@webiny/wcp 5.42.1 → 5.42.2-beta.1
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/licenses.js +8 -2
- package/licenses.js.map +1 -1
- package/package.json +4 -4
package/licenses.js
CHANGED
|
@@ -19,8 +19,14 @@ const fetchWcpProjectLicense = async ({
|
|
|
19
19
|
headers: {
|
|
20
20
|
authorization: projectEnvironmentApiKey
|
|
21
21
|
}
|
|
22
|
-
}).then(response =>
|
|
23
|
-
|
|
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);
|
|
24
30
|
return null;
|
|
25
31
|
});
|
|
26
32
|
return encryptedLicense;
|
package/licenses.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nodeFetch","_interopRequireDefault","require","_encryption","_urls","fetchWcpProjectLicense","orgId","projectId","projectEnvironmentApiKey","getLicenseEndpoint","getWcpApiUrl","encryptedLicense","fetch","headers","authorization","then","response","json","
|
|
1
|
+
{"version":3,"names":["_nodeFetch","_interopRequireDefault","require","_encryption","_urls","fetchWcpProjectLicense","orgId","projectId","projectEnvironmentApiKey","getLicenseEndpoint","getWcpApiUrl","encryptedLicense","fetch","headers","authorization","then","response","ok","json","console","warn","status","statusText","catch","e","message","getWcpProjectLicense","params","process","env","WCP_PROJECT_LICENSE","fetchedLicense","license","decrypt","exports"],"sources":["licenses.ts"],"sourcesContent":["import fetch from \"node-fetch\";\nimport { DecryptedWcpProjectLicense, EncryptedWcpProjectLicense } from \"./types\";\nimport { decrypt } from \"./encryption\";\nimport { getWcpApiUrl } from \"./urls\";\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"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAQA,MAAMG,sBAAsB,GAAG,MAAAA,CAAO;EAClCC,KAAK;EACLC,SAAS;EACTC;AACwB,CAAC,KAAK;EAC9B;EACA,MAAMC,kBAAkB,GAAG,IAAAC,kBAAY,EAAC,SAASJ,KAA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gFb,SAAS,MAAMiB,CAAC,CAACC,OAAO,EAC5G,CAAC;IACD,OAAO,IAAI;EACf;AACJ,CAAC;AAACS,OAAA,CAAAR,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/wcp",
|
|
3
|
-
"version": "5.42.1",
|
|
3
|
+
"version": "5.42.2-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"node-fetch": "2.6.7"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@webiny/cli": "5.42.1",
|
|
18
|
-
"@webiny/project-utils": "5.42.1",
|
|
17
|
+
"@webiny/cli": "5.42.2-beta.1",
|
|
18
|
+
"@webiny/project-utils": "5.42.2-beta.1",
|
|
19
19
|
"rimraf": "6.0.1",
|
|
20
20
|
"ttypescript": "1.5.15",
|
|
21
21
|
"typescript": "4.9.5"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"__tests__"
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "128fd99b1f7671825a398761f5709ff9e87638c7"
|
|
37
37
|
}
|