@uniformdev/cli 19.195.1-alpha.2 → 19.195.1-alpha.4
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.
|
@@ -13,6 +13,7 @@ var getDirname = () => path.dirname(getFilename());
|
|
|
13
13
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
14
14
|
|
|
15
15
|
// src/sync/util.ts
|
|
16
|
+
import { ApiClientError } from "@uniformdev/canvas";
|
|
16
17
|
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
17
18
|
import { dump, load } from "js-yaml";
|
|
18
19
|
import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
@@ -47,7 +48,26 @@ function withApiOptions(yargs) {
|
|
|
47
48
|
type: "string"
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function withDebugOptions(yargs) {
|
|
52
|
+
return yargs.option("verbose", {
|
|
53
|
+
describe: "Enable verbose mode, which outputs additional information",
|
|
54
|
+
default: false,
|
|
55
|
+
type: "boolean"
|
|
56
|
+
}).option("what-if", {
|
|
57
|
+
alias: ["w"],
|
|
58
|
+
describe: "What-if mode reports what would be done but changes nothing",
|
|
59
|
+
default: false,
|
|
60
|
+
type: "boolean"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function withVerboseOption(yargs) {
|
|
64
|
+
return yargs.option("verbose", {
|
|
65
|
+
describe: "Enable verbose mode, which outputs additional information",
|
|
66
|
+
default: false,
|
|
67
|
+
type: "boolean"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function nodeFetchProxy(proxy, verbose) {
|
|
51
71
|
if (proxy) {
|
|
52
72
|
console.log(`\u{1F991} Using proxy ${proxy}`);
|
|
53
73
|
}
|
|
@@ -61,6 +81,41 @@ function nodeFetchProxy(proxy) {
|
|
|
61
81
|
}
|
|
62
82
|
return undiciFetch(input, init);
|
|
63
83
|
};
|
|
84
|
+
if (verbose) {
|
|
85
|
+
return async function fetchWithVerboseLogging(input, init) {
|
|
86
|
+
const method = init?.method ?? "GET";
|
|
87
|
+
console.log(`\u{1F41B} verbose request: method ${method} url ${input.toString()}`);
|
|
88
|
+
const response = await wrappedFetch(input, init);
|
|
89
|
+
const clonedResponse = response.clone();
|
|
90
|
+
if (!clonedResponse.ok) {
|
|
91
|
+
let message = "";
|
|
92
|
+
try {
|
|
93
|
+
const responseText = await clonedResponse.text();
|
|
94
|
+
try {
|
|
95
|
+
const parsed = JSON.parse(responseText);
|
|
96
|
+
if (parsed.errorMessage) {
|
|
97
|
+
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
|
98
|
+
} else {
|
|
99
|
+
message = responseText;
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
message = responseText;
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
message = `General error`;
|
|
106
|
+
}
|
|
107
|
+
const exception = new ApiClientError(
|
|
108
|
+
message,
|
|
109
|
+
method,
|
|
110
|
+
input.toString(),
|
|
111
|
+
clonedResponse.status,
|
|
112
|
+
clonedResponse.statusText
|
|
113
|
+
);
|
|
114
|
+
console.error(`\u{1F41B} verbose API error`, exception.message, init?.body);
|
|
115
|
+
}
|
|
116
|
+
return response;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
64
119
|
return wrappedFetch;
|
|
65
120
|
}
|
|
66
121
|
function withProjectOptions(yargs) {
|
|
@@ -251,6 +306,8 @@ export {
|
|
|
251
306
|
__require,
|
|
252
307
|
withConfiguration,
|
|
253
308
|
withApiOptions,
|
|
309
|
+
withDebugOptions,
|
|
310
|
+
withVerboseOption,
|
|
254
311
|
nodeFetchProxy,
|
|
255
312
|
withProjectOptions,
|
|
256
313
|
withTeamOptions,
|
package/dist/defaultConfig.d.mts
CHANGED
package/dist/defaultConfig.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-MIERGFOU.mjs";
|
|
2
2
|
|
|
3
3
|
// src/sync/allSerializableEntitiesConfig.ts
|
|
4
4
|
var allSerializableEntitiesConfig = {
|
|
@@ -22,7 +22,9 @@ var allSerializableEntitiesConfig = {
|
|
|
22
22
|
prompt: {},
|
|
23
23
|
quirk: {},
|
|
24
24
|
signal: {},
|
|
25
|
-
test: {}
|
|
25
|
+
test: {},
|
|
26
|
+
previewUrl: {},
|
|
27
|
+
previewViewport: {}
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
// src/defaultConfig.ts
|
|
@@ -4,7 +4,7 @@ type StateArgs = {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
|
|
7
|
-
type EntityTypes = 'aggregate' | 'asset' | 'category' | 'workflow' | 'component' | 'composition' | 'contentType' | 'dataType' | 'enrichment' | 'entry' | 'entryPattern' | 'locale' | 'pattern' | 'componentPattern' | 'compositionPattern' | 'projectMapDefinition' | 'projectMapNode' | 'prompt' | 'quirk' | 'redirect' | 'signal' | 'test';
|
|
7
|
+
type EntityTypes = 'aggregate' | 'asset' | 'category' | 'workflow' | 'component' | 'composition' | 'contentType' | 'dataType' | 'enrichment' | 'entry' | 'entryPattern' | 'locale' | 'pattern' | 'componentPattern' | 'compositionPattern' | 'projectMapDefinition' | 'projectMapNode' | 'previewUrl' | 'previewViewport' | 'prompt' | 'quirk' | 'redirect' | 'signal' | 'test';
|
|
8
8
|
type SyncFileFormat = 'yaml' | 'json';
|
|
9
9
|
type EntityConfiguration = {
|
|
10
10
|
mode?: SyncMode;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { C as CLIConfiguration } from './index-
|
|
2
|
+
export { C as CLIConfiguration } from './index-DqpemVoW.mjs';
|