@scalar/types 0.3.0 → 0.3.1

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 (46) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/api-reference/api-client-configuration.d.ts +122 -0
  3. package/dist/api-reference/api-client-configuration.d.ts.map +1 -0
  4. package/dist/api-reference/api-client-configuration.js +7 -0
  5. package/dist/api-reference/api-client-configuration.js.map +7 -0
  6. package/dist/{api-client → api-reference}/api-client-plugin.d.ts +6 -3
  7. package/dist/api-reference/api-client-plugin.d.ts.map +1 -0
  8. package/dist/{api-client → api-reference}/api-client-plugin.js +10 -10
  9. package/dist/{api-client → api-reference}/api-client-plugin.js.map +3 -3
  10. package/dist/api-reference/api-reference-configuration.d.ts +58 -525
  11. package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
  12. package/dist/api-reference/api-reference-configuration.js +264 -501
  13. package/dist/api-reference/api-reference-configuration.js.map +2 -2
  14. package/dist/api-reference/api-reference-plugin.d.ts +4 -4
  15. package/dist/api-reference/api-reference-plugin.d.ts.map +1 -1
  16. package/dist/api-reference/api-reference-plugin.js +5 -5
  17. package/dist/api-reference/api-reference-plugin.js.map +2 -2
  18. package/dist/api-reference/base-configuration.d.ts +118 -0
  19. package/dist/api-reference/base-configuration.d.ts.map +1 -0
  20. package/dist/api-reference/base-configuration.js +139 -0
  21. package/dist/api-reference/base-configuration.js.map +7 -0
  22. package/dist/api-reference/html-rendering-configuration.d.ts +2 -2
  23. package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
  24. package/dist/api-reference/html-rendering-configuration.js.map +2 -2
  25. package/dist/api-reference/index.d.ts +6 -3
  26. package/dist/api-reference/index.d.ts.map +1 -1
  27. package/dist/api-reference/index.js +12 -3
  28. package/dist/api-reference/index.js.map +2 -2
  29. package/dist/api-reference/source-configuration.d.ts +18 -0
  30. package/dist/api-reference/source-configuration.d.ts.map +1 -0
  31. package/dist/api-reference/source-configuration.js +87 -0
  32. package/dist/api-reference/source-configuration.js.map +7 -0
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/index.js.map +2 -2
  37. package/dist/snippetz/snippetz.d.ts +1 -1
  38. package/dist/snippetz/snippetz.d.ts.map +1 -1
  39. package/dist/snippetz/snippetz.js +1 -0
  40. package/dist/snippetz/snippetz.js.map +2 -2
  41. package/package.json +2 -2
  42. package/dist/api-client/api-client-plugin.d.ts.map +0 -1
  43. package/dist/api-client/index.d.ts +0 -2
  44. package/dist/api-client/index.d.ts.map +0 -1
  45. package/dist/api-client/index.js +0 -6
  46. package/dist/api-client/index.js.map +0 -7
