@scalar/api-client 2.2.29 → 2.2.30

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.2.30
4
+
5
+ ### Patch Changes
6
+
7
+ - 1785304: feat: export extra packages and add findRequest lib
8
+
3
9
  ## 2.2.29
4
10
 
5
11
  ### Patch Changes
@@ -1,18 +1,18 @@
1
- import { default as t } from "./DataTableHeader.vue.js";
2
- import { default as o } from "./DataTableInput.vue.js";
3
- import { default as f } from "./DataTableRow.vue.js";
4
- import { default as u } from "./DataTableText.vue.js";
5
- import { default as b } from "./DataTable.vue.js";
6
- import { default as T } from "./DataTableCell.vue.js";
7
- import { default as s } from "./DataTableCheckbox.vue.js";
8
- import { default as c } from "./DataTableInputSelect.vue.js";
1
+ import { default as t } from "./DataTableInput.vue.js";
2
+ import { default as o } from "./DataTableRow.vue.js";
3
+ import { default as f } from "./DataTable.vue.js";
4
+ import { default as u } from "./DataTableCell.vue.js";
5
+ import { default as b } from "./DataTableCheckbox.vue.js";
6
+ import { default as T } from "./DataTableHeader.vue.js";
7
+ import { default as s } from "./DataTableInputSelect.vue.js";
8
+ import { default as c } from "./DataTableText.vue.js";
9
9
  export {
10
- b as DataTable,
11
- T as DataTableCell,
12
- s as DataTableCheckbox,
13
- t as DataTableHeader,
14
- o as DataTableInput,
15
- c as DataTableInputSelect,
16
- f as DataTableRow,
17
- u as DataTableText
10
+ f as DataTable,
11
+ u as DataTableCell,
12
+ b as DataTableCheckbox,
13
+ T as DataTableHeader,
14
+ t as DataTableInput,
15
+ s as DataTableInputSelect,
16
+ o as DataTableRow,
17
+ c as DataTableText
18
18
  };
@@ -1,6 +1,6 @@
1
1
  import { inject as o } from "vue";
2
2
  const t = Symbol(), s = () => ({
3
- layout: o(t) ?? "desktop"
3
+ layout: o(t, "desktop")
4
4
  });
