@uniformdev/cli 20.48.0 → 20.48.1-alpha.11
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/defaultConfig.d.mts +1 -1
- package/dist/defaultConfig.mjs +3 -1
- package/dist/{index-C1Ypkg3A.d.mts → index-BurxbjCD.d.mts} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1173 -556
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
import * as dotenv from "dotenv";
|
|
23
|
-
import
|
|
23
|
+
import yargs42 from "yargs";
|
|
24
24
|
import { hideBin } from "yargs/helpers";
|
|
25
25
|
|
|
26
26
|
// src/commands/ai/index.ts
|
|
@@ -150,10 +150,10 @@ var createClient = (baseUrl, authToken) => {
|
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
const requestJson = async (path8, opts,
|
|
153
|
+
const requestJson = async (path8, opts, schema, allowedNon2xxStatusCodes = []) => {
|
|
154
154
|
const res = await request2(path8, opts, allowedNon2xxStatusCodes);
|
|
155
155
|
const data = await res.json();
|
|
156
|
-
const parseResult =
|
|
156
|
+
const parseResult = schema.safeParse(data);
|
|
157
157
|
if (parseResult.success) {
|
|
158
158
|
return parseResult.data;
|
|
159
159
|
} else {
|
|
@@ -447,7 +447,7 @@ async function chooseExistingProject({
|
|
|
447
447
|
teamId,
|
|
448
448
|
user
|
|
449
449
|
}) {
|
|
450
|
-
const projects = (user.teams.find((t) => t.
|
|
450
|
+
const projects = (user.teams.find((t) => t.id === teamId)?.projects ?? []).map((t) => ({
|
|
451
451
|
name: t.name,
|
|
452
452
|
value: t.id
|
|
453
453
|
}));
|
|
@@ -503,20 +503,20 @@ var makeSpinner = () => {
|
|
|
503
503
|
async function createArraySyncEngineDataSource({
|
|
504
504
|
name,
|
|
505
505
|
objects,
|
|
506
|
-
selectIdentifier:
|
|
507
|
-
selectDisplayName:
|
|
506
|
+
selectIdentifier: selectIdentifier18,
|
|
507
|
+
selectDisplayName: selectDisplayName18 = selectIdentifier18,
|
|
508
508
|
onSyncComplete,
|
|
509
509
|
onBeforeDeleteObject
|
|
510
510
|
}) {
|
|
511
511
|
const objectIndex = objects.reduce(
|
|
512
512
|
(result, current) => {
|
|
513
|
-
const rawIdentifiers =
|
|
513
|
+
const rawIdentifiers = selectIdentifier18(current);
|
|
514
514
|
const identifiers = Array.isArray(rawIdentifiers) ? rawIdentifiers : [rawIdentifiers];
|
|
515
515
|
const existingResult = identifiers.find((id) => result[id]);
|
|
516
516
|
if (existingResult) {
|
|
517
517
|
throw new Error(`Identifier(s) ${identifiers} was not unique.`);
|
|
518
518
|
}
|
|
519
|
-
const displayName =
|
|
519
|
+
const displayName = selectDisplayName18(current);
|
|
520
520
|
result[identifiers[0]] = {
|
|
521
521
|
id: identifiers,
|
|
522
522
|
object: current,
|
|
@@ -546,7 +546,7 @@ async function createArraySyncEngineDataSource({
|
|
|
546
546
|
delete objectIndex[providerId];
|
|
547
547
|
},
|
|
548
548
|
writeObject: async (objectToWrite) => {
|
|
549
|
-
const id =
|
|
549
|
+
const id = selectIdentifier18(objectToWrite.object);
|
|
550
550
|
if (Array.isArray(id)) {
|
|
551
551
|
objectIndex[id[0]] = objectToWrite;
|
|
552
552
|
} else {
|
|
@@ -626,8 +626,8 @@ export default uniformConfig({
|
|
|
626
626
|
async function createFileSyncEngineDataSource({
|
|
627
627
|
directory,
|
|
628
628
|
format = "yaml",
|
|
629
|
-
selectIdentifier:
|
|
630
|
-
selectDisplayName:
|
|
629
|
+
selectIdentifier: selectIdentifier18,
|
|
630
|
+
selectDisplayName: selectDisplayName18 = selectIdentifier18,
|
|
631
631
|
selectFilename: selectFilename3,
|
|
632
632
|
selectSchemaUrl: selectSchemaUrl2,
|
|
633
633
|
onBeforeDeleteObject,
|
|
@@ -656,9 +656,9 @@ async function createFileSyncEngineDataSource({
|
|
|
656
656
|
const fullFilename = join(directory, filename);
|
|
657
657
|
try {
|
|
658
658
|
const contents = readFileToObject(fullFilename);
|
|
659
|
-
const displayName =
|
|
659
|
+
const displayName = selectDisplayName18(contents);
|
|
660
660
|
const object4 = {
|
|
661
|
-
id:
|
|
661
|
+
id: selectIdentifier18(contents),
|
|
662
662
|
displayName: Array.isArray(displayName) ? displayName[0] : displayName,
|
|
663
663
|
providerId: fullFilename,
|
|
664
664
|
object: omit(contents, ["$schema"])
|
|
@@ -722,7 +722,7 @@ import mitt from "mitt";
|
|
|
722
722
|
|
|
723
723
|
// src/sync/serializedDequal.ts
|
|
724
724
|
var has = Object.prototype.hasOwnProperty;
|
|
725
|
-
var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated"]);
|
|
725
|
+
var ignoredProperties = /* @__PURE__ */ new Set(["created", "modified", "updated", "createdBy", "modifiedBy", "updatedBy"]);
|
|
726
726
|
function serializedDequal(foo, bar) {
|
|
727
727
|
let ctor, len;
|
|
728
728
|
if (foo === bar) {
|
|
@@ -1033,8 +1033,8 @@ async function chooseTeam(user, prompt, telemetry) {
|
|
|
1033
1033
|
const teamId = await select3({
|
|
1034
1034
|
message: prompt,
|
|
1035
1035
|
choices: user.teams.map((team) => ({
|
|
1036
|
-
name: team.
|
|
1037
|
-
value: team.
|
|
1036
|
+
name: team.name,
|
|
1037
|
+
value: team.id
|
|
1038
1038
|
}))
|
|
1039
1039
|
});
|
|
1040
1040
|
telemetry.send("team picked", { teamId });
|
|
@@ -1042,56 +1042,39 @@ async function chooseTeam(user, prompt, telemetry) {
|
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
1044
|
// src/auth/user-info.ts
|
|
1045
|
+
import { ProjectClient } from "@uniformdev/canvas";
|
|
1045
1046
|
import { gql, request } from "graphql-request";
|
|
1046
1047
|
import * as z2 from "zod/v3";
|
|
1047
|
-
var
|
|
1048
|
-
query
|
|
1048
|
+
var identityQuery = gql`
|
|
1049
|
+
query GetUserIdentity($subject: String!) {
|
|
1049
1050
|
info: identities_by_pk(subject: $subject) {
|
|
1050
1051
|
name
|
|
1051
1052
|
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
1053
|
}
|
|
1063
1054
|
}
|
|
1064
1055
|
`;
|
|
1065
|
-
var
|
|
1056
|
+
var identitySchema = z2.object({
|
|
1066
1057
|
info: z2.object({
|
|
1067
1058
|
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
|
-
)
|
|
1059
|
+
email_address: z2.string().min(1).nullable()
|
|
1083
1060
|
})
|
|
1084
1061
|
});
|
|
1085
1062
|
var getUserInfo = async (baseUrl, authToken, subject) => {
|
|
1086
1063
|
try {
|
|
1087
|
-
const
|
|
1088
|
-
const
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1064
|
+
const headers = { Authorization: `Bearer ${authToken}` };
|
|
1065
|
+
const projectClient = new ProjectClient({ apiHost: baseUrl, bearerToken: authToken });
|
|
1066
|
+
const [identityRes, projectsRes] = await Promise.all([
|
|
1067
|
+
request(makeUrl(baseUrl, "/v1/graphql"), identityQuery, { subject }, headers),
|
|
1068
|
+
projectClient.getProjects()
|
|
1069
|
+
]);
|
|
1070
|
+
const identityParsed = identitySchema.safeParse(identityRes);
|
|
1071
|
+
if (!identityParsed.success) {
|
|
1072
|
+
throw new Error(`Invalid identity response: ${identityParsed.error.message}`);
|
|
1094
1073
|
}
|
|
1074
|
+
return {
|
|
1075
|
+
...identityParsed.data.info,
|
|
1076
|
+
teams: projectsRes.teams
|
|
1077
|
+
};
|
|
1095
1078
|
} catch (err) {
|
|
1096
1079
|
throw new Error(`Failed to fetch user account:
|
|
1097
1080
|
${err.message}`);
|
|
@@ -1124,7 +1107,7 @@ import { PostHog } from "posthog-node";
|
|
|
1124
1107
|
// package.json
|
|
1125
1108
|
var package_default = {
|
|
1126
1109
|
name: "@uniformdev/cli",
|
|
1127
|
-
version: "20.
|
|
1110
|
+
version: "20.56.0",
|
|
1128
1111
|
description: "Uniform command line interface tool",
|
|
1129
1112
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
1130
1113
|
main: "./cli.js",
|
|
@@ -1180,7 +1163,7 @@ var package_default = {
|
|
|
1180
1163
|
open: "10.2.0",
|
|
1181
1164
|
ora: "8.0.1",
|
|
1182
1165
|
"p-queue": "7.3.4",
|
|
1183
|
-
"posthog-node": "5.
|
|
1166
|
+
"posthog-node": "5.28.5",
|
|
1184
1167
|
"registry-auth-token": "^5.0.0",
|
|
1185
1168
|
"registry-url": "^6.0.0",
|
|
1186
1169
|
slugify: "1.6.6",
|
|
@@ -1343,16 +1326,12 @@ function getMcpDirectory(agentType, customDir) {
|
|
|
1343
1326
|
// src/commands/ai/lib/mcp.ts
|
|
1344
1327
|
import { yellow as yellow2 } from "colorette";
|
|
1345
1328
|
import { existsSync as existsSync3, readFileSync } from "fs";
|
|
1346
|
-
function createUniformMcpServerConfig(apiKey, projectId, aiApiHost,
|
|
1329
|
+
function createUniformMcpServerConfig(apiKey, projectId, aiApiHost, _apiHost) {
|
|
1347
1330
|
return {
|
|
1348
|
-
type: "
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
UNIFORM_API_KEY: apiKey,
|
|
1353
|
-
UNIFORM_PROJECT_ID: projectId,
|
|
1354
|
-
UNIFORM_AI_API_HOST: aiApiHost,
|
|
1355
|
-
UNIFORM_API_HOST: apiHost
|
|
1331
|
+
type: "streamable-http",
|
|
1332
|
+
url: `${aiApiHost}/projects/${projectId}/mcp`,
|
|
1333
|
+
headers: {
|
|
1334
|
+
"x-api-key": apiKey
|
|
1356
1335
|
}
|
|
1357
1336
|
};
|
|
1358
1337
|
}
|
|
@@ -1407,8 +1386,8 @@ function getExistingServers(config2) {
|
|
|
1407
1386
|
var InstallMcpCommand = {
|
|
1408
1387
|
command: "install",
|
|
1409
1388
|
describe: "Install Uniform MCP server configuration (use --team, --project, and --apiKey for non-interactive mode)",
|
|
1410
|
-
builder: (
|
|
1411
|
-
|
|
1389
|
+
builder: (yargs43) => withConfiguration(
|
|
1390
|
+
yargs43.option("agent", {
|
|
1412
1391
|
alias: "a",
|
|
1413
1392
|
describe: "Specify agent type (cursor, claude, copilot, other)",
|
|
1414
1393
|
type: "string",
|
|
@@ -1560,7 +1539,7 @@ Selected agent: ${agentType}`));
|
|
|
1560
1539
|
if (isNonInteractive) {
|
|
1561
1540
|
console.log(`\u{1F3E2} Team ID: ${teamId}`);
|
|
1562
1541
|
} else {
|
|
1563
|
-
console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.
|
|
1542
|
+
console.log(`\u{1F3E2} Team: ${user.teams.find((t) => t.id === teamId)?.name}`);
|
|
1564
1543
|
}
|
|
1565
1544
|
console.log(`\u{1F4E6} Project: ${projectName} (${projectId})`);
|
|
1566
1545
|
if (agentType === "cursor") {
|
|
@@ -1608,7 +1587,7 @@ Selected agent: ${agentType}`));
|
|
|
1608
1587
|
var McpCommand = {
|
|
1609
1588
|
command: "mcp <command>",
|
|
1610
1589
|
describe: "Uniform MCP server management commands",
|
|
1611
|
-
builder: (
|
|
1590
|
+
builder: (yargs43) => yargs43.command(InstallMcpCommand).demandCommand(),
|
|
1612
1591
|
handler: () => {
|
|
1613
1592
|
yargs.showHelp();
|
|
1614
1593
|
}
|
|
@@ -2083,8 +2062,8 @@ ${gray2("Rules source:")} https://github.com/uniformdev/ai-rules`);
|
|
|
2083
2062
|
var InstallRulesCommand = {
|
|
2084
2063
|
command: "install",
|
|
2085
2064
|
describe: "Install Uniform AI rules for your development assistant",
|
|
2086
|
-
builder: (
|
|
2087
|
-
|
|
2065
|
+
builder: (yargs43) => withConfiguration(
|
|
2066
|
+
yargs43.option("agent", {
|
|
2088
2067
|
alias: "a",
|
|
2089
2068
|
describe: "Specify agent type (cursor, claude, copilot, other)",
|
|
2090
2069
|
type: "string",
|
|
@@ -2122,7 +2101,7 @@ import { blue as blue4, bold as bold2, gray as gray3, green as green5, red as re
|
|
|
2122
2101
|
var ListRulesCommand = {
|
|
2123
2102
|
command: "list",
|
|
2124
2103
|
describe: "List available Uniform AI rules",
|
|
2125
|
-
builder: (
|
|
2104
|
+
builder: (yargs43) => withConfiguration(yargs43),
|
|
2126
2105
|
handler: async function() {
|
|
2127
2106
|
const { stopAllSpinners, spin } = makeSpinner();
|
|
2128
2107
|
try {
|
|
@@ -2151,7 +2130,7 @@ var ListRulesCommand = {
|
|
|
2151
2130
|
var RulesCommand = {
|
|
2152
2131
|
command: "rules <command>",
|
|
2153
2132
|
describe: "Uniform AI rules management commands",
|
|
2154
|
-
builder: (
|
|
2133
|
+
builder: (yargs43) => yargs43.command(InstallRulesCommand).command(ListRulesCommand).demandCommand(),
|
|
2155
2134
|
handler: () => {
|
|
2156
2135
|
yargs2.showHelp();
|
|
2157
2136
|
}
|
|
@@ -2161,14 +2140,14 @@ var RulesCommand = {
|
|
|
2161
2140
|
var AiCommand = {
|
|
2162
2141
|
command: "ai <command>",
|
|
2163
2142
|
describe: "Uniform AI development assistant commands",
|
|
2164
|
-
builder: (
|
|
2143
|
+
builder: (yargs43) => yargs43.command(RulesCommand).command(McpCommand).demandCommand(),
|
|
2165
2144
|
handler: () => {
|
|
2166
2145
|
yargs3.showHelp();
|
|
2167
2146
|
}
|
|
2168
2147
|
};
|
|
2169
2148
|
|
|
2170
2149
|
// src/commands/canvas/index.ts
|
|
2171
|
-
import
|
|
2150
|
+
import yargs21 from "yargs";
|
|
2172
2151
|
|
|
2173
2152
|
// src/commands/canvas/commands/asset.ts
|
|
2174
2153
|
import yargs4 from "yargs";
|
|
@@ -2200,12 +2179,12 @@ function getFileClient(options) {
|
|
|
2200
2179
|
var AssetGetModule = {
|
|
2201
2180
|
command: "get <id>",
|
|
2202
2181
|
describe: "Get an asset",
|
|
2203
|
-
builder: (
|
|
2182
|
+
builder: (yargs43) => withConfiguration(
|
|
2204
2183
|
withDebugOptions(
|
|
2205
2184
|
withFormatOptions(
|
|
2206
2185
|
withApiOptions(
|
|
2207
2186
|
withProjectOptions(
|
|
2208
|
-
|
|
2187
|
+
yargs43.positional("id", { demandOption: true, describe: "Asset ID to fetch" })
|
|
2209
2188
|
)
|
|
2210
2189
|
)
|
|
2211
2190
|
)
|
|
@@ -2226,7 +2205,7 @@ var AssetGetModule = {
|
|
|
2226
2205
|
var AssetListModule = {
|
|
2227
2206
|
command: "list",
|
|
2228
2207
|
describe: "List assets",
|
|
2229
|
-
builder: (
|
|
2208
|
+
builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
|
|
2230
2209
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
2231
2210
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
2232
2211
|
const client = getAssetClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -2480,7 +2459,7 @@ import {
|
|
|
2480
2459
|
walkNodeTree,
|
|
2481
2460
|
walkPropertyValues
|
|
2482
2461
|
} from "@uniformdev/canvas";
|
|
2483
|
-
var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu
|
|
2462
|
+
var UNIFORM_FILE_MATCH = /"(https:\/\/([^"]*?)?(img|files)\.(eu([1-9]\d*)?\.)?uniform\.(rocks|global)\/([^"]*?))"/g;
|
|
2484
2463
|
var walkFileUrlsForCompositionOrEntry = ({
|
|
2485
2464
|
entity,
|
|
2486
2465
|
callback
|
|
@@ -2616,6 +2595,15 @@ var compareCompositionsOrEntriesWithoutAssetUrls = (source, target) => {
|
|
|
2616
2595
|
removeUrlsFromAssetParameters(structuredClone(target.object))
|
|
2617
2596
|
);
|
|
2618
2597
|
};
|
|
2598
|
+
var PUBLISH_TIMESTAMP_TOLERANCE_MS = 2e3;
|
|
2599
|
+
var compareCompositionsOrEntriesWithoutAssetUrlsForPublishing = (source, target) => {
|
|
2600
|
+
const sourceModified = new Date(source.object.modified).getTime();
|
|
2601
|
+
const targetModified = new Date(target.object.modified).getTime();
|
|
2602
|
+
if (sourceModified - targetModified > PUBLISH_TIMESTAMP_TOLERANCE_MS) {
|
|
2603
|
+
return false;
|
|
2604
|
+
}
|
|
2605
|
+
return compareCompositionsOrEntriesWithoutAssetUrls(source, target);
|
|
2606
|
+
};
|
|
2619
2607
|
var removeUrlFromAsset = (asset) => {
|
|
2620
2608
|
if (asset.asset.fields?.url?.value) {
|
|
2621
2609
|
asset.asset.fields.url.value = "";
|
|
@@ -2754,7 +2742,7 @@ var escapeRegExp = (string4) => {
|
|
|
2754
2742
|
var findUrlMatchingPartialPathname = (source, pathname) => {
|
|
2755
2743
|
const escapedPathname = escapeRegExp(pathname);
|
|
2756
2744
|
const regex = new RegExp(
|
|
2757
|
-
`"(https://([^"]*?)?(img|files).uniform.(rocks|global)${escapedPathname}([^"]*?))"`
|
|
2745
|
+
`"(https://([^"]*?)?(img|files).(eu([1-9]\\d*)?\\.)?uniform.(rocks|global)${escapedPathname}([^"]*?))"`
|
|
2758
2746
|
);
|
|
2759
2747
|
const match = source.match(regex);
|
|
2760
2748
|
if (match && match[1]) {
|
|
@@ -2779,8 +2767,8 @@ function prepCompositionForDisk(composition) {
|
|
|
2779
2767
|
delete prepped.state;
|
|
2780
2768
|
return prepped;
|
|
2781
2769
|
}
|
|
2782
|
-
function withStateOptions(
|
|
2783
|
-
return
|
|
2770
|
+
function withStateOptions(yargs43, defaultState = "preview") {
|
|
2771
|
+
return yargs43.option("state", {
|
|
2784
2772
|
type: "string",
|
|
2785
2773
|
describe: `State to fetch.`,
|
|
2786
2774
|
choices: ["preview", "published"],
|
|
@@ -2862,12 +2850,12 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
2862
2850
|
var AssetPullModule = {
|
|
2863
2851
|
command: "pull <directory>",
|
|
2864
2852
|
describe: "Pulls all assets to local files in a directory",
|
|
2865
|
-
builder: (
|
|
2853
|
+
builder: (yargs43) => withConfiguration(
|
|
2866
2854
|
withApiOptions(
|
|
2867
2855
|
withDebugOptions(
|
|
2868
2856
|
withProjectOptions(
|
|
2869
2857
|
withDiffOptions(
|
|
2870
|
-
|
|
2858
|
+
yargs43.positional("directory", {
|
|
2871
2859
|
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.",
|
|
2872
2860
|
type: "string"
|
|
2873
2861
|
}).option("format", {
|
|
@@ -2979,12 +2967,12 @@ var AssetPullModule = {
|
|
|
2979
2967
|
var AssetPushModule = {
|
|
2980
2968
|
command: "push <directory>",
|
|
2981
2969
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
2982
|
-
builder: (
|
|
2970
|
+
builder: (yargs43) => withConfiguration(
|
|
2983
2971
|
withApiOptions(
|
|
2984
2972
|
withDebugOptions(
|
|
2985
2973
|
withProjectOptions(
|
|
2986
2974
|
withDiffOptions(
|
|
2987
|
-
|
|
2975
|
+
yargs43.positional("directory", {
|
|
2988
2976
|
describe: "Directory to read the assets from. If a filename is used, a package will be read instead.",
|
|
2989
2977
|
type: "string"
|
|
2990
2978
|
}).option("mode", {
|
|
@@ -3108,10 +3096,10 @@ var AssetRemoveModule = {
|
|
|
3108
3096
|
command: "remove <id>",
|
|
3109
3097
|
aliases: ["delete", "rm"],
|
|
3110
3098
|
describe: "Delete an asset",
|
|
3111
|
-
builder: (
|
|
3099
|
+
builder: (yargs43) => withConfiguration(
|
|
3112
3100
|
withDebugOptions(
|
|
3113
3101
|
withApiOptions(
|
|
3114
|
-
withProjectOptions(
|
|
3102
|
+
withProjectOptions(yargs43.positional("id", { demandOption: true, describe: "Asset ID to delete" }))
|
|
3115
3103
|
)
|
|
3116
3104
|
)
|
|
3117
3105
|
),
|
|
@@ -3132,11 +3120,11 @@ var AssetUpdateModule = {
|
|
|
3132
3120
|
command: "update <filename>",
|
|
3133
3121
|
aliases: ["put"],
|
|
3134
3122
|
describe: "Insert or update an asset",
|
|
3135
|
-
builder: (
|
|
3123
|
+
builder: (yargs43) => withConfiguration(
|
|
3136
3124
|
withDebugOptions(
|
|
3137
3125
|
withApiOptions(
|
|
3138
3126
|
withProjectOptions(
|
|
3139
|
-
|
|
3127
|
+
yargs43.positional("filename", { demandOption: true, describe: "Asset file to put" })
|
|
3140
3128
|
)
|
|
3141
3129
|
)
|
|
3142
3130
|
)
|
|
@@ -3162,7 +3150,7 @@ var AssetUpdateModule = {
|
|
|
3162
3150
|
var AssetModule = {
|
|
3163
3151
|
command: "asset <command>",
|
|
3164
3152
|
describe: "Commands for Assets",
|
|
3165
|
-
builder: (
|
|
3153
|
+
builder: (yargs43) => yargs43.command(AssetGetModule).command(AssetListModule).command(AssetRemoveModule).command(AssetUpdateModule).command(AssetPullModule).command(AssetPushModule).demandCommand(),
|
|
3166
3154
|
handler: () => {
|
|
3167
3155
|
yargs4.help();
|
|
3168
3156
|
}
|
|
@@ -3183,12 +3171,12 @@ function getCategoryClient(options) {
|
|
|
3183
3171
|
var CategoryGetModule = {
|
|
3184
3172
|
command: "get <id>",
|
|
3185
3173
|
describe: "Fetch a category",
|
|
3186
|
-
builder: (
|
|
3174
|
+
builder: (yargs43) => withConfiguration(
|
|
3187
3175
|
withFormatOptions(
|
|
3188
3176
|
withDebugOptions(
|
|
3189
3177
|
withApiOptions(
|
|
3190
3178
|
withProjectOptions(
|
|
3191
|
-
|
|
3179
|
+
yargs43.positional("id", { demandOption: true, describe: "Category UUID to fetch" })
|
|
3192
3180
|
)
|
|
3193
3181
|
)
|
|
3194
3182
|
)
|
|
@@ -3213,8 +3201,8 @@ var CategoryListModule = {
|
|
|
3213
3201
|
command: "list",
|
|
3214
3202
|
describe: "List categories",
|
|
3215
3203
|
aliases: ["ls"],
|
|
3216
|
-
builder: (
|
|
3217
|
-
withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(
|
|
3204
|
+
builder: (yargs43) => withConfiguration(
|
|
3205
|
+
withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs43.options({})))))
|
|
3218
3206
|
),
|
|
3219
3207
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
3220
3208
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
@@ -3258,12 +3246,12 @@ function createCategoriesEngineDataSource({
|
|
|
3258
3246
|
var CategoryPullModule = {
|
|
3259
3247
|
command: "pull <directory>",
|
|
3260
3248
|
describe: "Pulls all categories to local files in a directory",
|
|
3261
|
-
builder: (
|
|
3249
|
+
builder: (yargs43) => withConfiguration(
|
|
3262
3250
|
withApiOptions(
|
|
3263
3251
|
withProjectOptions(
|
|
3264
3252
|
withDiffOptions(
|
|
3265
3253
|
withDebugOptions(
|
|
3266
|
-
|
|
3254
|
+
yargs43.positional("directory", {
|
|
3267
3255
|
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.",
|
|
3268
3256
|
type: "string"
|
|
3269
3257
|
}).option("format", {
|
|
@@ -3338,12 +3326,12 @@ var CategoryPullModule = {
|
|
|
3338
3326
|
var CategoryPushModule = {
|
|
3339
3327
|
command: "push <directory>",
|
|
3340
3328
|
describe: "Pushes all categories from files in a directory to Uniform Canvas",
|
|
3341
|
-
builder: (
|
|
3329
|
+
builder: (yargs43) => withConfiguration(
|
|
3342
3330
|
withApiOptions(
|
|
3343
3331
|
withDebugOptions(
|
|
3344
3332
|
withProjectOptions(
|
|
3345
3333
|
withDiffOptions(
|
|
3346
|
-
|
|
3334
|
+
yargs43.positional("directory", {
|
|
3347
3335
|
describe: "Directory to read the categories from. If a filename is used, a package will be read instead.",
|
|
3348
3336
|
type: "string"
|
|
3349
3337
|
}).option("mode", {
|
|
@@ -3407,11 +3395,11 @@ var CategoryRemoveModule = {
|
|
|
3407
3395
|
command: "remove <id>",
|
|
3408
3396
|
aliases: ["delete", "rm"],
|
|
3409
3397
|
describe: "Delete a category",
|
|
3410
|
-
builder: (
|
|
3398
|
+
builder: (yargs43) => withConfiguration(
|
|
3411
3399
|
withApiOptions(
|
|
3412
3400
|
withDebugOptions(
|
|
3413
3401
|
withProjectOptions(
|
|
3414
|
-
|
|
3402
|
+
yargs43.positional("id", { demandOption: true, describe: "Category UUID to delete" })
|
|
3415
3403
|
)
|
|
3416
3404
|
)
|
|
3417
3405
|
)
|
|
@@ -3432,11 +3420,11 @@ var CategoryUpdateModule = {
|
|
|
3432
3420
|
command: "update <filename>",
|
|
3433
3421
|
aliases: ["put"],
|
|
3434
3422
|
describe: "Insert or update a category",
|
|
3435
|
-
builder: (
|
|
3423
|
+
builder: (yargs43) => withConfiguration(
|
|
3436
3424
|
withApiOptions(
|
|
3437
3425
|
withDebugOptions(
|
|
3438
3426
|
withProjectOptions(
|
|
3439
|
-
|
|
3427
|
+
yargs43.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
3440
3428
|
)
|
|
3441
3429
|
)
|
|
3442
3430
|
)
|
|
@@ -3458,7 +3446,7 @@ var CategoryModule = {
|
|
|
3458
3446
|
command: "category <command>",
|
|
3459
3447
|
aliases: ["cat"],
|
|
3460
3448
|
describe: "Commands for Canvas categories",
|
|
3461
|
-
builder: (
|
|
3449
|
+
builder: (yargs43) => yargs43.command(CategoryPullModule).command(CategoryPushModule).command(CategoryGetModule).command(CategoryRemoveModule).command(CategoryListModule).command(CategoryUpdateModule).demandCommand(),
|
|
3462
3450
|
handler: () => {
|
|
3463
3451
|
yargs5.help();
|
|
3464
3452
|
}
|
|
@@ -3480,12 +3468,12 @@ function getCanvasClient(options) {
|
|
|
3480
3468
|
var ComponentGetModule = {
|
|
3481
3469
|
command: "get <id>",
|
|
3482
3470
|
describe: "Fetch a component definition",
|
|
3483
|
-
builder: (
|
|
3471
|
+
builder: (yargs43) => withConfiguration(
|
|
3484
3472
|
withFormatOptions(
|
|
3485
3473
|
withDebugOptions(
|
|
3486
3474
|
withApiOptions(
|
|
3487
3475
|
withProjectOptions(
|
|
3488
|
-
|
|
3476
|
+
yargs43.positional("id", {
|
|
3489
3477
|
demandOption: true,
|
|
3490
3478
|
describe: "Component definition public ID to fetch"
|
|
3491
3479
|
})
|
|
@@ -3519,12 +3507,12 @@ var ComponentListModule = {
|
|
|
3519
3507
|
command: "list",
|
|
3520
3508
|
describe: "List component definitions",
|
|
3521
3509
|
aliases: ["ls"],
|
|
3522
|
-
builder: (
|
|
3510
|
+
builder: (yargs43) => withConfiguration(
|
|
3523
3511
|
withFormatOptions(
|
|
3524
3512
|
withDebugOptions(
|
|
3525
3513
|
withApiOptions(
|
|
3526
3514
|
withProjectOptions(
|
|
3527
|
-
|
|
3515
|
+
yargs43.options({
|
|
3528
3516
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3529
3517
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 }
|
|
3530
3518
|
})
|
|
@@ -3593,12 +3581,12 @@ function createComponentDefinitionEngineDataSource({
|
|
|
3593
3581
|
var ComponentPullModule = {
|
|
3594
3582
|
command: "pull <directory>",
|
|
3595
3583
|
describe: "Pulls all component definitions to local files in a directory",
|
|
3596
|
-
builder: (
|
|
3584
|
+
builder: (yargs43) => withConfiguration(
|
|
3597
3585
|
withApiOptions(
|
|
3598
3586
|
withDebugOptions(
|
|
3599
3587
|
withProjectOptions(
|
|
3600
3588
|
withDiffOptions(
|
|
3601
|
-
|
|
3589
|
+
yargs43.positional("directory", {
|
|
3602
3590
|
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.",
|
|
3603
3591
|
type: "string"
|
|
3604
3592
|
}).option("format", {
|
|
@@ -3674,12 +3662,12 @@ var ComponentPullModule = {
|
|
|
3674
3662
|
var ComponentPushModule = {
|
|
3675
3663
|
command: "push <directory>",
|
|
3676
3664
|
describe: "Pushes all component definitions from files in a directory to Uniform Canvas",
|
|
3677
|
-
builder: (
|
|
3665
|
+
builder: (yargs43) => withConfiguration(
|
|
3678
3666
|
withApiOptions(
|
|
3679
3667
|
withDebugOptions(
|
|
3680
3668
|
withProjectOptions(
|
|
3681
3669
|
withDiffOptions(
|
|
3682
|
-
|
|
3670
|
+
yargs43.positional("directory", {
|
|
3683
3671
|
describe: "Directory to read the component definitions from. If a filename is used, a package will be read instead.",
|
|
3684
3672
|
type: "string"
|
|
3685
3673
|
}).option("mode", {
|
|
@@ -3744,11 +3732,11 @@ var ComponentRemoveModule = {
|
|
|
3744
3732
|
command: "remove <id>",
|
|
3745
3733
|
aliases: ["delete", "rm"],
|
|
3746
3734
|
describe: "Delete a component definition",
|
|
3747
|
-
builder: (
|
|
3735
|
+
builder: (yargs43) => withConfiguration(
|
|
3748
3736
|
withDebugOptions(
|
|
3749
3737
|
withApiOptions(
|
|
3750
3738
|
withProjectOptions(
|
|
3751
|
-
|
|
3739
|
+
yargs43.positional("id", {
|
|
3752
3740
|
demandOption: true,
|
|
3753
3741
|
describe: "Component definition public ID to delete"
|
|
3754
3742
|
})
|
|
@@ -3772,11 +3760,11 @@ var ComponentUpdateModule = {
|
|
|
3772
3760
|
command: "update <filename>",
|
|
3773
3761
|
aliases: ["put"],
|
|
3774
3762
|
describe: "Insert or update a component definition",
|
|
3775
|
-
builder: (
|
|
3763
|
+
builder: (yargs43) => withConfiguration(
|
|
3776
3764
|
withApiOptions(
|
|
3777
3765
|
withDebugOptions(
|
|
3778
3766
|
withProjectOptions(
|
|
3779
|
-
|
|
3767
|
+
yargs43.positional("filename", { demandOption: true, describe: "Component definition file to put" })
|
|
3780
3768
|
)
|
|
3781
3769
|
)
|
|
3782
3770
|
)
|
|
@@ -3798,7 +3786,7 @@ var ComponentModule = {
|
|
|
3798
3786
|
command: "component <command>",
|
|
3799
3787
|
aliases: ["def"],
|
|
3800
3788
|
describe: "Commands for Canvas component definitions",
|
|
3801
|
-
builder: (
|
|
3789
|
+
builder: (yargs43) => yargs43.command(ComponentPullModule).command(ComponentPushModule).command(ComponentGetModule).command(ComponentRemoveModule).command(ComponentListModule).command(ComponentUpdateModule).demandCommand(),
|
|
3802
3790
|
handler: () => {
|
|
3803
3791
|
yargs6.help();
|
|
3804
3792
|
}
|
|
@@ -3811,13 +3799,13 @@ import yargs7 from "yargs";
|
|
|
3811
3799
|
var CompositionGetModule = {
|
|
3812
3800
|
command: "get <id>",
|
|
3813
3801
|
describe: "Fetch a composition",
|
|
3814
|
-
builder: (
|
|
3802
|
+
builder: (yargs43) => withFormatOptions(
|
|
3815
3803
|
withConfiguration(
|
|
3816
3804
|
withApiOptions(
|
|
3817
3805
|
withProjectOptions(
|
|
3818
3806
|
withStateOptions(
|
|
3819
3807
|
withDebugOptions(
|
|
3820
|
-
|
|
3808
|
+
yargs43.positional("id", {
|
|
3821
3809
|
demandOption: true,
|
|
3822
3810
|
describe: "Composition/pattern public ID to fetch"
|
|
3823
3811
|
}).option({
|
|
@@ -3907,13 +3895,13 @@ var CompositionListModule = {
|
|
|
3907
3895
|
command: "list",
|
|
3908
3896
|
describe: "List compositions",
|
|
3909
3897
|
aliases: ["ls"],
|
|
3910
|
-
builder: (
|
|
3898
|
+
builder: (yargs43) => withFormatOptions(
|
|
3911
3899
|
withConfiguration(
|
|
3912
3900
|
withApiOptions(
|
|
3913
3901
|
withProjectOptions(
|
|
3914
3902
|
withDebugOptions(
|
|
3915
3903
|
withStateOptions(
|
|
3916
|
-
|
|
3904
|
+
yargs43.options({
|
|
3917
3905
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
3918
3906
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
3919
3907
|
search: { describe: "Search query", type: "string", default: "" },
|
|
@@ -3994,13 +3982,13 @@ var CompositionListModule = {
|
|
|
3994
3982
|
var ComponentPatternListModule = {
|
|
3995
3983
|
...CompositionListModule,
|
|
3996
3984
|
describe: "List component patterns",
|
|
3997
|
-
builder: (
|
|
3985
|
+
builder: (yargs43) => withFormatOptions(
|
|
3998
3986
|
withConfiguration(
|
|
3999
3987
|
withApiOptions(
|
|
4000
3988
|
withDebugOptions(
|
|
4001
3989
|
withProjectOptions(
|
|
4002
3990
|
withStateOptions(
|
|
4003
|
-
|
|
3991
|
+
yargs43.options({
|
|
4004
3992
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
4005
3993
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
4006
3994
|
resolvePatterns: {
|
|
@@ -4123,12 +4111,12 @@ function createComponentInstanceEngineDataSource({
|
|
|
4123
4111
|
var CompositionPublishModule = {
|
|
4124
4112
|
command: "publish [ids]",
|
|
4125
4113
|
describe: "Publishes composition(s)",
|
|
4126
|
-
builder: (
|
|
4114
|
+
builder: (yargs43) => withConfiguration(
|
|
4127
4115
|
withApiOptions(
|
|
4128
4116
|
withProjectOptions(
|
|
4129
4117
|
withDebugOptions(
|
|
4130
4118
|
withDiffOptions(
|
|
4131
|
-
|
|
4119
|
+
yargs43.positional("ids", {
|
|
4132
4120
|
describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4133
4121
|
type: "string"
|
|
4134
4122
|
}).option("all", {
|
|
@@ -4205,7 +4193,7 @@ var CompositionPublishModule = {
|
|
|
4205
4193
|
fileClient
|
|
4206
4194
|
});
|
|
4207
4195
|
},
|
|
4208
|
-
compareContents:
|
|
4196
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
4209
4197
|
onBeforeWriteObject: async (sourceObject) => {
|
|
4210
4198
|
return uploadFilesForCompositionOrEntry({
|
|
4211
4199
|
entity: sourceObject,
|
|
@@ -4221,12 +4209,12 @@ var CompositionPublishModule = {
|
|
|
4221
4209
|
var ComponentPatternPublishModule = {
|
|
4222
4210
|
...CompositionPublishModule,
|
|
4223
4211
|
describe: "Publishes component pattern(s)",
|
|
4224
|
-
builder: (
|
|
4212
|
+
builder: (yargs43) => withConfiguration(
|
|
4225
4213
|
withApiOptions(
|
|
4226
4214
|
withDebugOptions(
|
|
4227
4215
|
withProjectOptions(
|
|
4228
4216
|
withDiffOptions(
|
|
4229
|
-
|
|
4217
|
+
yargs43.positional("ids", {
|
|
4230
4218
|
describe: "Publishes component pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4231
4219
|
type: "string"
|
|
4232
4220
|
}).option("all", {
|
|
@@ -4266,13 +4254,13 @@ function componentInstancePullModuleFactory(type) {
|
|
|
4266
4254
|
return {
|
|
4267
4255
|
command: "pull <directory>",
|
|
4268
4256
|
describe: "Pulls all compositions to local files in a directory",
|
|
4269
|
-
builder: (
|
|
4257
|
+
builder: (yargs43) => withConfiguration(
|
|
4270
4258
|
withApiOptions(
|
|
4271
4259
|
withProjectOptions(
|
|
4272
4260
|
withStateOptions(
|
|
4273
4261
|
withDebugOptions(
|
|
4274
4262
|
withDiffOptions(
|
|
4275
|
-
|
|
4263
|
+
yargs43.positional("directory", {
|
|
4276
4264
|
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.",
|
|
4277
4265
|
type: "string"
|
|
4278
4266
|
}).option("format", {
|
|
@@ -4387,13 +4375,13 @@ function componentInstancePullModuleFactory(type) {
|
|
|
4387
4375
|
var ComponentPatternPullModule = {
|
|
4388
4376
|
...componentInstancePullModuleFactory("componentPatterns"),
|
|
4389
4377
|
describe: "Pulls all component patterns to local files in a directory",
|
|
4390
|
-
builder: (
|
|
4378
|
+
builder: (yargs43) => withConfiguration(
|
|
4391
4379
|
withApiOptions(
|
|
4392
4380
|
withProjectOptions(
|
|
4393
4381
|
withDebugOptions(
|
|
4394
4382
|
withStateOptions(
|
|
4395
4383
|
withDiffOptions(
|
|
4396
|
-
|
|
4384
|
+
yargs43.positional("directory", {
|
|
4397
4385
|
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.",
|
|
4398
4386
|
type: "string"
|
|
4399
4387
|
}).option("format", {
|
|
@@ -4467,13 +4455,13 @@ function componentInstancePushModuleFactory(type) {
|
|
|
4467
4455
|
return {
|
|
4468
4456
|
command: "push <directory>",
|
|
4469
4457
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
4470
|
-
builder: (
|
|
4458
|
+
builder: (yargs43) => withConfiguration(
|
|
4471
4459
|
withApiOptions(
|
|
4472
4460
|
withProjectOptions(
|
|
4473
4461
|
withStateOptions(
|
|
4474
4462
|
withDebugOptions(
|
|
4475
4463
|
withDiffOptions(
|
|
4476
|
-
|
|
4464
|
+
yargs43.positional("directory", {
|
|
4477
4465
|
describe: "Directory to read the compositions/patterns from. If a filename is used, a package will be read instead.",
|
|
4478
4466
|
type: "string"
|
|
4479
4467
|
}).option("mode", {
|
|
@@ -4587,13 +4575,13 @@ function componentInstancePushModuleFactory(type) {
|
|
|
4587
4575
|
var ComponentPatternPushModule = {
|
|
4588
4576
|
...componentInstancePushModuleFactory("componentPatterns"),
|
|
4589
4577
|
describe: "Pushes all component patterns from files in a directory to Uniform Canvas",
|
|
4590
|
-
builder: (
|
|
4578
|
+
builder: (yargs43) => withConfiguration(
|
|
4591
4579
|
withApiOptions(
|
|
4592
4580
|
withProjectOptions(
|
|
4593
4581
|
withStateOptions(
|
|
4594
4582
|
withDiffOptions(
|
|
4595
4583
|
withDebugOptions(
|
|
4596
|
-
|
|
4584
|
+
yargs43.positional("directory", {
|
|
4597
4585
|
describe: "Directory to read the compositions/component patterns from. If a filename is used, a package will be read instead.",
|
|
4598
4586
|
type: "string"
|
|
4599
4587
|
}).option("mode", {
|
|
@@ -4627,11 +4615,11 @@ var CompositionRemoveModule = {
|
|
|
4627
4615
|
command: "remove <id>",
|
|
4628
4616
|
aliases: ["delete", "rm"],
|
|
4629
4617
|
describe: "Delete a composition",
|
|
4630
|
-
builder: (
|
|
4618
|
+
builder: (yargs43) => withConfiguration(
|
|
4631
4619
|
withApiOptions(
|
|
4632
4620
|
withDebugOptions(
|
|
4633
4621
|
withProjectOptions(
|
|
4634
|
-
|
|
4622
|
+
yargs43.positional("id", {
|
|
4635
4623
|
demandOption: true,
|
|
4636
4624
|
describe: "Composition/pattern public ID to delete"
|
|
4637
4625
|
})
|
|
@@ -4660,29 +4648,32 @@ var ComponentPatternRemoveModule = {
|
|
|
4660
4648
|
};
|
|
4661
4649
|
|
|
4662
4650
|
// src/commands/canvas/commands/composition/unpublish.ts
|
|
4663
|
-
import {
|
|
4651
|
+
import {
|
|
4652
|
+
ApiClientError,
|
|
4653
|
+
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
|
|
4654
|
+
} from "@uniformdev/canvas";
|
|
4664
4655
|
import { diffJson as diffJson2 } from "diff";
|
|
4665
4656
|
var CompositionUnpublishModule = {
|
|
4666
4657
|
command: "unpublish [ids]",
|
|
4667
4658
|
describe: "Unpublish a composition(s)",
|
|
4668
|
-
builder: (
|
|
4659
|
+
builder: (yargs43) => withConfiguration(
|
|
4669
4660
|
withApiOptions(
|
|
4670
4661
|
withDebugOptions(
|
|
4671
4662
|
withProjectOptions(
|
|
4672
|
-
|
|
4663
|
+
yargs43.positional("ids", {
|
|
4673
4664
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4674
4665
|
type: "string"
|
|
4675
4666
|
}).option("all", {
|
|
4676
4667
|
alias: ["a"],
|
|
4677
|
-
describe: "Un-publishes all compositions. Use
|
|
4668
|
+
describe: "Un-publishes all compositions. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
4678
4669
|
default: false,
|
|
4679
4670
|
type: "boolean"
|
|
4680
4671
|
}).option("onlyCompositions", {
|
|
4681
|
-
describe: "Only publishing compositions and not patterns",
|
|
4672
|
+
describe: "Only un-publishing compositions and not patterns",
|
|
4682
4673
|
default: false,
|
|
4683
4674
|
type: "boolean"
|
|
4684
4675
|
}).option("onlyPatterns", {
|
|
4685
|
-
describe: "Only
|
|
4676
|
+
describe: "Only un-publishing patterns and not compositions",
|
|
4686
4677
|
default: false,
|
|
4687
4678
|
type: "boolean",
|
|
4688
4679
|
hidden: true
|
|
@@ -4705,7 +4696,7 @@ var CompositionUnpublishModule = {
|
|
|
4705
4696
|
verbose
|
|
4706
4697
|
}) => {
|
|
4707
4698
|
if (!all && !ids || all && ids) {
|
|
4708
|
-
console.error(`Specify --all or composition ID(s) to
|
|
4699
|
+
console.error(`Specify --all or composition ID(s) to unpublish.`);
|
|
4709
4700
|
process.exit(1);
|
|
4710
4701
|
}
|
|
4711
4702
|
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -4730,7 +4721,6 @@ var CompositionUnpublishModule = {
|
|
|
4730
4721
|
patternType,
|
|
4731
4722
|
verbose
|
|
4732
4723
|
});
|
|
4733
|
-
const actions = [];
|
|
4734
4724
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
4735
4725
|
for await (const obj of target.objects) {
|
|
4736
4726
|
if (Array.isArray(obj.id)) {
|
|
@@ -4739,16 +4729,30 @@ var CompositionUnpublishModule = {
|
|
|
4739
4729
|
targetItems.set(obj.id, obj);
|
|
4740
4730
|
}
|
|
4741
4731
|
}
|
|
4732
|
+
const toUnpublish = [];
|
|
4742
4733
|
for await (const sourceObject of source.objects) {
|
|
4734
|
+
toUnpublish.push(sourceObject);
|
|
4735
|
+
}
|
|
4736
|
+
const actions = [];
|
|
4737
|
+
for (const sourceObject of toUnpublish) {
|
|
4743
4738
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
4744
4739
|
const targetObject = targetItems.get(id);
|
|
4745
4740
|
if (!targetObject) {
|
|
4746
|
-
console.log(`Composition ${id}
|
|
4747
|
-
return;
|
|
4741
|
+
console.log(`Composition ${id} did not have a draft (removing published)`);
|
|
4748
4742
|
}
|
|
4749
|
-
console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
|
|
4750
4743
|
if (!whatIf) {
|
|
4751
|
-
actions.push(
|
|
4744
|
+
actions.push(
|
|
4745
|
+
client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
|
|
4746
|
+
const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
|
|
4747
|
+
if (isNotFound) {
|
|
4748
|
+
console.warn(
|
|
4749
|
+
`Composition ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
4750
|
+
);
|
|
4751
|
+
return;
|
|
4752
|
+
}
|
|
4753
|
+
throw err;
|
|
4754
|
+
})
|
|
4755
|
+
);
|
|
4752
4756
|
}
|
|
4753
4757
|
log2({
|
|
4754
4758
|
action: "update",
|
|
@@ -4756,9 +4760,10 @@ var CompositionUnpublishModule = {
|
|
|
4756
4760
|
providerId: sourceObject.providerId,
|
|
4757
4761
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
4758
4762
|
whatIf,
|
|
4759
|
-
diff: () => diffJson2(targetObject.object, sourceObject.object)
|
|
4763
|
+
diff: () => targetObject ? diffJson2(targetObject.object, sourceObject.object) : []
|
|
4760
4764
|
});
|
|
4761
4765
|
}
|
|
4766
|
+
await Promise.all(actions);
|
|
4762
4767
|
}
|
|
4763
4768
|
};
|
|
4764
4769
|
|
|
@@ -4766,16 +4771,16 @@ var CompositionUnpublishModule = {
|
|
|
4766
4771
|
var ComponentPatternUnpublishModule = {
|
|
4767
4772
|
command: "unpublish [ids]",
|
|
4768
4773
|
describe: "Unpublish a component pattern(s)",
|
|
4769
|
-
builder: (
|
|
4774
|
+
builder: (yargs43) => withConfiguration(
|
|
4770
4775
|
withApiOptions(
|
|
4771
4776
|
withDebugOptions(
|
|
4772
4777
|
withProjectOptions(
|
|
4773
|
-
|
|
4778
|
+
yargs43.positional("ids", {
|
|
4774
4779
|
describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
4775
4780
|
type: "string"
|
|
4776
4781
|
}).option("all", {
|
|
4777
4782
|
alias: ["a"],
|
|
4778
|
-
describe: "Un-publishes all
|
|
4783
|
+
describe: "Un-publishes all component patterns. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
4779
4784
|
default: false,
|
|
4780
4785
|
type: "boolean"
|
|
4781
4786
|
}).option("onlyCompositions", {
|
|
@@ -4804,12 +4809,12 @@ var CompositionUpdateModule = {
|
|
|
4804
4809
|
command: "update <filename>",
|
|
4805
4810
|
aliases: ["put"],
|
|
4806
4811
|
describe: "Insert or update a composition",
|
|
4807
|
-
builder: (
|
|
4812
|
+
builder: (yargs43) => withConfiguration(
|
|
4808
4813
|
withApiOptions(
|
|
4809
4814
|
withProjectOptions(
|
|
4810
4815
|
withDebugOptions(
|
|
4811
4816
|
withStateOptions(
|
|
4812
|
-
|
|
4817
|
+
yargs43.positional("filename", {
|
|
4813
4818
|
demandOption: true,
|
|
4814
4819
|
describe: "Composition/pattern file to put"
|
|
4815
4820
|
})
|
|
@@ -4847,7 +4852,7 @@ var ComponentPatternUpdateModule = {
|
|
|
4847
4852
|
var ComponentPatternModule = {
|
|
4848
4853
|
command: "component-pattern <command>",
|
|
4849
4854
|
describe: "Commands for Canvas component patterns",
|
|
4850
|
-
builder: (
|
|
4855
|
+
builder: (yargs43) => yargs43.command(ComponentPatternPullModule).command(ComponentPatternPushModule).command(ComponentPatternGetModule).command(ComponentPatternRemoveModule).command(ComponentPatternListModule).command(ComponentPatternUpdateModule).command(ComponentPatternPublishModule).command(ComponentPatternUnpublishModule).demandCommand(),
|
|
4851
4856
|
handler: () => {
|
|
4852
4857
|
yargs7.help();
|
|
4853
4858
|
}
|
|
@@ -4859,7 +4864,7 @@ var CompositionModule = {
|
|
|
4859
4864
|
command: "composition <command>",
|
|
4860
4865
|
describe: "Commands for Canvas compositions",
|
|
4861
4866
|
aliases: ["comp"],
|
|
4862
|
-
builder: (
|
|
4867
|
+
builder: (yargs43) => yargs43.command(CompositionPullModule).command(CompositionPushModule).command(CompositionGetModule).command(CompositionRemoveModule).command(CompositionListModule).command(CompositionUpdateModule).command(CompositionPublishModule).command(CompositionUnpublishModule).demandCommand(),
|
|
4863
4868
|
handler: () => {
|
|
4864
4869
|
yargs8.help();
|
|
4865
4870
|
}
|
|
@@ -4878,13 +4883,13 @@ var CompositionPatternGetModule = {
|
|
|
4878
4883
|
var CompositionPatternListModule = {
|
|
4879
4884
|
...CompositionListModule,
|
|
4880
4885
|
describe: "List composition patterns",
|
|
4881
|
-
builder: (
|
|
4886
|
+
builder: (yargs43) => withFormatOptions(
|
|
4882
4887
|
withConfiguration(
|
|
4883
4888
|
withApiOptions(
|
|
4884
4889
|
withDebugOptions(
|
|
4885
4890
|
withProjectOptions(
|
|
4886
4891
|
withStateOptions(
|
|
4887
|
-
|
|
4892
|
+
yargs43.options({
|
|
4888
4893
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
4889
4894
|
limit: { describe: "Number of rows to fetch", type: "number", default: 20 },
|
|
4890
4895
|
resolvePatterns: {
|
|
@@ -4928,12 +4933,12 @@ var CompositionPatternListModule = {
|
|
|
4928
4933
|
var CompositionPatternPublishModule = {
|
|
4929
4934
|
...CompositionPublishModule,
|
|
4930
4935
|
describe: "Publishes composition pattern(s)",
|
|
4931
|
-
builder: (
|
|
4936
|
+
builder: (yargs43) => withConfiguration(
|
|
4932
4937
|
withApiOptions(
|
|
4933
4938
|
withDebugOptions(
|
|
4934
4939
|
withProjectOptions(
|
|
4935
4940
|
withDiffOptions(
|
|
4936
|
-
|
|
4941
|
+
yargs43.positional("ids", {
|
|
4937
4942
|
describe: "Publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
4938
4943
|
type: "string"
|
|
4939
4944
|
}).option("all", {
|
|
@@ -4972,13 +4977,13 @@ var CompositionPatternPublishModule = {
|
|
|
4972
4977
|
var CompositionPatternPullModule = {
|
|
4973
4978
|
...componentInstancePullModuleFactory("compositionPatterns"),
|
|
4974
4979
|
describe: "Pulls all composition patterns to local files in a directory",
|
|
4975
|
-
builder: (
|
|
4980
|
+
builder: (yargs43) => withConfiguration(
|
|
4976
4981
|
withApiOptions(
|
|
4977
4982
|
withDebugOptions(
|
|
4978
4983
|
withProjectOptions(
|
|
4979
4984
|
withStateOptions(
|
|
4980
4985
|
withDiffOptions(
|
|
4981
|
-
|
|
4986
|
+
yargs43.positional("directory", {
|
|
4982
4987
|
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.",
|
|
4983
4988
|
type: "string"
|
|
4984
4989
|
}).option("format", {
|
|
@@ -5016,13 +5021,13 @@ var CompositionPatternPullModule = {
|
|
|
5016
5021
|
var CompositionPatternPushModule = {
|
|
5017
5022
|
...componentInstancePushModuleFactory("compositionPatterns"),
|
|
5018
5023
|
describe: "Pushes all composition patterns from files in a directory to Uniform Canvas",
|
|
5019
|
-
builder: (
|
|
5024
|
+
builder: (yargs43) => withConfiguration(
|
|
5020
5025
|
withApiOptions(
|
|
5021
5026
|
withDebugOptions(
|
|
5022
5027
|
withProjectOptions(
|
|
5023
5028
|
withStateOptions(
|
|
5024
5029
|
withDiffOptions(
|
|
5025
|
-
|
|
5030
|
+
yargs43.positional("directory", {
|
|
5026
5031
|
describe: "Directory to read the compositions patterns from. If a filename is used, a package will be read instead.",
|
|
5027
5032
|
type: "string"
|
|
5028
5033
|
}).option("mode", {
|
|
@@ -5061,16 +5066,16 @@ var CompositionPatternRemoveModule = {
|
|
|
5061
5066
|
var CompositionPatternUnpublishModule = {
|
|
5062
5067
|
command: "unpublish [ids]",
|
|
5063
5068
|
describe: "Unpublish a composition pattern(s)",
|
|
5064
|
-
builder: (
|
|
5069
|
+
builder: (yargs43) => withConfiguration(
|
|
5065
5070
|
withApiOptions(
|
|
5066
5071
|
withDebugOptions(
|
|
5067
5072
|
withProjectOptions(
|
|
5068
|
-
|
|
5073
|
+
yargs43.positional("ids", {
|
|
5069
5074
|
describe: "Un-publishes composition pattern(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
5070
5075
|
type: "string"
|
|
5071
5076
|
}).option("all", {
|
|
5072
5077
|
alias: ["a"],
|
|
5073
|
-
describe: "Un-publishes all
|
|
5078
|
+
describe: "Un-publishes all composition patterns. Use composition ID(s) to unpublish specific one(s) instead.",
|
|
5074
5079
|
default: false,
|
|
5075
5080
|
type: "boolean"
|
|
5076
5081
|
}).option("onlyCompositions", {
|
|
@@ -5101,7 +5106,7 @@ var CompositionPatternUpdateModule = {
|
|
|
5101
5106
|
var CompositionPatternModule = {
|
|
5102
5107
|
command: "composition-pattern <command>",
|
|
5103
5108
|
describe: "Commands for Canvas composition patterns",
|
|
5104
|
-
builder: (
|
|
5109
|
+
builder: (yargs43) => yargs43.command(CompositionPatternPullModule).command(CompositionPatternPushModule).command(CompositionPatternGetModule).command(CompositionPatternRemoveModule).command(CompositionPatternListModule).command(CompositionPatternUpdateModule).command(CompositionPatternPublishModule).command(CompositionPatternUnpublishModule).demandCommand(),
|
|
5105
5110
|
handler: () => {
|
|
5106
5111
|
yargs9.help();
|
|
5107
5112
|
}
|
|
@@ -5122,12 +5127,12 @@ function getContentClient(options) {
|
|
|
5122
5127
|
var ContentTypeGetModule = {
|
|
5123
5128
|
command: "get <id>",
|
|
5124
5129
|
describe: "Get a content type",
|
|
5125
|
-
builder: (
|
|
5130
|
+
builder: (yargs43) => withConfiguration(
|
|
5126
5131
|
withDebugOptions(
|
|
5127
5132
|
withFormatOptions(
|
|
5128
5133
|
withApiOptions(
|
|
5129
5134
|
withProjectOptions(
|
|
5130
|
-
|
|
5135
|
+
yargs43.positional("id", {
|
|
5131
5136
|
demandOption: true,
|
|
5132
5137
|
describe: "Content type public ID to fetch"
|
|
5133
5138
|
})
|
|
@@ -5152,7 +5157,7 @@ var ContentTypeGetModule = {
|
|
|
5152
5157
|
var ContentTypeListModule = {
|
|
5153
5158
|
command: "list",
|
|
5154
5159
|
describe: "List content types",
|
|
5155
|
-
builder: (
|
|
5160
|
+
builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
|
|
5156
5161
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
5157
5162
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
5158
5163
|
const client = getContentClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -5193,12 +5198,12 @@ function createContentTypeEngineDataSource({
|
|
|
5193
5198
|
var ContentTypePullModule = {
|
|
5194
5199
|
command: "pull <directory>",
|
|
5195
5200
|
describe: "Pulls all content types to local files in a directory",
|
|
5196
|
-
builder: (
|
|
5201
|
+
builder: (yargs43) => withConfiguration(
|
|
5197
5202
|
withApiOptions(
|
|
5198
5203
|
withDebugOptions(
|
|
5199
5204
|
withProjectOptions(
|
|
5200
5205
|
withDiffOptions(
|
|
5201
|
-
|
|
5206
|
+
yargs43.positional("directory", {
|
|
5202
5207
|
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.",
|
|
5203
5208
|
type: "string"
|
|
5204
5209
|
}).option("format", {
|
|
@@ -5278,12 +5283,12 @@ var ContentTypePullModule = {
|
|
|
5278
5283
|
var ContentTypePushModule = {
|
|
5279
5284
|
command: "push <directory>",
|
|
5280
5285
|
describe: "Pushes all content types from files in a directory to Uniform",
|
|
5281
|
-
builder: (
|
|
5286
|
+
builder: (yargs43) => withConfiguration(
|
|
5282
5287
|
withApiOptions(
|
|
5283
5288
|
withDebugOptions(
|
|
5284
5289
|
withProjectOptions(
|
|
5285
5290
|
withDiffOptions(
|
|
5286
|
-
|
|
5291
|
+
yargs43.positional("directory", {
|
|
5287
5292
|
describe: "Directory to read the content types from. If a filename is used, a package will be read instead.",
|
|
5288
5293
|
type: "string"
|
|
5289
5294
|
}).option("what-if", {
|
|
@@ -5357,11 +5362,11 @@ var ContentTypeRemoveModule = {
|
|
|
5357
5362
|
command: "remove <id>",
|
|
5358
5363
|
aliases: ["delete", "rm"],
|
|
5359
5364
|
describe: "Delete a content type",
|
|
5360
|
-
builder: (
|
|
5365
|
+
builder: (yargs43) => withConfiguration(
|
|
5361
5366
|
withDebugOptions(
|
|
5362
5367
|
withApiOptions(
|
|
5363
5368
|
withProjectOptions(
|
|
5364
|
-
|
|
5369
|
+
yargs43.positional("id", { demandOption: true, describe: "Content type public ID to delete" })
|
|
5365
5370
|
)
|
|
5366
5371
|
)
|
|
5367
5372
|
)
|
|
@@ -5382,11 +5387,11 @@ var ContentTypeUpdateModule = {
|
|
|
5382
5387
|
command: "update <filename>",
|
|
5383
5388
|
aliases: ["put"],
|
|
5384
5389
|
describe: "Insert or update a content type",
|
|
5385
|
-
builder: (
|
|
5390
|
+
builder: (yargs43) => withConfiguration(
|
|
5386
5391
|
withDebugOptions(
|
|
5387
5392
|
withApiOptions(
|
|
5388
5393
|
withProjectOptions(
|
|
5389
|
-
|
|
5394
|
+
yargs43.positional("filename", { demandOption: true, describe: "Content type file to put" })
|
|
5390
5395
|
)
|
|
5391
5396
|
)
|
|
5392
5397
|
)
|
|
@@ -5408,7 +5413,7 @@ var ContentTypeModule = {
|
|
|
5408
5413
|
command: "contenttype <command>",
|
|
5409
5414
|
aliases: ["ct"],
|
|
5410
5415
|
describe: "Commands for Content Types",
|
|
5411
|
-
builder: (
|
|
5416
|
+
builder: (yargs43) => yargs43.command(ContentTypeGetModule).command(ContentTypeListModule).command(ContentTypeRemoveModule).command(ContentTypeUpdateModule).command(ContentTypePullModule).command(ContentTypePushModule).demandCommand(),
|
|
5412
5417
|
handler: () => {
|
|
5413
5418
|
yargs10.help();
|
|
5414
5419
|
}
|
|
@@ -5427,11 +5432,11 @@ function getDataSourceClient(options) {
|
|
|
5427
5432
|
var DataSourceGetModule = {
|
|
5428
5433
|
command: "get <id>",
|
|
5429
5434
|
describe: "Get a data source by ID and writes to stdout. Please note this may contain secret data, use discretion.",
|
|
5430
|
-
builder: (
|
|
5435
|
+
builder: (yargs43) => withConfiguration(
|
|
5431
5436
|
withApiOptions(
|
|
5432
5437
|
withDebugOptions(
|
|
5433
5438
|
withProjectOptions(
|
|
5434
|
-
|
|
5439
|
+
yargs43.positional("id", { demandOption: true, describe: "Data source public ID to fetch" })
|
|
5435
5440
|
)
|
|
5436
5441
|
)
|
|
5437
5442
|
)
|
|
@@ -5449,11 +5454,11 @@ var DataSourceRemoveModule = {
|
|
|
5449
5454
|
command: "remove <id>",
|
|
5450
5455
|
aliases: ["delete", "rm"],
|
|
5451
5456
|
describe: "Delete a data source",
|
|
5452
|
-
builder: (
|
|
5457
|
+
builder: (yargs43) => withConfiguration(
|
|
5453
5458
|
withDebugOptions(
|
|
5454
5459
|
withApiOptions(
|
|
5455
5460
|
withProjectOptions(
|
|
5456
|
-
|
|
5461
|
+
yargs43.positional("id", { demandOption: true, describe: "Data source public ID to delete" })
|
|
5457
5462
|
)
|
|
5458
5463
|
)
|
|
5459
5464
|
)
|
|
@@ -5474,11 +5479,11 @@ var DataSourceUpdateModule = {
|
|
|
5474
5479
|
command: "update <dataSource>",
|
|
5475
5480
|
aliases: ["put"],
|
|
5476
5481
|
describe: "Insert or update a data source",
|
|
5477
|
-
builder: (
|
|
5482
|
+
builder: (yargs43) => withConfiguration(
|
|
5478
5483
|
withApiOptions(
|
|
5479
5484
|
withDebugOptions(
|
|
5480
5485
|
withProjectOptions(
|
|
5481
|
-
|
|
5486
|
+
yargs43.positional("dataSource", { demandOption: true, describe: "Data source JSON to put" }).option("integrationType", {
|
|
5482
5487
|
describe: "Integration type that exposes the connector type for this data source (as defined in integration manifest).",
|
|
5483
5488
|
type: "string",
|
|
5484
5489
|
demandOption: true
|
|
@@ -5513,7 +5518,7 @@ var DataSourceModule = {
|
|
|
5513
5518
|
command: "datasource <command>",
|
|
5514
5519
|
aliases: ["ds"],
|
|
5515
5520
|
describe: "Commands for Data Source definitions",
|
|
5516
|
-
builder: (
|
|
5521
|
+
builder: (yargs43) => yargs43.command(DataSourceGetModule).command(DataSourceRemoveModule).command(DataSourceUpdateModule).demandCommand(),
|
|
5517
5522
|
handler: () => {
|
|
5518
5523
|
yargs11.help();
|
|
5519
5524
|
}
|
|
@@ -5535,12 +5540,12 @@ var DataTypeGetModule = {
|
|
|
5535
5540
|
command: "get <id>",
|
|
5536
5541
|
describe: "Get a data type",
|
|
5537
5542
|
aliases: ["ls"],
|
|
5538
|
-
builder: (
|
|
5543
|
+
builder: (yargs43) => withConfiguration(
|
|
5539
5544
|
withFormatOptions(
|
|
5540
5545
|
withDebugOptions(
|
|
5541
5546
|
withApiOptions(
|
|
5542
5547
|
withProjectOptions(
|
|
5543
|
-
|
|
5548
|
+
yargs43.positional("id", { demandOption: true, describe: "Data type public ID to fetch" })
|
|
5544
5549
|
)
|
|
5545
5550
|
)
|
|
5546
5551
|
)
|
|
@@ -5563,7 +5568,7 @@ var DataTypeListModule = {
|
|
|
5563
5568
|
command: "list",
|
|
5564
5569
|
describe: "List data types",
|
|
5565
5570
|
aliases: ["ls"],
|
|
5566
|
-
builder: (
|
|
5571
|
+
builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
|
|
5567
5572
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
5568
5573
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
5569
5574
|
const client = getDataTypeClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -5606,12 +5611,12 @@ function createDataTypeEngineDataSource({
|
|
|
5606
5611
|
var DataTypePullModule = {
|
|
5607
5612
|
command: "pull <directory>",
|
|
5608
5613
|
describe: "Pulls all data types to local files in a directory",
|
|
5609
|
-
builder: (
|
|
5614
|
+
builder: (yargs43) => withConfiguration(
|
|
5610
5615
|
withApiOptions(
|
|
5611
5616
|
withDebugOptions(
|
|
5612
5617
|
withProjectOptions(
|
|
5613
5618
|
withDiffOptions(
|
|
5614
|
-
|
|
5619
|
+
yargs43.positional("directory", {
|
|
5615
5620
|
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.",
|
|
5616
5621
|
type: "string"
|
|
5617
5622
|
}).option("format", {
|
|
@@ -5691,12 +5696,12 @@ var DataTypePullModule = {
|
|
|
5691
5696
|
var DataTypePushModule = {
|
|
5692
5697
|
command: "push <directory>",
|
|
5693
5698
|
describe: "Pushes all data types from files in a directory to Uniform",
|
|
5694
|
-
builder: (
|
|
5699
|
+
builder: (yargs43) => withConfiguration(
|
|
5695
5700
|
withApiOptions(
|
|
5696
5701
|
withDebugOptions(
|
|
5697
5702
|
withProjectOptions(
|
|
5698
5703
|
withDiffOptions(
|
|
5699
|
-
|
|
5704
|
+
yargs43.positional("directory", {
|
|
5700
5705
|
describe: "Directory to read the data types from. If a filename is used, a package will be read instead.",
|
|
5701
5706
|
type: "string"
|
|
5702
5707
|
}).option("mode", {
|
|
@@ -5765,11 +5770,11 @@ var DataTypeRemoveModule = {
|
|
|
5765
5770
|
command: "remove <id>",
|
|
5766
5771
|
aliases: ["delete", "rm"],
|
|
5767
5772
|
describe: "Delete a data type",
|
|
5768
|
-
builder: (
|
|
5773
|
+
builder: (yargs43) => withConfiguration(
|
|
5769
5774
|
withDebugOptions(
|
|
5770
5775
|
withApiOptions(
|
|
5771
5776
|
withProjectOptions(
|
|
5772
|
-
|
|
5777
|
+
yargs43.positional("id", { demandOption: true, describe: "Data type public ID to delete" })
|
|
5773
5778
|
)
|
|
5774
5779
|
)
|
|
5775
5780
|
)
|
|
@@ -5790,11 +5795,11 @@ var DataTypeUpdateModule = {
|
|
|
5790
5795
|
command: "update <filename>",
|
|
5791
5796
|
aliases: ["put"],
|
|
5792
5797
|
describe: "Insert or update a data type",
|
|
5793
|
-
builder: (
|
|
5798
|
+
builder: (yargs43) => withConfiguration(
|
|
5794
5799
|
withDebugOptions(
|
|
5795
5800
|
withApiOptions(
|
|
5796
5801
|
withProjectOptions(
|
|
5797
|
-
|
|
5802
|
+
yargs43.positional("filename", { demandOption: true, describe: "Data type file to put" })
|
|
5798
5803
|
)
|
|
5799
5804
|
)
|
|
5800
5805
|
)
|
|
@@ -5816,7 +5821,7 @@ var DataTypeModule = {
|
|
|
5816
5821
|
command: "datatype <command>",
|
|
5817
5822
|
aliases: ["dt"],
|
|
5818
5823
|
describe: "Commands for Data Type definitions",
|
|
5819
|
-
builder: (
|
|
5824
|
+
builder: (yargs43) => yargs43.command(DataTypeGetModule).command(DataTypePullModule).command(DataTypePushModule).command(DataTypeRemoveModule).command(DataTypeListModule).command(DataTypeUpdateModule).demandCommand(),
|
|
5820
5825
|
handler: () => {
|
|
5821
5826
|
yargs12.help();
|
|
5822
5827
|
}
|
|
@@ -5829,13 +5834,13 @@ import yargs13 from "yargs";
|
|
|
5829
5834
|
var EntryGetModule = {
|
|
5830
5835
|
command: "get <id>",
|
|
5831
5836
|
describe: "Get an entry",
|
|
5832
|
-
builder: (
|
|
5837
|
+
builder: (yargs43) => withConfiguration(
|
|
5833
5838
|
withDebugOptions(
|
|
5834
5839
|
withFormatOptions(
|
|
5835
5840
|
withApiOptions(
|
|
5836
5841
|
withProjectOptions(
|
|
5837
5842
|
withStateOptions(
|
|
5838
|
-
|
|
5843
|
+
yargs43.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }).option({
|
|
5839
5844
|
resolveData: {
|
|
5840
5845
|
type: "boolean",
|
|
5841
5846
|
default: false,
|
|
@@ -5907,13 +5912,13 @@ var LEGACY_DEFAULT_LIMIT = 1e3;
|
|
|
5907
5912
|
var EntryListModule = {
|
|
5908
5913
|
command: "list",
|
|
5909
5914
|
describe: "List entries",
|
|
5910
|
-
builder: (
|
|
5915
|
+
builder: (yargs43) => withConfiguration(
|
|
5911
5916
|
withDebugOptions(
|
|
5912
5917
|
withFormatOptions(
|
|
5913
5918
|
withApiOptions(
|
|
5914
5919
|
withProjectOptions(
|
|
5915
5920
|
withStateOptions(
|
|
5916
|
-
|
|
5921
|
+
yargs43.options({
|
|
5917
5922
|
offset: { describe: "Number of rows to skip before fetching", type: "number", default: 0 },
|
|
5918
5923
|
limit: {
|
|
5919
5924
|
describe: "Number of rows to fetch",
|
|
@@ -5968,7 +5973,7 @@ var EntryListModule = {
|
|
|
5968
5973
|
};
|
|
5969
5974
|
|
|
5970
5975
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
5971
|
-
import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
5976
|
+
import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
5972
5977
|
|
|
5973
5978
|
// src/commands/canvas/commands/entry/_util.ts
|
|
5974
5979
|
var selectEntryIdentifier = (e) => {
|
|
@@ -6014,7 +6019,7 @@ function createEntryEngineDataSource({
|
|
|
6014
6019
|
editions: "all"
|
|
6015
6020
|
})).entries;
|
|
6016
6021
|
} catch (error) {
|
|
6017
|
-
if (error instanceof
|
|
6022
|
+
if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
|
|
6018
6023
|
return [];
|
|
6019
6024
|
}
|
|
6020
6025
|
throw error;
|
|
@@ -6048,12 +6053,12 @@ function createEntryEngineDataSource({
|
|
|
6048
6053
|
var EntryPublishModule = {
|
|
6049
6054
|
command: "publish [ids]",
|
|
6050
6055
|
describe: "Publishes entry(ies)",
|
|
6051
|
-
builder: (
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6056
|
+
builder: (yargs43) => withConfiguration(
|
|
6057
|
+
withDebugOptions(
|
|
6058
|
+
withDiffOptions(
|
|
6059
|
+
withApiOptions(
|
|
6060
|
+
withProjectOptions(
|
|
6061
|
+
yargs43.positional("ids", {
|
|
6057
6062
|
describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
6058
6063
|
type: "string"
|
|
6059
6064
|
}).option("all", {
|
|
@@ -6112,7 +6117,7 @@ var EntryPublishModule = {
|
|
|
6112
6117
|
fileClient
|
|
6113
6118
|
});
|
|
6114
6119
|
},
|
|
6115
|
-
compareContents:
|
|
6120
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
6116
6121
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6117
6122
|
return uploadFilesForCompositionOrEntry({
|
|
6118
6123
|
entity: sourceObject,
|
|
@@ -6128,13 +6133,13 @@ var EntryPublishModule = {
|
|
|
6128
6133
|
var EntryPullModule = {
|
|
6129
6134
|
command: "pull <directory>",
|
|
6130
6135
|
describe: "Pulls all entries to local files in a directory",
|
|
6131
|
-
builder: (
|
|
6136
|
+
builder: (yargs43) => withConfiguration(
|
|
6132
6137
|
withDebugOptions(
|
|
6133
6138
|
withApiOptions(
|
|
6134
6139
|
withProjectOptions(
|
|
6135
6140
|
withStateOptions(
|
|
6136
6141
|
withDiffOptions(
|
|
6137
|
-
|
|
6142
|
+
yargs43.positional("directory", {
|
|
6138
6143
|
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.",
|
|
6139
6144
|
type: "string"
|
|
6140
6145
|
}).option("format", {
|
|
@@ -6234,13 +6239,13 @@ var EntryPullModule = {
|
|
|
6234
6239
|
var EntryPushModule = {
|
|
6235
6240
|
command: "push <directory>",
|
|
6236
6241
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
6237
|
-
builder: (
|
|
6242
|
+
builder: (yargs43) => withConfiguration(
|
|
6238
6243
|
withDebugOptions(
|
|
6239
6244
|
withApiOptions(
|
|
6240
6245
|
withProjectOptions(
|
|
6241
6246
|
withStateOptions(
|
|
6242
6247
|
withDiffOptions(
|
|
6243
|
-
|
|
6248
|
+
yargs43.positional("directory", {
|
|
6244
6249
|
describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
|
|
6245
6250
|
type: "string"
|
|
6246
6251
|
}).option("mode", {
|
|
@@ -6339,11 +6344,11 @@ var EntryRemoveModule = {
|
|
|
6339
6344
|
command: "remove <id>",
|
|
6340
6345
|
aliases: ["delete", "rm"],
|
|
6341
6346
|
describe: "Delete an entry",
|
|
6342
|
-
builder: (
|
|
6347
|
+
builder: (yargs43) => withConfiguration(
|
|
6343
6348
|
withDebugOptions(
|
|
6344
6349
|
withApiOptions(
|
|
6345
6350
|
withProjectOptions(
|
|
6346
|
-
|
|
6351
|
+
yargs43.positional("id", { demandOption: true, describe: "Entry public ID to delete" })
|
|
6347
6352
|
)
|
|
6348
6353
|
)
|
|
6349
6354
|
)
|
|
@@ -6360,16 +6365,16 @@ var EntryRemoveModule = {
|
|
|
6360
6365
|
};
|
|
6361
6366
|
|
|
6362
6367
|
// src/commands/canvas/commands/entry/unpublish.ts
|
|
6363
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
6368
|
+
import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
|
|
6364
6369
|
import { diffJson as diffJson3 } from "diff";
|
|
6365
6370
|
var EntryUnpublishModule = {
|
|
6366
6371
|
command: "unpublish [ids]",
|
|
6367
6372
|
describe: "Unpublish an entry(ies)",
|
|
6368
|
-
builder: (
|
|
6373
|
+
builder: (yargs43) => withConfiguration(
|
|
6369
6374
|
withDebugOptions(
|
|
6370
6375
|
withApiOptions(
|
|
6371
6376
|
withProjectOptions(
|
|
6372
|
-
|
|
6377
|
+
yargs43.positional("ids", {
|
|
6373
6378
|
describe: "Un-publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
6374
6379
|
type: "string"
|
|
6375
6380
|
}).option("all", {
|
|
@@ -6384,7 +6389,7 @@ var EntryUnpublishModule = {
|
|
|
6384
6389
|
),
|
|
6385
6390
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
6386
6391
|
if (!all && !ids || all && ids) {
|
|
6387
|
-
console.error(`Specify --all or entry ID(s) to
|
|
6392
|
+
console.error(`Specify --all or entry ID(s) to unpublish.`);
|
|
6388
6393
|
process.exit(1);
|
|
6389
6394
|
}
|
|
6390
6395
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -6403,7 +6408,6 @@ var EntryUnpublishModule = {
|
|
|
6403
6408
|
entryIDs: entryIDsArray,
|
|
6404
6409
|
onlyEntries: true
|
|
6405
6410
|
});
|
|
6406
|
-
const actions = [];
|
|
6407
6411
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
6408
6412
|
for await (const obj of target.objects) {
|
|
6409
6413
|
if (Array.isArray(obj.id)) {
|
|
@@ -6412,15 +6416,30 @@ var EntryUnpublishModule = {
|
|
|
6412
6416
|
targetItems.set(obj.id, obj);
|
|
6413
6417
|
}
|
|
6414
6418
|
}
|
|
6419
|
+
const toUnpublish = [];
|
|
6415
6420
|
for await (const sourceObject of source.objects) {
|
|
6421
|
+
toUnpublish.push(sourceObject);
|
|
6422
|
+
}
|
|
6423
|
+
const actions = [];
|
|
6424
|
+
for (const sourceObject of toUnpublish) {
|
|
6416
6425
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
6417
6426
|
const targetObject = targetItems.get(id);
|
|
6418
6427
|
if (!targetObject) {
|
|
6419
|
-
console.log(`Entry ${id}
|
|
6420
|
-
return;
|
|
6428
|
+
console.log(`Entry ${id} did not have a draft (removing published)`);
|
|
6421
6429
|
}
|
|
6422
6430
|
if (!whatIf) {
|
|
6423
|
-
actions.push(
|
|
6431
|
+
actions.push(
|
|
6432
|
+
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
|
|
6433
|
+
const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
|
|
6434
|
+
if (isNotFound) {
|
|
6435
|
+
console.warn(
|
|
6436
|
+
`Entry ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
6437
|
+
);
|
|
6438
|
+
return;
|
|
6439
|
+
}
|
|
6440
|
+
throw err;
|
|
6441
|
+
})
|
|
6442
|
+
);
|
|
6424
6443
|
}
|
|
6425
6444
|
log2({
|
|
6426
6445
|
action: "update",
|
|
@@ -6428,9 +6447,10 @@ var EntryUnpublishModule = {
|
|
|
6428
6447
|
providerId: sourceObject.providerId,
|
|
6429
6448
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
6430
6449
|
whatIf,
|
|
6431
|
-
diff: () => diffJson3(targetObject.object, sourceObject.object)
|
|
6450
|
+
diff: () => targetObject ? diffJson3(targetObject.object, sourceObject.object) : []
|
|
6432
6451
|
});
|
|
6433
6452
|
}
|
|
6453
|
+
await Promise.all(actions);
|
|
6434
6454
|
}
|
|
6435
6455
|
};
|
|
6436
6456
|
|
|
@@ -6439,12 +6459,12 @@ var EntryUpdateModule = {
|
|
|
6439
6459
|
command: "update <filename>",
|
|
6440
6460
|
aliases: ["put"],
|
|
6441
6461
|
describe: "Insert or update an entry",
|
|
6442
|
-
builder: (
|
|
6462
|
+
builder: (yargs43) => withConfiguration(
|
|
6443
6463
|
withDebugOptions(
|
|
6444
6464
|
withApiOptions(
|
|
6445
6465
|
withProjectOptions(
|
|
6446
6466
|
withStateOptions(
|
|
6447
|
-
|
|
6467
|
+
yargs43.positional("filename", { demandOption: true, describe: "Entry file to put" })
|
|
6448
6468
|
)
|
|
6449
6469
|
)
|
|
6450
6470
|
)
|
|
@@ -6476,7 +6496,7 @@ var EntryUpdateModule = {
|
|
|
6476
6496
|
var EntryModule = {
|
|
6477
6497
|
command: "entry <command>",
|
|
6478
6498
|
describe: "Commands for Entries",
|
|
6479
|
-
builder: (
|
|
6499
|
+
builder: (yargs43) => yargs43.command(EntryGetModule).command(EntryListModule).command(EntryRemoveModule).command(EntryUpdateModule).command(EntryPullModule).command(EntryPushModule).command(EntryPublishModule).command(EntryUnpublishModule).demandCommand(),
|
|
6480
6500
|
handler: () => {
|
|
6481
6501
|
yargs13.help();
|
|
6482
6502
|
}
|
|
@@ -6489,13 +6509,13 @@ import yargs14 from "yargs";
|
|
|
6489
6509
|
var EntryPatternGetModule = {
|
|
6490
6510
|
command: "get <id>",
|
|
6491
6511
|
describe: "Get an entry pattern",
|
|
6492
|
-
builder: (
|
|
6512
|
+
builder: (yargs43) => withConfiguration(
|
|
6493
6513
|
withDebugOptions(
|
|
6494
6514
|
withFormatOptions(
|
|
6495
6515
|
withApiOptions(
|
|
6496
6516
|
withProjectOptions(
|
|
6497
6517
|
withStateOptions(
|
|
6498
|
-
|
|
6518
|
+
yargs43.positional("id", {
|
|
6499
6519
|
demandOption: true,
|
|
6500
6520
|
describe: "Entry pattern public ID to fetch"
|
|
6501
6521
|
}).option({
|
|
@@ -6548,13 +6568,13 @@ var EntryPatternGetModule = {
|
|
|
6548
6568
|
var EntryPatternListModule = {
|
|
6549
6569
|
command: "list",
|
|
6550
6570
|
describe: "List entry patterns",
|
|
6551
|
-
builder: (
|
|
6571
|
+
builder: (yargs43) => withConfiguration(
|
|
6552
6572
|
withDebugOptions(
|
|
6553
6573
|
withFormatOptions(
|
|
6554
6574
|
withApiOptions(
|
|
6555
6575
|
withProjectOptions(
|
|
6556
6576
|
withStateOptions(
|
|
6557
|
-
|
|
6577
|
+
yargs43.option({
|
|
6558
6578
|
withComponentIDs: {
|
|
6559
6579
|
type: "boolean",
|
|
6560
6580
|
default: false,
|
|
@@ -6600,12 +6620,12 @@ var EntryPatternListModule = {
|
|
|
6600
6620
|
var EntryPatternPublishModule = {
|
|
6601
6621
|
command: "publish [ids]",
|
|
6602
6622
|
describe: "Publishes entry pattern(s)",
|
|
6603
|
-
builder: (
|
|
6623
|
+
builder: (yargs43) => withConfiguration(
|
|
6604
6624
|
withDebugOptions(
|
|
6605
6625
|
withApiOptions(
|
|
6606
6626
|
withProjectOptions(
|
|
6607
6627
|
withDiffOptions(
|
|
6608
|
-
|
|
6628
|
+
yargs43.positional("ids", {
|
|
6609
6629
|
describe: "Publishes entry pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
|
|
6610
6630
|
type: "string"
|
|
6611
6631
|
}).option("all", {
|
|
@@ -6664,7 +6684,7 @@ var EntryPatternPublishModule = {
|
|
|
6664
6684
|
fileClient
|
|
6665
6685
|
});
|
|
6666
6686
|
},
|
|
6667
|
-
compareContents:
|
|
6687
|
+
compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
|
|
6668
6688
|
onBeforeWriteObject: async (sourceObject) => {
|
|
6669
6689
|
return uploadFilesForCompositionOrEntry({
|
|
6670
6690
|
entity: sourceObject,
|
|
@@ -6680,13 +6700,13 @@ var EntryPatternPublishModule = {
|
|
|
6680
6700
|
var EntryPatternPullModule = {
|
|
6681
6701
|
command: "pull <directory>",
|
|
6682
6702
|
describe: "Pulls all entry patterns to local files in a directory",
|
|
6683
|
-
builder: (
|
|
6703
|
+
builder: (yargs43) => withConfiguration(
|
|
6684
6704
|
withApiOptions(
|
|
6685
6705
|
withDebugOptions(
|
|
6686
6706
|
withProjectOptions(
|
|
6687
6707
|
withStateOptions(
|
|
6688
6708
|
withDiffOptions(
|
|
6689
|
-
|
|
6709
|
+
yargs43.positional("directory", {
|
|
6690
6710
|
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.",
|
|
6691
6711
|
type: "string"
|
|
6692
6712
|
}).option("format", {
|
|
@@ -6786,13 +6806,13 @@ var EntryPatternPullModule = {
|
|
|
6786
6806
|
var EntryPatternPushModule = {
|
|
6787
6807
|
command: "push <directory>",
|
|
6788
6808
|
describe: "Pushes all entry patterns from files in a directory to Uniform",
|
|
6789
|
-
builder: (
|
|
6809
|
+
builder: (yargs43) => withConfiguration(
|
|
6790
6810
|
withDebugOptions(
|
|
6791
6811
|
withApiOptions(
|
|
6792
6812
|
withProjectOptions(
|
|
6793
6813
|
withStateOptions(
|
|
6794
6814
|
withDiffOptions(
|
|
6795
|
-
|
|
6815
|
+
yargs43.positional("directory", {
|
|
6796
6816
|
describe: "Directory to read the entry patterns from. If a filename is used, a package will be read instead.",
|
|
6797
6817
|
type: "string"
|
|
6798
6818
|
}).option("what-if", {
|
|
@@ -6896,11 +6916,11 @@ var EntryPatternRemoveModule = {
|
|
|
6896
6916
|
command: "remove <id>",
|
|
6897
6917
|
aliases: ["delete", "rm"],
|
|
6898
6918
|
describe: "Delete an entry pattern",
|
|
6899
|
-
builder: (
|
|
6919
|
+
builder: (yargs43) => withConfiguration(
|
|
6900
6920
|
withDebugOptions(
|
|
6901
6921
|
withApiOptions(
|
|
6902
6922
|
withProjectOptions(
|
|
6903
|
-
|
|
6923
|
+
yargs43.positional("id", { demandOption: true, describe: "Entry pattern public ID to delete" })
|
|
6904
6924
|
)
|
|
6905
6925
|
)
|
|
6906
6926
|
)
|
|
@@ -6917,16 +6937,16 @@ var EntryPatternRemoveModule = {
|
|
|
6917
6937
|
};
|
|
6918
6938
|
|
|
6919
6939
|
// src/commands/canvas/commands/entryPattern/unpublish.ts
|
|
6920
|
-
import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
6940
|
+
import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
|
|
6921
6941
|
import { diffJson as diffJson4 } from "diff";
|
|
6922
6942
|
var EntryPatternUnpublishModule = {
|
|
6923
6943
|
command: "unpublish [ids]",
|
|
6924
|
-
describe: "Unpublish
|
|
6925
|
-
builder: (
|
|
6944
|
+
describe: "Unpublish entry pattern(s)",
|
|
6945
|
+
builder: (yargs43) => withConfiguration(
|
|
6926
6946
|
withDebugOptions(
|
|
6927
6947
|
withApiOptions(
|
|
6928
6948
|
withProjectOptions(
|
|
6929
|
-
|
|
6949
|
+
yargs43.positional("ids", {
|
|
6930
6950
|
describe: "Un-publishes entry patterns by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
|
|
6931
6951
|
type: "string"
|
|
6932
6952
|
}).option("all", {
|
|
@@ -6941,7 +6961,7 @@ var EntryPatternUnpublishModule = {
|
|
|
6941
6961
|
),
|
|
6942
6962
|
handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
|
|
6943
6963
|
if (!all && !ids || all && ids) {
|
|
6944
|
-
console.error(`Specify --all or entry pattern ID(s) to
|
|
6964
|
+
console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
|
|
6945
6965
|
process.exit(1);
|
|
6946
6966
|
}
|
|
6947
6967
|
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
@@ -6960,7 +6980,6 @@ var EntryPatternUnpublishModule = {
|
|
|
6960
6980
|
entryIDs: entryIDsArray,
|
|
6961
6981
|
onlyPatterns: true
|
|
6962
6982
|
});
|
|
6963
|
-
const actions = [];
|
|
6964
6983
|
const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
|
|
6965
6984
|
for await (const obj of target.objects) {
|
|
6966
6985
|
if (Array.isArray(obj.id)) {
|
|
@@ -6969,15 +6988,30 @@ var EntryPatternUnpublishModule = {
|
|
|
6969
6988
|
targetItems.set(obj.id, obj);
|
|
6970
6989
|
}
|
|
6971
6990
|
}
|
|
6991
|
+
const toUnpublish = [];
|
|
6972
6992
|
for await (const sourceObject of source.objects) {
|
|
6993
|
+
toUnpublish.push(sourceObject);
|
|
6994
|
+
}
|
|
6995
|
+
const actions = [];
|
|
6996
|
+
for (const sourceObject of toUnpublish) {
|
|
6973
6997
|
const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
|
|
6974
6998
|
const targetObject = targetItems.get(id);
|
|
6975
6999
|
if (!targetObject) {
|
|
6976
|
-
console.log(`Entry pattern ${id}
|
|
6977
|
-
return;
|
|
7000
|
+
console.log(`Entry pattern ${id} did not have a draft (removing published)`);
|
|
6978
7001
|
}
|
|
6979
7002
|
if (!whatIf) {
|
|
6980
|
-
actions.push(
|
|
7003
|
+
actions.push(
|
|
7004
|
+
client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
|
|
7005
|
+
const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
|
|
7006
|
+
if (isNotFound) {
|
|
7007
|
+
console.warn(
|
|
7008
|
+
`Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
|
|
7009
|
+
);
|
|
7010
|
+
return;
|
|
7011
|
+
}
|
|
7012
|
+
throw err;
|
|
7013
|
+
})
|
|
7014
|
+
);
|
|
6981
7015
|
}
|
|
6982
7016
|
log2({
|
|
6983
7017
|
action: "update",
|
|
@@ -6985,9 +7019,10 @@ var EntryPatternUnpublishModule = {
|
|
|
6985
7019
|
providerId: sourceObject.providerId,
|
|
6986
7020
|
displayName: sourceObject.displayName ?? sourceObject.providerId,
|
|
6987
7021
|
whatIf,
|
|
6988
|
-
diff: () => diffJson4(targetObject.object, sourceObject.object)
|
|
7022
|
+
diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
|
|
6989
7023
|
});
|
|
6990
7024
|
}
|
|
7025
|
+
await Promise.all(actions);
|
|
6991
7026
|
}
|
|
6992
7027
|
};
|
|
6993
7028
|
|
|
@@ -6996,12 +7031,12 @@ var EntryPatternUpdateModule = {
|
|
|
6996
7031
|
command: "update <filename>",
|
|
6997
7032
|
aliases: ["put"],
|
|
6998
7033
|
describe: "Insert or update an entry pattern",
|
|
6999
|
-
builder: (
|
|
7034
|
+
builder: (yargs43) => withConfiguration(
|
|
7000
7035
|
withDebugOptions(
|
|
7001
7036
|
withApiOptions(
|
|
7002
7037
|
withProjectOptions(
|
|
7003
7038
|
withStateOptions(
|
|
7004
|
-
|
|
7039
|
+
yargs43.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
|
|
7005
7040
|
)
|
|
7006
7041
|
)
|
|
7007
7042
|
)
|
|
@@ -7037,15 +7072,254 @@ var EntryPatternUpdateModule = {
|
|
|
7037
7072
|
var EntryPatternModule = {
|
|
7038
7073
|
command: "entry-pattern <command>",
|
|
7039
7074
|
describe: "Commands for Entry patterns",
|
|
7040
|
-
builder: (
|
|
7075
|
+
builder: (yargs43) => yargs43.command(EntryPatternGetModule).command(EntryPatternListModule).command(EntryPatternRemoveModule).command(EntryPatternUpdateModule).command(EntryPatternPullModule).command(EntryPatternPushModule).command(EntryPatternPublishModule).command(EntryPatternUnpublishModule).demandCommand(),
|
|
7041
7076
|
handler: () => {
|
|
7042
7077
|
yargs14.help();
|
|
7043
7078
|
}
|
|
7044
7079
|
};
|
|
7045
7080
|
|
|
7046
|
-
// src/commands/canvas/commands/
|
|
7081
|
+
// src/commands/canvas/commands/label.ts
|
|
7047
7082
|
import yargs15 from "yargs";
|
|
7048
7083
|
|
|
7084
|
+
// src/commands/canvas/commands/label/_util.ts
|
|
7085
|
+
import { LabelClient } from "@uniformdev/canvas";
|
|
7086
|
+
var selectLabelIdentifier = (label) => label.label.publicId;
|
|
7087
|
+
var selectLabelDisplayName = (label) => `${label.label.displayName} (pid: ${label.label.publicId})`;
|
|
7088
|
+
function getLabelClient(options) {
|
|
7089
|
+
return new LabelClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
7090
|
+
}
|
|
7091
|
+
|
|
7092
|
+
// src/commands/canvas/labelsEngineDataSource.ts
|
|
7093
|
+
function normalizeLabelForSync(label) {
|
|
7094
|
+
const { projectId: _projectId, ...labelWithoutProjectId } = label;
|
|
7095
|
+
return labelWithoutProjectId;
|
|
7096
|
+
}
|
|
7097
|
+
function createLabelsEngineDataSource({
|
|
7098
|
+
client
|
|
7099
|
+
}) {
|
|
7100
|
+
async function* getObjects() {
|
|
7101
|
+
const labels = paginateAsync(
|
|
7102
|
+
async (offset, limit2) => (await client.getLabels({ offset, limit: limit2 })).labels,
|
|
7103
|
+
{ pageSize: 100 }
|
|
7104
|
+
);
|
|
7105
|
+
for await (const label of labels) {
|
|
7106
|
+
const result = {
|
|
7107
|
+
id: label.label.publicId,
|
|
7108
|
+
displayName: `${label.label.displayName} (pid: ${label.label.publicId})`,
|
|
7109
|
+
providerId: label.label.publicId,
|
|
7110
|
+
object: normalizeLabelForSync(label)
|
|
7111
|
+
};
|
|
7112
|
+
yield result;
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
return {
|
|
7116
|
+
name: "Uniform API",
|
|
7117
|
+
objects: getObjects(),
|
|
7118
|
+
deleteObject: async (providerId) => {
|
|
7119
|
+
await client.removeLabel({ labelId: providerId });
|
|
7120
|
+
},
|
|
7121
|
+
writeObject: async ({ object: object4 }) => {
|
|
7122
|
+
await client.upsertLabel({ label: object4.label });
|
|
7123
|
+
}
|
|
7124
|
+
};
|
|
7125
|
+
}
|
|
7126
|
+
|
|
7127
|
+
// src/commands/canvas/commands/label/pull.ts
|
|
7128
|
+
var LabelPullModule = {
|
|
7129
|
+
command: "pull <directory>",
|
|
7130
|
+
describe: "Pulls all labels to local files in a directory",
|
|
7131
|
+
builder: (yargs43) => withConfiguration(
|
|
7132
|
+
withDebugOptions(
|
|
7133
|
+
withApiOptions(
|
|
7134
|
+
withProjectOptions(
|
|
7135
|
+
withDiffOptions(
|
|
7136
|
+
yargs43.positional("directory", {
|
|
7137
|
+
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.",
|
|
7138
|
+
type: "string"
|
|
7139
|
+
}).option("format", {
|
|
7140
|
+
alias: ["f"],
|
|
7141
|
+
describe: "Output format",
|
|
7142
|
+
default: "yaml",
|
|
7143
|
+
choices: ["yaml", "json"],
|
|
7144
|
+
type: "string"
|
|
7145
|
+
}).option("mode", {
|
|
7146
|
+
alias: ["m"],
|
|
7147
|
+
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',
|
|
7148
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
7149
|
+
default: "mirror",
|
|
7150
|
+
type: "string"
|
|
7151
|
+
})
|
|
7152
|
+
)
|
|
7153
|
+
)
|
|
7154
|
+
)
|
|
7155
|
+
)
|
|
7156
|
+
),
|
|
7157
|
+
handler: async ({
|
|
7158
|
+
apiHost,
|
|
7159
|
+
apiKey,
|
|
7160
|
+
proxy,
|
|
7161
|
+
directory,
|
|
7162
|
+
format,
|
|
7163
|
+
mode,
|
|
7164
|
+
whatIf,
|
|
7165
|
+
project: projectId,
|
|
7166
|
+
diff: diffMode,
|
|
7167
|
+
allowEmptySource,
|
|
7168
|
+
verbose
|
|
7169
|
+
}) => {
|
|
7170
|
+
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7171
|
+
const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
7172
|
+
const source = createLabelsEngineDataSource({ client });
|
|
7173
|
+
let target;
|
|
7174
|
+
const isPackage = isPathAPackageFile(directory);
|
|
7175
|
+
if (isPackage) {
|
|
7176
|
+
const packageContents = readCanvasPackage(directory, false, verbose);
|
|
7177
|
+
const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
|
|
7178
|
+
target = await createArraySyncEngineDataSource({
|
|
7179
|
+
name: `Package file ${directory}`,
|
|
7180
|
+
objects: packageLabels,
|
|
7181
|
+
selectIdentifier: selectLabelIdentifier,
|
|
7182
|
+
selectDisplayName: selectLabelDisplayName,
|
|
7183
|
+
onSyncComplete: async (_, synced) => {
|
|
7184
|
+
packageContents.labels = synced;
|
|
7185
|
+
writeCanvasPackage(directory, packageContents);
|
|
7186
|
+
}
|
|
7187
|
+
});
|
|
7188
|
+
} else {
|
|
7189
|
+
target = await createFileSyncEngineDataSource({
|
|
7190
|
+
directory,
|
|
7191
|
+
selectIdentifier: selectLabelIdentifier,
|
|
7192
|
+
selectDisplayName: selectLabelDisplayName,
|
|
7193
|
+
format,
|
|
7194
|
+
verbose
|
|
7195
|
+
});
|
|
7196
|
+
}
|
|
7197
|
+
await syncEngine({
|
|
7198
|
+
source,
|
|
7199
|
+
target,
|
|
7200
|
+
mode,
|
|
7201
|
+
whatIf,
|
|
7202
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
7203
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
7204
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
7205
|
+
delete sourceObject.object.createdBy;
|
|
7206
|
+
delete sourceObject.object.modifiedBy;
|
|
7207
|
+
return sourceObject;
|
|
7208
|
+
}
|
|
7209
|
+
});
|
|
7210
|
+
}
|
|
7211
|
+
};
|
|
7212
|
+
|
|
7213
|
+
// src/commands/canvas/commands/label/push.ts
|
|
7214
|
+
var __INTERNAL_MISSING_PARENT_LABEL_ERROR = "Parent label with public ID";
|
|
7215
|
+
var LabelPushModule = {
|
|
7216
|
+
command: "push <directory>",
|
|
7217
|
+
describe: "Pushes all labels from files in a directory to Uniform",
|
|
7218
|
+
builder: (yargs43) => withConfiguration(
|
|
7219
|
+
withDebugOptions(
|
|
7220
|
+
withApiOptions(
|
|
7221
|
+
withProjectOptions(
|
|
7222
|
+
withDiffOptions(
|
|
7223
|
+
yargs43.positional("directory", {
|
|
7224
|
+
describe: "Directory to read the labels from. If a filename is used, a package will be read instead.",
|
|
7225
|
+
type: "string"
|
|
7226
|
+
}).option("mode", {
|
|
7227
|
+
alias: ["m"],
|
|
7228
|
+
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',
|
|
7229
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
7230
|
+
default: "mirror",
|
|
7231
|
+
type: "string"
|
|
7232
|
+
})
|
|
7233
|
+
)
|
|
7234
|
+
)
|
|
7235
|
+
)
|
|
7236
|
+
)
|
|
7237
|
+
),
|
|
7238
|
+
handler: async ({
|
|
7239
|
+
apiHost,
|
|
7240
|
+
apiKey,
|
|
7241
|
+
proxy,
|
|
7242
|
+
directory,
|
|
7243
|
+
mode,
|
|
7244
|
+
whatIf,
|
|
7245
|
+
project: projectId,
|
|
7246
|
+
diff: diffMode,
|
|
7247
|
+
allowEmptySource,
|
|
7248
|
+
verbose
|
|
7249
|
+
}) => {
|
|
7250
|
+
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7251
|
+
const client = getLabelClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
7252
|
+
let source;
|
|
7253
|
+
const isPackage = isPathAPackageFile(directory);
|
|
7254
|
+
if (isPackage) {
|
|
7255
|
+
const packageContents = readCanvasPackage(directory, true, verbose);
|
|
7256
|
+
const packageLabels = Array.isArray(packageContents.labels) ? packageContents.labels : [];
|
|
7257
|
+
source = await createArraySyncEngineDataSource({
|
|
7258
|
+
name: `Package file ${directory}`,
|
|
7259
|
+
objects: packageLabels,
|
|
7260
|
+
selectIdentifier: selectLabelIdentifier,
|
|
7261
|
+
selectDisplayName: selectLabelDisplayName
|
|
7262
|
+
});
|
|
7263
|
+
} else {
|
|
7264
|
+
source = await createFileSyncEngineDataSource({
|
|
7265
|
+
directory,
|
|
7266
|
+
selectIdentifier: selectLabelIdentifier,
|
|
7267
|
+
selectDisplayName: selectLabelDisplayName,
|
|
7268
|
+
verbose
|
|
7269
|
+
});
|
|
7270
|
+
}
|
|
7271
|
+
const target = createLabelsEngineDataSource({ client });
|
|
7272
|
+
const labelsFailedDueToMissingParent = /* @__PURE__ */ new Set();
|
|
7273
|
+
const attemptSync = async () => {
|
|
7274
|
+
const lastFailedLabelsCount = labelsFailedDueToMissingParent.size;
|
|
7275
|
+
labelsFailedDueToMissingParent.clear();
|
|
7276
|
+
await syncEngine({
|
|
7277
|
+
source,
|
|
7278
|
+
target,
|
|
7279
|
+
mode,
|
|
7280
|
+
whatIf,
|
|
7281
|
+
allowEmptySource,
|
|
7282
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
7283
|
+
onError: (error, object4) => {
|
|
7284
|
+
if (error.message.includes(__INTERNAL_MISSING_PARENT_LABEL_ERROR)) {
|
|
7285
|
+
labelsFailedDueToMissingParent.add(object4.object);
|
|
7286
|
+
} else {
|
|
7287
|
+
throw error;
|
|
7288
|
+
}
|
|
7289
|
+
}
|
|
7290
|
+
});
|
|
7291
|
+
if (labelsFailedDueToMissingParent.size !== 0) {
|
|
7292
|
+
const newFailedLabelsCount = labelsFailedDueToMissingParent.size;
|
|
7293
|
+
if (newFailedLabelsCount !== lastFailedLabelsCount) {
|
|
7294
|
+
source = await createArraySyncEngineDataSource({
|
|
7295
|
+
name: `Labels re-push from ${directory}`,
|
|
7296
|
+
objects: Array.from(labelsFailedDueToMissingParent),
|
|
7297
|
+
selectIdentifier: selectLabelIdentifier,
|
|
7298
|
+
selectDisplayName: selectLabelDisplayName
|
|
7299
|
+
});
|
|
7300
|
+
await attemptSync();
|
|
7301
|
+
} else {
|
|
7302
|
+
throw new Error("Failed to push labels due to missing parent labels");
|
|
7303
|
+
}
|
|
7304
|
+
}
|
|
7305
|
+
};
|
|
7306
|
+
await attemptSync();
|
|
7307
|
+
}
|
|
7308
|
+
};
|
|
7309
|
+
|
|
7310
|
+
// src/commands/canvas/commands/label.ts
|
|
7311
|
+
var LabelModule = {
|
|
7312
|
+
command: "label <command>",
|
|
7313
|
+
describe: "Commands for label definitions",
|
|
7314
|
+
builder: (yargs43) => yargs43.command(LabelPullModule).command(LabelPushModule),
|
|
7315
|
+
handler: () => {
|
|
7316
|
+
yargs15.help();
|
|
7317
|
+
}
|
|
7318
|
+
};
|
|
7319
|
+
|
|
7320
|
+
// src/commands/canvas/commands/locale.ts
|
|
7321
|
+
import yargs16 from "yargs";
|
|
7322
|
+
|
|
7049
7323
|
// src/commands/canvas/localesEngineDataSource.ts
|
|
7050
7324
|
function createLocaleEngineDataSource({
|
|
7051
7325
|
client
|
|
@@ -7086,12 +7360,12 @@ function getLocaleClient(options) {
|
|
|
7086
7360
|
var LocalePullModule = {
|
|
7087
7361
|
command: "pull <directory>",
|
|
7088
7362
|
describe: "Pulls all locales to local files in a directory",
|
|
7089
|
-
builder: (
|
|
7363
|
+
builder: (yargs43) => withConfiguration(
|
|
7090
7364
|
withDebugOptions(
|
|
7091
7365
|
withApiOptions(
|
|
7092
7366
|
withProjectOptions(
|
|
7093
7367
|
withDiffOptions(
|
|
7094
|
-
|
|
7368
|
+
yargs43.positional("directory", {
|
|
7095
7369
|
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.",
|
|
7096
7370
|
type: "string"
|
|
7097
7371
|
}).option("format", {
|
|
@@ -7171,12 +7445,12 @@ var LocalePullModule = {
|
|
|
7171
7445
|
var LocalePushModule = {
|
|
7172
7446
|
command: "push <directory>",
|
|
7173
7447
|
describe: "Pushes all locales from files in a directory to Uniform",
|
|
7174
|
-
builder: (
|
|
7448
|
+
builder: (yargs43) => withConfiguration(
|
|
7175
7449
|
withDebugOptions(
|
|
7176
7450
|
withApiOptions(
|
|
7177
7451
|
withProjectOptions(
|
|
7178
7452
|
withDiffOptions(
|
|
7179
|
-
|
|
7453
|
+
yargs43.positional("directory", {
|
|
7180
7454
|
describe: "Directory to read the locales from. If a filename is used, a package will be read instead.",
|
|
7181
7455
|
type: "string"
|
|
7182
7456
|
}).option("mode", {
|
|
@@ -7244,14 +7518,14 @@ var LocalePushModule = {
|
|
|
7244
7518
|
var LocaleModule = {
|
|
7245
7519
|
command: "locale <command>",
|
|
7246
7520
|
describe: "Commands for locale definitions",
|
|
7247
|
-
builder: (
|
|
7521
|
+
builder: (yargs43) => yargs43.command(LocalePullModule).command(LocalePushModule),
|
|
7248
7522
|
handler: () => {
|
|
7249
|
-
|
|
7523
|
+
yargs16.help();
|
|
7250
7524
|
}
|
|
7251
7525
|
};
|
|
7252
7526
|
|
|
7253
7527
|
// src/commands/canvas/commands/previewUrl.ts
|
|
7254
|
-
import
|
|
7528
|
+
import yargs17 from "yargs";
|
|
7255
7529
|
|
|
7256
7530
|
// src/commands/canvas/commands/previewUrl/_util.ts
|
|
7257
7531
|
import { PreviewClient } from "@uniformdev/canvas";
|
|
@@ -7265,12 +7539,12 @@ function getPreviewClient(options) {
|
|
|
7265
7539
|
var PreviewUrlGetModule = {
|
|
7266
7540
|
command: "get <id>",
|
|
7267
7541
|
describe: "Fetch a preview URL",
|
|
7268
|
-
builder: (
|
|
7542
|
+
builder: (yargs43) => withConfiguration(
|
|
7269
7543
|
withFormatOptions(
|
|
7270
7544
|
withDebugOptions(
|
|
7271
7545
|
withApiOptions(
|
|
7272
7546
|
withProjectOptions(
|
|
7273
|
-
|
|
7547
|
+
yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to fetch" })
|
|
7274
7548
|
)
|
|
7275
7549
|
)
|
|
7276
7550
|
)
|
|
@@ -7294,8 +7568,8 @@ var PreviewUrlListModule = {
|
|
|
7294
7568
|
command: "list",
|
|
7295
7569
|
describe: "List preview URLs",
|
|
7296
7570
|
aliases: ["ls"],
|
|
7297
|
-
builder: (
|
|
7298
|
-
withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(
|
|
7571
|
+
builder: (yargs43) => withConfiguration(
|
|
7572
|
+
withFormatOptions(withApiOptions(withDebugOptions(withProjectOptions(yargs43.options({})))))
|
|
7299
7573
|
),
|
|
7300
7574
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
7301
7575
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
@@ -7337,12 +7611,12 @@ function createPreviewUrlEngineDataSource({
|
|
|
7337
7611
|
var PreviewUrlPullModule = {
|
|
7338
7612
|
command: "pull <directory>",
|
|
7339
7613
|
describe: "Pulls all preview urls to local files in a directory",
|
|
7340
|
-
builder: (
|
|
7614
|
+
builder: (yargs43) => withConfiguration(
|
|
7341
7615
|
withApiOptions(
|
|
7342
7616
|
withProjectOptions(
|
|
7343
7617
|
withDebugOptions(
|
|
7344
7618
|
withDiffOptions(
|
|
7345
|
-
|
|
7619
|
+
yargs43.positional("directory", {
|
|
7346
7620
|
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.",
|
|
7347
7621
|
type: "string"
|
|
7348
7622
|
}).option("format", {
|
|
@@ -7417,12 +7691,12 @@ var PreviewUrlPullModule = {
|
|
|
7417
7691
|
var PreviewUrlPushModule = {
|
|
7418
7692
|
command: "push <directory>",
|
|
7419
7693
|
describe: "Pushes all preview urls from files in a directory to Uniform Canvas",
|
|
7420
|
-
builder: (
|
|
7694
|
+
builder: (yargs43) => withConfiguration(
|
|
7421
7695
|
withApiOptions(
|
|
7422
7696
|
withProjectOptions(
|
|
7423
7697
|
withDiffOptions(
|
|
7424
7698
|
withDebugOptions(
|
|
7425
|
-
|
|
7699
|
+
yargs43.positional("directory", {
|
|
7426
7700
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
7427
7701
|
type: "string"
|
|
7428
7702
|
}).option("mode", {
|
|
@@ -7486,11 +7760,11 @@ var PreviewUrlRemoveModule = {
|
|
|
7486
7760
|
command: "remove <id>",
|
|
7487
7761
|
aliases: ["delete", "rm"],
|
|
7488
7762
|
describe: "Delete a preview URL",
|
|
7489
|
-
builder: (
|
|
7763
|
+
builder: (yargs43) => withConfiguration(
|
|
7490
7764
|
withApiOptions(
|
|
7491
7765
|
withDebugOptions(
|
|
7492
7766
|
withProjectOptions(
|
|
7493
|
-
|
|
7767
|
+
yargs43.positional("id", { demandOption: true, describe: "Preview URL UUID to delete" })
|
|
7494
7768
|
)
|
|
7495
7769
|
)
|
|
7496
7770
|
)
|
|
@@ -7511,11 +7785,11 @@ var PreviewUrlUpdateModule = {
|
|
|
7511
7785
|
command: "update <filename>",
|
|
7512
7786
|
aliases: ["put"],
|
|
7513
7787
|
describe: "Insert or update a preview URL",
|
|
7514
|
-
builder: (
|
|
7788
|
+
builder: (yargs43) => withConfiguration(
|
|
7515
7789
|
withDebugOptions(
|
|
7516
7790
|
withApiOptions(
|
|
7517
7791
|
withProjectOptions(
|
|
7518
|
-
|
|
7792
|
+
yargs43.positional("filename", { demandOption: true, describe: "Category file to put" })
|
|
7519
7793
|
)
|
|
7520
7794
|
)
|
|
7521
7795
|
)
|
|
@@ -7537,25 +7811,25 @@ var PreviewUrlModule = {
|
|
|
7537
7811
|
command: "preview-url <command>",
|
|
7538
7812
|
aliases: ["pu"],
|
|
7539
7813
|
describe: "Commands for Canvas preview urls",
|
|
7540
|
-
builder: (
|
|
7814
|
+
builder: (yargs43) => yargs43.command(PreviewUrlPullModule).command(PreviewUrlPushModule).command(PreviewUrlGetModule).command(PreviewUrlRemoveModule).command(PreviewUrlListModule).command(PreviewUrlUpdateModule).demandCommand(),
|
|
7541
7815
|
handler: () => {
|
|
7542
|
-
|
|
7816
|
+
yargs17.help();
|
|
7543
7817
|
}
|
|
7544
7818
|
};
|
|
7545
7819
|
|
|
7546
7820
|
// src/commands/canvas/commands/previewViewport.ts
|
|
7547
|
-
import
|
|
7821
|
+
import yargs18 from "yargs";
|
|
7548
7822
|
|
|
7549
7823
|
// src/commands/canvas/commands/previewViewport/get.ts
|
|
7550
7824
|
var PreviewViewportGetModule = {
|
|
7551
7825
|
command: "get <id>",
|
|
7552
7826
|
describe: "Fetch a preview viewport",
|
|
7553
|
-
builder: (
|
|
7827
|
+
builder: (yargs43) => withConfiguration(
|
|
7554
7828
|
withFormatOptions(
|
|
7555
7829
|
withDebugOptions(
|
|
7556
7830
|
withApiOptions(
|
|
7557
7831
|
withProjectOptions(
|
|
7558
|
-
|
|
7832
|
+
yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to fetch" })
|
|
7559
7833
|
)
|
|
7560
7834
|
)
|
|
7561
7835
|
)
|
|
@@ -7579,8 +7853,8 @@ var PreviewViewportListModule = {
|
|
|
7579
7853
|
command: "list",
|
|
7580
7854
|
describe: "List preview viewports",
|
|
7581
7855
|
aliases: ["ls"],
|
|
7582
|
-
builder: (
|
|
7583
|
-
withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(
|
|
7856
|
+
builder: (yargs43) => withConfiguration(
|
|
7857
|
+
withFormatOptions(withDebugOptions(withApiOptions(withProjectOptions(yargs43.options({})))))
|
|
7584
7858
|
),
|
|
7585
7859
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
7586
7860
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
@@ -7626,12 +7900,12 @@ function createPreviewViewportEngineDataSource({
|
|
|
7626
7900
|
var PreviewViewportPullModule = {
|
|
7627
7901
|
command: "pull <directory>",
|
|
7628
7902
|
describe: "Pulls all preview viewports to local files in a directory",
|
|
7629
|
-
builder: (
|
|
7903
|
+
builder: (yargs43) => withConfiguration(
|
|
7630
7904
|
withApiOptions(
|
|
7631
7905
|
withProjectOptions(
|
|
7632
7906
|
withDebugOptions(
|
|
7633
7907
|
withDiffOptions(
|
|
7634
|
-
|
|
7908
|
+
yargs43.positional("directory", {
|
|
7635
7909
|
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.",
|
|
7636
7910
|
type: "string"
|
|
7637
7911
|
}).option("format", {
|
|
@@ -7706,12 +7980,12 @@ var PreviewViewportPullModule = {
|
|
|
7706
7980
|
var PreviewViewportPushModule = {
|
|
7707
7981
|
command: "push <directory>",
|
|
7708
7982
|
describe: "Pushes all preview viewports from files in a directory to Uniform Canvas",
|
|
7709
|
-
builder: (
|
|
7983
|
+
builder: (yargs43) => withConfiguration(
|
|
7710
7984
|
withApiOptions(
|
|
7711
7985
|
withProjectOptions(
|
|
7712
7986
|
withDiffOptions(
|
|
7713
7987
|
withDebugOptions(
|
|
7714
|
-
|
|
7988
|
+
yargs43.positional("directory", {
|
|
7715
7989
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
7716
7990
|
type: "string"
|
|
7717
7991
|
}).option("mode", {
|
|
@@ -7775,11 +8049,11 @@ var PreviewViewportRemoveModule = {
|
|
|
7775
8049
|
command: "remove <id>",
|
|
7776
8050
|
aliases: ["delete", "rm"],
|
|
7777
8051
|
describe: "Delete a preview viewport",
|
|
7778
|
-
builder: (
|
|
8052
|
+
builder: (yargs43) => withConfiguration(
|
|
7779
8053
|
withApiOptions(
|
|
7780
8054
|
withDebugOptions(
|
|
7781
8055
|
withProjectOptions(
|
|
7782
|
-
|
|
8056
|
+
yargs43.positional("id", { demandOption: true, describe: "Preview viewport UUID to delete" })
|
|
7783
8057
|
)
|
|
7784
8058
|
)
|
|
7785
8059
|
)
|
|
@@ -7800,11 +8074,11 @@ var PreviewViewportUpdateModule = {
|
|
|
7800
8074
|
command: "update <filename>",
|
|
7801
8075
|
aliases: ["put"],
|
|
7802
8076
|
describe: "Insert or update a preview viewport",
|
|
7803
|
-
builder: (
|
|
8077
|
+
builder: (yargs43) => withConfiguration(
|
|
7804
8078
|
withDebugOptions(
|
|
7805
8079
|
withApiOptions(
|
|
7806
8080
|
withProjectOptions(
|
|
7807
|
-
|
|
8081
|
+
yargs43.positional("filename", { demandOption: true, describe: "Preview viewport file to put" })
|
|
7808
8082
|
)
|
|
7809
8083
|
)
|
|
7810
8084
|
)
|
|
@@ -7826,14 +8100,14 @@ var PreviewViewportModule = {
|
|
|
7826
8100
|
command: "preview-viewport <command>",
|
|
7827
8101
|
aliases: ["pv"],
|
|
7828
8102
|
describe: "Commands for Canvas preview viewports",
|
|
7829
|
-
builder: (
|
|
8103
|
+
builder: (yargs43) => yargs43.command(PreviewViewportPullModule).command(PreviewViewportPushModule).command(PreviewViewportGetModule).command(PreviewViewportRemoveModule).command(PreviewViewportListModule).command(PreviewViewportUpdateModule).demandCommand(),
|
|
7830
8104
|
handler: () => {
|
|
7831
|
-
|
|
8105
|
+
yargs18.help();
|
|
7832
8106
|
}
|
|
7833
8107
|
};
|
|
7834
8108
|
|
|
7835
8109
|
// src/commands/canvas/commands/prompts.ts
|
|
7836
|
-
import
|
|
8110
|
+
import yargs19 from "yargs";
|
|
7837
8111
|
|
|
7838
8112
|
// src/commands/canvas/commands/prompts/_util.ts
|
|
7839
8113
|
import { PromptClient } from "@uniformdev/canvas";
|
|
@@ -7845,12 +8119,12 @@ var getPromptClient = (options) => new PromptClient({ ...options, bypassCache: t
|
|
|
7845
8119
|
var PromptGetModule = {
|
|
7846
8120
|
command: "get <id>",
|
|
7847
8121
|
describe: "Get a prompt",
|
|
7848
|
-
builder: (
|
|
8122
|
+
builder: (yargs43) => withConfiguration(
|
|
7849
8123
|
withDebugOptions(
|
|
7850
8124
|
withFormatOptions(
|
|
7851
8125
|
withApiOptions(
|
|
7852
8126
|
withProjectOptions(
|
|
7853
|
-
|
|
8127
|
+
yargs43.positional("id", { demandOption: true, describe: "Prompt ID to fetch" })
|
|
7854
8128
|
)
|
|
7855
8129
|
)
|
|
7856
8130
|
)
|
|
@@ -7871,7 +8145,7 @@ var PromptGetModule = {
|
|
|
7871
8145
|
var PromptListModule = {
|
|
7872
8146
|
command: "list",
|
|
7873
8147
|
describe: "List prompts",
|
|
7874
|
-
builder: (
|
|
8148
|
+
builder: (yargs43) => withConfiguration(withDebugOptions(withFormatOptions(withApiOptions(withProjectOptions(yargs43))))),
|
|
7875
8149
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
7876
8150
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7877
8151
|
const client = getPromptClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -7912,13 +8186,13 @@ function createPromptEngineDataSource({
|
|
|
7912
8186
|
var PromptPullModule = {
|
|
7913
8187
|
command: "pull <directory>",
|
|
7914
8188
|
describe: "Pulls all prompts to local files in a directory",
|
|
7915
|
-
builder: (
|
|
8189
|
+
builder: (yargs43) => withConfiguration(
|
|
7916
8190
|
withDebugOptions(
|
|
7917
8191
|
withApiOptions(
|
|
7918
8192
|
withProjectOptions(
|
|
7919
8193
|
withStateOptions(
|
|
7920
8194
|
withDiffOptions(
|
|
7921
|
-
|
|
8195
|
+
yargs43.positional("directory", {
|
|
7922
8196
|
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.",
|
|
7923
8197
|
type: "string"
|
|
7924
8198
|
}).option("format", {
|
|
@@ -7999,12 +8273,12 @@ var PromptPullModule = {
|
|
|
7999
8273
|
var PromptPushModule = {
|
|
8000
8274
|
command: "push <directory>",
|
|
8001
8275
|
describe: "Pushes all prompts from files in a directory to Uniform",
|
|
8002
|
-
builder: (
|
|
8276
|
+
builder: (yargs43) => withConfiguration(
|
|
8003
8277
|
withApiOptions(
|
|
8004
8278
|
withProjectOptions(
|
|
8005
8279
|
withStateOptions(
|
|
8006
8280
|
withDiffOptions(
|
|
8007
|
-
|
|
8281
|
+
yargs43.positional("directory", {
|
|
8008
8282
|
describe: "Directory to read the prompts from. If a filename is used, a package will be read instead.",
|
|
8009
8283
|
type: "string"
|
|
8010
8284
|
}).option("mode", {
|
|
@@ -8073,10 +8347,10 @@ var PromptRemoveModule = {
|
|
|
8073
8347
|
command: "remove <id>",
|
|
8074
8348
|
aliases: ["delete", "rm"],
|
|
8075
8349
|
describe: "Delete a prompt",
|
|
8076
|
-
builder: (
|
|
8350
|
+
builder: (yargs43) => withConfiguration(
|
|
8077
8351
|
withDebugOptions(
|
|
8078
8352
|
withApiOptions(
|
|
8079
|
-
withProjectOptions(
|
|
8353
|
+
withProjectOptions(yargs43.positional("id", { demandOption: true, describe: "Prompt ID to delete" }))
|
|
8080
8354
|
)
|
|
8081
8355
|
)
|
|
8082
8356
|
),
|
|
@@ -8096,11 +8370,11 @@ var PromptUpdateModule = {
|
|
|
8096
8370
|
command: "update <filename>",
|
|
8097
8371
|
aliases: ["put"],
|
|
8098
8372
|
describe: "Insert or update a prompt",
|
|
8099
|
-
builder: (
|
|
8373
|
+
builder: (yargs43) => withConfiguration(
|
|
8100
8374
|
withDebugOptions(
|
|
8101
8375
|
withApiOptions(
|
|
8102
8376
|
withProjectOptions(
|
|
8103
|
-
|
|
8377
|
+
yargs43.positional("filename", { demandOption: true, describe: "Prompt file to put" })
|
|
8104
8378
|
)
|
|
8105
8379
|
)
|
|
8106
8380
|
)
|
|
@@ -8122,14 +8396,14 @@ var PromptModule = {
|
|
|
8122
8396
|
command: "prompt <command>",
|
|
8123
8397
|
aliases: ["dt"],
|
|
8124
8398
|
describe: "Commands for AI Prompt definitions",
|
|
8125
|
-
builder: (
|
|
8399
|
+
builder: (yargs43) => yargs43.command(PromptGetModule).command(PromptListModule).command(PromptPullModule).command(PromptPushModule).command(PromptRemoveModule).command(PromptUpdateModule).demandCommand(),
|
|
8126
8400
|
handler: () => {
|
|
8127
|
-
|
|
8401
|
+
yargs19.help();
|
|
8128
8402
|
}
|
|
8129
8403
|
};
|
|
8130
8404
|
|
|
8131
8405
|
// src/commands/canvas/commands/workflow.ts
|
|
8132
|
-
import
|
|
8406
|
+
import yargs20 from "yargs";
|
|
8133
8407
|
|
|
8134
8408
|
// src/commands/canvas/commands/workflow/_util.ts
|
|
8135
8409
|
import { WorkflowClient } from "@uniformdev/canvas";
|
|
@@ -8172,12 +8446,12 @@ function createWorkflowEngineDataSource({
|
|
|
8172
8446
|
var WorkflowPullModule = {
|
|
8173
8447
|
command: "pull <directory>",
|
|
8174
8448
|
describe: "Pulls all workflows to local files in a directory",
|
|
8175
|
-
builder: (
|
|
8449
|
+
builder: (yargs43) => withConfiguration(
|
|
8176
8450
|
withApiOptions(
|
|
8177
8451
|
withDebugOptions(
|
|
8178
8452
|
withProjectOptions(
|
|
8179
8453
|
withDiffOptions(
|
|
8180
|
-
|
|
8454
|
+
yargs43.positional("directory", {
|
|
8181
8455
|
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.",
|
|
8182
8456
|
type: "string"
|
|
8183
8457
|
}).option("format", {
|
|
@@ -8252,12 +8526,12 @@ var WorkflowPullModule = {
|
|
|
8252
8526
|
var WorkflowPushModule = {
|
|
8253
8527
|
command: "push <directory>",
|
|
8254
8528
|
describe: "Pushes all workflows from files in a directory to Uniform Canvas",
|
|
8255
|
-
builder: (
|
|
8529
|
+
builder: (yargs43) => withConfiguration(
|
|
8256
8530
|
withDebugOptions(
|
|
8257
8531
|
withApiOptions(
|
|
8258
8532
|
withProjectOptions(
|
|
8259
8533
|
withDiffOptions(
|
|
8260
|
-
|
|
8534
|
+
yargs43.positional("directory", {
|
|
8261
8535
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
8262
8536
|
type: "string"
|
|
8263
8537
|
}).option("mode", {
|
|
@@ -8321,9 +8595,9 @@ var WorkflowModule = {
|
|
|
8321
8595
|
command: "workflow <command>",
|
|
8322
8596
|
aliases: ["wf"],
|
|
8323
8597
|
describe: "Commands for Canvas workflows",
|
|
8324
|
-
builder: (
|
|
8598
|
+
builder: (yargs43) => yargs43.command(WorkflowPullModule).command(WorkflowPushModule).demandCommand(),
|
|
8325
8599
|
handler: () => {
|
|
8326
|
-
|
|
8600
|
+
yargs20.help();
|
|
8327
8601
|
}
|
|
8328
8602
|
};
|
|
8329
8603
|
|
|
@@ -8332,17 +8606,17 @@ var CanvasCommand = {
|
|
|
8332
8606
|
command: "canvas <command>",
|
|
8333
8607
|
aliases: ["cv", "pm", "presentation"],
|
|
8334
8608
|
describe: "Uniform Canvas commands",
|
|
8335
|
-
builder: (
|
|
8609
|
+
builder: (yargs43) => yargs43.command(CompositionModule).command(ComponentModule).command(DataTypeModule).command(DataSourceModule).command(CategoryModule).command(ComponentPatternModule).command(CompositionPatternModule).command(ContentTypeModule).command(EntryModule).command(EntryPatternModule).command(PromptModule).command(AssetModule).command(LabelModule).command(LocaleModule).command(WorkflowModule).command(PreviewUrlModule).command(PreviewViewportModule).demandCommand(),
|
|
8336
8610
|
handler: () => {
|
|
8337
|
-
|
|
8611
|
+
yargs21.showHelp();
|
|
8338
8612
|
}
|
|
8339
8613
|
};
|
|
8340
8614
|
|
|
8341
8615
|
// src/commands/context/index.ts
|
|
8342
|
-
import
|
|
8616
|
+
import yargs28 from "yargs";
|
|
8343
8617
|
|
|
8344
8618
|
// src/commands/context/commands/aggregate.ts
|
|
8345
|
-
import
|
|
8619
|
+
import yargs22 from "yargs";
|
|
8346
8620
|
|
|
8347
8621
|
// src/commands/context/commands/aggregate/_util.ts
|
|
8348
8622
|
import { AggregateClient } from "@uniformdev/context/api";
|
|
@@ -8354,11 +8628,11 @@ var getAggregateClient = (options) => new AggregateClient({ ...options, bypassCa
|
|
|
8354
8628
|
var AggregateGetModule = {
|
|
8355
8629
|
command: "get <id>",
|
|
8356
8630
|
describe: "Fetch an aggregate",
|
|
8357
|
-
builder: (
|
|
8631
|
+
builder: (yargs43) => withConfiguration(
|
|
8358
8632
|
withFormatOptions(
|
|
8359
8633
|
withApiOptions(
|
|
8360
8634
|
withProjectOptions(
|
|
8361
|
-
|
|
8635
|
+
yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to fetch" })
|
|
8362
8636
|
)
|
|
8363
8637
|
)
|
|
8364
8638
|
)
|
|
@@ -8381,7 +8655,7 @@ var AggregateListModule = {
|
|
|
8381
8655
|
command: "list",
|
|
8382
8656
|
describe: "List aggregates",
|
|
8383
8657
|
aliases: ["ls"],
|
|
8384
|
-
builder: (
|
|
8658
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
8385
8659
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8386
8660
|
const fetch2 = nodeFetchProxy(proxy);
|
|
8387
8661
|
const client = getAggregateClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -8444,12 +8718,12 @@ function writeContextPackage(filename, packageContents) {
|
|
|
8444
8718
|
var AggregatePullModule = {
|
|
8445
8719
|
command: "pull <directory>",
|
|
8446
8720
|
describe: "Pulls all aggregates to local files in a directory",
|
|
8447
|
-
builder: (
|
|
8721
|
+
builder: (yargs43) => withConfiguration(
|
|
8448
8722
|
withApiOptions(
|
|
8449
8723
|
withDebugOptions(
|
|
8450
8724
|
withProjectOptions(
|
|
8451
8725
|
withDiffOptions(
|
|
8452
|
-
|
|
8726
|
+
yargs43.positional("directory", {
|
|
8453
8727
|
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.",
|
|
8454
8728
|
type: "string"
|
|
8455
8729
|
}).option("format", {
|
|
@@ -8524,12 +8798,12 @@ var AggregatePullModule = {
|
|
|
8524
8798
|
var AggregatePushModule = {
|
|
8525
8799
|
command: "push <directory>",
|
|
8526
8800
|
describe: "Pushes all aggregates from files in a directory or package to Uniform",
|
|
8527
|
-
builder: (
|
|
8801
|
+
builder: (yargs43) => withConfiguration(
|
|
8528
8802
|
withApiOptions(
|
|
8529
8803
|
withProjectOptions(
|
|
8530
8804
|
withDiffOptions(
|
|
8531
8805
|
withDebugOptions(
|
|
8532
|
-
|
|
8806
|
+
yargs43.positional("directory", {
|
|
8533
8807
|
describe: "Directory to read the aggregates from. If a filename is used, a package will be read instead.",
|
|
8534
8808
|
type: "string"
|
|
8535
8809
|
}).option("mode", {
|
|
@@ -8594,10 +8868,10 @@ var AggregateRemoveModule = {
|
|
|
8594
8868
|
command: "remove <id>",
|
|
8595
8869
|
aliases: ["delete", "rm"],
|
|
8596
8870
|
describe: "Delete an aggregate",
|
|
8597
|
-
builder: (
|
|
8871
|
+
builder: (yargs43) => withConfiguration(
|
|
8598
8872
|
withApiOptions(
|
|
8599
8873
|
withProjectOptions(
|
|
8600
|
-
|
|
8874
|
+
yargs43.positional("id", { demandOption: true, describe: "Aggregate public ID to delete" })
|
|
8601
8875
|
)
|
|
8602
8876
|
)
|
|
8603
8877
|
),
|
|
@@ -8613,10 +8887,10 @@ var AggregateUpdateModule = {
|
|
|
8613
8887
|
command: "update <filename>",
|
|
8614
8888
|
aliases: ["put"],
|
|
8615
8889
|
describe: "Insert or update an aggregate",
|
|
8616
|
-
builder: (
|
|
8890
|
+
builder: (yargs43) => withConfiguration(
|
|
8617
8891
|
withApiOptions(
|
|
8618
8892
|
withProjectOptions(
|
|
8619
|
-
|
|
8893
|
+
yargs43.positional("filename", { demandOption: true, describe: "Aggregate file to put" })
|
|
8620
8894
|
)
|
|
8621
8895
|
)
|
|
8622
8896
|
),
|
|
@@ -8633,14 +8907,14 @@ var AggregateModule = {
|
|
|
8633
8907
|
command: "aggregate <command>",
|
|
8634
8908
|
aliases: ["agg", "intent", "audience"],
|
|
8635
8909
|
describe: "Commands for Context aggregates (intents, audiences)",
|
|
8636
|
-
builder: (
|
|
8910
|
+
builder: (yargs43) => yargs43.command(AggregatePullModule).command(AggregatePushModule).command(AggregateGetModule).command(AggregateRemoveModule).command(AggregateListModule).command(AggregateUpdateModule).demandCommand(),
|
|
8637
8911
|
handler: () => {
|
|
8638
|
-
|
|
8912
|
+
yargs22.help();
|
|
8639
8913
|
}
|
|
8640
8914
|
};
|
|
8641
8915
|
|
|
8642
8916
|
// src/commands/context/commands/enrichment.ts
|
|
8643
|
-
import
|
|
8917
|
+
import yargs23 from "yargs";
|
|
8644
8918
|
|
|
8645
8919
|
// src/commands/context/commands/enrichment/_util.ts
|
|
8646
8920
|
import { UncachedEnrichmentClient } from "@uniformdev/context/api";
|
|
@@ -8654,11 +8928,11 @@ function getEnrichmentClient(options) {
|
|
|
8654
8928
|
var EnrichmentGetModule = {
|
|
8655
8929
|
command: "get <id>",
|
|
8656
8930
|
describe: "Fetch an enrichment category and its values",
|
|
8657
|
-
builder: (
|
|
8931
|
+
builder: (yargs43) => withFormatOptions(
|
|
8658
8932
|
withConfiguration(
|
|
8659
8933
|
withApiOptions(
|
|
8660
8934
|
withProjectOptions(
|
|
8661
|
-
|
|
8935
|
+
yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to fetch" })
|
|
8662
8936
|
)
|
|
8663
8937
|
)
|
|
8664
8938
|
)
|
|
@@ -8681,7 +8955,7 @@ var EnrichmentListModule = {
|
|
|
8681
8955
|
command: "list",
|
|
8682
8956
|
describe: "List enrichments",
|
|
8683
8957
|
aliases: ["ls"],
|
|
8684
|
-
builder: (
|
|
8958
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
8685
8959
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
8686
8960
|
const fetch2 = nodeFetchProxy(proxy);
|
|
8687
8961
|
const client = getEnrichmentClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -8776,12 +9050,12 @@ var createEnrichmentValueEngineDataSource = ({
|
|
|
8776
9050
|
var EnrichmentPullModule = {
|
|
8777
9051
|
command: "pull <directory>",
|
|
8778
9052
|
describe: "Pulls all enrichments to local files in a directory",
|
|
8779
|
-
builder: (
|
|
9053
|
+
builder: (yargs43) => withConfiguration(
|
|
8780
9054
|
withDebugOptions(
|
|
8781
9055
|
withApiOptions(
|
|
8782
9056
|
withProjectOptions(
|
|
8783
9057
|
withDiffOptions(
|
|
8784
|
-
|
|
9058
|
+
yargs43.positional("directory", {
|
|
8785
9059
|
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.",
|
|
8786
9060
|
type: "string"
|
|
8787
9061
|
}).option("format", {
|
|
@@ -8856,11 +9130,11 @@ var EnrichmentPullModule = {
|
|
|
8856
9130
|
var EnrichmentPushModule = {
|
|
8857
9131
|
command: "push <directory>",
|
|
8858
9132
|
describe: "Pushes all enrichments from files in a directory or package to Uniform",
|
|
8859
|
-
builder: (
|
|
9133
|
+
builder: (yargs43) => withConfiguration(
|
|
8860
9134
|
withApiOptions(
|
|
8861
9135
|
withProjectOptions(
|
|
8862
9136
|
withDiffOptions(
|
|
8863
|
-
|
|
9137
|
+
yargs43.positional("directory", {
|
|
8864
9138
|
describe: "Directory to read the enrichments from. If a filename is used, a package will be read instead.",
|
|
8865
9139
|
type: "string"
|
|
8866
9140
|
}).option("mode", {
|
|
@@ -8923,10 +9197,10 @@ var EnrichmentRemoveModule = {
|
|
|
8923
9197
|
command: "remove <id>",
|
|
8924
9198
|
aliases: ["delete", "rm"],
|
|
8925
9199
|
describe: "Delete an enrichment category and its values",
|
|
8926
|
-
builder: (
|
|
9200
|
+
builder: (yargs43) => withConfiguration(
|
|
8927
9201
|
withApiOptions(
|
|
8928
9202
|
withProjectOptions(
|
|
8929
|
-
|
|
9203
|
+
yargs43.positional("id", { demandOption: true, describe: "Enrichment category public ID to delete" })
|
|
8930
9204
|
)
|
|
8931
9205
|
)
|
|
8932
9206
|
),
|
|
@@ -8942,17 +9216,17 @@ var EnrichmentModule = {
|
|
|
8942
9216
|
command: "enrichment <command>",
|
|
8943
9217
|
aliases: ["enr"],
|
|
8944
9218
|
describe: "Commands for Context enrichments",
|
|
8945
|
-
builder: (
|
|
9219
|
+
builder: (yargs43) => yargs43.command(EnrichmentPullModule).command(EnrichmentPushModule).command(EnrichmentGetModule).command(EnrichmentRemoveModule).command(EnrichmentListModule).demandCommand(),
|
|
8946
9220
|
handler: () => {
|
|
8947
|
-
|
|
9221
|
+
yargs23.help();
|
|
8948
9222
|
}
|
|
8949
9223
|
};
|
|
8950
9224
|
|
|
8951
9225
|
// src/commands/context/commands/manifest.ts
|
|
8952
|
-
import
|
|
9226
|
+
import yargs24 from "yargs";
|
|
8953
9227
|
|
|
8954
9228
|
// src/commands/context/commands/manifest/get.ts
|
|
8955
|
-
import { ApiClientError as
|
|
9229
|
+
import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
|
|
8956
9230
|
import { gray as gray4, green as green6, red as red6 } from "colorette";
|
|
8957
9231
|
import { writeFile } from "fs";
|
|
8958
9232
|
import { exit } from "process";
|
|
@@ -8960,10 +9234,10 @@ var ManifestGetModule = {
|
|
|
8960
9234
|
command: "get [output]",
|
|
8961
9235
|
aliases: ["dl", "download"],
|
|
8962
9236
|
describe: "Download the Uniform Context manifest for a project",
|
|
8963
|
-
builder: (
|
|
9237
|
+
builder: (yargs43) => withConfiguration(
|
|
8964
9238
|
withApiOptions(
|
|
8965
9239
|
withProjectOptions(
|
|
8966
|
-
|
|
9240
|
+
yargs43.option("preview", {
|
|
8967
9241
|
describe: "If set, fetches the unpublished preview manifest (The API key must have permission)",
|
|
8968
9242
|
default: false,
|
|
8969
9243
|
type: "boolean",
|
|
@@ -9003,7 +9277,7 @@ var ManifestGetModule = {
|
|
|
9003
9277
|
}
|
|
9004
9278
|
} catch (e) {
|
|
9005
9279
|
let message;
|
|
9006
|
-
if (e instanceof
|
|
9280
|
+
if (e instanceof ApiClientError5) {
|
|
9007
9281
|
if (e.statusCode === 403) {
|
|
9008
9282
|
message = `The API key ${apiKey} did not have permissions to fetch the manifest. Ensure ${preview ? "Uniform Context > Read Drafts" : "Uniform Context > Manifest > Read"} permissions are granted.`;
|
|
9009
9283
|
}
|
|
@@ -9019,13 +9293,13 @@ var ManifestGetModule = {
|
|
|
9019
9293
|
};
|
|
9020
9294
|
|
|
9021
9295
|
// src/commands/context/commands/manifest/publish.ts
|
|
9022
|
-
import { ApiClientError as
|
|
9296
|
+
import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
|
|
9023
9297
|
import { gray as gray5, red as red7 } from "colorette";
|
|
9024
9298
|
import { exit as exit2 } from "process";
|
|
9025
9299
|
var ManifestPublishModule = {
|
|
9026
9300
|
command: "publish",
|
|
9027
9301
|
describe: "Publish the Uniform Context manifest for a project",
|
|
9028
|
-
builder: (
|
|
9302
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(yargs43))),
|
|
9029
9303
|
handler: async ({ apiKey, apiHost, proxy, project }) => {
|
|
9030
9304
|
const fetch2 = nodeFetchProxy(proxy);
|
|
9031
9305
|
try {
|
|
@@ -9038,7 +9312,7 @@ var ManifestPublishModule = {
|
|
|
9038
9312
|
await client.publish();
|
|
9039
9313
|
} catch (e) {
|
|
9040
9314
|
let message;
|
|
9041
|
-
if (e instanceof
|
|
9315
|
+
if (e instanceof ApiClientError6) {
|
|
9042
9316
|
if (e.statusCode === 403) {
|
|
9043
9317
|
message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
|
|
9044
9318
|
}
|
|
@@ -9058,25 +9332,25 @@ var ManifestModule = {
|
|
|
9058
9332
|
command: "manifest <command>",
|
|
9059
9333
|
describe: "Commands for context manifests",
|
|
9060
9334
|
aliases: ["man"],
|
|
9061
|
-
builder: (
|
|
9335
|
+
builder: (yargs43) => yargs43.command(ManifestGetModule).command(ManifestPublishModule).demandCommand(),
|
|
9062
9336
|
handler: () => {
|
|
9063
|
-
|
|
9337
|
+
yargs24.help();
|
|
9064
9338
|
}
|
|
9065
9339
|
};
|
|
9066
9340
|
|
|
9067
9341
|
// src/commands/context/commands/quirk.ts
|
|
9068
|
-
import
|
|
9342
|
+
import yargs25 from "yargs";
|
|
9069
9343
|
|
|
9070
9344
|
// src/commands/context/commands/quirk/get.ts
|
|
9071
9345
|
import { UncachedQuirkClient } from "@uniformdev/context/api";
|
|
9072
9346
|
var QuirkGetModule = {
|
|
9073
9347
|
command: "get <id>",
|
|
9074
9348
|
describe: "Fetch a quirk",
|
|
9075
|
-
builder: (
|
|
9349
|
+
builder: (yargs43) => withConfiguration(
|
|
9076
9350
|
withFormatOptions(
|
|
9077
9351
|
withApiOptions(
|
|
9078
9352
|
withProjectOptions(
|
|
9079
|
-
|
|
9353
|
+
yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to fetch" })
|
|
9080
9354
|
)
|
|
9081
9355
|
)
|
|
9082
9356
|
)
|
|
@@ -9100,11 +9374,11 @@ var QuirkListModule = {
|
|
|
9100
9374
|
command: "list",
|
|
9101
9375
|
describe: "List quirks",
|
|
9102
9376
|
aliases: ["ls"],
|
|
9103
|
-
builder: (
|
|
9377
|
+
builder: (yargs43) => withConfiguration(
|
|
9104
9378
|
withFormatOptions(
|
|
9105
9379
|
withApiOptions(
|
|
9106
9380
|
withProjectOptions(
|
|
9107
|
-
|
|
9381
|
+
yargs43.option("withIntegrations", {
|
|
9108
9382
|
alias: ["i"],
|
|
9109
9383
|
describe: "Whether to include meta-quirks created by integrations in the list. Defaults to false.",
|
|
9110
9384
|
type: "boolean"
|
|
@@ -9162,12 +9436,12 @@ function createQuirkEngineDataSource({
|
|
|
9162
9436
|
var QuirkPullModule = {
|
|
9163
9437
|
command: "pull <directory>",
|
|
9164
9438
|
describe: "Pulls all quirks to local files in a directory",
|
|
9165
|
-
builder: (
|
|
9439
|
+
builder: (yargs43) => withConfiguration(
|
|
9166
9440
|
withDebugOptions(
|
|
9167
9441
|
withApiOptions(
|
|
9168
9442
|
withProjectOptions(
|
|
9169
9443
|
withDiffOptions(
|
|
9170
|
-
|
|
9444
|
+
yargs43.positional("directory", {
|
|
9171
9445
|
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.",
|
|
9172
9446
|
type: "string"
|
|
9173
9447
|
}).option("format", {
|
|
@@ -9243,12 +9517,12 @@ import { UncachedQuirkClient as UncachedQuirkClient4 } from "@uniformdev/context
|
|
|
9243
9517
|
var QuirkPushModule = {
|
|
9244
9518
|
command: "push <directory>",
|
|
9245
9519
|
describe: "Pushes all quirks from files in a directory or package to Uniform",
|
|
9246
|
-
builder: (
|
|
9520
|
+
builder: (yargs43) => withConfiguration(
|
|
9247
9521
|
withDebugOptions(
|
|
9248
9522
|
withApiOptions(
|
|
9249
9523
|
withProjectOptions(
|
|
9250
9524
|
withDiffOptions(
|
|
9251
|
-
|
|
9525
|
+
yargs43.positional("directory", {
|
|
9252
9526
|
describe: "Directory to read the quirks from. If a filename is used, a package will be read instead.",
|
|
9253
9527
|
type: "string"
|
|
9254
9528
|
}).option("mode", {
|
|
@@ -9313,10 +9587,10 @@ var QuirkRemoveModule = {
|
|
|
9313
9587
|
command: "remove <id>",
|
|
9314
9588
|
aliases: ["delete", "rm"],
|
|
9315
9589
|
describe: "Delete a quirk",
|
|
9316
|
-
builder: (
|
|
9590
|
+
builder: (yargs43) => withConfiguration(
|
|
9317
9591
|
withApiOptions(
|
|
9318
9592
|
withProjectOptions(
|
|
9319
|
-
|
|
9593
|
+
yargs43.positional("id", { demandOption: true, describe: "Quirk public ID to delete" })
|
|
9320
9594
|
)
|
|
9321
9595
|
)
|
|
9322
9596
|
),
|
|
@@ -9333,10 +9607,10 @@ var QuirkUpdateModule = {
|
|
|
9333
9607
|
command: "update <filename>",
|
|
9334
9608
|
aliases: ["put"],
|
|
9335
9609
|
describe: "Insert or update a quirk",
|
|
9336
|
-
builder: (
|
|
9610
|
+
builder: (yargs43) => withConfiguration(
|
|
9337
9611
|
withApiOptions(
|
|
9338
9612
|
withProjectOptions(
|
|
9339
|
-
|
|
9613
|
+
yargs43.positional("filename", { demandOption: true, describe: "Quirk file to put" })
|
|
9340
9614
|
)
|
|
9341
9615
|
)
|
|
9342
9616
|
),
|
|
@@ -9353,25 +9627,25 @@ var QuirkModule = {
|
|
|
9353
9627
|
command: "quirk <command>",
|
|
9354
9628
|
aliases: ["qk"],
|
|
9355
9629
|
describe: "Commands for Context quirks",
|
|
9356
|
-
builder: (
|
|
9630
|
+
builder: (yargs43) => yargs43.command(QuirkPullModule).command(QuirkPushModule).command(QuirkGetModule).command(QuirkRemoveModule).command(QuirkListModule).command(QuirkUpdateModule).demandCommand(),
|
|
9357
9631
|
handler: () => {
|
|
9358
|
-
|
|
9632
|
+
yargs25.help();
|
|
9359
9633
|
}
|
|
9360
9634
|
};
|
|
9361
9635
|
|
|
9362
9636
|
// src/commands/context/commands/signal.ts
|
|
9363
|
-
import
|
|
9637
|
+
import yargs26 from "yargs";
|
|
9364
9638
|
|
|
9365
9639
|
// src/commands/context/commands/signal/get.ts
|
|
9366
9640
|
import { UncachedSignalClient } from "@uniformdev/context/api";
|
|
9367
9641
|
var SignalGetModule = {
|
|
9368
9642
|
command: "get <id>",
|
|
9369
9643
|
describe: "Fetch a signal",
|
|
9370
|
-
builder: (
|
|
9644
|
+
builder: (yargs43) => withConfiguration(
|
|
9371
9645
|
withFormatOptions(
|
|
9372
9646
|
withApiOptions(
|
|
9373
9647
|
withProjectOptions(
|
|
9374
|
-
|
|
9648
|
+
yargs43.positional("id", { demandOption: true, describe: "Signal public ID to fetch" })
|
|
9375
9649
|
)
|
|
9376
9650
|
)
|
|
9377
9651
|
)
|
|
@@ -9395,7 +9669,7 @@ var SignalListModule = {
|
|
|
9395
9669
|
command: "list",
|
|
9396
9670
|
describe: "List signals",
|
|
9397
9671
|
aliases: ["ls"],
|
|
9398
|
-
builder: (
|
|
9672
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
9399
9673
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
9400
9674
|
const fetch2 = nodeFetchProxy(proxy);
|
|
9401
9675
|
const client = new UncachedSignalClient2({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -9445,12 +9719,12 @@ function createSignalEngineDataSource({
|
|
|
9445
9719
|
var SignalPullModule = {
|
|
9446
9720
|
command: "pull <directory>",
|
|
9447
9721
|
describe: "Pulls all signals to local files in a directory",
|
|
9448
|
-
builder: (
|
|
9722
|
+
builder: (yargs43) => withConfiguration(
|
|
9449
9723
|
withDebugOptions(
|
|
9450
9724
|
withApiOptions(
|
|
9451
9725
|
withProjectOptions(
|
|
9452
9726
|
withDiffOptions(
|
|
9453
|
-
|
|
9727
|
+
yargs43.positional("directory", {
|
|
9454
9728
|
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.",
|
|
9455
9729
|
type: "string"
|
|
9456
9730
|
}).option("format", {
|
|
@@ -9526,12 +9800,12 @@ import { UncachedSignalClient as UncachedSignalClient4 } from "@uniformdev/conte
|
|
|
9526
9800
|
var SignalPushModule = {
|
|
9527
9801
|
command: "push <directory>",
|
|
9528
9802
|
describe: "Pushes all signals from files in a directory or package to Uniform",
|
|
9529
|
-
builder: (
|
|
9803
|
+
builder: (yargs43) => withConfiguration(
|
|
9530
9804
|
withDebugOptions(
|
|
9531
9805
|
withApiOptions(
|
|
9532
9806
|
withProjectOptions(
|
|
9533
9807
|
withDiffOptions(
|
|
9534
|
-
|
|
9808
|
+
yargs43.positional("directory", {
|
|
9535
9809
|
describe: "Directory to read the signals from. If a filename is used, a package will be read instead.",
|
|
9536
9810
|
type: "string"
|
|
9537
9811
|
}).option("mode", {
|
|
@@ -9596,10 +9870,10 @@ var SignalRemoveModule = {
|
|
|
9596
9870
|
command: "remove <id>",
|
|
9597
9871
|
aliases: ["delete", "rm"],
|
|
9598
9872
|
describe: "Delete a signal",
|
|
9599
|
-
builder: (
|
|
9873
|
+
builder: (yargs43) => withConfiguration(
|
|
9600
9874
|
withApiOptions(
|
|
9601
9875
|
withProjectOptions(
|
|
9602
|
-
|
|
9876
|
+
yargs43.positional("id", { demandOption: true, describe: "Signal public ID to delete" })
|
|
9603
9877
|
)
|
|
9604
9878
|
)
|
|
9605
9879
|
),
|
|
@@ -9616,10 +9890,10 @@ var SignalUpdateModule = {
|
|
|
9616
9890
|
command: "update <filename>",
|
|
9617
9891
|
aliases: ["put"],
|
|
9618
9892
|
describe: "Insert or update a signal",
|
|
9619
|
-
builder: (
|
|
9893
|
+
builder: (yargs43) => withConfiguration(
|
|
9620
9894
|
withApiOptions(
|
|
9621
9895
|
withProjectOptions(
|
|
9622
|
-
|
|
9896
|
+
yargs43.positional("filename", { demandOption: true, describe: "Signal file to put" })
|
|
9623
9897
|
)
|
|
9624
9898
|
)
|
|
9625
9899
|
),
|
|
@@ -9636,25 +9910,25 @@ var SignalModule = {
|
|
|
9636
9910
|
command: "signal <command>",
|
|
9637
9911
|
aliases: ["sig"],
|
|
9638
9912
|
describe: "Commands for Context signals",
|
|
9639
|
-
builder: (
|
|
9913
|
+
builder: (yargs43) => yargs43.command(SignalPullModule).command(SignalPushModule).command(SignalGetModule).command(SignalRemoveModule).command(SignalListModule).command(SignalUpdateModule).demandCommand(),
|
|
9640
9914
|
handler: () => {
|
|
9641
|
-
|
|
9915
|
+
yargs26.help();
|
|
9642
9916
|
}
|
|
9643
9917
|
};
|
|
9644
9918
|
|
|
9645
9919
|
// src/commands/context/commands/test.ts
|
|
9646
|
-
import
|
|
9920
|
+
import yargs27 from "yargs";
|
|
9647
9921
|
|
|
9648
9922
|
// src/commands/context/commands/test/get.ts
|
|
9649
9923
|
import { UncachedTestClient } from "@uniformdev/context/api";
|
|
9650
9924
|
var TestGetModule = {
|
|
9651
9925
|
command: "get <id>",
|
|
9652
9926
|
describe: "Fetch a test",
|
|
9653
|
-
builder: (
|
|
9927
|
+
builder: (yargs43) => withConfiguration(
|
|
9654
9928
|
withFormatOptions(
|
|
9655
9929
|
withApiOptions(
|
|
9656
9930
|
withProjectOptions(
|
|
9657
|
-
|
|
9931
|
+
yargs43.positional("id", { demandOption: true, describe: "Test public ID to fetch" })
|
|
9658
9932
|
)
|
|
9659
9933
|
)
|
|
9660
9934
|
)
|
|
@@ -9678,7 +9952,7 @@ var TestListModule = {
|
|
|
9678
9952
|
command: "list",
|
|
9679
9953
|
describe: "List tests",
|
|
9680
9954
|
aliases: ["ls"],
|
|
9681
|
-
builder: (
|
|
9955
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
9682
9956
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
9683
9957
|
const fetch2 = nodeFetchProxy(proxy);
|
|
9684
9958
|
const client = new UncachedTestClient2({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -9728,12 +10002,12 @@ function createTestEngineDataSource({
|
|
|
9728
10002
|
var TestPullModule = {
|
|
9729
10003
|
command: "pull <directory>",
|
|
9730
10004
|
describe: "Pulls all tests to local files in a directory",
|
|
9731
|
-
builder: (
|
|
10005
|
+
builder: (yargs43) => withConfiguration(
|
|
9732
10006
|
withDebugOptions(
|
|
9733
10007
|
withApiOptions(
|
|
9734
10008
|
withProjectOptions(
|
|
9735
10009
|
withDiffOptions(
|
|
9736
|
-
|
|
10010
|
+
yargs43.positional("directory", {
|
|
9737
10011
|
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.",
|
|
9738
10012
|
type: "string"
|
|
9739
10013
|
}).option("format", {
|
|
@@ -9809,12 +10083,12 @@ import { UncachedTestClient as UncachedTestClient4 } from "@uniformdev/context/a
|
|
|
9809
10083
|
var TestPushModule = {
|
|
9810
10084
|
command: "push <directory>",
|
|
9811
10085
|
describe: "Pushes all tests from files in a directory or package to Uniform",
|
|
9812
|
-
builder: (
|
|
10086
|
+
builder: (yargs43) => withConfiguration(
|
|
9813
10087
|
withDebugOptions(
|
|
9814
10088
|
withApiOptions(
|
|
9815
10089
|
withProjectOptions(
|
|
9816
10090
|
withDiffOptions(
|
|
9817
|
-
|
|
10091
|
+
yargs43.positional("directory", {
|
|
9818
10092
|
describe: "Directory to read the tests from. If a filename is used, a package will be read instead.",
|
|
9819
10093
|
type: "string"
|
|
9820
10094
|
}).option("mode", {
|
|
@@ -9879,10 +10153,10 @@ var TestRemoveModule = {
|
|
|
9879
10153
|
command: "remove <id>",
|
|
9880
10154
|
aliases: ["delete", "rm"],
|
|
9881
10155
|
describe: "Delete a test",
|
|
9882
|
-
builder: (
|
|
10156
|
+
builder: (yargs43) => withConfiguration(
|
|
9883
10157
|
withApiOptions(
|
|
9884
10158
|
withProjectOptions(
|
|
9885
|
-
|
|
10159
|
+
yargs43.positional("id", { demandOption: true, describe: "Test public ID to delete" })
|
|
9886
10160
|
)
|
|
9887
10161
|
)
|
|
9888
10162
|
),
|
|
@@ -9899,9 +10173,9 @@ var TestUpdateModule = {
|
|
|
9899
10173
|
command: "update <filename>",
|
|
9900
10174
|
aliases: ["put"],
|
|
9901
10175
|
describe: "Insert or update a test",
|
|
9902
|
-
builder: (
|
|
10176
|
+
builder: (yargs43) => withConfiguration(
|
|
9903
10177
|
withApiOptions(
|
|
9904
|
-
withProjectOptions(
|
|
10178
|
+
withProjectOptions(yargs43.positional("filename", { demandOption: true, describe: "Test file to put" }))
|
|
9905
10179
|
)
|
|
9906
10180
|
),
|
|
9907
10181
|
handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
|
|
@@ -9916,9 +10190,9 @@ var TestUpdateModule = {
|
|
|
9916
10190
|
var TestModule = {
|
|
9917
10191
|
command: "test <command>",
|
|
9918
10192
|
describe: "Commands for Context A/B tests",
|
|
9919
|
-
builder: (
|
|
10193
|
+
builder: (yargs43) => yargs43.command(TestPullModule).command(TestPushModule).command(TestGetModule).command(TestRemoveModule).command(TestListModule).command(TestUpdateModule).demandCommand(),
|
|
9920
10194
|
handler: () => {
|
|
9921
|
-
|
|
10195
|
+
yargs27.help();
|
|
9922
10196
|
}
|
|
9923
10197
|
};
|
|
9924
10198
|
|
|
@@ -9927,20 +10201,20 @@ var ContextCommand = {
|
|
|
9927
10201
|
command: "context <command>",
|
|
9928
10202
|
aliases: ["ctx"],
|
|
9929
10203
|
describe: "Uniform Context commands",
|
|
9930
|
-
builder: (
|
|
10204
|
+
builder: (yargs43) => yargs43.command(ManifestModule).command(SignalModule).command(EnrichmentModule).command(AggregateModule).command(QuirkModule).command(TestModule).demandCommand(),
|
|
9931
10205
|
handler: () => {
|
|
9932
|
-
|
|
10206
|
+
yargs28.showHelp();
|
|
9933
10207
|
}
|
|
9934
10208
|
};
|
|
9935
10209
|
|
|
9936
10210
|
// src/commands/integration/index.ts
|
|
9937
|
-
import
|
|
10211
|
+
import yargs33 from "yargs";
|
|
9938
10212
|
|
|
9939
10213
|
// src/commands/integration/commands/definition.ts
|
|
9940
|
-
import
|
|
10214
|
+
import yargs32 from "yargs";
|
|
9941
10215
|
|
|
9942
10216
|
// src/commands/integration/commands/definition/dataResourceEditor/dataResourceEditor.ts
|
|
9943
|
-
import
|
|
10217
|
+
import yargs29 from "yargs";
|
|
9944
10218
|
|
|
9945
10219
|
// src/commands/integration/commands/definition/dataResourceEditor/deploy.ts
|
|
9946
10220
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -10011,8 +10285,8 @@ var EdgehancerClient = class extends ApiClient {
|
|
|
10011
10285
|
};
|
|
10012
10286
|
|
|
10013
10287
|
// src/commands/integration/commands/definition/dataResourceEditor/util.ts
|
|
10014
|
-
function withDataResourceEditorIdOptions(
|
|
10015
|
-
return
|
|
10288
|
+
function withDataResourceEditorIdOptions(yargs43) {
|
|
10289
|
+
return yargs43.option("connectorType", {
|
|
10016
10290
|
describe: "Integration data connector type to attach the data resource editor to, as defined in the integration manifest file.",
|
|
10017
10291
|
demandOption: true,
|
|
10018
10292
|
type: "string"
|
|
@@ -10032,11 +10306,11 @@ function withDataResourceEditorIdOptions(yargs41) {
|
|
|
10032
10306
|
var IntegrationDataResourceEditorDeployModule = {
|
|
10033
10307
|
command: "deploy <filename>",
|
|
10034
10308
|
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.",
|
|
10035
|
-
builder: (
|
|
10309
|
+
builder: (yargs43) => withConfiguration(
|
|
10036
10310
|
withApiOptions(
|
|
10037
10311
|
withTeamOptions(
|
|
10038
10312
|
withDataResourceEditorIdOptions(
|
|
10039
|
-
|
|
10313
|
+
yargs43.positional("filename", {
|
|
10040
10314
|
demandOption: true,
|
|
10041
10315
|
describe: "ESM code file to run for the target data resource editor hook. Refer to the documentation for expected types."
|
|
10042
10316
|
}).option("compatibilityDate", {
|
|
@@ -10079,7 +10353,7 @@ var IntegrationDataResourceEditorDeployModule = {
|
|
|
10079
10353
|
var IntegrationDataResourceEditorRemoveModule = {
|
|
10080
10354
|
command: "remove",
|
|
10081
10355
|
describe: "Removes a custom AI data resource editor hook from a data resource archetype. The API key used must have team admin permissions.",
|
|
10082
|
-
builder: (
|
|
10356
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withDataResourceEditorIdOptions(yargs43)))),
|
|
10083
10357
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, connectorType, archetype, hook }) => {
|
|
10084
10358
|
const fetch2 = nodeFetchProxy(proxy);
|
|
10085
10359
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
|
|
@@ -10091,21 +10365,21 @@ var IntegrationDataResourceEditorRemoveModule = {
|
|
|
10091
10365
|
var IntegrationDataResourceEditorModule = {
|
|
10092
10366
|
command: "dataResourceEditor <command>",
|
|
10093
10367
|
describe: "Commands for managing custom AI data resource editors at the team level.",
|
|
10094
|
-
builder: (
|
|
10368
|
+
builder: (yargs43) => yargs43.command(IntegrationDataResourceEditorDeployModule).command(IntegrationDataResourceEditorRemoveModule).demandCommand(),
|
|
10095
10369
|
handler: () => {
|
|
10096
|
-
|
|
10370
|
+
yargs29.help();
|
|
10097
10371
|
}
|
|
10098
10372
|
};
|
|
10099
10373
|
|
|
10100
10374
|
// src/commands/integration/commands/definition/edgehancer/edgehancer.ts
|
|
10101
|
-
import
|
|
10375
|
+
import yargs30 from "yargs";
|
|
10102
10376
|
|
|
10103
10377
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
10104
10378
|
import { readFileSync as readFileSync3 } from "fs";
|
|
10105
10379
|
|
|
10106
10380
|
// src/commands/integration/commands/definition/edgehancer/util.ts
|
|
10107
|
-
function withEdgehancerIdOptions(
|
|
10108
|
-
return
|
|
10381
|
+
function withEdgehancerIdOptions(yargs43) {
|
|
10382
|
+
return yargs43.option("connectorType", {
|
|
10109
10383
|
describe: "Integration data connector type to edgehance, as defined in the integration manifest file.",
|
|
10110
10384
|
demandOption: true,
|
|
10111
10385
|
type: "string"
|
|
@@ -10125,11 +10399,11 @@ function withEdgehancerIdOptions(yargs41) {
|
|
|
10125
10399
|
var IntegrationEdgehancerDeployModule = {
|
|
10126
10400
|
command: "deploy <filename>",
|
|
10127
10401
|
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.",
|
|
10128
|
-
builder: (
|
|
10402
|
+
builder: (yargs43) => withConfiguration(
|
|
10129
10403
|
withApiOptions(
|
|
10130
10404
|
withTeamOptions(
|
|
10131
10405
|
withEdgehancerIdOptions(
|
|
10132
|
-
|
|
10406
|
+
yargs43.positional("filename", {
|
|
10133
10407
|
demandOption: true,
|
|
10134
10408
|
describe: "ESM code file to run for the target edgehancer hook. Refer to the documentation for expected types."
|
|
10135
10409
|
}).option("compatibilityDate", {
|
|
@@ -10172,7 +10446,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
10172
10446
|
var IntegrationEdgehancerRemoveModule = {
|
|
10173
10447
|
command: "remove",
|
|
10174
10448
|
describe: "Deletes a custom edgehancer hook from a data connector archetype. The API key used must have team admin permissions.",
|
|
10175
|
-
builder: (
|
|
10449
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withEdgehancerIdOptions(yargs43)))),
|
|
10176
10450
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, archetype, connectorType, hook }) => {
|
|
10177
10451
|
const fetch2 = nodeFetchProxy(proxy);
|
|
10178
10452
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch2, teamId });
|
|
@@ -10184,22 +10458,22 @@ var IntegrationEdgehancerRemoveModule = {
|
|
|
10184
10458
|
var IntegrationEdgehancerModule = {
|
|
10185
10459
|
command: "edgehancer <command>",
|
|
10186
10460
|
describe: "Commands for managing custom integration edgehancers at the team level.",
|
|
10187
|
-
builder: (
|
|
10461
|
+
builder: (yargs43) => yargs43.command(IntegrationEdgehancerDeployModule).command(IntegrationEdgehancerRemoveModule).demandCommand(),
|
|
10188
10462
|
handler: () => {
|
|
10189
|
-
|
|
10463
|
+
yargs30.help();
|
|
10190
10464
|
}
|
|
10191
10465
|
};
|
|
10192
10466
|
|
|
10193
10467
|
// src/commands/integration/commands/definition/propertyEditor/propertyEditor.ts
|
|
10194
|
-
import
|
|
10468
|
+
import yargs31 from "yargs";
|
|
10195
10469
|
|
|
10196
10470
|
// src/commands/integration/commands/definition/propertyEditor/deploy.ts
|
|
10197
10471
|
import { IntegrationPropertyEditorsClient } from "@uniformdev/canvas";
|
|
10198
10472
|
import { readFileSync as readFileSync4 } from "fs";
|
|
10199
10473
|
|
|
10200
10474
|
// src/commands/integration/commands/definition/propertyEditor/util.ts
|
|
10201
|
-
function withPropertyEditorIdOptions(
|
|
10202
|
-
return
|
|
10475
|
+
function withPropertyEditorIdOptions(yargs43) {
|
|
10476
|
+
return yargs43.option("propertyType", {
|
|
10203
10477
|
describe: "Property type to attach the editor to.",
|
|
10204
10478
|
demandOption: true,
|
|
10205
10479
|
type: "string"
|
|
@@ -10215,11 +10489,11 @@ function withPropertyEditorIdOptions(yargs41) {
|
|
|
10215
10489
|
var IntegrationPropertyEditorDeployModule = {
|
|
10216
10490
|
command: "deploy <filename>",
|
|
10217
10491
|
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.",
|
|
10218
|
-
builder: (
|
|
10492
|
+
builder: (yargs43) => withConfiguration(
|
|
10219
10493
|
withApiOptions(
|
|
10220
10494
|
withTeamOptions(
|
|
10221
10495
|
withPropertyEditorIdOptions(
|
|
10222
|
-
|
|
10496
|
+
yargs43.positional("filename", {
|
|
10223
10497
|
demandOption: true,
|
|
10224
10498
|
describe: "ESM code file to run for the target property editor hook. Refer to the documentation for expected types."
|
|
10225
10499
|
}).option("compatibilityDate", {
|
|
@@ -10262,7 +10536,7 @@ import { IntegrationPropertyEditorsClient as IntegrationPropertyEditorsClient2 }
|
|
|
10262
10536
|
var IntegrationPropertyEditorRemoveModule = {
|
|
10263
10537
|
command: "remove",
|
|
10264
10538
|
describe: "Deletes a custom AI property editor hook from a property type. The API key used must have team admin permissions.",
|
|
10265
|
-
builder: (
|
|
10539
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withTeamOptions(withPropertyEditorIdOptions(yargs43)))),
|
|
10266
10540
|
handler: async ({ apiHost, apiKey, proxy, team: teamId, propertyType, hook }) => {
|
|
10267
10541
|
const fetch2 = nodeFetchProxy(proxy);
|
|
10268
10542
|
const client = new IntegrationPropertyEditorsClient2({ apiKey, apiHost, fetch: fetch2, teamId });
|
|
@@ -10274,9 +10548,9 @@ var IntegrationPropertyEditorRemoveModule = {
|
|
|
10274
10548
|
var IntegrationPropertyEditorModule = {
|
|
10275
10549
|
command: "propertyEditor <command>",
|
|
10276
10550
|
describe: "Commands for managing custom AI property editors at the team level.",
|
|
10277
|
-
builder: (
|
|
10551
|
+
builder: (yargs43) => yargs43.command(IntegrationPropertyEditorDeployModule).command(IntegrationPropertyEditorRemoveModule).demandCommand(),
|
|
10278
10552
|
handler: () => {
|
|
10279
|
-
|
|
10553
|
+
yargs31.help();
|
|
10280
10554
|
}
|
|
10281
10555
|
};
|
|
10282
10556
|
|
|
@@ -10316,10 +10590,10 @@ var DefinitionClient = class extends ApiClient2 {
|
|
|
10316
10590
|
var IntegrationDefinitionRegisterModule = {
|
|
10317
10591
|
command: "register <filename>",
|
|
10318
10592
|
describe: "Registers a custom integration definition on a team. The API key used must have team admin permissions.",
|
|
10319
|
-
builder: (
|
|
10593
|
+
builder: (yargs43) => withConfiguration(
|
|
10320
10594
|
withApiOptions(
|
|
10321
10595
|
withTeamOptions(
|
|
10322
|
-
|
|
10596
|
+
yargs43.positional("filename", {
|
|
10323
10597
|
demandOption: true,
|
|
10324
10598
|
describe: "Integration definition manifest to register"
|
|
10325
10599
|
})
|
|
@@ -10338,10 +10612,10 @@ var IntegrationDefinitionRegisterModule = {
|
|
|
10338
10612
|
var IntegrationDefinitionRemoveModule = {
|
|
10339
10613
|
command: "remove <type>",
|
|
10340
10614
|
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.",
|
|
10341
|
-
builder: (
|
|
10615
|
+
builder: (yargs43) => withConfiguration(
|
|
10342
10616
|
withApiOptions(
|
|
10343
10617
|
withTeamOptions(
|
|
10344
|
-
|
|
10618
|
+
yargs43.positional("type", {
|
|
10345
10619
|
demandOption: true,
|
|
10346
10620
|
describe: "Integration type (from its manifest) to remove."
|
|
10347
10621
|
})
|
|
@@ -10359,9 +10633,9 @@ var IntegrationDefinitionRemoveModule = {
|
|
|
10359
10633
|
var IntegrationDefinitionModule = {
|
|
10360
10634
|
command: "definition <command>",
|
|
10361
10635
|
describe: "Commands for managing custom integration definitions at the team level.",
|
|
10362
|
-
builder: (
|
|
10636
|
+
builder: (yargs43) => yargs43.command(IntegrationDefinitionRemoveModule).command(IntegrationDefinitionRegisterModule).command(IntegrationEdgehancerModule).command(IntegrationDataResourceEditorModule).command(IntegrationPropertyEditorModule).demandCommand(),
|
|
10363
10637
|
handler: () => {
|
|
10364
|
-
|
|
10638
|
+
yargs32.help();
|
|
10365
10639
|
}
|
|
10366
10640
|
};
|
|
10367
10641
|
|
|
@@ -10401,10 +10675,10 @@ var InstallClient = class extends ApiClient3 {
|
|
|
10401
10675
|
var IntegrationInstallModule = {
|
|
10402
10676
|
command: "install <type>",
|
|
10403
10677
|
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.",
|
|
10404
|
-
builder: (
|
|
10678
|
+
builder: (yargs43) => withConfiguration(
|
|
10405
10679
|
withApiOptions(
|
|
10406
10680
|
withProjectOptions(
|
|
10407
|
-
|
|
10681
|
+
yargs43.positional("type", {
|
|
10408
10682
|
demandOption: true,
|
|
10409
10683
|
describe: "Integration type to install (as defined in its manifest)"
|
|
10410
10684
|
}).option("configuration", {
|
|
@@ -10426,10 +10700,10 @@ var IntegrationInstallModule = {
|
|
|
10426
10700
|
var IntegrationUninstallModule = {
|
|
10427
10701
|
command: "uninstall <type>",
|
|
10428
10702
|
describe: "Uninstalls an integration from a project. Existing usages of the integration may break.",
|
|
10429
|
-
builder: (
|
|
10703
|
+
builder: (yargs43) => withConfiguration(
|
|
10430
10704
|
withApiOptions(
|
|
10431
10705
|
withProjectOptions(
|
|
10432
|
-
|
|
10706
|
+
yargs43.positional("type", {
|
|
10433
10707
|
demandOption: true,
|
|
10434
10708
|
describe: "Integration type to uninstall (as defined in its manifest)"
|
|
10435
10709
|
})
|
|
@@ -10447,9 +10721,9 @@ var IntegrationUninstallModule = {
|
|
|
10447
10721
|
var IntegrationCommand = {
|
|
10448
10722
|
command: "integration <command>",
|
|
10449
10723
|
describe: "Integration management commands",
|
|
10450
|
-
builder: (
|
|
10724
|
+
builder: (yargs43) => yargs43.command(IntegrationDefinitionModule).command(IntegrationInstallModule).command(IntegrationUninstallModule).demandCommand(),
|
|
10451
10725
|
handler: () => {
|
|
10452
|
-
|
|
10726
|
+
yargs33.showHelp();
|
|
10453
10727
|
}
|
|
10454
10728
|
};
|
|
10455
10729
|
|
|
@@ -10913,16 +11187,355 @@ var NewMeshCmd = {
|
|
|
10913
11187
|
}
|
|
10914
11188
|
};
|
|
10915
11189
|
|
|
11190
|
+
// src/commands/policy-documents/index.ts
|
|
11191
|
+
import yargs34 from "yargs";
|
|
11192
|
+
|
|
11193
|
+
// src/commands/policy-documents/commands/list.ts
|
|
11194
|
+
var PolicyDocumentsListModule = {
|
|
11195
|
+
command: "list",
|
|
11196
|
+
describe: "List policy documents for a project",
|
|
11197
|
+
aliases: ["ls"],
|
|
11198
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
11199
|
+
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId, verbose }) => {
|
|
11200
|
+
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
11201
|
+
const url = new URL(`/api/v1/policy-documents`, apiHost);
|
|
11202
|
+
url.searchParams.set("projectId", projectId);
|
|
11203
|
+
const response = await fetch2(url.toString(), {
|
|
11204
|
+
method: "GET",
|
|
11205
|
+
headers: {
|
|
11206
|
+
"x-api-key": apiKey,
|
|
11207
|
+
"Content-Type": "application/json"
|
|
11208
|
+
}
|
|
11209
|
+
});
|
|
11210
|
+
if (!response.ok) {
|
|
11211
|
+
const errorText = await response.text();
|
|
11212
|
+
throw new Error(
|
|
11213
|
+
`Failed to fetch policy documents: ${response.status} ${response.statusText}
|
|
11214
|
+
${errorText}`
|
|
11215
|
+
);
|
|
11216
|
+
}
|
|
11217
|
+
const policyDocuments = await response.json();
|
|
11218
|
+
emitWithFormat(policyDocuments, format, filename);
|
|
11219
|
+
}
|
|
11220
|
+
};
|
|
11221
|
+
|
|
11222
|
+
// src/commands/policy-documents/policyDocumentsEngineDataSource.ts
|
|
11223
|
+
function createPolicyDocumentsEngineDataSource({
|
|
11224
|
+
apiHost,
|
|
11225
|
+
apiKey,
|
|
11226
|
+
projectId,
|
|
11227
|
+
fetch: fetch2
|
|
11228
|
+
}) {
|
|
11229
|
+
async function* getObjects() {
|
|
11230
|
+
const url = new URL(`/api/v1/policy-documents`, apiHost);
|
|
11231
|
+
url.searchParams.set("projectId", projectId);
|
|
11232
|
+
const response = await fetch2(url.toString(), {
|
|
11233
|
+
method: "GET",
|
|
11234
|
+
headers: {
|
|
11235
|
+
"x-api-key": apiKey,
|
|
11236
|
+
"Content-Type": "application/json"
|
|
11237
|
+
}
|
|
11238
|
+
});
|
|
11239
|
+
if (!response.ok) {
|
|
11240
|
+
const errorText = await response.text();
|
|
11241
|
+
throw new Error(
|
|
11242
|
+
`Failed to fetch policy documents: ${response.status} ${response.statusText}
|
|
11243
|
+
${errorText}`
|
|
11244
|
+
);
|
|
11245
|
+
}
|
|
11246
|
+
const policyDocuments = await response.json();
|
|
11247
|
+
for (const [roleId, document] of Object.entries(policyDocuments)) {
|
|
11248
|
+
yield {
|
|
11249
|
+
id: roleId,
|
|
11250
|
+
displayName: `Policy document for role ${roleId}`,
|
|
11251
|
+
providerId: roleId,
|
|
11252
|
+
object: {
|
|
11253
|
+
...document ?? {},
|
|
11254
|
+
roleId
|
|
11255
|
+
}
|
|
11256
|
+
};
|
|
11257
|
+
}
|
|
11258
|
+
}
|
|
11259
|
+
return {
|
|
11260
|
+
name: "Uniform API",
|
|
11261
|
+
objects: getObjects(),
|
|
11262
|
+
// No-op: The policy documents API only supports bulk replacement via PUT.
|
|
11263
|
+
// Individual delete operations are not available - deletion happens when
|
|
11264
|
+
// a document is omitted from the bulk PUT request.
|
|
11265
|
+
deleteObject: async () => {
|
|
11266
|
+
},
|
|
11267
|
+
// No-op: The policy documents API only supports bulk replacement via PUT.
|
|
11268
|
+
// Individual write operations are not available - the push command handler
|
|
11269
|
+
// collects all documents and performs a single bulk PUT.
|
|
11270
|
+
writeObject: async () => {
|
|
11271
|
+
}
|
|
11272
|
+
};
|
|
11273
|
+
}
|
|
11274
|
+
|
|
11275
|
+
// src/commands/policy-documents/commands/_util.ts
|
|
11276
|
+
var selectIdentifier13 = (policyDoc) => policyDoc.roleId;
|
|
11277
|
+
var selectDisplayName13 = (policyDoc) => `Policy document for role ${policyDoc.roleId}`;
|
|
11278
|
+
|
|
11279
|
+
// src/commands/policy-documents/commands/pull.ts
|
|
11280
|
+
var PolicyDocumentsPullModule = {
|
|
11281
|
+
command: "pull <directory>",
|
|
11282
|
+
describe: "Pulls all policy documents to local files in a directory",
|
|
11283
|
+
builder: (yargs43) => withConfiguration(
|
|
11284
|
+
withApiOptions(
|
|
11285
|
+
withDebugOptions(
|
|
11286
|
+
withProjectOptions(
|
|
11287
|
+
withDiffOptions(
|
|
11288
|
+
yargs43.positional("directory", {
|
|
11289
|
+
describe: "Directory to save to. Each policy document will be saved as a separate file named by role ID.",
|
|
11290
|
+
type: "string"
|
|
11291
|
+
}).option("format", {
|
|
11292
|
+
alias: ["f"],
|
|
11293
|
+
describe: "Output format",
|
|
11294
|
+
default: "yaml",
|
|
11295
|
+
choices: ["yaml", "json"],
|
|
11296
|
+
type: "string"
|
|
11297
|
+
}).option("mode", {
|
|
11298
|
+
alias: ["m"],
|
|
11299
|
+
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',
|
|
11300
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
11301
|
+
default: "mirror",
|
|
11302
|
+
type: "string"
|
|
11303
|
+
})
|
|
11304
|
+
)
|
|
11305
|
+
)
|
|
11306
|
+
)
|
|
11307
|
+
)
|
|
11308
|
+
),
|
|
11309
|
+
handler: async ({
|
|
11310
|
+
apiHost,
|
|
11311
|
+
apiKey,
|
|
11312
|
+
proxy,
|
|
11313
|
+
directory,
|
|
11314
|
+
format,
|
|
11315
|
+
mode,
|
|
11316
|
+
whatIf,
|
|
11317
|
+
project: projectId,
|
|
11318
|
+
diff: diffMode,
|
|
11319
|
+
allowEmptySource,
|
|
11320
|
+
verbose
|
|
11321
|
+
}) => {
|
|
11322
|
+
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
11323
|
+
const source = createPolicyDocumentsEngineDataSource({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
11324
|
+
const target = await createFileSyncEngineDataSource({
|
|
11325
|
+
directory,
|
|
11326
|
+
selectIdentifier: selectIdentifier13,
|
|
11327
|
+
selectDisplayName: selectDisplayName13,
|
|
11328
|
+
format,
|
|
11329
|
+
verbose
|
|
11330
|
+
});
|
|
11331
|
+
await syncEngine({
|
|
11332
|
+
source,
|
|
11333
|
+
target,
|
|
11334
|
+
mode,
|
|
11335
|
+
whatIf,
|
|
11336
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
11337
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
11338
|
+
});
|
|
11339
|
+
}
|
|
11340
|
+
};
|
|
11341
|
+
|
|
11342
|
+
// src/commands/policy-documents/commands/push.ts
|
|
11343
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
|
|
11344
|
+
import { readdir as readdir2 } from "fs/promises";
|
|
11345
|
+
import { extname as extname2, join as join11 } from "path";
|
|
11346
|
+
async function readLocalPolicyDocuments(directory, format, verbose) {
|
|
11347
|
+
const files = await readdir2(directory);
|
|
11348
|
+
const policyDocuments = {};
|
|
11349
|
+
const errors = [];
|
|
11350
|
+
for (const filename of files) {
|
|
11351
|
+
const ext = extname2(filename);
|
|
11352
|
+
if (ext !== `.${format}` && ext !== ".yaml" && ext !== ".yml" && ext !== ".json") {
|
|
11353
|
+
continue;
|
|
11354
|
+
}
|
|
11355
|
+
const filePath = join11(directory, filename);
|
|
11356
|
+
try {
|
|
11357
|
+
let roleId = filename.replace(ext, "");
|
|
11358
|
+
const fileContent = readFileToObject(filePath);
|
|
11359
|
+
let policyDoc;
|
|
11360
|
+
if (typeof fileContent === "object" && fileContent !== null && "roleId" in fileContent && typeof fileContent.roleId === "string") {
|
|
11361
|
+
const { roleId: _, ...doc } = fileContent;
|
|
11362
|
+
roleId = fileContent.roleId;
|
|
11363
|
+
policyDoc = doc;
|
|
11364
|
+
} else {
|
|
11365
|
+
policyDoc = fileContent;
|
|
11366
|
+
}
|
|
11367
|
+
policyDocuments[roleId] = policyDoc;
|
|
11368
|
+
} catch (e) {
|
|
11369
|
+
errors.push(`Failed to read ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
11370
|
+
}
|
|
11371
|
+
}
|
|
11372
|
+
if (errors.length > 0) {
|
|
11373
|
+
console.warn(`Warning: ${errors.length} file(s) could not be read:`);
|
|
11374
|
+
for (const error of errors) {
|
|
11375
|
+
console.warn(` ${error}`);
|
|
11376
|
+
}
|
|
11377
|
+
}
|
|
11378
|
+
if (verbose && Object.keys(policyDocuments).length > 0) {
|
|
11379
|
+
console.log(`Read ${Object.keys(policyDocuments).length} policy document(s) from ${directory}`);
|
|
11380
|
+
}
|
|
11381
|
+
return policyDocuments;
|
|
11382
|
+
}
|
|
11383
|
+
async function fetchRemotePolicyDocuments(apiHost, apiKey, projectId, fetch2) {
|
|
11384
|
+
const url = new URL(`/api/v1/policy-documents`, apiHost);
|
|
11385
|
+
url.searchParams.set("projectId", projectId);
|
|
11386
|
+
const response = await fetch2(url.toString(), {
|
|
11387
|
+
method: "GET",
|
|
11388
|
+
headers: {
|
|
11389
|
+
"x-api-key": apiKey,
|
|
11390
|
+
"Content-Type": "application/json"
|
|
11391
|
+
}
|
|
11392
|
+
});
|
|
11393
|
+
if (!response.ok) {
|
|
11394
|
+
const errorText = await response.text();
|
|
11395
|
+
throw new Error(
|
|
11396
|
+
`Failed to fetch policy documents: ${response.status} ${response.statusText}
|
|
11397
|
+
${errorText}`
|
|
11398
|
+
);
|
|
11399
|
+
}
|
|
11400
|
+
return await response.json();
|
|
11401
|
+
}
|
|
11402
|
+
function mergePolicyDocuments(localDocs, remoteDocs, mode) {
|
|
11403
|
+
switch (mode) {
|
|
11404
|
+
case "create":
|
|
11405
|
+
return {
|
|
11406
|
+
...remoteDocs,
|
|
11407
|
+
...Object.fromEntries(Object.entries(localDocs).filter(([roleId]) => !(roleId in remoteDocs)))
|
|
11408
|
+
};
|
|
11409
|
+
case "createOrUpdate":
|
|
11410
|
+
return {
|
|
11411
|
+
...remoteDocs,
|
|
11412
|
+
...localDocs
|
|
11413
|
+
};
|
|
11414
|
+
case "mirror":
|
|
11415
|
+
default:
|
|
11416
|
+
return localDocs;
|
|
11417
|
+
}
|
|
11418
|
+
}
|
|
11419
|
+
var PolicyDocumentsPushModule = {
|
|
11420
|
+
command: "push <directory>",
|
|
11421
|
+
describe: "Pushes policy documents from local files to Uniform",
|
|
11422
|
+
builder: (yargs43) => withConfiguration(
|
|
11423
|
+
withApiOptions(
|
|
11424
|
+
withDebugOptions(
|
|
11425
|
+
withProjectOptions(
|
|
11426
|
+
withDiffOptions(
|
|
11427
|
+
yargs43.positional("directory", {
|
|
11428
|
+
describe: "Directory containing policy document files (one file per role ID).",
|
|
11429
|
+
type: "string"
|
|
11430
|
+
}).option("format", {
|
|
11431
|
+
alias: ["f"],
|
|
11432
|
+
describe: "Input format",
|
|
11433
|
+
default: "yaml",
|
|
11434
|
+
choices: ["yaml", "json"],
|
|
11435
|
+
type: "string"
|
|
11436
|
+
}).option("mode", {
|
|
11437
|
+
alias: ["m"],
|
|
11438
|
+
describe: 'What kind of changes can be made. "create" = create new documents, update nothing. "createOrUpdate" = create new documents, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
|
|
11439
|
+
choices: ["create", "createOrUpdate", "mirror"],
|
|
11440
|
+
default: "mirror",
|
|
11441
|
+
type: "string"
|
|
11442
|
+
})
|
|
11443
|
+
)
|
|
11444
|
+
)
|
|
11445
|
+
)
|
|
11446
|
+
)
|
|
11447
|
+
),
|
|
11448
|
+
handler: async ({
|
|
11449
|
+
apiHost,
|
|
11450
|
+
apiKey,
|
|
11451
|
+
proxy,
|
|
11452
|
+
directory,
|
|
11453
|
+
format,
|
|
11454
|
+
mode,
|
|
11455
|
+
whatIf,
|
|
11456
|
+
project: projectId,
|
|
11457
|
+
diff: diffMode,
|
|
11458
|
+
allowEmptySource,
|
|
11459
|
+
verbose
|
|
11460
|
+
}) => {
|
|
11461
|
+
if (!existsSync5(directory)) {
|
|
11462
|
+
if (verbose) {
|
|
11463
|
+
console.log(`Creating directory ${directory}`);
|
|
11464
|
+
}
|
|
11465
|
+
mkdirSync4(directory, { recursive: true });
|
|
11466
|
+
}
|
|
11467
|
+
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
11468
|
+
const localDocs = await readLocalPolicyDocuments(directory, format, verbose);
|
|
11469
|
+
let remoteDocs = {};
|
|
11470
|
+
if (mode !== "mirror") {
|
|
11471
|
+
remoteDocs = await fetchRemotePolicyDocuments(apiHost, apiKey, projectId, fetch2);
|
|
11472
|
+
}
|
|
11473
|
+
const finalDocs = mergePolicyDocuments(localDocs, remoteDocs, mode);
|
|
11474
|
+
const source = await createFileSyncEngineDataSource({
|
|
11475
|
+
directory,
|
|
11476
|
+
selectIdentifier: selectIdentifier13,
|
|
11477
|
+
selectDisplayName: selectDisplayName13,
|
|
11478
|
+
format,
|
|
11479
|
+
verbose
|
|
11480
|
+
});
|
|
11481
|
+
const target = createPolicyDocumentsEngineDataSource({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
11482
|
+
await syncEngine({
|
|
11483
|
+
source,
|
|
11484
|
+
target,
|
|
11485
|
+
mode,
|
|
11486
|
+
whatIf,
|
|
11487
|
+
allowEmptySource: allowEmptySource ?? true,
|
|
11488
|
+
log: createSyncEngineConsoleLogger({ diffMode })
|
|
11489
|
+
});
|
|
11490
|
+
if (!whatIf) {
|
|
11491
|
+
const url = new URL(`/api/v1/policy-documents`, apiHost);
|
|
11492
|
+
url.searchParams.set("projectId", projectId);
|
|
11493
|
+
const response = await fetch2(url.toString(), {
|
|
11494
|
+
method: "PUT",
|
|
11495
|
+
headers: {
|
|
11496
|
+
"x-api-key": apiKey,
|
|
11497
|
+
"Content-Type": "application/json"
|
|
11498
|
+
},
|
|
11499
|
+
body: JSON.stringify({
|
|
11500
|
+
projectId,
|
|
11501
|
+
documents: finalDocs
|
|
11502
|
+
})
|
|
11503
|
+
});
|
|
11504
|
+
if (!response.ok) {
|
|
11505
|
+
const errorText = await response.text();
|
|
11506
|
+
throw new Error(
|
|
11507
|
+
`Failed to push policy documents: ${response.status} ${response.statusText}
|
|
11508
|
+
${errorText}`
|
|
11509
|
+
);
|
|
11510
|
+
}
|
|
11511
|
+
if (verbose) {
|
|
11512
|
+
console.log(`Successfully pushed ${Object.keys(finalDocs).length} policy document(s)`);
|
|
11513
|
+
}
|
|
11514
|
+
}
|
|
11515
|
+
}
|
|
11516
|
+
};
|
|
11517
|
+
|
|
11518
|
+
// src/commands/policy-documents/index.ts
|
|
11519
|
+
var PolicyDocumentsCommand = {
|
|
11520
|
+
command: "policy-documents <command>",
|
|
11521
|
+
aliases: ["policy", "policies"],
|
|
11522
|
+
describe: "Uniform Policy Documents commands",
|
|
11523
|
+
builder: (yargs43) => yargs43.command(PolicyDocumentsListModule).command(PolicyDocumentsPullModule).command(PolicyDocumentsPushModule).demandCommand(),
|
|
11524
|
+
handler: () => {
|
|
11525
|
+
yargs34.showHelp();
|
|
11526
|
+
}
|
|
11527
|
+
};
|
|
11528
|
+
|
|
10916
11529
|
// src/commands/project-map/index.ts
|
|
10917
|
-
import
|
|
11530
|
+
import yargs37 from "yargs";
|
|
10918
11531
|
|
|
10919
11532
|
// src/commands/project-map/commands/projectMapDefinition.ts
|
|
10920
|
-
import
|
|
11533
|
+
import yargs35 from "yargs";
|
|
10921
11534
|
|
|
10922
11535
|
// src/commands/project-map/commands/ProjectMapDefinition/_util.ts
|
|
10923
11536
|
import { UncachedProjectMapClient } from "@uniformdev/project-map";
|
|
10924
|
-
var
|
|
10925
|
-
var
|
|
11537
|
+
var selectIdentifier14 = (source) => source.id;
|
|
11538
|
+
var selectDisplayName14 = (source) => `${source.name} (pid: ${source.id})`;
|
|
10926
11539
|
function getProjectMapClient(options) {
|
|
10927
11540
|
return new UncachedProjectMapClient({ ...options, limitPolicy: cliLimitPolicy });
|
|
10928
11541
|
}
|
|
@@ -10931,11 +11544,11 @@ function getProjectMapClient(options) {
|
|
|
10931
11544
|
var ProjectMapDefinitionGetModule = {
|
|
10932
11545
|
command: "get <id>",
|
|
10933
11546
|
describe: "Fetch a project map",
|
|
10934
|
-
builder: (
|
|
11547
|
+
builder: (yargs43) => withFormatOptions(
|
|
10935
11548
|
withConfiguration(
|
|
10936
11549
|
withApiOptions(
|
|
10937
11550
|
withProjectOptions(
|
|
10938
|
-
|
|
11551
|
+
yargs43.positional("id", { demandOption: true, describe: "ProjectMap UUID to fetch" })
|
|
10939
11552
|
)
|
|
10940
11553
|
)
|
|
10941
11554
|
)
|
|
@@ -10958,7 +11571,7 @@ var ProjectMapDefinitionListModule = {
|
|
|
10958
11571
|
command: "list",
|
|
10959
11572
|
describe: "List of project maps",
|
|
10960
11573
|
aliases: ["ls"],
|
|
10961
|
-
builder: (
|
|
11574
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
10962
11575
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
10963
11576
|
const fetch2 = nodeFetchProxy(proxy);
|
|
10964
11577
|
const client = getProjectMapClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -10986,9 +11599,9 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
10986
11599
|
const projectMaps = (await client.getProjectMapDefinitions()).projectMaps;
|
|
10987
11600
|
for await (const def of projectMaps) {
|
|
10988
11601
|
const result = {
|
|
10989
|
-
id:
|
|
10990
|
-
displayName:
|
|
10991
|
-
providerId:
|
|
11602
|
+
id: selectIdentifier14(def),
|
|
11603
|
+
displayName: selectDisplayName14(def),
|
|
11604
|
+
providerId: selectIdentifier14(def),
|
|
10992
11605
|
object: def
|
|
10993
11606
|
};
|
|
10994
11607
|
yield result;
|
|
@@ -11012,12 +11625,12 @@ function createProjectMapDefinitionEngineDataSource({
|
|
|
11012
11625
|
var ProjectMapDefinitionPullModule = {
|
|
11013
11626
|
command: "pull <directory>",
|
|
11014
11627
|
describe: "Pulls all project maps to local files in a directory",
|
|
11015
|
-
builder: (
|
|
11628
|
+
builder: (yargs43) => withConfiguration(
|
|
11016
11629
|
withDebugOptions(
|
|
11017
11630
|
withApiOptions(
|
|
11018
11631
|
withProjectOptions(
|
|
11019
11632
|
withDiffOptions(
|
|
11020
|
-
|
|
11633
|
+
yargs43.positional("directory", {
|
|
11021
11634
|
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.",
|
|
11022
11635
|
type: "string"
|
|
11023
11636
|
}).option("format", {
|
|
@@ -11061,8 +11674,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
11061
11674
|
target = await createArraySyncEngineDataSource({
|
|
11062
11675
|
name: `Package file ${directory}`,
|
|
11063
11676
|
objects: packageContents.projectMaps ?? [],
|
|
11064
|
-
selectIdentifier:
|
|
11065
|
-
selectDisplayName:
|
|
11677
|
+
selectIdentifier: selectIdentifier14,
|
|
11678
|
+
selectDisplayName: selectDisplayName14,
|
|
11066
11679
|
onSyncComplete: async (_, synced) => {
|
|
11067
11680
|
packageContents.projectMaps = synced;
|
|
11068
11681
|
writeContextPackage2(directory, packageContents);
|
|
@@ -11071,8 +11684,8 @@ var ProjectMapDefinitionPullModule = {
|
|
|
11071
11684
|
} else {
|
|
11072
11685
|
target = await createFileSyncEngineDataSource({
|
|
11073
11686
|
directory,
|
|
11074
|
-
selectIdentifier:
|
|
11075
|
-
selectDisplayName:
|
|
11687
|
+
selectIdentifier: selectIdentifier14,
|
|
11688
|
+
selectDisplayName: selectDisplayName14,
|
|
11076
11689
|
format,
|
|
11077
11690
|
verbose
|
|
11078
11691
|
});
|
|
@@ -11092,12 +11705,12 @@ var ProjectMapDefinitionPullModule = {
|
|
|
11092
11705
|
var ProjectMapDefinitionPushModule = {
|
|
11093
11706
|
command: "push <directory>",
|
|
11094
11707
|
describe: "Pushes all project maps from files in a directory or package to Uniform",
|
|
11095
|
-
builder: (
|
|
11708
|
+
builder: (yargs43) => withConfiguration(
|
|
11096
11709
|
withDebugOptions(
|
|
11097
11710
|
withApiOptions(
|
|
11098
11711
|
withProjectOptions(
|
|
11099
11712
|
withDiffOptions(
|
|
11100
|
-
|
|
11713
|
+
yargs43.positional("directory", {
|
|
11101
11714
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
11102
11715
|
type: "string"
|
|
11103
11716
|
}).option("mode", {
|
|
@@ -11133,14 +11746,14 @@ var ProjectMapDefinitionPushModule = {
|
|
|
11133
11746
|
source = await createArraySyncEngineDataSource({
|
|
11134
11747
|
name: `Package file ${directory}`,
|
|
11135
11748
|
objects: packageContents.projectMaps ?? [],
|
|
11136
|
-
selectIdentifier:
|
|
11137
|
-
selectDisplayName:
|
|
11749
|
+
selectIdentifier: selectIdentifier14,
|
|
11750
|
+
selectDisplayName: selectDisplayName14
|
|
11138
11751
|
});
|
|
11139
11752
|
} else {
|
|
11140
11753
|
source = await createFileSyncEngineDataSource({
|
|
11141
11754
|
directory,
|
|
11142
|
-
selectIdentifier:
|
|
11143
|
-
selectDisplayName:
|
|
11755
|
+
selectIdentifier: selectIdentifier14,
|
|
11756
|
+
selectDisplayName: selectDisplayName14,
|
|
11144
11757
|
verbose
|
|
11145
11758
|
});
|
|
11146
11759
|
}
|
|
@@ -11161,9 +11774,9 @@ var ProjectMapDefinitionRemoveModule = {
|
|
|
11161
11774
|
command: "remove <id>",
|
|
11162
11775
|
aliases: ["delete", "rm"],
|
|
11163
11776
|
describe: "Delete a project map",
|
|
11164
|
-
builder: (
|
|
11777
|
+
builder: (yargs43) => withConfiguration(
|
|
11165
11778
|
withApiOptions(
|
|
11166
|
-
withProjectOptions(
|
|
11779
|
+
withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
11167
11780
|
)
|
|
11168
11781
|
),
|
|
11169
11782
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -11178,10 +11791,10 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
11178
11791
|
command: "update <filename>",
|
|
11179
11792
|
aliases: ["put"],
|
|
11180
11793
|
describe: "Insert or update a project map",
|
|
11181
|
-
builder: (
|
|
11794
|
+
builder: (yargs43) => withConfiguration(
|
|
11182
11795
|
withApiOptions(
|
|
11183
11796
|
withProjectOptions(
|
|
11184
|
-
|
|
11797
|
+
yargs43.positional("filename", { demandOption: true, describe: "Project map file to put" })
|
|
11185
11798
|
)
|
|
11186
11799
|
)
|
|
11187
11800
|
),
|
|
@@ -11197,24 +11810,24 @@ var ProjectMapDefinitionUpdateModule = {
|
|
|
11197
11810
|
var ProjectMapDefinitionModule = {
|
|
11198
11811
|
command: "definition <command>",
|
|
11199
11812
|
describe: "Commands for ProjectMap Definitions",
|
|
11200
|
-
builder: (
|
|
11813
|
+
builder: (yargs43) => yargs43.command(ProjectMapDefinitionPullModule).command(ProjectMapDefinitionPushModule).command(ProjectMapDefinitionGetModule).command(ProjectMapDefinitionRemoveModule).command(ProjectMapDefinitionListModule).command(ProjectMapDefinitionUpdateModule).demandCommand(),
|
|
11201
11814
|
handler: () => {
|
|
11202
|
-
|
|
11815
|
+
yargs35.help();
|
|
11203
11816
|
}
|
|
11204
11817
|
};
|
|
11205
11818
|
|
|
11206
11819
|
// src/commands/project-map/commands/projectMapNode.ts
|
|
11207
|
-
import
|
|
11820
|
+
import yargs36 from "yargs";
|
|
11208
11821
|
|
|
11209
11822
|
// src/commands/project-map/commands/ProjectMapNode/get.ts
|
|
11210
11823
|
var ProjectMapNodeGetModule = {
|
|
11211
11824
|
command: "get <id> <projectMapId>",
|
|
11212
11825
|
describe: "Fetch a project map node",
|
|
11213
|
-
builder: (
|
|
11826
|
+
builder: (yargs43) => withConfiguration(
|
|
11214
11827
|
withFormatOptions(
|
|
11215
11828
|
withApiOptions(
|
|
11216
11829
|
withProjectOptions(
|
|
11217
|
-
|
|
11830
|
+
yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to fetch" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to fetch from" })
|
|
11218
11831
|
)
|
|
11219
11832
|
)
|
|
11220
11833
|
)
|
|
@@ -11238,12 +11851,12 @@ var ProjectMapNodeListModule = {
|
|
|
11238
11851
|
command: "list <projectMapId>",
|
|
11239
11852
|
describe: "List project map nodes",
|
|
11240
11853
|
aliases: ["ls"],
|
|
11241
|
-
builder: (
|
|
11854
|
+
builder: (yargs43) => withConfiguration(
|
|
11242
11855
|
withFormatOptions(
|
|
11243
11856
|
withApiOptions(
|
|
11244
11857
|
withProjectOptions(
|
|
11245
11858
|
withStateOptions(
|
|
11246
|
-
|
|
11859
|
+
yargs43.positional("projectMapId", {
|
|
11247
11860
|
demandOption: true,
|
|
11248
11861
|
describe: "ProjectMap UUID to fetch from"
|
|
11249
11862
|
})
|
|
@@ -11261,12 +11874,12 @@ var ProjectMapNodeListModule = {
|
|
|
11261
11874
|
};
|
|
11262
11875
|
|
|
11263
11876
|
// src/commands/project-map/commands/ProjectMapNode/_util.ts
|
|
11264
|
-
var
|
|
11877
|
+
var selectIdentifier15 = (source, projectId) => [
|
|
11265
11878
|
projectId + source.projectMapId + source.id,
|
|
11266
11879
|
projectId + source.projectMapId + source.path
|
|
11267
11880
|
];
|
|
11268
11881
|
var selectFilename = (source) => cleanFileName(`${source.pathSegment}_${source.id}`);
|
|
11269
|
-
var
|
|
11882
|
+
var selectDisplayName15 = (source) => `${source.name} (pid: ${source.id})`;
|
|
11270
11883
|
|
|
11271
11884
|
// src/commands/project-map/ProjectMapNodeEngineDataSource.ts
|
|
11272
11885
|
function createProjectMapNodeEngineDataSource({
|
|
@@ -11280,9 +11893,9 @@ function createProjectMapNodeEngineDataSource({
|
|
|
11280
11893
|
for await (const node of nodes ?? []) {
|
|
11281
11894
|
if (node) {
|
|
11282
11895
|
const result = {
|
|
11283
|
-
id:
|
|
11284
|
-
displayName:
|
|
11285
|
-
providerId:
|
|
11896
|
+
id: selectIdentifier15({ ...node, projectMapId: projectMap.id }, projectId),
|
|
11897
|
+
displayName: selectDisplayName15(node),
|
|
11898
|
+
providerId: selectIdentifier15({ ...node, projectMapId: projectMap.id }, projectId)[0],
|
|
11286
11899
|
object: { ...node, projectMapId: projectMap.id }
|
|
11287
11900
|
};
|
|
11288
11901
|
yield result;
|
|
@@ -11321,12 +11934,12 @@ function createProjectMapNodeEngineDataSource({
|
|
|
11321
11934
|
var ProjectMapNodePullModule = {
|
|
11322
11935
|
command: "pull <directory>",
|
|
11323
11936
|
describe: "Pulls all project maps nodes to local files in a directory",
|
|
11324
|
-
builder: (
|
|
11937
|
+
builder: (yargs43) => withConfiguration(
|
|
11325
11938
|
withDebugOptions(
|
|
11326
11939
|
withApiOptions(
|
|
11327
11940
|
withProjectOptions(
|
|
11328
11941
|
withDiffOptions(
|
|
11329
|
-
|
|
11942
|
+
yargs43.positional("directory", {
|
|
11330
11943
|
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.",
|
|
11331
11944
|
type: "string"
|
|
11332
11945
|
}).option("format", {
|
|
@@ -11366,7 +11979,7 @@ var ProjectMapNodePullModule = {
|
|
|
11366
11979
|
let target;
|
|
11367
11980
|
const isPackage = isPathAPackageFile(directory);
|
|
11368
11981
|
const expandedSelectIdentifier = (object4) => {
|
|
11369
|
-
return
|
|
11982
|
+
return selectIdentifier15(object4, projectId);
|
|
11370
11983
|
};
|
|
11371
11984
|
if (isPackage) {
|
|
11372
11985
|
const packageContents = readContextPackage2(directory, false, verbose);
|
|
@@ -11374,7 +11987,7 @@ var ProjectMapNodePullModule = {
|
|
|
11374
11987
|
name: `Package file ${directory}`,
|
|
11375
11988
|
objects: packageContents.projectMapNodes ?? [],
|
|
11376
11989
|
selectIdentifier: expandedSelectIdentifier,
|
|
11377
|
-
selectDisplayName:
|
|
11990
|
+
selectDisplayName: selectDisplayName15,
|
|
11378
11991
|
onSyncComplete: async (_, synced) => {
|
|
11379
11992
|
packageContents.projectMapNodes = synced;
|
|
11380
11993
|
writeContextPackage2(directory, packageContents);
|
|
@@ -11384,7 +11997,7 @@ var ProjectMapNodePullModule = {
|
|
|
11384
11997
|
target = await createFileSyncEngineDataSource({
|
|
11385
11998
|
directory,
|
|
11386
11999
|
selectIdentifier: expandedSelectIdentifier,
|
|
11387
|
-
selectDisplayName:
|
|
12000
|
+
selectDisplayName: selectDisplayName15,
|
|
11388
12001
|
format,
|
|
11389
12002
|
selectFilename,
|
|
11390
12003
|
verbose
|
|
@@ -11408,12 +12021,12 @@ import {
|
|
|
11408
12021
|
var ProjectMapNodePushModule = {
|
|
11409
12022
|
command: "push <directory>",
|
|
11410
12023
|
describe: "Pushes all project maps nodes from files in a directory or package to Uniform",
|
|
11411
|
-
builder: (
|
|
12024
|
+
builder: (yargs43) => withConfiguration(
|
|
11412
12025
|
withDebugOptions(
|
|
11413
12026
|
withApiOptions(
|
|
11414
12027
|
withProjectOptions(
|
|
11415
12028
|
withDiffOptions(
|
|
11416
|
-
|
|
12029
|
+
yargs43.positional("directory", {
|
|
11417
12030
|
describe: "Directory to read project maps from. If a filename is used, a package will be read instead.",
|
|
11418
12031
|
type: "string"
|
|
11419
12032
|
}).option("mode", {
|
|
@@ -11450,7 +12063,7 @@ var ProjectMapNodePushModule = {
|
|
|
11450
12063
|
let source;
|
|
11451
12064
|
const isPackage = isPathAPackageFile(directory);
|
|
11452
12065
|
const expandedSelectIdentifier = (object4) => {
|
|
11453
|
-
return
|
|
12066
|
+
return selectIdentifier15(object4, projectId);
|
|
11454
12067
|
};
|
|
11455
12068
|
if (isPackage) {
|
|
11456
12069
|
const packageContents = readContextPackage2(directory, true, verbose);
|
|
@@ -11460,13 +12073,13 @@ var ProjectMapNodePushModule = {
|
|
|
11460
12073
|
return a.path.length - b.path.length;
|
|
11461
12074
|
}) ?? [],
|
|
11462
12075
|
selectIdentifier: expandedSelectIdentifier,
|
|
11463
|
-
selectDisplayName:
|
|
12076
|
+
selectDisplayName: selectDisplayName15
|
|
11464
12077
|
});
|
|
11465
12078
|
} else {
|
|
11466
12079
|
source = await createFileSyncEngineDataSource({
|
|
11467
12080
|
directory,
|
|
11468
12081
|
selectIdentifier: expandedSelectIdentifier,
|
|
11469
|
-
selectDisplayName:
|
|
12082
|
+
selectDisplayName: selectDisplayName15,
|
|
11470
12083
|
selectFilename,
|
|
11471
12084
|
verbose
|
|
11472
12085
|
});
|
|
@@ -11498,7 +12111,7 @@ var ProjectMapNodePushModule = {
|
|
|
11498
12111
|
name: `Nodes re-push from ${directory}`,
|
|
11499
12112
|
objects: Array.from(nodesFailedDueToMissingParent),
|
|
11500
12113
|
selectIdentifier: expandedSelectIdentifier,
|
|
11501
|
-
selectDisplayName:
|
|
12114
|
+
selectDisplayName: selectDisplayName15
|
|
11502
12115
|
});
|
|
11503
12116
|
await attemptSync();
|
|
11504
12117
|
} else {
|
|
@@ -11515,10 +12128,10 @@ var ProjectMapNodeRemoveModule = {
|
|
|
11515
12128
|
command: "remove <id> <projectMapId>",
|
|
11516
12129
|
aliases: ["delete", "rm"],
|
|
11517
12130
|
describe: "Delete a project map node",
|
|
11518
|
-
builder: (
|
|
12131
|
+
builder: (yargs43) => withConfiguration(
|
|
11519
12132
|
withApiOptions(
|
|
11520
12133
|
withProjectOptions(
|
|
11521
|
-
|
|
12134
|
+
yargs43.positional("id", { demandOption: true, describe: "ProjectMap Node UUID to delete" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to delete from" })
|
|
11522
12135
|
)
|
|
11523
12136
|
)
|
|
11524
12137
|
),
|
|
@@ -11534,10 +12147,10 @@ var ProjectMapNodeUpdateModule = {
|
|
|
11534
12147
|
command: "update <filename> <projectMapId>",
|
|
11535
12148
|
aliases: ["put"],
|
|
11536
12149
|
describe: "Insert or update a project map node",
|
|
11537
|
-
builder: (
|
|
12150
|
+
builder: (yargs43) => withConfiguration(
|
|
11538
12151
|
withApiOptions(
|
|
11539
12152
|
withProjectOptions(
|
|
11540
|
-
|
|
12153
|
+
yargs43.positional("filename", { demandOption: true, describe: "ProjectMap node file with nodes data" }).positional("projectMapId", { demandOption: true, describe: "ProjectMap UUID to put into" })
|
|
11541
12154
|
)
|
|
11542
12155
|
)
|
|
11543
12156
|
),
|
|
@@ -11553,9 +12166,9 @@ var ProjectMapNodeUpdateModule = {
|
|
|
11553
12166
|
var ProjectMapNodeModule = {
|
|
11554
12167
|
command: "node <command>",
|
|
11555
12168
|
describe: "Commands for ProjectMap Nodes",
|
|
11556
|
-
builder: (
|
|
12169
|
+
builder: (yargs43) => yargs43.command(ProjectMapNodePullModule).command(ProjectMapNodePushModule).command(ProjectMapNodeGetModule).command(ProjectMapNodeRemoveModule).command(ProjectMapNodeListModule).command(ProjectMapNodeUpdateModule).demandCommand(),
|
|
11557
12170
|
handler: () => {
|
|
11558
|
-
|
|
12171
|
+
yargs36.help();
|
|
11559
12172
|
}
|
|
11560
12173
|
};
|
|
11561
12174
|
|
|
@@ -11564,26 +12177,26 @@ var ProjectMapCommand = {
|
|
|
11564
12177
|
command: "project-map <command>",
|
|
11565
12178
|
aliases: ["prm"],
|
|
11566
12179
|
describe: "Uniform ProjectMap commands",
|
|
11567
|
-
builder: (
|
|
12180
|
+
builder: (yargs43) => yargs43.command(ProjectMapNodeModule).command(ProjectMapDefinitionModule).demandCommand(),
|
|
11568
12181
|
handler: () => {
|
|
11569
|
-
|
|
12182
|
+
yargs37.showHelp();
|
|
11570
12183
|
}
|
|
11571
12184
|
};
|
|
11572
12185
|
|
|
11573
12186
|
// src/commands/redirect/index.ts
|
|
11574
|
-
import
|
|
12187
|
+
import yargs39 from "yargs";
|
|
11575
12188
|
|
|
11576
12189
|
// src/commands/redirect/commands/redirect.ts
|
|
11577
|
-
import
|
|
12190
|
+
import yargs38 from "yargs";
|
|
11578
12191
|
|
|
11579
12192
|
// src/commands/redirect/commands/RedirectDefinition/_util.ts
|
|
11580
12193
|
import { UncachedRedirectClient } from "@uniformdev/redirect";
|
|
11581
|
-
var
|
|
12194
|
+
var selectIdentifier16 = (source) => source.id;
|
|
11582
12195
|
var selectFilename2 = (source) => {
|
|
11583
12196
|
const index = source.sourceUrl.lastIndexOf("/");
|
|
11584
12197
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
11585
12198
|
};
|
|
11586
|
-
var
|
|
12199
|
+
var selectDisplayName16 = (source) => {
|
|
11587
12200
|
let pathName = source.sourceUrl;
|
|
11588
12201
|
if (pathName.length > 30) {
|
|
11589
12202
|
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
@@ -11599,11 +12212,11 @@ function getRedirectClient(options) {
|
|
|
11599
12212
|
var RedirectDefinitionGetModule = {
|
|
11600
12213
|
command: "get <id>",
|
|
11601
12214
|
describe: "Fetch a redirect",
|
|
11602
|
-
builder: (
|
|
12215
|
+
builder: (yargs43) => withConfiguration(
|
|
11603
12216
|
withFormatOptions(
|
|
11604
12217
|
withApiOptions(
|
|
11605
12218
|
withProjectOptions(
|
|
11606
|
-
|
|
12219
|
+
yargs43.positional("id", { demandOption: true, describe: "Redirect UUID to fetch" })
|
|
11607
12220
|
)
|
|
11608
12221
|
)
|
|
11609
12222
|
)
|
|
@@ -11626,7 +12239,7 @@ var RedirectDefinitionListModule = {
|
|
|
11626
12239
|
command: "list",
|
|
11627
12240
|
describe: "List of redirects",
|
|
11628
12241
|
aliases: ["ls"],
|
|
11629
|
-
builder: (
|
|
12242
|
+
builder: (yargs43) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs43)))),
|
|
11630
12243
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
11631
12244
|
const fetch2 = nodeFetchProxy(proxy);
|
|
11632
12245
|
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -11654,9 +12267,9 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
11654
12267
|
const redirects = client.getAllRedirects();
|
|
11655
12268
|
for await (const redirect of redirects) {
|
|
11656
12269
|
const result = {
|
|
11657
|
-
id:
|
|
11658
|
-
displayName:
|
|
11659
|
-
providerId:
|
|
12270
|
+
id: selectIdentifier16(redirect.redirect),
|
|
12271
|
+
displayName: selectDisplayName16(redirect.redirect),
|
|
12272
|
+
providerId: selectIdentifier16(redirect.redirect),
|
|
11660
12273
|
object: redirect.redirect
|
|
11661
12274
|
};
|
|
11662
12275
|
yield result;
|
|
@@ -11678,12 +12291,12 @@ function createRedirectDefinitionEngineDataSource({
|
|
|
11678
12291
|
var RedirectDefinitionPullModule = {
|
|
11679
12292
|
command: "pull <directory>",
|
|
11680
12293
|
describe: "Pulls all redirects to local files in a directory",
|
|
11681
|
-
builder: (
|
|
12294
|
+
builder: (yargs43) => withConfiguration(
|
|
11682
12295
|
withDebugOptions(
|
|
11683
12296
|
withApiOptions(
|
|
11684
12297
|
withProjectOptions(
|
|
11685
12298
|
withDiffOptions(
|
|
11686
|
-
|
|
12299
|
+
yargs43.positional("directory", {
|
|
11687
12300
|
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.",
|
|
11688
12301
|
type: "string"
|
|
11689
12302
|
}).option("format", {
|
|
@@ -11727,8 +12340,8 @@ var RedirectDefinitionPullModule = {
|
|
|
11727
12340
|
target = await createArraySyncEngineDataSource({
|
|
11728
12341
|
name: `Package file ${directory}`,
|
|
11729
12342
|
objects: packageContents.redirects ?? [],
|
|
11730
|
-
selectIdentifier:
|
|
11731
|
-
selectDisplayName:
|
|
12343
|
+
selectIdentifier: selectIdentifier16,
|
|
12344
|
+
selectDisplayName: selectDisplayName16,
|
|
11732
12345
|
onSyncComplete: async (_, synced) => {
|
|
11733
12346
|
packageContents.redirects = synced;
|
|
11734
12347
|
writeContextPackage3(directory, packageContents);
|
|
@@ -11738,8 +12351,8 @@ var RedirectDefinitionPullModule = {
|
|
|
11738
12351
|
target = await createFileSyncEngineDataSource({
|
|
11739
12352
|
directory,
|
|
11740
12353
|
selectFilename: selectFilename2,
|
|
11741
|
-
selectIdentifier:
|
|
11742
|
-
selectDisplayName:
|
|
12354
|
+
selectIdentifier: selectIdentifier16,
|
|
12355
|
+
selectDisplayName: selectDisplayName16,
|
|
11743
12356
|
format,
|
|
11744
12357
|
verbose
|
|
11745
12358
|
});
|
|
@@ -11759,12 +12372,12 @@ var RedirectDefinitionPullModule = {
|
|
|
11759
12372
|
var RedirectDefinitionPushModule = {
|
|
11760
12373
|
command: "push <directory>",
|
|
11761
12374
|
describe: "Pushes all redirects from files in a directory or package to Uniform",
|
|
11762
|
-
builder: (
|
|
12375
|
+
builder: (yargs43) => withConfiguration(
|
|
11763
12376
|
withDebugOptions(
|
|
11764
12377
|
withApiOptions(
|
|
11765
12378
|
withProjectOptions(
|
|
11766
12379
|
withDiffOptions(
|
|
11767
|
-
|
|
12380
|
+
yargs43.positional("directory", {
|
|
11768
12381
|
describe: "Directory to read redirects from. If a filename is used, a package will be read instead.",
|
|
11769
12382
|
type: "string"
|
|
11770
12383
|
}).option("mode", {
|
|
@@ -11800,14 +12413,14 @@ var RedirectDefinitionPushModule = {
|
|
|
11800
12413
|
source = await createArraySyncEngineDataSource({
|
|
11801
12414
|
name: `Package file ${directory}`,
|
|
11802
12415
|
objects: packageContents.redirects ?? [],
|
|
11803
|
-
selectIdentifier:
|
|
11804
|
-
selectDisplayName:
|
|
12416
|
+
selectIdentifier: selectIdentifier16,
|
|
12417
|
+
selectDisplayName: selectDisplayName16
|
|
11805
12418
|
});
|
|
11806
12419
|
} else {
|
|
11807
12420
|
source = await createFileSyncEngineDataSource({
|
|
11808
12421
|
directory,
|
|
11809
|
-
selectIdentifier:
|
|
11810
|
-
selectDisplayName:
|
|
12422
|
+
selectIdentifier: selectIdentifier16,
|
|
12423
|
+
selectDisplayName: selectDisplayName16,
|
|
11811
12424
|
verbose
|
|
11812
12425
|
});
|
|
11813
12426
|
}
|
|
@@ -11828,9 +12441,9 @@ var RedirectDefinitionRemoveModule = {
|
|
|
11828
12441
|
command: "remove <id>",
|
|
11829
12442
|
aliases: ["delete", "rm"],
|
|
11830
12443
|
describe: "Delete a redirect",
|
|
11831
|
-
builder: (
|
|
12444
|
+
builder: (yargs43) => withConfiguration(
|
|
11832
12445
|
withApiOptions(
|
|
11833
|
-
withProjectOptions(
|
|
12446
|
+
withProjectOptions(yargs43.positional("id", { demandOption: true, describe: " UUID to delete" }))
|
|
11834
12447
|
)
|
|
11835
12448
|
),
|
|
11836
12449
|
handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
|
|
@@ -11845,10 +12458,10 @@ var RedirectDefinitionUpdateModule = {
|
|
|
11845
12458
|
command: "update <filename>",
|
|
11846
12459
|
aliases: ["put"],
|
|
11847
12460
|
describe: "Insert or update a redirect",
|
|
11848
|
-
builder: (
|
|
12461
|
+
builder: (yargs43) => withConfiguration(
|
|
11849
12462
|
withApiOptions(
|
|
11850
12463
|
withProjectOptions(
|
|
11851
|
-
|
|
12464
|
+
yargs43.positional("filename", { demandOption: true, describe: "Redirect file to put" })
|
|
11852
12465
|
)
|
|
11853
12466
|
)
|
|
11854
12467
|
),
|
|
@@ -11864,9 +12477,9 @@ var RedirectDefinitionUpdateModule = {
|
|
|
11864
12477
|
var RedirectDefinitionModule = {
|
|
11865
12478
|
command: "definition <command>",
|
|
11866
12479
|
describe: "Commands for Redirect Definitions",
|
|
11867
|
-
builder: (
|
|
12480
|
+
builder: (yargs43) => yargs43.command(RedirectDefinitionPullModule).command(RedirectDefinitionPushModule).command(RedirectDefinitionGetModule).command(RedirectDefinitionRemoveModule).command(RedirectDefinitionListModule).command(RedirectDefinitionUpdateModule).demandCommand(),
|
|
11868
12481
|
handler: () => {
|
|
11869
|
-
|
|
12482
|
+
yargs38.help();
|
|
11870
12483
|
}
|
|
11871
12484
|
};
|
|
11872
12485
|
|
|
@@ -11875,14 +12488,14 @@ var RedirectCommand = {
|
|
|
11875
12488
|
command: "redirect <command>",
|
|
11876
12489
|
aliases: ["red"],
|
|
11877
12490
|
describe: "Uniform Redirect commands",
|
|
11878
|
-
builder: (
|
|
12491
|
+
builder: (yargs43) => yargs43.command(RedirectDefinitionModule).demandCommand(),
|
|
11879
12492
|
handler: () => {
|
|
11880
|
-
|
|
12493
|
+
yargs39.showHelp();
|
|
11881
12494
|
}
|
|
11882
12495
|
};
|
|
11883
12496
|
|
|
11884
12497
|
// src/commands/sync/index.ts
|
|
11885
|
-
import
|
|
12498
|
+
import yargs40 from "yargs";
|
|
11886
12499
|
|
|
11887
12500
|
// src/webhooksClient.ts
|
|
11888
12501
|
import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
|
|
@@ -12016,8 +12629,8 @@ var WebhooksClient = class extends ApiClient4 {
|
|
|
12016
12629
|
};
|
|
12017
12630
|
|
|
12018
12631
|
// src/commands/webhook/commands/_util.ts
|
|
12019
|
-
var
|
|
12020
|
-
var
|
|
12632
|
+
var selectIdentifier17 = (webhook) => webhook.endpoint.uid ?? webhook.endpoint.id;
|
|
12633
|
+
var selectDisplayName17 = (webhook) => `${webhook.endpoint.url} (pid: ${webhook.endpoint.uid ?? webhook.endpoint.id})`;
|
|
12021
12634
|
var getWebhooksClient = (options) => new WebhooksClient({ ...options, bypassCache: true, limitPolicy: cliLimitPolicy });
|
|
12022
12635
|
var compareWebhooks = (source, target) => {
|
|
12023
12636
|
const { endpoint: sourceEndpoint, ...sourceWithoutEndpoint } = source.object;
|
|
@@ -12052,8 +12665,8 @@ function createWebhookEngineDataSource({
|
|
|
12052
12665
|
const webhooks = await client.get();
|
|
12053
12666
|
for await (const webhook of webhooks) {
|
|
12054
12667
|
const result = {
|
|
12055
|
-
id:
|
|
12056
|
-
displayName:
|
|
12668
|
+
id: selectIdentifier17(webhook),
|
|
12669
|
+
displayName: selectDisplayName17(webhook),
|
|
12057
12670
|
providerId: webhook.endpoint.id,
|
|
12058
12671
|
object: webhook
|
|
12059
12672
|
};
|
|
@@ -12076,12 +12689,12 @@ function createWebhookEngineDataSource({
|
|
|
12076
12689
|
var WebhookPullModule = {
|
|
12077
12690
|
command: "pull <directory>",
|
|
12078
12691
|
describe: "Pulls all webhooks to local files in a directory",
|
|
12079
|
-
builder: (
|
|
12692
|
+
builder: (yargs43) => withConfiguration(
|
|
12080
12693
|
withApiOptions(
|
|
12081
12694
|
withDebugOptions(
|
|
12082
12695
|
withProjectOptions(
|
|
12083
12696
|
withDiffOptions(
|
|
12084
|
-
|
|
12697
|
+
yargs43.positional("directory", {
|
|
12085
12698
|
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.",
|
|
12086
12699
|
type: "string"
|
|
12087
12700
|
}).option("format", {
|
|
@@ -12125,8 +12738,8 @@ var WebhookPullModule = {
|
|
|
12125
12738
|
target = await createArraySyncEngineDataSource({
|
|
12126
12739
|
name: `Package file ${directory}`,
|
|
12127
12740
|
objects: packageContents.webhooks ?? [],
|
|
12128
|
-
selectIdentifier:
|
|
12129
|
-
selectDisplayName:
|
|
12741
|
+
selectIdentifier: selectIdentifier17,
|
|
12742
|
+
selectDisplayName: selectDisplayName17,
|
|
12130
12743
|
onSyncComplete: async (_, synced) => {
|
|
12131
12744
|
packageContents.webhooks = synced;
|
|
12132
12745
|
writeCanvasPackage(directory, packageContents);
|
|
@@ -12135,8 +12748,8 @@ var WebhookPullModule = {
|
|
|
12135
12748
|
} else {
|
|
12136
12749
|
target = await createFileSyncEngineDataSource({
|
|
12137
12750
|
directory,
|
|
12138
|
-
selectIdentifier:
|
|
12139
|
-
selectDisplayName:
|
|
12751
|
+
selectIdentifier: selectIdentifier17,
|
|
12752
|
+
selectDisplayName: selectDisplayName17,
|
|
12140
12753
|
format,
|
|
12141
12754
|
verbose
|
|
12142
12755
|
});
|
|
@@ -12267,11 +12880,12 @@ function numPad(num, spaces = 6) {
|
|
|
12267
12880
|
var SyncPullModule = {
|
|
12268
12881
|
command: "pull",
|
|
12269
12882
|
describe: "Pulls whole project to local files in a directory",
|
|
12270
|
-
builder: (
|
|
12883
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDebugOptions(withDiffOptions(yargs43))))),
|
|
12271
12884
|
handler: async ({ serialization, ...otherParams }) => {
|
|
12272
12885
|
const config2 = serialization;
|
|
12273
12886
|
const enabledEntities = Object.entries({
|
|
12274
12887
|
locale: LocalePullModule,
|
|
12888
|
+
label: LabelPullModule,
|
|
12275
12889
|
asset: AssetPullModule,
|
|
12276
12890
|
category: CategoryPullModule,
|
|
12277
12891
|
workflow: WorkflowPullModule,
|
|
@@ -12294,6 +12908,7 @@ var SyncPullModule = {
|
|
|
12294
12908
|
contentType: ContentTypePullModule,
|
|
12295
12909
|
previewUrl: PreviewUrlPullModule,
|
|
12296
12910
|
previewViewport: PreviewViewportPullModule,
|
|
12911
|
+
policyDocument: PolicyDocumentsPullModule,
|
|
12297
12912
|
webhook: WebhookPullModule
|
|
12298
12913
|
}).filter(([entityType]) => {
|
|
12299
12914
|
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.pull?.disabled !== true;
|
|
@@ -12365,12 +12980,12 @@ var getFormat = (entityType, config2) => {
|
|
|
12365
12980
|
var WebhookPushModule = {
|
|
12366
12981
|
command: "push <directory>",
|
|
12367
12982
|
describe: "Pushes all webhooks from files in a directory to Uniform",
|
|
12368
|
-
builder: (
|
|
12983
|
+
builder: (yargs43) => withConfiguration(
|
|
12369
12984
|
withDebugOptions(
|
|
12370
12985
|
withApiOptions(
|
|
12371
12986
|
withProjectOptions(
|
|
12372
12987
|
withDiffOptions(
|
|
12373
|
-
|
|
12988
|
+
yargs43.positional("directory", {
|
|
12374
12989
|
describe: "Directory to read from. If a filename is used, a package will be read instead.",
|
|
12375
12990
|
type: "string"
|
|
12376
12991
|
}).option("mode", {
|
|
@@ -12406,14 +13021,14 @@ var WebhookPushModule = {
|
|
|
12406
13021
|
source = await createArraySyncEngineDataSource({
|
|
12407
13022
|
name: `Package file ${directory}`,
|
|
12408
13023
|
objects: packageContents.webhooks ?? [],
|
|
12409
|
-
selectIdentifier:
|
|
12410
|
-
selectDisplayName:
|
|
13024
|
+
selectIdentifier: selectIdentifier17,
|
|
13025
|
+
selectDisplayName: selectDisplayName17
|
|
12411
13026
|
});
|
|
12412
13027
|
} else {
|
|
12413
13028
|
source = await createFileSyncEngineDataSource({
|
|
12414
13029
|
directory,
|
|
12415
|
-
selectIdentifier:
|
|
12416
|
-
selectDisplayName:
|
|
13030
|
+
selectIdentifier: selectIdentifier17,
|
|
13031
|
+
selectDisplayName: selectDisplayName17,
|
|
12417
13032
|
verbose
|
|
12418
13033
|
});
|
|
12419
13034
|
}
|
|
@@ -12434,11 +13049,12 @@ var WebhookPushModule = {
|
|
|
12434
13049
|
var SyncPushModule = {
|
|
12435
13050
|
command: "push",
|
|
12436
13051
|
describe: "Pushes whole project data from files in a directory or package to Uniform",
|
|
12437
|
-
builder: (
|
|
13052
|
+
builder: (yargs43) => withConfiguration(withApiOptions(withProjectOptions(withDiffOptions(withDebugOptions(yargs43))))),
|
|
12438
13053
|
handler: async ({ serialization, ...otherParams }) => {
|
|
12439
13054
|
const config2 = serialization;
|
|
12440
13055
|
const enabledEntities = Object.entries({
|
|
12441
13056
|
locale: LocalePushModule,
|
|
13057
|
+
label: LabelPushModule,
|
|
12442
13058
|
asset: AssetPushModule,
|
|
12443
13059
|
category: CategoryPushModule,
|
|
12444
13060
|
workflow: WorkflowPushModule,
|
|
@@ -12461,6 +13077,7 @@ var SyncPushModule = {
|
|
|
12461
13077
|
entryPattern: EntryPatternPushModule,
|
|
12462
13078
|
previewUrl: PreviewUrlPushModule,
|
|
12463
13079
|
previewViewport: PreviewViewportPushModule,
|
|
13080
|
+
policyDocument: PolicyDocumentsPushModule,
|
|
12464
13081
|
webhook: WebhookPushModule
|
|
12465
13082
|
}).filter(([entityType]) => {
|
|
12466
13083
|
return Boolean(config2.entitiesConfig?.[entityType]) && config2.entitiesConfig?.[entityType]?.disabled !== true && config2.entitiesConfig?.[entityType]?.push?.disabled !== true;
|
|
@@ -12643,21 +13260,21 @@ var getFormat2 = (entityType, config2) => {
|
|
|
12643
13260
|
var SyncCommand = {
|
|
12644
13261
|
command: "sync <command>",
|
|
12645
13262
|
describe: "Uniform Sync commands",
|
|
12646
|
-
builder: (
|
|
13263
|
+
builder: (yargs43) => yargs43.command(SyncPullModule).command(SyncPushModule).demandCommand(),
|
|
12647
13264
|
handler: () => {
|
|
12648
|
-
|
|
13265
|
+
yargs40.showHelp();
|
|
12649
13266
|
}
|
|
12650
13267
|
};
|
|
12651
13268
|
|
|
12652
13269
|
// src/commands/webhook/index.ts
|
|
12653
|
-
import
|
|
13270
|
+
import yargs41 from "yargs";
|
|
12654
13271
|
var WebhookCommand = {
|
|
12655
13272
|
command: "webhook <command>",
|
|
12656
13273
|
aliases: ["wh"],
|
|
12657
13274
|
describe: "Commands for webhooks",
|
|
12658
|
-
builder: (
|
|
13275
|
+
builder: (yargs43) => yargs43.command(WebhookPullModule).command(WebhookPushModule).demandCommand(),
|
|
12659
13276
|
handler: () => {
|
|
12660
|
-
|
|
13277
|
+
yargs41.help();
|
|
12661
13278
|
}
|
|
12662
13279
|
};
|
|
12663
13280
|
|
|
@@ -12665,29 +13282,29 @@ var WebhookCommand = {
|
|
|
12665
13282
|
import { bold as bold3, gray as gray6, green as green7 } from "colorette";
|
|
12666
13283
|
|
|
12667
13284
|
// src/updateCheck.ts
|
|
12668
|
-
import { existsSync as
|
|
13285
|
+
import { existsSync as existsSync6, promises as fs8 } from "fs";
|
|
12669
13286
|
import { get as getHttp } from "http";
|
|
12670
13287
|
import { get as getHttps } from "https";
|
|
12671
13288
|
import { tmpdir } from "os";
|
|
12672
|
-
import { join as
|
|
13289
|
+
import { join as join12 } from "path";
|
|
12673
13290
|
import registryUrl from "registry-url";
|
|
12674
13291
|
import { URL as URL2 } from "url";
|
|
12675
13292
|
var compareVersions = (a, b) => a.localeCompare(b, "en-US", { numeric: true });
|
|
12676
13293
|
var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
|
|
12677
13294
|
var getFile = async (details, distTag) => {
|
|
12678
13295
|
const rootDir = tmpdir();
|
|
12679
|
-
const subDir =
|
|
12680
|
-
if (!
|
|
13296
|
+
const subDir = join12(rootDir, "update-check");
|
|
13297
|
+
if (!existsSync6(subDir)) {
|
|
12681
13298
|
await fs8.mkdir(subDir);
|
|
12682
13299
|
}
|
|
12683
13300
|
let name = `${details.name}-${distTag}.json`;
|
|
12684
13301
|
if (details.scope) {
|
|
12685
13302
|
name = `${details.scope}-${name}`;
|
|
12686
13303
|
}
|
|
12687
|
-
return
|
|
13304
|
+
return join12(subDir, name);
|
|
12688
13305
|
};
|
|
12689
13306
|
var evaluateCache = async (file, time, interval) => {
|
|
12690
|
-
if (
|
|
13307
|
+
if (existsSync6(file)) {
|
|
12691
13308
|
const content = await fs8.readFile(file, "utf8");
|
|
12692
13309
|
const { lastUpdate, latest } = JSON.parse(content);
|
|
12693
13310
|
const nextCheck = lastUpdate + interval;
|
|
@@ -12839,7 +13456,7 @@ var checkForUpdateMiddleware = async ({ verbose }) => {
|
|
|
12839
13456
|
|
|
12840
13457
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
12841
13458
|
import { magenta, red as red8 } from "colorette";
|
|
12842
|
-
import { join as
|
|
13459
|
+
import { join as join13 } from "path";
|
|
12843
13460
|
var uniformStrictVersions = [
|
|
12844
13461
|
"@uniformdev/canvas",
|
|
12845
13462
|
"@uniformdev/canvas-next",
|
|
@@ -12861,7 +13478,7 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
12861
13478
|
try {
|
|
12862
13479
|
let isOutside = false;
|
|
12863
13480
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
12864
|
-
const localPackages = await tryReadJSON(
|
|
13481
|
+
const localPackages = await tryReadJSON(join13(process.cwd(), "package.json"));
|
|
12865
13482
|
if (!localPackages) return;
|
|
12866
13483
|
let firstVersion;
|
|
12867
13484
|
const allDependencies = {
|
|
@@ -12892,11 +13509,11 @@ First found was: v${firstVersion}`;
|
|
|
12892
13509
|
|
|
12893
13510
|
// src/index.ts
|
|
12894
13511
|
dotenv.config();
|
|
12895
|
-
var yarggery =
|
|
13512
|
+
var yarggery = yargs42(hideBin(process.argv));
|
|
12896
13513
|
var useDefaultConfig = !process.argv.includes("--config");
|
|
12897
13514
|
var defaultConfig2 = useDefaultConfig ? loadConfig(null) : {};
|
|
12898
13515
|
yarggery.option("verbose", {
|
|
12899
13516
|
describe: "Include verbose logging",
|
|
12900
13517
|
default: false,
|
|
12901
13518
|
type: "boolean"
|
|
12902
|
-
}).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(RedirectCommand).command(WebhookCommand).command(SyncCommand).command(NewCmd).command(NewMeshCmd).command(IntegrationCommand).recommendCommands().demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).parse();
|
|
13519
|
+
}).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();
|