@scalar/api-client 2.19.3 → 2.20.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +0 -9
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +126 -67
  6. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
  7. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  8. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  9. package/dist/v2/blocks/operation-block/components/Header.vue2.js +25 -24
  10. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -1
  12. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-block/helpers/build-request.js +41 -39
  15. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts +42 -0
  16. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts.map +1 -0
  17. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +31 -0
  18. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +66 -0
  19. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts.map +1 -0
  20. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js +43 -0
  21. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -0
  22. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  23. package/dist/v2/blocks/operation-block/helpers/send-request.js +40 -38
  24. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  25. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +6 -0
  26. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  28. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +24 -23
  29. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -3
  30. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  31. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
  32. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +20 -20
  33. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -0
  34. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  35. package/dist/v2/components/sidebar/Sidebar.vue.js +60 -54
  36. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  37. package/dist/v2/features/app/app-events.js +53 -42
  38. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  39. package/dist/v2/features/app/app-state.js +72 -72
  40. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  41. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  42. package/dist/v2/features/app/components/AppSidebar.vue2.js +84 -76
  43. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  44. package/dist/v2/features/collection/DocumentCollection.vue.js +82 -43
  45. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/v2/features/operation/Operation.vue.js +2 -3
  47. package/dist/v2/workspace-events.d.ts.map +1 -1
  48. package/dist/v2/workspace-events.js +12 -6
  49. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  50. package/package.json +13 -13
@@ -7,7 +7,6 @@ import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/sche
7
7
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
8
8
  import type { ClientLayout } from '../../../hooks/index.js';
9
9
  import type { ExtendedScalarCookie } from '../../../v2/blocks/request-block/RequestBlock.vue.js';
10
- import { type History } from '../../../v2/blocks/scalar-address-bar-block/index.js';
11
10
  import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js';
12
11
  import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
13
12
  /**
@@ -48,10 +47,6 @@ declare const _default: import("vue").DefineComponent<{
48
47
  selectedClient: WorkspaceStore["workspace"]["x-scalar-default-client"];
49
48
  /** Server list available for operation/document */
50
49
  servers: ServerObject[];
51
- /** List of request history */
52
- history: History[];
53
- /** Total number of performed requests */
54
- totalPerformedRequests: number;
55
50
  /** Hides the client button on the header */
56
51
  hideClientButton?: boolean;
57
52
  /** Client integration */
