@uniformdev/tms-sdk 20.59.1-alpha.1 → 20.59.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/dist/index.d.mts CHANGED
@@ -29,20 +29,13 @@ type EntityTranslationResult<TResult = unknown> = {
29
29
  errorText?: string;
30
30
  };
31
31
  type MaybePromise<T> = T | Promise<T> | PromiseLike<T>;
32
- type CollectTranslationConfig = {
33
- /**
34
- * By default, if target locale value exists and different from source locale value, it will be skipped for translation.
35
- * If `true`, target locale value mismatch will be ignored.
36
- */
37
- ignoreTargetLocaleValueMismatch?: boolean;
38
- };
39
32
 
40
33
  type CollectTranslationPayloadResult = {
41
34
  payload?: TranslationPayload;
42
35
  errorKind?: 'unknown' | 'invalid-args' | 'entity-source-locale-missing';
43
36
  errorText?: string;
44
37
  };
45
- declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, config, }: {
38
+ declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, }: {
46
39
  uniformProjectId: string;
47
40
  uniformSourceLocale: string;
48
41
  uniformTargetLocale: string;
@@ -50,7 +43,6 @@ declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocal
50
43
  targetLang: string;
51
44
  entity: RootComponentInstance | EntryData;
52
45
  entityType: EntityType;
53
- config?: CollectTranslationConfig;
54
46
  }) => CollectTranslationPayloadResult;
55
47
 
