@webiny/wcp 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e
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/License.d.ts +22 -5
- package/License.js +112 -73
- package/License.js.map +1 -1
- package/NullLicense.d.ts +19 -2
- package/NullLicense.js +83 -41
- package/NullLicense.js.map +1 -1
- package/README.md +7 -111
- package/encryption.js +14 -26
- package/encryption.js.map +1 -1
- package/getWcpProjectEnvironment.d.ts +1 -1
- package/getWcpProjectEnvironment.js +7 -14
- package/getWcpProjectEnvironment.js.map +1 -1
- package/index.d.ts +7 -5
- package/index.js +17 -89
- package/index.js.map +1 -1
- package/licenses.d.ts +1 -1
- package/licenses.js +31 -50
- package/licenses.js.map +1 -1
- package/package.json +13 -15
- package/testing/createTestWcpLicense.d.ts +8 -2
- package/testing/createTestWcpLicense.js +57 -53
- package/testing/createTestWcpLicense.js.map +1 -1
- package/types.d.ts +57 -8
- package/types.js +18 -20
- package/types.js.map +1 -1
- package/urls.js +10 -18
- package/urls.js.map +1 -1
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getWcpProjectEnvironment = getWcpProjectEnvironment;
|
|
7
|
-
var _encryption = require("./encryption");
|
|
1
|
+
import { decrypt } from "./encryption.js";
|
|
8
2
|
function getWcpProjectEnvironment() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw new Error("Could not decrypt WCP_PROJECT_ENVIRONMENT environment variable data.");
|
|
3
|
+
if (process.env.WCP_PROJECT_ENVIRONMENT) try {
|
|
4
|
+
return decrypt(process.env.WCP_PROJECT_ENVIRONMENT);
|
|
5
|
+
} catch {
|
|
6
|
+
throw new Error("Could not decrypt WCP_PROJECT_ENVIRONMENT environment variable data.");
|
|
14
7
|
}
|
|
15
|
-
|
|
16
|
-
return null;
|
|
8
|
+
return null;
|
|
17
9
|
}
|
|
10
|
+
export { getWcpProjectEnvironment };
|
|
18
11
|
|
|
19
12
|
//# sourceMappingURL=getWcpProjectEnvironment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getWcpProjectEnvironment.js","sources":["../src/getWcpProjectEnvironment.ts"],"sourcesContent":["import type { WcpProjectEnvironment } from \"./types.js\";\nimport { decrypt } from \"./encryption.js\";\n\nexport function getWcpProjectEnvironment(): WcpProjectEnvironment | null {\n if (process.env.WCP_PROJECT_ENVIRONMENT) {\n try {\n return decrypt<WcpProjectEnvironment>(process.env.WCP_PROJECT_ENVIRONMENT);\n } catch {\n throw new Error(\"Could not decrypt WCP_PROJECT_ENVIRONMENT environment variable data.\");\n }\n }\n return null;\n}\n"],"names":["getWcpProjectEnvironment","process","decrypt","Error"],"mappings":";AAGO,SAASA;IACZ,IAAIC,QAAQ,GAAG,CAAC,uBAAuB,EACnC,IAAI;QACA,OAAOC,QAA+BD,QAAQ,GAAG,CAAC,uBAAuB;IAC7E,EAAE,OAAM;QACJ,MAAM,IAAIE,MAAM;IACpB;IAEJ,OAAO;AACX"}
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./encryption";
|
|
2
|
-
export * from "./licenses";
|
|
3
|
-
export * from "./urls";
|
|
1
|
+
export * from "./encryption.js";
|
|
2
|
+
export * from "./licenses.js";
|
|
3
|
+
export * from "./urls.js";
|
|
4
4
|
export * from "./License.js";
|
|
5
|
-
export * from "./NullLicense";
|
|
6
|
-
export * from "./getWcpProjectEnvironment";
|
|
5
|
+
export * from "./NullLicense.js";
|
|
6
|
+
export * from "./getWcpProjectEnvironment.js";
|
|
7
7
|
export declare const WCP_FEATURE_LABEL: {
|
|
8
8
|
seats: string;
|
|
9
9
|
multiTenancy: string;
|
|
@@ -12,4 +12,6 @@ export declare const WCP_FEATURE_LABEL: {
|
|
|
12
12
|
auditLogs: string;
|
|
13
13
|
recordLocking: string;
|
|
14
14
|
fileManager: string;
|
|
15
|
+
abTesting: string;
|
|
16
|
+
collaboration: string;
|
|
15
17
|
};
|
package/index.js
CHANGED
|
@@ -1,92 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
get: function () {
|
|
18
|
-
return _encryption[key];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
var _licenses = require("./licenses");
|
|
23
|
-
Object.keys(_licenses).forEach(function (key) {
|
|
24
|
-
if (key === "default" || key === "__esModule") return;
|
|
25
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
-
if (key in exports && exports[key] === _licenses[key]) return;
|
|
27
|
-
Object.defineProperty(exports, key, {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _licenses[key];
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
var _urls = require("./urls");
|
|
35
|
-
Object.keys(_urls).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
38
|
-
if (key in exports && exports[key] === _urls[key]) return;
|
|
39
|
-
Object.defineProperty(exports, key, {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return _urls[key];
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
var _License = require("./License.js");
|
|
47
|
-
Object.keys(_License).forEach(function (key) {
|
|
48
|
-
if (key === "default" || key === "__esModule") return;
|
|
49
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
-
if (key in exports && exports[key] === _License[key]) return;
|
|
51
|
-
Object.defineProperty(exports, key, {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return _License[key];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
var _NullLicense = require("./NullLicense");
|
|
59
|
-
Object.keys(_NullLicense).forEach(function (key) {
|
|
60
|
-
if (key === "default" || key === "__esModule") return;
|
|
61
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
62
|
-
if (key in exports && exports[key] === _NullLicense[key]) return;
|
|
63
|
-
Object.defineProperty(exports, key, {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
get: function () {
|
|
66
|
-
return _NullLicense[key];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
var _getWcpProjectEnvironment = require("./getWcpProjectEnvironment");
|
|
71
|
-
Object.keys(_getWcpProjectEnvironment).forEach(function (key) {
|
|
72
|
-
if (key === "default" || key === "__esModule") return;
|
|
73
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
74
|
-
if (key in exports && exports[key] === _getWcpProjectEnvironment[key]) return;
|
|
75
|
-
Object.defineProperty(exports, key, {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () {
|
|
78
|
-
return _getWcpProjectEnvironment[key];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
const WCP_FEATURE_LABEL = exports.WCP_FEATURE_LABEL = {
|
|
83
|
-
seats: "User Seats",
|
|
84
|
-
multiTenancy: "Multi-tenancy",
|
|
85
|
-
advancedPublishingWorkflow: "Advanced Publishing Workflow (APW)",
|
|
86
|
-
advancedAccessControlLayer: "Advanced Access Control Layer (ACL)",
|
|
87
|
-
auditLogs: "Audit Logs",
|
|
88
|
-
recordLocking: "Record Locking",
|
|
89
|
-
fileManager: "File Manager"
|
|
1
|
+
export * from "./encryption.js";
|
|
2
|
+
export * from "./licenses.js";
|
|
3
|
+
export * from "./urls.js";
|
|
4
|
+
export * from "./License.js";
|
|
5
|
+
export * from "./NullLicense.js";
|
|
6
|
+
export * from "./getWcpProjectEnvironment.js";
|
|
7
|
+
const WCP_FEATURE_LABEL = {
|
|
8
|
+
seats: "User Seats",
|
|
9
|
+
multiTenancy: "Multi-tenancy",
|
|
10
|
+
advancedPublishingWorkflow: "Advanced Publishing Workflow (APW)",
|
|
11
|
+
advancedAccessControlLayer: "Advanced Access Control Layer (ACL)",
|
|
12
|
+
auditLogs: "Audit Logs",
|
|
13
|
+
recordLocking: "Record Locking",
|
|
14
|
+
fileManager: "File Manager",
|
|
15
|
+
abTesting: "A/B Testing",
|
|
16
|
+
collaboration: "Collaboration"
|
|
90
17
|
};
|
|
18
|
+
export { WCP_FEATURE_LABEL };
|
|
91
19
|
|
|
92
20
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"./encryption.js\";\nexport * from \"./licenses.js\";\nexport * from \"./urls.js\";\nexport * from \"./License.js\";\nexport * from \"./NullLicense.js\";\nexport * from \"./getWcpProjectEnvironment.js\";\n\nexport const WCP_FEATURE_LABEL = {\n seats: \"User Seats\",\n multiTenancy: \"Multi-tenancy\",\n advancedPublishingWorkflow: \"Advanced Publishing Workflow (APW)\",\n advancedAccessControlLayer: \"Advanced Access Control Layer (ACL)\",\n auditLogs: \"Audit Logs\",\n recordLocking: \"Record Locking\",\n fileManager: \"File Manager\",\n abTesting: \"A/B Testing\",\n collaboration: \"Collaboration\"\n};\n"],"names":["WCP_FEATURE_LABEL"],"mappings":";;;;;;AAOO,MAAMA,oBAAoB;IAC7B,OAAO;IACP,cAAc;IACd,4BAA4B;IAC5B,4BAA4B;IAC5B,WAAW;IACX,eAAe;IACf,aAAa;IACb,WAAW;IACX,eAAe;AACnB"}
|
package/licenses.d.ts
CHANGED
package/licenses.js
CHANGED
|
@@ -1,55 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const encryptedLicense = await (0, _nodeFetch.default)(getLicenseEndpoint, {
|
|
19
|
-
headers: {
|
|
20
|
-
authorization: projectEnvironmentApiKey
|
|
21
|
-
}
|
|
22
|
-
}).then(response => {
|
|
23
|
-
if (response.ok) {
|
|
24
|
-
return response.json();
|
|
25
|
-
}
|
|
26
|
-
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": invalid response status (${response.status}, ${response.statusText})`, response);
|
|
27
|
-
return null;
|
|
28
|
-
}).catch(e => {
|
|
29
|
-
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": ${e.message}`, e);
|
|
30
|
-
return null;
|
|
31
|
-
});
|
|
32
|
-
return encryptedLicense;
|
|
1
|
+
import { decrypt } from "./encryption.js";
|
|
2
|
+
import { getWcpApiUrl } from "./urls.js";
|
|
3
|
+
const fetchWcpProjectLicense = async ({ orgId, projectId, projectEnvironmentApiKey })=>{
|
|
4
|
+
const getLicenseEndpoint = getWcpApiUrl(`/orgs/${orgId}/projects/${projectId}/license`);
|
|
5
|
+
const encryptedLicense = await fetch(getLicenseEndpoint, {
|
|
6
|
+
headers: {
|
|
7
|
+
authorization: projectEnvironmentApiKey
|
|
8
|
+
}
|
|
9
|
+
}).then((response)=>{
|
|
10
|
+
if (response.ok) return response.json();
|
|
11
|
+
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": invalid response status (${response.status}, ${response.statusText})`, response);
|
|
12
|
+
return null;
|
|
13
|
+
}).catch((e)=>{
|
|
14
|
+
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": ${e.message}`, e);
|
|
15
|
+
return null;
|
|
16
|
+
});
|
|
17
|
+
return encryptedLicense;
|
|
33
18
|
};
|
|
34
|
-
const getWcpProjectLicense = async params
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
const getWcpProjectLicense = async (params)=>{
|
|
20
|
+
let encryptedLicense = process.env.WCP_PROJECT_LICENSE;
|
|
21
|
+
if (!encryptedLicense) {
|
|
22
|
+
const fetchedLicense = await fetchWcpProjectLicense(params);
|
|
23
|
+
if (fetchedLicense) encryptedLicense = fetchedLicense.license;
|
|
24
|
+
}
|
|
25
|
+
if (!encryptedLicense) return null;
|
|
26
|
+
try {
|
|
27
|
+
return decrypt(encryptedLicense);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
const projectId = `${params.orgId}/${params.projectId}`;
|
|
30
|
+
console.warn(`An error occurred while trying to decrypt the retrieved license for project "${projectId}": ${e.message}`);
|
|
31
|
+
return null;
|
|
40
32
|
}
|
|
41
|
-
}
|
|
42
|
-
if (!encryptedLicense) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
return (0, _encryption.decrypt)(encryptedLicense);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
const projectId = `${params.orgId}/${params.projectId}`;
|
|
49
|
-
console.warn(`An error occurred while trying to decrypt the retrieved license for project "${projectId}": ${e.message}`);
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
33
|
};
|
|
53
|
-
|
|
34
|
+
export { getWcpProjectLicense };
|
|
54
35
|
|
|
55
36
|
//# sourceMappingURL=licenses.js.map
|
package/licenses.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"licenses.js","sources":["../src/licenses.ts"],"sourcesContent":["import type { DecryptedWcpProjectLicense, EncryptedWcpProjectLicense } from \"./types.js\";\nimport { decrypt } from \"./encryption.js\";\nimport { getWcpApiUrl } from \"./urls.js\";\n\ninterface GetWcpProjectLicenseParams {\n orgId: string;\n projectId: string;\n projectEnvironmentApiKey: string;\n}\n\nconst fetchWcpProjectLicense = async ({\n orgId,\n projectId,\n projectEnvironmentApiKey\n}: GetWcpProjectLicenseParams) => {\n // Fetch and decrypt the license.\n const getLicenseEndpoint = getWcpApiUrl(`/orgs/${orgId}/projects/${projectId}/license`);\n\n const encryptedLicense: { license: EncryptedWcpProjectLicense } | null = await fetch(\n getLicenseEndpoint,\n {\n headers: { authorization: projectEnvironmentApiKey }\n }\n )\n .then(response => {\n if (response.ok) {\n return response.json();\n }\n\n console.warn(\n `An error occurred while trying to retrieve the license for project \"${orgId}/${projectId}\": invalid response status (${response.status}, ${response.statusText})`,\n response\n );\n\n return null;\n })\n .catch(e => {\n console.warn(\n `An error occurred while trying to retrieve the license for project \"${orgId}/${projectId}\": ${e.message}`,\n e\n );\n return null;\n });\n\n return encryptedLicense;\n};\n\nexport const getWcpProjectLicense = async (params: GetWcpProjectLicenseParams) => {\n let encryptedLicense = process.env.WCP_PROJECT_LICENSE;\n if (!encryptedLicense) {\n const fetchedLicense = await fetchWcpProjectLicense(params);\n if (fetchedLicense) {\n encryptedLicense = fetchedLicense.license;\n }\n }\n\n if (!encryptedLicense) {\n return null;\n }\n\n try {\n return decrypt<DecryptedWcpProjectLicense>(encryptedLicense);\n } catch (e) {\n const projectId = `${params.orgId}/${params.projectId}`;\n console.warn(\n `An error occurred while trying to decrypt the retrieved license for project \"${projectId}\": ${e.message}`\n );\n return null;\n }\n};\n"],"names":["fetchWcpProjectLicense","orgId","projectId","projectEnvironmentApiKey","getLicenseEndpoint","getWcpApiUrl","encryptedLicense","fetch","response","console","e","getWcpProjectLicense","params","process","fetchedLicense","decrypt"],"mappings":";;AAUA,MAAMA,yBAAyB,OAAO,EAClCC,KAAK,EACLC,SAAS,EACTC,wBAAwB,EACC;IAEzB,MAAMC,qBAAqBC,aAAa,CAAC,MAAM,EAAEJ,MAAM,UAAU,EAAEC,UAAU,QAAQ,CAAC;IAEtF,MAAMI,mBAAmE,MAAMC,MAC3EH,oBACA;QACI,SAAS;YAAE,eAAeD;QAAyB;IACvD,GAEC,IAAI,CAACK,CAAAA;QACF,IAAIA,SAAS,EAAE,EACX,OAAOA,SAAS,IAAI;QAGxBC,QAAQ,IAAI,CACR,CAAC,oEAAoE,EAAER,MAAM,CAAC,EAAEC,UAAU,4BAA4B,EAAEM,SAAS,MAAM,CAAC,EAAE,EAAEA,SAAS,UAAU,CAAC,CAAC,CAAC,EAClKA;QAGJ,OAAO;IACX,GACC,KAAK,CAACE,CAAAA;QACHD,QAAQ,IAAI,CACR,CAAC,oEAAoE,EAAER,MAAM,CAAC,EAAEC,UAAU,GAAG,EAAEQ,EAAE,OAAO,EAAE,EAC1GA;QAEJ,OAAO;IACX;IAEJ,OAAOJ;AACX;AAEO,MAAMK,uBAAuB,OAAOC;IACvC,IAAIN,mBAAmBO,QAAQ,GAAG,CAAC,mBAAmB;IACtD,IAAI,CAACP,kBAAkB;QACnB,MAAMQ,iBAAiB,MAAMd,uBAAuBY;QACpD,IAAIE,gBACAR,mBAAmBQ,eAAe,OAAO;IAEjD;IAEA,IAAI,CAACR,kBACD,OAAO;IAGX,IAAI;QACA,OAAOS,QAAoCT;IAC/C,EAAE,OAAOI,GAAG;QACR,MAAMR,YAAY,GAAGU,OAAO,KAAK,CAAC,CAAC,EAAEA,OAAO,SAAS,EAAE;QACvDH,QAAQ,IAAI,CACR,CAAC,6EAA6E,EAAEP,UAAU,GAAG,EAAEQ,EAAE,OAAO,EAAE;QAE9G,OAAO;IACX;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/wcp",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.0-unstable.eb81deee7e",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
5
9
|
"repository": {
|
|
6
10
|
"type": "git",
|
|
7
11
|
"url": "https://github.com/webiny/webiny-js.git",
|
|
@@ -10,26 +14,20 @@
|
|
|
10
14
|
"description": "A set of Webiny Control Panel (WCP)-related utilities.",
|
|
11
15
|
"author": "Webiny Ltd.",
|
|
12
16
|
"license": "MIT",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"node-fetch": "2.6.7"
|
|
15
|
-
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@webiny/
|
|
18
|
-
"rimraf": "6.
|
|
19
|
-
"typescript": "
|
|
18
|
+
"@webiny/build-tools": "0.0.0-unstable.eb81deee7e",
|
|
19
|
+
"rimraf": "6.1.3",
|
|
20
|
+
"typescript": "7.0.2"
|
|
20
21
|
},
|
|
21
22
|
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
"directory": "dist"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"watch": "node ../cli/bin.js run watch",
|
|
27
|
-
"build": "node ../cli/bin.js run build"
|
|
23
|
+
"access": "public"
|
|
28
24
|
},
|
|
29
25
|
"adio": {
|
|
30
26
|
"ignoreDirs": [
|
|
31
27
|
"__tests__"
|
|
32
28
|
]
|
|
33
29
|
},
|
|
34
|
-
"
|
|
30
|
+
"webiny": {
|
|
31
|
+
"publishFrom": "dist"
|
|
32
|
+
}
|
|
35
33
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import type { DecryptedWcpProjectLicense } from "../types";
|
|
2
|
-
|
|
1
|
+
import type { DecryptedWcpProjectLicense } from "../types.js";
|
|
2
|
+
interface LicenseOptions {
|
|
3
|
+
recordLocking?: boolean;
|
|
4
|
+
folderLevelPermissions?: boolean;
|
|
5
|
+
hcmsFieldPermissions?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const createTestWcpLicense: (options?: LicenseOptions) => DecryptedWcpProjectLicense;
|
|
8
|
+
export {};
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { MT_OPTIONS_MAX_COUNT_TYPE, PROJECT_PACKAGE_FEATURE_NAME } from "../types.js";
|
|
2
|
+
const createTestWcpLicense = (options)=>({
|
|
3
|
+
orgId: "org-id",
|
|
4
|
+
projectId: "project-id",
|
|
5
|
+
package: {
|
|
6
|
+
features: {
|
|
7
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AACL]: {
|
|
8
|
+
enabled: true,
|
|
9
|
+
options: {
|
|
10
|
+
teams: true,
|
|
11
|
+
folderLevelPermissions: options?.folderLevelPermissions ?? true,
|
|
12
|
+
privateFiles: true,
|
|
13
|
+
hcmsFieldPermissions: options?.hcmsFieldPermissions ?? true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
[PROJECT_PACKAGE_FEATURE_NAME.MT]: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
options: {
|
|
19
|
+
maxCount: {
|
|
20
|
+
type: MT_OPTIONS_MAX_COUNT_TYPE.SEAT_BASED
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
[PROJECT_PACKAGE_FEATURE_NAME.APW]: {
|
|
25
|
+
enabled: true
|
|
26
|
+
},
|
|
27
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {
|
|
28
|
+
enabled: false
|
|
29
|
+
},
|
|
30
|
+
[PROJECT_PACKAGE_FEATURE_NAME.RECORD_LOCKING]: {
|
|
31
|
+
enabled: options?.recordLocking ?? false
|
|
32
|
+
},
|
|
33
|
+
[PROJECT_PACKAGE_FEATURE_NAME.SEATS]: {
|
|
34
|
+
enabled: true,
|
|
35
|
+
options: {
|
|
36
|
+
maxCount: 100
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {
|
|
40
|
+
enabled: false,
|
|
41
|
+
options: {
|
|
42
|
+
threatDetection: false
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AI_POWERUPS]: {
|
|
46
|
+
enabled: false,
|
|
47
|
+
options: {}
|
|
48
|
+
},
|
|
49
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AB_TESTING]: {
|
|
50
|
+
enabled: false
|
|
51
|
+
},
|
|
52
|
+
[PROJECT_PACKAGE_FEATURE_NAME.COLLABORATION]: {
|
|
53
|
+
enabled: false,
|
|
54
|
+
options: {}
|
|
55
|
+
}
|
|
27
56
|
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
[_types.PROJECT_PACKAGE_FEATURE_NAME.APW]: {
|
|
31
|
-
enabled: false
|
|
32
|
-
},
|
|
33
|
-
[_types.PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {
|
|
34
|
-
enabled: false
|
|
35
|
-
},
|
|
36
|
-
[_types.PROJECT_PACKAGE_FEATURE_NAME.RECORD_LOCKING]: {
|
|
37
|
-
enabled: false
|
|
38
|
-
},
|
|
39
|
-
[_types.PROJECT_PACKAGE_FEATURE_NAME.SEATS]: {
|
|
40
|
-
enabled: true,
|
|
41
|
-
options: {
|
|
42
|
-
maxCount: 100
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
[_types.PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {
|
|
46
|
-
enabled: false,
|
|
47
|
-
options: {
|
|
48
|
-
threatDetection: false
|
|
49
|
-
}
|
|
50
57
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.createTestWcpLicense = createTestWcpLicense;
|
|
58
|
+
});
|
|
59
|
+
export { createTestWcpLicense };
|
|
56
60
|
|
|
57
61
|
//# sourceMappingURL=createTestWcpLicense.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"testing/createTestWcpLicense.js","sources":["../../src/testing/createTestWcpLicense.ts"],"sourcesContent":["import type { DecryptedWcpProjectLicense } from \"~/types.js\";\nimport { MT_OPTIONS_MAX_COUNT_TYPE, PROJECT_PACKAGE_FEATURE_NAME } from \"~/types.js\";\n\ninterface LicenseOptions {\n recordLocking?: boolean;\n folderLevelPermissions?: boolean;\n hcmsFieldPermissions?: boolean;\n}\n\nexport const createTestWcpLicense = (options?: LicenseOptions): DecryptedWcpProjectLicense => {\n return {\n orgId: \"org-id\",\n projectId: \"project-id\",\n package: {\n features: {\n [PROJECT_PACKAGE_FEATURE_NAME.AACL]: {\n enabled: true,\n options: {\n teams: true,\n folderLevelPermissions: options?.folderLevelPermissions ?? true,\n privateFiles: true,\n hcmsFieldPermissions: options?.hcmsFieldPermissions ?? true\n }\n },\n [PROJECT_PACKAGE_FEATURE_NAME.MT]: {\n enabled: true,\n options: {\n maxCount: {\n type: MT_OPTIONS_MAX_COUNT_TYPE.SEAT_BASED\n }\n }\n },\n [PROJECT_PACKAGE_FEATURE_NAME.APW]: {\n enabled: true\n },\n [PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {\n enabled: false\n },\n [PROJECT_PACKAGE_FEATURE_NAME.RECORD_LOCKING]: {\n enabled: options?.recordLocking ?? false\n },\n [PROJECT_PACKAGE_FEATURE_NAME.SEATS]: {\n enabled: true,\n options: {\n maxCount: 100\n }\n },\n [PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {\n enabled: false,\n options: {\n threatDetection: false\n }\n },\n [PROJECT_PACKAGE_FEATURE_NAME.AI_POWERUPS]: {\n enabled: false,\n options: {}\n },\n [PROJECT_PACKAGE_FEATURE_NAME.AB_TESTING]: {\n enabled: false\n },\n [PROJECT_PACKAGE_FEATURE_NAME.COLLABORATION]: {\n enabled: false,\n options: {}\n }\n }\n }\n };\n};\n"],"names":["createTestWcpLicense","options","PROJECT_PACKAGE_FEATURE_NAME","MT_OPTIONS_MAX_COUNT_TYPE"],"mappings":";AASO,MAAMA,uBAAuB,CAACC,UAC1B;QACH,OAAO;QACP,WAAW;QACX,SAAS;YACL,UAAU;gBACN,CAACC,6BAA6B,IAAI,CAAC,EAAE;oBACjC,SAAS;oBACT,SAAS;wBACL,OAAO;wBACP,wBAAwBD,SAAS,0BAA0B;wBAC3D,cAAc;wBACd,sBAAsBA,SAAS,wBAAwB;oBAC3D;gBACJ;gBACA,CAACC,6BAA6B,EAAE,CAAC,EAAE;oBAC/B,SAAS;oBACT,SAAS;wBACL,UAAU;4BACN,MAAMC,0BAA0B,UAAU;wBAC9C;oBACJ;gBACJ;gBACA,CAACD,6BAA6B,GAAG,CAAC,EAAE;oBAChC,SAAS;gBACb;gBACA,CAACA,6BAA6B,UAAU,CAAC,EAAE;oBACvC,SAAS;gBACb;gBACA,CAACA,6BAA6B,cAAc,CAAC,EAAE;oBAC3C,SAASD,SAAS,iBAAiB;gBACvC;gBACA,CAACC,6BAA6B,KAAK,CAAC,EAAE;oBAClC,SAAS;oBACT,SAAS;wBACL,UAAU;oBACd;gBACJ;gBACA,CAACA,6BAA6B,YAAY,CAAC,EAAE;oBACzC,SAAS;oBACT,SAAS;wBACL,iBAAiB;oBACrB;gBACJ;gBACA,CAACA,6BAA6B,WAAW,CAAC,EAAE;oBACxC,SAAS;oBACT,SAAS,CAAC;gBACd;gBACA,CAACA,6BAA6B,UAAU,CAAC,EAAE;oBACvC,SAAS;gBACb;gBACA,CAACA,6BAA6B,aAAa,CAAC,EAAE;oBAC1C,SAAS;oBACT,SAAS,CAAC;gBACd;YACJ;QACJ;IACJ"}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type { WCP_FEATURE_LABEL } from "./index";
|
|
1
|
+
import type { WCP_FEATURE_LABEL } from "./index.js";
|
|
2
2
|
export interface WcpProject {
|
|
3
3
|
orgId: string;
|
|
4
4
|
projectId: string;
|
|
5
|
+
package: {
|
|
6
|
+
features: ProjectPackageFeatures;
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
9
|
export interface ILicense {
|
|
7
10
|
getRawLicense: () => DecryptedWcpProjectLicense | null;
|
|
8
11
|
getProject(): WcpProject | null;
|
|
12
|
+
toDto(): DecryptedWcpProjectLicense | null;
|
|
9
13
|
canUseFeature: (featureId: keyof typeof WCP_FEATURE_LABEL) => boolean;
|
|
10
14
|
canUseAacl: () => boolean;
|
|
11
15
|
canUseTeams: () => boolean;
|
|
@@ -14,6 +18,22 @@ export interface ILicense {
|
|
|
14
18
|
canUseFileManagerThreatDetection: () => boolean;
|
|
15
19
|
canUseFolderLevelPermissions: () => boolean;
|
|
16
20
|
canUseRecordLocking: () => boolean;
|
|
21
|
+
canUseWorkflows: () => boolean;
|
|
22
|
+
canUseHcmsFieldPermissions: () => boolean;
|
|
23
|
+
canUseAiImageEnrichment: () => boolean;
|
|
24
|
+
canUseAiPageGeneration: () => boolean;
|
|
25
|
+
canUseAiPageTranslation: () => boolean;
|
|
26
|
+
canUseAiLexicalGeneration: () => boolean;
|
|
27
|
+
canUseAiAdminAssistant: () => boolean;
|
|
28
|
+
canUseAiEntryGeneration: () => boolean;
|
|
29
|
+
canUseAiEntryComparison: () => boolean;
|
|
30
|
+
canUseAiEntryTranslation: () => boolean;
|
|
31
|
+
canUseAbTesting: () => boolean;
|
|
32
|
+
canUseRemoteComponents: () => boolean;
|
|
33
|
+
canUseAiPowerups: () => boolean;
|
|
34
|
+
canUseCollaboration: () => boolean;
|
|
35
|
+
canUseComments: () => boolean;
|
|
36
|
+
canUseActivityLog: () => boolean;
|
|
17
37
|
}
|
|
18
38
|
export declare type WcpProjectEnvironment = {
|
|
19
39
|
id: string;
|
|
@@ -33,14 +53,15 @@ export declare enum PROJECT_PACKAGE_FEATURE_NAME {
|
|
|
33
53
|
AACL = "advancedAccessControlLayer",
|
|
34
54
|
/**
|
|
35
55
|
* @deprecated Use `AUDIT_LOGS` instead.
|
|
56
|
+
* TODO: remove oxlint disable when removing AL enum value.
|
|
36
57
|
*/
|
|
37
58
|
AL = "auditLogs",
|
|
38
|
-
/**
|
|
39
|
-
* TODO: remove eslint disable when removing AL enum value.
|
|
40
|
-
*/
|
|
41
59
|
AUDIT_LOGS = "auditLogs",
|
|
42
60
|
RECORD_LOCKING = "recordLocking",
|
|
43
|
-
FILE_MANAGER = "fileManager"
|
|
61
|
+
FILE_MANAGER = "fileManager",
|
|
62
|
+
AI_POWERUPS = "aiPowerups",
|
|
63
|
+
AB_TESTING = "abTesting",
|
|
64
|
+
COLLABORATION = "collaboration"
|
|
44
65
|
}
|
|
45
66
|
export declare enum MT_OPTIONS_MAX_COUNT_TYPE {
|
|
46
67
|
SEAT_BASED = "seatBased",
|
|
@@ -77,17 +98,45 @@ export interface ProjectPackageFeatures {
|
|
|
77
98
|
teams: boolean;
|
|
78
99
|
privateFiles: boolean;
|
|
79
100
|
folderLevelPermissions: boolean;
|
|
101
|
+
hcmsFieldPermissions: boolean;
|
|
80
102
|
};
|
|
81
103
|
};
|
|
82
|
-
[PROJECT_PACKAGE_FEATURE_NAME.AL]: {
|
|
83
|
-
enabled: boolean;
|
|
84
|
-
};
|
|
85
104
|
[PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {
|
|
86
105
|
enabled: boolean;
|
|
87
106
|
options: {
|
|
88
107
|
threatDetection: boolean;
|
|
89
108
|
};
|
|
90
109
|
};
|
|
110
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AI_POWERUPS]: {
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
options: {
|
|
113
|
+
websiteBuilder?: {
|
|
114
|
+
pageGeneration?: boolean;
|
|
115
|
+
pageTranslation?: boolean;
|
|
116
|
+
};
|
|
117
|
+
fileManager?: {
|
|
118
|
+
imageEnrichment?: boolean;
|
|
119
|
+
};
|
|
120
|
+
lexicalGeneration?: boolean;
|
|
121
|
+
adminAssistant?: boolean;
|
|
122
|
+
remoteComponents?: boolean;
|
|
123
|
+
cms?: {
|
|
124
|
+
entryGeneration?: boolean;
|
|
125
|
+
entryComparison?: boolean;
|
|
126
|
+
entryTranslation?: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
[PROJECT_PACKAGE_FEATURE_NAME.AB_TESTING]: {
|
|
131
|
+
enabled: boolean;
|
|
132
|
+
};
|
|
133
|
+
[PROJECT_PACKAGE_FEATURE_NAME.COLLABORATION]: {
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
options: {
|
|
136
|
+
comments?: boolean;
|
|
137
|
+
activityLog?: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
91
140
|
}
|
|
92
141
|
export interface DecryptedWcpProjectLicense {
|
|
93
142
|
orgId: string;
|