@scayle/storefront-devtools 0.2.0-alpha.1 → 0.2.0-alpha.2
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/CHANGELOG.md +10 -0
- package/README.md +113 -83
- package/dist/_chunks/coalesce-cmmfn4qq.mjs +1585 -0
- package/dist/group.d.ts +29 -21
- package/dist/group.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +40 -65
- package/dist/inertia/channel.d.ts +54 -0
- package/dist/inertia/channel.d.ts.map +1 -0
- package/dist/inertia/client/index.d.ts +1 -6
- package/dist/inertia/client/index.d.ts.map +1 -1
- package/dist/inertia/client/index.mjs +246 -109
- package/dist/inertia/client/publish.d.ts +24 -0
- package/dist/inertia/client/publish.d.ts.map +1 -0
- package/dist/inertia/core/network.d.ts +1 -1
- package/dist/inertia/core/network.d.ts.map +1 -1
- package/dist/inertia/core/response.d.ts +3 -3
- package/dist/inertia/core/response.d.ts.map +1 -1
- package/dist/inertia/plugin.d.ts +8 -6
- package/dist/inertia/plugin.d.ts.map +1 -1
- package/dist/orpc/channel.d.ts +29 -0
- package/dist/orpc/channel.d.ts.map +1 -0
- package/dist/orpc/client/index.d.ts +1 -6
- package/dist/orpc/client/index.d.ts.map +1 -1
- package/dist/orpc/client/index.mjs +152 -137
- package/dist/orpc/client/publish.d.ts +15 -0
- package/dist/orpc/client/publish.d.ts.map +1 -0
- package/dist/orpc/core/serialize.d.ts +1 -1
- package/dist/orpc/core/stats.d.ts +10 -0
- package/dist/orpc/core/stats.d.ts.map +1 -0
- package/dist/orpc/core/store.d.ts +1 -2
- package/dist/orpc/core/store.d.ts.map +1 -1
- package/dist/orpc/plugin.d.ts +8 -5
- package/dist/orpc/plugin.d.ts.map +1 -1
- package/dist/shared/clipboard.d.ts +2 -3
- package/dist/shared/clipboard.d.ts.map +1 -1
- package/dist/shared/coalesce.d.ts +14 -0
- package/dist/shared/coalesce.d.ts.map +1 -0
- package/dist/shared/panel-channel.d.ts +49 -0
- package/dist/shared/panel-channel.d.ts.map +1 -0
- package/dist/shared/publish-options.d.ts +13 -0
- package/dist/shared/publish-options.d.ts.map +1 -0
- package/dist/shared/safe-clone.d.ts +2 -1
- package/dist/shared/safe-clone.d.ts.map +1 -1
- package/dist/storefront/plugin.d.ts +6 -4
- package/dist/storefront/plugin.d.ts.map +1 -1
- package/dist/ui/assets/App-BlEKD1MK.js +4 -0
- package/dist/ui/assets/App-C1rr07m5.js +1 -0
- package/dist/ui/assets/App-C5-JscO0.css +1 -0
- package/dist/ui/assets/App-M0iU7c4p.css +1 -0
- package/dist/ui/assets/App-VElUrn9P.js +5 -0
- package/dist/ui/assets/App-jiQKInbo.css +1 -0
- package/dist/ui/assets/_plugin-vue_export-helper-BDNMzG2s.js +1 -0
- package/dist/ui/assets/channel-D7V7aU79.js +1 -0
- package/dist/ui/assets/clipboard-BnEeWyfh.css +1 -0
- package/dist/ui/assets/clipboard-n-T06WI3.js +1 -0
- package/dist/ui/assets/panel-channel-DjMENemf.js +2 -0
- package/dist/ui/assets/panels-B4LTsmli.css +1 -0
- package/dist/ui/assets/panels-BLV_p6Kz.js +2 -0
- package/dist/ui/assets/preload-helper-J6bGWMBq.js +2 -0
- package/dist/{vue-devtools/ui/assets/index-Dby9TIQH.js → ui/assets/vue-BAMMushd.js} +19 -20
- package/dist/{vue-devtools/ui/assets/index-sSkqWPzY.css → ui/assets/vue-Kq4tvBbL.css} +1 -1
- package/dist/ui/panels/index.html +15 -0
- package/dist/{vue-devtools/ui → ui/vue}/index.html +4 -2
- package/dist/vue-devtools/client/index.mjs +0 -1
- package/dist/vue-devtools/plugin.d.ts +10 -9
- package/dist/vue-devtools/plugin.d.ts.map +1 -1
- package/package.json +11 -29
- package/dist/_chunks/clipboard-DrVHc2QA.mjs +0 -61
- package/dist/_chunks/diff-DzJ5arJj.mjs +0 -169
- package/dist/_chunks/panel-uV5ITqhY.mjs +0 -51
- package/dist/_chunks/redact-DmIF-iyk.mjs +0 -96
- package/dist/_chunks/useStore-Db8RZW8T.mjs +0 -10
- package/dist/inertia/client/index.d.mts +0 -13
- package/dist/inertia/renderer/index.d.mts +0 -16
- package/dist/inertia/renderer/index.mjs +0 -771
- package/dist/orpc/client/index.d.mts +0 -13
- package/dist/orpc/renderer/index.d.mts +0 -16
- package/dist/orpc/renderer/index.mjs +0 -457
- package/dist/resource-center/client/index.mjs +0 -21
- package/dist/resource-center/client.d.ts +0 -3
- package/dist/resource-center/client.d.ts.map +0 -1
- package/dist/resource-center/plugin.d.ts +0 -12
- package/dist/resource-center/plugin.d.ts.map +0 -1
- package/dist/shared/use-window-store.d.ts +0 -18
- package/dist/shared/use-window-store.d.ts.map +0 -1
- package/dist/storefront/renderer/index.d.mts +0 -16
- package/dist/storefront/renderer/index.mjs +0 -124
- /package/dist/{vue-devtools/ui → ui}/assets/css-8QJvnqUH.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/css-CaJ9TzKE.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/diff-woXpYk--.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/html-BHDw6EPc.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/html-GueGcY0x.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/javascript-BzbQS41l.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/javascript-Yelw-5ZN.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/json-B88Oqtu5.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/json-CaljABEy.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/shellscript-CLZ0U2zV.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/typescript-Utq2Cl8c.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/typescript-j_1H8WHN.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/vitesse-dark-BZCL-v6S.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/vitesse-light-VbXTXTou.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/vue-B1Tf5CHw.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/vue-html-CGMs_6qn.js +0 -0
- /package/dist/{vue-devtools/ui → ui}/assets/yaml-rwi0_p6S.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestRecord } from './types';
|
|
2
|
-
/** How a response prop key actually arrived
|
|
2
|
+
/** How a response prop key actually arrived in the response, for the Response view. */
|
|
3
3
|
export type ResponseArrivalKind = 'full' | 'partial' | 'deferred' | 'merged' | 'prepended' | 'deep-merged';
|
|
4
4
|
/** One prop key the response body actually included, tagged by arrival kind. */
|
|
5
5
|
export interface ResponseEntry {
|
|
@@ -25,11 +25,11 @@ export interface ResponseBreakdown {
|
|
|
25
25
|
* over from the previous page untouched by this response.
|
|
26
26
|
*
|
|
27
27
|
* Unlike a before/after diff, this never looks at the previous page's props
|
|
28
|
-
* for its main output: `record.responseProps` is the raw
|
|
28
|
+
* for its main output: `record.responseProps` is the raw response payload, so a
|
|
29
29
|
* key it doesn't contain genuinely wasn't sent for this request, whether or
|
|
30
30
|
* not the client's merged page still shows it.
|
|
31
31
|
*
|
|
32
|
-
* @param record - The request record. Uses `responseProps` (the parsed
|
|
32
|
+
* @param record - The request record. Uses `responseProps` (the parsed response
|
|
33
33
|
* body), falling back to nothing if the interceptor never captured it.
|
|
34
34
|
* @returns The classified breakdown, or `null` if no response body was
|
|
35
35
|
* captured for this request (for example a cancelled visit, or Inertia's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/inertia/core/response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAC7B,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAA;AAE1E,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,mBAAmB,CAAA;CAC1B;AAED,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,qFAAqF;IACrF,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAyBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,GACpB,iBAAiB,GAAG,IAAI,CAyB1B"}
|
package/dist/inertia/plugin.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
/**
|
|
3
|
-
* Creates the Vite plugin that registers the Inertia devtools panel:
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
3
|
+
* Creates the Vite plugin that registers the Inertia devtools panel: an
|
|
4
|
+
* iframe dock entry that loads the panel app's `inertia` view. The view
|
|
5
|
+
* gets the capture from the Inertia page script over the
|
|
6
|
+
* `storefront-devtools:inertia` channel. The page script itself is
|
|
7
|
+
* injected into the app entry alongside the other panels' clients; see
|
|
8
|
+
* `src/index.ts`.
|
|
9
|
+
*
|
|
10
|
+
* @returns A Vite plugin that registers the Inertia.js dock entry.
|
|
9
11
|
*/
|
|
10
12
|
export declare function createInertiaPlugin(): Plugin;
|
|
11
13
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/inertia/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AASlC
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/inertia/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AASlC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAO5C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InPageChannelProtocol } from 'devframe/in-page-channel';
|
|
2
|
+
import { OrpcCall, OrpcCallSummary } from './core/types';
|
|
3
|
+
/** Channel between the oRPC page script and the oRPC panel. */
|
|
4
|
+
export declare const ORPC_CHANNEL = "storefront-devtools:orpc";
|
|
5
|
+
/** Snapshot of the oRPC capture that the page script sends to the oRPC panel. */
|
|
6
|
+
export interface OrpcPanelState {
|
|
7
|
+
/** Captured calls, oldest first. */
|
|
8
|
+
calls: OrpcCall[];
|
|
9
|
+
/** Whether capture is paused. */
|
|
10
|
+
paused: boolean;
|
|
11
|
+
/** Summaries from the previous page load, empty after Clear or when none were saved. */
|
|
12
|
+
previousSession: OrpcCallSummary[];
|
|
13
|
+
}
|
|
14
|
+
/** Contract of {@link ORPC_CHANNEL}. */
|
|
15
|
+
export interface OrpcChannelProtocol extends InPageChannelProtocol {
|
|
16
|
+
functions: {
|
|
17
|
+
pageScript: {
|
|
18
|
+
getState: () => OrpcPanelState;
|
|
19
|
+
clear: () => void;
|
|
20
|
+
setPaused: (paused: boolean) => void;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
events: {
|
|
24
|
+
panel: {
|
|
25
|
+
state: (state: OrpcPanelState) => void;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/orpc/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE7D,+DAA+D;AAC/D,eAAO,MAAM,YAAY,6BAA6B,CAAA;AAEtD,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAA;IACf,wFAAwF;IACxF,eAAe,EAAE,eAAe,EAAE,CAAA;CACnC;AAED,wCAAwC;AACxC,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,SAAS,EAAE;QACT,UAAU,EAAE;YACV,QAAQ,EAAE,MAAM,cAAc,CAAA;YAC9B,KAAK,EAAE,MAAM,IAAI,CAAA;YACjB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;SACrC,CAAA;KACF,CAAA;IACD,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAA;SACvC,CAAA;KACF,CAAA;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orpc/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orpc/client/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, t as o } from "../../_chunks/coalesce-cmmfn4qq.mjs";
|
|
2
2
|
//#region src/orpc/core/session.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
3
|
+
var s = t("orpc-devtools-session");
|
|
4
|
+
function c(e) {
|
|
5
5
|
return {
|
|
6
6
|
id: e.id,
|
|
7
7
|
procedure: e.procedure,
|
|
@@ -11,28 +11,28 @@ function o(e) {
|
|
|
11
11
|
errorKind: e.errorKind
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
14
|
+
function l(e) {
|
|
15
|
+
s.save({
|
|
16
16
|
savedAt: Date.now(),
|
|
17
|
-
calls: e.map(
|
|
17
|
+
calls: e.map(c)
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function u() {
|
|
21
|
+
return s.load();
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function d() {
|
|
24
|
+
s.clear();
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/orpc/core/store.ts
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
return e
|
|
28
|
+
var f = 200, p = { redactKey: n };
|
|
29
|
+
function m(e) {
|
|
30
|
+
return i(e, p);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function h(e, t) {
|
|
33
|
+
return i(t, { redactKey: a(e) });
|
|
34
34
|
}
|
|
35
|
-
var
|
|
35
|
+
var g = class {
|
|
36
36
|
ordered = [];
|
|
37
37
|
maxCalls;
|
|
38
38
|
nextId = 1;
|
|
@@ -40,8 +40,8 @@ var m = class {
|
|
|
40
40
|
subscribers = /* @__PURE__ */ new Set();
|
|
41
41
|
previousSession = null;
|
|
42
42
|
saveTimer;
|
|
43
|
-
constructor(e =
|
|
44
|
-
this.maxCalls = e, this.previousSession =
|
|
43
|
+
constructor(e = f) {
|
|
44
|
+
this.maxCalls = e, this.previousSession = u();
|
|
45
45
|
}
|
|
46
46
|
get calls() {
|
|
47
47
|
return this.ordered.slice();
|
|
@@ -58,45 +58,23 @@ var m = class {
|
|
|
58
58
|
paused: this._paused
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
startCall(
|
|
61
|
+
startCall(t) {
|
|
62
62
|
if (this._paused) return -1;
|
|
63
|
-
let
|
|
64
|
-
id:
|
|
65
|
-
procedure:
|
|
66
|
-
method:
|
|
67
|
-
url:
|
|
68
|
-
input:
|
|
69
|
-
rawInput:
|
|
70
|
-
headers:
|
|
63
|
+
let n = this.nextId++, r = {
|
|
64
|
+
id: n,
|
|
65
|
+
procedure: t.procedure,
|
|
66
|
+
method: t.method,
|
|
67
|
+
url: t.url,
|
|
68
|
+
input: h(t.procedure, t.input),
|
|
69
|
+
rawInput: h(t.procedure, t.rawInput),
|
|
70
|
+
headers: t.headers ? e(t.headers) : void 0,
|
|
71
71
|
startedAt: performance.now()
|
|
72
72
|
};
|
|
73
|
-
return this.ordered.push(
|
|
73
|
+
return this.ordered.push(r), this.ordered.length > this.maxCalls && this.evictOldest(), this.notify(), n;
|
|
74
74
|
}
|
|
75
75
|
finishCall(e, t) {
|
|
76
76
|
let n = this.ordered.find((t) => t.id === e);
|
|
77
|
-
n && (n.finishedAt = performance.now(), n.duration = n.finishedAt - n.startedAt, n.status = t.status, n.ok = t.ok, n.output =
|
|
78
|
-
}
|
|
79
|
-
getProcedureStats() {
|
|
80
|
-
let e = /* @__PURE__ */ new Map();
|
|
81
|
-
for (let t of this.ordered) {
|
|
82
|
-
let n = e.get(t.procedure) ?? {
|
|
83
|
-
count: 0,
|
|
84
|
-
errors: 0,
|
|
85
|
-
total: 0,
|
|
86
|
-
last: 0,
|
|
87
|
-
durations: 0
|
|
88
|
-
};
|
|
89
|
-
n.count++, t.ok === !1 && n.errors++, t.duration != null && (n.total += t.duration, n.durations++, n.last = t.duration), e.set(t.procedure, n);
|
|
90
|
-
}
|
|
91
|
-
let t = [];
|
|
92
|
-
for (let [n, r] of e) t.push({
|
|
93
|
-
procedure: n,
|
|
94
|
-
count: r.count,
|
|
95
|
-
errorCount: r.errors,
|
|
96
|
-
avgDuration: r.durations > 0 ? r.total / r.durations : 0,
|
|
97
|
-
lastDuration: r.last
|
|
98
|
-
});
|
|
99
|
-
return t;
|
|
77
|
+
n && (n.finishedAt = performance.now(), n.duration = n.finishedAt - n.startedAt, n.status = t.status, n.ok = t.ok, n.output = m(t.output), n.error = m(t.error), n.errorKind = t.errorKind, n.streaming = t.streaming, n.rawOutput = m(t.rawOutput), n.rawError = m(t.rawError), n.responseHeaders = t.responseHeaders, this.notify());
|
|
100
78
|
}
|
|
101
79
|
subscribe(e) {
|
|
102
80
|
return this.subscribers.add(e), () => {
|
|
@@ -107,7 +85,7 @@ var m = class {
|
|
|
107
85
|
this._paused = e, this.notify();
|
|
108
86
|
}
|
|
109
87
|
clear() {
|
|
110
|
-
this.ordered = [], this.nextId = 1,
|
|
88
|
+
this.ordered = [], this.nextId = 1, d(), this.previousSession = null, this.notify();
|
|
111
89
|
}
|
|
112
90
|
evictOldest() {
|
|
113
91
|
let e = this.ordered.findIndex((e) => e.finishedAt != null);
|
|
@@ -120,41 +98,41 @@ var m = class {
|
|
|
120
98
|
} catch (e) {
|
|
121
99
|
console.warn("[storefront-devtools] oRPC subscriber error:", e);
|
|
122
100
|
}
|
|
123
|
-
clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() =>
|
|
101
|
+
clearTimeout(this.saveTimer), this.saveTimer = setTimeout(() => l(this.ordered), 1e3);
|
|
124
102
|
}
|
|
125
|
-
},
|
|
126
|
-
function
|
|
103
|
+
}, _ = /^\/+/;
|
|
104
|
+
function v(e, t) {
|
|
127
105
|
let n;
|
|
128
106
|
try {
|
|
129
107
|
n = new URL(e, "http://localhost").pathname;
|
|
130
108
|
} catch {
|
|
131
109
|
n = e;
|
|
132
110
|
}
|
|
133
|
-
let r =
|
|
134
|
-
return n.startsWith(r) ?
|
|
111
|
+
let r = y(t);
|
|
112
|
+
return n.startsWith(r) ? y(n.slice(r.length).replace(_, "")) : null;
|
|
135
113
|
}
|
|
136
|
-
function
|
|
114
|
+
function y(e) {
|
|
137
115
|
let t = e.length;
|
|
138
116
|
for (; t > 0 && e[t - 1] === "/";) t--;
|
|
139
117
|
return e.slice(0, t);
|
|
140
118
|
}
|
|
141
119
|
//#endregion
|
|
142
120
|
//#region src/orpc/core/classify.ts
|
|
143
|
-
function
|
|
121
|
+
function b(e) {
|
|
144
122
|
if (typeof e == "object" && e && "code" in e) {
|
|
145
123
|
let t = e.code;
|
|
146
124
|
return typeof t == "string" ? t : void 0;
|
|
147
125
|
}
|
|
148
126
|
}
|
|
149
|
-
function
|
|
150
|
-
return n ? "network" : e === 422 ||
|
|
127
|
+
function x(e, t, n) {
|
|
128
|
+
return n ? "network" : e === 422 || b(t) === "INPUT_VALIDATION_FAILED" ? "validation" : "server";
|
|
151
129
|
}
|
|
152
|
-
function
|
|
130
|
+
function S(e) {
|
|
153
131
|
if (!e || typeof e != "object") return !1;
|
|
154
132
|
let t = Object.getPrototypeOf(e);
|
|
155
133
|
return t === Object.prototype || !t || !t.constructor;
|
|
156
134
|
}
|
|
157
|
-
function
|
|
135
|
+
function C(e, t, n) {
|
|
158
136
|
t === "__proto__" ? Object.defineProperty(e, t, {
|
|
159
137
|
value: n,
|
|
160
138
|
writable: !0,
|
|
@@ -162,20 +140,20 @@ function x(e, t, n) {
|
|
|
162
140
|
configurable: !0
|
|
163
141
|
}) : e[t] = n;
|
|
164
142
|
}
|
|
165
|
-
function
|
|
143
|
+
function w(e, t, n) {
|
|
166
144
|
let r = e[t];
|
|
167
145
|
if (r !== n) return r;
|
|
168
146
|
let i;
|
|
169
147
|
if (Array.isArray(r)) i = r.slice();
|
|
170
|
-
else if (
|
|
148
|
+
else if (S(r)) i = { ...r };
|
|
171
149
|
else return r;
|
|
172
|
-
return
|
|
150
|
+
return C(e, t, i), i;
|
|
173
151
|
}
|
|
174
|
-
var
|
|
175
|
-
function
|
|
176
|
-
return
|
|
152
|
+
var T = /^[dgimsuvy]*$/;
|
|
153
|
+
function E(e) {
|
|
154
|
+
return T.test(e) && new Set(e).size === e.length && !(e.includes("u") && e.includes("v"));
|
|
177
155
|
}
|
|
178
|
-
function
|
|
156
|
+
function D(e, t) {
|
|
179
157
|
let n, r = 0, i = () => (n === void 0 && (n = new RegExp(e, t), n.lastIndex = r), n);
|
|
180
158
|
return new Proxy(Object.create(RegExp.prototype), {
|
|
181
159
|
get(e, t) {
|
|
@@ -198,8 +176,8 @@ function T(e, t) {
|
|
|
198
176
|
});
|
|
199
177
|
}
|
|
200
178
|
//#endregion
|
|
201
|
-
//#region ../../../node_modules/.pnpm/@orpc+client@1.15.
|
|
202
|
-
var
|
|
179
|
+
//#region ../../../node_modules/.pnpm/@orpc+client@1.15.4_@opentelemetry+api@1.9.1/node_modules/@orpc/client/dist/shared/client.BrcgsQH9.mjs
|
|
180
|
+
var O = {
|
|
203
181
|
BIGINT: 0,
|
|
204
182
|
DATE: 1,
|
|
205
183
|
NAN: 2,
|
|
@@ -208,16 +186,16 @@ var E = {
|
|
|
208
186
|
REGEXP: 5,
|
|
209
187
|
SET: 6,
|
|
210
188
|
MAP: 7
|
|
211
|
-
},
|
|
212
|
-
function
|
|
189
|
+
}, k = new Set(Object.values(O)), A = /^\/(.*)\/([a-z]*)$/;
|
|
190
|
+
function j(e) {
|
|
213
191
|
return /* @__PURE__ */ TypeError(`Invalid RPC serialized data: ${e}`);
|
|
214
192
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
193
|
+
function M(e, t, n) {
|
|
194
|
+
return j(`type ${e} (${t}) expects ${n}.`);
|
|
217
195
|
}
|
|
218
196
|
//#endregion
|
|
219
197
|
//#region src/orpc/core/serialize.ts
|
|
220
|
-
var
|
|
198
|
+
var N = new class {
|
|
221
199
|
customSerializers;
|
|
222
200
|
constructor(e = {}) {
|
|
223
201
|
if (this.customSerializers = e.customJsonSerializers ?? [], this.customSerializers.length !== new Set(this.customSerializers.map((e) => e.type)).size) throw Error("Custom serializer type must be unique.");
|
|
@@ -233,13 +211,13 @@ var j = new class {
|
|
|
233
211
|
r,
|
|
234
212
|
i
|
|
235
213
|
];
|
|
236
|
-
if (typeof e == "bigint") return n.push([
|
|
214
|
+
if (typeof e == "bigint") return n.push([O.BIGINT, ...t]), [
|
|
237
215
|
e.toString(),
|
|
238
216
|
n,
|
|
239
217
|
r,
|
|
240
218
|
i
|
|
241
219
|
];
|
|
242
|
-
if (e instanceof Date) return n.push([
|
|
220
|
+
if (e instanceof Date) return n.push([O.DATE, ...t]), Number.isNaN(e.getTime()) ? [
|
|
243
221
|
null,
|
|
244
222
|
n,
|
|
245
223
|
r,
|
|
@@ -250,19 +228,19 @@ var j = new class {
|
|
|
250
228
|
r,
|
|
251
229
|
i
|
|
252
230
|
];
|
|
253
|
-
if (Number.isNaN(e)) return n.push([
|
|
231
|
+
if (Number.isNaN(e)) return n.push([O.NAN, ...t]), [
|
|
254
232
|
null,
|
|
255
233
|
n,
|
|
256
234
|
r,
|
|
257
235
|
i
|
|
258
236
|
];
|
|
259
|
-
if (e instanceof URL) return n.push([
|
|
237
|
+
if (e instanceof URL) return n.push([O.URL, ...t]), [
|
|
260
238
|
e.toString(),
|
|
261
239
|
n,
|
|
262
240
|
r,
|
|
263
241
|
i
|
|
264
242
|
];
|
|
265
|
-
if (e instanceof RegExp) return n.push([
|
|
243
|
+
if (e instanceof RegExp) return n.push([O.REGEXP, ...t]), [
|
|
266
244
|
e.toString(),
|
|
267
245
|
n,
|
|
268
246
|
r,
|
|
@@ -270,15 +248,15 @@ var j = new class {
|
|
|
270
248
|
];
|
|
271
249
|
if (e instanceof Set) {
|
|
272
250
|
let a = this.serialize(Array.from(e), t, n, r, i);
|
|
273
|
-
return n.push([
|
|
251
|
+
return n.push([O.SET, ...t]), a;
|
|
274
252
|
}
|
|
275
253
|
if (e instanceof Map) {
|
|
276
254
|
let a = this.serialize(Array.from(e.entries()), t, n, r, i);
|
|
277
|
-
return n.push([
|
|
255
|
+
return n.push([O.MAP, ...t]), a;
|
|
278
256
|
}
|
|
279
257
|
if (Array.isArray(e)) return [
|
|
280
258
|
e.map((e, a) => e === void 0 ? (n.push([
|
|
281
|
-
|
|
259
|
+
O.UNDEFINED,
|
|
282
260
|
...t,
|
|
283
261
|
a
|
|
284
262
|
]), null) : this.serialize(e, [...t, a], n, r, i)[0]),
|
|
@@ -286,7 +264,7 @@ var j = new class {
|
|
|
286
264
|
r,
|
|
287
265
|
i
|
|
288
266
|
];
|
|
289
|
-
if (
|
|
267
|
+
if (S(e)) {
|
|
290
268
|
let a = {};
|
|
291
269
|
for (let o in e) (o !== "toJSON" || typeof e[o] != "function") && (a[o] = this.serialize(e[o], [...t, o], n, r, i)[0]);
|
|
292
270
|
return [
|
|
@@ -306,75 +284,77 @@ var j = new class {
|
|
|
306
284
|
deserialize(e, t, n, r) {
|
|
307
285
|
let i = { data: e }, a = { data: e };
|
|
308
286
|
n && r && n.forEach((e, t) => {
|
|
309
|
-
let n =
|
|
287
|
+
let n = r(t);
|
|
288
|
+
if (!(n instanceof Blob)) throw j(`blob ${t} is not a Blob.`);
|
|
289
|
+
let o = a, s = i, c = "data";
|
|
310
290
|
e.forEach((e) => {
|
|
311
|
-
if (
|
|
312
|
-
}),
|
|
291
|
+
if (o = o[c], s = w(s, c, o), c = e, !Object.hasOwn(s, c)) throw j(`segment "${c}" does not exist.`);
|
|
292
|
+
}), s[c] = n;
|
|
313
293
|
});
|
|
314
294
|
for (let e of t) {
|
|
315
295
|
let t = e[0], n = this.customSerializers.find((e) => e.type === t);
|
|
316
|
-
if (n === void 0 && !
|
|
296
|
+
if (n === void 0 && !k.has(t)) continue;
|
|
317
297
|
let r = a, o = i, s = "data";
|
|
318
|
-
for (let t = 1; t < e.length; t++) if (r = r[s], o =
|
|
298
|
+
for (let t = 1; t < e.length; t++) if (r = r[s], o = w(o, s, r), s = e[t], !Object.hasOwn(o, s)) throw j(`segment "${s}" does not exist.`);
|
|
319
299
|
if (n !== void 0) {
|
|
320
300
|
o[s] = n.deserialize(o[s]);
|
|
321
301
|
continue;
|
|
322
302
|
}
|
|
323
303
|
let c = o[s];
|
|
324
304
|
switch (t) {
|
|
325
|
-
case
|
|
326
|
-
if (typeof c != "string") throw
|
|
305
|
+
case O.BIGINT:
|
|
306
|
+
if (typeof c != "string") throw M(t, "bigint", "a string");
|
|
327
307
|
o[s] = BigInt(c);
|
|
328
308
|
break;
|
|
329
|
-
case
|
|
330
|
-
if (typeof c != "string" && c !== null) throw
|
|
309
|
+
case O.DATE:
|
|
310
|
+
if (typeof c != "string" && c !== null) throw M(t, "date", "a string or null");
|
|
331
311
|
o[s] = new Date(c ?? NaN);
|
|
332
312
|
break;
|
|
333
|
-
case
|
|
334
|
-
if (c !== null) throw
|
|
313
|
+
case O.NAN:
|
|
314
|
+
if (c !== null) throw M(t, "nan", "null");
|
|
335
315
|
o[s] = NaN;
|
|
336
316
|
break;
|
|
337
|
-
case
|
|
338
|
-
if (c !== null) throw
|
|
317
|
+
case O.UNDEFINED:
|
|
318
|
+
if (c !== null) throw M(t, "undefined", "null");
|
|
339
319
|
o[s] = void 0;
|
|
340
320
|
break;
|
|
341
|
-
case
|
|
342
|
-
if (typeof c != "string") throw
|
|
321
|
+
case O.URL:
|
|
322
|
+
if (typeof c != "string") throw M(t, "url", "a string");
|
|
343
323
|
o[s] = new URL(c);
|
|
344
324
|
break;
|
|
345
|
-
case
|
|
346
|
-
if (typeof c != "string") throw
|
|
347
|
-
let e = c.match(
|
|
348
|
-
if (e === null || !
|
|
349
|
-
o[s] =
|
|
325
|
+
case O.REGEXP: {
|
|
326
|
+
if (typeof c != "string") throw M(t, "regexp", "a string");
|
|
327
|
+
let e = c.match(A);
|
|
328
|
+
if (e === null || !E(e[2])) throw j(`type ${t} (regexp) expects a "/pattern/flags" string.`);
|
|
329
|
+
o[s] = D(e[1], e[2]);
|
|
350
330
|
break;
|
|
351
331
|
}
|
|
352
|
-
case
|
|
353
|
-
if (!Array.isArray(c)) throw
|
|
332
|
+
case O.SET:
|
|
333
|
+
if (!Array.isArray(c)) throw M(t, "set", "an array");
|
|
354
334
|
o[s] = new Set(c);
|
|
355
335
|
break;
|
|
356
|
-
case
|
|
357
|
-
if (!Array.isArray(c)) throw
|
|
336
|
+
case O.MAP:
|
|
337
|
+
if (!Array.isArray(c)) throw M(t, "map", "an array");
|
|
358
338
|
o[s] = new Map(c);
|
|
359
339
|
}
|
|
360
340
|
}
|
|
361
341
|
return i.data;
|
|
362
342
|
}
|
|
363
343
|
}();
|
|
364
|
-
function
|
|
344
|
+
function P(e) {
|
|
365
345
|
return typeof e == "object" && !!e && "json" in e && "meta" in e && Array.isArray(e.meta);
|
|
366
346
|
}
|
|
367
|
-
function
|
|
368
|
-
if (!
|
|
347
|
+
function F(e) {
|
|
348
|
+
if (!P(e)) return e;
|
|
369
349
|
try {
|
|
370
|
-
return
|
|
350
|
+
return N.deserialize(e.json, e.meta);
|
|
371
351
|
} catch {
|
|
372
352
|
return e;
|
|
373
353
|
}
|
|
374
354
|
}
|
|
375
355
|
//#endregion
|
|
376
356
|
//#region src/orpc/core/capture.ts
|
|
377
|
-
function
|
|
357
|
+
function I(e, t) {
|
|
378
358
|
return typeof e == "string" ? {
|
|
379
359
|
url: e,
|
|
380
360
|
method: t?.method ?? "GET"
|
|
@@ -386,11 +366,11 @@ function P(e, t) {
|
|
|
386
366
|
method: e.method ?? t?.method ?? "GET"
|
|
387
367
|
};
|
|
388
368
|
}
|
|
389
|
-
function
|
|
369
|
+
function L(e, t) {
|
|
390
370
|
let n = e instanceof Request ? e.headers : t?.headers;
|
|
391
371
|
return Object.fromEntries(Array.from(new Headers(n ?? {}), ([e, t]) => [e.toLowerCase(), t]));
|
|
392
372
|
}
|
|
393
|
-
function
|
|
373
|
+
function R(e) {
|
|
394
374
|
return Object.fromEntries([
|
|
395
375
|
"cache-control",
|
|
396
376
|
"age",
|
|
@@ -403,7 +383,7 @@ function I(e) {
|
|
|
403
383
|
"content-type"
|
|
404
384
|
].map((t) => [t, e.get(t)]).filter((e) => e[1] !== null));
|
|
405
385
|
}
|
|
406
|
-
async function
|
|
386
|
+
async function z(e, t) {
|
|
407
387
|
try {
|
|
408
388
|
let n;
|
|
409
389
|
return e instanceof Request ? n = await e.clone().text() : typeof t?.body == "string" && (n = t.body), n ? JSON.parse(n) : void 0;
|
|
@@ -411,7 +391,7 @@ async function L(e, t) {
|
|
|
411
391
|
return;
|
|
412
392
|
}
|
|
413
393
|
}
|
|
414
|
-
async function
|
|
394
|
+
async function B(e) {
|
|
415
395
|
if (e.headers.get("content-type")?.includes("text/event-stream")) return {
|
|
416
396
|
body: void 0,
|
|
417
397
|
streaming: !0
|
|
@@ -436,26 +416,26 @@ async function R(e) {
|
|
|
436
416
|
};
|
|
437
417
|
}
|
|
438
418
|
}
|
|
439
|
-
async function
|
|
419
|
+
async function V(e, t, n, r) {
|
|
440
420
|
try {
|
|
441
|
-
let { url: i, method: a } =
|
|
421
|
+
let { url: i, method: a } = I(e, t), o = v(i, r);
|
|
442
422
|
if (o !== null && o !== "spec.json" && o !== "docs") {
|
|
443
|
-
let r = await
|
|
423
|
+
let r = await z(e, t);
|
|
444
424
|
return n.startCall({
|
|
445
425
|
procedure: o,
|
|
446
426
|
method: a,
|
|
447
427
|
url: i,
|
|
448
|
-
input:
|
|
428
|
+
input: F(r),
|
|
449
429
|
rawInput: r,
|
|
450
|
-
headers:
|
|
430
|
+
headers: L(e, t)
|
|
451
431
|
});
|
|
452
432
|
}
|
|
453
433
|
} catch {}
|
|
454
434
|
return -1;
|
|
455
435
|
}
|
|
456
|
-
function
|
|
436
|
+
function H(e, t, n, r, i) {
|
|
457
437
|
if (e !== -1) try {
|
|
458
|
-
let a = t.ok, o =
|
|
438
|
+
let a = t.ok, o = F(r);
|
|
459
439
|
n.finishCall(e, {
|
|
460
440
|
status: t.status,
|
|
461
441
|
ok: a,
|
|
@@ -463,29 +443,29 @@ function B(e, t, n, r, i) {
|
|
|
463
443
|
rawOutput: a ? r : void 0,
|
|
464
444
|
error: a ? void 0 : o,
|
|
465
445
|
rawError: a ? void 0 : r,
|
|
466
|
-
errorKind: a ? void 0 :
|
|
446
|
+
errorKind: a ? void 0 : x(t.status, o, !1),
|
|
467
447
|
streaming: i,
|
|
468
|
-
responseHeaders:
|
|
448
|
+
responseHeaders: R(t.headers)
|
|
469
449
|
});
|
|
470
450
|
} catch {}
|
|
471
451
|
}
|
|
472
|
-
function
|
|
452
|
+
function U(e, t) {
|
|
473
453
|
if (typeof window > "u") return () => {};
|
|
474
454
|
let n = window.fetch.bind(window);
|
|
475
455
|
return window.fetch = async (r, i) => {
|
|
476
|
-
let a = await
|
|
456
|
+
let a = await V(r, i, e, t);
|
|
477
457
|
try {
|
|
478
458
|
let t = await n(r, i);
|
|
479
459
|
if (a !== -1) {
|
|
480
|
-
let { body: n, streaming: r } = await
|
|
481
|
-
|
|
460
|
+
let { body: n, streaming: r } = await B(t);
|
|
461
|
+
H(a, t, e, n, r);
|
|
482
462
|
}
|
|
483
463
|
return t;
|
|
484
464
|
} catch (t) {
|
|
485
465
|
throw a !== -1 && e.finishCall(a, {
|
|
486
466
|
ok: !1,
|
|
487
467
|
error: t,
|
|
488
|
-
errorKind:
|
|
468
|
+
errorKind: x(void 0, void 0, !0)
|
|
489
469
|
}), t;
|
|
490
470
|
}
|
|
491
471
|
}, () => {
|
|
@@ -493,10 +473,45 @@ function V(e, t) {
|
|
|
493
473
|
};
|
|
494
474
|
}
|
|
495
475
|
//#endregion
|
|
476
|
+
//#region src/orpc/channel.ts
|
|
477
|
+
var W = "storefront-devtools:orpc";
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/orpc/client/publish.ts
|
|
480
|
+
function G(e) {
|
|
481
|
+
let { calls: t, paused: n } = e.getState();
|
|
482
|
+
return {
|
|
483
|
+
calls: t,
|
|
484
|
+
paused: n,
|
|
485
|
+
previousSession: e.previousSessionCalls
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function K(e, t = {}) {
|
|
489
|
+
let n = r({
|
|
490
|
+
...t,
|
|
491
|
+
name: W,
|
|
492
|
+
functions: {
|
|
493
|
+
getState: { handler: () => G(e) },
|
|
494
|
+
clear: {
|
|
495
|
+
type: "action",
|
|
496
|
+
handler: () => e.clear()
|
|
497
|
+
},
|
|
498
|
+
setPaused: {
|
|
499
|
+
type: "action",
|
|
500
|
+
handler: (t) => e.setPaused(t)
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
events: {}
|
|
504
|
+
});
|
|
505
|
+
return n.events.on("panel:connected", () => {
|
|
506
|
+
n.emit("state", G(e));
|
|
507
|
+
}), e.subscribe(o(() => n.emit("state", G(e)), 16)), n;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
496
510
|
//#region src/orpc/client/index.ts
|
|
497
|
-
var
|
|
498
|
-
if (typeof window < "u" && typeof document < "u" && !
|
|
499
|
-
|
|
500
|
-
|
|
511
|
+
var q = "/api", J = Symbol.for("@scayle/storefront-devtools/orpc"), Y = globalThis;
|
|
512
|
+
if (typeof window < "u" && typeof document < "u" && !Y[J]) {
|
|
513
|
+
Y[J] = !0;
|
|
514
|
+
let e = new g();
|
|
515
|
+
U(e, q), K(e);
|
|
501
516
|
}
|
|
502
517
|
//#endregion
|