@forge/manifest 7.6.0 → 7.6.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @forge/manifest
2
2
 
3
+ ## 7.6.1-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c74ca63: Add translations section in manifest schema for Forge i18n Support (EAP)
8
+
9
+ ## 7.6.1-next.0
10
+
11
+ ### Patch Changes
12
+
13
+ - b90e809: Update manifest definitions
14
+ - 313b8e1: Update manifest definitions
15
+
3
16
  ## 7.6.0
4
17
 
5
18
  ### Minor Changes
package/out/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export * from './text';
8
8
  export * from './types';
9
9
  export * from './utils';
10
10
  export * from './validators';
11
- export { Modules, ManifestSchema, App, Resources, Permissions, Remotes, Fetch, Providers, Backend, Frames, Navigation, Images, Media, Scripts1, Styles1, Scopes, Content1, Fonts } from './schema/manifest';
11
+ export { Modules, ManifestSchema, App, Resources, Permissions, Remotes, Fetch, Providers, Backend, Frames, Navigation, Images, Media, Scripts1, Styles1, Scopes, Content1, Fonts, Translations, ForgeSupportedLocaleCode } from './schema/manifest';
12
12
  export declare const validate: (basic?: boolean, manifest?: string | undefined) => Promise<ManifestValidationResult<ManifestSchema | BasicManifestSchema>>;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAmB,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,OAAO,EACP,cAAc,EACd,GAAG,EACH,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,KAAK,EACN,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,QAAQ,+BAET,MAAM,GAAG,SAAS,KAC3B,QAAQ,yBAAyB,cAAc,GAAG,mBAAmB,CAAC,CAInD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAmB,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,OAAO,EACP,cAAc,EACd,GAAG,EACH,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,QAAQ,+BAET,MAAM,GAAG,SAAS,KAC3B,QAAQ,yBAAyB,cAAc,GAAG,mBAAmB,CAAC,CAInD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;;CAuBvF"}
1
+ {"version":3,"file":"full-validation-processor.d.ts","sourceRoot":"","sources":["../../src/processor/full-validation-processor.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,qBAAa,uBAAwB,SAAQ,2BAA2B,CAAC,cAAc,CAAC;;CAwBvF"}
@@ -30,7 +30,8 @@ class FullValidationProcessor extends abstract_validation_processor_1.AbstractVa
30
30
  new jql_function_validator_1.JqlFunctionValidator(),
31
31
  new validators_1.PackageValidator(),
32
32
  new app_features_validator_1.AppFeaturesValidator(),
33
- new data_classification_validator_1.DataClassificationValidator()
33
+ new data_classification_validator_1.DataClassificationValidator(),
34
+ new validators_1.TranslationsValidator()
34
35
  ]);
35
36
  }
36
37
  }
@@ -590,6 +590,13 @@
590
590
  "providers": {
591
591
  "$ref": "#/definitions/ExternalAuthFunctionProviders"
592
592
  },
593
+ "timeoutSeconds": {
594
+ "description": "The maximum amount of time the function is allowed to run, in seconds. Must be between 1 and 900.",
595
+ "maximum": 900,
596
+ "minimum": 1,
597
+ "title": "timeoutSeconds",
598
+ "type": "number"
599
+ },
593
600
  "key": {
594
601
  "$ref": "#/definitions/ModuleKeySchema"
595
602
  }
@@ -4386,28 +4393,6 @@
4386
4393
  },
4387
4394
  "edit": {
4388
4395
  "anyOf": [
4389
- {
4390
- "type": "object",
4391
- "properties": {
4392
- "resource": {
4393
- "type": "string",
4394
- "minLength": 1,
4395
- "maxLength": 23,
4396
- "pattern": "^[a-zA-Z0-9_\\-]+$"
4397
- },
4398
- "render": {
4399
- "default": "default",
4400
- "enum": [
4401
- "default",
4402
- "native"
4403
- ],
4404
- "type": "string"
4405
- }
4406
- },
4407
- "required": [
4408
- "resource"
4409
- ]
4410
- },
4411
4396
  {
4412
4397
  "type": "object",
4413
4398
  "properties": {
@@ -4421,6 +4406,40 @@
4421
4406
  "required": [
4422
4407
  "function"
4423
4408
  ]
4409
+ },
4410
+ {
4411
+ "allOf": [
4412
+ {
4413
+ "type": "object",
4414
+ "properties": {
4415
+ "resource": {
4416
+ "type": "string",
4417
+ "minLength": 1,
4418
+ "maxLength": 23,
4419
+ "pattern": "^[a-zA-Z0-9_\\-]+$"
4420
+ },
4421
+ "render": {
4422
+ "default": "default",
4423
+ "enum": [
4424
+ "default",
4425
+ "native"
4426
+ ],
4427
+ "type": "string"
4428
+ }
4429
+ },
4430
+ "required": [
4431
+ "resource"
4432
+ ]
4433
+ },
4434
+ {
4435
+ "type": "object",
4436
+ "properties": {
4437
+ "isInline": {
4438
+ "type": "boolean"
4439
+ }
4440
+ }
4441
+ }
4442
+ ]
4424
4443
  }
4425
4444
  ]
4426
4445
  },
@@ -4613,28 +4632,6 @@
4613
4632
  },
