@uniformdev/cli 20.50.2-alpha.9 → 20.50.2-alpha.96

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.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ CLI_USER_AGENT,
3
4
  __require,
4
5
  applyDefaultSyncConfiguration,
5
6
  emitWithFormat,
@@ -7,6 +8,7 @@ import {
7
8
  getEntityOption,
8
9
  isPathAPackageFile,
9
10
  nodeFetchProxy,
11
+ package_default,
10
12
  paginateAsync,
11
13
  readFileToObject,
12
14
  withApiOptions,
@@ -16,11 +18,11 @@ import {
16
18
  withFormatOptions,
17
19
  withProjectOptions,
18
20
  withTeamOptions
19
- } from "./chunk-SRP5OQEZ.mjs";
21
+ } from "./chunk-BFI4F2WF.mjs";
20
22
 
21
23
  // src/index.ts
22
24
  import * as dotenv from "dotenv";
23
- import yargs41 from "yargs";
25
+ import yargs42 from "yargs";
24
26
  import { hideBin } from "yargs/helpers";
25
27
 
26
28
  // src/commands/ai/index.ts
@@ -72,7 +74,7 @@ async function getBearerToken(baseUrl) {
72
74
  }
73
75
 
74
76
  // src/client.ts
75
- import * as z from "zod/v3";
77
+ import * as z from "zod";
76
78
 
77
79
  // src/auth/api-key.ts
78
80
  var READ_PERMISSIONS = ["PROJECT", "UPM_PUB", "OPT_PUB", "OPT_READ", "UPM_READ"];
