@sanity/runtime-cli 1.6.0 → 1.8.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 +184 -122
- package/dist/actions/blueprints/blueprint.d.ts +24 -7
- package/dist/actions/blueprints/blueprint.js +65 -44
- package/dist/actions/blueprints/logs.d.ts +3 -0
- package/dist/actions/blueprints/logs.js +24 -0
- package/dist/actions/blueprints/projects.d.ts +5 -0
- package/dist/actions/blueprints/projects.js +21 -0
- package/dist/actions/blueprints/resources.d.ts +13 -0
- package/dist/actions/blueprints/resources.js +37 -0
- package/dist/actions/blueprints/stacks.js +1 -1
- package/dist/commands/blueprints/add.d.ts +10 -0
- package/dist/commands/blueprints/add.js +67 -0
- package/dist/commands/blueprints/config.d.ts +9 -0
- package/dist/commands/blueprints/config.js +72 -0
- package/dist/commands/blueprints/deploy.js +13 -12
- package/dist/commands/blueprints/info.js +1 -1
- package/dist/commands/blueprints/init.d.ts +6 -0
- package/dist/commands/blueprints/init.js +56 -0
- package/dist/commands/blueprints/logs.js +24 -64
- package/dist/commands/blueprints/stacks.js +3 -15
- package/dist/commands/functions/invoke.d.ts +1 -1
- package/dist/commands/functions/invoke.js +9 -7
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/logs.js +21 -12
- package/dist/commands/functions/test.d.ts +1 -1
- package/dist/commands/functions/test.js +25 -16
- package/dist/config.d.ts +1 -0
- package/dist/config.js +10 -4
- package/dist/server/app.js +2 -2
- package/dist/server/static/api.js +43 -38
- package/dist/server/static/components/api-base.js +7 -6
- package/dist/server/static/components/function-list.js +48 -44
- package/dist/server/static/components/network-spinner.js +7 -6
- package/dist/server/static/components/payload-panel.js +36 -32
- package/dist/server/static/components/response-panel.js +64 -50
- package/dist/server/static/vendor/vendor.bundle.js +1029 -913
- package/dist/utils/display/blueprints-formatting.d.ts +3 -1
- package/dist/utils/display/blueprints-formatting.js +27 -2
- package/dist/utils/display/logs-formatting.d.ts +5 -0
- package/dist/utils/display/logs-formatting.js +50 -0
- package/dist/utils/find-function.d.ts +2 -0
- package/dist/utils/find-function.js +6 -0
- package/dist/utils/types.d.ts +0 -1
- package/oclif.manifest.json +120 -31
- package/package.json +10 -10
- package/dist/server/static/static/api.js +0 -53
- package/dist/server/static/static/components/api-base.js +0 -10
- package/dist/server/static/static/components/function-list.js +0 -54
- package/dist/server/static/static/components/network-spinner.js +0 -71
- package/dist/server/static/static/components/payload-panel.js +0 -45
- package/dist/server/static/static/components/response-panel.js +0 -83
- package/dist/server/static/static/vendor/vendor.bundle.js +0 -26879
- package/dist/utils/spinner.d.ts +0 -9
- package/dist/utils/spinner.js +0 -25
- /package/dist/server/static/{static/components → components}/app.css +0 -0
- /package/dist/server/static/{static/index.html → index.html} +0 -0
- /package/dist/server/static/{static/sanity-logo-sm.svg → sanity-logo-sm.svg} +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-dom-node-text-content */
|
|
2
|
-
/* globals customElements document */
|
|
3
|
-
import {
|
|
4
|
-
EditorState,
|
|
5
|
-
EditorView,
|
|
6
|
-
basicSetup,
|
|
7
|
-
json,
|
|
8
|
-
prettyBytes,
|
|
9
|
-
prettyMilliseconds,
|
|
10
|
-
} from '../vendor/vendor.bundle.js'
|
|
11
|
-
import {ApiBaseElement} from './api-base.js'
|
|
12
|
-
|
|
13
|
-
const template = `<m-box>
|
|
14
|
-
<m-tabs role="tablist">
|
|
15
|
-
<button id="a" role="tab" aria-selected="true">Response</button>
|
|
16
|
-
<button id="b" role="tab">Console</button>
|
|
17
|
-
</m-tabs>
|
|
18
|
-
<div role="tabpanel" data-tab-id="a" class="pad-t-sm">
|
|
19
|
-
<div class="mar-b-sm">
|
|
20
|
-
<span id="time"></span> <span id="size"></span>
|
|
21
|
-
</div>
|
|
22
|
-
<div id="response" name="response"></div>
|
|
23
|
-
</div>
|
|
24
|
-
<div role="tabpanel" data-tab-id="b" class="pad-t-sm" hidden><pre></pre></div>
|
|
25
|
-
</m-box>
|
|
26
|
-
`
|
|
27
|
-
class ResponsePanel extends ApiBaseElement {
|
|
28
|
-
switchTab = (e) => {
|
|
29
|
-
const selectedTabId = e.target.closest('[role=tab]').id
|
|
30
|
-
|
|
31
|
-
// Select the tab and its panel
|
|
32
|
-
for (const tab of e.currentTarget.querySelectorAll('[role=tab]')) {
|
|
33
|
-
tab.ariaSelected = tab.id === selectedTabId
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
for (const panel of document.querySelectorAll('[role=tabpanel')) {
|
|
37
|
-
panel.hidden = panel.dataset.tabId !== selectedTabId
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
updateResponse = ({result}) => {
|
|
41
|
-
const {error, json, logs, time} = result
|
|
42
|
-
if (!error) {
|
|
43
|
-
const transaction = this.api.store.response.state.update({
|
|
44
|
-
changes: {
|
|
45
|
-
from: 0,
|
|
46
|
-
insert: JSON.stringify(json, null, 2),
|
|
47
|
-
to: this.api.store.response.state.doc.length,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
this.api.store.response.dispatch(transaction)
|
|
51
|
-
|
|
52
|
-
this.size.innerText = json ? prettyBytes(JSON.stringify(json).length) : ''
|
|
53
|
-
this.time.innerText = prettyMilliseconds(time)
|
|
54
|
-
this.consoleTab.innerText = logs
|
|
55
|
-
} else {
|
|
56
|
-
this.consoleTab.innerText = error?.details?.error
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
connectedCallback() {
|
|
61
|
-
this.innerHTML = template
|
|
62
|
-
this.response = this.querySelector('#response')
|
|
63
|
-
this.size = this.querySelector('#size')
|
|
64
|
-
this.time = this.querySelector('#time')
|
|
65
|
-
this.consoleTab = this.querySelector('pre')
|
|
66
|
-
this.tabs = this.querySelector('m-tabs')
|
|
67
|
-
this.tabs.addEventListener('click', this.switchTab)
|
|
68
|
-
this.api.subscribe(this.updateResponse, ['result'])
|
|
69
|
-
|
|
70
|
-
this.api.store.response = new EditorView({
|
|
71
|
-
doc: '\n\n\n\n',
|
|
72
|
-
extensions: [basicSetup, json(), EditorState.readOnly.of(true)],
|
|
73
|
-
parent: this.response,
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
disconnectedCallback() {
|
|
78
|
-
this.tabs.removeEventListener('click', this.switchTab)
|
|
79
|
-
this.api.unsubscribe(this.updateResponse)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
customElements.define('response-panel', ResponsePanel)
|