5
5
  export {
6
6
  t as LAYOUT_SYMBOL,
@@ -0,0 +1,53 @@
1
+ import type { Request } from '@scalar/oas-utils/entities/spec';
2
+ /** Convert path string like '/planets/{planetId}' to regex pattern /\/planets/([^/]+)/ */
3
+ export declare const pathToRegex: (path: string) => RegExp;
4
+ /**
5
+ * Takes a path and method and returns the request that matches the path and method while taking
6
+ * path params into account by converting to a regex. Will also return the path params if they exist
7
+ *
8
+ * @example path can be /planets/{planetId} OR /planets/1
9
+ */
10
+ export declare const findRequestByPathMethod: (path: string, method: string, requests: Request[]) => {
11
+ request: {
12
+ path: string;
13
+ type: "request";
14
+ uid: string;
15
+ selectedSecuritySchemeUids: string[];
16
+ selectedServerUid: string;
17
+ servers: string[];
18
+ examples: string[];
19
+ method: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace";
20
+ description?: string | undefined;
21
+ summary?: string | undefined;
22
+ externalDocs?: {
23
+ url: string;
24
+ description?: string | undefined;
25
+ } | undefined;
26
+ security?: Record<string, string[]>[] | undefined;
27
+ tags?: string[] | undefined;
28
+ deprecated?: boolean | undefined;
29
+ operationId?: string | undefined;
30
+ parameters?: {
31
+ required: boolean;
32
+ name: string;
33
+ in: "path" | "query" | "header" | "cookie";
34
+ deprecated: boolean;
35
+ description?: string | undefined;
36
+ example?: unknown;
37
+ schema?: unknown;
38
+ content?: unknown;
39
+ style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
40
+ examples?: Record<string, {
41
+ value?: unknown;
42
+ summary?: string | undefined;
43
+ }> | undefined;
44
+ }[] | undefined;
45
+ requestBody?: any;
46
+ responses?: Record<string, any> | undefined;
47
+ } | undefined;
48
+ pathParams: {
49
+ key: string;
50
+ value: string;
51
+ }[];
52
+ };
53
+ //# sourceMappingURL=find-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-request.d.ts","sourceRoot":"","sources":["../../src/libs/find-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAE9D,0FAA0F;AAC1F,eAAO,MAAM,WAAW,SAAU,MAAM,WASvC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,SAC5B,MAAM,UACJ,MAAM,YACJ,OAAO,EAAE;;;;;;;;;;;;;;uBA0B4qsB,CAAC;;;;;;;;;;;uBAAqX,CAAC;mBAAqC,CAAC;kBAAyB,CAAC;mBAA0B,CAAC;iBAAwB,CAAC;oBAA0H,CAAC;qBAAoC,CAAC;uBAA8B,CAAC;;;;;;;aAxBl1tB,MAAM;eAAS,MAAM;;CAuB7C,CAAA"}
@@ -0,0 +1,22 @@
1
+ const h = (e) => {
2
+ const r = "^" + // start anchor
3
+ e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\\\{([^}]+)\\\}/g, "([^/]+)") + // replace {param} with capture group
4
+ "$";
5
+ return new RegExp(r);
6
+ }, l = (e, r, u) => {
7
+ let n = [];
8
+ return { request: u.find((t) => {
9
+ if (t.method.toLowerCase() !== r.toLowerCase()) return !1;
10
+ if (t.path === e) return !0;
11
+ const c = h(t.path), s = e.match(c);
12
+ return s ? (n = s.slice(1).flatMap((p, f) => {
13
+ var o;
14
+ const a = (o = t.path.split("{")[f + 1]) == null ? void 0 : o.split("}")[0];
15
+ return a ? [{ key: a, value: p }] : [];
16
+ }), !0) : !1;
17
+ }), pathParams: n };
18
+ };
19
+ export {
20
+ l as findRequestByPathMethod,
21
+ h as pathToRegex
22
+ };
@@ -1,2 +1,2 @@
1
- export * from './curl.js';
1
+ export { importCurlCommand } from './curl.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/libs/importers/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/libs/importers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export * from './create-client.js';
2
2
  export * from './formatters.js';
3
+ export { findRequestByPathMethod } from './find-request.js';
3
4
  export * from './errors.js';
4
5
  export * from './hot-keys.js';
5
6
  export * from './event-bus.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA;AACvB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,SAAS,CAAA;AACvB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
@@ -1,43 +1,45 @@
1
1
  import { createApiClient as o } from "./create-client.js";
2
2
  import { formatBytes as a, formatMs as m } from "./formatters.js";
3
- import { ERRORS as p, normalizeError as f, prettyErrorMessage as n } from "./errors.js";
4
- import { DEFAULT_HOTKEYS as c, getModifiers as l, handleHotKeyDown as x } from "./hot-keys.js";
5
- import { createEventBus as u } from "./event-bus.js";
6
- import { getEnvColor as y } from "./env-helpers.js";
7
- import { formatHeaderKey as D, normalizeHeaders as R } from "./normalize-headers.js";
8
- import { loadAllResources as A } from "./local-storage.js";
3
+ import { findRequestByPathMethod as p } from "./find-request.js";
4
+ import { ERRORS as n, normalizeError as i, prettyErrorMessage as c } from "./errors.js";
5
+ import { DEFAULT_HOTKEYS as x, getModifiers as d, handleHotKeyDown as u } from "./hot-keys.js";
6
+ import { createEventBus as y } from "./event-bus.js";
7
+ import { getEnvColor as h } from "./env-helpers.js";
8
+ import { formatHeaderKey as D, normalizeHeaders as g } from "./normalize-headers.js";
9
+ import { loadAllResources as B } from "./local-storage.js";
9
10
  import { parseEnvVariables as O } from "./environment-parser.js";
