@temporary-name/server 1.9.3-alpha.82e5e55517330d6049913c9b2f19e60239cd25d9 → 1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e
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/adapters/aws-lambda/index.mjs +2 -5
- package/dist/adapters/fetch/index.mjs +2 -5
- package/dist/adapters/node/index.mjs +2 -5
- package/dist/adapters/standard/index.mjs +2 -5
- package/dist/index.d.mts +938 -217
- package/dist/index.d.ts +938 -217
- package/dist/index.mjs +1677 -95
- package/dist/shared/{server.BKh8I1Ny.mjs → server.BZtKt8i8.mjs} +7 -45
- package/dist/shared/{server.DLsti1Pv.mjs → server.CMTfy2UB.mjs} +1 -1
- package/package.json +8 -8
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
import { validateORPCError, ValidationError } from '@temporary-name/contract';
|
|
2
2
|
import { resolveMaybeOptionalOptions, ORPCError, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, overlayProxy, asyncIteratorWithSpan } from '@temporary-name/shared';
|
|
3
3
|
import { HibernationEventIterator, mapEventIterator } from '@temporary-name/standard-server';
|
|
4
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
5
|
-
import 'zod';
|
|
6
|
-
import * as z4 from 'zod/v4/core';
|
|
7
|
-
|
|
8
|
-
const gatingContext = new AsyncLocalStorage();
|
|
9
|
-
function withoutGatedFields(data, schema, isGateEnabled) {
|
|
10
|
-
const filtered = { ...data };
|
|
11
|
-
const gatedFields = getGatedFields(schema);
|
|
12
|
-
for (const [fieldName, gate] of gatedFields) {
|
|
13
|
-
if (!isGateEnabled(gate)) {
|
|
14
|
-
delete filtered[fieldName];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return filtered;
|
|
18
|
-
}
|
|
19
|
-
function getGatedFields(schema) {
|
|
20
|
-
if (!schema || schema["~standard"].vendor !== "zod") {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
const gatedFields = [];
|
|
24
|
-
const zodDef = schema._zod.def;
|
|
25
|
-
if (zodDef.type === "object") {
|
|
26
|
-
const shape = zodDef.shape;
|
|
27
|
-
for (const fieldName in shape) {
|
|
28
|
-
const fieldSchema = shape[fieldName];
|
|
29
|
-
const gate = z4.globalRegistry.get(fieldSchema)?.gate;
|
|
30
|
-
if (gate) {
|
|
31
|
-
gatedFields.push([fieldName, gate]);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return gatedFields;
|
|
36
|
-
}
|
|
37
4
|
|
|
38
5
|
const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
|
|
39
6
|
function lazy(loader, meta = {}) {
|
|
@@ -164,7 +131,11 @@ async function validateInput(procedure, input) {
|
|
|
164
131
|
return result.value;
|
|
165
132
|
});
|
|
166
133
|
}
|
|
167
|
-
async function validateOutput(
|
|
134
|
+
async function validateOutput(procedure, output) {
|
|
135
|
+
const schema = procedure["~orpc"].outputSchema;
|
|
136
|
+
if (!schema) {
|
|
137
|
+
return output;
|
|
138
|
+
}
|
|
168
139
|
return runWithSpan({ name: "validate_output" }, async () => {
|
|
169
140
|
const result = await schema["~standard"].validate(output);
|
|
170
141
|
if (result.issues) {
|
|
@@ -220,20 +191,11 @@ async function executeProcedureInternal(procedure, options) {
|
|
|
220
191
|
() => procedure["~orpc"].handler({ ...options, context, input: currentInput })
|
|
221
192
|
);
|
|
222
193
|
if (index === outputValidationIndex) {
|
|
223
|
-
|
|
224
|
-
if (!schema) {
|
|
225
|
-
return output;
|
|
226
|
-
}
|
|
227
|
-
const validated = await validateOutput(schema, output);
|
|
228
|
-
const isGateEnabled = gatingContext.getStore();
|
|
229
|
-
if (!validated || !isGateEnabled) {
|
|
230
|
-
return validated;
|
|
231
|
-
}
|
|
232
|
-
return withoutGatedFields(validated, schema, isGateEnabled);
|
|
194
|
+
return await validateOutput(procedure, output);
|
|
233
195
|
}
|
|
234
196
|
return output;
|
|
235
197
|
};
|
|
236
198
|
return next(0, options.context, options.input);
|
|
237
199
|
}
|
|
238
200
|
|
|
239
|
-
export { LAZY_SYMBOL as L,
|
|
201
|
+
export { LAZY_SYMBOL as L, createORPCErrorConstructorMap as a, middlewareOutputFn as b, createProcedureClient as c, getLazyMeta as g, isLazy as i, lazy as l, mergeCurrentContext as m, unlazy as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isObject, stringifyJSON, isORPCErrorStatus, tryDecodeURIComponent, value, toHttpPath, toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, ORPCError, toORPCError } from '@temporary-name/shared';
|
|
2
2
|
import { flattenHeader } from '@temporary-name/standard-server';
|
|
3
|
-
import { c as createProcedureClient } from './server.
|
|
3
|
+
import { c as createProcedureClient } from './server.BZtKt8i8.mjs';
|
|
4
4
|
import { fallbackContractConfig } from '@temporary-name/contract';
|
|
5
5
|
import { d as deserialize, s as serialize, a as standardizeHTTPPath } from './server.BEHw7Eyx.mjs';
|
|
6
6
|
import { traverseContractProcedures, isProcedure, getLazyMeta, unlazy, getRouter, createContractedProcedure } from '@temporary-name/server';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporary-name/server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.3-alpha.
|
|
4
|
+
"version": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
"@standard-schema/spec": "^1.0.0",
|
|
75
75
|
"rou3": "^0.7.7",
|
|
76
76
|
"zod": "^4.1.12",
|
|
77
|
-
"@temporary-name/contract": "1.9.3-alpha.
|
|
78
|
-
"@temporary-name/interop": "1.9.3-alpha.
|
|
79
|
-
"@temporary-name/
|
|
80
|
-
"@temporary-name/standard-server-aws-lambda": "1.9.3-alpha.
|
|
81
|
-
"@temporary-name/standard-server-fetch": "1.9.3-alpha.
|
|
82
|
-
"@temporary-name/
|
|
83
|
-
"@temporary-name/standard-server-node": "1.9.3-alpha.
|
|
77
|
+
"@temporary-name/contract": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
78
|
+
"@temporary-name/interop": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
79
|
+
"@temporary-name/standard-server": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
80
|
+
"@temporary-name/standard-server-aws-lambda": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
81
|
+
"@temporary-name/standard-server-fetch": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
82
|
+
"@temporary-name/shared": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e",
|
|
83
|
+
"@temporary-name/standard-server-node": "1.9.3-alpha.a252b3ff8cb6bf7deaa6d41dc9ac8a8d50edd80e"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/supertest": "^6.0.3",
|