@@ -0,0 +1,87 @@
1
+ import z from "zod";
2
+ const sourceConfigurationSchema = z.object({
3
+ /**
4
+ * URL to an OpenAPI/Swagger document
5
+ * @example
6
+ * ```ts
7
+ * const oldConfiguration = {
8
+ * spec: {
9
+ * url: 'https://example.com/openapi.json',
10
+ * },
11
+ * }
12
+ *
13
+ * const newConfiguration = {
14
+ * url: 'https://example.com/openapi.json',
15
+ * }
16
+ * ```
17
+ **/
18
+ url: z.string().optional(),
19
+ /**
20
+ * Directly embed the OpenAPI document.
21
+ * Can be a string, object, function returning an object, or null.
22
+ *
23
+ * @remarks It's recommended to pass a URL instead of content.
24
+ * @example
25
+ * ```ts
26
+ * const oldConfiguration = {
27
+ * spec: {
28
+ * content: '…',
29
+ * },
30
+ * }
31
+ *
32
+ * const newConfiguration = {
33
+ * content: '…',
34
+ * }
35
+ * ```
36
+ **/
37
+ content: z.union([
38
+ z.string(),
39
+ z.null(),
40
+ z.record(z.string(), z.any()),
41
+ z.function({
42
+ input: [],
43
+ output: z.record(z.string(), z.any())
44
+ })
45
+ ]).optional(),
46
+ /**
47
+ * The title of the OpenAPI document.
48
+ *
49
+ * @example 'Scalar Galaxy'
50
+ *
51
+ * @deprecated Please move `title` to the top level and remove the `spec` prefix.
52
+ */
53
+ title: z.string().optional(),
54
+ /**
55
+ * The slug of the OpenAPI document used in the URL.
56
+ *
57
+ * If none is passed, the title will be used.
58
+ *
59
+ * If no title is used, it'll just use the index.
60
+ *
61
+ * @example 'scalar-galaxy'
62
+ *
63
+ * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
64
+ */
65
+ slug: z.string().optional(),
66
+ /**
67
+ * The OpenAPI/Swagger document to render
68
+ *
69
+ * @deprecated Use `url` and `content` on the top level instead.
70
+ **/
71
+ spec: z.object({
72
+ url: z.string().optional(),
73
+ content: z.union([
74
+ z.string(),
75
+ z.null(),
76
+ z.record(z.string(), z.any()),
77
+ z.function({
78
+ input: [],
79
+ output: z.record(z.string(), z.any())
80
+ })
81
+ ]).optional()
82
+ }).optional()
83
+ });
84
+ export {
85
+ sourceConfigurationSchema
86
+ };
87
+ //# sourceMappingURL=source-configuration.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/api-reference/source-configuration.ts"],
4
+ "sourcesContent": ["import z from 'zod'\n\n/**\n * A source is any potential document input used for API Reference\n * and API Client integrations. Sources may be specified in the configuration\n * or used independently. Some configurations may have multiple sources.\n */\nexport const sourceConfigurationSchema = z.object({\n /**\n * URL to an OpenAPI/Swagger document\n * @example\n * ```ts\n * const oldConfiguration = {\n * spec: {\n * url: 'https://example.com/openapi.json',\n * },\n * }\n *\n * const newConfiguration = {\n * url: 'https://example.com/openapi.json',\n * }\n * ```\n **/\n url: z.string().optional(),\n /**\n * Directly embed the OpenAPI document.\n * Can be a string, object, function returning an object, or null.\n *\n * @remarks It's recommended to pass a URL instead of content.\n * @example\n * ```ts\n * const oldConfiguration = {\n * spec: {\n * content: '\u2026',\n * },\n * }\n *\n * const newConfiguration = {\n * content: '\u2026',\n * }\n * ```\n **/\n content: z\n .union([\n z.string(),\n z.null(),\n z.record(z.string(), z.any()),\n z.function({\n input: [],\n output: z.record(z.string(), z.any()),\n }),\n ])\n .optional(),\n /**\n * The title of the OpenAPI document.\n *\n * @example 'Scalar Galaxy'\n *\n * @deprecated Please move `title` to the top level and remove the `spec` prefix.\n */\n title: z.string().optional(),\n /**\n * The slug of the OpenAPI document used in the URL.\n *\n * If none is passed, the title will be used.\n *\n * If no title is used, it'll just use the index.\n *\n * @example 'scalar-galaxy'\n *\n * @deprecated Please move `slug` to the top level and remove the `spec` prefix.\n */\n slug: z.string().optional(),\n /**\n * The OpenAPI/Swagger document to render\n *\n * @deprecated Use `url` and `content` on the top level instead.\n **/\n spec: z\n .object({\n url: z.string().optional(),\n content: z\n .union([\n z.string(),\n z.null(),\n z.record(z.string(), z.any()),\n z.function({\n input: [],\n output: z.record(z.string(), z.any()),\n }),\n ])\n .optional(),\n })\n .optional(),\n})\n\nexport type SourceConfiguration = z.infer<typeof sourceConfigurationSchema>\n"],
5
+ "mappings": "AAAA,OAAO,OAAO;AAOP,MAAM,4BAA4B,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBhD,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzB,SAAS,EACN,MAAM;AAAA,IACL,EAAE,OAAO;AAAA,IACT,EAAE,KAAK;AAAA,IACP,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,IAC5B,EAAE,SAAS;AAAA,MACT,OAAO,CAAC;AAAA,MACR,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,IACtC,CAAC;AAAA,EACH,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY3B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,MAAM,EACH,OAAO;AAAA,IACN,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,IACzB,SAAS,EACN,MAAM;AAAA,MACL,EAAE,OAAO;AAAA,MACT,EAAE,KAAK;AAAA,MACP,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,MAC5B,EAAE,SAAS;AAAA,QACT,OAAO,CAAC;AAAA,QACR,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,MACtC,CAAC;AAAA,IACH,CAAC,EACA,SAAS;AAAA,EACd,CAAC,EACA,SAAS;AACd,CAAC;",
6
+ "names": []
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** We should not use these exports anymore, but we need them for commonjs compatibility. */
2
- export * from './legacy/index.js';
3
2
  export * from './api-reference/index.js';
3
+ export * from './legacy/index.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAE5F,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./legacy/index.js";
2
1
  export * from "./api-reference/index.js";
