@uniformdev/cli 19.11.0 → 19.13.0

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 +31 -27
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -244,7 +244,7 @@ async function createFileSyncEngineDataSource({
244
244
  for (const filename of filenames) {
245
245
  const fullFilename = join(directory, filename);
246
246
  try {
247
- const contents = readFileToObject(fullFilename);
247
+ const contents = await readFileToObject(fullFilename);
248
248
  const displayName = selectDisplayName12(contents);
249
249
  const object = {
250
250
  id: selectIdentifier12(contents),
@@ -932,7 +932,7 @@ var CompositionListModule = {
932
932
  state: convertCompositionState(state),
933
933
  skipPatternResolution: !resolvePatterns,
934
934
  withComponentIDs: componentIDs,
935
- skipParameterResolution: !resolveOverrides
935
+ skipOverridesResolution: !resolveOverrides
936
936
  });
937
937
  emitWithFormat(res.compositions, format, filename);
938
938
  }
@@ -960,7 +960,6 @@ function createComponentInstanceEngineDataSource({
960
960
  offset,
961
961
  state: stateId,
962
962
  skipPatternResolution: true,
963
- skipParameterResolution: true,
964
963
  skipOverridesResolution: true,
965
964
  withComponentIDs: true
966
965
  })).compositions,
@@ -3102,7 +3101,7 @@ import { PostHog } from "posthog-node";
3102
3101
  // package.json
3103
3102
  var package_default = {
3104
3103
  name: "@uniformdev/cli",
3105
- version: "19.11.0",
3104
+ version: "19.13.0",
3106
3105
  description: "Uniform command line interface tool",
3107
3106
  license: "SEE LICENSE IN LICENSE.txt",
3108
3107
  main: "./cli.js",
@@ -3130,14 +3129,14 @@ var package_default = {
3130
3129
  graphql: "16.6.0",
3131
3130
  "graphql-request": "6.0.0",
3132
3131
  "https-proxy-agent": "^5.0.1",
3133
- inquirer: "9.2.3",
3132
+ inquirer: "9.2.5",
3134
3133
  "isomorphic-git": "1.21.0",
3135
3134
  "isomorphic-unfetch": "^3.1.0",
3136
3135
  "js-yaml": "^4.1.0",
3137
3136
  jsonwebtoken: "9.0.0",
3138
3137
  "lodash.isequalwith": "^4.4.0",
3139
3138
  open: "9.1.0",
3140
- ora: "6.3.0",
3139
+ ora: "6.3.1",
3141
3140
  "posthog-node": "3.1.1",
3142
3141
  slugify: "1.6.6",
3143
3142
  yargs: "^17.6.2",
@@ -3149,7 +3148,7 @@ var package_default = {
3149
3148
  "@types/js-yaml": "4.0.5",
3150
3149
  "@types/jsonwebtoken": "9.0.2",
3151
3150
  "@types/lodash.isequalwith": "4.4.7",
3152
- "@types/node": "18.16.9",
3151
+ "@types/node": "18.16.13",
3153
3152
  "@types/yargs": "17.0.24"
3154
3153
  },
3155
3154
  bin: {
@@ -3321,12 +3320,12 @@ var getLimitsSchema = z.object({
3321
3320
  })
3322
3321
  });
3323
3322
  var createClient = (baseUrl, authToken) => {
3324
- const request2 = async (path4, opts) => {
3323
+ const request2 = async (path4, opts, allowedNon2xxStatusCodes = []) => {
3325
3324
  const res = await fetch(makeUrl(baseUrl, path4), {
3326
3325
  ...opts,
3327
3326
  headers: { Authorization: `Bearer ${authToken}` }
3328
3327
  });
3329
- if (res.ok) {
3328
+ if (res.ok || allowedNon2xxStatusCodes.includes(res.status)) {
3330
3329
  return res;
3331
3330
  } else {
3332
3331
  throw new Error(
@@ -3334,8 +3333,8 @@ var createClient = (baseUrl, authToken) => {
3334
3333
  );
3335
3334
  }
3336
3335
  };
3337
- const requestJson = async (path4, opts, schema2) => {
3338
- const res = await request2(path4, opts);
3336
+ const requestJson = async (path4, opts, schema2, allowedNon2xxStatusCodes = []) => {
3337
+ const res = await request2(path4, opts, allowedNon2xxStatusCodes);
3339
3338
  const data = await res.json();
3340
3339
  const parseResult = schema2.safeParse(data);
3341
3340
  if (parseResult.success) {
@@ -3363,11 +3362,16 @@ var createClient = (baseUrl, authToken) => {
3363
3362
  const { limits } = await requestJson(
3364
3363
  `/api/v1/limits?teamId=${teamId}`,
3365
3364
  { method: "POST" },
3366
- getLimitsSchema
3365
+ getLimitsSchema,
3366
+ // HTTP 402 Payment Required means that SOME limit has been exceeded.
3367
+ // We still want to check if there is some project type that is below limit.
3368
+ [402]
3367
3369
  );
3368
3370
  const projectTypeBelowLimit = limits.projects.find((project) => project.used < project.limit);
3369
3371
  if (!projectTypeBelowLimit) {
3370
- throw new Error("Usage exceeded.");
3372
+ throw new Error(
3373
+ "Usage exceeded: cannot create more projects. Please upgrade your plan or delete one of existing projects."
3374
+ );
3371
3375
  }
3372
3376
  const result = await requestJson(
3373
3377
  "/api/v1/project",
@@ -4912,18 +4916,18 @@ function writeContextPackage3(filename, packageContents) {
4912
4916
  }
4913
4917
 
4914
4918
  // src/commands/redirect/commands/RedirectDefinition/_util.ts
4915
- var selectIdentifier11 = (source) => source.redirect.id;
4919
+ var selectIdentifier11 = (source) => source.id;
4916
4920
  var selectFilename2 = (source) => {
4917
- const index = source.redirect.sourceUrl.lastIndexOf("/");
4918
- return cleanFileName(source.redirect.sourceUrl.substring(index + 1)) + `_${source.redirect.id}`;
4921
+ const index = source.sourceUrl.lastIndexOf("/");
4922
+ return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
4919
4923
  };
4920
4924
  var selectDisplayName11 = (source) => {
4921
- let pathName = source.redirect.sourceUrl;
4925
+ let pathName = source.sourceUrl;
4922
4926
  if (pathName.length > 30) {
4923
- const slashIndex = source.redirect.sourceUrl.indexOf("/", source.redirect.sourceUrl.length - 30);
4927
+ const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
4924
4928
  pathName = "..." + pathName.substring(slashIndex);
4925
4929
  }
4926
- return `${pathName} (id: ${source.redirect.id})`;
4930
+ return `${pathName} (id: ${source.id})`;
4927
4931
  };
4928
4932
 
4929
4933
  // src/commands/redirect/RedirectEngineDataSource.ts
@@ -4934,10 +4938,10 @@ function createRedirectDefinitionEngineDataSource({
4934
4938
  const { redirects } = await client.getRedirects();
4935
4939
  for await (const def of redirects) {
4936
4940
  const result = {
4937
- id: selectIdentifier11(def),
4938
- displayName: selectDisplayName11(def),
4939
- providerId: selectIdentifier11(def),
4940
- object: def
4941
+ id: selectIdentifier11(def.redirect),
4942
+ displayName: selectDisplayName11(def.redirect),
4943
+ providerId: selectIdentifier11(def.redirect),
4944
+ object: def.redirect
4941
4945
  };
4942
4946
  yield result;
4943
4947
  }
@@ -4948,7 +4952,7 @@ function createRedirectDefinitionEngineDataSource({
4948
4952
  await client.deleteRedirect(providerId);
4949
4953
  },
4950
4954
  writeObject: async (object) => {
4951
- await client.upsertRedirect(object.object.redirect);
4955
+ await client.upsertRedirect(object.object);
4952
4956
  }
4953
4957
  };
4954
4958
  }
@@ -5003,7 +5007,7 @@ var RedirectDefinitionPullModule = {
5003
5007
  if (isPackage) {
5004
5008
  const packageContents = readContextPackage3(directory, false);
5005
5009
  target = await createArraySyncEngineDataSource({
5006
- objects: packageContents ?? [],
5010
+ objects: packageContents.redirects ?? [],
5007
5011
  selectIdentifier: selectIdentifier11,
5008
5012
  selectDisplayName: selectDisplayName11,
5009
5013
  onSyncComplete: async (_, synced) => {
@@ -5073,7 +5077,7 @@ var RedirectDefinitionPushModule = {
5073
5077
  if (isPackage) {
5074
5078
  const packageContents = readContextPackage3(directory, true);
5075
5079
  source = await createArraySyncEngineDataSource({
5076
- objects: packageContents ?? [],
5080
+ objects: packageContents.redirects ?? [],
5077
5081
  selectIdentifier: selectIdentifier11,
5078
5082
  selectDisplayName: selectDisplayName11
5079
5083
  });
@@ -5126,7 +5130,7 @@ var RedirectDefinitionUpdateModule = {
5126
5130
  const fetch3 = nodeFetchProxy(proxy);
5127
5131
  const client = new UncachedRedirectClient6({ apiKey, apiHost, fetch: fetch3, projectId });
5128
5132
  const file = readFileToObject(filename);
5129
- await client.upsertRedirect(file.redirect);
5133
+ await client.upsertRedirect(file);
5130
5134
  }
5131
5135
  };
5132
5136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.11.0",
3
+ "version": "19.13.0",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -16,10 +16,10 @@
16
16
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
17
17
  },
18
18
  "dependencies": {
19
- "@uniformdev/canvas": "19.11.0",
20
- "@uniformdev/context": "19.11.0",
21
- "@uniformdev/project-map": "19.11.0",
22
- "@uniformdev/redirect": "19.11.0",
19
+ "@uniformdev/canvas": "19.13.0",
20
+ "@uniformdev/context": "19.13.0",
21
+ "@uniformdev/project-map": "19.13.0",
22
+ "@uniformdev/redirect": "19.13.0",
23
23
  "ansi-colors": "^4.1.3",
24
24
  "diff": "^5.0.0",
25
25
  "dotenv": "^16.0.3",
@@ -28,14 +28,14 @@
28
28
  "graphql": "16.6.0",
29
29
  "graphql-request": "6.0.0",
30
30
  "https-proxy-agent": "^5.0.1",
31
- "inquirer": "9.2.3",
31
+ "inquirer": "9.2.5",
32
32
  "isomorphic-git": "1.21.0",
33
33
  "isomorphic-unfetch": "^3.1.0",
34
34
  "js-yaml": "^4.1.0",
35
35
  "jsonwebtoken": "9.0.0",
36
36
  "lodash.isequalwith": "^4.4.0",
37
37
  "open": "9.1.0",
38
- "ora": "6.3.0",
38
+ "ora": "6.3.1",
39
39
  "posthog-node": "3.1.1",
40
40
  "slugify": "1.6.6",
41
41
  "yargs": "^17.6.2",
@@ -47,7 +47,7 @@
47
47
  "@types/js-yaml": "4.0.5",
48
48
  "@types/jsonwebtoken": "9.0.2",
49
49
  "@types/lodash.isequalwith": "4.4.7",
50
- "@types/node": "18.16.9",
50
+ "@types/node": "18.16.13",
51
51
  "@types/yargs": "17.0.24"
52
52
  },
53
53
  "bin": {
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "25d492fe923f313b517cbc70d3ff13fdcf97fa34"
62
+ "gitHead": "1670a0e2475a7a98745ea737cd3b2b09649fe1a1"
63
63
  }