4614
4633
  "edit": {
4615
4634
  "anyOf": [
4616
- {
4617
- "type": "object",
4618
- "properties": {
4619
- "resource": {
4620
- "type": "string",
4621
- "minLength": 1,
4622
- "maxLength": 23,
4623
- "pattern": "^[a-zA-Z0-9_\\-]+$"
4624
- },
4625
- "render": {
4626
- "default": "default",
4627
- "enum": [
4628
- "default",
4629
- "native"
4630
- ],
4631
- "type": "string"
4632
- }
4633
- },
4634
- "required": [
4635
- "resource"
4636
- ]
4637
- },
4638
4635
  {
4639
4636
  "type": "object",
4640
4637
  "properties": {
@@ -4648,6 +4645,40 @@
4648
4645
  "required": [
4649
4646
  "function"
4650
4647
  ]
4648
+ },
4649
+ {
4650
+ "allOf": [
4651
+ {
4652
+ "type": "object",
4653
+ "properties": {
4654
+ "resource": {
4655
+ "type": "string",
4656
+ "minLength": 1,
4657
+ "maxLength": 23,
4658
+ "pattern": "^[a-zA-Z0-9_\\-]+$"
4659
+ },
4660
+ "render": {
4661
+ "default": "default",
4662
+ "enum": [
4663
+ "default",
4664
+ "native"
4665
+ ],
4666
+ "type": "string"
4667
+ }
4668
+ },
4669
+ "required": [
4670
+ "resource"
4671
+ ]
4672
+ },
4673
+ {
4674
+ "type": "object",
4675
+ "properties": {
4676
+ "isInline": {
4677
+ "type": "boolean"
4678
+ }
4679
+ }
4680
+ }
4681
+ ]
4651
4682
  }
4652
4683
  ]
4653
4684
  },
@@ -4818,28 +4849,6 @@
4818
4849
  },
4819
4850
  "edit": {
4820
4851
  "anyOf": [
4821
- {
4822
- "type": "object",
4823
- "properties": {
4824
- "resource": {
4825
- "type": "string",
4826
- "minLength": 1,
4827
- "maxLength": 23,
4828
- "pattern": "^[a-zA-Z0-9_\\-]+$"
4829
- },
4830
- "render": {
4831
- "default": "default",
4832
- "enum": [
4833
- "default",
4834
- "native"
4835
- ],
4836
- "type": "string"
4837
- }
4838
- },
4839
- "required": [
4840
- "resource"
4841
- ]
4842
- },
4843
4852
  {
4844
4853
  "type": "object",
4845
4854
  "properties": {
@@ -4853,6 +4862,40 @@
4853
4862
  "required": [
4854
4863
  "function"
4855
4864
  ]
4865
+ },
4866
+ {
4867
+ "allOf": [
4868
+ {
4869
+ "type": "object",
4870
+ "properties": {
4871
+ "resource": {
4872
+ "type": "string",
4873
+ "minLength": 1,
4874
+ "maxLength": 23,
4875
+ "pattern": "^[a-zA-Z0-9_\\-]+$"
4876
+ },
4877
+ "render": {
4878
+ "default": "default",
4879
+ "enum": [
4880
+ "default",
4881
+ "native"
4882
+ ],
4883
+ "type": "string"
4884
+ }
4885
+ },
4886
+ "required": [
4887
+ "resource"
4888
+ ]
4889
+ },
4890
+ {
4891
+ "type": "object",
4892
+ "properties": {
4893
+ "isInline": {
4894
+ "type": "boolean"
4895
+ }
4896
+ }
4897
+ }
4898
+ ]
4856
4899
  }
4857
4900
  ]
4858
4901
  },
@@ -5105,28 +5148,6 @@
5105
5148
  },
5106
5149
  "edit": {
5107
5150
  "anyOf": [
5108
- {
5109
- "type": "object",
5110
- "properties": {
5111
- "resource": {
5112
- "type": "string",
5113
- "minLength": 1,
5114
- "maxLength": 23,
5115
- "pattern": "^[a-zA-Z0-9_\\-]+$"
5116
- },
5117
- "render": {
5118
- "default": "default",
5119
- "enum": [
5120
- "default",
5121
- "native"
5122
- ],
5123
- "type": "string"
5124
- }
5125
- },
5126
- "required": [
5127
- "resource"
5128
- ]
5129
- },
5130
5151
  {
5131
5152
  "type": "object",
5132
5153
  "properties": {
@@ -5140,6 +5161,40 @@
5140
5161
  "required": [
5141
5162
  "function"
5142
5163
  ]
5164
+ },
5165
+ {
5166
+ "allOf": [
5167
+ {
5168
+ "type": "object",
5169
+ "properties": {
5170
+ "resource": {
5171
+ "type": "string",
5172
+ "minLength": 1,
5173
+ "maxLength": 23,
5174
+ "pattern": "^[a-zA-Z0-9_\\-]+$"
5175
+ },
5176
+ "render": {
5177
+ "default": "default",
5178
+ "enum": [
5179
+ "default",
5180
+ "native"
5181
+ ],
5182
+ "type": "string"
5183
+ }
5184
+ },
5185
+ "required": [
5186
+ "resource"
5187
+ ]
5188
+ },
5189
+ {
5190
+ "type": "object",
5191
+ "properties": {
5192
+ "isInline": {
5193
+ "type": "boolean"
5194
+ }
5195
+ }
5196
+ }
5197
+ ]
5143
5198
  }
5144
5199
  ]
5145
5200
  },
@@ -19985,6 +20040,112 @@
19985
20040
  }