2
+ export * from "./legacy/index.js";
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/** We should not use these exports anymore, but we need them for commonjs compatibility. */\nexport * from './legacy/index'\nexport * from './api-reference/index'\n"],
5
- "mappings": "AACA,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["/** We should not use these exports anymore, but we need them for commonjs compatibility. */\n\nexport * from './api-reference/index'\nexport * from './legacy/index'\n"],
5
+ "mappings": "AAEA,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,7 @@ export type { Param as FormDataParam, Request as HarRequest } from 'har-format';
4
4
  /**
5
5
  * List of available clients
6
6
  */
7
- export declare const AVAILABLE_CLIENTS: readonly ["c/libcurl", "clojure/clj_http", "csharp/httpclient", "csharp/restsharp", "dart/http", "go/native", "http/http1.1", "java/asynchttp", "java/nethttp", "java/okhttp", "java/unirest", "js/axios", "js/fetch", "js/jquery", "js/ofetch", "js/xhr", "kotlin/okhttp", "node/axios", "node/fetch", "node/ofetch", "node/undici", "objc/nsurlsession", "ocaml/cohttp", "php/curl", "php/guzzle", "powershell/restmethod", "powershell/webrequest", "python/python3", "python/requests", "python/httpx_sync", "python/httpx_async", "r/httr", "ruby/native", "rust/reqwest", "shell/curl", "shell/httpie", "shell/wget", "swift/nsurlsession"];
7
+ export declare const AVAILABLE_CLIENTS: readonly ["c/libcurl", "clojure/clj_http", "csharp/httpclient", "csharp/restsharp", "dart/http", "fsharp/httpclient", "go/native", "http/http1.1", "java/asynchttp", "java/nethttp", "java/okhttp", "java/unirest", "js/axios", "js/fetch", "js/jquery", "js/ofetch", "js/xhr", "kotlin/okhttp", "node/axios", "node/fetch", "node/ofetch", "node/undici", "objc/nsurlsession", "ocaml/cohttp", "php/curl", "php/guzzle", "powershell/restmethod", "powershell/webrequest", "python/python3", "python/requests", "python/httpx_sync", "python/httpx_async", "r/httr", "ruby/native", "rust/reqwest", "shell/curl", "shell/httpie", "shell/wget", "swift/nsurlsession"];
8
8
  /** Non read only tuple of available clients */
9
9
  export type AvailableClients = Writable<typeof AVAILABLE_CLIENTS>;
10
10
  /** A union for a single available client */
