@walkeros/cli 3.4.0 → 3.4.1-next-1776790594143

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.ts CHANGED
@@ -5197,6 +5197,31 @@ declare function resetClientContext(): void;
5197
5197
  */
5198
5198
  declare function clientContextHeaders(): Record<string, string>;
5199
5199
 
5200
+ interface ListPreviewsOptions {
5201
+ projectId?: string;
5202
+ flowId: string;
5203
+ }
5204
+ declare function listPreviews(options: ListPreviewsOptions): Promise<any>;
5205
+ interface GetPreviewOptions {
5206
+ projectId?: string;
5207
+ flowId: string;
5208
+ previewId: string;
5209
+ }
5210
+ declare function getPreview(options: GetPreviewOptions): Promise<any>;
5211
+ interface CreatePreviewOptions {
5212
+ projectId?: string;
5213
+ flowId: string;
5214
+ flowName?: string;
5215
+ flowSettingsId?: string;
5216
+ }
5217
+ declare function createPreview(options: CreatePreviewOptions): Promise<any>;
5218
+ interface DeletePreviewOptions {
5219
+ projectId?: string;
5220
+ flowId: string;
5221
+ previewId: string;
5222
+ }
5223
+ declare function deletePreview(options: DeletePreviewOptions): Promise<any>;
5224
+
5200
5225
  interface WalkerOSConfig {
5201
5226
  token: string;
5202
5227
  email: string;
@@ -5358,4 +5383,4 @@ interface PreparedFlow {
5358
5383
  cleanup: () => Promise<void>;
5359
5384
  }
5360
5385
 
5361
- export { ApiError, type ApiErrorDetail, type BuildOptions, type BundleStats, type CLIBuildOptions, type ClientContext, type ClientType, type DeployOptions, type ExampleLookupResult, type FeedbackOptions, type GlobalOptions, type ListDeploymentsOptions, type ListFlowsOptions, type MinifyOptions, type PrepareInput, type PreparedFlow, type PushResult, type RunCommandOptions, type RunOptions, type RunResult, type SSEEvent, type SSEParseResult, type SimulateDestinationOptions, type SimulateSourceOptions, type SimulateTransformerOptions, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, type WalkerOSConfig, type WrapSkeletonOptions, apiFetch, bundle, bundleCommand, bundleRemote, clientContextHeaders, compareOutput, createApiClient, createDeployCommand, createDeployment, createDeploymentCommand, createFlow, createFlowCommand, createProject, createProjectCommand, deleteDeployment, deleteDeploymentCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, deploy, deployCommand, deployFetch, duplicateFlow, duplicateFlowCommand, feedback, feedbackCommand, findExample, getAuthHeaders, getClientContext, getDeployment, getDeploymentBySlug, getDeploymentBySlugCommand, getDeploymentCommand, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listDeployments, listDeploymentsCommand, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loadConfig, loadJsonConfig, loginCommand, logoutCommand, mergeAuthHeaders, parseSSEEvents, publicFetch, push, pushCommand, readConfig, requireProjectId, resetClientContext, run, runCommand, setClientContext, simulateDestination, simulateSource, simulateTransformer, throwApiError, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand, wrapSkeleton, writeConfig };
5386
+ export { ApiError, type ApiErrorDetail, type BuildOptions, type BundleStats, type CLIBuildOptions, type ClientContext, type ClientType, type CreatePreviewOptions, type DeletePreviewOptions, type DeployOptions, type ExampleLookupResult, type FeedbackOptions, type GetPreviewOptions, type GlobalOptions, type ListDeploymentsOptions, type ListFlowsOptions, type ListPreviewsOptions, type MinifyOptions, type PrepareInput, type PreparedFlow, type PushResult, type RunCommandOptions, type RunOptions, type RunResult, type SSEEvent, type SSEParseResult, type SimulateDestinationOptions, type SimulateSourceOptions, type SimulateTransformerOptions, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, type WalkerOSConfig, type WrapSkeletonOptions, apiFetch, bundle, bundleCommand, bundleRemote, clientContextHeaders, compareOutput, createApiClient, createDeployCommand, createDeployment, createDeploymentCommand, createFlow, createFlowCommand, createPreview, createProject, createProjectCommand, deleteDeployment, deleteDeploymentCommand, deleteFlow, deleteFlowCommand, deletePreview, deleteProject, deleteProjectCommand, deploy, deployCommand, deployFetch, duplicateFlow, duplicateFlowCommand, feedback, feedbackCommand, findExample, getAuthHeaders, getClientContext, getDeployment, getDeploymentBySlug, getDeploymentBySlugCommand, getDeploymentCommand, getFlow, getFlowCommand, getPreview, getProject, getProjectCommand, getToken, listDeployments, listDeploymentsCommand, listFlows, listFlowsCommand, listPreviews, listProjects, listProjectsCommand, loadConfig, loadJsonConfig, loginCommand, logoutCommand, mergeAuthHeaders, parseSSEEvents, publicFetch, push, pushCommand, readConfig, requireProjectId, resetClientContext, run, runCommand, setClientContext, simulateDestination, simulateSource, simulateTransformer, throwApiError, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand, wrapSkeleton, writeConfig };
package/dist/index.js CHANGED
@@ -2505,10 +2505,34 @@ function generateWrapEntry(stage1Path, options = {}) {
2505
2505
  var __match = /(?:^|; )elbPreview=([^;]+)/.exec(document.cookie);
2506
2506
  var __token = __match && __match[1];
2507
2507
  if (__token && /^[a-zA-Z0-9_-]{8,32}$/.test(__token)) {
2508
- var __s = document.createElement('script');
2509
- __s.src = 'https://' + __previewOrigin + '/preview/' + __previewScope + '/walker.' + __token + '.js';
2510
- document.head.appendChild(__s);
2511
- return;
2508
+ var __previewSrc = 'https://' + __previewOrigin + '/preview/' + __previewScope + '/walker.' + __token + '.js';
2509
+ var __clearPreviewCookie = function () {
2510
+ document.cookie = 'elbPreview=; path=/; max-age=0; SameSite=Lax' + __secure;
2511
+ };
2512
+ try {
2513
+ // Bound the HEAD probe so a hung CDN can never block the production
2514
+ // walker. On abort/timeout we fall through to the catch branch and
2515
+ // self-heal by clearing the cookie.
2516
+ var __ctrl = typeof AbortController !== 'undefined' ? new AbortController() : null;
2517
+ var __timeoutId = __ctrl ? setTimeout(function () { __ctrl.abort(); }, 2000) : null;
2518
+ var __probe = await fetch(__previewSrc, {
2519
+ method: 'HEAD',
2520
+ signal: __ctrl ? __ctrl.signal : undefined,
2521
+ });
2522
+ if (__timeoutId) clearTimeout(__timeoutId);
2523
+ if (__probe && __probe.ok) {
2524
+ var __s = document.createElement('script');
2525
+ __s.src = __previewSrc;
2526
+ document.head.appendChild(__s);
2527
+ return;
2528
+ }
2529
+ // Preview bundle missing (404/5xx) \u2014 self-heal by clearing cookie and
2530
+ // falling through to the production walker in this same bundle.
2531
+ __clearPreviewCookie();
2532
+ } catch (__err) {
2533
+ // Network error, timeout, or abort \u2014 fall through to production too.
2534
+ __clearPreviewCookie();
2535
+ }
2512
2536
  }
2513
2537
  }
2514
2538
  // --- End preview mode preflight ---
@@ -3213,7 +3237,7 @@ async function ne(e, n, t) {
3213
3237
  if (n.init && !n.config.init) {
3214
3238
  const o2 = n.type || "unknown", s = e.logger.scope(`transformer:${o2}`), r2 = { collector: e, logger: s, id: t, ingest: N(t), config: n.config, env: se(n.config.env) };
3215
3239
  s.debug("init");
3216
- const i2 = await F(n.init, "TransformerInit", e.hooks)(r2);
3240
+ const i2 = await F(n.init, "TransformerInit", e.hooks, e.logger)(r2);
3217
3241
  if (false === i2) return false;
3218
3242
  n.config = { ...i2 || n.config, env: i2?.env || n.config.env, init: true }, s.debug("init done");
3219
3243
  }
@@ -3222,7 +3246,7 @@ async function ne(e, n, t) {
3222
3246
  async function te(e, n, t, o2, s, r2) {
3223
3247
  const i2 = n.type || "unknown", a2 = e.logger.scope(`transformer:${i2}`), c2 = { collector: e, logger: a2, id: t, ingest: s, config: n.config, env: { ...se(n.config.env), ...r2 ? { respond: r2 } : {} } };
3224
3248
  a2.debug("push", { event: o2.name });
3225
- const u2 = await F(n.push, "TransformerPush", e.hooks)(o2, c2);
3249
+ const u2 = await F(n.push, "TransformerPush", e.hooks, e.logger)(o2, c2);
3226
3250
  return a2.debug("push done"), u2;
3227
3251
  }
3228
3252
  async function oe(e, n, t, o2, s, r2, i2) {
@@ -7160,6 +7184,78 @@ init_auth();
7160
7184
  init_http();
7161
7185
  init_api_client();
7162
7186
  init_client_context();
7187
+
7188
+ // src/commands/previews/index.ts
7189
+ init_auth();
7190
+ init_http();
7191
+ async function listPreviews(options) {
7192
+ const pid = options.projectId ?? requireProjectId();
7193
+ const response = await apiFetch(
7194
+ `/api/projects/${pid}/flows/${options.flowId}/previews`
7195
+ );
7196
+ if (!response.ok) {
7197
+ const body = await response.json().catch(() => ({}));
7198
+ throwApiError(body, "Failed to list previews");
7199
+ }
7200
+ return response.json();
7201
+ }
7202
+ async function getPreview(options) {
7203
+ const pid = options.projectId ?? requireProjectId();
7204
+ const response = await apiFetch(
7205
+ `/api/projects/${pid}/flows/${options.flowId}/previews/${options.previewId}`
7206
+ );
7207
+ if (!response.ok) {
7208
+ const body = await response.json().catch(() => ({}));
7209
+ throwApiError(body, "Failed to get preview");
7210
+ }
7211
+ return response.json();
7212
+ }
7213
+ async function createPreview(options) {
7214
+ const pid = options.projectId ?? requireProjectId();
7215
+ let settingsId = options.flowSettingsId;
7216
+ if (!settingsId) {
7217
+ if (!options.flowName) {
7218
+ throw new Error("Either flowName or flowSettingsId is required");
7219
+ }
7220
+ const flow = await getFlow({ projectId: pid, flowId: options.flowId });
7221
+ const settings = flow.settings;
7222
+ const match = settings?.find((s) => s.name === options.flowName);
7223
+ if (!match) {
7224
+ throw new Error(
7225
+ `Flow settings named "${options.flowName}" not found on flow ${options.flowId}`
7226
+ );
7227
+ }
7228
+ settingsId = match.id;
7229
+ }
7230
+ const response = await apiFetch(
7231
+ `/api/projects/${pid}/flows/${options.flowId}/previews`,
7232
+ {
7233
+ method: "POST",
7234
+ headers: { "Content-Type": "application/json" },
7235
+ body: JSON.stringify({ flowSettingsId: settingsId })
7236
+ }
7237
+ );
7238
+ if (!response.ok) {
7239
+ const body = await response.json().catch(() => ({}));
7240
+ throwApiError(body, "Failed to create preview");
7241
+ }
7242
+ return response.json();
7243
+ }
7244
+ async function deletePreview(options) {
7245
+ const pid = options.projectId ?? requireProjectId();
7246
+ const response = await apiFetch(
7247
+ `/api/projects/${pid}/flows/${options.flowId}/previews/${options.previewId}`,
7248
+ { method: "DELETE" }
7249
+ );
7250
+ if (!response.ok) {
7251
+ const body = await response.json().catch(() => ({}));
7252
+ throwApiError(body, "Failed to delete preview");
7253
+ }
7254
+ if (response.status === 204) return null;
7255
+ return response.json().catch(() => null);
7256
+ }
7257
+
7258
+ // src/index.ts
7163
7259
  init_config_file();
7164
7260
  init_sse();
7165
7261
  init_utils();
@@ -7279,12 +7375,14 @@ export {
7279
7375
  createDeploymentCommand,
7280
7376
  createFlow,
7281
7377
  createFlowCommand,
7378
+ createPreview,
7282
7379
  createProject,
7283
7380
  createProjectCommand,
7284
7381
  deleteDeployment,
7285
7382
  deleteDeploymentCommand,
7286
7383
  deleteFlow,
7287
7384
  deleteFlowCommand,
7385
+ deletePreview,
7288
7386
  deleteProject,
7289
7387
  deleteProjectCommand,
7290
7388
  deploy,
@@ -7303,6 +7401,7 @@ export {
7303
7401
  getDeploymentCommand,
7304
7402
  getFlow,
7305
7403
  getFlowCommand,
7404
+ getPreview,
7306
7405
  getProject,
7307
7406
  getProjectCommand,
7308
7407
  getToken,
@@ -7310,6 +7409,7 @@ export {
7310
7409
  listDeploymentsCommand,
7311
7410
  listFlows,
7312
7411
  listFlowsCommand,
7412
+ listPreviews,
7313
7413
  listProjects,
7314
7414
  listProjectsCommand,
7315
7415
  loadConfig,