@zenstackhq/server 3.5.5 → 3.6.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 (105) hide show
  1. package/dist/api.cjs +2729 -4451
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/api.d.cts +219 -207
  4. package/dist/api.d.mts +249 -0
  5. package/dist/api.mjs +2745 -0
  6. package/dist/api.mjs.map +1 -0
  7. package/dist/common-BjzwQE8S.d.mts +16 -0
  8. package/dist/common-Cdj4rLFr.mjs +9 -0
  9. package/dist/common-Cdj4rLFr.mjs.map +1 -0
  10. package/dist/common-D2RyWTAZ.cjs +14 -0
  11. package/dist/common-D2RyWTAZ.cjs.map +1 -0
  12. package/dist/common-D3fx-IHt.d.cts +16 -0
  13. package/dist/elysia.cjs +46 -114
  14. package/dist/elysia.cjs.map +1 -1
  15. package/dist/elysia.d.cts +37 -36
  16. package/dist/elysia.d.mts +54 -0
  17. package/dist/elysia.mjs +48 -0
  18. package/dist/elysia.mjs.map +1 -0
  19. package/dist/express.cjs +40 -110
  20. package/dist/express.cjs.map +1 -1
  21. package/dist/express.d.cts +21 -20
  22. package/dist/express.d.mts +32 -0
  23. package/dist/express.mjs +42 -0
  24. package/dist/express.mjs.map +1 -0
  25. package/dist/fastify.cjs +36 -100
  26. package/dist/fastify.cjs.map +1 -1
  27. package/dist/fastify.d.cts +15 -14
  28. package/dist/fastify.d.mts +23 -0
  29. package/dist/fastify.mjs +36 -0
  30. package/dist/fastify.mjs.map +1 -0
  31. package/dist/hono.cjs +31 -108
  32. package/dist/hono.cjs.map +1 -1
  33. package/dist/hono.d.cts +11 -10
  34. package/dist/hono.d.mts +19 -0
  35. package/dist/hono.mjs +33 -0
  36. package/dist/hono.mjs.map +1 -0
  37. package/dist/next.cjs +81 -169
  38. package/dist/next.cjs.map +1 -1
  39. package/dist/next.d.cts +32 -29
  40. package/dist/{next.d.ts → next.d.mts} +32 -29
  41. package/dist/next.mjs +86 -0
  42. package/dist/next.mjs.map +1 -0
  43. package/dist/nuxt.cjs +414 -104
  44. package/dist/nuxt.cjs.map +1 -1
  45. package/dist/nuxt.d.cts +538 -12
  46. package/dist/nuxt.d.mts +545 -0
  47. package/dist/nuxt.mjs +416 -0
  48. package/dist/nuxt.mjs.map +1 -0
  49. package/dist/openapi-BPFL4Hn6.mjs +585 -0
  50. package/dist/openapi-BPFL4Hn6.mjs.map +1 -0
  51. package/dist/openapi-BUzfCKi-.cjs +586 -0
  52. package/dist/openapi-BUzfCKi-.cjs.map +1 -0
  53. package/dist/spec-utils-C7vlChMD.cjs +278 -0
  54. package/dist/spec-utils-C7vlChMD.cjs.map +1 -0
  55. package/dist/spec-utils-Syk4SLCX.mjs +200 -0
  56. package/dist/spec-utils-Syk4SLCX.mjs.map +1 -0
  57. package/dist/sveltekit.cjs +87 -188
  58. package/dist/sveltekit.cjs.map +1 -1
  59. package/dist/sveltekit.d.cts +24 -22
  60. package/dist/sveltekit.d.mts +43 -0
  61. package/dist/sveltekit.mjs +88 -0
  62. package/dist/sveltekit.mjs.map +1 -0
  63. package/dist/tanstack-start.cjs +59 -133
  64. package/dist/tanstack-start.cjs.map +1 -1
  65. package/dist/tanstack-start.d.cts +19 -14
  66. package/dist/tanstack-start.d.mts +37 -0
  67. package/dist/tanstack-start.mjs +60 -0
  68. package/dist/tanstack-start.mjs.map +1 -0
  69. package/dist/types-6NFtxov5.d.mts +74 -0
  70. package/dist/types-DYdFPTkH.d.cts +74 -0
  71. package/dist/utils-B9NX7OcP.cjs +85 -0
  72. package/dist/utils-B9NX7OcP.cjs.map +1 -0
  73. package/dist/utils-Doc_CQNd.mjs +39 -0
  74. package/dist/utils-Doc_CQNd.mjs.map +1 -0
  75. package/package.json +28 -27
  76. package/dist/api.d.ts +0 -237
  77. package/dist/api.js +0 -4437
  78. package/dist/api.js.map +0 -1
  79. package/dist/common-Cuu8bjzK.d.cts +0 -14
  80. package/dist/common-WHbiInuf.d.ts +0 -14
  81. package/dist/elysia.d.ts +0 -53
  82. package/dist/elysia.js +0 -82
  83. package/dist/elysia.js.map +0 -1
  84. package/dist/express.d.ts +0 -31
  85. package/dist/express.js +0 -78
  86. package/dist/express.js.map +0 -1
  87. package/dist/fastify.d.ts +0 -22
  88. package/dist/fastify.js +0 -68
  89. package/dist/fastify.js.map +0 -1
  90. package/dist/hono.d.ts +0 -18
  91. package/dist/hono.js +0 -76
  92. package/dist/hono.js.map +0 -1
  93. package/dist/next.js +0 -140
  94. package/dist/next.js.map +0 -1
  95. package/dist/nuxt.d.ts +0 -19
  96. package/dist/nuxt.js +0 -73
  97. package/dist/nuxt.js.map +0 -1
  98. package/dist/sveltekit.d.ts +0 -41
  99. package/dist/sveltekit.js +0 -156
  100. package/dist/sveltekit.js.map +0 -1
  101. package/dist/tanstack-start.d.ts +0 -32
  102. package/dist/tanstack-start.js +0 -104
  103. package/dist/tanstack-start.js.map +0 -1
  104. package/dist/types-CU_PWKr9.d.cts +0 -72
  105. package/dist/types-CU_PWKr9.d.ts +0 -72
