@uniformdev/cli 20.50.2-alpha.2 → 20.50.2-alpha.39

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-LRSNDSYX.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
@@ -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
1049
  import * as z2 from "zod/v3";
1047
- var query = gql`
1048
- query GetUserInfo($subject: String!) {
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,62 @@ 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
  )
4689
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4646
4690
  ),
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
- }
4691
+ handler: createCompositionRemoveHandler("composition")
4659
4692
  };
4660
4693
 
4661
4694
  // src/commands/canvas/commands/componentPattern/remove.ts
4662
4695
  var ComponentPatternRemoveModule = {
4663
4696
  ...CompositionRemoveModule,
4664
- describe: "Delete a component pattern"
4697
+ describe: "Delete a component pattern",
4698
+ handler: createCompositionRemoveHandler("component-pattern")
4665
4699
  };
4666
4700
 
4667
4701
  // src/commands/canvas/commands/composition/unpublish.ts
@@ -4673,11 +4707,11 @@ import { diffJson as diffJson2 } from "diff";
4673
4707
  var CompositionUnpublishModule = {
4674
4708
  command: "unpublish [ids]",
4675
4709
  describe: "Unpublish a composition(s)",
4676
- builder: (yargs42) => withConfiguration(
4710
+ builder: (yargs43) => withConfiguration(
4677
4711
  withApiOptions(
4678
4712
  withDebugOptions(
4679
4713
  withProjectOptions(
4680
- yargs42.positional("ids", {
4714
+ yargs43.positional("ids", {
4681
4715
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4682
4716
  type: "string"
4683
4717
  }).option("all", {
@@ -4788,11 +4822,11 @@ var CompositionUnpublishModule = {
4788
4822
  var ComponentPatternUnpublishModule = {
4789
4823
  command: "unpublish [ids]",
4790
4824
  describe: "Unpublish a component pattern(s)",
4791
- builder: (yargs42) => withConfiguration(
4825
+ builder: (yargs43) => withConfiguration(
4792
4826
  withApiOptions(
4793
4827
  withDebugOptions(
4794
4828
  withProjectOptions(
4795
- yargs42.positional("ids", {
4829
+ yargs43.positional("ids", {
4796
4830
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4797
4831
  type: "string"
4798
4832
  }).option("all", {
@@ -4822,16 +4856,50 @@ var ComponentPatternUnpublishModule = {
4822
4856
  };
4823
4857
 
4824
4858
  // src/commands/canvas/commands/composition/update.ts
4859
+ function createCompositionUpdateHandler(expectedType) {
4860
+ return async ({
4861
+ apiHost,
4862
+ apiKey,
4863
+ proxy,
4864
+ filename,
4865
+ project: projectId,
4866
+ state,
4867
+ verbose,
4868
+ whatIf
4869
+ }) => {
4870
+ if (verbose) {
4871
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
4872
+ }
4873
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4874
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4875
+ const file = readFileToObject(filename);
4876
+ const id = file.composition._id;
4877
+ const validation = await validateCompositionType(client, id, expectedType);
4878
+ if (validation.exists && !validation.isValid) {
4879
+ console.error(formatCompositionTypeError(id, validation.actualType, expectedType, "update"));
4880
+ process.exit(1);
4881
+ }
4882
+ if (!whatIf) {
4883
+ await client.updateComposition({ ...file, state: convertStateOption(state) });
4884
+ } else {
4885
+ whatIfSimpleLog({
4886
+ id,
4887
+ displayName: `${getCompositionDisplayName(expectedType)}: ${file.composition._name}`,
4888
+ action: "update"
4889
+ });
4890
+ }
4891
+ };
4892
+ }
4825
4893
  var CompositionUpdateModule = {
4826
4894
  command: "update <filename>",
4827
4895
  aliases: ["put"],
4828
4896
  describe: "Insert or update a composition",
4829
- builder: (yargs42) => withConfiguration(
4897
+ builder: (yargs43) => withConfiguration(
4830
4898
  withApiOptions(
4831
4899
  withProjectOptions(
4832
4900
  withDebugOptions(
4833
4901
  withStateOptions(
4834
- yargs42.positional("filename", {
4902
+ yargs43.positional("filename", {
4835
4903
  demandOption: true,
4836
4904
  describe: "Composition/pattern file to put"
4837
4905
  })
@@ -4840,36 +4908,21 @@ var CompositionUpdateModule = {
4840
4908
  )
4841
4909
  )
4842
4910
  ),
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
- }
4911
+ handler: createCompositionUpdateHandler("composition")
4860
4912
  };
4861
4913
 
4862
4914
  // src/commands/canvas/commands/componentPattern/update.ts
4863
4915
  var ComponentPatternUpdateModule = {
4864
4916
  ...CompositionUpdateModule,
4865
- describe: "Insert or update a component pattern"
4917
+ describe: "Insert or update a component pattern",
4918
+ handler: createCompositionUpdateHandler("component-pattern")
4866
4919
  };
4867
4920
 
4868
4921
  // src/commands/canvas/commands/componentPattern.ts
4869
4922
  var ComponentPatternModule = {
4870
4923
  command: "component-pattern <command>",
4871
4924
  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(),
4925
+ builder: (yargs43) => yargs43.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
4873
4926
  handler: () => {
4874
4927
  yargs7.help();
4875
4928
  }
@@ -4881,7 +4934,7 @@ var CompositionModule = {
4881
4934
  command: "composition <command>",
4882
4935
  describe: "Commands for Canvas compositions",
4883
4936
  aliases: ["comp"],
4884
- builder: (yargs42) => yargs42.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
4937
+ builder: (yargs43) => yargs43.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
4885
4938
  handler: () => {
4886
4939
  yargs8.help();
4887
4940
  }
@@ -4893,20 +4946,21 @@ import yargs9 from "yargs";
4893
4946
  // src/commands/canvas/commands/compositionPattern/get.ts
4894
4947
  var CompositionPatternGetModule = {
4895
4948
  ...CompositionGetModule,
4896
- describe: "Fetch a composition pattern"
4949
+ describe: "Fetch a composition pattern",
4950
+ handler: createCompositionGetHandler("composition-pattern")
4897
4951
  };
4898
4952
 
4899
4953
  // src/commands/canvas/commands/compositionPattern/list.ts
4900
4954
  var CompositionPatternListModule = {
4901
4955
  ...CompositionListModule,
4902
4956
  describe: "List composition patterns",
4903
- builder: (yargs42) => withFormatOptions(
4957
+ builder: (yargs43) => withFormatOptions(
4904
4958
  withConfiguration(
4905
4959
  withApiOptions(
4906
4960
  withDebugOptions(
4907
4961
  withProjectOptions(
4908
4962
  withStateOptions(
4909
- yargs42.options({
4963
+ yargs43.options({
4910
4964
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
4911
4965
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
4912
4966
  resolvePatterns: {
@@ -4950,12 +5004,12 @@ var CompositionPatternListModule = {
4950
5004
  var CompositionPatternPublishModule = {
4951
5005
  ...CompositionPublishModule,
4952
5006
  describe: "Publishes composition pattern(s)",
4953
- builder: (yargs42) => withConfiguration(
5007
+ builder: (yargs43) => withConfiguration(
4954
5008
  withApiOptions(
4955
5009
  withDebugOptions(
4956
5010
  withProjectOptions(
4957
5011
  withDiffOptions(
4958
- yargs42.positional("ids", {
5012
+ yargs43.positional("ids", {
4959
5013
  describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4960
5014
  type: "string"
4961
5015
  }).option("all", {
@@ -4994,13 +5048,13 @@ var CompositionPatternPublishModule = {
4994
5048
  var CompositionPatternPullModule = {
4995
5049
  ...componentInstancePullModuleFactory("compositionPatterns"),
4996
5050
  describe: "Pulls all composition patterns to local files in a directory",
4997
- builder: (yargs42) => withConfiguration(
5051
+ builder: (yargs43) => withConfiguration(
4998
5052
  withApiOptions(
4999
5053
  withDebugOptions(
5000
5054
  withProjectOptions(
5001
5055
  withStateOptions(
5002
5056
  withDiffOptions(
5003
- yargs42.positional("directory", {
5057
+ yargs43.positional("directory", {
5004
5058
  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
5059
  type: "string"
5006
5060
  }).option("format", {
@@ -5038,13 +5092,13 @@ var CompositionPatternPullModule = {
5038
5092
  var CompositionPatternPushModule = {
5039
5093
  ...componentInstancePushModuleFactory("compositionPatterns"),
5040
5094
  describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
5041
- builder: (yargs42) => withConfiguration(
5095
+ builder: (yargs43) => withConfiguration(
5042
5096
  withApiOptions(
5043
5097
  withDebugOptions(
5044
5098
  withProjectOptions(
5045
5099
  withStateOptions(
5046
5100
  withDiffOptions(
5047
- yargs42.positional("directory", {
5101
+ yargs43.positional("directory", {
5048
5102
  describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
5049
5103
  type: "string"
5050
5104
  }).option("mode", {
@@ -5076,18 +5130,19 @@ var CompositionPatternPushModule = {
5076
5130
  // src/commands/canvas/commands/compositionPattern/remove.ts
5077
5131
  var CompositionPatternRemoveModule = {
5078
5132
  ...CompositionRemoveModule,
5079
- describe: "Delete a composition pattern"
5133
+ describe: "Delete a composition pattern",
5134
+ handler: createCompositionRemoveHandler("composition-pattern")
5080
5135
  };
5081
5136
 
5082
5137
  // src/commands/canvas/commands/compositionPattern/unpublish.ts
5083
5138
  var CompositionPatternUnpublishModule = {
5084
5139
  command: "unpublish [ids]",
5085
5140
  describe: "Unpublish a composition pattern(s)",
5086
- builder: (yargs42) => withConfiguration(
5141
+ builder: (yargs43) => withConfiguration(
5087
5142
  withApiOptions(
5088
5143
  withDebugOptions(
5089
5144
  withProjectOptions(
5090
- yargs42.positional("ids", {
5145
+ yargs43.positional("ids", {
5091
5146
  describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
5092
5147
  type: "string"
5093
5148
  }).option("all", {
@@ -5116,14 +5171,15 @@ var CompositionPatternUnpublishModule = {
5116
5171
  // src/commands/canvas/commands/compositionPattern/update.ts
5117
5172
  var CompositionPatternUpdateModule = {
5118
5173
  ...CompositionUpdateModule,
5119
- describe: "Insert or update a composition pattern"
5174
+ describe: "Insert or update a composition pattern",
5175
+ handler: createCompositionUpdateHandler("composition-pattern")
5120
5176
  };
5121
5177
 
5122
5178
  // src/commands/canvas/commands/compositionPattern.ts
5123
5179
  var CompositionPatternModule = {
5124
5180
  command: "composition-pattern <command>",
5125
5181
  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(),
5182
+ builder: (yargs43) => yargs43.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
5127
5183
  handler: () => {
5128
5184
  yargs9.help();
5129
5185
  }
@@ -5144,12 +5200,12 @@ function getContentClient(options) {
5144
5200
  var ContentTypeGetModule = {
5145
5201
  command: "get <id>",
5146
5202
  describe: "Get a content type",
5147
- builder: (yargs42) => withConfiguration(
5203
+ builder: (yargs43) => withConfiguration(
5148
5204
  withDebugOptions(
5149
5205
  withFormatOptions(
5150
5206
  withApiOptions(
5151
5207
  withProjectOptions(
5152
- yargs42.positional("id", {
5208
+ yargs43.positional("id", {
5153
5209
  demandOption: true,
5154
5210
  describe: "Content type public ID to fetch"
5155
5211
  })
@@ -5174,7 +5230,7 @@ var ContentTypeGetModule = {
5174
5230
  var ContentTypeListModule = {
5175
5231
  command: "list",
5176
5232
  describe: "List content types",
5177
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5233
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
5178
5234
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5179
5235
  const fetch2 = nodeFetchProxy(proxy, verbose);
5180
5236
  const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5215,12 +5271,12 @@ function createContentTypeEngineDataSource({
5215
5271
  var ContentTypePullModule = {
5216
5272
  command: "pull <directory>",
5217
5273
  describe: "Pulls all content types to local files in a directory",
5218
- builder: (yargs42) => withConfiguration(
5274
+ builder: (yargs43) => withConfiguration(
5219
5275
  withApiOptions(
5220
5276
  withDebugOptions(
5221
5277
  withProjectOptions(
5222
5278
  withDiffOptions(
5223
- yargs42.positional("directory", {
5279
+ yargs43.positional("directory", {
5224
5280
  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
5281
  type: "string"
5226
5282
  }).option("format", {
@@ -5300,12 +5356,12 @@ var ContentTypePullModule = {
5300
5356
  var ContentTypePushModule = {
5301
5357
  command: "push <directory>",
5302
5358
  describe: "Pushes all content types from files in a directory to Uniform",
5303
- builder: (yargs42) => withConfiguration(
5359
+ builder: (yargs43) => withConfiguration(
5304
5360
  withApiOptions(
5305
5361
  withDebugOptions(
5306
5362
  withProjectOptions(
5307
5363
  withDiffOptions(
5308
- yargs42.positional("directory", {
5364
+ yargs43.positional("directory", {
5309
5365
  describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
5310
5366
  type: "string"
5311
5367
  }).option("what-if", {
@@ -5379,11 +5435,11 @@ var ContentTypeRemoveModule = {
5379
5435
  command: "remove <id>",
5380
5436
  aliases: ["delete", "rm"],
5381
5437
  describe: "Delete a content type",
5382
- builder: (yargs42) => withConfiguration(
5438
+ builder: (yargs43) => withConfiguration(
5383
5439
  withDebugOptions(
5384
5440
  withApiOptions(
5385
5441
  withProjectOptions(
5386
- yargs42.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5442
+ yargs43.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5387
5443
  )
5388
5444
  )
5389
5445
  )
@@ -5404,11 +5460,11 @@ var ContentTypeUpdateModule = {
5404
5460
  command: "update <filename>",
5405
5461
  aliases: ["put"],
5406
5462
  describe: "Insert or update a content type",
5407
- builder: (yargs42) => withConfiguration(
5463
+ builder: (yargs43) => withConfiguration(
5408
5464
  withDebugOptions(
5409
5465
  withApiOptions(
5410
5466
  withProjectOptions(
5411
- yargs42.positional("filename", { demandOption: true, describe: "Content type file to put" })
5467
+ yargs43.positional("filename", { demandOption: true, describe: "Content type file to put" })
5412
5468
  )
5413
5469
  )
5414
5470
  )
@@ -5430,7 +5486,7 @@ var ContentTypeModule = {
5430
5486
  command: "contenttype <command>",
5431
5487
  aliases: ["ct"],
5432
5488
  describe: "Commands for Content Types",
5433
- builder: (yargs42) => yargs42.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5489
+ builder: (yargs43) => yargs43.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5434
5490
  handler: () => {
5435
5491
  yargs10.help();
5436
5492
  }
@@ -5449,11 +5505,11 @@ function getDataSourceClient(options) {
5449
5505
  var DataSourceGetModule = {
5450
5506
  command: "get <id>",
5451
5507
  describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
5452
- builder: (yargs42) => withConfiguration(
5508
+ builder: (yargs43) => withConfiguration(
5453
5509
  withApiOptions(
5454
5510
  withDebugOptions(
5455
5511
  withProjectOptions(
5456
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5512
+ yargs43.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5457
5513
  )
5458
5514
  )
5459
5515
  )
@@ -5471,11 +5527,11 @@ var DataSourceRemoveModule = {
5471
5527
  command: "remove <id>",
5472
5528
  aliases: ["delete", "rm"],
5473
5529
  describe: "Delete a data source",
5474
- builder: (yargs42) => withConfiguration(
5530
+ builder: (yargs43) => withConfiguration(
5475
5531
  withDebugOptions(
5476
5532
  withApiOptions(
5477
5533
  withProjectOptions(
5478
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5534
+ yargs43.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5479
5535
  )
5480
5536
  )
5481
5537
  )
@@ -5496,11 +5552,11 @@ var DataSourceUpdateModule = {
5496
5552
  command: "update <dataSource>",
5497
5553
  aliases: ["put"],
5498
5554
  describe: "Insert or update a data source",
5499
- builder: (yargs42) => withConfiguration(
5555
+ builder: (yargs43) => withConfiguration(
5500
5556
  withApiOptions(
5501
5557
  withDebugOptions(
5502
5558
  withProjectOptions(
5503
- yargs42.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5559
+ yargs43.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5504
5560
  describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
5505
5561
  type: "string",
5506
5562
  demandOption: true
@@ -5535,7 +5591,7 @@ var DataSourceModule = {
5535
5591
  command: "datasource <command>",
5536
5592
  aliases: ["ds"],
5537
5593
  describe: "Commands for Data Source definitions",
5538
- builder: (yargs42) => yargs42.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5594
+ builder: (yargs43) => yargs43.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5539
5595
  handler: () => {
5540
5596
  yargs11.help();
5541
5597
  }
@@ -5557,12 +5613,12 @@ var DataTypeGetModule = {
5557
5613
  command: "get <id>",
5558
5614
  describe: "Get a data type",
5559
5615
  aliases: ["ls"],
5560
- builder: (yargs42) => withConfiguration(
5616
+ builder: (yargs43) => withConfiguration(
5561
5617
  withFormatOptions(
5562
5618
  withDebugOptions(
5563
5619
  withApiOptions(
5564
5620
  withProjectOptions(
5565
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5621
+ yargs43.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5566
5622
  )
5567
5623
  )
5568
5624
  )
@@ -5585,7 +5641,7 @@ var DataTypeListModule = {
5585
5641
  command: "list",
5586
5642
  describe: "List data types",
5587
5643
  aliases: ["ls"],
5588
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5644
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
5589
5645
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5590
5646
  const fetch2 = nodeFetchProxy(proxy, verbose);
5591
5647
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5628,12 +5684,12 @@ function createDataTypeEngineDataSource({
5628
5684
  var DataTypePullModule = {
5629
5685
  command: "pull <directory>",
5630
5686
  describe: "Pulls all data types to local files in a directory",
5631
- builder: (yargs42) => withConfiguration(
5687
+ builder: (yargs43) => withConfiguration(
5632
5688
  withApiOptions(
5633
5689
  withDebugOptions(
5634
5690
  withProjectOptions(
5635
5691
  withDiffOptions(
5636
- yargs42.positional("directory", {
5692
+ yargs43.positional("directory", {
5637
5693
  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
5694
  type: "string"
5639
5695
  }).option("format", {
@@ -5713,12 +5769,12 @@ var DataTypePullModule = {
5713
5769
  var DataTypePushModule = {
5714
5770
  command: "push <directory>",
5715
5771
  describe: "Pushes all data types from files in a directory to Uniform",
5716
- builder: (yargs42) => withConfiguration(
5772
+ builder: (yargs43) => withConfiguration(
5717
5773
  withApiOptions(
5718
5774
  withDebugOptions(
5719
5775
  withProjectOptions(
5720
5776
  withDiffOptions(
5721
- yargs42.positional("directory", {
5777
+ yargs43.positional("directory", {
5722
5778
  describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
5723
5779
  type: "string"
5724
5780
  }).option("mode", {
@@ -5787,11 +5843,11 @@ var DataTypeRemoveModule = {
5787
5843
  command: "remove <id>",
5788
5844
  aliases: ["delete", "rm"],
5789
5845
  describe: "Delete a data type",
5790
- builder: (yargs42) => withConfiguration(
5846
+ builder: (yargs43) => withConfiguration(
5791
5847
  withDebugOptions(
5792
5848
  withApiOptions(
5793
5849
  withProjectOptions(
5794
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
5850
+ yargs43.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
5795
5851
  )
5796
5852
  )
5797
5853
  )
@@ -5812,11 +5868,11 @@ var DataTypeUpdateModule = {
5812
5868
  command: "update <filename>",
5813
5869
  aliases: ["put"],
5814
5870
  describe: "Insert or update a data type",
5815
- builder: (yargs42) => withConfiguration(
5871
+ builder: (yargs43) => withConfiguration(
5816
5872
  withDebugOptions(
5817
5873
  withApiOptions(
5818
5874
  withProjectOptions(
5819
- yargs42.positional("filename", { demandOption: true, describe: "Data type file to put" })
5875
+ yargs43.positional("filename", { demandOption: true, describe: "Data type file to put" })
5820
5876
  )
5821
5877
  )
5822
5878
  )
@@ -5838,7 +5894,7 @@ var DataTypeModule = {
5838
5894
  command: "datatype <command>",
5839
5895
  aliases: ["dt"],
5840
5896
  describe: "Commands for Data Type definitions",
5841
- builder: (yargs42) => yargs42.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
5897
+ builder: (yargs43) => yargs43.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
5842
5898
  handler: () => {
5843
5899
  yargs12.help();
5844
5900
  }
@@ -5848,16 +5904,64 @@ var DataTypeModule = {
5848
5904
  import yargs13 from "yargs";
5849
5905
 
5850
5906
  // src/commands/canvas/commands/entry/get.ts
5907
+ function createEntryGetHandler(expectedType) {
5908
+ return async ({
5909
+ apiHost,
5910
+ edgeApiHost,
5911
+ apiKey,
5912
+ proxy,
5913
+ id,
5914
+ format,
5915
+ filename,
5916
+ project: projectId,
5917
+ state,
5918
+ resolveData,
5919
+ diagnostics,
5920
+ resolutionDepth,
5921
+ withComponentIDs,
5922
+ verbose
5923
+ }) => {
5924
+ if (verbose) {
5925
+ console.log(`\u{1F41B} get ${expectedType}: (id: ${id})`);
5926
+ }
5927
+ const fetch2 = nodeFetchProxy(proxy, verbose);
5928
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
5929
+ const res = await client.getEntries({
5930
+ offset: 0,
5931
+ limit: 1,
5932
+ entryIDs: [id],
5933
+ state: convertStateOption(state),
5934
+ skipOverridesResolution: true,
5935
+ skipPatternResolution: true,
5936
+ skipDataResolution: !resolveData,
5937
+ diagnostics: resolveData ? diagnostics : void 0,
5938
+ resolutionDepth: resolveData ? resolutionDepth : void 0,
5939
+ withComponentIDs,
5940
+ pattern: expectedType === "entry-pattern" ? true : void 0
5941
+ });
5942
+ if (res.entries.length !== 1) {
5943
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
5944
+ process.exit(1);
5945
+ }
5946
+ const entry = res.entries[0];
5947
+ const actualType = getEntryActualType(entry);
5948
+ if (actualType !== expectedType) {
5949
+ console.error(formatEntryTypeError(id, actualType, expectedType, "get"));
5950
+ process.exit(1);
5951
+ }
5952
+ emitWithFormat(entry, format, filename);
5953
+ };
5954
+ }
5851
5955
  var EntryGetModule = {
5852
5956
  command: "get <id>",
5853
5957
  describe: "Get an entry",
5854
- builder: (yargs42) => withConfiguration(
5958
+ builder: (yargs43) => withConfiguration(
5855
5959
  withDebugOptions(
5856
5960
  withFormatOptions(
5857
5961
  withApiOptions(
5858
5962
  withProjectOptions(
5859
5963
  withStateOptions(
5860
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
5964
+ yargs43.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
5861
5965
  resolveData: {
5862
5966
  type: "boolean",
5863
5967
  default: false,
@@ -5887,41 +5991,7 @@ var EntryGetModule = {
5887
5991
  )
5888
5992
  )
5889
5993
  ),
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
- }
5994
+ handler: createEntryGetHandler("entry")
5925
5995
  };
5926
5996
 
5927
5997
  // src/commands/canvas/commands/entry/list.ts
@@ -5929,13 +5999,13 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
5929
5999
  var EntryListModule = {
5930
6000
  command: "list",
5931
6001
  describe: "List entries",
5932
- builder: (yargs42) => withConfiguration(
6002
+ builder: (yargs43) => withConfiguration(
5933
6003
  withDebugOptions(
5934
6004
  withFormatOptions(
5935
6005
  withApiOptions(
5936
6006
  withProjectOptions(
5937
6007
  withStateOptions(
5938
- yargs42.options({
6008
+ yargs43.options({
5939
6009
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
5940
6010
  limit: {
5941
6011
  describe: "Number of rows to fetch",
@@ -6070,12 +6140,12 @@ function createEntryEngineDataSource({
6070
6140
  var EntryPublishModule = {
6071
6141
  command: "publish [ids]",
6072
6142
  describe: "Publishes entry(ies)",
6073
- builder: (yargs42) => withConfiguration(
6143
+ builder: (yargs43) => withConfiguration(
6074
6144
  withDebugOptions(
6075
6145
  withDiffOptions(
6076
6146
  withApiOptions(
6077
6147
  withProjectOptions(
6078
- yargs42.positional("ids", {
6148
+ yargs43.positional("ids", {
6079
6149
  describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6080
6150
  type: "string"
6081
6151
  }).option("all", {
@@ -6150,13 +6220,13 @@ var EntryPublishModule = {
6150
6220
  var EntryPullModule = {
6151
6221
  command: "pull <directory>",
6152
6222
  describe: "Pulls all entries to local files in a directory",
6153
- builder: (yargs42) => withConfiguration(
6223
+ builder: (yargs43) => withConfiguration(
6154
6224
  withDebugOptions(
6155
6225
  withApiOptions(
6156
6226
  withProjectOptions(
6157
6227
  withStateOptions(
6158
6228
  withDiffOptions(
6159
- yargs42.positional("directory", {
6229
+ yargs43.positional("directory", {
6160
6230
  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
6231
  type: "string"
6162
6232
  }).option("format", {
@@ -6256,13 +6326,13 @@ var EntryPullModule = {
6256
6326
  var EntryPushModule = {
6257
6327
  command: "push <directory>",
6258
6328
  describe: "Pushes all entries from files in a directory to Uniform",
6259
- builder: (yargs42) => withConfiguration(
6329
+ builder: (yargs43) => withConfiguration(
6260
6330
  withDebugOptions(
6261
6331
  withApiOptions(
6262
6332
  withProjectOptions(
6263
6333
  withStateOptions(
6264
6334
  withDiffOptions(
6265
- yargs42.positional("directory", {
6335
+ yargs43.positional("directory", {
6266
6336
  describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
6267
6337
  type: "string"
6268
6338
  }).option("mode", {
@@ -6357,28 +6427,51 @@ var EntryPushModule = {
6357
6427
  };
6358
6428
 
6359
6429
  // src/commands/canvas/commands/entry/remove.ts
6430
+ function createEntryRemoveHandler(expectedType) {
6431
+ return async ({
6432
+ apiHost,
6433
+ apiKey,
6434
+ proxy,
6435
+ id,
6436
+ project: projectId,
6437
+ verbose,
6438
+ whatIf
6439
+ }) => {
6440
+ if (verbose) {
6441
+ console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
6442
+ }
6443
+ const fetch2 = nodeFetchProxy(proxy, verbose);
6444
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6445
+ const validation = await validateEntryType(client, id, expectedType);
6446
+ if (!validation.exists) {
6447
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
6448
+ process.exit(1);
6449
+ }
6450
+ if (!validation.isValid) {
6451
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "delete"));
6452
+ process.exit(1);
6453
+ }
6454
+ if (!whatIf) {
6455
+ await client.deleteEntry({ entryId: id });
6456
+ } else {
6457
+ whatIfSimpleLog({ id, displayName: getEntryDisplayName(expectedType), action: "delete" });
6458
+ }
6459
+ };
6460
+ }
6360
6461
  var EntryRemoveModule = {
6361
6462
  command: "remove <id>",
6362
6463
  aliases: ["delete", "rm"],
6363
6464
  describe: "Delete an entry",
6364
- builder: (yargs42) => withConfiguration(
6465
+ builder: (yargs43) => withConfiguration(
6365
6466
  withDebugOptions(
6366
6467
  withApiOptions(
6367
6468
  withProjectOptions(
6368
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6469
+ yargs43.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6369
6470
  )
6370
6471
  )
6371
6472
  )
6372
6473
  ),
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
- }
6474
+ handler: createEntryRemoveHandler("entry")
6382
6475
  };
6383
6476
 
6384
6477
  // src/commands/canvas/commands/entry/unpublish.ts
@@ -6387,11 +6480,11 @@ import { diffJson as diffJson3 } from "diff";
6387
6480
  var EntryUnpublishModule = {
6388
6481
  command: "unpublish [ids]",
6389
6482
  describe: "Unpublish an entry(ies)",
6390
- builder: (yargs42) => withConfiguration(
6483
+ builder: (yargs43) => withConfiguration(
6391
6484
  withDebugOptions(
6392
6485
  withApiOptions(
6393
6486
  withProjectOptions(
6394
- yargs42.positional("ids", {
6487
+ yargs43.positional("ids", {
6395
6488
  describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6396
6489
  type: "string"
6397
6490
  }).option("all", {
@@ -6472,22 +6565,8 @@ var EntryUnpublishModule = {
6472
6565
  };
6473
6566
 
6474
6567
  // 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 ({
6568
+ function createEntryUpdateHandler(expectedType) {
6569
+ return async ({
6491
6570
  apiHost,
6492
6571
  edgeApiHost,
6493
6572
  apiKey,
@@ -6498,22 +6577,52 @@ var EntryUpdateModule = {
6498
6577
  verbose,
6499
6578
  whatIf
6500
6579
  }) => {
6580
+ if (verbose) {
6581
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
6582
+ }
6501
6583
  const fetch2 = nodeFetchProxy(proxy, verbose);
6502
6584
  const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6503
6585
  const file = readFileToObject(filename);
6586
+ const id = file.entry._id;
6587
+ const validation = await validateEntryType(client, id, expectedType);
6588
+ if (validation.exists && !validation.isValid) {
6589
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "update"));
6590
+ process.exit(1);
6591
+ }
6504
6592
  if (!whatIf) {
6505
6593
  await client.upsertEntry({ ...file, state: convertStateOption(state) });
6506
6594
  } else {
6507
- whatIfSimpleLog({ id: file.entry._id, displayName: `Entry: ${file.entry._name}`, action: "update" });
6595
+ whatIfSimpleLog({
6596
+ id,
6597
+ displayName: `${getEntryDisplayName(expectedType)}: ${file.entry._name}`,
6598
+ action: "update"
6599
+ });
6508
6600
  }
6509
- }
6601
+ };
6602
+ }
6603
+ var EntryUpdateModule = {
6604
+ command: "update <filename>",
6605
+ aliases: ["put"],
6606
+ describe: "Insert or update an entry",
6607
+ builder: (yargs43) => withConfiguration(
6608
+ withDebugOptions(
6609
+ withApiOptions(
6610
+ withProjectOptions(
6611
+ withStateOptions(
6612
+ yargs43.positional("filename", { demandOption: true, describe: "Entry file to put" })
6613
+ )
6614
+ )
6615
+ )
6616
+ )
6617
+ ),
6618
+ handler: createEntryUpdateHandler("entry")
6510
6619
  };
6511
6620
 
6512
6621
  // src/commands/canvas/commands/entry.ts
6513
6622
  var EntryModule = {
6514
6623
  command: "entry <command>",
6515
6624
  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(),
6625
+ builder: (yargs43) => yargs43.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
6517
6626
  handler: () => {
6518
6627
  yargs13.help();
6519
6628
  }
@@ -6526,16 +6635,28 @@ import yargs14 from "yargs";
6526
6635
  var EntryPatternGetModule = {
6527
6636
  command: "get <id>",
6528
6637
  describe: "Get an entry pattern",
6529
- builder: (yargs42) => withConfiguration(
6638
+ builder: (yargs43) => withConfiguration(
6530
6639
  withDebugOptions(
6531
6640
  withFormatOptions(
6532
6641
  withApiOptions(
6533
6642
  withProjectOptions(
6534
6643
  withStateOptions(
6535
- yargs42.positional("id", {
6536
- demandOption: true,
6537
- describe: "Entry pattern public ID to fetch"
6538
- }).option({
6644
+ yargs43.positional("id", { demandOption: true, describe: "Entry pattern public ID to fetch" }).option({
6645
+ resolveData: {
6646
+ type: "boolean",
6647
+ default: false,
6648
+ describe: "Resolve all data resources used by the entry pattern"
6649
+ },
6650
+ diagnostics: {
6651
+ type: "boolean",
6652
+ default: false,
6653
+ describe: "Include diagnostics information when resolving data"
6654
+ },
6655
+ resolutionDepth: {
6656
+ type: "number",
6657
+ default: 1,
6658
+ describe: "Controls how many levels deep content references should be resolved"
6659
+ },
6539
6660
  withComponentIDs: {
6540
6661
  type: "boolean",
6541
6662
  default: false,
@@ -6549,49 +6670,20 @@ var EntryPatternGetModule = {
6549
6670
  )
6550
6671
  )
6551
6672
  ),
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
- }
6673
+ handler: createEntryGetHandler("entry-pattern")
6582
6674
  };
6583
6675
 
6584
6676
  // src/commands/canvas/commands/entryPattern/list.ts
6585
6677
  var EntryPatternListModule = {
6586
6678
  command: "list",
6587
6679
  describe: "List entry patterns",
6588
- builder: (yargs42) => withConfiguration(
6680
+ builder: (yargs43) => withConfiguration(
6589
6681
  withDebugOptions(
6590
6682
  withFormatOptions(
6591
6683
  withApiOptions(
6592
6684
  withProjectOptions(
6593
6685
  withStateOptions(
6594
- yargs42.option({
6686
+ yargs43.option({
6595
6687
  withComponentIDs: {
6596
6688
  type: "boolean",
6597
6689
  default: false,
@@ -6637,12 +6729,12 @@ var EntryPatternListModule = {
6637
6729
  var EntryPatternPublishModule = {
6638
6730
  command: "publish [ids]",
6639
6731
  describe: "Publishes entry pattern(s)",
6640
- builder: (yargs42) => withConfiguration(
6732
+ builder: (yargs43) => withConfiguration(
6641
6733
  withDebugOptions(
6642
6734
  withApiOptions(
6643
6735
  withProjectOptions(
6644
6736
  withDiffOptions(
6645
- yargs42.positional("ids", {
6737
+ yargs43.positional("ids", {
6646
6738
  describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6647
6739
  type: "string"
6648
6740
  }).option("all", {
@@ -6717,13 +6809,13 @@ var EntryPatternPublishModule = {
6717
6809
  var EntryPatternPullModule = {
6718
6810
  command: "pull <directory>",
6719
6811
  describe: "Pulls all entry patterns to local files in a directory",
6720
- builder: (yargs42) => withConfiguration(
6812
+ builder: (yargs43) => withConfiguration(
6721
6813
  withApiOptions(
6722
6814
  withDebugOptions(
6723
6815
  withProjectOptions(
6724
6816
  withStateOptions(
6725
6817
  withDiffOptions(
6726
- yargs42.positional("directory", {
6818
+ yargs43.positional("directory", {
6727
6819
  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
6820
  type: "string"
6729
6821
  }).option("format", {
@@ -6823,13 +6915,13 @@ var EntryPatternPullModule = {
6823
6915
  var EntryPatternPushModule = {
6824
6916
  command: "push <directory>",
6825
6917
  describe: "Pushes all entry patterns from files in a directory to Uniform",
6826
- builder: (yargs42) => withConfiguration(
6918
+ builder: (yargs43) => withConfiguration(
6827
6919
  withDebugOptions(
6828
6920
  withApiOptions(
6829
6921
  withProjectOptions(
6830
6922
  withStateOptions(
6831
6923
  withDiffOptions(
6832
- yargs42.positional("directory", {
6924
+ yargs43.positional("directory", {
6833
6925
  describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
6834
6926
  type: "string"
6835
6927
  }).option("what-if", {
@@ -6933,24 +7025,16 @@ var EntryPatternRemoveModule = {
6933
7025
  command: "remove <id>",
6934
7026
  aliases: ["delete", "rm"],
6935
7027
  describe: "Delete an entry pattern",
6936
- builder: (yargs42) => withConfiguration(
7028
+ builder: (yargs43) => withConfiguration(
6937
7029
  withDebugOptions(
6938
7030
  withApiOptions(
6939
7031
  withProjectOptions(
6940
- yargs42.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
7032
+ yargs43.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
6941
7033
  )
6942
7034
  )
6943
7035
  )
6944
7036
  ),
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
- }
7037
+ handler: createEntryRemoveHandler("entry-pattern")
6954
7038
  };
6955
7039
 
6956
7040
  // src/commands/canvas/commands/entryPattern/unpublish.ts
@@ -6959,11 +7043,11 @@ import { diffJson as diffJson4 } from "diff";
6959
7043
  var EntryPatternUnpublishModule = {
6960
7044
  command: "unpublish [ids]",
6961
7045
  describe: "Unpublish entry pattern(s)",
6962
- builder: (yargs42) => withConfiguration(
7046
+ builder: (yargs43) => withConfiguration(
6963
7047
  withDebugOptions(
6964
7048
  withApiOptions(
6965
7049
  withProjectOptions(
6966
- yargs42.positional("ids", {
7050
+ yargs43.positional("ids", {
6967
7051
  describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6968
7052
  type: "string"
6969
7053
  }).option("all", {
@@ -6976,84 +7060,254 @@ var EntryPatternUnpublishModule = {
6976
7060
  )
6977
7061
  )
6978
7062
  ),
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();
7063
+ handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
7064
+ if (!all && !ids || all && ids) {
7065
+ console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
7066
+ process.exit(1);
7067
+ }
7068
+ const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
7069
+ const targetItems = /* @__PURE__ */ new Map();
7070
+ const fetch2 = nodeFetchProxy(proxy, verbose);
7071
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
7072
+ const source = createEntryEngineDataSource({
7073
+ client,
7074
+ state: "published",
7075
+ entryIDs: entryIDsArray,
7076
+ onlyPatterns: true
7077
+ });
7078
+ const target = createEntryEngineDataSource({
7079
+ client,
7080
+ state: "preview",
7081
+ entryIDs: entryIDsArray,
7082
+ onlyPatterns: true
7083
+ });
7084
+ const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
7085
+ for await (const obj of target.objects) {
7086
+ if (Array.isArray(obj.id)) {
7087
+ obj.id.forEach((o) => targetItems.set(o, obj));
7088
+ } else {
7089
+ targetItems.set(obj.id, obj);
7090
+ }
7091
+ }
7092
+ const toUnpublish = [];
7093
+ for await (const sourceObject of source.objects) {
7094
+ toUnpublish.push(sourceObject);
7095
+ }
7096
+ const actions = [];
7097
+ for (const sourceObject of toUnpublish) {
7098
+ const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
7099
+ const targetObject = targetItems.get(id);
7100
+ if (!targetObject) {
7101
+ console.log(`Entry pattern ${id} did not have a draft (removing published)`);
7102
+ }
7103
+ if (!whatIf) {
7104
+ actions.push(
7105
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7106
+ const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7107
+ if (isNotFound) {
7108
+ console.warn(
7109
+ `Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
7110
+ );
7111
+ return;
7112
+ }
7113
+ throw err;
7114
+ })
7115
+ );
7116
+ }
7117
+ log2({
7118
+ action: "update",
7119
+ id,
7120
+ providerId: sourceObject.providerId,
7121
+ displayName: sourceObject.displayName ?? sourceObject.providerId,
7122
+ whatIf,
7123
+ diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
7124
+ });
7125
+ }
7126
+ await Promise.all(actions);
7127
+ }
7128
+ };
7129
+
7130
+ // src/commands/canvas/commands/entryPattern/update.ts
7131
+ var EntryPatternUpdateModule = {
7132
+ command: "update <filename>",
7133
+ aliases: ["put"],
7134
+ describe: "Insert or update an entry pattern",
7135
+ builder: (yargs43) => withConfiguration(
7136
+ withDebugOptions(
7137
+ withApiOptions(
7138
+ withProjectOptions(
7139
+ withStateOptions(
7140
+ yargs43.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7141
+ )
7142
+ )
7143
+ )
7144
+ )
7145
+ ),
7146
+ handler: createEntryUpdateHandler("entry-pattern")
7147
+ };
7148
+
7149
+ // src/commands/canvas/commands/entryPattern.ts
7150
+ var EntryPatternModule = {
7151
+ command: "entry-pattern <command>",
7152
+ describe: "Commands for Entry patterns",
7153
+ builder: (yargs43) => yargs43.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
7154
+ handler: () => {
7155
+ yargs14.help();
7156
+ }
7157
+ };
7158
+
7159
+ // src/commands/canvas/commands/label.ts
7160
+ import yargs15 from "yargs";
7161
+
7162
+ // src/commands/canvas/labelsEngineDataSource.ts
7163
+ function normalizeLabelForSync(label) {
7164
+ const { projectId: _projectId, ...labelWithoutProjectId } = label;
7165
+ return labelWithoutProjectId;
7166
+ }
7167
+ function createLabelsEngineDataSource({
7168
+ client
7169
+ }) {
7170
+ async function* getObjects() {
7171
+ const labels = paginateAsync(
7172
+ async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
7173
+ { pageSize: 100 }
7174
+ );
7175
+ for await (const label of labels) {
7176
+ const result = {
7177
+ id: label.label.publicId,
7178
+ displayName: `${label.label.displayName} (pid: ${label.label.publicId})`,
7179
+ providerId: label.label.publicId,
7180
+ object: normalizeLabelForSync(label)
7181
+ };
7182
+ yield result;
7183
+ }
7184
+ }
7185
+ return {
7186
+ name: "Uniform API",
7187
+ objects: getObjects(),
7188
+ deleteObject: async (providerId) => {
7189
+ await client.removeLabel({ labelId: providerId });
7190
+ },
7191
+ writeObject: async ({ object: object4 }) => {
7192
+ await client.upsertLabel({ label: object4.label });
7193
+ }
7194
+ };
7195
+ }
7196
+
7197
+ // src/commands/canvas/commands/label/_util.ts
7198
+ import { LabelClient } from "@uniformdev/canvas";
7199
+ var selectLabelIdentifier = (label) => label.label.publicId;
7200
+ var selectLabelDisplayName = (label) => `${label.label.displayName} (pid: ${label.label.publicId})`;
7201
+ function getLabelClient(options) {
7202
+ return new LabelClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
7203
+ }
7204
+
7205
+ // src/commands/canvas/commands/label/pull.ts
7206
+ var LabelPullModule = {
7207
+ command: "pull <directory>",
7208
+ describe: "Pulls all labels to local files in a directory",
7209
+ builder: (yargs43) => withConfiguration(
7210
+ withDebugOptions(
7211
+ withApiOptions(
7212
+ withProjectOptions(
7213
+ withDiffOptions(
7214
+ yargs43.positional("directory", {
7215
+ 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.",
7216
+ type: "string"
7217
+ }).option("format", {
7218
+ alias: ["f"],
7219
+ describe: "Output format",
7220
+ default: "yaml",
7221
+ choices: ["yaml", "json"],
7222
+ type: "string"
7223
+ }).option("mode", {
7224
+ alias: ["m"],
7225
+ 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',
7226
+ choices: ["create", "createOrUpdate", "mirror"],
7227
+ default: "mirror",
7228
+ type: "string"
7229
+ })
7230
+ )
7231
+ )
7232
+ )
7233
+ )
7234
+ ),
7235
+ handler: async ({
7236
+ apiHost,
7237
+ apiKey,
7238
+ proxy,
7239
+ directory,
7240
+ format,
7241
+ mode,
7242
+ whatIf,
7243
+ project: projectId,
7244
+ diff: diffMode,
7245
+ allowEmptySource,
7246
+ verbose
7247
+ }) => {
6986
7248
  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) : []
7249
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7250
+ const source = createLabelsEngineDataSource({ client });
7251
+ let target;
7252
+ const isPackage = isPathAPackageFile(directory);
7253
+ if (isPackage) {
7254
+ const packageContents = readCanvasPackage(directory, false, verbose);
7255
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7256
+ target = await createArraySyncEngineDataSource({
7257
+ name: `Package file ${directory}`,
7258
+ objects: packageLabels,
7259
+ selectIdentifier: selectLabelIdentifier,
7260
+ selectDisplayName: selectLabelDisplayName,
7261
+ onSyncComplete: async (_, synced) => {
7262
+ packageContents.labels = synced;
7263
+ writeCanvasPackage(directory, packageContents);
7264
+ }
7265
+ });
7266
+ } else {
7267
+ target = await createFileSyncEngineDataSource({
7268
+ directory,
7269
+ selectIdentifier: selectLabelIdentifier,
7270
+ selectDisplayName: selectLabelDisplayName,
7271
+ format,
7272
+ verbose
7040
7273
  });
7041
7274
  }
7042
- await Promise.all(actions);
7275
+ await syncEngine({
7276
+ source,
7277
+ target,
7278
+ mode,
7279
+ whatIf,
7280
+ allowEmptySource: allowEmptySource ?? true,
7281
+ log: createSyncEngineConsoleLogger({ diffMode }),
7282
+ onBeforeWriteObject: async (sourceObject) => {
7283
+ delete sourceObject.object.createdBy;
7284
+ delete sourceObject.object.modifiedBy;
7285
+ return sourceObject;
7286
+ }
7287
+ });
7043
7288
  }
