@sanity/runtime-cli 7.6.4 → 7.6.6
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/README.md +15 -15
- package/dist/server/static/components/app.css +7 -2
- package/dist/server/static/components/payload-panel.js +0 -47
- package/dist/server/static/components/run-panel.d.ts +1 -0
- package/dist/server/static/components/run-panel.js +71 -0
- package/dist/server/static/index.html +2 -0
- package/dist/utils/invoke-local.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
|
|
|
20
20
|
$ sanity-run COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ sanity-run (--version)
|
|
23
|
-
@sanity/runtime-cli/7.6.
|
|
23
|
+
@sanity/runtime-cli/7.6.6 linux-x64 node-v22.16.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -84,7 +84,7 @@ EXAMPLES
|
|
|
84
84
|
$ sanity-run blueprints add function --name my-function --fn-type document-publish --lang js
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
87
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/add.ts)_
|
|
88
88
|
|
|
89
89
|
## `sanity-run blueprints config`
|
|
90
90
|
|
|
@@ -112,7 +112,7 @@ EXAMPLES
|
|
|
112
112
|
$ sanity-run blueprints config --edit --project-id <projectId>
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
115
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/config.ts)_
|
|
116
116
|
|
|
117
117
|
## `sanity-run blueprints deploy`
|
|
118
118
|
|
|
@@ -134,7 +134,7 @@ EXAMPLES
|
|
|
134
134
|
$ sanity-run blueprints deploy --no-wait
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
137
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/deploy.ts)_
|
|
138
138
|
|
|
139
139
|
## `sanity-run blueprints destroy`
|
|
140
140
|
|
|
@@ -155,7 +155,7 @@ EXAMPLES
|
|
|
155
155
|
$ sanity-run blueprints destroy
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
158
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/destroy.ts)_
|
|
159
159
|
|
|
160
160
|
## `sanity-run blueprints info`
|
|
161
161
|
|
|
@@ -172,7 +172,7 @@ EXAMPLES
|
|
|
172
172
|
$ sanity-run blueprints info
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
175
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/info.ts)_
|
|
176
176
|
|
|
177
177
|
## `sanity-run blueprints init [DIR]`
|
|
178
178
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId>
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
207
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/init.ts)_
|
|
208
208
|
|
|
209
209
|
## `sanity-run blueprints logs`
|
|
210
210
|
|
|
@@ -226,7 +226,7 @@ EXAMPLES
|
|
|
226
226
|
$ sanity-run blueprints logs --watch
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
229
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/logs.ts)_
|
|
230
230
|
|
|
231
231
|
## `sanity-run blueprints plan`
|
|
232
232
|
|
|
@@ -243,7 +243,7 @@ EXAMPLES
|
|
|
243
243
|
$ sanity-run blueprints plan
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
246
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/blueprints/plan.ts)_
|
|
247
247
|
|
|
248
248
|
## `sanity-run functions dev`
|
|
249
249
|
|
|
@@ -263,7 +263,7 @@ EXAMPLES
|
|
|
263
263
|
$ sanity-run functions dev --port 8974
|
|
264
264
|
```
|
|
265
265
|
|
|
266
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
266
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/dev.ts)_
|
|
267
267
|
|
|
268
268
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
269
269
|
|
|
@@ -285,7 +285,7 @@ EXAMPLES
|
|
|
285
285
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
288
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/env/add.ts)_
|
|
289
289
|
|
|
290
290
|
## `sanity-run functions env list NAME`
|
|
291
291
|
|
|
@@ -305,7 +305,7 @@ EXAMPLES
|
|
|
305
305
|
$ sanity-run functions env list MyFunction
|
|
306
306
|
```
|
|
307
307
|
|
|
308
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
308
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/env/list.ts)_
|
|
309
309
|
|
|
310
310
|
## `sanity-run functions env remove NAME KEY`
|
|
311
311
|
|
|
@@ -326,7 +326,7 @@ EXAMPLES
|
|
|
326
326
|
$ sanity-run functions env remove MyFunction API_URL
|
|
327
327
|
```
|
|
328
328
|
|
|
329
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
329
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/env/remove.ts)_
|
|
330
330
|
|
|
331
331
|
## `sanity-run functions logs NAME`
|
|
332
332
|
|
|
@@ -360,7 +360,7 @@ EXAMPLES
|
|
|
360
360
|
$ sanity-run functions logs <name> --delete
|
|
361
361
|
```
|
|
362
362
|
|
|
363
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
363
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/logs.ts)_
|
|
364
364
|
|
|
365
365
|
## `sanity-run functions test NAME`
|
|
366
366
|
|
|
@@ -393,7 +393,7 @@ EXAMPLES
|
|
|
393
393
|
$ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.
|
|
396
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v7.6.6/src/commands/functions/test.ts)_
|
|
397
397
|
|
|
398
398
|
## `sanity-run help [COMMAND]`
|
|
399
399
|
|
|
@@ -671,9 +671,10 @@ body {
|
|
|
671
671
|
'header'
|
|
672
672
|
'filters'
|
|
673
673
|
'left-sidebar'
|
|
674
|
-
'main'
|
|
674
|
+
'main'
|
|
675
|
+
'footer';
|
|
675
676
|
|
|
676
|
-
grid-template-rows: min-content min-content min-content 1fr;
|
|
677
|
+
grid-template-rows: min-content min-content min-content 1fr min-content;
|
|
677
678
|
}
|
|
678
679
|
|
|
679
680
|
/* Utilities */
|
|
@@ -775,6 +776,9 @@ body > main {
|
|
|
775
776
|
overflow: hidden; /* Prevent main itself from scrolling */
|
|
776
777
|
min-height: 0; /* Needed for grid children height */
|
|
777
778
|
}
|
|
779
|
+
body > footer {
|
|
780
|
+
grid-area: footer;
|
|
781
|
+
}
|
|
778
782
|
|
|
779
783
|
/* Add styles for filters-component form */
|
|
780
784
|
/* Default (Mobile) Styles */
|
|
@@ -885,6 +889,7 @@ console-panel {
|
|
|
885
889
|
'header header' min-content
|
|
886
890
|
'filters filters' min-content
|
|
887
891
|
'left-sidebar main ' 1fr
|
|
892
|
+
'footer footer' min-content
|
|
888
893
|
/ minmax(auto, 320px) 1fr;
|
|
889
894
|
}
|
|
890
895
|
.border-top-none-l {
|
|
@@ -4,16 +4,10 @@ import {sanityCodeMirrorTheme} from './codemirror-theme.js'
|
|
|
4
4
|
import {EditorView, basicSetup, json} from '../vendor/vendor.bundle.js'
|
|
5
5
|
import {ApiBaseElement} from './api-base.js'
|
|
6
6
|
|
|
7
|
-
const runTemplate = `<span>Run</span>
|
|
8
|
-
<svg data-sanity-icon="play" width="1em" height="1em" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.5 18.5V6.5L17.5 12.5L7.5 18.5Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path></svg>`
|
|
9
|
-
|
|
10
7
|
const template = `<div class="gutter-gradient relative h-100 max-h-100 y-scroll border-top border-top-none-l">
|
|
11
8
|
<div class="bg gutter-gradient sticky top-0 right-0 left-0 z-100">
|
|
12
9
|
<div class="flex items-center space-between" style="padding: 8px 20px 8px 48px;">
|
|
13
10
|
<h2 class="config-label mar-t-0 mar-b-0">Event</h2>
|
|
14
|
-
<button ord="primary" class="sanity-button">
|
|
15
|
-
${runTemplate}
|
|
16
|
-
</button>
|
|
17
11
|
</div>
|
|
18
12
|
<hr class='hr-border' style='margin-left: 31px; ' />
|
|
19
13
|
</div>
|
|
@@ -21,46 +15,9 @@ const template = `<div class="gutter-gradient relative h-100 max-h-100 y-scroll
|
|
|
21
15
|
</div>
|
|
22
16
|
`
|
|
23
17
|
class PayloadPanel extends ApiBaseElement {
|
|
24
|
-
invoke = () => {
|
|
25
|
-
const payloadText = this.createPayloadText(this.api.store.payload.state.doc)
|
|
26
|
-
const event = JSON.parse(payloadText)
|
|
27
|
-
const context = {
|
|
28
|
-
clientOptions: {
|
|
29
|
-
apiVersion: this.apiVersion.value,
|
|
30
|
-
dataset: this.api.store.selectedDataset,
|
|
31
|
-
projectId: this.api.store.selectedProject,
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
this.api.invoke({context, event})
|
|
35
|
-
}
|
|
36
|
-
createPayloadText = (doc) => {
|
|
37
|
-
if (doc.text) {
|
|
38
|
-
return doc.text.join('') || '{}'
|
|
39
|
-
}
|
|
40
|
-
if (doc.children) {
|
|
41
|
-
return doc.children.map((child) => child.text.join('')).join('') || '{}'
|
|
42
|
-
}
|
|
43
|
-
return '{}'
|
|
44
|
-
}
|
|
45
|
-
updateButtonText = ({inprogress}) => {
|
|
46
|
-
if (inprogress) {
|
|
47
|
-
this.button.setAttribute('disabled', '')
|
|
48
|
-
this.button.innerHTML = '<network-spinner></network-spinner>'
|
|
49
|
-
} else {
|
|
50
|
-
this.button.removeAttribute('disabled')
|
|
51
|
-
this.button.innerHTML = runTemplate
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
18
|
connectedCallback() {
|
|
56
19
|
this.innerHTML = template
|
|
57
20
|
this.payload = this.querySelector('#payload')
|
|
58
|
-
this.apiVersion = document.querySelector('#apiversion')
|
|
59
|
-
this.datasetname = document.querySelector('#datasetname')
|
|
60
|
-
this.productId = document.querySelector('#project')
|
|
61
|
-
this.button = this.querySelector('button')
|
|
62
|
-
this.button.addEventListener('click', this.invoke)
|
|
63
|
-
this.api.subscribe(this.updateButtonText, ['inprogress'])
|
|
64
21
|
|
|
65
22
|
this.api.store.payload = new EditorView({
|
|
66
23
|
doc: '\n\n\n\n',
|
|
@@ -68,10 +25,6 @@ class PayloadPanel extends ApiBaseElement {
|
|
|
68
25
|
parent: this.payload,
|
|
69
26
|
})
|
|
70
27
|
}
|
|
71
|
-
|
|
72
|
-
disconnectedCallback() {
|
|
73
|
-
this.button.removeEventListener('click', this.invoke)
|
|
74
|
-
}
|
|
75
28
|
}
|
|
76
29
|
|
|
77
30
|
customElements.define('payload-panel', PayloadPanel)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* globals customElements document */
|
|
2
|
+
import {ApiBaseElement} from './api-base.js'
|
|
3
|
+
|
|
4
|
+
const runTemplate = `<svg data-sanity-icon="play" width="1em" height="1em" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.5 18.5V6.5L17.5 12.5L7.5 18.5Z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"></path></svg>
|
|
5
|
+
<span>Run</span>`
|
|
6
|
+
|
|
7
|
+
const template = `<div style="padding: var(--space-3);">
|
|
8
|
+
<button ord="primary" class="sanity-button">
|
|
9
|
+
<span style="padding: var(--space-3); display: flex; gap: 0.25rem; justify-content: center; flex-direction: row;">
|
|
10
|
+
${runTemplate}
|
|
11
|
+
</span>
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
`
|
|
15
|
+
class RunPanel extends ApiBaseElement {
|
|
16
|
+
invoke = () => {
|
|
17
|
+
const payloadText = this.createPayloadText(this.api.store.payload.state.doc)
|
|
18
|
+
console.log(payloadText)
|
|
19
|
+
const event = JSON.parse(payloadText)
|
|
20
|
+
const context = {
|
|
21
|
+
clientOptions: {
|
|
22
|
+
apiVersion: this.apiVersion.value,
|
|
23
|
+
dataset: this.api.store.selectedDataset,
|
|
24
|
+
projectId: this.api.store.selectedProject,
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
this.api.invoke({context, event})
|
|
28
|
+
}
|
|
29
|
+
createPayloadText = (doc) => {
|
|
30
|
+
if (doc.text) {
|
|
31
|
+
return doc.text.join('') || '{}'
|
|
32
|
+
}
|
|
33
|
+
if (doc.children) {
|
|
34
|
+
return doc.children.map((child) => child.text.join('')).join('') || '{}'
|
|
35
|
+
}
|
|
36
|
+
return '{}'
|
|
37
|
+
}
|
|
38
|
+
updateButtonText = ({inprogress}) => {
|
|
39
|
+
if (inprogress) {
|
|
40
|
+
this.button.setAttribute('disabled', '')
|
|
41
|
+
this.buttonText.innerHTML = '<network-spinner></network-spinner>'
|
|
42
|
+
} else {
|
|
43
|
+
this.button.removeAttribute('disabled')
|
|
44
|
+
this.buttonText.innerHTML = runTemplate
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
onKeyDown = (event) => {
|
|
48
|
+
if (event.ctrlKey && event.key === 'Enter') {
|
|
49
|
+
this.invoke()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
connectedCallback() {
|
|
54
|
+
this.innerHTML = template
|
|
55
|
+
this.apiVersion = document.querySelector('#apiversion')
|
|
56
|
+
this.datasetname = document.querySelector('#datasetname')
|
|
57
|
+
this.productId = document.querySelector('#project')
|
|
58
|
+
this.button = this.querySelector('button')
|
|
59
|
+
this.buttonText = this.button.querySelector('span')
|
|
60
|
+
this.button.addEventListener('click', this.invoke)
|
|
61
|
+
document.addEventListener('keydown', this.onKeyDown)
|
|
62
|
+
this.api.subscribe(this.updateButtonText, ['inprogress'])
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
disconnectedCallback() {
|
|
66
|
+
this.button.removeEventListener('click', this.invoke)
|
|
67
|
+
document.removeEventListener('keydown', this.onKeyDown)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
customElements.define('run-panel', RunPanel)
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
<console-panel></console-panel>
|
|
44
44
|
</main>
|
|
45
|
+
<footer><run-panel></run-panel></footer>
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
<script src="./components/filters.js" type="module"></script>
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
<script src="./components/response-panel.js" type="module"></script>
|
|
54
55
|
<script src="./components/rule-panel.js" type="module"></script>
|
|
55
56
|
<script src="./components/console-panel.js" type="module"></script>
|
|
57
|
+
<script src="./components/run-panel.js" type="module"></script>
|
|
56
58
|
<script src="./hot-reload.js" type="module"></script>
|
|
57
59
|
</body>
|
|
58
60
|
</html>
|
|
@@ -75,7 +75,7 @@ export default async function invoke(resource, data, context, options) {
|
|
|
75
75
|
child = spawn('node', ['--enable-source-maps', getChildProcessWrapperPath()], {
|
|
76
76
|
cwd: cwd(),
|
|
77
77
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
78
|
-
env: { ...process.env, FORCE_COLOR: forceColor ? '1' : '0' },
|
|
78
|
+
env: { ...process.env, ...resource.env, FORCE_COLOR: forceColor ? '1' : '0' },
|
|
79
79
|
});
|
|
80
80
|
child.on('message', (data) => {
|
|
81
81
|
const executionTimeMs = performance.now() - executionStart;
|
package/oclif.manifest.json
CHANGED