10
11
  import { isUrl as v } from "./isUrl.js";
11
- import { getOpenApiDocumentDetails as F } from "./getOpenApiDocumentDetails.js";
12
+ import { getOpenApiDocumentDetails as M } from "./getOpenApiDocumentDetails.js";
12
13
  import { parseCurlCommand as K } from "./parse-curl.js";
13
- import { convertPostmanToOpenApi as T, getPostmanDocumentDetails as q, isPostmanCollection as z } from "./postman.js";
14
- import { createFetchBody as U, createFetchHeaders as b, createFetchQueryParams as k, createRequestOperation as w, decodeBuffer as L, setRequestCookies as Q } from "./send-request/send-request.js";
14
+ import { convertPostmanToOpenApi as z, getPostmanDocumentDetails as S, isPostmanCollection as U } from "./postman.js";
15
+ import { createFetchBody as k, createFetchHeaders as w, createFetchQueryParams as L, createRequestOperation as Q, decodeBuffer as V, setRequestCookies as Y } from "./send-request/send-request.js";
15
16
  export {
16
- c as DEFAULT_HOTKEYS,
17
- p as ERRORS,
18
- T as convertPostmanToOpenApi,
17
+ x as DEFAULT_HOTKEYS,
18
+ n as ERRORS,
19
+ z as convertPostmanToOpenApi,
19
20
  o as createApiClient,
20
- u as createEventBus,
21
- U as createFetchBody,
22
- b as createFetchHeaders,
23
- k as createFetchQueryParams,
24
- w as createRequestOperation,
25
- L as decodeBuffer,
21
+ y as createEventBus,
22
+ k as createFetchBody,
23
+ w as createFetchHeaders,
24
+ L as createFetchQueryParams,
25
+ Q as createRequestOperation,
26
+ V as decodeBuffer,
27
+ p as findRequestByPathMethod,
26
28
  a as formatBytes,
27
29
  D as formatHeaderKey,
28
30
  m as formatMs,
29
- y as getEnvColor,
30
- l as getModifiers,
31
- F as getOpenApiDocumentDetails,
32
- q as getPostmanDocumentDetails,
33
- x as handleHotKeyDown,
34
- z as isPostmanCollection,
31
+ h as getEnvColor,
32
+ d as getModifiers,
33
+ M as getOpenApiDocumentDetails,
34
+ S as getPostmanDocumentDetails,
35
+ u as handleHotKeyDown,
36
+ U as isPostmanCollection,
35
37
  v as isUrl,
36
- A as loadAllResources,
37
- f as normalizeError,
38
- R as normalizeHeaders,
38
+ B as loadAllResources,
39
+ i as normalizeError,
40
+ g as normalizeHeaders,
39
41
  K as parseCurlCommand,
40
42
  O as parseEnvVariables,
41
- n as prettyErrorMessage,
42
- Q as setRequestCookies
43
+ c as prettyErrorMessage,
44
+ Y as setRequestCookies
43
45
  };
@@ -1,7 +1,7 @@
1
1
  import type { Environment } from '@scalar/oas-utils/entities/environment';
2
2
  import type { Collection, Request, RequestExample, Server } from '@scalar/oas-utils/entities/spec';
3
3
  import type { Workspace } from '@scalar/oas-utils/entities/workspace';
4
- import { type InjectionKey } from 'vue';
4
+ import { type ComputedRef, type InjectionKey } from 'vue';
5
5
  import type { Router } from 'vue-router';