@@ -1 +1 @@
1
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/asynchttp",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/snippetz/snippetz.ts"],
4
- "sourcesContent": ["import type { Request as HarRequest } from 'har-format'\nimport type { Writable } from 'type-fest/source/writable'\n\nexport type { Param as FormDataParam, Request as HarRequest } from 'har-format'\n\n/**\n * List of available clients\n */\nexport const AVAILABLE_CLIENTS = [\n 'c/libcurl',\n 'clojure/clj_http',\n 'csharp/httpclient',\n 'csharp/restsharp',\n 'dart/http',\n 'go/native',\n 'http/http1.1',\n 'java/asynchttp',\n 'java/nethttp',\n 'java/okhttp',\n 'java/unirest',\n 'js/axios',\n 'js/fetch',\n 'js/jquery',\n 'js/ofetch',\n 'js/xhr',\n 'kotlin/okhttp',\n 'node/axios',\n 'node/fetch',\n 'node/ofetch',\n 'node/undici',\n 'objc/nsurlsession',\n 'ocaml/cohttp',\n 'php/curl',\n 'php/guzzle',\n 'powershell/restmethod',\n 'powershell/webrequest',\n 'python/python3',\n 'python/requests',\n 'python/httpx_sync',\n 'python/httpx_async',\n 'r/httr',\n 'ruby/native',\n 'rust/reqwest',\n 'shell/curl',\n 'shell/httpie',\n 'shell/wget',\n 'swift/nsurlsession',\n] as const\n\n/** Non read only tuple of available clients */\nexport type AvailableClients = Writable<typeof AVAILABLE_CLIENTS>\n/** A union for a single available client */\nexport type AvailableClient = AvailableClients[number]\n/** A non read only array of available clients */\nexport type AvailableClientsArray = AvailableClients[number][]\n\n/** Programming language */\nexport type TargetId = AvailableClients[number] extends `${infer T}/${string}` ? T : never\n\n/** Configuration for a target */\nexport type Target = {\n [K in TargetId]: {\n key: K\n title: string\n default: ClientId<K>\n clients: Plugin[]\n }\n}[TargetId]\n\n/** HTTP client */\nexport type ClientId<T extends string> = T extends TargetId\n ? Extract<AvailableClients[number], `${T}/${string}`> extends `${T}/${infer C}`\n ? C\n : never\n : never\n\n/** What any plugins needs to return */\nexport type Plugin = {\n /** The language or environment. */\n target: TargetId\n /** The identifier of the client. */\n client: ClientId<TargetId>\n /** The title of the client. */\n title: string\n /** The actual source code. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration for any plugin\n */\nexport type PluginConfiguration = {\n /** Credentials to add HTTP Basic Authentication */\n auth?: { username: string; password: string }\n}\n"],
5
- "mappings": "AAQO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import type { Request as HarRequest } from 'har-format'\nimport type { Writable } from 'type-fest/source/writable'\n\nexport type { Param as FormDataParam, Request as HarRequest } from 'har-format'\n\n/**\n * List of available clients\n */\nexport const AVAILABLE_CLIENTS = [\n 'c/libcurl',\n 'clojure/clj_http',\n 'csharp/httpclient',\n 'csharp/restsharp',\n 'dart/http',\n 'fsharp/httpclient',\n 'go/native',\n 'http/http1.1',\n 'java/asynchttp',\n 'java/nethttp',\n 'java/okhttp',\n 'java/unirest',\n 'js/axios',\n 'js/fetch',\n 'js/jquery',\n 'js/ofetch',\n 'js/xhr',\n 'kotlin/okhttp',\n 'node/axios',\n 'node/fetch',\n 'node/ofetch',\n 'node/undici',\n 'objc/nsurlsession',\n 'ocaml/cohttp',\n 'php/curl',\n 'php/guzzle',\n 'powershell/restmethod',\n 'powershell/webrequest',\n 'python/python3',\n 'python/requests',\n 'python/httpx_sync',\n 'python/httpx_async',\n 'r/httr',\n 'ruby/native',\n 'rust/reqwest',\n 'shell/curl',\n 'shell/httpie',\n 'shell/wget',\n 'swift/nsurlsession',\n] as const\n\n/** Non read only tuple of available clients */\nexport type AvailableClients = Writable<typeof AVAILABLE_CLIENTS>\n/** A union for a single available client */\nexport type AvailableClient = AvailableClients[number]\n/** A non read only array of available clients */\nexport type AvailableClientsArray = AvailableClients[number][]\n\n/** Programming language */\nexport type TargetId = AvailableClients[number] extends `${infer T}/${string}` ? T : never\n\n/** Configuration for a target */\nexport type Target = {\n [K in TargetId]: {\n key: K\n title: string\n default: ClientId<K>\n clients: Plugin[]\n }\n}[TargetId]\n\n/** HTTP client */\nexport type ClientId<T extends string> = T extends TargetId\n ? Extract<AvailableClients[number], `${T}/${string}`> extends `${T}/${infer C}`\n ? C\n : never\n : never\n\n/** What any plugins needs to return */\nexport type Plugin = {\n /** The language or environment. */\n target: TargetId\n /** The identifier of the client. */\n client: ClientId<TargetId>\n /** The title of the client. */\n title: string\n /** The actual source code. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration for any plugin\n */\nexport type PluginConfiguration = {\n /** Credentials to add HTTP Basic Authentication */\n auth?: { username: string; password: string }\n}\n"],
5
+ "mappings": "AAQO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "scalar",
17
17
  "references"
18
18
  ],
19
- "version": "0.3.0",
19
+ "version": "0.3.1",
20
20
  "engines": {
21
21
  "node": ">=20"
22
22
  },
@@ -67,7 +67,7 @@
67
67
  "nanoid": "5.1.5",
68
68
  "type-fest": "4.41.0",
69
69
  "zod": "4.1.11",
70
- "@scalar/openapi-types": "0.4.0"
70
+ "@scalar/openapi-types": "0.4.1"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/har-format": "^1.2.15",
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-client/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;iBAatB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { type ApiClientPlugin, ApiClientPluginSchema, HooksSchema } from './api-client-plugin.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1,6 +0,0 @@
1
- import { ApiClientPluginSchema, HooksSchema } from "./api-client-plugin.js";
2
- export {
3
- ApiClientPluginSchema,
4
- HooksSchema
5
- };
6
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-client/index.ts"],
4
- "sourcesContent": ["export { type ApiClientPlugin, ApiClientPluginSchema, HooksSchema } from './api-client-plugin'\n"],
5
- "mappings": "AAAA,SAA+B,uBAAuB,mBAAmB;",
6
- "names": []
7
- }