mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-01-19 18:58:04 -05:00
* chore(deps): bump the minor-patch group with 9 updates Bumps the minor-patch group with 9 updates: | Package | From | To | | --- | --- | --- | | [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js) | `8.1.0` | `8.2.0` | | [better-auth](https://github.com/better-auth/better-auth/tree/HEAD/packages/better-auth) | `1.4.10` | `1.4.12` | | [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.70.0` | `7.71.0` | | [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) | `0.90.2` | `0.90.3` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.0.3` | `25.0.7` | | [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.2.7` | `19.2.8` | | [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) | `0.23.0` | `0.24.0` | | [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) | `1.38.0` | `1.39.0` | | [vite-tsconfig-paths](https://github.com/aleclarson/vite-tsconfig-paths) | `6.0.3` | `6.0.4` | Updates `@inquirer/prompts` from 8.1.0 to 8.2.0 - [Release notes](https://github.com/SBoudrias/Inquirer.js/releases) - [Commits](https://github.com/SBoudrias/Inquirer.js/compare/@inquirer/prompts@8.1.0...@inquirer/prompts@8.2.0) Updates `better-auth` from 1.4.10 to 1.4.12 - [Release notes](https://github.com/better-auth/better-auth/releases) - [Commits](https://github.com/better-auth/better-auth/commits/v1.4.12/packages/better-auth) Updates `react-hook-form` from 7.70.0 to 7.71.0 - [Release notes](https://github.com/react-hook-form/react-hook-form/releases) - [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md) - [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.70.0...v7.71.0) Updates `@hey-api/openapi-ts` from 0.90.2 to 0.90.3 - [Release notes](https://github.com/hey-api/openapi-ts/releases) - [Changelog](https://github.com/hey-api/openapi-ts/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/hey-api/openapi-ts/compare/@hey-api/openapi-ts@0.90.2...@hey-api/openapi-ts@0.90.3) Updates `@types/node` from 25.0.3 to 25.0.7 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@types/react` from 19.2.7 to 19.2.8 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) Updates `oxfmt` from 0.23.0 to 0.24.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.24.0/npm/oxfmt) Updates `oxlint` from 1.38.0 to 1.39.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.39.0/npm/oxlint) Updates `vite-tsconfig-paths` from 6.0.3 to 6.0.4 - [Release notes](https://github.com/aleclarson/vite-tsconfig-paths/releases) - [Commits](https://github.com/aleclarson/vite-tsconfig-paths/compare/v6.0.3...v6.0.4) --- updated-dependencies: - dependency-name: "@inquirer/prompts" dependency-version: 8.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-patch - dependency-name: better-auth dependency-version: 1.4.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-patch - dependency-name: react-hook-form dependency-version: 7.71.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-patch - dependency-name: "@hey-api/openapi-ts" dependency-version: 0.90.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-patch - dependency-name: "@types/node" dependency-version: 25.0.7 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-patch - dependency-name: "@types/react" dependency-version: 19.2.8 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-patch - dependency-name: oxfmt dependency-version: 0.24.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-patch - dependency-name: oxlint dependency-version: 1.39.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-patch - dependency-name: vite-tsconfig-paths dependency-version: 6.0.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> * chore: gen api client --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nicolas Meienberger <github@thisprops.com>
168 lines
3.9 KiB
TypeScript
168 lines
3.9 KiB
TypeScript
// 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;
|
||
};
|