6
6
  type CreateActiveEntitiesStoreParams = {
7
7
  collections: Record<string, Collection>;
@@ -11,6 +11,10 @@ type CreateActiveEntitiesStoreParams = {
11
11
  servers: Record<string, Server>;
12
12
  workspaces: Record<string, Workspace>;
13
13
  router?: Router;
14
+ /** Override the active request */
15
+ activeRequestOverride?: ComputedRef<Request | undefined>;
16
+ /** Override the active request example */
17
+ activeExampleOverride?: ComputedRef<RequestExample | undefined>;
14
18
  };
15
19
  type EnvVariable = {
16
20
  key: string;
@@ -22,8 +26,8 @@ type EnvVariable = {
22
26
  *
23
27
  * We need the factory function to pass the router instance
24
28
  */
25
- export declare const createActiveEntitiesStore: ({ collections, requestExamples, requests, router, servers, workspaces, }: CreateActiveEntitiesStoreParams) => {
26
- activeCollection: import("vue").ComputedRef<{
29
+ export declare const createActiveEntitiesStore: ({ collections, requestExamples, requests, router, servers, workspaces, activeRequestOverride, activeExampleOverride, }: CreateActiveEntitiesStoreParams) => {
30
+ activeCollection: ComputedRef<{
27
31
  type: "collection";
28
32
  uid: string;
29
33
  children: string[];
@@ -78,8 +82,8 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
78
82
  documentUrl?: string | undefined;
79
83
  integration?: string | null | undefined;
80
84
  } | undefined>;
81
- activeCookieId: import("vue").ComputedRef<string | undefined>;
82
- activeExample: import("vue").ComputedRef<{
85
+ activeCookieId: ComputedRef<string>;
86
+ activeExample: ComputedRef<{
83
87
  type: "requestExample";
84
88
  uid: string;
85
89
  name: string;
@@ -174,7 +178,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
174
178
  };
175
179
  serverVariables?: Record<string, string[]> | undefined;
176
180
  } | undefined>;
177
- activeRequest: import("vue").ComputedRef<{
181
+ activeRequest: ComputedRef<{
178
182
  path: string;
179
183
  type: "request";
180
184
  uid: string;
@@ -211,7 +215,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
211
215
  requestBody?: any;
212
216
  responses?: Record<string, any> | undefined;
213
217
  } | undefined>;
214
- activeRouterParams: import("vue").ComputedRef<{
218
+ activeRouterParams: ComputedRef<{
215
219
  collection: string;
216
220
  environment: string;
217
221
  request: string;
@@ -222,7 +226,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
222
226
  workspace: string;
223
227
  settings: string;
224
228
  }>;
225
- activeEnvironment: import("vue").ComputedRef<{
229
+ activeEnvironment: ComputedRef<{
226
230
  uid: string;
227
231
  color: string;
228
232
  name: string;
@@ -235,7 +239,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
235
239
  color: string;
236
240
  isDefault: boolean;
237
241
  }>;
238
- activeServer: import("vue").ComputedRef<{
242
+ activeServer: ComputedRef<{
239
243
  uid: string;
240
244
  url: string;
241
245
  description?: string | undefined;
@@ -243,7 +247,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
243
247
  enum?: [string, ...string[]];
244
248
  }> | undefined;
245
249
  } | undefined>;
246
- activeWorkspace: import("vue").ComputedRef<{
250
+ activeWorkspace: ComputedRef<{
247
251
  uid: string;
248
252
  name: string;
249
253
  description: string;
@@ -261,7 +265,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
261
265
  } | undefined;
262
266
  proxyUrl?: string | undefined;
263
267
  } | undefined>;
264
- activeWorkspaceCollections: import("vue").ComputedRef<{
268
+ activeWorkspaceCollections: ComputedRef<{
265
269
  type: "collection";
266
270
  uid: string;
267
271
  children: string[];
@@ -316,7 +320,7 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
316
320
  documentUrl?: string | undefined;
317
321
  integration?: string | null | undefined;
318
322
  }[]>;
319
- activeWorkspaceServers: import("vue").ComputedRef<({
323
+ activeWorkspaceServers: ComputedRef<({
320
324
  uid: string;
321
325
  url: string;
322
326
  description?: string | undefined;
@@ -324,8 +328,8 @@ export declare const createActiveEntitiesStore: ({ collections, requestExamples,
324
328
  enum?: [string, ...string[]];
325
329
  }> | undefined;
326
330
  } | undefined)[]>;
327
- activeEnvVariables: import("vue").ComputedRef<EnvVariable[]>;
328
- activeWorkspaceRequests: import("vue").ComputedRef<string[]>;
331
+ activeEnvVariables: ComputedRef<EnvVariable[]>;
332
+ activeWorkspaceRequests: ComputedRef<string[]>;
329
333
  };
330
334
  export type ActiveEntitiesStore = ReturnType<typeof createActiveEntitiesStore>;
331
335
  export declare const ACTIVE_ENTITIES_SYMBOL: InjectionKey<ActiveEntitiesStore>;
@@ -1 +1 @@
1
- {"version":3,"file":"active-entities.d.ts","sourceRoot":"","sources":["../../src/store/active-entities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAErE,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,KAAK,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAIxC,KAAK,+BAA+B,GAAG;IACrC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACzC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IAC/C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACrC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,GAAG,CAAA;IACV,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAA;CAChC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,6EAOnC,+BAA+B;;;;;;;;;;;;;;;;;;uBA6N8mW,CAAC;;;;;;uBAAqK,CAAC;mBAAqC,CAAC;0BAA4C,CAAC;mBAAqC,CAAC;oBAAoB,CAAC;mBAAqC,CAAC;qBAAuC,CAAC;;mBA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3
- import { computed as i, inject as U } from "vue";
4
- import { getRouterParams as j } from "./router-params.js";
2
+ import { isDefined as j } from "@scalar/oas-utils/helpers";
3
+ import { computed as i, inject as w } from "vue";
4
+ import { getRouterParams as P } from "./router-params.js";
5
5
  import { PathId as m } from "../routes.js";
6
- const L = ({
6
+ const z = ({
7
7
  collections: v,
8
8
  requestExamples: N,
9
9
  requests: I,
10
10
  router: O,
11
11
  servers: S,
12
- workspaces: E
12
+ workspaces: E,
13
+ // TODO: these are temporary until we allow providing each entity individually
14
+ activeRequestOverride: q,
15
+ activeExampleOverride: C
13
16
  }) => {
14
- const l = i(j(O)), a = i(() => E[l.value[m.Workspace]] ?? E[Object.keys(E)[0] ?? ""]), f = i(
17
+ const l = i(P(O)), a = i(() => E[l.value[m.Workspace]] ?? E[Object.keys(E)[0] ?? ""]), f = i(
15
18
  () => {
16
19
  var e;
17
- return ((e = a.value) == null ? void 0 : e.collections.map((t) => v[t]).filter(M).sort((t, n) => {
20
+ return ((e = a.value) == null ? void 0 : e.collections.map((t) => v[t]).filter(j).sort((t, n) => {
18
21
  var s, o;
19
22
  return ((s = t.info) == null ? void 0 : s.title) === "Drafts" ? 1 : ((o = n.info) == null ? void 0 : o.title) === "Drafts" ? -1 : 0;
20
23
  })) ?? [];
21
24
  }
22
- ), q = i(
25
+ ), h = i(
23
26
  () => {
24
27
  var e;
25
28
  return (e = f.value) == null ? void 0 : e.flatMap(
26
29
  (t) => t.servers.map((n) => S[n])
27
30
  );
28
31
  }
29
- ), C = i(
32
+ ), A = i(
30
33
  () => {
31
34
  var e;
32
35
  return ((e = f.value) == null ? void 0 : e.flatMap(
@@ -43,9 +46,9 @@ const L = ({
43
46
  value: JSON.stringify((n = a.value) == null ? void 0 : n.environments, null, 2)
44
47
  };
45
48
  const e = f.value.find(
46
- (J) => {
49
+ (U) => {
47
50
  var g, x;
48
- return (x = J["x-scalar-environments"]) == null ? void 0 : x[((g = a.value) == null ? void 0 : g.activeEnvironmentId) ?? ""];
51
+ return (x = U["x-scalar-environments"]) == null ? void 0 : x[((g = a.value) == null ? void 0 : g.activeEnvironmentId) ?? ""];
49
52
  }
50
53
  );
51
54
  return e && ((s = a.value) != null && s.activeEnvironmentId) ? {
@@ -64,11 +67,11 @@ const L = ({
64
67
  name: "No Environment",
65
68
  value: JSON.stringify(a.value.environments, null, 2)
66
69
  };
67
- }), d = i(() => {
70
+ }), d = q ?? i(() => {
68
71
  var n;
69
72
  const e = l.value[m.Request], t = v[l.value.collection] || v[((n = a.value) == null ? void 0 : n.collections[0]) ?? ""];
70
73
  return I[e] || I[(t == null ? void 0 : t.requests[0]) ?? ""];
71
- }), h = i(() => {
74
+ }), R = C ?? i(() => {
72
75
  var t;
73
76
  const e = l.value[m.Examples] === "default" ? ((t = d.value) == null ? void 0 : t.examples[0]) || "" : l.value[m.Examples];
74
77
  return N[e];
@@ -84,14 +87,14 @@ const L = ({
84
87
  );
85
88
  const t = ((s = a.value) == null ? void 0 : s.collections[0]) ?? ((o = v[0]) == null ? void 0 : o.uid) ?? "";
86
89
  return v[t];
87
- }), A = i(
90
+ }), W = i(
88
91
  () => {
89
92
  var e, t, n;
90
93
  return S[(((e = d.value) == null ? void 0 : e.selectedServerUid) || ((t = k.value) == null ? void 0 : t.selectedServerUid) || ((n = k.value) == null ? void 0 : n.servers[0])) ?? ""];
91
94
  }
92
- ), R = i(
95
+ ), J = i(
93
96
  () => l.value[m.Cookies]
94
- ), W = i(() => {
97
+ ), M = i(() => {
95
98
  var c;
96
99
  const e = ((c = a.value) == null ? void 0 : c.environments) ?? {}, t = p.value.uid ? JSON.parse(p.value.value) : {}, n = D(e).map(
97
100
  ([r, u]) => ({
@@ -114,25 +117,25 @@ const L = ({
114
117
  });
115
118
  return {
116
119
  activeCollection: k,
117
- activeCookieId: R,
118
- activeExample: h,
120
+ activeCookieId: J,
121
+ activeExample: R,
119
122
  activeRequest: d,
120
123
  activeRouterParams: l,
121
124
  activeEnvironment: p,
122
- activeServer: A,
125
+ activeServer: W,
123
126
  activeWorkspace: a,
124
127
  activeWorkspaceCollections: f,
125
- activeWorkspaceServers: q,
126
- activeEnvVariables: W,
127
- activeWorkspaceRequests: C
128
+ activeWorkspaceServers: h,
129
+ activeEnvVariables: M,
130
+ activeWorkspaceRequests: A
128
131
  };
129
- }, w = Symbol(), Y = () => {
130
- const v = U(w);
132
+ }, T = Symbol(), F = () => {
133
+ const v = w(T);
131
134
  if (!v) throw new Error("Active entities store not provided");
132
135
  return v;
133
136
  };
134
137
  export {
135
- w as ACTIVE_ENTITIES_SYMBOL,
136
- L as createActiveEntitiesStore,
137
- Y as useActiveEntities
138
+ T as ACTIVE_ENTITIES_SYMBOL,
139
+ z as createActiveEntitiesStore,
140
+ F as useActiveEntities
138
141
  };