@epcc-sdk/sdks-files 0.0.3 → 0.2.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 (121) hide show
  1. package/README.md +37 -6
  2. package/dist/client/client/client.gen.cjs +229 -0
  3. package/dist/client/client/client.gen.cjs.map +1 -0
  4. package/dist/client/client/client.gen.d.cts +10 -0
  5. package/dist/client/client/client.gen.d.ts +10 -0
  6. package/dist/client/client/client.gen.mjs +213 -0
  7. package/dist/client/client/client.gen.mjs.map +1 -0
  8. package/dist/client/client/index.cjs +47 -0
  9. package/dist/client/client/index.cjs.map +1 -0
  10. package/dist/client/client/index.d.cts +9 -0
  11. package/dist/client/client/index.d.ts +9 -0
  12. package/dist/client/client/index.mjs +20 -0
  13. package/dist/client/client/index.mjs.map +1 -0
  14. package/dist/client/client/types.gen.cjs +17 -0
  15. package/dist/client/client/types.gen.cjs.map +1 -0
  16. package/dist/client/client/types.gen.d.cts +6 -0
  17. package/dist/client/client/types.gen.d.ts +6 -0
  18. package/dist/client/client/types.gen.mjs +1 -0
  19. package/dist/client/client/types.gen.mjs.map +1 -0
  20. package/dist/client/client/utils.gen.cjs +263 -0
  21. package/dist/client/client/utils.gen.cjs.map +1 -0
  22. package/dist/client/client/utils.gen.d.cts +6 -0
  23. package/dist/client/client/utils.gen.d.ts +6 -0
  24. package/dist/client/client/utils.gen.mjs +237 -0
  25. package/dist/client/client/utils.gen.mjs.map +1 -0
  26. package/dist/client/client.gen.cjs +34 -0
  27. package/dist/client/client.gen.cjs.map +1 -0
  28. package/dist/client/client.gen.d.cts +20 -0
  29. package/dist/client/client.gen.d.ts +20 -0
  30. package/dist/client/client.gen.mjs +13 -0
  31. package/dist/client/client.gen.mjs.map +1 -0
  32. package/dist/client/core/auth.gen.cjs +41 -0
  33. package/dist/client/core/auth.gen.cjs.map +1 -0
  34. package/dist/client/core/auth.gen.d.cts +27 -0
  35. package/dist/client/core/auth.gen.d.ts +27 -0
  36. package/dist/client/core/auth.gen.mjs +17 -0
  37. package/dist/client/core/auth.gen.mjs.map +1 -0
  38. package/dist/client/core/bodySerializer.gen.cjs +86 -0
  39. package/dist/client/core/bodySerializer.gen.cjs.map +1 -0
  40. package/dist/client/core/bodySerializer.gen.d.cts +27 -0
  41. package/dist/client/core/bodySerializer.gen.d.ts +27 -0
  42. package/dist/client/core/bodySerializer.gen.mjs +60 -0
  43. package/dist/client/core/bodySerializer.gen.mjs.map +1 -0
  44. package/dist/client/core/params.gen.cjs +128 -0
  45. package/dist/client/core/params.gen.cjs.map +1 -0
  46. package/dist/client/core/params.gen.d.cts +44 -0
  47. package/dist/client/core/params.gen.d.ts +44 -0
  48. package/dist/client/core/params.gen.mjs +104 -0
  49. package/dist/client/core/params.gen.mjs.map +1 -0
  50. package/dist/client/core/pathSerializer.gen.cjs +164 -0
  51. package/dist/client/core/pathSerializer.gen.cjs.map +1 -0
  52. package/dist/client/core/pathSerializer.gen.d.cts +34 -0
  53. package/dist/client/core/pathSerializer.gen.d.ts +34 -0
  54. package/dist/client/core/pathSerializer.gen.mjs +135 -0
  55. package/dist/client/core/pathSerializer.gen.mjs.map +1 -0
  56. package/dist/client/core/queryKeySerializer.gen.cjs +109 -0
  57. package/dist/client/core/queryKeySerializer.gen.cjs.map +1 -0
  58. package/dist/client/core/queryKeySerializer.gen.d.cts +20 -0
  59. package/dist/client/core/queryKeySerializer.gen.d.ts +20 -0
  60. package/dist/client/core/queryKeySerializer.gen.mjs +83 -0
  61. package/dist/client/core/queryKeySerializer.gen.mjs.map +1 -0
  62. package/dist/client/core/serverSentEvents.gen.cjs +162 -0
  63. package/dist/client/core/serverSentEvents.gen.cjs.map +1 -0
  64. package/dist/client/core/serverSentEvents.gen.d.cts +77 -0
  65. package/dist/client/core/serverSentEvents.gen.d.ts +77 -0
  66. package/dist/client/core/serverSentEvents.gen.mjs +138 -0
  67. package/dist/client/core/serverSentEvents.gen.mjs.map +1 -0
  68. package/dist/client/core/types.gen.cjs +17 -0
  69. package/dist/client/core/types.gen.cjs.map +1 -0
  70. package/dist/client/core/types.gen.d.cts +86 -0
  71. package/dist/client/core/types.gen.d.ts +86 -0
  72. package/dist/client/core/types.gen.mjs +1 -0
  73. package/dist/client/core/types.gen.mjs.map +1 -0
  74. package/dist/client/core/utils.gen.cjs +136 -0
  75. package/dist/client/core/utils.gen.cjs.map +1 -0
  76. package/dist/client/core/utils.gen.d.cts +23 -0
  77. package/dist/client/core/utils.gen.d.ts +23 -0
  78. package/dist/client/core/utils.gen.mjs +113 -0
  79. package/dist/client/core/utils.gen.mjs.map +1 -0
  80. package/dist/client/index.cjs +15 -5
  81. package/dist/client/index.cjs.map +1 -1
  82. package/dist/client/index.d.cts +8 -3
  83. package/dist/client/index.d.ts +8 -3
  84. package/dist/client/index.mjs +12 -2
  85. package/dist/client/index.mjs.map +1 -1
  86. package/dist/client/sdk.gen.cjs +27 -57
  87. package/dist/client/sdk.gen.cjs.map +1 -1
  88. package/dist/client/sdk.gen.d.cts +29 -17
  89. package/dist/client/sdk.gen.d.ts +29 -17
  90. package/dist/client/sdk.gen.mjs +27 -58
  91. package/dist/client/sdk.gen.mjs.map +1 -1
  92. package/dist/client/types.gen.cjs.map +1 -1
  93. package/dist/client/types.gen.d.cts +6 -3
  94. package/dist/client/types.gen.d.ts +6 -3
  95. package/dist/client/zod.gen.cjs +165 -0
  96. package/dist/client/zod.gen.cjs.map +1 -0
  97. package/dist/client/zod.gen.d.cts +906 -0
  98. package/dist/client/zod.gen.d.ts +906 -0
  99. package/dist/client/zod.gen.mjs +122 -0
  100. package/dist/client/zod.gen.mjs.map +1 -0
  101. package/dist/index.cjs +32 -4
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.d.cts +12 -3
  104. package/dist/index.d.ts +12 -3
  105. package/dist/index.mjs +30 -3
  106. package/dist/index.mjs.map +1 -1
  107. package/dist/runtime.cjs +33 -0
  108. package/dist/runtime.cjs.map +1 -0
  109. package/dist/runtime.d.cts +12 -0
  110. package/dist/runtime.d.ts +12 -0
  111. package/dist/runtime.mjs +9 -0
  112. package/dist/runtime.mjs.map +1 -0
  113. package/dist/types.gen-DXwTHYA3.d.ts +157 -0
  114. package/dist/types.gen-mB6gWg8u.d.cts +157 -0
  115. package/dist/zod.cjs +23 -0
  116. package/dist/zod.cjs.map +1 -0
  117. package/dist/zod.d.cts +2 -0
  118. package/dist/zod.d.ts +2 -0
  119. package/dist/zod.mjs +2 -0
  120. package/dist/zod.mjs.map +1 -0
  121. package/package.json +36 -7
