@nascentdigital/funnel-cms 4.4.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/api/AssetClient.d.ts +53 -0
- package/dist/api/AssetClient.js +2 -0
- package/dist/api/AssetUploadClient.d.ts +17 -0
- package/dist/api/AssetUploadClient.js +26 -0
- package/dist/api/AuthClient.d.ts +29 -0
- package/dist/api/AuthClient.js +2 -0
- package/dist/api/ChangeSetClient.d.ts +84 -0
- package/dist/api/ChangeSetClient.js +31 -0
- package/dist/api/CollectionClient.d.ts +187 -0
- package/dist/api/CollectionClient.js +2 -0
- package/dist/api/ContentClient.d.ts +43 -0
- package/dist/api/ContentClient.js +34 -0
- package/dist/api/IAssetApiClient.d.ts +9 -0
- package/dist/api/IAssetApiClient.js +2 -0
- package/dist/api/PageClient.d.ts +264 -0
- package/dist/api/PageClient.js +2 -0
- package/dist/api/SiteClient.d.ts +23 -0
- package/dist/api/SiteClient.js +2 -0
- package/dist/api/SiteConfigClient.d.ts +26 -0
- package/dist/api/SiteConfigClient.js +2 -0
- package/dist/api/UpgradeClient.d.ts +16 -0
- package/dist/api/UpgradeClient.js +2 -0
- package/dist/api/UserClient.d.ts +46 -0
- package/dist/api/UserClient.js +2 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.js +27 -0
- package/dist/errors/CMSError.d.ts +8 -0
- package/dist/errors/CMSError.js +17 -0
- package/dist/errors/CMSErrors.d.ts +5 -0
- package/dist/errors/CMSErrors.js +36 -0
- package/dist/errors/LinkedDependantsError.d.ts +21 -0
- package/dist/errors/LinkedDependantsError.js +31 -0
- package/dist/errors/LockdownError.d.ts +4 -0
- package/dist/errors/LockdownError.js +12 -0
- package/dist/errors/SlugValidationError.d.ts +21 -0
- package/dist/errors/SlugValidationError.js +23 -0
- package/dist/errors/TranslateReferencesError.d.ts +21 -0
- package/dist/errors/TranslateReferencesError.js +22 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.js +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/models/Entity.d.ts +14 -0
- package/dist/models/Entity.js +2 -0
- package/dist/models/Environment.d.ts +1 -0
- package/dist/models/Environment.js +2 -0
- package/dist/models/Pagination.d.ts +20 -0
- package/dist/models/Pagination.js +21 -0
- package/dist/models/Privilege.d.ts +57 -0
- package/dist/models/Privilege.js +163 -0
- package/dist/models/Role.d.ts +33 -0
- package/dist/models/Role.js +118 -0
- package/dist/models/SiteConfig.d.ts +14 -0
- package/dist/models/SiteConfig.js +2 -0
- package/dist/models/Upgrade.d.ts +40 -0
- package/dist/models/Upgrade.js +19 -0
- package/dist/models/User.d.ts +41 -0
- package/dist/models/User.js +71 -0
- package/dist/models/Versioned.d.ts +22 -0
- package/dist/models/Versioned.js +45 -0
- package/dist/models/index.d.ts +9 -0
- package/dist/models/index.js +25 -0
- package/dist/strapi/IStrapiContentClient.d.ts +39 -0
- package/dist/strapi/IStrapiContentClient.js +2 -0
- package/dist/strapi/Strapi.d.ts +37 -0
- package/dist/strapi/Strapi.js +156 -0
- package/dist/strapi/StrapiAssetClient.d.ts +11 -0
- package/dist/strapi/StrapiAssetClient.js +143 -0
- package/dist/strapi/StrapiAssetUploadClient.d.ts +6 -0
- package/dist/strapi/StrapiAssetUploadClient.js +109 -0
- package/dist/strapi/StrapiAuthClient.d.ts +9 -0
- package/dist/strapi/StrapiAuthClient.js +64 -0
- package/dist/strapi/StrapiChangeSetClient.d.ts +22 -0
- package/dist/strapi/StrapiChangeSetClient.js +218 -0
- package/dist/strapi/StrapiCollectionClient.d.ts +18 -0
- package/dist/strapi/StrapiCollectionClient.js +610 -0
- package/dist/strapi/StrapiContentClient.d.ts +38 -0
- package/dist/strapi/StrapiContentClient.js +105 -0
- package/dist/strapi/StrapiContentClientFactory.d.ts +13 -0
- package/dist/strapi/StrapiContentClientFactory.js +19 -0
- package/dist/strapi/StrapiPageClient.d.ts +23 -0
- package/dist/strapi/StrapiPageClient.js +882 -0
- package/dist/strapi/StrapiSiteConfigClient.d.ts +8 -0
- package/dist/strapi/StrapiSiteConfigClient.js +50 -0
- package/dist/strapi/StrapiUpgradeClient.d.ts +13 -0
- package/dist/strapi/StrapiUpgradeClient.js +118 -0
- package/dist/strapi/StrapiUserClient.d.ts +17 -0
- package/dist/strapi/StrapiUserClient.js +199 -0
- package/dist/strapi/client.d.ts +1 -0
- package/dist/strapi/client.js +17 -0
- package/dist/strapi/index.d.ts +3 -0
- package/dist/strapi/index.js +19 -0
- package/dist/strapi/models/StrapiAsset.d.ts +10 -0
- package/dist/strapi/models/StrapiAsset.js +16 -0
- package/dist/strapi/models/StrapiData.d.ts +13 -0
- package/dist/strapi/models/StrapiData.js +16 -0
- package/dist/strapi/models/StrapiFile.d.ts +18 -0
- package/dist/strapi/models/StrapiFile.js +2 -0
- package/dist/strapi/models/index.d.ts +3 -0
- package/dist/strapi/models/index.js +19 -0
- package/dist/strapi/serialization/ChangeSetData.d.ts +15 -0
- package/dist/strapi/serialization/ChangeSetData.js +76 -0
- package/dist/strapi/serialization/CollectionData.d.ts +57 -0
- package/dist/strapi/serialization/CollectionData.js +258 -0
- package/dist/strapi/serialization/CollectionSnapshotData.d.ts +16 -0
- package/dist/strapi/serialization/CollectionSnapshotData.js +66 -0
- package/dist/strapi/serialization/PageData.d.ts +126 -0
- package/dist/strapi/serialization/PageData.js +335 -0
- package/dist/strapi/serialization/PageSnapshotData.d.ts +20 -0
- package/dist/strapi/serialization/PageSnapshotData.js +69 -0
- package/dist/strapi/serialization/RoleData.d.ts +5 -0
- package/dist/strapi/serialization/RoleData.js +2 -0
- package/dist/strapi/serialization/SiteConfigData.d.ts +11 -0
- package/dist/strapi/serialization/SiteConfigData.js +23 -0
- package/dist/strapi/serialization/StrapiAssetData.d.ts +17 -0
- package/dist/strapi/serialization/StrapiAssetData.js +39 -0
- package/dist/strapi/serialization/UserData.d.ts +18 -0
- package/dist/strapi/serialization/UserData.js +42 -0
- package/dist/strapi/serialization/VersionData.d.ts +26 -0
- package/dist/strapi/serialization/VersionData.js +88 -0
- package/dist/strapi/serialization/index.d.ts +10 -0
- package/dist/strapi/serialization/index.js +26 -0
- package/dist/strapi/test.d.ts +563 -0
- package/dist/strapi/test.js +1131 -0
- package/package.json +42 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FileType, RequiredBy, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Pagination } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Provides access to (and management of) {@link File} related models.
|
|
5
|
+
*/
|
|
6
|
+
export interface AssetClient {
|
|
7
|
+
getAssets(args: AssetClient.GetAssets.Args): Promise<AssetClient.GetAssets.Result>;
|
|
8
|
+
getAsset(args: AssetClient.GetAsset.Args): Promise<AssetClient.GetAsset.Result>;
|
|
9
|
+
createAsset(args: AssetClient.CreateAsset.Args): Promise<AssetClient.CreateAsset.Result>;
|
|
10
|
+
updateAsset(args: AssetClient.UpdateAsset.Args): Promise<AssetClient.UpdateAsset.Result>;
|
|
11
|
+
deleteAsset(args: AssetClient.DeleteAsset.Args): Promise<AssetClient.DeleteAsset.Result>;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace AssetClient {
|
|
14
|
+
namespace GetAssets {
|
|
15
|
+
type Args = {
|
|
16
|
+
brand: string;
|
|
17
|
+
fileType?: FileType | ReadonlyArray<FileType>;
|
|
18
|
+
scope?: Scope;
|
|
19
|
+
tags?: Schema.TagGroup.Data;
|
|
20
|
+
pagination: Pagination;
|
|
21
|
+
};
|
|
22
|
+
type Scope = Scope.Page | Scope.Collection;
|
|
23
|
+
namespace Scope {
|
|
24
|
+
type Page = {
|
|
25
|
+
target: 'page';
|
|
26
|
+
type: Schema.Page.Type;
|
|
27
|
+
groupId: Schema.Page.GroupId;
|
|
28
|
+
};
|
|
29
|
+
type Collection = {
|
|
30
|
+
target: 'collection';
|
|
31
|
+
type: Schema.Collection.Type;
|
|
32
|
+
groupId: Schema.Collection.GroupId;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
type Result = Pagination.Paginated<Schema.Asset.Linked>;
|
|
36
|
+
}
|
|
37
|
+
namespace GetAsset {
|
|
38
|
+
type Args = Schema.Asset.Id;
|
|
39
|
+
type Result = Schema.Asset.Linked | undefined;
|
|
40
|
+
}
|
|
41
|
+
namespace CreateAsset {
|
|
42
|
+
type Args = Omit<Schema.AssetField.LinkedValue, 'id' | 'url'>;
|
|
43
|
+
type Result = Schema.Asset.Linked;
|
|
44
|
+
}
|
|
45
|
+
namespace UpdateAsset {
|
|
46
|
+
type Args = RequiredBy<Partial<Pick<Schema.AssetField.LinkedValue, 'id' | 'url' | 'name' | 'description' | 'scope' | 'tags' | 'metadata'>>, 'id'>;
|
|
47
|
+
type Result = Schema.Asset.Linked;
|
|
48
|
+
}
|
|
49
|
+
namespace DeleteAsset {
|
|
50
|
+
type Args = Schema.Asset.Id;
|
|
51
|
+
type Result = void;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { AssetClient } from './AssetClient';
|
|
3
|
+
import { IAssetApiClient } from './IAssetApiClient';
|
|
4
|
+
export declare abstract class AssetUploadClient {
|
|
5
|
+
abstract onUpload(args: AssetUploadClient.OnUpload.Args): Promise<AssetUploadClient.OnUpload.Result>;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace AssetUploadClient {
|
|
8
|
+
namespace OnUpload {
|
|
9
|
+
type Args = Omit<AssetClient.CreateAsset.Args, ''> & {
|
|
10
|
+
api: IAssetApiClient;
|
|
11
|
+
file: Blob;
|
|
12
|
+
};
|
|
13
|
+
type Result = Schema.Asset.Linked;
|
|
14
|
+
}
|
|
15
|
+
function get(): AssetUploadClient;
|
|
16
|
+
function set(client: AssetUploadClient): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetUploadClient = void 0;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
// class
|
|
6
|
+
class AssetUploadClient {
|
|
7
|
+
}
|
|
8
|
+
exports.AssetUploadClient = AssetUploadClient;
|
|
9
|
+
// extension
|
|
10
|
+
(function (AssetUploadClient) {
|
|
11
|
+
// methods
|
|
12
|
+
function get() {
|
|
13
|
+
// throw if config isn't bound
|
|
14
|
+
if (!_client) {
|
|
15
|
+
throw new funnel_core_1.IllegalStateError('Attempt to access AssetUploadClient before first call to AssetUploadClient.set()');
|
|
16
|
+
}
|
|
17
|
+
return _client;
|
|
18
|
+
}
|
|
19
|
+
AssetUploadClient.get = get;
|
|
20
|
+
function set(client) {
|
|
21
|
+
_client = client;
|
|
22
|
+
}
|
|
23
|
+
AssetUploadClient.set = set;
|
|
24
|
+
})(AssetUploadClient || (exports.AssetUploadClient = AssetUploadClient = {}));
|
|
25
|
+
// storage
|
|
26
|
+
let _client = undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Tagged } from 'type-fest';
|
|
2
|
+
import { User } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Provides authentication (and identity) apis.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthClient {
|
|
7
|
+
identify(args: AuthClient.Identify.Args): Promise<AuthClient.Identify.Result>;
|
|
8
|
+
login(args: AuthClient.Login.Args): Promise<AuthClient.Login.Result>;
|
|
9
|
+
authorize(args: AuthClient.Authorize.Args): Promise<AuthClient.Authorize.Result>;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace AuthClient {
|
|
12
|
+
type Credentials = {
|
|
13
|
+
email: string;
|
|
14
|
+
password: string;
|
|
15
|
+
};
|
|
16
|
+
type AccessToken = Tagged<string, 'funnel.AuthClient.AccessToken'>;
|
|
17
|
+
namespace Identify {
|
|
18
|
+
type Args = AccessToken;
|
|
19
|
+
type Result = User.Data | undefined;
|
|
20
|
+
}
|
|
21
|
+
namespace Login {
|
|
22
|
+
type Args = Credentials;
|
|
23
|
+
type Result = AccessToken;
|
|
24
|
+
}
|
|
25
|
+
namespace Authorize {
|
|
26
|
+
type Args = string;
|
|
27
|
+
type Result = AccessToken;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { PartialBy, RequiredBy, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Pagination } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Provides access to (and management of) {@link Schema.ChangeSet} related models.
|
|
5
|
+
*/
|
|
6
|
+
export interface ChangeSetClient {
|
|
7
|
+
/**
|
|
8
|
+
* Gets current `ChangeSet`, creating it if it doesn't exist.
|
|
9
|
+
*/
|
|
10
|
+
current(args: ChangeSetClient.Current.Args): Promise<ChangeSetClient.Current.Result>;
|
|
11
|
+
/**
|
|
12
|
+
* Lists all changesets (current and historical) as rolled-up groups.
|
|
13
|
+
*/
|
|
14
|
+
listGroups(args: ChangeSetClient.ListGroups.Args): Promise<ChangeSetClient.ListGroups.Result>;
|
|
15
|
+
/**
|
|
16
|
+
* Lists all current and historical `ChangeSet` entities.
|
|
17
|
+
*/
|
|
18
|
+
list(args: ChangeSetClient.List.Args): Promise<ChangeSetClient.List.Result>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets a specific `ChangeSet`, creating it if it doesn't exist.
|
|
21
|
+
*/
|
|
22
|
+
get(args: ChangeSetClient.Get.Args): Promise<ChangeSetClient.Get.Result>;
|
|
23
|
+
/**
|
|
24
|
+
* Updates an existing `ChangeSet`.
|
|
25
|
+
*/
|
|
26
|
+
update(args: ChangeSetClient.Update.Args): Promise<ChangeSetClient.Update.Result>;
|
|
27
|
+
/**
|
|
28
|
+
* Deletes a `ChangeSet`.
|
|
29
|
+
*/
|
|
30
|
+
delete(args: ChangeSetClient.Delete.Args): Promise<ChangeSetClient.Delete.Result>;
|
|
31
|
+
/**
|
|
32
|
+
* Commits a `ChangeSet`.
|
|
33
|
+
*/
|
|
34
|
+
commit(args: ChangeSetClient.Commit.Args): Promise<ChangeSetClient.Commit.Result>;
|
|
35
|
+
/**
|
|
36
|
+
* Reverts the specified changes in a `ChangeSet` OR all changes if no specific change ids are specified.
|
|
37
|
+
*/
|
|
38
|
+
revert(args: ChangeSetClient.Revert.Args): Promise<ChangeSetClient.Revert.Result>;
|
|
39
|
+
}
|
|
40
|
+
export declare namespace ChangeSetClient {
|
|
41
|
+
namespace Current {
|
|
42
|
+
type Args = PartialBy<Pick<Schema.ChangeSet.Data, 'brand' | 'groupId'>, 'groupId'>;
|
|
43
|
+
type Result = Schema.ChangeSet.Data;
|
|
44
|
+
}
|
|
45
|
+
namespace ListGroups {
|
|
46
|
+
type Args = Pick<Schema.ChangeSet.Data, 'brand'>;
|
|
47
|
+
type Result = Schema.ChangeSet.Data.Grouped[];
|
|
48
|
+
}
|
|
49
|
+
namespace List {
|
|
50
|
+
type Scope = 'unpublished' | 'published' | 'all';
|
|
51
|
+
namespace Scope {
|
|
52
|
+
const values: ReadonlyArray<Scope>;
|
|
53
|
+
function parse(value: string): Scope;
|
|
54
|
+
}
|
|
55
|
+
type Args = PartialBy<Pick<Schema.ChangeSet.Data, 'brand' | 'groupId'>, 'groupId'> & {
|
|
56
|
+
scope?: Scope;
|
|
57
|
+
pagination: Pagination;
|
|
58
|
+
};
|
|
59
|
+
type Result = Pagination.Paginated<Schema.ChangeSet.Data>;
|
|
60
|
+
}
|
|
61
|
+
namespace Get {
|
|
62
|
+
type Args = Schema.ChangeSet.Id;
|
|
63
|
+
type Result = Schema.ChangeSet.Data;
|
|
64
|
+
}
|
|
65
|
+
namespace Update {
|
|
66
|
+
type Args = RequiredBy<Partial<Pick<Schema.ChangeSet.Data, 'id' | 'name' | 'changes' | 'publishedOn'>>, 'id'>;
|
|
67
|
+
type Result = Schema.ChangeSet.Data;
|
|
68
|
+
}
|
|
69
|
+
namespace Delete {
|
|
70
|
+
type Args = Schema.ChangeSet.Id;
|
|
71
|
+
type Result = boolean;
|
|
72
|
+
}
|
|
73
|
+
namespace Commit {
|
|
74
|
+
type Args = Schema.ChangeSet.Id;
|
|
75
|
+
type Result = Schema.ChangeSet.Data;
|
|
76
|
+
}
|
|
77
|
+
namespace Revert {
|
|
78
|
+
type Args = {
|
|
79
|
+
changeSetId: Schema.ChangeSet.Id;
|
|
80
|
+
changeIds?: ReadonlyArray<Schema.ChangeSet.Change.Id>;
|
|
81
|
+
};
|
|
82
|
+
type Result = Schema.ChangeSet.Data | false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChangeSetClient = void 0;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
// extension
|
|
6
|
+
var ChangeSetClient;
|
|
7
|
+
(function (ChangeSetClient) {
|
|
8
|
+
let List;
|
|
9
|
+
(function (List) {
|
|
10
|
+
let Scope;
|
|
11
|
+
(function (Scope) {
|
|
12
|
+
// values
|
|
13
|
+
Scope.values = [
|
|
14
|
+
'unpublished', 'published', 'all'
|
|
15
|
+
];
|
|
16
|
+
// helpers
|
|
17
|
+
function parse(value) {
|
|
18
|
+
const normalizeValue = value.trim().toLowerCase();
|
|
19
|
+
switch (normalizeValue) {
|
|
20
|
+
case 'unpublished':
|
|
21
|
+
case 'published':
|
|
22
|
+
case 'all':
|
|
23
|
+
return normalizeValue;
|
|
24
|
+
default:
|
|
25
|
+
throw new funnel_core_1.ArgumentError(`Invalid scope: "${value}"`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
Scope.parse = parse;
|
|
29
|
+
})(Scope = List.Scope || (List.Scope = {}));
|
|
30
|
+
})(List = ChangeSetClient.List || (ChangeSetClient.List = {}));
|
|
31
|
+
})(ChangeSetClient || (exports.ChangeSetClient = ChangeSetClient = {}));
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Language, RequiredBy, Schema } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Environment, Pagination } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* Provides access to (and management of) {@link Collection} related models.
|
|
5
|
+
*/
|
|
6
|
+
export interface CollectionClient {
|
|
7
|
+
/**
|
|
8
|
+
* Fetches a count for each collection type for a given brand, including non-branded (or universal) collection
|
|
9
|
+
* instances.
|
|
10
|
+
*/
|
|
11
|
+
getOverview(args: CollectionClient.GetOverview.Args): Promise<CollectionClient.GetOverview.Result>;
|
|
12
|
+
/**
|
|
13
|
+
* Lists the items within a collection, returning a short summary for each item (e.g. groupId, type, name, etc).
|
|
14
|
+
*/
|
|
15
|
+
getItems(args: CollectionClient.GetItems.Args): Promise<CollectionClient.GetItems.Result>;
|
|
16
|
+
/**
|
|
17
|
+
* Find collections based on query.
|
|
18
|
+
* */
|
|
19
|
+
find(args: CollectionClient.Find.Args): Promise<CollectionClient.Find.Result>;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches the details for a specific collection, including a group of all related collection models (if any) for the
|
|
22
|
+
* same groupId, OR `undefined` if no collection exists for the target.
|
|
23
|
+
*/
|
|
24
|
+
getGroup(args: CollectionClient.GetGroup.Args): Promise<CollectionClient.GetGroup.Result>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetches the details for a specific collection model for a given brand
|
|
27
|
+
*/
|
|
28
|
+
get(args: CollectionClient.Get.Args): Promise<CollectionClient.Get.Result>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new collection.
|
|
31
|
+
*/
|
|
32
|
+
create(args: CollectionClient.Create.Args): Promise<CollectionClient.Create.Result>;
|
|
33
|
+
/**
|
|
34
|
+
* Duplicate collection or collection's language
|
|
35
|
+
*/
|
|
36
|
+
duplicate(args: CollectionClient.Duplicate.Args): Promise<CollectionClient.Duplicate.Result>;
|
|
37
|
+
/**
|
|
38
|
+
* Updates an existing collection.
|
|
39
|
+
*/
|
|
40
|
+
update(args: CollectionClient.Update.Args): Promise<CollectionClient.Update.Result>;
|
|
41
|
+
/**
|
|
42
|
+
* Replaces an existing collection with a new value - paves over the existing collection.
|
|
43
|
+
* */
|
|
44
|
+
replace(args: CollectionClient.Replace.Args): Promise<CollectionClient.Replace.Result>;
|
|
45
|
+
/**
|
|
46
|
+
* Unpublishes a collection.
|
|
47
|
+
*/
|
|
48
|
+
unpublish(args: CollectionClient.Unpublish.Args): Promise<CollectionClient.Unpublish.Result>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch items that depend on a collection
|
|
51
|
+
*/
|
|
52
|
+
getDependants(args: CollectionClient.GetDependants.Args): Promise<CollectionClient.GetDependants.Result>;
|
|
53
|
+
/**
|
|
54
|
+
* Fetch items that a collection has dependencies on
|
|
55
|
+
*/
|
|
56
|
+
getDependencies(args: CollectionClient.GetDependencies.Args): Promise<CollectionClient.GetDependencies.Result>;
|
|
57
|
+
}
|
|
58
|
+
export declare namespace CollectionClient {
|
|
59
|
+
namespace Query {
|
|
60
|
+
export type Paginated = Base & Criteria & WithPagination;
|
|
61
|
+
export type By<TCriteria extends Criteria.Key> = Base & RequiredBy<Criteria, TCriteria>;
|
|
62
|
+
export type ById = Base & {
|
|
63
|
+
id: Schema.Collection.Id;
|
|
64
|
+
};
|
|
65
|
+
export type ByGroupId = Base & {
|
|
66
|
+
groupId: Schema.Collection.GroupId;
|
|
67
|
+
};
|
|
68
|
+
export type ByBrand = Base & {
|
|
69
|
+
brand: string;
|
|
70
|
+
};
|
|
71
|
+
export type TagsMatch = 'any' | 'all';
|
|
72
|
+
type Base = {
|
|
73
|
+
version: Environment;
|
|
74
|
+
};
|
|
75
|
+
type WithPagination = {
|
|
76
|
+
pagination: Pagination;
|
|
77
|
+
};
|
|
78
|
+
export type Criteria = {
|
|
79
|
+
groupId?: Schema.Collection.GroupId;
|
|
80
|
+
brand?: string;
|
|
81
|
+
type?: Schema.Collection.Type | Schema.Collection.Type[];
|
|
82
|
+
name?: string;
|
|
83
|
+
language?: Language;
|
|
84
|
+
tags?: Schema.Tag.Data[];
|
|
85
|
+
tagsMatch?: TagsMatch;
|
|
86
|
+
};
|
|
87
|
+
export namespace Criteria {
|
|
88
|
+
type Key = keyof Criteria;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
91
|
+
}
|
|
92
|
+
type Update = {
|
|
93
|
+
id: Schema.Collection.Id;
|
|
94
|
+
errors: boolean;
|
|
95
|
+
updates: ReadonlyArray<Schema.Collection.Update>;
|
|
96
|
+
};
|
|
97
|
+
namespace Replace {
|
|
98
|
+
type Args = {
|
|
99
|
+
updatedCollection: Schema.Collection.Data;
|
|
100
|
+
version: Environment;
|
|
101
|
+
skipSync?: boolean;
|
|
102
|
+
};
|
|
103
|
+
type Result = Schema.Collection.Data;
|
|
104
|
+
}
|
|
105
|
+
namespace GetOverview {
|
|
106
|
+
type Args = Query.ByBrand;
|
|
107
|
+
type Result = Item[];
|
|
108
|
+
type Item = {
|
|
109
|
+
type: Schema.Collection.Type;
|
|
110
|
+
total: number;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
namespace GetItems {
|
|
114
|
+
type Args = Query.ByBrand & {
|
|
115
|
+
type: Schema.Collection.Type;
|
|
116
|
+
language: Language;
|
|
117
|
+
tags?: Schema.Tag.Data[];
|
|
118
|
+
};
|
|
119
|
+
type Result = Item[];
|
|
120
|
+
type Item = {
|
|
121
|
+
id: Schema.Collection.Id;
|
|
122
|
+
groupId: Schema.Collection.GroupId;
|
|
123
|
+
type: Schema.Collection.Type;
|
|
124
|
+
name: string;
|
|
125
|
+
refs: Record<Language, Schema.Collection.Data.AsRef>;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
namespace Find {
|
|
129
|
+
type Args = Query.Paginated;
|
|
130
|
+
type Result = Pagination.Paginated<Schema.Collection.Data>;
|
|
131
|
+
}
|
|
132
|
+
namespace GetGroup {
|
|
133
|
+
type Args = Query.ByGroupId & {
|
|
134
|
+
type: Schema.Collection.Type;
|
|
135
|
+
brand?: string;
|
|
136
|
+
language?: Language;
|
|
137
|
+
};
|
|
138
|
+
type Result = Schema.Collection.Data.AsGroup | undefined;
|
|
139
|
+
}
|
|
140
|
+
namespace Get {
|
|
141
|
+
type Args = Query.ById;
|
|
142
|
+
type Result = Schema.Collection.Data | undefined;
|
|
143
|
+
}
|
|
144
|
+
namespace Create {
|
|
145
|
+
type Args = NewArgs | NewLanguageArgs;
|
|
146
|
+
type NewArgs = Schema.Collection.Data.AsNew;
|
|
147
|
+
type NewLanguageArgs = Schema.Collection.Data.AsNewLanguage;
|
|
148
|
+
type Result = Schema.Collection.Data.AsGroup;
|
|
149
|
+
}
|
|
150
|
+
namespace Duplicate {
|
|
151
|
+
type TargetCollection = 'current' | 'new';
|
|
152
|
+
export type Args = {
|
|
153
|
+
source: Schema.Collection.Id;
|
|
154
|
+
targetCollection: TargetCollection;
|
|
155
|
+
targetLanguage: Language;
|
|
156
|
+
};
|
|
157
|
+
export type Result = Schema.Collection.Data.AsGroup;
|
|
158
|
+
export {};
|
|
159
|
+
}
|
|
160
|
+
namespace Update {
|
|
161
|
+
type Args = Update;
|
|
162
|
+
type Result = Schema.Collection.Data;
|
|
163
|
+
}
|
|
164
|
+
namespace Unpublish {
|
|
165
|
+
type Args = Schema.Collection.Id;
|
|
166
|
+
type Result = boolean;
|
|
167
|
+
}
|
|
168
|
+
namespace GetDependants {
|
|
169
|
+
type Args = {
|
|
170
|
+
id: Schema.Collection.Id;
|
|
171
|
+
version: Environment;
|
|
172
|
+
};
|
|
173
|
+
type Result = {
|
|
174
|
+
pages: Schema.Page.Data.AsLink[];
|
|
175
|
+
collections: Schema.Collection.Data.AsRef[];
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
namespace GetDependencies {
|
|
179
|
+
type Args = {
|
|
180
|
+
id: Schema.Collection.Id;
|
|
181
|
+
version: Environment;
|
|
182
|
+
};
|
|
183
|
+
type Result = {
|
|
184
|
+
collections: Schema.Collection.Data.AsRef[];
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AuthClient } from './AuthClient';
|
|
2
|
+
import { CollectionClient } from './CollectionClient';
|
|
3
|
+
import { AssetClient } from './AssetClient';
|
|
4
|
+
import { ChangeSetClient } from './ChangeSetClient';
|
|
5
|
+
import { PageClient } from './PageClient';
|
|
6
|
+
import { SiteConfigClient } from './SiteConfigClient';
|
|
7
|
+
import { UpgradeClient } from './UpgradeClient';
|
|
8
|
+
import { UserClient } from './UserClient';
|
|
9
|
+
export interface ContentClient {
|
|
10
|
+
token: AuthClient.AccessToken;
|
|
11
|
+
clearToken(): void;
|
|
12
|
+
readonly auth: AuthClient;
|
|
13
|
+
readonly changeSets: ChangeSetClient;
|
|
14
|
+
readonly files: AssetClient;
|
|
15
|
+
readonly pages: PageClient;
|
|
16
|
+
readonly collections: CollectionClient;
|
|
17
|
+
readonly upgrade: UpgradeClient;
|
|
18
|
+
readonly users: UserClient;
|
|
19
|
+
readonly siteConfig: SiteConfigClient;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace ContentClient {
|
|
22
|
+
interface Factory {
|
|
23
|
+
/**
|
|
24
|
+
* Returns an authenticated {@link ContentClient} for usage as a service account.
|
|
25
|
+
* This account should never be used for handling editor requests, since it has full
|
|
26
|
+
* access and privileges.
|
|
27
|
+
*
|
|
28
|
+
* This instance is typically shared.
|
|
29
|
+
*/
|
|
30
|
+
forServer(): ContentClient;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a new unauthenticated {@link ContentClient} for proxying actions on behalf of
|
|
33
|
+
* a content editor user. This client should **never** be stored or shared beyond a single request.
|
|
34
|
+
*/
|
|
35
|
+
forEditor(): ContentClient;
|
|
36
|
+
}
|
|
37
|
+
namespace Factory {
|
|
38
|
+
function get(): Factory;
|
|
39
|
+
function set(factory: Factory): void;
|
|
40
|
+
}
|
|
41
|
+
function forServer(): ContentClient;
|
|
42
|
+
function forEditor(): ContentClient;
|
|
43
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentClient = void 0;
|
|
4
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
5
|
+
// extension
|
|
6
|
+
var ContentClient;
|
|
7
|
+
(function (ContentClient) {
|
|
8
|
+
let Factory;
|
|
9
|
+
(function (Factory) {
|
|
10
|
+
function get() {
|
|
11
|
+
// throw if config isn't bound
|
|
12
|
+
if (!_factory) {
|
|
13
|
+
throw new funnel_core_1.IllegalStateError('Attempt to access ContentClient.Factory before first call to ContentClient.Factory.set()');
|
|
14
|
+
}
|
|
15
|
+
return _factory;
|
|
16
|
+
}
|
|
17
|
+
Factory.get = get;
|
|
18
|
+
function set(factory) {
|
|
19
|
+
_factory = factory;
|
|
20
|
+
}
|
|
21
|
+
Factory.set = set;
|
|
22
|
+
})(Factory = ContentClient.Factory || (ContentClient.Factory = {}));
|
|
23
|
+
// methods (for convenience)
|
|
24
|
+
function forServer() {
|
|
25
|
+
return Factory.get().forServer();
|
|
26
|
+
}
|
|
27
|
+
ContentClient.forServer = forServer;
|
|
28
|
+
function forEditor() {
|
|
29
|
+
return Factory.get().forEditor();
|
|
30
|
+
}
|
|
31
|
+
ContentClient.forEditor = forEditor;
|
|
32
|
+
})(ContentClient || (exports.ContentClient = ContentClient = {}));
|
|
33
|
+
// storage
|
|
34
|
+
let _factory = undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AssetClient } from './AssetClient';
|
|
2
|
+
export interface IAssetApiClient {
|
|
3
|
+
readonly token: string | undefined;
|
|
4
|
+
getAssets(args: AssetClient.GetAssets.Args): Promise<AssetClient.GetAssets.Result>;
|
|
5
|
+
getAsset(args: AssetClient.GetAsset.Args): Promise<AssetClient.GetAsset.Result>;
|
|
6
|
+
createAsset(args: AssetClient.CreateAsset.Args): Promise<AssetClient.CreateAsset.Result>;
|
|
7
|
+
updateAsset(args: AssetClient.UpdateAsset.Args): Promise<AssetClient.UpdateAsset.Result>;
|
|
8
|
+
deleteAsset(args: AssetClient.DeleteAsset.Args): Promise<AssetClient.DeleteAsset.Result>;
|
|
9
|
+
}
|