@zenstackhq/server 3.1.0 → 3.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.
- package/dist/api.cjs +376 -80
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +12 -1
- package/dist/api.d.ts +12 -1
- package/dist/api.js +368 -72
- package/dist/api.js.map +1 -1
- package/package.json +7 -7
package/dist/api.d.cts
CHANGED
|
@@ -37,7 +37,13 @@ type RestApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
|
|
|
37
37
|
* it should be included in the charset.
|
|
38
38
|
*/
|
|
39
39
|
urlSegmentCharset?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Mapping from model names to URL segment names.
|
|
42
|
+
*/
|
|
40
43
|
modelNameMapping?: Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Mapping from model names to unique field name to be used as resource's ID.
|
|
46
|
+
*/
|
|
41
47
|
externalIdMapping?: Record<string, string>;
|
|
42
48
|
};
|
|
43
49
|
/**
|
|
@@ -59,6 +65,7 @@ declare class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements Ap
|
|
|
59
65
|
private reverseModelNameMapping;
|
|
60
66
|
private externalIdMapping;
|
|
61
67
|
constructor(options: RestApiHandlerOptions<Schema>);
|
|
68
|
+
private validateOptions;
|
|
62
69
|
get schema(): Schema;
|
|
63
70
|
get log(): LogConfig | undefined;
|
|
64
71
|
private buildUrlPatternMap;
|
|
@@ -66,6 +73,9 @@ declare class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements Ap
|
|
|
66
73
|
private matchUrlPattern;
|
|
67
74
|
handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
|
|
68
75
|
private handleGenericError;
|
|
76
|
+
private processProcedureRequest;
|
|
77
|
+
private makeProcBadInputErrorResponse;
|
|
78
|
+
private makeProcGenericErrorResponse;
|
|
69
79
|
private processSingleRead;
|
|
70
80
|
private processFetchRelated;
|
|
71
81
|
private processReadRelationship;
|
|
@@ -133,15 +143,16 @@ type RPCApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
|
|
|
133
143
|
declare class RPCApiHandler<Schema extends SchemaDef = SchemaDef> implements ApiHandler<Schema> {
|
|
134
144
|
private readonly options;
|
|
135
145
|
constructor(options: RPCApiHandlerOptions<Schema>);
|
|
146
|
+
private validateOptions;
|
|
136
147
|
get schema(): Schema;
|
|
137
148
|
get log(): LogConfig | undefined;
|
|
138
149
|
handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
|
|
150
|
+
private handleProcedureRequest;
|
|
139
151
|
private isValidModel;
|
|
140
152
|
private makeBadInputErrorResponse;
|
|
141
153
|
private makeGenericErrorResponse;
|
|
142
154
|
private makeORMErrorResponse;
|
|
143
155
|
private processRequestPayload;
|
|
144
|
-
private unmarshalQ;
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
export { RPCApiHandler, type RPCApiHandlerOptions, RestApiHandler, type RestApiHandlerOptions };
|
package/dist/api.d.ts
CHANGED
|
@@ -37,7 +37,13 @@ type RestApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
|
|
|
37
37
|
* it should be included in the charset.
|
|
38
38
|
*/
|
|
39
39
|
urlSegmentCharset?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Mapping from model names to URL segment names.
|
|
42
|
+
*/
|
|
40
43
|
modelNameMapping?: Record<string, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Mapping from model names to unique field name to be used as resource's ID.
|
|
46
|
+
*/
|
|
41
47
|
externalIdMapping?: Record<string, string>;
|
|
42
48
|
};
|
|
43
49
|
/**
|
|
@@ -59,6 +65,7 @@ declare class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements Ap
|
|
|
59
65
|
private reverseModelNameMapping;
|
|
60
66
|
private externalIdMapping;
|
|
61
67
|
constructor(options: RestApiHandlerOptions<Schema>);
|
|
68
|
+
private validateOptions;
|
|
62
69
|
get schema(): Schema;
|
|
63
70
|
get log(): LogConfig | undefined;
|
|
64
71
|
private buildUrlPatternMap;
|
|
@@ -66,6 +73,9 @@ declare class RestApiHandler<Schema extends SchemaDef = SchemaDef> implements Ap
|
|
|
66
73
|
private matchUrlPattern;
|
|
67
74
|
handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
|
|
68
75
|
private handleGenericError;
|
|
76
|
+
private processProcedureRequest;
|
|
77
|
+
private makeProcBadInputErrorResponse;
|
|
78
|
+
private makeProcGenericErrorResponse;
|
|
69
79
|
private processSingleRead;
|
|
70
80
|
private processFetchRelated;
|
|
71
81
|
private processReadRelationship;
|
|
@@ -133,15 +143,16 @@ type RPCApiHandlerOptions<Schema extends SchemaDef = SchemaDef> = {
|
|
|
133
143
|
declare class RPCApiHandler<Schema extends SchemaDef = SchemaDef> implements ApiHandler<Schema> {
|
|
134
144
|
private readonly options;
|
|
135
145
|
constructor(options: RPCApiHandlerOptions<Schema>);
|
|
146
|
+
private validateOptions;
|
|
136
147
|
get schema(): Schema;
|
|
137
148
|
get log(): LogConfig | undefined;
|
|
138
149
|
handleRequest({ client, method, path, query, requestBody }: RequestContext<Schema>): Promise<Response>;
|
|
150
|
+
private handleProcedureRequest;
|
|
139
151
|
private isValidModel;
|
|
140
152
|
private makeBadInputErrorResponse;
|
|
141
153
|
private makeGenericErrorResponse;
|
|
142
154
|
private makeORMErrorResponse;
|
|
143
155
|
private processRequestPayload;
|
|
144
|
-
private unmarshalQ;
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
export { RPCApiHandler, type RPCApiHandlerOptions, RestApiHandler, type RestApiHandlerOptions };
|