@@ -0,0 +1,39 @@
1
+ import { Decimal } from "decimal.js";
2
+ import SuperJSON from "superjson";
3
+ import { match } from "ts-pattern";
4
+ import "zod";
5
+ import { fromError } from "zod-validation-error/v4";
6
+ import { fromError as fromError$1 } from "zod-validation-error/v3";
7
+ //#region src/api/utils.ts
8
+ function log(logger, level, message, error) {
9
+ if (!logger) return;
10
+ const getMessage = typeof message === "function" ? message : () => message;
11
+ if (typeof logger === "function") logger(level, getMessage(), error);
12
+ else if (logger.includes(level)) match(level).with("debug", () => console.debug).with("info", () => console.info).with("warn", () => console.warn).with("error", () => console.error).exhaustive()(`@zenstackhq/server: [${level}] ${getMessage()}${error ? `\n${error}` : ""}`);
13
+ }
14
+ /**
15
+ * Registers custom superjson serializers.
16
+ */
17
+ function registerCustomSerializers() {
18
+ SuperJSON.registerCustom({
19
+ isApplicable: (v) => Decimal.isDecimal(v),
20
+ serialize: (v) => v.toJSON(),
21
+ deserialize: (v) => new Decimal(v)
22
+ }, "Decimal");
23
+ if (globalThis.Buffer) SuperJSON.registerCustom({
24
+ isApplicable: (v) => Buffer.isBuffer(v),
25
+ serialize: (v) => v.toString("base64"),
26
+ deserialize: (v) => Buffer.from(v, "base64")
27
+ }, "Bytes");
28
+ }
29
+ /**
30
+ * Format ZodError into a readable string
31
+ */
32
+ function getZodErrorMessage(error) {
33
+ if ("_zod" in error) return fromError(error).toString();
34
+ else return fromError$1(error).toString();
35
+ }
36
+ //#endregion
37
+ export { log as n, registerCustomSerializers as r, getZodErrorMessage as t };
38
+
39
+ //# sourceMappingURL=utils-Doc_CQNd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-Doc_CQNd.mjs","names":["fromError4","fromError3"],"sources":["../src/api/utils.ts"],"sourcesContent":["import { Decimal } from 'decimal.js';\nimport SuperJSON from 'superjson';\nimport { match } from 'ts-pattern';\nimport { ZodError } from 'zod';\nimport { fromError as fromError3 } from 'zod-validation-error/v3';\nimport { fromError as fromError4 } from 'zod-validation-error/v4';\nimport type { LogConfig, LogLevel } from '../types';\n\nexport function log(logger: LogConfig | undefined, level: LogLevel, message: string | (() => string), error?: unknown) {\n if (!logger) {\n return;\n }\n\n const getMessage = typeof message === 'function' ? message : () => message;\n\n if (typeof logger === 'function') {\n logger(level, getMessage(), error);\n } else if (logger.includes(level)) {\n const logFn = match(level)\n .with('debug', () => console.debug)\n .with('info', () => console.info)\n .with('warn', () => console.warn)\n .with('error', () => console.error)\n .exhaustive();\n logFn(`@zenstackhq/server: [${level}] ${getMessage()}${error ? `\\n${error}` : ''}`);\n }\n}\n\n/**\n * Registers custom superjson serializers.\n */\nexport function registerCustomSerializers() {\n SuperJSON.registerCustom<Decimal, string>(\n {\n isApplicable: (v): v is Decimal => Decimal.isDecimal(v),\n serialize: (v) => v.toJSON(),\n deserialize: (v) => new Decimal(v),\n },\n 'Decimal',\n );\n\n // `Buffer` is not available in edge runtime\n if (globalThis.Buffer) {\n SuperJSON.registerCustom<Buffer, string>(\n {\n isApplicable: (v): v is Buffer => Buffer.isBuffer(v),\n serialize: (v) => v.toString('base64'),\n deserialize: (v) => Buffer.from(v, 'base64'),\n },\n 'Bytes',\n );\n }\n}\n\n/**\n * Format ZodError into a readable string\n */\nexport function getZodErrorMessage(error: ZodError): string {\n if ('_zod' in error) {\n return fromError4(error).toString();\n } else {\n return fromError3(error).toString();\n }\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,IAAI,QAA+B,OAAiB,SAAkC,OAAiB;AACnH,KAAI,CAAC,OACD;CAGJ,MAAM,aAAa,OAAO,YAAY,aAAa,gBAAgB;AAEnE,KAAI,OAAO,WAAW,WAClB,QAAO,OAAO,YAAY,EAAE,MAAM;UAC3B,OAAO,SAAS,MAAM,CACf,OAAM,MAAM,CACrB,KAAK,eAAe,QAAQ,MAAM,CAClC,KAAK,cAAc,QAAQ,KAAK,CAChC,KAAK,cAAc,QAAQ,KAAK,CAChC,KAAK,eAAe,QAAQ,MAAM,CAClC,YAAY,CACX,wBAAwB,MAAM,IAAI,YAAY,GAAG,QAAQ,KAAK,UAAU,KAAK;;;;;AAO3F,SAAgB,4BAA4B;AACxC,WAAU,eACN;EACI,eAAe,MAAoB,QAAQ,UAAU,EAAE;EACvD,YAAY,MAAM,EAAE,QAAQ;EAC5B,cAAc,MAAM,IAAI,QAAQ,EAAE;EACrC,EACD,UACH;AAGD,KAAI,WAAW,OACX,WAAU,eACN;EACI,eAAe,MAAmB,OAAO,SAAS,EAAE;EACpD,YAAY,MAAM,EAAE,SAAS,SAAS;EACtC,cAAc,MAAM,OAAO,KAAK,GAAG,SAAS;EAC/C,EACD,QACH;;;;;AAOT,SAAgB,mBAAmB,OAAyB;AACxD,KAAI,UAAU,MACV,QAAOA,UAAW,MAAM,CAAC,UAAU;KAEnC,QAAOC,YAAW,MAAM,CAAC,UAAU"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zenstackhq/server",
3
3
  "displayName": "ZenStack Automatic CRUD Server",
