Files
zerobyte/app/client/api-client/core/queryKeySerializer.gen.ts
dependabot[bot] 5bc0de4d1a chore(deps): bump the minor-patch group with 6 updates (#570)
* chore(deps): bump the minor-patch group with 6 updates

Bumps the minor-patch group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| @scalar/hono-api-reference | `0.9.44` | `0.9.45` |
| @tanstack/react-router | `1.162.8` | `1.162.9` |
| @tanstack/react-router-ssr-query | `1.162.8` | `1.162.9` |
| @tanstack/react-start | `1.162.8` | `1.162.9` |
| @hey-api/openapi-ts | `0.92.4` | `0.93.0` |
| oxlint-tsgolint | `0.14.2` | `0.15.0` |


Updates `@scalar/hono-api-reference` from 0.9.44 to 0.9.45

Updates `@tanstack/react-router` from 1.162.8 to 1.162.9

Updates `@tanstack/react-router-ssr-query` from 1.162.8 to 1.162.9

Updates `@tanstack/react-start` from 1.162.8 to 1.162.9

Updates `@hey-api/openapi-ts` from 0.92.4 to 0.93.0

Updates `oxlint-tsgolint` from 0.14.2 to 0.15.0

---
updated-dependencies:
- dependency-name: "@scalar/hono-api-reference"
  dependency-version: 0.9.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-patch
- dependency-name: "@tanstack/react-router"
  dependency-version: 1.162.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-patch
- dependency-name: "@tanstack/react-router-ssr-query"
  dependency-version: 1.162.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-patch
- dependency-name: "@tanstack/react-start"
  dependency-version: 1.162.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-patch
- dependency-name: "@hey-api/openapi-ts"
  dependency-version: 0.93.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: minor-patch
- dependency-name: oxlint-tsgolint
  dependency-version: 0.15.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  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>
2026-02-25 19:19:00 +01:00

113 lines
2.7 KiB
TypeScript

// @ts-nocheck
// This file is auto-generated by @hey-api/openapi-ts
/**
* JSON-friendly union that mirrors what Pinia Colada can hash.
*/
export type JsonValue = null | string | number | boolean | JsonValue[] | { [key: string]: JsonValue };
/**
* Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
*/
export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
if (value === undefined || typeof value === "function" || typeof value === "symbol") {
return undefined;
}
if (typeof value === "bigint") {
return value.toString();
}
if (value instanceof Date) {
return value.toISOString();
}
return value;
};
/**
* Safely stringifies a value and parses it back into a JsonValue.
*/
export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => {
try {
const json = JSON.stringify(input, queryKeyJsonReplacer);
if (json === undefined) {
return undefined;
}
return JSON.parse(json) as JsonValue;
} catch {
return undefined;
}
};
/**
* Detects plain objects (including objects with a null prototype).
*/
const isPlainObject = (value: unknown): value is Record<string, unknown> => {
if (value === null || typeof value !== "object") {
return false;
}
const prototype = Object.getPrototypeOf(value as object);
return prototype === Object.prototype || prototype === null;
};
/**
* Turns URLSearchParams into a sorted JSON object for deterministic keys.
*/
const serializeSearchParams = (params: URLSearchParams): JsonValue => {
const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
const result: Record<string, JsonValue> = {};
for (const [key, value] of entries) {
const existing = result[key];
if (existing === undefined) {
result[key] = value;
continue;
}
if (Array.isArray(existing)) {
(existing as string[]).push(value);
} else {
result[key] = [existing, value];
}
}
return result;
};
/**
* Normalizes any accepted value into a JSON-friendly shape for query keys.
*/
export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => {
if (value === null) {
return null;
}
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
return value;
}
if (value === undefined || typeof value === "function" || typeof value === "symbol") {
return undefined;
}
if (typeof value === "bigint") {
return value.toString();
}
if (value instanceof Date) {
return value.toISOString();
}
if (Array.isArray(value)) {
return stringifyToJsonValue(value);
}
if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) {
return serializeSearchParams(value);
}
if (isPlainObject(value)) {
return stringifyToJsonValue(value);
}
return undefined;
};