19986
20041
  }
19987
20042
  },
20043
+ "ForgeSupportedLocaleCode": {
20044
+ "title": "ForgeSupportedLocaleCode",
20045
+ "description": "Supported language locale codes",
20046
+ "enum": [
20047
+ "zh-CN",
20048
+ "zh-TW",
20049
+ "cs-CZ",
20050
+ "da-DK",
20051
+ "nl-NL",
20052
+ "en-US",
20053
+ "en-GB",
20054
+ "et-EE",
20055
+ "fi-FI",
20056
+ "fr-FR",
20057
+ "de-DE",
20058
+ "hu-HU",
20059
+ "is-IS",
20060
+ "it-IT",
20061
+ "ja-JP",
20062
+ "no-NO",
20063
+ "pl-PL",
20064
+ "pt-BR",
20065
+ "pt-PT",
20066
+ "ro-RO",
20067
+ "ru-RU",
20068
+ "sk-SK",
20069
+ "tr-TR",
20070
+ "es-ES",
20071
+ "sv-SE"
20072
+ ]
20073
+ },
20074
+ "TranslationsSchema": {
20075
+ "type": "object",
20076
+ "title": "TranslationsSchema",
20077
+ "required": [
20078
+ "resources",
20079
+ "fallback"
20080
+ ],
20081
+ "additionalProperties": false,
20082
+ "properties": {
20083
+ "resources": {
20084
+ "type": "array",
20085
+ "minItems": 1,
20086
+ "uniqueItems": true,
20087
+ "title": "TranslationsResources",
20088
+ "items": {
20089
+ "type": "object",
20090
+ "additionalProperties": false,
20091
+ "required": [
20092
+ "key",
20093
+ "path"
20094
+ ],
20095
+ "properties": {
20096
+ "key": {
20097
+ "description": "Language locale code",
20098
+ "type": "string",
20099
+ "$ref": "#/definitions/ForgeSupportedLocaleCode"
20100
+ },
20101
+ "path": {
20102
+ "description": "Path to locale file",
20103
+ "type": "string"
20104
+ }
20105
+ }
20106
+ }
20107
+ },
20108
+ "fallback": {
20109
+ "type": "object",
20110
+ "title": "TranslationsFallback",
20111
+ "tsType": "{\n [key in ForgeSupportedLocaleCode]?: ForgeSupportedLocaleCode[];\n} & {\n default: ForgeSupportedLocaleCode;\n};",
20112
+ "required": [
20113
+ "default"
20114
+ ],
20115
+ "additionalProperties": false,
20116
+ "propertyNames": {
20117
+ "anyOf": [
20118
+ {
20119
+ "$ref": "#/definitions/ForgeSupportedLocaleCode"
20120
+ },
20121
+ {
20122
+ "enum": [
20123
+ "default"
20124
+ ]
20125
+ }
20126
+ ]
20127
+ },
20128
+ "patternProperties": {
20129
+ "default": {
20130
+ "description": "Default fallback language",
20131
+ "type": "string",
20132
+ "$ref": "#/definitions/ForgeSupportedLocaleCode"
20133
+ },
20134
+ "^[a-z]{2}-[A-Z]{2}$": {
20135
+ "title": "FallbackLanguages",
20136
+ "description": "Fallback languages",
20137
+ "type": "array",
20138
+ "minItems": 1,
20139
+ "uniqueItems": true,
20140
+ "items": {
20141
+ "type": "string",
20142
+ "$ref": "#/definitions/ForgeSupportedLocaleCode"
20143
+ }
20144
+ }
20145
+ }
20146
+ }
20147
+ }
20148
+ },
19988
20149
  "ProvidersSchema": {
19989
20150
  "type": "object",
19990
20151
  "additionalProperties": false,
@@ -22397,6 +22558,10 @@
22397
22558
  "environment": {
22398
22559
  "$ref": "#/definitions/EnvironmentSchema",
22399
22560
  "title": "environment"
22561
+ },
22562
+ "translations": {
22563
+ "$ref": "#/definitions/TranslationsSchema",
22564
+ "title": "translations"
22400
22565
  }
22401
22566
  },
