@forge/manifest 7.7.0-next.10 → 7.7.0-next.12

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 7.7.0-next.12
4
+
5
+ ### Patch Changes
6
+
7
+ - ce41b8c: Update manifest definitions
8
+
9
+ ## 7.7.0-next.11
10
+
11
+ ### Minor Changes
12
+
13
+ - bf34881: Add translations schema to manifest schema template to enable Forge i18n support.
14
+ Additionally relevant validators (i.e. `translations-validator`) are added to validate the translations schema in the manifest.
15
+
3
16
  ## 7.7.0-next.10
4
17
 
5
18
  ### Patch Changes
@@ -908,6 +908,13 @@
908
908
  },
909
909
  "maxProperties": 10
910
910
  },
911
+ "outputs": {
912
+ "type": "object",
913
+ "additionalProperties": {
914
+ "$ref": "#/definitions/ActionOutput"
915
+ },
916
+ "maxProperties": 10
917
+ },
911
918
  "key": {
912
919
  "$ref": "#/definitions/ModuleKeySchema"
913
920
  }
@@ -965,6 +972,13 @@
965
972
  },
966
973
  "maxProperties": 10
967
974
  },
975
+ "outputs": {
976
+ "type": "object",
977
+ "additionalProperties": {
978
+ "$ref": "#/definitions/ActionOutput"
979
+ },
980
+ "maxProperties": 10
981
+ },
968
982
  "key": {
969
983
  "$ref": "#/definitions/ModuleKeySchema"
970
984
  }
@@ -24228,7 +24242,7 @@
24228
24242
  "auth"
24229
24243
  ]
24230
24244
  },
24231
- "CoreActionInputsType": {
24245
+ "CoreActionIOType": {
24232
24246
  "type": "string",
24233
24247
  "enum": [
24234
24248
  "boolean",
@@ -24253,7 +24267,28 @@
24253
24267
  "description": "A description of what this particular input is intended for. Example: 'ID of the Issue that will be updated as a result of this action'\n"
24254
24268
  },
24255
24269
  "type": {
24256
- "$ref": "#/definitions/CoreActionInputsType"
24270
+ "$ref": "#/definitions/CoreActionIOType"
24271
+ }
24272
+ }
24273
+ },
24274
+ "ActionOutput": {
24275
+ "type": "object",
24276
+ "required": [
24277
+ "description",
24278
+ "nullable",
24279
+ "type"
24280
+ ],
24281
+ "properties": {
24282
+ "description": {
24283
+ "type": "string",
24284
+ "description": "A description of what this particular output represents. Example: 'ID of the Issue that was created as a result of this action'\n"
24285
+ },
24286
+ "nullable": {
24287
+ "type": "boolean",
24288
+ "description": "A flag to indicate whether the output can have a value of null."
24289
+ },
24290
+ "type": {
24291
+ "$ref": "#/definitions/CoreActionIOType"
24257
24292
  }
24258
24293
  }
24259
24294
  },
@@ -110,7 +110,7 @@ export type Function3 = string;
110
110
  * Name of the key of the function that will handle this action.
111
111
  */
112
112
  export type Function4 = string;
113
- export type CoreActionInputsType = 'boolean' | 'integer' | 'number' | 'string';
113
+ export type CoreActionIOType = 'boolean' | 'integer' | 'number' | 'string';
114
114
  /**
115
115
  * The key for an extension in CaaS. That means that this is a reference to another
116
116
  * extension in your descriptor / manifest.
@@ -1015,6 +1015,9 @@ export interface Modules {
1015
1015
  inputs?: {
1016
1016
  [k: string]: ActionInput;
1017
1017
  };
1018
+ outputs?: {
1019
+ [k: string]: ActionOutput;
1020
+ };
1018
1021
  key: ModuleKeySchema;
1019
1022
  }
1020
1023
  | {
@@ -1038,6 +1041,9 @@ export interface Modules {
1038
1041
  inputs?: {
1039
1042
  [k: string]: ActionInput;
1040
1043
  };
1044
+ outputs?: {
1045
+ [k: string]: ActionOutput;
1046
+ };
1041
1047
  key: ModuleKeySchema;
1042
1048
  }
1043
1049
  | {
@@ -1109,6 +1115,9 @@ export interface Modules {
1109
1115
  inputs?: {
1110
1116
  [k: string]: ActionInput;
1111
1117
  };
1118
+ outputs?: {
1119
+ [k: string]: ActionOutput;
1120
+ };
1112
1121
  key: ModuleKeySchema;
1113
1122
  }
1114
1123
  | {
@@ -1132,6 +1141,9 @@ export interface Modules {
1132
1141
  inputs?: {
1133
1142
  [k: string]: ActionInput;
1134
1143
  };
1144
+ outputs?: {
1145
+ [k: string]: ActionOutput;
1146
+ };
1135
1147
  key: ModuleKeySchema;
1136
1148
  }
1137
1149
  | {
@@ -10646,7 +10658,20 @@ export interface ActionInput {
10646
10658
  *
10647
10659
  */
