summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-23 12:21:58 -0400
committerDax Raad <[email protected]>2025-08-23 12:21:58 -0400
commit732b67f8ce65ca8154574088abfbce06dd5054bb (patch)
tree7015c72112c26424f8213555172f2206ea4c1928 /packages/sdk/js/src/gen/core/pathSerializer.gen.ts
parentd47bb967849ff4a38c8926ef2450ffa883ff477f (diff)
downloadopencode-732b67f8ce65ca8154574088abfbce06dd5054bb.tar.gz
opencode-732b67f8ce65ca8154574088abfbce06dd5054bb.zip
ci: stuff
Diffstat (limited to 'packages/sdk/js/src/gen/core/pathSerializer.gen.ts')
-rw-r--r--packages/sdk/js/src/gen/core/pathSerializer.gen.ts167
1 files changed, 0 insertions, 167 deletions
diff --git a/packages/sdk/js/src/gen/core/pathSerializer.gen.ts b/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
deleted file mode 100644
index 96be3bc5a..000000000
--- a/packages/sdk/js/src/gen/core/pathSerializer.gen.ts
+++ /dev/null
@@ -1,167 +0,0 @@
-// This file is auto-generated by @hey-api/openapi-ts
-
-interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}
-
-interface SerializePrimitiveOptions {
- allowReserved?: boolean
- name: string
-}
-
-export interface SerializerOptions<T> {
- /**
- * @default true
- */
- explode: boolean
- style: T
-}
-
-export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited"
-export type ArraySeparatorStyle = ArrayStyle | MatrixStyle
-type MatrixStyle = "label" | "matrix" | "simple"
-export type ObjectStyle = "form" | "deepObject"
-type ObjectSeparatorStyle = ObjectStyle | MatrixStyle
-
-interface SerializePrimitiveParam extends SerializePrimitiveOptions {
- value: string
-}
-
-export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
- switch (style) {
- case "label":
- return "."
- case "matrix":
- return ";"
- case "simple":
- return ","
- default:
- return "&"
- }
-}
-
-export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
- switch (style) {
- case "form":
- return ","
- case "pipeDelimited":
- return "|"
- case "spaceDelimited":
- return "%20"
- default:
- return ","
- }
-}
-
-export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
- switch (style) {
- case "label":
- return "."
- case "matrix":
- return ";"
- case "simple":
- return ","
- default:
- return "&"
- }
-}
-
-export const serializeArrayParam = ({
- allowReserved,
- explode,
- name,
- style,
- value,
-}: SerializeOptions<ArraySeparatorStyle> & {
- value: unknown[]
-}) => {
- if (!explode) {
- const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join(
- separatorArrayNoExplode(style),
- )
- switch (style) {
- case "label":
- return `.${joinedValues}`
- case "matrix":
- return `;${name}=${joinedValues}`
- case "simple":
- return joinedValues
- default:
- return `${name}=${joinedValues}`
- }
- }
-
- const separator = separatorArrayExplode(style)
- const joinedValues = value
- .map((v) => {
- if (style === "label" || style === "simple") {
- return allowReserved ? v : encodeURIComponent(v as string)
- }
-
- return serializePrimitiveParam({
- allowReserved,
- name,
- value: v as string,
- })
- })
- .join(separator)
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues
-}
-
-export const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => {
- if (value === undefined || value === null) {
- return ""
- }
-
- if (typeof value === "object") {
- throw new Error(
- "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.",
- )
- }
-
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`
-}
-
-export const serializeObjectParam = ({
- allowReserved,
- explode,
- name,
- style,
- value,
- valueOnly,
-}: SerializeOptions<ObjectSeparatorStyle> & {
- value: Record<string, unknown> | Date
- valueOnly?: boolean
-}) => {
- if (value instanceof Date) {
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`
- }
-
- if (style !== "deepObject" && !explode) {
- let values: string[] = []
- Object.entries(value).forEach(([key, v]) => {
- values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]
- })
- const joinedValues = values.join(",")
- switch (style) {
- case "form":
- return `${name}=${joinedValues}`
- case "label":
- return `.${joinedValues}`
- case "matrix":
- return `;${name}=${joinedValues}`
- default:
- return joinedValues
- }
- }
-
- const separator = separatorObjectExplode(style)
- const joinedValues = Object.entries(value)
- .map(([key, v]) =>
- serializePrimitiveParam({
- allowReserved,
- name: style === "deepObject" ? `${name}[${key}]` : key,
- value: v as string,
- }),
- )
- .join(separator)
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues
-}