@uniformdev/cli 19.157.1-alpha.6 → 19.158.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +47 -1
- package/dist/index.mjs +349 -106
- package/package.json +9 -19
- package/dist/chunk-2TESILZJ.mjs +0 -267
- package/dist/defaultConfig.d.mts +0 -46
- package/dist/defaultConfig.mjs +0 -51
- package/dist/index-CwNHvz9G.d.mts +0 -48
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
withProjectOptions,
|
|
17
|
-
withTeamOptions
|
|
18
|
-
} from "./chunk-2TESILZJ.mjs";
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined")
|
|
6
|
+
return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.2_postcss@8.4.38_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import path from "path";
|
|
13
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
14
|
+
var getDirname = () => path.dirname(getFilename());
|
|
15
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
19
16
|
|
|
20
17
|
// src/index.ts
|
|
21
18
|
import * as dotenv from "dotenv";
|
|
@@ -93,9 +90,9 @@ async function createArraySyncEngineDataSource({
|
|
|
93
90
|
|
|
94
91
|
// src/sync/fileSyncEngineDataSource.ts
|
|
95
92
|
import { red } from "colorette";
|
|
96
|
-
import { existsSync, mkdirSync } from "fs";
|
|
93
|
+
import { existsSync, mkdirSync as mkdirSync2 } from "fs";
|
|
97
94
|
import { readdir, unlink } from "fs/promises";
|
|
98
|
-
import { extname, join } from "path";
|
|
95
|
+
import { extname as extname2, join } from "path";
|
|
99
96
|
|
|
100
97
|
// src/util.ts
|
|
101
98
|
import { cosmiconfigSync } from "cosmiconfig";
|
|
@@ -124,16 +121,254 @@ var loadConfig = (configPath) => {
|
|
|
124
121
|
throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
|
|
125
122
|
}
|
|
126
123
|
const configFile = syncCosmicExplorer.load(configPath);
|
|
127
|
-
if (!configFile
|
|
124
|
+
if (!(configFile == null ? void 0 : configFile.config.serialization)) {
|
|
128
125
|
throw new Error(
|
|
129
126
|
`Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
|
|
130
127
|
);
|
|
131
128
|
}
|
|
132
|
-
return applyDefaultSyncConfiguration(configFile
|
|
129
|
+
return applyDefaultSyncConfiguration((configFile == null ? void 0 : configFile.config) ?? {});
|
|
133
130
|
} else {
|
|
134
131
|
const searchedForm = syncCosmicExplorer.search();
|
|
135
|
-
return applyDefaultSyncConfiguration(searchedForm
|
|
132
|
+
return applyDefaultSyncConfiguration((searchedForm == null ? void 0 : searchedForm.config) ?? {});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/sync/util.ts
|
|
137
|
+
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
138
|
+
import { dump, load } from "js-yaml";
|
|
139
|
+
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
140
|
+
import { fetch as undiciFetch, ProxyAgent } from "undici";
|
|
141
|
+
function withConfiguration(yargs34) {
|
|
142
|
+
return yargs34.option("serialization", {
|
|
143
|
+
skipValidation: true,
|
|
144
|
+
hidden: true
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function withApiOptions(yargs34) {
|
|
148
|
+
return yargs34.option("apiKey", {
|
|
149
|
+
describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
|
|
150
|
+
default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
|
|
151
|
+
process.env.CANVAS_CLI_API_KEY ?? // deprecated
|
|
152
|
+
process.env.UPM_CLI_API_KEY ?? process.env.UNIFORM_API_KEY,
|
|
153
|
+
demandOption: true,
|
|
154
|
+
type: "string"
|
|
155
|
+
}).option("apiHost", {
|
|
156
|
+
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env var or https://uniform.app. Supports dotenv.",
|
|
157
|
+
default: process.env.UNIFORM_CLI_BASE_URL || "https://uniform.app",
|
|
158
|
+
demandOption: true,
|
|
159
|
+
type: "string"
|
|
160
|
+
}).option("edgeApiHost", {
|
|
161
|
+
describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
|
|
162
|
+
default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
|
|
163
|
+
demandOption: true,
|
|
164
|
+
type: "string"
|
|
165
|
+
}).option("proxy", {
|
|
166
|
+
describe: "HTTPS proxy to use for Uniform API calls. Defaults to HTTPS_PROXY, https_proxy, ALL_PROXY, or all_proxy env vars (in that order). Supports dotenv.",
|
|
167
|
+
default: process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy,
|
|
168
|
+
type: "string"
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function nodeFetchProxy(proxy) {
|
|
172
|
+
if (proxy) {
|
|
173
|
+
console.log(`\u{1F991} Using proxy ${proxy}`);
|
|
174
|
+
}
|
|
175
|
+
const wrappedFetch = (input, init) => {
|
|
176
|
+
if (proxy) {
|
|
177
|
+
const wrappedInit = {
|
|
178
|
+
...init,
|
|
179
|
+
dispatcher: new ProxyAgent(proxy)
|
|
180
|
+
};
|
|
181
|
+
return undiciFetch(input, wrappedInit);
|
|
182
|
+
}
|
|
183
|
+
return undiciFetch(input, init);
|
|
184
|
+
};
|
|
185
|
+
return wrappedFetch;
|
|
186
|
+
}
|
|
187
|
+
function withProjectOptions(yargs34) {
|
|
188
|
+
return yargs34.option("project", {
|
|
189
|
+
describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
190
|
+
default: process.env.UNIFORM_CLI_PROJECT_ID ?? // deprecated
|
|
191
|
+
process.env.CANVAS_CLI_PROJECT_ID ?? // deprecated
|
|
192
|
+
process.env.UPM_CLI_PROJECT_ID ?? process.env.UNIFORM_PROJECT_ID,
|
|
193
|
+
demandOption: true,
|
|
194
|
+
type: "string",
|
|
195
|
+
alias: ["p"]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function withTeamOptions(yargs34) {
|
|
199
|
+
return yargs34.option("team", {
|
|
200
|
+
describe: "Uniform team ID. Defaults to UNIFORM_CLI_TEAM_ID or UNIFORM_TEAM_ID env. Supports dotenv.",
|
|
201
|
+
default: process.env.UNIFORM_CLI_TEAM_ID ?? process.env.UNIFORM_TEAM_ID,
|
|
202
|
+
demandOption: true,
|
|
203
|
+
type: "string",
|
|
204
|
+
alias: ["p"]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function withFormatOptions(yargs34) {
|
|
208
|
+
return yargs34.option("format", {
|
|
209
|
+
alias: ["f"],
|
|
210
|
+
describe: "Output format",
|
|
211
|
+
default: "yaml",
|
|
212
|
+
choices: ["yaml", "json"],
|
|
213
|
+
type: "string"
|
|
214
|
+
}).option("filename", {
|
|
215
|
+
alias: ["o"],
|
|
216
|
+
describe: "Output filename. If not specified, write to stdout.",
|
|
217
|
+
type: "string"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function withDiffOptions(yargs34) {
|
|
221
|
+
return yargs34.option("diff", {
|
|
222
|
+
describe: "Whether to show diffs in stdout. off = no diffs; update = on for updates; on = updates, creates, deletes. Can be set by UNIFORM_CLI_DIFF_MODE environment variable.",
|
|
223
|
+
default: process.env.UNIFORM_CLI_DIFF_MODE ?? "off",
|
|
224
|
+
type: "string",
|
|
225
|
+
choices: ["off", "update", "on"],
|
|
226
|
+
alias: ["d"]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function isPathAPackageFile(path5) {
|
|
230
|
+
const extension = extname(path5);
|
|
231
|
+
return extension === ".yaml" || extension === ".yml" || extension === ".json";
|
|
232
|
+
}
|
|
233
|
+
function emitWithFormat(object, format, filename) {
|
|
234
|
+
let content;
|
|
235
|
+
if (filename && !format) {
|
|
236
|
+
const extension = extname(filename);
|
|
237
|
+
if (extension === ".yaml" || extension === ".yml") {
|
|
238
|
+
format = "yaml";
|
|
239
|
+
} else if (extension === ".json") {
|
|
240
|
+
format = "json";
|
|
241
|
+
}
|
|
242
|
+
} else if (!format) {
|
|
243
|
+
throw new Error("Format must be specified when no filename is passed");
|
|
244
|
+
}
|
|
245
|
+
switch (format) {
|
|
246
|
+
case "json":
|
|
247
|
+
content = JSON.stringify(object, null, 2);
|
|
248
|
+
break;
|
|
249
|
+
case "yaml":
|
|
250
|
+
content = dump(object);
|
|
251
|
+
if ("$schema" in object) {
|
|
252
|
+
content = `# yaml-language-server: $schema=<${object["$schema"]}>
|
|
253
|
+
${content}`;
|
|
254
|
+
}
|
|
255
|
+
break;
|
|
256
|
+
default:
|
|
257
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
258
|
+
}
|
|
259
|
+
if (filename) {
|
|
260
|
+
const directory = dirname(filename);
|
|
261
|
+
mkDirByPathSync(directory);
|
|
262
|
+
writeFileSync(filename, content, "utf8");
|
|
263
|
+
} else {
|
|
264
|
+
console.log(content);
|
|
136
265
|
}
|
|
266
|
+
}
|
|
267
|
+
function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
|
|
268
|
+
const initDir = isAbsolute(targetDir) ? sep : "";
|
|
269
|
+
const baseDir = isRelativeToScript ? __dirname : ".";
|
|
270
|
+
return targetDir.split(sep).reduce((parentDir, childDir) => {
|
|
271
|
+
const curDir = resolve(baseDir, parentDir, childDir);
|
|
272
|
+
try {
|
|
273
|
+
mkdirSync(curDir);
|
|
274
|
+
} catch (err) {
|
|
275
|
+
if (err.code === "EEXIST") {
|
|
276
|
+
return curDir;
|
|
277
|
+
}
|
|
278
|
+
if (err.code === "ENOENT") {
|
|
279
|
+
throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
|
|
280
|
+
}
|
|
281
|
+
const caughtErr = ["EACCES", "EPERM", "EISDIR"].indexOf(err.code) > -1;
|
|
282
|
+
if (!caughtErr || caughtErr && curDir === resolve(targetDir)) {
|
|
283
|
+
throw err;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return curDir;
|
|
287
|
+
}, initDir);
|
|
288
|
+
}
|
|
289
|
+
function readFileToObject(filename) {
|
|
290
|
+
const file = readFileSync(filename, "utf8");
|
|
291
|
+
return load(file, { filename, json: true });
|
|
292
|
+
}
|
|
293
|
+
async function* paginateAsync(fetchPage, options) {
|
|
294
|
+
const perPage = options.pageSize || 100;
|
|
295
|
+
let offset = 0;
|
|
296
|
+
let pageData = [];
|
|
297
|
+
do {
|
|
298
|
+
pageData = await fetchPage(offset, perPage);
|
|
299
|
+
for (const item of pageData) {
|
|
300
|
+
yield item;
|
|
301
|
+
}
|
|
302
|
+
offset += perPage;
|
|
303
|
+
} while (pageData.length === perPage);
|
|
304
|
+
}
|
|
305
|
+
var defaultSyncConfiguration = {
|
|
306
|
+
entitiesConfig: {},
|
|
307
|
+
directory: "uniform-data",
|
|
308
|
+
allowEmptySource: false,
|
|
309
|
+
format: "yaml",
|
|
310
|
+
mode: "mirror"
|
|
311
|
+
};
|
|
312
|
+
var applyDefaultSyncConfiguration = (config2) => {
|
|
313
|
+
var _a;
|
|
314
|
+
const mergedConfig = {
|
|
315
|
+
serialization: {
|
|
316
|
+
...defaultSyncConfiguration,
|
|
317
|
+
...(config2 == null ? void 0 : config2.serialization) ?? {},
|
|
318
|
+
entitiesConfig: {
|
|
319
|
+
...defaultSyncConfiguration.entitiesConfig,
|
|
320
|
+
...((_a = config2 == null ? void 0 : config2.serialization) == null ? void 0 : _a.entitiesConfig) ?? {}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
for (const entityType in mergedConfig.serialization.entitiesConfig) {
|
|
325
|
+
const entityTypeCasted = entityType;
|
|
326
|
+
const entityConfig = mergedConfig.serialization.entitiesConfig[entityTypeCasted];
|
|
327
|
+
if (Object.keys(entityConfig).length === 0) {
|
|
328
|
+
const separator = mergedConfig.serialization.directory[mergedConfig.serialization.directory.length - 1] === "/" ? "" : "/";
|
|
329
|
+
mergedConfig.serialization.entitiesConfig[entityTypeCasted].directory = isPathAPackageFile(
|
|
330
|
+
mergedConfig.serialization.directory
|
|
331
|
+
) ? mergedConfig.serialization.directory : `${mergedConfig.serialization.directory}${separator}${entityTypeCasted}`;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return mergedConfig;
|
|
335
|
+
};
|
|
336
|
+
var getEntityOption = ({
|
|
337
|
+
optionName,
|
|
338
|
+
config: config2,
|
|
339
|
+
entityType,
|
|
340
|
+
operation
|
|
341
|
+
}) => {
|
|
342
|
+
var _a, _b, _c, _d, _e, _f;
|
|
343
|
+
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b[optionName]) {
|
|
344
|
+
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d[optionName];
|
|
345
|
+
}
|
|
346
|
+
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e[optionName]) {
|
|
347
|
+
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f[optionName];
|
|
348
|
+
}
|
|
349
|
+
if (config2[optionName]) {
|
|
350
|
+
return config2[optionName];
|
|
351
|
+
}
|
|
352
|
+
throw `No ${optionName} option specified for ${entityType} ${operation}`;
|
|
353
|
+
};
|
|
354
|
+
var getDirectoryOrFilename = ({
|
|
355
|
+
config: config2,
|
|
356
|
+
entityType,
|
|
357
|
+
operation,
|
|
358
|
+
defaultEntityFolderName = entityType
|
|
359
|
+
}) => {
|
|
360
|
+
var _a, _b, _c, _d, _e, _f;
|
|
361
|
+
if ((_b = (_a = config2.entitiesConfig[entityType]) == null ? void 0 : _a[operation]) == null ? void 0 : _b.directory) {
|
|
362
|
+
return (_d = (_c = config2.entitiesConfig[entityType]) == null ? void 0 : _c[operation]) == null ? void 0 : _d.directory;
|
|
363
|
+
}
|
|
364
|
+
if ((_e = config2.entitiesConfig[entityType]) == null ? void 0 : _e.directory) {
|
|
365
|
+
return (_f = config2.entitiesConfig[entityType]) == null ? void 0 : _f.directory;
|
|
366
|
+
}
|
|
367
|
+
const isPackage = isPathAPackageFile(config2.directory);
|
|
368
|
+
if (isPackage) {
|
|
369
|
+
return config2.directory;
|
|
370
|
+
}
|
|
371
|
+
return `${config2.directory}/${defaultEntityFolderName}`;
|
|
137
372
|
};
|
|
138
373
|
|
|
139
374
|
// src/sync/fileSyncEngineDataSource.ts
|
|
@@ -148,12 +383,12 @@ async function createFileSyncEngineDataSource({
|
|
|
148
383
|
}) {
|
|
149
384
|
const dirExists = existsSync(directory);
|
|
150
385
|
if (!dirExists) {
|
|
151
|
-
|
|
386
|
+
mkdirSync2(directory, { recursive: true });
|
|
152
387
|
}
|
|
153
388
|
const rawFilenames = await readdir(directory, "utf-8");
|
|
154
389
|
const filenames = new Set(
|
|
155
390
|
rawFilenames.filter((filename) => {
|
|
156
|
-
const ext =
|
|
391
|
+
const ext = extname2(filename);
|
|
157
392
|
return ext === `.json` || ext === `.yaml` || ext === `.yml`;
|
|
158
393
|
})
|
|
159
394
|
);
|
|
@@ -173,7 +408,7 @@ async function createFileSyncEngineDataSource({
|
|
|
173
408
|
yield object;
|
|
174
409
|
} catch (e) {
|
|
175
410
|
console.error(red(`Failed to read ${fullFilename}, data is likely invalid.
|
|
176
|
-
${e
|
|
411
|
+
${e == null ? void 0 : e.message}`));
|
|
177
412
|
throw e;
|
|
178
413
|
}
|
|
179
414
|
}
|
|
@@ -239,6 +474,7 @@ async function syncEngine({
|
|
|
239
474
|
onBeforeCompareObjects,
|
|
240
475
|
onBeforeWriteObject
|
|
241
476
|
}) {
|
|
477
|
+
var _a, _b;
|
|
242
478
|
const targetItems = /* @__PURE__ */ new Map();
|
|
243
479
|
const deleteTracker = /* @__PURE__ */ new Set();
|
|
244
480
|
const processDelete = async (object) => {
|
|
@@ -274,7 +510,7 @@ async function syncEngine({
|
|
|
274
510
|
sourceHasItems = true;
|
|
275
511
|
const ids = Array.isArray(sourceObject.id) ? sourceObject.id : [sourceObject.id];
|
|
276
512
|
const targetObject = targetItems.get(ids[0]);
|
|
277
|
-
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => o
|
|
513
|
+
const invalidTargetObjects = ids.map((i) => targetItems.get(i)).filter((o) => (o == null ? void 0 : o.object) !== (targetObject == null ? void 0 : targetObject.object));
|
|
278
514
|
if (targetObject && invalidTargetObjects.length == 0) {
|
|
279
515
|
sourceObject = onBeforeCompareObjects ? await onBeforeCompareObjects(sourceObject, targetObject) : sourceObject;
|
|
280
516
|
if (!compareContents(sourceObject, targetObject)) {
|
|
@@ -322,7 +558,8 @@ async function syncEngine({
|
|
|
322
558
|
};
|
|
323
559
|
if (invalidTargetObjects.length > 0) {
|
|
324
560
|
[...invalidTargetObjects, targetObject].forEach((o) => {
|
|
325
|
-
|
|
561
|
+
var _a2;
|
|
562
|
+
(_a2 = Array.isArray(o == null ? void 0 : o.id) ? o == null ? void 0 : o.id : [o == null ? void 0 : o.id]) == null ? void 0 : _a2.forEach((i) => i && targetItems.delete(i));
|
|
326
563
|
});
|
|
327
564
|
const deletes = invalidTargetObjects.filter((io) => typeof io !== "undefined").map(async (io) => {
|
|
328
565
|
await processDelete(io);
|
|
@@ -349,7 +586,7 @@ async function syncEngine({
|
|
|
349
586
|
});
|
|
350
587
|
await Promise.all(deletes);
|
|
351
588
|
}
|
|
352
|
-
await Promise.all([source.onSyncComplete
|
|
589
|
+
await Promise.all([(_a = source.onSyncComplete) == null ? void 0 : _a.call(source, false), (_b = target.onSyncComplete) == null ? void 0 : _b.call(target, true)]);
|
|
353
590
|
}
|
|
354
591
|
var SyncEngineError = class _SyncEngineError extends Error {
|
|
355
592
|
constructor(innerError, sourceObject) {
|
|
@@ -454,7 +691,7 @@ import { createHash } from "crypto";
|
|
|
454
691
|
import fsj from "fs-jetpack";
|
|
455
692
|
import sizeOf from "image-size";
|
|
456
693
|
import PQueue from "p-queue";
|
|
457
|
-
import { dirname, join as join2 } from "path";
|
|
694
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
458
695
|
var FILES_DIRECTORY_NAME = "files";
|
|
459
696
|
var escapeRegExp = (string) => {
|
|
460
697
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -498,7 +735,7 @@ var urlToFileName = (url, hash) => {
|
|
|
498
735
|
};
|
|
499
736
|
var getFilesDirectory = (directory) => {
|
|
500
737
|
const isPackage = isPathAPackageFile(directory);
|
|
501
|
-
return isPackage ?
|
|
738
|
+
return isPackage ? dirname2(directory) : (
|
|
502
739
|
// If we are syncing to a directory, we want to write all files into a
|
|
503
740
|
// top-lvl folder. That way any entities that contain files will sync to the
|
|
504
741
|
// same directory, so there is no duplication
|
|
@@ -572,7 +809,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
572
809
|
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
573
810
|
const writeDirectory = getFilesDirectory(options.directory);
|
|
574
811
|
const isPackage = isPathAPackageFile(options.directory);
|
|
575
|
-
const legacyWriteDirectory = isPackage ?
|
|
812
|
+
const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
576
813
|
if (uniformFileUrlMatches) {
|
|
577
814
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
578
815
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -649,7 +886,7 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
649
886
|
}
|
|
650
887
|
const file2 = await options.fileClient.get({ id });
|
|
651
888
|
if (!file2 || file2.state !== FILE_READY_STATE || !file2.url) {
|
|
652
|
-
await new Promise((
|
|
889
|
+
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
653
890
|
return checkForFile();
|
|
654
891
|
}
|
|
655
892
|
return file2.url;
|
|
@@ -738,10 +975,11 @@ var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, op
|
|
|
738
975
|
return JSON.parse(sourceObjectAsString);
|
|
739
976
|
};
|
|
740
977
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
978
|
+
var _a;
|
|
741
979
|
if (!asset.asset.fields) {
|
|
742
980
|
return asset;
|
|
743
981
|
}
|
|
744
|
-
const fileUrl = asset.asset.fields.url
|
|
982
|
+
const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
|
|
745
983
|
if (!fileUrl) {
|
|
746
984
|
return asset;
|
|
747
985
|
}
|
|
@@ -771,7 +1009,10 @@ import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
|
771
1009
|
|
|
772
1010
|
// src/commands/canvas/commands/asset/_util.ts
|
|
773
1011
|
var selectAssetIdentifier = (e) => e.asset._id;
|
|
774
|
-
var selectAssetDisplayName = (e) =>
|
|
1012
|
+
var selectAssetDisplayName = (e) => {
|
|
1013
|
+
var _a, _b;
|
|
1014
|
+
return `${((_b = (_a = e.asset.fields) == null ? void 0 : _a.title) == null ? void 0 : _b.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
1015
|
+
};
|
|
775
1016
|
|
|
776
1017
|
// src/commands/canvas/util.ts
|
|
777
1018
|
import {
|
|
@@ -907,8 +1148,9 @@ var AssetPullModule = {
|
|
|
907
1148
|
let target;
|
|
908
1149
|
const isPackage = isPathAPackageFile(directory);
|
|
909
1150
|
const onBeforeDeleteObject = async (id, object) => {
|
|
1151
|
+
var _a, _b;
|
|
910
1152
|
const asset = object.object;
|
|
911
|
-
if (!asset.asset.fields
|
|
1153
|
+
if (!((_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value)) {
|
|
912
1154
|
return;
|
|
913
1155
|
}
|
|
914
1156
|
await deleteDownloadedFileByUrl(asset.asset.fields.url.value, {
|
|
@@ -945,6 +1187,7 @@ var AssetPullModule = {
|
|
|
945
1187
|
allowEmptySource: allowEmptySource ?? true,
|
|
946
1188
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
947
1189
|
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1190
|
+
var _a, _b;
|
|
948
1191
|
delete sourceObject.object.asset._author;
|
|
949
1192
|
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
950
1193
|
sourceObject,
|
|
@@ -954,7 +1197,7 @@ var AssetPullModule = {
|
|
|
954
1197
|
fileClient
|
|
955
1198
|
}
|
|
956
1199
|
);
|
|
957
|
-
if (sourceObjectWithPotentiallySwappedUrl.object.asset.fields
|
|
1200
|
+
if (((_a = sourceObjectWithPotentiallySwappedUrl.object.asset.fields) == null ? void 0 : _a.url) && ((_b = targetObject.object.asset.fields) == null ? void 0 : _b.url) && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
958
1201
|
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
959
1202
|
}
|
|
960
1203
|
return sourceObjectWithPotentiallySwappedUrl;
|
|
@@ -2174,7 +2417,7 @@ var CompositionPullModule = {
|
|
|
2174
2417
|
const packageContents = readCanvasPackage(directory, false);
|
|
2175
2418
|
target = await createArraySyncEngineDataSource({
|
|
2176
2419
|
name: `Package file ${directory}`,
|
|
2177
|
-
objects: packageContents
|
|
2420
|
+
objects: (packageContents == null ? void 0 : packageContents.compositions) ?? [],
|
|
2178
2421
|
selectIdentifier: selectIdentifier3,
|
|
2179
2422
|
selectDisplayName: selectDisplayName3,
|
|
2180
2423
|
onSyncComplete: async (_, synced) => {
|
|
@@ -5308,9 +5551,10 @@ var EnrichmentGetModule = {
|
|
|
5308
5551
|
)
|
|
5309
5552
|
),
|
|
5310
5553
|
handler: async ({ apiHost, apiKey, proxy, id, format, project: projectId, filename }) => {
|
|
5554
|
+
var _a, _b;
|
|
5311
5555
|
const fetch3 = nodeFetchProxy(proxy);
|
|
5312
5556
|
const client = new UncachedEnrichmentClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
5313
|
-
const res = (await client.get())
|
|
5557
|
+
const res = (_b = (_a = await client.get()) == null ? void 0 : _a.enrichments) == null ? void 0 : _b.filter((enr) => enr.id === id);
|
|
5314
5558
|
if (res.length === 0) {
|
|
5315
5559
|
console.error("Enrichment did not exist");
|
|
5316
5560
|
process.exit(1);
|
|
@@ -5365,6 +5609,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5365
5609
|
await client.removeCategory({ enrichmentId: providerId });
|
|
5366
5610
|
},
|
|
5367
5611
|
writeObject: async (object, existingObject) => {
|
|
5612
|
+
var _a;
|
|
5368
5613
|
await client.upsertCategory({
|
|
5369
5614
|
enrichment: object.object
|
|
5370
5615
|
});
|
|
@@ -5374,7 +5619,7 @@ function createEnrichmentEngineDataSource({
|
|
|
5374
5619
|
});
|
|
5375
5620
|
const target = createEnrichmentValueEngineDataSource({
|
|
5376
5621
|
categoryId: object.object.id,
|
|
5377
|
-
values: existingObject
|
|
5622
|
+
values: ((_a = existingObject == null ? void 0 : existingObject.object) == null ? void 0 : _a.values) ?? [],
|
|
5378
5623
|
client
|
|
5379
5624
|
});
|
|
5380
5625
|
await syncEngine({
|
|
@@ -6607,7 +6852,7 @@ import yargs23 from "yargs";
|
|
|
6607
6852
|
import yargs22 from "yargs";
|
|
6608
6853
|
|
|
6609
6854
|
// src/commands/integration/commands/definition/edgehancer/deploy.ts
|
|
6610
|
-
import { readFileSync } from "fs";
|
|
6855
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
6611
6856
|
|
|
6612
6857
|
// src/commands/integration/commands/definition/edgehancer/EdgehancerClient.ts
|
|
6613
6858
|
import { createLimitPolicy } from "@uniformdev/canvas";
|
|
@@ -6678,7 +6923,7 @@ var IntegrationEdgehancerDeployModule = {
|
|
|
6678
6923
|
handler: async ({ apiHost, apiKey, proxy, filename, team: teamId, archetype, connectorType, hook }) => {
|
|
6679
6924
|
const fetch3 = nodeFetchProxy(proxy);
|
|
6680
6925
|
const client = new EdgehancerClient({ apiKey, apiHost, fetch: fetch3, teamId });
|
|
6681
|
-
const code =
|
|
6926
|
+
const code = readFileSync2(filename, "utf8");
|
|
6682
6927
|
await client.deploy({ archetype, code, connectorType, hook });
|
|
6683
6928
|
}
|
|
6684
6929
|
};
|
|
@@ -6886,7 +7131,7 @@ var makeSpinner = () => {
|
|
|
6886
7131
|
const spin = async (text) => {
|
|
6887
7132
|
const spinner = ora(text).start();
|
|
6888
7133
|
spinners.push(spinner);
|
|
6889
|
-
const minWait = new Promise((
|
|
7134
|
+
const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
6890
7135
|
return async () => {
|
|
6891
7136
|
await minWait;
|
|
6892
7137
|
spinner.stop();
|
|
@@ -6902,20 +7147,10 @@ import { PostHog } from "posthog-node";
|
|
|
6902
7147
|
// package.json
|
|
6903
7148
|
var package_default = {
|
|
6904
7149
|
name: "@uniformdev/cli",
|
|
6905
|
-
version: "19.
|
|
7150
|
+
version: "19.158.0",
|
|
6906
7151
|
description: "Uniform command line interface tool",
|
|
6907
7152
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6908
7153
|
main: "./cli.js",
|
|
6909
|
-
exports: {
|
|
6910
|
-
".": {
|
|
6911
|
-
types: "./dist/index.d.mts",
|
|
6912
|
-
default: "./cli.js"
|
|
6913
|
-
},
|
|
6914
|
-
"./config": {
|
|
6915
|
-
types: "./dist/defaultConfig.d.mts",
|
|
6916
|
-
default: "./dist/defaultConfig.mjs"
|
|
6917
|
-
}
|
|
6918
|
-
},
|
|
6919
7154
|
types: "./dist/index.d.mts",
|
|
6920
7155
|
sideEffects: false,
|
|
6921
7156
|
scripts: {
|
|
@@ -6937,7 +7172,7 @@ var package_default = {
|
|
|
6937
7172
|
"@uniformdev/redirect": "workspace:*",
|
|
6938
7173
|
"call-bind": "^1.0.2",
|
|
6939
7174
|
colorette: "2.0.20",
|
|
6940
|
-
cosmiconfig: "
|
|
7175
|
+
cosmiconfig: "8.3.6",
|
|
6941
7176
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
6942
7177
|
diff: "^5.0.0",
|
|
6943
7178
|
dotenv: "^16.0.3",
|
|
@@ -7014,7 +7249,8 @@ var Telemetry = class {
|
|
|
7014
7249
|
this.send("logged in");
|
|
7015
7250
|
}
|
|
7016
7251
|
send(event, properties = {}) {
|
|
7017
|
-
|
|
7252
|
+
var _a;
|
|
7253
|
+
(_a = this.posthog) == null ? void 0 : _a.capture({
|
|
7018
7254
|
distinctId: this.distinctId,
|
|
7019
7255
|
event: [this.prefix, event].join(" "),
|
|
7020
7256
|
properties: {
|
|
@@ -7024,8 +7260,9 @@ var Telemetry = class {
|
|
|
7024
7260
|
});
|
|
7025
7261
|
}
|
|
7026
7262
|
shutdown() {
|
|
7263
|
+
var _a;
|
|
7027
7264
|
this.send("exited", { exitCode: process.exitCode });
|
|
7028
|
-
return this.posthog
|
|
7265
|
+
return (_a = this.posthog) == null ? void 0 : _a.shutdown();
|
|
7029
7266
|
}
|
|
7030
7267
|
};
|
|
7031
7268
|
|
|
@@ -7038,7 +7275,7 @@ import jwt from "jsonwebtoken";
|
|
|
7038
7275
|
import open from "open";
|
|
7039
7276
|
|
|
7040
7277
|
// src/url.ts
|
|
7041
|
-
var makeUrl = (baseUrl,
|
|
7278
|
+
var makeUrl = (baseUrl, path5) => [baseUrl.trim().replace(/\/+$/, ""), path5.trim().replace(/^\/+/, "")].join("/");
|
|
7042
7279
|
|
|
7043
7280
|
// src/auth/getBearerToken.ts
|
|
7044
7281
|
async function getBearerToken(baseUrl) {
|
|
@@ -7143,8 +7380,8 @@ var getLimitsSchema = z.object({
|
|
|
7143
7380
|
})
|
|
7144
7381
|
});
|
|
7145
7382
|
var createClient = (baseUrl, authToken) => {
|
|
7146
|
-
const request2 = async (
|
|
7147
|
-
const res = await fetch(makeUrl(baseUrl,
|
|
7383
|
+
const request2 = async (path5, opts, allowedNon2xxStatusCodes = []) => {
|
|
7384
|
+
const res = await fetch(makeUrl(baseUrl, path5), {
|
|
7148
7385
|
...opts,
|
|
7149
7386
|
headers: { Authorization: `Bearer ${authToken}` }
|
|
7150
7387
|
});
|
|
@@ -7152,18 +7389,18 @@ var createClient = (baseUrl, authToken) => {
|
|
|
7152
7389
|
return res;
|
|
7153
7390
|
} else {
|
|
7154
7391
|
throw new Error(
|
|
7155
|
-
`Non-2xx API response: ${opts.method} ${
|
|
7392
|
+
`Non-2xx API response: ${opts.method} ${path5} responded with ${res.status} ${res.statusText}`
|
|
7156
7393
|
);
|
|
7157
7394
|
}
|
|
7158
7395
|
};
|
|
7159
|
-
const requestJson = async (
|
|
7160
|
-
const res = await request2(
|
|
7396
|
+
const requestJson = async (path5, opts, schema2, allowedNon2xxStatusCodes = []) => {
|
|
7397
|
+
const res = await request2(path5, opts, allowedNon2xxStatusCodes);
|
|
7161
7398
|
const data = await res.json();
|
|
7162
7399
|
const parseResult = schema2.safeParse(data);
|
|
7163
7400
|
if (parseResult.success) {
|
|
7164
7401
|
return parseResult.data;
|
|
7165
7402
|
} else {
|
|
7166
|
-
throw new Error(`Invalid ${opts.method} ${
|
|
7403
|
+
throw new Error(`Invalid ${opts.method} ${path5} response: ${parseResult.error.message}`);
|
|
7167
7404
|
}
|
|
7168
7405
|
};
|
|
7169
7406
|
return {
|
|
@@ -7285,7 +7522,7 @@ var runNpm = async (workDir, args, { inherit, env } = {}) => {
|
|
|
7285
7522
|
${err.message}`);
|
|
7286
7523
|
}
|
|
7287
7524
|
if (result.exitCode !== 0) {
|
|
7288
|
-
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result
|
|
7525
|
+
throw new Error(`Command npm ${args.join(" ")} exitted with code ${result == null ? void 0 : result.exitCode}}: ${result.stderr}`);
|
|
7289
7526
|
}
|
|
7290
7527
|
return result.stdout;
|
|
7291
7528
|
};
|
|
@@ -7297,7 +7534,7 @@ import fsj2 from "fs-jetpack";
|
|
|
7297
7534
|
import * as git from "isomorphic-git";
|
|
7298
7535
|
import * as http from "isomorphic-git/http/node/index.js";
|
|
7299
7536
|
import os from "os";
|
|
7300
|
-
import
|
|
7537
|
+
import path2 from "path";
|
|
7301
7538
|
async function cloneStarter({
|
|
7302
7539
|
spin,
|
|
7303
7540
|
githubPath,
|
|
@@ -7305,7 +7542,7 @@ async function cloneStarter({
|
|
|
7305
7542
|
dotEnvFile
|
|
7306
7543
|
}) {
|
|
7307
7544
|
const done = await spin("Fetching starter code...");
|
|
7308
|
-
const cloneDir =
|
|
7545
|
+
const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
|
|
7309
7546
|
const [user, repo, ...pathSegments] = githubPath.split("/");
|
|
7310
7547
|
try {
|
|
7311
7548
|
await git.clone({
|
|
@@ -7323,10 +7560,10 @@ async function cloneStarter({
|
|
|
7323
7560
|
if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
|
|
7324
7561
|
throw new Error(`"${targetDir}" is not empty`);
|
|
7325
7562
|
}
|
|
7326
|
-
const starterDir =
|
|
7563
|
+
const starterDir = path2.join(cloneDir, ...pathSegments);
|
|
7327
7564
|
fsj2.copy(starterDir, targetDir, { overwrite: true });
|
|
7328
7565
|
if (dotEnvFile) {
|
|
7329
|
-
fs3.writeFileSync(
|
|
7566
|
+
fs3.writeFileSync(path2.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
|
|
7330
7567
|
}
|
|
7331
7568
|
console.log(`
|
|
7332
7569
|
Your project now lives in ${targetDir} \u2728`);
|
|
@@ -7342,9 +7579,9 @@ Installing project dependencies...
|
|
|
7342
7579
|
}
|
|
7343
7580
|
|
|
7344
7581
|
// src/projects/getOrCreateProject.ts
|
|
7345
|
-
import fs4, { existsSync as existsSync2, mkdirSync as
|
|
7582
|
+
import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
7346
7583
|
import inquirer2 from "inquirer";
|
|
7347
|
-
import
|
|
7584
|
+
import path3 from "path";
|
|
7348
7585
|
import slugify from "slugify";
|
|
7349
7586
|
var newProjectId = "$new";
|
|
7350
7587
|
async function getOrCreateProject({
|
|
@@ -7439,7 +7676,8 @@ async function chooseExistingProject({
|
|
|
7439
7676
|
teamId,
|
|
7440
7677
|
user
|
|
7441
7678
|
}) {
|
|
7442
|
-
|
|
7679
|
+
var _a, _b;
|
|
7680
|
+
const projects = (((_a = user.teams.find((t) => t.team.id === teamId)) == null ? void 0 : _a.team.sites) ?? []).map((t) => ({
|
|
7443
7681
|
name: t.name,
|
|
7444
7682
|
value: t.id
|
|
7445
7683
|
}));
|
|
@@ -7454,7 +7692,7 @@ async function chooseExistingProject({
|
|
|
7454
7692
|
]);
|
|
7455
7693
|
return {
|
|
7456
7694
|
projectId: result.projectId,
|
|
7457
|
-
projectName: projects.find((p) => p.value === result.projectId)
|
|
7695
|
+
projectName: (_b = projects.find((p) => p.value === result.projectId)) == null ? void 0 : _b.name
|
|
7458
7696
|
};
|
|
7459
7697
|
}
|
|
7460
7698
|
function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
@@ -7466,10 +7704,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
|
|
|
7466
7704
|
if (checkTargetDir) {
|
|
7467
7705
|
let targetDir = explicitTargetDir ?? process.cwd();
|
|
7468
7706
|
if (!existsSync2(targetDir)) {
|
|
7469
|
-
|
|
7707
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
7470
7708
|
}
|
|
7471
7709
|
if (fs4.readdirSync(targetDir).length > 0) {
|
|
7472
|
-
targetDir =
|
|
7710
|
+
targetDir = path3.resolve(targetDir, projectNameSlug);
|
|
7473
7711
|
if (fs4.existsSync(targetDir)) {
|
|
7474
7712
|
throw new Error(`${targetDir} already exists, choose a different name.`);
|
|
7475
7713
|
}
|
|
@@ -7723,9 +7961,9 @@ npm run dev
|
|
|
7723
7961
|
}
|
|
7724
7962
|
|
|
7725
7963
|
// src/commands/new/commands/new-mesh-integration.ts
|
|
7726
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
7964
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
7727
7965
|
import inquirer5 from "inquirer";
|
|
7728
|
-
import
|
|
7966
|
+
import path4 from "path";
|
|
7729
7967
|
import slugify2 from "slugify";
|
|
7730
7968
|
async function newMeshIntegrationHandler({
|
|
7731
7969
|
spin,
|
|
@@ -7766,19 +8004,19 @@ async function newMeshIntegrationHandler({
|
|
|
7766
8004
|
targetDir
|
|
7767
8005
|
});
|
|
7768
8006
|
let done = await spin("Registering integration to team...");
|
|
7769
|
-
const pathToManifest =
|
|
8007
|
+
const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
|
|
7770
8008
|
if (!existsSync3(pathToManifest)) {
|
|
7771
8009
|
throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
|
|
7772
8010
|
}
|
|
7773
|
-
const manifestContents =
|
|
8011
|
+
const manifestContents = readFileSync3(pathToManifest, "utf-8");
|
|
7774
8012
|
const manifestJson = JSON.parse(manifestContents);
|
|
7775
8013
|
manifestJson.type = typeSlug;
|
|
7776
8014
|
manifestJson.displayName = name;
|
|
7777
|
-
|
|
7778
|
-
const packageJsonPath =
|
|
7779
|
-
const packageJson = JSON.parse(
|
|
8015
|
+
writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
|
|
8016
|
+
const packageJsonPath = path4.resolve(targetDir, "package.json");
|
|
8017
|
+
const packageJson = JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
7780
8018
|
packageJson.name = typeSlug;
|
|
7781
|
-
|
|
8019
|
+
writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
7782
8020
|
const fullMeshAppKey = await uniformClient.registerMeshIntegration({ teamId, manifest: manifestJson });
|
|
7783
8021
|
await done();
|
|
7784
8022
|
await runNpmInstall();
|
|
@@ -7822,10 +8060,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
|
|
|
7822
8060
|
}
|
|
7823
8061
|
let targetDir = explicitOutputPath ?? process.cwd();
|
|
7824
8062
|
if (!existsSync3(targetDir)) {
|
|
7825
|
-
|
|
8063
|
+
mkdirSync4(targetDir, { recursive: true });
|
|
7826
8064
|
}
|
|
7827
8065
|
if (readdirSync(targetDir).length > 0) {
|
|
7828
|
-
targetDir =
|
|
8066
|
+
targetDir = path4.resolve(targetDir, typeSlug);
|
|
7829
8067
|
if (existsSync3(targetDir)) {
|
|
7830
8068
|
throw new Error(`${targetDir} directory already exists, choose a different name.`);
|
|
7831
8069
|
}
|
|
@@ -8369,11 +8607,12 @@ var ProjectMapNodeGetModule = {
|
|
|
8369
8607
|
)
|
|
8370
8608
|
),
|
|
8371
8609
|
handler: async ({ apiHost, apiKey, proxy, id, projectMapId, format, project: projectId, filename }) => {
|
|
8610
|
+
var _a;
|
|
8372
8611
|
const fetch3 = nodeFetchProxy(proxy);
|
|
8373
8612
|
const client = new UncachedProjectMapClient7({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
8374
8613
|
console.log("Debugging params for node get", { projectMapId, id, projectId });
|
|
8375
8614
|
const res = await client.getNodes({ projectMapId, id });
|
|
8376
|
-
if (res.nodes
|
|
8615
|
+
if (((_a = res.nodes) == null ? void 0 : _a.length) === 0) {
|
|
8377
8616
|
console.error("Project map node does not exist");
|
|
8378
8617
|
process.exit(1);
|
|
8379
8618
|
} else {
|
|
@@ -9078,11 +9317,12 @@ var SyncPullModule = {
|
|
|
9078
9317
|
)
|
|
9079
9318
|
),
|
|
9080
9319
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9320
|
+
var _a, _b;
|
|
9081
9321
|
const config2 = serialization;
|
|
9082
9322
|
let isUsingDeprecatedPatternConfig = false;
|
|
9083
9323
|
if (config2.entitiesConfig.pattern) {
|
|
9084
9324
|
isUsingDeprecatedPatternConfig = true;
|
|
9085
|
-
config2.entitiesConfig.componentPattern
|
|
9325
|
+
(_a = config2.entitiesConfig).componentPattern ?? (_a.componentPattern = config2.entitiesConfig.pattern);
|
|
9086
9326
|
}
|
|
9087
9327
|
const enabledEntities = Object.entries({
|
|
9088
9328
|
locale: LocalePullModule,
|
|
@@ -9107,7 +9347,8 @@ var SyncPullModule = {
|
|
|
9107
9347
|
contentType: ContentTypePullModule
|
|
9108
9348
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9109
9349
|
}).filter(([entityType]) => {
|
|
9110
|
-
|
|
9350
|
+
var _a2, _b2, _c, _d, _e, _f;
|
|
9351
|
+
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
9111
9352
|
});
|
|
9112
9353
|
if (enabledEntities.length === 0) {
|
|
9113
9354
|
throw new Error(
|
|
@@ -9118,7 +9359,7 @@ var SyncPullModule = {
|
|
|
9118
9359
|
const entityConfigSupportsPullState = (entityConfig2) => {
|
|
9119
9360
|
return entityConfig2 !== void 0 && "state" in entityConfig2;
|
|
9120
9361
|
};
|
|
9121
|
-
const entityConfig = config2.entitiesConfig
|
|
9362
|
+
const entityConfig = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType];
|
|
9122
9363
|
try {
|
|
9123
9364
|
await spinPromise(
|
|
9124
9365
|
module3.handler({
|
|
@@ -9137,7 +9378,7 @@ var SyncPullModule = {
|
|
|
9137
9378
|
failText(error) {
|
|
9138
9379
|
return `${entityType}
|
|
9139
9380
|
|
|
9140
|
-
${error.stack
|
|
9381
|
+
${error.stack}`;
|
|
9141
9382
|
}
|
|
9142
9383
|
}
|
|
9143
9384
|
);
|
|
@@ -9192,11 +9433,12 @@ var SyncPushModule = {
|
|
|
9192
9433
|
)
|
|
9193
9434
|
),
|
|
9194
9435
|
handler: async ({ serialization, ...otherParams }) => {
|
|
9436
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
9195
9437
|
const config2 = serialization;
|
|
9196
9438
|
let isUsingDeprecatedPatternConfig = false;
|
|
9197
9439
|
if (config2.entitiesConfig.pattern) {
|
|
9198
9440
|
isUsingDeprecatedPatternConfig = true;
|
|
9199
|
-
config2.entitiesConfig.componentPattern
|
|
9441
|
+
(_a = config2.entitiesConfig).componentPattern ?? (_a.componentPattern = config2.entitiesConfig.pattern);
|
|
9200
9442
|
}
|
|
9201
9443
|
const enabledEntities = Object.entries({
|
|
9202
9444
|
locale: LocalePushModule,
|
|
@@ -9221,7 +9463,8 @@ var SyncPushModule = {
|
|
|
9221
9463
|
entryPattern: EntryPatternPushModule
|
|
9222
9464
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9223
9465
|
}).filter(([entityType]) => {
|
|
9224
|
-
|
|
9466
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
9467
|
+
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
|
9225
9468
|
});
|
|
9226
9469
|
if (enabledEntities.length === 0) {
|
|
9227
9470
|
throw new Error(
|
|
@@ -9247,7 +9490,7 @@ var SyncPushModule = {
|
|
|
9247
9490
|
failText(error) {
|
|
9248
9491
|
return `${entityType}
|
|
9249
9492
|
|
|
9250
|
-
${error.stack
|
|
9493
|
+
${error.stack}`;
|
|
9251
9494
|
}
|
|
9252
9495
|
}
|
|
9253
9496
|
);
|
|
@@ -9255,16 +9498,16 @@ var SyncPushModule = {
|
|
|
9255
9498
|
process.exit(1);
|
|
9256
9499
|
}
|
|
9257
9500
|
}
|
|
9258
|
-
if (config2.entitiesConfig
|
|
9501
|
+
if (((_b = config2.entitiesConfig) == null ? void 0 : _b.componentPattern) && ((_e = (_d = (_c = config2.entitiesConfig) == null ? void 0 : _c.componentPattern) == null ? void 0 : _d.push) == null ? void 0 : _e.disabled) !== true && ((_g = (_f = config2.entitiesConfig) == null ? void 0 : _f.componentPattern) == null ? void 0 : _g.publish)) {
|
|
9259
9502
|
await ComponentPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9260
9503
|
}
|
|
9261
|
-
if (config2.entitiesConfig
|
|
9504
|
+
if (((_h = config2.entitiesConfig) == null ? void 0 : _h.composition) && ((_k = (_j = (_i = config2.entitiesConfig) == null ? void 0 : _i.composition) == null ? void 0 : _j.push) == null ? void 0 : _k.disabled) !== true && ((_m = (_l = config2.entitiesConfig) == null ? void 0 : _l.composition) == null ? void 0 : _m.publish)) {
|
|
9262
9505
|
await CompositionPublishModule.handler({ ...otherParams, all: true });
|
|
9263
9506
|
}
|
|
9264
|
-
if (config2.entitiesConfig
|
|
9507
|
+
if (((_n = config2.entitiesConfig) == null ? void 0 : _n.entry) && ((_q = (_p = (_o = config2.entitiesConfig) == null ? void 0 : _o.entry) == null ? void 0 : _p.push) == null ? void 0 : _q.disabled) !== true && ((_s = (_r = config2.entitiesConfig) == null ? void 0 : _r.entry) == null ? void 0 : _s.publish)) {
|
|
9265
9508
|
await EntryPublishModule.handler({ ...otherParams, all: true });
|
|
9266
9509
|
}
|
|
9267
|
-
if (config2.entitiesConfig
|
|
9510
|
+
if (((_t = config2.entitiesConfig) == null ? void 0 : _t.entryPattern) && ((_w = (_v = (_u = config2.entitiesConfig) == null ? void 0 : _u.entryPattern) == null ? void 0 : _v.push) == null ? void 0 : _w.disabled) !== true && ((_y = (_x = config2.entitiesConfig) == null ? void 0 : _x.entryPattern) == null ? void 0 : _y.publish)) {
|
|
9268
9511
|
await EntryPatternPublishModule.handler({ ...otherParams, all: true });
|
|
9269
9512
|
}
|
|
9270
9513
|
}
|
|
@@ -9374,7 +9617,7 @@ var updateCache = async (file, latest, lastUpdate) => {
|
|
|
9374
9617
|
});
|
|
9375
9618
|
await fs5.writeFile(file, content, "utf8");
|
|
9376
9619
|
};
|
|
9377
|
-
var loadPackage = ({ url, timeout }, authInfo) => new Promise((
|
|
9620
|
+
var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve2, reject) => {
|
|
9378
9621
|
const options = {
|
|
9379
9622
|
host: url.hostname,
|
|
9380
9623
|
path: url.pathname,
|
|
@@ -9405,7 +9648,7 @@ var loadPackage = ({ url, timeout }, authInfo) => new Promise((resolve, reject)
|
|
|
9405
9648
|
response.on("end", () => {
|
|
9406
9649
|
try {
|
|
9407
9650
|
const parsedData = JSON.parse(rawData);
|
|
9408
|
-
|
|
9651
|
+
resolve2(parsedData);
|
|
9409
9652
|
} catch (e) {
|
|
9410
9653
|
reject(e);
|
|
9411
9654
|
}
|
|
@@ -9419,7 +9662,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
|
|
|
9419
9662
|
try {
|
|
9420
9663
|
spec = await loadPackage({ url, timeout });
|
|
9421
9664
|
} catch (err) {
|
|
9422
|
-
if (err
|
|
9665
|
+
if ((err == null ? void 0 : err.code) && String(err.code).startsWith("4")) {
|
|
9423
9666
|
const registryAuthToken = __require("registry-auth-token");
|
|
9424
9667
|
const authInfo = registryAuthToken(regURL, { recursive: true });
|
|
9425
9668
|
spec = await loadPackage({ url, timeout }, authInfo);
|
|
@@ -9500,14 +9743,14 @@ import { join as join4 } from "path";
|
|
|
9500
9743
|
|
|
9501
9744
|
// src/fs.ts
|
|
9502
9745
|
import { promises as fs6 } from "fs";
|
|
9503
|
-
async function readJSON(
|
|
9504
|
-
const fileContents = await fs6.readFile(
|
|
9746
|
+
async function readJSON(path5) {
|
|
9747
|
+
const fileContents = await fs6.readFile(path5, "utf-8");
|
|
9505
9748
|
return JSON.parse(fileContents);
|
|
9506
9749
|
}
|
|
9507
|
-
async function tryReadJSON(
|
|
9750
|
+
async function tryReadJSON(path5, missingValue = null) {
|
|
9508
9751
|
try {
|
|
9509
|
-
const stat = await fs6.stat(
|
|
9510
|
-
return stat.isFile() ? await readJSON(
|
|
9752
|
+
const stat = await fs6.stat(path5);
|
|
9753
|
+
return stat.isFile() ? await readJSON(path5) : missingValue;
|
|
9511
9754
|
} catch (e) {
|
|
9512
9755
|
return missingValue;
|
|
9513
9756
|
}
|
|
@@ -9540,8 +9783,8 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
9540
9783
|
return;
|
|
9541
9784
|
let firstVersion;
|
|
9542
9785
|
const allDependencies = {
|
|
9543
|
-
...localPackages
|
|
9544
|
-
...localPackages
|
|
9786
|
+
...(localPackages == null ? void 0 : localPackages.dependencies) ?? {},
|
|
9787
|
+
...(localPackages == null ? void 0 : localPackages.devDependencies) ?? {}
|
|
9545
9788
|
};
|
|
9546
9789
|
for (const [p, version] of Object.entries(allDependencies)) {
|
|
9547
9790
|
if (uniformStrictVersions.includes(p)) {
|