56
48
  declare const getCompositionForTranslation: ({ canvasClient, compositionId, releaseId, state, }: {
@@ -126,4 +118,4 @@ declare const translateEntry: ({ entry, translationPayload, }: {
126
118
  translationPayload: TranslationPayload;
127
119
  }) => EntityTranslationResult<Entry>;
128
120
 
129
- export { type CollectTranslationConfig, type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
121
+ export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
package/dist/index.d.ts CHANGED
@@ -29,20 +29,13 @@ type EntityTranslationResult<TResult = unknown> = {
29
29
  errorText?: string;
30
30
  };
31
31
  type MaybePromise<T> = T | Promise<T> | PromiseLike<T>;
32
- type CollectTranslationConfig = {
33
- /**
34
- * By default, if target locale value exists and different from source locale value, it will be skipped for translation.
35
- * If `true`, target locale value mismatch will be ignored.
36
- */
37
- ignoreTargetLocaleValueMismatch?: boolean;
38
- };
39
32
 
40
33
  type CollectTranslationPayloadResult = {
41
34
  payload?: TranslationPayload;
42
35
  errorKind?: 'unknown' | 'invalid-args' | 'entity-source-locale-missing';
43
36
  errorText?: string;
44
37
  };
45
- declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, config, }: {
38
+ declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocale, uniformTargetLocale, uniformReleaseId, targetLang, entity, entityType, }: {
46
39
  uniformProjectId: string;
47
40
  uniformSourceLocale: string;
48
41
  uniformTargetLocale: string;
@@ -50,7 +43,6 @@ declare const collectTranslationPayload: ({ uniformProjectId, uniformSourceLocal
50
43
  targetLang: string;
51
44
  entity: RootComponentInstance | EntryData;
52
45
  entityType: EntityType;
53
- config?: CollectTranslationConfig;
54
46
  }) => CollectTranslationPayloadResult;
55
47
 
56
48
  declare const getCompositionForTranslation: ({ canvasClient, compositionId, releaseId, state, }: {
@@ -126,4 +118,4 @@ declare const translateEntry: ({ entry, translationPayload, }: {
126
118
  translationPayload: TranslationPayload;
127
119
  }) => EntityTranslationResult<Entry>;
128
120
 
129
- export { type CollectTranslationConfig, type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
121
+ export { type CollectTranslationPayloadResult, type ComponentTranslationPayload, type EntityTranslationResult, type EntityType, type MaybePromise, type MergeCompositionTranslationToUniformOptions, type MergeEntryTranslationToUniformOptions, type MergeTranslationToUniformOptions, type TranslationPayload, collectTranslationPayload, getCompositionForTranslation, getEntryForTranslation, mergeCompositionTranslationToUniform, mergeEntryTranslationToUniform, mergeTranslationToUniform, translateComposition, translateEntry };
package/dist/index.esm.js CHANGED
@@ -309,7 +309,7 @@ var processParameterTranslation = ({
309
309
  left: originalParameterSource,
310
310
  right: sourceValue
311
311
  });
312
- const isTargetValueUntouched = originalTargetValue === void 0 ? true : isSameParameterValue({
312
+ const isTargetValueUntouched = isSameParameterValue({
313
313
  parameterType: originalParameter.type,
314
314
  left: (_d = originalParameter.locales) == null ? void 0 : _d[uniformTargetLocale],
315
315
  right: originalTargetValue
@@ -453,8 +453,7 @@ var collectTranslationPayload = ({
453
453
  uniformReleaseId,
454
454
  targetLang,
455
455
  entity,
456
- entityType,
457
- config = {}
456
+ entityType
458
457
  }) => {
459
458
  if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
460
459
  return createErrorResult2("invalid-args");
@@ -487,8 +486,7 @@ var collectTranslationPayload = ({
487
486
  uniformSourceLocale,
488
487
  uniformTargetLocale,
489
488
  node,
490
- deep: false,
491
- config
489
+ deep: false
492
490
  });
493
491
  if (parameters || _overrides) {
494
492
  payload.components[node._id] = {
@@ -505,8 +503,7 @@ var collectFromNode = ({
505
503
  uniformSourceLocale,
506
504
  uniformTargetLocale,
507
505
  node,
508
- deep,
509
- config
506
+ deep
510
507
  }) => {
511
508
  var _a, _b, _c;
512
509
  const collectedParameters = {};
@@ -521,7 +518,7 @@ var collectFromNode = ({
521
518
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
522
519
  return;
523
520
  }
524
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
521
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
525
522
  return;
526
523
  }
527
524
  collectedParameters[paramKey] = {
@@ -529,7 +526,7 @@ var collectFromNode = ({
529
526
  locales: {
530
527
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
531
528
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
532
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
529
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
533
530
  }
534
531
  };
535
532
  });
@@ -544,8 +541,7 @@ var collectFromNode = ({
544
541
  uniformSourceLocale,
545
542
  uniformTargetLocale,
546
543
  node: slotComponent,
547
- deep: true,
548
- config
544
+ deep: true
549
545
  });
550
546
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
551
547
  if (hasContent) {
@@ -564,7 +560,7 @@ var collectFromNode = ({
564
560
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
565
561
  return;
566
562
  }
567
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
563
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
568
564
  return;
569
565
  }
570
566
  (_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
@@ -574,7 +570,7 @@ var collectFromNode = ({
574
570
  locales: {
575
571
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
576
572
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
577
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
573
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
578
574
  }
579
575
  };
580
576
  });
@@ -590,8 +586,7 @@ var collectFromNode = ({
590
586
  node: slotComponent,
591
587
  // keep tree structure for `Slot Sections`
592
588
  // to store whole `override` content in scope of current component
593
- deep: true,
594
- config
589
+ deep: true
595
590
  });
596
591
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
597
592
  if (hasContent) {
package/dist/index.js CHANGED
@@ -337,7 +337,7 @@ var processParameterTranslation = ({
337
337
  left: originalParameterSource,
338
338
  right: sourceValue
339
339
  });
340
- const isTargetValueUntouched = originalTargetValue === void 0 ? true : isSameParameterValue({
340
+ const isTargetValueUntouched = isSameParameterValue({
341
341
  parameterType: originalParameter.type,
342
342
  left: (_d = originalParameter.locales) == null ? void 0 : _d[uniformTargetLocale],
343
343
  right: originalTargetValue
@@ -481,8 +481,7 @@ var collectTranslationPayload = ({
481
481
  uniformReleaseId,
482
482
  targetLang,
483
483
  entity,
484
- entityType,
485
- config = {}
484
+ entityType
486
485
  }) => {
487
486
  if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
488
487
  return createErrorResult2("invalid-args");
@@ -515,8 +514,7 @@ var collectTranslationPayload = ({
515
514
  uniformSourceLocale,
516
515
  uniformTargetLocale,
517
516
  node,
518
- deep: false,
519
- config
517
+ deep: false
520
518
  });
521
519
  if (parameters || _overrides) {
522
520
  payload.components[node._id] = {
@@ -533,8 +531,7 @@ var collectFromNode = ({
533
531
  uniformSourceLocale,
534
532
  uniformTargetLocale,
535
533
  node,
536
- deep,
537
- config
534
+ deep
538
535
  }) => {
539
536
  var _a, _b, _c;
540
537
  const collectedParameters = {};
@@ -549,7 +546,7 @@ var collectFromNode = ({
549
546
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
550
547
  return;
551
548
  }
552
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
549
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
553
550
  return;
554
551
  }
555
552
  collectedParameters[paramKey] = {
@@ -557,7 +554,7 @@ var collectFromNode = ({
557
554
  locales: {
558
555
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
559
556
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
560
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
557
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
561
558
  }
562
559
  };
563
560
  });
@@ -572,8 +569,7 @@ var collectFromNode = ({
572
569
  uniformSourceLocale,
573
570
  uniformTargetLocale,
574
571
  node: slotComponent,
575
- deep: true,
576
- config
572
+ deep: true
577
573
  });
578
574
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
579
575
  if (hasContent) {
@@ -592,7 +588,7 @@ var collectFromNode = ({
592
588
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
593
589
  return;
594
590
  }
595
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
591
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
596
592
  return;
597
593
  }
598
594
  (_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
@@ -602,7 +598,7 @@ var collectFromNode = ({
602
598
  locales: {
603
599
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
604
600
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
605
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
601
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
606
602
  }
607
603
  };
608
604
  });
@@ -618,8 +614,7 @@ var collectFromNode = ({
618
614
  node: slotComponent,
619
615
  // keep tree structure for `Slot Sections`
620
616
  // to store whole `override` content in scope of current component
621
- deep: true,
622
- config
617
+ deep: true
623
618
  });
624
619
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
625
620
  if (hasContent) {
package/dist/index.mjs CHANGED
@@ -309,7 +309,7 @@ var processParameterTranslation = ({
309
309
  left: originalParameterSource,
310
310
  right: sourceValue
311
311
  });
312
- const isTargetValueUntouched = originalTargetValue === void 0 ? true : isSameParameterValue({
312
+ const isTargetValueUntouched = isSameParameterValue({
313
313
  parameterType: originalParameter.type,
314
314
  left: (_d = originalParameter.locales) == null ? void 0 : _d[uniformTargetLocale],
315
315
  right: originalTargetValue
@@ -453,8 +453,7 @@ var collectTranslationPayload = ({
453
453
  uniformReleaseId,
454
454
  targetLang,
455
455
  entity,
456
- entityType,
457
- config = {}
456
+ entityType
458
457
  }) => {
459
458
  if (!uniformSourceLocale || !uniformTargetLocale || !targetLang || !entity) {
460
459
  return createErrorResult2("invalid-args");
@@ -487,8 +486,7 @@ var collectTranslationPayload = ({
487
486
  uniformSourceLocale,
488
487
  uniformTargetLocale,
489
488
  node,
490
- deep: false,
491
- config
489
+ deep: false
492
490
  });
493
491
  if (parameters || _overrides) {
494
492
  payload.components[node._id] = {
@@ -505,8 +503,7 @@ var collectFromNode = ({
505
503
  uniformSourceLocale,
506
504
  uniformTargetLocale,
507
505
  node,
508
- deep,
509
- config
506
+ deep
510
507
  }) => {
511
508
  var _a, _b, _c;
512
509
  const collectedParameters = {};
@@ -521,7 +518,7 @@ var collectFromNode = ({
521
518
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
522
519
  return;
523
520
  }
524
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
521
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
525
522
  return;
526
523
  }
527
524
  collectedParameters[paramKey] = {
@@ -529,7 +526,7 @@ var collectFromNode = ({
529
526
  locales: {
530
527
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
531
528
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
532
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
529
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
533
530
  }
534
531
  };
535
532
  });
@@ -544,8 +541,7 @@ var collectFromNode = ({
544
541
  uniformSourceLocale,
545
542
  uniformTargetLocale,
546
543
  node: slotComponent,
547
- deep: true,
548
- config
544
+ deep: true
549
545
  });
550
546
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
551
547
  if (hasContent) {
@@ -564,7 +560,7 @@ var collectFromNode = ({
564
560
  if (!canTranslateParameterValue(param, sourceLocaleValue)) {
565
561
  return;
566
562
  }
567
- if (!config.ignoreTargetLocaleValueMismatch && !isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
563
+ if (!isTargetLocaleUntouched(param.type, sourceLocaleValue, targetLocaleValue)) {
568
564
  return;
569
565
  }
570
566
  (_c2 = collectedOverrides[overrideKey]) != null ? _c2 : collectedOverrides[overrideKey] = {};
@@ -574,7 +570,7 @@ var collectFromNode = ({
574
570
  locales: {
575
571
  [TRANSLATION_PAYLOAD_SOURCE_KEY]: sourceLocaleValue,
576
572
  [TRANSLATION_PAYLOAD_TARGET_KEY]: preprocessTargetValue(param, sourceLocaleValue),
577
- [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: !config.ignoreTargetLocaleValueMismatch ? targetLocaleValue : void 0
573
+ [TRANSLATION_PAYLOAD_ORIGINAL_TARGET_KEY]: targetLocaleValue
578
574
  }
579
575
  };
580
576
  });
@@ -590,8 +586,7 @@ var collectFromNode = ({
590
586
  node: slotComponent,
591
587
  // keep tree structure for `Slot Sections`
592
588
  // to store whole `override` content in scope of current component
593
- deep: true,
594
- config
589
+ deep: true
595
590
  });
596
591
  const hasContent = collectedNode.parameters || collectedNode._overrides || collectedNode.slots;
597
592
  if (hasContent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/tms-sdk",
3
- "version": "20.59.1-alpha.1+7025e4ce05",
3
+ "version": "20.59.1",
4
4
  "description": "Uniform Translation Management System SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -33,12 +33,12 @@
33
33
  "access": "public"
34
34
  },
35
35
  "dependencies": {
36
- "@uniformdev/canvas": "20.59.1-alpha.1+7025e4ce05",
37
- "@uniformdev/mesh-sdk": "20.59.1-alpha.1+7025e4ce05",
38
- "@uniformdev/richtext": "20.59.1-alpha.1+7025e4ce05",
36
+ "@uniformdev/canvas": "20.59.1",
37
+ "@uniformdev/mesh-sdk": "20.59.1",
38
+ "@uniformdev/richtext": "20.59.1",
39
39
  "dequal": "2.0.3",
40
40
  "fast-xml-parser": "4.4.1",
41
41
  "immer": "10.1.3"
42
42
  },
43
- "gitHead": "7025e4ce052f67d73c0ee93cbf56104262cf190d"
43
+ "gitHead": "c373fe4a7fa491894a70b5529281db08696e8231"
44
44
  }