10648
10660
  description: string;
10649
- type: CoreActionInputsType;
10661
+ type: CoreActionIOType;
10662
+ [k: string]: unknown;
10663
+ }
10664
+ export interface ActionOutput {
10665
+ /**
10666
+ * A description of what this particular output represents. Example: 'ID of the Issue that was created as a result of this action'
10667
+ *
10668
+ */
10669
+ description: string;
10670
+ /**
10671
+ * A flag to indicate whether the output can have a value of null.
10672
+ */
10673
+ nullable: boolean;
10674
+ type: CoreActionIOType;
10650
10675
  [k: string]: unknown;
10651
10676
  }
10652
10677
  /**
@@ -1,3 +1,4 @@
1
+ import { type ForgeSupportedLocaleCode } from '../schema/manifest';
1
2
  import { AllModuleTypes } from '../types';
2
3
  export declare const errors: {
3
4
  invalidManifest: (reason: string) => string;
@@ -164,13 +165,14 @@ export declare const errors: {
164
165
  };
165
166
  };
166
167
  translations: {
167
- missingTranslationsJsonFile: (languageLocaleCode: string) => string;
168
- duplicateFallbackConfig: (languageLocaleCode: string) => string;
169
- invalidLanguageFile: (languageLocaleCode: string, path: string) => string;
170
- duplicateResourceKey: (languageLocaleCode: string) => string;
168
+ missingTranslationsJsonFile: (languageLocaleCode: ForgeSupportedLocaleCode) => string;
169
+ duplicateFallbackConfig: (languageLocaleCode: ForgeSupportedLocaleCode) => string;
170
+ invalidLanguageFile: (languageLocaleCode: ForgeSupportedLocaleCode, path: string) => string;
171
+ duplicateResourceKey: (languageLocaleCode: ForgeSupportedLocaleCode) => string;
171
172
  i18nKeyNotFound: (keyName: string) => string;
172
173
  missingTranslationsPropertyError: string;
173
174
  internalI18nPropertyKeyFound: (propertyKey: string, moduleKey: string) => string;
175
+ i18nValueValidationError: (keyName: string, languageLocaleCode: ForgeSupportedLocaleCode, errorMsg: string) => string;
174
176
  };
175
177
  };
176
178
  export declare enum References {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":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AO,0BAA0B;IACjC,cAAc,kCAAkC;IAChD,SAAS,4BAA4B;IACrC,SAAS,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;IACjC,eAAe,0BAA0B;CAC1C"}
@@ -183,7 +183,8 @@ exports.errors = {
183
183
  duplicateResourceKey: (languageLocaleCode) => `Duplicate translations resource key found: '${languageLocaleCode}'`,
184
184
  i18nKeyNotFound: (keyName) => `i18n key '${keyName}' could not be found in default locale file.`,
185
185
  missingTranslationsPropertyError: 'i18n key(s) found but translations property is missing in manifest file',
186
- internalI18nPropertyKeyFound: (propertyKey, moduleKey) => `Unexpected property key '${propertyKey}' found in '${moduleKey}' module`
186
+ internalI18nPropertyKeyFound: (propertyKey, moduleKey) => `Unexpected property key '${propertyKey}' found in '${moduleKey}' module`,
187
+ i18nValueValidationError: (keyName, languageLocaleCode, errorMsg) => `i18n value for key '${keyName}' for locale '${languageLocaleCode}' ${errorMsg}`
187
188
  }
188
189
  };
189
190
  var References;
@@ -0,0 +1,3 @@
1
+ export * from './module-i18n-helper';
2
+ export * from './translation-value-getter';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/i18n/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./module-i18n-helper"), exports);
5
+ tslib_1.__exportStar(require("./translation-value-getter"), exports);
@@ -0,0 +1,10 @@
1
+ import { Modules } from '../../schema/manifest';
2
+ export declare type ModuleI18nProperties = {
3
+ propertyPath: string[];
4
+ moduleName: string;
5
+ key: string;
6
+ }[];
7
+ export declare const extractI18nPropertiesFromModules: (modules: Modules) => ModuleI18nProperties;
8
+ export declare const extractI18nKeysFromModules: (modules: Modules) => string[];
9
+ export declare const extractInternalI18nPropertyKeysFromModules: (modules: Modules) => [string, string][];
10
+ //# sourceMappingURL=module-i18n-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-i18n-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/i18n/module-i18n-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,oBAAY,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,EAAE,CAAC;AA8EJ,eAAO,MAAM,gCAAgC,YAAa,OAAO,yBAWhE,CAAC;AAGF,eAAO,MAAM,0BAA0B,YAAa,OAAO,KAAG,MAAM,EAWnE,CAAC;AAEF,eAAO,MAAM,0CAA0C,YAAa,OAAO,KAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAS7F,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractInternalI18nPropertyKeysFromModules = exports.extractI18nKeysFromModules = void 0;
3
+ exports.extractInternalI18nPropertyKeysFromModules = exports.extractI18nKeysFromModules = exports.extractI18nPropertiesFromModules = void 0;
4
4
  const isObject = (value) => {
5
5
  return typeof value === 'object' && value !== null && !Array.isArray(value);
6
6
  };
@@ -9,22 +9,23 @@ const isI18nValue = (value) => {
9
9
  };
10
10
  const getI18nKeysFromObject = (obj) => {
11
11
  const visited = new Set();
12
- const visit = (value) => {
12
+ const visit = (value, i18nPath) => {
13
13
  if (!isObject(value) || visited.has(value)) {
14
14
  return [];
15
15
  }
16
16
  visited.add(value);
17
- return Object.values(value).flatMap((propValue) => {
17
+ return Object.entries(value).flatMap(([propKey, propValue]) => {
18
+ const currentPath = [...i18nPath, propKey];
18
19
  if (isI18nValue(propValue)) {
19
- return [propValue.i18n];
20
+ return [{ propertyPath: currentPath, key: propValue.i18n }];
20
21
  }
21
22
  else if (Array.isArray(propValue)) {
22
- return propValue.flatMap((item) => visit(item));
23
+ return propValue.flatMap((item) => visit(item, currentPath));
23
24
  }
24
- return visit(propValue);
25
+ return visit(propValue, currentPath);
25
26
  });
26
27
  };
27
- return visit(obj);
28
+ return visit(obj, []);
28
29
  };
29
30
  const INTERNAL_I18N_PROPERTY_KEY_SUFFIX = '__i18n';
30
31
  const isInternalI18nPropertyKey = (key) => {
@@ -60,11 +61,22 @@ const getAllModuleEntries = (modules) => {
60
61
  return [];
61
62
  });
62
63
  };
64
+ const extractI18nPropertiesFromModules = (modules) => {
65
+ const moduleI18nProperties = [];
66
+ for (const moduleEntry of getAllModuleEntries(modules)) {
67
+ const i18nKeysForEntryValue = getI18nKeysFromObject(moduleEntry[0]);
68
+ for (const i18nObj of i18nKeysForEntryValue) {
69
+ moduleI18nProperties.push({ moduleName: moduleEntry[1], ...i18nObj });
70
+ }
71
+ }
72
+ return moduleI18nProperties;
73
+ };
74
+ exports.extractI18nPropertiesFromModules = extractI18nPropertiesFromModules;
63
75
  const extractI18nKeysFromModules = (modules) => {
64
76
  const i18nKeys = new Set();
65
77
  for (const moduleEntry of getAllModuleEntries(modules)) {
66
78
  const i18nKeysForEntryValue = getI18nKeysFromObject(moduleEntry[0]);
67
- for (const key of i18nKeysForEntryValue) {
79
+ for (const { key } of i18nKeysForEntryValue) {
68
80
  i18nKeys.add(key);
69
81
  }
70
82
  }
@@ -1,4 +1,4 @@
1
- import { type ForgeSupportedLocaleCode } from '../schema/manifest';
1
+ import { type ForgeSupportedLocaleCode } from '../../schema/manifest';
2
2
  interface TranslationContent {
3
3
  [key: string]: string | TranslationContent;
4
4
  }
@@ -6,5 +6,6 @@ declare type TranslationContentByLocaleCode = {
6
6
  [key in ForgeSupportedLocaleCode]?: TranslationContent;
7
7
  };
8
8
  export declare const getTranslationValue: (translationLookup: TranslationContentByLocaleCode, i18nKey: string, locale: ForgeSupportedLocaleCode) => string | null;
9
+ export declare const getTranslationValueFromContent: (translationContent: TranslationContent, i18nKey: string) => string | null;
9
10
  export {};
10
11
  //# sourceMappingURL=translation-value-getter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-value-getter.d.ts","sourceRoot":"","sources":["../../../src/utils/i18n/translation-value-getter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,UAAU,kBAAkB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAC;CAC5C;AAED,aAAK,8BAA8B,GAAG;KACnC,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,kBAAkB;CACvD,CAAC;AAIF,eAAO,MAAM,mBAAmB,sBACX,8BAA8B,WACxC,MAAM,UACP,wBAAwB,KAC/B,MAAM,GAAG,IAMX,CAAC;AAEF,eAAO,MAAM,8BAA8B,uBACrB,kBAAkB,WAC7B,MAAM,KACd,MAAM,GAAG,IAUX,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTranslationValue = void 0;
3
+ exports.getTranslationValueFromContent = exports.getTranslationValue = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const get_1 = tslib_1.__importDefault(require("lodash/get"));
6
6
  const getTranslationValue = (translationLookup, i18nKey, locale) => {
@@ -8,13 +8,17 @@ const getTranslationValue = (translationLookup, i18nKey, locale) => {
8
8
  if (!translation) {
9
9
  return null;
10
10
  }
11
- let translationValue = translation[i18nKey];
11
+ return (0, exports.getTranslationValueFromContent)(translation, i18nKey);
12
+ };
13
+ exports.getTranslationValue = getTranslationValue;
14
+ const getTranslationValueFromContent = (translationContent, i18nKey) => {
15
+ let translationValue = translationContent[i18nKey];
12
16
  if (!translationValue) {
13
17
  const keyTokens = i18nKey.split('.');
14
18
  if (keyTokens.length > 1) {
15
- translationValue = (0, get_1.default)(translation, keyTokens, null);
19
+ translationValue = (0, get_1.default)(translationContent, keyTokens, null);
16
20
  }
17
21
  }
18
22
  return typeof translationValue === 'string' ? translationValue : null;
19
23
  };
20
- exports.getTranslationValue = getTranslationValue;
24
+ exports.getTranslationValueFromContent = getTranslationValueFromContent;
@@ -4,6 +4,5 @@ export * from './module-key-cleaner';
4
4
  export * from './module-references';
5
5
  export * from './manifest-parser-builder';
6
6
  export type { ManifestParser } from './manifest-parser';
7
- export * from './module-i18n-helper';
8
- export * from './translation-value-getter';
7
+ export * from './i18n';
9
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,cAAc,QAAQ,CAAC"}
@@ -6,5 +6,4 @@ tslib_1.__exportStar(require("./line-finder"), exports);
6
6
  tslib_1.__exportStar(require("./module-key-cleaner"), exports);
7
7
  tslib_1.__exportStar(require("./module-references"), exports);
8
8
  tslib_1.__exportStar(require("./manifest-parser-builder"), exports);
9
- tslib_1.__exportStar(require("./module-i18n-helper"), exports);
10
- tslib_1.__exportStar(require("./translation-value-getter"), exports);
9
+ tslib_1.__exportStar(require("./i18n"), exports);
@@ -2,9 +2,18 @@ import { type ManifestSchema } from '../schema/manifest';
2
2
  import { ManifestObject, ManifestValidationResult } from '../types';
3
3
  import { ValidatorInterface } from './validator-interface';
4
4
  export declare class TranslationsValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
5
+ private validateCache;
6
+ private ajv;
5
7
  private ensureValidResourcesDefinition;
6
8
  private ensureValidFallbackDefinition;
9
+ private getAllLocalesLookup;
7
10
  private ensureI18nKeysExistInDefaultJson;
11
+ private getI18nMap;
12
+ private getI18nPropertySchema;
13
+ private getValidateI18nFn;
14
+ private getI18nPropertyValidator;
15
+ private ensureValidI18nValue;
16
+ private ensureAllValidI18nValue;
8
17
  private validateManifestWithoutI18nConfig;
9
18
  private validateManifestI18nConfig;
10
19
  private validateInternalI18nPropertyKeysNotInModules;
@@ -1 +1 @@
1
- {"version":3,"file":"translations-validator.d.ts","sourceRoot":"","sources":["../../src/validators/translations-validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+C,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGtG,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,qBAAa,qBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,8BAA8B;IA8CtC,OAAO,CAAC,6BAA6B;IA8CrC,OAAO,CAAC,gCAAgC;IAsBxC,OAAO,CAAC,iCAAiC;IAwBzC,OAAO,CAAC,0BAA0B;IASlC,OAAO,CAAC,4CAA4C;IAe9C,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CAyBrD"}
1
+ {"version":3,"file":"translations-validator.d.ts","sourceRoot":"","sources":["../../src/validators/translations-validator.ts"],"names":[],"mappings":"AAKA,OAAO,EAA+C,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAItG,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAmB,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAW3D,qBAAa,qBACX,YAAW,kBAAkB,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,EAAE,cAAc,CAAC;IAEzF,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,GAAG,CAA8D;IAEzE,OAAO,CAAC,8BAA8B;IA4CtC,OAAO,CAAC,6BAA6B;IA+CrC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gCAAgC;IAoBxC,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,qBAAqB;IA4B7B,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,wBAAwB;IAiDhC,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,iCAAiC;IAwBzC,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,4CAA4C;IAe9C,QAAQ,CACZ,QAAQ,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;CA0BrD"}
@@ -4,14 +4,19 @@ exports.TranslationsValidator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const path_1 = require("path");
7
+ const lodash_1 = require("lodash");
8
+ const ajv_1 = tslib_1.__importDefault(require("ajv"));
9
+ const manifest_schema_json_1 = tslib_1.__importDefault(require("../schema/manifest-schema.json"));
7
10
  const text_1 = require("../text");
8
11
  const text_2 = require("../text");
9
12
  const utils_1 = require("../utils");
10
13
  class TranslationsValidator {
14
+ validateCache = new Map();
15
+ ajv = new ajv_1.default({ allErrors: true, verbose: true, strict: false });
11
16
  ensureValidResourcesDefinition(validationErrors, manifest) {
12
- const { resources, fallback } = manifest.yamlContent.translations;
17
+ const { resources } = manifest.yamlContent.translations;
13
18
  const resourcesMap = new Map();
14
- resources.forEach(({ key, path }) => {
19
+ for (const { key, path } of resources) {
15
20
  if (resourcesMap.has(key)) {
16
21
  validationErrors.push({
17
22
  message: text_1.errors.translations.duplicateResourceKey(key),
@@ -23,16 +28,14 @@ class TranslationsValidator {
23
28
  else {
24
29
  resourcesMap.set(key, path);
25
30
  }
26
- });
27
- let defaultLanguageLookup = {};
28
- resourcesMap.forEach((path, key) => {
31
+ }
32
+ const allLanguageLookup = {};
33
+ for (const [key, path] of resourcesMap) {
29
34
  const resourcePath = (0, path_1.resolve)(path);
30
35
  try {
31
36
  if (fs_1.default.lstatSync(resourcePath).isFile()) {
32
37
  const data = JSON.parse(fs_1.default.readFileSync((0, path_1.resolve)(path), 'utf8'));
33
- if (fallback?.default === key) {
34
- defaultLanguageLookup = data;
35
- }
38
+ allLanguageLookup[key] = data;
36
39
  }
37
40
  }
38
41
  catch (e) {
@@ -43,8 +46,8 @@ class TranslationsValidator {
43
46
  ...(0, utils_1.findPosition)(`path: ${path}`, manifest?.yamlContentByLine)
44
47
  });
45
48
  }
46
- });
47
- return defaultLanguageLookup;
49
+ }
50
+ return allLanguageLookup;
48
51
  }
49
52
  ensureValidFallbackDefinition(validationErrors, manifest) {
50
53
  const { resources, fallback } = manifest.yamlContent.translations;
@@ -52,7 +55,7 @@ class TranslationsValidator {
52
55
  const resourcesSet = new Set(resources.map((resource) => resource.key));
53
56
  const fallbackLanguages = Object.keys(fallback).filter((fallbackLanguage) => fallbackLanguage !== 'default');
54
57
  const allFallbackLanguagesSet = new Set([defaultLanguage, ...fallbackLanguages]);
55
- allFallbackLanguagesSet.forEach((fallbackLanguage) => {
58
+ for (const fallbackLanguage of allFallbackLanguagesSet) {
56
59
  if (!resourcesSet.has(fallbackLanguage)) {
57
60
  validationErrors.push({
58
61
  message: text_1.errors.translations.missingTranslationsJsonFile(fallbackLanguage),
@@ -61,7 +64,7 @@ class TranslationsValidator {
61
64
  ...(0, utils_1.findPosition)(fallbackLanguage === defaultLanguage ? `default: ${fallbackLanguage}` : `${fallbackLanguage}:`, manifest.yamlContentByLine)
62
65
  });
63
66
  }
64
- });
67
+ }
65
68
  const allLanguagesList = [
66
69
  defaultLanguage,
67
70
  ...fallbackLanguages,
@@ -71,31 +74,138 @@ class TranslationsValidator {
71
74
  languageSet.has(language) ? duplicates.add(language) : languageSet.add(language);
72
75
  return [languageSet, duplicates];
73
76
  }, [new Set(), new Set()]);
74
- duplicates.forEach((duplicate) => {
77
+ for (const duplicate of duplicates) {
75
78
  validationErrors.push({
76
79
  message: text_1.errors.translations.duplicateFallbackConfig(duplicate),
77
80
  reference: text_2.References.SchemaError,
78
81
  level: 'error',
79
82
  ...(0, utils_1.findPosition)(duplicate, manifest.yamlContentByLine)
80
83
  });
81
- });
84
+ }
82
85
  }
83
- ensureI18nKeysExistInDefaultJson(validationErrors, i18nKeys, defaultLanguageLookup, manifest) {
84
- const i18nKeysSet = new Set(i18nKeys);
85
- const defaultLocalCode = manifest.yamlContent.translations.fallback.default;
86
- const languageLookUp = { [defaultLocalCode]: defaultLanguageLookup };
87
- i18nKeysSet.forEach((key) => {
88
- const i18nValue = (0, utils_1.getTranslationValue)(languageLookUp, key, defaultLocalCode);
86
+ getAllLocalesLookup(validationErrors, i18nKeys, translationsLookup, manifest) {
87
+ const { resources, fallback } = manifest.yamlContent.translations;
88
+ const defaultLocaleCode = fallback.default;
89
+ return resources
90
+ .map((resource) => resource.key)
91
+ .reduce((allLocalesLookup, locale) => {
92
+ const i18nMap = this.getI18nMap(i18nKeys, translationsLookup, locale);
93
+ if (locale === defaultLocaleCode) {
94
+ this.ensureI18nKeysExistInDefaultJson(validationErrors, i18nKeys, translationsLookup, locale, manifest);
95
+ }
96
+ allLocalesLookup.set(locale, i18nMap);
97
+ return allLocalesLookup;
98
+ }, new Map());
99
+ }
100
+ ensureI18nKeysExistInDefaultJson(validationErrors, i18nKeys, translationsLookup, locale, manifest) {
101
+ for (const i18nKey of i18nKeys) {
102
+ const i18nValue = (0, utils_1.getTranslationValue)(translationsLookup, i18nKey, locale);
89
103
  if (!i18nValue) {
90
104
  validationErrors.push({
91
- message: text_1.errors.translations.i18nKeyNotFound(key),
105
+ message: text_1.errors.translations.i18nKeyNotFound(i18nKey),
92
106
  reference: text_2.References.SchemaError,
93
107
  level: 'error',
94
- ...(0, utils_1.findPosition)(`i18n: ${key}`, manifest.yamlContentByLine)
108
+ ...(0, utils_1.findPosition)(`i18n: ${i18nKey}`, manifest.yamlContentByLine)
95
109
  });
96
110
  }
111
+ }
112
+ }
113
+ getI18nMap(i18nKeys, translationsLookup, locale) {
114
+ return i18nKeys.reduce((i18nMap, key) => {
115
+ const i18nValue = (0, utils_1.getTranslationValue)(translationsLookup, key, locale);
116
+ if (i18nValue) {
117
+ i18nMap.set(key, i18nValue);
118
+ }
119
+ return i18nMap;
120
+ }, new Map());
121
+ }
122
+ getI18nPropertySchema(schemaSlice, i18nPath) {
123
+ if (typeof schemaSlice !== 'object' || schemaSlice === null) {
124
+ return [];
125
+ }
126
+ const [propertyName, ...restPath] = i18nPath;
127
+ if (Array.isArray(schemaSlice)) {
128
+ return schemaSlice.flatMap((object) => {
129
+ return this.getI18nPropertySchema(object, i18nPath);
130
+ });
131
+ }
132
+ return Object.entries(schemaSlice).flatMap(([key, value]) => {
133
+ if (key === propertyName) {
134
+ if (restPath.length === 0 && typeof value === 'object') {
135
+ return [value];
136
+ }
137
+ else if (restPath.length > 0) {
138
+ return this.getI18nPropertySchema(value, restPath);
139
+ }
140
+ else {
141
+ return [];
142
+ }
143
+ }
144
+ else {
145
+ return this.getI18nPropertySchema(value, i18nPath);
146
+ }
97
147
  });
98
148
  }
149
+ getValidateI18nFn(i18nPropertySchema) {
150
+ const schemaKey = JSON.stringify(i18nPropertySchema);
151
+ if (this.validateCache.has(schemaKey)) {
152
+ return this.validateCache.get(schemaKey);
153
+ }
154
+ const validate = this.ajv.compile(i18nPropertySchema);
155
+ this.validateCache.set(schemaKey, validate);
156
+ return validate;
157
+ }
158
+ getI18nPropertyValidator({ modulesSchema, i18nPropertyPath, i18nKey, locale, manifest }) {
159
+ const i18nPropertySchemas = this.getI18nPropertySchema(modulesSchema, i18nPropertyPath);
160
+ return (i18nValue) => {
161
+ const validationResults = i18nPropertySchemas.reduce((validationResults, i18nPropertySchema) => {
162
+ const validate = this.getValidateI18nFn(i18nPropertySchema);
163
+ if (!validationResults.isValid && !validate(i18nValue)) {
164
+ const validationErrors = validate.errors.reduce((validationErrors, validationError) => {
165
+ if (validationError.message) {
166
+ validationErrors.push({
167
+ message: text_1.errors.translations.i18nValueValidationError(i18nKey, locale, validationError.message),
168
+ reference: text_2.References.SchemaError,
169
+ level: 'error',
170
+ ...(0, utils_1.findPosition)(`i18n: ${i18nKey}`, manifest?.yamlContentByLine)
171
+ });
172
+ }
173
+ return validationErrors;
174
+ }, []);
175
+ validationResults.errors.push(validationErrors);
176
+ }
177
+ else {
178
+ validationResults.isValid = true;
179
+ }
180
+ return validationResults;
181
+ }, { errors: [], isValid: false });
182
+ return validationResults.isValid ? [] : validationResults.errors;
183
+ };
184
+ }
185
+ ensureValidI18nValue(validationErrors, i18nMap, moduleI18nProperties, locale, manifest) {
186
+ for (const i18n of moduleI18nProperties) {
187
+ const i18nValue = i18nMap.get(i18n.key);
188
+ if (i18nValue) {
189
+ const modulesSchema = (0, lodash_1.get)(manifest_schema_json_1.default.definitions.ModuleSchema.properties, i18n.moduleName);
190
+ const validator = this.getI18nPropertyValidator({
191
+ modulesSchema,
192
+ i18nPropertyPath: i18n.propertyPath,
193
+ i18nKey: i18n.key,
194
+ locale,
195
+ manifest
196
+ });
197
+ const validationResults = validator(i18nValue);
198
+ if (validationResults.length > 0) {
199
+ validationErrors.push(...validationResults[0]);
200
+ }
201
+ }
202
+ }
203
+ }
204
+ ensureAllValidI18nValue(validationErrors, allI18nMap, moduleI18nProperties, manifest) {
205
+ for (const [locale, i18nMap] of allI18nMap) {
206
+ this.ensureValidI18nValue(validationErrors, i18nMap, moduleI18nProperties, locale, manifest);
207
+ }
208
+ }
99
209
  validateManifestWithoutI18nConfig(manifest, i18nKeys) {
100
210
  if (i18nKeys.length === 0) {
101
211
  return {
@@ -117,11 +227,12 @@ class TranslationsValidator {
117
227
  errors: missingTranslationsPropertyError
118
228
  };
119
229
  }
120
- validateManifestI18nConfig(manifest, i18nKeys) {
230
+ validateManifestI18nConfig(manifest, i18nKeys, moduleI18nProperties) {
121
231
  const validationErrors = [];
122
- const defaultLanguageLookup = this.ensureValidResourcesDefinition(validationErrors, manifest);
232
+ const allLanguageLookup = this.ensureValidResourcesDefinition(validationErrors, manifest);
123
233
  this.ensureValidFallbackDefinition(validationErrors, manifest);
124
- this.ensureI18nKeysExistInDefaultJson(validationErrors, i18nKeys, defaultLanguageLookup, manifest);
234
+ const i18nMap = this.getAllLocalesLookup(validationErrors, i18nKeys, allLanguageLookup, manifest);
235
+ this.ensureAllValidI18nValue(validationErrors, i18nMap, moduleI18nProperties, manifest);
125
236
  return validationErrors;
126
237
  }
127
238
  validateInternalI18nPropertyKeysNotInModules(manifest) {
@@ -141,13 +252,14 @@ class TranslationsValidator {
141
252
  manifestObject: manifest
142
253
  };
143
254
  }
144
- const i18nKeys = (0, utils_1.extractI18nKeysFromModules)(manifest?.typedContent?.modules ?? {});
255
+ const moduleI18nProperties = (0, utils_1.extractI18nPropertiesFromModules)(manifest?.typedContent?.modules ?? {});
256
+ const i18nKeys = moduleI18nProperties.map((i18nConfig) => i18nConfig.key);
145
257
  const i18nConfig = manifest?.yamlContent?.translations;
146
258
  if (!i18nConfig) {
147
259
  return this.validateManifestWithoutI18nConfig(manifest, i18nKeys);
148
260
  }
149
261
  const validationErrors = [
150
- ...this.validateManifestI18nConfig(manifest, i18nKeys),
262
+ ...this.validateManifestI18nConfig(manifest, i18nKeys, moduleI18nProperties),
151
263
  ...this.validateInternalI18nPropertyKeysNotInModules(manifest)
152
264
  ];
153
265
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "7.7.0-next.10",
3
+ "version": "7.7.0-next.12",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {
@@ -1,4 +0,0 @@
1
- import { Modules } from '../schema/manifest';
2
- export declare const extractI18nKeysFromModules: (modules: Modules) => string[];
3
- export declare const extractInternalI18nPropertyKeysFromModules: (modules: Modules) => [string, string][];
4
- //# sourceMappingURL=module-i18n-helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-i18n-helper.d.ts","sourceRoot":"","sources":["../../src/utils/module-i18n-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AA8E7C,eAAO,MAAM,0BAA0B,YAAa,OAAO,KAAG,MAAM,EASnE,CAAC;AAEF,eAAO,MAAM,0CAA0C,YAAa,OAAO,KAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAS7F,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"translation-value-getter.d.ts","sourceRoot":"","sources":["../../src/utils/translation-value-getter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,UAAU,kBAAkB;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAC;CAC5C;AAED,aAAK,8BAA8B,GAAG;KACnC,GAAG,IAAI,wBAAwB,CAAC,CAAC,EAAE,kBAAkB;CACvD,CAAC;AAIF,eAAO,MAAM,mBAAmB,sBACX,8BAA8B,WACxC,MAAM,UACP,wBAAwB,KAC/B,MAAM,GAAG,IAcX,CAAC"}