22402
22567
  "required": [
@@ -98,6 +98,10 @@ export type Handler = string;
98
98
  * Whether this function is used for GDPR cleanup (default false). If set to true, this function has a higher rate limit for ESS list queries.
99
99
  */
100
100
  export type Cleanup = boolean;
101
+ /**
102
+ * The maximum amount of time the function is allowed to run, in seconds. Must be between 1 and 900.
103
+ */
104
+ export type TimeoutSeconds = number;
101
105
  /**
102
106
  * Name of the key of the function that will handle this action.
103
107
  */
@@ -440,6 +444,56 @@ export type Auth = (AuthProviderCustom | AuthProviderPredefined)[];
440
444
  * Manifest environment variables
441
445
  */
442
446
  export type Variables = string[];
447
+ export type TranslationsResources = [
448
+ {
449
+ key: ForgeSupportedLocaleCode;
450
+ /**
451
+ * Path to locale file
452
+ */
453
+ path: string;
454
+ },
455
+ ...{
456
+ key: ForgeSupportedLocaleCode;
457
+ /**
458
+ * Path to locale file
459
+ */
460
+ path: string;
461
+ }[]
462
+ ];
463
+ /**
464
+ * Language locale code
465
+ */
466
+ export type ForgeSupportedLocaleCode =
467
+ | 'zh-CN'
468
+ | 'zh-TW'
469
+ | 'cs-CZ'
470
+ | 'da-DK'
471
+ | 'nl-NL'
472
+ | 'en-US'
473
+ | 'en-GB'
474
+ | 'et-EE'
475
+ | 'fi-FI'
476
+ | 'fr-FR'
477
+ | 'de-DE'
478
+ | 'hu-HU'
479
+ | 'is-IS'
480
+ | 'it-IT'
481
+ | 'ja-JP'
482
+ | 'no-NO'
483
+ | 'pl-PL'
484
+ | 'pt-BR'
485
+ | 'pt-PT'
486
+ | 'ro-RO'
487
+ | 'ru-RU'
488
+ | 'sk-SK'
489
+ | 'tr-TR'
490
+ | 'es-ES'
491
+ | 'sv-SE';
492
+ export type TranslationsFallback = {
493
+ [key in ForgeSupportedLocaleCode]?: ForgeSupportedLocaleCode[];
494
+ } & {
495
+ default: ForgeSupportedLocaleCode;
496
+ };
443
497
 
444
498
  export interface ManifestSchema {
445
499
  app: App;
@@ -450,6 +504,7 @@ export interface ManifestSchema {
450
504
  remotes?: Remotes;
451
505
  providers?: Providers;
452
506
  environment?: Environment;
507
+ translations?: Translations;
453
508
  }
454
509
  export interface App {
455
510
  description?: Description;
@@ -731,6 +786,7 @@ export interface Modules {
731
786
  };
732
787
  };
733
788
  providers?: ExternalAuthFunctionProviders;
789
+ timeoutSeconds?: TimeoutSeconds;
734
790
  key: ModuleKeySchema;
735
791
  [k: string]: unknown;
736
792
  },
@@ -752,6 +808,7 @@ export interface Modules {
752
808
  };
753
809
  };
754
810
  providers?: ExternalAuthFunctionProviders;
811
+ timeoutSeconds?: TimeoutSeconds;
755
812
  key: ModuleKeySchema;
756
813
  [k: string]: unknown;
757
814
  }[]
@@ -2633,14 +2690,17 @@ export interface Modules {
2633
2690
  };
2634
2691
  edit?:
