@sanity/runtime-cli 4.3.5-bundle.0 → 4.5.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.
- package/README.md +17 -17
- package/dist/server/static/components/app.css +117 -0
- package/dist/server/static/components/console-panel.d.ts +1 -0
- package/dist/server/static/components/console-panel.js +53 -0
- package/dist/server/static/components/filters.js +4 -3
- package/dist/server/static/components/response-panel.js +22 -14
- package/dist/server/static/index.html +4 -1
- 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/4.
|
|
23
|
+
@sanity/runtime-cli/4.5.0 linux-x64 node-v22.15.0
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -74,7 +74,7 @@ EXAMPLES
|
|
|
74
74
|
$ sanity-run blueprints add function --name my-function --function-type document-publish
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
77
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/add.ts)_
|
|
78
78
|
|
|
79
79
|
## `sanity-run blueprints config`
|
|
80
80
|
|
|
@@ -103,7 +103,7 @@ EXAMPLES
|
|
|
103
103
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack-id <stackId>
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
106
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/config.ts)_
|
|
107
107
|
|
|
108
108
|
## `sanity-run blueprints deploy`
|
|
109
109
|
|
|
@@ -123,7 +123,7 @@ EXAMPLES
|
|
|
123
123
|
$ sanity-run blueprints deploy
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
126
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/deploy.ts)_
|
|
127
127
|
|
|
128
128
|
## `sanity-run blueprints destroy`
|
|
129
129
|
|
|
@@ -146,7 +146,7 @@ EXAMPLES
|
|
|
146
146
|
$ sanity-run blueprints destroy --id ST-a1b2c3
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
149
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/destroy.ts)_
|
|
150
150
|
|
|
151
151
|
## `sanity-run blueprints info`
|
|
152
152
|
|
|
@@ -168,7 +168,7 @@ EXAMPLES
|
|
|
168
168
|
$ sanity-run blueprints info --id ST-a1b2c3
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
171
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/info.ts)_
|
|
172
172
|
|
|
173
173
|
## `sanity-run blueprints init`
|
|
174
174
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId> --stack-name <stackName>
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
201
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/init.ts)_
|
|
202
202
|
|
|
203
203
|
## `sanity-run blueprints logs`
|
|
204
204
|
|
|
@@ -220,7 +220,7 @@ EXAMPLES
|
|
|
220
220
|
$ sanity-run blueprints logs --watch
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
223
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/logs.ts)_
|
|
224
224
|
|
|
225
225
|
## `sanity-run blueprints plan`
|
|
226
226
|
|
|
@@ -237,7 +237,7 @@ EXAMPLES
|
|
|
237
237
|
$ sanity-run blueprints plan
|
|
238
238
|
```
|
|
239
239
|
|
|
240
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
240
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/plan.ts)_
|
|
241
241
|
|
|
242
242
|
## `sanity-run blueprints stacks`
|
|
243
243
|
|
|
@@ -259,7 +259,7 @@ EXAMPLES
|
|
|
259
259
|
$ sanity-run blueprints stacks --projectId a1b2c3
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
262
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/blueprints/stacks.ts)_
|
|
263
263
|
|
|
264
264
|
## `sanity-run functions dev`
|
|
265
265
|
|
|
@@ -279,7 +279,7 @@ EXAMPLES
|
|
|
279
279
|
$ sanity-run functions dev --port 8974
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
282
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/dev.ts)_
|
|
283
283
|
|
|
284
284
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
285
285
|
|
|
@@ -301,7 +301,7 @@ EXAMPLES
|
|
|
301
301
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
304
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/env/add.ts)_
|
|
305
305
|
|
|
306
306
|
## `sanity-run functions env list NAME`
|
|
307
307
|
|
|
@@ -321,7 +321,7 @@ EXAMPLES
|
|
|
321
321
|
$ sanity-run functions env list MyFunction
|
|
322
322
|
```
|
|
323
323
|
|
|
324
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
324
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/env/list.ts)_
|
|
325
325
|
|
|
326
326
|
## `sanity-run functions env remove NAME KEY`
|
|
327
327
|
|
|
@@ -342,7 +342,7 @@ EXAMPLES
|
|
|
342
342
|
$ sanity-run functions env remove MyFunction API_URL
|
|
343
343
|
```
|
|
344
344
|
|
|
345
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
345
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/env/remove.ts)_
|
|
346
346
|
|
|
347
347
|
## `sanity-run functions invoke NAME`
|
|
348
348
|
|
|
@@ -368,7 +368,7 @@ EXAMPLES
|
|
|
368
368
|
$ sanity-run functions invoke <name> --file 'payload.json'
|
|
369
369
|
```
|
|
370
370
|
|
|
371
|
-
_See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
371
|
+
_See code: [src/commands/functions/invoke.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/invoke.ts)_
|
|
372
372
|
|
|
373
373
|
## `sanity-run functions logs NAME`
|
|
374
374
|
|
|
@@ -400,7 +400,7 @@ EXAMPLES
|
|
|
400
400
|
$ sanity-run functions logs <name> --delete
|
|
401
401
|
```
|
|
402
402
|
|
|
403
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
403
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/logs.ts)_
|
|
404
404
|
|
|
405
405
|
## `sanity-run functions test NAME`
|
|
406
406
|
|
|
@@ -433,7 +433,7 @@ EXAMPLES
|
|
|
433
433
|
$ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
|
|
434
434
|
```
|
|
435
435
|
|
|
436
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v4.
|
|
436
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v4.5.0/src/commands/functions/test.ts)_
|
|
437
437
|
|
|
438
438
|
## `sanity-run help [COMMAND]`
|
|
439
439
|
|
|
@@ -771,9 +771,105 @@ body > nav {
|
|
|
771
771
|
}
|
|
772
772
|
body > main {
|
|
773
773
|
grid-area: main;
|
|
774
|
+
/* Ensure main takes up available space if body is grid/flex */
|
|
775
|
+
overflow: hidden; /* Prevent main itself from scrolling */
|
|
776
|
+
min-height: 0; /* Needed for grid children height */
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/* Add styles for filters-component form */
|
|
780
|
+
/* Default (Mobile) Styles */
|
|
781
|
+
filters-component form {
|
|
782
|
+
display: block; /* Stack direct children */
|
|
783
|
+
padding: var(--space-3); /* Consistent padding */
|
|
784
|
+
border-bottom: 1px solid var(--card-border-color);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
filters-component form > * {
|
|
788
|
+
/* Target direct children: dropdowns, fieldset */
|
|
789
|
+
display: block; /* Ensure they are block level */
|
|
790
|
+
width: 100%; /* Make them take full width */
|
|
791
|
+
margin-bottom: var(--space-3); /* Add space below each item when stacked */
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
filters-component form > *:last-child {
|
|
795
|
+
margin-bottom: 0; /* Remove margin from the last stacked item */
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
filters-component form label {
|
|
799
|
+
display: block; /* Ensure label stacks above input if needed */
|
|
800
|
+
margin-bottom: var(--space-1); /* Small space between label and input */
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
filters-component form input {
|
|
804
|
+
width: 100%; /* Make input fill its container */
|
|
805
|
+
box-sizing: border-box; /* Include padding/border in width calculation */
|
|
806
|
+
}
|
|
807
|
+
/* End of Mobile Styles */
|
|
808
|
+
|
|
809
|
+
/* Apply grid styles to main#main-content */
|
|
810
|
+
#main-content {
|
|
811
|
+
display: grid;
|
|
812
|
+
grid-template-areas:
|
|
813
|
+
'payload response'
|
|
814
|
+
'console console';
|
|
815
|
+
grid-template-columns: 1fr 1fr;
|
|
816
|
+
/* Let console height be flexible based on content, up to a max */
|
|
817
|
+
grid-template-rows: 1fr 1fr;
|
|
818
|
+
/* Ensure grid takes full height of its container (main) */
|
|
819
|
+
height: 100%;
|
|
820
|
+
max-height: 100%;
|
|
821
|
+
min-height: 0; /* Important for nested overflow/height */
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
payload-panel {
|
|
825
|
+
grid-area: payload;
|
|
826
|
+
max-height: 100%; /* Fit within allocated grid row space */
|
|
827
|
+
overflow: hidden; /* Let internal elements scroll */
|
|
828
|
+
min-height: 0; /* Allow shrinking */
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
response-panel {
|
|
832
|
+
grid-area: response;
|
|
833
|
+
max-height: 100%;
|
|
834
|
+
overflow: hidden;
|
|
835
|
+
min-height: 0;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/* Target console-panel for grid area and height constraints */
|
|
839
|
+
console-panel {
|
|
840
|
+
grid-area: console;
|
|
841
|
+
overflow: hidden; /* The inner div handles scrolling */
|
|
774
842
|
}
|
|
775
843
|
|
|
776
844
|
@media (max-width: 40rem) {
|
|
845
|
+
/* Mobile layout: stack elements vertically */
|
|
846
|
+
#main-content {
|
|
847
|
+
grid-template-areas:
|
|
848
|
+
'payload'
|
|
849
|
+
'response'
|
|
850
|
+
'console';
|
|
851
|
+
grid-template-columns: 1fr;
|
|
852
|
+
/* Adjust row heights for mobile, maybe allow content to determine height */
|
|
853
|
+
grid-template-rows: auto auto auto;
|
|
854
|
+
height: auto; /* Allow main content to scroll if needed */
|
|
855
|
+
max-height: none;
|
|
856
|
+
overflow-y: auto; /* Allow scrolling for the whole main area */
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/* Reset max-heights on mobile if they cause layout issues */
|
|
860
|
+
payload-panel,
|
|
861
|
+
response-panel,
|
|
862
|
+
console-panel {
|
|
863
|
+
max-height: none;
|
|
864
|
+
min-height: 200px; /* Give some minimum space on mobile */
|
|
865
|
+
overflow: auto; /* Allow individual scrolling if content is large */
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/* Ensure console has reasonable height on mobile */
|
|
869
|
+
console-panel {
|
|
870
|
+
max-height: 400px; /* Allow more console height on mobile maybe */
|
|
871
|
+
}
|
|
872
|
+
|
|
777
873
|
.block-lg {
|
|
778
874
|
display: block !important;
|
|
779
875
|
}
|
|
@@ -794,6 +890,27 @@ body > main {
|
|
|
794
890
|
.border-top-none-l {
|
|
795
891
|
border-top: 0;
|
|
796
892
|
}
|
|
893
|
+
|
|
894
|
+
/* Revert filters-component form to horizontal layout on larger screens */
|
|
895
|
+
filters-component form {
|
|
896
|
+
display: flex;
|
|
897
|
+
flex-direction: row;
|
|
898
|
+
align-items: flex-end; /* Align form elements along their bottom edge */
|
|
899
|
+
gap: var(--space-3); /* Space between elements */
|
|
900
|
+
padding-left: var(--space-3);
|
|
901
|
+
padding-bottom: var(--space-3);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
filters-component form > * {
|
|
905
|
+
width: auto; /* Allow elements to size based on content/flex rules */
|
|
906
|
+
margin-bottom: 0; /* Remove stacking margin */
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/* Optional: Give API version input a specific width or allow growth */
|
|
910
|
+
filters-component form fieldset {
|
|
911
|
+
min-width: 150px; /* Example minimum width */
|
|
912
|
+
/* flex-grow: 1; */ /* Uncomment to allow it to fill space */
|
|
913
|
+
}
|
|
797
914
|
}
|
|
798
915
|
|
|
799
916
|
header {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* globals customElements document */
|
|
2
|
+
import {ApiBaseElement} from './api-base.js'
|
|
3
|
+
|
|
4
|
+
// Template for the console panel
|
|
5
|
+
const template = `
|
|
6
|
+
<div id="console-container" style='position: relative; background: var(--base-background-color); padding: var(--space-0) var(--space-3) var(--space-7) var(--space-4);overflow-y:scroll; border-top: 1px solid var(--card-border-color); height: 100%; max-height: 100%;'>
|
|
7
|
+
<h3 class="config-label" style="padding-top: var(--space-3); padding-bottom: var(--space-3); z-index: 32; background: var(--base-background-color); position: sticky; top: 0; left: 0; right: 0; margin-top:0;margin-bottom:0;">Console</h3>
|
|
8
|
+
<pre id="console-output" style="padding: 0; margin: 0 0 var(--space-4) 0; white-space: pre-wrap; word-wrap: break-word;"></pre>
|
|
9
|
+
</div>
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
class ConsolePanel extends ApiBaseElement {
|
|
13
|
+
updateConsole = ({result}) => {
|
|
14
|
+
// Guard against element not being ready or API not injected yet
|
|
15
|
+
if (!this.consoleOutput || !result) return
|
|
16
|
+
|
|
17
|
+
const {error, logs} = result
|
|
18
|
+
if (error) {
|
|
19
|
+
// Display error details in the console
|
|
20
|
+
this.consoleOutput.innerText = error?.details?.error ?? 'An error occurred.'
|
|
21
|
+
} else {
|
|
22
|
+
// Display regular logs
|
|
23
|
+
this.consoleOutput.innerText = logs ?? '' // Handle case where logs might be null/undefined
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
this.innerHTML = template
|
|
29
|
+
this.consoleOutput = this.querySelector('#console-output')
|
|
30
|
+
|
|
31
|
+
// Subscribe to changes in the result state to update the console
|
|
32
|
+
if (this.api) {
|
|
33
|
+
this.api.subscribe(this.updateConsole, ['result'])
|
|
34
|
+
// Initial update in case result is already populated
|
|
35
|
+
if (this.api.store.result) {
|
|
36
|
+
this.updateConsole({result: this.api.store.result})
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
console.error('API context not available for console-panel on connect.')
|
|
40
|
+
// Optionally, set up a mechanism to wait for API initialization if needed
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
disconnectedCallback() {
|
|
45
|
+
// Unsubscribe when the element is removed from the DOM
|
|
46
|
+
if (this.api) {
|
|
47
|
+
this.api.unsubscribe(this.updateConsole)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Define the new custom element
|
|
53
|
+
customElements.define('console-panel', ConsolePanel)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
class FiltersComponent extends HTMLElement {
|
|
2
2
|
connectedCallback() {
|
|
3
3
|
this.innerHTML = `
|
|
4
|
-
<form style="
|
|
5
|
-
|
|
4
|
+
<form style="gap: 8px;padding-left: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--card-border-color);">
|
|
5
|
+
<projects-dropdown></projects-dropdown>
|
|
6
|
+
<dataset-dropdown></dataset-dropdown>
|
|
6
7
|
<fieldset class="mar-t-sm">
|
|
7
8
|
<label class="config-label">
|
|
8
9
|
<span>API Version</span>
|
|
@@ -10,7 +11,7 @@ class FiltersComponent extends HTMLElement {
|
|
|
10
11
|
<input name="apiVersion" id="apiversion" style="background: transparent; border-color: light-dark(var(--gray-200), var(--gray-700))">
|
|
11
12
|
</label>
|
|
12
13
|
</fieldset>
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
|
|
15
16
|
</form>
|
|
16
17
|
`
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from '../vendor/vendor.bundle.js'
|
|
11
11
|
import {ApiBaseElement} from './api-base.js'
|
|
12
12
|
|
|
13
|
-
const template = `<div class="border-left border-top border-top-none-l h-100 gutter-gradient" style='height: 100%; max-height: 100%; overflow: hidden; display:grid;grid-template-rows:
|
|
13
|
+
const template = `<div class="border-left border-top border-top-none-l h-100 gutter-gradient" style='height: 100%; max-height: 100%; overflow: hidden; display:grid;grid-template-rows: auto 1fr; grid-template-columns: 1fr;' >
|
|
14
14
|
<!-- Response Section -->
|
|
15
|
-
<div style='overflow-y:scroll;'>
|
|
15
|
+
<div style='overflow-y:scroll; min-height: 0;'>
|
|
16
16
|
<div style='padding-bottom: var(--space-6)'>
|
|
17
17
|
<h3 class="config-label" style='display: none; margin-top: 0;'>Response</h3>
|
|
18
18
|
<header class='flex space-between'>
|
|
@@ -28,16 +28,12 @@ const template = `<div class="border-left border-top border-top-none-l h-100 gut
|
|
|
28
28
|
<div id="response" name="response" class="cm-s-dracula"></div>
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
|
-
|
|
32
|
-
<!-- Console Section -->
|
|
33
|
-
<div style='position: relative; border-top: 1px solid var(--card-border-color); background: var(--base-background-color); padding: var(--space-0) var(--space-3) var(--space-6) var(--space-4);overflow-y:scroll;'>
|
|
34
|
-
<h3 class="config-label" style="padding-top: var(--space-3); padding-bottom: var(--space-3); z-index: 32; background: var(--base-background-color); position: sticky; top: 0; left: 0; right: 0; margin-top:0;margin-bottom:0;">Console</h3>
|
|
35
|
-
<pre style="padding: 0; margin: 0; white-space: pre-wrap; word-wrap: break-word;"></pre>
|
|
36
|
-
</div>
|
|
37
31
|
</div>
|
|
38
32
|
`
|
|
39
33
|
class ResponsePanel extends ApiBaseElement {
|
|
40
34
|
updateResponse = ({result}) => {
|
|
35
|
+
if (!result) return
|
|
36
|
+
|
|
41
37
|
const {error, json, logs, time, timings} = result
|
|
42
38
|
if (!error) {
|
|
43
39
|
const transaction = this.api.store.response.state.update({
|
|
@@ -63,10 +59,14 @@ class ResponsePanel extends ApiBaseElement {
|
|
|
63
59
|
this.time.innerText = prettyMilliseconds(time)
|
|
64
60
|
this.time.dateTime = `PT${time / 1000}S`
|
|
65
61
|
}
|
|
66
|
-
|
|
67
|
-
this.consoleTab.innerText = logs
|
|
68
62
|
} else {
|
|
69
|
-
this.
|
|
63
|
+
const transaction = this.api.store.response.state.update({
|
|
64
|
+
changes: {from: 0, to: this.api.store.response.state.doc.length, insert: ''},
|
|
65
|
+
})
|
|
66
|
+
this.api.store.response.dispatch(transaction)
|
|
67
|
+
this.size.innerText = ''
|
|
68
|
+
this.time.innerText = ''
|
|
69
|
+
this.time.removeAttribute('datetime')
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -75,8 +75,14 @@ class ResponsePanel extends ApiBaseElement {
|
|
|
75
75
|
this.response = this.querySelector('#response')
|
|
76
76
|
this.size = this.querySelector('#size')
|
|
77
77
|
this.time = this.querySelector('#time')
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
if (this.api) {
|
|
79
|
+
this.api.subscribe(this.updateResponse, ['result'])
|
|
80
|
+
if (this.api.store.result) {
|
|
81
|
+
this.updateResponse({result: this.api.store.result})
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
console.error('API context not available for response-panel on connect.')
|
|
85
|
+
}
|
|
80
86
|
|
|
81
87
|
this.api.store.response = new EditorView({
|
|
82
88
|
doc: '\n\n\n\n',
|
|
@@ -86,7 +92,9 @@ class ResponsePanel extends ApiBaseElement {
|
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
disconnectedCallback() {
|
|
89
|
-
this.api
|
|
95
|
+
if (this.api) {
|
|
96
|
+
this.api.unsubscribe(this.updateResponse)
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
|
+
<title>Sanity Functions</title>
|
|
5
6
|
<link href="https://unpkg.com/m-@3.2.0/dist/m-.woff2" rel="preload" as="font" crossorigin>
|
|
6
7
|
<link href="https://unpkg.com/m-@3.2.0/dist/m-.css" rel="stylesheet">
|
|
7
8
|
<link href="./components/app.css" rel="stylesheet">
|
|
@@ -21,9 +22,10 @@
|
|
|
21
22
|
<h4 class="config-label mar-t-0" style="padding-left: var(--space-3); margin-bottom:var(--space-3);">Functions</h4>
|
|
22
23
|
<function-list></function-list>
|
|
23
24
|
</nav>
|
|
24
|
-
<main style='
|
|
25
|
+
<main id="main-content" style='max-height: 100%; overflow: hidden;'>
|
|
25
26
|
<payload-panel></payload-panel>
|
|
26
27
|
<response-panel></response-panel>
|
|
28
|
+
<console-panel></console-panel>
|
|
27
29
|
</main>
|
|
28
30
|
|
|
29
31
|
|
|
@@ -34,5 +36,6 @@
|
|
|
34
36
|
<script src="./components/network-spinner.js" type="module"></script>
|
|
35
37
|
<script src="./components/payload-panel.js" type="module"></script>
|
|
36
38
|
<script src="./components/response-panel.js" type="module"></script>
|
|
39
|
+
<script src="./components/console-panel.js" type="module"></script>
|
|
37
40
|
</body>
|
|
38
41
|
</html>
|
|
@@ -34,7 +34,7 @@ export default async function invoke(resource, data, context, timeout = 5) {
|
|
|
34
34
|
let executionStart;
|
|
35
35
|
function start() {
|
|
36
36
|
executionStart = performance.now();
|
|
37
|
-
child = spawn('node', [getChildProcessWrapperPath()], {
|
|
37
|
+
child = spawn('node', ['--enable-source-maps', getChildProcessWrapperPath()], {
|
|
38
38
|
cwd: cwd(),
|
|
39
39
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
40
40
|
});
|
package/oclif.manifest.json
CHANGED