@@ -140,7 +142,7 @@ var createClient = (baseUrl, authToken) => {
140
142
  const request2 = async (path8, opts, allowedNon2xxStatusCodes = []) => {
141
143
  const res = await fetch(makeUrl(baseUrl, path8), {
142
144
  ...opts,
143
- headers: { Authorization: `Bearer ${authToken}` }
145
+ headers: { Authorization: `Bearer ${authToken}`, "User-Agent": CLI_USER_AGENT }
144
146
  });
145
147
  if (res.ok || allowedNon2xxStatusCodes.includes(res.status)) {
146
148
  return res;
@@ -150,10 +152,10 @@ var createClient = (baseUrl, authToken) => {
150
152
  );
151
153
  }
152
154
  };
153
- const requestJson = async (path8, opts, schema2, allowedNon2xxStatusCodes = []) => {
155
+ const requestJson = async (path8, opts, schema, allowedNon2xxStatusCodes = []) => {
154
156
  const res = await request2(path8, opts, allowedNon2xxStatusCodes);
155
157
  const data = await res.json();
156
- const parseResult = schema2.safeParse(data);
158
+ const parseResult = schema.safeParse(data);
157
159
  if (parseResult.success) {
158
160
  return parseResult.data;
159
161
  } else {
@@ -324,8 +326,8 @@ async function readJSON(path8) {
324
326
  }
325
327
  async function tryReadJSON(path8, missingValue = null) {
326
328
  try {
327
- const stat2 = await fs.stat(path8);
328
- return stat2.isFile() ? await readJSON(path8) : missingValue;
329
+ const stat = await fs.stat(path8);
330
+ return stat.isFile() ? await readJSON(path8) : missingValue;
329
331
  } catch {
330
332
  return missingValue;
331
333
  }
@@ -447,7 +449,7 @@ async function chooseExistingProject({
447
449
  teamId,
448
450
  user
449
451
  }) {
450
- const projects = (user.teams.find((t) => t.team.id === teamId)?.team.sites ?? []).map((t) => ({
452
+ const projects = (user.teams.find((t) => t.id === teamId)?.projects ?? []).map((t) => ({
451
453
  name: t.name,
452
454
  value: t.id
453
455
  }));
@@ -722,7 +724,7 @@ import mitt from "mitt";
722
724
 
723
725
  // src/sync/serializedDequal.ts
724
726
  var has = Object.prototype.hasOwnProperty;
725
- var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated"]);
727
+ var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated", "createdBy", "modifiedBy", "updatedBy"]);
726
728
  function serializedDequal(foo, bar) {
727
729
  let ctor, len;
728
730
  if (foo === bar) {
@@ -1033,8 +1035,8 @@ async function chooseTeam(user, prompt, telemetry) {
1033
1035
  const teamId = await select3({
1034
1036
  message: prompt,
1035
1037
  choices: user.teams.map((team) => ({
1036
- name: team.team.name,
1037
- value: team.team.id
1038
+ name: team.name,
1039
+ value: team.id
1038
1040
  }))
1039
1041
  });
1040
1042
  telemetry.send("team picked", { teamId });
@@ -1042,56 +1044,39 @@ async function chooseTeam(user, prompt, telemetry) {
1042
1044
  }
1043
1045
 
1044
1046
  // src/auth/user-info.ts
1047
+ import { ProjectClient } from "@uniformdev/canvas";
1045
1048
  import { gql, request } from "graphql-request";
1046
- import * as z2 from "zod/v3";
1047
- var query = gql`
1048
- query GetUserInfo($subject: String!) {
1049
+ import * as z2 from "zod";
1050
+ var identityQuery = gql`
1051
+ query GetUserIdentity($subject: String!) {
1049
1052
  info: identities_by_pk(subject: $subject) {
1050
1053
  name
1051
1054
  email_address
1052
- teams: organizations_identities(order_by: { organization: { name: asc } }) {
1053
- team: organization {
1054
- name
1055
- id
1056
- sites {
1057
- name
1058
- id
1059
- }
1060
- }
1061
- }
1062
1055
  }
1063
1056
  }
1064
1057
  `;
1065
- var schema = z2.object({
1058
+ var identitySchema = z2.object({
1066
1059
  info: z2.object({
1067
1060
  name: z2.string().min(1),
1068
- email_address: z2.string().min(1).nullable(),
1069
- teams: z2.array(
1070
- z2.object({
1071
- team: z2.object({
1072
- name: z2.string().min(1),
1073
- id: z2.string().min(1),
1074
- sites: z2.array(
1075
- z2.object({
1076
- name: z2.string().min(1),
1077
- id: z2.string().min(1)
1078
- })
1079
- )
1080
- })
1081
- })
1082
- )
1061
+ email_address: z2.string().min(1).nullable()
1083
1062
  })
1084
1063
  });
1085
1064
  var getUserInfo = async (baseUrl, authToken, subject) => {
1086
1065
  try {
1087
- const endpoint = makeUrl(baseUrl, "/v1/graphql");
1088
- const res = await request(endpoint, query, { subject }, { Authorization: `Bearer ${authToken}` });
1089
- const parseResult = schema.safeParse(res);
1090
- if (parseResult.success) {
1091
- return parseResult.data.info;
1092
- } else {
1093
- throw new Error(`Invalid GraphQL response: ${parseResult.error.message}`);
1066
+ const headers = { Authorization: `Bearer ${authToken}`, "User-Agent": CLI_USER_AGENT };
1067
+ const projectClient = new ProjectClient({ apiHost: baseUrl, bearerToken: authToken });
1068
+ const [identityRes, projectsRes] = await Promise.all([
1069
+ request(makeUrl(baseUrl, "/v1/graphql"), identityQuery, { subject }, headers),
1070
+ projectClient.getProjects()
1071
+ ]);
1072
+ const identityParsed = identitySchema.safeParse(identityRes);
1073
+ if (!identityParsed.success) {
1074
+ throw new Error(`Invalid identity response: ${identityParsed.error.message}`);
1094
1075
  }
1076
+ return {
1077
+ ...identityParsed.data.info,
1078
+ teams: projectsRes.teams
1079
+ };
1095
1080
  } catch (err) {
1096
1081
  throw new Error(`Failed to fetch user account:
1097
1082
  ${err.message}`);
@@ -1120,94 +1105,6 @@ async function fetchUserAndEnsureFirstTeamExists({
1120
1105
  // src/telemetry/telemetry.ts
1121
1106
  import crypto from "crypto";
1122
1107
  import { PostHog } from "posthog-node";
1123
-
1124
- // package.json
1125
- var package_default = {
1126
- name: "@uniformdev/cli",
1127
- version: "20.50.1",
1128
- description: "Uniform command line interface tool",
1129
- license: "SEE LICENSE IN LICENSE.txt",
1130
- main: "./cli.js",
1131
- exports: {
1132
- ".": {
1133
- types: "./dist/index.d.mts",
1134
- default: "./cli.js"
1135
- },
1136
- "./config": {
1137
- types: "./dist/defaultConfig.d.mts",
1138
- default: "./dist/defaultConfig.mjs"
1139
- }
1140
- },
1141
- types: "./dist/index.d.mts",
1142
- sideEffects: false,
1143
- scripts: {
1144
- uniform: "node ./cli.js",
1145
- build: "tsc --noEmit && tsup",
1146
- dev: "tsup --watch",
1147
- clean: "rimraf dist",
1148
- test: "jest --maxWorkers=1 --passWithNoTests",
1149
- lint: 'eslint "src/**/*.{js,ts,tsx}"',
1150
- format: 'prettier --write "src/**/*.{js,ts,tsx}"'
1151
- },
1152
- dependencies: {
1153
- "@inquirer/prompts": "^7.10.1",
1154
- "@thi.ng/mime": "^2.2.23",
1155
- "@uniformdev/assets": "workspace:*",
1156
- "@uniformdev/canvas": "workspace:*",
1157
- "@uniformdev/context": "workspace:*",
1158
- "@uniformdev/files": "workspace:*",
1159
- "@uniformdev/project-map": "workspace:*",
1160
- "@uniformdev/redirect": "workspace:*",
1161
- "@uniformdev/richtext": "workspace:*",
1162
- "call-bind": "^1.0.2",
1163
- colorette: "2.0.20",
1164
- cosmiconfig: "9.0.0",
1165
- "cosmiconfig-typescript-loader": "5.0.0",
1166
- diff: "^5.0.0",
1167
- dotenv: "^16.4.7",
1168
- esbuild: "0.25.0",
1169
- execa: "5.1.1",
1170
- "file-type": "^20.0.0",
1171
- "fs-jetpack": "5.1.0",
1172
- graphql: "16.9.0",
1173
- "graphql-request": "6.1.0",
1174
- "image-size": "^1.2.1",
1175
- "isomorphic-git": "1.35.0",
1176
- "js-yaml": "^4.1.0",
1177
- jsonwebtoken: "9.0.3",
1178
- mitt: "^3.0.1",
1179
- "normalize-newline": "^4.1.0",
1180
- open: "10.2.0",
1181
- ora: "8.0.1",
1182
- "p-queue": "7.3.4",
1183
- "posthog-node": "5.10.3",
1184
- "registry-auth-token": "^5.0.0",
1185
- "registry-url": "^6.0.0",
1186
- slugify: "1.6.6",
1187
- svix: "^1.71.0",
1188
- undici: "^7.16.0",
1189
- yargs: "^17.6.2",
1190
- zod: "3.25.76"
1191
- },
1192
- devDependencies: {
1193
- "@types/diff": "5.0.9",
1194
- "@types/js-yaml": "4.0.9",
1195
- "@types/jsonwebtoken": "9.0.5",
1196
- "@types/node": "24.3.1",
1197
- "@types/yargs": "17.0.32"
1198
- },
1199
- bin: {
1200
- uniform: "./cli.js"
1201
- },
1202
- files: [
1203
- "/dist"
1204
- ],
1205
- publishConfig: {
1206
- access: "public"
1207
- }
1208
- };
1209
-
1210
- // src/telemetry/telemetry.ts
1211
1108
  var POSTHOG_WRITE_ONLY_KEY = "phc_c8YoKI9984KOHBfNrCRfIKvL56aYd5OpYxOdYexRzH7";
1212
1109
  var Telemetry = class {
1213
1110
  constructor(prefix, disable = false) {
@@ -1403,8 +1300,8 @@ function getExistingServers(config2) {
1403
1300
  var InstallMcpCommand = {
1404
1301
  command: "install",
1405
1302
  describe: "Install Uniform MCP server configuration (use --team, --project, and --apiKey for non-interactive mode)",
1406
- builder: (yargs42) => withConfiguration(
1407
- yargs42.option("agent", {
1303
+ builder: (yargs43) => withConfiguration(
1304
+ yargs43.option("agent", {
1408
1305
  alias: "a",
1409
1306
  describe: "Specify agent type (cursor, claude, copilot, other)",
1410
1307
  type: "string",
@@ -1556,7 +1453,7 @@ Selected agent: ${agentType}`));
1556
1453
  if (isNonInteractive) {
1557
1454
  console.log(`\u{1F3E2} Team ID: ${teamId}`);
1558
1455
  } else {
1559
- console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.team.id === teamId)?.team.name}`);
1456
+ console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.id === teamId)?.name}`);
1560
1457
  }
1561
1458
  console.log(`\u{1F4E6} Project: ${projectName} (${projectId})`);
1562
1459
  if (agentType === "cursor") {
@@ -1604,7 +1501,7 @@ Selected agent: ${agentType}`));
1604
1501
  var McpCommand = {
1605
1502
  command: "mcp <command>",
1606
1503
  describe: "Uniform MCP server management commands",
1607
- builder: (yargs42) => yargs42.command(InstallMcpCommand).demandCommand(),
1504
+ builder: (yargs43) => yargs43.command(InstallMcpCommand).demandCommand(),
1608
1505
  handler: () => {
1609
1506
  yargs.showHelp();
1610
1507
  }
@@ -2079,8 +1976,8 @@ ${gray2("Rules source:")} https://github.com/uniformdev/ai-rules`);
2079
1976
  var InstallRulesCommand = {
2080
1977
  command: "install",
2081
1978
  describe: "Install Uniform AI rules for your development assistant",
2082
- builder: (yargs42) => withConfiguration(
2083
- yargs42.option("agent", {
1979
+ builder: (yargs43) => withConfiguration(
1980
+ yargs43.option("agent", {
2084
1981
  alias: "a",
2085
1982
  describe: "Specify agent type (cursor, claude, copilot, other)",
2086
1983
  type: "string",
@@ -2118,7 +2015,7 @@ import { blue as blue4, bold as bold2, gray as gray3, green as green5, red as re
2118
2015
  var ListRulesCommand = {
2119
2016
  command: "list",
2120
2017
  describe: "List available Uniform AI rules",
2121
- builder: (yargs42) => withConfiguration(yargs42),
2018
+ builder: (yargs43) => withConfiguration(yargs43),
2122
2019
  handler: async function() {
2123
2020
  const { stopAllSpinners, spin } = makeSpinner();
2124
2021
  try {
@@ -2147,7 +2044,7 @@ var ListRulesCommand = {
2147
2044
  var RulesCommand = {
2148
2045
  command: "rules <command>",
2149
2046
  describe: "Uniform AI rules management commands",
2150
- builder: (yargs42) => yargs42.command(InstallRulesCommand).command(ListRulesCommand).demandCommand(),
2047
+ builder: (yargs43) => yargs43.command(InstallRulesCommand).command(ListRulesCommand).demandCommand(),
2151
2048
  handler: () => {
2152
2049
  yargs2.showHelp();
2153
2050
  }
@@ -2157,14 +2054,14 @@ var RulesCommand = {
2157
2054
  var AiCommand = {
2158
2055
  command: "ai <command>",
2159
2056
  describe: "Uniform AI development assistant commands",
2160
- builder: (yargs42) => yargs42.command(RulesCommand).command(McpCommand).demandCommand(),
2057
+ builder: (yargs43) => yargs43.command(RulesCommand).command(McpCommand).demandCommand(),
2161
2058
  handler: () => {
2162
2059
  yargs3.showHelp();
2163
2060
  }
2164
2061
  };
2165
2062
 
2166
2063
  // src/commands/canvas/index.ts
2167
- import yargs20 from "yargs";
2064
+ import yargs21 from "yargs";
2168
2065
 
2169
2066
  // src/commands/canvas/commands/asset.ts
2170
2067
  import yargs4 from "yargs";
@@ -2196,12 +2093,12 @@ function getFileClient(options) {
2196
2093
  var AssetGetModule = {
2197
2094
  command: "get <id>",
2198
2095
  describe: "Get an asset",
2199
- builder: (yargs42) => withConfiguration(
2096
+ builder: (yargs43) => withConfiguration(
2200
2097
  withDebugOptions(
2201
2098
  withFormatOptions(
2202
2099
  withApiOptions(
2203
2100
  withProjectOptions(
2204
- yargs42.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
2101
+ yargs43.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
2205
2102
  )
2206
2103
  )
2207
2104
  )
@@ -2222,7 +2119,7 @@ var AssetGetModule = {
2222
2119
  var AssetListModule = {
2223
2120
  command: "list",
2224
2121
  describe: "List assets",
2225
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
2122
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
2226
2123
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
2227
2124
  const fetch2 = nodeFetchProxy(proxy, verbose);
2228
2125
  const client = getAssetClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -2476,7 +2373,7 @@ import {
2476
2373
  walkNodeTree,
2477
2374
  walkPropertyValues
2478
2375
  } from "@uniformdev/canvas";
2479
- var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2376
+ var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu([1-9]\d*)?\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2480
2377
  var walkFileUrlsForCompositionOrEntry = ({
2481
2378
  entity,
2482
2379
  callback
@@ -2759,7 +2656,7 @@ var escapeRegExp = (string4) => {
2759
2656
  var findUrlMatchingPartialPathname = (source, pathname) => {
2760
2657
  const escapedPathname = escapeRegExp(pathname);
2761
2658
  const regex = new RegExp(
2762
- `"(https://([^"]*?)?(img|files).uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2659
+ `"(https://([^"]*?)?(img|files).(eu([1-9]\\d*)?\\.)?uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2763
2660
  );
2764
2661
  const match = source.match(regex);
2765
2662
  if (match && match[1]) {
@@ -2784,8 +2681,8 @@ function prepCompositionForDisk(composition) {
2784
2681
  delete prepped.state;
2785
2682
  return prepped;
2786
2683
  }
2787
- function withStateOptions(yargs42, defaultState = "preview") {
2788
- return yargs42.option("state", {
2684
+ function withStateOptions(yargs43, defaultState = "preview") {
2685
+ return yargs43.option("state", {
2789
2686
  type: "string",
2790
2687
  describe: `State to fetch.`,
2791
2688
  choices: ["preview", "published"],
@@ -2867,12 +2764,12 @@ function writeCanvasPackage(filename, packageContents) {
2867
2764
  var AssetPullModule = {
2868
2765
  command: "pull <directory>",
2869
2766
  describe: "Pulls all assets to local files in a directory",
2870
- builder: (yargs42) => withConfiguration(
2767
+ builder: (yargs43) => withConfiguration(
2871
2768
  withApiOptions(
2872
2769
  withDebugOptions(
2873
2770
  withProjectOptions(
2874
2771
  withDiffOptions(
2875
- yargs42.positional("directory", {
2772
+ yargs43.positional("directory", {
2876
2773
  describe: "Directory to save the assets to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2877
2774
  type: "string"
2878
2775
  }).option("format", {
@@ -2984,12 +2881,12 @@ var AssetPullModule = {
2984
2881
  var AssetPushModule = {
2985
2882
  command: "push <directory>",
2986
2883
  describe: "Pushes all assets from files in a directory to Uniform",
2987
- builder: (yargs42) => withConfiguration(
2884
+ builder: (yargs43) => withConfiguration(
2988
2885
  withApiOptions(
2989
2886
  withDebugOptions(
2990
2887
  withProjectOptions(
2991
2888
  withDiffOptions(
2992
- yargs42.positional("directory", {
2889
+ yargs43.positional("directory", {
2993
2890
  describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
2994
2891
  type: "string"
2995
2892
  }).option("mode", {
@@ -3113,10 +3010,10 @@ var AssetRemoveModule = {
3113
3010
  command: "remove <id>",
3114
3011
  aliases: ["delete", "rm"],
3115
3012
  describe: "Delete an asset",
3116
- builder: (yargs42) => withConfiguration(
3013
+ builder: (yargs43) => withConfiguration(
3117
3014
  withDebugOptions(
3118
3015
  withApiOptions(
3119
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
3016
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
3120
3017
  )
3121
3018
  )
3122
3019
  ),
@@ -3137,11 +3034,11 @@ var AssetUpdateModule = {
3137
3034
  command: "update <filename>",
3138
3035
  aliases: ["put"],
3139
3036
  describe: "Insert or update an asset",
3140
- builder: (yargs42) => withConfiguration(
3037
+ builder: (yargs43) => withConfiguration(
3141
3038
  withDebugOptions(
3142
3039
  withApiOptions(
3143
3040
  withProjectOptions(
3144
- yargs42.positional("filename", { demandOption: true, describe: "Asset file to put" })
3041
+ yargs43.positional("filename", { demandOption: true, describe: "Asset file to put" })
3145
3042
  )
3146
3043
  )
3147
3044
  )
@@ -3167,7 +3064,7 @@ var AssetUpdateModule = {
3167
3064
  var AssetModule = {
3168
3065
  command: "asset <command>",
3169
3066
  describe: "Commands for Assets",
3170
- builder: (yargs42) => yargs42.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
3067
+ builder: (yargs43) => yargs43.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
3171
3068
  handler: () => {
3172
3069
  yargs4.help();
3173
3070
  }
@@ -3188,12 +3085,12 @@ function getCategoryClient(options) {
3188
3085
  var CategoryGetModule = {
3189
3086
  command: "get <id>",
3190
3087
  describe: "Fetch a category",
3191
- builder: (yargs42) => withConfiguration(
3088
+ builder: (yargs43) => withConfiguration(
3192
3089
  withFormatOptions(
3193
3090
  withDebugOptions(
3194
3091
  withApiOptions(
3195
3092
  withProjectOptions(
3196
- yargs42.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
3093
+ yargs43.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
3197
3094
  )
3198
3095
  )
3199
3096
  )
@@ -3218,8 +3115,8 @@ var CategoryListModule = {
3218
3115
  command: "list",
3219
3116
  describe: "List categories",
3220
3117
  aliases: ["ls"],
3221
- builder: (yargs42) => withConfiguration(
3222
- withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs42.options({})))))
3118
+ builder: (yargs43) => withConfiguration(
3119
+ withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs43.options({})))))
3223
3120
  ),
3224
3121
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
3225
3122
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -3263,12 +3160,12 @@ function createCategoriesEngineDataSource({
3263
3160
  var CategoryPullModule = {
3264
3161
  command: "pull <directory>",
3265
3162
  describe: "Pulls all categories to local files in a directory",
3266
- builder: (yargs42) => withConfiguration(
3163
+ builder: (yargs43) => withConfiguration(
3267
3164
  withApiOptions(
3268
3165
  withProjectOptions(
3269
3166
  withDiffOptions(
3270
3167
  withDebugOptions(
3271
- yargs42.positional("directory", {
3168
+ yargs43.positional("directory", {
3272
3169
  describe: "Directory to save the categories to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3273
3170
  type: "string"
3274
3171
  }).option("format", {
@@ -3343,12 +3240,12 @@ var CategoryPullModule = {
3343
3240
  var CategoryPushModule = {
3344
3241
  command: "push <directory>",
3345
3242
  describe: "Pushes all categories from files in a directory to Uniform Canvas",
3346
- builder: (yargs42) => withConfiguration(
3243
+ builder: (yargs43) => withConfiguration(
3347
3244
  withApiOptions(
3348
3245
  withDebugOptions(
3349
3246
  withProjectOptions(
3350
3247
  withDiffOptions(
3351
- yargs42.positional("directory", {
3248
+ yargs43.positional("directory", {
3352
3249
  describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
3353
3250
  type: "string"
3354
3251
  }).option("mode", {
@@ -3412,11 +3309,11 @@ var CategoryRemoveModule = {
3412
3309
  command: "remove <id>",
3413
3310
  aliases: ["delete", "rm"],
3414
3311
  describe: "Delete a category",
3415
- builder: (yargs42) => withConfiguration(
3312
+ builder: (yargs43) => withConfiguration(
3416
3313
  withApiOptions(
3417
3314
  withDebugOptions(
3418
3315
  withProjectOptions(
3419
- yargs42.positional("id", { demandOption: true, describe: "Category UUID to delete" })
3316
+ yargs43.positional("id", { demandOption: true, describe: "Category UUID to delete" })
3420
3317
  )
3421
3318
  )
3422
3319
  )
@@ -3437,11 +3334,11 @@ var CategoryUpdateModule = {
3437
3334
  command: "update <filename>",
3438
3335
  aliases: ["put"],
3439
3336
  describe: "Insert or update a category",
3440
- builder: (yargs42) => withConfiguration(
3337
+ builder: (yargs43) => withConfiguration(
3441
3338
  withApiOptions(
3442
3339
  withDebugOptions(
3443
3340
  withProjectOptions(
3444
- yargs42.positional("filename", { demandOption: true, describe: "Category file to put" })
3341
+ yargs43.positional("filename", { demandOption: true, describe: "Category file to put" })
3445
3342
  )
3446
3343
  )
3447
3344
  )
@@ -3463,7 +3360,7 @@ var CategoryModule = {
3463
3360
  command: "category <command>",
3464
3361
  aliases: ["cat"],
3465
3362
  describe: "Commands for Canvas categories",
3466
- builder: (yargs42) => yargs42.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
3363
+ builder: (yargs43) => yargs43.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
3467
3364
  handler: () => {
3468
3365
  yargs5.help();
3469
3366
  }
@@ -3485,12 +3382,12 @@ function getCanvasClient(options) {
3485
3382
  var ComponentGetModule = {
3486
3383
  command: "get <id>",
3487
3384
  describe: "Fetch a component definition",
3488
- builder: (yargs42) => withConfiguration(
3385
+ builder: (yargs43) => withConfiguration(
3489
3386
  withFormatOptions(
3490
3387
  withDebugOptions(
3491
3388
  withApiOptions(
3492
3389
  withProjectOptions(
3493
- yargs42.positional("id", {
3390
+ yargs43.positional("id", {
3494
3391
  demandOption: true,
3495
3392
  describe: "Component definition public ID to fetch"
3496
3393
  })
@@ -3524,12 +3421,12 @@ var ComponentListModule = {
3524
3421
  command: "list",
3525
3422
  describe: "List component definitions",
3526
3423
  aliases: ["ls"],
3527
- builder: (yargs42) => withConfiguration(
3424
+ builder: (yargs43) => withConfiguration(
3528
3425
  withFormatOptions(
3529
3426
  withDebugOptions(
3530
3427
  withApiOptions(
3531
3428
  withProjectOptions(
3532
- yargs42.options({
3429
+ yargs43.options({
3533
3430
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3534
3431
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
3535
3432
  })
@@ -3598,12 +3495,12 @@ function createComponentDefinitionEngineDataSource({
3598
3495
  var ComponentPullModule = {
3599
3496
  command: "pull <directory>",
3600
3497
  describe: "Pulls all component definitions to local files in a directory",
3601
- builder: (yargs42) => withConfiguration(
3498
+ builder: (yargs43) => withConfiguration(
3602
3499
  withApiOptions(
3603
3500
  withDebugOptions(
3604
3501
  withProjectOptions(
3605
3502
  withDiffOptions(
3606
- yargs42.positional("directory", {
3503
+ yargs43.positional("directory", {
3607
3504
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
3608
3505
  type: "string"
3609
3506
  }).option("format", {
@@ -3679,12 +3576,12 @@ var ComponentPullModule = {
3679
3576
  var ComponentPushModule = {
3680
3577
  command: "push <directory>",
3681
3578
  describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
3682
- builder: (yargs42) => withConfiguration(
3579
+ builder: (yargs43) => withConfiguration(
3683
3580
  withApiOptions(
3684
3581
  withDebugOptions(
3685
3582
  withProjectOptions(
3686
3583
  withDiffOptions(
3687
- yargs42.positional("directory", {
3584
+ yargs43.positional("directory", {
3688
3585
  describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
3689
3586
  type: "string"
3690
3587
  }).option("mode", {
@@ -3749,11 +3646,11 @@ var ComponentRemoveModule = {
3749
3646
  command: "remove <id>",
3750
3647
  aliases: ["delete", "rm"],
3751
3648
  describe: "Delete a component definition",
3752
- builder: (yargs42) => withConfiguration(
3649
+ builder: (yargs43) => withConfiguration(
3753
3650
  withDebugOptions(
3754
3651
  withApiOptions(
3755
3652
  withProjectOptions(
3756
- yargs42.positional("id", {
3653
+ yargs43.positional("id", {
3757
3654
  demandOption: true,
3758
3655
  describe: "Component definition public ID to delete"
3759
3656
  })
@@ -3777,11 +3674,11 @@ var ComponentUpdateModule = {
3777
3674
  command: "update <filename>",
3778
3675
  aliases: ["put"],
3779
3676
  describe: "Insert or update a component definition",
3780
- builder: (yargs42) => withConfiguration(
3677
+ builder: (yargs43) => withConfiguration(
3781
3678
  withApiOptions(
3782
3679
  withDebugOptions(
3783
3680
  withProjectOptions(
3784
- yargs42.positional("filename", { demandOption: true, describe: "Component definition file to put" })
3681
+ yargs43.positional("filename", { demandOption: true, describe: "Component definition file to put" })
3785
3682
  )
3786
3683
  )
3787
3684
  )
@@ -3803,7 +3700,7 @@ var ComponentModule = {
3803
3700
  command: "component <command>",
3804
3701
  aliases: ["def"],
3805
3702
  describe: "Commands for Canvas component definitions",
3806
- builder: (yargs42) => yargs42.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
3703
+ builder: (yargs43) => yargs43.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
3807
3704
  handler: () => {
3808
3705
  yargs6.help();
3809
3706
  }
@@ -3812,19 +3709,168 @@ var ComponentModule = {
3812
3709
  // src/commands/canvas/commands/componentPattern.ts
3813
3710
  import yargs7 from "yargs";
3814
3711
 
3712
+ // src/commands/canvas/util/entityTypeValidation.ts
3713
+ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE2 } from "@uniformdev/canvas";
3714
+ function getCompositionActualType(composition) {
3715
+ return composition.pattern ? composition.patternType === "component" ? "component-pattern" : "composition-pattern" : "composition";
3716
+ }
3717
+ function getEntryActualType(entry) {
3718
+ return entry.pattern ? "entry-pattern" : "entry";
3719
+ }
3720
+ async function validateCompositionType(client, id, expectedType) {
3721
+ try {
3722
+ const composition = await client.getCompositionById({
3723
+ compositionId: id,
3724
+ skipDataResolution: true,
3725
+ state: CANVAS_DRAFT_STATE2,
3726
+ withPatternType: true
3727
+ });
3728
+ const actualType = getCompositionActualType(composition);
3729
+ return {
3730
+ actualType,
3731
+ isValid: actualType === expectedType,
3732
+ exists: true
3733
+ };
3734
+ } catch (error) {
3735
+ if (error && typeof error === "object" && "statusCode" in error && error.statusCode === 404) {
3736
+ return {
3737
+ actualType: expectedType,
3738
+ isValid: false,
3739
+ exists: false
3740
+ };
3741
+ }
3742
+ throw error;
3743
+ }
3744
+ }
3745
+ async function validateEntryType(client, id, expectedType) {
3746
+ const res = await client.getEntries({
3747
+ offset: 0,
3748
+ limit: 1,
3749
+ entryIDs: [id],
3750
+ skipDataResolution: true,
3751
+ state: CANVAS_DRAFT_STATE2,
3752
+ pattern: expectedType === "entry-pattern" ? true : void 0
3753
+ });
3754
+ if (res.entries.length !== 1) {
3755
+ return {
3756
+ actualType: expectedType,
3757
+ isValid: false,
3758
+ exists: false
3759
+ };
3760
+ }
3761
+ const entry = res.entries[0];
3762
+ const actualType = getEntryActualType(entry);
3763
+ return {
3764
+ actualType,
3765
+ isValid: actualType === expectedType,
3766
+ exists: true
3767
+ };
3768
+ }
3769
+ function getCompositionDisplayNameWithArticle(type) {
3770
+ switch (type) {
3771
+ case "composition":
3772
+ return "a composition";
3773
+ case "composition-pattern":
3774
+ return "a composition pattern";
3775
+ case "component-pattern":
3776
+ return "a component pattern";
3777
+ }
3778
+ }
3779
+ function getEntryDisplayNameWithArticle(type) {
3780
+ return type === "entry" ? "an entry" : "an entry pattern";
3781
+ }
3782
+ function getCompositionDisplayName(type) {
3783
+ switch (type) {
3784
+ case "composition":
3785
+ return "Composition";
3786
+ case "composition-pattern":
3787
+ return "Composition Pattern";
3788
+ case "component-pattern":
3789
+ return "Component Pattern";
3790
+ }
3791
+ }
3792
+ function getEntryDisplayName(type) {
3793
+ return type === "entry" ? "Entry" : "Entry Pattern";
3794
+ }
3795
+ function getCommandVerb(action) {
3796
+ return action === "delete" ? "remove" : action;
3797
+ }
3798
+ function formatCompositionTypeError(id, actualType, expectedType, action) {
3799
+ const actualDisplayName = getCompositionDisplayNameWithArticle(actualType);
3800
+ const expectedDisplayName = getCompositionDisplayNameWithArticle(expectedType);
3801
+ return `Error: The provided ID belongs to ${actualDisplayName}, not ${expectedDisplayName}.
3802
+ To ${action} ${actualDisplayName}, use: uniform canvas ${actualType} ${getCommandVerb(action)} ${id}`;
3803
+ }
3804
+ function formatEntryTypeError(id, actualType, expectedType, action) {
3805
+ const actualDisplayName = getEntryDisplayNameWithArticle(actualType);
3806
+ const expectedDisplayName = getEntryDisplayNameWithArticle(expectedType);
3807
+ return `Error: The provided ID belongs to ${actualDisplayName}, not ${expectedDisplayName}.
3808
+ To ${action} ${actualDisplayName}, use: uniform canvas ${actualType} ${getCommandVerb(action)} ${id}`;
3809
+ }
3810
+
3815
3811
  // src/commands/canvas/commands/composition/get.ts
3812
+ function createCompositionGetHandler(expectedType) {
3813
+ return async ({
3814
+ apiHost,
3815
+ edgeApiHost,
3816
+ apiKey,
3817
+ proxy,
3818
+ id,
3819
+ format,
3820
+ filename,
3821
+ state,
3822
+ project: projectId,
3823
+ resolvePatterns,
3824
+ resolveOverrides,
3825
+ componentIDs,
3826
+ resolveData,
3827
+ diagnostics,
3828
+ resolutionDepth,
3829
+ verbose
3830
+ }) => {
3831
+ const parameters = {
3832
+ compositionId: id,
3833
+ state: convertStateOption(state),
3834
+ skipPatternResolution: !resolvePatterns,
3835
+ skipOverridesResolution: !resolveOverrides,
3836
+ withComponentIDs: componentIDs,
3837
+ skipDataResolution: !resolveData,
3838
+ diagnostics: resolveData ? diagnostics : void 0,
3839
+ resolutionDepth: resolveData ? resolutionDepth : void 0,
3840
+ withPatternType: true
3841
+ };
3842
+ if (verbose) {
3843
+ console.log(`\u{1F41B} get ${expectedType}:`, parameters);
3844
+ }
3845
+ const fetch2 = nodeFetchProxy(proxy, verbose);
3846
+ const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch2, projectId });
3847
+ const composition = await client.getCompositionById(parameters);
3848
+ const actualType = getCompositionActualType(composition);
3849
+ if (actualType !== expectedType) {
3850
+ console.error(formatCompositionTypeError(id, actualType, expectedType, "get"));
3851
+ process.exit(1);
3852
+ }
3853
+ const {
3854
+ // We fetch pattern type for type validation, but historically we did not include it in the payload so excluding for now
3855
+ patternType,
3856
+ ...rest
3857
+ } = composition;
3858
+ const res = prepCompositionForDisk(rest);
3859
+ emitWithFormat(res, format, filename);
3860
+ };
3861
+ }
3816
3862
  var CompositionGetModule = {
3817
3863
  command: "get <id>",
3818
3864
  describe: "Fetch a composition",
3819
- builder: (yargs42) => withFormatOptions(
3865
+ builder: (yargs43) => withFormatOptions(
3820
3866
  withConfiguration(
3821
3867
  withApiOptions(
3822
3868
  withProjectOptions(
3823
3869
  withStateOptions(
3824
3870
  withDebugOptions(
3825
- yargs42.positional("id", {
3871
+ yargs43.positional("id", {
3826
3872
  demandOption: true,
3827
- describe: "Composition/pattern public ID to fetch"
3873
+ describe: "Composition public ID to fetch"
3828
3874
  }).option({
3829
3875
  resolvePatterns: {
3830
3876
  type: "boolean",
@@ -3863,48 +3909,14 @@ var CompositionGetModule = {
3863
3909
  )
3864
3910
  )
3865
3911
  ),
3866
- handler: async ({
3867
- apiHost,
3868
- edgeApiHost,
3869
- apiKey,
3870
- proxy,
3871
- id,
3872
- format,
3873
- filename,
3874
- state,
3875
- project: projectId,
3876
- resolvePatterns,
3877
- resolveOverrides,
3878
- componentIDs,
3879
- resolveData,
3880
- diagnostics,
3881
- resolutionDepth,
3882
- verbose
3883
- }) => {
3884
- const parameters = {
3885
- compositionId: id,
3886
- state: convertStateOption(state),
3887
- skipPatternResolution: !resolvePatterns,
3888
- skipOverridesResolution: !resolveOverrides,
3889
- withComponentIDs: componentIDs,
3890
- skipDataResolution: !resolveData,
3891
- diagnostics: resolveData ? diagnostics : void 0,
3892
- resolutionDepth: resolveData ? resolutionDepth : void 0
3893
- };
3894
- if (verbose) {
3895
- console.log(`\u{1F41B} get composition:`, parameters);
3896
- }
3897
- const fetch2 = nodeFetchProxy(proxy, verbose);
3898
- const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch2, projectId });
3899
- const res = prepCompositionForDisk(await client.getCompositionById(parameters));
3900
- emitWithFormat(res, format, filename);
3901
- }
3912
+ handler: createCompositionGetHandler("composition")
3902
3913
  };
3903
3914
 
3904
3915
  // src/commands/canvas/commands/componentPattern/get.ts
3905
3916
  var ComponentPatternGetModule = {
3906
3917
  ...CompositionGetModule,
3907
- describe: "Fetch a component pattern"
3918
+ describe: "Fetch a component pattern",
3919
+ handler: createCompositionGetHandler("component-pattern")
3908
3920
  };
3909
3921
 
3910
3922
  // src/commands/canvas/commands/composition/list.ts
@@ -3912,13 +3924,13 @@ var CompositionListModule = {
3912
3924
  command: "list",
3913
3925
  describe: "List compositions",
3914
3926
  aliases: ["ls"],
3915
- builder: (yargs42) => withFormatOptions(
3927
+ builder: (yargs43) => withFormatOptions(
3916
3928
  withConfiguration(
3917
3929
  withApiOptions(
3918
3930
  withProjectOptions(
3919
3931
  withDebugOptions(
3920
3932
  withStateOptions(
3921
- yargs42.options({
3933
+ yargs43.options({
3922
3934
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3923
3935
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
3924
3936
  search: { describe: "Search query", type: "string", default: "" },
@@ -3999,13 +4011,13 @@ var CompositionListModule = {
3999
4011
  var ComponentPatternListModule = {
4000
4012
  ...CompositionListModule,
4001
4013
  describe: "List component patterns",
4002
- builder: (yargs42) => withFormatOptions(
4014
+ builder: (yargs43) => withFormatOptions(
4003
4015
  withConfiguration(
4004
4016
  withApiOptions(
4005
4017
  withDebugOptions(
4006
4018
  withProjectOptions(
4007
4019
  withStateOptions(
4008
- yargs42.options({
4020
+ yargs43.options({
4009
4021
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
4010
4022
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
4011
4023
  resolvePatterns: {
@@ -4128,12 +4140,12 @@ function createComponentInstanceEngineDataSource({
4128
4140
  var CompositionPublishModule = {
4129
4141
  command: "publish [ids]",
4130
4142
  describe: "Publishes composition(s)",
4131
- builder: (yargs42) => withConfiguration(
4143
+ builder: (yargs43) => withConfiguration(
4132
4144
  withApiOptions(
4133
4145
  withProjectOptions(
4134
4146
  withDebugOptions(
4135
4147
  withDiffOptions(
4136
- yargs42.positional("ids", {
4148
+ yargs43.positional("ids", {
4137
4149
  describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4138
4150
  type: "string"
4139
4151
  }).option("all", {
@@ -4226,12 +4238,12 @@ var CompositionPublishModule = {
4226
4238
  var ComponentPatternPublishModule = {
4227
4239
  ...CompositionPublishModule,
4228
4240
  describe: "Publishes component pattern(s)",
4229
- builder: (yargs42) => withConfiguration(
4241
+ builder: (yargs43) => withConfiguration(
4230
4242
  withApiOptions(
4231
4243
  withDebugOptions(
4232
4244
  withProjectOptions(
4233
4245
  withDiffOptions(
4234
- yargs42.positional("ids", {
4246
+ yargs43.positional("ids", {
4235
4247
  describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4236
4248
  type: "string"
4237
4249
  }).option("all", {
@@ -4271,13 +4283,13 @@ function componentInstancePullModuleFactory(type) {
4271
4283
  return {
4272
4284
  command: "pull <directory>",
4273
4285
  describe: "Pulls all compositions to local files in a directory",
4274
- builder: (yargs42) => withConfiguration(
4286
+ builder: (yargs43) => withConfiguration(
4275
4287
  withApiOptions(
4276
4288
  withProjectOptions(
4277
4289
  withStateOptions(
4278
4290
  withDebugOptions(
4279
4291
  withDiffOptions(
4280
- yargs42.positional("directory", {
4292
+ yargs43.positional("directory", {
4281
4293
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
4282
4294
  type: "string"
4283
4295
  }).option("format", {
@@ -4392,13 +4404,13 @@ function componentInstancePullModuleFactory(type) {
4392
4404
  var ComponentPatternPullModule = {
4393
4405
  ...componentInstancePullModuleFactory("componentPatterns"),
4394
4406
  describe: "Pulls all component patterns to local files in a directory",
4395
- builder: (yargs42) => withConfiguration(
4407
+ builder: (yargs43) => withConfiguration(
4396
4408
  withApiOptions(
4397
4409
  withProjectOptions(
4398
4410
  withDebugOptions(
4399
4411
  withStateOptions(
4400
4412
  withDiffOptions(
4401
- yargs42.positional("directory", {
4413
+ yargs43.positional("directory", {
4402
4414
  describe: "Directory to save the component definitions to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
4403
4415
  type: "string"
4404
4416
  }).option("format", {
@@ -4472,13 +4484,13 @@ function componentInstancePushModuleFactory(type) {
4472
4484
  return {
4473
4485
  command: "push <directory>",
4474
4486
  describe: "Pushes all compositions from files in a directory to Uniform Canvas",
4475
- builder: (yargs42) => withConfiguration(
4487
+ builder: (yargs43) => withConfiguration(
4476
4488
  withApiOptions(
4477
4489
  withProjectOptions(
4478
4490
  withStateOptions(
4479
4491
  withDebugOptions(
4480
4492
  withDiffOptions(
4481
- yargs42.positional("directory", {
4493
+ yargs43.positional("directory", {
4482
4494
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
4483
4495
  type: "string"
4484
4496
  }).option("mode", {
@@ -4592,13 +4604,13 @@ function componentInstancePushModuleFactory(type) {
4592
4604
  var ComponentPatternPushModule = {
4593
4605
  ...componentInstancePushModuleFactory("componentPatterns"),
4594
4606
  describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
4595
- builder: (yargs42) => withConfiguration(
4607
+ builder: (yargs43) => withConfiguration(
4596
4608
  withApiOptions(
4597
4609
  withProjectOptions(
4598
4610
  withStateOptions(
4599
4611
  withDiffOptions(
4600
4612
  withDebugOptions(
4601
- yargs42.positional("directory", {
4613
+ yargs43.positional("directory", {
4602
4614
  describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
4603
4615
  type: "string"
4604
4616
  }).option("mode", {
@@ -4628,40 +4640,61 @@ var ComponentPatternPushModule = {
4628
4640
  };
4629
4641
 
4630
4642
  // src/commands/canvas/commands/composition/remove.ts
4643
+ function createCompositionRemoveHandler(expectedType) {
4644
+ return async ({
4645
+ apiHost,
4646
+ apiKey,
4647
+ proxy,
4648
+ id,
4649
+ project: projectId,
4650
+ verbose,
4651
+ whatIf
4652
+ }) => {
4653
+ if (verbose) {
4654
+ console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
4655
+ }
4656
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4657
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4658
+ const validation = await validateCompositionType(client, id, expectedType);
4659
+ if (!validation.exists) {
4660
+ console.error(`Error: ${getCompositionDisplayName(expectedType)} with ID "${id}" not found.`);
4661
+ process.exit(1);
4662
+ }
4663
+ if (!validation.isValid) {
4664
+ console.error(formatCompositionTypeError(id, validation.actualType, expectedType, "delete"));
4665
+ process.exit(1);
4666
+ }
4667
+ if (!whatIf) {
4668
+ await client.removeComposition({ compositionId: id });
4669
+ } else {
4670
+ whatIfSimpleLog({ id, displayName: getCompositionDisplayName(expectedType), action: "delete" });
4671
+ }
4672
+ };
4673
+ }
4631
4674
  var CompositionRemoveModule = {
4632
4675
  command: "remove <id>",
4633
4676
  aliases: ["delete", "rm"],
4634
4677
  describe: "Delete a composition",
4635
- builder: (yargs42) => withConfiguration(
4678
+ builder: (yargs43) => withConfiguration(
4636
4679
  withApiOptions(
4637
4680
  withDebugOptions(
4638
4681
  withProjectOptions(
4639
- yargs42.positional("id", {
4682
+ yargs43.positional("id", {
4640
4683
  demandOption: true,
4641
- describe: "Composition/pattern public ID to delete"
4684
+ describe: "Composition public ID to delete"
4642
4685
  })
4643
4686
  )
4644
4687
  )
4645
4688
  )
4646
4689
  ),
4647
- handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
4648
- if (verbose) {
4649
- console.log(`\u{1F41B} remove composition: (id: ${id})`);
4650
- }
4651
- const fetch2 = nodeFetchProxy(proxy, verbose);
4652
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4653
- if (!whatIf) {
4654
- await client.removeComposition({ compositionId: id });
4655
- } else {
4656
- whatIfSimpleLog({ id, displayName: `Composition`, action: "delete" });
4657
- }
4658
- }
4690
+ handler: createCompositionRemoveHandler("composition")
4659
4691
  };
4660
4692
 
4661
4693
  // src/commands/canvas/commands/componentPattern/remove.ts
4662
4694
  var ComponentPatternRemoveModule = {
4663
4695
  ...CompositionRemoveModule,
4664
- describe: "Delete a component pattern"
4696
+ describe: "Delete a component pattern",
4697
+ handler: createCompositionRemoveHandler("component-pattern")
4665
4698
  };
4666
4699
 
4667
4700
  // src/commands/canvas/commands/composition/unpublish.ts
@@ -4673,11 +4706,11 @@ import { diffJson as diffJson2 } from "diff";
4673
4706
  var CompositionUnpublishModule = {
4674
4707
  command: "unpublish [ids]",
4675
4708
  describe: "Unpublish a composition(s)",
4676
- builder: (yargs42) => withConfiguration(
4709
+ builder: (yargs43) => withConfiguration(
4677
4710
  withApiOptions(
4678
4711
  withDebugOptions(
4679
4712
  withProjectOptions(
4680
- yargs42.positional("ids", {
4713
+ yargs43.positional("ids", {
4681
4714
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4682
4715
  type: "string"
4683
4716
  }).option("all", {
@@ -4788,11 +4821,11 @@ var CompositionUnpublishModule = {
4788
4821
  var ComponentPatternUnpublishModule = {
4789
4822
  command: "unpublish [ids]",
4790
4823
  describe: "Unpublish a component pattern(s)",
4791
- builder: (yargs42) => withConfiguration(
4824
+ builder: (yargs43) => withConfiguration(
4792
4825
  withApiOptions(
4793
4826
  withDebugOptions(
4794
4827
  withProjectOptions(
4795
- yargs42.positional("ids", {
4828
+ yargs43.positional("ids", {
4796
4829
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4797
4830
  type: "string"
4798
4831
  }).option("all", {
@@ -4822,16 +4855,50 @@ var ComponentPatternUnpublishModule = {
4822
4855
  };
4823
4856
 
4824
4857
  // src/commands/canvas/commands/composition/update.ts
4858
+ function createCompositionUpdateHandler(expectedType) {
4859
+ return async ({
4860
+ apiHost,
4861
+ apiKey,
4862
+ proxy,
4863
+ filename,
4864
+ project: projectId,
4865
+ state,
4866
+ verbose,
4867
+ whatIf
4868
+ }) => {
4869
+ if (verbose) {
4870
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
4871
+ }
4872
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4873
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4874
+ const file = readFileToObject(filename);
4875
+ const id = file.composition._id;
4876
+ const validation = await validateCompositionType(client, id, expectedType);
4877
+ if (validation.exists && !validation.isValid) {
4878
+ console.error(formatCompositionTypeError(id, validation.actualType, expectedType, "update"));
4879
+ process.exit(1);
4880
+ }
4881
+ if (!whatIf) {
4882
+ await client.updateComposition({ ...file, state: convertStateOption(state) });
4883
+ } else {
4884
+ whatIfSimpleLog({
4885
+ id,
4886
+ displayName: `${getCompositionDisplayName(expectedType)}: ${file.composition._name}`,
4887
+ action: "update"
4888
+ });
4889
+ }
4890
+ };
4891
+ }
4825
4892
  var CompositionUpdateModule = {
4826
4893
  command: "update <filename>",
4827
4894
  aliases: ["put"],
4828
4895
  describe: "Insert or update a composition",
4829
- builder: (yargs42) => withConfiguration(
4896
+ builder: (yargs43) => withConfiguration(
4830
4897
  withApiOptions(
4831
4898
  withProjectOptions(
4832
4899
  withDebugOptions(
4833
4900
  withStateOptions(
4834
- yargs42.positional("filename", {
4901
+ yargs43.positional("filename", {
4835
4902
  demandOption: true,
4836
4903
  describe: "Composition/pattern file to put"
4837
4904
  })
@@ -4840,36 +4907,21 @@ var CompositionUpdateModule = {
4840
4907
  )
4841
4908
  )
4842
4909
  ),
4843
- handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, state, verbose, whatIf }) => {
4844
- if (verbose) {
4845
- console.log(`\u{1F41B} update composition: (filename: ${filename}, state: ${convertStateOption(state)})`);
4846
- }
4847
- const fetch2 = nodeFetchProxy(proxy, verbose);
4848
- const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4849
- const file = readFileToObject(filename);
4850
- if (!whatIf) {
4851
- await client.updateComposition({ ...file, state: convertStateOption(state) });
4852
- } else {
4853
- whatIfSimpleLog({
4854
- id: file.composition._id,
4855
- displayName: `Composition: ${file.composition._name}`,
4856
- action: "update"
4857
- });
4858
- }
4859
- }
4910
+ handler: createCompositionUpdateHandler("composition")
4860
4911
  };
4861
4912
 
4862
4913
  // src/commands/canvas/commands/componentPattern/update.ts
4863
4914
  var ComponentPatternUpdateModule = {
4864
4915
  ...CompositionUpdateModule,
4865
- describe: "Insert or update a component pattern"
4916
+ describe: "Insert or update a component pattern",
4917
+ handler: createCompositionUpdateHandler("component-pattern")
4866
4918
  };
4867
4919
 
4868
4920
  // src/commands/canvas/commands/componentPattern.ts
4869
4921
  var ComponentPatternModule = {
4870
4922
  command: "component-pattern <command>",
4871
4923
  describe: "Commands for Canvas component patterns",
4872
- builder: (yargs42) => yargs42.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
4924
+ builder: (yargs43) => yargs43.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
4873
4925
  handler: () => {
4874
4926
  yargs7.help();
4875
4927
  }
@@ -4881,7 +4933,7 @@ var CompositionModule = {
4881
4933
  command: "composition <command>",
4882
4934
  describe: "Commands for Canvas compositions",
4883
4935
  aliases: ["comp"],
4884
- builder: (yargs42) => yargs42.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
4936
+ builder: (yargs43) => yargs43.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
4885
4937
  handler: () => {
4886
4938
  yargs8.help();
4887
4939
  }
@@ -4893,20 +4945,21 @@ import yargs9 from "yargs";
4893
4945
  // src/commands/canvas/commands/compositionPattern/get.ts
4894
4946
  var CompositionPatternGetModule = {
4895
4947
  ...CompositionGetModule,
4896
- describe: "Fetch a composition pattern"
4948
+ describe: "Fetch a composition pattern",
4949
+ handler: createCompositionGetHandler("composition-pattern")
4897
4950
  };
4898
4951
 
4899
4952
  // src/commands/canvas/commands/compositionPattern/list.ts
4900
4953
  var CompositionPatternListModule = {
4901
4954
  ...CompositionListModule,
4902
4955
  describe: "List composition patterns",
4903
- builder: (yargs42) => withFormatOptions(
4956
+ builder: (yargs43) => withFormatOptions(
4904
4957
  withConfiguration(
4905
4958
  withApiOptions(
4906
4959
  withDebugOptions(
4907
4960
  withProjectOptions(
4908
4961
  withStateOptions(
4909
- yargs42.options({
4962
+ yargs43.options({
4910
4963
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
4911
4964
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
4912
4965
  resolvePatterns: {
@@ -4950,12 +5003,12 @@ var CompositionPatternListModule = {
4950
5003
  var CompositionPatternPublishModule = {
4951
5004
  ...CompositionPublishModule,
4952
5005
  describe: "Publishes composition pattern(s)",
4953
- builder: (yargs42) => withConfiguration(
5006
+ builder: (yargs43) => withConfiguration(
4954
5007
  withApiOptions(
4955
5008
  withDebugOptions(
4956
5009
  withProjectOptions(
4957
5010
  withDiffOptions(
4958
- yargs42.positional("ids", {
5011
+ yargs43.positional("ids", {
4959
5012
  describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4960
5013
  type: "string"
4961
5014
  }).option("all", {
@@ -4994,13 +5047,13 @@ var CompositionPatternPublishModule = {
4994
5047
  var CompositionPatternPullModule = {
4995
5048
  ...componentInstancePullModuleFactory("compositionPatterns"),
4996
5049
  describe: "Pulls all composition patterns to local files in a directory",
4997
- builder: (yargs42) => withConfiguration(
5050
+ builder: (yargs43) => withConfiguration(
4998
5051
  withApiOptions(
4999
5052
  withDebugOptions(
5000
5053
  withProjectOptions(
5001
5054
  withStateOptions(
5002
5055
  withDiffOptions(
5003
- yargs42.positional("directory", {
5056
+ yargs43.positional("directory", {
5004
5057
  describe: "Directory to save the composition patterns to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
5005
5058
  type: "string"
5006
5059
  }).option("format", {
@@ -5038,13 +5091,13 @@ var CompositionPatternPullModule = {
5038
5091
  var CompositionPatternPushModule = {
5039
5092
  ...componentInstancePushModuleFactory("compositionPatterns"),
5040
5093
  describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
5041
- builder: (yargs42) => withConfiguration(
5094
+ builder: (yargs43) => withConfiguration(
5042
5095
  withApiOptions(
5043
5096
  withDebugOptions(
5044
5097
  withProjectOptions(
5045
5098
  withStateOptions(
5046
5099
  withDiffOptions(
5047
- yargs42.positional("directory", {
5100
+ yargs43.positional("directory", {
5048
5101
  describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
5049
5102
  type: "string"
5050
5103
  }).option("mode", {
@@ -5076,18 +5129,19 @@ var CompositionPatternPushModule = {
5076
5129
  // src/commands/canvas/commands/compositionPattern/remove.ts
5077
5130
  var CompositionPatternRemoveModule = {
5078
5131
  ...CompositionRemoveModule,
5079
- describe: "Delete a composition pattern"
5132
+ describe: "Delete a composition pattern",
5133
+ handler: createCompositionRemoveHandler("composition-pattern")
5080
5134
  };
5081
5135
 
5082
5136
  // src/commands/canvas/commands/compositionPattern/unpublish.ts
5083
5137
  var CompositionPatternUnpublishModule = {
5084
5138
  command: "unpublish [ids]",
5085
5139
  describe: "Unpublish a composition pattern(s)",
5086
- builder: (yargs42) => withConfiguration(
5140
+ builder: (yargs43) => withConfiguration(
5087
5141
  withApiOptions(
5088
5142
  withDebugOptions(
5089
5143
  withProjectOptions(
5090
- yargs42.positional("ids", {
5144
+ yargs43.positional("ids", {
5091
5145
  describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
5092
5146
  type: "string"
5093
5147
  }).option("all", {
@@ -5116,14 +5170,15 @@ var CompositionPatternUnpublishModule = {
5116
5170
  // src/commands/canvas/commands/compositionPattern/update.ts
5117
5171
  var CompositionPatternUpdateModule = {
5118
5172
  ...CompositionUpdateModule,
5119
- describe: "Insert or update a composition pattern"
5173
+ describe: "Insert or update a composition pattern",
5174
+ handler: createCompositionUpdateHandler("composition-pattern")
5120
5175
  };
5121
5176
 
5122
5177
  // src/commands/canvas/commands/compositionPattern.ts
5123
5178
  var CompositionPatternModule = {
5124
5179
  command: "composition-pattern <command>",
5125
5180
  describe: "Commands for Canvas composition patterns",
5126
- builder: (yargs42) => yargs42.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
5181
+ builder: (yargs43) => yargs43.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
5127
5182
  handler: () => {
5128
5183
  yargs9.help();
5129
5184
  }
@@ -5144,12 +5199,12 @@ function getContentClient(options) {
5144
5199
  var ContentTypeGetModule = {
5145
5200
  command: "get <id>",
5146
5201
  describe: "Get a content type",
5147
- builder: (yargs42) => withConfiguration(
5202
+ builder: (yargs43) => withConfiguration(
5148
5203
  withDebugOptions(
5149
5204
  withFormatOptions(
5150
5205
  withApiOptions(
5151
5206
  withProjectOptions(
5152
- yargs42.positional("id", {
5207
+ yargs43.positional("id", {
5153
5208
  demandOption: true,
5154
5209
  describe: "Content type public ID to fetch"
5155
5210
  })
@@ -5174,7 +5229,7 @@ var ContentTypeGetModule = {
5174
5229
  var ContentTypeListModule = {
5175
5230
  command: "list",
5176
5231
  describe: "List content types",
5177
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5232
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
5178
5233
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5179
5234
  const fetch2 = nodeFetchProxy(proxy, verbose);
5180
5235
  const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5215,12 +5270,12 @@ function createContentTypeEngineDataSource({
5215
5270
  var ContentTypePullModule = {
5216
5271
  command: "pull <directory>",
5217
5272
  describe: "Pulls all content types to local files in a directory",
5218
- builder: (yargs42) => withConfiguration(
5273
+ builder: (yargs43) => withConfiguration(
5219
5274
  withApiOptions(
5220
5275
  withDebugOptions(
5221
5276
  withProjectOptions(
5222
5277
  withDiffOptions(
5223
- yargs42.positional("directory", {
5278
+ yargs43.positional("directory", {
5224
5279
  describe: "Directory to save the content types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
5225
5280
  type: "string"
5226
5281
  }).option("format", {
@@ -5300,12 +5355,12 @@ var ContentTypePullModule = {
5300
5355
  var ContentTypePushModule = {
5301
5356
  command: "push <directory>",
5302
5357
  describe: "Pushes all content types from files in a directory to Uniform",
5303
- builder: (yargs42) => withConfiguration(
5358
+ builder: (yargs43) => withConfiguration(
5304
5359
  withApiOptions(
5305
5360
  withDebugOptions(
5306
5361
  withProjectOptions(
5307
5362
  withDiffOptions(
5308
- yargs42.positional("directory", {
5363
+ yargs43.positional("directory", {
5309
5364
  describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
5310
5365
  type: "string"
5311
5366
  }).option("what-if", {
@@ -5379,11 +5434,11 @@ var ContentTypeRemoveModule = {
5379
5434
  command: "remove <id>",
5380
5435
  aliases: ["delete", "rm"],
5381
5436
  describe: "Delete a content type",
5382
- builder: (yargs42) => withConfiguration(
5437
+ builder: (yargs43) => withConfiguration(
5383
5438
  withDebugOptions(
5384
5439
  withApiOptions(
5385
5440
  withProjectOptions(
5386
- yargs42.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5441
+ yargs43.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5387
5442
  )
5388
5443
  )
5389
5444
  )
@@ -5404,11 +5459,11 @@ var ContentTypeUpdateModule = {
5404
5459
  command: "update <filename>",
5405
5460
  aliases: ["put"],
5406
5461
  describe: "Insert or update a content type",
5407
- builder: (yargs42) => withConfiguration(
5462
+ builder: (yargs43) => withConfiguration(
5408
5463
  withDebugOptions(
5409
5464
  withApiOptions(
5410
5465
  withProjectOptions(
5411
- yargs42.positional("filename", { demandOption: true, describe: "Content type file to put" })
5466
+ yargs43.positional("filename", { demandOption: true, describe: "Content type file to put" })
5412
5467
  )
5413
5468
  )
5414
5469
  )
@@ -5430,7 +5485,7 @@ var ContentTypeModule = {
5430
5485
  command: "contenttype <command>",
5431
5486
  aliases: ["ct"],
5432
5487
  describe: "Commands for Content Types",
5433
- builder: (yargs42) => yargs42.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5488
+ builder: (yargs43) => yargs43.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5434
5489
  handler: () => {
5435
5490
  yargs10.help();
5436
5491
  }
@@ -5449,11 +5504,11 @@ function getDataSourceClient(options) {
5449
5504
  var DataSourceGetModule = {
5450
5505
  command: "get <id>",
5451
5506
  describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
5452
- builder: (yargs42) => withConfiguration(
5507
+ builder: (yargs43) => withConfiguration(
5453
5508
  withApiOptions(
5454
5509
  withDebugOptions(
5455
5510
  withProjectOptions(
5456
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5511
+ yargs43.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5457
5512
  )
5458
5513
  )
5459
5514
  )
@@ -5471,11 +5526,11 @@ var DataSourceRemoveModule = {
5471
5526
  command: "remove <id>",
5472
5527
  aliases: ["delete", "rm"],
5473
5528
  describe: "Delete a data source",
5474
- builder: (yargs42) => withConfiguration(
5529
+ builder: (yargs43) => withConfiguration(
5475
5530
  withDebugOptions(
5476
5531
  withApiOptions(
5477
5532
  withProjectOptions(
5478
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5533
+ yargs43.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5479
5534
  )
5480
5535
  )
5481
5536
  )
@@ -5496,11 +5551,11 @@ var DataSourceUpdateModule = {
5496
5551
  command: "update <dataSource>",
5497
5552
  aliases: ["put"],
5498
5553
  describe: "Insert or update a data source",
5499
- builder: (yargs42) => withConfiguration(
5554
+ builder: (yargs43) => withConfiguration(
5500
5555
  withApiOptions(
5501
5556
  withDebugOptions(
5502
5557
  withProjectOptions(
5503
- yargs42.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5558
+ yargs43.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5504
5559
  describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
5505
5560
  type: "string",
5506
5561
  demandOption: true
@@ -5535,7 +5590,7 @@ var DataSourceModule = {
5535
5590
  command: "datasource <command>",
5536
5591
  aliases: ["ds"],
5537
5592
  describe: "Commands for Data Source definitions",
5538
- builder: (yargs42) => yargs42.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5593
+ builder: (yargs43) => yargs43.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5539
5594
  handler: () => {
5540
5595
  yargs11.help();
5541
5596
  }
@@ -5557,12 +5612,12 @@ var DataTypeGetModule = {
5557
5612
  command: "get <id>",
5558
5613
  describe: "Get a data type",
5559
5614
  aliases: ["ls"],
5560
- builder: (yargs42) => withConfiguration(
5615
+ builder: (yargs43) => withConfiguration(
5561
5616
  withFormatOptions(
5562
5617
  withDebugOptions(
5563
5618
  withApiOptions(
5564
5619
  withProjectOptions(
5565
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5620
+ yargs43.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5566
5621
  )
5567
5622
  )
5568
5623
  )
@@ -5585,7 +5640,7 @@ var DataTypeListModule = {
5585
5640
  command: "list",
5586
5641
  describe: "List data types",
5587
5642
  aliases: ["ls"],
5588
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5643
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
5589
5644
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5590
5645
  const fetch2 = nodeFetchProxy(proxy, verbose);
5591
5646
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5628,12 +5683,12 @@ function createDataTypeEngineDataSource({
5628
5683
  var DataTypePullModule = {
5629
5684
  command: "pull <directory>",
5630
5685
  describe: "Pulls all data types to local files in a directory",
5631
- builder: (yargs42) => withConfiguration(
5686
+ builder: (yargs43) => withConfiguration(
5632
5687
  withApiOptions(
5633
5688
  withDebugOptions(
5634
5689
  withProjectOptions(
5635
5690
  withDiffOptions(
5636
- yargs42.positional("directory", {
5691
+ yargs43.positional("directory", {
5637
5692
  describe: "Directory to save the data types to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
5638
5693
  type: "string"
5639
5694
  }).option("format", {
@@ -5713,12 +5768,12 @@ var DataTypePullModule = {
5713
5768
  var DataTypePushModule = {
5714
5769
  command: "push <directory>",
5715
5770
  describe: "Pushes all data types from files in a directory to Uniform",
5716
- builder: (yargs42) => withConfiguration(
5771
+ builder: (yargs43) => withConfiguration(
5717
5772
  withApiOptions(
5718
5773
  withDebugOptions(
5719
5774
  withProjectOptions(
5720
5775
  withDiffOptions(
5721
- yargs42.positional("directory", {
5776
+ yargs43.positional("directory", {
5722
5777
  describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
5723
5778
  type: "string"
5724
5779
  }).option("mode", {
@@ -5787,11 +5842,11 @@ var DataTypeRemoveModule = {
5787
5842
  command: "remove <id>",
5788
5843
  aliases: ["delete", "rm"],
5789
5844
  describe: "Delete a data type",
5790
- builder: (yargs42) => withConfiguration(
5845
+ builder: (yargs43) => withConfiguration(
5791
5846
  withDebugOptions(
5792
5847
  withApiOptions(
5793
5848
  withProjectOptions(
5794
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
5849
+ yargs43.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
5795
5850
  )
5796
5851
  )
5797
5852
  )
@@ -5812,11 +5867,11 @@ var DataTypeUpdateModule = {
5812
5867
  command: "update <filename>",
5813
5868
  aliases: ["put"],
5814
5869
  describe: "Insert or update a data type",
5815
- builder: (yargs42) => withConfiguration(
5870
+ builder: (yargs43) => withConfiguration(
5816
5871
  withDebugOptions(
5817
5872
  withApiOptions(
5818
5873
  withProjectOptions(
5819
- yargs42.positional("filename", { demandOption: true, describe: "Data type file to put" })
5874
+ yargs43.positional("filename", { demandOption: true, describe: "Data type file to put" })
5820
5875
  )
5821
5876
  )
5822
5877
  )
@@ -5838,7 +5893,7 @@ var DataTypeModule = {
5838
5893
  command: "datatype <command>",
5839
5894
  aliases: ["dt"],
5840
5895
  describe: "Commands for Data Type definitions",
5841
- builder: (yargs42) => yargs42.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
5896
+ builder: (yargs43) => yargs43.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
5842
5897
  handler: () => {
5843
5898
  yargs12.help();
5844
5899
  }
@@ -5848,16 +5903,64 @@ var DataTypeModule = {
5848
5903
  import yargs13 from "yargs";
5849
5904
 
5850
5905
  // src/commands/canvas/commands/entry/get.ts
5906
+ function createEntryGetHandler(expectedType) {
5907
+ return async ({
5908
+ apiHost,
5909
+ edgeApiHost,
5910
+ apiKey,
5911
+ proxy,
5912
+ id,
5913
+ format,
5914
+ filename,
5915
+ project: projectId,
5916
+ state,
5917
+ resolveData,
5918
+ diagnostics,
5919
+ resolutionDepth,
5920
+ withComponentIDs,
5921
+ verbose
5922
+ }) => {
5923
+ if (verbose) {
5924
+ console.log(`\u{1F41B} get ${expectedType}: (id: ${id})`);
5925
+ }
5926
+ const fetch2 = nodeFetchProxy(proxy, verbose);
5927
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
5928
+ const res = await client.getEntries({
5929
+ offset: 0,
5930
+ limit: 1,
5931
+ entryIDs: [id],
5932
+ state: convertStateOption(state),
5933
+ skipOverridesResolution: true,
5934
+ skipPatternResolution: true,
5935
+ skipDataResolution: !resolveData,
5936
+ diagnostics: resolveData ? diagnostics : void 0,
5937
+ resolutionDepth: resolveData ? resolutionDepth : void 0,
5938
+ withComponentIDs,
5939
+ pattern: expectedType === "entry-pattern" ? true : void 0
5940
+ });
5941
+ if (res.entries.length !== 1) {
5942
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
5943
+ process.exit(1);
5944
+ }
5945
+ const entry = res.entries[0];
5946
+ const actualType = getEntryActualType(entry);
5947
+ if (actualType !== expectedType) {
5948
+ console.error(formatEntryTypeError(id, actualType, expectedType, "get"));
5949
+ process.exit(1);
5950
+ }
5951
+ emitWithFormat(entry, format, filename);
5952
+ };
5953
+ }
5851
5954
  var EntryGetModule = {
5852
5955
  command: "get <id>",
5853
5956
  describe: "Get an entry",
5854
- builder: (yargs42) => withConfiguration(
5957
+ builder: (yargs43) => withConfiguration(
5855
5958
  withDebugOptions(
5856
5959
  withFormatOptions(
5857
5960
  withApiOptions(
5858
5961
  withProjectOptions(
5859
5962
  withStateOptions(
5860
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
5963
+ yargs43.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
5861
5964
  resolveData: {
5862
5965
  type: "boolean",
5863
5966
  default: false,
@@ -5887,41 +5990,7 @@ var EntryGetModule = {
5887
5990
  )
5888
5991
  )
5889
5992
  ),
5890
- handler: async ({
5891
- apiHost,
5892
- edgeApiHost,
5893
- apiKey,
5894
- proxy,
5895
- id,
5896
- format,
5897
- filename,
5898
- project: projectId,
5899
- state,
5900
- resolveData,
5901
- diagnostics,
5902
- resolutionDepth,
5903
- withComponentIDs,
5904
- verbose
5905
- }) => {
5906
- const fetch2 = nodeFetchProxy(proxy, verbose);
5907
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
5908
- const res = await client.getEntries({
5909
- offset: 0,
5910
- limit: 1,
5911
- entryIDs: [id],
5912
- state: convertStateOption(state),
5913
- skipOverridesResolution: true,
5914
- skipPatternResolution: true,
5915
- skipDataResolution: !resolveData,
5916
- diagnostics: resolveData ? diagnostics : void 0,
5917
- resolutionDepth: resolveData ? resolutionDepth : void 0,
5918
- withComponentIDs
5919
- });
5920
- if (res.entries.length !== 1) {
5921
- throw new Error(`Entry with ID ${id} not found`);
5922
- }
5923
- emitWithFormat(res.entries[0], format, filename);
5924
- }
5993
+ handler: createEntryGetHandler("entry")
5925
5994
  };
5926
5995
 
5927
5996
  // src/commands/canvas/commands/entry/list.ts
@@ -5929,13 +5998,13 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
5929
5998
  var EntryListModule = {
5930
5999
  command: "list",
5931
6000
  describe: "List entries",
5932
- builder: (yargs42) => withConfiguration(
6001
+ builder: (yargs43) => withConfiguration(
5933
6002
  withDebugOptions(
5934
6003
  withFormatOptions(
5935
6004
  withApiOptions(
5936
6005
  withProjectOptions(
5937
6006
  withStateOptions(
5938
- yargs42.options({
6007
+ yargs43.options({
5939
6008
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
5940
6009
  limit: {
5941
6010
  describe: "Number of rows to fetch",
@@ -6070,12 +6139,12 @@ function createEntryEngineDataSource({
6070
6139
  var EntryPublishModule = {
6071
6140
  command: "publish [ids]",
6072
6141
  describe: "Publishes entry(ies)",
6073
- builder: (yargs42) => withConfiguration(
6142
+ builder: (yargs43) => withConfiguration(
6074
6143
  withDebugOptions(
6075
6144
  withDiffOptions(
6076
6145
  withApiOptions(
6077
6146
  withProjectOptions(
6078
- yargs42.positional("ids", {
6147
+ yargs43.positional("ids", {
6079
6148
  describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6080
6149
  type: "string"
6081
6150
  }).option("all", {
@@ -6150,13 +6219,13 @@ var EntryPublishModule = {
6150
6219
  var EntryPullModule = {
6151
6220
  command: "pull <directory>",
6152
6221
  describe: "Pulls all entries to local files in a directory",
6153
- builder: (yargs42) => withConfiguration(
6222
+ builder: (yargs43) => withConfiguration(
6154
6223
  withDebugOptions(
6155
6224
  withApiOptions(
6156
6225
  withProjectOptions(
6157
6226
  withStateOptions(
6158
6227
  withDiffOptions(
6159
- yargs42.positional("directory", {
6228
+ yargs43.positional("directory", {
6160
6229
  describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
6161
6230
  type: "string"
6162
6231
  }).option("format", {
@@ -6256,13 +6325,13 @@ var EntryPullModule = {
6256
6325
  var EntryPushModule = {
6257
6326
  command: "push <directory>",
6258
6327
  describe: "Pushes all entries from files in a directory to Uniform",
6259
- builder: (yargs42) => withConfiguration(
6328
+ builder: (yargs43) => withConfiguration(
6260
6329
  withDebugOptions(
6261
6330
  withApiOptions(
6262
6331
  withProjectOptions(
6263
6332
  withStateOptions(
6264
6333
  withDiffOptions(
6265
- yargs42.positional("directory", {
6334
+ yargs43.positional("directory", {
6266
6335
  describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
6267
6336
  type: "string"
6268
6337
  }).option("mode", {
@@ -6357,28 +6426,51 @@ var EntryPushModule = {
6357
6426
  };
6358
6427
 
6359
6428
  // src/commands/canvas/commands/entry/remove.ts
6429
+ function createEntryRemoveHandler(expectedType) {
6430
+ return async ({
6431
+ apiHost,
6432
+ apiKey,
6433
+ proxy,
6434
+ id,
6435
+ project: projectId,
6436
+ verbose,
6437
+ whatIf
6438
+ }) => {
6439
+ if (verbose) {
6440
+ console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
6441
+ }
6442
+ const fetch2 = nodeFetchProxy(proxy, verbose);
6443
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6444
+ const validation = await validateEntryType(client, id, expectedType);
6445
+ if (!validation.exists) {
6446
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
6447
+ process.exit(1);
6448
+ }
6449
+ if (!validation.isValid) {
6450
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "delete"));
6451
+ process.exit(1);
6452
+ }
6453
+ if (!whatIf) {
6454
+ await client.deleteEntry({ entryId: id });
6455
+ } else {
6456
+ whatIfSimpleLog({ id, displayName: getEntryDisplayName(expectedType), action: "delete" });
6457
+ }
6458
+ };
6459
+ }
6360
6460
  var EntryRemoveModule = {
6361
6461
  command: "remove <id>",
6362
6462
  aliases: ["delete", "rm"],
6363
6463
  describe: "Delete an entry",
6364
- builder: (yargs42) => withConfiguration(
6464
+ builder: (yargs43) => withConfiguration(
6365
6465
  withDebugOptions(
6366
6466
  withApiOptions(
6367
6467
  withProjectOptions(
6368
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6468
+ yargs43.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6369
6469
  )
6370
6470
  )
6371
6471
  )
6372
6472
  ),
6373
- handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
6374
- const fetch2 = nodeFetchProxy(proxy, verbose);
6375
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6376
- if (!whatIf) {
6377
- await client.deleteEntry({ entryId: id });
6378
- } else {
6379
- whatIfSimpleLog({ id, displayName: `Entry`, action: "delete" });
6380
- }
6381
- }
6473
+ handler: createEntryRemoveHandler("entry")
6382
6474
  };
6383
6475
 
6384
6476
  // src/commands/canvas/commands/entry/unpublish.ts
@@ -6387,11 +6479,11 @@ import { diffJson as diffJson3 } from "diff";
6387
6479
  var EntryUnpublishModule = {
6388
6480
  command: "unpublish [ids]",
6389
6481
  describe: "Unpublish an entry(ies)",
6390
- builder: (yargs42) => withConfiguration(
6482
+ builder: (yargs43) => withConfiguration(
6391
6483
  withDebugOptions(
6392
6484
  withApiOptions(
6393
6485
  withProjectOptions(
6394
- yargs42.positional("ids", {
6486
+ yargs43.positional("ids", {
6395
6487
  describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6396
6488
  type: "string"
6397
6489
  }).option("all", {
@@ -6472,22 +6564,8 @@ var EntryUnpublishModule = {
6472
6564
  };
6473
6565
 
6474
6566
  // src/commands/canvas/commands/entry/update.ts
6475
- var EntryUpdateModule = {
6476
- command: "update <filename>",
6477
- aliases: ["put"],
6478
- describe: "Insert or update an entry",
6479
- builder: (yargs42) => withConfiguration(
6480
- withDebugOptions(
6481
- withApiOptions(
6482
- withProjectOptions(
6483
- withStateOptions(
6484
- yargs42.positional("filename", { demandOption: true, describe: "Entry file to put" })
6485
- )
6486
- )
6487
- )
6488
- )
6489
- ),
6490
- handler: async ({
6567
+ function createEntryUpdateHandler(expectedType) {
6568
+ return async ({
6491
6569
  apiHost,
6492
6570
  edgeApiHost,
6493
6571
  apiKey,
@@ -6498,22 +6576,52 @@ var EntryUpdateModule = {
6498
6576
  verbose,
6499
6577
  whatIf
6500
6578
  }) => {
6579
+ if (verbose) {
6580
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
6581
+ }
6501
6582
  const fetch2 = nodeFetchProxy(proxy, verbose);
6502
6583
  const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6503
6584
  const file = readFileToObject(filename);
6585
+ const id = file.entry._id;
6586
+ const validation = await validateEntryType(client, id, expectedType);
6587
+ if (validation.exists && !validation.isValid) {
6588
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "update"));
6589
+ process.exit(1);
6590
+ }
6504
6591
  if (!whatIf) {
6505
6592
  await client.upsertEntry({ ...file, state: convertStateOption(state) });
6506
6593
  } else {
6507
- whatIfSimpleLog({ id: file.entry._id, displayName: `Entry: ${file.entry._name}`, action: "update" });
6594
+ whatIfSimpleLog({
6595
+ id,
6596
+ displayName: `${getEntryDisplayName(expectedType)}: ${file.entry._name}`,
6597
+ action: "update"
6598
+ });
6508
6599
  }
6509
- }
6600
+ };
6601
+ }
6602
+ var EntryUpdateModule = {
6603
+ command: "update <filename>",
6604
+ aliases: ["put"],
6605
+ describe: "Insert or update an entry",
6606
+ builder: (yargs43) => withConfiguration(
6607
+ withDebugOptions(
6608
+ withApiOptions(
6609
+ withProjectOptions(
6610
+ withStateOptions(
6611
+ yargs43.positional("filename", { demandOption: true, describe: "Entry file to put" })
6612
+ )
6613
+ )
6614
+ )
6615
+ )
6616
+ ),
6617
+ handler: createEntryUpdateHandler("entry")
6510
6618
  };
6511
6619
 
6512
6620
  // src/commands/canvas/commands/entry.ts
6513
6621
  var EntryModule = {
6514
6622
  command: "entry <command>",
6515
6623
  describe: "Commands for Entries",
6516
- builder: (yargs42) => yargs42.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
6624
+ builder: (yargs43) => yargs43.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
6517
6625
  handler: () => {
6518
6626
  yargs13.help();
6519
6627
  }
@@ -6526,16 +6634,28 @@ import yargs14 from "yargs";
6526
6634
  var EntryPatternGetModule = {
6527
6635
  command: "get <id>",
6528
6636
  describe: "Get an entry pattern",
6529
- builder: (yargs42) => withConfiguration(
6637
+ builder: (yargs43) => withConfiguration(
6530
6638
  withDebugOptions(
6531
6639
  withFormatOptions(
6532
6640
  withApiOptions(
6533
6641
  withProjectOptions(
6534
6642
  withStateOptions(
6535
- yargs42.positional("id", {
6536
- demandOption: true,
6537
- describe: "Entry pattern public ID to fetch"
6538
- }).option({
6643
+ yargs43.positional("id", { demandOption: true, describe: "Entry pattern public ID to fetch" }).option({
6644
+ resolveData: {
6645
+ type: "boolean",
6646
+ default: false,
6647
+ describe: "Resolve all data resources used by the entry pattern"
6648
+ },
6649
+ diagnostics: {
6650
+ type: "boolean",
6651
+ default: false,
6652
+ describe: "Include diagnostics information when resolving data"
6653
+ },
6654
+ resolutionDepth: {
6655
+ type: "number",
6656
+ default: 1,
6657
+ describe: "Controls how many levels deep content references should be resolved"
6658
+ },
6539
6659
  withComponentIDs: {
6540
6660
  type: "boolean",
6541
6661
  default: false,
@@ -6549,49 +6669,20 @@ var EntryPatternGetModule = {
6549
6669
  )
6550
6670
  )
6551
6671
  ),
6552
- handler: async ({
6553
- apiHost,
6554
- apiKey,
6555
- proxy,
6556
- id,
6557
- format,
6558
- filename,
6559
- project: projectId,
6560
- state,
6561
- withComponentIDs,
6562
- verbose
6563
- }) => {
6564
- const fetch2 = nodeFetchProxy(proxy, verbose);
6565
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6566
- const res = await client.getEntries({
6567
- offset: 0,
6568
- limit: 1,
6569
- entryIDs: [id],
6570
- state: convertStateOption(state),
6571
- skipOverridesResolution: true,
6572
- skipPatternResolution: true,
6573
- skipDataResolution: true,
6574
- pattern: true,
6575
- withComponentIDs
6576
- });
6577
- if (res.entries.length !== 1) {
6578
- throw new Error(`Entry pattern with ID ${id} not found`);
6579
- }
6580
- emitWithFormat(res.entries[0], format, filename);
6581
- }
6672
+ handler: createEntryGetHandler("entry-pattern")
6582
6673
  };
6583
6674
 
6584
6675
  // src/commands/canvas/commands/entryPattern/list.ts
6585
6676
  var EntryPatternListModule = {
6586
6677
  command: "list",
6587
6678
  describe: "List entry patterns",
6588
- builder: (yargs42) => withConfiguration(
6679
+ builder: (yargs43) => withConfiguration(
6589
6680
  withDebugOptions(
6590
6681
  withFormatOptions(
6591
6682
  withApiOptions(
6592
6683
  withProjectOptions(
6593
6684
  withStateOptions(
6594
- yargs42.option({
6685
+ yargs43.option({
6595
6686
  withComponentIDs: {
6596
6687
  type: "boolean",
6597
6688
  default: false,
@@ -6637,12 +6728,12 @@ var EntryPatternListModule = {
6637
6728
  var EntryPatternPublishModule = {
6638
6729
  command: "publish [ids]",
6639
6730
  describe: "Publishes entry pattern(s)",
6640
- builder: (yargs42) => withConfiguration(
6731
+ builder: (yargs43) => withConfiguration(
6641
6732
  withDebugOptions(
6642
6733
  withApiOptions(
6643
6734
  withProjectOptions(
6644
6735
  withDiffOptions(
6645
- yargs42.positional("ids", {
6736
+ yargs43.positional("ids", {
6646
6737
  describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6647
6738
  type: "string"
6648
6739
  }).option("all", {
@@ -6717,13 +6808,13 @@ var EntryPatternPublishModule = {
6717
6808
  var EntryPatternPullModule = {
6718
6809
  command: "pull <directory>",
6719
6810
  describe: "Pulls all entry patterns to local files in a directory",
6720
- builder: (yargs42) => withConfiguration(
6811
+ builder: (yargs43) => withConfiguration(
6721
6812
  withApiOptions(
6722
6813
  withDebugOptions(
6723
6814
  withProjectOptions(
6724
6815
  withStateOptions(
6725
6816
  withDiffOptions(
6726
- yargs42.positional("directory", {
6817
+ yargs43.positional("directory", {
6727
6818
  describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
6728
6819
  type: "string"
6729
6820
  }).option("format", {
@@ -6823,13 +6914,13 @@ var EntryPatternPullModule = {
6823
6914
  var EntryPatternPushModule = {
6824
6915
  command: "push <directory>",
6825
6916
  describe: "Pushes all entry patterns from files in a directory to Uniform",
6826
- builder: (yargs42) => withConfiguration(
6917
+ builder: (yargs43) => withConfiguration(
6827
6918
  withDebugOptions(
6828
6919
  withApiOptions(
6829
6920
  withProjectOptions(
6830
6921
  withStateOptions(
6831
6922
  withDiffOptions(
6832
- yargs42.positional("directory", {
6923
+ yargs43.positional("directory", {
6833
6924
  describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
6834
6925
  type: "string"
6835
6926
  }).option("what-if", {
@@ -6933,24 +7024,16 @@ var EntryPatternRemoveModule = {
6933
7024
  command: "remove <id>",
6934
7025
  aliases: ["delete", "rm"],
6935
7026
  describe: "Delete an entry pattern",
6936
- builder: (yargs42) => withConfiguration(
7027
+ builder: (yargs43) => withConfiguration(
6937
7028
  withDebugOptions(
6938
7029
  withApiOptions(
6939
7030
  withProjectOptions(
6940
- yargs42.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
7031
+ yargs43.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
6941
7032
  )
6942
7033
  )
6943
7034
  )
6944
7035
  ),
6945
- handler: async ({ apiHost, apiKey, proxy, id, project: projectId, verbose, whatIf }) => {
6946
- const fetch2 = nodeFetchProxy(proxy, verbose);
6947
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6948
- if (!whatIf) {
6949
- await client.deleteEntry({ entryId: id });
6950
- } else {
6951
- whatIfSimpleLog({ id, displayName: `Entry Pattern`, action: "delete" });
6952
- }
6953
- }
7036
+ handler: createEntryRemoveHandler("entry-pattern")
6954
7037
  };
6955
7038
 
6956
7039
  // src/commands/canvas/commands/entryPattern/unpublish.ts
@@ -6959,11 +7042,11 @@ import { diffJson as diffJson4 } from "diff";
6959
7042
  var EntryPatternUnpublishModule = {
6960
7043
  command: "unpublish [ids]",
6961
7044
  describe: "Unpublish entry pattern(s)",
6962
- builder: (yargs42) => withConfiguration(
7045
+ builder: (yargs43) => withConfiguration(
6963
7046
  withDebugOptions(
6964
7047
  withApiOptions(
6965
7048
  withProjectOptions(
6966
- yargs42.positional("ids", {
7049
+ yargs43.positional("ids", {
6967
7050
  describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6968
7051
  type: "string"
6969
7052
  }).option("all", {
@@ -6976,84 +7059,254 @@ var EntryPatternUnpublishModule = {
6976
7059
  )
6977
7060
  )
6978
7061
  ),
6979
- handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6980
- if (!all && !ids || all && ids) {
6981
- console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
6982
- process.exit(1);
6983
- }
6984
- const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
6985
- const targetItems = /* @__PURE__ */ new Map();
7062
+ handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
7063
+ if (!all && !ids || all && ids) {
7064
+ console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
7065
+ process.exit(1);
7066
+ }
7067
+ const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
7068
+ const targetItems = /* @__PURE__ */ new Map();
7069
+ const fetch2 = nodeFetchProxy(proxy, verbose);
7070
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
7071
+ const source = createEntryEngineDataSource({
7072
+ client,
7073
+ state: "published",
7074
+ entryIDs: entryIDsArray,
7075
+ onlyPatterns: true
7076
+ });
7077
+ const target = createEntryEngineDataSource({
7078
+ client,
7079
+ state: "preview",
7080
+ entryIDs: entryIDsArray,
7081
+ onlyPatterns: true
7082
+ });
7083
+ const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
7084
+ for await (const obj of target.objects) {
7085
+ if (Array.isArray(obj.id)) {
7086
+ obj.id.forEach((o) => targetItems.set(o, obj));
7087
+ } else {
7088
+ targetItems.set(obj.id, obj);
7089
+ }
7090
+ }
7091
+ const toUnpublish = [];
7092
+ for await (const sourceObject of source.objects) {
7093
+ toUnpublish.push(sourceObject);
7094
+ }
7095
+ const actions = [];
7096
+ for (const sourceObject of toUnpublish) {
7097
+ const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
7098
+ const targetObject = targetItems.get(id);
7099
+ if (!targetObject) {
7100
+ console.log(`Entry pattern ${id} did not have a draft (removing published)`);
7101
+ }
7102
+ if (!whatIf) {
7103
+ actions.push(
7104
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7105
+ const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7106
+ if (isNotFound) {
7107
+ console.warn(
7108
+ `Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
7109
+ );
7110
+ return;
7111
+ }
7112
+ throw err;
7113
+ })
7114
+ );
7115
+ }
7116
+ log2({
7117
+ action: "update",
7118
+ id,
7119
+ providerId: sourceObject.providerId,
7120
+ displayName: sourceObject.displayName ?? sourceObject.providerId,
7121
+ whatIf,
7122
+ diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
7123
+ });
7124
+ }
7125
+ await Promise.all(actions);
7126
+ }
7127
+ };
7128
+
7129
+ // src/commands/canvas/commands/entryPattern/update.ts
7130
+ var EntryPatternUpdateModule = {
7131
+ command: "update <filename>",
7132
+ aliases: ["put"],
7133
+ describe: "Insert or update an entry pattern",
7134
+ builder: (yargs43) => withConfiguration(
7135
+ withDebugOptions(
7136
+ withApiOptions(
7137
+ withProjectOptions(
7138
+ withStateOptions(
7139
+ yargs43.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7140
+ )
7141
+ )
7142
+ )
7143
+ )
7144
+ ),
7145
+ handler: createEntryUpdateHandler("entry-pattern")
7146
+ };
7147
+
7148
+ // src/commands/canvas/commands/entryPattern.ts
7149
+ var EntryPatternModule = {
7150
+ command: "entry-pattern <command>",
7151
+ describe: "Commands for Entry patterns",
7152
+ builder: (yargs43) => yargs43.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
7153
+ handler: () => {
7154
+ yargs14.help();
7155
+ }
7156
+ };
7157
+
7158
+ // src/commands/canvas/commands/label.ts
7159
+ import yargs15 from "yargs";
7160
+
7161
+ // src/commands/canvas/labelsEngineDataSource.ts
7162
+ function normalizeLabelForSync(label) {
7163
+ const { projectId: _projectId, ...labelWithoutProjectId } = label;
7164
+ return labelWithoutProjectId;
7165
+ }
7166
+ function createLabelsEngineDataSource({
7167
+ client
7168
+ }) {
7169
+ async function* getObjects() {
7170
+ const labels = paginateAsync(
7171
+ async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
7172
+ { pageSize: 100 }
7173
+ );
7174
+ for await (const label of labels) {
7175
+ const result = {
7176
+ id: label.label.publicId,
7177
+ displayName: `${label.label.displayName} (pid: ${label.label.publicId})`,
7178
+ providerId: label.label.publicId,
7179
+ object: normalizeLabelForSync(label)
7180
+ };
7181
+ yield result;
7182
+ }
7183
+ }
7184
+ return {
7185
+ name: "Uniform API",
7186
+ objects: getObjects(),
7187
+ deleteObject: async (providerId) => {
7188
+ await client.removeLabel({ labelId: providerId });
7189
+ },
7190
+ writeObject: async ({ object: object4 }) => {
7191
+ await client.upsertLabel({ label: object4.label });
7192
+ }
7193
+ };
7194
+ }
7195
+
7196
+ // src/commands/canvas/commands/label/_util.ts
7197
+ import { LabelClient } from "@uniformdev/canvas";
7198
+ var selectLabelIdentifier = (label) => label.label.publicId;
7199
+ var selectLabelDisplayName = (label) => `${label.label.displayName} (pid: ${label.label.publicId})`;
7200
+ function getLabelClient(options) {
7201
+ return new LabelClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
7202
+ }
7203
+
7204
+ // src/commands/canvas/commands/label/pull.ts
7205
+ var LabelPullModule = {
7206
+ command: "pull <directory>",
7207
+ describe: "Pulls all labels to local files in a directory",
7208
+ builder: (yargs43) => withConfiguration(
7209
+ withDebugOptions(
7210
+ withApiOptions(
7211
+ withProjectOptions(
7212
+ withDiffOptions(
7213
+ yargs43.positional("directory", {
7214
+ describe: "Directory to save the labels to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7215
+ type: "string"
7216
+ }).option("format", {
7217
+ alias: ["f"],
7218
+ describe: "Output format",
7219
+ default: "yaml",
7220
+ choices: ["yaml", "json"],
7221
+ type: "string"
7222
+ }).option("mode", {
7223
+ alias: ["m"],
7224
+ describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
7225
+ choices: ["create", "createOrUpdate", "mirror"],
7226
+ default: "mirror",
7227
+ type: "string"
7228
+ })
7229
+ )
7230
+ )
7231
+ )
7232
+ )
7233
+ ),
7234
+ handler: async ({
7235
+ apiHost,
7236
+ apiKey,
7237
+ proxy,
7238
+ directory,
7239
+ format,
7240
+ mode,
7241
+ whatIf,
7242
+ project: projectId,
7243
+ diff: diffMode,
7244
+ allowEmptySource,
7245
+ verbose
7246
+ }) => {
6986
7247
  const fetch2 = nodeFetchProxy(proxy, verbose);
6987
- const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6988
- const source = createEntryEngineDataSource({
6989
- client,
6990
- state: "published",
6991
- entryIDs: entryIDsArray,
6992
- onlyPatterns: true
6993
- });
6994
- const target = createEntryEngineDataSource({
6995
- client,
6996
- state: "preview",
6997
- entryIDs: entryIDsArray,
6998
- onlyPatterns: true
6999
- });
7000
- const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
7001
- for await (const obj of target.objects) {
7002
- if (Array.isArray(obj.id)) {
7003
- obj.id.forEach((o) => targetItems.set(o, obj));
7004
- } else {
7005
- targetItems.set(obj.id, obj);
7006
- }
7007
- }
7008
- const toUnpublish = [];
7009
- for await (const sourceObject of source.objects) {
7010
- toUnpublish.push(sourceObject);
7011
- }
7012
- const actions = [];
7013
- for (const sourceObject of toUnpublish) {
7014
- const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
7015
- const targetObject = targetItems.get(id);
7016
- if (!targetObject) {
7017
- console.log(`Entry pattern ${id} did not have a draft (removing published)`);
7018
- }
7019
- if (!whatIf) {
7020
- actions.push(
7021
- client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7022
- const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7023
- if (isNotFound) {
7024
- console.warn(
7025
- `Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
7026
- );
7027
- return;
7028
- }
7029
- throw err;
7030
- })
7031
- );
7032
- }
7033
- log2({
7034
- action: "update",
7035
- id,
7036
- providerId: sourceObject.providerId,
7037
- displayName: sourceObject.displayName ?? sourceObject.providerId,
7038
- whatIf,
7039
- diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
7248
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7249
+ const source = createLabelsEngineDataSource({ client });
7250
+ let target;
7251
+ const isPackage = isPathAPackageFile(directory);
7252
+ if (isPackage) {
7253
+ const packageContents = readCanvasPackage(directory, false, verbose);
7254
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7255
+ target = await createArraySyncEngineDataSource({
7256
+ name: `Package file ${directory}`,
7257
+ objects: packageLabels,
7258
+ selectIdentifier: selectLabelIdentifier,
7259
+ selectDisplayName: selectLabelDisplayName,
7260
+ onSyncComplete: async (_, synced) => {
7261
+ packageContents.labels = synced;
7262
+ writeCanvasPackage(directory, packageContents);
7263
+ }
7264
+ });
7265
+ } else {
7266
+ target = await createFileSyncEngineDataSource({
7267
+ directory,
7268
+ selectIdentifier: selectLabelIdentifier,
7269
+ selectDisplayName: selectLabelDisplayName,
7270
+ format,
7271
+ verbose
7040
7272
  });
7041
7273
  }
7042
- await Promise.all(actions);
7274
+ await syncEngine({
7275
+ source,
7276
+ target,
7277
+ mode,
7278
+ whatIf,
7279
+ allowEmptySource: allowEmptySource ?? true,
7280
+ log: createSyncEngineConsoleLogger({ diffMode }),
7281
+ onBeforeWriteObject: async (sourceObject) => {
7282
+ delete sourceObject.object.createdBy;
7283
+ delete sourceObject.object.modifiedBy;
7284
+ return sourceObject;
7285
+ }
7286
+ });
7043
7287
  }
7044
7288
  };
7045
7289
 
7046
- // src/commands/canvas/commands/entryPattern/update.ts
7047
- var EntryPatternUpdateModule = {
7048
- command: "update <filename>",
7049
- aliases: ["put"],
7050
- describe: "Insert or update an entry pattern",
7051
- builder: (yargs42) => withConfiguration(
7290
+ // src/commands/canvas/commands/label/push.ts
7291
+ var __INTERNAL_MISSING_PARENT_LABEL_ERROR = "Parent label with public ID";
7292
+ var LabelPushModule = {
7293
+ command: "push <directory>",
7294
+ describe: "Pushes all labels from files in a directory to Uniform",
7295
+ builder: (yargs43) => withConfiguration(
7052
7296
  withDebugOptions(
7053
7297
  withApiOptions(
7054
7298
  withProjectOptions(
7055
- withStateOptions(
7056
- yargs42.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7299
+ withDiffOptions(
7300
+ yargs43.positional("directory", {
7301
+ describe: "Directory to read the labels from. If a filename is used, a package will be read instead.",
7302
+ type: "string"
7303
+ }).option("mode", {
7304
+ alias: ["m"],
7305
+ describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
7306
+ choices: ["create", "createOrUpdate", "mirror"],
7307
+ default: "mirror",
7308
+ type: "string"
7309
+ })
7057
7310
  )
7058
7311
  )
7059
7312
  )
@@ -7061,42 +7314,88 @@ var EntryPatternUpdateModule = {
7061
7314
  ),
7062
7315
  handler: async ({
7063
7316
  apiHost,
7064
- edgeApiHost,
7065
7317
  apiKey,
7066
7318
  proxy,
7067
- filename,
7319
+ directory,
7320
+ mode,
7321
+ whatIf,
7068
7322
  project: projectId,
7069
- state,
7070
- verbose,
7071
- whatIf
7323
+ diff: diffMode,
7324
+ allowEmptySource,
7325
+ verbose
7072
7326
  }) => {
7073
7327
  const fetch2 = nodeFetchProxy(proxy, verbose);
7074
- const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
7075
- const file = readFileToObject(filename);
7076
- if (!whatIf) {
7077
- await client.upsertEntry({ ...file, state: convertStateOption(state) });
7328
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7329
+ let source;
7330
+ const isPackage = isPathAPackageFile(directory);
7331
+ if (isPackage) {
7332
+ const packageContents = readCanvasPackage(directory, true, verbose);
7333
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7334
+ source = await createArraySyncEngineDataSource({
7335
+ name: `Package file ${directory}`,
7336
+ objects: packageLabels,
7337
+ selectIdentifier: selectLabelIdentifier,
7338
+ selectDisplayName: selectLabelDisplayName
7339
+ });
7078
7340
  } else {
7079
- whatIfSimpleLog({
7080
- id: file.entry._id,
7081
- displayName: `Entry Pattern: ${file.entry._name}`,
7082
- action: "update"
7341
+ source = await createFileSyncEngineDataSource({
7342
+ directory,
7343
+ selectIdentifier: selectLabelIdentifier,
7344
+ selectDisplayName: selectLabelDisplayName,
7345
+ verbose
7083
7346
  });
7084
7347
  }
7348
+ const target = createLabelsEngineDataSource({ client });
7349
+ const labelsFailedDueToMissingParent = /* @__PURE__ */ new Set();
7350
+ const attemptSync = async () => {
7351
+ const lastFailedLabelsCount = labelsFailedDueToMissingParent.size;
7352
+ labelsFailedDueToMissingParent.clear();
7353
+ await syncEngine({
7354
+ source,
7355
+ target,
7356
+ mode,
7357
+ whatIf,
7358
+ allowEmptySource,
7359
+ log: createSyncEngineConsoleLogger({ diffMode }),
7360
+ onError: (error, object4) => {
7361
+ if (error.message.includes(__INTERNAL_MISSING_PARENT_LABEL_ERROR)) {
7362
+ labelsFailedDueToMissingParent.add(object4.object);
7363
+ } else {
7364
+ throw error;
7365
+ }
7366
+ }
7367
+ });
7368
+ if (labelsFailedDueToMissingParent.size !== 0) {
7369
+ const newFailedLabelsCount = labelsFailedDueToMissingParent.size;
7370
+ if (newFailedLabelsCount !== lastFailedLabelsCount) {
7371
+ source = await createArraySyncEngineDataSource({
7372
+ name: `Labels re-push from ${directory}`,
7373
+ objects: Array.from(labelsFailedDueToMissingParent),
7374
+ selectIdentifier: selectLabelIdentifier,
7375
+ selectDisplayName: selectLabelDisplayName
7376
+ });
7377
+ await attemptSync();
7378
+ } else {
7379
+ throw new Error("Failed to push labels due to missing parent labels");
7380
+ }
7381
+ }
7382
+ };
7383
+ await attemptSync();
7085
7384
  }
7086
7385
  };
7087
7386
 
7088
- // src/commands/canvas/commands/entryPattern.ts
7089
- var EntryPatternModule = {
7090
- command: "entry-pattern <command>",
7091
- describe: "Commands for Entry patterns",
7092
- builder: (yargs42) => yargs42.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
7387
+ // src/commands/canvas/commands/label.ts
7388
+ var LabelModule = {
7389
+ command: "label <command>",
7390
+ describe: "Commands for label definitions",
7391
+ builder: (yargs43) => yargs43.command(LabelPullModule).command(LabelPushModule),
7093
7392
  handler: () => {
7094
- yargs14.help();
7393
+ yargs15.help();
7095
7394
  }
7096
7395
  };
7097
7396
 
7098
7397
  // src/commands/canvas/commands/locale.ts
7099
- import yargs15 from "yargs";
7398
+ import yargs16 from "yargs";
7100
7399
 
7101
7400
  // src/commands/canvas/localesEngineDataSource.ts
7102
7401
  function createLocaleEngineDataSource({
@@ -7138,12 +7437,12 @@ function getLocaleClient(options) {
7138
7437
  var LocalePullModule = {
7139
7438
  command: "pull <directory>",
7140
7439
  describe: "Pulls all locales to local files in a directory",
7141
- builder: (yargs42) => withConfiguration(
7440
+ builder: (yargs43) => withConfiguration(
7142
7441
  withDebugOptions(
7143
7442
  withApiOptions(
7144
7443
  withProjectOptions(
7145
7444
  withDiffOptions(
7146
- yargs42.positional("directory", {
7445
+ yargs43.positional("directory", {
7147
7446
  describe: "Directory to save the locales to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7148
7447
  type: "string"
7149
7448
  }).option("format", {
@@ -7223,12 +7522,12 @@ var LocalePullModule = {
7223
7522
  var LocalePushModule = {
7224
7523
  command: "push <directory>",
7225
7524
  describe: "Pushes all locales from files in a directory to Uniform",
7226
- builder: (yargs42) => withConfiguration(
7525
+ builder: (yargs43) => withConfiguration(
7227
7526
  withDebugOptions(
7228
7527
  withApiOptions(
7229
7528
  withProjectOptions(
7230
7529
  withDiffOptions(
7231
- yargs42.positional("directory", {
7530
+ yargs43.positional("directory", {
7232
7531
  describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
7233
7532
  type: "string"
7234
7533
  }).option("mode", {
@@ -7296,14 +7595,14 @@ var LocalePushModule = {
7296
7595
  var LocaleModule = {
7297
7596
  command: "locale <command>",
7298
7597
  describe: "Commands for locale definitions",
7299
- builder: (yargs42) => yargs42.command(LocalePullModule).command(LocalePushModule),
7598
+ builder: (yargs43) => yargs43.command(LocalePullModule).command(LocalePushModule),
7300
7599
  handler: () => {
7301
- yargs15.help();
7600
+ yargs16.help();
7302
7601
  }
7303
7602
  };
7304
7603
 
7305
7604
  // src/commands/canvas/commands/previewUrl.ts
7306
- import yargs16 from "yargs";
7605
+ import yargs17 from "yargs";
7307
7606
 
7308
7607
  // src/commands/canvas/commands/previewUrl/_util.ts
7309
7608
  import { PreviewClient } from "@uniformdev/canvas";
@@ -7317,12 +7616,12 @@ function getPreviewClient(options) {
7317
7616
  var PreviewUrlGetModule = {
7318
7617
  command: "get <id>",
7319
7618
  describe: "Fetch a preview URL",
7320
- builder: (yargs42) => withConfiguration(
7619
+ builder: (yargs43) => withConfiguration(
7321
7620
  withFormatOptions(
7322
7621
  withDebugOptions(
7323
7622
  withApiOptions(
7324
7623
  withProjectOptions(
7325
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7624
+ yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7326
7625
  )
7327
7626
  )
7328
7627
  )
@@ -7346,8 +7645,8 @@ var PreviewUrlListModule = {
7346
7645
  command: "list",
7347
7646
  describe: "List preview URLs",
7348
7647
  aliases: ["ls"],
7349
- builder: (yargs42) => withConfiguration(
7350
- withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs42.options({})))))
7648
+ builder: (yargs43) => withConfiguration(
7649
+ withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs43.options({})))))
7351
7650
  ),
7352
7651
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7353
7652
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7389,12 +7688,12 @@ function createPreviewUrlEngineDataSource({
7389
7688
  var PreviewUrlPullModule = {
7390
7689
  command: "pull <directory>",
7391
7690
  describe: "Pulls all preview urls to local files in a directory",
7392
- builder: (yargs42) => withConfiguration(
7691
+ builder: (yargs43) => withConfiguration(
7393
7692
  withApiOptions(
7394
7693
  withProjectOptions(
7395
7694
  withDebugOptions(
7396
7695
  withDiffOptions(
7397
- yargs42.positional("directory", {
7696
+ yargs43.positional("directory", {
7398
7697
  describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7399
7698
  type: "string"
7400
7699
  }).option("format", {
@@ -7469,12 +7768,12 @@ var PreviewUrlPullModule = {
7469
7768
  var PreviewUrlPushModule = {
7470
7769
  command: "push <directory>",
7471
7770
  describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
7472
- builder: (yargs42) => withConfiguration(
7771
+ builder: (yargs43) => withConfiguration(
7473
7772
  withApiOptions(
7474
7773
  withProjectOptions(
7475
7774
  withDiffOptions(
7476
7775
  withDebugOptions(
7477
- yargs42.positional("directory", {
7776
+ yargs43.positional("directory", {
7478
7777
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7479
7778
  type: "string"
7480
7779
  }).option("mode", {
@@ -7538,11 +7837,11 @@ var PreviewUrlRemoveModule = {
7538
7837
  command: "remove <id>",
7539
7838
  aliases: ["delete", "rm"],
7540
7839
  describe: "Delete a preview URL",
7541
- builder: (yargs42) => withConfiguration(
7840
+ builder: (yargs43) => withConfiguration(
7542
7841
  withApiOptions(
7543
7842
  withDebugOptions(
7544
7843
  withProjectOptions(
7545
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
7844
+ yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
7546
7845
  )
7547
7846
  )
7548
7847
  )
@@ -7563,11 +7862,11 @@ var PreviewUrlUpdateModule = {
7563
7862
  command: "update <filename>",
7564
7863
  aliases: ["put"],
7565
7864
  describe: "Insert or update a preview URL",
7566
- builder: (yargs42) => withConfiguration(
7865
+ builder: (yargs43) => withConfiguration(
7567
7866
  withDebugOptions(
7568
7867
  withApiOptions(
7569
7868
  withProjectOptions(
7570
- yargs42.positional("filename", { demandOption: true, describe: "Category file to put" })
7869
+ yargs43.positional("filename", { demandOption: true, describe: "Category file to put" })
7571
7870
  )
7572
7871
  )
7573
7872
  )
@@ -7589,25 +7888,25 @@ var PreviewUrlModule = {
7589
7888
  command: "preview-url <command>",
7590
7889
  aliases: ["pu"],
7591
7890
  describe: "Commands for Canvas preview urls",
7592
- builder: (yargs42) => yargs42.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
7891
+ builder: (yargs43) => yargs43.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
7593
7892
  handler: () => {
7594
- yargs16.help();
7893
+ yargs17.help();
7595
7894
  }
7596
7895
  };
7597
7896
 
7598
7897
  // src/commands/canvas/commands/previewViewport.ts
7599
- import yargs17 from "yargs";
7898
+ import yargs18 from "yargs";
7600
7899
 
7601
7900
  // src/commands/canvas/commands/previewViewport/get.ts
7602
7901
  var PreviewViewportGetModule = {
7603
7902
  command: "get <id>",
7604
7903
  describe: "Fetch a preview viewport",
7605
- builder: (yargs42) => withConfiguration(
7904
+ builder: (yargs43) => withConfiguration(
7606
7905
  withFormatOptions(
7607
7906
  withDebugOptions(
7608
7907
  withApiOptions(
7609
7908
  withProjectOptions(
7610
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
7909
+ yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
7611
7910
  )
7612
7911
  )
7613
7912
  )
@@ -7631,8 +7930,8 @@ var PreviewViewportListModule = {
7631
7930
  command: "list",
7632
7931
  describe: "List preview viewports",
7633
7932
  aliases: ["ls"],
7634
- builder: (yargs42) => withConfiguration(
7635
- withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs42.options({})))))
7933
+ builder: (yargs43) => withConfiguration(
7934
+ withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs43.options({})))))
7636
7935
  ),
7637
7936
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7638
7937
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7678,12 +7977,12 @@ function createPreviewViewportEngineDataSource({
7678
7977
  var PreviewViewportPullModule = {
7679
7978
  command: "pull <directory>",
7680
7979
  describe: "Pulls all preview viewports to local files in a directory",
7681
- builder: (yargs42) => withConfiguration(
7980
+ builder: (yargs43) => withConfiguration(
7682
7981
  withApiOptions(
7683
7982
  withProjectOptions(
7684
7983
  withDebugOptions(
7685
7984
  withDiffOptions(
7686
- yargs42.positional("directory", {
7985
+ yargs43.positional("directory", {
7687
7986
  describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7688
7987
  type: "string"
7689
7988
  }).option("format", {
@@ -7758,12 +8057,12 @@ var PreviewViewportPullModule = {
7758
8057
  var PreviewViewportPushModule = {
7759
8058
  command: "push <directory>",
7760
8059
  describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
7761
- builder: (yargs42) => withConfiguration(
8060
+ builder: (yargs43) => withConfiguration(
7762
8061
  withApiOptions(
7763
8062
  withProjectOptions(
7764
8063
  withDiffOptions(
7765
8064
  withDebugOptions(
7766
- yargs42.positional("directory", {
8065
+ yargs43.positional("directory", {
7767
8066
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7768
8067
  type: "string"
7769
8068
  }).option("mode", {
@@ -7827,11 +8126,11 @@ var PreviewViewportRemoveModule = {
7827
8126
  command: "remove <id>",
7828
8127
  aliases: ["delete", "rm"],
7829
8128
  describe: "Delete a preview viewport",
7830
- builder: (yargs42) => withConfiguration(
8129
+ builder: (yargs43) => withConfiguration(
7831
8130
  withApiOptions(
7832
8131
  withDebugOptions(
7833
8132
  withProjectOptions(
7834
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
8133
+ yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
7835
8134
  )
7836
8135
  )
7837
8136
  )
@@ -7852,11 +8151,11 @@ var PreviewViewportUpdateModule = {
7852
8151
  command: "update <filename>",
7853
8152
  aliases: ["put"],
7854
8153
  describe: "Insert or update a preview viewport",
7855
- builder: (yargs42) => withConfiguration(
8154
+ builder: (yargs43) => withConfiguration(
7856
8155
  withDebugOptions(
7857
8156
  withApiOptions(
7858
8157
  withProjectOptions(
7859
- yargs42.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
8158
+ yargs43.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
7860
8159
  )
7861
8160
  )
7862
8161
  )
@@ -7878,14 +8177,14 @@ var PreviewViewportModule = {
7878
8177
  command: "preview-viewport <command>",
7879
8178
  aliases: ["pv"],
7880
8179
  describe: "Commands for Canvas preview viewports",
7881
- builder: (yargs42) => yargs42.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
8180
+ builder: (yargs43) => yargs43.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
7882
8181
  handler: () => {
7883
- yargs17.help();
8182
+ yargs18.help();
7884
8183
  }
7885
8184
  };
7886
8185
 
7887
8186
  // src/commands/canvas/commands/prompts.ts
7888
- import yargs18 from "yargs";
8187
+ import yargs19 from "yargs";
7889
8188
 
7890
8189
  // src/commands/canvas/commands/prompts/_util.ts
7891
8190
  import { PromptClient } from "@uniformdev/canvas";
@@ -7897,12 +8196,12 @@ var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: t
7897
8196
  var PromptGetModule = {
7898
8197
  command: "get <id>",
7899
8198
  describe: "Get a prompt",
7900
- builder: (yargs42) => withConfiguration(
8199
+ builder: (yargs43) => withConfiguration(
7901
8200
  withDebugOptions(
7902
8201
  withFormatOptions(
7903
8202
  withApiOptions(
7904
8203
  withProjectOptions(
7905
- yargs42.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
8204
+ yargs43.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
7906
8205
  )
7907
8206
  )
7908
8207
  )
@@ -7923,7 +8222,7 @@ var PromptGetModule = {
7923
8222
  var PromptListModule = {
7924
8223
  command: "list",
7925
8224
  describe: "List prompts",
7926
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
8225
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
7927
8226
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7928
8227
  const fetch2 = nodeFetchProxy(proxy, verbose);
7929
8228
  const client = getPromptClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -7964,13 +8263,13 @@ function createPromptEngineDataSource({
7964
8263
  var PromptPullModule = {
7965
8264
  command: "pull <directory>",
7966
8265
  describe: "Pulls all prompts to local files in a directory",
7967
- builder: (yargs42) => withConfiguration(
8266
+ builder: (yargs43) => withConfiguration(
7968
8267
  withDebugOptions(
7969
8268
  withApiOptions(
7970
8269
  withProjectOptions(
7971
8270
  withStateOptions(
7972
8271
  withDiffOptions(
7973
- yargs42.positional("directory", {
8272
+ yargs43.positional("directory", {
7974
8273
  describe: "Directory to save the prompts to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
7975
8274
  type: "string"
7976
8275
  }).option("format", {
@@ -8051,12 +8350,12 @@ var PromptPullModule = {
8051
8350
  var PromptPushModule = {
8052
8351
  command: "push <directory>",
8053
8352
  describe: "Pushes all prompts from files in a directory to Uniform",
8054
- builder: (yargs42) => withConfiguration(
8353
+ builder: (yargs43) => withConfiguration(
8055
8354
  withApiOptions(
8056
8355
  withProjectOptions(
8057
8356
  withStateOptions(
8058
8357
  withDiffOptions(
8059
- yargs42.positional("directory", {
8358
+ yargs43.positional("directory", {
8060
8359
  describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
8061
8360
  type: "string"
8062
8361
  }).option("mode", {
@@ -8125,10 +8424,10 @@ var PromptRemoveModule = {
8125
8424
  command: "remove <id>",
8126
8425
  aliases: ["delete", "rm"],
8127
8426
  describe: "Delete a prompt",
8128
- builder: (yargs42) => withConfiguration(
8427
+ builder: (yargs43) => withConfiguration(
8129
8428
  withDebugOptions(
8130
8429
  withApiOptions(
8131
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8430
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8132
8431
  )
8133
8432
  )
8134
8433
  ),
@@ -8148,11 +8447,11 @@ var PromptUpdateModule = {
8148
8447
  command: "update <filename>",
8149
8448
  aliases: ["put"],
8150
8449
  describe: "Insert or update a prompt",
8151
- builder: (yargs42) => withConfiguration(
8450
+ builder: (yargs43) => withConfiguration(
8152
8451
  withDebugOptions(
8153
8452
  withApiOptions(
8154
8453
  withProjectOptions(
8155
- yargs42.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8454
+ yargs43.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8156
8455
  )
8157
8456
  )
8158
8457
  )
@@ -8174,14 +8473,14 @@ var PromptModule = {
8174
8473
  command: "prompt <command>",
8175
8474
  aliases: ["dt"],
8176
8475
  describe: "Commands for AI Prompt definitions",
8177
- builder: (yargs42) => yargs42.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8476
+ builder: (yargs43) => yargs43.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8178
8477
  handler: () => {
8179
- yargs18.help();
8478
+ yargs19.help();
8180
8479
  }
8181
8480
  };
8182
8481
 
8183
8482
  // src/commands/canvas/commands/workflow.ts
8184
- import yargs19 from "yargs";
8483
+ import yargs20 from "yargs";
8185
8484
 
8186
8485
  // src/commands/canvas/commands/workflow/_util.ts
8187
8486
  import { WorkflowClient } from "@uniformdev/canvas";
@@ -8224,12 +8523,12 @@ function createWorkflowEngineDataSource({
8224
8523
  var WorkflowPullModule = {
8225
8524
  command: "pull <directory>",
8226
8525
  describe: "Pulls all workflows to local files in a directory",
8227
- builder: (yargs42) => withConfiguration(
8526
+ builder: (yargs43) => withConfiguration(
8228
8527
  withApiOptions(
8229
8528
  withDebugOptions(
8230
8529
  withProjectOptions(
8231
8530
  withDiffOptions(
8232
- yargs42.positional("directory", {
8531
+ yargs43.positional("directory", {
8233
8532
  describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
8234
8533
  type: "string"
8235
8534
  }).option("format", {
@@ -8304,12 +8603,12 @@ var WorkflowPullModule = {
8304
8603
  var WorkflowPushModule = {
8305
8604
  command: "push <directory>",
8306
8605
  describe: "Pushes all workflows from files in a directory to Uniform Canvas",
8307
- builder: (yargs42) => withConfiguration(
8606
+ builder: (yargs43) => withConfiguration(
8308
8607
  withDebugOptions(
8309
8608
  withApiOptions(
8310
8609
  withProjectOptions(
8311
8610
  withDiffOptions(
8312
- yargs42.positional("directory", {
8611
+ yargs43.positional("directory", {
8313
8612
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
8314
8613
  type: "string"
8315
8614
  }).option("mode", {
@@ -8373,9 +8672,9 @@ var WorkflowModule = {
8373
8672
  command: "workflow <command>",
8374
8673
  aliases: ["wf"],
8375
8674
  describe: "Commands for Canvas workflows",
8376
- builder: (yargs42) => yargs42.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8675
+ builder: (yargs43) => yargs43.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8377
8676
  handler: () => {
8378
- yargs19.help();
8677
+ yargs20.help();
8379
8678
  }
8380
8679
  };
8381
8680
 
@@ -8384,17 +8683,17 @@ var CanvasCommand = {
8384
8683
  command: "canvas <command>",
8385
8684
  aliases: ["cv", "pm", "presentation"],
8386
8685
  describe: "Uniform Canvas commands",
8387
- builder: (yargs42) => yargs42.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LocaleModule).command(WorkflowModule).command(PreviewUrlModule).command(PreviewViewportModule).demandCommand(),
8686
+ builder: (yargs43) => yargs43.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LabelModule).command(LocaleModule).command(WorkflowModule).command(PreviewUrlModule).command(PreviewViewportModule).demandCommand(),
8388
8687
  handler: () => {
8389
- yargs20.showHelp();
8688
+ yargs21.showHelp();
8390
8689
  }
8391
8690
  };
8392
8691
 
8393
8692
  // src/commands/context/index.ts
8394
- import yargs27 from "yargs";
8693
+ import yargs28 from "yargs";
8395
8694
 
8396
8695
  // src/commands/context/commands/aggregate.ts
8397
- import yargs21 from "yargs";
8696
+ import yargs22 from "yargs";
8398
8697
 
8399
8698
  // src/commands/context/commands/aggregate/_util.ts
8400
8699
  import { AggregateClient } from "@uniformdev/context/api";
@@ -8406,11 +8705,11 @@ var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCa
8406
8705
  var AggregateGetModule = {
8407
8706
  command: "get <id>",
8408
8707
  describe: "Fetch an aggregate",
8409
- builder: (yargs42) => withConfiguration(
8708
+ builder: (yargs43) => withConfiguration(
8410
8709
  withFormatOptions(
8411
8710
  withApiOptions(
8412
8711
  withProjectOptions(
8413
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8712
+ yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8414
8713
  )
8415
8714
  )
8416
8715
  )
@@ -8433,7 +8732,7 @@ var AggregateListModule = {
8433
8732
  command: "list",
8434
8733
  describe: "List aggregates",
8435
8734
  aliases: ["ls"],
8436
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
8735
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
8437
8736
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8438
8737
  const fetch2 = nodeFetchProxy(proxy);
8439
8738
  const client = getAggregateClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8496,12 +8795,12 @@ function writeContextPackage(filename, packageContents) {
8496
8795
  var AggregatePullModule = {
8497
8796
  command: "pull <directory>",
8498
8797
  describe: "Pulls all aggregates to local files in a directory",
8499
- builder: (yargs42) => withConfiguration(
8798
+ builder: (yargs43) => withConfiguration(
8500
8799
  withApiOptions(
8501
8800
  withDebugOptions(
8502
8801
  withProjectOptions(
8503
8802
  withDiffOptions(
8504
- yargs42.positional("directory", {
8803
+ yargs43.positional("directory", {
8505
8804
  describe: "Directory to save the aggregates to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
8506
8805
  type: "string"
8507
8806
  }).option("format", {
@@ -8576,12 +8875,12 @@ var AggregatePullModule = {
8576
8875
  var AggregatePushModule = {
8577
8876
  command: "push <directory>",
8578
8877
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
8579
- builder: (yargs42) => withConfiguration(
8878
+ builder: (yargs43) => withConfiguration(
8580
8879
  withApiOptions(
8581
8880
  withProjectOptions(
8582
8881
  withDiffOptions(
8583
8882
  withDebugOptions(
8584
- yargs42.positional("directory", {
8883
+ yargs43.positional("directory", {
8585
8884
  describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
8586
8885
  type: "string"
8587
8886
  }).option("mode", {
@@ -8646,10 +8945,10 @@ var AggregateRemoveModule = {
8646
8945
  command: "remove <id>",
8647
8946
  aliases: ["delete", "rm"],
8648
8947
  describe: "Delete an aggregate",
8649
- builder: (yargs42) => withConfiguration(
8948
+ builder: (yargs43) => withConfiguration(
8650
8949
  withApiOptions(
8651
8950
  withProjectOptions(
8652
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
8951
+ yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
8653
8952
  )
8654
8953
  )
8655
8954
  ),
@@ -8665,10 +8964,10 @@ var AggregateUpdateModule = {
8665
8964
  command: "update <filename>",
8666
8965
  aliases: ["put"],
8667
8966
  describe: "Insert or update an aggregate",
8668
- builder: (yargs42) => withConfiguration(
8967
+ builder: (yargs43) => withConfiguration(
8669
8968
  withApiOptions(
8670
8969
  withProjectOptions(
8671
- yargs42.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
8970
+ yargs43.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
8672
8971
  )
8673
8972
  )
8674
8973
  ),
@@ -8685,14 +8984,14 @@ var AggregateModule = {
8685
8984
  command: "aggregate <command>",
8686
8985
  aliases: ["agg", "intent", "audience"],
8687
8986
  describe: "Commands for Context aggregates (intents, audiences)",
8688
- builder: (yargs42) => yargs42.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
8987
+ builder: (yargs43) => yargs43.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
8689
8988
  handler: () => {
8690
- yargs21.help();
8989
+ yargs22.help();
8691
8990
  }
8692
8991
  };
8693
8992
 
8694
8993
  // src/commands/context/commands/enrichment.ts
8695
- import yargs22 from "yargs";
8994
+ import yargs23 from "yargs";
8696
8995
 
8697
8996
  // src/commands/context/commands/enrichment/_util.ts
8698
8997
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
@@ -8706,11 +9005,11 @@ function getEnrichmentClient(options) {
8706
9005
  var EnrichmentGetModule = {
8707
9006
  command: "get <id>",
8708
9007
  describe: "Fetch an enrichment category and its values",
8709
- builder: (yargs42) => withFormatOptions(
9008
+ builder: (yargs43) => withFormatOptions(
8710
9009
  withConfiguration(
8711
9010
  withApiOptions(
8712
9011
  withProjectOptions(
8713
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
9012
+ yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
8714
9013
  )
8715
9014
  )
8716
9015
  )
@@ -8733,7 +9032,7 @@ var EnrichmentListModule = {
8733
9032
  command: "list",
8734
9033
  describe: "List enrichments",
8735
9034
  aliases: ["ls"],
8736
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9035
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
8737
9036
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8738
9037
  const fetch2 = nodeFetchProxy(proxy);
8739
9038
  const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8828,12 +9127,12 @@ var createEnrichmentValueEngineDataSource = ({
8828
9127
  var EnrichmentPullModule = {
8829
9128
  command: "pull <directory>",
8830
9129
  describe: "Pulls all enrichments to local files in a directory",
8831
- builder: (yargs42) => withConfiguration(
9130
+ builder: (yargs43) => withConfiguration(
8832
9131
  withDebugOptions(
8833
9132
  withApiOptions(
8834
9133
  withProjectOptions(
8835
9134
  withDiffOptions(
8836
- yargs42.positional("directory", {
9135
+ yargs43.positional("directory", {
8837
9136
  describe: "Directory to save the enrichments to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
8838
9137
  type: "string"
8839
9138
  }).option("format", {
@@ -8908,11 +9207,11 @@ var EnrichmentPullModule = {
8908
9207
  var EnrichmentPushModule = {
8909
9208
  command: "push <directory>",
8910
9209
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
8911
- builder: (yargs42) => withConfiguration(
9210
+ builder: (yargs43) => withConfiguration(
8912
9211
  withApiOptions(
8913
9212
  withProjectOptions(
8914
9213
  withDiffOptions(
8915
- yargs42.positional("directory", {
9214
+ yargs43.positional("directory", {
8916
9215
  describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
8917
9216
  type: "string"
8918
9217
  }).option("mode", {
@@ -8975,10 +9274,10 @@ var EnrichmentRemoveModule = {
8975
9274
  command: "remove <id>",
8976
9275
  aliases: ["delete", "rm"],
8977
9276
  describe: "Delete an enrichment category and its values",
8978
- builder: (yargs42) => withConfiguration(
9277
+ builder: (yargs43) => withConfiguration(
8979
9278
  withApiOptions(
8980
9279
  withProjectOptions(
8981
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
9280
+ yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
8982
9281
  )
8983
9282
  )
8984
9283
  ),
@@ -8994,14 +9293,14 @@ var EnrichmentModule = {
8994
9293
  command: "enrichment <command>",
8995
9294
  aliases: ["enr"],
8996
9295
  describe: "Commands for Context enrichments",
8997
- builder: (yargs42) => yargs42.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
9296
+ builder: (yargs43) => yargs43.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
8998
9297
  handler: () => {
8999
- yargs22.help();
9298
+ yargs23.help();
9000
9299
  }
9001
9300
  };
9002
9301
 
9003
9302
  // src/commands/context/commands/manifest.ts
9004
- import yargs23 from "yargs";
9303
+ import yargs24 from "yargs";
9005
9304
 
9006
9305
  // src/commands/context/commands/manifest/get.ts
9007
9306
  import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
@@ -9012,10 +9311,10 @@ var ManifestGetModule = {
9012
9311
  command: "get [output]",
9013
9312
  aliases: ["dl", "download"],
9014
9313
  describe: "Download the Uniform Context manifest for a project",
9015
- builder: (yargs42) => withConfiguration(
9314
+ builder: (yargs43) => withConfiguration(
9016
9315
  withApiOptions(
9017
9316
  withProjectOptions(
9018
- yargs42.option("preview", {
9317
+ yargs43.option("preview", {
9019
9318
  describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
9020
9319
  default: false,
9021
9320
  type: "boolean",
@@ -9077,7 +9376,7 @@ import { exit as exit2 } from "process";
9077
9376
  var ManifestPublishModule = {
9078
9377
  command: "publish",
9079
9378
  describe: "Publish the Uniform Context manifest for a project",
9080
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(yargs42))),
9379
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(yargs43))),
9081
9380
  handler: async ({ apiKey, apiHost, proxy, project }) => {
9082
9381
  const fetch2 = nodeFetchProxy(proxy);
9083
9382
  try {
@@ -9110,25 +9409,25 @@ var ManifestModule = {
9110
9409
  command: "manifest <command>",
9111
9410
  describe: "Commands for context manifests",
9112
9411
  aliases: ["man"],
9113
- builder: (yargs42) => yargs42.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9412
+ builder: (yargs43) => yargs43.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9114
9413
  handler: () => {
9115
- yargs23.help();
9414
+ yargs24.help();
9116
9415
  }
9117
9416
  };
9118
9417
 
9119
9418
  // src/commands/context/commands/quirk.ts
9120
- import yargs24 from "yargs";
9419
+ import yargs25 from "yargs";
9121
9420
 
9122
9421
  // src/commands/context/commands/quirk/get.ts
9123
9422
  import { UncachedQuirkClient } from "@uniformdev/context/api";
9124
9423
  var QuirkGetModule = {
9125
9424
  command: "get <id>",
9126
9425
  describe: "Fetch a quirk",
9127
- builder: (yargs42) => withConfiguration(
9426
+ builder: (yargs43) => withConfiguration(
9128
9427
  withFormatOptions(
9129
9428
  withApiOptions(
9130
9429
  withProjectOptions(
9131
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9430
+ yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9132
9431
  )
9133
9432
  )
9134
9433
  )
@@ -9152,11 +9451,11 @@ var QuirkListModule = {
9152
9451
  command: "list",
9153
9452
  describe: "List quirks",
9154
9453
  aliases: ["ls"],
9155
- builder: (yargs42) => withConfiguration(
9454
+ builder: (yargs43) => withConfiguration(
9156
9455
  withFormatOptions(
9157
9456
  withApiOptions(
9158
9457
  withProjectOptions(
9159
- yargs42.option("withIntegrations", {
9458
+ yargs43.option("withIntegrations", {
9160
9459
  alias: ["i"],
9161
9460
  describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
9162
9461
  type: "boolean"
@@ -9214,12 +9513,12 @@ function createQuirkEngineDataSource({
9214
9513
  var QuirkPullModule = {
9215
9514
  command: "pull <directory>",
9216
9515
  describe: "Pulls all quirks to local files in a directory",
9217
- builder: (yargs42) => withConfiguration(
9516
+ builder: (yargs43) => withConfiguration(
9218
9517
  withDebugOptions(
9219
9518
  withApiOptions(
9220
9519
  withProjectOptions(
9221
9520
  withDiffOptions(
9222
- yargs42.positional("directory", {
9521
+ yargs43.positional("directory", {
9223
9522
  describe: "Directory to save the quirks to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
9224
9523
  type: "string"
9225
9524
  }).option("format", {
@@ -9295,12 +9594,12 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
9295
9594
  var QuirkPushModule = {
9296
9595
  command: "push <directory>",
9297
9596
  describe: "Pushes all quirks from files in a directory or package to Uniform",
9298
- builder: (yargs42) => withConfiguration(
9597
+ builder: (yargs43) => withConfiguration(
9299
9598
  withDebugOptions(
9300
9599
  withApiOptions(
9301
9600
  withProjectOptions(
9302
9601
  withDiffOptions(
9303
- yargs42.positional("directory", {
9602
+ yargs43.positional("directory", {
9304
9603
  describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
9305
9604
  type: "string"
9306
9605
  }).option("mode", {
@@ -9365,10 +9664,10 @@ var QuirkRemoveModule = {
9365
9664
  command: "remove <id>",
9366
9665
  aliases: ["delete", "rm"],
9367
9666
  describe: "Delete a quirk",
9368
- builder: (yargs42) => withConfiguration(
9667
+ builder: (yargs43) => withConfiguration(
9369
9668
  withApiOptions(
9370
9669
  withProjectOptions(
9371
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9670
+ yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9372
9671
  )
9373
9672
  )
9374
9673
  ),
@@ -9385,10 +9684,10 @@ var QuirkUpdateModule = {
9385
9684
  command: "update <filename>",
9386
9685
  aliases: ["put"],
9387
9686
  describe: "Insert or update a quirk",
9388
- builder: (yargs42) => withConfiguration(
9687
+ builder: (yargs43) => withConfiguration(
9389
9688
  withApiOptions(
9390
9689
  withProjectOptions(
9391
- yargs42.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9690
+ yargs43.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9392
9691
  )
9393
9692
  )
9394
9693
  ),
@@ -9405,25 +9704,25 @@ var QuirkModule = {
9405
9704
  command: "quirk <command>",
9406
9705
  aliases: ["qk"],
9407
9706
  describe: "Commands for Context quirks",
9408
- builder: (yargs42) => yargs42.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9707
+ builder: (yargs43) => yargs43.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9409
9708
  handler: () => {
9410
- yargs24.help();
9709
+ yargs25.help();
9411
9710
  }
9412
9711
  };
9413
9712
 
9414
9713
  // src/commands/context/commands/signal.ts
9415
- import yargs25 from "yargs";
9714
+ import yargs26 from "yargs";
9416
9715
 
9417
9716
  // src/commands/context/commands/signal/get.ts
9418
9717
  import { UncachedSignalClient } from "@uniformdev/context/api";
9419
9718
  var SignalGetModule = {
9420
9719
  command: "get <id>",
9421
9720
  describe: "Fetch a signal",
9422
- builder: (yargs42) => withConfiguration(
9721
+ builder: (yargs43) => withConfiguration(
9423
9722
  withFormatOptions(
9424
9723
  withApiOptions(
9425
9724
  withProjectOptions(
9426
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9725
+ yargs43.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9427
9726
  )
9428
9727
  )
9429
9728
  )
@@ -9447,7 +9746,7 @@ var SignalListModule = {
9447
9746
  command: "list",
9448
9747
  describe: "List signals",
9449
9748
  aliases: ["ls"],
9450
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9749
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
9451
9750
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9452
9751
  const fetch2 = nodeFetchProxy(proxy);
9453
9752
  const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9497,12 +9796,12 @@ function createSignalEngineDataSource({
9497
9796
  var SignalPullModule = {
9498
9797
  command: "pull <directory>",
9499
9798
  describe: "Pulls all signals to local files in a directory",
9500
- builder: (yargs42) => withConfiguration(
9799
+ builder: (yargs43) => withConfiguration(
9501
9800
  withDebugOptions(
9502
9801
  withApiOptions(
9503
9802
  withProjectOptions(
9504
9803
  withDiffOptions(
9505
- yargs42.positional("directory", {
9804
+ yargs43.positional("directory", {
9506
9805
  describe: "Directory to save the signals to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
9507
9806
  type: "string"
9508
9807
  }).option("format", {
@@ -9578,12 +9877,12 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
9578
9877
  var SignalPushModule = {
9579
9878
  command: "push <directory>",
9580
9879
  describe: "Pushes all signals from files in a directory or package to Uniform",
9581
- builder: (yargs42) => withConfiguration(
9880
+ builder: (yargs43) => withConfiguration(
9582
9881
  withDebugOptions(
9583
9882
  withApiOptions(
9584
9883
  withProjectOptions(
9585
9884
  withDiffOptions(
9586
- yargs42.positional("directory", {
9885
+ yargs43.positional("directory", {
9587
9886
  describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
9588
9887
  type: "string"
9589
9888
  }).option("mode", {
@@ -9648,10 +9947,10 @@ var SignalRemoveModule = {
9648
9947
  command: "remove <id>",
9649
9948
  aliases: ["delete", "rm"],
9650
9949
  describe: "Delete a signal",
9651
- builder: (yargs42) => withConfiguration(
9950
+ builder: (yargs43) => withConfiguration(
9652
9951
  withApiOptions(
9653
9952
  withProjectOptions(
9654
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
9953
+ yargs43.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
9655
9954
  )
9656
9955
  )
9657
9956
  ),
@@ -9668,10 +9967,10 @@ var SignalUpdateModule = {
9668
9967
  command: "update <filename>",
9669
9968
  aliases: ["put"],
9670
9969
  describe: "Insert or update a signal",
9671
- builder: (yargs42) => withConfiguration(
9970
+ builder: (yargs43) => withConfiguration(
9672
9971
  withApiOptions(
9673
9972
  withProjectOptions(
9674
- yargs42.positional("filename", { demandOption: true, describe: "Signal file to put" })
9973
+ yargs43.positional("filename", { demandOption: true, describe: "Signal file to put" })
9675
9974
  )
9676
9975
  )
9677
9976
  ),
@@ -9688,25 +9987,25 @@ var SignalModule = {
9688
9987
  command: "signal <command>",
9689
9988
  aliases: ["sig"],
9690
9989
  describe: "Commands for Context signals",
9691
- builder: (yargs42) => yargs42.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
9990
+ builder: (yargs43) => yargs43.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
9692
9991
  handler: () => {
9693
- yargs25.help();
9992
+ yargs26.help();
9694
9993
  }
9695
9994
  };
9696
9995
 
9697
9996
  // src/commands/context/commands/test.ts
9698
- import yargs26 from "yargs";
9997
+ import yargs27 from "yargs";
9699
9998
 
9700
9999
  // src/commands/context/commands/test/get.ts
9701
10000
  import { UncachedTestClient } from "@uniformdev/context/api";
9702
10001
  var TestGetModule = {
9703
10002
  command: "get <id>",
9704
10003
  describe: "Fetch a test",
9705
- builder: (yargs42) => withConfiguration(
10004
+ builder: (yargs43) => withConfiguration(
9706
10005
  withFormatOptions(
9707
10006
  withApiOptions(
9708
10007
  withProjectOptions(
9709
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
10008
+ yargs43.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
9710
10009
  )
9711
10010
  )
9712
10011
  )
@@ -9730,7 +10029,7 @@ var TestListModule = {
9730
10029
  command: "list",
9731
10030
  describe: "List tests",
9732
10031
  aliases: ["ls"],
9733
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
10032
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
9734
10033
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9735
10034
  const fetch2 = nodeFetchProxy(proxy);
9736
10035
  const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9780,12 +10079,12 @@ function createTestEngineDataSource({
9780
10079
  var TestPullModule = {
9781
10080
  command: "pull <directory>",
9782
10081
  describe: "Pulls all tests to local files in a directory",
9783
- builder: (yargs42) => withConfiguration(
10082
+ builder: (yargs43) => withConfiguration(
9784
10083
  withDebugOptions(
9785
10084
  withApiOptions(
9786
10085
  withProjectOptions(
9787
10086
  withDiffOptions(
9788
- yargs42.positional("directory", {
10087
+ yargs43.positional("directory", {
9789
10088
  describe: "Directory to save the tests to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
9790
10089
  type: "string"
9791
10090
  }).option("format", {
@@ -9861,12 +10160,12 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
9861
10160
  var TestPushModule = {
9862
10161
  command: "push <directory>",
9863
10162
  describe: "Pushes all tests from files in a directory or package to Uniform",
9864
- builder: (yargs42) => withConfiguration(
10163
+ builder: (yargs43) => withConfiguration(
9865
10164
  withDebugOptions(
9866
10165
  withApiOptions(
9867
10166
  withProjectOptions(
9868
10167
  withDiffOptions(
9869
- yargs42.positional("directory", {
10168
+ yargs43.positional("directory", {
9870
10169
  describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
9871
10170
  type: "string"
9872
10171
  }).option("mode", {
@@ -9931,10 +10230,10 @@ var TestRemoveModule = {
9931
10230
  command: "remove <id>",
9932
10231
  aliases: ["delete", "rm"],
9933
10232
  describe: "Delete a test",
9934
- builder: (yargs42) => withConfiguration(
10233
+ builder: (yargs43) => withConfiguration(
9935
10234
  withApiOptions(
9936
10235
  withProjectOptions(
9937
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to delete" })
10236
+ yargs43.positional("id", { demandOption: true, describe: "Test public ID to delete" })
9938
10237
  )
9939
10238
  )
9940
10239
  ),
@@ -9951,9 +10250,9 @@ var TestUpdateModule = {
9951
10250
  command: "update <filename>",
9952
10251
  aliases: ["put"],
9953
10252
  describe: "Insert or update a test",
9954
- builder: (yargs42) => withConfiguration(
10253
+ builder: (yargs43) => withConfiguration(
9955
10254
  withApiOptions(
9956
- withProjectOptions(yargs42.positional("filename", { demandOption: true, describe: "Test file to put" }))
10255
+ withProjectOptions(yargs43.positional("filename", { demandOption: true, describe: "Test file to put" }))
9957
10256
  )
9958
10257
  ),
9959
10258
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
@@ -9968,9 +10267,9 @@ var TestUpdateModule = {
9968
10267
  var TestModule = {
9969
10268
  command: "test <command>",
9970
10269
  describe: "Commands for Context A/B tests",
9971
- builder: (yargs42) => yargs42.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
10270
+ builder: (yargs43) => yargs43.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
9972
10271
  handler: () => {
9973
- yargs26.help();
10272
+ yargs27.help();
9974
10273
  }
9975
10274
  };
9976
10275
 
@@ -9979,20 +10278,20 @@ var ContextCommand = {
9979
10278
  command: "context <command>",
9980
10279
  aliases: ["ctx"],
9981
10280
  describe: "Uniform Context commands",
9982
- builder: (yargs42) => yargs42.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
10281
+ builder: (yargs43) => yargs43.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
9983
10282
  handler: () => {
9984
- yargs27.showHelp();
10283
+ yargs28.showHelp();
9985
10284
  }
9986
10285
  };
9987
10286
 
9988
10287
  // src/commands/integration/index.ts
9989
- import yargs32 from "yargs";
10288
+ import yargs33 from "yargs";
9990
10289
 
9991
10290
  // src/commands/integration/commands/definition.ts
9992
- import yargs31 from "yargs";
10291
+ import yargs32 from "yargs";
9993
10292
 
9994
10293
  // src/commands/integration/commands/definition/dataResourceEditor/dataResourceEditor.ts
9995
- import yargs28 from "yargs";
10294
+ import yargs29 from "yargs";
9996
10295
 
9997
10296
  // src/commands/integration/commands/definition/dataResourceEditor/deploy.ts
9998
10297
  import { readFileSync as readFileSync2 } from "fs";
@@ -10063,8 +10362,8 @@ var EdgehancerClient = class extends ApiClient {
10063
10362
  };
10064
10363
 
10065
10364
  // src/commands/integration/commands/definition/dataResourceEditor/util.ts
10066
- function withDataResourceEditorIdOptions(yargs42) {
10067
- return yargs42.option("connectorType", {
10365
+ function withDataResourceEditorIdOptions(yargs43) {
10366
+ return yargs43.option("connectorType", {
10068
10367
  describe: "Integration data connector type to attach the data resource editor to, as defined in the integration manifest file.",
10069
10368
  demandOption: true,
10070
10369
  type: "string"
@@ -10084,11 +10383,11 @@ function withDataResourceEditorIdOptions(yargs42) {
10084
10383
  var IntegrationDataResourceEditorDeployModule = {
10085
10384
  command: "deploy <filename>",
10086
10385
  describe: "Deploys a custom AI data resource editor hook to run when AI edits data resources of a specific archetype. The API key used must have team admin permissions.",
10087
- builder: (yargs42) => withConfiguration(
10386
+ builder: (yargs43) => withConfiguration(
10088
10387
  withApiOptions(
10089
10388
  withTeamOptions(
10090
10389
  withDataResourceEditorIdOptions(
10091
- yargs42.positional("filename", {
10390
+ yargs43.positional("filename", {
10092
10391
  demandOption: true,
10093
10392
  describe: "ESM code file to run for the target data resource editor hook. Refer to the documentation for expected types."
10094
10393
  }).option("compatibilityDate", {
@@ -10131,7 +10430,7 @@ var IntegrationDataResourceEditorDeployModule = {
10131
10430
  var IntegrationDataResourceEditorRemoveModule = {
10132
10431
  command: "remove",
10133
10432
  describe: "Removes a custom AI data resource editor hook from a data resource archetype. The API key used must have team admin permissions.",
10134
- builder: (yargs42) => withConfiguration(withApiOptions(withTeamOptions(withDataResourceEditorIdOptions(yargs42)))),
10433
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withDataResourceEditorIdOptions(yargs43)))),
10135
10434
  handler: async ({ apiHost, apiKey, proxy, team: teamId, connectorType, archetype, hook }) => {
10136
10435
  const fetch2 = nodeFetchProxy(proxy);
10137
10436
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10143,21 +10442,21 @@ var IntegrationDataResourceEditorRemoveModule = {
10143
10442
  var IntegrationDataResourceEditorModule = {
10144
10443
  command: "dataResourceEditor <command>",
10145
10444
  describe: "Commands for managing custom AI data resource editors at the team level.",
10146
- builder: (yargs42) => yargs42.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10445
+ builder: (yargs43) => yargs43.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10147
10446
  handler: () => {
10148
- yargs28.help();
10447
+ yargs29.help();
10149
10448
  }
10150
10449
  };
10151
10450
 
10152
10451
  // src/commands/integration/commands/definition/edgehancer/edgehancer.ts
10153
- import yargs29 from "yargs";
10452
+ import yargs30 from "yargs";
10154
10453
 
10155
10454
  // src/commands/integration/commands/definition/edgehancer/deploy.ts
10156
10455
  import { readFileSync as readFileSync3 } from "fs";
10157
10456
 
10158
10457
  // src/commands/integration/commands/definition/edgehancer/util.ts
10159
- function withEdgehancerIdOptions(yargs42) {
10160
- return yargs42.option("connectorType", {
10458
+ function withEdgehancerIdOptions(yargs43) {
10459
+ return yargs43.option("connectorType", {
10161
10460
  describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
10162
10461
  demandOption: true,
10163
10462
  type: "string"
@@ -10177,11 +10476,11 @@ function withEdgehancerIdOptions(yargs42) {
10177
10476
  var IntegrationEdgehancerDeployModule = {
10178
10477
  command: "deploy <filename>",
10179
10478
  describe: "Deploys a custom edgehancer hook to run when a data resource of a specific archetype is fetched. The API key used must have team admin permissions.",
10180
- builder: (yargs42) => withConfiguration(
10479
+ builder: (yargs43) => withConfiguration(
10181
10480
  withApiOptions(
10182
10481
  withTeamOptions(
10183
10482
  withEdgehancerIdOptions(
10184
- yargs42.positional("filename", {
10483
+ yargs43.positional("filename", {
10185
10484
  demandOption: true,
10186
10485
  describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
10187
10486
  }).option("compatibilityDate", {
@@ -10224,7 +10523,7 @@ var IntegrationEdgehancerDeployModule = {
10224
10523
  var IntegrationEdgehancerRemoveModule = {
10225
10524
  command: "remove",
10226
10525
  describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
10227
- builder: (yargs42) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs42)))),
10526
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs43)))),
10228
10527
  handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
10229
10528
  const fetch2 = nodeFetchProxy(proxy);
10230
10529
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10236,22 +10535,22 @@ var IntegrationEdgehancerRemoveModule = {
10236
10535
  var IntegrationEdgehancerModule = {
10237
10536
  command: "edgehancer <command>",
10238
10537
  describe: "Commands for managing custom integration edgehancers at the team level.",
10239
- builder: (yargs42) => yargs42.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10538
+ builder: (yargs43) => yargs43.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10240
10539
  handler: () => {
10241
- yargs29.help();
10540
+ yargs30.help();
10242
10541
  }
10243
10542
  };
10244
10543
 
10245
10544
  // src/commands/integration/commands/definition/propertyEditor/propertyEditor.ts
10246
- import yargs30 from "yargs";
10545
+ import yargs31 from "yargs";
10247
10546
 
10248
10547
  // src/commands/integration/commands/definition/propertyEditor/deploy.ts
10249
10548
  import { IntegrationPropertyEditorsClient } from "@uniformdev/canvas";
10250
10549
  import { readFileSync as readFileSync4 } from "fs";
10251
10550
 
10252
10551
  // src/commands/integration/commands/definition/propertyEditor/util.ts
10253
- function withPropertyEditorIdOptions(yargs42) {
10254
- return yargs42.option("propertyType", {
10552
+ function withPropertyEditorIdOptions(yargs43) {
10553
+ return yargs43.option("propertyType", {
10255
10554
  describe: "Property type to attach the editor to.",
10256
10555
  demandOption: true,
10257
10556
  type: "string"
@@ -10267,11 +10566,11 @@ function withPropertyEditorIdOptions(yargs42) {
10267
10566
  var IntegrationPropertyEditorDeployModule = {
10268
10567
  command: "deploy <filename>",
10269
10568
  describe: "Deploys a custom AI property editor hook to run when a property of a specific type is edited. The API key used must have team admin permissions.",
10270
- builder: (yargs42) => withConfiguration(
10569
+ builder: (yargs43) => withConfiguration(
10271
10570
  withApiOptions(
10272
10571
  withTeamOptions(
10273
10572
  withPropertyEditorIdOptions(
10274
- yargs42.positional("filename", {
10573
+ yargs43.positional("filename", {
10275
10574
  demandOption: true,
10276
10575
  describe: "ESM code file to run for the target property editor hook. Refer to the documentation for expected types."
10277
10576
  }).option("compatibilityDate", {
@@ -10314,7 +10613,7 @@ import { IntegrationPropertyEditorsClient as IntegrationPropertyEditorsClient2 }
10314
10613
  var IntegrationPropertyEditorRemoveModule = {
10315
10614
  command: "remove",
10316
10615
  describe: "Deletes a custom AI property editor hook from a property type. The API key used must have team admin permissions.",
10317
- builder: (yargs42) => withConfiguration(withApiOptions(withTeamOptions(withPropertyEditorIdOptions(yargs42)))),
10616
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withPropertyEditorIdOptions(yargs43)))),
10318
10617
  handler: async ({ apiHost, apiKey, proxy, team: teamId, propertyType, hook }) => {
10319
10618
  const fetch2 = nodeFetchProxy(proxy);
10320
10619
  const client = new IntegrationPropertyEditorsClient2({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10326,9 +10625,9 @@ var IntegrationPropertyEditorRemoveModule = {
10326
10625
  var IntegrationPropertyEditorModule = {
10327
10626
  command: "propertyEditor <command>",
10328
10627
  describe: "Commands for managing custom AI property editors at the team level.",
10329
- builder: (yargs42) => yargs42.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10628
+ builder: (yargs43) => yargs43.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10330
10629
  handler: () => {
10331
- yargs30.help();
10630
+ yargs31.help();
10332
10631
  }
10333
10632
  };
10334
10633
 
@@ -10368,10 +10667,10 @@ var DefinitionClient = class extends ApiClient2 {
10368
10667
  var IntegrationDefinitionRegisterModule = {
10369
10668
  command: "register <filename>",
10370
10669
  describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
10371
- builder: (yargs42) => withConfiguration(
10670
+ builder: (yargs43) => withConfiguration(
10372
10671
  withApiOptions(
10373
10672
  withTeamOptions(
10374
- yargs42.positional("filename", {
10673
+ yargs43.positional("filename", {
10375
10674
  demandOption: true,
10376
10675
  describe: "Integration definition manifest to register"
10377
10676
  })
@@ -10390,10 +10689,10 @@ var IntegrationDefinitionRegisterModule = {
10390
10689
  var IntegrationDefinitionRemoveModule = {
10391
10690
  command: "remove <type>",
10392
10691
  describe: "Deletes a custom integration definition from a team. This will uninstall it on any active projects. Existing usages of the integration may break. The API key used must have team admin permissions.",
10393
- builder: (yargs42) => withConfiguration(
10692
+ builder: (yargs43) => withConfiguration(
10394
10693
  withApiOptions(
10395
10694
  withTeamOptions(
10396
- yargs42.positional("type", {
10695
+ yargs43.positional("type", {
10397
10696
  demandOption: true,
10398
10697
  describe: "Integration type (from its manifest) to remove."
10399
10698
  })
@@ -10411,9 +10710,9 @@ var IntegrationDefinitionRemoveModule = {
10411
10710
  var IntegrationDefinitionModule = {
10412
10711
  command: "definition <command>",
10413
10712
  describe: "Commands for managing custom integration definitions at the team level.",
10414
- builder: (yargs42) => yargs42.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).command(IntegrationDataResourceEditorModule).command(IntegrationPropertyEditorModule).demandCommand(),
10713
+ builder: (yargs43) => yargs43.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).command(IntegrationDataResourceEditorModule).command(IntegrationPropertyEditorModule).demandCommand(),
10415
10714
  handler: () => {
10416
- yargs31.help();
10715
+ yargs32.help();
10417
10716
  }
10418
10717
  };
10419
10718
 
@@ -10453,10 +10752,10 @@ var InstallClient = class extends ApiClient3 {
10453
10752
  var IntegrationInstallModule = {
10454
10753
  command: "install <type>",
10455
10754
  describe: "Installs an integration to a project. The integration may be built-in or custom. Custom integrations must be registered to the parent team first.",
10456
- builder: (yargs42) => withConfiguration(
10755
+ builder: (yargs43) => withConfiguration(
10457
10756
  withApiOptions(
10458
10757
  withProjectOptions(
10459
- yargs42.positional("type", {
10758
+ yargs43.positional("type", {
10460
10759
  demandOption: true,
10461
10760
  describe: "Integration type to install (as defined in its manifest)"
10462
10761
  }).option("configuration", {
@@ -10478,10 +10777,10 @@ var IntegrationInstallModule = {
10478
10777
  var IntegrationUninstallModule = {
10479
10778
  command: "uninstall <type>",
10480
10779
  describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
10481
- builder: (yargs42) => withConfiguration(
10780
+ builder: (yargs43) => withConfiguration(
10482
10781
  withApiOptions(
10483
10782
  withProjectOptions(
10484
- yargs42.positional("type", {
10783
+ yargs43.positional("type", {
10485
10784
  demandOption: true,
10486
10785
  describe: "Integration type to uninstall (as defined in its manifest)"
10487
10786
  })
@@ -10499,9 +10798,9 @@ var IntegrationUninstallModule = {
10499
10798
  var IntegrationCommand = {
10500
10799
  command: "integration <command>",
10501
10800
  describe: "Integration management commands",
10502
- builder: (yargs42) => yargs42.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
10801
+ builder: (yargs43) => yargs43.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
10503
10802
  handler: () => {
10504
- yargs32.showHelp();
10803
+ yargs33.showHelp();
10505
10804
  }
10506
10805
  };
10507
10806
 
@@ -10966,14 +11265,14 @@ var NewMeshCmd = {
10966
11265
  };
10967
11266
 
10968
11267
  // src/commands/policy-documents/index.ts
10969
- import yargs33 from "yargs";
11268
+ import yargs34 from "yargs";
10970
11269
 
10971
11270
  // src/commands/policy-documents/commands/list.ts
10972
11271
  var PolicyDocumentsListModule = {
10973
11272
  command: "list",
10974
11273
  describe: "List policy documents for a project",
10975
11274
  aliases: ["ls"],
10976
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11275
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
10977
11276
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
10978
11277
  const fetch2 = nodeFetchProxy(proxy, verbose);
10979
11278
  const url = new URL(`/api/v1/policy-documents`, apiHost);
@@ -11058,12 +11357,12 @@ var selectDisplayName13 = (policyDoc) => `Policy document for role ${policyDoc.r
11058
11357
  var PolicyDocumentsPullModule = {
11059
11358
  command: "pull <directory>",
11060
11359
  describe: "Pulls all policy documents to local files in a directory",
11061
- builder: (yargs42) => withConfiguration(
11360
+ builder: (yargs43) => withConfiguration(
11062
11361
  withApiOptions(
11063
11362
  withDebugOptions(
11064
11363
  withProjectOptions(
11065
11364
  withDiffOptions(
11066
- yargs42.positional("directory", {
11365
+ yargs43.positional("directory", {
11067
11366
  describe: "Directory to save to. Each policy document will be saved as a separate file named by role ID.",
11068
11367
  type: "string"
11069
11368
  }).option("format", {
@@ -11118,7 +11417,8 @@ var PolicyDocumentsPullModule = {
11118
11417
  };
11119
11418
 
11120
11419
  // src/commands/policy-documents/commands/push.ts
11121
- import { readdir as readdir2, stat } from "fs/promises";
11420
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
11421
+ import { readdir as readdir2 } from "fs/promises";
11122
11422
  import { extname as extname2, join as join11 } from "path";
11123
11423
  async function readLocalPolicyDocuments(directory, format, verbose) {
11124
11424
  const files = await readdir2(directory);
@@ -11196,12 +11496,12 @@ function mergePolicyDocuments(localDocs, remoteDocs, mode) {
11196
11496
  var PolicyDocumentsPushModule = {
11197
11497
  command: "push <directory>",
11198
11498
  describe: "Pushes policy documents from local files to Uniform",
11199
- builder: (yargs42) => withConfiguration(
11499
+ builder: (yargs43) => withConfiguration(
11200
11500
  withApiOptions(
11201
11501
  withDebugOptions(
11202
11502
  withProjectOptions(
11203
11503
  withDiffOptions(
11204
- yargs42.positional("directory", {
11504
+ yargs43.positional("directory", {
11205
11505
  describe: "Directory containing policy document files (one file per role ID).",
11206
11506
  type: "string"
11207
11507
  }).option("format", {
@@ -11235,16 +11535,11 @@ var PolicyDocumentsPushModule = {
11235
11535
  allowEmptySource,
11236
11536
  verbose
11237
11537
  }) => {
11238
- try {
11239
- const dirStat = await stat(directory);
11240
- if (!dirStat.isDirectory()) {
11241
- throw new Error(`Path "${directory}" is not a directory`);
11242
- }
11243
- } catch (e) {
11244
- if (e.code === "ENOENT") {
11245
- throw new Error(`Directory "${directory}" does not exist`);
11538
+ if (!existsSync5(directory)) {
11539
+ if (verbose) {
11540
+ console.log(`Creating directory ${directory}`);
11246
11541
  }
11247
- throw e;
11542
+ mkdirSync4(directory, { recursive: true });
11248
11543
  }
11249
11544
  const fetch2 = nodeFetchProxy(proxy, verbose);
11250
11545
  const localDocs = await readLocalPolicyDocuments(directory, format, verbose);
@@ -11302,17 +11597,17 @@ var PolicyDocumentsCommand = {
11302
11597
  command: "policy-documents <command>",
11303
11598
  aliases: ["policy", "policies"],
11304
11599
  describe: "Uniform Policy Documents commands",
11305
- builder: (yargs42) => yargs42.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11600
+ builder: (yargs43) => yargs43.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11306
11601
  handler: () => {
11307
- yargs33.showHelp();
11602
+ yargs34.showHelp();
11308
11603
  }
11309
11604
  };
11310
11605
 
11311
11606
  // src/commands/project-map/index.ts
11312
- import yargs36 from "yargs";
11607
+ import yargs37 from "yargs";
11313
11608
 
11314
11609
  // src/commands/project-map/commands/projectMapDefinition.ts
11315
- import yargs34 from "yargs";
11610
+ import yargs35 from "yargs";
11316
11611
 
11317
11612
  // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
11318
11613
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
@@ -11326,11 +11621,11 @@ function getProjectMapClient(options) {
11326
11621
  var ProjectMapDefinitionGetModule = {
11327
11622
  command: "get <id>",
11328
11623
  describe: "Fetch a project map",
11329
- builder: (yargs42) => withFormatOptions(
11624
+ builder: (yargs43) => withFormatOptions(
11330
11625
  withConfiguration(
11331
11626
  withApiOptions(
11332
11627
  withProjectOptions(
11333
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11628
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11334
11629
  )
11335
11630
  )
11336
11631
  )
@@ -11353,7 +11648,7 @@ var ProjectMapDefinitionListModule = {
11353
11648
  command: "list",
11354
11649
  describe: "List of project maps",
11355
11650
  aliases: ["ls"],
11356
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11651
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
11357
11652
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
11358
11653
  const fetch2 = nodeFetchProxy(proxy);
11359
11654
  const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -11407,12 +11702,12 @@ function createProjectMapDefinitionEngineDataSource({
11407
11702
  var ProjectMapDefinitionPullModule = {
11408
11703
  command: "pull <directory>",
11409
11704
  describe: "Pulls all project maps to local files in a directory",
11410
- builder: (yargs42) => withConfiguration(
11705
+ builder: (yargs43) => withConfiguration(
11411
11706
  withDebugOptions(
11412
11707
  withApiOptions(
11413
11708
  withProjectOptions(
11414
11709
  withDiffOptions(
11415
- yargs42.positional("directory", {
11710
+ yargs43.positional("directory", {
11416
11711
  describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
11417
11712
  type: "string"
11418
11713
  }).option("format", {
@@ -11487,12 +11782,12 @@ var ProjectMapDefinitionPullModule = {
11487
11782
  var ProjectMapDefinitionPushModule = {
11488
11783
  command: "push <directory>",
11489
11784
  describe: "Pushes all project maps from files in a directory or package to Uniform",
11490
- builder: (yargs42) => withConfiguration(
11785
+ builder: (yargs43) => withConfiguration(
11491
11786
  withDebugOptions(
11492
11787
  withApiOptions(
11493
11788
  withProjectOptions(
11494
11789
  withDiffOptions(
11495
- yargs42.positional("directory", {
11790
+ yargs43.positional("directory", {
11496
11791
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11497
11792
  type: "string"
11498
11793
  }).option("mode", {
@@ -11556,9 +11851,9 @@ var ProjectMapDefinitionRemoveModule = {
11556
11851
  command: "remove <id>",
11557
11852
  aliases: ["delete", "rm"],
11558
11853
  describe: "Delete a project map",
11559
- builder: (yargs42) => withConfiguration(
11854
+ builder: (yargs43) => withConfiguration(
11560
11855
  withApiOptions(
11561
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
11856
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
11562
11857
  )
11563
11858
  ),
11564
11859
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -11573,10 +11868,10 @@ var ProjectMapDefinitionUpdateModule = {
11573
11868
  command: "update <filename>",
11574
11869
  aliases: ["put"],
11575
11870
  describe: "Insert or update a project map",
11576
- builder: (yargs42) => withConfiguration(
11871
+ builder: (yargs43) => withConfiguration(
11577
11872
  withApiOptions(
11578
11873
  withProjectOptions(
11579
- yargs42.positional("filename", { demandOption: true, describe: "Project map file to put" })
11874
+ yargs43.positional("filename", { demandOption: true, describe: "Project map file to put" })
11580
11875
  )
11581
11876
  )
11582
11877
  ),
@@ -11592,24 +11887,24 @@ var ProjectMapDefinitionUpdateModule = {
11592
11887
  var ProjectMapDefinitionModule = {
11593
11888
  command: "definition <command>",
11594
11889
  describe: "Commands for ProjectMap Definitions",
11595
- builder: (yargs42) => yargs42.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
11890
+ builder: (yargs43) => yargs43.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
11596
11891
  handler: () => {
11597
- yargs34.help();
11892
+ yargs35.help();
11598
11893
  }
11599
11894
  };
11600
11895
 
11601
11896
  // src/commands/project-map/commands/projectMapNode.ts
11602
- import yargs35 from "yargs";
11897
+ import yargs36 from "yargs";
11603
11898
 
11604
11899
  // src/commands/project-map/commands/ProjectMapNode/get.ts
11605
11900
  var ProjectMapNodeGetModule = {
11606
11901
  command: "get <id> <projectMapId>",
11607
11902
  describe: "Fetch a project map node",
11608
- builder: (yargs42) => withConfiguration(
11903
+ builder: (yargs43) => withConfiguration(
11609
11904
  withFormatOptions(
11610
11905
  withApiOptions(
11611
11906
  withProjectOptions(
11612
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
11907
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
11613
11908
  )
11614
11909
  )
11615
11910
  )
@@ -11633,12 +11928,12 @@ var ProjectMapNodeListModule = {
11633
11928
  command: "list <projectMapId>",
11634
11929
  describe: "List project map nodes",
11635
11930
  aliases: ["ls"],
11636
- builder: (yargs42) => withConfiguration(
11931
+ builder: (yargs43) => withConfiguration(
11637
11932
  withFormatOptions(
11638
11933
  withApiOptions(
11639
11934
  withProjectOptions(
11640
11935
  withStateOptions(
11641
- yargs42.positional("projectMapId", {
11936
+ yargs43.positional("projectMapId", {
11642
11937
  demandOption: true,
11643
11938
  describe: "ProjectMap UUID to fetch from"
11644
11939
  })
@@ -11716,12 +12011,12 @@ function createProjectMapNodeEngineDataSource({
11716
12011
  var ProjectMapNodePullModule = {
11717
12012
  command: "pull <directory>",
11718
12013
  describe: "Pulls all project maps nodes to local files in a directory",
11719
- builder: (yargs42) => withConfiguration(
12014
+ builder: (yargs43) => withConfiguration(
11720
12015
  withDebugOptions(
11721
12016
  withApiOptions(
11722
12017
  withProjectOptions(
11723
12018
  withDiffOptions(
11724
- yargs42.positional("directory", {
12019
+ yargs43.positional("directory", {
11725
12020
  describe: "Directory to save project maps to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
11726
12021
  type: "string"
11727
12022
  }).option("format", {
@@ -11803,12 +12098,12 @@ import {
11803
12098
  var ProjectMapNodePushModule = {
11804
12099
  command: "push <directory>",
11805
12100
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
11806
- builder: (yargs42) => withConfiguration(
12101
+ builder: (yargs43) => withConfiguration(
11807
12102
  withDebugOptions(
11808
12103
  withApiOptions(
11809
12104
  withProjectOptions(
11810
12105
  withDiffOptions(
11811
- yargs42.positional("directory", {
12106
+ yargs43.positional("directory", {
11812
12107
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11813
12108
  type: "string"
11814
12109
  }).option("mode", {
@@ -11910,10 +12205,10 @@ var ProjectMapNodeRemoveModule = {
11910
12205
  command: "remove <id> <projectMapId>",
11911
12206
  aliases: ["delete", "rm"],
11912
12207
  describe: "Delete a project map node",
11913
- builder: (yargs42) => withConfiguration(
12208
+ builder: (yargs43) => withConfiguration(
11914
12209
  withApiOptions(
11915
12210
  withProjectOptions(
11916
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
12211
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
11917
12212
  )
11918
12213
  )
11919
12214
  ),
@@ -11929,10 +12224,10 @@ var ProjectMapNodeUpdateModule = {
11929
12224
  command: "update <filename> <projectMapId>",
11930
12225
  aliases: ["put"],
11931
12226
  describe: "Insert or update a project map node",
11932
- builder: (yargs42) => withConfiguration(
12227
+ builder: (yargs43) => withConfiguration(
11933
12228
  withApiOptions(
11934
12229
  withProjectOptions(
11935
- yargs42.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
12230
+ yargs43.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
11936
12231
  )
11937
12232
  )
11938
12233
  ),
@@ -11948,9 +12243,9 @@ var ProjectMapNodeUpdateModule = {
11948
12243
  var ProjectMapNodeModule = {
11949
12244
  command: "node <command>",
11950
12245
  describe: "Commands for ProjectMap Nodes",
11951
- builder: (yargs42) => yargs42.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
12246
+ builder: (yargs43) => yargs43.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
11952
12247
  handler: () => {
11953
- yargs35.help();
12248
+ yargs36.help();
11954
12249
  }
11955
12250
  };
11956
12251
 
@@ -11959,17 +12254,17 @@ var ProjectMapCommand = {
11959
12254
  command: "project-map <command>",
11960
12255
  aliases: ["prm"],
11961
12256
  describe: "Uniform ProjectMap commands",
11962
- builder: (yargs42) => yargs42.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
12257
+ builder: (yargs43) => yargs43.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
11963
12258
  handler: () => {
11964
- yargs36.showHelp();
12259
+ yargs37.showHelp();
11965
12260
  }
11966
12261
  };
11967
12262
 
11968
12263
  // src/commands/redirect/index.ts
11969
- import yargs38 from "yargs";
12264
+ import yargs39 from "yargs";
11970
12265
 
11971
12266
  // src/commands/redirect/commands/redirect.ts
11972
- import yargs37 from "yargs";
12267
+ import yargs38 from "yargs";
11973
12268
 
11974
12269
  // src/commands/redirect/commands/RedirectDefinition/_util.ts
11975
12270
  import { UncachedRedirectClient } from "@uniformdev/redirect";
@@ -11994,11 +12289,11 @@ function getRedirectClient(options) {
11994
12289
  var RedirectDefinitionGetModule = {
11995
12290
  command: "get <id>",
11996
12291
  describe: "Fetch a redirect",
11997
- builder: (yargs42) => withConfiguration(
12292
+ builder: (yargs43) => withConfiguration(
11998
12293
  withFormatOptions(
11999
12294
  withApiOptions(
12000
12295
  withProjectOptions(
12001
- yargs42.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12296
+ yargs43.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12002
12297
  )
12003
12298
  )
12004
12299
  )
@@ -12021,7 +12316,7 @@ var RedirectDefinitionListModule = {
12021
12316
  command: "list",
12022
12317
  describe: "List of redirects",
12023
12318
  aliases: ["ls"],
12024
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
12319
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
12025
12320
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
12026
12321
  const fetch2 = nodeFetchProxy(proxy);
12027
12322
  const client = getRedirectClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -12073,12 +12368,12 @@ function createRedirectDefinitionEngineDataSource({
12073
12368
  var RedirectDefinitionPullModule = {
12074
12369
  command: "pull <directory>",
12075
12370
  describe: "Pulls all redirects to local files in a directory",
12076
- builder: (yargs42) => withConfiguration(
12371
+ builder: (yargs43) => withConfiguration(
12077
12372
  withDebugOptions(
12078
12373
  withApiOptions(
12079
12374
  withProjectOptions(
12080
12375
  withDiffOptions(
12081
- yargs42.positional("directory", {
12376
+ yargs43.positional("directory", {
12082
12377
  describe: "Directory to save redirects to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
12083
12378
  type: "string"
12084
12379
  }).option("format", {
@@ -12154,12 +12449,12 @@ var RedirectDefinitionPullModule = {
12154
12449
  var RedirectDefinitionPushModule = {
12155
12450
  command: "push <directory>",
12156
12451
  describe: "Pushes all redirects from files in a directory or package to Uniform",
12157
- builder: (yargs42) => withConfiguration(
12452
+ builder: (yargs43) => withConfiguration(
12158
12453
  withDebugOptions(
12159
12454
  withApiOptions(
12160
12455
  withProjectOptions(
12161
12456
  withDiffOptions(
12162
- yargs42.positional("directory", {
12457
+ yargs43.positional("directory", {
12163
12458
  describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
12164
12459
  type: "string"
12165
12460
  }).option("mode", {
@@ -12223,9 +12518,9 @@ var RedirectDefinitionRemoveModule = {
12223
12518
  command: "remove <id>",
12224
12519
  aliases: ["delete", "rm"],
12225
12520
  describe: "Delete a redirect",
12226
- builder: (yargs42) => withConfiguration(
12521
+ builder: (yargs43) => withConfiguration(
12227
12522
  withApiOptions(
12228
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
12523
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
12229
12524
  )
12230
12525
  ),
12231
12526
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -12240,10 +12535,10 @@ var RedirectDefinitionUpdateModule = {
12240
12535
  command: "update <filename>",
12241
12536
  aliases: ["put"],
12242
12537
  describe: "Insert or update a redirect",
12243
- builder: (yargs42) => withConfiguration(
12538
+ builder: (yargs43) => withConfiguration(
12244
12539
  withApiOptions(
12245
12540
  withProjectOptions(
12246
- yargs42.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12541
+ yargs43.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12247
12542
  )
12248
12543
  )
12249
12544
  ),
@@ -12259,9 +12554,9 @@ var RedirectDefinitionUpdateModule = {
12259
12554
  var RedirectDefinitionModule = {
12260
12555
  command: "definition <command>",
12261
12556
  describe: "Commands for Redirect Definitions",
12262
- builder: (yargs42) => yargs42.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12557
+ builder: (yargs43) => yargs43.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12263
12558
  handler: () => {
12264
- yargs37.help();
12559
+ yargs38.help();
12265
12560
  }
12266
12561
  };
12267
12562
 
@@ -12270,20 +12565,20 @@ var RedirectCommand = {
12270
12565
  command: "redirect <command>",
12271
12566
  aliases: ["red"],
12272
12567
  describe: "Uniform Redirect commands",
12273
- builder: (yargs42) => yargs42.command(RedirectDefinitionModule).demandCommand(),
12568
+ builder: (yargs43) => yargs43.command(RedirectDefinitionModule).demandCommand(),
12274
12569
  handler: () => {
12275
- yargs38.showHelp();
12570
+ yargs39.showHelp();
12276
12571
  }
12277
12572
  };
12278
12573
 
12279
12574
  // src/commands/sync/index.ts
12280
- import yargs39 from "yargs";
12575
+ import yargs40 from "yargs";
12281
12576
 
12282
12577
  // src/webhooksClient.ts
12283
12578
  import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
12284
12579
  import PQueue3 from "p-queue";
12285
12580
  import { Svix } from "svix";
12286
- import * as z3 from "zod/v3";
12581
+ import * as z3 from "zod";
12287
12582
  var WEBHOOKS_DASHBOARD_BASE_PATH = "/api/v1/svix-dashboard";
12288
12583
  var WebhooksClient = class extends ApiClient4 {
12289
12584
  constructor(options) {
@@ -12471,12 +12766,12 @@ function createWebhookEngineDataSource({
12471
12766
  var WebhookPullModule = {
12472
12767
  command: "pull <directory>",
12473
12768
  describe: "Pulls all webhooks to local files in a directory",
12474
- builder: (yargs42) => withConfiguration(
12769
+ builder: (yargs43) => withConfiguration(
12475
12770
  withApiOptions(
12476
12771
  withDebugOptions(
12477
12772
  withProjectOptions(
12478
12773
  withDiffOptions(
12479
- yargs42.positional("directory", {
12774
+ yargs43.positional("directory", {
12480
12775
  describe: "Directory to save to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
12481
12776
  type: "string"
12482
12777
  }).option("format", {
@@ -12662,11 +12957,12 @@ function numPad(num, spaces = 6) {
12662
12957
  var SyncPullModule = {
12663
12958
  command: "pull",
12664
12959
  describe: "Pulls whole project to local files in a directory",
12665
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs42))))),
12960
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs43))))),
12666
12961
  handler: async ({ serialization, ...otherParams }) => {
12667
12962
  const config2 = serialization;
12668
12963
  const enabledEntities = Object.entries({
12669
12964
  locale: LocalePullModule,
12965
+ label: LabelPullModule,
12670
12966
  asset: AssetPullModule,
12671
12967
  category: CategoryPullModule,
12672
12968
  workflow: WorkflowPullModule,
@@ -12761,12 +13057,12 @@ var getFormat = (entityType, config2) => {
12761
13057
  var WebhookPushModule = {
12762
13058
  command: "push <directory>",
12763
13059
  describe: "Pushes all webhooks from files in a directory to Uniform",
12764
- builder: (yargs42) => withConfiguration(
13060
+ builder: (yargs43) => withConfiguration(
12765
13061
  withDebugOptions(
12766
13062
  withApiOptions(
12767
13063
  withProjectOptions(
12768
13064
  withDiffOptions(
12769
- yargs42.positional("directory", {
13065
+ yargs43.positional("directory", {
12770
13066
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
12771
13067
  type: "string"
12772
13068
  }).option("mode", {
@@ -12830,11 +13126,12 @@ var WebhookPushModule = {
12830
13126
  var SyncPushModule = {
12831
13127
  command: "push",
12832
13128
  describe: "Pushes whole project data from files in a directory or package to Uniform",
12833
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs42))))),
13129
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs43))))),
12834
13130
  handler: async ({ serialization, ...otherParams }) => {
12835
13131
  const config2 = serialization;
12836
13132
  const enabledEntities = Object.entries({
12837
13133
  locale: LocalePushModule,
13134
+ label: LabelPushModule,
12838
13135
  asset: AssetPushModule,
12839
13136
  category: CategoryPushModule,
12840
13137
  workflow: WorkflowPushModule,
@@ -13040,21 +13337,21 @@ var getFormat2 = (entityType, config2) => {
13040
13337
  var SyncCommand = {
13041
13338
  command: "sync <command>",
13042
13339
  describe: "Uniform Sync commands",
13043
- builder: (yargs42) => yargs42.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13340
+ builder: (yargs43) => yargs43.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13044
13341
  handler: () => {
13045
- yargs39.showHelp();
13342
+ yargs40.showHelp();
13046
13343
  }
13047
13344
  };
13048
13345
 
13049
13346
  // src/commands/webhook/index.ts
13050
- import yargs40 from "yargs";
13347
+ import yargs41 from "yargs";
13051
13348
  var WebhookCommand = {
13052
13349
  command: "webhook <command>",
13053
13350
  aliases: ["wh"],
13054
13351
  describe: "Commands for webhooks",
13055
- builder: (yargs42) => yargs42.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13352
+ builder: (yargs43) => yargs43.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13056
13353
  handler: () => {
13057
- yargs40.help();
13354
+ yargs41.help();
13058
13355
  }
13059
13356
  };
13060
13357
 
@@ -13062,7 +13359,7 @@ var WebhookCommand = {
13062
13359
  import { bold as bold3, gray as gray6, green as green7 } from "colorette";
13063
13360
 
13064
13361
  // src/updateCheck.ts
13065
- import { existsSync as existsSync5, promises as fs8 } from "fs";
13362
+ import { existsSync as existsSync6, promises as fs8 } from "fs";
13066
13363
  import { get as getHttp } from "http";
13067
13364
  import { get as getHttps } from "https";
13068
13365
  import { tmpdir } from "os";
@@ -13074,7 +13371,7 @@ var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
13074
13371
  var getFile = async (details, distTag) => {
13075
13372
  const rootDir = tmpdir();
13076
13373
  const subDir = join12(rootDir, "update-check");
13077
- if (!existsSync5(subDir)) {
13374
+ if (!existsSync6(subDir)) {
13078
13375
  await fs8.mkdir(subDir);
13079
13376
  }
13080
13377
  let name = `${details.name}-${distTag}.json`;
@@ -13084,7 +13381,7 @@ var getFile = async (details, distTag) => {
13084
13381
  return join12(subDir, name);
13085
13382
  };
13086
13383
  var evaluateCache = async (file, time, interval) => {
13087
- if (existsSync5(file)) {
13384
+ if (existsSync6(file)) {
13088
13385
  const content = await fs8.readFile(file, "utf8");
13089
13386
  const { lastUpdate, latest } = JSON.parse(content);
13090
13387
  const nextCheck = lastUpdate + interval;
@@ -13289,7 +13586,7 @@ First found was: v${firstVersion}`;
13289
13586
 
13290
13587
  // src/index.ts
13291
13588
  dotenv.config();
13292
- var yarggery = yargs41(hideBin(process.argv));
13589
+ var yarggery = yargs42(hideBin(process.argv));
13293
13590
  var useDefaultConfig = !process.argv.includes("--config");
13294
13591
  var defaultConfig2 = useDefaultConfig ? loadConfig(null) : {};
13295
13592
  yarggery.option("verbose", {