@@ -103,10 +98,6 @@ declare const _default: import("vue").DefineComponent<{
103
98
  selectedClient: WorkspaceStore["workspace"]["x-scalar-default-client"];
104
99
  /** Server list available for operation/document */
105
100
  servers: ServerObject[];
106
- /** List of request history */
107
- history: History[];
108
- /** Total number of performed requests */
109
- totalPerformedRequests: number;
110
101
  /** Hides the client button on the header */
111
102
  hideClientButton?: boolean;
112
103
  /** Client integration */
@@ -1 +1 @@
1
- {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AA6SA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OA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AAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;IAnDhB,gBAAgB;cACN,iBAAiB;IAC3B,gCAAgC;sBACd,eAAe,CAAC,UAAU,CAAC;IAC7C,iCAAiC;8BACP,eAAe,CAAC,4BAA4B,CAAC;IACvE,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,oBAAoB,EAAE;IACrC,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,8BAA8B;aACrB,OAAO,EAAE;IAClB,yCAAyC;4BACjB,MAAM;IAC9B,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,qDAAqD;0BAC/B,OAAO;IAC7B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,qBAAqB;IACtC,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;AArDlB,wBA0YC"}
1
+ {"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"AAiYA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAg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ACtC,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;IA/ChB,gBAAgB;cACN,iBAAiB;IAC3B,gCAAgC;sBACd,eAAe,CAAC,UAAU,CAAC;IAC7C,iCAAiC;8BACP,eAAe,CAAC,4BAA4B,CAAC;IACvE,0BAA0B;gBACd,MAAM;IAClB,iCAAiC;mBAClB,oBAAoB,EAAE;IACrC,2BAA2B;UACrB,MAAM;IACZ,6BAA6B;YACrB,cAAc;IACtB,mBAAmB;iBACN,gBAAgB;IAC7B,oBAAoB;YACZ,YAAY;IACpB,gCAAgC;YACxB,YAAY,GAAG,IAAI;IAC3B,gCAAgC;oBAChB,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC;IACtE,mDAAmD;aAC1C,YAAY,EAAE;IACvB,4CAA4C;uBACzB,OAAO;IAC1B,0BAA0B;kBACZ,MAAM,GAAG,IAAI;IAC3B,mEAAmE;kBACrD,MAAM;IACpB,oBAAoB;aACX,SAAS,GAAG,eAAe;IACpC,uBAAuB;eACZ,eAAe;IAC1B,qDAAqD;0BAC/B,OAAO;IAC7B,+DAA+D;gBACnD,MAAM;IAClB,2CAA2C;cACjC,QAAQ;IAClB,wCAAwC;qBACvB,qBAAqB;IACtC,qBAAqB;aACZ,YAAY,EAAE;IACvB,8CAA8C;iBACjC,kBAAkB;IAC/B,yCAAyC;cAC/B,MAAM;;;;AAjDlB,wBAieC"}
@@ -1,23 +1,25 @@
1
- import { defineComponent as C, computed as r, ref as a, onMounted as R, onBeforeUnmount as k, watch as U, createElementBlock as b, openBlock as E, createElementVNode as O, createVNode as n, withCtx as g, unref as c } from "vue";
2
- import { AVAILABLE_CLIENTS as V } from "@scalar/types/snippetz";
3
- import { useToasts as K } from "@scalar/use-toasts";
4
- import w from "../../../components/ViewLayout/ViewLayout.vue.js";
5
- import P from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
6
- import { ERRORS as M } from "../../../libs/errors.js";
7
- import { createStoreEvents as A } from "../../../store/events.js";
8
- import { buildRequest as L } from "./helpers/build-request.js";
9
- import { getSecuritySchemes as T } from "./helpers/build-request-security.js";
10
- import { sendRequest as N } from "./helpers/send-request.js";
11
- import I from "./components/Header.vue.js";
12
- import { generateClientOptions as $ } from "../operation-code-sample/helpers/generate-client-options.js";
13
- import { getSecurityRequirements as j } from "../../features/operation/helpers/get-security-requirements.js";
14
- import { getSelectedSecurity as D } from "../../features/operation/helpers/get-selected-security.js";
15
- import H from "../request-block/RequestBlock.vue.js";
16
- import Q from "../response-block/ResponseBlock.vue.js";
17
- const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, G = {
1
+ import { defineComponent as K, computed as a, ref as m, onMounted as O, onBeforeUnmount as g, watch as V, createElementBlock as w, openBlock as T, createElementVNode as I, createVNode as s, withCtx as q, unref as d } from "vue";
2
+ import { AVAILABLE_CLIENTS as M } from "@scalar/types/snippetz";
3
+ import { useToasts as A } from "@scalar/use-toasts";
4
+ import L from "../../../components/ViewLayout/ViewLayout.vue.js";
5
+ import N from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
6
+ import { ERRORS as P } from "../../../libs/errors.js";
7
+ import { createStoreEvents as H } from "../../../store/events.js";
8
+ import { buildRequest as F } from "./helpers/build-request.js";
9
+ import { getSecuritySchemes as $ } from "./helpers/build-request-security.js";
10
+ import { harToFetchRequest as j } from "./helpers/har-to-fetch-request.js";
11
+ import { harToFetchResponse as D } from "./helpers/har-to-fetch-response.js";
12
+ import { sendRequest as Q } from "./helpers/send-request.js";
13
+ import z from "./components/Header.vue.js";
14
+ import { generateClientOptions as G } from "../operation-code-sample/helpers/generate-client-options.js";
15
+ import { getSecurityRequirements as J } from "../../features/operation/helpers/get-security-requirements.js";
16
+ import { getSelectedSecurity as W } from "../../features/operation/helpers/get-selected-security.js";
17
+ import X from "../request-block/RequestBlock.vue.js";
18
+ import Y from "../response-block/ResponseBlock.vue.js";
19
+ const Z = { class: "bg-b-1 flex h-full flex-col" }, p = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, _ = {
18
20
  name: "OperationBlock"
19
- }, ae = /* @__PURE__ */ C({
20
- ...G,
21
+ }, Se = /* @__PURE__ */ K({
22
+ ..._,
21
23
  props: {
22
24
  eventBus: {},
23
25
  documentSecurity: {},
@@ -26,13 +28,11 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
26
28
  globalCookies: { default: () => [] },
27
29
  path: {},
28
30
  method: {},
29
- httpClients: { default: () => V },
31
+ httpClients: { default: () => M },
30
32
  layout: {},
31
33
  server: {},
32
34
  selectedClient: {},
33
35
  servers: {},
34
- history: {},
35
- totalPerformedRequests: {},
36
36
  hideClientButton: { type: Boolean },
37
37
  integration: {},
38
38
  documentUrl: {},
@@ -48,60 +48,118 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
48
48
  },
49
49
  emits: ["update:servers"],
50
50
  setup(e, { emit: B }) {
51
- const x = B, q = r(() => $(e.httpClients)), m = r(
52
- () => j(e.documentSecurity, e.operation.security)
53
- ), d = r(
54
- () => D(
51
+ const R = B, C = a(() => G(e.httpClients)), h = a(
52
+ () => J(e.documentSecurity, e.operation.security)
53
+ ), v = a(
54
+ () => W(
55
55
  e.documentSelectedSecurity,
56
56
  e.operation["x-scalar-selected-security"],
57
- m.value,
57
+ h.value,
58
58
  e.setOperationSecurity
59
59
  )
60
- ), v = r(
61
- () => T(e.securitySchemes, d.value.selectedSchemes)
62
- ), { toast: y } = K(), h = a(null), l = a(null), u = a(null), f = () => h.value?.abort(M.REQUEST_ABORTED), o = async () => {
63
- const [s, t] = L({
60
+ ), y = a(
61
+ () => $(e.securitySchemes, v.value.selectedSchemes)
62
+ ), { toast: f } = A(), x = m(null), l = m(null), u = m(null), i = () => x.value?.abort(P.REQUEST_ABORTED), c = async () => {
63
+ const [t, n] = F({
64
64
  environment: e.environment,
65
65
  exampleKey: e.exampleKey,
66
66
  globalCookies: e.globalCookies,
67
67
  method: e.method,
68
68
  operation: e.operation,
69
69
  path: e.path,
70
- selectedSecuritySchemes: v.value,
70
+ selectedSecuritySchemes: y.value,
71
71
  server: e.server,
72
72
  proxyUrl: e.proxyUrl
73
73
  });
74
- if (s) {
75
- y(s.message, "error");
74
+ if (t) {
75
+ f(t.message, "error");
76
76
  return;
77
77
  }
78
- h.value = t.controller, e.eventBus.emit("hooks:on:request:sent");
79
- const [i, S] = await N({
80
- isUsingProxy: t.isUsingProxy,
78
+ x.value = n.controller, e.eventBus.emit("hooks:on:request:sent", {
79
+ meta: {
80
+ method: e.method,
81
+ path: e.path,
82
+ exampleKey: e.exampleKey
83
+ }
84
+ });
85
+ const [o, r] = await Q({
86
+ isUsingProxy: n.isUsingProxy,
81
87
  operation: e.operation,
82
88
  plugins: e.plugins,
83
- request: t.request
89
+ request: n.request
84
90
  });
85
- if (e.eventBus.emit("hooks:on:request:complete"), i) {
86
- y(i.message, "error");
91
+ if (e.eventBus.emit("hooks:on:request:complete", {
92
+ payload: r ? {
93
+ response: r.originalResponse,
94
+ request: r.request.clone(),
95
+ duration: r.response.duration,
96
+ timestamp: r.timestamp
97
+ } : void 0,
98
+ meta: {
99
+ method: e.method,
100
+ path: e.path,
101
+ exampleKey: e.exampleKey
102
+ }
103
+ }), o) {
104
+ f(o.message, "error");
87
105
  return;
88
106
  }
89
- l.value = S.response, u.value = S.request;
107
+ l.value = r.response, u.value = r.request;
108
+ };
109
+ O(() => {
110
+ e.eventBus.on("operation:send:request:hotkey", c), e.eventBus.on("operation:cancel:request", i);
111
+ }), g(() => {
112
+ e.eventBus.off("operation:send:request:hotkey", c), e.eventBus.off("operation:cancel:request", i);
113
+ });
114
+ const S = a(
115
+ () => (e.operation["x-scalar-history"] ?? []).map((t) => ({
116
+ method: t.request.method,
117
+ path: t.request.url,
118
+ duration: t.time,
119
+ status: t.response.status
120
+ })).reverse()
121
+ ), k = ({ index: t }) => {
122
+ const n = (e.operation["x-scalar-history"]?.length ?? 0) - t - 1, o = e.operation["x-scalar-history"]?.[n];
123
+ if (!o)
124
+ return;
125
+ const r = () => e.eventBus.emit("ui:route:example", {
126
+ exampleName: "draft",
127
+ callback: async (U) => {
128
+ if (U === "error")
129
+ return;
130
+ const b = D({
131
+ harResponse: o.response,
132
+ url: o.request.url,
133
+ method: e.method,
134
+ path: e.path,
135
+ duration: o.time
136
+ }), E = j({
137
+ harRequest: o.request
138
+ });
139
+ l.value = b, u.value = E;
140
+ }
141
+ });
142
+ e.eventBus.emit("operation:reload:history", {
143
+ meta: {
144
+ path: e.path,
145
+ method: e.method
146
+ },
147
+ index: n,
148
+ callback: r
149
+ });
90
150
  };
91
- return R(() => {
92
- e.eventBus.on("operation:send:request:hotkey", o), e.eventBus.on("operation:cancel:request", f);
93
- }), k(() => {
94
- e.eventBus.off("operation:send:request:hotkey", o), e.eventBus.off("operation:cancel:request", f);
95
- }), U([() => e.path, () => e.method, () => e.exampleKey], () => {
96
- l.value = null, u.value = null;
97
- }), (s, t) => (E(), b("div", z, [
98
- O("div", F, [
99
- n(I, {
151
+ return V([() => e.path, () => e.method, () => e.exampleKey], () => {
152
+ l.value = null, u.value = null, i();
153
+ }), g(() => {
154
+ i();
155
+ }), (t, n) => (T(), w("div", Z, [
156
+ I("div", p, [
157
+ s(z, {
100
158
  documentUrl: e.documentUrl,
101
159
  environment: e.environment,
102
160
  eventBus: e.eventBus,
103
161
  hideClientButton: e.hideClientButton,
104
- history: e.history,
162
+ history: S.value,
105
163
  integration: e.integration,
106
164
  layout: e.layout,
107
165
  method: e.method,
@@ -109,17 +167,18 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
109
167
  server: e.server,
110
168
  servers: e.servers,
111
169
  source: e.source,
112
- onExecute: o,
113
- "onUpdate:servers": t[0] || (t[0] = (i) => x("update:servers"))
170
+ onExecute: c,
171
+ "onSelect:history:item": k,
172
+ "onUpdate:servers": n[0] || (n[0] = (o) => R("update:servers"))
114
173
  }, null, 8, ["documentUrl", "environment", "eventBus", "hideClientButton", "history", "integration", "layout", "method", "path", "server", "servers", "source"])
115
174
  ]),
116
- n(w, { class: "border-t" }, {
117
- default: g(() => [
118
- n(P, { class: "flex-1" }, {
119
- default: g(() => [
120
- n(c(H), {
175
+ s(L, { class: "border-t" }, {
176
+ default: q(() => [
177
+ s(N, { class: "flex-1" }, {
178
+ default: q(() => [
179
+ s(d(X), {
121
180
  authMeta: e.authMeta,
122
- clientOptions: q.value,
181
+ clientOptions: C.value,
123
182
  environment: e.environment,
124
183
  eventBus: e.eventBus,
125
184
  exampleKey: e.exampleKey,
@@ -130,23 +189,23 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
130
189
  path: e.path,
131
190
  plugins: e.plugins,
132
191
  proxyUrl: e.proxyUrl,
133
- securityRequirements: m.value,
192
+ securityRequirements: h.value,
134
193
  securitySchemes: e.securitySchemes,
135
194
  selectedClient: e.selectedClient,
136
- selectedSecurity: d.value,
137
- selectedSecuritySchemes: v.value,
195
+ selectedSecurity: v.value,
196
+ selectedSecuritySchemes: y.value,
138
197
  server: e.server
139
198
  }, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "globalCookies", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
140
- n(c(Q), {
199
+ s(d(Y), {
141
200
  appVersion: e.appVersion,
142
201
  eventBus: e.eventBus,
143
- events: c(A)(),
202
+ events: d(H)(),
144
203
  layout: e.layout,
145
204
  plugins: e.plugins,
146
205
  request: u.value,
147
206
  response: l.value,
148
- totalPerformedRequests: e.totalPerformedRequests,
149
- onSendRequest: o
207
+ totalPerformedRequests: S.value.length,
208
+ onSendRequest: c
150
209
  }, null, 8, ["appVersion", "eventBus", "events", "layout", "plugins", "request", "response", "totalPerformedRequests"])
151
210
  ]),
152
211
  _: 1
@@ -158,5 +217,5 @@ const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-heade
158
217
  }
159
218
  });
160
219
  export {
161
- ae as default
220
+ Se as default
162
221
  };
@@ -33,9 +33,15 @@ type __VLS_Props = {
33
33
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
34
34
  execute: () => any;
35
35
  "update:servers": () => any;
36
+ "select:history:item": (payload: {
37
+ index: number;
38
+ }) => any;
36
39
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
37
40
  onExecute?: (() => any) | undefined;
38
41
  "onUpdate:servers"?: (() => any) | undefined;
42
+ "onSelect:history:item"?: ((payload: {
43
+ index: number;
44
+ }) => any) | undefined;
39
45
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
46
  export default _default;
41
47
  //# sourceMappingURL=Header.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Header.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"names":[],"mappings":"AAmIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAE/E,KAAK,WAAW,GAAG;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,UAAU,CAAA;IAClB,oBAAoB;IACpB,MAA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AAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oBAAoB;IACpB,MAAM,CAAC,EAAE,SAAS,GAAG,eAAe,CAAA;IACpC,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,4BAA4B;IAC5B,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;;;;eAO6C,MAAM;;;;;;eAAN,MAAM;;;AAwNrD,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./Header.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const d = /* @__PURE__ */ r(o, [["__scopeId", "data-v-d73c7e3d"]]);
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-43c7b0fc"]]);
5
5
  export {
6
- d as default
6
+ e as default
7
7
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as c, createElementBlock as i, openBlock as o, createElementVNode as n, createVNode as s, unref as l, createBlock as v, createCommentVNode as u } from "vue";
1
+ import { defineComponent as c, createElementBlock as s, openBlock as l, createElementVNode as o, createVNode as u, unref as i, createBlock as v, createCommentVNode as m } from "vue";
2
2
  import { ScalarIcon as a } from "@scalar/components";
3
3
  import f from "../../scalar-address-bar-block/components/AddressBar.vue.js";
4
- import g from "../../../../components/OpenApiClientButton.vue.js";
5
- const y = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1" }, x = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-1 lg:mb-0 lg:flex-1 lg:px-2.5" }, w = /* @__PURE__ */ c({
4
+ import y from "../../../../components/OpenApiClientButton.vue.js";
5
+ const g = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1" }, x = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-1 lg:mb-0 lg:flex-1 lg:px-2.5" }, w = /* @__PURE__ */ c({
6
6
  __name: "Header",
7
7
  props: {
8
8
  path: {},
@@ -18,14 +18,14 @@ const y = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap i
18
18
  eventBus: {},
19
19
  environment: {}
20
20
  },
21
- emits: ["execute", "update:servers"],
21
+ emits: ["execute", "update:servers", "select:history:item"],
22
22
  setup(e, { emit: d }) {
23
- const m = d;
24
- return (b, t) => (o(), i("div", y, [
25
- t[6] || (t[6] = n("div", { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, [
26
- n("div", { class: "size-8" })
23
+ const r = d;
24
+ return (b, t) => (l(), s("div", g, [
25
+ t[7] || (t[7] = o("div", { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, [
26
+ o("div", { class: "size-8" })
27
27
  ], -1)),
28
- s(l(f), {
28
+ u(i(f), {
29
29
  environment: e.environment,
30
30
  eventBus: e.eventBus,
31
31
  history: e.history,
@@ -34,44 +34,45 @@ const y = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap i
34
34
  path: e.path,
35
35
  server: e.server,
36
36
  servers: e.servers,
37
- onExecute: t[0] || (t[0] = (r) => m("execute")),
38
- "onUpdate:servers": t[1] || (t[1] = (r) => m("update:servers"))
37
+ onExecute: t[0] || (t[0] = (n) => r("execute")),
38
+ "onSelect:history:item": t[1] || (t[1] = (n) => r("select:history:item", n)),
39
+ "onUpdate:servers": t[2] || (t[2] = (n) => r("update:servers"))
39
40
  }, null, 8, ["environment", "eventBus", "history", "layout", "method", "path", "server", "servers"]),
40
- n("div", x, [
41
- e.layout === "modal" && e.documentUrl && !e.hideClientButton ? (o(), v(l(g), {
41
+ o("div", x, [
42
+ e.layout === "modal" && e.documentUrl && !e.hideClientButton ? (l(), v(i(y), {
42
43
  key: 0,
43
44
  buttonSource: "modal",
44
45
  class: "!w-fit lg:-mr-1",
45
46
  integration: e.integration ?? null,
46
47
  source: e.source ?? "api-reference",
47
48
  url: e.documentUrl
48
- }, null, 8, ["integration", "source", "url"])) : u("", !0),
49
- e.layout === "modal" && e.source !== "gitbook" ? (o(), i("button", {
49
+ }, null, 8, ["integration", "source", "url"])) : m("", !0),
50
+ e.layout === "modal" && e.source !== "gitbook" ? (l(), s("button", {
50
51
  key: 1,
51
52
  class: "app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2",
52
53
  type: "button",
53
- onClick: t[2] || (t[2] = (r) => e.eventBus.emit("ui:close:client-modal"))
54
+ onClick: t[3] || (t[3] = (n) => e.eventBus.emit("ui:close:client-modal"))
54
55
  }, [
55
- s(l(a), {
56
+ u(i(a), {
56
57
  icon: "Close",
57
58
  size: "lg",
58
59
  thickness: "2"
59
60
  }),
60
- t[4] || (t[4] = n("span", { class: "sr-only" }, "Close Client", -1))
61
- ])) : u("", !0),
62
- e.layout === "modal" && e.source === "gitbook" ? (o(), i("button", {
61
+ t[5] || (t[5] = o("span", { class: "sr-only" }, "Close Client", -1))
62
+ ])) : m("", !0),
63
+ e.layout === "modal" && e.source === "gitbook" ? (l(), s("button", {
63
64
  key: 2,
64
65
  class: "text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2",
65
66
  type: "button",
66
- onClick: t[3] || (t[3] = (r) => e.eventBus.emit("ui:close:client-modal"))
67
+ onClick: t[4] || (t[4] = (n) => e.eventBus.emit("ui:close:client-modal"))
67
68
  }, [
68
- s(l(a), {
69
+ u(i(a), {
69
70
  icon: "Close",
70
71
  size: "md",
71
72
  thickness: "1.75"
72
73
  }),
73
- t[5] || (t[5] = n("span", { class: "sr-only" }, "Close Client", -1))
74
- ])) : u("", !0)
74
+ t[6] || (t[6] = o("span", { class: "sr-only" }, "Close Client", -1))
75
+ ])) : m("", !0)
75
76
  ])
76
77
  ]));
77
78
  }
@@ -14,7 +14,7 @@ export declare const buildRequestCookieHeader: ({ paramCookies, globalCookies, e
14
14
  /** Environment variables flattened into a key-value object */
15
15
  env: Record<string, string>;
16
16
  /** Cookie header that previously exists from the spec OR from the user */
17
- originalCookieHeader: string | undefined;
17
+ originalCookieHeader: string | undefined | null;
18
18
  /** The url of the request used to filter global cookies by domain */
19
19
  url: string;
20
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-cookie-header.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAa5E;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,aAAa,EAAE,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,MAWzG,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,gHAQtC;IACD,uEAAuE;IACvE,YAAY,EAAE,aAAa,EAAE,CAAA;IAC7B,qDAAqD;IACrD,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,0EAA0E;IAC1E,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAA;IAC9B,0DAA0D;IAC1D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CA4BvC,CAAA"}
1
+ {"version":3,"file":"build-request-cookie-header.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-cookie-header.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAa5E;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,aAAa,EAAE,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,MAWzG,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,gHAQtC;IACD,uEAAuE;IACvE,YAAY,EAAE,aAAa,EAAE,CAAA;IAC7B,qDAAqD;IACrD,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC3B,0EAA0E;IAC1E,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAC/C,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAA;IAC9B,0DAA0D;IAC1D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CA4BvC,CAAA"}
@@ -22,7 +22,7 @@ const d = "We're using a `X-Scalar-Cookie` custom header to the request. The pro
22
22
  ...r,
23
23
  name: i(r.name, e),
24
24
  value: i(r.value, e)
25
- })), s = C([...l, ...a], t);
25
+ })), s = C([...l, ...a], t ?? void 0);
26
26
  return s ? u ? (console.warn(d), { name: "X-Scalar-Cookie", value: s }) : (console.warn(b), { name: "Cookie", value: s }) : null;
27
27
  };
28
28
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAU1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAoFA,CAAA"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAU1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CA0FA,CAAA"}
@@ -1,65 +1,67 @@
1
- import { shouldUseProxy as v, redirectToProxy as A } from "@scalar/oas-utils/helpers";
2
- import { getResolvedRef as S } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { isElectron as p } from "../../../../libs/electron.js";
4
- import { ERRORS as g, normalizeError as w } from "../../../../libs/errors.js";
5
- import { getEnvironmentVariables as B } from "./get-environment-variables.js";
6
- import { getResolvedUrl as D } from "./get-resolved-url.js";
7
- import { getDefaultHeaders as L } from "../../request-block/helpers/get-default-headers.js";
1
+ import { shouldUseProxy as v, redirectToProxy as w } from "@scalar/oas-utils/helpers";
2
+ import { getResolvedRef as A } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { isElectron as U } from "../../../../libs/electron.js";
4
+ import { ERRORS as h, normalizeError as D } from "../../../../libs/errors.js";
5
+ import { getEnvironmentVariables as L } from "./get-environment-variables.js";
6
+ import { getResolvedUrl as B } from "./get-resolved-url.js";
7
+ import { getDefaultHeaders as T } from "../../request-block/helpers/get-default-headers.js";
8
8
  import { buildRequestBody as V } from "./build-request-body.js";
9
9
  import { buildRequestCookieHeader as I } from "./build-request-cookie-header.js";
10
- import { buildRequestParameters as T } from "./build-request-parameters.js";
11
- import { buildRequestSecurity as _ } from "./build-request-security.js";
10
+ import { buildRequestParameters as _ } from "./build-request-parameters.js";
11
+ import { buildRequestSecurity as x } from "./build-request-security.js";
12
12
  const W = ({
13
- environment: d,
14
- exampleKey: o = "default",
13
+ environment: m,
14
+ exampleKey: r = "default",
15
15
  globalCookies: k,
16
- method: n,
17
- operation: s,
18
- path: U,
19
- proxyUrl: m,
20
- server: h,
16
+ method: c,
17
+ operation: o,
18
+ path: C,
19
+ proxyUrl: f,
20
+ server: P,
21
21
  selectedSecuritySchemes: q
22
22
  }) => {
23
23
  try {
24
- const r = B(d), C = S(s.requestBody), t = T(s.parameters ?? [], r, o), H = V(C, r, o), l = _(q, r), e = { ...L({ method: n, operation: s, exampleKey: o, hideDisabledHeaders: !0 }).filter((i) => !i.isOverridden).reduce(
25
- (i, R) => (i[R.name] = R.defaultValue, i),
24
+ const n = A(o.requestBody), t = L(m), s = _(o.parameters ?? [], t, r), d = x(q, t), H = T({ method: c, operation: o, exampleKey: r, hideDisabledHeaders: !0 }).filter((l) => !l.isOverridden).reduce(
25
+ (l, g) => (l[g.name] = g.defaultValue, l),
26
26
  {}
27
- ), ...t.headers, ...l.headers }, P = new URLSearchParams([...t.urlParams, ...l.urlParams]), a = D({ environment: d, server: h, path: U, pathVariables: t.pathVariables, urlParams: P });
28
- if (!a)
29
- throw g.URL_EMPTY;
30
- const c = v(m, a), E = A(m, a), f = e["User-Agent"] || e["user-agent"];
31
- p() && f && (e["X-Scalar-User-Agent"] = f);
27
+ ), e = new Headers({ ...H, ...s.headers, ...d.headers }), E = new URLSearchParams([...s.urlParams, ...d.urlParams]), a = V(n, t, r);
28
+ a && (a instanceof FormData || a instanceof URLSearchParams) && e.delete("Content-Type");
29
+ const i = B({ environment: m, server: P, path: C, pathVariables: s.pathVariables, urlParams: E });
30
+ if (!i)
31
+ throw h.URL_EMPTY;
32
+ const R = v(f, i), y = w(f, i), b = e.get("User-Agent");
33
+ U() && b && e.set("X-Scalar-User-Agent", b);
32
34
  const u = I({
33
- paramCookies: [...t.cookies, ...l.cookies],
35
+ paramCookies: [...s.cookies, ...d.cookies],
34
36
  globalCookies: k,
35
- env: r,
36
- originalCookieHeader: e.Cookie || e.cookie,
37
- url: a,
38
- useCustomCookieHeader: p() || c,
39
- disabledGlobalCookies: s["x-scalar-disable-parameters"]?.["global-cookies"]?.[o] ?? {}
37
+ env: t,
38
+ originalCookieHeader: e.get("Cookie"),
39
+ url: i,
40
+ useCustomCookieHeader: U() || R,
41
+ disabledGlobalCookies: o["x-scalar-disable-parameters"]?.["global-cookies"]?.[r] ?? {}
40
42
  });
41
- u && (e[u.name] = u.value);
42
- const b = new AbortController(), y = new Request(E, {
43
+ u && e.set(u.name, u.value);
44
+ const p = new AbortController(), S = new Request(y, {
43
45
  /**
44
46
  * Ensure that all methods are uppercased (though only needed for patch)
45
47
  *
46
48
  * @see https://github.com/whatwg/fetch/issues/50
47
49
  */
48
- method: n.toUpperCase(),
50
+ method: c.toUpperCase(),
49
51
  headers: e,
50
- signal: b.signal,
51
- body: H
52
+ signal: p.signal,
53
+ body: a
52
54
  });
53
55
  return [
54
56
  null,
55
57
  {
56
- controller: b,
57
- isUsingProxy: c,
58
- request: y
58
+ controller: p,
59
+ isUsingProxy: R,
60
+ request: S
59
61
  }
60
62
  ];
61
- } catch (r) {
62
- return [w(r, g.BUILDING_REQUEST_FAILED), null];
63
+ } catch (n) {
64
+ return [D(n, h.BUILDING_REQUEST_FAILED), null];
63
65
  }
64
66
  };
65
67
  export {