@webiny/wcp 6.3.0 → 6.4.0-beta.0
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.js +75 -86
- package/License.js.map +1 -1
- package/NullLicense.js +51 -53
- package/NullLicense.js.map +1 -1
- package/encryption.js +14 -18
- package/encryption.js.map +1 -1
- package/getWcpProjectEnvironment.js +7 -8
- package/getWcpProjectEnvironment.js.map +1 -1
- package/index.js +9 -8
- package/index.js.map +1 -1
- package/licenses.js +29 -39
- package/licenses.js.map +1 -1
- package/package.json +3 -3
- package/testing/createTestWcpLicense.js +49 -50
- package/testing/createTestWcpLicense.js.map +1 -1
- package/types.js +16 -20
- package/types.js.map +1 -1
- package/urls.js +10 -9
- package/urls.js.map +1 -1
package/License.js
CHANGED
|
@@ -1,92 +1,81 @@
|
|
|
1
1
|
import { getWcpProjectEnvironment } from "./getWcpProjectEnvironment.js";
|
|
2
2
|
import { getWcpProjectLicense } from "./licenses.js";
|
|
3
3
|
import { NullLicense } from "./NullLicense.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
canUseWorkflows() {
|
|
79
|
-
return this.canUseFeature("advancedPublishingWorkflow");
|
|
80
|
-
}
|
|
81
|
-
canUseAiImageEnrichment() {
|
|
82
|
-
return this.license.package.features.aiPowerups?.options?.fileManager?.imageEnrichment === true;
|
|
83
|
-
}
|
|
84
|
-
canUseAiPageGeneration() {
|
|
85
|
-
return this.license.package.features.aiPowerups?.options?.websiteBuilder?.pageGeneration === true;
|
|
86
|
-
}
|
|
87
|
-
canUseAiLexicalGeneration() {
|
|
88
|
-
return this.license.package.features.aiPowerups?.options?.lexicalGeneration === true;
|
|
89
|
-
}
|
|
4
|
+
class License {
|
|
5
|
+
static fromLicenseDto(license) {
|
|
6
|
+
if (!license) return new NullLicense();
|
|
7
|
+
return new License(license);
|
|
8
|
+
}
|
|
9
|
+
static async fromEnvironment() {
|
|
10
|
+
const wcpProjectEnvironment = getWcpProjectEnvironment();
|
|
11
|
+
if (!wcpProjectEnvironment) return new NullLicense();
|
|
12
|
+
const license = await getWcpProjectLicense({
|
|
13
|
+
orgId: wcpProjectEnvironment.org.id,
|
|
14
|
+
projectId: wcpProjectEnvironment.project.id,
|
|
15
|
+
projectEnvironmentApiKey: wcpProjectEnvironment.apiKey
|
|
16
|
+
});
|
|
17
|
+
return License.fromLicenseDto(license);
|
|
18
|
+
}
|
|
19
|
+
constructor(license){
|
|
20
|
+
this.license = license;
|
|
21
|
+
}
|
|
22
|
+
getRawLicense() {
|
|
23
|
+
return this.license;
|
|
24
|
+
}
|
|
25
|
+
toDto() {
|
|
26
|
+
return this.license;
|
|
27
|
+
}
|
|
28
|
+
getProject() {
|
|
29
|
+
return {
|
|
30
|
+
orgId: this.license.orgId,
|
|
31
|
+
projectId: this.license.projectId,
|
|
32
|
+
package: this.license.package
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
canUseFeature(wcpFeatureId) {
|
|
36
|
+
return this.license.package?.features?.[wcpFeatureId]?.enabled === true;
|
|
37
|
+
}
|
|
38
|
+
canUseAacl() {
|
|
39
|
+
return this.canUseFeature("advancedAccessControlLayer");
|
|
40
|
+
}
|
|
41
|
+
canUseTeams() {
|
|
42
|
+
if (!this.canUseAacl()) return false;
|
|
43
|
+
return this.license.package.features.advancedAccessControlLayer.options.teams;
|
|
44
|
+
}
|
|
45
|
+
canUseFolderLevelPermissions() {
|
|
46
|
+
if (!this.canUseAacl()) return false;
|
|
47
|
+
return this.license.package.features.advancedAccessControlLayer.options.folderLevelPermissions;
|
|
48
|
+
}
|
|
49
|
+
canUseHcmsFieldPermissions() {
|
|
50
|
+
if (!this.canUseAacl()) return false;
|
|
51
|
+
return this.license.package.features.advancedAccessControlLayer.options.hcmsFieldPermissions;
|
|
52
|
+
}
|
|
53
|
+
canUsePrivateFiles() {
|
|
54
|
+
if (!this.canUseAacl()) return false;
|
|
55
|
+
return this.license.package.features.advancedAccessControlLayer.options.privateFiles;
|
|
56
|
+
}
|
|
57
|
+
canUseAuditLogs() {
|
|
58
|
+
return this.canUseFeature("auditLogs");
|
|
59
|
+
}
|
|
60
|
+
canUseRecordLocking() {
|
|
61
|
+
return this.canUseFeature("recordLocking");
|
|
62
|
+
}
|
|
63
|
+
canUseFileManagerThreatDetection() {
|
|
64
|
+
return this.license.package.features.fileManager?.options.threatDetection ?? false;
|
|
65
|
+
}
|
|
66
|
+
canUseWorkflows() {
|
|
67
|
+
return this.canUseFeature("advancedPublishingWorkflow");
|
|
68
|
+
}
|
|
69
|
+
canUseAiImageEnrichment() {
|
|
70
|
+
return this.license.package.features.aiPowerups?.options?.fileManager?.imageEnrichment === true;
|
|
71
|
+
}
|
|
72
|
+
canUseAiPageGeneration() {
|
|
73
|
+
return this.license.package.features.aiPowerups?.options?.websiteBuilder?.pageGeneration === true;
|
|
74
|
+
}
|
|
75
|
+
canUseAiLexicalGeneration() {
|
|
76
|
+
return this.license.package.features.aiPowerups?.options?.lexicalGeneration === true;
|
|
77
|
+
}
|
|
90
78
|
}
|
|
79
|
+
export { License };
|
|
91
80
|
|
|
92
81
|
//# sourceMappingURL=License.js.map
|
package/License.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"License.js","sources":["../src/License.ts"],"sourcesContent":["import { getWcpProjectEnvironment } from \"./getWcpProjectEnvironment.js\";\nimport type { DecryptedWcpProjectLicense, ILicense, WcpProject } from \"./types.js\";\nimport { getWcpProjectLicense } from \"./licenses.js\";\nimport { NullLicense } from \"./NullLicense.js\";\nimport type { WCP_FEATURE_LABEL } from \"./index.js\";\n\nexport class License implements ILicense {\n private readonly license: DecryptedWcpProjectLicense;\n\n static fromLicenseDto(license: DecryptedWcpProjectLicense | null) {\n if (!license) {\n return new NullLicense();\n }\n\n return new License(license);\n }\n\n static async fromEnvironment() {\n const wcpProjectEnvironment = getWcpProjectEnvironment();\n\n if (!wcpProjectEnvironment) {\n return new NullLicense();\n }\n\n const license = await getWcpProjectLicense({\n orgId: wcpProjectEnvironment.org.id,\n projectId: wcpProjectEnvironment.project.id,\n projectEnvironmentApiKey: wcpProjectEnvironment.apiKey\n });\n\n return License.fromLicenseDto(license);\n }\n\n private constructor(license: DecryptedWcpProjectLicense) {\n this.license = license;\n }\n\n getRawLicense(): DecryptedWcpProjectLicense {\n return this.license;\n }\n\n toDto(): DecryptedWcpProjectLicense {\n return this.license;\n }\n\n getProject(): WcpProject | null {\n return {\n orgId: this.license.orgId,\n projectId: this.license.projectId,\n package: this.license.package\n };\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL) {\n return this.license.package?.features?.[wcpFeatureId]?.enabled === true;\n }\n\n canUseAacl() {\n return this.canUseFeature(\"advancedAccessControlLayer\");\n }\n\n canUseTeams() {\n if (!this.canUseAacl()) {\n return false;\n }\n\n return this.license.package.features.advancedAccessControlLayer.options.teams;\n }\n\n canUseFolderLevelPermissions() {\n if (!this.canUseAacl()) {\n return false;\n }\n\n return this.license.package.features.advancedAccessControlLayer.options\n .folderLevelPermissions;\n }\n\n canUseHcmsFieldPermissions() {\n if (!this.canUseAacl()) {\n return false;\n }\n\n return this.license.package.features.advancedAccessControlLayer.options\n .hcmsFieldPermissions;\n }\n\n canUsePrivateFiles() {\n if (!this.canUseAacl()) {\n return false;\n }\n\n return this.license.package.features.advancedAccessControlLayer.options.privateFiles;\n }\n\n canUseAuditLogs() {\n return this.canUseFeature(\"auditLogs\");\n }\n\n canUseRecordLocking() {\n return this.canUseFeature(\"recordLocking\");\n }\n\n canUseFileManagerThreatDetection() {\n return this.license.package.features.fileManager?.options.threatDetection ?? false;\n }\n\n public canUseWorkflows(): boolean {\n return this.canUseFeature(\"advancedPublishingWorkflow\");\n }\n\n canUseAiImageEnrichment(): boolean {\n return (\n this.license.package.features.aiPowerups?.options?.fileManager?.imageEnrichment === true\n );\n }\n\n canUseAiPageGeneration(): boolean {\n return (\n this.license.package.features.aiPowerups?.options?.websiteBuilder?.pageGeneration ===\n true\n );\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.license.package.features.aiPowerups?.options?.lexicalGeneration === true;\n }\n}\n"],"names":["License","license","NullLicense","wcpProjectEnvironment","getWcpProjectEnvironment","getWcpProjectLicense","wcpFeatureId"],"mappings":";;;AAMO,MAAMA;IAGT,OAAO,eAAeC,OAA0C,EAAE;QAC9D,IAAI,CAACA,SACD,OAAO,IAAIC;QAGf,OAAO,IAAIF,QAAQC;IACvB;IAEA,aAAa,kBAAkB;QAC3B,MAAME,wBAAwBC;QAE9B,IAAI,CAACD,uBACD,OAAO,IAAID;QAGf,MAAMD,UAAU,MAAMI,qBAAqB;YACvC,OAAOF,sBAAsB,GAAG,CAAC,EAAE;YACnC,WAAWA,sBAAsB,OAAO,CAAC,EAAE;YAC3C,0BAA0BA,sBAAsB,MAAM;QAC1D;QAEA,OAAOH,QAAQ,cAAc,CAACC;IAClC;IAEA,YAAoBA,OAAmC,CAAE;QACrD,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,gBAA4C;QACxC,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,QAAoC;QAChC,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,aAAgC;QAC5B,OAAO;YACH,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,WAAW,IAAI,CAAC,OAAO,CAAC,SAAS;YACjC,SAAS,IAAI,CAAC,OAAO,CAAC,OAAO;QACjC;IACJ;IAEA,cAAcK,YAA4C,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAACA,aAAa,EAAE,YAAY;IACvE;IAEA,aAAa;QACT,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B;IAEA,cAAc;QACV,IAAI,CAAC,IAAI,CAAC,UAAU,IAChB,OAAO;QAGX,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,KAAK;IACjF;IAEA,+BAA+B;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,IAChB,OAAO;QAGX,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAClE,sBAAsB;IAC/B;IAEA,6BAA6B;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,IAChB,OAAO;QAGX,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAClE,oBAAoB;IAC7B;IAEA,qBAAqB;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,IAChB,OAAO;QAGX,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,YAAY;IACxF;IAEA,kBAAkB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B;IAEA,sBAAsB;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B;IAEA,mCAAmC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,mBAAmB;IACjF;IAEO,kBAA2B;QAC9B,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B;IAEA,0BAAmC;QAC/B,OACI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,oBAAoB;IAE5F;IAEA,yBAAkC;QAC9B,OACI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,mBACnE;IAER;IAEA,4BAAqC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,sBAAsB;IACpF;AACJ"}
|
package/NullLicense.js
CHANGED
|
@@ -1,56 +1,54 @@
|
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
canUseAiLexicalGeneration() {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
1
|
+
class NullLicense {
|
|
2
|
+
getRawLicense() {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
toDto() {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
getProject() {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
canUseAacl() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
canUseAuditLogs() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
canUseFeature(featureId) {
|
|
18
|
+
if ("multiTenancy" === featureId) return "true" === process.env.WEBINY_MULTI_TENANCY;
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
canUseFileManagerThreatDetection() {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
canUseFolderLevelPermissions() {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
canUseHcmsFieldPermissions() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
canUsePrivateFiles() {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
canUseRecordLocking() {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
canUseTeams() {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
canUseWorkflows() {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
canUseAiImageEnrichment() {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
canUseAiPageGeneration() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
canUseAiLexicalGeneration() {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
54
51
|
}
|
|
52
|
+
export { NullLicense };
|
|
55
53
|
|
|
56
54
|
//# sourceMappingURL=NullLicense.js.map
|
package/NullLicense.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"NullLicense.js","sources":["../src/NullLicense.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"./index.js\";\nimport type { ILicense, WcpProject } from \"./types.js\";\n\nexport class NullLicense implements ILicense {\n getRawLicense() {\n return null;\n }\n\n toDto(): null {\n return null;\n }\n\n getProject(): WcpProject | null {\n return null;\n }\n\n canUseAacl() {\n return false;\n }\n\n canUseAuditLogs() {\n return false;\n }\n\n canUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n // For backwards compatibility, we need to check the legacy ENV variable `WEBINY_MULTI_TENANCY`.\n if (featureId === \"multiTenancy\") {\n return process.env.WEBINY_MULTI_TENANCY === \"true\";\n }\n\n return false;\n }\n\n canUseFileManagerThreatDetection() {\n return false;\n }\n\n canUseFolderLevelPermissions() {\n return false;\n }\n\n canUseHcmsFieldPermissions() {\n return false;\n }\n\n canUsePrivateFiles() {\n return false;\n }\n\n canUseRecordLocking() {\n return false;\n }\n\n canUseTeams() {\n return false;\n }\n\n public canUseWorkflows(): boolean {\n return false;\n }\n\n canUseAiImageEnrichment(): boolean {\n return false;\n }\n\n canUseAiPageGeneration(): boolean {\n return false;\n }\n\n canUseAiLexicalGeneration(): boolean {\n return false;\n }\n}\n"],"names":["NullLicense","featureId","process"],"mappings":"AAGO,MAAMA;IACT,gBAAgB;QACZ,OAAO;IACX;IAEA,QAAc;QACV,OAAO;IACX;IAEA,aAAgC;QAC5B,OAAO;IACX;IAEA,aAAa;QACT,OAAO;IACX;IAEA,kBAAkB;QACd,OAAO;IACX;IAEA,cAAcC,SAAyC,EAAW;QAE9D,IAAIA,AAAc,mBAAdA,WACA,OAAOC,AAAqC,WAArCA,QAAQ,GAAG,CAAC,oBAAoB;QAG3C,OAAO;IACX;IAEA,mCAAmC;QAC/B,OAAO;IACX;IAEA,+BAA+B;QAC3B,OAAO;IACX;IAEA,6BAA6B;QACzB,OAAO;IACX;IAEA,qBAAqB;QACjB,OAAO;IACX;IAEA,sBAAsB;QAClB,OAAO;IACX;IAEA,cAAc;QACV,OAAO;IACX;IAEO,kBAA2B;QAC9B,OAAO;IACX;IAEA,0BAAmC;QAC/B,OAAO;IACX;IAEA,yBAAkC;QAC9B,OAAO;IACX;IAEA,4BAAqC;QACjC,OAAO;IACX;AACJ"}
|
package/encryption.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
return Buffer.from(JSON.stringify(rawObject), "utf-8").toString("base64");
|
|
9
|
-
} catch {
|
|
10
|
-
throw new Error("Could not encrypt given data.");
|
|
11
|
-
}
|
|
1
|
+
const encrypt = (rawObject)=>{
|
|
2
|
+
try {
|
|
3
|
+
return Buffer.from(JSON.stringify(rawObject), "utf-8").toString("base64");
|
|
4
|
+
} catch {
|
|
5
|
+
throw new Error("Could not encrypt given data.");
|
|
6
|
+
}
|
|
12
7
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
const decrypt = (encryptedString)=>{
|
|
9
|
+
try {
|
|
10
|
+
const decryptedString = Buffer.from(encryptedString, "base64").toString("utf-8");
|
|
11
|
+
return JSON.parse(decryptedString);
|
|
12
|
+
} catch {
|
|
13
|
+
throw new Error(`Could not decrypt the given string (${encryptedString}).`);
|
|
14
|
+
}
|
|
20
15
|
};
|
|
16
|
+
export { decrypt, encrypt };
|
|
21
17
|
|
|
22
18
|
//# sourceMappingURL=encryption.js.map
|
package/encryption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"encryption.js","sources":["../src/encryption.ts"],"sourcesContent":["/**\n * For now, we're not doing actual encryption, just simple base64 encoding/decoding.\n * Potentially, we'll revisit this in the future and implement actual encryption.\n */\n\nexport const encrypt = <T = Record<string, any>>(rawObject: T): string => {\n try {\n return Buffer.from(JSON.stringify(rawObject), \"utf-8\").toString(\"base64\");\n } catch {\n throw new Error(\"Could not encrypt given data.\");\n }\n};\n\nexport const decrypt = <T = Record<string, any>>(encryptedString: string): T => {\n try {\n const decryptedString = Buffer.from(encryptedString, \"base64\").toString(\"utf-8\");\n return JSON.parse(decryptedString) as T;\n } catch {\n throw new Error(`Could not decrypt the given string (${encryptedString}).`);\n }\n};\n"],"names":["encrypt","rawObject","Buffer","JSON","Error","decrypt","encryptedString","decryptedString"],"mappings":"AAKO,MAAMA,UAAU,CAA0BC;IAC7C,IAAI;QACA,OAAOC,OAAO,IAAI,CAACC,KAAK,SAAS,CAACF,YAAY,SAAS,QAAQ,CAAC;IACpE,EAAE,OAAM;QACJ,MAAM,IAAIG,MAAM;IACpB;AACJ;AAEO,MAAMC,UAAU,CAA0BC;IAC7C,IAAI;QACA,MAAMC,kBAAkBL,OAAO,IAAI,CAACI,iBAAiB,UAAU,QAAQ,CAAC;QACxE,OAAOH,KAAK,KAAK,CAACI;IACtB,EAAE,OAAM;QACJ,MAAM,IAAIH,MAAM,CAAC,oCAAoC,EAAEE,gBAAgB,EAAE,CAAC;IAC9E;AACJ"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { decrypt } from "./encryption.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw new Error("Could not decrypt WCP_PROJECT_ENVIRONMENT environment variable data.");
|
|
2
|
+
function getWcpProjectEnvironment() {
|
|
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.");
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
return null;
|
|
8
|
+
return null;
|
|
11
9
|
}
|
|
10
|
+
export { getWcpProjectEnvironment };
|
|
12
11
|
|
|
13
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.js
CHANGED
|
@@ -4,14 +4,15 @@ export * from "./urls.js";
|
|
|
4
4
|
export * from "./License.js";
|
|
5
5
|
export * from "./NullLicense.js";
|
|
6
6
|
export * from "./getWcpProjectEnvironment.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
};
|
|
16
|
+
export { WCP_FEATURE_LABEL };
|
|
16
17
|
|
|
17
18
|
//# 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};\n"],"names":["WCP_FEATURE_LABEL"],"mappings":";;;;;;AAOO,MAAMA,oBAAoB;IAC7B,OAAO;IACP,cAAc;IACd,4BAA4B;IAC5B,4BAA4B;IAC5B,WAAW;IACX,eAAe;IACf,aAAa;AACjB"}
|
package/licenses.js
CHANGED
|
@@ -1,46 +1,36 @@
|
|
|
1
1
|
import { decrypt } from "./encryption.js";
|
|
2
2
|
import { getWcpApiUrl } from "./urls.js";
|
|
3
|
-
const fetchWcpProjectLicense = async ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": invalid response status (${response.status}, ${response.statusText})`, response);
|
|
19
|
-
return null;
|
|
20
|
-
}).catch(e => {
|
|
21
|
-
console.warn(`An error occurred while trying to retrieve the license for project "${orgId}/${projectId}": ${e.message}`, e);
|
|
22
|
-
return null;
|
|
23
|
-
});
|
|
24
|
-
return encryptedLicense;
|
|
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;
|
|
25
18
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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;
|
|
32
32
|
}
|
|
33
|
-
}
|
|
34
|
-
if (!encryptedLicense) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
return decrypt(encryptedLicense);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
const projectId = `${params.orgId}/${params.projectId}`;
|
|
41
|
-
console.warn(`An error occurred while trying to decrypt the retrieved license for project "${projectId}": ${e.message}`);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
33
|
};
|
|
34
|
+
export { getWcpProjectLicense };
|
|
45
35
|
|
|
46
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/wcp",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "Webiny Ltd.",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@webiny/build-tools": "6.
|
|
18
|
+
"@webiny/build-tools": "6.4.0-beta.0",
|
|
19
19
|
"rimraf": "6.1.3",
|
|
20
20
|
"typescript": "6.0.3"
|
|
21
21
|
},
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"__tests__"
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
|
|
32
32
|
}
|
|
@@ -1,55 +1,54 @@
|
|
|
1
1
|
import { MT_OPTIONS_MAX_COUNT_TYPE, PROJECT_PACKAGE_FEATURE_NAME } from "../types.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
}
|
|
22
49
|
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
[PROJECT_PACKAGE_FEATURE_NAME.APW]: {
|
|
26
|
-
enabled: true
|
|
27
|
-
},
|
|
28
|
-
[PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {
|
|
29
|
-
enabled: false
|
|
30
|
-
},
|
|
31
|
-
[PROJECT_PACKAGE_FEATURE_NAME.RECORD_LOCKING]: {
|
|
32
|
-
enabled: options?.recordLocking ?? false
|
|
33
|
-
},
|
|
34
|
-
[PROJECT_PACKAGE_FEATURE_NAME.SEATS]: {
|
|
35
|
-
enabled: true,
|
|
36
|
-
options: {
|
|
37
|
-
maxCount: 100
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
[PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {
|
|
41
|
-
enabled: false,
|
|
42
|
-
options: {
|
|
43
|
-
threatDetection: false
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
[PROJECT_PACKAGE_FEATURE_NAME.AI_POWERUPS]: {
|
|
47
|
-
enabled: false,
|
|
48
|
-
options: {}
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
};
|
|
51
|
+
});
|
|
52
|
+
export { createTestWcpLicense };
|
|
54
53
|
|
|
55
54
|
//# 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 }\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;YACJ;QACJ;IACJ"}
|
package/types.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
PROJECT_PACKAGE_FEATURE_NAME["AUDIT_LOGS"] = "auditLogs";
|
|
13
|
-
PROJECT_PACKAGE_FEATURE_NAME["RECORD_LOCKING"] = "recordLocking";
|
|
14
|
-
PROJECT_PACKAGE_FEATURE_NAME["FILE_MANAGER"] = "fileManager";
|
|
15
|
-
PROJECT_PACKAGE_FEATURE_NAME["AI_POWERUPS"] = "aiPowerups";
|
|
16
|
-
return PROJECT_PACKAGE_FEATURE_NAME;
|
|
1
|
+
var types_PROJECT_PACKAGE_FEATURE_NAME = /*#__PURE__*/ function(PROJECT_PACKAGE_FEATURE_NAME) {
|
|
2
|
+
PROJECT_PACKAGE_FEATURE_NAME["SEATS"] = "seats";
|
|
3
|
+
PROJECT_PACKAGE_FEATURE_NAME["MT"] = "multiTenancy";
|
|
4
|
+
PROJECT_PACKAGE_FEATURE_NAME["APW"] = "advancedPublishingWorkflow";
|
|
5
|
+
PROJECT_PACKAGE_FEATURE_NAME["AACL"] = "advancedAccessControlLayer";
|
|
6
|
+
PROJECT_PACKAGE_FEATURE_NAME["AL"] = "auditLogs";
|
|
7
|
+
PROJECT_PACKAGE_FEATURE_NAME["AUDIT_LOGS"] = "auditLogs";
|
|
8
|
+
PROJECT_PACKAGE_FEATURE_NAME["RECORD_LOCKING"] = "recordLocking";
|
|
9
|
+
PROJECT_PACKAGE_FEATURE_NAME["FILE_MANAGER"] = "fileManager";
|
|
10
|
+
PROJECT_PACKAGE_FEATURE_NAME["AI_POWERUPS"] = "aiPowerups";
|
|
11
|
+
return PROJECT_PACKAGE_FEATURE_NAME;
|
|
17
12
|
}({});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
var types_MT_OPTIONS_MAX_COUNT_TYPE = /*#__PURE__*/ function(MT_OPTIONS_MAX_COUNT_TYPE) {
|
|
14
|
+
MT_OPTIONS_MAX_COUNT_TYPE["SEAT_BASED"] = "seatBased";
|
|
15
|
+
MT_OPTIONS_MAX_COUNT_TYPE["FIXED"] = "fixed";
|
|
16
|
+
return MT_OPTIONS_MAX_COUNT_TYPE;
|
|
22
17
|
}({});
|
|
18
|
+
export { types_MT_OPTIONS_MAX_COUNT_TYPE as MT_OPTIONS_MAX_COUNT_TYPE, types_PROJECT_PACKAGE_FEATURE_NAME as PROJECT_PACKAGE_FEATURE_NAME };
|
|
23
19
|
|
|
24
20
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"./index.js\";\n\nexport interface WcpProject {\n orgId: string;\n projectId: string;\n package: {\n features: ProjectPackageFeatures;\n };\n}\n\nexport interface ILicense {\n // TODO: identify all places where raw license data is being used and refactor.\n getRawLicense: () => DecryptedWcpProjectLicense | null;\n getProject(): WcpProject | null;\n toDto(): DecryptedWcpProjectLicense | null;\n canUseFeature: (featureId: keyof typeof WCP_FEATURE_LABEL) => boolean;\n canUseAacl: () => boolean;\n canUseTeams: () => boolean;\n canUseAuditLogs: () => boolean;\n canUsePrivateFiles: () => boolean;\n canUseFileManagerThreatDetection: () => boolean;\n canUseFolderLevelPermissions: () => boolean;\n canUseRecordLocking: () => boolean;\n canUseWorkflows: () => boolean;\n canUseHcmsFieldPermissions: () => boolean;\n canUseAiImageEnrichment: () => boolean;\n canUseAiPageGeneration: () => boolean;\n canUseAiLexicalGeneration: () => boolean;\n}\n\nexport declare type WcpProjectEnvironment = {\n id: string;\n apiKey: string;\n org: {\n id: string;\n };\n project: {\n id: string;\n };\n};\n\nexport declare type EncryptedWcpProjectLicense = string;\n\nexport enum PROJECT_PACKAGE_FEATURE_NAME {\n SEATS = \"seats\",\n MT = \"multiTenancy\",\n APW = \"advancedPublishingWorkflow\",\n AACL = \"advancedAccessControlLayer\",\n /**\n * @deprecated Use `AUDIT_LOGS` instead.\n * TODO: remove oxlint disable when removing AL enum value.\n */\n // oxlint-disable-next-line typescript/no-duplicate-enum-values\n AL = \"auditLogs\",\n AUDIT_LOGS = \"auditLogs\",\n RECORD_LOCKING = \"recordLocking\",\n FILE_MANAGER = \"fileManager\",\n AI_POWERUPS = \"aiPowerups\"\n}\n\nexport enum MT_OPTIONS_MAX_COUNT_TYPE {\n SEAT_BASED = \"seatBased\",\n FIXED = \"fixed\"\n}\n\nexport interface ProjectPackageFeatures {\n [PROJECT_PACKAGE_FEATURE_NAME.SEATS]: {\n // This is always true because WCP projects immediately get access to seats (by default 1 seat).\n enabled: true;\n options: {\n maxCount: number;\n };\n };\n [PROJECT_PACKAGE_FEATURE_NAME.MT]: {\n // This is always true because WCP projects immediately get access to multi-tenancy.\n enabled: true;\n options: {\n maxCount: {\n type: MT_OPTIONS_MAX_COUNT_TYPE;\n count?: number;\n };\n };\n };\n [PROJECT_PACKAGE_FEATURE_NAME.APW]: {\n enabled: boolean;\n };\n [PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {\n enabled: boolean;\n };\n [PROJECT_PACKAGE_FEATURE_NAME.RECORD_LOCKING]: {\n enabled: boolean;\n };\n [PROJECT_PACKAGE_FEATURE_NAME.AACL]: {\n enabled: boolean;\n options: {\n teams: boolean;\n privateFiles: boolean;\n folderLevelPermissions: boolean;\n hcmsFieldPermissions: boolean;\n };\n };\n [PROJECT_PACKAGE_FEATURE_NAME.AL]: {\n enabled: boolean;\n };\n [PROJECT_PACKAGE_FEATURE_NAME.FILE_MANAGER]: {\n enabled: boolean;\n options: { threatDetection: boolean };\n };\n [PROJECT_PACKAGE_FEATURE_NAME.AI_POWERUPS]: {\n enabled: boolean;\n options: {\n websiteBuilder?: { pageGeneration?: boolean };\n fileManager?: { imageEnrichment?: boolean };\n lexicalGeneration?: boolean;\n };\n };\n}\n\nexport interface DecryptedWcpProjectLicense {\n orgId: string;\n projectId: string;\n package: {\n features: ProjectPackageFeatures;\n };\n}\n"],"names":["PROJECT_PACKAGE_FEATURE_NAME","MT_OPTIONS_MAX_COUNT_TYPE"],"mappings":"AA2CO,IAAKA,qCAA4BA,WAAAA,GAAAA,SAA5BA,4BAA4B;;;;;;;;;;WAA5BA;;AAiBL,IAAKC,kCAAyBA,WAAAA,GAAAA,SAAzBA,yBAAyB;;;WAAzBA"}
|
package/urls.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
const DEFAULT_WCP_API_URL = "https://api.webiny.com";
|
|
2
2
|
const DEFAULT_WCP_APP_URL = "https://app.webiny.com";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const getWcpApiUrl = (path)=>{
|
|
4
|
+
const apiUrl = process.env.WCP_API_URL || DEFAULT_WCP_API_URL;
|
|
5
|
+
return path ? apiUrl + path : apiUrl;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const getWcpGqlApiUrl = (path)=>{
|
|
8
|
+
const graphqlApi = getWcpApiUrl("/graphql");
|
|
9
|
+
return path ? graphqlApi + path : graphqlApi;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const getWcpAppUrl = (path)=>{
|
|
12
|
+
const appUrl = process.env.WCP_APP_URL || DEFAULT_WCP_APP_URL;
|
|
13
|
+
return path ? appUrl + path : appUrl;
|
|
14
14
|
};
|
|
15
|
+
export { getWcpApiUrl, getWcpAppUrl, getWcpGqlApiUrl };
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=urls.js.map
|
package/urls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"urls.js","sources":["../src/urls.ts"],"sourcesContent":["const DEFAULT_WCP_API_URL = \"https://api.webiny.com\";\nconst DEFAULT_WCP_APP_URL = \"https://app.webiny.com\";\n\nexport const getWcpApiUrl = (path?: string) => {\n const apiUrl = process.env.WCP_API_URL || DEFAULT_WCP_API_URL;\n return path ? apiUrl + path : apiUrl;\n};\n\nexport const getWcpGqlApiUrl = (path?: string) => {\n const graphqlApi = getWcpApiUrl(\"/graphql\");\n return path ? graphqlApi + path : graphqlApi;\n};\n\nexport const getWcpAppUrl = (path?: string) => {\n const appUrl = process.env.WCP_APP_URL || DEFAULT_WCP_APP_URL;\n return path ? appUrl + path : appUrl;\n};\n"],"names":["DEFAULT_WCP_API_URL","DEFAULT_WCP_APP_URL","getWcpApiUrl","path","apiUrl","process","getWcpGqlApiUrl","graphqlApi","getWcpAppUrl","appUrl"],"mappings":"AAAA,MAAMA,sBAAsB;AAC5B,MAAMC,sBAAsB;AAErB,MAAMC,eAAe,CAACC;IACzB,MAAMC,SAASC,QAAQ,GAAG,CAAC,WAAW,IAAIL;IAC1C,OAAOG,OAAOC,SAASD,OAAOC;AAClC;AAEO,MAAME,kBAAkB,CAACH;IAC5B,MAAMI,aAAaL,aAAa;IAChC,OAAOC,OAAOI,aAAaJ,OAAOI;AACtC;AAEO,MAAMC,eAAe,CAACL;IACzB,MAAMM,SAASJ,QAAQ,GAAG,CAAC,WAAW,IAAIJ;IAC1C,OAAOE,OAAOM,SAASN,OAAOM;AAClC"}
|