@uniformdev/cli 20.24.1-alpha.0 → 20.24.4-alpha.26

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.
Files changed (2) hide show
  1. package/dist/index.mjs +92 -8
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -312,6 +312,7 @@ async function syncEngine({
312
312
  whatIf = false,
313
313
  log: log2 = () => {
314
314
  },
315
+ onBeforeProcessObject,
315
316
  onBeforeCompareObjects,
316
317
  onBeforeWriteObject,
317
318
  onError
@@ -357,6 +358,9 @@ async function syncEngine({
357
358
  let sourceHasItems = false;
358
359
  for await (let sourceObject of source.objects) {
359
360
  sourceHasItems = true;
361
+ if (onBeforeProcessObject) {
362
+ await onBeforeProcessObject(sourceObject);
363
+ }
360
364
  const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
361
365
  const targetObject = targetItems.get(ids[0]);
362
366
  status.compared++;
@@ -2775,6 +2779,34 @@ var ComponentPatternPullModule = {
2775
2779
  )
2776
2780
  };
2777
2781
 
2782
+ // src/commands/canvas/util/localeValidation.ts
2783
+ import { LocaleClient } from "@uniformdev/canvas";
2784
+ async function fetchUniformLocales(options) {
2785
+ const client = new LocaleClient({
2786
+ ...options,
2787
+ bypassCache: true,
2788
+ limitPolicy: cliLimitPolicy
2789
+ });
2790
+ const locales = (await client.get()).results;
2791
+ return new Set(locales.map((locale) => locale.locale));
2792
+ }
2793
+ function validateEntityLocales(entity, uniformLocales, entityName) {
2794
+ if (!entity._locales || entity._locales.length === 0) {
2795
+ return;
2796
+ }
2797
+ const invalidLocales = entity._locales.filter((locale) => !uniformLocales.has(locale));
2798
+ if (invalidLocales.length > 0) {
2799
+ console.warn(
2800
+ `\u26A0\uFE0F ${entityName} enables locale${invalidLocales.length > 1 ? "s" : ""} ${invalidLocales.join(", ")} that are not registered in your Uniform project. This may cause unexpected behavior.`
2801
+ );
2802
+ }
2803
+ }
2804
+ function createLocaleValidationHook(uniformLocales) {
2805
+ return async (entity) => {
2806
+ validateEntityLocales(entity, uniformLocales, entity.displayName);
2807
+ };
2808
+ }
2809
+
2778
2810
  // src/commands/canvas/commands/composition/push.ts
2779
2811
  var CompositionPushModule = componentInstancePushModuleFactory("compositions");
2780
2812
  function componentInstancePushModuleFactory(type) {
@@ -2857,6 +2889,13 @@ function componentInstancePushModuleFactory(type) {
2857
2889
  verbose
2858
2890
  });
2859
2891
  const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
2892
+ const uniformLocales = await fetchUniformLocales({
2893
+ apiKey,
2894
+ apiHost,
2895
+ fetch: fetch2,
2896
+ projectId
2897
+ });
2898
+ const localeValidationHook = createLocaleValidationHook(uniformLocales);
2860
2899
  await syncEngine({
2861
2900
  source,
2862
2901
  target,
@@ -2865,6 +2904,12 @@ function componentInstancePushModuleFactory(type) {
2865
2904
  verbose,
2866
2905
  allowEmptySource,
2867
2906
  log: createSyncEngineConsoleLogger({ diffMode }),
2907
+ onBeforeProcessObject: async (sourceObject) => {
2908
+ await localeValidationHook({
2909
+ _locales: sourceObject.object.composition._locales,
2910
+ displayName: sourceObject.displayName ?? sourceObject.providerId
2911
+ });
2912
+ },
2868
2913
  onBeforeCompareObjects: async (sourceObject) => {
2869
2914
  return replaceLocalUrlsWithRemoteReferences({
2870
2915
  entity: sourceObject,
@@ -4583,6 +4628,13 @@ var EntryPushModule = {
4583
4628
  }
4584
4629
  const target = createEntryEngineDataSource({ client, state, onlyEntries: true });
4585
4630
  const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
4631
+ const uniformLocales = await fetchUniformLocales({
4632
+ apiKey,
4633
+ apiHost,
4634
+ fetch: fetch2,
4635
+ projectId
4636
+ });
4637
+ const localeValidationHook = createLocaleValidationHook(uniformLocales);
4586
4638
  await syncEngine({
4587
4639
  source,
4588
4640
  target,
@@ -4590,6 +4642,12 @@ var EntryPushModule = {
4590
4642
  whatIf,
4591
4643
  allowEmptySource,
4592
4644
  log: createSyncEngineConsoleLogger({ diffMode }),
4645
+ onBeforeProcessObject: async (sourceObject) => {
4646
+ await localeValidationHook({
4647
+ _locales: sourceObject.object.entry._locales,
4648
+ displayName: sourceObject.displayName ?? sourceObject.providerId
4649
+ });
4650
+ },
4593
4651
  onBeforeCompareObjects: async (sourceObject) => {
4594
4652
  return replaceLocalUrlsWithRemoteReferences({
4595
4653
  entity: sourceObject,
@@ -4976,11 +5034,11 @@ var EntryPatternPullModule = {
4976
5034
  const packageContents = readCanvasPackage(directory, false, verbose);
4977
5035
  target = await createArraySyncEngineDataSource({
4978
5036
  name: `Package file ${directory}`,
4979
- objects: packageContents.entries ?? [],
5037
+ objects: packageContents.entryPatterns ?? [],
4980
5038
  selectIdentifier: selectEntryIdentifier,
4981
5039
  selectDisplayName: selectEntryDisplayName,
4982
5040
  onSyncComplete: async (_, synced) => {
4983
- packageContents.entries = synced;
5041
+ packageContents.entryPatterns = synced;
4984
5042
  writeCanvasPackage(directory, packageContents);
4985
5043
  }
4986
5044
  });
@@ -5078,7 +5136,7 @@ var EntryPatternPushModule = {
5078
5136
  const packageContents = readCanvasPackage(directory, true, verbose);
5079
5137
  source = await createArraySyncEngineDataSource({
5080
5138
  name: `Package file ${directory}`,
5081
- objects: packageContents.entries ?? [],
5139
+ objects: packageContents.entryPatterns ?? [],
5082
5140
  selectIdentifier: selectEntryIdentifier,
5083
5141
  selectDisplayName: selectEntryDisplayName
5084
5142
  });
@@ -5092,6 +5150,13 @@ var EntryPatternPushModule = {
5092
5150
  }
5093
5151
  const target = createEntryEngineDataSource({ client, state, onlyPatterns: true });
5094
5152
  const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
5153
+ const uniformLocales = await fetchUniformLocales({
5154
+ apiKey,
5155
+ apiHost,
5156
+ fetch: fetch2,
5157
+ projectId
5158
+ });
5159
+ const localeValidationHook = createLocaleValidationHook(uniformLocales);
5095
5160
  await syncEngine({
5096
5161
  source,
5097
5162
  target,
@@ -5099,6 +5164,12 @@ var EntryPatternPushModule = {
5099
5164
  whatIf,
5100
5165
  allowEmptySource,
5101
5166
  log: createSyncEngineConsoleLogger({ diffMode }),
5167
+ onBeforeProcessObject: async (sourceObject) => {
5168
+ await localeValidationHook({
5169
+ _locales: sourceObject.object.entry._locales,
5170
+ displayName: sourceObject.displayName ?? sourceObject.providerId
5171
+ });
5172
+ },
5102
5173
  onBeforeCompareObjects: async (sourceObject) => {
5103
5174
  return replaceLocalUrlsWithRemoteReferences({
5104
5175
  entity: sourceObject,
@@ -5303,9 +5374,9 @@ function createLocaleEngineDataSource({
5303
5374
  }
5304
5375
 
5305
5376
  // src/commands/canvas/commands/locale/_util.ts
5306
- import { LocaleClient } from "@uniformdev/canvas";
5377
+ import { LocaleClient as LocaleClient2 } from "@uniformdev/canvas";
5307
5378
  function getLocaleClient(options) {
5308
- return new LocaleClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
5379
+ return new LocaleClient2({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
5309
5380
  }
5310
5381
 
5311
5382
  // src/commands/canvas/commands/locale/pull.ts
@@ -8232,16 +8303,29 @@ var IntegrationEdgehancerDeployModule = {
8232
8303
  yargs35.positional("filename", {
8233
8304
  demandOption: true,
8234
8305
  describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
8306
+ }).option("compatibilityDate", {
8307
+ type: "string",
8308
+ describe: "Date indicating targeted support in the custom edgehancer runtime. Backwards incompatible fixes to the runtime following this date will not affect this custom edgehancer. Format: YYYY-MM-DD. You can check here for more information: https://developers.cloudflare.com/workers/configuration/compatibility-dates/#setting-compatibility-date"
8235
8309
  })
8236
8310
  )
8237
8311
  )
8238
8312
  )
8239
8313
  ),
8240
- handler: async ({ apiHost, apiKey, proxy, filename, team: teamId, archetype, connectorType, hook }) => {
8314
+ handler: async ({
8315
+ apiHost,
8316
+ apiKey,
8317
+ proxy,
8318
+ filename,
8319
+ team: teamId,
8320
+ archetype,
8321
+ connectorType,
8322
+ hook,
8323
+ compatibilityDate
8324
+ }) => {
8241
8325
  const fetch2 = nodeFetchProxy(proxy);
8242
8326
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
8243
8327
  const code = readFileSync(filename, "utf8");
8244
- await client.deploy({ archetype, code, connectorType, hook });
8328
+ await client.deploy({ archetype, code, connectorType, hook, compatibilityDate });
8245
8329
  }
8246
8330
  };
8247
8331
 
@@ -8464,7 +8548,7 @@ import { PostHog } from "posthog-node";
8464
8548
  // package.json
8465
8549
  var package_default = {
8466
8550
  name: "@uniformdev/cli",
8467
- version: "20.24.0",
8551
+ version: "20.25.0",
8468
8552
  description: "Uniform command line interface tool",
8469
8553
  license: "SEE LICENSE IN LICENSE.txt",
8470
8554
  main: "./cli.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.24.1-alpha.0+9e8dbc01e8",
3
+ "version": "20.24.4-alpha.26+80d802be78",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "20.24.1-alpha.0+9e8dbc01e8",
31
- "@uniformdev/canvas": "20.24.1-alpha.0+9e8dbc01e8",
32
- "@uniformdev/context": "20.24.1-alpha.0+9e8dbc01e8",
33
- "@uniformdev/files": "20.24.1-alpha.0+9e8dbc01e8",
34
- "@uniformdev/project-map": "20.24.1-alpha.0+9e8dbc01e8",
35
- "@uniformdev/redirect": "20.24.1-alpha.0+9e8dbc01e8",
36
- "@uniformdev/richtext": "20.24.1-alpha.0+9e8dbc01e8",
30
+ "@uniformdev/assets": "20.24.4-alpha.26+80d802be78",
31
+ "@uniformdev/canvas": "20.24.4-alpha.26+80d802be78",
32
+ "@uniformdev/context": "20.24.4-alpha.26+80d802be78",
33
+ "@uniformdev/files": "20.24.4-alpha.26+80d802be78",
34
+ "@uniformdev/project-map": "20.24.4-alpha.26+80d802be78",
35
+ "@uniformdev/redirect": "20.24.4-alpha.26+80d802be78",
36
+ "@uniformdev/richtext": "20.24.4-alpha.26+80d802be78",
37
37
  "call-bind": "^1.0.2",
38
38
  "colorette": "2.0.20",
39
39
  "cosmiconfig": "9.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "9e8dbc01e870c404b63c19326477dbb3910ec14a"
82
+ "gitHead": "80d802be787a855a99bfe70f2b6cbdb17e71cbae"
83
83
  }