4
4
  "description": "ZenStack automatic CRUD API handlers and server adapters for popular frameworks",
5
- "version": "3.5.5",
5
+ "version": "3.6.0",
6
6
  "type": "module",
7
7
  "author": {
8
8
  "name": "ZenStack Team",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "./api": {
35
35
  "import": {
36
- "types": "./dist/api.d.ts",
37
- "default": "./dist/api.js"
36
+ "types": "./dist/api.d.mts",
37
+ "default": "./dist/api.mjs"
38
38
  },
39
39
  "require": {
40
40
  "types": "./dist/api.d.cts",
@@ -43,8 +43,8 @@
43
43
  },
44
44
  "./express": {
45
45
  "import": {
46
- "types": "./dist/express.d.ts",
47
- "default": "./dist/express.js"
46
+ "types": "./dist/express.d.mts",
47
+ "default": "./dist/express.mjs"
48
48
  },
49
49
  "require": {
50
50
  "types": "./dist/express.d.cts",
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "./elysia": {
55
55
  "import": {
56
- "types": "./dist/elysia.d.ts",
57
- "default": "./dist/elysia.js"
56
+ "types": "./dist/elysia.d.mts",
57
+ "default": "./dist/elysia.mjs"
58
58
  },
59
59
  "require": {
60
60
  "types": "./dist/elysia.d.cts",
@@ -63,8 +63,8 @@
63
63
  },
64
64
  "./fastify": {
65
65
  "import": {
66
- "types": "./dist/fastify.d.ts",
67
- "default": "./dist/fastify.js"
66
+ "types": "./dist/fastify.d.mts",
67
+ "default": "./dist/fastify.mjs"
68
68
  },
69
69
  "require": {
70
70
  "types": "./dist/fastify.d.cts",
@@ -73,8 +73,8 @@
73
73
  },
74
74
  "./next": {
75
75
  "import": {
76
- "types": "./dist/next.d.ts",
77
- "default": "./dist/next.js"
76
+ "types": "./dist/next.d.mts",
77
+ "default": "./dist/next.mjs"
78
78
  },
79
79
  "require": {
80
80
  "types": "./dist/next.d.cts",
@@ -83,8 +83,8 @@
83
83
  },
84
84
  "./hono": {
85
85
  "import": {
86
- "types": "./dist/hono.d.ts",
87
- "default": "./dist/hono.js"
86
+ "types": "./dist/hono.d.mts",
87
+ "default": "./dist/hono.mjs"
88
88
  },
89
89
  "require": {
90
90
  "types": "./dist/hono.d.cts",
@@ -93,8 +93,8 @@
93
93
  },
94
94
  "./nuxt": {
95
95
  "import": {
96
- "types": "./dist/nuxt.d.ts",
97
- "default": "./dist/nuxt.js"
96
+ "types": "./dist/nuxt.d.mts",
97
+ "default": "./dist/nuxt.mjs"
98
98
  },
99
99
  "require": {
100
100
  "types": "./dist/nuxt.d.cts",
@@ -103,8 +103,8 @@
103
103
  },
104
104
  "./sveltekit": {
105
105
  "import": {
106
- "types": "./dist/sveltekit.d.ts",
107
- "default": "./dist/sveltekit.js"
106
+ "types": "./dist/sveltekit.d.mts",
107
+ "default": "./dist/sveltekit.mjs"
108
108
  },
109
109
  "require": {
110
110
  "types": "./dist/sveltekit.d.cts",
@@ -113,8 +113,8 @@
113
113
  },
114
114
  "./tanstack-start": {
115
115
  "import": {
116
- "types": "./dist/tanstack-start.d.ts",
117
- "default": "./dist/tanstack-start.js"
116
+ "types": "./dist/tanstack-start.d.mts",
117
+ "default": "./dist/tanstack-start.mjs"
118
118
  },
119
119
  "require": {
120
120
  "types": "./dist/tanstack-start.d.cts",
@@ -130,8 +130,8 @@
130
130
  "ts-pattern": "^5.7.1",
131
131
  "url-pattern": "^1.0.3",
132
132
  "zod-validation-error": "^4.0.1",
133
- "@zenstackhq/common-helpers": "3.5.5",
134
- "@zenstackhq/orm": "3.5.5"
133
+ "@zenstackhq/common-helpers": "3.6.0",
134
+ "@zenstackhq/orm": "3.6.0"
135
135
  },
136
136
  "devDependencies": {
137
137
  "@readme/openapi-parser": "^6.0.0",
@@ -150,10 +150,11 @@
150
150
  "nuxt": "4.3.1",
151
151
  "supertest": "^7.1.4",
152
152
  "zod": "^4.1.0",
153
- "@zenstackhq/eslint-config": "3.5.5",
154
- "@zenstackhq/testtools": "3.5.5",
155
- "@zenstackhq/typescript-config": "3.5.5",
156
- "@zenstackhq/vitest-config": "3.5.5"
153
+ "@zenstackhq/eslint-config": "3.6.0",
154
+ "@zenstackhq/testtools": "3.6.0",
155
+ "@zenstackhq/typescript-config": "3.6.0",
156
+ "@zenstackhq/vitest-config": "3.6.0",
157
+ "@zenstackhq/tsdown-config": "3.6.0"
157
158
  },
158
159
  "peerDependencies": {
159
160
  "@sveltejs/kit": "^2.0.0",
@@ -194,8 +195,8 @@
194
195
  },
195
196
  "funding": "https://github.com/sponsors/zenstackhq",
196
197
  "scripts": {
197
- "build": "tsc --noEmit && tsup-node",
198
- "watch": "tsup-node --watch",
198
+ "build": "tsc --noEmit && tsdown",
199
+ "watch": "tsdown --watch",
199
200
  "lint": "eslint src --ext ts",
200
201
  "test": "vitest run",
201
202
  "update-baseline": "UPDATE_BASELINE=1 vitest run test/openapi",
package/dist/api.d.ts DELETED
@@ -1,237 +0,0 @@
1
- import { QueryOptions } from '@zenstackhq/orm';
2
- import { SchemaDef } from '@zenstackhq/orm/schema';
3
- import * as openapi_types from 'openapi-types';
4
- import { OpenAPIV3_1 } from 'openapi-types';
5
- import { A as ApiHandler, L as LogConfig, R as RequestContext, a as Response } from './types-CU_PWKr9.js';
6
-
7
- type CommonHandlerOptions<Schema extends SchemaDef> = {
8
- /** Query options that affect the behavior of the OpenAPI provider. */
9
- queryOptions?: QueryOptions<Schema>;
10
- };
11
- type OpenApiSpecOptions = {
12
- /** Spec title. Defaults to 'ZenStack Generated API' */
13
- title?: string;
14
- /** Spec version. Defaults to '1.0.0' */
15
- version?: string;
16
- /** Spec description. */
17
- description?: string;
18
- /** Spec summary. */
19
- summary?: string;
20
- /**
21
- * When true, assumes that the schema includes access policies, and adds
22
- * 403 responses to operations that can potentially be rejected.
23
- */
24
- respectAccessPolicies?: boolean;
25
- };
26
- /**
27
- * Interface for generating OpenAPI specifications.
28
- */
29
- interface OpenApiSpecGenerator {
30
- /**
31
- * Generates an OpenAPI v3.1 specification document.
32
- */
33
- generateSpec(options?: OpenApiSpecOptions): Promise<OpenAPIV3_1.Document>;
34
- }
35
-
36
- /**
37
- * Options for {@link RestApiHandler}
38
- */
39
- type RestApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
40
- /**
41
- * The schema
42
- */
43
- schema: Schema;
44
- /**
45
- * Logging configuration
46
- */
47
- log?: LogConfig;
48
- /**
49
- * The base endpoint of the RESTful API, must be a valid URL
50
- */
51
- endpoint: string;
52
- /**
53
- * The default page size for limiting the number of results returned
54
- * from collection queries, including resource collection, related data
55
- * of collection types, and relationship of collection types.
56
- *
57
- * Defaults to 100. Set to Infinity to disable pagination.
58
- */
59
- pageSize?: number;
60
- /**
61
- * The divider used to separate compound ID fields in the URL.
62
- * Defaults to '_'.
63
- */
64
- idDivider?: string;
65
- /**
66
- * The charset used for URL segment values. Defaults to `a-zA-Z0-9-_~ %`. You can change it if your entity's ID values
67
- * allow different characters. Specifically, if your models use compound IDs and the idDivider is set to a different value,
68
- * it should be included in the charset.
69
- */
70
- urlSegmentCharset?: string;
71
- /**
72
- * Mapping from model names to URL segment names.
73
- */
74
- modelNameMapping?: Record<string, string>;
75
- /**
76
- * Mapping from model names to unique field name to be used as resource's ID.
77
- */
78
- externalIdMapping?: Record<string, string>;
79
- /**
80
- * When `true`, enables nested route handling for all to-many relations:
81
- * `/:parentType/:parentId/:relationName` (collection) and
82
- * `/:parentType/:parentId/:relationName/:childId` (single).
83
- *
84
- * Defaults to `false`.
85
- */
86
- nestedRoutes?: boolean;
87
- } & CommonHandlerOptions<Schema>;
88
- /**
89
- * RESTful-style API request handler (compliant with JSON:API)
90
- */
91
- declare class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements ApiHandler<Schema>, OpenApiSpecGenerator {
92
- private readonly options;
93
- private serializers;
94
- private readonly errors;
95
- private filterParamPattern;
96
- private createUpdatePayloadSchema;
97
- private updateSingleRelationSchema;
98
- private updateCollectionRelationSchema;
99
- private upsertMetaSchema;
100
- private typeMap;
101
- private idDivider;
102
- private urlPatternMap;
103
- private modelNameMapping;
104
- private reverseModelNameMapping;
105
- private externalIdMapping;
106
- private nestedRoutes;
107
- constructor(options: RestApiHandlerOptions<Schema>);
108
- private validateOptions;
109
- get schema(): Schema;
110
- get log(): LogConfig | undefined;
111
- private buildUrlPatternMap;
112
- private mapModelName;
113
- /**
114
- * Resolves child model type and reverse relation from a parent relation name.
115
- * e.g. given parentType='user', parentRelation='posts', returns { childType:'post', reverseRelation:'author' }
116
- */
117
- private resolveNestedRelation;
118
- private mergeFilters;
119
- /**
120
- * Builds a WHERE filter for the child model that constrains results to those belonging to the given parent.
121
- * @param parentType lowercased parent model name
122
- * @param parentId parent resource ID string
123
- * @param parentRelation relation field name on the parent model (e.g. 'posts')
124
- */
125
- private buildNestedParentFilter;
126
- private matchUrlPattern;
127
- handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
128
- private handleGenericError;
129
- private processProcedureRequest;
130
- private makeProcBadInputErrorResponse;
131
- private makeProcGenericErrorResponse;
132
- /**
133
- * Builds the ORM `args` object (include, select) shared by single-read operations.
134
- * Returns the args to pass to findUnique/findFirst and the resolved `include` list for serialization,
135
- * or an error response if query params are invalid.
136
- */
137
- private buildSingleReadArgs;
138
- private processSingleRead;
139
- private processFetchRelated;
140
- private processReadRelationship;
141
- private processCollectionRead;
142
- /**
143
- * Builds link URL for a nested resource using parent type, parent ID, relation name, and optional child ID.
144
- * Uses the parent model name mapping for the parent segment; the relation name is used as-is.
145
- */
146
- private makeNestedLinkUrl;
147
- private processNestedSingleRead;
148
- private processNestedCreate;
149
- /**
150
- * Builds the ORM `data` payload for a nested update, shared by both to-many (childId present)
151
- * and to-one (childId absent) variants. Returns either `{ updateData }` or `{ error }`.
152
- */
153
- private buildNestedUpdatePayload;
154
- /**
155
- * Handles PATCH /:type/:id/:relationship/:childId (to-many) and
156
- * PATCH /:type/:id/:relationship (to-one, childId undefined).
157
- */
158
- private processNestedUpdate;
159
- private processNestedDelete;
160
- private buildPartialSelect;
161
- private addTotalCountToMeta;
162
- private makePaginator;
163
- private processRequestBody;
164
- private processCreate;
165
- private processUpsert;
166
- private getUniqueFieldSets;
167
- private processRelationshipCRUD;
168
- private processUpdate;
169
- private processDelete;
170
- private requireModel;
171
- private getIdFields;
172
- private requireField;
173
- private buildTypeMap;
174
- private getModelInfo;
175
- private makeLinkUrl;
176
- private buildSerializers;
177
- private getId;
178
- private serializeItems;
179
- private injectCompoundId;
180
- private toPlainObject;
181
- private replaceURLSearchParams;
182
- private makeIdFilter;
183
- private makeIdSelect;
184
- private makeIdConnect;
185
- private makeIdKey;
186
- private makeDefaultIdKey;
187
- private makeCompoundId;
188
- private makeUpsertWhere;
189
- private includeRelationshipIds;
190
- private coerce;
191
- private makeNormalizedUrl;
192
- private getPagination;
193
- private buildFilter;
194
- private buildSort;
195
- private buildRelationSelect;
196
- private makeFilterValue;
197
- private injectRelationQuery;
198
- private handleORMError;
199
- private makeError;
200
- private makeUnsupportedModelError;
201
- private makeUnsupportedRelationshipError;
202
- generateSpec(options?: OpenApiSpecOptions): Promise<openapi_types.OpenAPIV3_1.Document<{}>>;
203
- }
204
-
205
- /**
206
- * Options for {@link RPCApiHandler}
207
- */
208
- type RPCApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
209
- /**
210
- * The schema
211
- */
212
- schema: Schema;
213
- /**
214
- * Logging configuration
215
- */
216
- log?: LogConfig;
217
- } & CommonHandlerOptions<Schema>;
218
- /**
219
- * RPC style API request handler that mirrors the ZenStackClient API
220
- */
221
- declare class RPCApiHandler<Schema extends SchemaDef = SchemaDef> implements ApiHandler<Schema> {
222
- private readonly options;
223
- constructor(options: RPCApiHandlerOptions<Schema>);
224
- private validateOptions;
225
- get schema(): Schema;
226
- get log(): LogConfig | undefined;
227
- handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
228
- private handleTransaction;
229
- private handleProcedureRequest;
230
- private isValidModel;
231
- private makeBadInputErrorResponse;
232
- private makeGenericErrorResponse;
233
- private makeORMErrorResponse;
234
- private processRequestPayload;
235
- }
236
-
237
- export { type OpenApiSpecGenerator, type OpenApiSpecOptions, RPCApiHandler, type RPCApiHandlerOptions, RestApiHandler, type RestApiHandlerOptions };