@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,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TranslateReferencesError = void 0;
|
|
4
|
+
const CMSError_1 = require("./CMSError");
|
|
5
|
+
// class
|
|
6
|
+
class TranslateReferencesError extends CMSError_1.CMSError {
|
|
7
|
+
constructor(args) {
|
|
8
|
+
// construct base
|
|
9
|
+
super(args);
|
|
10
|
+
// initialize instance variables
|
|
11
|
+
this.targetLanguage = args.targetLanguage;
|
|
12
|
+
this.untranslatedPages = args.untranslatedPages;
|
|
13
|
+
this.untranslatedCollections = args.untranslatedCollections;
|
|
14
|
+
}
|
|
15
|
+
serialize() {
|
|
16
|
+
const { targetLanguage, untranslatedPages, untranslatedCollections } = this;
|
|
17
|
+
return Object.assign(Object.assign({}, super.serialize()), { targetLanguage,
|
|
18
|
+
untranslatedPages,
|
|
19
|
+
untranslatedCollections });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TranslateReferencesError = TranslateReferencesError;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const funnel_core_1 = require("@nascentdigital/funnel-core");
|
|
18
|
+
const CMSErrors_1 = require("./CMSErrors");
|
|
19
|
+
// exports
|
|
20
|
+
__exportStar(require("./LinkedDependantsError"), exports);
|
|
21
|
+
__exportStar(require("./LockdownError"), exports);
|
|
22
|
+
__exportStar(require("./SlugValidationError"), exports);
|
|
23
|
+
__exportStar(require("./TranslateReferencesError"), exports);
|
|
24
|
+
// bind module
|
|
25
|
+
funnel_core_1.IsometricErrorUtils.registerModule(CMSErrors_1.CMSErrors);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./errors"), exports);
|
|
19
|
+
__exportStar(require("./models"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JsonObject } from 'type-fest';
|
|
2
|
+
export type Entity<TId = string, TInternal extends JsonObject = JsonObject> = {
|
|
3
|
+
__internal?: TInternal;
|
|
4
|
+
id: TId;
|
|
5
|
+
};
|
|
6
|
+
export declare namespace Entity {
|
|
7
|
+
type Id = string | number;
|
|
8
|
+
type Extend<TEntity extends Extensible, TInternal extends JsonObject = JsonObject> = TEntity & {
|
|
9
|
+
__internal: TInternal;
|
|
10
|
+
};
|
|
11
|
+
interface Extensible<TId extends Id = Id> {
|
|
12
|
+
id: TId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Environment = 'draft' | 'published';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Pagination = Pagination.Paging | Pagination.All;
|
|
2
|
+
export declare namespace Pagination {
|
|
3
|
+
type Paging = {
|
|
4
|
+
page: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
};
|
|
7
|
+
namespace Paging {
|
|
8
|
+
function filter(value: Pagination): value is Paging;
|
|
9
|
+
}
|
|
10
|
+
type All = 'all';
|
|
11
|
+
namespace All {
|
|
12
|
+
function filter(value: Pagination): value is All;
|
|
13
|
+
}
|
|
14
|
+
type Paginated<T> = {
|
|
15
|
+
items: T[];
|
|
16
|
+
page: number;
|
|
17
|
+
pageCount: number;
|
|
18
|
+
totalItemCount: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pagination = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Pagination;
|
|
6
|
+
(function (Pagination) {
|
|
7
|
+
let Paging;
|
|
8
|
+
(function (Paging) {
|
|
9
|
+
function filter(value) {
|
|
10
|
+
return typeof value === 'object' && 'page' in value;
|
|
11
|
+
}
|
|
12
|
+
Paging.filter = filter;
|
|
13
|
+
})(Paging = Pagination.Paging || (Pagination.Paging = {}));
|
|
14
|
+
let All;
|
|
15
|
+
(function (All) {
|
|
16
|
+
function filter(value) {
|
|
17
|
+
return value === 'all';
|
|
18
|
+
}
|
|
19
|
+
All.filter = filter;
|
|
20
|
+
})(All = Pagination.All || (Pagination.All = {}));
|
|
21
|
+
})(Pagination || (exports.Pagination = Pagination = {}));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type Privilege = {
|
|
2
|
+
readonly id: Privilege.Id;
|
|
3
|
+
readonly domain: Privilege.Domain;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
};
|
|
7
|
+
export declare namespace Privilege {
|
|
8
|
+
type Id = Site.Id | User.Id | ChangeSet.Id | Content.Id;
|
|
9
|
+
type DomainId = Site.DomainId | User.DomainId | ChangeSet.DomainId | Content.DomainId;
|
|
10
|
+
type Domain = {
|
|
11
|
+
id: DomainId;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
namespace Site {
|
|
16
|
+
type Id = 'site.update';
|
|
17
|
+
type DomainId = 'site';
|
|
18
|
+
const domain: Domain;
|
|
19
|
+
const Update: Privilege;
|
|
20
|
+
const all: ReadonlyArray<Privilege>;
|
|
21
|
+
}
|
|
22
|
+
namespace User {
|
|
23
|
+
type Id = 'user.view' | 'user.create' | 'user.update' | 'user.delete' | 'user.passwordReset';
|
|
24
|
+
type DomainId = 'user';
|
|
25
|
+
const domain: Domain;
|
|
26
|
+
const View: Privilege;
|
|
27
|
+
const Create: Privilege;
|
|
28
|
+
const Update: Privilege;
|
|
29
|
+
const Delete: Privilege;
|
|
30
|
+
const PasswordReset: Privilege;
|
|
31
|
+
const all: ReadonlyArray<Privilege>;
|
|
32
|
+
}
|
|
33
|
+
namespace ChangeSet {
|
|
34
|
+
type Id = 'changeset.view' | 'changeset.create' | 'changeset.update' | 'changeset.delete';
|
|
35
|
+
type DomainId = 'changeset';
|
|
36
|
+
const domain: Domain;
|
|
37
|
+
const View: Privilege;
|
|
38
|
+
const Create: Privilege;
|
|
39
|
+
const Update: Privilege;
|
|
40
|
+
const Delete: Privilege;
|
|
41
|
+
const all: ReadonlyArray<Privilege>;
|
|
42
|
+
}
|
|
43
|
+
namespace Content {
|
|
44
|
+
type Id = 'content.view' | 'content.create' | 'content.update' | 'content.publish' | 'content.unpublish' | 'content.discard';
|
|
45
|
+
type DomainId = 'content';
|
|
46
|
+
const domain: Domain;
|
|
47
|
+
const View: Privilege;
|
|
48
|
+
const Create: Privilege;
|
|
49
|
+
const Update: Privilege;
|
|
50
|
+
const Publish: Privilege;
|
|
51
|
+
const Unpublish: Privilege;
|
|
52
|
+
const Discard: Privilege;
|
|
53
|
+
const edit: ReadonlyArray<Privilege>;
|
|
54
|
+
const all: ReadonlyArray<Privilege>;
|
|
55
|
+
}
|
|
56
|
+
const all: ReadonlyArray<Privilege>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Privilege = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Privilege;
|
|
6
|
+
(function (Privilege) {
|
|
7
|
+
// site management
|
|
8
|
+
let Site;
|
|
9
|
+
(function (Site) {
|
|
10
|
+
// domain
|
|
11
|
+
Site.domain = {
|
|
12
|
+
id: 'site',
|
|
13
|
+
name: 'Site management',
|
|
14
|
+
description: 'Management of CMS/Site settings'
|
|
15
|
+
};
|
|
16
|
+
// privileges
|
|
17
|
+
Site.Update = {
|
|
18
|
+
id: 'site.update',
|
|
19
|
+
domain: Site.domain,
|
|
20
|
+
name: 'Update site',
|
|
21
|
+
description: 'Can make changes to the site/cms'
|
|
22
|
+
};
|
|
23
|
+
// all
|
|
24
|
+
Site.all = [Site.Update];
|
|
25
|
+
})(Site = Privilege.Site || (Privilege.Site = {}));
|
|
26
|
+
// user management
|
|
27
|
+
let User;
|
|
28
|
+
(function (User) {
|
|
29
|
+
// domain
|
|
30
|
+
User.domain = {
|
|
31
|
+
id: 'user',
|
|
32
|
+
name: 'User management',
|
|
33
|
+
description: 'Management of who can access the CMS'
|
|
34
|
+
};
|
|
35
|
+
// privileges
|
|
36
|
+
User.View = {
|
|
37
|
+
id: 'user.view',
|
|
38
|
+
domain: User.domain,
|
|
39
|
+
name: 'View users',
|
|
40
|
+
description: 'Can view basic details of users'
|
|
41
|
+
};
|
|
42
|
+
User.Create = {
|
|
43
|
+
id: 'user.create',
|
|
44
|
+
domain: User.domain,
|
|
45
|
+
name: 'Create users',
|
|
46
|
+
description: 'Can create users that are at/below their role'
|
|
47
|
+
};
|
|
48
|
+
User.Update = {
|
|
49
|
+
id: 'user.update',
|
|
50
|
+
domain: User.domain,
|
|
51
|
+
name: 'Update users',
|
|
52
|
+
description: 'Can update users that are at/below their role'
|
|
53
|
+
};
|
|
54
|
+
User.Delete = {
|
|
55
|
+
id: 'user.delete',
|
|
56
|
+
domain: User.domain,
|
|
57
|
+
name: 'Delete users',
|
|
58
|
+
description: 'Can delete users that are at/below their role'
|
|
59
|
+
};
|
|
60
|
+
User.PasswordReset = {
|
|
61
|
+
id: 'user.passwordReset',
|
|
62
|
+
domain: User.domain,
|
|
63
|
+
name: 'Reset password',
|
|
64
|
+
description: 'Can reset passwords of users that are at/below their role'
|
|
65
|
+
};
|
|
66
|
+
// all
|
|
67
|
+
User.all = [User.View, User.Create, User.Update, User.Delete, User.PasswordReset];
|
|
68
|
+
})(User = Privilege.User || (Privilege.User = {}));
|
|
69
|
+
// changeset management
|
|
70
|
+
let ChangeSet;
|
|
71
|
+
(function (ChangeSet) {
|
|
72
|
+
// domain
|
|
73
|
+
ChangeSet.domain = {
|
|
74
|
+
id: 'changeset',
|
|
75
|
+
name: 'Changeset management',
|
|
76
|
+
description: 'Access of publishing, unpublishing, and reverting content changes within the CMS'
|
|
77
|
+
};
|
|
78
|
+
// privileges
|
|
79
|
+
ChangeSet.View = {
|
|
80
|
+
id: 'changeset.view',
|
|
81
|
+
domain: ChangeSet.domain,
|
|
82
|
+
name: 'View changeset',
|
|
83
|
+
description: 'Can view changesets (current and historical)'
|
|
84
|
+
};
|
|
85
|
+
ChangeSet.Create = {
|
|
86
|
+
id: 'changeset.create',
|
|
87
|
+
domain: ChangeSet.domain,
|
|
88
|
+
name: 'Create changesets',
|
|
89
|
+
description: 'Can create a "named" changeset for parallel updates'
|
|
90
|
+
};
|
|
91
|
+
ChangeSet.Update = {
|
|
92
|
+
id: 'changeset.update',
|
|
93
|
+
domain: ChangeSet.domain,
|
|
94
|
+
name: 'Update changesets',
|
|
95
|
+
description: 'Can modify existing changesets (e.g. renaming it, moving items into it, etc.)'
|
|
96
|
+
};
|
|
97
|
+
ChangeSet.Delete = {
|
|
98
|
+
id: 'changeset.delete',
|
|
99
|
+
domain: ChangeSet.domain,
|
|
100
|
+
name: 'Delete changesets',
|
|
101
|
+
description: 'Can delete a "named" changeset (moving changes to the global changeset)'
|
|
102
|
+
};
|
|
103
|
+
// all
|
|
104
|
+
ChangeSet.all = [ChangeSet.View, ChangeSet.Create, ChangeSet.Update, ChangeSet.Delete];
|
|
105
|
+
})(ChangeSet = Privilege.ChangeSet || (Privilege.ChangeSet = {}));
|
|
106
|
+
// content management
|
|
107
|
+
let Content;
|
|
108
|
+
(function (Content) {
|
|
109
|
+
// domain
|
|
110
|
+
Content.domain = {
|
|
111
|
+
id: 'content',
|
|
112
|
+
name: 'Content management',
|
|
113
|
+
description: 'Management of CMS content'
|
|
114
|
+
};
|
|
115
|
+
// privileges
|
|
116
|
+
Content.View = {
|
|
117
|
+
id: 'content.view',
|
|
118
|
+
domain: Content.domain,
|
|
119
|
+
name: 'View content',
|
|
120
|
+
description: 'Can view pages, collections, and assets'
|
|
121
|
+
};
|
|
122
|
+
Content.Create = {
|
|
123
|
+
id: 'content.create',
|
|
124
|
+
domain: Content.domain,
|
|
125
|
+
name: 'Create content',
|
|
126
|
+
description: 'Can create new pages/collections and upload new assets'
|
|
127
|
+
};
|
|
128
|
+
Content.Update = {
|
|
129
|
+
id: 'content.update',
|
|
130
|
+
domain: Content.domain,
|
|
131
|
+
name: 'Update content',
|
|
132
|
+
description: 'Can update existing pages/collections'
|
|
133
|
+
};
|
|
134
|
+
Content.Publish = {
|
|
135
|
+
id: 'content.publish',
|
|
136
|
+
domain: Content.domain,
|
|
137
|
+
name: 'Publish content',
|
|
138
|
+
description: 'Can publish content into production'
|
|
139
|
+
};
|
|
140
|
+
Content.Unpublish = {
|
|
141
|
+
id: 'content.unpublish',
|
|
142
|
+
domain: Content.domain,
|
|
143
|
+
name: 'Unpublish content',
|
|
144
|
+
description: 'Can unpublish production content, moving it to a draft or archived state'
|
|
145
|
+
};
|
|
146
|
+
Content.Discard = {
|
|
147
|
+
id: 'content.discard',
|
|
148
|
+
domain: Content.domain,
|
|
149
|
+
name: 'Discard content',
|
|
150
|
+
description: 'Can discard draft page/collection changes to the last published value'
|
|
151
|
+
};
|
|
152
|
+
// all
|
|
153
|
+
Content.edit = [Content.View, Content.Create, Content.Update, Content.Discard];
|
|
154
|
+
Content.all = [Content.View, Content.Create, Content.Update, Content.Publish, Content.Unpublish, Content.Discard];
|
|
155
|
+
})(Content = Privilege.Content || (Privilege.Content = {}));
|
|
156
|
+
// all (cross domain)
|
|
157
|
+
Privilege.all = [
|
|
158
|
+
...Site.all,
|
|
159
|
+
...User.all,
|
|
160
|
+
...ChangeSet.all,
|
|
161
|
+
...Content.all
|
|
162
|
+
];
|
|
163
|
+
})(Privilege || (exports.Privilege = Privilege = {}));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Privilege } from './Privilege';
|
|
2
|
+
export declare class Role {
|
|
3
|
+
readonly id: Role.Id;
|
|
4
|
+
readonly groupName: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly privileges: ReadonlyArray<Privilege>;
|
|
8
|
+
readonly privilegeIds: ReadonlySet<Privilege.Id>;
|
|
9
|
+
constructor(args: Role.ConstructorArgs);
|
|
10
|
+
has(...privileges: Privilege.Id[]): boolean;
|
|
11
|
+
hasAny(...privileges: Privilege.Id[]): boolean;
|
|
12
|
+
compareTo(thatRaw: Role | Role.Id): number;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace Role {
|
|
15
|
+
type Id = 'owner' | 'admin' | 'manager' | 'editor' | 'viewer' | 'public';
|
|
16
|
+
namespace Id {
|
|
17
|
+
const values: ReadonlyArray<Id>;
|
|
18
|
+
}
|
|
19
|
+
const Owner: Role;
|
|
20
|
+
const Admin: Role;
|
|
21
|
+
const Manager: Role;
|
|
22
|
+
const Editor: Role;
|
|
23
|
+
const Viewer: Role;
|
|
24
|
+
const Public: Role;
|
|
25
|
+
function fromId(roleId: Role.Id): Role;
|
|
26
|
+
type ConstructorArgs = {
|
|
27
|
+
id: Id;
|
|
28
|
+
groupName: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
privileges: ReadonlyArray<Privilege>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Role = void 0;
|
|
4
|
+
const Privilege_1 = require("./Privilege");
|
|
5
|
+
// class
|
|
6
|
+
class Role {
|
|
7
|
+
constructor(args) {
|
|
8
|
+
this.id = args.id;
|
|
9
|
+
this.groupName = args.groupName;
|
|
10
|
+
this.name = args.name;
|
|
11
|
+
this.description = args.description;
|
|
12
|
+
this.privileges = args.privileges;
|
|
13
|
+
this.privilegeIds = new Set(args.privileges.map(({ id }) => id));
|
|
14
|
+
}
|
|
15
|
+
has(...privileges) {
|
|
16
|
+
const { privilegeIds } = this;
|
|
17
|
+
return privileges.every(privilegeId => privilegeIds.has(privilegeId));
|
|
18
|
+
}
|
|
19
|
+
hasAny(...privileges) {
|
|
20
|
+
const { privilegeIds } = this;
|
|
21
|
+
return privileges.some(privilegeId => privilegeIds.has(privilegeId));
|
|
22
|
+
}
|
|
23
|
+
compareTo(thatRaw) {
|
|
24
|
+
// coerce
|
|
25
|
+
const that = typeof thatRaw === 'string'
|
|
26
|
+
? Role.fromId(thatRaw)
|
|
27
|
+
: thatRaw;
|
|
28
|
+
// compare
|
|
29
|
+
const thisIndex = Role.Id.values.indexOf(this.id);
|
|
30
|
+
const thatIndex = Role.Id.values.indexOf(that.id);
|
|
31
|
+
return thisIndex === thatIndex
|
|
32
|
+
? 0
|
|
33
|
+
: thisIndex < thatIndex
|
|
34
|
+
? -1
|
|
35
|
+
: 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Role = Role;
|
|
39
|
+
// extension
|
|
40
|
+
(function (Role) {
|
|
41
|
+
let Id;
|
|
42
|
+
(function (Id) {
|
|
43
|
+
Id.values = ['owner', 'admin', 'manager', 'editor', 'viewer', 'public'];
|
|
44
|
+
})(Id = Role.Id || (Role.Id = {}));
|
|
45
|
+
// role definitions
|
|
46
|
+
Role.Owner = new Role({
|
|
47
|
+
id: 'owner',
|
|
48
|
+
groupName: 'Owners',
|
|
49
|
+
name: 'Owner',
|
|
50
|
+
description: 'A super-admin with access to everything',
|
|
51
|
+
privileges: Privilege_1.Privilege.all
|
|
52
|
+
});
|
|
53
|
+
Role.Admin = new Role({
|
|
54
|
+
id: 'admin',
|
|
55
|
+
groupName: 'Admins',
|
|
56
|
+
name: 'Admin',
|
|
57
|
+
description: 'Full access, but cannot create/delete owners OR configure site',
|
|
58
|
+
privileges: [
|
|
59
|
+
...Privilege_1.Privilege.User.all,
|
|
60
|
+
...Privilege_1.Privilege.ChangeSet.all,
|
|
61
|
+
...Privilege_1.Privilege.Content.all
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
Role.Manager = new Role({
|
|
65
|
+
id: 'manager',
|
|
66
|
+
groupName: 'Managers',
|
|
67
|
+
name: 'Manager',
|
|
68
|
+
description: 'Can manage/publish content, but not manage users',
|
|
69
|
+
privileges: [
|
|
70
|
+
...Privilege_1.Privilege.ChangeSet.all,
|
|
71
|
+
...Privilege_1.Privilege.Content.all
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
Role.Editor = new Role({
|
|
75
|
+
id: 'editor',
|
|
76
|
+
groupName: 'Editors',
|
|
77
|
+
name: 'Editor',
|
|
78
|
+
description: 'Can manage content, but not publish content or manage users',
|
|
79
|
+
privileges: [
|
|
80
|
+
...Privilege_1.Privilege.Content.edit
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
Role.Viewer = new Role({
|
|
84
|
+
id: 'viewer',
|
|
85
|
+
groupName: 'Viewers',
|
|
86
|
+
name: 'Viewer',
|
|
87
|
+
description: 'Can explore, but not change content',
|
|
88
|
+
privileges: [
|
|
89
|
+
Privilege_1.Privilege.ChangeSet.View,
|
|
90
|
+
Privilege_1.Privilege.Content.View
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
Role.Public = new Role({
|
|
94
|
+
id: 'public',
|
|
95
|
+
groupName: 'Public',
|
|
96
|
+
name: 'Public',
|
|
97
|
+
description: 'Has no access to the system',
|
|
98
|
+
privileges: []
|
|
99
|
+
});
|
|
100
|
+
// helpers
|
|
101
|
+
function fromId(roleId) {
|
|
102
|
+
switch (roleId) {
|
|
103
|
+
case 'owner':
|
|
104
|
+
return Role.Owner;
|
|
105
|
+
case 'admin':
|
|
106
|
+
return Role.Admin;
|
|
107
|
+
case 'manager':
|
|
108
|
+
return Role.Manager;
|
|
109
|
+
case 'editor':
|
|
110
|
+
return Role.Editor;
|
|
111
|
+
case 'viewer':
|
|
112
|
+
return Role.Viewer;
|
|
113
|
+
default:
|
|
114
|
+
return Role.Public;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
Role.fromId = fromId;
|
|
118
|
+
})(Role || (exports.Role = Role = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RequiredBy } from '@nascentdigital/funnel-core';
|
|
2
|
+
import { Tagged } from 'type-fest';
|
|
3
|
+
export declare namespace SiteConfig {
|
|
4
|
+
type Id = Tagged<string, 'SiteConfig.Id'>;
|
|
5
|
+
type Data = {
|
|
6
|
+
id: Id;
|
|
7
|
+
brand: string;
|
|
8
|
+
lockdownEditor: boolean;
|
|
9
|
+
};
|
|
10
|
+
namespace Data {
|
|
11
|
+
type AsDraft = Omit<Partial<Data>, 'id'>;
|
|
12
|
+
type Update = RequiredBy<Partial<Data>, 'id'>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Tagged } from 'type-fest';
|
|
2
|
+
export declare namespace Upgrade {
|
|
3
|
+
type Version = Tagged<number, 'funnel.Upgrade.Version'>;
|
|
4
|
+
type Status = Status.Pending | Status.Upgrading | Status.Failed | Status.UpToDate;
|
|
5
|
+
namespace Status {
|
|
6
|
+
type Id = Tagged<string, 'funnel.Upgrade.Status.Id'>;
|
|
7
|
+
namespace Id {
|
|
8
|
+
const unknown: Id;
|
|
9
|
+
}
|
|
10
|
+
type Pending = {
|
|
11
|
+
status: 'pending';
|
|
12
|
+
current?: Version;
|
|
13
|
+
available: ReadonlyArray<Version>;
|
|
14
|
+
dbReady: boolean;
|
|
15
|
+
};
|
|
16
|
+
type Upgrading = {
|
|
17
|
+
id: Id;
|
|
18
|
+
status: 'upgrading';
|
|
19
|
+
current?: Version;
|
|
20
|
+
active: Version;
|
|
21
|
+
};
|
|
22
|
+
type Failed = {
|
|
23
|
+
id: Id;
|
|
24
|
+
status: 'failed';
|
|
25
|
+
current?: Version;
|
|
26
|
+
failed: Version;
|
|
27
|
+
failure: string;
|
|
28
|
+
dbReady: boolean;
|
|
29
|
+
};
|
|
30
|
+
type UpToDate = {
|
|
31
|
+
status: 'up-to-date';
|
|
32
|
+
current: Version;
|
|
33
|
+
};
|
|
34
|
+
function getCurrentVersion(status: Status): Version | undefined;
|
|
35
|
+
}
|
|
36
|
+
interface Task {
|
|
37
|
+
readonly version: Version;
|
|
38
|
+
execute(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Upgrade = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Upgrade;
|
|
6
|
+
(function (Upgrade) {
|
|
7
|
+
let Status;
|
|
8
|
+
(function (Status) {
|
|
9
|
+
let Id;
|
|
10
|
+
(function (Id) {
|
|
11
|
+
Id.unknown = '__unknown__';
|
|
12
|
+
})(Id = Status.Id || (Status.Id = {}));
|
|
13
|
+
// helpers
|
|
14
|
+
function getCurrentVersion(status) {
|
|
15
|
+
return status.current;
|
|
16
|
+
}
|
|
17
|
+
Status.getCurrentVersion = getCurrentVersion;
|
|
18
|
+
})(Status = Upgrade.Status || (Upgrade.Status = {}));
|
|
19
|
+
})(Upgrade || (exports.Upgrade = Upgrade = {}));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Tagged } from 'type-fest';
|
|
2
|
+
import type { RequiredBy } from '@nascentdigital/funnel-core';
|
|
3
|
+
import { Role } from './Role';
|
|
4
|
+
import { Privilege } from './Privilege';
|
|
5
|
+
export declare class User<TBrand extends string = string> {
|
|
6
|
+
readonly data: User.Data<TBrand>;
|
|
7
|
+
readonly role: Role;
|
|
8
|
+
constructor(data: User.Data<TBrand>);
|
|
9
|
+
get isOwner(): boolean;
|
|
10
|
+
get isAdmin(): boolean;
|
|
11
|
+
get isEditor(): boolean;
|
|
12
|
+
get isViewer(): boolean;
|
|
13
|
+
get id(): User.Id;
|
|
14
|
+
get brands(): ReadonlyArray<TBrand>;
|
|
15
|
+
get username(): string;
|
|
16
|
+
get email(): string;
|
|
17
|
+
get blocked(): boolean;
|
|
18
|
+
has(...privileges: Privilege.Id[]): boolean;
|
|
19
|
+
hasAny(...privileges: Privilege.Id[]): boolean;
|
|
20
|
+
compareTo(that: User): number;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace User {
|
|
23
|
+
type Id = Tagged<string, 'funnel.User.Id'>;
|
|
24
|
+
type Data<TBrand extends string = string> = {
|
|
25
|
+
id: User.Id;
|
|
26
|
+
username: string;
|
|
27
|
+
email: string;
|
|
28
|
+
blocked: boolean;
|
|
29
|
+
role: Role.Id;
|
|
30
|
+
brands: TBrand[];
|
|
31
|
+
};
|
|
32
|
+
namespace Data {
|
|
33
|
+
type Create = Omit<Data, 'id'> & {
|
|
34
|
+
password?: string;
|
|
35
|
+
};
|
|
36
|
+
type Update = RequiredBy<Partial<Data>, 'id'> & {
|
|
37
|
+
password?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const UNAUTHENTICATED: User<string>;
|
|
41
|
+
}
|