@uniformdev/cli 20.50.1 → 20.50.2-alpha.109

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,12 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ CLI_USER_AGENT,
3
4
  __require,
4
5
  applyDefaultSyncConfiguration,
5
6
  emitWithFormat,
7
+ exitOnCliError,
6
8
  getDirectoryOrFilename,
7
9
  getEntityOption,
8
10
  isPathAPackageFile,
9
11
  nodeFetchProxy,
12
+ package_default,
10
13
  paginateAsync,
11
14
  readFileToObject,
12
15
  withApiOptions,
@@ -16,11 +19,11 @@ import {
16
19
  withFormatOptions,
17
20
  withProjectOptions,
18
21
  withTeamOptions
19
- } from "./chunk-SRP5OQEZ.mjs";
22
+ } from "./chunk-UQFYUBTM.mjs";
20
23
 
21
24
  // src/index.ts
22
25
  import * as dotenv from "dotenv";
23
- import yargs41 from "yargs";
26
+ import yargs43 from "yargs";
24
27
  import { hideBin } from "yargs/helpers";
25
28
 
26
29
  // src/commands/ai/index.ts
@@ -72,7 +75,7 @@ async function getBearerToken(baseUrl) {
72
75
  }
73
76
 
74
77
  // src/client.ts
75
- import * as z from "zod/v3";
78
+ import * as z from "zod";
76
79
 
77
80
  // src/auth/api-key.ts
78
81
  var READ_PERMISSIONS = ["PROJECT", "UPM_PUB", "OPT_PUB", "OPT_READ", "UPM_READ"];
