@forge/manifest 7.6.1-next.1 → 7.7.0-next.10
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/CHANGELOG.md +60 -0
- package/README.md +3 -0
- package/out/interpolator/environment-variable-interpolator.d.ts +15 -0
- package/out/interpolator/environment-variable-interpolator.d.ts.map +1 -0
- package/out/interpolator/environment-variable-interpolator.js +47 -0
- package/out/interpolator/manifest-interpolator-manager.d.ts +9 -0
- package/out/interpolator/manifest-interpolator-manager.d.ts.map +1 -0
- package/out/interpolator/manifest-interpolator-manager.js +21 -0
- package/out/interpolator/manifest-interpolator.d.ts +13 -0
- package/out/interpolator/manifest-interpolator.d.ts.map +1 -0
- package/out/interpolator/manifest-interpolator.js +15 -0
- package/out/interpolator/string-resource-interpolator.d.ts +14 -0
- package/out/interpolator/string-resource-interpolator.d.ts.map +1 -0
- package/out/interpolator/string-resource-interpolator.js +70 -0
- package/out/schema/manifest-schema.json +3924 -329
- package/out/schema/manifest.d.ts +1790 -246
- package/out/scopes/shipyard-scopes.json +3 -0
- package/out/text/errors.d.ts +7 -4
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +9 -6
- package/out/utils/index.d.ts +2 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -1
- package/out/utils/manifest-parser-builder.d.ts +8 -0
- package/out/utils/manifest-parser-builder.d.ts.map +1 -0
- package/out/utils/manifest-parser-builder.js +22 -0
- package/out/utils/manifest-parser.d.ts +4 -6
- package/out/utils/manifest-parser.d.ts.map +1 -1
- package/out/utils/manifest-parser.js +13 -29
- package/out/validators/connect-modules-validator.d.ts.map +1 -1
- package/out/validators/connect-modules-validator.js +1 -12
- package/out/validators/modules-validator.d.ts +5 -0
- package/out/validators/modules-validator.d.ts.map +1 -1
- package/out/validators/modules-validator.js +123 -170
- package/out/validators/modules-validators/jira/validate-custom-field.d.ts +4 -0
- package/out/validators/modules-validators/jira/validate-custom-field.d.ts.map +1 -0
- package/out/validators/modules-validators/jira/validate-custom-field.js +31 -0
- package/out/validators/modules-validators/jira/validate-full-admin-page.d.ts +1 -1
- package/out/validators/modules-validators/jira/validate-full-admin-page.d.ts.map +1 -1
- package/out/validators/modules-validators/jira/validate-full-admin-page.js +3 -3
- package/out/validators/modules-validators/jira/validate-full-page.d.ts +4 -0
- package/out/validators/modules-validators/jira/validate-full-page.d.ts.map +1 -0
- package/out/validators/modules-validators/jira/validate-full-page.js +26 -0
- package/out/validators/modules-validators/jira/validate-trigger.d.ts +4 -0
- package/out/validators/modules-validators/jira/validate-trigger.d.ts.map +1 -0
- package/out/validators/modules-validators/jira/validate-trigger.js +23 -0
- package/out/validators/modules-validators/jira/validate-workflow.d.ts +5 -0
- package/out/validators/modules-validators/jira/validate-workflow.d.ts.map +1 -0
- package/out/validators/modules-validators/jira/validate-workflow.js +44 -0
- package/out/validators/modules-validators/rovo/index.d.ts.map +1 -1
- package/out/validators/modules-validators/rovo/index.js +4 -0
- package/out/validators/modules-validators/rovo/validate-undefined-action-name.d.ts +4 -0
- package/out/validators/modules-validators/rovo/validate-undefined-action-name.d.ts.map +1 -0
- package/out/validators/modules-validators/rovo/validate-undefined-action-name.js +28 -0
- package/out/validators/modules-validators/rovo/validate-unreferenced-actions.d.ts +4 -0
- package/out/validators/modules-validators/rovo/validate-unreferenced-actions.d.ts.map +1 -0
- package/out/validators/modules-validators/rovo/validate-unreferenced-actions.js +34 -0
- package/out/validators/yaml-validator.d.ts +0 -2
- package/out/validators/yaml-validator.d.ts.map +1 -1
- package/out/validators/yaml-validator.js +2 -6
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @forge/manifest
|
|
2
2
|
|
|
3
|
+
## 7.7.0-next.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 26f8528: Update manifest definitions
|
|
8
|
+
|
|
9
|
+
## 7.7.0-next.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 13fb92c: Update forge repo with unit tests for manifest schema changes Jira, Confluence, Bitbucket
|
|
14
|
+
|
|
15
|
+
## 7.7.0-next.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- f40d3b5: Update manifest definitions
|
|
20
|
+
|
|
21
|
+
## 7.7.0-next.7
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 7160171: Update manifest definitions
|
|
26
|
+
|
|
27
|
+
## 7.7.0-next.6
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- be67acb: Interpolate string resources in modules
|
|
32
|
+
|
|
33
|
+
## 7.7.0-next.5
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- b0ad6d7: Update manifest definitions
|
|
38
|
+
|
|
39
|
+
## 7.7.0-next.4
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- c341349: Show warning if action doesn't have name attribute
|
|
44
|
+
|
|
45
|
+
## 7.7.0-next.3
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 10f4545: Update package readme to include instruction on how to update schema in the package
|
|
50
|
+
|
|
51
|
+
## 7.7.0-next.2
|
|
52
|
+
|
|
53
|
+
### Minor Changes
|
|
54
|
+
|
|
55
|
+
- c113f86: Show warning if action is not referenced by any agent
|
|
56
|
+
- 9a546fd: Lint unique module key across Connect and Forge modules
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- c6377ba: Update unit test in manifest validator
|
|
61
|
+
- bf0fab6: Update manifest definitions
|
|
62
|
+
|
|
3
63
|
## 7.6.1-next.1
|
|
4
64
|
|
|
5
65
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -35,3 +35,6 @@ export interface ManifestValidationResult {
|
|
|
35
35
|
errors?: ValidationError[];
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
|
+
|
|
39
|
+
## Updating Manifest schemas
|
|
40
|
+
The schemas in this package are automatically updated from Shipyard daily. Any manual changes to these files will be reverted. Please raise a PR in [app-host-artifacts](https://bitbucket.org/atlassian/app-host-artifacts/src/master/) instead.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InterpolatorType, ManifestInterpolator, ManifestInterpolatorError } from './manifest-interpolator';
|
|
2
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
3
|
+
export declare class EnvironmentVariableInterpolatorError extends ManifestInterpolatorError {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class EnvironmentVariableInterpolator implements ManifestInterpolator {
|
|
7
|
+
private readonly envVarsRecord;
|
|
8
|
+
type: InterpolatorType;
|
|
9
|
+
POSSIBLE_ENVIRONMENT_VARIABLE: RegExp;
|
|
10
|
+
private envVarsToReplace;
|
|
11
|
+
constructor(envVarsRecord?: Record<string, string | undefined>);
|
|
12
|
+
interpolate(manifest: ManifestSchema): ManifestSchema;
|
|
13
|
+
private environmentVariableReviver;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=environment-variable-interpolator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-variable-interpolator.d.ts","sourceRoot":"","sources":["../../src/interpolator/environment-variable-interpolator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,qBAAa,oCAAqC,SAAQ,yBAAyB;gBACrE,OAAO,EAAE,MAAM;CAI5B;AAKD,qBAAa,+BAAgC,YAAW,oBAAoB;IAS9D,OAAO,CAAC,QAAQ,CAAC,aAAa;IAR1C,IAAI,EAAE,gBAAgB,CAAyC;IAI/D,6BAA6B,SAAqC;IAElE,OAAO,CAAC,gBAAgB,CAAW;gBAEN,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM;IAInF,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc;IAKrD,OAAO,CAAC,0BAA0B,CAkBhC;CACH"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvironmentVariableInterpolator = exports.EnvironmentVariableInterpolatorError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const yaml_1 = require("yaml");
|
|
6
|
+
const manifest_interpolator_1 = require("./manifest-interpolator");
|
|
7
|
+
const text_1 = require("../text");
|
|
8
|
+
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
9
|
+
class EnvironmentVariableInterpolatorError extends manifest_interpolator_1.ManifestInterpolatorError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'EnvironmentVariableInterpolatorError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.EnvironmentVariableInterpolatorError = EnvironmentVariableInterpolatorError;
|
|
16
|
+
class EnvironmentVariableInterpolator {
|
|
17
|
+
envVarsRecord;
|
|
18
|
+
type = manifest_interpolator_1.InterpolatorType.ENVIRONMENT_VARIABLE;
|
|
19
|
+
POSSIBLE_ENVIRONMENT_VARIABLE = /\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;
|
|
20
|
+
envVarsToReplace;
|
|
21
|
+
constructor(envVarsRecord = {}) {
|
|
22
|
+
this.envVarsRecord = envVarsRecord;
|
|
23
|
+
this.envVarsToReplace = [];
|
|
24
|
+
}
|
|
25
|
+
interpolate(manifest) {
|
|
26
|
+
this.envVarsToReplace = manifest.environment?.variables ?? [];
|
|
27
|
+
return (0, yaml_1.parse)(JSON.stringify(manifest), this.environmentVariableReviver);
|
|
28
|
+
}
|
|
29
|
+
environmentVariableReviver = (_, value) => {
|
|
30
|
+
if (!(typeof value == 'string')) {
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
value = value.replace(this.POSSIBLE_ENVIRONMENT_VARIABLE, (original, envVarName) => {
|
|
34
|
+
if (!this.envVarsToReplace.includes(envVarName)) {
|
|
35
|
+
return original;
|
|
36
|
+
}
|
|
37
|
+
const envVar = this.envVarsRecord[envVarName];
|
|
38
|
+
if (envVar === undefined) {
|
|
39
|
+
throw new EnvironmentVariableInterpolatorError(text_1.errors.schema.missingEnvironmentVariable(envVarName));
|
|
40
|
+
}
|
|
41
|
+
Sentry.captureMessage('replaced environment variable');
|
|
42
|
+
return envVar;
|
|
43
|
+
});
|
|
44
|
+
return value;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.EnvironmentVariableInterpolator = EnvironmentVariableInterpolator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
2
|
+
import { ManifestInterpolator } from './manifest-interpolator';
|
|
3
|
+
export declare class ManifestInterpolatorManager {
|
|
4
|
+
private interpolators;
|
|
5
|
+
constructor();
|
|
6
|
+
addInterpolator(interpolator: ManifestInterpolator): void;
|
|
7
|
+
interpolate(manifest: string): ManifestSchema;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=manifest-interpolator-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-interpolator-manager.d.ts","sourceRoot":"","sources":["../../src/interpolator/manifest-interpolator-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAoB,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAMjF,qBAAa,2BAA2B;IACtC,OAAO,CAAC,aAAa,CAA8C;;IAUnE,eAAe,CAAC,YAAY,EAAE,oBAAoB,GAAG,IAAI;IASzD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;CAO9C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManifestInterpolatorManager = void 0;
|
|
4
|
+
const yaml_1 = require("yaml");
|
|
5
|
+
class ManifestInterpolatorManager {
|
|
6
|
+
interpolators;
|
|
7
|
+
constructor() {
|
|
8
|
+
this.interpolators = new Map();
|
|
9
|
+
}
|
|
10
|
+
addInterpolator(interpolator) {
|
|
11
|
+
this.interpolators.set(interpolator.type, interpolator);
|
|
12
|
+
}
|
|
13
|
+
interpolate(manifest) {
|
|
14
|
+
let interpolatedManifest = (0, yaml_1.parse)(manifest);
|
|
15
|
+
for (const interpolator of this.interpolators.values()) {
|
|
16
|
+
interpolatedManifest = interpolator.interpolate(interpolatedManifest);
|
|
17
|
+
}
|
|
18
|
+
return interpolatedManifest;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ManifestInterpolatorManager = ManifestInterpolatorManager;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
2
|
+
export declare class ManifestInterpolatorError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare enum InterpolatorType {
|
|
6
|
+
STRING_RESOURCE = 0,
|
|
7
|
+
ENVIRONMENT_VARIABLE = 1
|
|
8
|
+
}
|
|
9
|
+
export interface ManifestInterpolator {
|
|
10
|
+
type: InterpolatorType;
|
|
11
|
+
interpolate(manifest: ManifestSchema): ManifestSchema;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=manifest-interpolator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-interpolator.d.ts","sourceRoot":"","sources":["../../src/interpolator/manifest-interpolator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,oBAAY,gBAAgB;IAC1B,eAAe,IAAA;IACf,oBAAoB,IAAA;CACrB;AAKD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,gBAAgB,CAAC;IAMvB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,CAAC;CACvD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InterpolatorType = exports.ManifestInterpolatorError = void 0;
|
|
4
|
+
class ManifestInterpolatorError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ManifestInterpolatorError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ManifestInterpolatorError = ManifestInterpolatorError;
|
|
11
|
+
var InterpolatorType;
|
|
12
|
+
(function (InterpolatorType) {
|
|
13
|
+
InterpolatorType[InterpolatorType["STRING_RESOURCE"] = 0] = "STRING_RESOURCE";
|
|
14
|
+
InterpolatorType[InterpolatorType["ENVIRONMENT_VARIABLE"] = 1] = "ENVIRONMENT_VARIABLE";
|
|
15
|
+
})(InterpolatorType = exports.InterpolatorType || (exports.InterpolatorType = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
2
|
+
import { InterpolatorType, ManifestInterpolator, ManifestInterpolatorError } from './manifest-interpolator';
|
|
3
|
+
export declare class StringResourceInterpolatorError extends ManifestInterpolatorError {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class StringResourceInterpolator implements ManifestInterpolator {
|
|
7
|
+
type: InterpolatorType;
|
|
8
|
+
interpolate(manifest: ManifestSchema): ManifestSchema;
|
|
9
|
+
private fetchContentFromResourceFile;
|
|
10
|
+
private getResourcePath;
|
|
11
|
+
private checkIfResourceIsValid;
|
|
12
|
+
private checkIfResourceTypeIsSupported;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=string-resource-interpolator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-resource-interpolator.d.ts","sourceRoot":"","sources":["../../src/interpolator/string-resource-interpolator.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAY5G,qBAAa,+BAAgC,SAAQ,yBAAyB;gBAChE,OAAO,EAAE,MAAM;CAI5B;AAKD,qBAAa,0BAA2B,YAAW,oBAAoB;IACrE,IAAI,EAAE,gBAAgB,CAAoC;IAE1D,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc;IAiBrD,OAAO,CAAC,4BAA4B;IASpC,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,8BAA8B;CAOvC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringResourceInterpolator = exports.StringResourceInterpolatorError = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const errors_1 = require("../text/errors");
|
|
7
|
+
const manifest_interpolator_1 = require("./manifest-interpolator");
|
|
8
|
+
const mime_types_1 = require("mime-types");
|
|
9
|
+
const MODULE_PROPERTIES_TO_INTERPOLATE = [
|
|
10
|
+
{ moduleType: types_1.AllModuleTypes.RovoAgent, property: 'prompt' }
|
|
11
|
+
];
|
|
12
|
+
class StringResourceInterpolatorError extends manifest_interpolator_1.ManifestInterpolatorError {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'StringResourceInterpolatorError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.StringResourceInterpolatorError = StringResourceInterpolatorError;
|
|
19
|
+
class StringResourceInterpolator {
|
|
20
|
+
type = manifest_interpolator_1.InterpolatorType.STRING_RESOURCE;
|
|
21
|
+
interpolate(manifest) {
|
|
22
|
+
MODULE_PROPERTIES_TO_INTERPOLATE.forEach(({ moduleType, property }) => {
|
|
23
|
+
const modules = manifest.modules?.[moduleType];
|
|
24
|
+
modules?.forEach((module) => {
|
|
25
|
+
if (module.hasOwnProperty(property)) {
|
|
26
|
+
const moduleAny = module;
|
|
27
|
+
const propertyValue = moduleAny[property];
|
|
28
|
+
if (propertyValue.startsWith('resource:')) {
|
|
29
|
+
moduleAny[property] = this.fetchContentFromResourceFile(propertyValue, manifest);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return manifest;
|
|
35
|
+
}
|
|
36
|
+
fetchContentFromResourceFile(modulePropertyWithStringResource, manifest) {
|
|
37
|
+
const resourcePath = this.getResourcePath(manifest, modulePropertyWithStringResource);
|
|
38
|
+
try {
|
|
39
|
+
return (0, fs_1.readFileSync)(resourcePath, 'utf8');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new StringResourceInterpolatorError(errors_1.errors.schema.errorReadingResourceFile(resourcePath, error?.message));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
getResourcePath(manifest, resourceString) {
|
|
46
|
+
const resourceUrl = new URL(resourceString);
|
|
47
|
+
const [resourceKey, relativePath] = resourceUrl.pathname.split(';');
|
|
48
|
+
const resource = this.checkIfResourceIsValid(manifest, resourceKey);
|
|
49
|
+
const resourcePath = `${resource.path}/${relativePath}`;
|
|
50
|
+
this.checkIfResourceTypeIsSupported(resourcePath);
|
|
51
|
+
return resourcePath;
|
|
52
|
+
}
|
|
53
|
+
checkIfResourceIsValid(manifest, resourceKey) {
|
|
54
|
+
const resource = manifest.resources?.find((resource) => resource.key === resourceKey);
|
|
55
|
+
if (!resource) {
|
|
56
|
+
throw new StringResourceInterpolatorError(errors_1.errors.schema.resourceNotFound(resourceKey));
|
|
57
|
+
}
|
|
58
|
+
if (!resource.path) {
|
|
59
|
+
throw new StringResourceInterpolatorError(errors_1.errors.schema.resourcePathNotDefined(resourceKey));
|
|
60
|
+
}
|
|
61
|
+
return resource;
|
|
62
|
+
}
|
|
63
|
+
checkIfResourceTypeIsSupported(resourcePath) {
|
|
64
|
+
const mimeType = (0, mime_types_1.lookup)(resourcePath);
|
|
65
|
+
if (!mimeType || !mimeType.startsWith('text')) {
|
|
66
|
+
throw new StringResourceInterpolatorError(errors_1.errors.schema.resourceFileNotSupported(resourcePath));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.StringResourceInterpolator = StringResourceInterpolator;
|