@walkeros/cli 3.3.1 → 3.4.0-next-1776749829492
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/CHANGELOG.md +25 -0
- package/dist/cli.js +427 -273
- package/dist/examples/flow-complete.json +15 -7
- package/dist/examples/flow-complete.md +76 -57
- package/dist/index.d.ts +72 -5
- package/dist/index.js +222 -61
- package/dist/index.js.map +1 -1
- package/examples/flow-complete.json +15 -7
- package/examples/flow-complete.md +76 -57
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -193,6 +193,33 @@ var init_config_file = __esm({
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
|
|
196
|
+
// src/core/client-context.ts
|
|
197
|
+
function setClientContext(input) {
|
|
198
|
+
const envType = process.env.WALKEROS_CLIENT_TYPE;
|
|
199
|
+
const type = envType ?? input.type ?? "cli";
|
|
200
|
+
context = { type, version: input.version };
|
|
201
|
+
}
|
|
202
|
+
function getClientContext() {
|
|
203
|
+
return context;
|
|
204
|
+
}
|
|
205
|
+
function resetClientContext() {
|
|
206
|
+
context = void 0;
|
|
207
|
+
}
|
|
208
|
+
function clientContextHeaders() {
|
|
209
|
+
if (!context) return {};
|
|
210
|
+
return {
|
|
211
|
+
"User-Agent": `walkeros-${context.type}/${context.version}`,
|
|
212
|
+
"X-WalkerOS-Client": context.type,
|
|
213
|
+
"X-WalkerOS-Client-Version": context.version
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
var context;
|
|
217
|
+
var init_client_context = __esm({
|
|
218
|
+
"src/core/client-context.ts"() {
|
|
219
|
+
"use strict";
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
196
223
|
// src/core/http.ts
|
|
197
224
|
function normalizeHeaders(headers) {
|
|
198
225
|
if (!headers) return {};
|
|
@@ -205,17 +232,29 @@ function mergeAuthHeaders(token, headers) {
|
|
|
205
232
|
if (token) normalized.Authorization = `Bearer ${token}`;
|
|
206
233
|
return normalized;
|
|
207
234
|
}
|
|
235
|
+
function buildHeaders(token, headers) {
|
|
236
|
+
return {
|
|
237
|
+
...clientContextHeaders(),
|
|
238
|
+
...mergeAuthHeaders(token, headers)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
208
241
|
async function apiFetch(path19, init) {
|
|
209
242
|
const baseUrl = resolveAppUrl();
|
|
210
243
|
const token = resolveToken()?.token;
|
|
211
244
|
return fetch(`${baseUrl}${path19}`, {
|
|
212
245
|
...init,
|
|
213
|
-
headers:
|
|
246
|
+
headers: buildHeaders(token, init?.headers)
|
|
214
247
|
});
|
|
215
248
|
}
|
|
216
249
|
async function publicFetch(path19, init) {
|
|
217
250
|
const baseUrl = resolveAppUrl();
|
|
218
|
-
return fetch(`${baseUrl}${path19}`,
|
|
251
|
+
return fetch(`${baseUrl}${path19}`, {
|
|
252
|
+
...init,
|
|
253
|
+
headers: {
|
|
254
|
+
...clientContextHeaders(),
|
|
255
|
+
...normalizeHeaders(init?.headers)
|
|
256
|
+
}
|
|
257
|
+
});
|
|
219
258
|
}
|
|
220
259
|
async function deployFetch(path19, init) {
|
|
221
260
|
const baseUrl = resolveAppUrl();
|
|
@@ -226,13 +265,14 @@ async function deployFetch(path19, init) {
|
|
|
226
265
|
);
|
|
227
266
|
return fetch(`${baseUrl}${path19}`, {
|
|
228
267
|
...init,
|
|
229
|
-
headers:
|
|
268
|
+
headers: buildHeaders(token, init?.headers)
|
|
230
269
|
});
|
|
231
270
|
}
|
|
232
271
|
var init_http = __esm({
|
|
233
272
|
"src/core/http.ts"() {
|
|
234
273
|
"use strict";
|
|
235
274
|
init_config_file();
|
|
275
|
+
init_client_context();
|
|
236
276
|
}
|
|
237
277
|
});
|
|
238
278
|
|
|
@@ -1741,7 +1781,8 @@ ${dataDeclaration}`;
|
|
|
1741
1781
|
} else {
|
|
1742
1782
|
const stage2Entry = (buildOptions.platform || "node") === "browser" ? generateWebEntry(stage1Path, dataPayload, {
|
|
1743
1783
|
windowCollector: buildOptions.windowCollector,
|
|
1744
|
-
windowElb: buildOptions.windowElb
|
|
1784
|
+
windowElb: buildOptions.windowElb,
|
|
1785
|
+
platform: buildOptions.platform
|
|
1745
1786
|
}) : generateServerEntry(stage1Path, dataPayload);
|
|
1746
1787
|
const stage2EntryPath = path10.join(TEMP_DIR, "stage2.mjs");
|
|
1747
1788
|
await fs9.writeFile(stage2EntryPath, stage2Entry);
|
|
@@ -2131,6 +2172,7 @@ async function createEntryPoint(flowSettings, buildOptions, packagePaths) {
|
|
|
2131
2172
|
validateComponentNames(flowWithSections.transformers, "transformers");
|
|
2132
2173
|
if (flowWithSections.stores)
|
|
2133
2174
|
validateComponentNames(flowWithSections.stores, "stores");
|
|
2175
|
+
const withDev = buildOptions.withDev !== void 0 ? buildOptions.withDev === true : buildOptions.skipWrapper === true;
|
|
2134
2176
|
const { importStatements, devExportEntries } = await generateImportStatements(
|
|
2135
2177
|
buildOptions.packages,
|
|
2136
2178
|
destinationPackages,
|
|
@@ -2139,7 +2181,7 @@ async function createEntryPoint(flowSettings, buildOptions, packagePaths) {
|
|
|
2139
2181
|
storePackages,
|
|
2140
2182
|
explicitCodeImports,
|
|
2141
2183
|
packagePaths,
|
|
2142
|
-
|
|
2184
|
+
withDev
|
|
2143
2185
|
);
|
|
2144
2186
|
const importsCode = importStatements.join("\n");
|
|
2145
2187
|
const hasFlow = Object.values(flowSettings.sources || {}).some(
|
|
@@ -2408,12 +2450,24 @@ function generateWebEntry(stage1Path, dataPayload, options = {}) {
|
|
|
2408
2450
|
);
|
|
2409
2451
|
}
|
|
2410
2452
|
const assignmentCode = assignments.length > 0 ? "\n" + assignments.join("\n") : "";
|
|
2453
|
+
const platform = options.platform ?? "browser";
|
|
2454
|
+
const envBlock = platform === "browser" ? `
|
|
2455
|
+
if (config.sources) {
|
|
2456
|
+
for (const key of Object.keys(config.sources)) {
|
|
2457
|
+
const source = config.sources[key];
|
|
2458
|
+
if (!source) continue;
|
|
2459
|
+
const env = source.env ?? (source.env = {});
|
|
2460
|
+
env.window = env.window ?? (typeof window !== 'undefined' ? window : undefined);
|
|
2461
|
+
env.document = env.document ?? (typeof document !== 'undefined' ? document : undefined);
|
|
2462
|
+
}
|
|
2463
|
+
}` : "";
|
|
2411
2464
|
return `import { startFlow, wireConfig } from '${stage1Path}';
|
|
2412
2465
|
|
|
2413
2466
|
const __configData = ${dataPayload};
|
|
2414
2467
|
|
|
2415
2468
|
(async () => {
|
|
2416
|
-
const
|
|
2469
|
+
const config = wireConfig(__configData);${envBlock}
|
|
2470
|
+
const { collector, elb } = await startFlow(config);${assignmentCode}
|
|
2417
2471
|
})();`;
|
|
2418
2472
|
}
|
|
2419
2473
|
function generateWrapEntry(stage1Path, options = {}) {
|
|
@@ -2459,10 +2513,22 @@ function generateWrapEntry(stage1Path, options = {}) {
|
|
|
2459
2513
|
}
|
|
2460
2514
|
// --- End preview mode preflight ---
|
|
2461
2515
|
` : "";
|
|
2516
|
+
const platform = options.platform ?? "browser";
|
|
2517
|
+
const envBlock = platform === "browser" ? `
|
|
2518
|
+
if (config.sources) {
|
|
2519
|
+
for (const key of Object.keys(config.sources)) {
|
|
2520
|
+
const source = config.sources[key];
|
|
2521
|
+
if (!source) continue;
|
|
2522
|
+
const env = source.env ?? (source.env = {});
|
|
2523
|
+
env.window = env.window ?? (typeof window !== 'undefined' ? window : undefined);
|
|
2524
|
+
env.document = env.document ?? (typeof document !== 'undefined' ? document : undefined);
|
|
2525
|
+
}
|
|
2526
|
+
}` : "";
|
|
2462
2527
|
return `import { startFlow, wireConfig, __configData } from '${stage1Path}';
|
|
2463
2528
|
|
|
2464
2529
|
(async () => {${preflightBlock}
|
|
2465
|
-
const
|
|
2530
|
+
const config = wireConfig(__configData);${envBlock}
|
|
2531
|
+
const { collector, elb } = await startFlow(config);${assignmentCode}
|
|
2466
2532
|
})();`;
|
|
2467
2533
|
}
|
|
2468
2534
|
function generateWrapEntryServer(stage1Path) {
|
|
@@ -2568,6 +2634,55 @@ var init_bundler = __esm({
|
|
|
2568
2634
|
}
|
|
2569
2635
|
});
|
|
2570
2636
|
|
|
2637
|
+
// src/commands/bundle/targets.ts
|
|
2638
|
+
function resolveTarget(target) {
|
|
2639
|
+
const preset = BUNDLE_TARGETS[target];
|
|
2640
|
+
if (!preset) {
|
|
2641
|
+
throw new Error(
|
|
2642
|
+
`Unknown target: ${target}. Valid: ${Object.keys(BUNDLE_TARGETS).join(", ")}`
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
return preset;
|
|
2646
|
+
}
|
|
2647
|
+
var BUNDLE_TARGETS;
|
|
2648
|
+
var init_targets = __esm({
|
|
2649
|
+
"src/commands/bundle/targets.ts"() {
|
|
2650
|
+
"use strict";
|
|
2651
|
+
BUNDLE_TARGETS = Object.freeze({
|
|
2652
|
+
cdn: Object.freeze({
|
|
2653
|
+
skipWrapper: false,
|
|
2654
|
+
withDev: false,
|
|
2655
|
+
platform: "browser",
|
|
2656
|
+
injectEnv: true
|
|
2657
|
+
}),
|
|
2658
|
+
"cdn-skeleton": Object.freeze({
|
|
2659
|
+
skipWrapper: true,
|
|
2660
|
+
withDev: false,
|
|
2661
|
+
platform: "browser",
|
|
2662
|
+
injectEnv: false
|
|
2663
|
+
}),
|
|
2664
|
+
runner: Object.freeze({
|
|
2665
|
+
skipWrapper: true,
|
|
2666
|
+
withDev: false,
|
|
2667
|
+
platform: "node",
|
|
2668
|
+
injectEnv: false
|
|
2669
|
+
}),
|
|
2670
|
+
simulate: Object.freeze({
|
|
2671
|
+
skipWrapper: true,
|
|
2672
|
+
withDev: true,
|
|
2673
|
+
platform: "node",
|
|
2674
|
+
injectEnv: false
|
|
2675
|
+
}),
|
|
2676
|
+
push: Object.freeze({
|
|
2677
|
+
skipWrapper: true,
|
|
2678
|
+
withDev: true,
|
|
2679
|
+
platform: "node",
|
|
2680
|
+
injectEnv: false
|
|
2681
|
+
})
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
});
|
|
2685
|
+
|
|
2571
2686
|
// src/commands/bundle/upload.ts
|
|
2572
2687
|
import fs10 from "fs-extra";
|
|
2573
2688
|
function sanitizeUrl(url) {
|
|
@@ -2640,7 +2755,8 @@ function createApiClient() {
|
|
|
2640
2755
|
baseUrl: resolveAppUrl(),
|
|
2641
2756
|
headers: {
|
|
2642
2757
|
Authorization: `Bearer ${token}`,
|
|
2643
|
-
"Content-Type": "application/json"
|
|
2758
|
+
"Content-Type": "application/json",
|
|
2759
|
+
...clientContextHeaders()
|
|
2644
2760
|
}
|
|
2645
2761
|
});
|
|
2646
2762
|
}
|
|
@@ -2649,6 +2765,7 @@ var init_api_client = __esm({
|
|
|
2649
2765
|
"use strict";
|
|
2650
2766
|
init_auth();
|
|
2651
2767
|
init_config_file();
|
|
2768
|
+
init_client_context();
|
|
2652
2769
|
}
|
|
2653
2770
|
});
|
|
2654
2771
|
|
|
@@ -2868,6 +2985,20 @@ Build Summary: ${successCount}/${results.length} succeeded`
|
|
|
2868
2985
|
}
|
|
2869
2986
|
}
|
|
2870
2987
|
async function bundle(configOrPath, options = {}) {
|
|
2988
|
+
let effectiveTarget;
|
|
2989
|
+
if (options.target) {
|
|
2990
|
+
effectiveTarget = options.target;
|
|
2991
|
+
} else if (options.buildOverrides?.skipWrapper === true) {
|
|
2992
|
+
effectiveTarget = "simulate";
|
|
2993
|
+
} else {
|
|
2994
|
+
effectiveTarget = "cdn";
|
|
2995
|
+
}
|
|
2996
|
+
const preset = resolveTarget(effectiveTarget);
|
|
2997
|
+
if (options.buildOverrides?.skipWrapper !== void 0 && !options.target && process.env.WALKEROS_SUPPRESS_DEPRECATIONS !== "1") {
|
|
2998
|
+
console.warn(
|
|
2999
|
+
"[@walkeros/cli] buildOverrides.skipWrapper is deprecated. Pass `target: 'cdn' | 'cdn-skeleton' | 'runner' | 'simulate' | 'push'` instead. Set WALKEROS_SUPPRESS_DEPRECATIONS=1 to silence this warning."
|
|
3000
|
+
);
|
|
3001
|
+
}
|
|
2871
3002
|
let rawConfig;
|
|
2872
3003
|
let configPath = path12.resolve(process.cwd(), "walkeros.config.json");
|
|
2873
3004
|
if (typeof configOrPath === "string") {
|
|
@@ -2876,10 +3007,15 @@ async function bundle(configOrPath, options = {}) {
|
|
|
2876
3007
|
} else {
|
|
2877
3008
|
rawConfig = configOrPath;
|
|
2878
3009
|
}
|
|
3010
|
+
const mergedOverrides = {
|
|
3011
|
+
...options.buildOverrides ?? {},
|
|
3012
|
+
skipWrapper: preset.skipWrapper,
|
|
3013
|
+
withDev: preset.withDev
|
|
3014
|
+
};
|
|
2879
3015
|
const { flowSettings, buildOptions } = loadBundleConfig(rawConfig, {
|
|
2880
3016
|
configPath,
|
|
2881
3017
|
flowName: options.flowName,
|
|
2882
|
-
buildOverrides:
|
|
3018
|
+
buildOverrides: mergedOverrides
|
|
2883
3019
|
});
|
|
2884
3020
|
if (options.cache !== void 0) {
|
|
2885
3021
|
buildOptions.cache = options.cache;
|
|
@@ -2918,6 +3054,7 @@ var init_bundle = __esm({
|
|
|
2918
3054
|
init_config();
|
|
2919
3055
|
init_utils();
|
|
2920
3056
|
init_bundler();
|
|
3057
|
+
init_targets();
|
|
2921
3058
|
init_upload();
|
|
2922
3059
|
init_stats();
|
|
2923
3060
|
init_api_client();
|
|
@@ -4645,7 +4782,7 @@ import { resolve as resolve2, dirname as dirname2 } from "path";
|
|
|
4645
4782
|
// src/runtime/load-bundle.ts
|
|
4646
4783
|
import { resolve } from "path";
|
|
4647
4784
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
4648
|
-
async function loadBundle(file,
|
|
4785
|
+
async function loadBundle(file, context2, logger) {
|
|
4649
4786
|
const absolutePath = resolve(file);
|
|
4650
4787
|
const fileUrl = pathToFileURL2(absolutePath).href;
|
|
4651
4788
|
logger?.debug?.(`Importing bundle: ${absolutePath}`);
|
|
@@ -4656,7 +4793,7 @@ async function loadBundle(file, context, logger) {
|
|
|
4656
4793
|
);
|
|
4657
4794
|
}
|
|
4658
4795
|
logger?.debug?.("Calling factory function...");
|
|
4659
|
-
const result = await module.default(
|
|
4796
|
+
const result = await module.default(context2 ?? {});
|
|
4660
4797
|
if (!result || !result.collector || typeof result.collector.push !== "function") {
|
|
4661
4798
|
throw new Error(
|
|
4662
4799
|
`Invalid bundle: factory must return { collector } with a push function`
|
|
@@ -5652,7 +5789,7 @@ function buildConnectionGraph(config) {
|
|
|
5652
5789
|
return connections;
|
|
5653
5790
|
}
|
|
5654
5791
|
function checkCompatibility(conn, errors, warnings) {
|
|
5655
|
-
const fromOuts = Object.entries(conn.from.examples).filter(([, ex]) => ex.out !== void 0 && ex.out
|
|
5792
|
+
const fromOuts = Object.entries(conn.from.examples).filter(([, ex]) => ex.out !== void 0 && ex.out.length > 0).map(([name, ex]) => ({ name, value: ex.out }));
|
|
5656
5793
|
const toIns = Object.entries(conn.to.examples).filter(([, ex]) => ex.in !== void 0).map(([name, ex]) => ({ name, value: ex.in }));
|
|
5657
5794
|
const path19 = `${conn.from.type}.${conn.from.name} \u2192 ${conn.to.type}.${conn.to.name}`;
|
|
5658
5795
|
if (fromOuts.length === 0 || toIns.length === 0) {
|
|
@@ -6125,6 +6262,63 @@ async function logoutCommand(options) {
|
|
|
6125
6262
|
|
|
6126
6263
|
// src/commands/auth/index.ts
|
|
6127
6264
|
init_api_client();
|
|
6265
|
+
|
|
6266
|
+
// src/core/api-error.ts
|
|
6267
|
+
var ApiError = class extends Error {
|
|
6268
|
+
code;
|
|
6269
|
+
details;
|
|
6270
|
+
// Populated only for CLIENT_OUTDATED responses (HTTP 426).
|
|
6271
|
+
minVersion;
|
|
6272
|
+
clientVersion;
|
|
6273
|
+
client;
|
|
6274
|
+
upgrade;
|
|
6275
|
+
docs;
|
|
6276
|
+
constructor(message, options) {
|
|
6277
|
+
super(message);
|
|
6278
|
+
this.name = "ApiError";
|
|
6279
|
+
this.code = options?.code;
|
|
6280
|
+
this.details = options?.details;
|
|
6281
|
+
this.minVersion = options?.minVersion;
|
|
6282
|
+
this.clientVersion = options?.clientVersion;
|
|
6283
|
+
this.client = options?.client;
|
|
6284
|
+
this.upgrade = options?.upgrade;
|
|
6285
|
+
this.docs = options?.docs;
|
|
6286
|
+
}
|
|
6287
|
+
};
|
|
6288
|
+
function throwApiError(error, fallbackMessage) {
|
|
6289
|
+
if (error && typeof error === "object" && "error" in error && typeof error.error === "object") {
|
|
6290
|
+
const inner = error.error;
|
|
6291
|
+
const message = inner.message || fallbackMessage;
|
|
6292
|
+
const code = inner.code;
|
|
6293
|
+
const details = inner.details?.errors;
|
|
6294
|
+
const options = { code, details };
|
|
6295
|
+
if (code === "CLIENT_OUTDATED") {
|
|
6296
|
+
options.minVersion = inner.minVersion;
|
|
6297
|
+
options.clientVersion = inner.clientVersion;
|
|
6298
|
+
options.client = inner.client;
|
|
6299
|
+
options.upgrade = inner.upgrade;
|
|
6300
|
+
options.docs = inner.docs;
|
|
6301
|
+
}
|
|
6302
|
+
throw new ApiError(message, options);
|
|
6303
|
+
}
|
|
6304
|
+
throw new ApiError(fallbackMessage);
|
|
6305
|
+
}
|
|
6306
|
+
function handleCliError(err) {
|
|
6307
|
+
if (err instanceof ApiError && err.code === "CLIENT_OUTDATED") {
|
|
6308
|
+
console.error(`
|
|
6309
|
+
${err.message}
|
|
6310
|
+
`);
|
|
6311
|
+
if (err.upgrade) console.error(` Upgrade: ${err.upgrade}`);
|
|
6312
|
+
if (err.docs) console.error(` Docs: ${err.docs}
|
|
6313
|
+
`);
|
|
6314
|
+
process.exit(2);
|
|
6315
|
+
}
|
|
6316
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6317
|
+
console.error(message);
|
|
6318
|
+
process.exit(1);
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6321
|
+
// src/commands/auth/index.ts
|
|
6128
6322
|
init_cli_logger();
|
|
6129
6323
|
init_output();
|
|
6130
6324
|
async function whoami() {
|
|
@@ -6146,15 +6340,13 @@ async function whoamiCommand(options) {
|
|
|
6146
6340
|
if (data.projectId) logger.info(`Project: ${data.projectId}`);
|
|
6147
6341
|
}
|
|
6148
6342
|
} catch (error) {
|
|
6149
|
-
|
|
6150
|
-
process.exit(1);
|
|
6343
|
+
handleCliError(error);
|
|
6151
6344
|
}
|
|
6152
6345
|
}
|
|
6153
6346
|
|
|
6154
6347
|
// src/commands/projects/index.ts
|
|
6155
6348
|
init_api_client();
|
|
6156
6349
|
init_auth();
|
|
6157
|
-
init_cli_logger();
|
|
6158
6350
|
init_output();
|
|
6159
6351
|
async function listProjects() {
|
|
6160
6352
|
const client = createApiClient();
|
|
@@ -6202,13 +6394,11 @@ async function deleteProject(options = {}) {
|
|
|
6202
6394
|
return data ?? { success: true };
|
|
6203
6395
|
}
|
|
6204
6396
|
async function handleResult(fn, options) {
|
|
6205
|
-
const logger = createCLILogger(options);
|
|
6206
6397
|
try {
|
|
6207
6398
|
const result = await fn();
|
|
6208
6399
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
6209
6400
|
} catch (error) {
|
|
6210
|
-
|
|
6211
|
-
process.exit(1);
|
|
6401
|
+
handleCliError(error);
|
|
6212
6402
|
}
|
|
6213
6403
|
}
|
|
6214
6404
|
async function listProjectsCommand(options) {
|
|
@@ -6245,32 +6435,7 @@ async function deleteProjectCommand(projectId, options) {
|
|
|
6245
6435
|
|
|
6246
6436
|
// src/commands/flows/index.ts
|
|
6247
6437
|
init_api_client();
|
|
6248
|
-
|
|
6249
|
-
// src/core/api-error.ts
|
|
6250
|
-
var ApiError = class extends Error {
|
|
6251
|
-
code;
|
|
6252
|
-
details;
|
|
6253
|
-
constructor(message, options) {
|
|
6254
|
-
super(message);
|
|
6255
|
-
this.name = "ApiError";
|
|
6256
|
-
this.code = options?.code;
|
|
6257
|
-
this.details = options?.details;
|
|
6258
|
-
}
|
|
6259
|
-
};
|
|
6260
|
-
function throwApiError(error, fallbackMessage) {
|
|
6261
|
-
if (error && typeof error === "object" && "error" in error && typeof error.error === "object") {
|
|
6262
|
-
const inner = error.error;
|
|
6263
|
-
const message = inner.message || fallbackMessage;
|
|
6264
|
-
const code = inner.code;
|
|
6265
|
-
const details = inner.details?.errors;
|
|
6266
|
-
throw new ApiError(message, { code, details });
|
|
6267
|
-
}
|
|
6268
|
-
throw new ApiError(fallbackMessage);
|
|
6269
|
-
}
|
|
6270
|
-
|
|
6271
|
-
// src/commands/flows/index.ts
|
|
6272
6438
|
init_auth();
|
|
6273
|
-
init_cli_logger();
|
|
6274
6439
|
init_output();
|
|
6275
6440
|
init_stdin();
|
|
6276
6441
|
async function listFlows(options = {}) {
|
|
@@ -6361,13 +6526,11 @@ async function duplicateFlow(options) {
|
|
|
6361
6526
|
return data;
|
|
6362
6527
|
}
|
|
6363
6528
|
async function handleResult2(fn, options) {
|
|
6364
|
-
const logger = createCLILogger(options);
|
|
6365
6529
|
try {
|
|
6366
6530
|
const result = await fn();
|
|
6367
6531
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
6368
6532
|
} catch (error) {
|
|
6369
|
-
|
|
6370
|
-
process.exit(1);
|
|
6533
|
+
handleCliError(error);
|
|
6371
6534
|
}
|
|
6372
6535
|
}
|
|
6373
6536
|
async function listFlowsCommand(options) {
|
|
@@ -6635,8 +6798,7 @@ async function deployCommand(flowId, options) {
|
|
|
6635
6798
|
log.info(`Status: ${r2.status}`);
|
|
6636
6799
|
}
|
|
6637
6800
|
} catch (err) {
|
|
6638
|
-
|
|
6639
|
-
process.exit(1);
|
|
6801
|
+
handleCliError(err);
|
|
6640
6802
|
}
|
|
6641
6803
|
}
|
|
6642
6804
|
async function getDeploymentCommand(flowId, options) {
|
|
@@ -6663,8 +6825,7 @@ async function getDeploymentCommand(flowId, options) {
|
|
|
6663
6825
|
if (r2.publicUrl) log.info(`URL: ${r2.publicUrl}`);
|
|
6664
6826
|
if (r2.errorMessage) log.error(`Error: ${r2.errorMessage}`);
|
|
6665
6827
|
} catch (err) {
|
|
6666
|
-
|
|
6667
|
-
process.exit(1);
|
|
6828
|
+
handleCliError(err);
|
|
6668
6829
|
}
|
|
6669
6830
|
}
|
|
6670
6831
|
|
|
@@ -6728,13 +6889,11 @@ async function deleteDeployment(options) {
|
|
|
6728
6889
|
return data ?? { success: true };
|
|
6729
6890
|
}
|
|
6730
6891
|
async function handleResult3(fn, options) {
|
|
6731
|
-
const logger = createCLILogger(options);
|
|
6732
6892
|
try {
|
|
6733
6893
|
const result = await fn();
|
|
6734
6894
|
await writeResult(JSON.stringify(result, null, 2), options);
|
|
6735
6895
|
} catch (error) {
|
|
6736
|
-
|
|
6737
|
-
process.exit(1);
|
|
6896
|
+
handleCliError(error);
|
|
6738
6897
|
}
|
|
6739
6898
|
}
|
|
6740
6899
|
async function listDeploymentsCommand(options) {
|
|
@@ -6836,18 +6995,15 @@ async function createDeployCommand(config, options) {
|
|
|
6836
6995
|
log.info(" -e WALKEROS_APP_URL=https://app.walkeros.io \\");
|
|
6837
6996
|
log.info(" walkeros/flow:latest");
|
|
6838
6997
|
} catch (err) {
|
|
6839
|
-
|
|
6840
|
-
err instanceof Error ? err.message : "Failed to create deployment"
|
|
6841
|
-
);
|
|
6842
|
-
process.exit(1);
|
|
6998
|
+
handleCliError(err);
|
|
6843
6999
|
}
|
|
6844
7000
|
}
|
|
6845
7001
|
|
|
6846
7002
|
// src/commands/feedback/index.ts
|
|
6847
7003
|
init_config_file();
|
|
6848
7004
|
init_http();
|
|
6849
|
-
init_cli_logger();
|
|
6850
7005
|
import { createInterface } from "readline";
|
|
7006
|
+
init_cli_logger();
|
|
6851
7007
|
async function feedback(text, options) {
|
|
6852
7008
|
const config = readConfig();
|
|
6853
7009
|
const anonymous = options?.anonymous ?? config?.anonymousFeedback ?? true;
|
|
@@ -6900,8 +7056,7 @@ async function feedbackCommand(text) {
|
|
|
6900
7056
|
await feedback(text, { anonymous });
|
|
6901
7057
|
logger.info("Feedback sent. Thanks!");
|
|
6902
7058
|
} catch (error) {
|
|
6903
|
-
|
|
6904
|
-
process.exit(1);
|
|
7059
|
+
handleCliError(error);
|
|
6905
7060
|
}
|
|
6906
7061
|
}
|
|
6907
7062
|
function promptUser(question) {
|
|
@@ -6955,7 +7110,8 @@ async function wrapSkeleton(options) {
|
|
|
6955
7110
|
...windowCollector ? { windowCollector } : {},
|
|
6956
7111
|
...windowElb ? { windowElb } : {},
|
|
6957
7112
|
...options.previewOrigin ? { previewOrigin: options.previewOrigin } : {},
|
|
6958
|
-
...options.previewScope ? { previewScope: options.previewScope } : {}
|
|
7113
|
+
...options.previewScope ? { previewScope: options.previewScope } : {},
|
|
7114
|
+
platform
|
|
6959
7115
|
}) : generateWrapEntryServer(absoluteSkeletonPath);
|
|
6960
7116
|
const entryDir = await fs17.mkdtemp(path18.join(os2.tmpdir(), "walkeros-wrap-"));
|
|
6961
7117
|
const entryPath = path18.join(entryDir, "entry.mjs");
|
|
@@ -7003,6 +7159,7 @@ async function wrapSkeleton(options) {
|
|
|
7003
7159
|
init_auth();
|
|
7004
7160
|
init_http();
|
|
7005
7161
|
init_api_client();
|
|
7162
|
+
init_client_context();
|
|
7006
7163
|
init_config_file();
|
|
7007
7164
|
init_sse();
|
|
7008
7165
|
init_utils();
|
|
@@ -7114,6 +7271,7 @@ export {
|
|
|
7114
7271
|
bundle,
|
|
7115
7272
|
bundleCommand,
|
|
7116
7273
|
bundleRemote,
|
|
7274
|
+
clientContextHeaders,
|
|
7117
7275
|
compareOutput,
|
|
7118
7276
|
createApiClient,
|
|
7119
7277
|
createDeployCommand,
|
|
@@ -7138,6 +7296,7 @@ export {
|
|
|
7138
7296
|
feedbackCommand,
|
|
7139
7297
|
findExample,
|
|
7140
7298
|
getAuthHeaders,
|
|
7299
|
+
getClientContext,
|
|
7141
7300
|
getDeployment,
|
|
7142
7301
|
getDeploymentBySlug,
|
|
7143
7302
|
getDeploymentBySlugCommand,
|
|
@@ -7164,8 +7323,10 @@ export {
|
|
|
7164
7323
|
pushCommand,
|
|
7165
7324
|
readConfig,
|
|
7166
7325
|
requireProjectId,
|
|
7326
|
+
resetClientContext,
|
|
7167
7327
|
run,
|
|
7168
7328
|
runCommand,
|
|
7329
|
+
setClientContext,
|
|
7169
7330
|
simulateDestination,
|
|
7170
7331
|
simulateSource,
|
|
7171
7332
|
simulateTransformer,
|