7044
7289
  };
7045
7290
 
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(
7291
+ // src/commands/canvas/commands/label/push.ts
7292
+ var __INTERNAL_MISSING_PARENT_LABEL_ERROR = "Parent label with public ID";
7293
+ var LabelPushModule = {
7294
+ command: "push <directory>",
7295
+ describe: "Pushes all labels from files in a directory to Uniform",
7296
+ builder: (yargs43) => withConfiguration(
7052
7297
  withDebugOptions(
7053
7298
  withApiOptions(
7054
7299
  withProjectOptions(
7055
- withStateOptions(
7056
- yargs42.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7300
+ withDiffOptions(
7301
+ yargs43.positional("directory", {
7302
+ describe: "Directory to read the labels from. If a filename is used, a package will be read instead.",
7303
+ type: "string"
7304
+ }).option("mode", {
7305
+ alias: ["m"],
7306
+ 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',
7307
+ choices: ["create", "createOrUpdate", "mirror"],
7308
+ default: "mirror",
7309
+ type: "string"
7310
+ })
7057
7311
  )
7058
7312
  )
7059
7313
  )
@@ -7061,42 +7315,88 @@ var EntryPatternUpdateModule = {
7061
7315
  ),
7062
7316
  handler: async ({
7063
7317
  apiHost,
7064
- edgeApiHost,
7065
7318
  apiKey,
7066
7319
  proxy,
7067
- filename,
7320
+ directory,
7321
+ mode,
7322
+ whatIf,
7068
7323
  project: projectId,
7069
- state,
7070
- verbose,
7071
- whatIf
7324
+ diff: diffMode,
7325
+ allowEmptySource,
7326
+ verbose
7072
7327
  }) => {
7073
7328
  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) });
7329
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7330
+ let source;
7331
+ const isPackage = isPathAPackageFile(directory);
7332
+ if (isPackage) {
7333
+ const packageContents = readCanvasPackage(directory, true, verbose);
7334
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7335
+ source = await createArraySyncEngineDataSource({
7336
+ name: `Package file ${directory}`,
7337
+ objects: packageLabels,
7338
+ selectIdentifier: selectLabelIdentifier,
7339
+ selectDisplayName: selectLabelDisplayName
7340
+ });
7078
7341
  } else {
7079
- whatIfSimpleLog({
7080
- id: file.entry._id,
7081
- displayName: `Entry Pattern: ${file.entry._name}`,
7082
- action: "update"
7342
+ source = await createFileSyncEngineDataSource({
7343
+ directory,
7344
+ selectIdentifier: selectLabelIdentifier,
7345
+ selectDisplayName: selectLabelDisplayName,
7346
+ verbose
7083
7347
  });
7084
7348
  }
7349
+ const target = createLabelsEngineDataSource({ client });
7350
+ const labelsFailedDueToMissingParent = /* @__PURE__ */ new Set();
7351
+ const attemptSync = async () => {
7352
+ const lastFailedLabelsCount = labelsFailedDueToMissingParent.size;
7353
+ labelsFailedDueToMissingParent.clear();
7354
+ await syncEngine({
7355
+ source,
7356
+ target,
7357
+ mode,
7358
+ whatIf,
7359
+ allowEmptySource,
7360
+ log: createSyncEngineConsoleLogger({ diffMode }),
7361
+ onError: (error, object4) => {
7362
+ if (error.message.includes(__INTERNAL_MISSING_PARENT_LABEL_ERROR)) {
7363
+ labelsFailedDueToMissingParent.add(object4.object);
7364
+ } else {
7365
+ throw error;
7366
+ }
7367
+ }
7368
+ });
7369
+ if (labelsFailedDueToMissingParent.size !== 0) {
7370
+ const newFailedLabelsCount = labelsFailedDueToMissingParent.size;
7371
+ if (newFailedLabelsCount !== lastFailedLabelsCount) {
7372
+ source = await createArraySyncEngineDataSource({
7373
+ name: `Labels re-push from ${directory}`,
7374
+ objects: Array.from(labelsFailedDueToMissingParent),
7375
+ selectIdentifier: selectLabelIdentifier,
7376
+ selectDisplayName: selectLabelDisplayName
7377
+ });
7378
+ await attemptSync();
7379
+ } else {
7380
+ throw new Error("Failed to push labels due to missing parent labels");
7381
+ }
7382
+ }
7383
+ };
7384
+ await attemptSync();
7085
7385
  }
7086
7386
  };
7087
7387
 
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(),
7388
+ // src/commands/canvas/commands/label.ts
7389
+ var LabelModule = {
7390
+ command: "label <command>",
7391
+ describe: "Commands for label definitions",
7392
+ builder: (yargs43) => yargs43.command(LabelPullModule).command(LabelPushModule),
7093
7393
  handler: () => {
7094
- yargs14.help();
7394
+ yargs15.help();
7095
7395
  }
7096
7396
  };
7097
7397
 
7098
7398
  // src/commands/canvas/commands/locale.ts
7099
- import yargs15 from "yargs";
7399
+ import yargs16 from "yargs";
7100
7400
 
7101
7401
  // src/commands/canvas/localesEngineDataSource.ts
7102
7402
  function createLocaleEngineDataSource({
@@ -7138,12 +7438,12 @@ function getLocaleClient(options) {
7138
7438
  var LocalePullModule = {
7139
7439
  command: "pull <directory>",
7140
7440
  describe: "Pulls all locales to local files in a directory",
7141
- builder: (yargs42) => withConfiguration(
7441
+ builder: (yargs43) => withConfiguration(
7142
7442
  withDebugOptions(
7143
7443
  withApiOptions(
7144
7444
  withProjectOptions(
7145
7445
  withDiffOptions(
7146
- yargs42.positional("directory", {
7446
+ yargs43.positional("directory", {
7147
7447
  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
7448
  type: "string"
7149
7449
  }).option("format", {
@@ -7223,12 +7523,12 @@ var LocalePullModule = {
7223
7523
  var LocalePushModule = {
7224
7524
  command: "push <directory>",
7225
7525
  describe: "Pushes all locales from files in a directory to Uniform",
7226
- builder: (yargs42) => withConfiguration(
7526
+ builder: (yargs43) => withConfiguration(
7227
7527
  withDebugOptions(
7228
7528
  withApiOptions(
7229
7529
  withProjectOptions(
7230
7530
  withDiffOptions(
7231
- yargs42.positional("directory", {
7531
+ yargs43.positional("directory", {
7232
7532
  describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
7233
7533
  type: "string"
7234
7534
  }).option("mode", {
@@ -7296,14 +7596,14 @@ var LocalePushModule = {
7296
7596
  var LocaleModule = {
7297
7597
  command: "locale <command>",
7298
7598
  describe: "Commands for locale definitions",
7299
- builder: (yargs42) => yargs42.command(LocalePullModule).command(LocalePushModule),
7599
+ builder: (yargs43) => yargs43.command(LocalePullModule).command(LocalePushModule),
7300
7600
  handler: () => {
7301
- yargs15.help();
7601
+ yargs16.help();
7302
7602
  }
7303
7603
  };
7304
7604
 
7305
7605
  // src/commands/canvas/commands/previewUrl.ts
7306
- import yargs16 from "yargs";
7606
+ import yargs17 from "yargs";
7307
7607
 
7308
7608
  // src/commands/canvas/commands/previewUrl/_util.ts
7309
7609
  import { PreviewClient } from "@uniformdev/canvas";
@@ -7317,12 +7617,12 @@ function getPreviewClient(options) {
7317
7617
  var PreviewUrlGetModule = {
7318
7618
  command: "get <id>",
7319
7619
  describe: "Fetch a preview URL",
7320
- builder: (yargs42) => withConfiguration(
7620
+ builder: (yargs43) => withConfiguration(
7321
7621
  withFormatOptions(
7322
7622
  withDebugOptions(
7323
7623
  withApiOptions(
7324
7624
  withProjectOptions(
7325
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7625
+ yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7326
7626
  )
7327
7627
  )
7328
7628
  )
@@ -7346,8 +7646,8 @@ var PreviewUrlListModule = {
7346
7646
  command: "list",
7347
7647
  describe: "List preview URLs",
7348
7648
  aliases: ["ls"],
7349
- builder: (yargs42) => withConfiguration(
7350
- withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs42.options({})))))
7649
+ builder: (yargs43) => withConfiguration(
7650
+ withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs43.options({})))))
7351
7651
  ),
7352
7652
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7353
7653
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7389,12 +7689,12 @@ function createPreviewUrlEngineDataSource({
7389
7689
  var PreviewUrlPullModule = {
7390
7690
  command: "pull <directory>",
7391
7691
  describe: "Pulls all preview urls to local files in a directory",
7392
- builder: (yargs42) => withConfiguration(
7692
+ builder: (yargs43) => withConfiguration(
7393
7693
  withApiOptions(
7394
7694
  withProjectOptions(
7395
7695
  withDebugOptions(
7396
7696
  withDiffOptions(
7397
- yargs42.positional("directory", {
7697
+ yargs43.positional("directory", {
7398
7698
  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
7699
  type: "string"
7400
7700
  }).option("format", {
@@ -7469,12 +7769,12 @@ var PreviewUrlPullModule = {
7469
7769
  var PreviewUrlPushModule = {
7470
7770
  command: "push <directory>",
7471
7771
  describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
7472
- builder: (yargs42) => withConfiguration(
7772
+ builder: (yargs43) => withConfiguration(
7473
7773
  withApiOptions(
7474
7774
  withProjectOptions(
7475
7775
  withDiffOptions(
7476
7776
  withDebugOptions(
7477
- yargs42.positional("directory", {
7777
+ yargs43.positional("directory", {
7478
7778
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7479
7779
  type: "string"
7480
7780
  }).option("mode", {
@@ -7538,11 +7838,11 @@ var PreviewUrlRemoveModule = {
7538
7838
  command: "remove <id>",
7539
7839
  aliases: ["delete", "rm"],
7540
7840
  describe: "Delete a preview URL",
7541
- builder: (yargs42) => withConfiguration(
7841
+ builder: (yargs43) => withConfiguration(
7542
7842
  withApiOptions(
7543
7843
  withDebugOptions(
7544
7844
  withProjectOptions(
7545
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
7845
+ yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
7546
7846
  )
7547
7847
  )
7548
7848
  )
@@ -7563,11 +7863,11 @@ var PreviewUrlUpdateModule = {
7563
7863
  command: "update <filename>",
7564
7864
  aliases: ["put"],
7565
7865
  describe: "Insert or update a preview URL",
7566
- builder: (yargs42) => withConfiguration(
7866
+ builder: (yargs43) => withConfiguration(
7567
7867
  withDebugOptions(
7568
7868
  withApiOptions(
7569
7869
  withProjectOptions(
7570
- yargs42.positional("filename", { demandOption: true, describe: "Category file to put" })
7870
+ yargs43.positional("filename", { demandOption: true, describe: "Category file to put" })
7571
7871
  )
7572
7872
  )
7573
7873
  )
@@ -7589,25 +7889,25 @@ var PreviewUrlModule = {
7589
7889
  command: "preview-url <command>",
7590
7890
  aliases: ["pu"],
7591
7891
  describe: "Commands for Canvas preview urls",
7592
- builder: (yargs42) => yargs42.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
7892
+ builder: (yargs43) => yargs43.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
7593
7893
  handler: () => {
7594
- yargs16.help();
7894
+ yargs17.help();
7595
7895
  }
7596
7896
  };
7597
7897
 
7598
7898
  // src/commands/canvas/commands/previewViewport.ts
7599
- import yargs17 from "yargs";
7899
+ import yargs18 from "yargs";
7600
7900
 
7601
7901
  // src/commands/canvas/commands/previewViewport/get.ts
7602
7902
  var PreviewViewportGetModule = {
7603
7903
  command: "get <id>",
7604
7904
  describe: "Fetch a preview viewport",
7605
- builder: (yargs42) => withConfiguration(
7905
+ builder: (yargs43) => withConfiguration(
7606
7906
  withFormatOptions(
7607
7907
  withDebugOptions(
7608
7908
  withApiOptions(
7609
7909
  withProjectOptions(
7610
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
7910
+ yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
7611
7911
  )
7612
7912
  )
7613
7913
  )
@@ -7631,8 +7931,8 @@ var PreviewViewportListModule = {
7631
7931
  command: "list",
7632
7932
  describe: "List preview viewports",
7633
7933
  aliases: ["ls"],
7634
- builder: (yargs42) => withConfiguration(
7635
- withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs42.options({})))))
7934
+ builder: (yargs43) => withConfiguration(
7935
+ withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs43.options({})))))
7636
7936
  ),
7637
7937
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7638
7938
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7678,12 +7978,12 @@ function createPreviewViewportEngineDataSource({
7678
7978
  var PreviewViewportPullModule = {
7679
7979
  command: "pull <directory>",
7680
7980
  describe: "Pulls all preview viewports to local files in a directory",
7681
- builder: (yargs42) => withConfiguration(
7981
+ builder: (yargs43) => withConfiguration(
7682
7982
  withApiOptions(
7683
7983
  withProjectOptions(
7684
7984
  withDebugOptions(
7685
7985
  withDiffOptions(
7686
- yargs42.positional("directory", {
7986
+ yargs43.positional("directory", {
7687
7987
  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
7988
  type: "string"
7689
7989
  }).option("format", {
@@ -7758,12 +8058,12 @@ var PreviewViewportPullModule = {
7758
8058
  var PreviewViewportPushModule = {
7759
8059
  command: "push <directory>",
7760
8060
  describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
7761
- builder: (yargs42) => withConfiguration(
8061
+ builder: (yargs43) => withConfiguration(
7762
8062
  withApiOptions(
7763
8063
  withProjectOptions(
7764
8064
  withDiffOptions(
7765
8065
  withDebugOptions(
7766
- yargs42.positional("directory", {
8066
+ yargs43.positional("directory", {
7767
8067
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7768
8068
  type: "string"
7769
8069
  }).option("mode", {
@@ -7827,11 +8127,11 @@ var PreviewViewportRemoveModule = {
7827
8127
  command: "remove <id>",
7828
8128
  aliases: ["delete", "rm"],
7829
8129
  describe: "Delete a preview viewport",
7830
- builder: (yargs42) => withConfiguration(
8130
+ builder: (yargs43) => withConfiguration(
7831
8131
  withApiOptions(
7832
8132
  withDebugOptions(
7833
8133
  withProjectOptions(
7834
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
8134
+ yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
7835
8135
  )
7836
8136
  )
7837
8137
  )
@@ -7852,11 +8152,11 @@ var PreviewViewportUpdateModule = {
7852
8152
  command: "update <filename>",
7853
8153
  aliases: ["put"],
7854
8154
  describe: "Insert or update a preview viewport",
7855
- builder: (yargs42) => withConfiguration(
8155
+ builder: (yargs43) => withConfiguration(
7856
8156
  withDebugOptions(
7857
8157
  withApiOptions(
7858
8158
  withProjectOptions(
7859
- yargs42.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
8159
+ yargs43.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
7860
8160
  )
7861
8161
  )
7862
8162
  )
@@ -7878,14 +8178,14 @@ var PreviewViewportModule = {
7878
8178
  command: "preview-viewport <command>",
7879
8179
  aliases: ["pv"],
7880
8180
  describe: "Commands for Canvas preview viewports",
7881
- builder: (yargs42) => yargs42.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
8181
+ builder: (yargs43) => yargs43.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
7882
8182
  handler: () => {
7883
- yargs17.help();
8183
+ yargs18.help();
7884
8184
  }
7885
8185
  };
7886
8186
 
7887
8187
  // src/commands/canvas/commands/prompts.ts
7888
- import yargs18 from "yargs";
8188
+ import yargs19 from "yargs";
7889
8189
 
7890
8190
  // src/commands/canvas/commands/prompts/_util.ts
7891
8191
  import { PromptClient } from "@uniformdev/canvas";
@@ -7897,12 +8197,12 @@ var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: t
7897
8197
  var PromptGetModule = {
7898
8198
  command: "get <id>",
7899
8199
  describe: "Get a prompt",
7900
- builder: (yargs42) => withConfiguration(
8200
+ builder: (yargs43) => withConfiguration(
7901
8201
  withDebugOptions(
7902
8202
  withFormatOptions(
7903
8203
  withApiOptions(
7904
8204
  withProjectOptions(
7905
- yargs42.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
8205
+ yargs43.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
7906
8206
  )
7907
8207
  )
7908
8208
  )
@@ -7923,7 +8223,7 @@ var PromptGetModule = {
7923
8223
  var PromptListModule = {
7924
8224
  command: "list",
7925
8225
  describe: "List prompts",
7926
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
8226
+ builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
7927
8227
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7928
8228
  const fetch2 = nodeFetchProxy(proxy, verbose);
7929
8229
  const client = getPromptClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -7964,13 +8264,13 @@ function createPromptEngineDataSource({
7964
8264
  var PromptPullModule = {
7965
8265
  command: "pull <directory>",
7966
8266
  describe: "Pulls all prompts to local files in a directory",
7967
- builder: (yargs42) => withConfiguration(
8267
+ builder: (yargs43) => withConfiguration(
7968
8268
  withDebugOptions(
7969
8269
  withApiOptions(
7970
8270
  withProjectOptions(
7971
8271
  withStateOptions(
7972
8272
  withDiffOptions(
7973
- yargs42.positional("directory", {
8273
+ yargs43.positional("directory", {
7974
8274
  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
8275
  type: "string"
7976
8276
  }).option("format", {
@@ -8051,12 +8351,12 @@ var PromptPullModule = {
8051
8351
  var PromptPushModule = {
8052
8352
  command: "push <directory>",
8053
8353
  describe: "Pushes all prompts from files in a directory to Uniform",
8054
- builder: (yargs42) => withConfiguration(
8354
+ builder: (yargs43) => withConfiguration(
8055
8355
  withApiOptions(
8056
8356
  withProjectOptions(
8057
8357
  withStateOptions(
8058
8358
  withDiffOptions(
8059
- yargs42.positional("directory", {
8359
+ yargs43.positional("directory", {
8060
8360
  describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
8061
8361
  type: "string"
8062
8362
  }).option("mode", {
@@ -8125,10 +8425,10 @@ var PromptRemoveModule = {
8125
8425
  command: "remove <id>",
8126
8426
  aliases: ["delete", "rm"],
8127
8427
  describe: "Delete a prompt",
8128
- builder: (yargs42) => withConfiguration(
8428
+ builder: (yargs43) => withConfiguration(
8129
8429
  withDebugOptions(
8130
8430
  withApiOptions(
8131
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8431
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8132
8432
  )
8133
8433
  )
8134
8434
  ),
@@ -8148,11 +8448,11 @@ var PromptUpdateModule = {
8148
8448
  command: "update <filename>",
8149
8449
  aliases: ["put"],
8150
8450
  describe: "Insert or update a prompt",
8151
- builder: (yargs42) => withConfiguration(
8451
+ builder: (yargs43) => withConfiguration(
8152
8452
  withDebugOptions(
8153
8453
  withApiOptions(
8154
8454
  withProjectOptions(
8155
- yargs42.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8455
+ yargs43.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8156
8456
  )
8157
8457
  )
8158
8458
  )
@@ -8174,14 +8474,14 @@ var PromptModule = {
8174
8474
  command: "prompt <command>",
8175
8475
  aliases: ["dt"],
8176
8476
  describe: "Commands for AI Prompt definitions",
8177
- builder: (yargs42) => yargs42.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8477
+ builder: (yargs43) => yargs43.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8178
8478
  handler: () => {
8179
- yargs18.help();
8479
+ yargs19.help();
8180
8480
  }
8181
8481
  };
8182
8482
 
8183
8483
  // src/commands/canvas/commands/workflow.ts
8184
- import yargs19 from "yargs";
8484
+ import yargs20 from "yargs";
8185
8485
 
8186
8486
  // src/commands/canvas/commands/workflow/_util.ts
8187
8487
  import { WorkflowClient } from "@uniformdev/canvas";
@@ -8224,12 +8524,12 @@ function createWorkflowEngineDataSource({
8224
8524
  var WorkflowPullModule = {
8225
8525
  command: "pull <directory>",
8226
8526
  describe: "Pulls all workflows to local files in a directory",
8227
- builder: (yargs42) => withConfiguration(
8527
+ builder: (yargs43) => withConfiguration(
8228
8528
  withApiOptions(
8229
8529
  withDebugOptions(
8230
8530
  withProjectOptions(
8231
8531
  withDiffOptions(
8232
- yargs42.positional("directory", {
8532
+ yargs43.positional("directory", {
8233
8533
  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
8534
  type: "string"
8235
8535
  }).option("format", {
@@ -8304,12 +8604,12 @@ var WorkflowPullModule = {
8304
8604
  var WorkflowPushModule = {
8305
8605
  command: "push <directory>",
8306
8606
  describe: "Pushes all workflows from files in a directory to Uniform Canvas",
8307
- builder: (yargs42) => withConfiguration(
8607
+ builder: (yargs43) => withConfiguration(
8308
8608
  withDebugOptions(
8309
8609
  withApiOptions(
8310
8610
  withProjectOptions(
8311
8611
  withDiffOptions(
8312
- yargs42.positional("directory", {
8612
+ yargs43.positional("directory", {
8313
8613
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
8314
8614
  type: "string"
8315
8615
  }).option("mode", {
@@ -8373,9 +8673,9 @@ var WorkflowModule = {
8373
8673
  command: "workflow <command>",
8374
8674
  aliases: ["wf"],
8375
8675
  describe: "Commands for Canvas workflows",
8376
- builder: (yargs42) => yargs42.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8676
+ builder: (yargs43) => yargs43.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8377
8677
  handler: () => {
8378
- yargs19.help();
8678
+ yargs20.help();
8379
8679
  }
8380
8680
  };
8381
8681
 
@@ -8384,17 +8684,17 @@ var CanvasCommand = {
8384
8684
  command: "canvas <command>",
8385
8685
  aliases: ["cv", "pm", "presentation"],
8386
8686
  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(),
8687
+ 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
8688
  handler: () => {
8389
- yargs20.showHelp();
8689
+ yargs21.showHelp();
8390
8690
  }
8391
8691
  };
8392
8692
 
8393
8693
  // src/commands/context/index.ts
8394
- import yargs27 from "yargs";
8694
+ import yargs28 from "yargs";
8395
8695
 
8396
8696
  // src/commands/context/commands/aggregate.ts
8397
- import yargs21 from "yargs";
8697
+ import yargs22 from "yargs";
8398
8698
 
8399
8699
  // src/commands/context/commands/aggregate/_util.ts
8400
8700
  import { AggregateClient } from "@uniformdev/context/api";
@@ -8406,11 +8706,11 @@ var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCa
8406
8706
  var AggregateGetModule = {
8407
8707
  command: "get <id>",
8408
8708
  describe: "Fetch an aggregate",
8409
- builder: (yargs42) => withConfiguration(
8709
+ builder: (yargs43) => withConfiguration(
8410
8710
  withFormatOptions(
8411
8711
  withApiOptions(
8412
8712
  withProjectOptions(
8413
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8713
+ yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8414
8714
  )
8415
8715
  )
8416
8716
  )
@@ -8433,7 +8733,7 @@ var AggregateListModule = {
8433
8733
  command: "list",
8434
8734
  describe: "List aggregates",
8435
8735
  aliases: ["ls"],
8436
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
8736
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
8437
8737
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8438
8738
  const fetch2 = nodeFetchProxy(proxy);
8439
8739
  const client = getAggregateClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8496,12 +8796,12 @@ function writeContextPackage(filename, packageContents) {
8496
8796
  var AggregatePullModule = {
8497
8797
  command: "pull <directory>",
8498
8798
  describe: "Pulls all aggregates to local files in a directory",
8499
- builder: (yargs42) => withConfiguration(
8799
+ builder: (yargs43) => withConfiguration(
8500
8800
  withApiOptions(
8501
8801
  withDebugOptions(
8502
8802
  withProjectOptions(
8503
8803
  withDiffOptions(
8504
- yargs42.positional("directory", {
8804
+ yargs43.positional("directory", {
8505
8805
  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
8806
  type: "string"
8507
8807
  }).option("format", {
@@ -8576,12 +8876,12 @@ var AggregatePullModule = {
8576
8876
  var AggregatePushModule = {
8577
8877
  command: "push <directory>",
8578
8878
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
8579
- builder: (yargs42) => withConfiguration(
8879
+ builder: (yargs43) => withConfiguration(
8580
8880
  withApiOptions(
8581
8881
  withProjectOptions(
8582
8882
  withDiffOptions(
8583
8883
  withDebugOptions(
8584
- yargs42.positional("directory", {
8884
+ yargs43.positional("directory", {
8585
8885
  describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
8586
8886
  type: "string"
8587
8887
  }).option("mode", {
@@ -8646,10 +8946,10 @@ var AggregateRemoveModule = {
8646
8946
  command: "remove <id>",
8647
8947
  aliases: ["delete", "rm"],
8648
8948
  describe: "Delete an aggregate",
8649
- builder: (yargs42) => withConfiguration(
8949
+ builder: (yargs43) => withConfiguration(
8650
8950
  withApiOptions(
8651
8951
  withProjectOptions(
8652
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
8952
+ yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
8653
8953
  )
8654
8954
  )
8655
8955
  ),
@@ -8665,10 +8965,10 @@ var AggregateUpdateModule = {
8665
8965
  command: "update <filename>",
8666
8966
  aliases: ["put"],
8667
8967
  describe: "Insert or update an aggregate",
8668
- builder: (yargs42) => withConfiguration(
8968
+ builder: (yargs43) => withConfiguration(
8669
8969
  withApiOptions(
8670
8970
  withProjectOptions(
8671
- yargs42.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
8971
+ yargs43.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
8672
8972
  )
8673
8973
  )
8674
8974
  ),
@@ -8685,14 +8985,14 @@ var AggregateModule = {
8685
8985
  command: "aggregate <command>",
8686
8986
  aliases: ["agg", "intent", "audience"],
8687
8987
  describe: "Commands for Context aggregates (intents, audiences)",
8688
- builder: (yargs42) => yargs42.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
8988
+ builder: (yargs43) => yargs43.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
8689
8989
  handler: () => {
8690
- yargs21.help();
8990
+ yargs22.help();
8691
8991
  }
8692
8992
  };
8693
8993
 
8694
8994
  // src/commands/context/commands/enrichment.ts
8695
- import yargs22 from "yargs";
8995
+ import yargs23 from "yargs";
8696
8996
 
8697
8997
  // src/commands/context/commands/enrichment/_util.ts
8698
8998
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
@@ -8706,11 +9006,11 @@ function getEnrichmentClient(options) {
8706
9006
  var EnrichmentGetModule = {
8707
9007
  command: "get <id>",
8708
9008
  describe: "Fetch an enrichment category and its values",
8709
- builder: (yargs42) => withFormatOptions(
9009
+ builder: (yargs43) => withFormatOptions(
8710
9010
  withConfiguration(
8711
9011
  withApiOptions(
8712
9012
  withProjectOptions(
8713
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
9013
+ yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
8714
9014
  )
8715
9015
  )
8716
9016
  )
@@ -8733,7 +9033,7 @@ var EnrichmentListModule = {
8733
9033
  command: "list",
8734
9034
  describe: "List enrichments",
8735
9035
  aliases: ["ls"],
8736
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9036
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
8737
9037
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8738
9038
  const fetch2 = nodeFetchProxy(proxy);
8739
9039
  const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8828,12 +9128,12 @@ var createEnrichmentValueEngineDataSource = ({
8828
9128
  var EnrichmentPullModule = {
8829
9129
  command: "pull <directory>",
8830
9130
  describe: "Pulls all enrichments to local files in a directory",
8831
- builder: (yargs42) => withConfiguration(
9131
+ builder: (yargs43) => withConfiguration(
8832
9132
  withDebugOptions(
8833
9133
  withApiOptions(
8834
9134
  withProjectOptions(
8835
9135
  withDiffOptions(
8836
- yargs42.positional("directory", {
9136
+ yargs43.positional("directory", {
8837
9137
  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
9138
  type: "string"
8839
9139
  }).option("format", {
@@ -8908,11 +9208,11 @@ var EnrichmentPullModule = {
8908
9208
  var EnrichmentPushModule = {
8909
9209
  command: "push <directory>",
8910
9210
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
8911
- builder: (yargs42) => withConfiguration(
9211
+ builder: (yargs43) => withConfiguration(
8912
9212
  withApiOptions(
8913
9213
  withProjectOptions(
8914
9214
  withDiffOptions(
8915
- yargs42.positional("directory", {
9215
+ yargs43.positional("directory", {
8916
9216
  describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
8917
9217
  type: "string"
8918
9218
  }).option("mode", {
@@ -8975,10 +9275,10 @@ var EnrichmentRemoveModule = {
8975
9275
  command: "remove <id>",
8976
9276
  aliases: ["delete", "rm"],
8977
9277
  describe: "Delete an enrichment category and its values",
8978
- builder: (yargs42) => withConfiguration(
9278
+ builder: (yargs43) => withConfiguration(
8979
9279
  withApiOptions(
8980
9280
  withProjectOptions(
8981
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
9281
+ yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
8982
9282
  )
8983
9283
  )
8984
9284
  ),
@@ -8994,14 +9294,14 @@ var EnrichmentModule = {
8994
9294
  command: "enrichment <command>",
8995
9295
  aliases: ["enr"],
8996
9296
  describe: "Commands for Context enrichments",
8997
- builder: (yargs42) => yargs42.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
9297
+ builder: (yargs43) => yargs43.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
8998
9298
  handler: () => {
8999
- yargs22.help();
9299
+ yargs23.help();
9000
9300
  }
9001
9301
  };
9002
9302
 
9003
9303
  // src/commands/context/commands/manifest.ts
9004
- import yargs23 from "yargs";
9304
+ import yargs24 from "yargs";
9005
9305
 
9006
9306
  // src/commands/context/commands/manifest/get.ts
9007
9307
  import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
@@ -9012,10 +9312,10 @@ var ManifestGetModule = {
9012
9312
  command: "get [output]",
9013
9313
  aliases: ["dl", "download"],
9014
9314
  describe: "Download the Uniform Context manifest for a project",
9015
- builder: (yargs42) => withConfiguration(
9315
+ builder: (yargs43) => withConfiguration(
9016
9316
  withApiOptions(
9017
9317
  withProjectOptions(
9018
- yargs42.option("preview", {
9318
+ yargs43.option("preview", {
9019
9319
  describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
9020
9320
  default: false,
9021
9321
  type: "boolean",
@@ -9077,7 +9377,7 @@ import { exit as exit2 } from "process";
9077
9377
  var ManifestPublishModule = {
9078
9378
  command: "publish",
9079
9379
  describe: "Publish the Uniform Context manifest for a project",
9080
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(yargs42))),
9380
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(yargs43))),
9081
9381
  handler: async ({ apiKey, apiHost, proxy, project }) => {
9082
9382
  const fetch2 = nodeFetchProxy(proxy);
9083
9383
  try {
@@ -9110,25 +9410,25 @@ var ManifestModule = {
9110
9410
  command: "manifest <command>",
9111
9411
  describe: "Commands for context manifests",
9112
9412
  aliases: ["man"],
9113
- builder: (yargs42) => yargs42.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9413
+ builder: (yargs43) => yargs43.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9114
9414
  handler: () => {
9115
- yargs23.help();
9415
+ yargs24.help();
9116
9416
  }
9117
9417
  };
9118
9418
 
9119
9419
  // src/commands/context/commands/quirk.ts
9120
- import yargs24 from "yargs";
9420
+ import yargs25 from "yargs";
9121
9421
 
9122
9422
  // src/commands/context/commands/quirk/get.ts
9123
9423
  import { UncachedQuirkClient } from "@uniformdev/context/api";
9124
9424
  var QuirkGetModule = {
9125
9425
  command: "get <id>",
9126
9426
  describe: "Fetch a quirk",
9127
- builder: (yargs42) => withConfiguration(
9427
+ builder: (yargs43) => withConfiguration(
9128
9428
  withFormatOptions(
9129
9429
  withApiOptions(
9130
9430
  withProjectOptions(
9131
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9431
+ yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9132
9432
  )
9133
9433
  )
9134
9434
  )
@@ -9152,11 +9452,11 @@ var QuirkListModule = {
9152
9452
  command: "list",
9153
9453
  describe: "List quirks",
9154
9454
  aliases: ["ls"],
9155
- builder: (yargs42) => withConfiguration(
9455
+ builder: (yargs43) => withConfiguration(
9156
9456
  withFormatOptions(
9157
9457
  withApiOptions(
9158
9458
  withProjectOptions(
9159
- yargs42.option("withIntegrations", {
9459
+ yargs43.option("withIntegrations", {
9160
9460
  alias: ["i"],
9161
9461
  describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
9162
9462
  type: "boolean"
@@ -9214,12 +9514,12 @@ function createQuirkEngineDataSource({
9214
9514
  var QuirkPullModule = {
9215
9515
  command: "pull <directory>",
9216
9516
  describe: "Pulls all quirks to local files in a directory",
9217
- builder: (yargs42) => withConfiguration(
9517
+ builder: (yargs43) => withConfiguration(
9218
9518
  withDebugOptions(
9219
9519
  withApiOptions(
9220
9520
  withProjectOptions(
9221
9521
  withDiffOptions(
9222
- yargs42.positional("directory", {
9522
+ yargs43.positional("directory", {
9223
9523
  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
9524
  type: "string"
9225
9525
  }).option("format", {
@@ -9295,12 +9595,12 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
9295
9595
  var QuirkPushModule = {
9296
9596
  command: "push <directory>",
9297
9597
  describe: "Pushes all quirks from files in a directory or package to Uniform",
9298
- builder: (yargs42) => withConfiguration(
9598
+ builder: (yargs43) => withConfiguration(
9299
9599
  withDebugOptions(
9300
9600
  withApiOptions(
9301
9601
  withProjectOptions(
9302
9602
  withDiffOptions(
9303
- yargs42.positional("directory", {
9603
+ yargs43.positional("directory", {
9304
9604
  describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
9305
9605
  type: "string"
9306
9606
  }).option("mode", {
@@ -9365,10 +9665,10 @@ var QuirkRemoveModule = {
9365
9665
  command: "remove <id>",
9366
9666
  aliases: ["delete", "rm"],
9367
9667
  describe: "Delete a quirk",
9368
- builder: (yargs42) => withConfiguration(
9668
+ builder: (yargs43) => withConfiguration(
9369
9669
  withApiOptions(
9370
9670
  withProjectOptions(
9371
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9671
+ yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9372
9672
  )
9373
9673
  )
9374
9674
  ),
@@ -9385,10 +9685,10 @@ var QuirkUpdateModule = {
9385
9685
  command: "update <filename>",
9386
9686
  aliases: ["put"],
9387
9687
  describe: "Insert or update a quirk",
9388
- builder: (yargs42) => withConfiguration(
9688
+ builder: (yargs43) => withConfiguration(
9389
9689
  withApiOptions(
9390
9690
  withProjectOptions(
9391
- yargs42.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9691
+ yargs43.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9392
9692
  )
9393
9693
  )
9394
9694
  ),
@@ -9405,25 +9705,25 @@ var QuirkModule = {
9405
9705
  command: "quirk <command>",
9406
9706
  aliases: ["qk"],
9407
9707
  describe: "Commands for Context quirks",
9408
- builder: (yargs42) => yargs42.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9708
+ builder: (yargs43) => yargs43.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9409
9709
  handler: () => {
9410
- yargs24.help();
9710
+ yargs25.help();
9411
9711
  }
9412
9712
  };
9413
9713
 
9414
9714
  // src/commands/context/commands/signal.ts
9415
- import yargs25 from "yargs";
9715
+ import yargs26 from "yargs";
9416
9716
 
9417
9717
  // src/commands/context/commands/signal/get.ts
9418
9718
  import { UncachedSignalClient } from "@uniformdev/context/api";
9419
9719
  var SignalGetModule = {
9420
9720
  command: "get <id>",
9421
9721
  describe: "Fetch a signal",
9422
- builder: (yargs42) => withConfiguration(
9722
+ builder: (yargs43) => withConfiguration(
9423
9723
  withFormatOptions(
9424
9724
  withApiOptions(
9425
9725
  withProjectOptions(
9426
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9726
+ yargs43.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9427
9727
  )
9428
9728
  )
9429
9729
  )
@@ -9447,7 +9747,7 @@ var SignalListModule = {
9447
9747
  command: "list",
9448
9748
  describe: "List signals",
9449
9749
  aliases: ["ls"],
9450
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9750
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
9451
9751
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9452
9752
  const fetch2 = nodeFetchProxy(proxy);
9453
9753
  const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9497,12 +9797,12 @@ function createSignalEngineDataSource({
9497
9797
  var SignalPullModule = {
9498
9798
  command: "pull <directory>",
9499
9799
  describe: "Pulls all signals to local files in a directory",
9500
- builder: (yargs42) => withConfiguration(
9800
+ builder: (yargs43) => withConfiguration(
9501
9801
  withDebugOptions(
9502
9802
  withApiOptions(
9503
9803
  withProjectOptions(
9504
9804
  withDiffOptions(
9505
- yargs42.positional("directory", {
9805
+ yargs43.positional("directory", {
9506
9806
  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
9807
  type: "string"
9508
9808
  }).option("format", {
@@ -9578,12 +9878,12 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
9578
9878
  var SignalPushModule = {
9579
9879
  command: "push <directory>",
9580
9880
  describe: "Pushes all signals from files in a directory or package to Uniform",
9581
- builder: (yargs42) => withConfiguration(
9881
+ builder: (yargs43) => withConfiguration(
9582
9882
  withDebugOptions(
9583
9883
  withApiOptions(
9584
9884
  withProjectOptions(
9585
9885
  withDiffOptions(
9586
- yargs42.positional("directory", {
9886
+ yargs43.positional("directory", {
9587
9887
  describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
9588
9888
  type: "string"
9589
9889
  }).option("mode", {
@@ -9648,10 +9948,10 @@ var SignalRemoveModule = {
9648
9948
  command: "remove <id>",
9649
9949
  aliases: ["delete", "rm"],
9650
9950
  describe: "Delete a signal",
9651
- builder: (yargs42) => withConfiguration(
9951
+ builder: (yargs43) => withConfiguration(
9652
9952
  withApiOptions(
9653
9953
  withProjectOptions(
9654
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
9954
+ yargs43.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
9655
9955
  )
9656
9956
  )
9657
9957
  ),
@@ -9668,10 +9968,10 @@ var SignalUpdateModule = {
9668
9968
  command: "update <filename>",
9669
9969
  aliases: ["put"],
9670
9970
  describe: "Insert or update a signal",
9671
- builder: (yargs42) => withConfiguration(
9971
+ builder: (yargs43) => withConfiguration(
9672
9972
  withApiOptions(
9673
9973
  withProjectOptions(
9674
- yargs42.positional("filename", { demandOption: true, describe: "Signal file to put" })
9974
+ yargs43.positional("filename", { demandOption: true, describe: "Signal file to put" })
9675
9975
  )
9676
9976
  )
9677
9977
  ),
@@ -9688,25 +9988,25 @@ var SignalModule = {
9688
9988
  command: "signal <command>",
9689
9989
  aliases: ["sig"],
9690
9990
  describe: "Commands for Context signals",
9691
- builder: (yargs42) => yargs42.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
9991
+ builder: (yargs43) => yargs43.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
9692
9992
  handler: () => {
9693
- yargs25.help();
9993
+ yargs26.help();
9694
9994
  }
9695
9995
  };
9696
9996
 
9697
9997
  // src/commands/context/commands/test.ts
9698
- import yargs26 from "yargs";
9998
+ import yargs27 from "yargs";
9699
9999
 
9700
10000
  // src/commands/context/commands/test/get.ts
9701
10001
  import { UncachedTestClient } from "@uniformdev/context/api";
9702
10002
  var TestGetModule = {
9703
10003
  command: "get <id>",
9704
10004
  describe: "Fetch a test",
9705
- builder: (yargs42) => withConfiguration(
10005
+ builder: (yargs43) => withConfiguration(
9706
10006
  withFormatOptions(
9707
10007
  withApiOptions(
9708
10008
  withProjectOptions(
9709
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
10009
+ yargs43.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
9710
10010
  )
9711
10011
  )
9712
10012
  )
@@ -9730,7 +10030,7 @@ var TestListModule = {
9730
10030
  command: "list",
9731
10031
  describe: "List tests",
9732
10032
  aliases: ["ls"],
9733
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
10033
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
9734
10034
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9735
10035
  const fetch2 = nodeFetchProxy(proxy);
9736
10036
  const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9780,12 +10080,12 @@ function createTestEngineDataSource({
9780
10080
  var TestPullModule = {
9781
10081
  command: "pull <directory>",
9782
10082
  describe: "Pulls all tests to local files in a directory",
9783
- builder: (yargs42) => withConfiguration(
10083
+ builder: (yargs43) => withConfiguration(
9784
10084
  withDebugOptions(
9785
10085
  withApiOptions(
9786
10086
  withProjectOptions(
9787
10087
  withDiffOptions(
9788
- yargs42.positional("directory", {
10088
+ yargs43.positional("directory", {
9789
10089
  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
10090
  type: "string"
9791
10091
  }).option("format", {
@@ -9861,12 +10161,12 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
9861
10161
  var TestPushModule = {
9862
10162
  command: "push <directory>",
9863
10163
  describe: "Pushes all tests from files in a directory or package to Uniform",
9864
- builder: (yargs42) => withConfiguration(
10164
+ builder: (yargs43) => withConfiguration(
9865
10165
  withDebugOptions(
9866
10166
  withApiOptions(
9867
10167
  withProjectOptions(
9868
10168
  withDiffOptions(
9869
- yargs42.positional("directory", {
10169
+ yargs43.positional("directory", {
9870
10170
  describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
9871
10171
  type: "string"
9872
10172
  }).option("mode", {
@@ -9931,10 +10231,10 @@ var TestRemoveModule = {
9931
10231
  command: "remove <id>",
9932
10232
  aliases: ["delete", "rm"],
9933
10233
  describe: "Delete a test",
9934
- builder: (yargs42) => withConfiguration(
10234
+ builder: (yargs43) => withConfiguration(
9935
10235
  withApiOptions(
9936
10236
  withProjectOptions(
9937
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to delete" })
10237
+ yargs43.positional("id", { demandOption: true, describe: "Test public ID to delete" })
9938
10238
  )
9939
10239
  )
9940
10240
  ),
@@ -9951,9 +10251,9 @@ var TestUpdateModule = {
9951
10251
  command: "update <filename>",
9952
10252
  aliases: ["put"],
9953
10253
  describe: "Insert or update a test",
9954
- builder: (yargs42) => withConfiguration(
10254
+ builder: (yargs43) => withConfiguration(
9955
10255
  withApiOptions(
9956
- withProjectOptions(yargs42.positional("filename", { demandOption: true, describe: "Test file to put" }))
10256
+ withProjectOptions(yargs43.positional("filename", { demandOption: true, describe: "Test file to put" }))
9957
10257
  )
9958
10258
  ),
9959
10259
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
@@ -9968,9 +10268,9 @@ var TestUpdateModule = {
9968
10268
  var TestModule = {
9969
10269
  command: "test <command>",
9970
10270
  describe: "Commands for Context A/B tests",
9971
- builder: (yargs42) => yargs42.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
10271
+ builder: (yargs43) => yargs43.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
9972
10272
  handler: () => {
9973
- yargs26.help();
10273
+ yargs27.help();
9974
10274
  }
9975
10275
  };
9976
10276
 
@@ -9979,20 +10279,20 @@ var ContextCommand = {
9979
10279
  command: "context <command>",
9980
10280
  aliases: ["ctx"],
9981
10281
  describe: "Uniform Context commands",
9982
- builder: (yargs42) => yargs42.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
10282
+ builder: (yargs43) => yargs43.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
9983
10283
  handler: () => {
9984
- yargs27.showHelp();
10284
+ yargs28.showHelp();
9985
10285
  }
9986
10286
  };
9987
10287
 
9988
10288
  // src/commands/integration/index.ts
9989
- import yargs32 from "yargs";
10289
+ import yargs33 from "yargs";
9990
10290
 
9991
10291
  // src/commands/integration/commands/definition.ts
9992
- import yargs31 from "yargs";
10292
+ import yargs32 from "yargs";
9993
10293
 
9994
10294
  // src/commands/integration/commands/definition/dataResourceEditor/dataResourceEditor.ts
9995
- import yargs28 from "yargs";
10295
+ import yargs29 from "yargs";
9996
10296
 
9997
10297
  // src/commands/integration/commands/definition/dataResourceEditor/deploy.ts
9998
10298
  import { readFileSync as readFileSync2 } from "fs";
@@ -10063,8 +10363,8 @@ var EdgehancerClient = class extends ApiClient {
10063
10363
  };
10064
10364
 
10065
10365
  // src/commands/integration/commands/definition/dataResourceEditor/util.ts
10066
- function withDataResourceEditorIdOptions(yargs42) {
10067
- return yargs42.option("connectorType", {
10366
+ function withDataResourceEditorIdOptions(yargs43) {
10367
+ return yargs43.option("connectorType", {
10068
10368
  describe: "Integration data connector type to attach the data resource editor to, as defined in the integration manifest file.",
10069
10369
  demandOption: true,
10070
10370
  type: "string"
@@ -10084,11 +10384,11 @@ function withDataResourceEditorIdOptions(yargs42) {
10084
10384
  var IntegrationDataResourceEditorDeployModule = {
10085
10385
  command: "deploy <filename>",
10086
10386
  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(
10387
+ builder: (yargs43) => withConfiguration(
10088
10388
  withApiOptions(
10089
10389
  withTeamOptions(
10090
10390
  withDataResourceEditorIdOptions(
10091
- yargs42.positional("filename", {
10391
+ yargs43.positional("filename", {
10092
10392
  demandOption: true,
10093
10393
  describe: "ESM code file to run for the target data resource editor hook. Refer to the documentation for expected types."
10094
10394
  }).option("compatibilityDate", {
@@ -10131,7 +10431,7 @@ var IntegrationDataResourceEditorDeployModule = {
10131
10431
  var IntegrationDataResourceEditorRemoveModule = {
10132
10432
  command: "remove",
10133
10433
  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)))),
10434
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withDataResourceEditorIdOptions(yargs43)))),
10135
10435
  handler: async ({ apiHost, apiKey, proxy, team: teamId, connectorType, archetype, hook }) => {
10136
10436
  const fetch2 = nodeFetchProxy(proxy);
10137
10437
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10143,21 +10443,21 @@ var IntegrationDataResourceEditorRemoveModule = {
10143
10443
  var IntegrationDataResourceEditorModule = {
10144
10444
  command: "dataResourceEditor <command>",
10145
10445
  describe: "Commands for managing custom AI data resource editors at the team level.",
10146
- builder: (yargs42) => yargs42.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10446
+ builder: (yargs43) => yargs43.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10147
10447
  handler: () => {
10148
- yargs28.help();
10448
+ yargs29.help();
10149
10449
  }
10150
10450
  };
10151
10451
 
10152
10452
  // src/commands/integration/commands/definition/edgehancer/edgehancer.ts
10153
- import yargs29 from "yargs";
10453
+ import yargs30 from "yargs";
10154
10454
 
10155
10455
  // src/commands/integration/commands/definition/edgehancer/deploy.ts
10156
10456
  import { readFileSync as readFileSync3 } from "fs";
10157
10457
 
10158
10458
  // src/commands/integration/commands/definition/edgehancer/util.ts
10159
- function withEdgehancerIdOptions(yargs42) {
10160
- return yargs42.option("connectorType", {
10459
+ function withEdgehancerIdOptions(yargs43) {
10460
+ return yargs43.option("connectorType", {
10161
10461
  describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
10162
10462
  demandOption: true,
10163
10463
  type: "string"
@@ -10177,11 +10477,11 @@ function withEdgehancerIdOptions(yargs42) {
10177
10477
  var IntegrationEdgehancerDeployModule = {
10178
10478
  command: "deploy <filename>",
10179
10479
  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(
10480
+ builder: (yargs43) => withConfiguration(
10181
10481
  withApiOptions(
10182
10482
  withTeamOptions(
10183
10483
  withEdgehancerIdOptions(
10184
- yargs42.positional("filename", {
10484
+ yargs43.positional("filename", {
10185
10485
  demandOption: true,
10186
10486
  describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
10187
10487
  }).option("compatibilityDate", {
@@ -10224,7 +10524,7 @@ var IntegrationEdgehancerDeployModule = {
10224
10524
  var IntegrationEdgehancerRemoveModule = {
10225
10525
  command: "remove",
10226
10526
  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)))),
10527
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs43)))),
10228
10528
  handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
10229
10529
  const fetch2 = nodeFetchProxy(proxy);
10230
10530
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10236,22 +10536,22 @@ var IntegrationEdgehancerRemoveModule = {
10236
10536
  var IntegrationEdgehancerModule = {
10237
10537
  command: "edgehancer <command>",
10238
10538
  describe: "Commands for managing custom integration edgehancers at the team level.",
10239
- builder: (yargs42) => yargs42.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10539
+ builder: (yargs43) => yargs43.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10240
10540
  handler: () => {
10241
- yargs29.help();
10541
+ yargs30.help();
10242
10542
  }
10243
10543
  };
10244
10544
 
10245
10545
  // src/commands/integration/commands/definition/propertyEditor/propertyEditor.ts
10246
- import yargs30 from "yargs";
10546
+ import yargs31 from "yargs";
10247
10547
 
10248
10548
  // src/commands/integration/commands/definition/propertyEditor/deploy.ts
10249
10549
  import { IntegrationPropertyEditorsClient } from "@uniformdev/canvas";
10250
10550
  import { readFileSync as readFileSync4 } from "fs";
10251
10551
 
10252
10552
  // src/commands/integration/commands/definition/propertyEditor/util.ts
10253
- function withPropertyEditorIdOptions(yargs42) {
10254
- return yargs42.option("propertyType", {
10553
+ function withPropertyEditorIdOptions(yargs43) {
10554
+ return yargs43.option("propertyType", {
10255
10555
  describe: "Property type to attach the editor to.",
10256
10556
  demandOption: true,
10257
10557
  type: "string"
@@ -10267,11 +10567,11 @@ function withPropertyEditorIdOptions(yargs42) {
10267
10567
  var IntegrationPropertyEditorDeployModule = {
10268
10568
  command: "deploy <filename>",
10269
10569
  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(
10570
+ builder: (yargs43) => withConfiguration(
10271
10571
  withApiOptions(
10272
10572
  withTeamOptions(
10273
10573
  withPropertyEditorIdOptions(
10274
- yargs42.positional("filename", {
10574
+ yargs43.positional("filename", {
10275
10575
  demandOption: true,
10276
10576
  describe: "ESM code file to run for the target property editor hook. Refer to the documentation for expected types."
10277
10577
  }).option("compatibilityDate", {
@@ -10314,7 +10614,7 @@ import { IntegrationPropertyEditorsClient as IntegrationPropertyEditorsClient2 }
10314
10614
  var IntegrationPropertyEditorRemoveModule = {
10315
10615
  command: "remove",
10316
10616
  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)))),
10617
+ builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withPropertyEditorIdOptions(yargs43)))),
10318
10618
  handler: async ({ apiHost, apiKey, proxy, team: teamId, propertyType, hook }) => {
10319
10619
  const fetch2 = nodeFetchProxy(proxy);
10320
10620
  const client = new IntegrationPropertyEditorsClient2({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10326,9 +10626,9 @@ var IntegrationPropertyEditorRemoveModule = {
10326
10626
  var IntegrationPropertyEditorModule = {
10327
10627
  command: "propertyEditor <command>",
10328
10628
  describe: "Commands for managing custom AI property editors at the team level.",
10329
- builder: (yargs42) => yargs42.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10629
+ builder: (yargs43) => yargs43.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10330
10630
  handler: () => {
10331
- yargs30.help();
10631
+ yargs31.help();
10332
10632
  }
10333
10633
  };
10334
10634
 
@@ -10368,10 +10668,10 @@ var DefinitionClient = class extends ApiClient2 {
10368
10668
  var IntegrationDefinitionRegisterModule = {
10369
10669
  command: "register <filename>",
10370
10670
  describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
10371
- builder: (yargs42) => withConfiguration(
10671
+ builder: (yargs43) => withConfiguration(
10372
10672
  withApiOptions(
10373
10673
  withTeamOptions(
10374
- yargs42.positional("filename", {
10674
+ yargs43.positional("filename", {
10375
10675
  demandOption: true,
10376
10676
  describe: "Integration definition manifest to register"
10377
10677
  })
@@ -10390,10 +10690,10 @@ var IntegrationDefinitionRegisterModule = {
10390
10690
  var IntegrationDefinitionRemoveModule = {
10391
10691
  command: "remove <type>",
10392
10692
  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(
10693
+ builder: (yargs43) => withConfiguration(
10394
10694
  withApiOptions(
10395
10695
  withTeamOptions(
10396
- yargs42.positional("type", {
10696
+ yargs43.positional("type", {
10397
10697
  demandOption: true,
10398
10698
  describe: "Integration type (from its manifest) to remove."
10399
10699
  })
@@ -10411,9 +10711,9 @@ var IntegrationDefinitionRemoveModule = {
10411
10711
  var IntegrationDefinitionModule = {
10412
10712
  command: "definition <command>",
10413
10713
  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(),
10714
+ builder: (yargs43) => yargs43.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).command(IntegrationDataResourceEditorModule).command(IntegrationPropertyEditorModule).demandCommand(),
10415
10715
  handler: () => {
10416
- yargs31.help();
10716
+ yargs32.help();
10417
10717
  }
10418
10718
  };
10419
10719
 
@@ -10453,10 +10753,10 @@ var InstallClient = class extends ApiClient3 {
10453
10753
  var IntegrationInstallModule = {
10454
10754
  command: "install <type>",
10455
10755
  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(
10756
+ builder: (yargs43) => withConfiguration(
10457
10757
  withApiOptions(
10458
10758
  withProjectOptions(
10459
- yargs42.positional("type", {
10759
+ yargs43.positional("type", {
10460
10760
  demandOption: true,
10461
10761
  describe: "Integration type to install (as defined in its manifest)"
10462
10762
  }).option("configuration", {
@@ -10478,10 +10778,10 @@ var IntegrationInstallModule = {
10478
10778
  var IntegrationUninstallModule = {
10479
10779
  command: "uninstall <type>",
10480
10780
  describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
10481
- builder: (yargs42) => withConfiguration(
10781
+ builder: (yargs43) => withConfiguration(
10482
10782
  withApiOptions(
10483
10783
  withProjectOptions(
10484
- yargs42.positional("type", {
10784
+ yargs43.positional("type", {
10485
10785
  demandOption: true,
10486
10786
  describe: "Integration type to uninstall (as defined in its manifest)"
10487
10787
  })
@@ -10499,9 +10799,9 @@ var IntegrationUninstallModule = {
10499
10799
  var IntegrationCommand = {
10500
10800
  command: "integration <command>",
10501
10801
  describe: "Integration management commands",
10502
- builder: (yargs42) => yargs42.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
10802
+ builder: (yargs43) => yargs43.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
10503
10803
  handler: () => {
10504
- yargs32.showHelp();
10804
+ yargs33.showHelp();
10505
10805
  }
10506
10806
  };
10507
10807
 
@@ -10966,14 +11266,14 @@ var NewMeshCmd = {
10966
11266
  };
10967
11267
 
10968
11268
  // src/commands/policy-documents/index.ts
10969
- import yargs33 from "yargs";
11269
+ import yargs34 from "yargs";
10970
11270
 
10971
11271
  // src/commands/policy-documents/commands/list.ts
10972
11272
  var PolicyDocumentsListModule = {
10973
11273
  command: "list",
10974
11274
  describe: "List policy documents for a project",
10975
11275
  aliases: ["ls"],
10976
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11276
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
10977
11277
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
10978
11278
  const fetch2 = nodeFetchProxy(proxy, verbose);
10979
11279
  const url = new URL(`/api/v1/policy-documents`, apiHost);
@@ -11058,12 +11358,12 @@ var selectDisplayName13 = (policyDoc) => `Policy document for role ${policyDoc.r
11058
11358
  var PolicyDocumentsPullModule = {
11059
11359
  command: "pull <directory>",
11060
11360
  describe: "Pulls all policy documents to local files in a directory",
11061
- builder: (yargs42) => withConfiguration(
11361
+ builder: (yargs43) => withConfiguration(
11062
11362
  withApiOptions(
11063
11363
  withDebugOptions(
11064
11364
  withProjectOptions(
11065
11365
  withDiffOptions(
11066
- yargs42.positional("directory", {
11366
+ yargs43.positional("directory", {
11067
11367
  describe: "Directory to save to. Each policy document will be saved as a separate file named by role ID.",
11068
11368
  type: "string"
11069
11369
  }).option("format", {
@@ -11118,7 +11418,8 @@ var PolicyDocumentsPullModule = {
11118
11418
  };
11119
11419
 
11120
11420
  // src/commands/policy-documents/commands/push.ts
11121
- import { readdir as readdir2, stat } from "fs/promises";
11421
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
11422
+ import { readdir as readdir2 } from "fs/promises";
11122
11423
  import { extname as extname2, join as join11 } from "path";
11123
11424
  async function readLocalPolicyDocuments(directory, format, verbose) {
11124
11425
  const files = await readdir2(directory);
@@ -11196,12 +11497,12 @@ function mergePolicyDocuments(localDocs, remoteDocs, mode) {
11196
11497
  var PolicyDocumentsPushModule = {
11197
11498
  command: "push <directory>",
11198
11499
  describe: "Pushes policy documents from local files to Uniform",
11199
- builder: (yargs42) => withConfiguration(
11500
+ builder: (yargs43) => withConfiguration(
11200
11501
  withApiOptions(
11201
11502
  withDebugOptions(
11202
11503
  withProjectOptions(
11203
11504
  withDiffOptions(
11204
- yargs42.positional("directory", {
11505
+ yargs43.positional("directory", {
11205
11506
  describe: "Directory containing policy document files (one file per role ID).",
11206
11507
  type: "string"
11207
11508
  }).option("format", {
@@ -11235,16 +11536,11 @@ var PolicyDocumentsPushModule = {
11235
11536
  allowEmptySource,
11236
11537
  verbose
11237
11538
  }) => {
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`);
11539
+ if (!existsSync5(directory)) {
11540
+ if (verbose) {
11541
+ console.log(`Creating directory ${directory}`);
11246
11542
  }
11247
- throw e;
11543
+ mkdirSync4(directory, { recursive: true });
11248
11544
  }
11249
11545
  const fetch2 = nodeFetchProxy(proxy, verbose);
11250
11546
  const localDocs = await readLocalPolicyDocuments(directory, format, verbose);
@@ -11302,17 +11598,17 @@ var PolicyDocumentsCommand = {
11302
11598
  command: "policy-documents <command>",
11303
11599
  aliases: ["policy", "policies"],
11304
11600
  describe: "Uniform Policy Documents commands",
11305
- builder: (yargs42) => yargs42.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11601
+ builder: (yargs43) => yargs43.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11306
11602
  handler: () => {
11307
- yargs33.showHelp();
11603
+ yargs34.showHelp();
11308
11604
  }
11309
11605
  };
11310
11606
 
11311
11607
  // src/commands/project-map/index.ts
11312
- import yargs36 from "yargs";
11608
+ import yargs37 from "yargs";
11313
11609
 
11314
11610
  // src/commands/project-map/commands/projectMapDefinition.ts
11315
- import yargs34 from "yargs";
11611
+ import yargs35 from "yargs";
11316
11612
 
11317
11613
  // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
11318
11614
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
@@ -11326,11 +11622,11 @@ function getProjectMapClient(options) {
11326
11622
  var ProjectMapDefinitionGetModule = {
11327
11623
  command: "get <id>",
11328
11624
  describe: "Fetch a project map",
11329
- builder: (yargs42) => withFormatOptions(
11625
+ builder: (yargs43) => withFormatOptions(
11330
11626
  withConfiguration(
11331
11627
  withApiOptions(
11332
11628
  withProjectOptions(
11333
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11629
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11334
11630
  )
11335
11631
  )
11336
11632
  )
@@ -11353,7 +11649,7 @@ var ProjectMapDefinitionListModule = {
11353
11649
  command: "list",
11354
11650
  describe: "List of project maps",
11355
11651
  aliases: ["ls"],
11356
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11652
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
11357
11653
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
11358
11654
  const fetch2 = nodeFetchProxy(proxy);
11359
11655
  const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -11407,12 +11703,12 @@ function createProjectMapDefinitionEngineDataSource({
11407
11703
  var ProjectMapDefinitionPullModule = {
11408
11704
  command: "pull <directory>",
11409
11705
  describe: "Pulls all project maps to local files in a directory",
11410
- builder: (yargs42) => withConfiguration(
11706
+ builder: (yargs43) => withConfiguration(
11411
11707
  withDebugOptions(
11412
11708
  withApiOptions(
11413
11709
  withProjectOptions(
11414
11710
  withDiffOptions(
11415
- yargs42.positional("directory", {
11711
+ yargs43.positional("directory", {
11416
11712
  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
11713
  type: "string"
11418
11714
  }).option("format", {
@@ -11487,12 +11783,12 @@ var ProjectMapDefinitionPullModule = {
11487
11783
  var ProjectMapDefinitionPushModule = {
11488
11784
  command: "push <directory>",
11489
11785
  describe: "Pushes all project maps from files in a directory or package to Uniform",
11490
- builder: (yargs42) => withConfiguration(
11786
+ builder: (yargs43) => withConfiguration(
11491
11787
  withDebugOptions(
11492
11788
  withApiOptions(
11493
11789
  withProjectOptions(
11494
11790
  withDiffOptions(
11495
- yargs42.positional("directory", {
11791
+ yargs43.positional("directory", {
11496
11792
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11497
11793
  type: "string"
11498
11794
  }).option("mode", {
@@ -11556,9 +11852,9 @@ var ProjectMapDefinitionRemoveModule = {
11556
11852
  command: "remove <id>",
11557
11853
  aliases: ["delete", "rm"],
11558
11854
  describe: "Delete a project map",
11559
- builder: (yargs42) => withConfiguration(
11855
+ builder: (yargs43) => withConfiguration(
11560
11856
  withApiOptions(
11561
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
11857
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
11562
11858
  )
11563
11859
  ),
11564
11860
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -11573,10 +11869,10 @@ var ProjectMapDefinitionUpdateModule = {
11573
11869
  command: "update <filename>",
11574
11870
  aliases: ["put"],
11575
11871
  describe: "Insert or update a project map",
11576
- builder: (yargs42) => withConfiguration(
11872
+ builder: (yargs43) => withConfiguration(
11577
11873
  withApiOptions(
11578
11874
  withProjectOptions(
11579
- yargs42.positional("filename", { demandOption: true, describe: "Project map file to put" })
11875
+ yargs43.positional("filename", { demandOption: true, describe: "Project map file to put" })
11580
11876
  )
11581
11877
  )
11582
11878
  ),
@@ -11592,24 +11888,24 @@ var ProjectMapDefinitionUpdateModule = {
11592
11888
  var ProjectMapDefinitionModule = {
11593
11889
  command: "definition <command>",
11594
11890
  describe: "Commands for ProjectMap Definitions",
11595
- builder: (yargs42) => yargs42.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
11891
+ builder: (yargs43) => yargs43.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
11596
11892
  handler: () => {
11597
- yargs34.help();
11893
+ yargs35.help();
11598
11894
  }
11599
11895
  };
11600
11896
 
11601
11897
  // src/commands/project-map/commands/projectMapNode.ts
11602
- import yargs35 from "yargs";
11898
+ import yargs36 from "yargs";
11603
11899
 
11604
11900
  // src/commands/project-map/commands/ProjectMapNode/get.ts
11605
11901
  var ProjectMapNodeGetModule = {
11606
11902
  command: "get <id> <projectMapId>",
11607
11903
  describe: "Fetch a project map node",
11608
- builder: (yargs42) => withConfiguration(
11904
+ builder: (yargs43) => withConfiguration(
11609
11905
  withFormatOptions(
11610
11906
  withApiOptions(
11611
11907
  withProjectOptions(
11612
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
11908
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
11613
11909
  )
11614
11910
  )
11615
11911
  )
@@ -11633,12 +11929,12 @@ var ProjectMapNodeListModule = {
11633
11929
  command: "list <projectMapId>",
11634
11930
  describe: "List project map nodes",
11635
11931
  aliases: ["ls"],
11636
- builder: (yargs42) => withConfiguration(
11932
+ builder: (yargs43) => withConfiguration(
11637
11933
  withFormatOptions(
11638
11934
  withApiOptions(
11639
11935
  withProjectOptions(
11640
11936
  withStateOptions(
11641
- yargs42.positional("projectMapId", {
11937
+ yargs43.positional("projectMapId", {
11642
11938
  demandOption: true,
11643
11939
  describe: "ProjectMap UUID to fetch from"
11644
11940
  })
@@ -11716,12 +12012,12 @@ function createProjectMapNodeEngineDataSource({
11716
12012
  var ProjectMapNodePullModule = {
11717
12013
  command: "pull <directory>",
11718
12014
  describe: "Pulls all project maps nodes to local files in a directory",
11719
- builder: (yargs42) => withConfiguration(
12015
+ builder: (yargs43) => withConfiguration(
11720
12016
  withDebugOptions(
11721
12017
  withApiOptions(
11722
12018
  withProjectOptions(
11723
12019
  withDiffOptions(
11724
- yargs42.positional("directory", {
12020
+ yargs43.positional("directory", {
11725
12021
  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
12022
  type: "string"
11727
12023
  }).option("format", {
@@ -11803,12 +12099,12 @@ import {
11803
12099
  var ProjectMapNodePushModule = {
11804
12100
  command: "push <directory>",
11805
12101
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
11806
- builder: (yargs42) => withConfiguration(
12102
+ builder: (yargs43) => withConfiguration(
11807
12103
  withDebugOptions(
11808
12104
  withApiOptions(
11809
12105
  withProjectOptions(
11810
12106
  withDiffOptions(
11811
- yargs42.positional("directory", {
12107
+ yargs43.positional("directory", {
11812
12108
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11813
12109
  type: "string"
11814
12110
  }).option("mode", {
@@ -11910,10 +12206,10 @@ var ProjectMapNodeRemoveModule = {
11910
12206
  command: "remove <id> <projectMapId>",
11911
12207
  aliases: ["delete", "rm"],
11912
12208
  describe: "Delete a project map node",
11913
- builder: (yargs42) => withConfiguration(
12209
+ builder: (yargs43) => withConfiguration(
11914
12210
  withApiOptions(
11915
12211
  withProjectOptions(
11916
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
12212
+ yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
11917
12213
  )
11918
12214
  )
11919
12215
  ),
@@ -11929,10 +12225,10 @@ var ProjectMapNodeUpdateModule = {
11929
12225
  command: "update <filename> <projectMapId>",
11930
12226
  aliases: ["put"],
11931
12227
  describe: "Insert or update a project map node",
11932
- builder: (yargs42) => withConfiguration(
12228
+ builder: (yargs43) => withConfiguration(
11933
12229
  withApiOptions(
11934
12230
  withProjectOptions(
11935
- yargs42.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
12231
+ yargs43.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
11936
12232
  )
11937
12233
  )
11938
12234
  ),
@@ -11948,9 +12244,9 @@ var ProjectMapNodeUpdateModule = {
11948
12244
  var ProjectMapNodeModule = {
11949
12245
  command: "node <command>",
11950
12246
  describe: "Commands for ProjectMap Nodes",
11951
- builder: (yargs42) => yargs42.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
12247
+ builder: (yargs43) => yargs43.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
11952
12248
  handler: () => {
11953
- yargs35.help();
12249
+ yargs36.help();
11954
12250
  }
11955
12251
  };
11956
12252
 
@@ -11959,17 +12255,17 @@ var ProjectMapCommand = {
11959
12255
  command: "project-map <command>",
11960
12256
  aliases: ["prm"],
11961
12257
  describe: "Uniform ProjectMap commands",
11962
- builder: (yargs42) => yargs42.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
12258
+ builder: (yargs43) => yargs43.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
11963
12259
  handler: () => {
11964
- yargs36.showHelp();
12260
+ yargs37.showHelp();
11965
12261
  }
11966
12262
  };
11967
12263
 
11968
12264
  // src/commands/redirect/index.ts
11969
- import yargs38 from "yargs";
12265
+ import yargs39 from "yargs";
11970
12266
 
11971
12267
  // src/commands/redirect/commands/redirect.ts
11972
- import yargs37 from "yargs";
12268
+ import yargs38 from "yargs";
11973
12269
 
11974
12270
  // src/commands/redirect/commands/RedirectDefinition/_util.ts
11975
12271
  import { UncachedRedirectClient } from "@uniformdev/redirect";
@@ -11994,11 +12290,11 @@ function getRedirectClient(options) {
11994
12290
  var RedirectDefinitionGetModule = {
11995
12291
  command: "get <id>",
11996
12292
  describe: "Fetch a redirect",
11997
- builder: (yargs42) => withConfiguration(
12293
+ builder: (yargs43) => withConfiguration(
11998
12294
  withFormatOptions(
11999
12295
  withApiOptions(
12000
12296
  withProjectOptions(
12001
- yargs42.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12297
+ yargs43.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12002
12298
  )
12003
12299
  )
12004
12300
  )
@@ -12021,7 +12317,7 @@ var RedirectDefinitionListModule = {
12021
12317
  command: "list",
12022
12318
  describe: "List of redirects",
12023
12319
  aliases: ["ls"],
12024
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
12320
+ builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
12025
12321
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
12026
12322
  const fetch2 = nodeFetchProxy(proxy);
12027
12323
  const client = getRedirectClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -12073,12 +12369,12 @@ function createRedirectDefinitionEngineDataSource({
12073
12369
  var RedirectDefinitionPullModule = {
12074
12370
  command: "pull <directory>",
12075
12371
  describe: "Pulls all redirects to local files in a directory",
12076
- builder: (yargs42) => withConfiguration(
12372
+ builder: (yargs43) => withConfiguration(
12077
12373
  withDebugOptions(
12078
12374
  withApiOptions(
12079
12375
  withProjectOptions(
12080
12376
  withDiffOptions(
12081
- yargs42.positional("directory", {
12377
+ yargs43.positional("directory", {
12082
12378
  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
12379
  type: "string"
12084
12380
  }).option("format", {
@@ -12154,12 +12450,12 @@ var RedirectDefinitionPullModule = {
12154
12450
  var RedirectDefinitionPushModule = {
12155
12451
  command: "push <directory>",
12156
12452
  describe: "Pushes all redirects from files in a directory or package to Uniform",
12157
- builder: (yargs42) => withConfiguration(
12453
+ builder: (yargs43) => withConfiguration(
12158
12454
  withDebugOptions(
12159
12455
  withApiOptions(
12160
12456
  withProjectOptions(
12161
12457
  withDiffOptions(
12162
- yargs42.positional("directory", {
12458
+ yargs43.positional("directory", {
12163
12459
  describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
12164
12460
  type: "string"
12165
12461
  }).option("mode", {
@@ -12223,9 +12519,9 @@ var RedirectDefinitionRemoveModule = {
12223
12519
  command: "remove <id>",
12224
12520
  aliases: ["delete", "rm"],
12225
12521
  describe: "Delete a redirect",
12226
- builder: (yargs42) => withConfiguration(
12522
+ builder: (yargs43) => withConfiguration(
12227
12523
  withApiOptions(
12228
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
12524
+ withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
12229
12525
  )
12230
12526
  ),
12231
12527
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -12240,10 +12536,10 @@ var RedirectDefinitionUpdateModule = {
12240
12536
  command: "update <filename>",
12241
12537
  aliases: ["put"],
12242
12538
  describe: "Insert or update a redirect",
12243
- builder: (yargs42) => withConfiguration(
12539
+ builder: (yargs43) => withConfiguration(
12244
12540
  withApiOptions(
12245
12541
  withProjectOptions(
12246
- yargs42.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12542
+ yargs43.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12247
12543
  )
12248
12544
  )
12249
12545
  ),
@@ -12259,9 +12555,9 @@ var RedirectDefinitionUpdateModule = {
12259
12555
  var RedirectDefinitionModule = {
12260
12556
  command: "definition <command>",
12261
12557
  describe: "Commands for Redirect Definitions",
12262
- builder: (yargs42) => yargs42.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12558
+ builder: (yargs43) => yargs43.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12263
12559
  handler: () => {
12264
- yargs37.help();
12560
+ yargs38.help();
12265
12561
  }
12266
12562
  };
12267
12563
 
@@ -12270,14 +12566,14 @@ var RedirectCommand = {
12270
12566
  command: "redirect <command>",
12271
12567
  aliases: ["red"],
12272
12568
  describe: "Uniform Redirect commands",
12273
- builder: (yargs42) => yargs42.command(RedirectDefinitionModule).demandCommand(),
12569
+ builder: (yargs43) => yargs43.command(RedirectDefinitionModule).demandCommand(),
12274
12570
  handler: () => {
12275
- yargs38.showHelp();
12571
+ yargs39.showHelp();
12276
12572
  }
12277
12573
  };
12278
12574
 
12279
12575
  // src/commands/sync/index.ts
12280
- import yargs39 from "yargs";
12576
+ import yargs40 from "yargs";
12281
12577
 
12282
12578
  // src/webhooksClient.ts
12283
12579
  import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
@@ -12471,12 +12767,12 @@ function createWebhookEngineDataSource({
12471
12767
  var WebhookPullModule = {
12472
12768
  command: "pull <directory>",
12473
12769
  describe: "Pulls all webhooks to local files in a directory",
12474
- builder: (yargs42) => withConfiguration(
12770
+ builder: (yargs43) => withConfiguration(
12475
12771
  withApiOptions(
12476
12772
  withDebugOptions(
12477
12773
  withProjectOptions(
12478
12774
  withDiffOptions(
12479
- yargs42.positional("directory", {
12775
+ yargs43.positional("directory", {
12480
12776
  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
12777
  type: "string"
12482
12778
  }).option("format", {
@@ -12662,11 +12958,12 @@ function numPad(num, spaces = 6) {
12662
12958
  var SyncPullModule = {
12663
12959
  command: "pull",
12664
12960
  describe: "Pulls whole project to local files in a directory",
12665
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs42))))),
12961
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs43))))),
12666
12962
  handler: async ({ serialization, ...otherParams }) => {
12667
12963
  const config2 = serialization;
12668
12964
  const enabledEntities = Object.entries({
12669
12965
  locale: LocalePullModule,
12966
+ label: LabelPullModule,
12670
12967
  asset: AssetPullModule,
12671
12968
  category: CategoryPullModule,
12672
12969
  workflow: WorkflowPullModule,
@@ -12761,12 +13058,12 @@ var getFormat = (entityType, config2) => {
12761
13058
  var WebhookPushModule = {
12762
13059
  command: "push <directory>",
12763
13060
  describe: "Pushes all webhooks from files in a directory to Uniform",
12764
- builder: (yargs42) => withConfiguration(
13061
+ builder: (yargs43) => withConfiguration(
12765
13062
  withDebugOptions(
12766
13063
  withApiOptions(
12767
13064
  withProjectOptions(
12768
13065
  withDiffOptions(
12769
- yargs42.positional("directory", {
13066
+ yargs43.positional("directory", {
12770
13067
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
12771
13068
  type: "string"
12772
13069
  }).option("mode", {
@@ -12830,11 +13127,12 @@ var WebhookPushModule = {
12830
13127
  var SyncPushModule = {
12831
13128
  command: "push",
12832
13129
  describe: "Pushes whole project data from files in a directory or package to Uniform",
12833
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs42))))),
13130
+ builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs43))))),
12834
13131
  handler: async ({ serialization, ...otherParams }) => {
12835
13132
  const config2 = serialization;
12836
13133
  const enabledEntities = Object.entries({
12837
13134
  locale: LocalePushModule,
13135
+ label: LabelPushModule,
12838
13136
  asset: AssetPushModule,
12839
13137
  category: CategoryPushModule,
12840
13138
  workflow: WorkflowPushModule,
@@ -13040,21 +13338,21 @@ var getFormat2 = (entityType, config2) => {
13040
13338
  var SyncCommand = {
13041
13339
  command: "sync <command>",
13042
13340
  describe: "Uniform Sync commands",
13043
- builder: (yargs42) => yargs42.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13341
+ builder: (yargs43) => yargs43.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13044
13342
  handler: () => {
13045
- yargs39.showHelp();
13343
+ yargs40.showHelp();
13046
13344
  }
13047
13345
  };
13048
13346
 
13049
13347
  // src/commands/webhook/index.ts
13050
- import yargs40 from "yargs";
13348
+ import yargs41 from "yargs";
13051
13349
  var WebhookCommand = {
13052
13350
  command: "webhook <command>",
13053
13351
  aliases: ["wh"],
13054
13352
  describe: "Commands for webhooks",
13055
- builder: (yargs42) => yargs42.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13353
+ builder: (yargs43) => yargs43.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13056
13354
  handler: () => {
13057
- yargs40.help();
13355
+ yargs41.help();
13058
13356
  }
13059
13357
  };
13060
13358
 
@@ -13062,7 +13360,7 @@ var WebhookCommand = {
13062
13360
  import { bold as bold3, gray as gray6, green as green7 } from "colorette";
13063
13361
 
13064
13362
  // src/updateCheck.ts
13065
- import { existsSync as existsSync5, promises as fs8 } from "fs";
13363
+ import { existsSync as existsSync6, promises as fs8 } from "fs";
13066
13364
  import { get as getHttp } from "http";
13067
13365
  import { get as getHttps } from "https";
13068
13366
  import { tmpdir } from "os";
@@ -13074,7 +13372,7 @@ var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
13074
13372
  var getFile = async (details, distTag) => {
13075
13373
  const rootDir = tmpdir();
13076
13374
  const subDir = join12(rootDir, "update-check");
13077
- if (!existsSync5(subDir)) {
13375
+ if (!existsSync6(subDir)) {
13078
13376
  await fs8.mkdir(subDir);
13079
13377
  }
13080
13378
  let name = `${details.name}-${distTag}.json`;
@@ -13084,7 +13382,7 @@ var getFile = async (details, distTag) => {
13084
13382
  return join12(subDir, name);
13085
13383
  };
13086
13384
  var evaluateCache = async (file, time, interval) => {
13087
- if (existsSync5(file)) {
13385
+ if (existsSync6(file)) {
13088
13386
  const content = await fs8.readFile(file, "utf8");
13089
13387
  const { lastUpdate, latest } = JSON.parse(content);
13090
13388
  const nextCheck = lastUpdate + interval;
@@ -13289,7 +13587,7 @@ First found was: v${firstVersion}`;
13289
13587
 
13290
13588
  // src/index.ts
13291
13589
  dotenv.config();
13292
- var yarggery = yargs41(hideBin(process.argv));
13590
+ var yarggery = yargs42(hideBin(process.argv));
13293
13591
  var useDefaultConfig = !process.argv.includes("--config");
13294
13592
  var defaultConfig2 = useDefaultConfig ? loadConfig(null) : {};
13295
13593
  yarggery.option("verbose", {