@sanity/runtime-cli 17.15.0 → 17.16.0-app-functions.ge0a25ea

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 (64) 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/blueprint.d.ts +20 -9
  5. package/dist/actions/blueprints/blueprint.js +25 -79
  6. package/dist/actions/blueprints/config.d.ts +1 -0
  7. package/dist/actions/blueprints/config.js +7 -1
  8. package/dist/actions/blueprints/pre-deploy.js +3 -3
  9. package/dist/actions/blueprints/process-assets.js +3 -2
  10. package/dist/actions/blueprints/stacks.d.ts +7 -2
  11. package/dist/actions/blueprints/stacks.js +10 -6
  12. package/dist/actions/blueprints/wait-for-operation.d.ts +1 -0
  13. package/dist/actions/blueprints/wait-for-operation.js +1 -1
  14. package/dist/baseCommands.js +3 -3
  15. package/dist/config.d.ts +1 -2
  16. package/dist/config.js +1 -2
  17. package/dist/cores/blueprints/deploy.d.ts +8 -0
  18. package/dist/cores/blueprints/deploy.js +12 -4
  19. package/dist/cores/blueprints/doctor.js +2 -2
  20. package/dist/cores/blueprints/init.js +11 -2
  21. package/dist/cores/functions/test.js +43 -9
  22. package/dist/functions/artifacts.d.ts +13 -0
  23. package/dist/functions/artifacts.js +26 -0
  24. package/dist/functions/build.d.ts +15 -0
  25. package/dist/functions/build.js +27 -0
  26. package/dist/functions/contractPlugin.d.ts +7 -0
  27. package/dist/functions/contractPlugin.js +32 -0
  28. package/dist/functions/contracts/schema.d.ts +22 -0
  29. package/dist/functions/contracts/schema.js +99 -0
  30. package/dist/functions/contracts/validation.d.ts +3 -0
  31. package/dist/functions/contracts/validation.js +66 -0
  32. package/dist/functions/contracts.d.ts +20 -0
  33. package/dist/functions/contracts.js +119 -0
  34. package/dist/functions/deploy.d.ts +15 -0
  35. package/dist/functions/deploy.js +60 -0
  36. package/dist/functions/stack.d.ts +18 -0
  37. package/dist/functions/stack.js +84 -0
  38. package/dist/server/app.js +4 -4
  39. package/dist/server/static/components/app.css +8 -1
  40. package/dist/utils/blueprints/group-resources.d.ts +2 -1
  41. package/dist/utils/blueprints/group-resources.js +3 -3
  42. package/dist/utils/blueprints/resolve-deployed-resources.d.ts +2 -2
  43. package/dist/utils/blueprints/resolve-deployed-resources.js +4 -4
  44. package/dist/utils/bundles/prepare-asset.d.ts +3 -3
  45. package/dist/utils/bundles/prepare-asset.js +8 -7
  46. package/dist/utils/functions/child-process-wrapper.js +1 -1
  47. package/dist/utils/functions/child-runtime/durable.js +99 -22
  48. package/dist/utils/functions/child-runtime/invoke.d.ts +1 -0
  49. package/dist/utils/functions/child-runtime/invoke.js +26 -9
  50. package/dist/utils/functions/child-runtime/step-history.d.ts +15 -0
  51. package/dist/utils/functions/child-runtime/step-history.js +52 -0
  52. package/dist/utils/functions/extract-durable-config.js +1 -4
  53. package/dist/utils/functions/invoke/local.js +27 -11
  54. package/dist/utils/functions/invoke/nested.js +2 -1
  55. package/dist/utils/functions/invoke/resolve-invoke-type.d.ts +2 -2
  56. package/dist/utils/functions/invoke/resolve-invoke-type.js +2 -2
  57. package/dist/utils/functions/transpile/function.d.ts +7 -1
  58. package/dist/utils/functions/transpile/function.js +15 -9
  59. package/dist/utils/types.d.ts +24 -13
  60. package/dist/utils/types.js +1 -1
  61. package/oclif.manifest.json +1 -1
  62. package/package.json +24 -3
  63. package/dist/actions/blueprints/resolve.d.ts +0 -51
  64. package/dist/actions/blueprints/resolve.js +0 -52
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.15.0",
4
+ "version": "17.16.0-app-functions.ge0a25ea",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -14,6 +14,26 @@
14
14
  "main": "dist/index.js",
15
15
  "types": "dist/index.d.ts",