@@ -140,7 +143,7 @@ var createClient = (baseUrl, authToken) => {
140
143
  const request2 = async (path8, opts, allowedNon2xxStatusCodes = []) => {
141
144
  const res = await fetch(makeUrl(baseUrl, path8), {
142
145
  ...opts,
143
- headers: { Authorization: `Bearer ${authToken}` }
146
+ headers: { Authorization: `Bearer ${authToken}`, "User-Agent": CLI_USER_AGENT }
144
147
  });
145
148
  if (res.ok || allowedNon2xxStatusCodes.includes(res.status)) {
146
149
  return res;
@@ -150,10 +153,10 @@ var createClient = (baseUrl, authToken) => {
150
153
  );
151
154
  }
152
155
  };
153
- const requestJson = async (path8, opts, schema2, allowedNon2xxStatusCodes = []) => {
156
+ const requestJson = async (path8, opts, schema, allowedNon2xxStatusCodes = []) => {
154
157
  const res = await request2(path8, opts, allowedNon2xxStatusCodes);
155
158
  const data = await res.json();
156
- const parseResult = schema2.safeParse(data);
159
+ const parseResult = schema.safeParse(data);
157
160
  if (parseResult.success) {
158
161
  return parseResult.data;
159
162
  } else {
@@ -324,8 +327,8 @@ async function readJSON(path8) {
324
327
  }
325
328
  async function tryReadJSON(path8, missingValue = null) {
326
329
  try {
327
- const stat2 = await fs.stat(path8);
328
- return stat2.isFile() ? await readJSON(path8) : missingValue;
330
+ const stat = await fs.stat(path8);
331
+ return stat.isFile() ? await readJSON(path8) : missingValue;
329
332
  } catch {
330
333
  return missingValue;
331
334
  }
@@ -447,7 +450,7 @@ async function chooseExistingProject({
447
450
  teamId,
448
451
  user
449
452
  }) {
450
- const projects = (user.teams.find((t) => t.team.id === teamId)?.team.sites ?? []).map((t) => ({
453
+ const projects = (user.teams.find((t) => t.id === teamId)?.projects ?? []).map((t) => ({
451
454
  name: t.name,
452
455
  value: t.id
453
456
  }));
@@ -490,7 +493,7 @@ var makeSpinner = () => {
490
493
  const spin = async (text) => {
491
494
  const spinner = ora(text).start();
492
495
  spinners.push(spinner);
493
- const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
496
+ const minWait = new Promise((resolve4) => setTimeout(resolve4, 500));
494
497
  return async () => {
495
498
  await minWait;
496
499
  spinner.stop();
@@ -722,7 +725,7 @@ import mitt from "mitt";
722
725
 
723
726
  // src/sync/serializedDequal.ts
724
727
  var has = Object.prototype.hasOwnProperty;
725
- var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated"]);
728
+ var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated", "createdBy", "modifiedBy", "updatedBy"]);
726
729
  function serializedDequal(foo, bar) {
727
730
  let ctor, len;
728
731
  if (foo === bar) {
@@ -1033,8 +1036,8 @@ async function chooseTeam(user, prompt, telemetry) {
1033
1036
  const teamId = await select3({
1034
1037
  message: prompt,
1035
1038
  choices: user.teams.map((team) => ({
1036
- name: team.team.name,
1037
- value: team.team.id
1039
+ name: team.name,
1040
+ value: team.id
1038
1041
  }))
1039
1042
  });
1040
1043
  telemetry.send("team picked", { teamId });
@@ -1042,56 +1045,39 @@ async function chooseTeam(user, prompt, telemetry) {
1042
1045
  }
1043
1046
 
1044
1047
  // src/auth/user-info.ts
1048
+ import { ProjectClient } from "@uniformdev/canvas";
1045
1049
  import { gql, request } from "graphql-request";
1046
- import * as z2 from "zod/v3";
1047
- var query = gql`
1048
- query GetUserInfo($subject: String!) {
1050
+ import * as z2 from "zod";
1051
+ var identityQuery = gql`
1052
+ query GetUserIdentity($subject: String!) {
1049
1053
  info: identities_by_pk(subject: $subject) {
1050
1054
  name
1051
1055
  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
1056
  }
1063
1057
  }
1064
1058
  `;
1065
- var schema = z2.object({
1059
+ var identitySchema = z2.object({
1066
1060
  info: z2.object({
1067
1061
  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
- )
1062
+ email_address: z2.string().min(1).nullable()
1083
1063
  })
1084
1064
  });
1085
1065
  var getUserInfo = async (baseUrl, authToken, subject) => {
1086
1066
  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}`);
1067
+ const headers = { Authorization: `Bearer ${authToken}`, "User-Agent": CLI_USER_AGENT };
1068
+ const projectClient = new ProjectClient({ apiHost: baseUrl, bearerToken: authToken });
1069
+ const [identityRes, projectsRes] = await Promise.all([
1070
+ request(makeUrl(baseUrl, "/v1/graphql"), identityQuery, { subject }, headers),
1071
+ projectClient.getProjects()
1072
+ ]);
1073
+ const identityParsed = identitySchema.safeParse(identityRes);
1074
+ if (!identityParsed.success) {
1075
+ throw new Error(`Invalid identity response: ${identityParsed.error.message}`);
1094
1076
  }
1077
+ return {
1078
+ ...identityParsed.data.info,
1079
+ teams: projectsRes.teams
1080
+ };
1095
1081
  } catch (err) {
1096
1082
  throw new Error(`Failed to fetch user account:
1097
1083
  ${err.message}`);
@@ -1120,94 +1106,6 @@ async function fetchUserAndEnsureFirstTeamExists({
1120
1106
  // src/telemetry/telemetry.ts
1121
1107
  import crypto from "crypto";
1122
1108
  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
1109
  var POSTHOG_WRITE_ONLY_KEY = "phc_c8YoKI9984KOHBfNrCRfIKvL56aYd5OpYxOdYexRzH7";
1212
1110
  var Telemetry = class {
1213
1111
  constructor(prefix, disable = false) {
@@ -1403,8 +1301,8 @@ function getExistingServers(config2) {
1403
1301
  var InstallMcpCommand = {
1404
1302
  command: "install",
1405
1303
  describe: "Install Uniform MCP server configuration (use --team, --project, and --apiKey for non-interactive mode)",
1406
- builder: (yargs42) => withConfiguration(
1407
- yargs42.option("agent", {
1304
+ builder: (yargs44) => withConfiguration(
1305
+ yargs44.option("agent", {
1408
1306
  alias: "a",
1409
1307
  describe: "Specify agent type (cursor, claude, copilot, other)",
1410
1308
  type: "string",
@@ -1556,7 +1454,7 @@ Selected agent: ${agentType}`));
1556
1454
  if (isNonInteractive) {
1557
1455
  console.log(`\u{1F3E2} Team ID: ${teamId}`);
1558
1456
  } else {
1559
- console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.team.id === teamId)?.team.name}`);
1457
+ console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.id === teamId)?.name}`);
1560
1458
  }
1561
1459
  console.log(`\u{1F4E6} Project: ${projectName} (${projectId})`);
1562
1460
  if (agentType === "cursor") {
@@ -1604,7 +1502,7 @@ Selected agent: ${agentType}`));
1604
1502
  var McpCommand = {
1605
1503
  command: "mcp <command>",
1606
1504
  describe: "Uniform MCP server management commands",
1607
- builder: (yargs42) => yargs42.command(InstallMcpCommand).demandCommand(),
1505
+ builder: (yargs44) => yargs44.command(InstallMcpCommand).demandCommand(),
1608
1506
  handler: () => {
1609
1507
  yargs.showHelp();
1610
1508
  }
@@ -2079,8 +1977,8 @@ ${gray2("Rules source:")} https://github.com/uniformdev/ai-rules`);
2079
1977
  var InstallRulesCommand = {
2080
1978
  command: "install",
2081
1979
  describe: "Install Uniform AI rules for your development assistant",
2082
- builder: (yargs42) => withConfiguration(
2083
- yargs42.option("agent", {
1980
+ builder: (yargs44) => withConfiguration(
1981
+ yargs44.option("agent", {
2084
1982
  alias: "a",
2085
1983
  describe: "Specify agent type (cursor, claude, copilot, other)",
2086
1984
  type: "string",
@@ -2118,7 +2016,7 @@ import { blue as blue4, bold as bold2, gray as gray3, green as green5, red as re
2118
2016
  var ListRulesCommand = {
2119
2017
  command: "list",
2120
2018
  describe: "List available Uniform AI rules",
2121
- builder: (yargs42) => withConfiguration(yargs42),
2019
+ builder: (yargs44) => withConfiguration(yargs44),
2122
2020
  handler: async function() {
2123
2021
  const { stopAllSpinners, spin } = makeSpinner();
2124
2022
  try {
@@ -2147,7 +2045,7 @@ var ListRulesCommand = {
2147
2045
  var RulesCommand = {
2148
2046
  command: "rules <command>",
2149
2047
  describe: "Uniform AI rules management commands",
2150
- builder: (yargs42) => yargs42.command(InstallRulesCommand).command(ListRulesCommand).demandCommand(),
2048
+ builder: (yargs44) => yargs44.command(InstallRulesCommand).command(ListRulesCommand).demandCommand(),
2151
2049
  handler: () => {
2152
2050
  yargs2.showHelp();
2153
2051
  }
@@ -2157,17 +2055,279 @@ var RulesCommand = {
2157
2055
  var AiCommand = {
2158
2056
  command: "ai <command>",
2159
2057
  describe: "Uniform AI development assistant commands",
2160
- builder: (yargs42) => yargs42.command(RulesCommand).command(McpCommand).demandCommand(),
2058
+ builder: (yargs44) => yargs44.command(RulesCommand).command(McpCommand).demandCommand(),
2161
2059
  handler: () => {
2162
2060
  yargs3.showHelp();
2163
2061
  }
2164
2062
  };
2165
2063
 
2064
+ // src/commands/automation/index.ts
2065
+ import yargs4 from "yargs";
2066
+
2067
+ // src/commands/automation/delete.ts
2068
+ import { AutomationsClient } from "@uniformdev/automations-sdk/api";
2069
+
2070
+ // src/commands/automation/resolveAutomationPublicId.ts
2071
+ import { existsSync as existsSync4 } from "fs";
2072
+ import { basename, extname as extname2, resolve as resolve2 } from "path";
2073
+ function resolveAutomationPublicId(identifier) {
2074
+ const absPath = resolve2(identifier);
2075
+ if (existsSync4(absPath)) {
2076
+ return basename(absPath, extname2(absPath));
2077
+ }
2078
+ return identifier;
2079
+ }
2080
+
2081
+ // src/commands/automation/delete.ts
2082
+ var AutomationDeleteModule = {
2083
+ command: "delete <identifier>",
2084
+ describe: "Deletes an automation from a project.",
2085
+ builder: (yargs44) => withConfiguration(
2086
+ withApiOptions(
2087
+ withProjectOptions(
2088
+ yargs44.positional("identifier", {
2089
+ demandOption: true,
2090
+ type: "string",
2091
+ describe: "Automation public ID, or path to a local automation source file (same as deploy)."
2092
+ })
2093
+ )
2094
+ )
2095
+ ),
2096
+ handler: async ({ apiHost, apiKey, proxy, identifier, project: projectId }) => {
2097
+ const fetch2 = nodeFetchProxy(proxy);
2098
+ const client = new AutomationsClient({ apiKey, apiHost, fetch: fetch2, projectId });
2099
+ const publicId = resolveAutomationPublicId(identifier);
2100
+ try {
2101
+ await client.remove(publicId);
2102
+ console.log(`\u{1F5D1}\uFE0F Deleted automation "${publicId}".`);
2103
+ } catch (error) {
2104
+ exitOnCliError(error);
2105
+ }
2106
+ }
2107
+ };
2108
+
2109
+ // src/commands/automation/deploy.ts
2110
+ import { AutomationsClient as AutomationsClient2, formatAutomationWebhookUrl } from "@uniformdev/automations-sdk/api";
2111
+
2112
+ // src/commands/automation/bundleAutomationForDeploy.ts
2113
+ import { mkdtempSync, readFileSync as readFileSync2, rmSync } from "fs";
2114
+ import { tmpdir } from "os";
2115
+ import { basename as basename2, join as join6, resolve as resolve3 } from "path";
2116
+ import { pathToFileURL } from "url";
2117
+
2118
+ // src/commands/bundleWorkerCode.ts
2119
+ import esbuild from "esbuild";
2120
+ import path5 from "path";
2121
+ var INJECTED_ENV_PREFIX = "UNIFORM_ENV_";
2122
+ function buildInjectedEnvDefine() {
2123
+ const define = {};
2124
+ for (const [key, value] of Object.entries(process.env)) {
2125
+ if (key.startsWith(INJECTED_ENV_PREFIX) && value !== void 0) {
2126
+ define[`process.env.${key}`] = JSON.stringify(value);
2127
+ }
2128
+ }
2129
+ return define;
2130
+ }
2131
+ function workerBundleBuildOptions(entryFile) {
2132
+ return {
2133
+ entryPoints: [entryFile],
2134
+ bundle: true,
2135
+ format: "esm",
2136
+ target: "es2021",
2137
+ platform: "browser",
2138
+ minify: true,
2139
+ external: [],
2140
+ splitting: false,
2141
+ sourcemap: false,
2142
+ define: buildInjectedEnvDefine()
2143
+ };
2144
+ }
2145
+ async function bundleWorkerCodeToFile(entryFile, outfile) {
2146
+ await esbuild.build({
2147
+ ...workerBundleBuildOptions(entryFile),
2148
+ outfile,
2149
+ logLevel: "silent"
2150
+ });
2151
+ }
2152
+ async function bundleWorkerCode(entryFile) {
2153
+ const result = await esbuild.build({
2154
+ ...workerBundleBuildOptions(entryFile),
2155
+ write: false
2156
+ });
2157
+ const outputFiles = result.outputFiles;
2158
+ if (!outputFiles || outputFiles.length === 0) {
2159
+ throw new Error(`No output generated for ${entryFile}`);
2160
+ }
2161
+ const outputFile = outputFiles[0];
2162
+ const builtCode = outputFile.text;
2163
+ console.log(
2164
+ `\u2139\uFE0F ${path5.basename(entryFile)} was prepared with esbuild. Size: ${Math.round(
2165
+ builtCode.length / 1024
2166
+ )}kb (use --skipBundle to disable)`
2167
+ );
2168
+ return builtCode;
2169
+ }
2170
+
2171
+ // src/commands/automation/toInputJsonSchema.ts
2172
+ import * as z3 from "zod";
2173
+ function isZodSchema(value) {
2174
+ return typeof value === "object" && value !== null && "_zod" in value;
2175
+ }
2176
+ function isStandardSchema(value) {
2177
+ return typeof value === "object" && value !== null && "~standard" in value;
2178
+ }
2179
+ function toInputJsonSchema(inputSchema) {
2180
+ if (inputSchema === void 0 || inputSchema === null) {
2181
+ throw new Error("An AI-tool automation must declare an `inputSchema` in its metadata.");
2182
+ }
2183
+ if (isZodSchema(inputSchema)) {
2184
+ return z3.toJSONSchema(inputSchema);
2185
+ }
2186
+ if (isStandardSchema(inputSchema)) {
2187
+ throw new Error(
2188
+ "`inputSchema` is a Standard Schema but not a zod schema. Deploy-time conversion to JSON Schema currently supports zod only \u2014 provide a zod schema or a JSON Schema object."
2189
+ );
2190
+ }
2191
+ if (typeof inputSchema === "object") {
2192
+ return inputSchema;
2193
+ }
2194
+ throw new Error("`inputSchema` must be a zod schema or a JSON Schema object.");
2195
+ }
2196
+
2197
+ // src/commands/automation/bundleAutomationForDeploy.ts
2198
+ async function readAutomationMetadataFromBundle(bundlePath, publicId) {
2199
+ const automationModule = await import(pathToFileURL(bundlePath).href);
2200
+ const automation = automationModule.default;
2201
+ if (!automation?.metadata) {
2202
+ throw new Error("Default export must be the return value of defineAutomation");
2203
+ }
2204
+ const metadata = automation.metadata;
2205
+ const trigger = metadata.trigger?.type === "aiTool" ? { type: "aiTool", inputSchema: toInputJsonSchema(metadata.inputSchema) } : metadata.trigger;
2206
+ return {
2207
+ publicId,
2208
+ name: metadata.name,
2209
+ description: metadata.description,
2210
+ trigger,
2211
+ compatibilityDate: metadata.compatibilityDate,
2212
+ permissions: metadata.permissions
2213
+ };
2214
+ }
2215
+ async function bundleAutomationForDeploy(entryFile) {
2216
+ const absEntry = resolve3(entryFile);
2217
+ const publicId = resolveAutomationPublicId(absEntry);
2218
+ const workDir = mkdtempSync(join6(tmpdir(), "uniform-automation-deploy-"));
2219
+ const bundlePath = join6(workDir, "automation.mjs");
2220
+ try {
2221
+ await bundleWorkerCodeToFile(absEntry, bundlePath);
2222
+ const metadata = await readAutomationMetadataFromBundle(bundlePath, publicId);
2223
+ const code = readFileSync2(bundlePath, "utf8");
2224
+ console.log(
2225
+ `\u2139\uFE0F ${basename2(absEntry)} was prepared with esbuild. Size: ${Math.round(code.length / 1024)}kb`
2226
+ );
2227
+ return {
2228
+ metadata,
2229
+ code,
2230
+ cleanup: () => rmSync(workDir, { recursive: true, force: true })
2231
+ };
2232
+ } catch (error) {
2233
+ rmSync(workDir, { recursive: true, force: true });
2234
+ throw error;
2235
+ }
2236
+ }
2237
+
2238
+ // src/commands/automation/deploy.ts
2239
+ var AutomationDeployModule = {
2240
+ command: "deploy <filename>",
2241
+ describe: "Deploys an automation to a project.",
2242
+ builder: (yargs44) => withConfiguration(
2243
+ withApiOptions(
2244
+ withProjectOptions(
2245
+ yargs44.positional("filename", {
2246
+ demandOption: true,
2247
+ describe: "Automation code file to deploy. The module must default-export the return value of defineAutomation."
2248
+ }).option("compatibilityDate", {
2249
+ type: "string",
2250
+ describe: "Overrides the compatibility date in metadata. Format: YYYY-MM-DD."
2251
+ })
2252
+ )
2253
+ )
2254
+ ),
2255
+ handler: async ({ apiHost, apiKey, proxy, filename, project: projectId, compatibilityDate }) => {
2256
+ const fetch2 = nodeFetchProxy(proxy);
2257
+ const client = new AutomationsClient2({ apiKey, apiHost, fetch: fetch2, projectId });
2258
+ let cleanup;
2259
+ try {
2260
+ const bundled = await bundleAutomationForDeploy(filename);
2261
+ cleanup = bundled.cleanup;
2262
+ await client.deploy({
2263
+ ...bundled.metadata,
2264
+ code: bundled.code,
2265
+ compatibilityDate: compatibilityDate ?? bundled.metadata.compatibilityDate
2266
+ });
2267
+ console.log(
2268
+ `\u2705 Deployed automation "${bundled.metadata.publicId}" (${bundled.metadata.trigger.type}).`
2269
+ );
2270
+ if (bundled.metadata.trigger.type === "incomingWebhook") {
2271
+ console.log(
2272
+ `Webhook URL: ${formatAutomationWebhookUrl(apiHost, projectId, bundled.metadata.publicId)}`
2273
+ );
2274
+ }
2275
+ } catch (error) {
2276
+ exitOnCliError(error);
2277
+ } finally {
2278
+ cleanup?.();
2279
+ }
2280
+ }
2281
+ };
2282
+
2283
+ // src/commands/automation/list.ts
2284
+ import { AutomationsClient as AutomationsClient3 } from "@uniformdev/automations-sdk/api";
2285
+ var AutomationListModule = {
2286
+ command: "list",
2287
+ aliases: ["ls"],
2288
+ describe: "Lists the automations in a project.",
2289
+ builder: (yargs44) => withConfiguration(withApiOptions(withProjectOptions(yargs44))),
2290
+ handler: async ({ apiHost, apiKey, proxy, project: projectId }) => {
2291
+ const fetch2 = nodeFetchProxy(proxy);
2292
+ const client = new AutomationsClient3({ apiKey, apiHost, fetch: fetch2, projectId });
2293
+ try {
2294
+ const { automations } = await client.list();
2295
+ if (!automations.length) {
2296
+ console.log("No automations found in this project.");
2297
+ return;
2298
+ }
2299
+ console.table(
2300
+ automations.map((automation) => ({
2301
+ publicId: automation.publicId,
2302
+ name: automation.name,
2303
+ trigger: automation.trigger.type,
2304
+ enabled: automation.enabled,
2305
+ lastDeployedAt: automation.lastDeployedAt,
2306
+ lastDeployedBy: automation.lastDeployedBy
2307
+ }))
2308
+ );
2309
+ } catch (error) {
2310
+ exitOnCliError(error);
2311
+ }
2312
+ }
2313
+ };
2314
+
2315
+ // src/commands/automation/index.ts
2316
+ var AutomationCommand = {
2317
+ command: "automation <command>",
2318
+ aliases: ["automations"],
2319
+ describe: "Commands for managing Uniform Automations",
2320
+ builder: (yargs44) => yargs44.command(AutomationDeployModule).command(AutomationDeleteModule).command(AutomationListModule).demandCommand(),
2321
+ handler: () => {
2322
+ yargs4.showHelp();
2323
+ }
2324
+ };
2325
+
2166
2326
  // src/commands/canvas/index.ts
2167
- import yargs20 from "yargs";
2327
+ import yargs22 from "yargs";
2168
2328
 
2169
2329
  // src/commands/canvas/commands/asset.ts
2170
- import yargs4 from "yargs";
2330
+ import yargs5 from "yargs";
2171
2331
 
2172
2332
  // src/commands/canvas/commands/asset/_util.ts
2173
2333
  import { UncachedAssetClient } from "@uniformdev/assets";
@@ -2196,12 +2356,12 @@ function getFileClient(options) {
2196
2356
  var AssetGetModule = {
2197
2357
  command: "get <id>",
2198
2358
  describe: "Get an asset",
2199
- builder: (yargs42) => withConfiguration(
2359
+ builder: (yargs44) => withConfiguration(
2200
2360
  withDebugOptions(
2201
2361
  withFormatOptions(
2202
2362
  withApiOptions(
2203
2363
  withProjectOptions(
2204
- yargs42.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
2364
+ yargs44.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
2205
2365
  )
2206
2366
  )
2207
2367
  )
@@ -2222,7 +2382,7 @@ var AssetGetModule = {
2222
2382
  var AssetListModule = {
2223
2383
  command: "list",
2224
2384
  describe: "List assets",
2225
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
2385
+ builder: (yargs44) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs44))))),
2226
2386
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
2227
2387
  const fetch2 = nodeFetchProxy(proxy, verbose);
2228
2388
  const client = getAssetClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -2233,10 +2393,10 @@ var AssetListModule = {
2233
2393
 
2234
2394
  // src/files/deleteDownloadedFileByUrl.ts
2235
2395
  import fsj from "fs-jetpack";
2236
- import { join as join7 } from "path";
2396
+ import { join as join8 } from "path";
2237
2397
 
2238
2398
  // src/files/urlToFileName.ts
2239
- import { join as join6 } from "path";
2399
+ import { join as join7 } from "path";
2240
2400
  import { dirname } from "path";
2241
2401
  var FILES_DIRECTORY_NAME = "files";
2242
2402
  var getFilesDirectory = (directory) => {
@@ -2245,7 +2405,7 @@ var getFilesDirectory = (directory) => {
2245
2405
  // If we are syncing to a directory, we want to write all files into a
2246
2406
  // top-lvl folder. That way any entities that contain files will sync to the
2247
2407
  // same directory, so there is no duplication
2248
- join6(directory, "..")
2408
+ join7(directory, "..")
2249
2409
  );
2250
2410
  };
2251
2411
  var urlToHash = (url) => {
@@ -2281,7 +2441,7 @@ var hashToPartialPathname = (hash) => {
2281
2441
  var deleteDownloadedFileByUrl = async (url, options) => {
2282
2442
  const writeDirectory = getFilesDirectory(options.directory);
2283
2443
  const fileName = urlToFileName(url);
2284
- const fileToDelete = join7(writeDirectory, FILES_DIRECTORY_NAME, fileName);
2444
+ const fileToDelete = join8(writeDirectory, FILES_DIRECTORY_NAME, fileName);
2285
2445
  try {
2286
2446
  await fsj.removeAsync(fileToDelete);
2287
2447
  } catch {
@@ -2301,11 +2461,11 @@ import {
2301
2461
  import { isRichTextNodeType, isRichTextValue, walkRichTextTree } from "@uniformdev/richtext";
2302
2462
  import fsj4 from "fs-jetpack";
2303
2463
  import PQueue2 from "p-queue";
2304
- import { join as join10 } from "path";
2464
+ import { join as join11 } from "path";
2305
2465
 
2306
2466
  // src/files/downloadFile.ts
2307
2467
  import fsj2 from "fs-jetpack";
2308
- import { join as join8 } from "path";
2468
+ import { join as join9 } from "path";
2309
2469
  var downloadFile = async ({
2310
2470
  fileClient,
2311
2471
  fileUrl,
@@ -2313,7 +2473,7 @@ var downloadFile = async ({
2313
2473
  }) => {
2314
2474
  const writeDirectory = getFilesDirectory(directory);
2315
2475
  const fileName = urlToFileName(fileUrl.toString());
2316
- const fileAlreadyExists = await fsj2.existsAsync(join8(writeDirectory, FILES_DIRECTORY_NAME, fileName));
2476
+ const fileAlreadyExists = await fsj2.existsAsync(join9(writeDirectory, FILES_DIRECTORY_NAME, fileName));
2317
2477
  if (fileAlreadyExists) {
2318
2478
  return { url: fileUrl };
2319
2479
  }
@@ -2324,7 +2484,7 @@ var downloadFile = async ({
2324
2484
  }
2325
2485
  if (file.sourceId) {
2326
2486
  try {
2327
- const hashAlreadyExists = await fsj2.findAsync(join8(writeDirectory, FILES_DIRECTORY_NAME), {
2487
+ const hashAlreadyExists = await fsj2.findAsync(join9(writeDirectory, FILES_DIRECTORY_NAME), {
2328
2488
  matching: [file.sourceId, `${file.sourceId}.*`]
2329
2489
  });
2330
2490
  if (hashAlreadyExists.length > 0) {
@@ -2339,19 +2499,20 @@ var downloadFile = async ({
2339
2499
  return null;
2340
2500
  }
2341
2501
  const fileBuffer = await response.arrayBuffer();
2342
- await fsj2.writeAsync(join8(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
2502
+ await fsj2.writeAsync(join9(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
2343
2503
  return { id: file.id, url: fileUrl };
2344
2504
  };
2345
2505
 
2346
2506
  // src/files/uploadFile.ts
2347
2507
  import { preferredType } from "@thi.ng/mime";
2348
2508
  import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
2349
- import { fileTypeFromBuffer } from "file-type";
2509
+ import { fileTypeFromFile } from "file-type";
2510
+ import { createReadStream } from "fs";
2350
2511
  import fsj3 from "fs-jetpack";
2351
- import sizeOf from "image-size";
2512
+ import { imageSizeFromFile } from "image-size/fromFile";
2352
2513
  import normalizeNewline from "normalize-newline";
2353
2514
  import PQueue from "p-queue";
2354
- import { join as join9 } from "path";
2515
+ import { join as join10 } from "path";
2355
2516
  var uploadQueueByKey = /* @__PURE__ */ new Map();
2356
2517
  var fileUploadQueue = new PQueue({ concurrency: 10 });
2357
2518
  var uploadFile = async ({
@@ -2378,34 +2539,40 @@ var uploadFile = async ({
2378
2539
  return { id: file.id, url: file.url };
2379
2540
  }
2380
2541
  const localFileName = urlToFileName(fileUrl);
2381
- const expectedFilePath = join9(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
2382
- const fileExistsLocally = await fsj3.existsAsync(expectedFilePath);
2383
- if (!fileExistsLocally) {
2542
+ const expectedFilePath = join10(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
2543
+ const fileInspect = await fsj3.inspectAsync(expectedFilePath);
2544
+ if (fileInspect?.type !== "file") {
2384
2545
  console.warn(
2385
2546
  `Skipping file ${fileUrl} as we couldn't find a local copy (looked at ${expectedFilePath})`
2386
2547
  );
2387
2548
  return null;
2388
2549
  }
2389
- let fileBuffer = await fsj3.readAsync(expectedFilePath, "buffer");
2390
- if (!fileBuffer) {
2391
- console.warn(`Skipping file ${fileUrl} (${expectedFilePath}) as we couldn't read it`);
2392
- return null;
2393
- }
2394
2550
  const fileName = getFileNameFromUrl(fileUrl);
2395
- let mimeType = expectedFilePath.endsWith(".svg") ? "image/svg+xml" : (await fileTypeFromBuffer(fileBuffer))?.mime;
2551
+ let mimeType = expectedFilePath.endsWith(".svg") ? "image/svg+xml" : (await fileTypeFromFile(expectedFilePath))?.mime;
2396
2552
  if (!mimeType) {
2397
2553
  mimeType = preferredType(fileUrl.split(".").at(-1) ?? "");
2398
2554
  }
2399
2555
  if (mimeType === "audio/x-flac") {
2400
2556
  mimeType = "audio/flac";
2401
2557
  }
2558
+ let uploadBody;
2559
+ let uploadSize = fileInspect.size;
2402
2560
  if (mimeType === "image/svg+xml") {
2561
+ const fileBuffer = await fsj3.readAsync(expectedFilePath, "buffer");
2562
+ if (!fileBuffer) {
2563
+ console.warn(`Skipping file ${fileUrl} (${expectedFilePath}) as we couldn't read it`);
2564
+ return null;
2565
+ }
2566
+ uploadBody = fileBuffer;
2403
2567
  try {
2404
- fileBuffer = normalizeNewline(fileBuffer);
2568
+ uploadBody = normalizeNewline(fileBuffer);
2405
2569
  } catch {
2406
2570
  }
2571
+ uploadSize = uploadBody.length;
2572
+ } else {
2573
+ uploadBody = createReadStream(expectedFilePath);
2407
2574
  }
2408
- const { width, height } = (() => {
2575
+ const { width, height } = await (async () => {
2409
2576
  if (!mimeType.startsWith("image/")) {
2410
2577
  return {
2411
2578
  width: void 0,
@@ -2413,7 +2580,7 @@ var uploadFile = async ({
2413
2580
  };
2414
2581
  }
2415
2582
  try {
2416
- return sizeOf(fileBuffer);
2583
+ return await imageSizeFromFile(expectedFilePath);
2417
2584
  } catch {
2418
2585
  return {
2419
2586
  width: void 0,
@@ -2425,19 +2592,21 @@ var uploadFile = async ({
2425
2592
  id: fileId,
2426
2593
  name: fileName,
2427
2594
  mediaType: mimeType,
2428
- size: fileBuffer.length,
2595
+ size: uploadSize,
2429
2596
  width,
2430
2597
  height,
2431
2598
  sourceId: hash
2432
2599
  });
2433
- const uploadResponse = await fetch(uploadUrl, {
2600
+ const uploadRequest = {
2434
2601
  method,
2435
- body: fileBuffer,
2602
+ body: uploadBody,
2603
+ duplex: "half",
2436
2604
  headers: {
2437
2605
  "Content-Type": mimeType,
2438
- "Content-Length": fileBuffer.length.toString()
2606
+ "Content-Length": uploadSize.toString()
2439
2607
  }
2440
- });
2608
+ };
2609
+ const uploadResponse = await fetch(uploadUrl, uploadRequest);
2441
2610
  if (!uploadResponse.ok) {
2442
2611
  console.warn(`Failed to upload file ${fileUrl} (${expectedFilePath})`);
2443
2612
  return null;
@@ -2449,7 +2618,7 @@ var uploadFile = async ({
2449
2618
  }
2450
2619
  const file2 = await fileClient.get({ id });
2451
2620
  if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
2452
- await new Promise((resolve2) => setTimeout(resolve2, 1e3));
2621
+ await new Promise((resolve4) => setTimeout(resolve4, 1e3));
2453
2622
  return checkForFile();
2454
2623
  }
2455
2624
  return file2.url;
@@ -2476,7 +2645,7 @@ import {
2476
2645
  walkNodeTree,
2477
2646
  walkPropertyValues
2478
2647
  } from "@uniformdev/canvas";
2479
- var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2648
+ var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu([1-9]\d*)?\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
2480
2649
  var walkFileUrlsForCompositionOrEntry = ({
2481
2650
  entity,
2482
2651
  callback
@@ -2525,6 +2694,9 @@ var walkFileUrlsForCompositionOrEntry = ({
2525
2694
  };
2526
2695
 
2527
2696
  // src/files/files.ts
2697
+ var fileDownloadQueue = new PQueue2({ concurrency: 10 });
2698
+ var fileUploadQueue2 = new PQueue2({ concurrency: 10 });
2699
+ var fileUrlReplacementQueue = new PQueue2({ concurrency: 10 });
2528
2700
  var downloadFileForAsset = async ({
2529
2701
  asset,
2530
2702
  directory,
@@ -2638,7 +2810,6 @@ var downloadFilesForCompositionOrEntry = async ({
2638
2810
  directory,
2639
2811
  fileClient
2640
2812
  }) => {
2641
- const fileDownloadQueue = new PQueue2({ concurrency: 10 });
2642
2813
  await walkFileUrlsForCompositionOrEntry({
2643
2814
  entity,
2644
2815
  callback: ({ fileUrl }) => {
@@ -2654,7 +2825,6 @@ var uploadFilesForCompositionOrEntry = async ({
2654
2825
  directory,
2655
2826
  fileClient
2656
2827
  }) => {
2657
- const fileUploadQueue2 = new PQueue2({ concurrency: 10 });
2658
2828
  const urlReplacementMap = /* @__PURE__ */ new Map();
2659
2829
  walkFileUrlsForCompositionOrEntry({
2660
2830
  entity: entity.object,
@@ -2687,7 +2857,6 @@ var replaceRemoteUrlsWithLocalReferences = async ({
2687
2857
  let sourceEntityAsString = JSON.stringify(sourceEntity);
2688
2858
  const targetEntityAsString = JSON.stringify(targetEntity);
2689
2859
  const writeDirectory = getFilesDirectory(directory);
2690
- const fileUrlReplacementQueue = new PQueue2({ concurrency: 10 });
2691
2860
  walkFileUrlsForCompositionOrEntry({
2692
2861
  entity: sourceEntity.object,
2693
2862
  callback: ({ fileUrl }) => {
@@ -2695,7 +2864,7 @@ var replaceRemoteUrlsWithLocalReferences = async ({
2695
2864
  try {
2696
2865
  const localFileName = urlToFileName(fileUrl);
2697
2866
  const fileExistsLocally = await fsj4.existsAsync(
2698
- join10(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
2867
+ join11(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
2699
2868
  );
2700
2869
  if (fileExistsLocally) {
2701
2870
  return;
@@ -2727,23 +2896,17 @@ var replaceLocalUrlsWithRemoteReferences = async ({
2727
2896
  fileClient
2728
2897
  }) => {
2729
2898
  let entityAsString = JSON.stringify(entity);
2730
- const fileUrlReplacementQueue = new PQueue2({ concurrency: 10 });
2731
2899
  walkFileUrlsForCompositionOrEntry({
2732
2900
  entity: entity.object,
2733
2901
  callback: ({ fileUrl }) => {
2734
2902
  fileUrlReplacementQueue.add(async () => {
2735
2903
  try {
2736
2904
  const hash = urlToHash(fileUrl);
2737
- fileUrlReplacementQueue.add(async () => {
2738
- try {
2739
- const file = await fileClient.get({ sourceId: hash }).catch(() => null);
2740
- if (!file) {
2741
- return;
2742
- }
2743
- entityAsString = entityAsString.replaceAll(`"${fileUrl}"`, `"${file.url}"`);
2744
- } catch {
2745
- }
2746
- });
2905
+ const file = await fileClient.get({ sourceId: hash }).catch(() => null);
2906
+ if (!file) {
2907
+ return;
2908
+ }
2909
+ entityAsString = entityAsString.replaceAll(`"${fileUrl}"`, `"${file.url}"`);
2747
2910
  } catch {
2748
2911
  }
2749
2912
  });
@@ -2759,7 +2922,7 @@ var escapeRegExp = (string4) => {
2759
2922
  var findUrlMatchingPartialPathname = (source, pathname) => {
2760
2923
  const escapedPathname = escapeRegExp(pathname);
2761
2924
  const regex = new RegExp(
2762
- `"(https://([^"]*?)?(img|files).uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2925
+ `"(https://([^"]*?)?(img|files).(eu([1-9]\\d*)?\\.)?uniform.(rocks|global)${escapedPathname}([^"]*?))"`
2763
2926
  );
2764
2927
  const match = source.match(regex);
2765
2928
  if (match && match[1]) {
@@ -2784,8 +2947,8 @@ function prepCompositionForDisk(composition) {
2784
2947
  delete prepped.state;
2785
2948
  return prepped;
2786
2949
  }
2787
- function withStateOptions(yargs42, defaultState = "preview") {
2788
- return yargs42.option("state", {
2950
+ function withStateOptions(yargs44, defaultState = "preview") {
2951
+ return yargs44.option("state", {
2789
2952
  type: "string",
2790
2953
  describe: `State to fetch.`,
2791
2954
  choices: ["preview", "published"],
@@ -2867,12 +3030,12 @@ function writeCanvasPackage(filename, packageContents) {
2867
3030
  var AssetPullModule = {
2868
3031
  command: "pull <directory>",
2869
3032
  describe: "Pulls all assets to local files in a directory",
2870
- builder: (yargs42) => withConfiguration(
3033
+ builder: (yargs44) => withConfiguration(
2871
3034
  withApiOptions(
2872
3035
  withDebugOptions(
2873
3036
  withProjectOptions(
2874
3037
  withDiffOptions(
2875
- yargs42.positional("directory", {
3038
+ yargs44.positional("directory", {
2876
3039
  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
3040
  type: "string"
2878
3041
  }).option("format", {
@@ -2984,12 +3147,12 @@ var AssetPullModule = {
2984
3147
  var AssetPushModule = {
2985
3148
  command: "push <directory>",
2986
3149
  describe: "Pushes all assets from files in a directory to Uniform",
2987
- builder: (yargs42) => withConfiguration(
3150
+ builder: (yargs44) => withConfiguration(
2988
3151
  withApiOptions(
2989
3152
  withDebugOptions(
2990
3153
  withProjectOptions(
2991
3154
  withDiffOptions(
2992
- yargs42.positional("directory", {
3155
+ yargs44.positional("directory", {
2993
3156
  describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
2994
3157
  type: "string"
2995
3158
  }).option("mode", {
@@ -3113,10 +3276,10 @@ var AssetRemoveModule = {
3113
3276
  command: "remove <id>",
3114
3277
  aliases: ["delete", "rm"],
3115
3278
  describe: "Delete an asset",
3116
- builder: (yargs42) => withConfiguration(
3279
+ builder: (yargs44) => withConfiguration(
3117
3280
  withDebugOptions(
3118
3281
  withApiOptions(
3119
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
3282
+ withProjectOptions(yargs44.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
3120
3283
  )
3121
3284
  )
3122
3285
  ),
@@ -3137,11 +3300,11 @@ var AssetUpdateModule = {
3137
3300
  command: "update <filename>",
3138
3301
  aliases: ["put"],
3139
3302
  describe: "Insert or update an asset",
3140
- builder: (yargs42) => withConfiguration(
3303
+ builder: (yargs44) => withConfiguration(
3141
3304
  withDebugOptions(
3142
3305
  withApiOptions(
3143
3306
  withProjectOptions(
3144
- yargs42.positional("filename", { demandOption: true, describe: "Asset file to put" })
3307
+ yargs44.positional("filename", { demandOption: true, describe: "Asset file to put" })
3145
3308
  )
3146
3309
  )
3147
3310
  )
@@ -3167,14 +3330,14 @@ var AssetUpdateModule = {
3167
3330
  var AssetModule = {
3168
3331
  command: "asset <command>",
3169
3332
  describe: "Commands for Assets",
3170
- builder: (yargs42) => yargs42.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
3333
+ builder: (yargs44) => yargs44.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
3171
3334
  handler: () => {
3172
- yargs4.help();
3335
+ yargs5.help();
3173
3336
  }
3174
3337
  };
3175
3338
 
3176
3339
  // src/commands/canvas/commands/category.ts
3177
- import yargs5 from "yargs";
3340
+ import yargs6 from "yargs";
3178
3341
 
3179
3342
  // src/commands/canvas/commands/category/_util.ts
3180
3343
  import { UncachedCategoryClient } from "@uniformdev/canvas";
@@ -3188,12 +3351,12 @@ function getCategoryClient(options) {
3188
3351
  var CategoryGetModule = {
3189
3352
  command: "get <id>",
3190
3353
  describe: "Fetch a category",
3191
- builder: (yargs42) => withConfiguration(
3354
+ builder: (yargs44) => withConfiguration(
3192
3355
  withFormatOptions(
3193
3356
  withDebugOptions(
3194
3357
  withApiOptions(
3195
3358
  withProjectOptions(
3196
- yargs42.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
3359
+ yargs44.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
3197
3360
  )
3198
3361
  )
3199
3362
  )
@@ -3218,8 +3381,8 @@ var CategoryListModule = {
3218
3381
  command: "list",
3219
3382
  describe: "List categories",
3220
3383
  aliases: ["ls"],
3221
- builder: (yargs42) => withConfiguration(
3222
- withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs42.options({})))))
3384
+ builder: (yargs44) => withConfiguration(
3385
+ withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs44.options({})))))
3223
3386
  ),
3224
3387
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
3225
3388
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -3263,12 +3426,12 @@ function createCategoriesEngineDataSource({
3263
3426
  var CategoryPullModule = {
3264
3427
  command: "pull <directory>",
3265
3428
  describe: "Pulls all categories to local files in a directory",
3266
- builder: (yargs42) => withConfiguration(
3429
+ builder: (yargs44) => withConfiguration(
3267
3430
  withApiOptions(
3268
3431
  withProjectOptions(
3269
3432
  withDiffOptions(
3270
3433
  withDebugOptions(
3271
- yargs42.positional("directory", {
3434
+ yargs44.positional("directory", {
3272
3435
  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
3436
  type: "string"
3274
3437
  }).option("format", {
@@ -3343,12 +3506,12 @@ var CategoryPullModule = {
3343
3506
  var CategoryPushModule = {
3344
3507
  command: "push <directory>",
3345
3508
  describe: "Pushes all categories from files in a directory to Uniform Canvas",
3346
- builder: (yargs42) => withConfiguration(
3509
+ builder: (yargs44) => withConfiguration(
3347
3510
  withApiOptions(
3348
3511
  withDebugOptions(
3349
3512
  withProjectOptions(
3350
3513
  withDiffOptions(
3351
- yargs42.positional("directory", {
3514
+ yargs44.positional("directory", {
3352
3515
  describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
3353
3516
  type: "string"
3354
3517
  }).option("mode", {
@@ -3412,11 +3575,11 @@ var CategoryRemoveModule = {
3412
3575
  command: "remove <id>",
3413
3576
  aliases: ["delete", "rm"],
3414
3577
  describe: "Delete a category",
3415
- builder: (yargs42) => withConfiguration(
3578
+ builder: (yargs44) => withConfiguration(
3416
3579
  withApiOptions(
3417
3580
  withDebugOptions(
3418
3581
  withProjectOptions(
3419
- yargs42.positional("id", { demandOption: true, describe: "Category UUID to delete" })
3582
+ yargs44.positional("id", { demandOption: true, describe: "Category UUID to delete" })
3420
3583
  )
3421
3584
  )
3422
3585
  )
@@ -3437,11 +3600,11 @@ var CategoryUpdateModule = {
3437
3600
  command: "update <filename>",
3438
3601
  aliases: ["put"],
3439
3602
  describe: "Insert or update a category",
3440
- builder: (yargs42) => withConfiguration(
3603
+ builder: (yargs44) => withConfiguration(
3441
3604
  withApiOptions(
3442
3605
  withDebugOptions(
3443
3606
  withProjectOptions(
3444
- yargs42.positional("filename", { demandOption: true, describe: "Category file to put" })
3607
+ yargs44.positional("filename", { demandOption: true, describe: "Category file to put" })
3445
3608
  )
3446
3609
  )
3447
3610
  )
@@ -3463,14 +3626,14 @@ var CategoryModule = {
3463
3626
  command: "category <command>",
3464
3627
  aliases: ["cat"],
3465
3628
  describe: "Commands for Canvas categories",
3466
- builder: (yargs42) => yargs42.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
3629
+ builder: (yargs44) => yargs44.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
3467
3630
  handler: () => {
3468
- yargs5.help();
3631
+ yargs6.help();
3469
3632
  }
3470
3633
  };
3471
3634
 
3472
3635
  // src/commands/canvas/commands/component.ts
3473
- import yargs6 from "yargs";
3636
+ import yargs7 from "yargs";
3474
3637
 
3475
3638
  // src/commands/canvas/commands/component/_util.ts
3476
3639
  import { UncachedCanvasClient } from "@uniformdev/canvas";
@@ -3485,12 +3648,12 @@ function getCanvasClient(options) {
3485
3648
  var ComponentGetModule = {
3486
3649
  command: "get <id>",
3487
3650
  describe: "Fetch a component definition",
3488
- builder: (yargs42) => withConfiguration(
3651
+ builder: (yargs44) => withConfiguration(
3489
3652
  withFormatOptions(
3490
3653
  withDebugOptions(
3491
3654
  withApiOptions(
3492
3655
  withProjectOptions(
3493
- yargs42.positional("id", {
3656
+ yargs44.positional("id", {
3494
3657
  demandOption: true,
3495
3658
  describe: "Component definition public ID to fetch"
3496
3659
  })
@@ -3524,12 +3687,12 @@ var ComponentListModule = {
3524
3687
  command: "list",
3525
3688
  describe: "List component definitions",
3526
3689
  aliases: ["ls"],
3527
- builder: (yargs42) => withConfiguration(
3690
+ builder: (yargs44) => withConfiguration(
3528
3691
  withFormatOptions(
3529
3692
  withDebugOptions(
3530
3693
  withApiOptions(
3531
3694
  withProjectOptions(
3532
- yargs42.options({
3695
+ yargs44.options({
3533
3696
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3534
3697
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
3535
3698
  })
@@ -3598,12 +3761,12 @@ function createComponentDefinitionEngineDataSource({
3598
3761
  var ComponentPullModule = {
3599
3762
  command: "pull <directory>",
3600
3763
  describe: "Pulls all component definitions to local files in a directory",
3601
- builder: (yargs42) => withConfiguration(
3764
+ builder: (yargs44) => withConfiguration(
3602
3765
  withApiOptions(
3603
3766
  withDebugOptions(
3604
3767
  withProjectOptions(
3605
3768
  withDiffOptions(
3606
- yargs42.positional("directory", {
3769
+ yargs44.positional("directory", {
3607
3770
  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
3771
  type: "string"
3609
3772
  }).option("format", {
@@ -3679,12 +3842,12 @@ var ComponentPullModule = {
3679
3842
  var ComponentPushModule = {
3680
3843
  command: "push <directory>",
3681
3844
  describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
3682
- builder: (yargs42) => withConfiguration(
3845
+ builder: (yargs44) => withConfiguration(
3683
3846
  withApiOptions(
3684
3847
  withDebugOptions(
3685
3848
  withProjectOptions(
3686
3849
  withDiffOptions(
3687
- yargs42.positional("directory", {
3850
+ yargs44.positional("directory", {
3688
3851
  describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
3689
3852
  type: "string"
3690
3853
  }).option("mode", {
@@ -3749,11 +3912,11 @@ var ComponentRemoveModule = {
3749
3912
  command: "remove <id>",
3750
3913
  aliases: ["delete", "rm"],
3751
3914
  describe: "Delete a component definition",
3752
- builder: (yargs42) => withConfiguration(
3915
+ builder: (yargs44) => withConfiguration(
3753
3916
  withDebugOptions(
3754
3917
  withApiOptions(
3755
3918
  withProjectOptions(
3756
- yargs42.positional("id", {
3919
+ yargs44.positional("id", {
3757
3920
  demandOption: true,
3758
3921
  describe: "Component definition public ID to delete"
3759
3922
  })
@@ -3777,11 +3940,11 @@ var ComponentUpdateModule = {
3777
3940
  command: "update <filename>",
3778
3941
  aliases: ["put"],
3779
3942
  describe: "Insert or update a component definition",
3780
- builder: (yargs42) => withConfiguration(
3943
+ builder: (yargs44) => withConfiguration(
3781
3944
  withApiOptions(
3782
3945
  withDebugOptions(
3783
3946
  withProjectOptions(
3784
- yargs42.positional("filename", { demandOption: true, describe: "Component definition file to put" })
3947
+ yargs44.positional("filename", { demandOption: true, describe: "Component definition file to put" })
3785
3948
  )
3786
3949
  )
3787
3950
  )
@@ -3803,28 +3966,177 @@ var ComponentModule = {
3803
3966
  command: "component <command>",
3804
3967
  aliases: ["def"],
3805
3968
  describe: "Commands for Canvas component definitions",
3806
- builder: (yargs42) => yargs42.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
3969
+ builder: (yargs44) => yargs44.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
3807
3970
  handler: () => {
3808
- yargs6.help();
3971
+ yargs7.help();
3809
3972
  }
3810
3973
  };
3811
3974
 
3812
3975
  // src/commands/canvas/commands/componentPattern.ts
3813
- import yargs7 from "yargs";
3976
+ import yargs8 from "yargs";
3977
+
3978
+ // src/commands/canvas/util/entityTypeValidation.ts
3979
+ import { CANVAS_DRAFT_STATE as CANVAS_DRAFT_STATE2 } from "@uniformdev/canvas";
3980
+ function getCompositionActualType(composition) {
3981
+ return composition.pattern ? composition.patternType === "component" ? "component-pattern" : "composition-pattern" : "composition";
3982
+ }
3983
+ function getEntryActualType(entry) {
3984
+ return entry.pattern ? "entry-pattern" : "entry";
3985
+ }
3986
+ async function validateCompositionType(client, id, expectedType) {
3987
+ try {
3988
+ const composition = await client.getCompositionById({
3989
+ compositionId: id,
3990
+ skipDataResolution: true,
3991
+ state: CANVAS_DRAFT_STATE2,
3992
+ withPatternType: true
3993
+ });
3994
+ const actualType = getCompositionActualType(composition);
3995
+ return {
3996
+ actualType,
3997
+ isValid: actualType === expectedType,
3998
+ exists: true
3999
+ };
4000
+ } catch (error) {
4001
+ if (error && typeof error === "object" && "statusCode" in error && error.statusCode === 404) {
4002
+ return {
4003
+ actualType: expectedType,
4004
+ isValid: false,
4005
+ exists: false
4006
+ };
4007
+ }
4008
+ throw error;
4009
+ }
4010
+ }
4011
+ async function validateEntryType(client, id, expectedType) {
4012
+ const res = await client.getEntries({
4013
+ offset: 0,
4014
+ limit: 1,
4015
+ entryIDs: [id],
4016
+ skipDataResolution: true,
4017
+ state: CANVAS_DRAFT_STATE2,
4018
+ pattern: expectedType === "entry-pattern" ? true : void 0
4019
+ });
4020
+ if (res.entries.length !== 1) {
4021
+ return {
4022
+ actualType: expectedType,
4023
+ isValid: false,
4024
+ exists: false
4025
+ };
4026
+ }
4027
+ const entry = res.entries[0];
4028
+ const actualType = getEntryActualType(entry);
4029
+ return {
4030
+ actualType,
4031
+ isValid: actualType === expectedType,
4032
+ exists: true
4033
+ };
4034
+ }
4035
+ function getCompositionDisplayNameWithArticle(type) {
4036
+ switch (type) {
4037
+ case "composition":
4038
+ return "a composition";
4039
+ case "composition-pattern":
4040
+ return "a composition pattern";
4041
+ case "component-pattern":
4042
+ return "a component pattern";
4043
+ }
4044
+ }
4045
+ function getEntryDisplayNameWithArticle(type) {
4046
+ return type === "entry" ? "an entry" : "an entry pattern";
4047
+ }
4048
+ function getCompositionDisplayName(type) {
4049
+ switch (type) {
4050
+ case "composition":
4051
+ return "Composition";
4052
+ case "composition-pattern":
4053
+ return "Composition Pattern";
4054
+ case "component-pattern":
4055
+ return "Component Pattern";
4056
+ }
4057
+ }
4058
+ function getEntryDisplayName(type) {
4059
+ return type === "entry" ? "Entry" : "Entry Pattern";
4060
+ }
4061
+ function getCommandVerb(action) {
4062
+ return action === "delete" ? "remove" : action;
4063
+ }
4064
+ function formatCompositionTypeError(id, actualType, expectedType, action) {
4065
+ const actualDisplayName = getCompositionDisplayNameWithArticle(actualType);
4066
+ const expectedDisplayName = getCompositionDisplayNameWithArticle(expectedType);
4067
+ return `Error: The provided ID belongs to ${actualDisplayName}, not ${expectedDisplayName}.
4068
+ To ${action} ${actualDisplayName}, use: uniform canvas ${actualType} ${getCommandVerb(action)} ${id}`;
4069
+ }
4070
+ function formatEntryTypeError(id, actualType, expectedType, action) {
4071
+ const actualDisplayName = getEntryDisplayNameWithArticle(actualType);
4072
+ const expectedDisplayName = getEntryDisplayNameWithArticle(expectedType);
4073
+ return `Error: The provided ID belongs to ${actualDisplayName}, not ${expectedDisplayName}.
4074
+ To ${action} ${actualDisplayName}, use: uniform canvas ${actualType} ${getCommandVerb(action)} ${id}`;
4075
+ }
3814
4076
 
3815
4077
  // src/commands/canvas/commands/composition/get.ts
4078
+ function createCompositionGetHandler(expectedType) {
4079
+ return async ({
4080
+ apiHost,
4081
+ edgeApiHost,
4082
+ apiKey,
4083
+ proxy,
4084
+ id,
4085
+ format,
4086
+ filename,
4087
+ state,
4088
+ project: projectId,
4089
+ resolvePatterns,
4090
+ resolveOverrides,
4091
+ componentIDs,
4092
+ resolveData,
4093
+ diagnostics,
4094
+ resolutionDepth,
4095
+ verbose
4096
+ }) => {
4097
+ const parameters = {
4098
+ compositionId: id,
4099
+ state: convertStateOption(state),
4100
+ skipPatternResolution: !resolvePatterns,
4101
+ skipOverridesResolution: !resolveOverrides,
4102
+ withComponentIDs: componentIDs,
4103
+ skipDataResolution: !resolveData,
4104
+ diagnostics: resolveData ? diagnostics : void 0,
4105
+ resolutionDepth: resolveData ? resolutionDepth : void 0,
4106
+ withPatternType: true
4107
+ };
4108
+ if (verbose) {
4109
+ console.log(`\u{1F41B} get ${expectedType}:`, parameters);
4110
+ }
4111
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4112
+ const client = getCanvasClient({ apiKey, edgeApiHost, apiHost, fetch: fetch2, projectId });
4113
+ const composition = await client.getCompositionById(parameters);
4114
+ const actualType = getCompositionActualType(composition);
4115
+ if (actualType !== expectedType) {
4116
+ console.error(formatCompositionTypeError(id, actualType, expectedType, "get"));
4117
+ process.exit(1);
4118
+ }
4119
+ const {
4120
+ // We fetch pattern type for type validation, but historically we did not include it in the payload so excluding for now
4121
+ patternType,
4122
+ ...rest
4123
+ } = composition;
4124
+ const res = prepCompositionForDisk(rest);
4125
+ emitWithFormat(res, format, filename);
4126
+ };
4127
+ }
3816
4128
  var CompositionGetModule = {
3817
4129
  command: "get <id>",
3818
4130
  describe: "Fetch a composition",
3819
- builder: (yargs42) => withFormatOptions(
4131
+ builder: (yargs44) => withFormatOptions(
3820
4132
  withConfiguration(
3821
4133
  withApiOptions(
3822
4134
  withProjectOptions(
3823
4135
  withStateOptions(
3824
4136
  withDebugOptions(
3825
- yargs42.positional("id", {
4137
+ yargs44.positional("id", {
3826
4138
  demandOption: true,
3827
- describe: "Composition/pattern public ID to fetch"
4139
+ describe: "Composition public ID to fetch"
3828
4140
  }).option({
3829
4141
  resolvePatterns: {
3830
4142
  type: "boolean",
@@ -3863,48 +4175,14 @@ var CompositionGetModule = {
3863
4175
  )
3864
4176
  )
3865
4177
  ),
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
- }
4178
+ handler: createCompositionGetHandler("composition")
3902
4179
  };
3903
4180
 
3904
4181
  // src/commands/canvas/commands/componentPattern/get.ts
3905
4182
  var ComponentPatternGetModule = {
3906
4183
  ...CompositionGetModule,
3907
- describe: "Fetch a component pattern"
4184
+ describe: "Fetch a component pattern",
4185
+ handler: createCompositionGetHandler("component-pattern")
3908
4186
  };
3909
4187
 
3910
4188
  // src/commands/canvas/commands/composition/list.ts
@@ -3912,13 +4190,13 @@ var CompositionListModule = {
3912
4190
  command: "list",
3913
4191
  describe: "List compositions",
3914
4192
  aliases: ["ls"],
3915
- builder: (yargs42) => withFormatOptions(
4193
+ builder: (yargs44) => withFormatOptions(
3916
4194
  withConfiguration(
3917
4195
  withApiOptions(
3918
4196
  withProjectOptions(
3919
4197
  withDebugOptions(
3920
4198
  withStateOptions(
3921
- yargs42.options({
4199
+ yargs44.options({
3922
4200
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
3923
4201
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
3924
4202
  search: { describe: "Search query", type: "string", default: "" },
@@ -3999,13 +4277,13 @@ var CompositionListModule = {
3999
4277
  var ComponentPatternListModule = {
4000
4278
  ...CompositionListModule,
4001
4279
  describe: "List component patterns",
4002
- builder: (yargs42) => withFormatOptions(
4280
+ builder: (yargs44) => withFormatOptions(
4003
4281
  withConfiguration(
4004
4282
  withApiOptions(
4005
4283
  withDebugOptions(
4006
4284
  withProjectOptions(
4007
4285
  withStateOptions(
4008
- yargs42.options({
4286
+ yargs44.options({
4009
4287
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
4010
4288
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
4011
4289
  resolvePatterns: {
@@ -4128,12 +4406,12 @@ function createComponentInstanceEngineDataSource({
4128
4406
  var CompositionPublishModule = {
4129
4407
  command: "publish [ids]",
4130
4408
  describe: "Publishes composition(s)",
4131
- builder: (yargs42) => withConfiguration(
4409
+ builder: (yargs44) => withConfiguration(
4132
4410
  withApiOptions(
4133
4411
  withProjectOptions(
4134
4412
  withDebugOptions(
4135
4413
  withDiffOptions(
4136
- yargs42.positional("ids", {
4414
+ yargs44.positional("ids", {
4137
4415
  describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4138
4416
  type: "string"
4139
4417
  }).option("all", {
@@ -4226,12 +4504,12 @@ var CompositionPublishModule = {
4226
4504
  var ComponentPatternPublishModule = {
4227
4505
  ...CompositionPublishModule,
4228
4506
  describe: "Publishes component pattern(s)",
4229
- builder: (yargs42) => withConfiguration(
4507
+ builder: (yargs44) => withConfiguration(
4230
4508
  withApiOptions(
4231
4509
  withDebugOptions(
4232
4510
  withProjectOptions(
4233
4511
  withDiffOptions(
4234
- yargs42.positional("ids", {
4512
+ yargs44.positional("ids", {
4235
4513
  describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4236
4514
  type: "string"
4237
4515
  }).option("all", {
@@ -4271,13 +4549,13 @@ function componentInstancePullModuleFactory(type) {
4271
4549
  return {
4272
4550
  command: "pull <directory>",
4273
4551
  describe: "Pulls all compositions to local files in a directory",
4274
- builder: (yargs42) => withConfiguration(
4552
+ builder: (yargs44) => withConfiguration(
4275
4553
  withApiOptions(
4276
4554
  withProjectOptions(
4277
4555
  withStateOptions(
4278
4556
  withDebugOptions(
4279
4557
  withDiffOptions(
4280
- yargs42.positional("directory", {
4558
+ yargs44.positional("directory", {
4281
4559
  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
4560
  type: "string"
4283
4561
  }).option("format", {
@@ -4392,13 +4670,13 @@ function componentInstancePullModuleFactory(type) {
4392
4670
  var ComponentPatternPullModule = {
4393
4671
  ...componentInstancePullModuleFactory("componentPatterns"),
4394
4672
  describe: "Pulls all component patterns to local files in a directory",
4395
- builder: (yargs42) => withConfiguration(
4673
+ builder: (yargs44) => withConfiguration(
4396
4674
  withApiOptions(
4397
4675
  withProjectOptions(
4398
4676
  withDebugOptions(
4399
4677
  withStateOptions(
4400
4678
  withDiffOptions(
4401
- yargs42.positional("directory", {
4679
+ yargs44.positional("directory", {
4402
4680
  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
4681
  type: "string"
4404
4682
  }).option("format", {
@@ -4472,13 +4750,13 @@ function componentInstancePushModuleFactory(type) {
4472
4750
  return {
4473
4751
  command: "push <directory>",
4474
4752
  describe: "Pushes all compositions from files in a directory to Uniform Canvas",
4475
- builder: (yargs42) => withConfiguration(
4753
+ builder: (yargs44) => withConfiguration(
4476
4754
  withApiOptions(
4477
4755
  withProjectOptions(
4478
4756
  withStateOptions(
4479
4757
  withDebugOptions(
4480
4758
  withDiffOptions(
4481
- yargs42.positional("directory", {
4759
+ yargs44.positional("directory", {
4482
4760
  describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
4483
4761
  type: "string"
4484
4762
  }).option("mode", {
@@ -4592,13 +4870,13 @@ function componentInstancePushModuleFactory(type) {
4592
4870
  var ComponentPatternPushModule = {
4593
4871
  ...componentInstancePushModuleFactory("componentPatterns"),
4594
4872
  describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
4595
- builder: (yargs42) => withConfiguration(
4873
+ builder: (yargs44) => withConfiguration(
4596
4874
  withApiOptions(
4597
4875
  withProjectOptions(
4598
4876
  withStateOptions(
4599
4877
  withDiffOptions(
4600
4878
  withDebugOptions(
4601
- yargs42.positional("directory", {
4879
+ yargs44.positional("directory", {
4602
4880
  describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
4603
4881
  type: "string"
4604
4882
  }).option("mode", {
@@ -4628,40 +4906,61 @@ var ComponentPatternPushModule = {
4628
4906
  };
4629
4907
 
4630
4908
  // src/commands/canvas/commands/composition/remove.ts
4909
+ function createCompositionRemoveHandler(expectedType) {
4910
+ return async ({
4911
+ apiHost,
4912
+ apiKey,
4913
+ proxy,
4914
+ id,
4915
+ project: projectId,
4916
+ verbose,
4917
+ whatIf
4918
+ }) => {
4919
+ if (verbose) {
4920
+ console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
4921
+ }
4922
+ const fetch2 = nodeFetchProxy(proxy, verbose);
4923
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
4924
+ const validation = await validateCompositionType(client, id, expectedType);
4925
+ if (!validation.exists) {
4926
+ console.error(`Error: ${getCompositionDisplayName(expectedType)} with ID "${id}" not found.`);
4927
+ process.exit(1);
4928
+ }
4929
+ if (!validation.isValid) {
4930
+ console.error(formatCompositionTypeError(id, validation.actualType, expectedType, "delete"));
4931
+ process.exit(1);
4932
+ }
4933
+ if (!whatIf) {
4934
+ await client.removeComposition({ compositionId: id });
4935
+ } else {
4936
+ whatIfSimpleLog({ id, displayName: getCompositionDisplayName(expectedType), action: "delete" });
4937
+ }
4938
+ };
4939
+ }
4631
4940
  var CompositionRemoveModule = {
4632
4941
  command: "remove <id>",
4633
4942
  aliases: ["delete", "rm"],
4634
4943
  describe: "Delete a composition",
4635
- builder: (yargs42) => withConfiguration(
4944
+ builder: (yargs44) => withConfiguration(
4636
4945
  withApiOptions(
4637
4946
  withDebugOptions(
4638
4947
  withProjectOptions(
4639
- yargs42.positional("id", {
4948
+ yargs44.positional("id", {
4640
4949
  demandOption: true,
4641
- describe: "Composition/pattern public ID to delete"
4950
+ describe: "Composition public ID to delete"
4642
4951
  })
4643
4952
  )
4644
4953
  )
4645
4954
  )
4646
4955
  ),
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
- }
4956
+ handler: createCompositionRemoveHandler("composition")
4659
4957
  };
4660
4958
 
4661
4959
  // src/commands/canvas/commands/componentPattern/remove.ts
4662
4960
  var ComponentPatternRemoveModule = {
4663
4961
  ...CompositionRemoveModule,
4664
- describe: "Delete a component pattern"
4962
+ describe: "Delete a component pattern",
4963
+ handler: createCompositionRemoveHandler("component-pattern")
4665
4964
  };
4666
4965
 
4667
4966
  // src/commands/canvas/commands/composition/unpublish.ts
@@ -4673,11 +4972,11 @@ import { diffJson as diffJson2 } from "diff";
4673
4972
  var CompositionUnpublishModule = {
4674
4973
  command: "unpublish [ids]",
4675
4974
  describe: "Unpublish a composition(s)",
4676
- builder: (yargs42) => withConfiguration(
4975
+ builder: (yargs44) => withConfiguration(
4677
4976
  withApiOptions(
4678
4977
  withDebugOptions(
4679
4978
  withProjectOptions(
4680
- yargs42.positional("ids", {
4979
+ yargs44.positional("ids", {
4681
4980
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4682
4981
  type: "string"
4683
4982
  }).option("all", {
@@ -4788,11 +5087,11 @@ var CompositionUnpublishModule = {
4788
5087
  var ComponentPatternUnpublishModule = {
4789
5088
  command: "unpublish [ids]",
4790
5089
  describe: "Unpublish a component pattern(s)",
4791
- builder: (yargs42) => withConfiguration(
5090
+ builder: (yargs44) => withConfiguration(
4792
5091
  withApiOptions(
4793
5092
  withDebugOptions(
4794
5093
  withProjectOptions(
4795
- yargs42.positional("ids", {
5094
+ yargs44.positional("ids", {
4796
5095
  describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
4797
5096
  type: "string"
4798
5097
  }).option("all", {
@@ -4822,16 +5121,50 @@ var ComponentPatternUnpublishModule = {
4822
5121
  };
4823
5122
 
4824
5123
  // src/commands/canvas/commands/composition/update.ts
5124
+ function createCompositionUpdateHandler(expectedType) {
5125
+ return async ({
5126
+ apiHost,
5127
+ apiKey,
5128
+ proxy,
5129
+ filename,
5130
+ project: projectId,
5131
+ state,
5132
+ verbose,
5133
+ whatIf
5134
+ }) => {
5135
+ if (verbose) {
5136
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
5137
+ }
5138
+ const fetch2 = nodeFetchProxy(proxy, verbose);
5139
+ const client = getCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
5140
+ const file = readFileToObject(filename);
5141
+ const id = file.composition._id;
5142
+ const validation = await validateCompositionType(client, id, expectedType);
5143
+ if (validation.exists && !validation.isValid) {
5144
+ console.error(formatCompositionTypeError(id, validation.actualType, expectedType, "update"));
5145
+ process.exit(1);
5146
+ }
5147
+ if (!whatIf) {
5148
+ await client.updateComposition({ ...file, state: convertStateOption(state) });
5149
+ } else {
5150
+ whatIfSimpleLog({
5151
+ id,
5152
+ displayName: `${getCompositionDisplayName(expectedType)}: ${file.composition._name}`,
5153
+ action: "update"
5154
+ });
5155
+ }
5156
+ };
5157
+ }
4825
5158
  var CompositionUpdateModule = {
4826
5159
  command: "update <filename>",
4827
5160
  aliases: ["put"],
4828
5161
  describe: "Insert or update a composition",
4829
- builder: (yargs42) => withConfiguration(
5162
+ builder: (yargs44) => withConfiguration(
4830
5163
  withApiOptions(
4831
5164
  withProjectOptions(
4832
5165
  withDebugOptions(
4833
5166
  withStateOptions(
4834
- yargs42.positional("filename", {
5167
+ yargs44.positional("filename", {
4835
5168
  demandOption: true,
4836
5169
  describe: "Composition/pattern file to put"
4837
5170
  })
@@ -4840,73 +5173,59 @@ var CompositionUpdateModule = {
4840
5173
  )
4841
5174
  )
4842
5175
  ),
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
- }
5176
+ handler: createCompositionUpdateHandler("composition")
4860
5177
  };
4861
5178
 
4862
5179
  // src/commands/canvas/commands/componentPattern/update.ts
4863
5180
  var ComponentPatternUpdateModule = {
4864
5181
  ...CompositionUpdateModule,
4865
- describe: "Insert or update a component pattern"
5182
+ describe: "Insert or update a component pattern",
5183
+ handler: createCompositionUpdateHandler("component-pattern")
4866
5184
  };
4867
5185
 
4868
5186
  // src/commands/canvas/commands/componentPattern.ts
4869
5187
  var ComponentPatternModule = {
4870
5188
  command: "component-pattern <command>",
4871
5189
  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(),
5190
+ builder: (yargs44) => yargs44.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
4873
5191
  handler: () => {
4874
- yargs7.help();
5192
+ yargs8.help();
4875
5193
  }
4876
5194
  };
4877
5195
 
4878
5196
  // src/commands/canvas/commands/composition.ts
4879
- import yargs8 from "yargs";
5197
+ import yargs9 from "yargs";
4880
5198
  var CompositionModule = {
4881
5199
  command: "composition <command>",
4882
5200
  describe: "Commands for Canvas compositions",
4883
5201
  aliases: ["comp"],
4884
- builder: (yargs42) => yargs42.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
5202
+ builder: (yargs44) => yargs44.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
4885
5203
  handler: () => {
4886
- yargs8.help();
5204
+ yargs9.help();
4887
5205
  }
4888
5206
  };
4889
5207
 
4890
5208
  // src/commands/canvas/commands/compositionPattern.ts
4891
- import yargs9 from "yargs";
5209
+ import yargs10 from "yargs";
4892
5210
 
4893
5211
  // src/commands/canvas/commands/compositionPattern/get.ts
4894
5212
  var CompositionPatternGetModule = {
4895
5213
  ...CompositionGetModule,
4896
- describe: "Fetch a composition pattern"
5214
+ describe: "Fetch a composition pattern",
5215
+ handler: createCompositionGetHandler("composition-pattern")
4897
5216
  };
4898
5217
 
4899
5218
  // src/commands/canvas/commands/compositionPattern/list.ts
4900
5219
  var CompositionPatternListModule = {
4901
5220
  ...CompositionListModule,
4902
5221
  describe: "List composition patterns",
4903
- builder: (yargs42) => withFormatOptions(
5222
+ builder: (yargs44) => withFormatOptions(
4904
5223
  withConfiguration(
4905
5224
  withApiOptions(
4906
5225
  withDebugOptions(
4907
5226
  withProjectOptions(
4908
5227
  withStateOptions(
4909
- yargs42.options({
5228
+ yargs44.options({
4910
5229
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
4911
5230
  limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
4912
5231
  resolvePatterns: {
@@ -4950,12 +5269,12 @@ var CompositionPatternListModule = {
4950
5269
  var CompositionPatternPublishModule = {
4951
5270
  ...CompositionPublishModule,
4952
5271
  describe: "Publishes composition pattern(s)",
4953
- builder: (yargs42) => withConfiguration(
5272
+ builder: (yargs44) => withConfiguration(
4954
5273
  withApiOptions(
4955
5274
  withDebugOptions(
4956
5275
  withProjectOptions(
4957
5276
  withDiffOptions(
4958
- yargs42.positional("ids", {
5277
+ yargs44.positional("ids", {
4959
5278
  describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
4960
5279
  type: "string"
4961
5280
  }).option("all", {
@@ -4994,13 +5313,13 @@ var CompositionPatternPublishModule = {
4994
5313
  var CompositionPatternPullModule = {
4995
5314
  ...componentInstancePullModuleFactory("compositionPatterns"),
4996
5315
  describe: "Pulls all composition patterns to local files in a directory",
4997
- builder: (yargs42) => withConfiguration(
5316
+ builder: (yargs44) => withConfiguration(
4998
5317
  withApiOptions(
4999
5318
  withDebugOptions(
5000
5319
  withProjectOptions(
5001
5320
  withStateOptions(
5002
5321
  withDiffOptions(
5003
- yargs42.positional("directory", {
5322
+ yargs44.positional("directory", {
5004
5323
  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
5324
  type: "string"
5006
5325
  }).option("format", {
@@ -5038,13 +5357,13 @@ var CompositionPatternPullModule = {
5038
5357
  var CompositionPatternPushModule = {
5039
5358
  ...componentInstancePushModuleFactory("compositionPatterns"),
5040
5359
  describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
5041
- builder: (yargs42) => withConfiguration(
5360
+ builder: (yargs44) => withConfiguration(
5042
5361
  withApiOptions(
5043
5362
  withDebugOptions(
5044
5363
  withProjectOptions(
5045
5364
  withStateOptions(
5046
5365
  withDiffOptions(
5047
- yargs42.positional("directory", {
5366
+ yargs44.positional("directory", {
5048
5367
  describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
5049
5368
  type: "string"
5050
5369
  }).option("mode", {
@@ -5076,18 +5395,19 @@ var CompositionPatternPushModule = {
5076
5395
  // src/commands/canvas/commands/compositionPattern/remove.ts
5077
5396
  var CompositionPatternRemoveModule = {
5078
5397
  ...CompositionRemoveModule,
5079
- describe: "Delete a composition pattern"
5398
+ describe: "Delete a composition pattern",
5399
+ handler: createCompositionRemoveHandler("composition-pattern")
5080
5400
  };
5081
5401
 
5082
5402
  // src/commands/canvas/commands/compositionPattern/unpublish.ts
5083
5403
  var CompositionPatternUnpublishModule = {
5084
5404
  command: "unpublish [ids]",
5085
5405
  describe: "Unpublish a composition pattern(s)",
5086
- builder: (yargs42) => withConfiguration(
5406
+ builder: (yargs44) => withConfiguration(
5087
5407
  withApiOptions(
5088
5408
  withDebugOptions(
5089
5409
  withProjectOptions(
5090
- yargs42.positional("ids", {
5410
+ yargs44.positional("ids", {
5091
5411
  describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
5092
5412
  type: "string"
5093
5413
  }).option("all", {
@@ -5116,21 +5436,22 @@ var CompositionPatternUnpublishModule = {
5116
5436
  // src/commands/canvas/commands/compositionPattern/update.ts
5117
5437
  var CompositionPatternUpdateModule = {
5118
5438
  ...CompositionUpdateModule,
5119
- describe: "Insert or update a composition pattern"
5439
+ describe: "Insert or update a composition pattern",
5440
+ handler: createCompositionUpdateHandler("composition-pattern")
5120
5441
  };
5121
5442
 
5122
5443
  // src/commands/canvas/commands/compositionPattern.ts
5123
5444
  var CompositionPatternModule = {
5124
5445
  command: "composition-pattern <command>",
5125
5446
  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(),
5447
+ builder: (yargs44) => yargs44.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
5127
5448
  handler: () => {
5128
- yargs9.help();
5449
+ yargs10.help();
5129
5450
  }
5130
5451
  };
5131
5452
 
5132
5453
  // src/commands/canvas/commands/contentType.ts
5133
- import yargs10 from "yargs";
5454
+ import yargs11 from "yargs";
5134
5455
 
5135
5456
  // src/commands/canvas/commands/contentType/_util.ts
5136
5457
  import { ContentClient } from "@uniformdev/canvas";
@@ -5144,12 +5465,12 @@ function getContentClient(options) {
5144
5465
  var ContentTypeGetModule = {
5145
5466
  command: "get <id>",
5146
5467
  describe: "Get a content type",
5147
- builder: (yargs42) => withConfiguration(
5468
+ builder: (yargs44) => withConfiguration(
5148
5469
  withDebugOptions(
5149
5470
  withFormatOptions(
5150
5471
  withApiOptions(
5151
5472
  withProjectOptions(
5152
- yargs42.positional("id", {
5473
+ yargs44.positional("id", {
5153
5474
  demandOption: true,
5154
5475
  describe: "Content type public ID to fetch"
5155
5476
  })
@@ -5174,7 +5495,7 @@ var ContentTypeGetModule = {
5174
5495
  var ContentTypeListModule = {
5175
5496
  command: "list",
5176
5497
  describe: "List content types",
5177
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5498
+ builder: (yargs44) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs44))))),
5178
5499
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5179
5500
  const fetch2 = nodeFetchProxy(proxy, verbose);
5180
5501
  const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5215,12 +5536,12 @@ function createContentTypeEngineDataSource({
5215
5536
  var ContentTypePullModule = {
5216
5537
  command: "pull <directory>",
5217
5538
  describe: "Pulls all content types to local files in a directory",
5218
- builder: (yargs42) => withConfiguration(
5539
+ builder: (yargs44) => withConfiguration(
5219
5540
  withApiOptions(
5220
5541
  withDebugOptions(
5221
5542
  withProjectOptions(
5222
5543
  withDiffOptions(
5223
- yargs42.positional("directory", {
5544
+ yargs44.positional("directory", {
5224
5545
  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
5546
  type: "string"
5226
5547
  }).option("format", {
@@ -5300,12 +5621,12 @@ var ContentTypePullModule = {
5300
5621
  var ContentTypePushModule = {
5301
5622
  command: "push <directory>",
5302
5623
  describe: "Pushes all content types from files in a directory to Uniform",
5303
- builder: (yargs42) => withConfiguration(
5624
+ builder: (yargs44) => withConfiguration(
5304
5625
  withApiOptions(
5305
5626
  withDebugOptions(
5306
5627
  withProjectOptions(
5307
5628
  withDiffOptions(
5308
- yargs42.positional("directory", {
5629
+ yargs44.positional("directory", {
5309
5630
  describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
5310
5631
  type: "string"
5311
5632
  }).option("what-if", {
@@ -5379,11 +5700,11 @@ var ContentTypeRemoveModule = {
5379
5700
  command: "remove <id>",
5380
5701
  aliases: ["delete", "rm"],
5381
5702
  describe: "Delete a content type",
5382
- builder: (yargs42) => withConfiguration(
5703
+ builder: (yargs44) => withConfiguration(
5383
5704
  withDebugOptions(
5384
5705
  withApiOptions(
5385
5706
  withProjectOptions(
5386
- yargs42.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5707
+ yargs44.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
5387
5708
  )
5388
5709
  )
5389
5710
  )
@@ -5404,11 +5725,11 @@ var ContentTypeUpdateModule = {
5404
5725
  command: "update <filename>",
5405
5726
  aliases: ["put"],
5406
5727
  describe: "Insert or update a content type",
5407
- builder: (yargs42) => withConfiguration(
5728
+ builder: (yargs44) => withConfiguration(
5408
5729
  withDebugOptions(
5409
5730
  withApiOptions(
5410
5731
  withProjectOptions(
5411
- yargs42.positional("filename", { demandOption: true, describe: "Content type file to put" })
5732
+ yargs44.positional("filename", { demandOption: true, describe: "Content type file to put" })
5412
5733
  )
5413
5734
  )
5414
5735
  )
@@ -5430,14 +5751,14 @@ var ContentTypeModule = {
5430
5751
  command: "contenttype <command>",
5431
5752
  aliases: ["ct"],
5432
5753
  describe: "Commands for Content Types",
5433
- builder: (yargs42) => yargs42.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5754
+ builder: (yargs44) => yargs44.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
5434
5755
  handler: () => {
5435
- yargs10.help();
5756
+ yargs11.help();
5436
5757
  }
5437
5758
  };
5438
5759
 
5439
5760
  // src/commands/canvas/commands/dataSource.ts
5440
- import yargs11 from "yargs";
5761
+ import yargs12 from "yargs";
5441
5762
 
5442
5763
  // src/commands/canvas/commands/dataSource/_util.ts
5443
5764
  import { DataSourceClient } from "@uniformdev/canvas";
@@ -5449,11 +5770,11 @@ function getDataSourceClient(options) {
5449
5770
  var DataSourceGetModule = {
5450
5771
  command: "get <id>",
5451
5772
  describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
5452
- builder: (yargs42) => withConfiguration(
5773
+ builder: (yargs44) => withConfiguration(
5453
5774
  withApiOptions(
5454
5775
  withDebugOptions(
5455
5776
  withProjectOptions(
5456
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5777
+ yargs44.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
5457
5778
  )
5458
5779
  )
5459
5780
  )
@@ -5471,11 +5792,11 @@ var DataSourceRemoveModule = {
5471
5792
  command: "remove <id>",
5472
5793
  aliases: ["delete", "rm"],
5473
5794
  describe: "Delete a data source",
5474
- builder: (yargs42) => withConfiguration(
5795
+ builder: (yargs44) => withConfiguration(
5475
5796
  withDebugOptions(
5476
5797
  withApiOptions(
5477
5798
  withProjectOptions(
5478
- yargs42.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5799
+ yargs44.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
5479
5800
  )
5480
5801
  )
5481
5802
  )
@@ -5496,11 +5817,11 @@ var DataSourceUpdateModule = {
5496
5817
  command: "update <dataSource>",
5497
5818
  aliases: ["put"],
5498
5819
  describe: "Insert or update a data source",
5499
- builder: (yargs42) => withConfiguration(
5820
+ builder: (yargs44) => withConfiguration(
5500
5821
  withApiOptions(
5501
5822
  withDebugOptions(
5502
5823
  withProjectOptions(
5503
- yargs42.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5824
+ yargs44.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
5504
5825
  describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
5505
5826
  type: "string",
5506
5827
  demandOption: true
@@ -5535,14 +5856,14 @@ var DataSourceModule = {
5535
5856
  command: "datasource <command>",
5536
5857
  aliases: ["ds"],
5537
5858
  describe: "Commands for Data Source definitions",
5538
- builder: (yargs42) => yargs42.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5859
+ builder: (yargs44) => yargs44.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
5539
5860
  handler: () => {
5540
- yargs11.help();
5861
+ yargs12.help();
5541
5862
  }
5542
5863
  };
5543
5864
 
5544
5865
  // src/commands/canvas/commands/dataType.ts
5545
- import yargs12 from "yargs";
5866
+ import yargs13 from "yargs";
5546
5867
 
5547
5868
  // src/commands/canvas/commands/dataType/_util.ts
5548
5869
  import { DataTypeClient } from "@uniformdev/canvas";
@@ -5557,12 +5878,12 @@ var DataTypeGetModule = {
5557
5878
  command: "get <id>",
5558
5879
  describe: "Get a data type",
5559
5880
  aliases: ["ls"],
5560
- builder: (yargs42) => withConfiguration(
5881
+ builder: (yargs44) => withConfiguration(
5561
5882
  withFormatOptions(
5562
5883
  withDebugOptions(
5563
5884
  withApiOptions(
5564
5885
  withProjectOptions(
5565
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5886
+ yargs44.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
5566
5887
  )
5567
5888
  )
5568
5889
  )
@@ -5585,7 +5906,7 @@ var DataTypeListModule = {
5585
5906
  command: "list",
5586
5907
  describe: "List data types",
5587
5908
  aliases: ["ls"],
5588
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
5909
+ builder: (yargs44) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs44))))),
5589
5910
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
5590
5911
  const fetch2 = nodeFetchProxy(proxy, verbose);
5591
5912
  const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -5628,12 +5949,12 @@ function createDataTypeEngineDataSource({
5628
5949
  var DataTypePullModule = {
5629
5950
  command: "pull <directory>",
5630
5951
  describe: "Pulls all data types to local files in a directory",
5631
- builder: (yargs42) => withConfiguration(
5952
+ builder: (yargs44) => withConfiguration(
5632
5953
  withApiOptions(
5633
5954
  withDebugOptions(
5634
5955
  withProjectOptions(
5635
5956
  withDiffOptions(
5636
- yargs42.positional("directory", {
5957
+ yargs44.positional("directory", {
5637
5958
  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
5959
  type: "string"
5639
5960
  }).option("format", {
@@ -5713,12 +6034,12 @@ var DataTypePullModule = {
5713
6034
  var DataTypePushModule = {
5714
6035
  command: "push <directory>",
5715
6036
  describe: "Pushes all data types from files in a directory to Uniform",
5716
- builder: (yargs42) => withConfiguration(
6037
+ builder: (yargs44) => withConfiguration(
5717
6038
  withApiOptions(
5718
6039
  withDebugOptions(
5719
6040
  withProjectOptions(
5720
6041
  withDiffOptions(
5721
- yargs42.positional("directory", {
6042
+ yargs44.positional("directory", {
5722
6043
  describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
5723
6044
  type: "string"
5724
6045
  }).option("mode", {
@@ -5787,11 +6108,11 @@ var DataTypeRemoveModule = {
5787
6108
  command: "remove <id>",
5788
6109
  aliases: ["delete", "rm"],
5789
6110
  describe: "Delete a data type",
5790
- builder: (yargs42) => withConfiguration(
6111
+ builder: (yargs44) => withConfiguration(
5791
6112
  withDebugOptions(
5792
6113
  withApiOptions(
5793
6114
  withProjectOptions(
5794
- yargs42.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
6115
+ yargs44.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
5795
6116
  )
5796
6117
  )
5797
6118
  )
@@ -5812,11 +6133,11 @@ var DataTypeUpdateModule = {
5812
6133
  command: "update <filename>",
5813
6134
  aliases: ["put"],
5814
6135
  describe: "Insert or update a data type",
5815
- builder: (yargs42) => withConfiguration(
6136
+ builder: (yargs44) => withConfiguration(
5816
6137
  withDebugOptions(
5817
6138
  withApiOptions(
5818
6139
  withProjectOptions(
5819
- yargs42.positional("filename", { demandOption: true, describe: "Data type file to put" })
6140
+ yargs44.positional("filename", { demandOption: true, describe: "Data type file to put" })
5820
6141
  )
5821
6142
  )
5822
6143
  )
@@ -5838,26 +6159,74 @@ var DataTypeModule = {
5838
6159
  command: "datatype <command>",
5839
6160
  aliases: ["dt"],
5840
6161
  describe: "Commands for Data Type definitions",
5841
- builder: (yargs42) => yargs42.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
6162
+ builder: (yargs44) => yargs44.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
5842
6163
  handler: () => {
5843
- yargs12.help();
6164
+ yargs13.help();
5844
6165
  }
5845
6166
  };
5846
6167
 
5847
6168
  // src/commands/canvas/commands/entry.ts
5848
- import yargs13 from "yargs";
6169
+ import yargs14 from "yargs";
5849
6170
 
5850
6171
  // src/commands/canvas/commands/entry/get.ts
6172
+ function createEntryGetHandler(expectedType) {
6173
+ return async ({
6174
+ apiHost,
6175
+ edgeApiHost,
6176
+ apiKey,
6177
+ proxy,
6178
+ id,
6179
+ format,
6180
+ filename,
6181
+ project: projectId,
6182
+ state,
6183
+ resolveData,
6184
+ diagnostics,
6185
+ resolutionDepth,
6186
+ withComponentIDs,
6187
+ verbose
6188
+ }) => {
6189
+ if (verbose) {
6190
+ console.log(`\u{1F41B} get ${expectedType}: (id: ${id})`);
6191
+ }
6192
+ const fetch2 = nodeFetchProxy(proxy, verbose);
6193
+ const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6194
+ const res = await client.getEntries({
6195
+ offset: 0,
6196
+ limit: 1,
6197
+ entryIDs: [id],
6198
+ state: convertStateOption(state),
6199
+ skipOverridesResolution: true,
6200
+ skipPatternResolution: true,
6201
+ skipDataResolution: !resolveData,
6202
+ diagnostics: resolveData ? diagnostics : void 0,
6203
+ resolutionDepth: resolveData ? resolutionDepth : void 0,
6204
+ withComponentIDs,
6205
+ pattern: expectedType === "entry-pattern" ? true : void 0
6206
+ });
6207
+ if (res.entries.length !== 1) {
6208
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
6209
+ process.exit(1);
6210
+ }
6211
+ const entry = res.entries[0];
6212
+ const actualType = getEntryActualType(entry);
6213
+ if (actualType !== expectedType) {
6214
+ console.error(formatEntryTypeError(id, actualType, expectedType, "get"));
6215
+ process.exit(1);
6216
+ }
6217
+ emitWithFormat(entry, format, filename);
6218
+ };
6219
+ }
5851
6220
  var EntryGetModule = {
5852
6221
  command: "get <id>",
5853
6222
  describe: "Get an entry",
5854
- builder: (yargs42) => withConfiguration(
6223
+ builder: (yargs44) => withConfiguration(
5855
6224
  withDebugOptions(
5856
6225
  withFormatOptions(
5857
6226
  withApiOptions(
5858
6227
  withProjectOptions(
5859
6228
  withStateOptions(
5860
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
6229
+ yargs44.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
5861
6230
  resolveData: {
5862
6231
  type: "boolean",
5863
6232
  default: false,
@@ -5887,41 +6256,7 @@ var EntryGetModule = {
5887
6256
  )
5888
6257
  )
5889
6258
  ),
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
- }
6259
+ handler: createEntryGetHandler("entry")
5925
6260
  };
5926
6261
 
5927
6262
  // src/commands/canvas/commands/entry/list.ts
@@ -5929,13 +6264,13 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
5929
6264
  var EntryListModule = {
5930
6265
  command: "list",
5931
6266
  describe: "List entries",
5932
- builder: (yargs42) => withConfiguration(
6267
+ builder: (yargs44) => withConfiguration(
5933
6268
  withDebugOptions(
5934
6269
  withFormatOptions(
5935
6270
  withApiOptions(
5936
6271
  withProjectOptions(
5937
6272
  withStateOptions(
5938
- yargs42.options({
6273
+ yargs44.options({
5939
6274
  offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
5940
6275
  limit: {
5941
6276
  describe: "Number of rows to fetch",
@@ -6070,12 +6405,12 @@ function createEntryEngineDataSource({
6070
6405
  var EntryPublishModule = {
6071
6406
  command: "publish [ids]",
6072
6407
  describe: "Publishes entry(ies)",
6073
- builder: (yargs42) => withConfiguration(
6408
+ builder: (yargs44) => withConfiguration(
6074
6409
  withDebugOptions(
6075
6410
  withDiffOptions(
6076
6411
  withApiOptions(
6077
6412
  withProjectOptions(
6078
- yargs42.positional("ids", {
6413
+ yargs44.positional("ids", {
6079
6414
  describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6080
6415
  type: "string"
6081
6416
  }).option("all", {
@@ -6150,13 +6485,13 @@ var EntryPublishModule = {
6150
6485
  var EntryPullModule = {
6151
6486
  command: "pull <directory>",
6152
6487
  describe: "Pulls all entries to local files in a directory",
6153
- builder: (yargs42) => withConfiguration(
6488
+ builder: (yargs44) => withConfiguration(
6154
6489
  withDebugOptions(
6155
6490
  withApiOptions(
6156
6491
  withProjectOptions(
6157
6492
  withStateOptions(
6158
6493
  withDiffOptions(
6159
- yargs42.positional("directory", {
6494
+ yargs44.positional("directory", {
6160
6495
  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
6496
  type: "string"
6162
6497
  }).option("format", {
@@ -6256,13 +6591,13 @@ var EntryPullModule = {
6256
6591
  var EntryPushModule = {
6257
6592
  command: "push <directory>",
6258
6593
  describe: "Pushes all entries from files in a directory to Uniform",
6259
- builder: (yargs42) => withConfiguration(
6594
+ builder: (yargs44) => withConfiguration(
6260
6595
  withDebugOptions(
6261
6596
  withApiOptions(
6262
6597
  withProjectOptions(
6263
6598
  withStateOptions(
6264
6599
  withDiffOptions(
6265
- yargs42.positional("directory", {
6600
+ yargs44.positional("directory", {
6266
6601
  describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
6267
6602
  type: "string"
6268
6603
  }).option("mode", {
@@ -6357,28 +6692,51 @@ var EntryPushModule = {
6357
6692
  };
6358
6693
 
6359
6694
  // src/commands/canvas/commands/entry/remove.ts
6695
+ function createEntryRemoveHandler(expectedType) {
6696
+ return async ({
6697
+ apiHost,
6698
+ apiKey,
6699
+ proxy,
6700
+ id,
6701
+ project: projectId,
6702
+ verbose,
6703
+ whatIf
6704
+ }) => {
6705
+ if (verbose) {
6706
+ console.log(`\u{1F41B} remove ${expectedType}: (id: ${id})`);
6707
+ }
6708
+ const fetch2 = nodeFetchProxy(proxy, verbose);
6709
+ const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
6710
+ const validation = await validateEntryType(client, id, expectedType);
6711
+ if (!validation.exists) {
6712
+ console.error(`Error: ${getEntryDisplayName(expectedType)} with ID "${id}" not found.`);
6713
+ process.exit(1);
6714
+ }
6715
+ if (!validation.isValid) {
6716
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "delete"));
6717
+ process.exit(1);
6718
+ }
6719
+ if (!whatIf) {
6720
+ await client.deleteEntry({ entryId: id });
6721
+ } else {
6722
+ whatIfSimpleLog({ id, displayName: getEntryDisplayName(expectedType), action: "delete" });
6723
+ }
6724
+ };
6725
+ }
6360
6726
  var EntryRemoveModule = {
6361
6727
  command: "remove <id>",
6362
6728
  aliases: ["delete", "rm"],
6363
6729
  describe: "Delete an entry",
6364
- builder: (yargs42) => withConfiguration(
6730
+ builder: (yargs44) => withConfiguration(
6365
6731
  withDebugOptions(
6366
6732
  withApiOptions(
6367
6733
  withProjectOptions(
6368
- yargs42.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6734
+ yargs44.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
6369
6735
  )
6370
6736
  )
6371
6737
  )
6372
6738
  ),
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
- }
6739
+ handler: createEntryRemoveHandler("entry")
6382
6740
  };
6383
6741
 
6384
6742
  // src/commands/canvas/commands/entry/unpublish.ts
@@ -6387,11 +6745,11 @@ import { diffJson as diffJson3 } from "diff";
6387
6745
  var EntryUnpublishModule = {
6388
6746
  command: "unpublish [ids]",
6389
6747
  describe: "Unpublish an entry(ies)",
6390
- builder: (yargs42) => withConfiguration(
6748
+ builder: (yargs44) => withConfiguration(
6391
6749
  withDebugOptions(
6392
6750
  withApiOptions(
6393
6751
  withProjectOptions(
6394
- yargs42.positional("ids", {
6752
+ yargs44.positional("ids", {
6395
6753
  describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6396
6754
  type: "string"
6397
6755
  }).option("all", {
@@ -6472,22 +6830,8 @@ var EntryUnpublishModule = {
6472
6830
  };
6473
6831
 
6474
6832
  // 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 ({
6833
+ function createEntryUpdateHandler(expectedType) {
6834
+ return async ({
6491
6835
  apiHost,
6492
6836
  edgeApiHost,
6493
6837
  apiKey,
@@ -6498,44 +6842,86 @@ var EntryUpdateModule = {
6498
6842
  verbose,
6499
6843
  whatIf
6500
6844
  }) => {
6845
+ if (verbose) {
6846
+ console.log(`\u{1F41B} update ${expectedType}: (filename: ${filename}, state: ${convertStateOption(state)})`);
6847
+ }
6501
6848
  const fetch2 = nodeFetchProxy(proxy, verbose);
6502
6849
  const client = getContentClient({ apiKey, apiHost, edgeApiHost, fetch: fetch2, projectId });
6503
6850
  const file = readFileToObject(filename);
6851
+ const id = file.entry._id;
6852
+ const validation = await validateEntryType(client, id, expectedType);
6853
+ if (validation.exists && !validation.isValid) {
6854
+ console.error(formatEntryTypeError(id, validation.actualType, expectedType, "update"));
6855
+ process.exit(1);
6856
+ }
6504
6857
  if (!whatIf) {
6505
6858
  await client.upsertEntry({ ...file, state: convertStateOption(state) });
6506
6859
  } else {
6507
- whatIfSimpleLog({ id: file.entry._id, displayName: `Entry: ${file.entry._name}`, action: "update" });
6860
+ whatIfSimpleLog({
6861
+ id,
6862
+ displayName: `${getEntryDisplayName(expectedType)}: ${file.entry._name}`,
6863
+ action: "update"
6864
+ });
6508
6865
  }
6509
- }
6866
+ };
6867
+ }
6868
+ var EntryUpdateModule = {
6869
+ command: "update <filename>",
6870
+ aliases: ["put"],
6871
+ describe: "Insert or update an entry",
6872
+ builder: (yargs44) => withConfiguration(
6873
+ withDebugOptions(
6874
+ withApiOptions(
6875
+ withProjectOptions(
6876
+ withStateOptions(
6877
+ yargs44.positional("filename", { demandOption: true, describe: "Entry file to put" })
6878
+ )
6879
+ )
6880
+ )
6881
+ )
6882
+ ),
6883
+ handler: createEntryUpdateHandler("entry")
6510
6884
  };
6511
6885
 
6512
6886
  // src/commands/canvas/commands/entry.ts
6513
6887
  var EntryModule = {
6514
6888
  command: "entry <command>",
6515
6889
  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(),
6890
+ builder: (yargs44) => yargs44.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
6517
6891
  handler: () => {
6518
- yargs13.help();
6892
+ yargs14.help();
6519
6893
  }
6520
6894
  };
6521
6895
 
6522
6896
  // src/commands/canvas/commands/entryPattern.ts
6523
- import yargs14 from "yargs";
6897
+ import yargs15 from "yargs";
6524
6898
 
6525
6899
  // src/commands/canvas/commands/entryPattern/get.ts
6526
6900
  var EntryPatternGetModule = {
6527
6901
  command: "get <id>",
6528
6902
  describe: "Get an entry pattern",
6529
- builder: (yargs42) => withConfiguration(
6903
+ builder: (yargs44) => withConfiguration(
6530
6904
  withDebugOptions(
6531
6905
  withFormatOptions(
6532
6906
  withApiOptions(
6533
6907
  withProjectOptions(
6534
6908
  withStateOptions(
6535
- yargs42.positional("id", {
6536
- demandOption: true,
6537
- describe: "Entry pattern public ID to fetch"
6538
- }).option({
6909
+ yargs44.positional("id", { demandOption: true, describe: "Entry pattern public ID to fetch" }).option({
6910
+ resolveData: {
6911
+ type: "boolean",
6912
+ default: false,
6913
+ describe: "Resolve all data resources used by the entry pattern"
6914
+ },
6915
+ diagnostics: {
6916
+ type: "boolean",
6917
+ default: false,
6918
+ describe: "Include diagnostics information when resolving data"
6919
+ },
6920
+ resolutionDepth: {
6921
+ type: "number",
6922
+ default: 1,
6923
+ describe: "Controls how many levels deep content references should be resolved"
6924
+ },
6539
6925
  withComponentIDs: {
6540
6926
  type: "boolean",
6541
6927
  default: false,
@@ -6549,49 +6935,20 @@ var EntryPatternGetModule = {
6549
6935
  )
6550
6936
  )
6551
6937
  ),
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
- }
6938
+ handler: createEntryGetHandler("entry-pattern")
6582
6939
  };
6583
6940
 
6584
6941
  // src/commands/canvas/commands/entryPattern/list.ts
6585
6942
  var EntryPatternListModule = {
6586
6943
  command: "list",
6587
6944
  describe: "List entry patterns",
6588
- builder: (yargs42) => withConfiguration(
6945
+ builder: (yargs44) => withConfiguration(
6589
6946
  withDebugOptions(
6590
6947
  withFormatOptions(
6591
6948
  withApiOptions(
6592
6949
  withProjectOptions(
6593
6950
  withStateOptions(
6594
- yargs42.option({
6951
+ yargs44.option({
6595
6952
  withComponentIDs: {
6596
6953
  type: "boolean",
6597
6954
  default: false,
@@ -6637,12 +6994,12 @@ var EntryPatternListModule = {
6637
6994
  var EntryPatternPublishModule = {
6638
6995
  command: "publish [ids]",
6639
6996
  describe: "Publishes entry pattern(s)",
6640
- builder: (yargs42) => withConfiguration(
6997
+ builder: (yargs44) => withConfiguration(
6641
6998
  withDebugOptions(
6642
6999
  withApiOptions(
6643
7000
  withProjectOptions(
6644
7001
  withDiffOptions(
6645
- yargs42.positional("ids", {
7002
+ yargs44.positional("ids", {
6646
7003
  describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6647
7004
  type: "string"
6648
7005
  }).option("all", {
@@ -6717,13 +7074,13 @@ var EntryPatternPublishModule = {
6717
7074
  var EntryPatternPullModule = {
6718
7075
  command: "pull <directory>",
6719
7076
  describe: "Pulls all entry patterns to local files in a directory",
6720
- builder: (yargs42) => withConfiguration(
7077
+ builder: (yargs44) => withConfiguration(
6721
7078
  withApiOptions(
6722
7079
  withDebugOptions(
6723
7080
  withProjectOptions(
6724
7081
  withStateOptions(
6725
7082
  withDiffOptions(
6726
- yargs42.positional("directory", {
7083
+ yargs44.positional("directory", {
6727
7084
  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
7085
  type: "string"
6729
7086
  }).option("format", {
@@ -6823,13 +7180,13 @@ var EntryPatternPullModule = {
6823
7180
  var EntryPatternPushModule = {
6824
7181
  command: "push <directory>",
6825
7182
  describe: "Pushes all entry patterns from files in a directory to Uniform",
6826
- builder: (yargs42) => withConfiguration(
7183
+ builder: (yargs44) => withConfiguration(
6827
7184
  withDebugOptions(
6828
7185
  withApiOptions(
6829
7186
  withProjectOptions(
6830
7187
  withStateOptions(
6831
7188
  withDiffOptions(
6832
- yargs42.positional("directory", {
7189
+ yargs44.positional("directory", {
6833
7190
  describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
6834
7191
  type: "string"
6835
7192
  }).option("what-if", {
@@ -6933,24 +7290,16 @@ var EntryPatternRemoveModule = {
6933
7290
  command: "remove <id>",
6934
7291
  aliases: ["delete", "rm"],
6935
7292
  describe: "Delete an entry pattern",
6936
- builder: (yargs42) => withConfiguration(
7293
+ builder: (yargs44) => withConfiguration(
6937
7294
  withDebugOptions(
6938
7295
  withApiOptions(
6939
7296
  withProjectOptions(
6940
- yargs42.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
7297
+ yargs44.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
6941
7298
  )
6942
7299
  )
6943
7300
  )
6944
7301
  ),
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
- }
7302
+ handler: createEntryRemoveHandler("entry-pattern")
6954
7303
  };
6955
7304
 
6956
7305
  // src/commands/canvas/commands/entryPattern/unpublish.ts
@@ -6959,11 +7308,11 @@ import { diffJson as diffJson4 } from "diff";
6959
7308
  var EntryPatternUnpublishModule = {
6960
7309
  command: "unpublish [ids]",
6961
7310
  describe: "Unpublish entry pattern(s)",
6962
- builder: (yargs42) => withConfiguration(
7311
+ builder: (yargs44) => withConfiguration(
6963
7312
  withDebugOptions(
6964
7313
  withApiOptions(
6965
7314
  withProjectOptions(
6966
- yargs42.positional("ids", {
7315
+ yargs44.positional("ids", {
6967
7316
  describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
6968
7317
  type: "string"
6969
7318
  }).option("all", {
@@ -7039,21 +7388,191 @@ var EntryPatternUnpublishModule = {
7039
7388
  diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
7040
7389
  });
7041
7390
  }
7042
- await Promise.all(actions);
7391
+ await Promise.all(actions);
7392
+ }
7393
+ };
7394
+
7395
+ // src/commands/canvas/commands/entryPattern/update.ts
7396
+ var EntryPatternUpdateModule = {
7397
+ command: "update <filename>",
7398
+ aliases: ["put"],
7399
+ describe: "Insert or update an entry pattern",
7400
+ builder: (yargs44) => withConfiguration(
7401
+ withDebugOptions(
7402
+ withApiOptions(
7403
+ withProjectOptions(
7404
+ withStateOptions(
7405
+ yargs44.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7406
+ )
7407
+ )
7408
+ )
7409
+ )
7410
+ ),
7411
+ handler: createEntryUpdateHandler("entry-pattern")
7412
+ };
7413
+
7414
+ // src/commands/canvas/commands/entryPattern.ts
7415
+ var EntryPatternModule = {
7416
+ command: "entry-pattern <command>",
7417
+ describe: "Commands for Entry patterns",
7418
+ builder: (yargs44) => yargs44.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
7419
+ handler: () => {
7420
+ yargs15.help();
7421
+ }
7422
+ };
7423
+
7424
+ // src/commands/canvas/commands/label.ts
7425
+ import yargs16 from "yargs";
7426
+
7427
+ // src/commands/canvas/labelsEngineDataSource.ts
7428
+ function normalizeLabelForSync(label) {
7429
+ const { projectId: _projectId, ...labelWithoutProjectId } = label;
7430
+ return labelWithoutProjectId;
7431
+ }
7432
+ function createLabelsEngineDataSource({
7433
+ client
7434
+ }) {
7435
+ async function* getObjects() {
7436
+ const labels = paginateAsync(
7437
+ async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
7438
+ { pageSize: 100 }
7439
+ );
7440
+ for await (const label of labels) {
7441
+ const result = {
7442
+ id: label.label.publicId,
7443
+ displayName: `${label.label.displayName} (pid: ${label.label.publicId})`,
7444
+ providerId: label.label.publicId,
7445
+ object: normalizeLabelForSync(label)
7446
+ };
7447
+ yield result;
7448
+ }
7449
+ }
7450
+ return {
7451
+ name: "Uniform API",
7452
+ objects: getObjects(),
7453
+ deleteObject: async (providerId) => {
7454
+ await client.removeLabel({ labelId: providerId });
7455
+ },
7456
+ writeObject: async ({ object: object4 }) => {
7457
+ await client.upsertLabel({ label: object4.label });
7458
+ }
7459
+ };
7460
+ }
7461
+
7462
+ // src/commands/canvas/commands/label/_util.ts
7463
+ import { LabelClient } from "@uniformdev/canvas";
7464
+ var selectLabelIdentifier = (label) => label.label.publicId;
7465
+ var selectLabelDisplayName = (label) => `${label.label.displayName} (pid: ${label.label.publicId})`;
7466
+ function getLabelClient(options) {
7467
+ return new LabelClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
7468
+ }
7469
+
7470
+ // src/commands/canvas/commands/label/pull.ts
7471
+ var LabelPullModule = {
7472
+ command: "pull <directory>",
7473
+ describe: "Pulls all labels to local files in a directory",
7474
+ builder: (yargs44) => withConfiguration(
7475
+ withDebugOptions(
7476
+ withApiOptions(
7477
+ withProjectOptions(
7478
+ withDiffOptions(
7479
+ yargs44.positional("directory", {
7480
+ 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.",
7481
+ type: "string"
7482
+ }).option("format", {
7483
+ alias: ["f"],
7484
+ describe: "Output format",
7485
+ default: "yaml",
7486
+ choices: ["yaml", "json"],
7487
+ type: "string"
7488
+ }).option("mode", {
7489
+ alias: ["m"],
7490
+ 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',
7491
+ choices: ["create", "createOrUpdate", "mirror"],
7492
+ default: "mirror",
7493
+ type: "string"
7494
+ })
7495
+ )
7496
+ )
7497
+ )
7498
+ )
7499
+ ),
7500
+ handler: async ({
7501
+ apiHost,
7502
+ apiKey,
7503
+ proxy,
7504
+ directory,
7505
+ format,
7506
+ mode,
7507
+ whatIf,
7508
+ project: projectId,
7509
+ diff: diffMode,
7510
+ allowEmptySource,
7511
+ verbose
7512
+ }) => {
7513
+ const fetch2 = nodeFetchProxy(proxy, verbose);
7514
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7515
+ const source = createLabelsEngineDataSource({ client });
7516
+ let target;
7517
+ const isPackage = isPathAPackageFile(directory);
7518
+ if (isPackage) {
7519
+ const packageContents = readCanvasPackage(directory, false, verbose);
7520
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7521
+ target = await createArraySyncEngineDataSource({
7522
+ name: `Package file ${directory}`,
7523
+ objects: packageLabels,
7524
+ selectIdentifier: selectLabelIdentifier,
7525
+ selectDisplayName: selectLabelDisplayName,
7526
+ onSyncComplete: async (_, synced) => {
7527
+ packageContents.labels = synced;
7528
+ writeCanvasPackage(directory, packageContents);
7529
+ }
7530
+ });
7531
+ } else {
7532
+ target = await createFileSyncEngineDataSource({
7533
+ directory,
7534
+ selectIdentifier: selectLabelIdentifier,
7535
+ selectDisplayName: selectLabelDisplayName,
7536
+ format,
7537
+ verbose
7538
+ });
7539
+ }
7540
+ await syncEngine({
7541
+ source,
7542
+ target,
7543
+ mode,
7544
+ whatIf,
7545
+ allowEmptySource: allowEmptySource ?? true,
7546
+ log: createSyncEngineConsoleLogger({ diffMode }),
7547
+ onBeforeWriteObject: async (sourceObject) => {
7548
+ delete sourceObject.object.createdBy;
7549
+ delete sourceObject.object.modifiedBy;
7550
+ return sourceObject;
7551
+ }
7552
+ });
7043
7553
  }
7044
7554
  };
7045
7555
 
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(
7556
+ // src/commands/canvas/commands/label/push.ts
7557
+ var __INTERNAL_MISSING_PARENT_LABEL_ERROR = "Parent label with public ID";
7558
+ var LabelPushModule = {
7559
+ command: "push <directory>",
7560
+ describe: "Pushes all labels from files in a directory to Uniform",
7561
+ builder: (yargs44) => withConfiguration(
7052
7562
  withDebugOptions(
7053
7563
  withApiOptions(
7054
7564
  withProjectOptions(
7055
- withStateOptions(
7056
- yargs42.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
7565
+ withDiffOptions(
7566
+ yargs44.positional("directory", {
7567
+ describe: "Directory to read the labels from. If a filename is used, a package will be read instead.",
7568
+ type: "string"
7569
+ }).option("mode", {
7570
+ alias: ["m"],
7571
+ 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',
7572
+ choices: ["create", "createOrUpdate", "mirror"],
7573
+ default: "mirror",
7574
+ type: "string"
7575
+ })
7057
7576
  )
7058
7577
  )
7059
7578
  )
@@ -7061,42 +7580,88 @@ var EntryPatternUpdateModule = {
7061
7580
  ),
7062
7581
  handler: async ({
7063
7582
  apiHost,
7064
- edgeApiHost,
7065
7583
  apiKey,
7066
7584
  proxy,
7067
- filename,
7585
+ directory,
7586
+ mode,
7587
+ whatIf,
7068
7588
  project: projectId,
7069
- state,
7070
- verbose,
7071
- whatIf
7589
+ diff: diffMode,
7590
+ allowEmptySource,
7591
+ verbose
7072
7592
  }) => {
7073
7593
  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) });
7594
+ const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
7595
+ let source;
7596
+ const isPackage = isPathAPackageFile(directory);
7597
+ if (isPackage) {
7598
+ const packageContents = readCanvasPackage(directory, true, verbose);
7599
+ const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
7600
+ source = await createArraySyncEngineDataSource({
7601
+ name: `Package file ${directory}`,
7602
+ objects: packageLabels,
7603
+ selectIdentifier: selectLabelIdentifier,
7604
+ selectDisplayName: selectLabelDisplayName
7605
+ });
7078
7606
  } else {
7079
- whatIfSimpleLog({
7080
- id: file.entry._id,
7081
- displayName: `Entry Pattern: ${file.entry._name}`,
7082
- action: "update"
7607
+ source = await createFileSyncEngineDataSource({
7608
+ directory,
7609
+ selectIdentifier: selectLabelIdentifier,
7610
+ selectDisplayName: selectLabelDisplayName,
7611
+ verbose
7083
7612
  });
7084
7613
  }
7614
+ const target = createLabelsEngineDataSource({ client });
7615
+ const labelsFailedDueToMissingParent = /* @__PURE__ */ new Set();
7616
+ const attemptSync = async () => {
7617
+ const lastFailedLabelsCount = labelsFailedDueToMissingParent.size;
7618
+ labelsFailedDueToMissingParent.clear();
7619
+ await syncEngine({
7620
+ source,
7621
+ target,
7622
+ mode,
7623
+ whatIf,
7624
+ allowEmptySource,
7625
+ log: createSyncEngineConsoleLogger({ diffMode }),
7626
+ onError: (error, object4) => {
7627
+ if (error.message.includes(__INTERNAL_MISSING_PARENT_LABEL_ERROR)) {
7628
+ labelsFailedDueToMissingParent.add(object4.object);
7629
+ } else {
7630
+ throw error;
7631
+ }
7632
+ }
7633
+ });
7634
+ if (labelsFailedDueToMissingParent.size !== 0) {
7635
+ const newFailedLabelsCount = labelsFailedDueToMissingParent.size;
7636
+ if (newFailedLabelsCount !== lastFailedLabelsCount) {
7637
+ source = await createArraySyncEngineDataSource({
7638
+ name: `Labels re-push from ${directory}`,
7639
+ objects: Array.from(labelsFailedDueToMissingParent),
7640
+ selectIdentifier: selectLabelIdentifier,
7641
+ selectDisplayName: selectLabelDisplayName
7642
+ });
7643
+ await attemptSync();
7644
+ } else {
7645
+ throw new Error("Failed to push labels due to missing parent labels");
7646
+ }
7647
+ }
7648
+ };
7649
+ await attemptSync();
7085
7650
  }
7086
7651
  };
7087
7652
 
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(),
7653
+ // src/commands/canvas/commands/label.ts
7654
+ var LabelModule = {
7655
+ command: "label <command>",
7656
+ describe: "Commands for label definitions",
7657
+ builder: (yargs44) => yargs44.command(LabelPullModule).command(LabelPushModule),
7093
7658
  handler: () => {
7094
- yargs14.help();
7659
+ yargs16.help();
7095
7660
  }
7096
7661
  };
7097
7662
 
7098
7663
  // src/commands/canvas/commands/locale.ts
7099
- import yargs15 from "yargs";
7664
+ import yargs17 from "yargs";
7100
7665
 
7101
7666
  // src/commands/canvas/localesEngineDataSource.ts
7102
7667
  function createLocaleEngineDataSource({
@@ -7138,12 +7703,12 @@ function getLocaleClient(options) {
7138
7703
  var LocalePullModule = {
7139
7704
  command: "pull <directory>",
7140
7705
  describe: "Pulls all locales to local files in a directory",
7141
- builder: (yargs42) => withConfiguration(
7706
+ builder: (yargs44) => withConfiguration(
7142
7707
  withDebugOptions(
7143
7708
  withApiOptions(
7144
7709
  withProjectOptions(
7145
7710
  withDiffOptions(
7146
- yargs42.positional("directory", {
7711
+ yargs44.positional("directory", {
7147
7712
  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
7713
  type: "string"
7149
7714
  }).option("format", {
@@ -7223,12 +7788,12 @@ var LocalePullModule = {
7223
7788
  var LocalePushModule = {
7224
7789
  command: "push <directory>",
7225
7790
  describe: "Pushes all locales from files in a directory to Uniform",
7226
- builder: (yargs42) => withConfiguration(
7791
+ builder: (yargs44) => withConfiguration(
7227
7792
  withDebugOptions(
7228
7793
  withApiOptions(
7229
7794
  withProjectOptions(
7230
7795
  withDiffOptions(
7231
- yargs42.positional("directory", {
7796
+ yargs44.positional("directory", {
7232
7797
  describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
7233
7798
  type: "string"
7234
7799
  }).option("mode", {
@@ -7296,14 +7861,14 @@ var LocalePushModule = {
7296
7861
  var LocaleModule = {
7297
7862
  command: "locale <command>",
7298
7863
  describe: "Commands for locale definitions",
7299
- builder: (yargs42) => yargs42.command(LocalePullModule).command(LocalePushModule),
7864
+ builder: (yargs44) => yargs44.command(LocalePullModule).command(LocalePushModule),
7300
7865
  handler: () => {
7301
- yargs15.help();
7866
+ yargs17.help();
7302
7867
  }
7303
7868
  };
7304
7869
 
7305
7870
  // src/commands/canvas/commands/previewUrl.ts
7306
- import yargs16 from "yargs";
7871
+ import yargs18 from "yargs";
7307
7872
 
7308
7873
  // src/commands/canvas/commands/previewUrl/_util.ts
7309
7874
  import { PreviewClient } from "@uniformdev/canvas";
@@ -7317,12 +7882,12 @@ function getPreviewClient(options) {
7317
7882
  var PreviewUrlGetModule = {
7318
7883
  command: "get <id>",
7319
7884
  describe: "Fetch a preview URL",
7320
- builder: (yargs42) => withConfiguration(
7885
+ builder: (yargs44) => withConfiguration(
7321
7886
  withFormatOptions(
7322
7887
  withDebugOptions(
7323
7888
  withApiOptions(
7324
7889
  withProjectOptions(
7325
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7890
+ yargs44.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
7326
7891
  )
7327
7892
  )
7328
7893
  )
@@ -7346,8 +7911,8 @@ var PreviewUrlListModule = {
7346
7911
  command: "list",
7347
7912
  describe: "List preview URLs",
7348
7913
  aliases: ["ls"],
7349
- builder: (yargs42) => withConfiguration(
7350
- withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs42.options({})))))
7914
+ builder: (yargs44) => withConfiguration(
7915
+ withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs44.options({})))))
7351
7916
  ),
7352
7917
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7353
7918
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7389,12 +7954,12 @@ function createPreviewUrlEngineDataSource({
7389
7954
  var PreviewUrlPullModule = {
7390
7955
  command: "pull <directory>",
7391
7956
  describe: "Pulls all preview urls to local files in a directory",
7392
- builder: (yargs42) => withConfiguration(
7957
+ builder: (yargs44) => withConfiguration(
7393
7958
  withApiOptions(
7394
7959
  withProjectOptions(
7395
7960
  withDebugOptions(
7396
7961
  withDiffOptions(
7397
- yargs42.positional("directory", {
7962
+ yargs44.positional("directory", {
7398
7963
  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
7964
  type: "string"
7400
7965
  }).option("format", {
@@ -7469,12 +8034,12 @@ var PreviewUrlPullModule = {
7469
8034
  var PreviewUrlPushModule = {
7470
8035
  command: "push <directory>",
7471
8036
  describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
7472
- builder: (yargs42) => withConfiguration(
8037
+ builder: (yargs44) => withConfiguration(
7473
8038
  withApiOptions(
7474
8039
  withProjectOptions(
7475
8040
  withDiffOptions(
7476
8041
  withDebugOptions(
7477
- yargs42.positional("directory", {
8042
+ yargs44.positional("directory", {
7478
8043
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7479
8044
  type: "string"
7480
8045
  }).option("mode", {
@@ -7538,11 +8103,11 @@ var PreviewUrlRemoveModule = {
7538
8103
  command: "remove <id>",
7539
8104
  aliases: ["delete", "rm"],
7540
8105
  describe: "Delete a preview URL",
7541
- builder: (yargs42) => withConfiguration(
8106
+ builder: (yargs44) => withConfiguration(
7542
8107
  withApiOptions(
7543
8108
  withDebugOptions(
7544
8109
  withProjectOptions(
7545
- yargs42.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
8110
+ yargs44.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
7546
8111
  )
7547
8112
  )
7548
8113
  )
@@ -7563,11 +8128,11 @@ var PreviewUrlUpdateModule = {
7563
8128
  command: "update <filename>",
7564
8129
  aliases: ["put"],
7565
8130
  describe: "Insert or update a preview URL",
7566
- builder: (yargs42) => withConfiguration(
8131
+ builder: (yargs44) => withConfiguration(
7567
8132
  withDebugOptions(
7568
8133
  withApiOptions(
7569
8134
  withProjectOptions(
7570
- yargs42.positional("filename", { demandOption: true, describe: "Category file to put" })
8135
+ yargs44.positional("filename", { demandOption: true, describe: "Category file to put" })
7571
8136
  )
7572
8137
  )
7573
8138
  )
@@ -7589,25 +8154,25 @@ var PreviewUrlModule = {
7589
8154
  command: "preview-url <command>",
7590
8155
  aliases: ["pu"],
7591
8156
  describe: "Commands for Canvas preview urls",
7592
- builder: (yargs42) => yargs42.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
8157
+ builder: (yargs44) => yargs44.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
7593
8158
  handler: () => {
7594
- yargs16.help();
8159
+ yargs18.help();
7595
8160
  }
7596
8161
  };
7597
8162
 
7598
8163
  // src/commands/canvas/commands/previewViewport.ts
7599
- import yargs17 from "yargs";
8164
+ import yargs19 from "yargs";
7600
8165
 
7601
8166
  // src/commands/canvas/commands/previewViewport/get.ts
7602
8167
  var PreviewViewportGetModule = {
7603
8168
  command: "get <id>",
7604
8169
  describe: "Fetch a preview viewport",
7605
- builder: (yargs42) => withConfiguration(
8170
+ builder: (yargs44) => withConfiguration(
7606
8171
  withFormatOptions(
7607
8172
  withDebugOptions(
7608
8173
  withApiOptions(
7609
8174
  withProjectOptions(
7610
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
8175
+ yargs44.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
7611
8176
  )
7612
8177
  )
7613
8178
  )
@@ -7631,8 +8196,8 @@ var PreviewViewportListModule = {
7631
8196
  command: "list",
7632
8197
  describe: "List preview viewports",
7633
8198
  aliases: ["ls"],
7634
- builder: (yargs42) => withConfiguration(
7635
- withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs42.options({})))))
8199
+ builder: (yargs44) => withConfiguration(
8200
+ withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs44.options({})))))
7636
8201
  ),
7637
8202
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7638
8203
  const fetch2 = nodeFetchProxy(proxy, verbose);
@@ -7678,12 +8243,12 @@ function createPreviewViewportEngineDataSource({
7678
8243
  var PreviewViewportPullModule = {
7679
8244
  command: "pull <directory>",
7680
8245
  describe: "Pulls all preview viewports to local files in a directory",
7681
- builder: (yargs42) => withConfiguration(
8246
+ builder: (yargs44) => withConfiguration(
7682
8247
  withApiOptions(
7683
8248
  withProjectOptions(
7684
8249
  withDebugOptions(
7685
8250
  withDiffOptions(
7686
- yargs42.positional("directory", {
8251
+ yargs44.positional("directory", {
7687
8252
  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
8253
  type: "string"
7689
8254
  }).option("format", {
@@ -7758,12 +8323,12 @@ var PreviewViewportPullModule = {
7758
8323
  var PreviewViewportPushModule = {
7759
8324
  command: "push <directory>",
7760
8325
  describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
7761
- builder: (yargs42) => withConfiguration(
8326
+ builder: (yargs44) => withConfiguration(
7762
8327
  withApiOptions(
7763
8328
  withProjectOptions(
7764
8329
  withDiffOptions(
7765
8330
  withDebugOptions(
7766
- yargs42.positional("directory", {
8331
+ yargs44.positional("directory", {
7767
8332
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
7768
8333
  type: "string"
7769
8334
  }).option("mode", {
@@ -7827,11 +8392,11 @@ var PreviewViewportRemoveModule = {
7827
8392
  command: "remove <id>",
7828
8393
  aliases: ["delete", "rm"],
7829
8394
  describe: "Delete a preview viewport",
7830
- builder: (yargs42) => withConfiguration(
8395
+ builder: (yargs44) => withConfiguration(
7831
8396
  withApiOptions(
7832
8397
  withDebugOptions(
7833
8398
  withProjectOptions(
7834
- yargs42.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
8399
+ yargs44.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
7835
8400
  )
7836
8401
  )
7837
8402
  )
@@ -7852,11 +8417,11 @@ var PreviewViewportUpdateModule = {
7852
8417
  command: "update <filename>",
7853
8418
  aliases: ["put"],
7854
8419
  describe: "Insert or update a preview viewport",
7855
- builder: (yargs42) => withConfiguration(
8420
+ builder: (yargs44) => withConfiguration(
7856
8421
  withDebugOptions(
7857
8422
  withApiOptions(
7858
8423
  withProjectOptions(
7859
- yargs42.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
8424
+ yargs44.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
7860
8425
  )
7861
8426
  )
7862
8427
  )
@@ -7878,14 +8443,14 @@ var PreviewViewportModule = {
7878
8443
  command: "preview-viewport <command>",
7879
8444
  aliases: ["pv"],
7880
8445
  describe: "Commands for Canvas preview viewports",
7881
- builder: (yargs42) => yargs42.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
8446
+ builder: (yargs44) => yargs44.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
7882
8447
  handler: () => {
7883
- yargs17.help();
8448
+ yargs19.help();
7884
8449
  }
7885
8450
  };
7886
8451
 
7887
8452
  // src/commands/canvas/commands/prompts.ts
7888
- import yargs18 from "yargs";
8453
+ import yargs20 from "yargs";
7889
8454
 
7890
8455
  // src/commands/canvas/commands/prompts/_util.ts
7891
8456
  import { PromptClient } from "@uniformdev/canvas";
@@ -7897,12 +8462,12 @@ var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: t
7897
8462
  var PromptGetModule = {
7898
8463
  command: "get <id>",
7899
8464
  describe: "Get a prompt",
7900
- builder: (yargs42) => withConfiguration(
8465
+ builder: (yargs44) => withConfiguration(
7901
8466
  withDebugOptions(
7902
8467
  withFormatOptions(
7903
8468
  withApiOptions(
7904
8469
  withProjectOptions(
7905
- yargs42.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
8470
+ yargs44.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
7906
8471
  )
7907
8472
  )
7908
8473
  )
@@ -7923,7 +8488,7 @@ var PromptGetModule = {
7923
8488
  var PromptListModule = {
7924
8489
  command: "list",
7925
8490
  describe: "List prompts",
7926
- builder: (yargs42) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs42))))),
8491
+ builder: (yargs44) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs44))))),
7927
8492
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
7928
8493
  const fetch2 = nodeFetchProxy(proxy, verbose);
7929
8494
  const client = getPromptClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -7964,13 +8529,13 @@ function createPromptEngineDataSource({
7964
8529
  var PromptPullModule = {
7965
8530
  command: "pull <directory>",
7966
8531
  describe: "Pulls all prompts to local files in a directory",
7967
- builder: (yargs42) => withConfiguration(
8532
+ builder: (yargs44) => withConfiguration(
7968
8533
  withDebugOptions(
7969
8534
  withApiOptions(
7970
8535
  withProjectOptions(
7971
8536
  withStateOptions(
7972
8537
  withDiffOptions(
7973
- yargs42.positional("directory", {
8538
+ yargs44.positional("directory", {
7974
8539
  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
8540
  type: "string"
7976
8541
  }).option("format", {
@@ -8051,12 +8616,12 @@ var PromptPullModule = {
8051
8616
  var PromptPushModule = {
8052
8617
  command: "push <directory>",
8053
8618
  describe: "Pushes all prompts from files in a directory to Uniform",
8054
- builder: (yargs42) => withConfiguration(
8619
+ builder: (yargs44) => withConfiguration(
8055
8620
  withApiOptions(
8056
8621
  withProjectOptions(
8057
8622
  withStateOptions(
8058
8623
  withDiffOptions(
8059
- yargs42.positional("directory", {
8624
+ yargs44.positional("directory", {
8060
8625
  describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
8061
8626
  type: "string"
8062
8627
  }).option("mode", {
@@ -8125,10 +8690,10 @@ var PromptRemoveModule = {
8125
8690
  command: "remove <id>",
8126
8691
  aliases: ["delete", "rm"],
8127
8692
  describe: "Delete a prompt",
8128
- builder: (yargs42) => withConfiguration(
8693
+ builder: (yargs44) => withConfiguration(
8129
8694
  withDebugOptions(
8130
8695
  withApiOptions(
8131
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8696
+ withProjectOptions(yargs44.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
8132
8697
  )
8133
8698
  )
8134
8699
  ),
@@ -8148,11 +8713,11 @@ var PromptUpdateModule = {
8148
8713
  command: "update <filename>",
8149
8714
  aliases: ["put"],
8150
8715
  describe: "Insert or update a prompt",
8151
- builder: (yargs42) => withConfiguration(
8716
+ builder: (yargs44) => withConfiguration(
8152
8717
  withDebugOptions(
8153
8718
  withApiOptions(
8154
8719
  withProjectOptions(
8155
- yargs42.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8720
+ yargs44.positional("filename", { demandOption: true, describe: "Prompt file to put" })
8156
8721
  )
8157
8722
  )
8158
8723
  )
@@ -8174,14 +8739,14 @@ var PromptModule = {
8174
8739
  command: "prompt <command>",
8175
8740
  aliases: ["dt"],
8176
8741
  describe: "Commands for AI Prompt definitions",
8177
- builder: (yargs42) => yargs42.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8742
+ builder: (yargs44) => yargs44.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
8178
8743
  handler: () => {
8179
- yargs18.help();
8744
+ yargs20.help();
8180
8745
  }
8181
8746
  };
8182
8747
 
8183
8748
  // src/commands/canvas/commands/workflow.ts
8184
- import yargs19 from "yargs";
8749
+ import yargs21 from "yargs";
8185
8750
 
8186
8751
  // src/commands/canvas/commands/workflow/_util.ts
8187
8752
  import { WorkflowClient } from "@uniformdev/canvas";
@@ -8224,12 +8789,12 @@ function createWorkflowEngineDataSource({
8224
8789
  var WorkflowPullModule = {
8225
8790
  command: "pull <directory>",
8226
8791
  describe: "Pulls all workflows to local files in a directory",
8227
- builder: (yargs42) => withConfiguration(
8792
+ builder: (yargs44) => withConfiguration(
8228
8793
  withApiOptions(
8229
8794
  withDebugOptions(
8230
8795
  withProjectOptions(
8231
8796
  withDiffOptions(
8232
- yargs42.positional("directory", {
8797
+ yargs44.positional("directory", {
8233
8798
  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
8799
  type: "string"
8235
8800
  }).option("format", {
@@ -8304,12 +8869,12 @@ var WorkflowPullModule = {
8304
8869
  var WorkflowPushModule = {
8305
8870
  command: "push <directory>",
8306
8871
  describe: "Pushes all workflows from files in a directory to Uniform Canvas",
8307
- builder: (yargs42) => withConfiguration(
8872
+ builder: (yargs44) => withConfiguration(
8308
8873
  withDebugOptions(
8309
8874
  withApiOptions(
8310
8875
  withProjectOptions(
8311
8876
  withDiffOptions(
8312
- yargs42.positional("directory", {
8877
+ yargs44.positional("directory", {
8313
8878
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
8314
8879
  type: "string"
8315
8880
  }).option("mode", {
@@ -8373,9 +8938,9 @@ var WorkflowModule = {
8373
8938
  command: "workflow <command>",
8374
8939
  aliases: ["wf"],
8375
8940
  describe: "Commands for Canvas workflows",
8376
- builder: (yargs42) => yargs42.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8941
+ builder: (yargs44) => yargs44.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
8377
8942
  handler: () => {
8378
- yargs19.help();
8943
+ yargs21.help();
8379
8944
  }
8380
8945
  };
8381
8946
 
@@ -8384,17 +8949,17 @@ var CanvasCommand = {
8384
8949
  command: "canvas <command>",
8385
8950
  aliases: ["cv", "pm", "presentation"],
8386
8951
  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(),
8952
+ builder: (yargs44) => yargs44.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
8953
  handler: () => {
8389
- yargs20.showHelp();
8954
+ yargs22.showHelp();
8390
8955
  }
8391
8956
  };
8392
8957
 
8393
8958
  // src/commands/context/index.ts
8394
- import yargs27 from "yargs";
8959
+ import yargs29 from "yargs";
8395
8960
 
8396
8961
  // src/commands/context/commands/aggregate.ts
8397
- import yargs21 from "yargs";
8962
+ import yargs23 from "yargs";
8398
8963
 
8399
8964
  // src/commands/context/commands/aggregate/_util.ts
8400
8965
  import { AggregateClient } from "@uniformdev/context/api";
@@ -8406,11 +8971,11 @@ var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCa
8406
8971
  var AggregateGetModule = {
8407
8972
  command: "get <id>",
8408
8973
  describe: "Fetch an aggregate",
8409
- builder: (yargs42) => withConfiguration(
8974
+ builder: (yargs44) => withConfiguration(
8410
8975
  withFormatOptions(
8411
8976
  withApiOptions(
8412
8977
  withProjectOptions(
8413
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8978
+ yargs44.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
8414
8979
  )
8415
8980
  )
8416
8981
  )
@@ -8433,7 +8998,7 @@ var AggregateListModule = {
8433
8998
  command: "list",
8434
8999
  describe: "List aggregates",
8435
9000
  aliases: ["ls"],
8436
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9001
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
8437
9002
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8438
9003
  const fetch2 = nodeFetchProxy(proxy);
8439
9004
  const client = getAggregateClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8496,12 +9061,12 @@ function writeContextPackage(filename, packageContents) {
8496
9061
  var AggregatePullModule = {
8497
9062
  command: "pull <directory>",
8498
9063
  describe: "Pulls all aggregates to local files in a directory",
8499
- builder: (yargs42) => withConfiguration(
9064
+ builder: (yargs44) => withConfiguration(
8500
9065
  withApiOptions(
8501
9066
  withDebugOptions(
8502
9067
  withProjectOptions(
8503
9068
  withDiffOptions(
8504
- yargs42.positional("directory", {
9069
+ yargs44.positional("directory", {
8505
9070
  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
9071
  type: "string"
8507
9072
  }).option("format", {
@@ -8576,12 +9141,12 @@ var AggregatePullModule = {
8576
9141
  var AggregatePushModule = {
8577
9142
  command: "push <directory>",
8578
9143
  describe: "Pushes all aggregates from files in a directory or package to Uniform",
8579
- builder: (yargs42) => withConfiguration(
9144
+ builder: (yargs44) => withConfiguration(
8580
9145
  withApiOptions(
8581
9146
  withProjectOptions(
8582
9147
  withDiffOptions(
8583
9148
  withDebugOptions(
8584
- yargs42.positional("directory", {
9149
+ yargs44.positional("directory", {
8585
9150
  describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
8586
9151
  type: "string"
8587
9152
  }).option("mode", {
@@ -8646,10 +9211,10 @@ var AggregateRemoveModule = {
8646
9211
  command: "remove <id>",
8647
9212
  aliases: ["delete", "rm"],
8648
9213
  describe: "Delete an aggregate",
8649
- builder: (yargs42) => withConfiguration(
9214
+ builder: (yargs44) => withConfiguration(
8650
9215
  withApiOptions(
8651
9216
  withProjectOptions(
8652
- yargs42.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
9217
+ yargs44.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
8653
9218
  )
8654
9219
  )
8655
9220
  ),
@@ -8665,10 +9230,10 @@ var AggregateUpdateModule = {
8665
9230
  command: "update <filename>",
8666
9231
  aliases: ["put"],
8667
9232
  describe: "Insert or update an aggregate",
8668
- builder: (yargs42) => withConfiguration(
9233
+ builder: (yargs44) => withConfiguration(
8669
9234
  withApiOptions(
8670
9235
  withProjectOptions(
8671
- yargs42.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
9236
+ yargs44.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
8672
9237
  )
8673
9238
  )
8674
9239
  ),
@@ -8685,14 +9250,14 @@ var AggregateModule = {
8685
9250
  command: "aggregate <command>",
8686
9251
  aliases: ["agg", "intent", "audience"],
8687
9252
  describe: "Commands for Context aggregates (intents, audiences)",
8688
- builder: (yargs42) => yargs42.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
9253
+ builder: (yargs44) => yargs44.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
8689
9254
  handler: () => {
8690
- yargs21.help();
9255
+ yargs23.help();
8691
9256
  }
8692
9257
  };
8693
9258
 
8694
9259
  // src/commands/context/commands/enrichment.ts
8695
- import yargs22 from "yargs";
9260
+ import yargs24 from "yargs";
8696
9261
 
8697
9262
  // src/commands/context/commands/enrichment/_util.ts
8698
9263
  import { UncachedEnrichmentClient } from "@uniformdev/context/api";
@@ -8706,11 +9271,11 @@ function getEnrichmentClient(options) {
8706
9271
  var EnrichmentGetModule = {
8707
9272
  command: "get <id>",
8708
9273
  describe: "Fetch an enrichment category and its values",
8709
- builder: (yargs42) => withFormatOptions(
9274
+ builder: (yargs44) => withFormatOptions(
8710
9275
  withConfiguration(
8711
9276
  withApiOptions(
8712
9277
  withProjectOptions(
8713
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
9278
+ yargs44.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
8714
9279
  )
8715
9280
  )
8716
9281
  )
@@ -8733,7 +9298,7 @@ var EnrichmentListModule = {
8733
9298
  command: "list",
8734
9299
  describe: "List enrichments",
8735
9300
  aliases: ["ls"],
8736
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
9301
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
8737
9302
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
8738
9303
  const fetch2 = nodeFetchProxy(proxy);
8739
9304
  const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -8828,12 +9393,12 @@ var createEnrichmentValueEngineDataSource = ({
8828
9393
  var EnrichmentPullModule = {
8829
9394
  command: "pull <directory>",
8830
9395
  describe: "Pulls all enrichments to local files in a directory",
8831
- builder: (yargs42) => withConfiguration(
9396
+ builder: (yargs44) => withConfiguration(
8832
9397
  withDebugOptions(
8833
9398
  withApiOptions(
8834
9399
  withProjectOptions(
8835
9400
  withDiffOptions(
8836
- yargs42.positional("directory", {
9401
+ yargs44.positional("directory", {
8837
9402
  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
9403
  type: "string"
8839
9404
  }).option("format", {
@@ -8908,11 +9473,11 @@ var EnrichmentPullModule = {
8908
9473
  var EnrichmentPushModule = {
8909
9474
  command: "push <directory>",
8910
9475
  describe: "Pushes all enrichments from files in a directory or package to Uniform",
8911
- builder: (yargs42) => withConfiguration(
9476
+ builder: (yargs44) => withConfiguration(
8912
9477
  withApiOptions(
8913
9478
  withProjectOptions(
8914
9479
  withDiffOptions(
8915
- yargs42.positional("directory", {
9480
+ yargs44.positional("directory", {
8916
9481
  describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
8917
9482
  type: "string"
8918
9483
  }).option("mode", {
@@ -8975,10 +9540,10 @@ var EnrichmentRemoveModule = {
8975
9540
  command: "remove <id>",
8976
9541
  aliases: ["delete", "rm"],
8977
9542
  describe: "Delete an enrichment category and its values",
8978
- builder: (yargs42) => withConfiguration(
9543
+ builder: (yargs44) => withConfiguration(
8979
9544
  withApiOptions(
8980
9545
  withProjectOptions(
8981
- yargs42.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
9546
+ yargs44.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
8982
9547
  )
8983
9548
  )
8984
9549
  ),
@@ -8994,14 +9559,14 @@ var EnrichmentModule = {
8994
9559
  command: "enrichment <command>",
8995
9560
  aliases: ["enr"],
8996
9561
  describe: "Commands for Context enrichments",
8997
- builder: (yargs42) => yargs42.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
9562
+ builder: (yargs44) => yargs44.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
8998
9563
  handler: () => {
8999
- yargs22.help();
9564
+ yargs24.help();
9000
9565
  }
9001
9566
  };
9002
9567
 
9003
9568
  // src/commands/context/commands/manifest.ts
9004
- import yargs23 from "yargs";
9569
+ import yargs25 from "yargs";
9005
9570
 
9006
9571
  // src/commands/context/commands/manifest/get.ts
9007
9572
  import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
@@ -9012,10 +9577,10 @@ var ManifestGetModule = {
9012
9577
  command: "get [output]",
9013
9578
  aliases: ["dl", "download"],
9014
9579
  describe: "Download the Uniform Context manifest for a project",
9015
- builder: (yargs42) => withConfiguration(
9580
+ builder: (yargs44) => withConfiguration(
9016
9581
  withApiOptions(
9017
9582
  withProjectOptions(
9018
- yargs42.option("preview", {
9583
+ yargs44.option("preview", {
9019
9584
  describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
9020
9585
  default: false,
9021
9586
  type: "boolean",
@@ -9077,7 +9642,7 @@ import { exit as exit2 } from "process";
9077
9642
  var ManifestPublishModule = {
9078
9643
  command: "publish",
9079
9644
  describe: "Publish the Uniform Context manifest for a project",
9080
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(yargs42))),
9645
+ builder: (yargs44) => withConfiguration(withApiOptions(withProjectOptions(yargs44))),
9081
9646
  handler: async ({ apiKey, apiHost, proxy, project }) => {
9082
9647
  const fetch2 = nodeFetchProxy(proxy);
9083
9648
  try {
@@ -9110,25 +9675,25 @@ var ManifestModule = {
9110
9675
  command: "manifest <command>",
9111
9676
  describe: "Commands for context manifests",
9112
9677
  aliases: ["man"],
9113
- builder: (yargs42) => yargs42.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9678
+ builder: (yargs44) => yargs44.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
9114
9679
  handler: () => {
9115
- yargs23.help();
9680
+ yargs25.help();
9116
9681
  }
9117
9682
  };
9118
9683
 
9119
9684
  // src/commands/context/commands/quirk.ts
9120
- import yargs24 from "yargs";
9685
+ import yargs26 from "yargs";
9121
9686
 
9122
9687
  // src/commands/context/commands/quirk/get.ts
9123
9688
  import { UncachedQuirkClient } from "@uniformdev/context/api";
9124
9689
  var QuirkGetModule = {
9125
9690
  command: "get <id>",
9126
9691
  describe: "Fetch a quirk",
9127
- builder: (yargs42) => withConfiguration(
9692
+ builder: (yargs44) => withConfiguration(
9128
9693
  withFormatOptions(
9129
9694
  withApiOptions(
9130
9695
  withProjectOptions(
9131
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9696
+ yargs44.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
9132
9697
  )
9133
9698
  )
9134
9699
  )
@@ -9152,11 +9717,11 @@ var QuirkListModule = {
9152
9717
  command: "list",
9153
9718
  describe: "List quirks",
9154
9719
  aliases: ["ls"],
9155
- builder: (yargs42) => withConfiguration(
9720
+ builder: (yargs44) => withConfiguration(
9156
9721
  withFormatOptions(
9157
9722
  withApiOptions(
9158
9723
  withProjectOptions(
9159
- yargs42.option("withIntegrations", {
9724
+ yargs44.option("withIntegrations", {
9160
9725
  alias: ["i"],
9161
9726
  describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
9162
9727
  type: "boolean"
@@ -9214,12 +9779,12 @@ function createQuirkEngineDataSource({
9214
9779
  var QuirkPullModule = {
9215
9780
  command: "pull <directory>",
9216
9781
  describe: "Pulls all quirks to local files in a directory",
9217
- builder: (yargs42) => withConfiguration(
9782
+ builder: (yargs44) => withConfiguration(
9218
9783
  withDebugOptions(
9219
9784
  withApiOptions(
9220
9785
  withProjectOptions(
9221
9786
  withDiffOptions(
9222
- yargs42.positional("directory", {
9787
+ yargs44.positional("directory", {
9223
9788
  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
9789
  type: "string"
9225
9790
  }).option("format", {
@@ -9295,12 +9860,12 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
9295
9860
  var QuirkPushModule = {
9296
9861
  command: "push <directory>",
9297
9862
  describe: "Pushes all quirks from files in a directory or package to Uniform",
9298
- builder: (yargs42) => withConfiguration(
9863
+ builder: (yargs44) => withConfiguration(
9299
9864
  withDebugOptions(
9300
9865
  withApiOptions(
9301
9866
  withProjectOptions(
9302
9867
  withDiffOptions(
9303
- yargs42.positional("directory", {
9868
+ yargs44.positional("directory", {
9304
9869
  describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
9305
9870
  type: "string"
9306
9871
  }).option("mode", {
@@ -9365,10 +9930,10 @@ var QuirkRemoveModule = {
9365
9930
  command: "remove <id>",
9366
9931
  aliases: ["delete", "rm"],
9367
9932
  describe: "Delete a quirk",
9368
- builder: (yargs42) => withConfiguration(
9933
+ builder: (yargs44) => withConfiguration(
9369
9934
  withApiOptions(
9370
9935
  withProjectOptions(
9371
- yargs42.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9936
+ yargs44.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
9372
9937
  )
9373
9938
  )
9374
9939
  ),
@@ -9385,10 +9950,10 @@ var QuirkUpdateModule = {
9385
9950
  command: "update <filename>",
9386
9951
  aliases: ["put"],
9387
9952
  describe: "Insert or update a quirk",
9388
- builder: (yargs42) => withConfiguration(
9953
+ builder: (yargs44) => withConfiguration(
9389
9954
  withApiOptions(
9390
9955
  withProjectOptions(
9391
- yargs42.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9956
+ yargs44.positional("filename", { demandOption: true, describe: "Quirk file to put" })
9392
9957
  )
9393
9958
  )
9394
9959
  ),
@@ -9405,25 +9970,25 @@ var QuirkModule = {
9405
9970
  command: "quirk <command>",
9406
9971
  aliases: ["qk"],
9407
9972
  describe: "Commands for Context quirks",
9408
- builder: (yargs42) => yargs42.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9973
+ builder: (yargs44) => yargs44.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
9409
9974
  handler: () => {
9410
- yargs24.help();
9975
+ yargs26.help();
9411
9976
  }
9412
9977
  };
9413
9978
 
9414
9979
  // src/commands/context/commands/signal.ts
9415
- import yargs25 from "yargs";
9980
+ import yargs27 from "yargs";
9416
9981
 
9417
9982
  // src/commands/context/commands/signal/get.ts
9418
9983
  import { UncachedSignalClient } from "@uniformdev/context/api";
9419
9984
  var SignalGetModule = {
9420
9985
  command: "get <id>",
9421
9986
  describe: "Fetch a signal",
9422
- builder: (yargs42) => withConfiguration(
9987
+ builder: (yargs44) => withConfiguration(
9423
9988
  withFormatOptions(
9424
9989
  withApiOptions(
9425
9990
  withProjectOptions(
9426
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9991
+ yargs44.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
9427
9992
  )
9428
9993
  )
9429
9994
  )
@@ -9447,7 +10012,7 @@ var SignalListModule = {
9447
10012
  command: "list",
9448
10013
  describe: "List signals",
9449
10014
  aliases: ["ls"],
9450
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
10015
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
9451
10016
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9452
10017
  const fetch2 = nodeFetchProxy(proxy);
9453
10018
  const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9497,12 +10062,12 @@ function createSignalEngineDataSource({
9497
10062
  var SignalPullModule = {
9498
10063
  command: "pull <directory>",
9499
10064
  describe: "Pulls all signals to local files in a directory",
9500
- builder: (yargs42) => withConfiguration(
10065
+ builder: (yargs44) => withConfiguration(
9501
10066
  withDebugOptions(
9502
10067
  withApiOptions(
9503
10068
  withProjectOptions(
9504
10069
  withDiffOptions(
9505
- yargs42.positional("directory", {
10070
+ yargs44.positional("directory", {
9506
10071
  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
10072
  type: "string"
9508
10073
  }).option("format", {
@@ -9578,12 +10143,12 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
9578
10143
  var SignalPushModule = {
9579
10144
  command: "push <directory>",
9580
10145
  describe: "Pushes all signals from files in a directory or package to Uniform",
9581
- builder: (yargs42) => withConfiguration(
10146
+ builder: (yargs44) => withConfiguration(
9582
10147
  withDebugOptions(
9583
10148
  withApiOptions(
9584
10149
  withProjectOptions(
9585
10150
  withDiffOptions(
9586
- yargs42.positional("directory", {
10151
+ yargs44.positional("directory", {
9587
10152
  describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
9588
10153
  type: "string"
9589
10154
  }).option("mode", {
@@ -9648,10 +10213,10 @@ var SignalRemoveModule = {
9648
10213
  command: "remove <id>",
9649
10214
  aliases: ["delete", "rm"],
9650
10215
  describe: "Delete a signal",
9651
- builder: (yargs42) => withConfiguration(
10216
+ builder: (yargs44) => withConfiguration(
9652
10217
  withApiOptions(
9653
10218
  withProjectOptions(
9654
- yargs42.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
10219
+ yargs44.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
9655
10220
  )
9656
10221
  )
9657
10222
  ),
@@ -9668,10 +10233,10 @@ var SignalUpdateModule = {
9668
10233
  command: "update <filename>",
9669
10234
  aliases: ["put"],
9670
10235
  describe: "Insert or update a signal",
9671
- builder: (yargs42) => withConfiguration(
10236
+ builder: (yargs44) => withConfiguration(
9672
10237
  withApiOptions(
9673
10238
  withProjectOptions(
9674
- yargs42.positional("filename", { demandOption: true, describe: "Signal file to put" })
10239
+ yargs44.positional("filename", { demandOption: true, describe: "Signal file to put" })
9675
10240
  )
9676
10241
  )
9677
10242
  ),
@@ -9688,25 +10253,25 @@ var SignalModule = {
9688
10253
  command: "signal <command>",
9689
10254
  aliases: ["sig"],
9690
10255
  describe: "Commands for Context signals",
9691
- builder: (yargs42) => yargs42.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
10256
+ builder: (yargs44) => yargs44.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
9692
10257
  handler: () => {
9693
- yargs25.help();
10258
+ yargs27.help();
9694
10259
  }
9695
10260
  };
9696
10261
 
9697
10262
  // src/commands/context/commands/test.ts
9698
- import yargs26 from "yargs";
10263
+ import yargs28 from "yargs";
9699
10264
 
9700
10265
  // src/commands/context/commands/test/get.ts
9701
10266
  import { UncachedTestClient } from "@uniformdev/context/api";
9702
10267
  var TestGetModule = {
9703
10268
  command: "get <id>",
9704
10269
  describe: "Fetch a test",
9705
- builder: (yargs42) => withConfiguration(
10270
+ builder: (yargs44) => withConfiguration(
9706
10271
  withFormatOptions(
9707
10272
  withApiOptions(
9708
10273
  withProjectOptions(
9709
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
10274
+ yargs44.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
9710
10275
  )
9711
10276
  )
9712
10277
  )
@@ -9730,7 +10295,7 @@ var TestListModule = {
9730
10295
  command: "list",
9731
10296
  describe: "List tests",
9732
10297
  aliases: ["ls"],
9733
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
10298
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
9734
10299
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
9735
10300
  const fetch2 = nodeFetchProxy(proxy);
9736
10301
  const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -9780,12 +10345,12 @@ function createTestEngineDataSource({
9780
10345
  var TestPullModule = {
9781
10346
  command: "pull <directory>",
9782
10347
  describe: "Pulls all tests to local files in a directory",
9783
- builder: (yargs42) => withConfiguration(
10348
+ builder: (yargs44) => withConfiguration(
9784
10349
  withDebugOptions(
9785
10350
  withApiOptions(
9786
10351
  withProjectOptions(
9787
10352
  withDiffOptions(
9788
- yargs42.positional("directory", {
10353
+ yargs44.positional("directory", {
9789
10354
  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
10355
  type: "string"
9791
10356
  }).option("format", {
@@ -9861,12 +10426,12 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
9861
10426
  var TestPushModule = {
9862
10427
  command: "push <directory>",
9863
10428
  describe: "Pushes all tests from files in a directory or package to Uniform",
9864
- builder: (yargs42) => withConfiguration(
10429
+ builder: (yargs44) => withConfiguration(
9865
10430
  withDebugOptions(
9866
10431
  withApiOptions(
9867
10432
  withProjectOptions(
9868
10433
  withDiffOptions(
9869
- yargs42.positional("directory", {
10434
+ yargs44.positional("directory", {
9870
10435
  describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
9871
10436
  type: "string"
9872
10437
  }).option("mode", {
@@ -9931,10 +10496,10 @@ var TestRemoveModule = {
9931
10496
  command: "remove <id>",
9932
10497
  aliases: ["delete", "rm"],
9933
10498
  describe: "Delete a test",
9934
- builder: (yargs42) => withConfiguration(
10499
+ builder: (yargs44) => withConfiguration(
9935
10500
  withApiOptions(
9936
10501
  withProjectOptions(
9937
- yargs42.positional("id", { demandOption: true, describe: "Test public ID to delete" })
10502
+ yargs44.positional("id", { demandOption: true, describe: "Test public ID to delete" })
9938
10503
  )
9939
10504
  )
9940
10505
  ),
@@ -9951,9 +10516,9 @@ var TestUpdateModule = {
9951
10516
  command: "update <filename>",
9952
10517
  aliases: ["put"],
9953
10518
  describe: "Insert or update a test",
9954
- builder: (yargs42) => withConfiguration(
10519
+ builder: (yargs44) => withConfiguration(
9955
10520
  withApiOptions(
9956
- withProjectOptions(yargs42.positional("filename", { demandOption: true, describe: "Test file to put" }))
10521
+ withProjectOptions(yargs44.positional("filename", { demandOption: true, describe: "Test file to put" }))
9957
10522
  )
9958
10523
  ),
9959
10524
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
@@ -9968,9 +10533,9 @@ var TestUpdateModule = {
9968
10533
  var TestModule = {
9969
10534
  command: "test <command>",
9970
10535
  describe: "Commands for Context A/B tests",
9971
- builder: (yargs42) => yargs42.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
10536
+ builder: (yargs44) => yargs44.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
9972
10537
  handler: () => {
9973
- yargs26.help();
10538
+ yargs28.help();
9974
10539
  }
9975
10540
  };
9976
10541
 
@@ -9979,56 +10544,23 @@ var ContextCommand = {
9979
10544
  command: "context <command>",
9980
10545
  aliases: ["ctx"],
9981
10546
  describe: "Uniform Context commands",
9982
- builder: (yargs42) => yargs42.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
10547
+ builder: (yargs44) => yargs44.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
9983
10548
  handler: () => {
9984
- yargs27.showHelp();
10549
+ yargs29.showHelp();
9985
10550
  }
9986
10551
  };
9987
10552
 
9988
10553
  // src/commands/integration/index.ts
9989
- import yargs32 from "yargs";
10554
+ import yargs34 from "yargs";
9990
10555
 
9991
10556
  // src/commands/integration/commands/definition.ts
9992
- import yargs31 from "yargs";
10557
+ import yargs33 from "yargs";
9993
10558
 
9994
10559
  // src/commands/integration/commands/definition/dataResourceEditor/dataResourceEditor.ts
9995
- import yargs28 from "yargs";
10560
+ import yargs30 from "yargs";
9996
10561
 
9997
10562
  // src/commands/integration/commands/definition/dataResourceEditor/deploy.ts
9998
- import { readFileSync as readFileSync2 } from "fs";
9999
-
10000
- // src/commands/integration/commands/definition/bundleWorkerCode.ts
10001
- import esbuild from "esbuild";
10002
- import path5 from "path";
10003
- async function bundleWorkerCode(entryFile) {
10004
- const result = await esbuild.build({
10005
- entryPoints: [entryFile],
10006
- bundle: true,
10007
- // Don't write to disk, build to memory
10008
- write: false,
10009
- format: "esm",
10010
- target: "es2021",
10011
- platform: "browser",
10012
- minify: true,
10013
- // Force inlining of all dependencies
10014
- external: [],
10015
- // Ensure single file output
10016
- splitting: false,
10017
- sourcemap: false
10018
- });
10019
- const outputFiles = result.outputFiles;
10020
- if (!outputFiles || outputFiles.length === 0) {
10021
- throw new Error(`No output generated for ${entryFile}`);
10022
- }
10023
- const outputFile = outputFiles[0];
10024
- const builtCode = outputFile.text;
10025
- console.log(
10026
- `\u2139\uFE0F ${path5.basename(entryFile)} was prepared with esbuild. Size: ${Math.round(
10027
- builtCode.length / 1024
10028
- )}kb (use --skipBundle to disable)`
10029
- );
10030
- return builtCode;
10031
- }
10563
+ import { readFileSync as readFileSync3 } from "fs";
10032
10564
 
10033
10565
  // src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
10034
10566
  import { createLimitPolicy as createLimitPolicy2 } from "@uniformdev/canvas";
@@ -10063,8 +10595,8 @@ var EdgehancerClient = class extends ApiClient {
10063
10595
  };
10064
10596
 
10065
10597
  // src/commands/integration/commands/definition/dataResourceEditor/util.ts
10066
- function withDataResourceEditorIdOptions(yargs42) {
10067
- return yargs42.option("connectorType", {
10598
+ function withDataResourceEditorIdOptions(yargs44) {
10599
+ return yargs44.option("connectorType", {
10068
10600
  describe: "Integration data connector type to attach the data resource editor to, as defined in the integration manifest file.",
10069
10601
  demandOption: true,
10070
10602
  type: "string"
@@ -10084,11 +10616,11 @@ function withDataResourceEditorIdOptions(yargs42) {
10084
10616
  var IntegrationDataResourceEditorDeployModule = {
10085
10617
  command: "deploy <filename>",
10086
10618
  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(
10619
+ builder: (yargs44) => withConfiguration(
10088
10620
  withApiOptions(
10089
10621
  withTeamOptions(
10090
10622
  withDataResourceEditorIdOptions(
10091
- yargs42.positional("filename", {
10623
+ yargs44.positional("filename", {
10092
10624
  demandOption: true,
10093
10625
  describe: "ESM code file to run for the target data resource editor hook. Refer to the documentation for expected types."
10094
10626
  }).option("compatibilityDate", {
@@ -10119,7 +10651,7 @@ var IntegrationDataResourceEditorDeployModule = {
10119
10651
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
10120
10652
  let code;
10121
10653
  if (skipBundle) {
10122
- code = readFileSync2(filename, "utf8");
10654
+ code = readFileSync3(filename, "utf8");
10123
10655
  } else {
10124
10656
  code = await bundleWorkerCode(filename);
10125
10657
  }
@@ -10131,7 +10663,7 @@ var IntegrationDataResourceEditorDeployModule = {
10131
10663
  var IntegrationDataResourceEditorRemoveModule = {
10132
10664
  command: "remove",
10133
10665
  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)))),
10666
+ builder: (yargs44) => withConfiguration(withApiOptions(withTeamOptions(withDataResourceEditorIdOptions(yargs44)))),
10135
10667
  handler: async ({ apiHost, apiKey, proxy, team: teamId, connectorType, archetype, hook }) => {
10136
10668
  const fetch2 = nodeFetchProxy(proxy);
10137
10669
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10143,21 +10675,21 @@ var IntegrationDataResourceEditorRemoveModule = {
10143
10675
  var IntegrationDataResourceEditorModule = {
10144
10676
  command: "dataResourceEditor <command>",
10145
10677
  describe: "Commands for managing custom AI data resource editors at the team level.",
10146
- builder: (yargs42) => yargs42.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10678
+ builder: (yargs44) => yargs44.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
10147
10679
  handler: () => {
10148
- yargs28.help();
10680
+ yargs30.help();
10149
10681
  }
10150
10682
  };
10151
10683
 
10152
10684
  // src/commands/integration/commands/definition/edgehancer/edgehancer.ts
10153
- import yargs29 from "yargs";
10685
+ import yargs31 from "yargs";
10154
10686
 
10155
10687
  // src/commands/integration/commands/definition/edgehancer/deploy.ts
10156
- import { readFileSync as readFileSync3 } from "fs";
10688
+ import { readFileSync as readFileSync4 } from "fs";
10157
10689
 
10158
10690
  // src/commands/integration/commands/definition/edgehancer/util.ts
10159
- function withEdgehancerIdOptions(yargs42) {
10160
- return yargs42.option("connectorType", {
10691
+ function withEdgehancerIdOptions(yargs44) {
10692
+ return yargs44.option("connectorType", {
10161
10693
  describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
10162
10694
  demandOption: true,
10163
10695
  type: "string"
@@ -10177,11 +10709,11 @@ function withEdgehancerIdOptions(yargs42) {
10177
10709
  var IntegrationEdgehancerDeployModule = {
10178
10710
  command: "deploy <filename>",
10179
10711
  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(
10712
+ builder: (yargs44) => withConfiguration(
10181
10713
  withApiOptions(
10182
10714
  withTeamOptions(
10183
10715
  withEdgehancerIdOptions(
10184
- yargs42.positional("filename", {
10716
+ yargs44.positional("filename", {
10185
10717
  demandOption: true,
10186
10718
  describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
10187
10719
  }).option("compatibilityDate", {
@@ -10212,7 +10744,7 @@ var IntegrationEdgehancerDeployModule = {
10212
10744
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
10213
10745
  let code;
10214
10746
  if (skipBundle) {
10215
- code = readFileSync3(filename, "utf8");
10747
+ code = readFileSync4(filename, "utf8");
10216
10748
  } else {
10217
10749
  code = await bundleWorkerCode(filename);
10218
10750
  }
@@ -10224,7 +10756,7 @@ var IntegrationEdgehancerDeployModule = {
10224
10756
  var IntegrationEdgehancerRemoveModule = {
10225
10757
  command: "remove",
10226
10758
  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)))),
10759
+ builder: (yargs44) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs44)))),
10228
10760
  handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
10229
10761
  const fetch2 = nodeFetchProxy(proxy);
10230
10762
  const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10236,22 +10768,22 @@ var IntegrationEdgehancerRemoveModule = {
10236
10768
  var IntegrationEdgehancerModule = {
10237
10769
  command: "edgehancer <command>",
10238
10770
  describe: "Commands for managing custom integration edgehancers at the team level.",
10239
- builder: (yargs42) => yargs42.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10771
+ builder: (yargs44) => yargs44.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
10240
10772
  handler: () => {
10241
- yargs29.help();
10773
+ yargs31.help();
10242
10774
  }
10243
10775
  };
10244
10776
 
10245
10777
  // src/commands/integration/commands/definition/propertyEditor/propertyEditor.ts
10246
- import yargs30 from "yargs";
10778
+ import yargs32 from "yargs";
10247
10779
 
10248
10780
  // src/commands/integration/commands/definition/propertyEditor/deploy.ts
10249
10781
  import { IntegrationPropertyEditorsClient } from "@uniformdev/canvas";
10250
- import { readFileSync as readFileSync4 } from "fs";
10782
+ import { readFileSync as readFileSync5 } from "fs";
10251
10783
 
10252
10784
  // src/commands/integration/commands/definition/propertyEditor/util.ts
10253
- function withPropertyEditorIdOptions(yargs42) {
10254
- return yargs42.option("propertyType", {
10785
+ function withPropertyEditorIdOptions(yargs44) {
10786
+ return yargs44.option("propertyType", {
10255
10787
  describe: "Property type to attach the editor to.",
10256
10788
  demandOption: true,
10257
10789
  type: "string"
@@ -10267,11 +10799,11 @@ function withPropertyEditorIdOptions(yargs42) {
10267
10799
  var IntegrationPropertyEditorDeployModule = {
10268
10800
  command: "deploy <filename>",
10269
10801
  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(
10802
+ builder: (yargs44) => withConfiguration(
10271
10803
  withApiOptions(
10272
10804
  withTeamOptions(
10273
10805
  withPropertyEditorIdOptions(
10274
- yargs42.positional("filename", {
10806
+ yargs44.positional("filename", {
10275
10807
  demandOption: true,
10276
10808
  describe: "ESM code file to run for the target property editor hook. Refer to the documentation for expected types."
10277
10809
  }).option("compatibilityDate", {
@@ -10301,7 +10833,7 @@ var IntegrationPropertyEditorDeployModule = {
10301
10833
  const client = new IntegrationPropertyEditorsClient({ apiKey, apiHost, fetch: fetch2, teamId });
10302
10834
  let code;
10303
10835
  if (skipBundle) {
10304
- code = readFileSync4(filename, "utf8");
10836
+ code = readFileSync5(filename, "utf8");
10305
10837
  } else {
10306
10838
  code = await bundleWorkerCode(filename);
10307
10839
  }
@@ -10314,7 +10846,7 @@ import { IntegrationPropertyEditorsClient as IntegrationPropertyEditorsClient2 }
10314
10846
  var IntegrationPropertyEditorRemoveModule = {
10315
10847
  command: "remove",
10316
10848
  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)))),
10849
+ builder: (yargs44) => withConfiguration(withApiOptions(withTeamOptions(withPropertyEditorIdOptions(yargs44)))),
10318
10850
  handler: async ({ apiHost, apiKey, proxy, team: teamId, propertyType, hook }) => {
10319
10851
  const fetch2 = nodeFetchProxy(proxy);
10320
10852
  const client = new IntegrationPropertyEditorsClient2({ apiKey, apiHost, fetch: fetch2, teamId });
@@ -10326,9 +10858,9 @@ var IntegrationPropertyEditorRemoveModule = {
10326
10858
  var IntegrationPropertyEditorModule = {
10327
10859
  command: "propertyEditor <command>",
10328
10860
  describe: "Commands for managing custom AI property editors at the team level.",
10329
- builder: (yargs42) => yargs42.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10861
+ builder: (yargs44) => yargs44.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
10330
10862
  handler: () => {
10331
- yargs30.help();
10863
+ yargs32.help();
10332
10864
  }
10333
10865
  };
10334
10866
 
@@ -10368,10 +10900,10 @@ var DefinitionClient = class extends ApiClient2 {
10368
10900
  var IntegrationDefinitionRegisterModule = {
10369
10901
  command: "register <filename>",
10370
10902
  describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
10371
- builder: (yargs42) => withConfiguration(
10903
+ builder: (yargs44) => withConfiguration(
10372
10904
  withApiOptions(
10373
10905
  withTeamOptions(
10374
- yargs42.positional("filename", {
10906
+ yargs44.positional("filename", {
10375
10907
  demandOption: true,
10376
10908
  describe: "Integration definition manifest to register"
10377
10909
  })
@@ -10390,10 +10922,10 @@ var IntegrationDefinitionRegisterModule = {
10390
10922
  var IntegrationDefinitionRemoveModule = {
10391
10923
  command: "remove <type>",
10392
10924
  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(
10925
+ builder: (yargs44) => withConfiguration(
10394
10926
  withApiOptions(
10395
10927
  withTeamOptions(
10396
- yargs42.positional("type", {
10928
+ yargs44.positional("type", {
10397
10929
  demandOption: true,
10398
10930
  describe: "Integration type (from its manifest) to remove."
10399
10931
  })
@@ -10411,9 +10943,9 @@ var IntegrationDefinitionRemoveModule = {
10411
10943
  var IntegrationDefinitionModule = {
10412
10944
  command: "definition <command>",
10413
10945
  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(),
10946
+ builder: (yargs44) => yargs44.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).command(IntegrationDataResourceEditorModule).command(IntegrationPropertyEditorModule).demandCommand(),
10415
10947
  handler: () => {
10416
- yargs31.help();
10948
+ yargs33.help();
10417
10949
  }
10418
10950
  };
10419
10951
 
@@ -10453,10 +10985,10 @@ var InstallClient = class extends ApiClient3 {
10453
10985
  var IntegrationInstallModule = {
10454
10986
  command: "install <type>",
10455
10987
  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(
10988
+ builder: (yargs44) => withConfiguration(
10457
10989
  withApiOptions(
10458
10990
  withProjectOptions(
10459
- yargs42.positional("type", {
10991
+ yargs44.positional("type", {
10460
10992
  demandOption: true,
10461
10993
  describe: "Integration type to install (as defined in its manifest)"
10462
10994
  }).option("configuration", {
@@ -10478,10 +11010,10 @@ var IntegrationInstallModule = {
10478
11010
  var IntegrationUninstallModule = {
10479
11011
  command: "uninstall <type>",
10480
11012
  describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
10481
- builder: (yargs42) => withConfiguration(
11013
+ builder: (yargs44) => withConfiguration(
10482
11014
  withApiOptions(
10483
11015
  withProjectOptions(
10484
- yargs42.positional("type", {
11016
+ yargs44.positional("type", {
10485
11017
  demandOption: true,
10486
11018
  describe: "Integration type to uninstall (as defined in its manifest)"
10487
11019
  })
@@ -10499,9 +11031,9 @@ var IntegrationUninstallModule = {
10499
11031
  var IntegrationCommand = {
10500
11032
  command: "integration <command>",
10501
11033
  describe: "Integration management commands",
10502
- builder: (yargs42) => yargs42.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
11034
+ builder: (yargs44) => yargs44.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
10503
11035
  handler: () => {
10504
- yargs32.showHelp();
11036
+ yargs34.showHelp();
10505
11037
  }
10506
11038
  };
10507
11039
 
@@ -10749,7 +11281,7 @@ npm run dev
10749
11281
 
10750
11282
  // src/commands/new/commands/new-mesh-integration.ts
10751
11283
  import { input as input2 } from "@inquirer/prompts";
10752
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "fs";
11284
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "fs";
10753
11285
  import path7 from "path";
10754
11286
  import slugify2 from "slugify";
10755
11287
  async function newMeshIntegrationHandler({
@@ -10798,16 +11330,16 @@ async function newMeshIntegrationHandler({
10798
11330
  });
10799
11331
  let done = await spin("Registering integration to team...");
10800
11332
  const pathToManifest = path7.resolve(targetDir, "mesh-manifest.json");
10801
- if (!existsSync4(pathToManifest)) {
11333
+ if (!existsSync5(pathToManifest)) {
10802
11334
  throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
10803
11335
  }
10804
- const manifestContents = readFileSync5(pathToManifest, "utf-8");
11336
+ const manifestContents = readFileSync6(pathToManifest, "utf-8");
10805
11337
  const manifestJson = JSON.parse(manifestContents);
10806
11338
  manifestJson.type = typeSlug;
10807
11339
  manifestJson.displayName = name;
10808
11340
  writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
10809
11341
  const packageJsonPath = path7.resolve(targetDir, "package.json");
10810
- const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
11342
+ const packageJson = JSON.parse(readFileSync6(packageJsonPath, "utf-8"));
10811
11343
  packageJson.name = typeSlug;
10812
11344
  writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
10813
11345
  const fullMeshAppKey = await uniformClient.registerMeshIntegration({ teamId, manifest: manifestJson });
@@ -10852,12 +11384,12 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
10852
11384
  throw new Error("Integration name cannot be shorter than 6 characters.");
10853
11385
  }
10854
11386
  let targetDir = explicitOutputPath ?? process.cwd();
10855
- if (!existsSync4(targetDir)) {
11387
+ if (!existsSync5(targetDir)) {
10856
11388
  mkdirSync3(targetDir, { recursive: true });
10857
11389
  }
10858
11390
  if (readdirSync(targetDir).length > 0) {
10859
11391
  targetDir = path7.resolve(targetDir, typeSlug);
10860
- if (existsSync4(targetDir)) {
11392
+ if (existsSync5(targetDir)) {
10861
11393
  throw new Error(`${targetDir} directory already exists, choose a different name.`);
10862
11394
  }
10863
11395
  }
@@ -10966,14 +11498,14 @@ var NewMeshCmd = {
10966
11498
  };
10967
11499
 
10968
11500
  // src/commands/policy-documents/index.ts
10969
- import yargs33 from "yargs";
11501
+ import yargs35 from "yargs";
10970
11502
 
10971
11503
  // src/commands/policy-documents/commands/list.ts
10972
11504
  var PolicyDocumentsListModule = {
10973
11505
  command: "list",
10974
11506
  describe: "List policy documents for a project",
10975
11507
  aliases: ["ls"],
10976
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11508
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
10977
11509
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
10978
11510
  const fetch2 = nodeFetchProxy(proxy, verbose);
10979
11511
  const url = new URL(`/api/v1/policy-documents`, apiHost);
@@ -11058,12 +11590,12 @@ var selectDisplayName13 = (policyDoc) => `Policy document for role ${policyDoc.r
11058
11590
  var PolicyDocumentsPullModule = {
11059
11591
  command: "pull <directory>",
11060
11592
  describe: "Pulls all policy documents to local files in a directory",
11061
- builder: (yargs42) => withConfiguration(
11593
+ builder: (yargs44) => withConfiguration(
11062
11594
  withApiOptions(
11063
11595
  withDebugOptions(
11064
11596
  withProjectOptions(
11065
11597
  withDiffOptions(
11066
- yargs42.positional("directory", {
11598
+ yargs44.positional("directory", {
11067
11599
  describe: "Directory to save to. Each policy document will be saved as a separate file named by role ID.",
11068
11600
  type: "string"
11069
11601
  }).option("format", {
@@ -11118,18 +11650,19 @@ var PolicyDocumentsPullModule = {
11118
11650
  };
11119
11651
 
11120
11652
  // src/commands/policy-documents/commands/push.ts
11121
- import { readdir as readdir2, stat } from "fs/promises";
11122
- import { extname as extname2, join as join11 } from "path";
11653
+ import { existsSync as existsSync6, mkdirSync as mkdirSync4 } from "fs";
11654
+ import { readdir as readdir2 } from "fs/promises";
11655
+ import { extname as extname3, join as join12 } from "path";
11123
11656
  async function readLocalPolicyDocuments(directory, format, verbose) {
11124
11657
  const files = await readdir2(directory);
11125
11658
  const policyDocuments = {};
11126
11659
  const errors = [];
11127
11660
  for (const filename of files) {
11128
- const ext = extname2(filename);
11661
+ const ext = extname3(filename);
11129
11662
  if (ext !== `.${format}` && ext !== ".yaml" && ext !== ".yml" && ext !== ".json") {
11130
11663
  continue;
11131
11664
  }
11132
- const filePath = join11(directory, filename);
11665
+ const filePath = join12(directory, filename);
11133
11666
  try {
11134
11667
  let roleId = filename.replace(ext, "");
11135
11668
  const fileContent = readFileToObject(filePath);
@@ -11196,12 +11729,12 @@ function mergePolicyDocuments(localDocs, remoteDocs, mode) {
11196
11729
  var PolicyDocumentsPushModule = {
11197
11730
  command: "push <directory>",
11198
11731
  describe: "Pushes policy documents from local files to Uniform",
11199
- builder: (yargs42) => withConfiguration(
11732
+ builder: (yargs44) => withConfiguration(
11200
11733
  withApiOptions(
11201
11734
  withDebugOptions(
11202
11735
  withProjectOptions(
11203
11736
  withDiffOptions(
11204
- yargs42.positional("directory", {
11737
+ yargs44.positional("directory", {
11205
11738
  describe: "Directory containing policy document files (one file per role ID).",
11206
11739
  type: "string"
11207
11740
  }).option("format", {
@@ -11235,16 +11768,11 @@ var PolicyDocumentsPushModule = {
11235
11768
  allowEmptySource,
11236
11769
  verbose
11237
11770
  }) => {
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`);
11771
+ if (!existsSync6(directory)) {
11772
+ if (verbose) {
11773
+ console.log(`Creating directory ${directory}`);
11246
11774
  }
11247
- throw e;
11775
+ mkdirSync4(directory, { recursive: true });
11248
11776
  }
11249
11777
  const fetch2 = nodeFetchProxy(proxy, verbose);
11250
11778
  const localDocs = await readLocalPolicyDocuments(directory, format, verbose);
@@ -11302,17 +11830,17 @@ var PolicyDocumentsCommand = {
11302
11830
  command: "policy-documents <command>",
11303
11831
  aliases: ["policy", "policies"],
11304
11832
  describe: "Uniform Policy Documents commands",
11305
- builder: (yargs42) => yargs42.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11833
+ builder: (yargs44) => yargs44.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
11306
11834
  handler: () => {
11307
- yargs33.showHelp();
11835
+ yargs35.showHelp();
11308
11836
  }
11309
11837
  };
11310
11838
 
11311
11839
  // src/commands/project-map/index.ts
11312
- import yargs36 from "yargs";
11840
+ import yargs38 from "yargs";
11313
11841
 
11314
11842
  // src/commands/project-map/commands/projectMapDefinition.ts
11315
- import yargs34 from "yargs";
11843
+ import yargs36 from "yargs";
11316
11844
 
11317
11845
  // src/commands/project-map/commands/ProjectMapDefinition/_util.ts
11318
11846
  import { UncachedProjectMapClient } from "@uniformdev/project-map";
@@ -11326,11 +11854,11 @@ function getProjectMapClient(options) {
11326
11854
  var ProjectMapDefinitionGetModule = {
11327
11855
  command: "get <id>",
11328
11856
  describe: "Fetch a project map",
11329
- builder: (yargs42) => withFormatOptions(
11857
+ builder: (yargs44) => withFormatOptions(
11330
11858
  withConfiguration(
11331
11859
  withApiOptions(
11332
11860
  withProjectOptions(
11333
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11861
+ yargs44.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
11334
11862
  )
11335
11863
  )
11336
11864
  )
@@ -11353,7 +11881,7 @@ var ProjectMapDefinitionListModule = {
11353
11881
  command: "list",
11354
11882
  describe: "List of project maps",
11355
11883
  aliases: ["ls"],
11356
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
11884
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
11357
11885
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
11358
11886
  const fetch2 = nodeFetchProxy(proxy);
11359
11887
  const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -11407,12 +11935,12 @@ function createProjectMapDefinitionEngineDataSource({
11407
11935
  var ProjectMapDefinitionPullModule = {
11408
11936
  command: "pull <directory>",
11409
11937
  describe: "Pulls all project maps to local files in a directory",
11410
- builder: (yargs42) => withConfiguration(
11938
+ builder: (yargs44) => withConfiguration(
11411
11939
  withDebugOptions(
11412
11940
  withApiOptions(
11413
11941
  withProjectOptions(
11414
11942
  withDiffOptions(
11415
- yargs42.positional("directory", {
11943
+ yargs44.positional("directory", {
11416
11944
  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
11945
  type: "string"
11418
11946
  }).option("format", {
@@ -11487,12 +12015,12 @@ var ProjectMapDefinitionPullModule = {
11487
12015
  var ProjectMapDefinitionPushModule = {
11488
12016
  command: "push <directory>",
11489
12017
  describe: "Pushes all project maps from files in a directory or package to Uniform",
11490
- builder: (yargs42) => withConfiguration(
12018
+ builder: (yargs44) => withConfiguration(
11491
12019
  withDebugOptions(
11492
12020
  withApiOptions(
11493
12021
  withProjectOptions(
11494
12022
  withDiffOptions(
11495
- yargs42.positional("directory", {
12023
+ yargs44.positional("directory", {
11496
12024
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11497
12025
  type: "string"
11498
12026
  }).option("mode", {
@@ -11556,9 +12084,9 @@ var ProjectMapDefinitionRemoveModule = {
11556
12084
  command: "remove <id>",
11557
12085
  aliases: ["delete", "rm"],
11558
12086
  describe: "Delete a project map",
11559
- builder: (yargs42) => withConfiguration(
12087
+ builder: (yargs44) => withConfiguration(
11560
12088
  withApiOptions(
11561
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
12089
+ withProjectOptions(yargs44.positional("id", { demandOption: true, describe: " UUID to delete" }))
11562
12090
  )
11563
12091
  ),
11564
12092
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -11573,10 +12101,10 @@ var ProjectMapDefinitionUpdateModule = {
11573
12101
  command: "update <filename>",
11574
12102
  aliases: ["put"],
11575
12103
  describe: "Insert or update a project map",
11576
- builder: (yargs42) => withConfiguration(
12104
+ builder: (yargs44) => withConfiguration(
11577
12105
  withApiOptions(
11578
12106
  withProjectOptions(
11579
- yargs42.positional("filename", { demandOption: true, describe: "Project map file to put" })
12107
+ yargs44.positional("filename", { demandOption: true, describe: "Project map file to put" })
11580
12108
  )
11581
12109
  )
11582
12110
  ),
@@ -11592,24 +12120,24 @@ var ProjectMapDefinitionUpdateModule = {
11592
12120
  var ProjectMapDefinitionModule = {
11593
12121
  command: "definition <command>",
11594
12122
  describe: "Commands for ProjectMap Definitions",
11595
- builder: (yargs42) => yargs42.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
12123
+ builder: (yargs44) => yargs44.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
11596
12124
  handler: () => {
11597
- yargs34.help();
12125
+ yargs36.help();
11598
12126
  }
11599
12127
  };
11600
12128
 
11601
12129
  // src/commands/project-map/commands/projectMapNode.ts
11602
- import yargs35 from "yargs";
12130
+ import yargs37 from "yargs";
11603
12131
 
11604
12132
  // src/commands/project-map/commands/ProjectMapNode/get.ts
11605
12133
  var ProjectMapNodeGetModule = {
11606
12134
  command: "get <id> <projectMapId>",
11607
12135
  describe: "Fetch a project map node",
11608
- builder: (yargs42) => withConfiguration(
12136
+ builder: (yargs44) => withConfiguration(
11609
12137
  withFormatOptions(
11610
12138
  withApiOptions(
11611
12139
  withProjectOptions(
11612
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
12140
+ yargs44.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
11613
12141
  )
11614
12142
  )
11615
12143
  )
@@ -11633,12 +12161,12 @@ var ProjectMapNodeListModule = {
11633
12161
  command: "list <projectMapId>",
11634
12162
  describe: "List project map nodes",
11635
12163
  aliases: ["ls"],
11636
- builder: (yargs42) => withConfiguration(
12164
+ builder: (yargs44) => withConfiguration(
11637
12165
  withFormatOptions(
11638
12166
  withApiOptions(
11639
12167
  withProjectOptions(
11640
12168
  withStateOptions(
11641
- yargs42.positional("projectMapId", {
12169
+ yargs44.positional("projectMapId", {
11642
12170
  demandOption: true,
11643
12171
  describe: "ProjectMap UUID to fetch from"
11644
12172
  })
@@ -11716,12 +12244,12 @@ function createProjectMapNodeEngineDataSource({
11716
12244
  var ProjectMapNodePullModule = {
11717
12245
  command: "pull <directory>",
11718
12246
  describe: "Pulls all project maps nodes to local files in a directory",
11719
- builder: (yargs42) => withConfiguration(
12247
+ builder: (yargs44) => withConfiguration(
11720
12248
  withDebugOptions(
11721
12249
  withApiOptions(
11722
12250
  withProjectOptions(
11723
12251
  withDiffOptions(
11724
- yargs42.positional("directory", {
12252
+ yargs44.positional("directory", {
11725
12253
  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
12254
  type: "string"
11727
12255
  }).option("format", {
@@ -11803,12 +12331,12 @@ import {
11803
12331
  var ProjectMapNodePushModule = {
11804
12332
  command: "push <directory>",
11805
12333
  describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
11806
- builder: (yargs42) => withConfiguration(
12334
+ builder: (yargs44) => withConfiguration(
11807
12335
  withDebugOptions(
11808
12336
  withApiOptions(
11809
12337
  withProjectOptions(
11810
12338
  withDiffOptions(
11811
- yargs42.positional("directory", {
12339
+ yargs44.positional("directory", {
11812
12340
  describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
11813
12341
  type: "string"
11814
12342
  }).option("mode", {
@@ -11910,10 +12438,10 @@ var ProjectMapNodeRemoveModule = {
11910
12438
  command: "remove <id> <projectMapId>",
11911
12439
  aliases: ["delete", "rm"],
11912
12440
  describe: "Delete a project map node",
11913
- builder: (yargs42) => withConfiguration(
12441
+ builder: (yargs44) => withConfiguration(
11914
12442
  withApiOptions(
11915
12443
  withProjectOptions(
11916
- yargs42.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
12444
+ yargs44.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
11917
12445
  )
11918
12446
  )
11919
12447
  ),
@@ -11929,10 +12457,10 @@ var ProjectMapNodeUpdateModule = {
11929
12457
  command: "update <filename> <projectMapId>",
11930
12458
  aliases: ["put"],
11931
12459
  describe: "Insert or update a project map node",
11932
- builder: (yargs42) => withConfiguration(
12460
+ builder: (yargs44) => withConfiguration(
11933
12461
  withApiOptions(
11934
12462
  withProjectOptions(
11935
- yargs42.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
12463
+ yargs44.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
11936
12464
  )
11937
12465
  )
11938
12466
  ),
@@ -11948,9 +12476,9 @@ var ProjectMapNodeUpdateModule = {
11948
12476
  var ProjectMapNodeModule = {
11949
12477
  command: "node <command>",
11950
12478
  describe: "Commands for ProjectMap Nodes",
11951
- builder: (yargs42) => yargs42.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
12479
+ builder: (yargs44) => yargs44.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
11952
12480
  handler: () => {
11953
- yargs35.help();
12481
+ yargs37.help();
11954
12482
  }
11955
12483
  };
11956
12484
 
@@ -11959,17 +12487,17 @@ var ProjectMapCommand = {
11959
12487
  command: "project-map <command>",
11960
12488
  aliases: ["prm"],
11961
12489
  describe: "Uniform ProjectMap commands",
11962
- builder: (yargs42) => yargs42.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
12490
+ builder: (yargs44) => yargs44.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
11963
12491
  handler: () => {
11964
- yargs36.showHelp();
12492
+ yargs38.showHelp();
11965
12493
  }
11966
12494
  };
11967
12495
 
11968
12496
  // src/commands/redirect/index.ts
11969
- import yargs38 from "yargs";
12497
+ import yargs40 from "yargs";
11970
12498
 
11971
12499
  // src/commands/redirect/commands/redirect.ts
11972
- import yargs37 from "yargs";
12500
+ import yargs39 from "yargs";
11973
12501
 
11974
12502
  // src/commands/redirect/commands/RedirectDefinition/_util.ts
11975
12503
  import { UncachedRedirectClient } from "@uniformdev/redirect";
@@ -11994,11 +12522,11 @@ function getRedirectClient(options) {
11994
12522
  var RedirectDefinitionGetModule = {
11995
12523
  command: "get <id>",
11996
12524
  describe: "Fetch a redirect",
11997
- builder: (yargs42) => withConfiguration(
12525
+ builder: (yargs44) => withConfiguration(
11998
12526
  withFormatOptions(
11999
12527
  withApiOptions(
12000
12528
  withProjectOptions(
12001
- yargs42.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12529
+ yargs44.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
12002
12530
  )
12003
12531
  )
12004
12532
  )
@@ -12021,7 +12549,7 @@ var RedirectDefinitionListModule = {
12021
12549
  command: "list",
12022
12550
  describe: "List of redirects",
12023
12551
  aliases: ["ls"],
12024
- builder: (yargs42) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs42)))),
12552
+ builder: (yargs44) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs44)))),
12025
12553
  handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
12026
12554
  const fetch2 = nodeFetchProxy(proxy);
12027
12555
  const client = getRedirectClient({ apiKey, apiHost, fetch: fetch2, projectId });
@@ -12073,12 +12601,12 @@ function createRedirectDefinitionEngineDataSource({
12073
12601
  var RedirectDefinitionPullModule = {
12074
12602
  command: "pull <directory>",
12075
12603
  describe: "Pulls all redirects to local files in a directory",
12076
- builder: (yargs42) => withConfiguration(
12604
+ builder: (yargs44) => withConfiguration(
12077
12605
  withDebugOptions(
12078
12606
  withApiOptions(
12079
12607
  withProjectOptions(
12080
12608
  withDiffOptions(
12081
- yargs42.positional("directory", {
12609
+ yargs44.positional("directory", {
12082
12610
  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
12611
  type: "string"
12084
12612
  }).option("format", {
@@ -12154,12 +12682,12 @@ var RedirectDefinitionPullModule = {
12154
12682
  var RedirectDefinitionPushModule = {
12155
12683
  command: "push <directory>",
12156
12684
  describe: "Pushes all redirects from files in a directory or package to Uniform",
12157
- builder: (yargs42) => withConfiguration(
12685
+ builder: (yargs44) => withConfiguration(
12158
12686
  withDebugOptions(
12159
12687
  withApiOptions(
12160
12688
  withProjectOptions(
12161
12689
  withDiffOptions(
12162
- yargs42.positional("directory", {
12690
+ yargs44.positional("directory", {
12163
12691
  describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
12164
12692
  type: "string"
12165
12693
  }).option("mode", {
@@ -12223,9 +12751,9 @@ var RedirectDefinitionRemoveModule = {
12223
12751
  command: "remove <id>",
12224
12752
  aliases: ["delete", "rm"],
12225
12753
  describe: "Delete a redirect",
12226
- builder: (yargs42) => withConfiguration(
12754
+ builder: (yargs44) => withConfiguration(
12227
12755
  withApiOptions(
12228
- withProjectOptions(yargs42.positional("id", { demandOption: true, describe: " UUID to delete" }))
12756
+ withProjectOptions(yargs44.positional("id", { demandOption: true, describe: " UUID to delete" }))
12229
12757
  )
12230
12758
  ),
12231
12759
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
@@ -12240,10 +12768,10 @@ var RedirectDefinitionUpdateModule = {
12240
12768
  command: "update <filename>",
12241
12769
  aliases: ["put"],
12242
12770
  describe: "Insert or update a redirect",
12243
- builder: (yargs42) => withConfiguration(
12771
+ builder: (yargs44) => withConfiguration(
12244
12772
  withApiOptions(
12245
12773
  withProjectOptions(
12246
- yargs42.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12774
+ yargs44.positional("filename", { demandOption: true, describe: "Redirect file to put" })
12247
12775
  )
12248
12776
  )
12249
12777
  ),
@@ -12259,9 +12787,9 @@ var RedirectDefinitionUpdateModule = {
12259
12787
  var RedirectDefinitionModule = {
12260
12788
  command: "definition <command>",
12261
12789
  describe: "Commands for Redirect Definitions",
12262
- builder: (yargs42) => yargs42.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12790
+ builder: (yargs44) => yargs44.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
12263
12791
  handler: () => {
12264
- yargs37.help();
12792
+ yargs39.help();
12265
12793
  }
12266
12794
  };
12267
12795
 
@@ -12270,20 +12798,20 @@ var RedirectCommand = {
12270
12798
  command: "redirect <command>",
12271
12799
  aliases: ["red"],
12272
12800
  describe: "Uniform Redirect commands",
12273
- builder: (yargs42) => yargs42.command(RedirectDefinitionModule).demandCommand(),
12801
+ builder: (yargs44) => yargs44.command(RedirectDefinitionModule).demandCommand(),
12274
12802
  handler: () => {
12275
- yargs38.showHelp();
12803
+ yargs40.showHelp();
12276
12804
  }
12277
12805
  };
12278
12806
 
12279
12807
  // src/commands/sync/index.ts
12280
- import yargs39 from "yargs";
12808
+ import yargs41 from "yargs";
12281
12809
 
12282
12810
  // src/webhooksClient.ts
12283
12811
  import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
12284
12812
  import PQueue3 from "p-queue";
12285
12813
  import { Svix } from "svix";
12286
- import * as z3 from "zod/v3";
12814
+ import * as z4 from "zod";
12287
12815
  var WEBHOOKS_DASHBOARD_BASE_PATH = "/api/v1/svix-dashboard";
12288
12816
  var WebhooksClient = class extends ApiClient4 {
12289
12817
  constructor(options) {
@@ -12303,14 +12831,14 @@ var WebhooksClient = class extends ApiClient4 {
12303
12831
  if (!key) {
12304
12832
  throw new Error("Failed to get webhooks token");
12305
12833
  }
12306
- const keySchema = z3.object({
12307
- appId: z3.string(),
12308
- oneTimeToken: z3.string(),
12309
- region: z3.enum(["us", "eu"])
12834
+ const keySchema = z4.object({
12835
+ appId: z4.string(),
12836
+ oneTimeToken: z4.string(),
12837
+ region: z4.enum(["us", "eu"])
12310
12838
  });
12311
12839
  const { appId, oneTimeToken, region } = keySchema.parse(JSON.parse(atob(key)));
12312
- const tokenSchema = z3.object({
12313
- token: z3.string()
12840
+ const tokenSchema = z4.object({
12841
+ token: z4.string()
12314
12842
  });
12315
12843
  const tokenResponse = await fetch(`https://api.${region}.svix.com/api/v1/auth/one-time-token`, {
12316
12844
  method: "POST",
@@ -12471,12 +12999,12 @@ function createWebhookEngineDataSource({
12471
12999
  var WebhookPullModule = {
12472
13000
  command: "pull <directory>",
12473
13001
  describe: "Pulls all webhooks to local files in a directory",
12474
- builder: (yargs42) => withConfiguration(
13002
+ builder: (yargs44) => withConfiguration(
12475
13003
  withApiOptions(
12476
13004
  withDebugOptions(
12477
13005
  withProjectOptions(
12478
13006
  withDiffOptions(
12479
- yargs42.positional("directory", {
13007
+ yargs44.positional("directory", {
12480
13008
  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
13009
  type: "string"
12482
13010
  }).option("format", {
@@ -12662,11 +13190,12 @@ function numPad(num, spaces = 6) {
12662
13190
  var SyncPullModule = {
12663
13191
  command: "pull",
12664
13192
  describe: "Pulls whole project to local files in a directory",
12665
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs42))))),
13193
+ builder: (yargs44) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs44))))),
12666
13194
  handler: async ({ serialization, ...otherParams }) => {
12667
13195
  const config2 = serialization;
12668
13196
  const enabledEntities = Object.entries({
12669
13197
  locale: LocalePullModule,
13198
+ label: LabelPullModule,
12670
13199
  asset: AssetPullModule,
12671
13200
  category: CategoryPullModule,
12672
13201
  workflow: WorkflowPullModule,
@@ -12761,12 +13290,12 @@ var getFormat = (entityType, config2) => {
12761
13290
  var WebhookPushModule = {
12762
13291
  command: "push <directory>",
12763
13292
  describe: "Pushes all webhooks from files in a directory to Uniform",
12764
- builder: (yargs42) => withConfiguration(
13293
+ builder: (yargs44) => withConfiguration(
12765
13294
  withDebugOptions(
12766
13295
  withApiOptions(
12767
13296
  withProjectOptions(
12768
13297
  withDiffOptions(
12769
- yargs42.positional("directory", {
13298
+ yargs44.positional("directory", {
12770
13299
  describe: "Directory to read from. If a filename is used, a package will be read instead.",
12771
13300
  type: "string"
12772
13301
  }).option("mode", {
@@ -12830,11 +13359,12 @@ var WebhookPushModule = {
12830
13359
  var SyncPushModule = {
12831
13360
  command: "push",
12832
13361
  describe: "Pushes whole project data from files in a directory or package to Uniform",
12833
- builder: (yargs42) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs42))))),
13362
+ builder: (yargs44) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs44))))),
12834
13363
  handler: async ({ serialization, ...otherParams }) => {
12835
13364
  const config2 = serialization;
12836
13365
  const enabledEntities = Object.entries({
12837
13366
  locale: LocalePushModule,
13367
+ label: LabelPushModule,
12838
13368
  asset: AssetPushModule,
12839
13369
  category: CategoryPushModule,
12840
13370
  workflow: WorkflowPushModule,
@@ -13040,21 +13570,21 @@ var getFormat2 = (entityType, config2) => {
13040
13570
  var SyncCommand = {
13041
13571
  command: "sync <command>",
13042
13572
  describe: "Uniform Sync commands",
13043
- builder: (yargs42) => yargs42.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13573
+ builder: (yargs44) => yargs44.command(SyncPullModule).command(SyncPushModule).demandCommand(),
13044
13574
  handler: () => {
13045
- yargs39.showHelp();
13575
+ yargs41.showHelp();
13046
13576
  }
13047
13577
  };
13048
13578
 
13049
13579
  // src/commands/webhook/index.ts
13050
- import yargs40 from "yargs";
13580
+ import yargs42 from "yargs";
13051
13581
  var WebhookCommand = {
13052
13582
  command: "webhook <command>",
13053
13583
  aliases: ["wh"],
13054
13584
  describe: "Commands for webhooks",
13055
- builder: (yargs42) => yargs42.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13585
+ builder: (yargs44) => yargs44.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
13056
13586
  handler: () => {
13057
- yargs40.help();
13587
+ yargs42.help();
13058
13588
  }
13059
13589
  };
13060
13590
 
@@ -13062,29 +13592,29 @@ var WebhookCommand = {
13062
13592
  import { bold as bold3, gray as gray6, green as green7 } from "colorette";
13063
13593
 
13064
13594
  // src/updateCheck.ts
13065
- import { existsSync as existsSync5, promises as fs8 } from "fs";
13595
+ import { existsSync as existsSync7, promises as fs8 } from "fs";
13066
13596
  import { get as getHttp } from "http";
13067
13597
  import { get as getHttps } from "https";
13068
- import { tmpdir } from "os";
13069
- import { join as join12 } from "path";
13598
+ import { tmpdir as tmpdir2 } from "os";
13599
+ import { join as join13 } from "path";
13070
13600
  import registryUrl from "registry-url";
13071
13601
  import { URL as URL2 } from "url";
13072
13602
  var compareVersions = (a, b) => a.localeCompare(b, "en-US", { numeric: true });
13073
13603
  var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
13074
13604
  var getFile = async (details, distTag) => {
13075
- const rootDir = tmpdir();
13076
- const subDir = join12(rootDir, "update-check");
13077
- if (!existsSync5(subDir)) {
13605
+ const rootDir = tmpdir2();
13606
+ const subDir = join13(rootDir, "update-check");
13607
+ if (!existsSync7(subDir)) {
13078
13608
  await fs8.mkdir(subDir);
13079
13609
  }
13080
13610
  let name = `${details.name}-${distTag}.json`;
13081
13611
  if (details.scope) {
13082
13612
  name = `${details.scope}-${name}`;
13083
13613
  }
13084
- return join12(subDir, name);
13614
+ return join13(subDir, name);
13085
13615
  };
13086
13616
  var evaluateCache = async (file, time, interval) => {
13087
- if (existsSync5(file)) {
13617
+ if (existsSync7(file)) {
13088
13618
  const content = await fs8.readFile(file, "utf8");
13089
13619
  const { lastUpdate, latest } = JSON.parse(content);
13090
13620
  const nextCheck = lastUpdate + interval;
@@ -13107,7 +13637,7 @@ var updateCache = async (file, latest, lastUpdate) => {
13107
13637
  });
13108
13638
  await fs8.writeFile(file, content, "utf8");
13109
13639
  };
13110
- var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve2, reject) => {
13640
+ var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve4, reject) => {
13111
13641
  const options = {
13112
13642
  host: url.hostname,
13113
13643
  path: url.pathname,
@@ -13138,7 +13668,7 @@ var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve2, reject)
13138
13668
  response.on("end", () => {
13139
13669
  try {
13140
13670
  const parsedData = JSON.parse(rawData);
13141
- resolve2(parsedData);
13671
+ resolve4(parsedData);
13142
13672
  } catch (e) {
13143
13673
  reject(e);
13144
13674
  }
@@ -13236,7 +13766,7 @@ var checkForUpdateMiddleware = async ({ verbose }) => {
13236
13766
 
13237
13767
  // src/middleware/checkLocalDepsVersionsMiddleware.ts
13238
13768
  import { magenta, red as red8 } from "colorette";
13239
- import { join as join13 } from "path";
13769
+ import { join as join14 } from "path";
13240
13770
  var uniformStrictVersions = [
13241
13771
  "@uniformdev/canvas",
13242
13772
  "@uniformdev/canvas-next",
@@ -13258,7 +13788,7 @@ var checkLocalDepsVersions = async (args) => {
13258
13788
  try {
13259
13789
  let isOutside = false;
13260
13790
  let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
13261
- const localPackages = await tryReadJSON(join13(process.cwd(), "package.json"));
13791
+ const localPackages = await tryReadJSON(join14(process.cwd(), "package.json"));
13262
13792
  if (!localPackages) return;
13263
13793
  let firstVersion;
13264
13794
  const allDependencies = {
@@ -13289,11 +13819,11 @@ First found was: v${firstVersion}`;
13289
13819
 
13290
13820
  // src/index.ts
13291
13821
  dotenv.config();
13292
- var yarggery = yargs41(hideBin(process.argv));
13822
+ var yarggery = yargs43(hideBin(process.argv));
13293
13823
  var useDefaultConfig = !process.argv.includes("--config");
13294
13824
  var defaultConfig2 = useDefaultConfig ? loadConfig(null) : {};
13295
13825
  yarggery.option("verbose", {
13296
13826
  describe: "Include verbose logging",
13297
13827
  default: false,
13298
13828
  type: "boolean"
13299
- }).scriptName("uniform").config(defaultConfig2).config("config", "Specify a custom Uniform CLI config file", (configPath) => loadConfig(configPath)).command(AiCommand).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(PolicyDocumentsCommand).command(RedirectCommand).command(WebhookCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(IntegrationCommand).recommendCommands().demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).parse();
13829
+ }).scriptName("uniform").config(defaultConfig2).config("config", "Specify a custom Uniform CLI config file", (configPath) => loadConfig(configPath)).command(AiCommand).command(AutomationCommand).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(PolicyDocumentsCommand).command(RedirectCommand).command(WebhookCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(IntegrationCommand).recommendCommands().demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).parse();