2635
2692
  | {
2693
+ function: string;
2694
+ [k: string]: unknown;
2695
+ }
2696
+ | ({
2636
2697
  resource: string;
2637
2698
  render?: 'default' | 'native';
2638
2699
  [k: string]: unknown;
2639
- }
2640
- | {
2641
- function: string;
2700
+ } & {
2701
+ isInline?: boolean;
2642
2702
  [k: string]: unknown;
2643
- };
2703
+ });
2644
2704
  value?: {
2645
2705
  function: string;
2646
2706
  [k: string]: unknown;
@@ -2695,14 +2755,17 @@ export interface Modules {
2695
2755
  };
2696
2756
  edit?:
2697
2757
  | {
2758
+ function: string;
2759
+ [k: string]: unknown;
2760
+ }
2761
+ | ({
2698
2762
  resource: string;
2699
2763
  render?: 'default' | 'native';
2700
2764
  [k: string]: unknown;
2701
- }
2702
- | {
2703
- function: string;
2765
+ } & {
2766
+ isInline?: boolean;
2704
2767
  [k: string]: unknown;
2705
- };
2768
+ });
2706
2769
  value?: {
2707
2770
  function: string;
2708
2771
  [k: string]: unknown;
@@ -2756,14 +2819,17 @@ export interface Modules {
2756
2819
  };
2757
2820
  edit?:
2758
2821
  | {
2822
+ function: string;
2823
+ [k: string]: unknown;
2824
+ }
2825
+ | ({
2759
2826
  resource: string;
2760
2827
  render?: 'default' | 'native';
2761
2828
  [k: string]: unknown;
2762
- }
2763
- | {
2764
- function: string;
2829
+ } & {
2830
+ isInline?: boolean;
2765
2831
  [k: string]: unknown;
2766
- };
2832
+ });
2767
2833
  value?: {
2768
2834
  function: string;
2769
2835
  [k: string]: unknown;
@@ -2818,14 +2884,17 @@ export interface Modules {
2818
2884
  };
2819
2885
  edit?:
2820
2886
  | {
2887
+ function: string;
2888
+ [k: string]: unknown;
2889
+ }
2890
+ | ({
2821
2891
  resource: string;
2822
2892
  render?: 'default' | 'native';
2823
2893
  [k: string]: unknown;
2824
- }
2825
- | {
2826
- function: string;
2894
+ } & {
2895
+ isInline?: boolean;
2827
2896
  [k: string]: unknown;
2828
- };
2897
+ });
2829
2898
  value?: {
2830
2899
  function: string;
2831
2900
  [k: string]: unknown;
@@ -2874,14 +2943,17 @@ export interface Modules {
2874
2943
  readOnly?: boolean;
2875
2944
  edit?:
2876
2945
  | {
2946
+ function: string;
2947
+ [k: string]: unknown;
2948
+ }
2949
+ | ({
2877
2950
  resource: string;
2878
2951
  render?: 'default' | 'native';
2879
2952
  [k: string]: unknown;
2880
- }
2881
- | {
2882
- function: string;
2953
+ } & {
2954
+ isInline?: boolean;
2883
2955
  [k: string]: unknown;
2884
- };
2956
+ });
2885
2957
  value?: {
2886
2958
  function: string;
2887
2959
  [k: string]: unknown;
@@ -2949,14 +3021,17 @@ export interface Modules {
2949
3021
  readOnly?: boolean;
2950
3022
  edit?:
2951
3023
  | {
3024
+ function: string;
3025
+ [k: string]: unknown;
3026
+ }
3027
+ | ({
2952
3028
  resource: string;
2953
3029
  render?: 'default' | 'native';
2954
3030
  [k: string]: unknown;
2955
- }
2956
- | {
2957
- function: string;
3031
+ } & {
3032
+ isInline?: boolean;
2958
3033
  [k: string]: unknown;
2959
- };
3034
+ });
2960
3035
  value?: {
2961
3036
  function: string;
2962
3037
  [k: string]: unknown;
@@ -3023,14 +3098,17 @@ export interface Modules {
3023
3098
  readOnly?: boolean;
3024
3099
  edit?:
3025
3100
  | {
3101
+ function: string;
3102
+ [k: string]: unknown;
3103
+ }
3104
+ | ({
3026
3105
  resource: string;
3027
3106
  render?: 'default' | 'native';
3028
3107
  [k: string]: unknown;
3029
- }
3030
- | {
3031
- function: string;
3108
+ } & {
3109
+ isInline?: boolean;
3032
3110
  [k: string]: unknown;
3033
- };
3111
+ });
3034
3112
  value?: {
3035
3113
  function: string;
3036
3114
  [k: string]: unknown;
@@ -3098,14 +3176,17 @@ export interface Modules {
3098
3176
  readOnly?: boolean;
3099
3177
  edit?:
3100
3178
  | {
3179
+ function: string;
3180
+ [k: string]: unknown;
3181
+ }
3182
+ | ({
3101
3183
  resource: string;
3102
3184
  render?: 'default' | 'native';
3103
3185
  [k: string]: unknown;
3104
- }
3105
- | {
3106
- function: string;
3186
+ } & {
3187
+ isInline?: boolean;
3107
3188
  [k: string]: unknown;
3108
- };
3189
+ });
3109
3190
  value?: {
3110
3191
  function: string;
3111
3192
  [k: string]: unknown;
@@ -57927,3 +58008,7 @@ export interface AuthProviderPredefined {
57927
58008
  export interface Environment {
57928
58009
  variables?: Variables;
57929
58010
  }
58011
+ export interface Translations {
58012
+ resources: TranslationsResources;
58013
+ fallback: TranslationsFallback;
58014
+ }
@@ -159,6 +159,15 @@ export declare const errors: {
159
159
  };
160
160
  };
161
161
  };
162
+ translations: {
163
+ missingTranslationsJsonFile: (languageLocaleCode: string) => string;
164
+ duplicateFallbackConfig: (languageLocaleCode: string) => string;
165
+ invalidLanguageFile: (languageLocaleCode: string, path: string) => string;
166
+ duplicateResourceKey: (languageLocaleCode: string) => string;
167
+ i18nKeyNotFound: (keyName: string) => string;
168
+ missingTranslationsPropertyError: string;
169
+ internalI18nPropertyKeyFound: (propertyKey: string, moduleKey: string) => string;
170
+ };
162
171
  };
163
172
  export declare enum References {
164
173
  MissingManifest = "manifest-file-required",
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/text/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,eAAO,MAAM,MAAM;8BACS,MAAM,KAAG,MAAM;2BACpB,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;;;qCAGhB,MAAM,SAAS,MAAM,KAAG,MAAM;4CAEvB,MAAM,SAAS,MAAM,KAAG,MAAM;oDAEtB,MAAM,OAAO,MAAM,KAAG,MAAM;kDAE9B,MAAM,OAAO,MAAM,KAAG,MAAM;wCAEtC,MAAM,SAAS,MAAM,EAAE,KAAG,MAAM;;;uCAMjC,MAAM,KAAG,MAAM;oCACpB,MAAM;iCAEP,MAAM,KAAG,MAAM;4CACJ,MAAM,KAAG,MAAM;;;gCAG3B,MAAM,KAAG,MAAM;6BACpB,MAAM;+BACJ,MAAM;iCACF,MAAM,KAAG,MAAM;yCACP,MAAM,eAAe,MAAM,KAAG,MAAM;yCAEpC,MAAM,eAAe,MAAM,KAAG,MAAM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S,4BAA4B;IACrC,UAAU,wBAAwB;IAClC,GAAG,8BAA8B;IACjC,eAAe,0BAA0B;CAC1C"}
@@ -171,6 +171,15 @@ exports.errors = {
171
171
  missing: (glob) => `Extra files specification '${glob}' does not match any files.`
172
172
  }
173
173
  }
174
+ },
175
+ translations: {
176
+ missingTranslationsJsonFile: (languageLocaleCode) => `There is no available translations JSON file for the specified fallback language: '${languageLocaleCode}'`,
177
+ duplicateFallbackConfig: (languageLocaleCode) => `Duplicated fallback configuration found for: '${languageLocaleCode}'`,
178
+ invalidLanguageFile: (languageLocaleCode, path) => `An error occurred while reading JSON file for '${languageLocaleCode}' at the specified path: ${path}`,
179
+ duplicateResourceKey: (languageLocaleCode) => `Duplicate translations resource key found: '${languageLocaleCode}'`,
180
+ i18nKeyNotFound: (keyName) => `i18n key '${keyName}' could not be found in default locale file.`,
181
+ missingTranslationsPropertyError: 'i18n key(s) found but translations property is missing in manifest file',
182
+ internalI18nPropertyKeyFound: (propertyKey, moduleKey) => `Unexpected property key '${propertyKey}' found in '${moduleKey}' module`
174
183
  }
175
184
  };
176
185
  var References;
@@ -3,4 +3,6 @@ export * from './line-finder';
3
3
  export * from './module-key-cleaner';
4
4
  export * from './module-references';
5
5
  export * from './manifest-parser';
6
+ export * from './module-i18n-helper';
7
+ export * from './translation-value-getter';
6
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,mBAAmB,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,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
@@ -6,3 +6,5 @@ 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"), exports);
9
+ tslib_1.__exportStar(require("./module-i18n-helper"), exports);
10
+ tslib_1.__exportStar(require("./translation-value-getter"), exports);
@@ -0,0 +1,4 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractInternalI18nPropertyKeysFromModules = exports.extractI18nKeysFromModules = void 0;
4
+ const isObject = (value) => {
5
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
6
+ };
7
+ const isI18nValue = (value) => {
8
+ return typeof value?.i18n === 'string';
9
+ };
10
+ const getI18nKeysFromObject = (obj) => {
11
+ const visited = new Set();
12
+ const visit = (value) => {
13
+ if (!isObject(value) || visited.has(value)) {
14
+ return [];
15
+ }
16
+ visited.add(value);
17
+ return Object.values(value).flatMap((propValue) => {
18
+ if (isI18nValue(propValue)) {
19
+ return [propValue.i18n];
20
+ }
21
+ else if (Array.isArray(propValue)) {
22
+ return propValue.flatMap((item) => visit(item));
23
+ }
24
+ return visit(propValue);
25
+ });
26
+ };
27
+ return visit(obj);
28
+ };
29
+ const INTERNAL_I18N_PROPERTY_KEY_SUFFIX = '__i18n';
30
+ const isInternalI18nPropertyKey = (key) => {
31
+ return key.length > INTERNAL_I18N_PROPERTY_KEY_SUFFIX.length && key.endsWith(INTERNAL_I18N_PROPERTY_KEY_SUFFIX);
32
+ };
33
+ const isI18nProperty = (key, value) => {
34
+ return isInternalI18nPropertyKey(key) && typeof value === 'string';
35
+ };
36
+ const getInternalI18nPropertyKeysFromObject = (obj) => {
37
+ const visited = new Set();
38
+ const visit = (value) => {
39
+ if (!isObject(value) || visited.has(value)) {
40
+ return [];
41
+ }
42
+ visited.add(value);
43
+ return Object.entries(value).flatMap(([propKey, propValue]) => {
44
+ if (isI18nProperty(propKey, propValue)) {
45
+ return [propKey];
46
+ }
47
+ else if (Array.isArray(propValue)) {
48
+ return propValue.flatMap((item) => visit(item));
49
+ }
50
+ return visit(propValue);
51
+ });
52
+ };
53
+ return visit(obj);
54
+ };
55
+ const getAllModuleEntries = (modules) => {
56
+ return Object.entries(modules).flatMap(([moduleKey, moduleEntries]) => {
57
+ if (moduleEntries && Array.isArray(moduleEntries) && moduleEntries.length > 0) {
58
+ return moduleEntries.map((moduleEntry) => [moduleEntry, moduleKey]);
59
+ }
60
+ return [];
61
+ });
62
+ };
63
+ const extractI18nKeysFromModules = (modules) => {
64
+ const i18nKeys = new Set();
65
+ for (const moduleEntry of getAllModuleEntries(modules)) {
66
+ const i18nKeysForEntryValue = getI18nKeysFromObject(moduleEntry[0]);
67
+ for (const key of i18nKeysForEntryValue) {
68
+ i18nKeys.add(key);
69
+ }
70
+ }
71
+ return i18nKeys.size > 0 ? Array.from(i18nKeys) : [];
72
+ };
73
+ exports.extractI18nKeysFromModules = extractI18nKeysFromModules;
74
+ const extractInternalI18nPropertyKeysFromModules = (modules) => {
75
+ const i18nKeys = new Set();
76
+ for (const [moduleEntryObject, moduleKey] of getAllModuleEntries(modules)) {
77
+ const i18nKeysForEntryValue = getInternalI18nPropertyKeysFromObject(moduleEntryObject);
78
+ for (const key of i18nKeysForEntryValue) {
79
+ i18nKeys.add(`${key},${moduleKey}`);
80
+ }
81
+ }
82
+ return i18nKeys.size > 0 ? Array.from(i18nKeys).map((key) => key.split(',')) : [];
83
+ };
84
+ exports.extractInternalI18nPropertyKeysFromModules = extractInternalI18nPropertyKeysFromModules;
@@ -0,0 +1,10 @@
1
+ import { type ForgeSupportedLocaleCode } from '../schema/manifest';
2
+ interface TranslationContent {
3
+ [key: string]: string | TranslationContent;
4
+ }
5
+ declare type TranslationContentByLocaleCode = {
6
+ [key in ForgeSupportedLocaleCode]?: TranslationContent;
7
+ };
8
+ export declare const getTranslationValue: (translationLookup: TranslationContentByLocaleCode, i18nKey: string, locale: ForgeSupportedLocaleCode) => string | null;
9
+ export {};
10
+ //# sourceMappingURL=translation-value-getter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTranslationValue = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const get_1 = tslib_1.__importDefault(require("lodash/get"));
6
+ const getTranslationValue = (translationLookup, i18nKey, locale) => {
7
+ const translation = translationLookup[locale];
8
+ if (!translation) {
9
+ return null;
10
+ }
11
+ let translationValue = translation[i18nKey];
12
+ if (!translationValue) {
13
+ const keyTokens = i18nKey.split('.');
14
+ if (keyTokens.length > 1) {
15
+ translationValue = (0, get_1.default)(translation, keyTokens, null);
16
+ }
17
+ }
18
+ return typeof translationValue === 'string' ? translationValue : null;
19
+ };
20
+ exports.getTranslationValue = getTranslationValue;
@@ -14,4 +14,5 @@ export * from './connect-authentication-validator';
14
14
  export * from './entity-property-validator';
15
15
  export * from './snapshot-validator';
16
16
  export * from './package-validator';
17
+ export * from './translations-validator';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -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,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,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,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}
@@ -17,3 +17,4 @@ tslib_1.__exportStar(require("./connect-authentication-validator"), exports);
17
17
  tslib_1.__exportStar(require("./entity-property-validator"), exports);