16
16
  "exports": {
17
+ "./functions/stack": {
18
+ "types": "./dist/functions/stack.d.ts",
19
+ "import": "./dist/functions/stack.js",
20
+ "require": "./dist/functions/stack.js"
21
+ },
22
+ "./functions/contracts": {
23
+ "types": "./dist/functions/contracts.d.ts",
24
+ "import": "./dist/functions/contracts.js",
25
+ "require": "./dist/functions/contracts.js"
26
+ },
27
+ "./functions/deploy": {
28
+ "types": "./dist/functions/deploy.d.ts",
29
+ "import": "./dist/functions/deploy.js",
30
+ "require": "./dist/functions/deploy.js"
31
+ },
32
+ "./functions/build": {
33
+ "types": "./dist/functions/build.d.ts",
34
+ "import": "./dist/functions/build.js",
35
+ "require": "./dist/functions/build.js"
36
+ },
17
37
  ".": {
18
38
  "types": "./dist/index.d.ts",
19
39
  "import": "./dist/index.js",
@@ -68,7 +88,7 @@
68
88
  "@oclif/core": "^4.14.0",
69
89
  "@oclif/plugin-help": "^6.3.0",
70
90
  "@sanity-labs/oclif-plugin-skills-flag": "^0.2.1",
71
- "@sanity/blueprints": "^0.27.0",
91
+ "@sanity/blueprints": "^0.28.0",
72
92
  "@sanity/blueprints-parser": "^0.5.0",
73
93
  "@sanity/cli-build": "^6.3.0",
74
94
  "@sanity/cli-core": "^3.7.0",
@@ -86,6 +106,7 @@
86
106
  "strip-ansi": "^7.2.0",
87
107
  "tar-fs": "^3.1.3",
88
108
  "tar-stream": "^3.2.1",
109
+ "typescript-compiler": "npm:typescript@^6.0.3",
89
110
  "vite": "^8.3.0",
90
111
  "ws": "^8.21.3",
91
112
  "xdg-basedir": "^5.1.0"
@@ -100,7 +121,7 @@
100
121
  "@oclif/test": "^4.2.0",
101
122
  "@playwright/test": "^1.63.0",
102
123
  "@sanity-labs/design-tokens": "^0.0.2-alpha.2",
103
- "@sanity/functions": "^1.7.2",
124
+ "@sanity/functions": "^1.8.1",
104
125
  "@types/cardinal": "^2.1.1",
105
126
  "@types/mime-types": "^3.0.1",
106
127
  "@types/node": "^22",
@@ -1,51 +0,0 @@
1
- import type { ScopeType } from '../../utils/types.js';
2
- /**
3
- * Source of a resolved config value.
4
- * - flags: from CLI flags like `--project-id`
5
- * - env: from the environment - usually CLI var like `SANITY_ORGANIZATION_ID`
6
- * - module: from the blueprint module - undocumented escape hatch
7
- * - config: from the config file - .sanity/blueprint.config.json most common
8
- * - inferred: legacy `ST-<projectId>` stacks from launch
9
- */
10
- export type ConfigSource = 'flags' | 'env' | 'module' | 'config' | 'inferred';
11
- /** A set of optional IDs from a single source. */
12
- export interface IdValues {
13
- organizationId?: string;
14
- projectId?: string;
15
- stackId?: string;
16
- }
17
- /**
18
- * Sources to resolve IDs from, in descending priority.
19
- * Each key maps to a source; the first non-empty value wins.
20
- *
21
- * - `env` defaults to reading SANITY_* process.env vars
22
- * - `module` and `config` accept any object with `{organizationId?, projectId?, stackId?}`
23
- */
24
- export interface IdSources {
25
- flags?: IdValues | null;
26
- env?: IdValues | null;
27
- module?: IdValues | null;
28
- config?: IdValues | null;
29
- }
30
- export interface ResolvedIds {
31
- organizationId?: string;
32
- projectId?: string;
33
- stackId?: string;
34
- scopeType?: ScopeType;
35
- scopeId?: string;
36
- sources: {
37
- organizationId?: ConfigSource;
38
- projectId?: ConfigSource;
39
- stackId?: ConfigSource;
40
- };
41
- }
42
- /**
43
- * Resolve organization, project, and stack IDs from a prioritized set of sources.
44
- * Precedence: flags > env > module > config.
45
- * Derives scopeType/scopeId from the resolved IDs (project > organization).
46
- *
47
- * Env vars are read from process.env by default (SANITY_ORGANIZATION_ID,
48
- * SANITY_PROJECT_ID, SANITY_BLUEPRINT_STACK_ID). Pass `env` explicitly to
49
- * override, or `null` to skip.
50
- */
51
- export declare function resolveIds(sources?: IdSources): ResolvedIds;
@@ -1,52 +0,0 @@
1
- import { env as processEnv } from 'node:process';
2
- /**
3
- * Resolve organization, project, and stack IDs from a prioritized set of sources.
4
- * Precedence: flags > env > module > config.
5
- * Derives scopeType/scopeId from the resolved IDs (project > organization).
6
- *
7
- * Env vars are read from process.env by default (SANITY_ORGANIZATION_ID,
8
- * SANITY_PROJECT_ID, SANITY_BLUEPRINT_STACK_ID). Pass `env` explicitly to
9
- * override, or `null` to skip.
10
- */
11
- export function resolveIds(sources = {}) {
12
- const envValues = sources.env !== undefined
13
- ? sources.env
14
- : {
15
- organizationId: processEnv.SANITY_ORGANIZATION_ID,
16
- projectId: processEnv.SANITY_PROJECT_ID,
17
- stackId: processEnv.SANITY_BLUEPRINT_STACK_ID,
18
- };
19
- const ordered = [
20
- { source: 'flags', values: sources.flags },
21
- { source: 'env', values: envValues },
22
- { source: 'module', values: sources.module },
23
- { source: 'config', values: sources.config },
24
- ];
25
- const result = { sources: {} };
26
- for (const { source, values } of ordered) {
27
- if (values === null || values === undefined)
28
- continue;
29
- if (!result.organizationId && values.organizationId) {
30
- result.organizationId = values.organizationId;
31
- result.sources.organizationId = source;
32
- }
33
- if (!result.projectId && values.projectId) {
34
- result.projectId = values.projectId;
35
- result.sources.projectId = source;
36
- }
37
- if (!result.stackId && values.stackId) {
38
- result.stackId = values.stackId;
39
- result.sources.stackId = source;
40
- }
41
- }
42
- // Scope is as specific as possible; project > organization
43
- if (result.projectId) {
44
- result.scopeType = 'project';
45
- result.scopeId = result.projectId;
46
- }
47
- else if (result.organizationId) {
48
- result.scopeType = 'organization';
49
- result.scopeId = result.organizationId;
50
- }
51
- return result;
52
- }