@forge/manifest 12.8.0-next.3 → 12.8.0-next.4
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 +8 -0
- package/out/processor/full-validation-processor.d.ts.map +1 -1
- package/out/processor/full-validation-processor.js +1 -0
- package/out/schema/manifest-schema.json +11 -0
- package/out/schema/manifest.d.ts +3 -0
- package/out/text/errors.d.ts +12 -0
- package/out/text/errors.d.ts.map +1 -1
- package/out/text/errors.js +14 -2
- package/out/utils/module-references.d.ts +6 -0
- package/out/utils/module-references.d.ts.map +1 -1
- package/out/utils/module-references.js +32 -2
- package/out/validators/index.d.ts +1 -0
- package/out/validators/index.d.ts.map +1 -1
- package/out/validators/index.js +1 -0
- package/out/validators/internal-fields-validator.d.ts +8 -0
- package/out/validators/internal-fields-validator.d.ts.map +1 -0
- package/out/validators/internal-fields-validator.js +44 -0
- package/out/validators/modules-validators/rovo/index.d.ts.map +1 -1
- package/out/validators/modules-validators/rovo/index.js +2 -0
- package/out/validators/modules-validators/rovo/validate-rovo-skill-actions.d.ts +4 -0
- package/out/validators/modules-validators/rovo/validate-rovo-skill-actions.d.ts.map +1 -0
- package/out/validators/modules-validators/rovo/validate-rovo-skill-actions.js +29 -0
- package/out/validators/modules-validators/rovo/validate-unreferenced-actions.js +6 -0
- package/out/validators/resources-validator.d.ts +4 -0
- package/out/validators/resources-validator.d.ts.map +1 -1
- package/out/validators/resources-validator.js +158 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;gBAC1E,WAAW,EAAE,WAAW;CA8BrC"}
|
|
@@ -22,6 +22,7 @@ class FullValidationProcessor extends abstract_validation_processor_1.AbstractVa
|
|
|
22
22
|
new validators_1.FileValidator(),
|
|
23
23
|
new validators_1.YamlValidator(),
|
|
24
24
|
new validators_1.SchemaValidator(FULL_SCHEMA),
|
|
25
|
+
new validators_1.InternalFieldsValidator(),
|
|
25
26
|
new validators_1.ModulesValidator(),
|
|
26
27
|
new validators_1.ConnectModulesValidator(),
|
|
27
28
|
new validators_1.ResourcesValidator(),
|
|
@@ -32300,6 +32300,17 @@
|
|
|
32300
32300
|
"path": {
|
|
32301
32301
|
"type": "string"
|
|
32302
32302
|
},
|
|
32303
|
+
"entry": {
|
|
32304
|
+
"type": "object",
|
|
32305
|
+
"propertyNames": {
|
|
32306
|
+
"pattern": "^[a-zA-Z0-9_-]+$",
|
|
32307
|
+
"maxLength": 23
|
|
32308
|
+
},
|
|
32309
|
+
"additionalProperties": {
|
|
32310
|
+
"type": "string",
|
|
32311
|
+
"pattern": "^[a-zA-Z0-9_-]+(?:\\.[a-zA-Z0-9_-]+)*$"
|
|
32312
|
+
}
|
|
32313
|
+
},
|
|
32303
32314
|
"tunnel": {
|
|
32304
32315
|
"type": "object",
|
|
32305
32316
|
"required": [
|
package/out/schema/manifest.d.ts
CHANGED
|
@@ -74951,6 +74951,9 @@ export interface HostedResourcesSchema {
|
|
|
74951
74951
|
*/
|
|
74952
74952
|
key: string;
|
|
74953
74953
|
path: string;
|
|
74954
|
+
entry?: {
|
|
74955
|
+
[k: string]: string;
|
|
74956
|
+
};
|
|
74954
74957
|
tunnel?: {
|
|
74955
74958
|
port: number;
|
|
74956
74959
|
};
|
package/out/text/errors.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare const errors: {
|
|
|
44
44
|
wrongEndpointReference: (module: string, endpointKey: string) => string;
|
|
45
45
|
wrongServiceReference: (module: string, serviceKey: string) => string;
|
|
46
46
|
wrongResourceReference: (module: string, resourceKey: string) => string;
|
|
47
|
+
internalFieldFound: (fieldName: string, moduleKey: string) => string;
|
|
47
48
|
wrongResourceType: (folder: string) => string;
|
|
48
49
|
singleEntryOfTheModule: (moduleType: string) => string;
|
|
49
50
|
singleEntryOfModuleWithoutConfigureAndStartedParams: (moduleType: string) => string;
|
|
@@ -149,6 +150,7 @@ export declare const errors: {
|
|
|
149
150
|
undefinedActionName: (action: string) => string;
|
|
150
151
|
incorrectA2AEndpointReference: (module: string, endpointKey: string) => string;
|
|
151
152
|
incorrectA2AEndpointConfiguration: (module: string, endpointKey: string) => string;
|
|
153
|
+
incorrectSkill: (module: string, toolKey: string) => string;
|
|
152
154
|
};
|
|
153
155
|
action: {
|
|
154
156
|
unreferencedAction: (action: string) => string;
|
|
@@ -182,6 +184,16 @@ export declare const errors: {
|
|
|
182
184
|
deprecatedCspPolicyDefinition: (folder: string) => string;
|
|
183
185
|
tooManyResourcesError: (limit: number) => string;
|
|
184
186
|
nonDirectory: (folder: string, key: string) => string;
|
|
187
|
+
missingEntryMap: (resourceKey: string, key: string) => string;
|
|
188
|
+
missingEntryKey: (resourceKey: string, entryKey: string, key: string) => string;
|
|
189
|
+
missingEntryFile: (entryPath: string, key: string) => string;
|
|
190
|
+
directoryEntryFile: (entryPath: string, key: string) => string;
|
|
191
|
+
invalidCustomUiEntryFileType: (entryPath: string, key: string) => string;
|
|
192
|
+
invalidUiKitEntryFileType: (entryPath: string, key: string) => string;
|
|
193
|
+
invalidEntryPathValue: (resourceKey: string, entryKey: string, entryPath: string) => string;
|
|
194
|
+
resourceTypeConflict: (resourceKey: string) => string;
|
|
195
|
+
invalidCustomUiResourceEntryFileType: (resourceKey: string, entryKey: string, entryPath: string) => string;
|
|
196
|
+
invalidUiKitResourceEntryFileType: (resourceKey: string, entryKey: string, entryPath: string) => string;
|
|
185
197
|
};
|
|
186
198
|
deprecationInfo: {
|
|
187
199
|
app: {
|
package/out/text/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;+BACd,MAAM,EAAE,KAAG,MAAM;2BAIvB,MAAM;yBAEN,MAAM,GAAG,SAAS,QAAQ,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAAM;;uBAO3E,MAAM,EAAE,EAAE,GAAG,SAAS,KAAG,MAAM;4BAI1B,MAAM,EAAE,KAAG,MAAM;mCACV,MAAM,SAAS,MAAM,mBAAmB,MAAM,KAAG,MAAM;mDAIvC,MAAM,KAAG,MAAM;4BAEtC,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM;+CAIV,MAAM;6CACR,MAAM,gBAAgB,MAAM;qCAEpC,MAAM;2CACA,MAAM;6CACJ,MAAM;;;qCAGd,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;0DAEhB,MAAM,YAAY,MAAM,mBAAmB,MAAM,EAAE,KAAG,MAAM;oDAElE,MAAM,OAAO,MAAM,KAAG,MAAM;kDAE9B,MAAM,OAAO,MAAM,KAAG,MAAM;wCAEtC,MAAM,SAAS,MAAM,EAAE,KAAG,MAAM;0CAI9B,MAAM;2CAEL,MAAM,KAAG,MAAM;0CAEhB,MAAM,SAAS,MAAM,KAAG,MAAM;+CAEzB,MAAM,KAAG,MAAM;wCAEtB,MAAM,KAAG,MAAM;gCAEvB,MAAM,KAAG,MAAM;;;uCAIR,MAAM,KAAG,MAAM;0CACZ,MAAM,KAAG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CAIpC,MAAM;uCAEJ,MAAM,KAAG,MAAM;qCAEnB,MAAM;2CAEA,MAAM;sDACK,MAAM;;6CAGjB,MAAM;;;mDAIE,MAAM,KAAG,MAAM;iDAEnB,MAAM;;;;4CAKX,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE9B,MAAM,KAAG,MAAM;4CACf,MAAM,SAAS,MAAM,KAAG,MAAM;+CAE3B,MAAM,aAAa,MAAM,SAAS,MAAM,KAAG,MAAM;yCAEvD,MAAM,SAAS,MAAM,KAAG,MAAM;4CAE3B,MAAM,SAAS,MAAM,KAAG,MAAM;gDAE1B,MAAM,aAAa,MAAM,KAAG,MAAM;4CAEtC,MAAM,SAAS,MAAM,KAAG,MAAM;;;;;gCAM1C,MAAM;;;;;;;;;;0DAawB,wBAAwB,KAAG,MAAM;sDAErC,wBAAwB,KAAG,MAAM;kDAErC,wBAAwB,QAAQ,MAAM,KAAG,MAAM;mDAE9C,wBAAwB,KAAG,MAAM;mCAEjD,MAAM,KAAG,MAAM;;oDAEE,MAAM,aAAa,MAAM,KAAG,MAAM;4CAE1C,MAAM,sBAAsB,wBAAwB,YAAY,MAAM;;;;mCAKjF,MAAM;;;CAQlC,CAAC;AAEF,oBAAY,UAAU;IACpB,eAAe,2BAA2B;IAC1C,eAAe,wBAAwB;IACvC,WAAW,4BAA4B;IACvC,WAAW,+BAA+B;IAC1C,aAAa,8BAA8B;IAC3C,OAAO,0BAA0B;IACjC,cAAc,kCAAkC;IAChD,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;CAClC"}
|
package/out/text/errors.js
CHANGED
|
@@ -58,6 +58,7 @@ exports.errors = {
|
|
|
58
58
|
wrongEndpointReference: (module, endpointKey) => `${module} references undefined endpoint module with key '${endpointKey}'`,
|
|
59
59
|
wrongServiceReference: (module, serviceKey) => `${module} references undefined service with key '${serviceKey}'`,
|
|
60
60
|
wrongResourceReference: (module, resourceKey) => `missing resource key '${resourceKey}' is being referenced by ${module} module`,
|
|
61
|
+
internalFieldFound: (fieldName, moduleKey) => `'${fieldName}' is an internal property and cannot be set explicitly. Remove this field from the ${moduleKey} module.`,
|
|
61
62
|
wrongResourceType: (folder) => `Client Side UI Kit resource (${folder}) cannot be a directory`,
|
|
62
63
|
singleEntryOfTheModule: (moduleType) => `Only a single entry of the ${moduleType} module can be defined in the manifest`,
|
|
63
64
|
singleEntryOfModuleWithoutConfigureAndStartedParams: (moduleType) => `The ${moduleType} module can only have a single entry that doesn’t include either useAsConfig or useAsGetStarted properties.`,
|
|
@@ -162,7 +163,8 @@ exports.errors = {
|
|
|
162
163
|
incorrectAgentActionReference: (module, moduleKey) => `${module} references undefined action module with key '${moduleKey}'.`,
|
|
163
164
|
undefinedActionName: (action) => `Action '${action}' does not have a name property. 'name' property will be required when Forge Agents are GA.`,
|
|
164
165
|
incorrectA2AEndpointReference: (module, endpointKey) => `${module} references undefined endpoint '${endpointKey}' in agent2Agent protocol.`,
|
|
165
|
-
incorrectA2AEndpointConfiguration: (module, endpointKey) => `${module} endpoint '${endpointKey}' must reference a remote. Agent2Agent protocol requires remote endpoints
|
|
166
|
+
incorrectA2AEndpointConfiguration: (module, endpointKey) => `${module} endpoint '${endpointKey}' must reference a remote. Agent2Agent protocol requires remote endpoints.`,
|
|
167
|
+
incorrectSkill: (module, toolKey) => `${module} references undefined action module with key '${toolKey}'.`
|
|
166
168
|
},
|
|
167
169
|
action: {
|
|
168
170
|
unreferencedAction: (action) => `Action '${action}' is not referenced by any Rovo agent or automation:actionProvider module.`,
|
|
@@ -195,7 +197,17 @@ exports.errors = {
|
|
|
195
197
|
missingEntrypoint: (folder, key) => `missing index.html file in directory (${folder}) is being referenced by a Custom UI resource in ${key} module`,
|
|
196
198
|
deprecatedCspPolicyDefinition: (folder) => `The index.html file in the (${folder}) directory is using a deprecated method of defining CSP. To use the supported method, go to: https://go.atlassian.com/forge-content-security-and-egress-controls`,
|
|
197
199
|
tooManyResourcesError: (limit) => `document exceeds ${limit} resources`,
|
|
198
|
-
nonDirectory: (folder, key) => `Custom UI resource must be a directory. (${folder}) in ${key} module is not a directory
|
|
200
|
+
nonDirectory: (folder, key) => `Custom UI resource must be a directory. (${folder}) in ${key} module is not a directory`,
|
|
201
|
+
missingEntryMap: (resourceKey, key) => `resource '${resourceKey}' referenced by ${key} module does not define an entry map`,
|
|
202
|
+
missingEntryKey: (resourceKey, entryKey, key) => `resource '${resourceKey}' referenced by ${key} module does not define entry '${entryKey}'`,
|
|
203
|
+
missingEntryFile: (entryPath, key) => `missing resource entry file '${entryPath}' referenced by ${key} module`,
|
|
204
|
+
directoryEntryFile: (entryPath, key) => `resource entry '${entryPath}' referenced by ${key} module must be a file`,
|
|
205
|
+
invalidCustomUiEntryFileType: (entryPath, key) => `Custom UI resource entry '${entryPath}' referenced by ${key} module must point to an .html file`,
|
|
206
|
+
invalidUiKitEntryFileType: (entryPath, key) => `UI Kit resource entry '${entryPath}' referenced by ${key} module must not point to an .html file`,
|
|
207
|
+
invalidEntryPathValue: (resourceKey, entryKey, entryPath) => `resource '${resourceKey}' entry '${entryKey}' must be a filename only. Found '${entryPath}'`,
|
|
208
|
+
resourceTypeConflict: (resourceKey) => `resource '${resourceKey}' cannot be used as both UI Kit and Custom UI. Use a consistent resource type`,
|
|
209
|
+
invalidCustomUiResourceEntryFileType: (resourceKey, entryKey, entryPath) => `resource '${resourceKey}' is Custom UI, so entry '${entryKey}' must point to an .html file. Found '${entryPath}'`,
|
|
210
|
+
invalidUiKitResourceEntryFileType: (resourceKey, entryKey, entryPath) => `resource '${resourceKey}' is UI Kit, so entry '${entryKey}' must not point to an .html file. Found '${entryPath}'`
|
|
199
211
|
},
|
|
200
212
|
deprecationInfo: {
|
|
201
213
|
app: {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
interface KeyedModuleEntry {
|
|
2
2
|
key: string;
|
|
3
3
|
}
|
|
4
|
+
export declare type ResourceReference = {
|
|
5
|
+
resourceKey: string;
|
|
6
|
+
entryKey?: string;
|
|
7
|
+
isValidFormat: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const parseResourceReference: (resourceReference: string) => ResourceReference;
|
|
4
10
|
export declare const findInvalidFunctionReferences: (module: any, functions?: KeyedModuleEntry[]) => string[];
|
|
5
11
|
export declare const findInvalidResourceReferences: (module: any, resources?: KeyedModuleEntry[]) => string[];
|
|
6
12
|
export declare const findInvalidEndpointReferences: (module: any, resources?: KeyedModuleEntry[]) => string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-references.d.ts","sourceRoot":"","sources":["../../src/utils/module-references.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;CACb;
|
|
1
|
+
{"version":3,"file":"module-references.d.ts","sourceRoot":"","sources":["../../src/utils/module-references.ts"],"names":[],"mappings":"AAAA,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;CACb;AAID,oBAAY,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,sBAAsB,sBAAuB,MAAM,KAAG,iBAsBlE,CAAC;AAoCF,eAAO,MAAM,6BAA6B,WAAY,GAAG,cAAc,gBAAgB,EAAE,aAChC,CAAC;AAC1D,eAAO,MAAM,6BAA6B,WAAY,GAAG,cAAc,gBAAgB,EAAE,aAChC,CAAC;AAC1D,eAAO,MAAM,6BAA6B,WAAY,GAAG,cAAc,gBAAgB,EAAE,aAChC,CAAC;AAC1D,eAAO,MAAM,4BAA4B,WAAY,GAAG,aAAa,gBAAgB,EAAE,aAChC,CAAC"}
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findInvalidServiceReferences = exports.findInvalidEndpointReferences = exports.findInvalidResourceReferences = exports.findInvalidFunctionReferences = void 0;
|
|
3
|
+
exports.findInvalidServiceReferences = exports.findInvalidEndpointReferences = exports.findInvalidResourceReferences = exports.findInvalidFunctionReferences = exports.parseResourceReference = void 0;
|
|
4
|
+
const parseResourceReference = (resourceReference) => {
|
|
5
|
+
const parts = resourceReference.split('/');
|
|
6
|
+
if (parts.length === 1 && parts[0]) {
|
|
7
|
+
return {
|
|
8
|
+
resourceKey: parts[0],
|
|
9
|
+
isValidFormat: true
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (parts.length === 2 && parts[0] && parts[1]) {
|
|
13
|
+
return {
|
|
14
|
+
resourceKey: parts[0],
|
|
15
|
+
entryKey: parts[1],
|
|
16
|
+
isValidFormat: true
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
resourceKey: resourceReference,
|
|
21
|
+
isValidFormat: false
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.parseResourceReference = parseResourceReference;
|
|
25
|
+
const parseResourceKey = (resourceReference) => {
|
|
26
|
+
const parsedReference = (0, exports.parseResourceReference)(resourceReference);
|
|
27
|
+
return parsedReference.isValidFormat ? parsedReference.resourceKey : undefined;
|
|
28
|
+
};
|
|
29
|
+
const normalizeReferenceKey = (referenceProperty, entryKey) => referenceProperty === 'resource' ? parseResourceKey(entryKey) : entryKey;
|
|
4
30
|
const findInvalidReferenceKeys = (property, module, references) => {
|
|
5
31
|
const invalidEntries = [];
|
|
6
32
|
const _checkModuleEntryKey = (entryKey) => {
|
|
7
|
-
if (
|
|
33
|
+
if (!entryKey) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const normalizedReference = normalizeReferenceKey(property, entryKey);
|
|
37
|
+
if (!normalizedReference || !references?.find((reference) => reference.key === normalizedReference)) {
|
|
8
38
|
invalidEntries.push(entryKey);
|
|
9
39
|
}
|
|
10
40
|
};
|
|
@@ -4,6 +4,7 @@ export * from './schema-validator';
|
|
|
4
4
|
export * from './file-validator';
|
|
5
5
|
export * from './yaml-validator';
|
|
6
6
|
export * from './validator-interface';
|
|
7
|
+
export * from './internal-fields-validator';
|
|
7
8
|
export * from './resources-validator';
|
|
8
9
|
export * from './display-conditions-validator';
|
|
9
10
|
export * from './product-trigger-scopes-validator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
package/out/validators/index.js
CHANGED
|
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./schema-validator"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./file-validator"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./yaml-validator"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./validator-interface"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./internal-fields-validator"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./resources-validator"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./display-conditions-validator"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./product-trigger-scopes-validator"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ManifestObject, ManifestValidationResult } from '../types';
|
|
2
|
+
import { ManifestSchema } from '../schema/manifest';
|
|
3
|
+
import { ValidatorInterface } from './validator-interface';
|
|
4
|
+
export declare class InternalFieldsValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
5
|
+
private readonly INTERNAL_FIELDS;
|
|
6
|
+
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=internal-fields-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-fields-validator.d.ts","sourceRoot":"","sources":["../../src/validators/internal-fields-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAW3D,qBAAa,uBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAGzF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2D;IAErF,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAyCrD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalFieldsValidator = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const text_1 = require("../text");
|
|
6
|
+
class InternalFieldsValidator {
|
|
7
|
+
INTERNAL_FIELDS = ['resolvedResourceEntry', 'renderRuntimeType'];
|
|
8
|
+
async validate(manifest) {
|
|
9
|
+
if (!manifest || !manifest.typedContent || !manifest.typedContent.modules) {
|
|
10
|
+
return {
|
|
11
|
+
success: true,
|
|
12
|
+
manifestObject: manifest
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const validationErrors = [];
|
|
16
|
+
const { modules } = manifest.typedContent;
|
|
17
|
+
const yamlContentByLine = manifest.yamlContentByLine || [];
|
|
18
|
+
(0, utils_1.getValidModules)(modules).forEach((moduleType) => {
|
|
19
|
+
const moduleArray = modules[moduleType];
|
|
20
|
+
if (!Array.isArray(moduleArray)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
moduleArray.forEach((module, index) => {
|
|
24
|
+
this.INTERNAL_FIELDS.forEach((fieldName) => {
|
|
25
|
+
if (fieldName in module) {
|
|
26
|
+
const moduleKey = module.key || `${moduleType}[${index}]`;
|
|
27
|
+
validationErrors.push({
|
|
28
|
+
message: text_1.errors.modules.internalFieldFound(fieldName, moduleKey),
|
|
29
|
+
reference: text_1.References.Modules,
|
|
30
|
+
level: 'error',
|
|
31
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
success: validationErrors.length === 0,
|
|
39
|
+
manifestObject: manifest,
|
|
40
|
+
errors: validationErrors
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.InternalFieldsValidator = InternalFieldsValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/rovo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/rovo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAOnD,eAAO,MAAM,mBAAmB,YAAa,OAAO,sBAAsB,MAAM,EAAE,KAAG,eAAe,EAUnG,CAAC"}
|
|
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validateRovoModules = void 0;
|
|
4
4
|
const validate_rovo_agent_actions_1 = require("./validate-rovo-agent-actions");
|
|
5
5
|
const validate_unreferenced_actions_1 = require("./validate-unreferenced-actions");
|
|
6
|
+
const validate_rovo_skill_actions_1 = require("./validate-rovo-skill-actions");
|
|
6
7
|
const validate_undefined_action_name_1 = require("./validate-undefined-action-name");
|
|
7
8
|
const validate_agent_connector_remote_endpoints_1 = require("./validate-agent-connector-remote-endpoints");
|
|
8
9
|
const validateRovoModules = (modules, yamlContentByLine) => {
|
|
9
10
|
const validationErrors = [];
|
|
10
11
|
validationErrors.push(...(0, validate_rovo_agent_actions_1.validateRovoAgentActions)(modules, yamlContentByLine));
|
|
11
12
|
validationErrors.push(...(0, validate_unreferenced_actions_1.validateUnreferencedActions)(modules, yamlContentByLine));
|
|
13
|
+
validationErrors.push(...(0, validate_rovo_skill_actions_1.validateRovoSkillActions)(modules, yamlContentByLine));
|
|
12
14
|
validationErrors.push(...(0, validate_undefined_action_name_1.validateUndefinedActionName)(modules, yamlContentByLine));
|
|
13
15
|
validationErrors.push(...(0, validate_agent_connector_remote_endpoints_1.validateAgentConnectorRemoteEndpoints)(modules, yamlContentByLine));
|
|
14
16
|
return validationErrors;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ValidationError } from '../../../types';
|
|
2
|
+
import { Modules } from '../../../schema/manifest';
|
|
3
|
+
export declare const validateRovoSkillActions: (allModules: Modules, yamlContentByLine?: string[]) => ValidationError[];
|
|
4
|
+
//# sourceMappingURL=validate-rovo-skill-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-rovo-skill-actions.d.ts","sourceRoot":"","sources":["../../../../src/validators/modules-validators/rovo/validate-rovo-skill-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,eAAO,MAAM,wBAAwB,eAAgB,OAAO,sBAAsB,MAAM,EAAE,KAAG,eAAe,EAe3G,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRovoSkillActions = void 0;
|
|
4
|
+
const types_1 = require("../../../types");
|
|
5
|
+
const text_1 = require("../../../text");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const validateRovoSkillActions = (allModules, yamlContentByLine) => {
|
|
8
|
+
const validationErrors = [];
|
|
9
|
+
const rovoSkills = allModules[types_1.AllModuleTypes.RovoSkill];
|
|
10
|
+
const actionKey = (0, utils_1.cleanKey)(types_1.AllModuleTypes.CoreAction);
|
|
11
|
+
const actions = new Set(allModules[actionKey]?.map((action) => action.key) ?? []);
|
|
12
|
+
rovoSkills?.forEach((skill) => {
|
|
13
|
+
skill.dependencies?.tools?.forEach((tool) => {
|
|
14
|
+
if (!actions.has(tool)) {
|
|
15
|
+
validationErrors.push(getValidationError(skill.key, tool, yamlContentByLine));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return validationErrors;
|
|
20
|
+
};
|
|
21
|
+
exports.validateRovoSkillActions = validateRovoSkillActions;
|
|
22
|
+
function getValidationError(skill, tool, yamlContentByLine) {
|
|
23
|
+
return {
|
|
24
|
+
message: text_1.errors.modules.rovo.incorrectSkill(skill, tool),
|
|
25
|
+
reference: text_1.References.Modules,
|
|
26
|
+
level: 'error',
|
|
27
|
+
...(0, utils_1.findPosition)(skill, yamlContentByLine)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -17,12 +17,18 @@ function getUnreferencedActions(allModules) {
|
|
|
17
17
|
const actionKey = (0, utils_1.cleanKey)(types_1.AllModuleTypes.CoreAction);
|
|
18
18
|
const allActions = new Set((allModules[actionKey]?.map((action) => action.key) ?? []));
|
|
19
19
|
const rovoAgents = allModules[types_1.AllModuleTypes.RovoAgent];
|
|
20
|
+
const rovoSkills = allModules[types_1.AllModuleTypes.RovoSkill];
|
|
20
21
|
const automationActionProviders = allModules[types_1.AllModuleTypes.AutomationActionProvider];
|
|
21
22
|
rovoAgents?.forEach((agent) => {
|
|
22
23
|
agent.actions?.forEach((action) => {
|
|
23
24
|
allActions.delete(action);
|
|
24
25
|
});
|
|
25
26
|
});
|
|
27
|
+
rovoSkills?.forEach((skill) => {
|
|
28
|
+
skill.dependencies?.tools?.forEach((tool) => {
|
|
29
|
+
allActions.delete(tool);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
26
32
|
automationActionProviders?.forEach((actionProvider) => {
|
|
27
33
|
actionProvider.actions?.forEach((action) => {
|
|
28
34
|
allActions.delete(action);
|
|
@@ -3,6 +3,10 @@ import { ManifestSchema } from '../schema/manifest';
|
|
|
3
3
|
import { ValidatorInterface } from './validator-interface';
|
|
4
4
|
export declare const MAX_RESOURCE_COUNT = 50;
|
|
5
5
|
export declare class ResourcesValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
|
|
6
|
+
private isHtmlEntryFile;
|
|
7
|
+
private validateEntryResourceReference;
|
|
8
|
+
private trackAndValidateResourceType;
|
|
9
|
+
private validateResourceEntryExtensions;
|
|
6
10
|
validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
|
|
7
11
|
}
|
|
8
12
|
//# sourceMappingURL=resources-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources-validator.d.ts","sourceRoot":"","sources":["../../src/validators/resources-validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,
|
|
1
|
+
{"version":3,"file":"resources-validator.d.ts","sourceRoot":"","sources":["../../src/validators/resources-validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAyB,cAAc,EAAmB,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAcrC,qBAAa,kBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,8BAA8B;IAoGtC,OAAO,CAAC,4BAA4B;IAwBpC,OAAO,CAAC,+BAA+B;IAwCjC,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAsOrD"}
|
|
@@ -7,9 +7,130 @@ const path_1 = require("path");
|
|
|
7
7
|
const cheerio_1 = require("cheerio");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const text_1 = require("../text");
|
|
10
|
-
const utils_2 = require("../utils");
|
|
11
10
|
exports.MAX_RESOURCE_COUNT = 50;
|
|
12
11
|
class ResourcesValidator {
|
|
12
|
+
isHtmlEntryFile(entryPath) {
|
|
13
|
+
return entryPath.toLowerCase().endsWith('.html');
|
|
14
|
+
}
|
|
15
|
+
validateEntryResourceReference(parsedReference, resource, moduleKey, module, manifestDir, yamlContentByLine, validationErrors) {
|
|
16
|
+
const entryKey = parsedReference.entryKey;
|
|
17
|
+
if (!entryKey) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const entryMap = resource.entry;
|
|
21
|
+
if (!entryMap) {
|
|
22
|
+
validationErrors.push({
|
|
23
|
+
message: text_1.errors.resources.missingEntryMap(resource.key, moduleKey),
|
|
24
|
+
reference: text_1.References.Resources,
|
|
25
|
+
level: 'error',
|
|
26
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!Object.hasOwn(entryMap, entryKey)) {
|
|
31
|
+
validationErrors.push({
|
|
32
|
+
message: text_1.errors.resources.missingEntryKey(resource.key, entryKey, moduleKey),
|
|
33
|
+
reference: text_1.References.Resources,
|
|
34
|
+
level: 'error',
|
|
35
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const entryPath = entryMap[entryKey];
|
|
40
|
+
if (entryPath.includes('..')) {
|
|
41
|
+
validationErrors.push({
|
|
42
|
+
message: text_1.errors.resources.invalidEntryPathValue(resource.key, entryKey, entryPath),
|
|
43
|
+
reference: text_1.References.Resources,
|
|
44
|
+
level: 'error',
|
|
45
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const resolvedEntryPath = (0, path_1.resolve)(manifestDir, resource.path, entryPath);
|
|
50
|
+
const displayEntryPath = `${resource.path}/${entryPath}`;
|
|
51
|
+
if (!fs_1.default.existsSync(resolvedEntryPath)) {
|
|
52
|
+
validationErrors.push({
|
|
53
|
+
message: text_1.errors.resources.missingEntryFile(displayEntryPath, moduleKey),
|
|
54
|
+
reference: text_1.References.Resources,
|
|
55
|
+
level: 'error',
|
|
56
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (fs_1.default.lstatSync(resolvedEntryPath).isDirectory()) {
|
|
61
|
+
validationErrors.push({
|
|
62
|
+
message: text_1.errors.resources.directoryEntryFile(displayEntryPath, moduleKey),
|
|
63
|
+
reference: text_1.References.Resources,
|
|
64
|
+
level: 'error',
|
|
65
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (module.render === 'native' && this.isHtmlEntryFile(entryPath)) {
|
|
70
|
+
validationErrors.push({
|
|
71
|
+
message: text_1.errors.resources.invalidUiKitEntryFileType(displayEntryPath, moduleKey),
|
|
72
|
+
reference: text_1.References.Resources,
|
|
73
|
+
level: 'error',
|
|
74
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (module.render !== 'native' && !this.isHtmlEntryFile(entryPath)) {
|
|
79
|
+
validationErrors.push({
|
|
80
|
+
message: text_1.errors.resources.invalidCustomUiEntryFileType(displayEntryPath, moduleKey),
|
|
81
|
+
reference: text_1.References.Resources,
|
|
82
|
+
level: 'error',
|
|
83
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
trackAndValidateResourceType(resource, module, resourceTypeMap, moduleKey, yamlContentByLine, validationErrors) {
|
|
88
|
+
if (resource.entry) {
|
|
89
|
+
const resourceType = module.render === 'native' ? 'native' : 'customUI';
|
|
90
|
+
const existingResourceType = resourceTypeMap.get(resource.key);
|
|
91
|
+
if (existingResourceType && existingResourceType !== resourceType) {
|
|
92
|
+
validationErrors.push({
|
|
93
|
+
message: text_1.errors.resources.resourceTypeConflict(resource.key),
|
|
94
|
+
reference: text_1.References.Resources,
|
|
95
|
+
level: 'error',
|
|
96
|
+
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (!existingResourceType) {
|
|
100
|
+
resourceTypeMap.set(resource.key, resourceType);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
validateResourceEntryExtensions(resources, resourceTypeMap, yamlContentByLine, validationErrors) {
|
|
105
|
+
resources.forEach((resource) => {
|
|
106
|
+
const entryMap = resource.entry;
|
|
107
|
+
if (!entryMap) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const resourceType = resourceTypeMap.get(resource.key);
|
|
111
|
+
if (!resourceType) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
Object.entries(entryMap).forEach(([entryKey, entryPath]) => {
|
|
115
|
+
if (resourceType === 'native' && this.isHtmlEntryFile(entryPath)) {
|
|
116
|
+
validationErrors.push({
|
|
117
|
+
message: text_1.errors.resources.invalidUiKitResourceEntryFileType(resource.key, entryKey, entryPath),
|
|
118
|
+
reference: text_1.References.Resources,
|
|
119
|
+
level: 'error',
|
|
120
|
+
...(0, utils_1.findPosition)(resource.key, yamlContentByLine)
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (resourceType === 'customUI' && !this.isHtmlEntryFile(entryPath)) {
|
|
124
|
+
validationErrors.push({
|
|
125
|
+
message: text_1.errors.resources.invalidCustomUiResourceEntryFileType(resource.key, entryKey, entryPath),
|
|
126
|
+
reference: text_1.References.Resources,
|
|
127
|
+
level: 'error',
|
|
128
|
+
...(0, utils_1.findPosition)(resource.key, yamlContentByLine)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
13
134
|
async validate(manifest) {
|
|
14
135
|
if (!manifest || !manifest.typedContent || !manifest.filePath) {
|
|
15
136
|
return {
|
|
@@ -18,7 +139,8 @@ class ResourcesValidator {
|
|
|
18
139
|
};
|
|
19
140
|
}
|
|
20
141
|
const validationErrors = [];
|
|
21
|
-
const { typedContent: { resources, modules },
|
|
142
|
+
const { typedContent: { resources, modules }, filePath } = manifest;
|
|
143
|
+
const yamlContentByLine = manifest.yamlContentByLine || [];
|
|
22
144
|
if (!resources) {
|
|
23
145
|
return {
|
|
24
146
|
success: true,
|
|
@@ -34,22 +156,40 @@ class ResourcesValidator {
|
|
|
34
156
|
});
|
|
35
157
|
}
|
|
36
158
|
if (modules) {
|
|
37
|
-
const resourceMap = new Map(resources.map((
|
|
159
|
+
const resourceMap = new Map(resources.map((resource) => [resource.key, resource]));
|
|
160
|
+
const resourceTypeMap = new Map();
|
|
38
161
|
const manifestDir = (0, path_1.dirname)(filePath);
|
|
39
162
|
(0, utils_1.getValidModules)(modules).forEach((moduleKey) => {
|
|
40
163
|
modules[moduleKey]?.forEach((module) => {
|
|
41
|
-
|
|
164
|
+
const resourceReference = module.resource;
|
|
165
|
+
if (!resourceReference) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const invalidResourceReferences = (0, utils_1.findInvalidResourceReferences)(module, resources);
|
|
169
|
+
invalidResourceReferences.forEach((invalidReference) => {
|
|
170
|
+
const parsedReference = (0, utils_1.parseResourceReference)(invalidReference);
|
|
42
171
|
validationErrors.push({
|
|
43
|
-
message: text_1.errors.modules.wrongResourceReference(moduleKey, resourceKey),
|
|
172
|
+
message: text_1.errors.modules.wrongResourceReference(moduleKey, parsedReference.resourceKey),
|
|
44
173
|
reference: text_1.References.Resources,
|
|
45
174
|
level: 'error',
|
|
46
175
|
...(0, utils_1.findPosition)(moduleKey, yamlContentByLine)
|
|
47
176
|
});
|
|
48
177
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
178
|
+
const parsedReference = (0, utils_1.parseResourceReference)(resourceReference);
|
|
179
|
+
const resource = resourceMap.get(parsedReference.resourceKey);
|
|
180
|
+
if (!resource) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (parsedReference.entryKey) {
|
|
184
|
+
this.trackAndValidateResourceType(resource, module, resourceTypeMap, moduleKey, yamlContentByLine, validationErrors);
|
|
185
|
+
this.validateEntryResourceReference(parsedReference, resource, moduleKey, module, manifestDir, yamlContentByLine, validationErrors);
|
|
51
186
|
return;
|
|
52
|
-
|
|
187
|
+
}
|
|
188
|
+
const resourcePath = resource.path;
|
|
189
|
+
const resourcePathDir = (0, path_1.resolve)(manifestDir, resourcePath);
|
|
190
|
+
if (!fs_1.default.existsSync(resourcePathDir)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
53
193
|
if (module.render === 'native') {
|
|
54
194
|
if (fs_1.default.lstatSync(resourcePathDir).isDirectory()) {
|
|
55
195
|
validationErrors.push({
|
|
@@ -81,8 +221,17 @@ class ResourcesValidator {
|
|
|
81
221
|
}
|
|
82
222
|
});
|
|
83
223
|
});
|
|
224
|
+
this.validateResourceEntryExtensions(resources, resourceTypeMap, yamlContentByLine, validationErrors);
|
|
84
225
|
(0, utils_1.getValidModules)(modules).forEach((moduleKey) => {
|
|
85
|
-
const uniquePaths = new Set(modules[moduleKey]
|
|
226
|
+
const uniquePaths = new Set(modules[moduleKey]
|
|
227
|
+
.map(({ resource }) => {
|
|
228
|
+
if (!resource) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
const parsedReference = (0, utils_1.parseResourceReference)(resource);
|
|
232
|
+
return resourceMap.get(parsedReference.resourceKey)?.path;
|
|
233
|
+
})
|
|
234
|
+
.filter((resourcePath) => Boolean(resourcePath)));
|
|
86
235
|
uniquePaths.forEach((path) => {
|
|
87
236
|
if (!path)
|
|
88
237
|
return;
|