@@ -0,0 +1,44 @@
1
+ type Slot = "body" | "headers" | "path" | "query";
2
+ type Field = {
3
+ in: Exclude<Slot, "body">;
4
+ /**
5
+ * Field name. This is the name we want the user to see and use.
6
+ */
7
+ key: string;
8
+ /**
9
+ * Field mapped name. This is the name we want to use in the request.
10
+ * If omitted, we use the same value as `key`.
11
+ */
12
+ map?: string;
13
+ } | {
14
+ in: Extract<Slot, "body">;
15
+ /**
16
+ * Key isn't required for bodies.
17
+ */
18
+ key?: string;
19
+ map?: string;
20
+ } | {
21
+ /**
22
+ * Field name. This is the name we want the user to see and use.
23
+ */
24
+ key: string;
25
+ /**
26
+ * Field mapped name. This is the name we want to use in the request.
27
+ * If `in` is omitted, `map` aliases `key` to the transport layer.
28
+ */
29
+ map: Slot;
30
+ };
31
+ interface Fields {
32
+ allowExtra?: Partial<Record<Slot, boolean>>;
33
+ args?: ReadonlyArray<Field>;
34
+ }
35
+ type FieldsConfig = ReadonlyArray<Field | Fields>;
36
+ interface Params {
37
+ body?: unknown;
38
+ headers: Record<string, unknown>;
39
+ path: Record<string, unknown>;
40
+ query: Record<string, unknown>;
41
+ }
42
+ declare function buildClientParams(args: ReadonlyArray<unknown>, fields: FieldsConfig): Params;
43
+
44
+ export { type Field, type Fields, type FieldsConfig, buildClientParams };
@@ -0,0 +1,104 @@
1
+ const extraPrefixesMap = {
2
+ $body_: "body",
3
+ $headers_: "headers",
4
+ $path_: "path",
5
+ $query_: "query"
6
+ };
7
+ const extraPrefixes = Object.entries(extraPrefixesMap);
8
+ function buildKeyMap(fields, map) {
9
+ if (!map) {
10
+ map = /* @__PURE__ */ new Map();
11
+ }
12
+ for (const config of fields) {
13
+ if ("in" in config) {
14
+ if (config.key) {
15
+ map.set(config.key, {
16
+ in: config.in,
17
+ map: config.map
18
+ });
19
+ }
20
+ } else if ("key" in config) {
21
+ map.set(config.key, {
22
+ map: config.map
23
+ });
24
+ } else if (config.args) {
25
+ buildKeyMap(config.args, map);
26
+ }
27
+ }
28
+ return map;
29
+ }
30
+ function stripEmptySlots(params) {
31
+ for (const [slot, value] of Object.entries(params)) {
32
+ if (slot === "body") continue;
33
+ if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
34
+ delete params[slot];
35
+ }
36
+ }
37
+ }
38
+ function buildClientParams(args, fields) {
39
+ const params = {
40
+ headers: /* @__PURE__ */ Object.create(null),
41
+ path: /* @__PURE__ */ Object.create(null),
42
+ query: /* @__PURE__ */ Object.create(null)
43
+ };
44
+ const map = buildKeyMap(fields);
45
+ function writeSlot(slot, key, value) {
46
+ let record = params[slot];
47
+ if (record === void 0) {
48
+ record = /* @__PURE__ */ Object.create(null);
49
+ params[slot] = record;
50
+ }
51
+ record[key] = value;
52
+ }
53
+ let config;
54
+ for (const [index, arg] of args.entries()) {
55
+ if (fields[index]) {
56
+ config = fields[index];
57
+ }
58
+ if (!config) {
59
+ continue;
60
+ }
61
+ if ("in" in config) {
62
+ if (config.key) {
63
+ const field = map.get(config.key);
64
+ const name = field.map || config.key;
65
+ if (field.in) {
66
+ writeSlot(field.in, name, arg);
67
+ }
68
+ } else {
69
+ params.body = arg;
70
+ }
71
+ } else {
72
+ for (const [key, value] of Object.entries(arg ?? {})) {
73
+ const field = map.get(key);
74
+ if (field) {
75
+ if (field.in) {
76
+ const name = field.map || key;
77
+ writeSlot(field.in, name, value);
78
+ } else {
79
+ params[field.map] = value;
80
+ }
81
+ } else {
82
+ const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
83
+ if (extra) {
84
+ const [prefix, slot] = extra;
85
+ writeSlot(slot, key.slice(prefix.length), value);
86
+ } else if ("allowExtra" in config && config.allowExtra) {
87
+ for (const [slot, allowed] of Object.entries(config.allowExtra)) {
88
+ if (allowed) {
89
+ writeSlot(slot, key, value);
90
+ break;
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ stripEmptySlots(params);
99
+ return params;
100
+ }
101
+ export {
102
+ buildClientParams
103
+ };
104
+ //# sourceMappingURL=params.gen.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/core/params.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\ntype Slot = \"body\" | \"headers\" | \"path\" | \"query\"\n\nexport type Field =\n | {\n in: Exclude<Slot, \"body\">\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If omitted, we use the same value as `key`.\n */\n map?: string\n }\n | {\n in: Extract<Slot, \"body\">\n /**\n * Key isn't required for bodies.\n */\n key?: string\n map?: string\n }\n | {\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If `in` is omitted, `map` aliases `key` to the transport layer.\n */\n map: Slot\n }\n\nexport interface Fields {\n allowExtra?: Partial<Record<Slot, boolean>>\n args?: ReadonlyArray<Field>\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>\n\nconst extraPrefixesMap: Record<string, Slot> = {\n $body_: \"body\",\n $headers_: \"headers\",\n $path_: \"path\",\n $query_: \"query\",\n}\nconst extraPrefixes = Object.entries(extraPrefixesMap)\n\ntype KeyMap = Map<\n string,\n | {\n in: Slot\n map?: string\n }\n | {\n in?: never\n map: Slot\n }\n>\n\nfunction buildKeyMap(fields: FieldsConfig, map?: KeyMap): KeyMap {\n if (!map) {\n map = new Map()\n }\n\n for (const config of fields) {\n if (\"in\" in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n })\n }\n } else if (\"key\" in config) {\n map.set(config.key, {\n map: config.map,\n })\n } else if (config.args) {\n buildKeyMap(config.args, map)\n }\n }\n\n return map\n}\n\ninterface Params {\n body?: unknown\n headers: Record<string, unknown>\n path: Record<string, unknown>\n query: Record<string, unknown>\n}\n\nfunction stripEmptySlots(params: Params): void {\n for (const [slot, value] of Object.entries(params)) {\n if (slot === \"body\") continue\n if (\n value &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n !Object.keys(value).length\n ) {\n delete params[slot as Slot]\n }\n }\n}\n\nexport function buildClientParams(\n args: ReadonlyArray<unknown>,\n fields: FieldsConfig,\n): Params {\n const params: Params = {\n headers: Object.create(null),\n path: Object.create(null),\n query: Object.create(null),\n }\n\n const map = buildKeyMap(fields)\n\n function writeSlot(slot: Slot, key: string, value: unknown): void {\n let record = params[slot] as Record<string, unknown> | undefined\n if (record === undefined) {\n record = Object.create(null) as Record<string, unknown>\n params[slot] = record\n }\n record[key] = value\n }\n\n let config: FieldsConfig[number] | undefined\n\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index]\n }\n\n if (!config) {\n continue\n }\n\n if (\"in\" in config) {\n if (config.key) {\n const field = map.get(config.key)!\n const name = field.map || config.key\n if (field.in) {\n writeSlot(field.in, name, arg)\n }\n } else {\n params.body = arg\n }\n } else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key)\n\n if (field) {\n if (field.in) {\n const name = field.map || key\n writeSlot(field.in, name, value)\n } else {\n params[field.map] = value\n }\n } else {\n const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))\n\n if (extra) {\n const [prefix, slot] = extra\n writeSlot(slot, key.slice(prefix.length), value)\n } else if (\"allowExtra\" in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n writeSlot(slot as Slot, key, value)\n break\n }\n }\n }\n }\n }\n }\n }\n\n stripEmptySlots(params)\n\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,IACF;AAAA,EACF;AAEA,kBAAgB,MAAM;AAEtB,SAAO;AACT;","names":[]}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pathSerializer_gen_exports = {};
20
+ __export(pathSerializer_gen_exports, {
21
+ separatorArrayExplode: () => separatorArrayExplode,
22
+ separatorArrayNoExplode: () => separatorArrayNoExplode,
23
+ separatorObjectExplode: () => separatorObjectExplode,
24
+ serializeArrayParam: () => serializeArrayParam,
25
+ serializeObjectParam: () => serializeObjectParam,
26
+ serializePrimitiveParam: () => serializePrimitiveParam
27
+ });
28
+ module.exports = __toCommonJS(pathSerializer_gen_exports);
29
+ const separatorArrayExplode = (style) => {
30
+ switch (style) {
31
+ case "label":
32
+ return ".";
33
+ case "matrix":
34
+ return ";";
35
+ case "simple":
36
+ return ",";
37
+ default:
38
+ return "&";
39
+ }
40
+ };
41
+ const separatorArrayNoExplode = (style) => {
42
+ switch (style) {
43
+ case "form":
44
+ return ",";
45
+ case "pipeDelimited":
46
+ return "|";
47
+ case "spaceDelimited":
48
+ return "%20";
49
+ default:
50
+ return ",";
51
+ }
52
+ };
53
+ const separatorObjectExplode = (style) => {
54
+ switch (style) {
55
+ case "label":
56
+ return ".";
57
+ case "matrix":
58
+ return ";";
59
+ case "simple":
60
+ return ",";
61
+ default:
62
+ return "&";
63
+ }
64
+ };
65
+ const serializeArrayParam = ({
66
+ allowReserved,
67
+ explode,
68
+ name,
69
+ style,
70
+ value
71
+ }) => {
72
+ if (!explode) {
73
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
74
+ switch (style) {
75
+ case "label":
76
+ return `.${joinedValues2}`;
77
+ case "matrix":
78
+ return `;${name}=${joinedValues2}`;
79
+ case "simple":
80
+ return joinedValues2;
81
+ default:
82
+ return `${name}=${joinedValues2}`;
83
+ }
84
+ }
85
+ const separator = separatorArrayExplode(style);
86
+ const joinedValues = value.map((v) => {
87
+ if (style === "label" || style === "simple") {
88
+ return allowReserved ? v : encodeURIComponent(v);
89
+ }
90
+ return serializePrimitiveParam({
91
+ allowReserved,
92
+ name,
93
+ value: v
94
+ });
95
+ }).join(separator);
96
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
97
+ };
98
+ const serializePrimitiveParam = ({
99
+ allowReserved,
100
+ name,
101
+ value
102
+ }) => {
103
+ if (value === void 0 || value === null) {
104
+ return "";
105
+ }
106
+ if (typeof value === "object") {
107
+ throw new Error(
108
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
109
+ );
110
+ }
111
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
112
+ };
113
+ const serializeObjectParam = ({
114
+ allowReserved,
115
+ explode,
116
+ name,
117
+ style,
118
+ value,
119
+ valueOnly
120
+ }) => {
121
+ if (value instanceof Date) {
122
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
123
+ }
124
+ if (style !== "deepObject" && !explode) {
125
+ let values = [];
126
+ Object.entries(value).forEach(([key, v]) => {
127
+ values = [
128
+ ...values,
129
+ key,
130
+ allowReserved ? v : encodeURIComponent(v)
131
+ ];
132
+ });
133
+ const joinedValues2 = values.join(",");
134
+ switch (style) {
135
+ case "form":
136
+ return `${name}=${joinedValues2}`;
137
+ case "label":
138
+ return `.${joinedValues2}`;
139
+ case "matrix":
140
+ return `;${name}=${joinedValues2}`;
141
+ default:
142
+ return joinedValues2;
143
+ }
144
+ }
145
+ const separator = separatorObjectExplode(style);
146
+ const joinedValues = Object.entries(value).map(
147
+ ([key, v]) => serializePrimitiveParam({
148
+ allowReserved,
149
+ name: style === "deepObject" ? `${name}[${key}]` : key,
150
+ value: v
151
+ })
152
+ ).join(separator);
153
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
154
+ };
155
+ // Annotate the CommonJS export names for ESM import in node:
156
+ 0 && (module.exports = {
157
+ separatorArrayExplode,
158
+ separatorArrayNoExplode,
159
+ separatorObjectExplode,
160
+ serializeArrayParam,
161
+ serializeObjectParam,
162
+ serializePrimitiveParam
163
+ });
164
+ //# sourceMappingURL=pathSerializer.gen.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/core/pathSerializer.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T>\n extends SerializePrimitiveOptions,\n SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean\n name: string\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean\n style: T\n}\n\nexport type ArrayStyle = \"form\" | \"spaceDelimited\" | \"pipeDelimited\"\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle\ntype MatrixStyle = \"label\" | \"matrix\" | \"simple\"\nexport type ObjectStyle = \"form\" | \"deepObject\"\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string\n}\n\nexport const separatorArrayExplode = (\n style: ArraySeparatorStyle,\n): \".\" | \";\" | \",\" | \"&\" => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const separatorArrayNoExplode = (\n style: ArraySeparatorStyle,\n): \",\" | \"|\" | \"%20\" => {\n switch (style) {\n case \"form\":\n return \",\"\n case \"pipeDelimited\":\n return \"|\"\n case \"spaceDelimited\":\n return \"%20\"\n default:\n return \",\"\n }\n}\n\nexport const separatorObjectExplode = (\n style: ObjectSeparatorStyle,\n): \".\" | \";\" | \",\" | \"&\" => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[]\n}): string => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style))\n switch (style) {\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n case \"simple\":\n return joinedValues\n default:\n return `${name}=${joinedValues}`\n }\n }\n\n const separator = separatorArrayExplode(style)\n const joinedValues = value\n .map((v) => {\n if (style === \"label\" || style === \"simple\") {\n return allowReserved ? v : encodeURIComponent(v as string)\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n })\n })\n .join(separator)\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues\n}\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam): string => {\n if (value === undefined || value === null) {\n return \"\"\n }\n\n if (typeof value === \"object\") {\n throw new Error(\n \"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.\",\n )\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`\n}\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date\n valueOnly?: boolean\n}): string => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`\n }\n\n if (style !== \"deepObject\" && !explode) {\n let values: string[] = []\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? (v as string) : encodeURIComponent(v as string),\n ]\n })\n const joinedValues = values.join(\",\")\n switch (style) {\n case \"form\":\n return `${name}=${joinedValues}`\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n default:\n return joinedValues\n }\n }\n\n const separator = separatorObjectExplode(style)\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === \"deepObject\" ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator)\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BO,MAAM,wBAAwB,CACnC,UAC0B;AAC1B,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,0BAA0B,CACrC,UACsB;AACtB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,yBAAyB,CACpC,UAC0B;AAC1B,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAEc;AAC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AmB,CAAC;AACxB,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,MAAM;AAC1C,eAAS;AAAA,QACP,GAAG;AAAA,QACH;AAAA,QACA,gBAAiB,IAAe,mBAAmB,CAAW;AAAA,MAChE;AAAA,IACF,CAAC;AACD,UAAMA,gBAAe,OAAO,KAAK,GAAG;AACpC,YAAQ,OAAO;AAAA,MACb,KAAK;AACH,eAAO,GAAG,IAAI,IAAIA,aAAY;AAAA,MAChC,KAAK;AACH,eAAO,IAAIA,aAAY;AAAA,MACzB,KAAK;AACH,eAAO,IAAI,IAAI,IAAIA,aAAY;AAAA,MACjC;AACE,eAAOA;AAAA,IACX;AAAA,EACF;AAEA,QAAM,YAAY,uBAAuB,KAAK;AAC9C,QAAM,eAAe,OAAO,QAAQ,KAAK,EACtC;AAAA,IAAI,CAAC,CAAC,KAAK,CAAC,MACX,wBAAwB;AAAA,MACtB;AAAA,MACA,MAAM,UAAU,eAAe,GAAG,IAAI,IAAI,GAAG,MAAM;AAAA,MACnD,OAAO;AAAA,IACT,CAAC;AAAA,EACH,EACC,KAAK,SAAS;AACjB,SAAO,UAAU,WAAW,UAAU,WAClC,YAAY,eACZ;AACN;","names":["joinedValues"]}
@@ -0,0 +1,34 @@
1
+ interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {
2
+ }
3
+ interface SerializePrimitiveOptions {
4
+ allowReserved?: boolean;
5
+ name: string;
6
+ }
7
+ interface SerializerOptions<T> {
8
+ /**
9
+ * @default true
10
+ */
11
+ explode: boolean;
12
+ style: T;
13
+ }
14
+ type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
15
+ type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
16
+ type MatrixStyle = "label" | "matrix" | "simple";
17
+ type ObjectStyle = "form" | "deepObject";
18
+ type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
19
+ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
20
+ value: string;
21
+ }
22
+ declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "." | ";" | "," | "&";
23
+ declare const separatorArrayNoExplode: (style: ArraySeparatorStyle) => "," | "|" | "%20";
24
+ declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "." | ";" | "," | "&";
25
+ declare const serializeArrayParam: ({ allowReserved, explode, name, style, value, }: SerializeOptions<ArraySeparatorStyle> & {
26
+ value: unknown[];
27
+ }) => string;
28
+ declare const serializePrimitiveParam: ({ allowReserved, name, value, }: SerializePrimitiveParam) => string;
29
+ declare const serializeObjectParam: ({ allowReserved, explode, name, style, value, valueOnly, }: SerializeOptions<ObjectSeparatorStyle> & {
30
+ value: Record<string, unknown> | Date;
31
+ valueOnly?: boolean;
32
+ }) => string;
33
+
34
+ export { type ArraySeparatorStyle, type ArrayStyle, type ObjectStyle, type SerializerOptions, separatorArrayExplode, separatorArrayNoExplode, separatorObjectExplode, serializeArrayParam, serializeObjectParam, serializePrimitiveParam };
@@ -0,0 +1,34 @@
1
+ interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {
2
+ }
3
+ interface SerializePrimitiveOptions {
4
+ allowReserved?: boolean;
5
+ name: string;
6
+ }
7
+ interface SerializerOptions<T> {
8
+ /**
9
+ * @default true
10
+ */
11
+ explode: boolean;
12
+ style: T;
13
+ }
14
+ type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
15
+ type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
16
+ type MatrixStyle = "label" | "matrix" | "simple";
17
+ type ObjectStyle = "form" | "deepObject";
18
+ type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
19
+ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
20
+ value: string;
21
+ }
22
+ declare const separatorArrayExplode: (style: ArraySeparatorStyle) => "." | ";" | "," | "&";
23
+ declare const separatorArrayNoExplode: (style: ArraySeparatorStyle) => "," | "|" | "%20";
24
+ declare const separatorObjectExplode: (style: ObjectSeparatorStyle) => "." | ";" | "," | "&";
25
+ declare const serializeArrayParam: ({ allowReserved, explode, name, style, value, }: SerializeOptions<ArraySeparatorStyle> & {
26
+ value: unknown[];
27
+ }) => string;
28
+ declare const serializePrimitiveParam: ({ allowReserved, name, value, }: SerializePrimitiveParam) => string;
29
+ declare const serializeObjectParam: ({ allowReserved, explode, name, style, value, valueOnly, }: SerializeOptions<ObjectSeparatorStyle> & {
30
+ value: Record<string, unknown> | Date;
31
+ valueOnly?: boolean;
32
+ }) => string;
33
+
34
+ export { type ArraySeparatorStyle, type ArrayStyle, type ObjectStyle, type SerializerOptions, separatorArrayExplode, separatorArrayNoExplode, separatorObjectExplode, serializeArrayParam, serializeObjectParam, serializePrimitiveParam };
@@ -0,0 +1,135 @@
1
+ const separatorArrayExplode = (style) => {
2
+ switch (style) {
3
+ case "label":
4
+ return ".";
5
+ case "matrix":
6
+ return ";";
7
+ case "simple":
8
+ return ",";
9
+ default:
10
+ return "&";
11
+ }
12
+ };
13
+ const separatorArrayNoExplode = (style) => {
14
+ switch (style) {
15
+ case "form":
16
+ return ",";
17
+ case "pipeDelimited":
18
+ return "|";
19
+ case "spaceDelimited":
20
+ return "%20";
21
+ default:
22
+ return ",";
23
+ }
24
+ };
25
+ const separatorObjectExplode = (style) => {
26
+ switch (style) {
27
+ case "label":
28
+ return ".";
29
+ case "matrix":
30
+ return ";";
31
+ case "simple":
32
+ return ",";
33
+ default:
34
+ return "&";
35
+ }
36
+ };
37
+ const serializeArrayParam = ({
38
+ allowReserved,
39
+ explode,
40
+ name,
41
+ style,
42
+ value
43
+ }) => {
44
+ if (!explode) {
45
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
46
+ switch (style) {
47
+ case "label":
48
+ return `.${joinedValues2}`;
49
+ case "matrix":
50
+ return `;${name}=${joinedValues2}`;
51
+ case "simple":
52
+ return joinedValues2;
53
+ default:
54
+ return `${name}=${joinedValues2}`;
55
+ }
56
+ }
57
+ const separator = separatorArrayExplode(style);
58
+ const joinedValues = value.map((v) => {
59
+ if (style === "label" || style === "simple") {
60
+ return allowReserved ? v : encodeURIComponent(v);
61
+ }
62
+ return serializePrimitiveParam({
63
+ allowReserved,
64
+ name,
65
+ value: v
66
+ });
67
+ }).join(separator);
68
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
69
+ };
70
+ const serializePrimitiveParam = ({
71
+ allowReserved,
72
+ name,
73
+ value
74
+ }) => {
75
+ if (value === void 0 || value === null) {
76
+ return "";
77
+ }
78
+ if (typeof value === "object") {
79
+ throw new Error(
80
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
81
+ );
82
+ }
83
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
84
+ };
85
+ const serializeObjectParam = ({
86
+ allowReserved,
87
+ explode,
88
+ name,
89
+ style,
90
+ value,
91
+ valueOnly
92
+ }) => {
93
+ if (value instanceof Date) {
94
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
95
+ }
96
+ if (style !== "deepObject" && !explode) {
97
+ let values = [];
98
+ Object.entries(value).forEach(([key, v]) => {
99
+ values = [
100
+ ...values,
101
+ key,
102
+ allowReserved ? v : encodeURIComponent(v)
103
+ ];
104
+ });
105
+ const joinedValues2 = values.join(",");
106
+ switch (style) {
107
+ case "form":
108
+ return `${name}=${joinedValues2}`;
109
+ case "label":
110
+ return `.${joinedValues2}`;
111
+ case "matrix":
112
+ return `;${name}=${joinedValues2}`;
113
+ default:
114
+ return joinedValues2;
115
+ }
116
+ }
117
+ const separator = separatorObjectExplode(style);
118
+ const joinedValues = Object.entries(value).map(
119
+ ([key, v]) => serializePrimitiveParam({
120
+ allowReserved,
121
+ name: style === "deepObject" ? `${name}[${key}]` : key,
122
+ value: v
123
+ })
124
+ ).join(separator);
125
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
126
+ };
127
+ export {
128
+ separatorArrayExplode,
129
+ separatorArrayNoExplode,
130
+ separatorObjectExplode,
131
+ serializeArrayParam,
132
+ serializeObjectParam,
133
+ serializePrimitiveParam
134
+ };
135
+ //# sourceMappingURL=pathSerializer.gen.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/client/core/pathSerializer.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T>\n extends SerializePrimitiveOptions,\n SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean\n name: string\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean\n style: T\n}\n\nexport type ArrayStyle = \"form\" | \"spaceDelimited\" | \"pipeDelimited\"\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle\ntype MatrixStyle = \"label\" | \"matrix\" | \"simple\"\nexport type ObjectStyle = \"form\" | \"deepObject\"\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string\n}\n\nexport const separatorArrayExplode = (\n style: ArraySeparatorStyle,\n): \".\" | \";\" | \",\" | \"&\" => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const separatorArrayNoExplode = (\n style: ArraySeparatorStyle,\n): \",\" | \"|\" | \"%20\" => {\n switch (style) {\n case \"form\":\n return \",\"\n case \"pipeDelimited\":\n return \"|\"\n case \"spaceDelimited\":\n return \"%20\"\n default:\n return \",\"\n }\n}\n\nexport const separatorObjectExplode = (\n style: ObjectSeparatorStyle,\n): \".\" | \";\" | \",\" | \"&\" => {\n switch (style) {\n case \"label\":\n return \".\"\n case \"matrix\":\n return \";\"\n case \"simple\":\n return \",\"\n default:\n return \"&\"\n }\n}\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[]\n}): string => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style))\n switch (style) {\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n case \"simple\":\n return joinedValues\n default:\n return `${name}=${joinedValues}`\n }\n }\n\n const separator = separatorArrayExplode(style)\n const joinedValues = value\n .map((v) => {\n if (style === \"label\" || style === \"simple\") {\n return allowReserved ? v : encodeURIComponent(v as string)\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n })\n })\n .join(separator)\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues\n}\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam): string => {\n if (value === undefined || value === null) {\n return \"\"\n }\n\n if (typeof value === \"object\") {\n throw new Error(\n \"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.\",\n )\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`\n}\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date\n valueOnly?: boolean\n}): string => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`\n }\n\n if (style !== \"deepObject\" && !explode) {\n let values: string[] = []\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? (v as string) : encodeURIComponent(v as string),\n ]\n })\n const joinedValues = values.join(\",\")\n switch (style) {\n case \"form\":\n return `${name}=${joinedValues}`\n case \"label\":\n return `.${joinedValues}`\n case \"matrix\":\n return `;${name}=${joinedValues}`\n default:\n return joinedValues\n }\n }\n\n const separator = separatorObjectExplode(style)\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === \"deepObject\" ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator)\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues\n}\n"],"mappings":"AA6BO,MAAM,wBAAwB,CACnC,UAC0B;AAC1B,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,0BAA0B,CACrC,UACsB;AACtB,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,yBAAyB,CACpC,UAC0B;AAC1B,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAEc;AACZ,MAAI,CAAC,SAAS;AACZ,UAAMA,iBACJ,gBAAgB,QAAQ,MAAM,IAAI,CAAC,MAAM,mBAAmB,CAAW,CAAC,GACxE,KAAK,wBAAwB,KAAK,CAAC;AACrC,YAAQ,OAAO;AAAA,MACb,KAAK;AACH,eAAO,IAAIA,aAAY;AAAA,MACzB,KAAK;AACH,eAAO,IAAI,IAAI,IAAIA,aAAY;AAAA,MACjC,KAAK;AACH,eAAOA;AAAA,MACT;AACE,eAAO,GAAG,IAAI,IAAIA,aAAY;AAAA,IAClC;AAAA,EACF;AAEA,QAAM,YAAY,sBAAsB,KAAK;AAC7C,QAAM,eAAe,MAClB,IAAI,CAAC,MAAM;AACV,QAAI,UAAU,WAAW,UAAU,UAAU;AAC3C,aAAO,gBAAgB,IAAI,mBAAmB,CAAW;AAAA,IAC3D;AAEA,WAAO,wBAAwB;AAAA,M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AAK,CAAC,MACX,wBAAwB;AAAA,MACtB;AAAA,MACA,MAAM,UAAU,eAAe,GAAG,IAAI,IAAI,GAAG,MAAM;AAAA,MACnD,OAAO;AAAA,IACT,CAAC;AAAA,EACH,EACC,KAAK,SAAS;AACjB,SAAO,UAAU,WAAW,UAAU,WAClC,YAAY,eACZ;AACN;","names":["joinedValues"]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var queryKeySerializer_gen_exports = {};
20
+ __export(queryKeySerializer_gen_exports, {
21
+ queryKeyJsonReplacer: () => queryKeyJsonReplacer,
22
+ serializeQueryKeyValue: () => serializeQueryKeyValue,
23
+ stringifyToJsonValue: () => stringifyToJsonValue
24
+ });
25
+ module.exports = __toCommonJS(queryKeySerializer_gen_exports);
26
+ const queryKeyJsonReplacer = (_key, value) => {
27
+ if (value === void 0 || typeof value === "function" || typeof value === "symbol") {
28
+ return void 0;
29
+ }
30
+ if (typeof value === "bigint") {
31
+ return value.toString();
32
+ }
33
+ if (value instanceof Date) {
34
+ return value.toISOString();
35
+ }
36
+ return value;
37
+ };
38
+ const stringifyToJsonValue = (input) => {
39
+ try {
40
+ const json = JSON.stringify(input, queryKeyJsonReplacer);
41
+ if (json === void 0) {
42
+ return void 0;
43
+ }
44
+ return JSON.parse(json);
45
+ } catch {
46
+ return void 0;
47
+ }
48
+ };
49
+ const isPlainObject = (value) => {
50
+ if (value === null || typeof value !== "object") {
51
+ return false;
52
+ }
53
+ const prototype = Object.getPrototypeOf(value);
54
+ return prototype === Object.prototype || prototype === null;
55
+ };
56
+ const serializeSearchParams = (params) => {
57
+ const entries = Array.from(params.entries()).sort(
58
+ ([a], [b]) => a.localeCompare(b)
59
+ );
60
+ const result = {};
61
+ for (const [key, value] of entries) {
62
+ const existing = result[key];
63
+ if (existing === void 0) {
64
+ result[key] = value;
65
+ continue;
66
+ }
67
+ if (Array.isArray(existing)) {
68
+ ;
69
+ existing.push(value);
70
+ } else {
71
+ result[key] = [existing, value];
72
+ }
73
+ }
74
+ return result;
75
+ };
76
+ const serializeQueryKeyValue = (value) => {
77
+ if (value === null) {
78
+ return null;
79
+ }
80
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
81
+ return value;
82
+ }
83
+ if (value === void 0 || typeof value === "function" || typeof value === "symbol") {
84
+ return void 0;
85
+ }
86
+ if (typeof value === "bigint") {
87
+ return value.toString();
88
+ }
89
+ if (value instanceof Date) {
90
+ return value.toISOString();
91
+ }
92
+ if (Array.isArray(value)) {
93
+ return stringifyToJsonValue(value);
94
+ }
95
+ if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) {
96
+ return serializeSearchParams(value);
97
+ }
98
+ if (isPlainObject(value)) {
99
+ return stringifyToJsonValue(value);
100
+ }
101
+ return void 0;
102
+ };
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ queryKeyJsonReplacer,
106
+ serializeQueryKeyValue,
107
+ stringifyToJsonValue
108
+ });
109
+ //# sourceMappingURL=queryKeySerializer.gen.cjs.map