@sanity/runtime-cli 17.16.0-next.g26925c0 → 17.16.0-next.g76cdca8

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 (29) hide show
  1. package/README.md +19 -19
  2. package/dist/actions/blueprints/assets.d.ts +3 -3
  3. package/dist/actions/blueprints/assets.js +3 -3
  4. package/dist/actions/blueprints/pre-deploy.js +3 -3
  5. package/dist/actions/blueprints/process-assets.js +3 -2
  6. package/dist/config.js +4 -1
  7. package/dist/cores/functions/logs.d.ts +7 -0
  8. package/dist/cores/functions/logs.js +17 -6
  9. package/dist/cores/functions/test.js +15 -4
  10. package/dist/server/app.js +2 -2
  11. package/dist/server/static/vendor/vendor.bundle.js +21 -42
  12. package/dist/utils/blueprints/group-resources.d.ts +2 -1
  13. package/dist/utils/blueprints/group-resources.js +3 -3
  14. package/dist/utils/blueprints/resolve-deployed-resources.d.ts +2 -2
  15. package/dist/utils/blueprints/resolve-deployed-resources.js +4 -4
  16. package/dist/utils/bundles/prepare-asset.d.ts +3 -3
  17. package/dist/utils/bundles/prepare-asset.js +46 -12
  18. package/dist/utils/functions/child-runtime/durable.js +141 -23
  19. package/dist/utils/functions/child-runtime/getBatchResults.js +75 -0
  20. package/dist/utils/functions/child-runtime/step-history.d.ts +15 -0
  21. package/dist/utils/functions/child-runtime/step-history.js +52 -0
  22. package/dist/utils/functions/invoke/local.js +19 -8
  23. package/dist/utils/functions/invoke/resolve-invoke-type.d.ts +2 -2
  24. package/dist/utils/functions/invoke/resolve-invoke-type.js +2 -2
  25. package/dist/utils/functions/transpile/function.js +3 -0
  26. package/dist/utils/types.d.ts +19 -12
  27. package/dist/utils/types.js +1 -1
  28. package/oclif.manifest.json +1 -1
  29. package/package.json +5 -5
