@sanity/workflow-cli 0.8.0 → 0.9.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.
Files changed (60) hide show
  1. package/README.md +99 -61
  2. package/dist/commands/abort.d.ts +5 -7
  3. package/dist/commands/abort.js +15 -14
  4. package/dist/commands/definition/delete.d.ts +10 -6
  5. package/dist/commands/definition/delete.js +8 -11
  6. package/dist/commands/definition/diff.d.ts +8 -1
  7. package/dist/commands/definition/diff.js +30 -24
  8. package/dist/commands/definition/list.d.ts +4 -4
  9. package/dist/commands/definition/list.js +8 -8
  10. package/dist/commands/definition/show.d.ts +0 -10
  11. package/dist/commands/definition/show.js +11 -20
  12. package/dist/commands/deploy.d.ts +58 -5
  13. package/dist/commands/deploy.js +134 -27
  14. package/dist/commands/diagnose.d.ts +5 -1
  15. package/dist/commands/diagnose.js +18 -28
  16. package/dist/commands/fire-action.d.ts +15 -28
  17. package/dist/commands/fire-action.js +37 -72
  18. package/dist/commands/list.d.ts +2 -2
  19. package/dist/commands/list.js +8 -8
  20. package/dist/commands/{retry-activity.d.ts → reset-activity.d.ts} +1 -1
  21. package/dist/commands/{retry-activity.js → reset-activity.js} +2 -2
  22. package/dist/commands/set-stage.d.ts +27 -3
  23. package/dist/commands/set-stage.js +80 -13
  24. package/dist/commands/show.d.ts +1 -0
  25. package/dist/commands/show.js +14 -8
  26. package/dist/commands/start.d.ts +59 -0
  27. package/dist/commands/start.js +169 -0
  28. package/dist/commands/tail.d.ts +3 -0
  29. package/dist/commands/tail.js +9 -5
  30. package/dist/lib/client.d.ts +11 -14
  31. package/dist/lib/client.js +45 -33
  32. package/dist/lib/context.d.ts +62 -0
  33. package/dist/lib/context.js +82 -0
  34. package/dist/lib/definitions.d.ts +38 -29
  35. package/dist/lib/definitions.js +45 -85
  36. package/dist/lib/diff.js +8 -0
  37. package/dist/lib/env.d.ts +0 -6
  38. package/dist/lib/env.js +3 -9
  39. package/dist/lib/fail.d.ts +6 -0
  40. package/dist/lib/fail.js +11 -1
  41. package/dist/lib/flags.d.ts +14 -2
  42. package/dist/lib/flags.js +24 -3
  43. package/dist/lib/load-config.d.ts +11 -0
  44. package/dist/lib/load-config.js +69 -0
  45. package/dist/lib/operation-args.d.ts +25 -7
  46. package/dist/lib/operation-args.js +12 -11
  47. package/dist/lib/ops-report.d.ts +19 -7
  48. package/dist/lib/ops-report.js +6 -7
  49. package/dist/lib/params.d.ts +7 -0
  50. package/dist/lib/params.js +26 -0
  51. package/dist/lib/select-deployment.d.ts +31 -0
  52. package/dist/lib/select-deployment.js +58 -0
  53. package/dist/lib/ui.d.ts +3 -1
  54. package/dist/lib/ui.js +1 -3
  55. package/oclif.manifest.json +145 -86
  56. package/package.json +6 -4
  57. package/dist/commands/move-stage.d.ts +0 -47
  58. package/dist/commands/move-stage.js +0 -77
  59. package/dist/lib/config.d.ts +0 -18
  60. package/dist/lib/config.js +0 -50
@@ -1,18 +0,0 @@
1
- import type { WorkflowResource } from '@sanity/workflow-engine';
2
- export interface WorkflowConfig {
3
- workflowResource: WorkflowResource;
4
- tag: string;
5
- }
6
- /**
7
- * {@link readWorkflowConfig} but funnel a thrown env-validation error
8
- * through the standard {@link fail} path so commands don't each have to wrap.
9
- */
10
- export declare function loadWorkflowConfig(tagOverride?: string): WorkflowConfig;
11
- /**
12
- * Resolve the `deploy` command's definitions source — a module specifier
13
- * (a path like `./src/workflows.ts`, or a package name) whose
14
- * `allDefinitions` export holds the batch to deploy. Required and with no
15
- * default: the CLI is agnostic about *which* definitions it ships, so an
16
- * unset source is an error rather than a silent fall back to a built-in set.
17
- */
18
- export declare function loadDefinitionsSource(): string;
@@ -1,50 +0,0 @@
1
- import { ENV } from "./env.js";
2
- import { fail, failOnThrow } from "./fail.js";
3
- const VALID_RESOURCE_TYPES = ['dataset', 'canvas', 'media-library', 'dashboard'];
4
- function isResourceType(value) {
5
- return VALID_RESOURCE_TYPES.includes(value);
6
- }
7
- /**
8
- * Resolve the engine's `workflowResource` + tag from env vars (and an
9
- * optional `tagOverride`, e.g. the `--tag` flag).
10
- *
11
- * - `WORKFLOW_RESOURCE_TYPE` — one of "dataset" / "canvas" / "media-library" /
12
- * "dashboard". Defaults to "dataset".
13
- * - `WORKFLOW_RESOURCE_ID` — the resource id (e.g. "test.test" for a
14
- * dataset). Defaults to "test.test".
15
- * - `WORKFLOW_TAG` — the single environment tag (e.g. "prod"). Required;
16
- * `tagOverride` takes precedence when supplied.
17
- */
18
- function readWorkflowConfig(tagOverride) {
19
- const rawType = process.env[ENV.WORKFLOW_RESOURCE_TYPE] ?? 'dataset';
20
- if (!isResourceType(rawType)) {
21
- throw new Error(`WORKFLOW_RESOURCE_TYPE must be one of: ${VALID_RESOURCE_TYPES.join(', ')} (got "${rawType}")`);
22
- }
23
- const id = process.env[ENV.WORKFLOW_RESOURCE_ID] ?? 'test.test';
24
- const tag = (tagOverride ?? process.env[ENV.WORKFLOW_TAG] ?? '').trim();
25
- if (!tag) {
26
- throw new Error('Workflow tag is required - pass --tag or set WORKFLOW_TAG (e.g. prod)');
27
- }
28
- return { workflowResource: { type: rawType, id }, tag };
29
- }
30
- /**
31
- * {@link readWorkflowConfig} but funnel a thrown env-validation error
32
- * through the standard {@link fail} path so commands don't each have to wrap.
33
- */
34
- export function loadWorkflowConfig(tagOverride) {
35
- return failOnThrow('Invalid workflow config:', () => readWorkflowConfig(tagOverride));
36
- }
37
- /**
38
- * Resolve the `deploy` command's definitions source — a module specifier
39
- * (a path like `./src/workflows.ts`, or a package name) whose
40
- * `allDefinitions` export holds the batch to deploy. Required and with no
41
- * default: the CLI is agnostic about *which* definitions it ships, so an
42
- * unset source is an error rather than a silent fall back to a built-in set.
43
- */
44
- export function loadDefinitionsSource() {
45
- const source = process.env[ENV.WORKFLOW_DEFS]?.trim();
46
- if (source === undefined || source === '') {
47
- fail('No definitions source configured.', 'Set WORKFLOW_DEFS to a module that exports `allDefinitions` — a path like ./src/workflows.ts, or a package name.');
48
- }
49
- return source;
50
- }