@qelos/sdk 3.5.2 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/administrator/index.d.ts +4 -0
- package/dist/administrator/index.js +13 -0
- package/dist/administrator/index.js.map +1 -1
- package/dist/administrator/manage-blueprints.d.ts +14 -0
- package/dist/administrator/manage-blueprints.js +31 -0
- package/dist/administrator/manage-blueprints.js.map +1 -0
- package/dist/blueprints-entities.d.ts +12 -0
- package/dist/blueprints-entities.js +33 -0
- package/dist/blueprints-entities.js.map +1 -0
- package/dist/blueprints.d.ts +13 -0
- package/dist/blueprints.js +24 -0
- package/dist/blueprints.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/administrator/index.ts +15 -0
- package/src/administrator/manage-blueprints.ts +44 -0
- package/src/blueprints-entities.ts +41 -0
- package/src/blueprints.ts +29 -0
- package/src/index.ts +16 -4
- package/tsconfig.json +10 -6
- package/dist/categories.d.ts +0 -22
- package/dist/categories.js +0 -34
- package/dist/categories.js.map +0 -1
- package/dist/menus.d.ts +0 -36
- package/dist/menus.js +0 -31
- package/dist/menus.js.map +0 -1
- package/dist/posts.d.ts +0 -40
- package/dist/posts.js +0 -42
- package/dist/posts.js.map +0 -1
- package/src/categories.ts +0 -62
- package/src/posts.ts +0 -91
|
@@ -6,12 +6,16 @@ import QlManageLayouts from './manage-layouts';
|
|
|
6
6
|
import QlUsers from './users';
|
|
7
7
|
import QlManageConfigurations from './manage-configurations';
|
|
8
8
|
import QlAdminWorkspaces from './workspaces';
|
|
9
|
+
import QlManageBlueprints from './manage-blueprints';
|
|
9
10
|
export default class QelosAdministratorSDK<T = any> extends QelosSDK {
|
|
10
11
|
users: QlUsers<T>;
|
|
11
12
|
manageLayouts: QlManageLayouts;
|
|
12
13
|
manageConfigurations: QlManageConfigurations;
|
|
14
|
+
manageBlueprints: QlManageBlueprints;
|
|
13
15
|
drafts: QlDrafts;
|
|
14
16
|
events: QlEvents;
|
|
15
17
|
adminWorkspaces: QlAdminWorkspaces;
|
|
16
18
|
constructor(options: QelosSDKOptions);
|
|
19
|
+
impersonateUser(userId: string, workspaceId?: string): void;
|
|
20
|
+
clearImpersonation(): void;
|
|
17
21
|
}
|
|
@@ -5,10 +5,12 @@ import QlManageLayouts from './manage-layouts';
|
|
|
5
5
|
import QlUsers from './users';
|
|
6
6
|
import QlManageConfigurations from './manage-configurations';
|
|
7
7
|
import QlAdminWorkspaces from './workspaces';
|
|
8
|
+
import QlManageBlueprints from './manage-blueprints';
|
|
8
9
|
export default class QelosAdministratorSDK extends QelosSDK {
|
|
9
10
|
users;
|
|
10
11
|
manageLayouts;
|
|
11
12
|
manageConfigurations;
|
|
13
|
+
manageBlueprints;
|
|
12
14
|
drafts;
|
|
13
15
|
events;
|
|
14
16
|
adminWorkspaces;
|
|
@@ -17,9 +19,20 @@ export default class QelosAdministratorSDK extends QelosSDK {
|
|
|
17
19
|
this.users = new QlUsers(options);
|
|
18
20
|
this.manageLayouts = new QlManageLayouts(options);
|
|
19
21
|
this.manageConfigurations = new QlManageConfigurations(options);
|
|
22
|
+
this.manageBlueprints = new QlManageBlueprints(options);
|
|
20
23
|
this.drafts = new QlDrafts(options);
|
|
21
24
|
this.events = new QlEvents(options);
|
|
22
25
|
this.adminWorkspaces = new QlAdminWorkspaces(options);
|
|
23
26
|
}
|
|
27
|
+
impersonateUser(userId, workspaceId) {
|
|
28
|
+
this.setCustomHeader('x-impersonate-user', userId);
|
|
29
|
+
if (workspaceId) {
|
|
30
|
+
this.setCustomHeader('x-impersonate-workspace', workspaceId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
clearImpersonation() {
|
|
34
|
+
this.removeCustomHeader('x-impersonate-user');
|
|
35
|
+
this.removeCustomHeader('x-impersonate-workspace');
|
|
36
|
+
}
|
|
24
37
|
}
|
|
25
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/administrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,sBAAsB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,iBAAiB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/administrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,sBAAsB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,qBAA+B,SAAQ,QAAQ;IAClE,KAAK,CAAa;IAClB,aAAa,CAAkB;IAC/B,oBAAoB,CAAyB;IAC7C,gBAAgB,CAAqB;IACrC,MAAM,CAAW;IACjB,MAAM,CAAW;IACjB,eAAe,CAAoB;IAEnC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAI,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,eAAe,CAAC,MAAc,EAAE,WAAoB;QAClD,IAAI,CAAC,eAAe,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,WAAW,CAAC,CAAC;SAC9D;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;QAC9C,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BaseSDK from '../base-sdk';
|
|
2
|
+
import { QelosSDKOptions } from '../types';
|
|
3
|
+
import { IBlueprint } from '@qelos/global-types';
|
|
4
|
+
type IBlueprintUpdateParams = Omit<IBlueprint, 'tenant' | 'created' | 'updated'>;
|
|
5
|
+
export default class QlManageBlueprints extends BaseSDK {
|
|
6
|
+
private relativePath;
|
|
7
|
+
constructor(options: QelosSDKOptions);
|
|
8
|
+
getBlueprint(key: string): Promise<IBlueprint>;
|
|
9
|
+
getList(): Promise<IBlueprint[]>;
|
|
10
|
+
remove(key: string): Promise<any>;
|
|
11
|
+
update(key: string, changes: Partial<IBlueprintUpdateParams>): Promise<IBlueprint>;
|
|
12
|
+
create(blueprint: IBlueprintUpdateParams): Promise<IBlueprint>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BaseSDK from '../base-sdk';
|
|
2
|
+
export default class QlManageBlueprints extends BaseSDK {
|
|
3
|
+
relativePath = '/api/blueprints';
|
|
4
|
+
constructor(options) {
|
|
5
|
+
super(options);
|
|
6
|
+
}
|
|
7
|
+
getBlueprint(key) {
|
|
8
|
+
return this.callJsonApi(`${this.relativePath}/${key}`);
|
|
9
|
+
}
|
|
10
|
+
getList() {
|
|
11
|
+
return this.callJsonApi(this.relativePath);
|
|
12
|
+
}
|
|
13
|
+
remove(key) {
|
|
14
|
+
return this.callApi(`${this.relativePath}/${key}`, { method: 'delete' });
|
|
15
|
+
}
|
|
16
|
+
update(key, changes) {
|
|
17
|
+
return this.callJsonApi(`${this.relativePath}/${key}`, {
|
|
18
|
+
method: 'put',
|
|
19
|
+
headers: { 'content-type': 'application/json' },
|
|
20
|
+
body: JSON.stringify(changes)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
create(blueprint) {
|
|
24
|
+
return this.callJsonApi(this.relativePath, {
|
|
25
|
+
method: 'post',
|
|
26
|
+
headers: { 'content-type': 'application/json' },
|
|
27
|
+
body: JSON.stringify(blueprint)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=manage-blueprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manage-blueprints.js","sourceRoot":"","sources":["../../src/administrator/manage-blueprints.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAMlC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IAC7C,YAAY,GAAG,iBAAiB,CAAC;IAEzC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,WAAW,CAAa,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAe,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,OAAwC;QAC1D,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,EAC7B;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,SAAiC;QACtC,OAAO,IAAI,CAAC,WAAW,CAAa,IAAI,CAAC,YAAY,EAAE;YACrD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QelosSDKOptions } from './types';
|
|
2
|
+
import BaseSDK from './base-sdk';
|
|
3
|
+
export default class QlBlueprintEntities<T = any> extends BaseSDK {
|
|
4
|
+
private blueprintKey;
|
|
5
|
+
private relativePath;
|
|
6
|
+
constructor(options: QelosSDKOptions, blueprintKey: string);
|
|
7
|
+
getEntity(identifier: string): Promise<T>;
|
|
8
|
+
getList(query?: Record<string, any>): Promise<T[]>;
|
|
9
|
+
remove(identifier: string): Promise<any>;
|
|
10
|
+
update(identifier: string, changes: Partial<T>): Promise<T>;
|
|
11
|
+
create(entity: T): Promise<T>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseSDK from './base-sdk';
|
|
2
|
+
export default class QlBlueprintEntities extends BaseSDK {
|
|
3
|
+
blueprintKey;
|
|
4
|
+
relativePath = '/api/blueprints';
|
|
5
|
+
constructor(options, blueprintKey) {
|
|
6
|
+
super(options);
|
|
7
|
+
this.blueprintKey = blueprintKey;
|
|
8
|
+
}
|
|
9
|
+
getEntity(identifier) {
|
|
10
|
+
return this.callJsonApi(`${this.relativePath}/${this.blueprintKey}/${identifier}`);
|
|
11
|
+
}
|
|
12
|
+
getList(query) {
|
|
13
|
+
return this.callJsonApi(`${this.relativePath}/${this.blueprintKey}${query ? `?${new URLSearchParams(query)}` : ''}`);
|
|
14
|
+
}
|
|
15
|
+
remove(identifier) {
|
|
16
|
+
return this.callApi(`${this.relativePath}/${this.blueprintKey}/${identifier}`, { method: 'delete' });
|
|
17
|
+
}
|
|
18
|
+
update(identifier, changes) {
|
|
19
|
+
return this.callJsonApi(`${this.relativePath}/${this.blueprintKey}/${identifier}`, {
|
|
20
|
+
method: 'put',
|
|
21
|
+
headers: { 'content-type': 'application/json' },
|
|
22
|
+
body: JSON.stringify(changes)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
create(entity) {
|
|
26
|
+
return this.callJsonApi(`${this.relativePath}/${this.blueprintKey}`, {
|
|
27
|
+
method: 'post',
|
|
28
|
+
headers: { 'content-type': 'application/json' },
|
|
29
|
+
body: JSON.stringify(entity)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=blueprints-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blueprints-entities.js","sourceRoot":"","sources":["../src/blueprints-entities.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,mBAA6B,SAAQ,OAAO;IAGjB;IAFtC,YAAY,GAAG,iBAAiB,CAAC;IAEzC,YAAY,OAAwB,EAAU,YAAoB;QAChE,KAAK,CAAC,OAAO,CAAC,CAAA;QAD8B,iBAAY,GAAZ,YAAY,CAAQ;IAElE,CAAC;IAED,SAAS,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,WAAW,CAAI,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,UAAU,EAAE,CAAC,CAAA;IACvF,CAAC;IAED,OAAO,CAAC,KAA2B;QACjC,OAAO,IAAI,CAAC,WAAW,CAAM,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5H,CAAC;IAED,MAAM,CAAC,UAAkB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,MAAM,CAAC,UAAkB,EAAE,OAAmB;QAC5C,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,UAAU,EAAE,EACzD;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,MAAS;QACd,OAAO,IAAI,CAAC,WAAW,CAAI,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE;YACtE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAC7B,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QelosSDKOptions } from './types';
|
|
2
|
+
import BaseSDK from './base-sdk';
|
|
3
|
+
import { IBlueprint } from '@qelos/global-types';
|
|
4
|
+
import QlBlueprintEntities from './blueprints-entities';
|
|
5
|
+
export default class QlBlueprints extends BaseSDK {
|
|
6
|
+
#private;
|
|
7
|
+
private options;
|
|
8
|
+
private relativePath;
|
|
9
|
+
constructor(options: QelosSDKOptions);
|
|
10
|
+
getBlueprint(key: string): Promise<IBlueprint>;
|
|
11
|
+
getList(): Promise<IBlueprint[]>;
|
|
12
|
+
entitiesOf<T = any>(blueprintKey: string): QlBlueprintEntities<T>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BaseSDK from './base-sdk';
|
|
2
|
+
import QlBlueprintEntities from './blueprints-entities';
|
|
3
|
+
export default class QlBlueprints extends BaseSDK {
|
|
4
|
+
options;
|
|
5
|
+
relativePath = '/api/blueprints';
|
|
6
|
+
#entities = new Map();
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super(options);
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
getBlueprint(key) {
|
|
12
|
+
return this.callJsonApi(`${this.relativePath}/${key}`);
|
|
13
|
+
}
|
|
14
|
+
getList() {
|
|
15
|
+
return this.callJsonApi(this.relativePath);
|
|
16
|
+
}
|
|
17
|
+
entitiesOf(blueprintKey) {
|
|
18
|
+
if (!this.#entities.has(blueprintKey)) {
|
|
19
|
+
this.#entities.set(blueprintKey, new QlBlueprintEntities(this.options, blueprintKey));
|
|
20
|
+
}
|
|
21
|
+
return this.#entities.get(blueprintKey);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=blueprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blueprints.js","sourceRoot":"","sources":["../src/blueprints.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAK3B;IAJZ,YAAY,GAAG,iBAAiB,CAAC;IAEzC,SAAS,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEnD,YAAoB,OAAwB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAA;QADI,YAAO,GAAP,OAAO,CAAiB;IAE5C,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,OAAO,IAAI,CAAC,WAAW,CAAa,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAe,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,UAAU,CAAU,YAAoB;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,mBAAmB,CAAI,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;SAC1F;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import QlLayouts from './administrator/layouts';
|
|
|
6
6
|
import QlAuthentication from './authentication';
|
|
7
7
|
import QlWorkspaces from './workspaces';
|
|
8
8
|
import QlInvites from './invites';
|
|
9
|
+
import QlBlueprints from './blueprints';
|
|
9
10
|
export default class QelosSDK extends BaseSDK {
|
|
11
|
+
#private;
|
|
10
12
|
private options;
|
|
11
13
|
blocks: QlBlocks;
|
|
12
14
|
layouts: QlLayouts;
|
|
@@ -14,5 +16,8 @@ export default class QelosSDK extends BaseSDK {
|
|
|
14
16
|
authentication: QlAuthentication;
|
|
15
17
|
workspaces: QlWorkspaces;
|
|
16
18
|
invites: QlInvites;
|
|
19
|
+
blueprints: QlBlueprints;
|
|
17
20
|
constructor(options: QelosSDKOptions);
|
|
21
|
+
setCustomHeader(key: string, value: string): void;
|
|
22
|
+
removeCustomHeader(key: string): void;
|
|
18
23
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,15 +5,18 @@ import QlLayouts from './administrator/layouts';
|
|
|
5
5
|
import QlAuthentication from './authentication';
|
|
6
6
|
import QlWorkspaces from './workspaces';
|
|
7
7
|
import QlInvites from './invites';
|
|
8
|
+
import QlBlueprints from './blueprints';
|
|
8
9
|
const noExtraHeadersUrls = new Set(['/api/token/refresh', '/api/signin', '/api/signup']);
|
|
9
10
|
export default class QelosSDK extends BaseSDK {
|
|
10
11
|
options;
|
|
12
|
+
#customHeaders = {};
|
|
11
13
|
blocks;
|
|
12
14
|
layouts;
|
|
13
15
|
appConfigurations;
|
|
14
16
|
authentication;
|
|
15
17
|
workspaces;
|
|
16
18
|
invites;
|
|
19
|
+
blueprints;
|
|
17
20
|
constructor(options) {
|
|
18
21
|
super(options);
|
|
19
22
|
this.options = options;
|
|
@@ -23,13 +26,14 @@ export default class QelosSDK extends BaseSDK {
|
|
|
23
26
|
this.authentication = new QlAuthentication(this.options);
|
|
24
27
|
this.workspaces = new QlWorkspaces(this.options);
|
|
25
28
|
this.invites = new QlInvites(this.options);
|
|
29
|
+
this.blueprints = new QlBlueprints(this.options);
|
|
26
30
|
if (!options.getAccessToken) {
|
|
27
31
|
options.getAccessToken = () => this.authentication.accessToken;
|
|
28
32
|
}
|
|
29
33
|
if (!options.extraHeaders) {
|
|
30
34
|
options.extraHeaders = async (relativeUrl, forceRefresh) => {
|
|
31
35
|
if (globalThis.navigator || noExtraHeadersUrls.has(relativeUrl)) {
|
|
32
|
-
return {};
|
|
36
|
+
return { ...this.#customHeaders };
|
|
33
37
|
}
|
|
34
38
|
let token = forceRefresh ? '' : options.getAccessToken();
|
|
35
39
|
if (!token) {
|
|
@@ -37,11 +41,17 @@ export default class QelosSDK extends BaseSDK {
|
|
|
37
41
|
token = options.getAccessToken();
|
|
38
42
|
}
|
|
39
43
|
if (token) {
|
|
40
|
-
return { authorization: 'Bearer ' + token };
|
|
44
|
+
return { authorization: 'Bearer ' + token, ...this.#customHeaders };
|
|
41
45
|
}
|
|
42
|
-
return {};
|
|
46
|
+
return { ...this.#customHeaders };
|
|
43
47
|
};
|
|
44
48
|
}
|
|
45
49
|
}
|
|
50
|
+
setCustomHeader(key, value) {
|
|
51
|
+
this.#customHeaders[key] = value;
|
|
52
|
+
}
|
|
53
|
+
removeCustomHeader(key) {
|
|
54
|
+
delete this.#customHeaders[key];
|
|
55
|
+
}
|
|
46
56
|
}
|
|
47
57
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,mBAAmB,MAAM,kBAAkB,CAAC;AACnD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,mBAAmB,MAAM,kBAAkB,CAAC;AACnD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAA;AAExF,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IAWvB;IAVpB,cAAc,GAAG,EAAE,CAAA;IAEnB,MAAM,CAAW;IACjB,OAAO,CAAY;IACnB,iBAAiB,CAAsB;IACvC,cAAc,CAAmB;IACjC,UAAU,CAAe;IACzB,OAAO,CAAY;IACnB,UAAU,CAAe;IAEzB,YAAoB,OAAwB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QADG,YAAO,GAAP,OAAO,CAAiB;QAE1C,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjD,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAC3B,OAAO,CAAC,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC;SAChE;QAED,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;YACzB,OAAO,CAAC,YAAY,GAAG,KAAK,EAAE,WAAmB,EAAE,YAAsB,EAAE,EAAE;gBAC3E,IAAI,UAAU,CAAC,SAAS,IAAI,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;oBAC/D,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;iBACnC;gBACD,IAAI,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;gBACzD,IAAI,CAAC,KAAK,EAAE;oBACV,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;oBACzC,KAAK,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;iBAClC;gBACD,IAAI,KAAK,EAAE;oBACT,OAAO,EAAE,aAAa,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;iBACpE;gBACD,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;YACnC,CAAC,CAAA;SACF;IACH,CAAC;IAED,eAAe,CAAC,GAAW,EAAE,KAAa;QACxC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnC,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CAEF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qelos/sdk",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"description": "SDK for Qelos API",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@qelos/global-types": "^3.5.
|
|
15
|
+
"@qelos/global-types": "^3.5.4",
|
|
16
16
|
"typescript": "^4.9.5"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "a952292a7de503674aac40136fb448dc6350e55a"
|
|
19
19
|
}
|
|
@@ -6,11 +6,13 @@ import QlManageLayouts from './manage-layouts';
|
|
|
6
6
|
import QlUsers from './users';
|
|
7
7
|
import QlManageConfigurations from './manage-configurations';
|
|
8
8
|
import QlAdminWorkspaces from './workspaces';
|
|
9
|
+
import QlManageBlueprints from './manage-blueprints';
|
|
9
10
|
|
|
10
11
|
export default class QelosAdministratorSDK<T = any> extends QelosSDK {
|
|
11
12
|
users: QlUsers<T>;
|
|
12
13
|
manageLayouts: QlManageLayouts;
|
|
13
14
|
manageConfigurations: QlManageConfigurations;
|
|
15
|
+
manageBlueprints: QlManageBlueprints;
|
|
14
16
|
drafts: QlDrafts;
|
|
15
17
|
events: QlEvents;
|
|
16
18
|
adminWorkspaces: QlAdminWorkspaces;
|
|
@@ -20,8 +22,21 @@ export default class QelosAdministratorSDK<T = any> extends QelosSDK {
|
|
|
20
22
|
this.users = new QlUsers<T>(options);
|
|
21
23
|
this.manageLayouts = new QlManageLayouts(options);
|
|
22
24
|
this.manageConfigurations = new QlManageConfigurations(options);
|
|
25
|
+
this.manageBlueprints = new QlManageBlueprints(options);
|
|
23
26
|
this.drafts = new QlDrafts(options);
|
|
24
27
|
this.events = new QlEvents(options);
|
|
25
28
|
this.adminWorkspaces = new QlAdminWorkspaces(options);
|
|
26
29
|
}
|
|
30
|
+
|
|
31
|
+
impersonateUser(userId: string, workspaceId?: string) {
|
|
32
|
+
this.setCustomHeader('x-impersonate-user', userId);
|
|
33
|
+
if (workspaceId) {
|
|
34
|
+
this.setCustomHeader('x-impersonate-workspace', workspaceId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
clearImpersonation() {
|
|
39
|
+
this.removeCustomHeader('x-impersonate-user');
|
|
40
|
+
this.removeCustomHeader('x-impersonate-workspace');
|
|
41
|
+
}
|
|
27
42
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import BaseSDK from '../base-sdk';
|
|
2
|
+
import { QelosSDKOptions } from '../types';
|
|
3
|
+
import { IBlueprint } from '@qelos/global-types';
|
|
4
|
+
|
|
5
|
+
type IBlueprintUpdateParams = Omit<IBlueprint, 'tenant' | 'created' | 'updated'>;
|
|
6
|
+
|
|
7
|
+
export default class QlManageBlueprints extends BaseSDK {
|
|
8
|
+
private relativePath = '/api/blueprints';
|
|
9
|
+
|
|
10
|
+
constructor(options: QelosSDKOptions) {
|
|
11
|
+
super(options)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getBlueprint(key: string) {
|
|
15
|
+
return this.callJsonApi<IBlueprint>(`${this.relativePath}/${key}`)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getList() {
|
|
19
|
+
return this.callJsonApi<IBlueprint[]>(this.relativePath);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
remove(key: string): Promise<any> {
|
|
23
|
+
return this.callApi(`${this.relativePath}/${key}`, { method: 'delete' });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
update(key: string, changes: Partial<IBlueprintUpdateParams>): Promise<IBlueprint> {
|
|
27
|
+
return this.callJsonApi<IBlueprint>(
|
|
28
|
+
`${this.relativePath}/${key}`,
|
|
29
|
+
{
|
|
30
|
+
method: 'put',
|
|
31
|
+
headers: { 'content-type': 'application/json' },
|
|
32
|
+
body: JSON.stringify(changes)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
create(blueprint: IBlueprintUpdateParams): Promise<IBlueprint> {
|
|
38
|
+
return this.callJsonApi<IBlueprint>(this.relativePath, {
|
|
39
|
+
method: 'post',
|
|
40
|
+
headers: { 'content-type': 'application/json' },
|
|
41
|
+
body: JSON.stringify(blueprint)
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { QelosSDKOptions } from './types';
|
|
2
|
+
import BaseSDK from './base-sdk';
|
|
3
|
+
|
|
4
|
+
export default class QlBlueprintEntities<T = any> extends BaseSDK {
|
|
5
|
+
private relativePath = '/api/blueprints';
|
|
6
|
+
|
|
7
|
+
constructor(options: QelosSDKOptions, private blueprintKey: string) {
|
|
8
|
+
super(options)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getEntity(identifier: string) {
|
|
12
|
+
return this.callJsonApi<T>(`${this.relativePath}/${this.blueprintKey}/${identifier}`)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getList(query?: Record<string, any>) {
|
|
16
|
+
return this.callJsonApi<T[]>(`${this.relativePath}/${this.blueprintKey}${query ? `?${new URLSearchParams(query)}` : ''}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
remove(identifier: string): Promise<any> {
|
|
20
|
+
return this.callApi(`${this.relativePath}/${this.blueprintKey}/${identifier}`, { method: 'delete' });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
update(identifier: string, changes: Partial<T>): Promise<T> {
|
|
24
|
+
return this.callJsonApi<T>(
|
|
25
|
+
`${this.relativePath}/${this.blueprintKey}/${identifier}`,
|
|
26
|
+
{
|
|
27
|
+
method: 'put',
|
|
28
|
+
headers: { 'content-type': 'application/json' },
|
|
29
|
+
body: JSON.stringify(changes)
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
create(entity: T): Promise<T> {
|
|
35
|
+
return this.callJsonApi<T>(`${this.relativePath}/${this.blueprintKey}`, {
|
|
36
|
+
method: 'post',
|
|
37
|
+
headers: { 'content-type': 'application/json' },
|
|
38
|
+
body: JSON.stringify(entity)
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { QelosSDKOptions } from './types';
|
|
2
|
+
import BaseSDK from './base-sdk';
|
|
3
|
+
import { IBlueprint } from '@qelos/global-types';
|
|
4
|
+
import QlBlueprintEntities from './blueprints-entities';
|
|
5
|
+
|
|
6
|
+
export default class QlBlueprints extends BaseSDK {
|
|
7
|
+
private relativePath = '/api/blueprints';
|
|
8
|
+
|
|
9
|
+
#entities = new Map<string, QlBlueprintEntities>();
|
|
10
|
+
|
|
11
|
+
constructor(private options: QelosSDKOptions) {
|
|
12
|
+
super(options)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getBlueprint(key: string) {
|
|
16
|
+
return this.callJsonApi<IBlueprint>(`${this.relativePath}/${key}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getList() {
|
|
20
|
+
return this.callJsonApi<IBlueprint[]>(this.relativePath);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
entitiesOf<T = any>(blueprintKey: string): QlBlueprintEntities<T> {
|
|
24
|
+
if (!this.#entities.has(blueprintKey)) {
|
|
25
|
+
this.#entities.set(blueprintKey, new QlBlueprintEntities<T>(this.options, blueprintKey));
|
|
26
|
+
}
|
|
27
|
+
return this.#entities.get(blueprintKey);
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {QelosSDKOptions} from './types';
|
|
1
|
+
import { QelosSDKOptions } from './types';
|
|
2
2
|
import BaseSDK from './base-sdk';
|
|
3
3
|
import QlAppConfigurations from './configurations';
|
|
4
4
|
import QlBlocks from './blocks';
|
|
@@ -6,10 +6,12 @@ import QlLayouts from './administrator/layouts';
|
|
|
6
6
|
import QlAuthentication from './authentication';
|
|
7
7
|
import QlWorkspaces from './workspaces';
|
|
8
8
|
import QlInvites from './invites';
|
|
9
|
+
import QlBlueprints from './blueprints';
|
|
9
10
|
|
|
10
11
|
const noExtraHeadersUrls = new Set(['/api/token/refresh', '/api/signin', '/api/signup'])
|
|
11
12
|
|
|
12
13
|
export default class QelosSDK extends BaseSDK {
|
|
14
|
+
#customHeaders = {}
|
|
13
15
|
|
|
14
16
|
blocks: QlBlocks;
|
|
15
17
|
layouts: QlLayouts;
|
|
@@ -17,6 +19,7 @@ export default class QelosSDK extends BaseSDK {
|
|
|
17
19
|
authentication: QlAuthentication;
|
|
18
20
|
workspaces: QlWorkspaces;
|
|
19
21
|
invites: QlInvites;
|
|
22
|
+
blueprints: QlBlueprints;
|
|
20
23
|
|
|
21
24
|
constructor(private options: QelosSDKOptions) {
|
|
22
25
|
super(options);
|
|
@@ -26,6 +29,7 @@ export default class QelosSDK extends BaseSDK {
|
|
|
26
29
|
this.authentication = new QlAuthentication(this.options);
|
|
27
30
|
this.workspaces = new QlWorkspaces(this.options);
|
|
28
31
|
this.invites = new QlInvites(this.options);
|
|
32
|
+
this.blueprints = new QlBlueprints(this.options);
|
|
29
33
|
|
|
30
34
|
if (!options.getAccessToken) {
|
|
31
35
|
options.getAccessToken = () => this.authentication.accessToken;
|
|
@@ -34,7 +38,7 @@ export default class QelosSDK extends BaseSDK {
|
|
|
34
38
|
if (!options.extraHeaders) {
|
|
35
39
|
options.extraHeaders = async (relativeUrl: string, forceRefresh?: boolean) => {
|
|
36
40
|
if (globalThis.navigator || noExtraHeadersUrls.has(relativeUrl)) {
|
|
37
|
-
return {};
|
|
41
|
+
return { ...this.#customHeaders };
|
|
38
42
|
}
|
|
39
43
|
let token = forceRefresh ? '' : options.getAccessToken();
|
|
40
44
|
if (!token) {
|
|
@@ -42,11 +46,19 @@ export default class QelosSDK extends BaseSDK {
|
|
|
42
46
|
token = options.getAccessToken();
|
|
43
47
|
}
|
|
44
48
|
if (token) {
|
|
45
|
-
return {authorization: 'Bearer ' + token}
|
|
49
|
+
return { authorization: 'Bearer ' + token, ...this.#customHeaders }
|
|
46
50
|
}
|
|
47
|
-
return {}
|
|
51
|
+
return { ...this.#customHeaders }
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
setCustomHeader(key: string, value: string) {
|
|
57
|
+
this.#customHeaders[key] = value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
removeCustomHeader(key: string) {
|
|
61
|
+
delete this.#customHeaders[key];
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"rootDir": "./src",
|
|
3
5
|
"module": "ESNext",
|
|
4
6
|
"target": "esnext",
|
|
5
7
|
"outDir": "./dist",
|
|
8
|
+
"moduleResolution": "node",
|
|
6
9
|
"sourceMap": true,
|
|
7
10
|
"declaration": true,
|
|
8
|
-
"skipLibCheck": true
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"paths": {
|
|
13
|
+
"@qelos/global-types": [
|
|
14
|
+
"node_modules/@qelos/global-types/index.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
14
18
|
}
|
package/dist/categories.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { QelosSDKOptions } from "./types";
|
|
2
|
-
import BaseSDK from "./base-sdk";
|
|
3
|
-
export interface ICategory {
|
|
4
|
-
_id?: string;
|
|
5
|
-
created: Date;
|
|
6
|
-
isPublic: boolean;
|
|
7
|
-
name: string;
|
|
8
|
-
path: string;
|
|
9
|
-
content?: string;
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
}
|
|
12
|
-
export default class QlCategories extends BaseSDK {
|
|
13
|
-
private relativePath;
|
|
14
|
-
constructor(options: QelosSDKOptions);
|
|
15
|
-
getByPath(path: string, extra?: Partial<RequestInit>): Promise<ICategory>;
|
|
16
|
-
getList(options: {
|
|
17
|
-
target: "front" | "admin";
|
|
18
|
-
}, extra?: Partial<RequestInit>): Promise<ICategory[]>;
|
|
19
|
-
remove(path: string): Promise<Response>;
|
|
20
|
-
update(path: string, changes: Partial<ICategory>): Promise<ICategory>;
|
|
21
|
-
create(category: ICategory): Promise<ICategory>;
|
|
22
|
-
}
|
package/dist/categories.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import BaseSDK from "./base-sdk";
|
|
2
|
-
export default class QlCategories extends BaseSDK {
|
|
3
|
-
relativePath = "/api/categories";
|
|
4
|
-
constructor(options) {
|
|
5
|
-
super(options);
|
|
6
|
-
}
|
|
7
|
-
getByPath(path, extra) {
|
|
8
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(path)}`, extra);
|
|
9
|
-
}
|
|
10
|
-
getList(options, extra) {
|
|
11
|
-
const queryParams = new URLSearchParams(options);
|
|
12
|
-
return this.callJsonApi(`${this.relativePath}?${queryParams}`, extra);
|
|
13
|
-
}
|
|
14
|
-
remove(path) {
|
|
15
|
-
return this.callApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
16
|
-
method: "delete",
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
update(path, changes) {
|
|
20
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
21
|
-
method: "put",
|
|
22
|
-
headers: { 'content-type': 'application/json' },
|
|
23
|
-
body: JSON.stringify(changes)
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
create(category) {
|
|
27
|
-
return this.callJsonApi(this.relativePath, {
|
|
28
|
-
method: "post",
|
|
29
|
-
headers: { 'content-type': 'application/json' },
|
|
30
|
-
body: JSON.stringify(category),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=categories.js.map
|
package/dist/categories.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../src/categories.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAYjC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IACvC,YAAY,GAAG,iBAAiB,CAAC;IAEzC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,KAA4B;QAClD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EACzC,KAAK,CACN,CAAC;IACJ,CAAC;IAED,OAAO,CACL,OAAsC,EACtC,KAA4B;QAE5B,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE,EACrC,KAAK,CACN,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;YAC7D,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,OAA2B;QAC9C,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;YACzC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAmB;QACxB,OAAO,IAAI,CAAC,WAAW,CAAY,IAAI,CAAC,YAAY,EAAE;YACpD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/menus.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { QelosSDKOptions } from './types';
|
|
2
|
-
import BaseSDK from './base-sdk';
|
|
3
|
-
export interface MenuLink {
|
|
4
|
-
_id?: string;
|
|
5
|
-
kind: 'category' | 'post' | 'http';
|
|
6
|
-
category?: {
|
|
7
|
-
name: string;
|
|
8
|
-
path: string;
|
|
9
|
-
};
|
|
10
|
-
post?: {
|
|
11
|
-
title: string;
|
|
12
|
-
path: string;
|
|
13
|
-
category: {
|
|
14
|
-
path: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
value?: {
|
|
18
|
-
text: string;
|
|
19
|
-
url: string;
|
|
20
|
-
newWindow: boolean;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface IMenu {
|
|
24
|
-
name: string;
|
|
25
|
-
links: MenuLink[];
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
}
|
|
28
|
-
export default class QlMenus extends BaseSDK {
|
|
29
|
-
private relativePath;
|
|
30
|
-
constructor(options: QelosSDKOptions);
|
|
31
|
-
getMenu(name: string): Promise<IMenu>;
|
|
32
|
-
getList(): Promise<IMenu[]>;
|
|
33
|
-
remove(name: string): Promise<any>;
|
|
34
|
-
update(name: string, changes: Partial<IMenu>): Promise<IMenu>;
|
|
35
|
-
create(menu: IMenu): Promise<IMenu>;
|
|
36
|
-
}
|
package/dist/menus.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import BaseSDK from './base-sdk';
|
|
2
|
-
export default class QlMenus extends BaseSDK {
|
|
3
|
-
relativePath = '/api/menus';
|
|
4
|
-
constructor(options) {
|
|
5
|
-
super(options);
|
|
6
|
-
}
|
|
7
|
-
getMenu(name) {
|
|
8
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(name)}`);
|
|
9
|
-
}
|
|
10
|
-
getList() {
|
|
11
|
-
return this.callJsonApi(this.relativePath);
|
|
12
|
-
}
|
|
13
|
-
remove(name) {
|
|
14
|
-
return this.callApi(`${this.relativePath}/${encodeURI(name)}`, { method: 'delete' });
|
|
15
|
-
}
|
|
16
|
-
update(name, changes) {
|
|
17
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(name)}`, {
|
|
18
|
-
method: 'put',
|
|
19
|
-
headers: { 'content-type': 'application/json' },
|
|
20
|
-
body: JSON.stringify(changes)
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
create(menu) {
|
|
24
|
-
return this.callJsonApi(this.relativePath, {
|
|
25
|
-
method: 'post',
|
|
26
|
-
headers: { 'content-type': 'application/json' },
|
|
27
|
-
body: JSON.stringify(menu)
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=menus.js.map
|
package/dist/menus.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menus.js","sourceRoot":"","sources":["../src/menus.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AA8BjC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAClC,YAAY,GAAG,YAAY,CAAC;IAEpC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,WAAW,CAAQ,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAU,IAAI,CAAC,YAAY,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,OAAuB;QAC1C,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;YACzC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CACF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,IAAW;QAChB,OAAO,IAAI,CAAC,WAAW,CAAQ,IAAI,CAAC,YAAY,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAAC,CAAC,CAAA;IAChC,CAAC;CACF"}
|
package/dist/posts.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { QelosSDKOptions } from "./types";
|
|
2
|
-
import BaseSDK from "./base-sdk";
|
|
3
|
-
import { ICategory } from "./categories";
|
|
4
|
-
export declare enum PostContentState {
|
|
5
|
-
EDITOR = "editor",
|
|
6
|
-
HTML = "html"
|
|
7
|
-
}
|
|
8
|
-
export interface IPost {
|
|
9
|
-
_id?: string;
|
|
10
|
-
title: string;
|
|
11
|
-
authors: any[];
|
|
12
|
-
thumbnail: string;
|
|
13
|
-
short: string;
|
|
14
|
-
contents: string[];
|
|
15
|
-
editorContentsStates: PostContentState[];
|
|
16
|
-
path: string;
|
|
17
|
-
tags: string[];
|
|
18
|
-
category: string | ICategory;
|
|
19
|
-
isPublic: boolean;
|
|
20
|
-
isPinned: boolean;
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}
|
|
23
|
-
export type GetPostsListOptions = {
|
|
24
|
-
target: "front" | "admin";
|
|
25
|
-
populate?: "string";
|
|
26
|
-
q?: string;
|
|
27
|
-
lean?: "true";
|
|
28
|
-
limit?: string;
|
|
29
|
-
offset?: string;
|
|
30
|
-
category: string;
|
|
31
|
-
};
|
|
32
|
-
export default class QlPosts extends BaseSDK {
|
|
33
|
-
private relativePath;
|
|
34
|
-
constructor(options: QelosSDKOptions);
|
|
35
|
-
getByPath(categoryPath: string, postPath: string, extra?: Partial<RequestInit>): Promise<IPost>;
|
|
36
|
-
getList(options: GetPostsListOptions, extra?: Partial<RequestInit>): Promise<IPost[]>;
|
|
37
|
-
remove(path: string, extra?: Partial<RequestInit>): Promise<Response>;
|
|
38
|
-
update(path: string, changes: Partial<IPost>, extra?: Partial<RequestInit>): Promise<IPost>;
|
|
39
|
-
create(post: IPost, extra?: Partial<RequestInit>): Promise<IPost>;
|
|
40
|
-
}
|
package/dist/posts.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import BaseSDK from "./base-sdk";
|
|
2
|
-
export var PostContentState;
|
|
3
|
-
(function (PostContentState) {
|
|
4
|
-
PostContentState["EDITOR"] = "editor";
|
|
5
|
-
PostContentState["HTML"] = "html";
|
|
6
|
-
})(PostContentState || (PostContentState = {}));
|
|
7
|
-
export default class QlPosts extends BaseSDK {
|
|
8
|
-
relativePath = "/api/posts";
|
|
9
|
-
constructor(options) {
|
|
10
|
-
super(options);
|
|
11
|
-
}
|
|
12
|
-
getByPath(categoryPath, postPath, extra) {
|
|
13
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(categoryPath)}/${encodeURI(postPath)}`, extra);
|
|
14
|
-
}
|
|
15
|
-
getList(options, extra) {
|
|
16
|
-
const queryParams = new URLSearchParams(options);
|
|
17
|
-
return this.callJsonApi(`${this.relativePath}?${queryParams}`, extra);
|
|
18
|
-
}
|
|
19
|
-
remove(path, extra) {
|
|
20
|
-
return this.callApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
21
|
-
method: "delete",
|
|
22
|
-
...(extra || {}),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
update(path, changes, extra) {
|
|
26
|
-
return this.callJsonApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
27
|
-
method: "put",
|
|
28
|
-
headers: { 'content-type': 'application/json' },
|
|
29
|
-
body: JSON.stringify(changes),
|
|
30
|
-
...(extra || {}),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
create(post, extra) {
|
|
34
|
-
return this.callJsonApi(this.relativePath, {
|
|
35
|
-
method: "post",
|
|
36
|
-
headers: { 'content-type': 'application/json' },
|
|
37
|
-
body: JSON.stringify(post),
|
|
38
|
-
...(extra || {}),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=posts.js.map
|
package/dist/posts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"posts.js","sourceRoot":"","sources":["../src/posts.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;AACf,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AA6BD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,OAAO;IAClC,YAAY,GAAG,YAAY,CAAC;IAEpC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,SAAS,CACP,YAAoB,EACpB,QAAgB,EAChB,KAA4B;QAE5B,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE,EACxE,KAAK,CACN,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAA4B,EAAE,KAA4B;QAChE,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE,EACrC,KAAK,CACN,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAY,EAAE,KAA4B;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;YAC7D,MAAM,EAAE,QAAQ;YAChB,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CACJ,IAAY,EACZ,OAAuB,EACvB,KAA4B;QAE5B,OAAO,IAAI,CAAC,WAAW,CAAQ,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE;YACxE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7B,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,IAAW,EAAE,KAA4B;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAQ,IAAI,CAAC,YAAY,EAAE;YAChD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAC1B,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/categories.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { QelosSDKOptions } from "./types";
|
|
2
|
-
import BaseSDK from "./base-sdk";
|
|
3
|
-
|
|
4
|
-
export interface ICategory {
|
|
5
|
-
_id?: string;
|
|
6
|
-
created: Date;
|
|
7
|
-
isPublic: boolean;
|
|
8
|
-
name: string;
|
|
9
|
-
path: string;
|
|
10
|
-
content?: string;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default class QlCategories extends BaseSDK {
|
|
15
|
-
private relativePath = "/api/categories";
|
|
16
|
-
|
|
17
|
-
constructor(options: QelosSDKOptions) {
|
|
18
|
-
super(options);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getByPath(path: string, extra?: Partial<RequestInit>) {
|
|
22
|
-
return this.callJsonApi<ICategory>(
|
|
23
|
-
`${this.relativePath}/${encodeURI(path)}`,
|
|
24
|
-
extra
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getList(
|
|
29
|
-
options: { target: "front" | "admin" },
|
|
30
|
-
extra?: Partial<RequestInit>
|
|
31
|
-
) {
|
|
32
|
-
const queryParams = new URLSearchParams(options);
|
|
33
|
-
return this.callJsonApi<ICategory[]>(
|
|
34
|
-
`${this.relativePath}?${queryParams}`,
|
|
35
|
-
extra
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
remove(path: string): Promise<Response> {
|
|
40
|
-
return this.callApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
41
|
-
method: "delete",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
update(path: string, changes: Partial<ICategory>): Promise<ICategory> {
|
|
46
|
-
return this.callJsonApi<ICategory>(
|
|
47
|
-
`${this.relativePath}/${encodeURI(path)}`, {
|
|
48
|
-
method: "put",
|
|
49
|
-
headers: {'content-type': 'application/json'},
|
|
50
|
-
body: JSON.stringify(changes)
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
create(category: ICategory): Promise<ICategory> {
|
|
56
|
-
return this.callJsonApi<ICategory>(this.relativePath, {
|
|
57
|
-
method: "post",
|
|
58
|
-
headers: {'content-type': 'application/json'},
|
|
59
|
-
body: JSON.stringify(category),
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
package/src/posts.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { QelosSDKOptions } from "./types";
|
|
2
|
-
import BaseSDK from "./base-sdk";
|
|
3
|
-
import { ICategory } from "./categories";
|
|
4
|
-
|
|
5
|
-
export enum PostContentState {
|
|
6
|
-
EDITOR = "editor",
|
|
7
|
-
HTML = "html",
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IPost {
|
|
11
|
-
_id?: string;
|
|
12
|
-
title: string;
|
|
13
|
-
authors: any[];
|
|
14
|
-
thumbnail: string;
|
|
15
|
-
short: string;
|
|
16
|
-
contents: string[];
|
|
17
|
-
editorContentsStates: PostContentState[];
|
|
18
|
-
path: string;
|
|
19
|
-
tags: string[];
|
|
20
|
-
category: string | ICategory;
|
|
21
|
-
isPublic: boolean;
|
|
22
|
-
isPinned: boolean;
|
|
23
|
-
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type GetPostsListOptions = {
|
|
28
|
-
target: "front" | "admin";
|
|
29
|
-
populate?: "string";
|
|
30
|
-
q?: string;
|
|
31
|
-
lean?: "true";
|
|
32
|
-
limit?: string;
|
|
33
|
-
offset?: string;
|
|
34
|
-
category: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default class QlPosts extends BaseSDK {
|
|
38
|
-
private relativePath = "/api/posts";
|
|
39
|
-
|
|
40
|
-
constructor(options: QelosSDKOptions) {
|
|
41
|
-
super(options);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getByPath(
|
|
45
|
-
categoryPath: string,
|
|
46
|
-
postPath: string,
|
|
47
|
-
extra?: Partial<RequestInit>
|
|
48
|
-
) {
|
|
49
|
-
return this.callJsonApi<IPost>(
|
|
50
|
-
`${this.relativePath}/${encodeURI(categoryPath)}/${encodeURI(postPath)}`,
|
|
51
|
-
extra
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getList(options: GetPostsListOptions, extra?: Partial<RequestInit>) {
|
|
56
|
-
const queryParams = new URLSearchParams(options);
|
|
57
|
-
return this.callJsonApi<IPost[]>(
|
|
58
|
-
`${this.relativePath}?${queryParams}`,
|
|
59
|
-
extra
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
remove(path: string, extra?: Partial<RequestInit>): Promise<Response> {
|
|
64
|
-
return this.callApi(`${this.relativePath}/${encodeURI(path)}`, {
|
|
65
|
-
method: "delete",
|
|
66
|
-
...(extra || {}),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
update(
|
|
71
|
-
path: string,
|
|
72
|
-
changes: Partial<IPost>,
|
|
73
|
-
extra?: Partial<RequestInit>
|
|
74
|
-
): Promise<IPost> {
|
|
75
|
-
return this.callJsonApi<IPost>(`${this.relativePath}/${encodeURI(path)}`, {
|
|
76
|
-
method: "put",
|
|
77
|
-
headers: {'content-type': 'application/json'},
|
|
78
|
-
body: JSON.stringify(changes),
|
|
79
|
-
...(extra || {}),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
create(post: IPost, extra?: Partial<RequestInit>): Promise<IPost> {
|
|
84
|
-
return this.callJsonApi<IPost>(this.relativePath, {
|
|
85
|
-
method: "post",
|
|
86
|
-
headers: {'content-type': 'application/json'},
|
|
87
|
-
body: JSON.stringify(post),
|
|
88
|
-
...(extra || {}),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|