@@ -40,6 +40,11 @@ export interface BlueprintResourceRecord extends BlueprintResource {
40
40
  export interface DeployedResource extends BlueprintResourceRecord {
41
41
  externalId: string;
42
42
  }
43
+ /** Wrap a resource and its externalId if it has one. */
44
+ export interface ResolvedResource<R extends BlueprintResource> {
45
+ resource: R;
46
+ externalId?: string;
47
+ }
43
48
  export declare function isLocalFunctionResource(r: BlueprintResource): r is FunctionResource;
44
49
  export declare function hasEventSource(r: FunctionResource): r is EventFunctionResource;
45
50
  export declare function isScheduleEvent(e: unknown): e is BlueprintScheduledFunctionResource['event'];
@@ -134,8 +139,14 @@ export type InvokePayloadMetadata = Pick<InvokeGroqPayloadOptions, 'event' | 'be
134
139
  export type EventType = 'create' | 'update' | 'delete';
135
140
  export type NonGroqEventType = 'plain' | 'nested' | 'durable';
136
141
  export declare function isEventType(arg: string): arg is EventType;
142
+ interface BaseContextOptions {
143
+ /** All resources declared by the blueprint, used to populate `context.resources` at invoke time. */
144
+ resources?: ResolvedResource<BlueprintResource>[];
145
+ /** The directory where the blueprint manifest is located. */
146
+ blueprintFileDir: string;
147
+ }
137
148
  /** @internal */
138
- export interface InvokeGroqContextOptions {
149
+ export interface InvokeGroqContextOptions extends BaseContextOptions {
139
150
  clientOptions: {
140
151
  apiVersion?: string;
141
152
  dataset?: string;
@@ -151,20 +162,12 @@ export interface InvokeGroqContextOptions {
151
162
  functionResourceType: string;
152
163
  /** The resource ID of the function container; resource ID that houses the function. */
153
164
  functionResourceId: string;
154
- /** All resources declared by the blueprint, used to populate `context.resources` at invoke time. */
155
- resources?: BlueprintResource[];
156
- /** The directory where the blueprint manifest is located. */
157
- blueprintFileDir: string;
158
165
  }
159
166
  /** @internal */
160
- export interface InvokeScheduleContextOptions {
167
+ export interface InvokeScheduleContextOptions extends BaseContextOptions {
161
168
  clientOptions: {
162
169
  token?: string;
163
170
  };
164
- /** All resources declared by the blueprint, used to populate `context.resources` at invoke time. */
165
- resources?: BlueprintResource[];
166
- /** The directory where the blueprint manifest is located. */
167
- blueprintFileDir: string;
168
171
  }
169
172
  export type InvokeContextOptions = InvokeGroqContextOptions | InvokeScheduleContextOptions;
170
173
  export declare function isGroqContextOptions(context: InvokeContextOptions): context is InvokeGroqContextOptions;
@@ -338,7 +341,7 @@ export type AssetPrepResult = {
338
341
  error: string;
339
342
  };
340
343
  export type PrepAssetFn<R extends BlueprintResource> = (options: {
341
- resource: R;
344
+ resolvedResource: ResolvedResource<R>;
342
345
  blueprintFileDir: string;
343
346
  installer?: InstallerType;
344
347
  }) => Promise<AssetPrepResult>;
@@ -355,7 +358,7 @@ export type PreDeployConfig = {
355
358
  prepareResource?: PrepResourceFn<BlueprintResource>;
356
359
  };
357
360
  export type AssetResource<R extends BlueprintResource> = {
358
- resource: R;
361
+ resource: ResolvedResource<R>;
359
362
  prepareAsset: PrepAssetFn<R>;
360
363
  };
361
364
  export type Warning = {
@@ -376,6 +379,10 @@ export interface DurableStepEvent {
376
379
  output?: unknown;
377
380
  error?: InvocationError;
378
381
  durationMs?: number;
382
+ retryDelayMs?: number;
383
+ attempt?: number;
384
+ retries?: number;
385
+ maxAttempts?: number;
379
386
  }
380
387
  export interface DurableLogEvent {
381
388
  kind: 'log';
@@ -38,7 +38,7 @@ export function isEventType(arg) {
38
38
  return ['create', 'update', 'delete'].includes(arg);
39
39
  }
40
40
  export function isGroqContextOptions(context) {
41
- return 'clientOptions' in context;
41
+ return 'eventResourceType' in context;
42
42
  }
43
43
  /** @internal */
44
44
  export var BlueprintParserErrorType;
@@ -3148,5 +3148,5 @@
3148
3148
  ]
3149
3149
  }
3150
3150
  },
3151
- "version": "17.16.0-next.g26925c0"
3151
+ "version": "17.16.0-next.g76cdca8"
3152
3152
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "17.16.0-next.g26925c0",
4
+ "version": "17.16.0-next.g76cdca8",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -68,10 +68,10 @@
68
68
  "@oclif/core": "^4.14.0",
69
69
  "@oclif/plugin-help": "^6.3.0",
70
70
  "@sanity-labs/oclif-plugin-skills-flag": "^0.2.1",
71
- "@sanity/blueprints": "^0.28.0",
71
+ "@sanity/blueprints": "^0.29.0",
72
72
  "@sanity/blueprints-parser": "^0.5.0",
73
- "@sanity/cli-build": "^6.3.0",
74
- "@sanity/cli-core": "^3.7.0",
73
+ "@sanity/cli-build": "^7.0.2",
74
+ "@sanity/cli-core": "^3.12.0",
75
75
  "@sanity/client": "^8.6.1",
76
76
  "adm-zip": "^0.6.1",
77
77
  "array-treeify": "^0.2.0",
@@ -100,7 +100,7 @@
100
100
  "@oclif/test": "^4.2.0",
101
101
  "@playwright/test": "^1.63.0",
102
102
  "@sanity-labs/design-tokens": "^0.0.2-alpha.2",
103
- "@sanity/functions": "^1.7.2",
103
+ "@sanity/functions": "^1.10.1",
104
104
  "@types/cardinal": "^2.1.1",
105
105
  "@types/mime-types": "^3.0.1",
106
106
  "@types/node": "^22",