@sanity/runtime-cli 4.3.3 → 4.3.5-bundle.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/actions/blueprints/assets.d.ts +1 -0
- package/dist/actions/blueprints/assets.js +21 -4
- package/dist/actions/functions/test.d.ts +2 -2
- package/dist/actions/functions/test.js +2 -2
- package/dist/commands/blueprints/config.d.ts +1 -1
- package/dist/commands/blueprints/config.js +8 -8
- package/dist/commands/blueprints/deploy.js +3 -4
- package/dist/commands/blueprints/init.d.ts +1 -1
- package/dist/commands/blueprints/init.js +8 -8
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/logs.js +8 -8
- package/dist/commands/functions/test.js +3 -6
- package/dist/server/app.js +80 -12
- package/dist/server/static/api.js +24 -3
- package/dist/server/static/components/app.css +915 -54
- package/dist/server/static/components/dataset-dropdown.js +5 -3
- package/dist/server/static/components/filters.d.ts +1 -0
- package/dist/server/static/components/filters.js +20 -0
- package/dist/server/static/components/function-list.js +7 -7
- package/dist/server/static/components/payload-panel.js +18 -17
- package/dist/server/static/components/projects-dropdown.js +5 -3
- package/dist/server/static/components/response-panel.js +38 -28
- package/dist/server/static/index.html +11 -30
- package/dist/server/static/vendor/vendor.bundle.d.ts +2 -2
- package/dist/utils/build-payload.d.ts +1 -1
- package/dist/utils/build-payload.js +3 -3
- package/dist/utils/bundle/bundle-function.d.ts +8 -0
- package/dist/utils/bundle/bundle-function.js +125 -0
- package/dist/utils/bundle/cleanup-source-maps.d.ts +10 -0
- package/dist/utils/bundle/cleanup-source-maps.js +53 -0
- package/dist/utils/bundle/find-up.d.ts +16 -0
- package/dist/utils/bundle/find-up.js +39 -0
- package/dist/utils/bundle/verify-handler.d.ts +2 -0
- package/dist/utils/bundle/verify-handler.js +13 -0
- package/dist/utils/child-process-wrapper.js +8 -6
- package/dist/utils/functions/find-entry-point.d.ts +11 -0
- package/dist/utils/functions/find-entry-point.js +75 -0
- package/dist/utils/functions/should-bundle.d.ts +2 -0
- package/dist/utils/functions/should-bundle.js +23 -0
- package/dist/utils/invoke-local.d.ts +2 -2
- package/dist/utils/invoke-local.js +48 -7
- package/dist/utils/is-record.d.ts +1 -0
- package/dist/utils/is-record.js +3 -0
- package/dist/utils/parse-json-object.d.ts +1 -0
- package/dist/utils/parse-json-object.js +10 -0
- package/dist/utils/types.d.ts +3 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -1
- package/dist/utils/is-json.d.ts +0 -1
- package/dist/utils/is-json.js +0 -12
|
@@ -30,12 +30,15 @@ function invoke(payloadText = '{}') {
|
|
|
30
30
|
},
|
|
31
31
|
method: 'POST',
|
|
32
32
|
})
|
|
33
|
-
.then((response) =>
|
|
34
|
-
|
|
33
|
+
.then((response) => {
|
|
34
|
+
return response.json().then((data) => ({data, timings: getServerTimings(response)}))
|
|
35
|
+
})
|
|
36
|
+
.then(({data, timings}) => {
|
|
35
37
|
store.inprogress = false
|
|
36
38
|
store.result = {
|
|
37
39
|
...data,
|
|
38
40
|
time: Date.now() - start,
|
|
41
|
+
timings,
|
|
39
42
|
}
|
|
40
43
|
})
|
|
41
44
|
}
|
|
@@ -47,7 +50,7 @@ function blueprint() {
|
|
|
47
50
|
const functions = blueprint?.resources.filter((r) => r.type.startsWith('sanity.function.'))
|
|
48
51
|
|
|
49
52
|
store.functions = functions
|
|
50
|
-
store.selectedIndex = functions[0].
|
|
53
|
+
store.selectedIndex = functions[0].name
|
|
51
54
|
})
|
|
52
55
|
.catch(() => {
|
|
53
56
|
store.functions = []
|
|
@@ -77,3 +80,21 @@ function datasets(selectedProject) {
|
|
|
77
80
|
store.datasets = []
|
|
78
81
|
})
|
|
79
82
|
}
|
|
83
|
+
|
|
84
|
+
function getServerTimings(response) {
|
|
85
|
+
const timings = {}
|
|
86
|
+
const serverTiming = response.headers.get('Server-Timing')
|
|
87
|
+
if (!serverTiming) {
|
|
88
|
+
return timings
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for (const entry of serverTiming.split(',')) {
|
|
92
|
+
const [name, ...params] = entry.split(';')
|
|
93
|
+
const durationParam = params.find((p) => p.startsWith('dur='))
|
|
94
|
+
if (durationParam) {
|
|
95
|
+
timings[name.trim()] = Number.parseFloat(durationParam.slice(4))
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return timings
|
|
100
|
+
}
|