18
18
  tslib_1.__exportStar(require("./snapshot-validator"), exports);
19
19
  tslib_1.__exportStar(require("./package-validator"), exports);
20
+ tslib_1.__exportStar(require("./translations-validator"), exports);
@@ -0,0 +1,13 @@
1
+ import { type ManifestSchema } from '../schema/manifest';
2
+ import { ManifestObject, ManifestValidationResult } from '../types';
3
+ import { ValidatorInterface } from './validator-interface';
4
+ export declare class TranslationsValidator implements ValidatorInterface<ManifestObject<ManifestSchema> | undefined, ManifestSchema> {
5
+ private ensureValidResourcesDefinition;
6
+ private ensureValidFallbackDefinition;
7
+ private ensureI18nKeysExistInDefaultJson;
8
+ private validateManifestWithoutI18nConfig;
9
+ private validateManifestI18nConfig;
10
+ private validateInternalI18nPropertyKeysNotInModules;
11
+ validate(manifest: ManifestObject<ManifestSchema> | undefined): Promise<ManifestValidationResult<ManifestSchema>>;
12
+ }
13
+ //# sourceMappingURL=translations-validator.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslationsValidator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs_1 = tslib_1.__importDefault(require("fs"));
6
+ const path_1 = require("path");
7
+ const text_1 = require("../text");
8
+ const text_2 = require("../text");
9
+ const utils_1 = require("../utils");
10
+ class TranslationsValidator {
11
+ ensureValidResourcesDefinition(validationErrors, manifest) {
12
+ const { resources, fallback } = manifest.yamlContent.translations;
13
+ const resourcesMap = new Map();
14
+ resources.forEach(({ key, path }) => {
15
+ if (resourcesMap.has(key)) {
16
+ validationErrors.push({
17
+ message: text_1.errors.translations.duplicateResourceKey(key),
18
+ reference: text_2.References.SchemaError,
19
+ level: 'error',
20
+ ...(0, utils_1.findPosition)(`key: ${key}`, manifest.yamlContentByLine)
21
+ });
22
+ }
23
+ else {
24
+ resourcesMap.set(key, path);
25
+ }
26
+ });
27
+ let defaultLanguageLookup = {};
28
+ resourcesMap.forEach((path, key) => {
29
+ const resourcePath = (0, path_1.resolve)(path);
30
+ try {
31
+ if (fs_1.default.lstatSync(resourcePath).isFile()) {
32
+ const data = JSON.parse(fs_1.default.readFileSync((0, path_1.resolve)(path), 'utf8'));
33
+ if (fallback?.default === key) {
34
+ defaultLanguageLookup = data;
35
+ }
36
+ }
37
+ }
38
+ catch (e) {
39
+ validationErrors.push({
40
+ message: text_1.errors.translations.invalidLanguageFile(key, path),
41
+ reference: text_2.References.SchemaError,
42
+ level: 'error',
43
+ ...(0, utils_1.findPosition)(`path: ${path}`, manifest?.yamlContentByLine)
44
+ });
45
+ }
46
+ });
47
+ return defaultLanguageLookup;
48
+ }
49
+ ensureValidFallbackDefinition(validationErrors, manifest) {
50
+ const { resources, fallback } = manifest.yamlContent.translations;
51
+ const defaultLanguage = fallback.default;
52
+ const resourcesSet = new Set(resources.map((resource) => resource.key));
53
+ const fallbackLanguages = Object.keys(fallback).filter((fallbackLanguage) => fallbackLanguage !== 'default');
54
+ const allFallbackLanguagesSet = new Set([defaultLanguage, ...fallbackLanguages]);
55
+ allFallbackLanguagesSet.forEach((fallbackLanguage) => {
56
+ if (!resourcesSet.has(fallbackLanguage)) {
57
+ validationErrors.push({
58
+ message: text_1.errors.translations.missingTranslationsJsonFile(fallbackLanguage),
59
+ reference: text_2.References.SchemaError,
60
+ level: 'error',
61
+ ...(0, utils_1.findPosition)(fallbackLanguage === defaultLanguage ? `default: ${fallbackLanguage}` : `${fallbackLanguage}:`, manifest.yamlContentByLine)
62
+ });
63
+ }
64
+ });
65
+ const allLanguagesList = [
66
+ defaultLanguage,
67
+ ...fallbackLanguages,
68
+ ...fallbackLanguages.flatMap((language) => fallback[language])
69
+ ];
70
+ const [, duplicates] = allLanguagesList.reduce(([languageSet, duplicates], language) => {
71
+ languageSet.has(language) ? duplicates.add(language) : languageSet.add(language);
72
+ return [languageSet, duplicates];
73
+ }, [new Set(), new Set()]);
74
+ duplicates.forEach((duplicate) => {
75
+ validationErrors.push({
76
+ message: text_1.errors.translations.duplicateFallbackConfig(duplicate),
77
+ reference: text_2.References.SchemaError,
78
+ level: 'error',
79
+ ...(0, utils_1.findPosition)(duplicate, manifest.yamlContentByLine)
80
+ });
81
+ });
82
+ }
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);
89
+ if (!i18nValue) {
90
+ validationErrors.push({
91
+ message: text_1.errors.translations.i18nKeyNotFound(key),
92
+ reference: text_2.References.SchemaError,
93
+ level: 'error',
94
+ ...(0, utils_1.findPosition)(`i18n: ${key}`, manifest.yamlContentByLine)
95
+ });
96
+ }
97
+ });
98
+ }
99
+ validateManifestWithoutI18nConfig(manifest, i18nKeys) {
100
+ if (i18nKeys.length === 0) {
101
+ return {
102
+ success: true,
103
+ manifestObject: manifest
104
+ };
105
+ }
106
+ const missingTranslationsPropertyError = [
107
+ {
108
+ message: text_1.errors.translations.missingTranslationsPropertyError,
109
+ reference: text_2.References.SchemaError,
110
+ level: 'error',
111
+ ...(0, utils_1.findPosition)('i18n', manifest?.yamlContentByLine)
112
+ }
113
+ ];
114
+ return {
115
+ success: false,
116
+ manifestObject: manifest,
117
+ errors: missingTranslationsPropertyError
118
+ };
119
+ }
120
+ validateManifestI18nConfig(manifest, i18nKeys) {
121
+ const validationErrors = [];
122
+ const defaultLanguageLookup = this.ensureValidResourcesDefinition(validationErrors, manifest);
123
+ this.ensureValidFallbackDefinition(validationErrors, manifest);
124
+ this.ensureI18nKeysExistInDefaultJson(validationErrors, i18nKeys, defaultLanguageLookup, manifest);
125
+ return validationErrors;
126
+ }
127
+ validateInternalI18nPropertyKeysNotInModules(manifest) {
128
+ const modules = manifest?.typedContent?.modules ?? {};
129
+ const internalI18nPropertyKeys = (0, utils_1.extractInternalI18nPropertyKeysFromModules)(modules);
130
+ return internalI18nPropertyKeys.map(([propertyKey, moduleKey]) => ({
131
+ message: text_1.errors.translations.internalI18nPropertyKeyFound(propertyKey, moduleKey),
132
+ reference: text_2.References.SchemaError,
133
+ level: 'error',
134
+ ...(0, utils_1.findPosition)(propertyKey, manifest.yamlContentByLine, moduleKey)
135
+ }));
136
+ }
137
+ async validate(manifest) {
138
+ if (!manifest || !manifest.typedContent || !manifest.filePath) {
139
+ return {
140
+ success: false,
141
+ manifestObject: manifest
142
+ };
143
+ }
144
+ const i18nKeys = (0, utils_1.extractI18nKeysFromModules)(manifest?.typedContent?.modules ?? {});
145
+ const i18nConfig = manifest?.yamlContent?.translations;
146
+ if (!i18nConfig) {
147
+ return this.validateManifestWithoutI18nConfig(manifest, i18nKeys);
148
+ }
149
+ const validationErrors = [
150
+ ...this.validateManifestI18nConfig(manifest, i18nKeys),
151
+ ...this.validateInternalI18nPropertyKeysNotInModules(manifest)
152
+ ];
153
+ return {
154
+ success: validationErrors.length === 0,
155
+ manifestObject: manifest,
156
+ errors: validationErrors
157
+ };
158
+ }
159
+ }
160
+ exports.TranslationsValidator = TranslationsValidator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/manifest",
3
- "version": "7.6.0",
3
+ "version": "7.6.1-next.1",
4
4
  "description": "Definitions and validations of the Forge manifest",
5
5
  "main": "out/index.js",
6
6
  "scripts": {