@commercetools-frontend/application-config 21.8.1 → 21.11.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/client.d.ts +7 -0
- package/dist/commercetools-frontend-application-config.cjs.dev.js +32 -43
- package/dist/commercetools-frontend-application-config.cjs.prod.js +32 -43
- package/dist/commercetools-frontend-application-config.esm.js +30 -44
- package/dist/declarations/src/constants.d.ts +1 -0
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/declarations/src/schema.d.ts +1 -2
- package/dist/declarations/src/utils.d.ts +4 -1
- package/dist/declarations/src/validations.d.ts +1 -0
- package/package.json +7 -7
- package/schema.json +2 -21
package/client.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ declare module '*.png' {
|
|
|
13
13
|
const src: string;
|
|
14
14
|
export default src;
|
|
15
15
|
}
|
|
16
|
+
declare module '*.react.svg' {
|
|
17
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
18
|
+
const ReactComponent: FunctionComponent<
|
|
19
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
20
|
+
>;
|
|
21
|
+
export default ReactComponent;
|
|
22
|
+
}
|
|
16
23
|
declare module '*.svg' {
|
|
17
24
|
const src: string;
|
|
18
25
|
export default src;
|
|
@@ -161,10 +161,6 @@ var schemaJson = {
|
|
|
161
161
|
title: "JSON schema for Custom Application configuration files",
|
|
162
162
|
type: "object",
|
|
163
163
|
definitions: {
|
|
164
|
-
envVariablePlaceholder: {
|
|
165
|
-
type: "string",
|
|
166
|
-
pattern: "(\\$\\{env:\\w+\\})+"
|
|
167
|
-
},
|
|
168
164
|
cspDirective: {
|
|
169
165
|
type: "array",
|
|
170
166
|
items: {
|
|
@@ -184,32 +180,11 @@ var schemaJson = {
|
|
|
184
180
|
},
|
|
185
181
|
entryPointUriPath: {
|
|
186
182
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#entrypointuripath",
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
type: "string",
|
|
190
|
-
pattern: "^[^\\-_#]([0-9a-z]|[\\-_](?![\\-_])){0,62}[^\\-_#]$"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
194
|
-
}
|
|
195
|
-
]
|
|
183
|
+
type: "string"
|
|
196
184
|
},
|
|
197
185
|
cloudIdentifier: {
|
|
198
186
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#cloudidentifier",
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
"enum": [
|
|
202
|
-
"gcp-au",
|
|
203
|
-
"gcp-eu",
|
|
204
|
-
"gcp-us",
|
|
205
|
-
"aws-fra",
|
|
206
|
-
"aws-ohio"
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
211
|
-
}
|
|
212
|
-
]
|
|
187
|
+
type: "string"
|
|
213
188
|
},
|
|
214
189
|
mcApiUrl: {
|
|
215
190
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mcapiurl",
|
|
@@ -493,6 +468,26 @@ var schemaJson = {
|
|
|
493
468
|
]
|
|
494
469
|
};
|
|
495
470
|
|
|
471
|
+
/**
|
|
472
|
+
* The entryPointUriPath may be between 2 and 64 characters and only contain alphanumeric lowercase characters,
|
|
473
|
+
* non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
|
|
474
|
+
*/
|
|
475
|
+
var ENTRY_POINT_URI_PATH_REGEX = /^[^-_#]([0-9a-z]|[-_](?![-_])){0,62}[^-_#]$/g;
|
|
476
|
+
var CLOUD_IDENTIFIERS = {
|
|
477
|
+
GCP_AU: 'gcp-au',
|
|
478
|
+
GCP_EU: 'gcp-eu',
|
|
479
|
+
GCP_US: 'gcp-us',
|
|
480
|
+
AWS_FRA: 'aws-fra',
|
|
481
|
+
AWS_OHIO: 'aws-ohio'
|
|
482
|
+
};
|
|
483
|
+
var MC_API_URLS = {
|
|
484
|
+
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
485
|
+
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
486
|
+
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
487
|
+
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
488
|
+
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
489
|
+
};
|
|
490
|
+
|
|
496
491
|
var ajv = new Ajv__default["default"]({
|
|
497
492
|
strict: true,
|
|
498
493
|
useDefaults: true
|
|
@@ -529,6 +524,11 @@ var validateConfig = function validateConfig(config) {
|
|
|
529
524
|
throw new Error(printErrors(validate.errors));
|
|
530
525
|
}
|
|
531
526
|
};
|
|
527
|
+
var validateEntryPointUriPath = function validateEntryPointUriPath(config) {
|
|
528
|
+
if (!config.entryPointUriPath.match(ENTRY_POINT_URI_PATH_REGEX)) {
|
|
529
|
+
throw new Error('Invalid "entryPointUriPath". The value may be between 2 and 64 characters and only contain alphanumeric lowercase characters, non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.');
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
532
|
var validateSubmenuLinks = function validateSubmenuLinks(config) {
|
|
533
533
|
var _context4;
|
|
534
534
|
|
|
@@ -667,21 +667,6 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
|
|
|
667
667
|
});
|
|
668
668
|
};
|
|
669
669
|
|
|
670
|
-
var CLOUD_IDENTIFIERS = {
|
|
671
|
-
GCP_AU: 'gcp-au',
|
|
672
|
-
GCP_EU: 'gcp-eu',
|
|
673
|
-
GCP_US: 'gcp-us',
|
|
674
|
-
AWS_FRA: 'aws-fra',
|
|
675
|
-
AWS_OHIO: 'aws-ohio'
|
|
676
|
-
};
|
|
677
|
-
var MC_API_URLS = {
|
|
678
|
-
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
679
|
-
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
680
|
-
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
681
|
-
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
682
|
-
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
683
|
-
};
|
|
684
|
-
|
|
685
670
|
var mapCloudIdentifierToApiUrl = function mapCloudIdentifierToApiUrl(key) {
|
|
686
671
|
var _context;
|
|
687
672
|
|
|
@@ -771,8 +756,9 @@ var computeUriPath = function computeUriPath(uriPath, entryPointUriPath) {
|
|
|
771
756
|
function transformCustomApplicationConfigToData(appConfig) {
|
|
772
757
|
var _context2;
|
|
773
758
|
|
|
774
|
-
|
|
759
|
+
validateEntryPointUriPath(appConfig);
|
|
775
760
|
validateSubmenuLinks(appConfig);
|
|
761
|
+
var permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath);
|
|
776
762
|
return {
|
|
777
763
|
id: appConfig.env.production.applicationId,
|
|
778
764
|
name: appConfig.name,
|
|
@@ -901,6 +887,9 @@ var processConfig = function processConfig() {
|
|
|
901
887
|
return cachedConfig;
|
|
902
888
|
};
|
|
903
889
|
|
|
890
|
+
exports.CLOUD_IDENTIFIERS = CLOUD_IDENTIFIERS;
|
|
891
|
+
exports.ENTRY_POINT_URI_PATH_REGEX = ENTRY_POINT_URI_PATH_REGEX;
|
|
892
|
+
exports.MC_API_URLS = MC_API_URLS;
|
|
904
893
|
exports.MissingOrInvalidConfigError = MissingOrInvalidConfigError;
|
|
905
894
|
exports.getConfigPath = getConfigPath;
|
|
906
895
|
exports.processConfig = processConfig;
|
|
@@ -161,10 +161,6 @@ var schemaJson = {
|
|
|
161
161
|
title: "JSON schema for Custom Application configuration files",
|
|
162
162
|
type: "object",
|
|
163
163
|
definitions: {
|
|
164
|
-
envVariablePlaceholder: {
|
|
165
|
-
type: "string",
|
|
166
|
-
pattern: "(\\$\\{env:\\w+\\})+"
|
|
167
|
-
},
|
|
168
164
|
cspDirective: {
|
|
169
165
|
type: "array",
|
|
170
166
|
items: {
|
|
@@ -184,32 +180,11 @@ var schemaJson = {
|
|
|
184
180
|
},
|
|
185
181
|
entryPointUriPath: {
|
|
186
182
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#entrypointuripath",
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
type: "string",
|
|
190
|
-
pattern: "^[^\\-_#]([0-9a-z]|[\\-_](?![\\-_])){0,62}[^\\-_#]$"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
194
|
-
}
|
|
195
|
-
]
|
|
183
|
+
type: "string"
|
|
196
184
|
},
|
|
197
185
|
cloudIdentifier: {
|
|
198
186
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#cloudidentifier",
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
"enum": [
|
|
202
|
-
"gcp-au",
|
|
203
|
-
"gcp-eu",
|
|
204
|
-
"gcp-us",
|
|
205
|
-
"aws-fra",
|
|
206
|
-
"aws-ohio"
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
211
|
-
}
|
|
212
|
-
]
|
|
187
|
+
type: "string"
|
|
213
188
|
},
|
|
214
189
|
mcApiUrl: {
|
|
215
190
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mcapiurl",
|
|
@@ -493,6 +468,26 @@ var schemaJson = {
|
|
|
493
468
|
]
|
|
494
469
|
};
|
|
495
470
|
|
|
471
|
+
/**
|
|
472
|
+
* The entryPointUriPath may be between 2 and 64 characters and only contain alphanumeric lowercase characters,
|
|
473
|
+
* non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
|
|
474
|
+
*/
|
|
475
|
+
var ENTRY_POINT_URI_PATH_REGEX = /^[^-_#]([0-9a-z]|[-_](?![-_])){0,62}[^-_#]$/g;
|
|
476
|
+
var CLOUD_IDENTIFIERS = {
|
|
477
|
+
GCP_AU: 'gcp-au',
|
|
478
|
+
GCP_EU: 'gcp-eu',
|
|
479
|
+
GCP_US: 'gcp-us',
|
|
480
|
+
AWS_FRA: 'aws-fra',
|
|
481
|
+
AWS_OHIO: 'aws-ohio'
|
|
482
|
+
};
|
|
483
|
+
var MC_API_URLS = {
|
|
484
|
+
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
485
|
+
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
486
|
+
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
487
|
+
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
488
|
+
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
489
|
+
};
|
|
490
|
+
|
|
496
491
|
var ajv = new Ajv__default["default"]({
|
|
497
492
|
strict: true,
|
|
498
493
|
useDefaults: true
|
|
@@ -529,6 +524,11 @@ var validateConfig = function validateConfig(config) {
|
|
|
529
524
|
throw new Error(printErrors(validate.errors));
|
|
530
525
|
}
|
|
531
526
|
};
|
|
527
|
+
var validateEntryPointUriPath = function validateEntryPointUriPath(config) {
|
|
528
|
+
if (!config.entryPointUriPath.match(ENTRY_POINT_URI_PATH_REGEX)) {
|
|
529
|
+
throw new Error('Invalid "entryPointUriPath". The value may be between 2 and 64 characters and only contain alphanumeric lowercase characters, non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.');
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
532
|
var validateSubmenuLinks = function validateSubmenuLinks(config) {
|
|
533
533
|
var _context4;
|
|
534
534
|
|
|
@@ -667,21 +667,6 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
|
|
|
667
667
|
});
|
|
668
668
|
};
|
|
669
669
|
|
|
670
|
-
var CLOUD_IDENTIFIERS = {
|
|
671
|
-
GCP_AU: 'gcp-au',
|
|
672
|
-
GCP_EU: 'gcp-eu',
|
|
673
|
-
GCP_US: 'gcp-us',
|
|
674
|
-
AWS_FRA: 'aws-fra',
|
|
675
|
-
AWS_OHIO: 'aws-ohio'
|
|
676
|
-
};
|
|
677
|
-
var MC_API_URLS = {
|
|
678
|
-
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
679
|
-
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
680
|
-
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
681
|
-
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
682
|
-
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
683
|
-
};
|
|
684
|
-
|
|
685
670
|
var mapCloudIdentifierToApiUrl = function mapCloudIdentifierToApiUrl(key) {
|
|
686
671
|
var _context;
|
|
687
672
|
|
|
@@ -771,8 +756,9 @@ var computeUriPath = function computeUriPath(uriPath, entryPointUriPath) {
|
|
|
771
756
|
function transformCustomApplicationConfigToData(appConfig) {
|
|
772
757
|
var _context2;
|
|
773
758
|
|
|
774
|
-
|
|
759
|
+
validateEntryPointUriPath(appConfig);
|
|
775
760
|
validateSubmenuLinks(appConfig);
|
|
761
|
+
var permissionKeys = formatters.entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath);
|
|
776
762
|
return {
|
|
777
763
|
id: appConfig.env.production.applicationId,
|
|
778
764
|
name: appConfig.name,
|
|
@@ -901,6 +887,9 @@ var processConfig = function processConfig() {
|
|
|
901
887
|
return cachedConfig;
|
|
902
888
|
};
|
|
903
889
|
|
|
890
|
+
exports.CLOUD_IDENTIFIERS = CLOUD_IDENTIFIERS;
|
|
891
|
+
exports.ENTRY_POINT_URI_PATH_REGEX = ENTRY_POINT_URI_PATH_REGEX;
|
|
892
|
+
exports.MC_API_URLS = MC_API_URLS;
|
|
904
893
|
exports.MissingOrInvalidConfigError = MissingOrInvalidConfigError;
|
|
905
894
|
exports.getConfigPath = getConfigPath;
|
|
906
895
|
exports.processConfig = processConfig;
|
|
@@ -130,10 +130,6 @@ var schemaJson = {
|
|
|
130
130
|
title: "JSON schema for Custom Application configuration files",
|
|
131
131
|
type: "object",
|
|
132
132
|
definitions: {
|
|
133
|
-
envVariablePlaceholder: {
|
|
134
|
-
type: "string",
|
|
135
|
-
pattern: "(\\$\\{env:\\w+\\})+"
|
|
136
|
-
},
|
|
137
133
|
cspDirective: {
|
|
138
134
|
type: "array",
|
|
139
135
|
items: {
|
|
@@ -153,32 +149,11 @@ var schemaJson = {
|
|
|
153
149
|
},
|
|
154
150
|
entryPointUriPath: {
|
|
155
151
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#entrypointuripath",
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
type: "string",
|
|
159
|
-
pattern: "^[^\\-_#]([0-9a-z]|[\\-_](?![\\-_])){0,62}[^\\-_#]$"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
163
|
-
}
|
|
164
|
-
]
|
|
152
|
+
type: "string"
|
|
165
153
|
},
|
|
166
154
|
cloudIdentifier: {
|
|
167
155
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#cloudidentifier",
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
"enum": [
|
|
171
|
-
"gcp-au",
|
|
172
|
-
"gcp-eu",
|
|
173
|
-
"gcp-us",
|
|
174
|
-
"aws-fra",
|
|
175
|
-
"aws-ohio"
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
$ref: "#/definitions/envVariablePlaceholder"
|
|
180
|
-
}
|
|
181
|
-
]
|
|
156
|
+
type: "string"
|
|
182
157
|
},
|
|
183
158
|
mcApiUrl: {
|
|
184
159
|
description: "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mcapiurl",
|
|
@@ -462,6 +437,26 @@ var schemaJson = {
|
|
|
462
437
|
]
|
|
463
438
|
};
|
|
464
439
|
|
|
440
|
+
/**
|
|
441
|
+
* The entryPointUriPath may be between 2 and 64 characters and only contain alphanumeric lowercase characters,
|
|
442
|
+
* non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.
|
|
443
|
+
*/
|
|
444
|
+
var ENTRY_POINT_URI_PATH_REGEX = /^[^-_#]([0-9a-z]|[-_](?![-_])){0,62}[^-_#]$/g;
|
|
445
|
+
var CLOUD_IDENTIFIERS = {
|
|
446
|
+
GCP_AU: 'gcp-au',
|
|
447
|
+
GCP_EU: 'gcp-eu',
|
|
448
|
+
GCP_US: 'gcp-us',
|
|
449
|
+
AWS_FRA: 'aws-fra',
|
|
450
|
+
AWS_OHIO: 'aws-ohio'
|
|
451
|
+
};
|
|
452
|
+
var MC_API_URLS = {
|
|
453
|
+
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
454
|
+
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
455
|
+
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
456
|
+
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
457
|
+
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
458
|
+
};
|
|
459
|
+
|
|
465
460
|
var ajv = new Ajv({
|
|
466
461
|
strict: true,
|
|
467
462
|
useDefaults: true
|
|
@@ -498,6 +493,11 @@ var validateConfig = function validateConfig(config) {
|
|
|
498
493
|
throw new Error(printErrors(validate.errors));
|
|
499
494
|
}
|
|
500
495
|
};
|
|
496
|
+
var validateEntryPointUriPath = function validateEntryPointUriPath(config) {
|
|
497
|
+
if (!config.entryPointUriPath.match(ENTRY_POINT_URI_PATH_REGEX)) {
|
|
498
|
+
throw new Error('Invalid "entryPointUriPath". The value may be between 2 and 64 characters and only contain alphanumeric lowercase characters, non-consecutive underscores and hyphens. Leading and trailing underscore and hyphens are also not allowed.');
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
501
|
var validateSubmenuLinks = function validateSubmenuLinks(config) {
|
|
502
502
|
var _context4;
|
|
503
503
|
|
|
@@ -636,21 +636,6 @@ var substituteVariablePlaceholders = function substituteVariablePlaceholders(con
|
|
|
636
636
|
});
|
|
637
637
|
};
|
|
638
638
|
|
|
639
|
-
var CLOUD_IDENTIFIERS = {
|
|
640
|
-
GCP_AU: 'gcp-au',
|
|
641
|
-
GCP_EU: 'gcp-eu',
|
|
642
|
-
GCP_US: 'gcp-us',
|
|
643
|
-
AWS_FRA: 'aws-fra',
|
|
644
|
-
AWS_OHIO: 'aws-ohio'
|
|
645
|
-
};
|
|
646
|
-
var MC_API_URLS = {
|
|
647
|
-
GCP_AU: 'https://mc-api.australia-southeast1.gcp.commercetools.com',
|
|
648
|
-
GCP_EU: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
649
|
-
GCP_US: 'https://mc-api.us-central1.gcp.commercetools.com',
|
|
650
|
-
AWS_FRA: 'https://mc-api.eu-central-1.aws.commercetools.com',
|
|
651
|
-
AWS_OHIO: 'https://mc-api.us-east-2.aws.commercetools.com'
|
|
652
|
-
};
|
|
653
|
-
|
|
654
639
|
var mapCloudIdentifierToApiUrl = function mapCloudIdentifierToApiUrl(key) {
|
|
655
640
|
var _context;
|
|
656
641
|
|
|
@@ -740,8 +725,9 @@ var computeUriPath = function computeUriPath(uriPath, entryPointUriPath) {
|
|
|
740
725
|
function transformCustomApplicationConfigToData(appConfig) {
|
|
741
726
|
var _context2;
|
|
742
727
|
|
|
743
|
-
|
|
728
|
+
validateEntryPointUriPath(appConfig);
|
|
744
729
|
validateSubmenuLinks(appConfig);
|
|
730
|
+
var permissionKeys = entryPointUriPathToResourceAccesses(appConfig.entryPointUriPath);
|
|
745
731
|
return {
|
|
746
732
|
id: appConfig.env.production.applicationId,
|
|
747
733
|
name: appConfig.name,
|
|
@@ -870,4 +856,4 @@ var processConfig = function processConfig() {
|
|
|
870
856
|
return cachedConfig;
|
|
871
857
|
};
|
|
872
858
|
|
|
873
|
-
export { MissingOrInvalidConfigError, getConfigPath, processConfig };
|
|
859
|
+
export { CLOUD_IDENTIFIERS, ENTRY_POINT_URI_PATH_REGEX, MC_API_URLS, MissingOrInvalidConfigError, getConfigPath, processConfig };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export declare type EnvVariablePlaceholder = string;
|
|
2
1
|
export declare type CspDirective = string[];
|
|
3
2
|
export interface JSONSchemaForCustomApplicationConfigurationFiles {
|
|
4
3
|
name: string;
|
|
5
4
|
description?: string;
|
|
6
5
|
entryPointUriPath: string;
|
|
7
|
-
cloudIdentifier:
|
|
6
|
+
cloudIdentifier: string;
|
|
8
7
|
mcApiUrl?: string;
|
|
9
8
|
oAuthScopes: {
|
|
10
9
|
view: string[];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="webpack-env" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
/// <reference types="node" />
|
|
3
6
|
import { CLOUD_IDENTIFIERS } from './constants';
|
|
4
|
-
declare const mapCloudIdentifierToApiUrl: (key: typeof CLOUD_IDENTIFIERS[keyof typeof CLOUD_IDENTIFIERS]) => string;
|
|
7
|
+
declare const mapCloudIdentifierToApiUrl: (key: (typeof CLOUD_IDENTIFIERS)[keyof typeof CLOUD_IDENTIFIERS]) => string;
|
|
5
8
|
declare const getUniqueValues: (initialValues?: string[], additionalValues?: string[]) => string[];
|
|
6
9
|
declare const getIsProd: (env: NodeJS.ProcessEnv) => boolean;
|
|
7
10
|
declare const getOrThrow: <T>(fn: () => T, errorMessage: string) => T;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { JSONSchemaForCustomApplicationConfigurationFiles } from './schema';
|
|
2
2
|
export declare const validateConfig: (config: JSONSchemaForCustomApplicationConfigurationFiles) => void;
|
|
3
|
+
export declare const validateEntryPointUriPath: (config: JSONSchemaForCustomApplicationConfigurationFiles) => void;
|
|
3
4
|
export declare const validateSubmenuLinks: (config: JSONSchemaForCustomApplicationConfigurationFiles) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-config",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.11.0",
|
|
4
4
|
"description": "Configuration utilities for building Custom Applications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"build:schema": "json2ts schema.json src/schema.ts --style.singleQuote --bannerComment '/* eslint-disable prettier/prettier */\n// This file was automatically generated by json-schema-to-typescript.\n// DO NOT MODIFY IT BY HAND. Instead, modify the source schema.json file.'"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/register": "^7.
|
|
38
|
-
"@babel/runtime": "^7.
|
|
39
|
-
"@babel/runtime-corejs3": "^7.
|
|
40
|
-
"@commercetools-frontend/babel-preset-mc-app": "21.
|
|
37
|
+
"@babel/register": "^7.18.6",
|
|
38
|
+
"@babel/runtime": "^7.18.6",
|
|
39
|
+
"@babel/runtime-corejs3": "^7.18.6",
|
|
40
|
+
"@commercetools-frontend/babel-preset-mc-app": "21.11.0",
|
|
41
41
|
"ajv": "8.11.0",
|
|
42
|
-
"core-js": "^3.
|
|
42
|
+
"core-js": "^3.23.4",
|
|
43
43
|
"cosmiconfig": "7.0.1",
|
|
44
44
|
"dompurify": "^2.3.6",
|
|
45
45
|
"jsdom": "^19.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/jsdom": "^16.2.14",
|
|
51
|
-
"json-schema-to-typescript": "
|
|
51
|
+
"json-schema-to-typescript": "11.0.1",
|
|
52
52
|
"shelljs": "0.8.5"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
package/schema.json
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
"title": "JSON schema for Custom Application configuration files",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"definitions": {
|
|
7
|
-
"envVariablePlaceholder": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"pattern": "(\\$\\{env:\\w+\\})+"
|
|
10
|
-
},
|
|
11
7
|
"cspDirective": {
|
|
12
8
|
"type": "array",
|
|
13
9
|
"items": {
|
|
@@ -27,26 +23,11 @@
|
|
|
27
23
|
},
|
|
28
24
|
"entryPointUriPath": {
|
|
29
25
|
"description": "See https://docs.commercetools.com/custom-applications/api-reference/application-config#entrypointuripath",
|
|
30
|
-
"
|
|
31
|
-
{
|
|
32
|
-
"type": "string",
|
|
33
|
-
"pattern": "^[^\\-_#]([0-9a-z]|[\\-_](?![\\-_])){0,62}[^\\-_#]$"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"$ref": "#/definitions/envVariablePlaceholder"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
26
|
+
"type": "string"
|
|
39
27
|
},
|
|
40
28
|
"cloudIdentifier": {
|
|
41
29
|
"description": "See https://docs.commercetools.com/custom-applications/api-reference/application-config#cloudidentifier",
|
|
42
|
-
"
|
|
43
|
-
{
|
|
44
|
-
"enum": ["gcp-au", "gcp-eu", "gcp-us", "aws-fra", "aws-ohio"]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"$ref": "#/definitions/envVariablePlaceholder"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
30
|
+
"type": "string"
|
|
50
31
|
},
|
|
51
32
|
"mcApiUrl": {
|
|
52
33
|
"description": "See https://docs.commercetools.com/custom-applications/api-reference/application-config#mcapiurl",
|