0.28.0
This is the SDK for all ec.APIs by entrecode. By entrecode.
Documentation can be found here. If you like to see some code look here.
In order to use this SDK you should be familiar with ec.APIs and the concepts behind those. Please refer to the official documentation to get a basic understanding. The documentation you are reading now will first introduce the basic concept when using the SDK. Secondly it is the complete API documentation for ec.sdk.
For every ec.API you will find an API connector. Use one of those to connect to a certain ec.API. Login and logout for ec.users are special cases and are done in Session API connector. All API connectors of a certain environment share some information. The most important one is any access token either received with Session#login or by calling Core#setToken. This means you can specifiy the token on any API connector and it will be automatically used by all other API connectors. Also it will be saved in a cookie with the name <environment>Token
. If any API connector receives a token related Error (Problem) it will be automatically removed from all API connectors and a logout event is triggered. A special case is PublicAPI since this will store the token in a cookie containing the environment and Data Manager shortID of the PublicAPI (for example: stagebeefbeefToken
).
Since version 0.13.0 you can create a stand-alone API Connector. By calling the constructor with new Session({ noCookie: true });
the API Connector won't share its token with other API Connectors.
Every action you take in the ec.sdk will be validated before it will be sent as a request to ec.APIs. This means that the provided json schemas are used.
Add the following in your webpack.config.js.
Then you can start coding:
Require statements are different on node. Also, you probably don't want to share tokens in a node.js environment. You'll need to use noCookie
or namespacing via cookieModifier
.
This is not officially supported. Mainly exists for usage in jsfiddles or similar.
Here are two notes on developing ec.sdk:
npm run release <semver-version>
– This will build docs and changelog etc, npm publish
is handled by travis.This is a quick cheatsheet with the most needed snippets to get started with the PublicAPI.
NodeJS / ec-user-token:
Frontend / public:
Always recommended: size
and _fields
.
Properties:
Get single entry:
Async Iterator Functions:
Keep in mind that you should sort the entryList after something that does not change, like created
Properties:
Saving/Deleting:
You can view an API connector as the entry point to an ec.api. Each connector is a class which must be instantiated with new
and an optional environment
. If no environment is specified the API connector will connect to live
or rather production. It is possible to have multiple API connectors for multiple environments.
The two API connectors Core and Session are special cases. Core is the API connector every other inherits from and contains functionality shared by all other API connectors. Session is only used for login and logout of ec.users. This will allow you to implement tree shaking into your build and only the parts which are used will be in your bundle.
Each API connector Class inherits directly from Core class. You cannot instantiate Core directly. Use one of the other API connectors instead.
(object)
Object with URLs for each environment (key: environment, value: url)
(any
= 'live'
)
(environment)
The environment to connect to
// will share token for 'userA'
const dmUserA = new DataManager({ environment: 'live', cookieModifier: 'userA' });
const apiUserA = new PublicAPI(shortID, { environment: 'live', cookieModifier: 'userA' }, true);
// will share token for 'userB'
const dmUserB = new DataManager({ environment: 'live', cookieModifier: 'userB' });
const apiUserB = new PublicAPI(shortID, { environment: 'live', cookieModifier: 'userB' }, true);
// will not share token and not save it in cookie as well
const dmStandAlone = new DataManager({ environment: 'live', noCookie: true });
Static function to globally enable history events. If you want to use history events please provide 'eventsource/lib/eventsource-polyfill' within your project.
(any)
import { PublicAPI } from 'ec.sdk';
import * as EventSource from 'eventsource/lib/eventsource-polyfill';
PublicAPI.enableHistoryEvents(EventSource);
…
Create a new Resource. Note: Not all relations will support this.
(string)
The shortened relation name
(object)
object representing the resource
(boolean
= false
)
override Resource creation with List creation.
Promise<Resource>
:
the newly created Resource
return accounts.create('client', {
clientID: 'myClient',
callbackURL: 'https://example.com/login',
config: {
tokenMethod: 'query',
},
})
.then(client => show(client));
Delete a single Resource identified by resourceID.
(string)
The shortened relation name
(string)
id of the Resource
(any
= {}
)
Promise<undefined>
:
resolves when Resource could be deleted
return accounts.deleteResource('account', me.accountID)
.then(()) => alert('Account deleted'));
Abstract interface
for PublicAPI#doRefreshToken. Exists until Accountserver has token refreshal of its own.
Returns a traverson request builder following the provided link. If the link is not present in the root resource it will try to reload the root resource. This is done since links can appear/disappear when login state changes.
(string)
The link to follow
Promise<any>
:
Promise resolving to traverson request builder
All API connectors have an underlying EventEmitter for emitting events. You can use this function for attaching an event listener. See EventEmitter for the events which will be emitted.
function myAlertFunc(string){
console.log(`A new token was received: ${string}`);
}
session.on('login', myAlertFunc);
session.login(email, password);
// "A new token was received: <aJwtToken>" will be logged
You can remove a previously attached listener from the underlying EventEmitter with this function.
boolean
:
whether or not the listener was removed
session.on('login', myAlertFunc);
session.login(email, password)
.then(token => { // myAlertFunc will be called with token
console.log(token);
session.removeListener('login', myAlertFunc);
// myAlertFunc will no longer be called.
});
Get a single Resource identified by resourceID.
(string)
The shortened relation name
(string)
id of the Resource
(any
= {}
)
Promise<Resource>
:
resolves to the Resource which should be loaded
return accounts.resource('account', me.accountID)
.then(account => show(account.email));
Load a ListResource of Resources filtered by the values specified by the options parameter.
(string)
The shortened relation name
(filterOptions?
= {}
)
the filter options
(object
= {}
)
additional template parameters to apply
Promise<ListResource>
:
resolves to resource list with applied filters
return accounts.resourceList('account', {
filter: {
created: {
from: new Date(new Date.getTime() - 600000).toISOString()),
},
},
})
.then(list => show(list))
If you have an existing access token you can use it by calling this function. All subsequent requests will use the provided Json Web Token with an Authorization header.
Core
:
this for chainability
return accounts.me(); // will result in error
accounts.setToken('aJwtToken');
return accounts.mes(); // will resolve
If you have an existing refresh token you can use it by calling this function. It will be used to get a new token when time comes.
(string)
the existing token
Core
:
this for chainability
return accounts.me(); // will result in error
accounts.setToken('aJwtToken');
accounts.setRefreshToken('anotherJwtToken');
return accounts.me(); // will resolve
If you want to add additional information to the user agent used by ec.sdk you can use this function to add any string.
(string)
the user agent to add
Core
:
this for chainability
accounts.setUserAgent('editor/0.15.3 (a comment)');
// all subsequent requests will use x-user-agent: editor/0.15.3 (a comment) ec.sdk/<version>
Set the global locale for error output. 'de' and 'en' are available.
(any
= 'en'
)
This API connector can be used for login or logout into ec.apis. Login state will be avaliable to all other API connectors of the same environment.
Extends Core_1.default
(any)
(environment?)
the environment to connect to
const session = new Session();
return session.login(email, password)
.then(() => {
const accounts = new Accounts();
return accounts.me();
});
Queries the current users permission trie for granted permissions. See shiro-trie.
(string)
the permission string to be queried
API connector for Accounts API. Use this for ec.accounts only. It contains APIs for profile editing (change email, reset password, signup…), permissions, clients, and groups.
Extends Core_1.default
(any)
const accounts = new Accounts();
return accounts.me()
.then((me) => {
return me.checkPemission('dm-create');
})
.then((allowed) => {
if(!allowed){
return showError();
}
return createDM(…);
};
Get a single AccountResource identified by accountID.
(string)
id of the Account
Promise<AccountResource>
:
resolves to the Account which should be loaded
return accounts.account(accountList.getFirstItem().accountID)
.then(account => show(account.email));
Load a AccountList of AccountResources filtered by the values specified by the options parameter.
(filterOptions?)
the filter options
Promise<AccountList>
:
resolves to account list with applied filters
return accounts.accountList({
filter: {
created: {
from: new Date(new Date.getTime() - 600000).toISOString()),
},
},
})
.then(list => show(list))
Load a single ClientResource.
(string)
the clientID
Promise<ClientResource>
:
Promise resolving to ClientResource
return accounts.client('thisOne')
.then(client => show(client));
Load the ClientList filtered by the values specified by the options parameter.
(filterOptions?)
filter options
Promise<ClientList>
:
Promise resolving to ClientList
return accounts.clientList({
filter: {
callbackURL: 'thisOne', // the same as 'callbackURL: { exact: 'thisOne' }'
},
})
.then(clients => show(clients.getFirstItem()));
Creates a new API token with 100 years validity (or how long you want).
(apiTokenOptions?
= {}
)
Name | Description |
---|---|
options.name any
|
|
options.validUntil any
|
|
options.permissions any
|
|
options.groups any
|
Promise<{jwt: string, accountID: string, iat: number, exp: number}>
:
the created api
token response.
return accounts.createAPIToken({ // all options are optional
name: 'my-api-key', // PLEASE use a good identifier for the account
validUntil: 1440, // token validity in minutes, leave blank for "distant future" (1440 = 24h)
permissions: ['my:permission-string'], // directly attach permission. You need the right to do that!
groups: [{ groupID: '...' }], // directly add account to group. You need the right to do that!
})
.then(({ jwt, accountID, iat, exp}) => {
// do something with `jwt` because it is not accessable later
});
Create a new Client.
(object)
object representing the client
Promise<ClientResource>
:
the newly created ClientResource
const accounts = new Accounts();
const publicClient = await accounts.createClient({
clientID: 'my-public-client',
clientName: 'A public client for web applications',
grantTypes: ['authorization_code', 'refresh_token'],
tokenEndpointAuthMethod: 'none',
redirectURIs: ['https://my.app.com/redirect'],
postLogoutRedirectURIs: ['https://my.app.com/logout'],
authUIOrigin: 'https://login.entrecode.de',
logoURI: 'https://entrecode.de/de/assets/ec-logo.svg'
});
const confidentialClient = await accounts.createClient({
clientID: 'my-private-client',
clientName: 'A confidential client for server side applications',
grantTypes: ['authorization_code', 'refresh_token'],
tokenEndpointAuthMethod: 'client_secret_basic',
clientSecret: 'my-secret',
redirectURIs: ['https://my.app.com/redirect'],
postLogoutRedirectURIs: ['https://my.app.com/logout'],
authUIOrigin: 'https://login.entrecode.de',
logoURI: 'https://entrecode.de/de/assets/ec-logo.svg'
});
const apiClient = await accounts.createClient({
clientID: 'my-api-client',
clientName: 'A client for API access',
grantTypes: ['client_credentials'],
tokenEndpointAuthMethod: 'client_secret_basic',
clientSecret: 'my-secret',
});
Create a new Group.
(object)
object representing the group
Promise<GroupResource>
:
the newly created GroupResource
Create new invites. Specify number of invites to create with options.count
, permissions with options.permissions
or options.groups[]
.
Promise<InviteList>
:
Promise resolving to the InviteList
Will check if the given email is available for login.
(string)
the email to check.
Promise<boolean>
:
Whether or not the email is available.
return accounts.emailAvailable(email)
.then((available) => {
if (!available){
return showError(new Error(`Email ${email} not available.`));
}
return accounts.signup(email, password);
});
Load a single group.
(string)
the id of the group
Promise<GroupResource>
:
Promise resolving to the group
return accounts.group(groupID)
.then((group) => {
group.addPermission('can-view-stacktrace');
return group.save();
});
Load the GroupList filtered by the values specified by the options parameter.
(filterOptions?)
filter options
Promise<GroupList>
:
Promise resolving group list
return accounts.groupList({
filter: {
title: {
search: 'dev',
},
},
})
.then(groups => {
// all groups with 'dev' in the title
return show(groups.getAllItems());
});
Get InvalidPermissionsResource to show all invalid permissions.
Promise<InvalidPermissionsResource>
:
Promise resolving to invalid permissions
return accounts.invalidPermissions()
.then((invalidPermissions) => Promise.all([
show(invalidPermissions.invalidAccountPermissions),
show(invalidPermissions.invalidGroupPermissions),
]));
Load a single InviteResource. Only unused invites are returned.
(string)
invite uuid to request
Promise<InviteResource>
:
the requested
InviteResource
Load the list of InviteResources. Only unused invites are in the list.
(filterOptions)
filter options you want to have applied
Promise<InviteList>
:
the requested
InviteList
.
Get the AccountResource which is currently logged in.
Promise<AccountResource>
:
resolves to the Account which is logged in.
return accounts.me()
.then((account) => {
return show(`Your are logged in as ${account.name || account.email}`);
});
Signup a new account. Invite may be required.
(string)
email for the new account
(string)
password for the new account
(string?)
optional invite. Signup can be declined without invite
Promise<string>
:
Promise resolving the token
return accounts.signup(email, password, invite)
.then((token) => {
accounts.setToken(token);
return show('Successfully registered account');
});
This API connector can be used for Appserver APIs. It contains APIs for Apps, Platforms, Plugins, Builds and Deployments.
Extends Core_1.default
(any)
(environment?)
the environment to connect to
Get a single AppResource identified by appID.
(string)
id of the app
Promise<AppResource>
:
resolves to the app which should be loaded
return apps.app(deleteThisID)
.then(app => app.del());
Load a AppList of AppResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options
Promise<AppList>
:
resolves to app list with applied filters
return apps.appList()
.then(list => list.map((app) => {
app.name = 'haha all your apps are named the same';
return app.save();
}));
Create a new App
(object)
object representing the app
Promise<AppResource>
:
the newly created AppResource
return apps.create({
title: 'my new app',
hexColor: '#ffffff',
})
.then(app => show(app));
Load a single AppStatsResource.
(string)
the appID
Promise<AppStatsResource>
:
Promise resolving to AppStatsResource
return dm.stats(app.appID)
.then(stats => show(stats));
Load the AppStatsList.
Promise<AppStatsList>
:
Promise resolving to AppStatsList
return apps.statsList()
.then(stats => show(stats.getAllItems()));
Load the TypesResource. This resource contains information about all available plugin types.
Promise<TypesResource>
:
Promise resolving to TypesResource
API connector for DataManager API. It contains APIs for DataManagers, Models, Fields, Hooks, and Policies.
Extends Core_1.default
(any)
(environment?)
the environment to connect to
Create a new DataManager.
(object)
object representing the datamanager
Promise<DataManagerResource>
:
the newly created DataManagerResource
return dm.create({ title: 'my new dm' })
.then(dm => createRequiredModelsFor(dm));
Create a new template.
(object)
object representing the template
Promise<TemplateResource>
:
the newly created TemplateResource
return dm.createTemplate({
collection: {…},
dataSchema: {…},
})
.then(template => template.createDM())
.then(dm => show(dm));
Get a single DataManagerResource identified by dataManagerID.
(string)
id of the DataManager
Promise<DataManagerResource>
:
resolves to the DataManager which should be loaded
return dm.dataManager(myDmID)
.then(dm => dm.del());
Load a DataManagerList of DataManagerResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options
Promise<DataManagerList>
:
resolves to datamanager list with applied filters
Load the HistoryEvents for this DataManager from v3 API. Note: This Request only has pagination when you load a single modelID.
((filterOptions | any))
The filter options
Load a single DMStatsResource.
(string)
the dataManagerID
Promise<DMStatsResource>
:
Promise resolving to DMStatsResource
return dm.stats(myDM.dataManagerID)
.then(stats => show(stats));
Load the DMStatsList.
Promise<TemplateList>
:
Promise resolving to DMStatsList
return dm.statsList()
.then(templates => show(templates.getAllItems()));
Load a single TemplateResource.
(string)
the templateID
Promise<TemplateResource>
:
Promise resolving to TemplateResource
return dm.template('thisOne')
.then(template => {
const data = createRandomDataFromSchema(template.dataSchema);
return template.creatDM(data);
});
Load the TemplateList.
(filterOptions?)
filter options
Promise<TemplateList>
:
Promise resolving to TemplateList
return dm.template({
filter: {
name: {
search: 'clubapp',
},
},
sort: ['-version'],
size: 2,
})
.then(templates => );
API connector for public APIs. This is the successor of ec.datamanager.js.
When instantiating this as an ecUser please set the ecUser flag to true. This will use the
tokenStore for ecUsers and not the ones for each Data Manager. If you don't do this you must set
the token with publicAPI.setToken(session.getToken());
.
Extends Core_1.default
(string)
shortID or dataManagerID of the desired DataManager or url in old sdk like syntax.
(any
= 'live'
)
(boolean?
= false
)
if you are an ecUser it is best to set this to true
((environment | envOptions?))
the environment to connect to, ignored when url is passed to
idOrUrl.
(object)
: The current logged in account if it is a public user
(object)
: The public config of the connected Data Manager
(string)
: unshortened dataManagerID
(string)
: default locale
(string)
: description of the connected Data Manager
(Array<any>)
: array of all models in the connected Data Manager
(string)
: shortened dataManagerID
(string)
: title of the connected Data Manager
// node usage:
const { PublicAPI } = require('ec.sdk');
const api = new PublicAPI('beefbeef', { environment: 'live', noCookie: true }, true); // for ec user
// or
const api = new PublicAPI('9062c09a-c2a2-40dd-b1cf-332f497f9bde'); // with UUID as well
api.setToken(config.accessToken);
// frontend usage with session:
const session new Session();
let api = new PublicAPI('beefbeef', 'live', true);
// same as
api = new PublicAPI('https://datamanager.entrecode.de/api/beefbeef', 'willBeIgnored', true);
session.setClientID('rest');
return session.login('me@entrecode.de', 'letmein')
.then(() =>
api.entryList('muffins', { awesome: true })
.then(list => list.map((entry) => {
if(isNoLongerAwesome(entry)){
entry.awesome = false;
}
if(!entry.isDirty){
return entry;
}
return entry.save();
}));
Load a single PublicAssetResource.
(string)
the assetID
Promise<PublicAssetResource>
:
Promise resolving to PublicAssetResource
return api.asset(thisOne)
.then(asset => show(asset));
Load the PublicAssetList.
(filterOptions?)
filter options
Promise<PublicAssetList>
:
Promise resolving to PublicAssetList
return api.assetList({ filter: { type: 'image'} })
.then(assets => assets.getAllItems().find(asset => asset.title.toLowerCase() === 'favicon' ))
.then(asset => show(asset));
Checks a permission for the currently logged in public user. ec.users check their permission with Session#checkPermission.
(string)
the permission to check
(boolean
= false
)
whether or not it should use a cached response
Promise<boolean>
:
true if user has permission, false otherwise
Programatically signup a user, mostly used for special register flows using legacy users or magic link login.
(any)
Promise<{accountID: string, email: string, hasPassword: boolean, pending: boolean}>
:
Promise resolving to the created account
const createdAccount = await api.configurableSignup({
email: 'test@entrecode.de',
password: 'CorrectHorseBatteryStaple', // optional
invite: null, // optional
pending: true, // optional
sendWelcomeMail: false, // optional
anonymousToken: 'eyasldfaslfkelaewjflejf...', // optional
});
const { accountID, email, hasPassword, pending } = createdAccount;
Programatically complete a signup with a single use validationToken, mostly used for special register flows using legacy users or magic link login.
(any)
Creates a new anonymous account.
(Date?)
valid until date
Promise<{jwt: string, accountID: string, iat: number, exp: number}>
:
the created api
token
return api.createAnonymous()
.then(token => yourFancySaveFkt(token));
Create a new asset. This should handle various input types.
The most basic type is a string representing a file path, this can be used on node projects. Another option for node is providing a Buffer object (eg. fs.readFile, …). When providing a Buffer you must specify 'fileName' in options object.
For frontend usage you musst provide a FormData object containing the file in a field with the name 'file'.
(object
= {}
)
options for creating an asset.
Promise<function<Promise<PublicAssetResource>>>
:
Promise resolving to a Promise
factory which then resolves to the newly created PublicAssetResource
Create a legacy asset. This should handle various input types.
The most basic type is an array of strings representing a file paths, this can be used on node projects. Another option for node is providing an array of Buffer objects (eg. fs.readFile, …). When providing a Buffer you must specify 'fileName' in options object.
For frontend usage you musst provide a FormData object containing the multiple files in a field with the name 'file'.
(object
= {}
)
options for creating an asset.
Promise<function<Promise<AssetList>>>
:
Promise resolving to a Promise
factory which then resolves to the newly created assets as AssetList
Create one or multiple new assets. This should handle various input types.
The most basic type is a string representing a file path, this can be used on node projects. Another option for node is providing a Buffer object (eg. fs.readFile, …). When providing a Buffer you must specify 'fileName' in options object.
For frontend usage you must provide a FormData object containing the multiple files in a field with the name 'file'.
In both cases you can add a string representing an url. DataManager will then create the assets from this url.
(string)
the asset group in which the asset should be created.
(fileOptions
= {}
)
options for creating an asset.
Promise<function<Promise<DMAssetList>>>
:
Promise resolving to a Promise
factory which then resolves to the newly created assets as DMAssetList
const createdAssets = await api.createDMAssets(
'myAssetGroup',
['/path/to/file1', '/path/to/file2'],
{
fileName: ['filename1.png', 'filename2.png'], // omit for default filenames
deduplicate: true, // you'll get back existing assets if duplicates exist
defaultVariants: [ 256 ], // will generate a 256px-variant right away instead of on first request. Only use if needed!
}
);
Create a new entry.
(string)
name of the model for which the list should be loaded
(object)
object representing the entry.
(number)
levels parameter to have them returned
Promise<EntryResource>
:
the newly created EntryResource
Delete a single EntryResource.
Promise<undefined>
:
Promise resolving when Entry got deleted
return api.deleteEntry('myModel', '1234567')
.then(()) => alert('Entry deleted'));
Load a single DMAssetResource.
Promise<DMAssetResource>
:
Promise resolving to DMAssetResource
return api.dmAsset(thisOne)
.then(asset => show(asset));
Delete a single DMAssetResource.
Promise<undefined>
:
Promise resolving when entry is deleted
return api.deleteDmAsset(thisOne)
.then(() => alert('Asset deleted'));
Load the DMAssetList.
(any)
(filterOptions?)
filter options
Promise<DMAssetList>
:
Promise resolving to DMAssetList
return api.dmAssetList('public', { filter: { type: 'image'} })
.then(assets => assets.getAllItems().find(asset => asset.title.toLowerCase() === 'favicon' ))
.then(asset => show(asset));
When the logged in user has a refresh token this function will do the token refresh. On successful
refreshal PublicAPI will emmit the event refresh
, if it failes it will emmit refreshError
. You
MUST handle these events.
Will check if the given email is available for login.
(string)
the email to check.
Promise<boolean>
:
Whether or not the email is available.
return api.emailAvailable(email)
.then((available) => {
if (available){
return api.signup(email, password);
} else {
return showError(new Error(`Email ${email} already registered.`));
}
});
Load a single EntryResource.
(string)
name of the model for which the list should be loaded
((string | filterOptions))
the entry id
Promise<EntryResource>
:
Promise resolving to EntryResource
return api.entry('myModel', '1234567')
.then(entry => {
return show(entry);
});
// since 0.17.10
const entry = await api.entry('myModel', { urltitle: 'this-is-unique' });
await show(entry);
Load the EntryList.
(string)
name of the model for which the list should be loaded
(filterOptions?)
filter options
Promise<EntryList>
:
Promise resolving to EntryList
return api.entryList('myModel')
.then(list => {
return list.getAllItems().find(entry => entry.id === '1234567');
})
.then(entry => {
return show(entry);
});
Load the HistoryEvents for this DataManager from v3 API. Note: This Request only has pagination when you load a single modelID.
((filterOptions | any))
The filter options
Generic file helper for images and thumbnails.
(string)
assetID of the file requested. Can be legacy Asset (uuid v4) or
AssetNeue.
(boolean
= false
)
true when image should be a thumbnail
(number?)
the minimum size of the image
(imageType?)
the format of the image
Promise<string>
:
the url string of the requested image
Create a single-use validation token for a user. The token should then be send to the user via mail and MUST NOT be displayed to her.
Create validation tokens for a user to change the email address. The tokens should then be send to the old and new email address and MUST NOT be displayed to the user. Validating with the new address updates the email. Aborting via the old email address resets to the old address and invalidates the token to change it.
Promise<{verifyEmailChangeToken: string, abortEmailChangeToken: string}>
:
Promise resolving to the two tokens for old and new email address
Validate and perform a email change request. Depending on the token type (changeEmail
or revokeEmail
), the email address is changed or reset to the old address (with invalidation of the changeEmail
-Token).
(string)
The change or revoke token
Promise<{accountID: string, email: string, hasPassword: boolean, pending: boolean}>
:
Promise resolving to account info including potentially changed email address
Call PublicAPI#refCount with model, field and desired ids to get a simple object with ref counts.
(string)
Model for which you want a ref count
(string)
Field for which you want a ref count
object
:
Returns an object with entryID keys and number values
const counts = await api.refCount('myModel', 'myField', [entryID1, entryID2, ...entryIDn]);
alert(`Entry ${entryID1} has ${counts[entryID1]} references`);
Signup a new account. Invite may be required.
(string)
email for the new account
(string)
password for the new account
(string?)
optional invite. signup can be declined without invite.
return api.signup(email, password, invite)
.then((tokenResponse) => {
api.setToken(tokenResponse.access_token);
return show('Successfully registered account');
});
Load a single PublicTagResource.
(string)
the tag
Promise<PublicTagResource>
:
Promise resolving to PublicTagResource
return assetList.tag('thisOne')
.then(tag => {
return show(tag);
});
Load the PublicTagList.
(filterOptions?)
filter options
Promise<PublicTagList>
:
Promise resolving to PublicTagList
return assetList.tagList()
.then(tags => {
return tags.getAllItems().filter(tags => tag.tag === 'thisOne');
})
.then(tagsArray => {
return show(tagsArray[0]);
});
// This would actually be better:
return dm.tagList({
filter: {
assetID: 'thisOne',
},
})
.then(tags => {
return show(tags.getFirstItem());
});
Load the active sessions for the current user - the DMAuthTokenList.
(filterOptions?)
filter options
Promise<DMAuthTokenList>
:
Promise resolving to DMAuthTokenList
const tokenList = await dm.tokenList();
await tokenList.map((token) => {
// delete all sessions that are not the active one
if (!token.isCurrent) {
await token.delete();
}
});
Validates a single-use token from a user. Checks if the token is valid and responds with user information.
Call PublicAPI#valueCount with model and field to get a simple array with value counts.
(string)
Model for which you want a ref count
(string)
Field for which you want a ref count
Array<object>
:
Returns an array with values an their counts.
const values = await api.valueCount('myModel', 'myField');
alert(`Values are: ${values.map(x => `Value: ${x.value} (${x.count})`).join(', ')}`);
You can define which API should be used with the environment parameter. Internally this is also used as key to store tokens into cookies (for browsers).
Valid value is one of live
, stage
, nightly
, or develop
.
Type:
("live"
| "stage"
| "nightly"
| "develop"
)
// will connect to production https://editor.entrecode.de
const session = new Session('live');
// will connect to cachena https://editor.cachena.entrecode.de
const accounts = new Accounts('stage');
// will connect to buffalo https://editor.buffalo.entrecode.de
const dataManager = new DataManager('nightly');
// will connect to your local instances, well maybe
const accounts = new Accounts('develop');
In node context it is advised to configure token handling more specifically. Normally ec.sdk will share a given token with other API Connectors (see Core), in most cases this is not desired in node scripts. By providing an options object instead of an environment string when creating the API Conenctor you can overwrite the handling.
Type: Object
(environment)
: The environment for the API Connector
(boolean)
: True if you want to token-handling disabled (will overwrite Tokenstore name with random string)
(string)
: Define a string for sharing multiple tokens.
(boolean)
: True if the user is a ecUser. PublicAPI API Connectors will share across all shortIDs.
// will not share any token with other API connectors (token name is appended with a generated shortID)
new PublicAPI('beefbeef', { noCookie: true });
// will share token with all `userA` PublicAPI Connectors for 'beefbeef'
new PublicAPI('beefbeef', { cookieModifier: 'userA' });
// will share token with all `userA` API Connectors, even DataManager and so on
new PublicAPI('beefbeef', { cookieModifier: 'userA', ecUser: true });
// same
new PublicAPI('beefbeef', { cookieModifier: 'userA' }, true);
// will share token with all PublicAPI Connectors for 'beefbeef'
new PublicAPI('beefbeef')
// will share token with all API connectors
new PublicAPI('beefbeef', { ecUser: true });
// same
new PublicAPI('beefbeef', 'live', true);
When creating assets, you can provide some options like fileName and others. These are directly mapped to DataManager options in the create Asset route. Use them to influence fileNames, duplicate handling and generation of default image variants.
Type: Object
((string | Array<string>))
: By default, a filename is generated using the original file's filename. Use this property to overwrite the filename – even sub-paths are possible this way. File extension has to be included, if desired. String Array if you upload multiple files at once.
(boolean?)
: set to
false
if you want a randomly generated filename. This way it is safe to set
includeAssetIDInPath
to
false
and get shorter URLs.
(boolean?)
: set to
false
if you want shorter URls. If you have a conflicting filename, you'll get an error. Should therefore usually have the same value as
preserveFilenames
.
(boolean?)
: set to
true
to get back an already uploaded duplicate asset instead of an error, when the file already exists.
(boolean?)
: use if you don't want deduplication and you don't want to trigger an error if the file already exists. Normally it is better to just use the
deduplicate
flag instead.
const assetList = await api.createDMAsset('myFiles', filePath, { deduplicate: true });
Collection of all models and their fields
Type: Object
(field)
Collection of all fields and their fieldDefinition
Type: Object
(fieldDefinition)
A field definitions is the public version of model field config with field specific configs used in ec.forms.
Type: Object
Whenever the ec.sdk receives an Error from any ec.API it will create not only an Error object but a Problem. Problems will contain the error codes from ec.APIs and all other information of the error. See below for a detailed description for Problems.
Amongst other all Erors or Problems are emitted as events in every API connector. You can subscribe to error events with Core#on. Additionally to error events there are also events for login and logout. Below you will find a description for each event type.
Class representing Errors sent by all entrecode APIs. Complies to {@link https://tools.ietf.org/html/draft-nottingham-http-problem-07 Problem Details for HTTP APIs}. Problems also comply to {@link https://tools.ietf.org/html/draft-kelly-json-hal-08 HAL resources} but this class won't include any special hal implementation (like getEmbedded or getLinks).
Extends Error
(object)
the error received from any entrecode API.
(any
= 'en'
)
Login event is emitted when a login succeeds with Session#login, PublicAPI#login, or PublicAPI#loginWithCode.
Logout event is emitted either on a successful logout with Session#logout or PublicAPI#logout or an API error with token related error codes. Will either have undefined or Problem as event parameter.
Signup event is emitted when a login succeeds with PublicAPI#signup.
Error events are emitted whenever an API responds with an Error or Problem.
Refresh event is emitted when a token is automatically refreshed.
Refresh error event is emitted when a token is automatically refreshed.
Type: Problem
All resources used by ec.APIs and ec.sdk are HAL resources (Content-Type: application/hal+json). A HAL resources define the resources itself and relations to other resources.
Take a look at the API state digrams of ec.APIs for an overview of all relations and how they are connected (Accounts, AppManager, and DataManager). You can keep the state diagrams in mind since they tell you where to find any functionality inside ec.sdk. API connectors are the entry points, resources are – well – resources, and relations resemble the functions of them.
In the next section you will find the description of Resource and ListResource at the top. They define functionality all other resources. Like Resource#save or functions for pagination. Following those are the documentation of resources for any individual ec.APIs.
All resources which are from a specialized type (eg.: DataManagerResource) will contain properties with getter and setter implementations. So calling dataManager.title = 'new title'
will change the title and mark the resource dirty (Resource#isDirty). Calling Resource#save would then save the resource with the ec.API.
Generic resource class. Represents {@link https://tools.ietf.org/html/draft-kelly-json-hal-08 HAL resources}.
(object)
resource loaded from the API.
(environment
= 'live'
)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(any)
(any)
(boolean)
: Whether or not this Resource was modified
Create a new Resource. Note: Not all relations will support this.
(string)
The shortened relation name
(object)
object representing the resource
(any
= false
)
Promise<Resource>
:
the newly created Resource
return accounts.create('client', {
clientID: 'myClient',
callbackURL: 'https://example.com/login',
config: {
tokenMethod: 'query',
},
})
.then(client => show(client));
alias for Resource#del()
Loads the given link and returns a Resource with the loaded result.
Promise<(Resource | ResourceClass)>
:
the resource identified by the link.
Returns a traverson request builder following the provided link.
Promise<any>
:
Promise resolving to traverson request builder
Reset this Resource to its initial state. Resource#isDirty will be false afterwards.
undefined
:
Get a single Resource identified by resourceID.
(string)
The shortened relation name
(string)
id of the Resource
(any
= {}
)
Promise<Resource>
:
resolves to the Resource which should be loaded
return accounts.resource('account', me.accountID)
.then(account => show(account.email));
Load a ListResource of Resources filtered by the values specified by the options parameter.
(string)
The shortened relation name
(filterOptions?
= {}
)
the filter options
(object
= {}
)
additional template parameters to apply
Promise<ListResource>
:
resolves to resource list with applied filters
return accounts.resourceList('account', {
filter: {
created: {
from: new Date(new Date.getTime() - 600000).toISOString()),
},
},
})
.then(list => show(list))
Saves this Resource.
(boolean
= false
)
true when safe put functionality is required.
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<Resource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
Generic list resource class. Represents {@link https://tools.ietf.org/html/draft-kelly-json-hal-08 HAL resources} with added support for lists.
Since version 0.8.1 ListResources are iterable, so you can use spread operator or for … of loops with them.
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object)
traversal from which traverson can continue.
(string)
name of the embedded resources.
(object)
optional schema for list items
(ListResource
= ListResource
)
Class constructor for list types
(Resource
= Resource_1.default
)
Class constructor for item types
(number)
: the number of embedded items in this list
(number)
: the number of total items in this list
The filter() method creates a new array with all elements that pass the test implemented by the provided function. It will use ListResource#followNextLink. Keep in mind that altering the list within the map method is possible but can change the order of the list. E.g. do not use on lists sorted by modified and update the entries during the process.
(function)
function to test each element of the array. Return true to keep the
element, false otherwise.
(boolean
= false
)
boolean flag wheter or not to retry on failed requests
Promise
:
returns Promise resolving to the new array.
The find() method returns the first element that passes the test implemented by the provided function. It will use ListResource#followNextLink. Keep in mind that altering the list within the map method is possible but can change the order of the list. E.g. do not use on lists sorted by modified and update the entries during the process.
(function)
function to test each element of the array. Return true to keep the
element, false otherwise.
(boolean
= false
)
boolean flag wheter or not to retry on failed requests
Promise
:
returns Promise resolving to the new array.
Loads the first link and returns a ListResource with the loaded result.
Promise<(ListResource | ResourceClass)>
:
the resource identified by the link.
Loads the next link and returns a ListResource with the loaded result.
Promise<(ListResource | ResourceClass)>
:
the resource identified by the link.
Loads the prev link and returns a ListResource with the loaded result.
Promise<(ListResource | ResourceClass)>
:
the resource identified by the link.
Get all list items {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} into this ListResource.
Array<(Resource | ResourceClass)>
:
an array of all list items.
Get the first {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} item from the list
(Resource | ResourceClass)
:
the first item.
Get the n'th {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} item from the list
(number)
index of the item
(Resource | ResourceClass)
:
the requested item.
Checks if this Resource has at least one {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5 link} with the name 'first'.
boolean
:
whether or not a link with the name 'first' was found.
Checks if this Resource has at least one {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5 link} with the name 'next'.
boolean
:
whether or not a link with the name 'next' was found.
Checks if this Resource has at least one {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5 link} with the name 'prev'.
boolean
:
whether or not a link with the name 'prev' was found.
The map() method creates a new array with the results of calling a provided function on every item in this list. It will use ListResource#followNextLink. Keep in mind that altering the list within the map method is possible but can change the order of the list. E.g. do not use on lists sorted by modified and update the entries during the process.
(function)
function that produces an element of the new array.
(boolean
= false
)
boolean flag wheter or not to retry on failed requests
Promise
:
returns Promise resolving to the new array.
List filter options with pagination, sorting, and filter. This can be used to apply all sorts of filter to a list request.
Type: Object
(number)
(number)
(number)
(filter)
: This could be any field name of a model
accounts.accountList({ size: 25 }); // will result in a list with 25 entries
accounts.accountList({
sort: ['email', '-created'], // sorted by email asc and created desc
page: 3, // page 3 of a list with 10 entries
property: 'exactlyThis', // filter exactly exactlyThis for property property
});
// for filter see below
filterOptions can contain key value pairs with filter options for entry fields. These object will be applied when loading a ListResource.
Type: Object
((string | filterObject))
accounts.accountList({
email: {
search: 'andre', // email contains 'andre'
},
language: 'de', // language is exactly 'de'
active: {
exact: 'active', // is (exactly) in active state
},
created: {
from: new Date(new Date().getTime() - 60000), // created 10minutes or less ago
},
permissions: { // has at least one of these permissions
any: [
'dm-user',
'app-user',
],
},
});
Type: Object
HistoryEvents resource class
https://github.com/entrecode/ec.dm-history/blob/develop/data-transform.js#L35
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(any)
(number)
: Event count in this list
(number)
: Count of scanned objects
(Array<HistoryEvent>)
: array of HistoryEvent objects
Load the next page.
Promise<HistoryEvents>
:
Next page of HistoryEvents
HistoryEvent resource class
https://github.com/entrecode/ec.dm-history/blob/develop/data-transform.js#L35
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(string)
: the model this event belongs to
(string)
: data manager short id
(Date)
: time this event happened
(string)
: 'timestamp#entryID#randomNumber' the unique key from dynamodb
(object)
: data describing the event
(object)
: old data describing the event
(object)
: the user responsible for this event
(string)
: the entry this event belongs to
(string)
: type defining what happened
The following section describes resources of Accounts.
Account resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the Account
(string)
: The type of the account
(string)
: The current name.
(string)
: The current company.
(string)
: The current preferredUsername.
(string)
: The current givenName.
(string)
: The current middleName.
(string)
: The current familyName.
(string)
: The current nickname.
(Date)
: The current birthdate.
(string)
: The current gender (f|m|d)
(string)
: The current picture url
(string)
: The current phoneNumber
(boolean)
: Whether or not the phoneNumber is verified
(object)
: The current address
(string)
: The language for frontend usage
(string)
: The locale for frontend usage
(string)
: The zoneinfo for frontend usage
(string)
: State of the account.
(boolean)
: Whether or not this account has TOTP enabled
(number)
: Number of fallback codes this account has
(boolean)
: Whether or not this account requires MFA
(boolean)
: Whether or not this account requires 2FA
(boolean)
: Whether or not this account has legacy login disabled
Adds a new permission to permissions array.
(string)
the permission to add.
AccountResource
:
this Resource for chainability
Adds new permissions to permissions array.
AccountResource
:
this Resource for chainability
Create an additional access token tokenResponse for this account. Only supported for API Keys.
Promise<{jwt: string, accountID: string, iat: number, exp: number}>
:
the created api
token response.
return account.createToken()
.then(({ jwt, accountID, iat, exp}) => {
// do something with `jwt` because it is not accessable later
});
Saves this AccountResource.
Promise<AccountResource>
:
Promise will resolve to the saved AccountResource. Will
be the same object but with refreshed data.
Account list resource class.
Extends ListResource_1.default
TokenResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Token list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
ClientResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the client
(string)
: The name of the client (human readable)
(("Public Client"
| "Private Client"
| "API Client"
| "Legacy Client"
| "Unknown Client"
))
: The type of the client, computed depending on settings
(Array<("authorization_code"
| "refresh_token"
| "client_credentials"
)>)
: The grant types of the client
(("client_secret_basic"
| "none"
))
: The token endpoint authentication method of the client
(string)
: The client secret - set only if grantTypes contains 'client_credentials'
(string)
: The auth UI origin of the client
(string)
: The logo URI of the client
(string)
: The legacy client callback URL
(clientConfig)
: The legacy client config
Configuration of a legacy client
Type: Object
Client list class
Extends ListResource_1.default
GroupResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the group
(string)
: The group name
(string)
: Domain from wich users in this group receive auth mails
(string)
: Priority of the custom auth domain
(Object)
: Group settings
Adds a new permission to permissions array.
(string)
the permission to add.
GroupResource
:
this Resource for chainability
Adds a new permissions to permissions array.
GroupResource
:
this Resource for chainability
Remove a single permission from this group.
(string)
the permission to remove
GroupResource
:
returns this group resource
Remove multiple permissions from this group.
GroupResource
:
returns this group resource
Add an account to this group.
You can add by accountID
or by email
.
Note that email addings are only validated after you called .save()
on your group.
GroupResource
:
returns this group resource
Replace all accounts in this GroupResource with a new array.
You can add by accountID
or by email
.
Note that email addings are only validated after you called .save()
on your group.
(any)
The array of accounts you want to contain in this group.
Remove an account from this group.
GroupResource
:
returns this group resource
GroupList list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Invite list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
InviteResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The invite
(array)
: Permissions added to the invite
(arry)
: Groups added to the invite
(string)
: The email address of the invite
(Date)
: The date the invite expires
Saves this InviteResource.
Promise<InviteResource>
:
Promise will resolve to the saved InviteResource. Will
be the same object but with refreshed data.
InvalidPermissionsResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(Array<Permission>)
: Array of invalid permissions linked to a
AccountResource
The following section describes resources of AppManager.
AppResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: ID
(string)
: shortened ID
(date)
: created date
(string)
: title
(string)
: color for frontend usage
Get a single CodeSourceResource identified by codeSourceID.
(string)
id of the app.
Promise<CodeSourceResource>
:
resolves to the codeSource which should be loaded.
Load a CodeSourceList of CodeSourceResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<CodeSourceList>
:
resolves to app list with applied filters.
Create a new codeSource.
(object)
object representing the codeSource.
Promise<CodeSourceResource>
:
the newly created CodeSourceResource
Create a new dataSource.
(object)
object representing the dataSource.
Promise<DataSourceResource>
:
the newly created DataSourceResource
Creates a new platform for this app. You will have to have a CodeSourceResource,
DataSourceResource, and one or more TargetResource. In the ec.API
this is
performed as a POST request containing the plugins as links in HALs _links
object - This is
also an option here. But for convenience you can put the Resources into the object directly.
See the example below for details.
(object)
platform to create
Promise<PlatformResource>
:
const platform = {
title: 'MyAwesomePlatform',
platformType: 'website',
config: {
// …
},
codeSource = codeSourceResource,
dataSource = dataSourceResource,
target = [targetResource1, targetResource2],
};
// this would be ok as well
const otherPlatform = {
title: 'MyAwesomePlatform',
platformType: 'website',
config: {
// …
},
_links: {
"ec:app/codesource": {
href: "…",
},
"ec:app/datasource": {
href: "…",
},
"ec:app/target": {
href: "…",
},
}
}
app.createPlatform(platform)
.then(platform => doSomethingWith(platform));
Create a new target.
(object)
object representing the target.
Promise<TargetResource>
:
the newly created TargetResource
Get a single CodeSourceResource identified by dataSourceID.
(string)
id of the app.
Promise<CodeSourceResource>
:
resolves to the dataSource which should be loaded.
Load a DataSourceList of CodeSourceResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<CodeSourceList>
:
resolves to app list with applied filters.
Get a single PlatformResource identified by platformID.
(string)
id of the app.
Promise<PlatformResource>
:
resolves to the platform which should be loaded.
Load a PlatformList of PlatformResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<PlatformList>
:
resolves to app list with applied filters.
Get a single TargetResource identified by targetID.
(string)
id of the app.
Promise<TargetResource>
:
resolves to the target which should be loaded.
Load a TargetList of TargetResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<TargetList>
:
resolves to app list with applied filters.
App list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
TypesResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
AppStatsResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
AppStats list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
PlatformResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: the id
(string)
: title
(any)
: additional config, see schema for format
(string)
: platform type
Use this helper function to add a single target.
((string | TargetResource))
The target you want to add.
Get a single BuildResource identified by buildID.
(string)
id of the build.
Promise<BuildResource>
:
resolves to the build which should be loaded.
Load a BuildList of BuildResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<BuildList>
:
resolves to app list with applied filters.
Start a new build for this platform.
(any)
(String)
: Comment to add to this Build.
Promise<BuildResource>
:
The created build, probably in running state.
Start a new deployment for this platform.
((string | TargetResource | TargetList | Array<(string | TargetResource)>))
targets
to which the build should be deployed.
((string | BuildResource | BuildList | Array<(string | BuildResource)>))
build which
should be deployed.
(string)
Comment to add to new Deployment.
Promise<DeploymentResource>
:
The created deployment, probably in running state.
Start a new deployment of the latest build for this platform.
((string | TargetResource | TargetList | Array<(string | TargetResource)>))
targets
to which the build should be deployed.
Promise<DeploymentResource>
:
The created deployment, probably in running state.
Get a single DeploymentResource identified by deploymentID.
(string)
id of the deployment.
Promise<DeploymentResource>
:
resolves to the deployment which should be loaded.
Load a DeploymentList of DeploymentResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<DeploymentList>
:
resolves to app list with applied filters.
Check if a given target is part of this platform.
((string | TargetResource))
Target you want to check.
boolean
:
Wether or not the target is contained in this platform.
Get the latest BuildResource identified by buildID.
(string)
id of the build.
Promise<BuildResource>
:
resolves to the build which should be loaded.
Get the latest DeploymentResource identified by deploymentID.
Promise<DeploymentResource>
:
resolves to the deployment which should be loaded.
Get the CodeSourceResource of this platform.
Promise<CodeSourceResource>
:
resolves to the codeSource
Get the DataSourceResource of this platform.
Promise<DataSourceResource>
:
resolves to the datasource
Get a TargetList of this platform with all assigned TargetResources.
Promise<TargetList>
:
resolves to the list of assigned targets
Use this helper function to remove a single target.
((string | TargetResource))
The target you want to remove.
Get the codeSource for this platform.
(any)
(string | CodeSourceResource)
:
The codeSource or codeSourceID
Get the dataSource for this platform.
(any)
(string | DataSourceResource)
:
The dataSource or dataSourceID
Set the targets for this platofrm.
(any)
Array<(string | TargetResource)>
:
The targetIDs or targets
Platform list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
CodeSourceResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
CodeSource list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
DataSourceResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
DataSource list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
TargetResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Target list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
BuildResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: the id
CodeSource list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
DeploymentResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: the id
CodeSource list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
The following section describes resources of DataManager.
DataManager resource class.
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the dataManager
(string)
: The templateID from which this dataManager was created
(object)
: The dataManager config
(Date)
: The Date this dataManager was created
(string)
: The description
(string)
: The hexColor for frontend usage
(string)
: Title of the dataManager
(string)
: Default locale for this dataManager
Get a single DMAccountResource identified by accountID.
(string)
id of the Account.
Promise<DMAccountResource>
:
resolves to the Account which should be loaded.
return dm.account(accountID)
.then((account) => {
return show(account.email);
});
Load a DMAccountList of DMAccountResource filtered by the values specified by the options parameter.
(filterOptions?)
the filter options.
Promise<DMAccountList>
:
resolves to account list with applied filters.
return dm.accountList({
created: {
from: new Date(new Date.getTime() - 600000).toISOString()),
},
})
.then((list) => {
return show(list);
})
Load a single AssetResource.
(string)
the assetID
Promise<AssetResource>
:
Promise resolving to AssetResource
return dm.asset('thisOne')
.then(asset => {
return show(asset);
});
Load a single AssetGroupResource.
(string)
the id
Promise<AssetGroupResource>
:
Promise resolving to AssetGroupResource
return dm.asset('thisOne')
.then(asset => {
return show(asset);
});
Load the AssetGroupList.
(filterOptions?
= {}
)
filter options
Promise<AssetGroupList>
:
Promise resolving to AssetGroupList
return dm.assetGroupList()
.then(groups => {
return groups.getAllItems().filter(group => group.public);
})
.then(groups => {
return show(groups);
});
Load the AssetList.
(filterOptions?)
filter options
Promise<AssetList>
:
Promise resolving to AssetList
return dm.assetList()
.then(assets => {
return assets.getAllItems().filter(asset => asset.assetID === 'thisOne');
})
.then(assetsArray => {
return show(assetsArray[0]);
});
// This would actually be better:
return dm.assetList({
filter: {
assetID: 'thisOne',
},
})
.then(assets => {
return show(assets.getFirstItem());
});
Load a single DMClientResource.
(string)
the clientID
Promise<DMClientResource>
:
Promise resolving to DMClientResource
return dm.client('thisOne')
.then(client => {
return show(client);
});
Load the DMClientList.
(filterOptions?)
filter options
Promise<DMClientList>
:
Promise resolving to DMClientList
return dm.clientList()
.then(clients => {
return clients.getAllItems().filter(client => client.clientID === 'thisOne');
})
.then(clientArray => {
return show(clientArray[0]);
});
// This would actually be better:
return dm.clientList({
filter: {
clientID: 'thisOne',
},
})
.then(clients => {
return show(clients.getFirstItem());
});
Create a new asset.
(object?
= {}
)
options for creating an asset.
Promise<Promise<AssetResource>>
:
the newly created AssetResource
Create a new asset group.
(object)
object representing the group.
Promise<AssetGroupResource>
:
the newly created AssetGroupResource
Create a new dm client.
(object)
object representing the client.
Promise<DMClientResource>
:
the newly created DMClientResource
Create a new model.
(object)
object representing the model.
Promise<ModelResource>
:
the newly created ModelResource
Create a new role.
(object)
object representing the role.
Promise<RoleResource>
:
the newly created RoleResouce
Get a single ModelResource identified by modelID.
(string)
id of the Model.
Promise<ModelResource>
:
resolves to the Model which should be loaded.
Load a ModelList of DataManagerResource filtered by the values specified by the options parameter.
(filterOptions?)
the
filter options.
Promise<ModelList>
:
resolves to model list with applied filters.
Load the HistoryEvents for this DataManager from v3 API. Note: This Request only has pagination when you load a single modelID.
((filterOptions | any))
The filter options
Load a single RoleResource.
(string)
the roleID
Promise<RoleResource>
:
Promise resolving to RoleResource
return dm.role('thisOne')
.then(role => {
return show(role);
});
Load the RoleList.
(filterOptions?)
filter options
Promise<RoleList>
:
Promise resolving to RoleList
return dm.roleList()
.then(roles => {
return roles.getAllItems().filter(client => client.clientID === 'thisOne');
})
.then(roleArray => {
return show(roleArray[0]);
});
// This would actually be better:
return dm.roleList({
filter: {
roleID: 'thisOne',
},
})
.then(roles => {
return show(roles.getFirstItem());
});
Load a single DMStatsResource.
Promise<DMStatsResource>
:
Promise resolving to DMStatsResource
return dm.stats('id')
.then(stats => {
return show(stats);
});
DataManager list resource class.
Extends ListResource_1.default
Model resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this Model
(Date)
: The Date on which this Model was created
(string)
: optional description
(boolean)
: Whether or not this Model has Entries
(string)
: The hexColor for frontend usage
(Date)
: The Date this Model was modified last
(string)
: Model title
(string)
: the field to used as a title for Entries
(any)
: the config for this model
Load the HistoryEvents for this Model from v3 API.
((filterOptions | any))
The filter options
Saves this Resource.
(boolean
= false
)
true when safe put functionality is required.
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<Resource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
Model list resource class.
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Object describing all properties of fields.
Type: Object
(string)
(string)
(string)
(boolean)
(boolean)
(boolean)
(boolean)
(boolean)
{
"method": "put",
"restrictToFields": ["editableField"],
"public": false,
"roles": ["anonymous"],
"conditions": [
{
"field": "_creator",
"operator": "=",
"variable": "accountID"
},
"or",
{
"field": "public",
"operator": "=",
"constant":true
}
]
}
Policy object
Type: Object
Single condition object.
Type: Object
Multiple conditions can be used by putting them into an array.
Type: (condition | Array<(condition | conditions | string)>)
Single hook object.
Type: Object
DM Account resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the Account
(string)
: The current email.
(boolean)
: Whether or not this account has a password
(boolean)
: wheter or not this account is in pending state
(boolean)
: wheter or not this account is blocked
(Date)
: Date on which pending state got updated
(Date)
: Date on which this account was created
(Array<LiteRoleResource>)
: Roles this account is member of
Load the active sessions for this acccount - the DMAuthTokenList.
(filterOptions?)
filter options
Promise<DMAuthTokenList>
:
Promise resolving to DMAuthTokenList
const tokenList = await account.tokenList();
await tokenList.map((token) => {
console.log(`${token.created}: ${token.device} (${token.near})`);
});
Account list resource class.
Extends ListResource_1.default
DMAuthToken resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Tag list resource class.
Extends ListResource_1.default
DMClientResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Client list class
Extends ListResource_1.default
Role resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the role
(string)
: The name of the role
(string)
: A label for the role
(number)
: Number of accounts in this role
(boolean)
: Whether or not to add unregistered users to this role
(boolean)
: Whether or not to add registered users to this role
(array<LiteDMAccountResource>)
: array of accountIDs associated to this role
Load the DMAccountList of DMAccountResource for this role.
(filterOptions?)
the filter options.
Promise<DMAccountList>
:
resolves to account list with applied filters.
return role.accountList({
created: {
from: new Date(new Date.getTime() - 600000).toISOString()),
},
})
.then((list) => {
return show(list);
})
Client list class
Extends ListResource_1.default
Template resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of the template
(string)
: The name of the template
(object)
: Postman collection
(object)
: JSON schema for collection data
(string)
: version of the template
Create new DataManager from this template.
(object)
body parameters for creating the DataManager
Promise<DataManagerResource>
:
The newly created DataManager.
Update existing DataManager from this template.
(string)
The DataManager to update.
Promise<DataManagerResource>
:
The updated DataManager.
Template list class
Extends ListResource_1.default
DMStatsResource class
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
DMStats list class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Get all list items {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} into this ListResource.
Array<(Resource | ResourceClass)>
:
an array of all list items.
Get the first {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} item from the list
(Resource | ResourceClass)
:
the first item.
AssetGroupResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this asset group
(boolean)
: Wether or not these assets are public
(object)
: Settings for this asset group
Load a single DMAssetResource.
(string)
the id
Promise<DMAssetResource>
:
Promise resolving to DMAssetResource
Load the DMAssetList.
(filterOptions?
= {}
)
filter options
Promise<DMAssetList>
:
Promise resolving to DMAssetList
AssetGroup list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
AssetResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this asset
(string)
: The title of this asset
(Date)
: Timestamp when this asset was created
(string)
: type of this asset, like image
Asset list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Load a single deleted AssetResource.
(string)
the assetID
Promise<DeletedAssetResource>
:
Promise resolving to AssetResource
return assetList.deletedAsset('thisOne')
.then(asset => {
return show(asset);
});
Load the DeletedAssetList.
(filterOptions?)
filter options
Promise<DeletedAssetList>
:
Promise resolving to AssetList
return assetList.deletedAssetList()
.then(assets => {
return assets.getAllItems().filter(asset => asset.assetID === 'thisOne');
})
.then(assetsArray => {
return show(assetsArray[0]);
});
// This would actually be better:
return dm.assetList({
filter: {
assetID: 'thisOne',
},
})
.then(assets => {
return show(assets.getFirstItem());
});
Download the contents of this AssetList. It will pipe the response to a writeable stream if one is provided. Otherwise it will simply return the url where the assets can be downloaded.
(stream.Writable?)
writable stream for direct downloading of zip file.
Promise<(void | string)>
:
Promise resolving undefined if writeable stream is
provided. Url otherwise.
Load a single deleted TagResource.
(string)
the tag
Promise<TagResource>
:
Promise resolving to TagResource
return assetList.tag('thisOne')
.then(tag => {
return show(tag);
});
Load the TagList.
(filterOptions?)
filter options
Promise<TagList>
:
Promise resolving to TagList
return assetList.tagList()
.then(tags => {
return tags.getAllItems().filter(tags => tag.tag === 'thisOne');
})
.then(tagsArray => {
return show(tagsArray[0]);
});
// This would actually be better:
return dm.tagList({
filter: {
assetID: 'thisOne',
},
})
.then(tags => {
return show(tags.getFirstItem());
});
DeletedAssetResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this asset
(string)
: The title of this asset
(Date)
: Timestamp when this asset was created
(string)
: type of this asset, like image
Asset list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Tag resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Tag list resource class.
Extends ListResource_1.default
The following section describes resources of PublicAPI. You'll find the official API documentation at https://datamanager.entrecode.de/api/doc/<shortID>
.
LiteEntryResources are what the name suggests. They are lite entries. They only provide some basic functionality useful for showing unresolved (read: not loaded nested) entries.
Extends Resource_1.default
(any)
(any)
(any)
(String)
: The entry title of this LiteEntryResource
(String)
: The entries environment
(object)
: traversal from which to continue
Get the title of this LiteEntryResource's model.
string
:
title of the entry's model
Get the title from this EntryResource. Note: field argument only works with proper EntryResources and is only in this method signature to provide consistency.
(any)
(string?)
: Will throw if provided. Only for consistency.
string
:
title The title of the entry.
In order to resolve this LiteEntryResource to a proper EntryResource call this function. A promise is returned which resolves to the EntryResource.
Promise<EntryResource>
:
Promise resolving to
EntryResource
.
Saves this EntryResource. Does not work on LiteEntryResources. Those must be resolved first.
(any
= false
)
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<EntryResource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
EntryResource class representing entries. Fields will have getter and setter. Setter will validate the input on a best effort basis.
If the schema for this Entry is not known on creating it, you will have to use EntryResource#creatEntry.
So called nested Entries
will seamlessly integrate with EntryResources. When an entry is
loaded with level parameter set it will return EntryResources for alle entry/entries fields. You
don't need to do any other work except loading it leveled. For this to work properly the parent
EntryResource will need to be instantiated with EntryResource#createEntry, otherwise the
required JSON Schemas won't be stored in the cache.
Extends LiteEntryResource_1.default
(object)
loaded resource
(environment)
the environment of this resource
(object)
JSON Schema for this entry
(object?)
traversal for continuing
(string)
: entry id (_id defined as well)
(Date)
: created date (_created defined as well)
(Date)
: last modified date (_modified defined as well)
(string)
: public user which created thie entry (_creator defined as well)
(string)
: the title of this entry
((EntryResource | LiteEntryResource))
: fields with type entry
(Array<(EntryResource | LiteEntryResource)>)
: fields with type entries
(AssetResource)
: fields with type asset
(Array<AssetResource>)
: fields with type assets
((DMAccountResource | object | string))
: fields with type account
((RoleResource | object | string))
: fields with type role
publicAPI.entry('muffins', '1234567')
.then((muffin) => {
show(muffin.title, muffin.deliciousness);
});
Get the title of this EntryResource's model.
string
:
title of the entry's model
Get the title field of this EntryResource's model.
string
:
title field of this entry's model
Get the title from this EntryResource. Either the entryTitle when no field value is provided. When one is provided the title of the nested element is returned.
(any)
(string?)
: The field name from which the title should be loaded. Undefined for
the entry title.
string
:
title The title of either the element or the entry.
Load the HistoryEvents for this Entry from v3 API.
((filterOptions | any))
The filter options
Saves this EntryResource.
(boolean
= false
)
Send true if you want save put active.
Promise<EntryResource>
:
Promise will resolve to the saved EntryResource. Will
be the same object but with refreshed data.
Entry list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
name of the embedded items.
(object)
JSON Schema for list items.
Get all list items {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} into this EntryListResource.
Array<EntryResource>
:
an array of all list items.
Get the first {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} item from the list
EntryResource
:
the first item.
Get the n'th {@link https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2 embedded} item from the list
(number)
index of the item
EntryResource
:
the requested item.
DMAssetResource class
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this asset
(string)
: The title of this asset
(string)
: The type of this asset
(string)
: The assetGroupID this asset belongs to
(string)
: The caption of this asset
(Date)
: The creation Date
(Date)
: Date on which the asset got modified
(string)
: The user who created this asset
(string)
: The type of user the creator is of
(number)
: The total number of duplicate assets
(object)
: Object describing the original file of this asset
(Boolean)
: Whether or not this asses is used in any entry
(Boolean)
: Whether or not this asset has unrendered, but required variants
(string)
: Mimetype of the assets file
Returns the original file from files array. This is useful if you want to show the original image for an asset.
any
:
The original file object
Asset list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
PublicAsset list class
Extends ListResource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
Load a single PublicTagResource.
(string)
the tag
Promise<PublicTagResource>
:
Promise resolving to PublicTagResource
return assetList.tag('thisOne')
.then(tag => {
return show(tag);
});
Load the PublicTagList.
(filterOptions?)
filter options
Promise<PublicTagList>
:
Promise resolving to PublicTagList
return assetList.tagList()
.then(tags => {
return tags.getAllItems().filter(tags => tag.tag === 'thisOne');
})
.then(tagsArray => {
return show(tagsArray[0]);
});
// This would actually be better:
return dm.tagList({
filter: {
assetID: 'thisOne',
},
})
.then(tags => {
return show(tags.getFirstItem());
});
PublicAssetResource class. PublicAssetResources can be obtained via two methods. Either by loading a Asset resource directly or by accessing it via an Entry which was not loaded with levels (nested). The latter one does not contain the tags property since it was created with the embedded version of this asset.
Extends Resource_1.default
(object)
resource loaded from the API.
(environment)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
(string)
: The id of this asset
(string)
: The title of this asset
(Date)
: Timestamp when this asset was created
(string)
: type of this asset, like image
(boolean)
: whether or not this asset is resolved
Returns the original file from files array. This is useful if you want to show the original image for an asset.
any
:
The original file object
In order to resolve this PublicAssetResource call this function. A promise is returned which resolves to the PublicAssetResource.
Promise<PublicAssetResource>
:
Promise resolving to
PublicAssetResource
.
Saves this PublicAssetResource. Only works on resolved PublicAssetResource.
(any
= false
)
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<PublicAssetResource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
Tag list resource class.
Extends ListResource_1.default
PublicTag resource class
Extends Resource_1.default
(object)
resource loaded from the API.
(string)
the environment this resource is associated to.
(object?)
traversal from which traverson can continue.
LiteEntryResources are what the name suggests. They are lite entries. They only provide some basic functionality useful for showing unresolved (read: not loaded nested) entries.
Extends Resource_1.default
(any)
(any)
(any)
(String)
: The id of this dm account
(String)
: The email of this dm account, undefined if anonymous
In order to resolve this LiteDMAccountResource to a proper DMAccountResource call this function. A promise is returned which resolves to the DMAccountResource.
Promise<DMAccountResource>
:
Promise resolving to
DMAccountResource
.
Saves this DMAccountResource. Does not work on LiteDMAccountResources. Those must be resolved first.
(any
= false
)
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<EntryResource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
LiteEntryResources are what the name suggests. They are lite entries. They only provide some basic functionality useful for showing unresolved (read: not loaded nested) entries.
Extends Resource_1.default
(any)
(any)
(any)
(String)
: The id of this dm account
(String)
: The email of this dm account, undefined if anonymous
In order to resolve this LiteRoleResource to a proper RoleResource call this function. A promise is returned which resolves to the RoleResource.
Promise<RoleResource>
:
Promise resolving to
RoleResource
.
Saves this RoleResource. Does not work on LiteRoleResources. Those must be resolved first.
(any
= false
)
(string?)
Other schema url to overwrite the one in
_link.self.profile
. Mainly for internal use.
Promise<RoleResource>
:
Promise will resolve to the saved Resource. Will
be the same object but with refreshed data.
configurableSignup
example (226a204)This function is only used by ec user and they are capable of getting their DataManagerResource by their own. ;-)
Something like await dmApi.dataManager(publicAPI.dataManagerID);
will help.
Before 0.21.0 you could upload assets via Buffer (eg. loaded with fs.readFile or loaded by url). This was dropped because it was hardly used and assets neue are capable of uploading via url which should be sufficient.
If are using asset upload via Buffer, you should be capable of migrating by yourself. Possible solutions are saving the file to disc and upload with path string or uploading directly with an url.
before:
after:
_list=true
with all requests.This will only work with DataManager ^0.20.0
. There is no change in your code needed, but this will fail on DataMAnager <0.20.0
.
You will need to use #getEvents() instead of #getPastEvents(). The signature of HistoryEvents and HistoryEvent has changed! Support for EventSource is currently disabled.
Before:
After:
Before:
After:
inject 'eventsource/lib/eventsource-polyfill' manually in you project.
before:
after:
before:
after:
RoleResource's accounts field now has an array of LiteDMAccountResources not strings
before:
after:
before:
signupAnonymous()
use createAnonymous(validUntil)
.before:
after:
Before:
After:
src
to lib
.before:
after:
Before:
After:
feat: "Lite" PublicAssetResource for better handling of entries. Used for ec-form.
Since version 0.7.0 the ec.sdk supports "Lite" PublicAssetResources. Those are used to better support EntryResources in ec-forms. They are a stripped down versions of PublicAssetResources containing everything but tags
. The reason to add this was better support of title handling for linked entries.
Migration is straight forward, just add .assetID
on all linked entry types when you don't use nested assets.
Before:
After:
feat: LiteEntryResource for better handling of entry title. Used for ec-form.
Since version 0.7.0 the ec.sdk supports LiteEntryResources. Those are used to better support EntryResources in ec-forms. They are a stripped down versions of EntryResources only containing id
, _id
, _entryTitle
, and getModelTitle()
. The reason to add this was better support of title handling for linked entries.
Migration is straight forward, just add .id
on all linked entry types when you don't use nested entries.
Before:
After:
filter
anymorebefore:
after:
before:
after: