@rotorsoft/act-http 1.8.12 → 1.8.13
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.
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* transports never sees two error shapes for the same framework
|
|
51
51
|
* error.
|
|
52
52
|
*/
|
|
53
|
-
import type
|
|
53
|
+
import { type Target } from "@rotorsoft/act";
|
|
54
54
|
import type { IdempotencyStore } from "@rotorsoft/act-ops/idempotency";
|
|
55
55
|
import { type AnyTRPCMiddlewareFunction, type AnyTRPCMutationProcedure, type AnyTRPCRootTypes, type TRPCBuiltRouter } from "@trpc/server";
|
|
56
56
|
import { type ActorExtractor, type SseOptions } from "../api/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/trpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,EAAc,KAAK,MAAM,EAAY,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,UAAU,EAGhB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,WAAW,CAAC,GAAG,IAAI;IAC7B,QAAQ,CAAC,KAAK,EAAE,cAA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e,CAC1C,gBAAgB,EAChB,IAAI,SAAS;IAAE,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;KAAE,CAAA;CAAE,GAClD;KAAG,CAAC,IAAI,MAAM,QAAQ,GAAG,wBAAwB;CAAE,GACnD,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAC7C,CAAC;AAEF,wBAAgB,IAAI,CAClB,GAAG,SAAS,MAAM,GAAG,MAAM,EAC3B,IAAI,SAAS,UAAU,GAAG,UAAU,EACpC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CA2I7D"}
|
package/dist/trpc/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ __export(trpc_exports, {
|
|
|
24
24
|
trpc: () => trpc
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(trpc_exports);
|
|
27
|
+
var import_act2 = require("@rotorsoft/act");
|
|
27
28
|
var import_server = require("@trpc/server");
|
|
28
29
|
|
|
29
30
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
@@ -14730,7 +14731,8 @@ function trpc(app, options) {
|
|
|
14730
14731
|
const t = import_server.initTRPC.context().create();
|
|
14731
14732
|
const handlers = {};
|
|
14732
14733
|
for (const [action_name, state] of Object.entries(app.registry.actions)) {
|
|
14733
|
-
|
|
14734
|
+
const action_schema = state.actions[action_name];
|
|
14735
|
+
handlers[action_name] = t.procedure.input((raw) => raw).mutation(async ({ input, ctx }) => {
|
|
14734
14736
|
const host_ctx = ctx;
|
|
14735
14737
|
let actor;
|
|
14736
14738
|
try {
|
|
@@ -14743,8 +14745,13 @@ function trpc(app, options) {
|
|
|
14743
14745
|
});
|
|
14744
14746
|
}
|
|
14745
14747
|
try {
|
|
14746
|
-
const
|
|
14747
|
-
|
|
14748
|
+
const validated = (0, import_act2.validate)(
|
|
14749
|
+
action_name,
|
|
14750
|
+
input,
|
|
14751
|
+
action_schema
|
|
14752
|
+
);
|
|
14753
|
+
const stream = await options.stream(action_name, validated, host_ctx);
|
|
14754
|
+
const expected_version = options.expectedVersion ? await options.expectedVersion(action_name, validated, host_ctx) : void 0;
|
|
14748
14755
|
const target = expected_version === void 0 ? { stream, actor } : { stream, actor, expectedVersion: expected_version };
|
|
14749
14756
|
if (options.idempotency) {
|
|
14750
14757
|
const key = options.idempotency.keyFrom(host_ctx);
|
|
@@ -14757,7 +14764,11 @@ function trpc(app, options) {
|
|
|
14757
14764
|
const outcome = await withIdempotency(
|
|
14758
14765
|
options.idempotency.store,
|
|
14759
14766
|
key,
|
|
14760
|
-
() => app.do(
|
|
14767
|
+
() => app.do(
|
|
14768
|
+
action_name,
|
|
14769
|
+
target,
|
|
14770
|
+
validated
|
|
14771
|
+
)
|
|
14761
14772
|
);
|
|
14762
14773
|
if (outcome.deduped) {
|
|
14763
14774
|
throw new import_server.TRPCError({
|
|
@@ -14770,7 +14781,7 @@ function trpc(app, options) {
|
|
|
14770
14781
|
return await app.do(
|
|
14771
14782
|
action_name,
|
|
14772
14783
|
target,
|
|
14773
|
-
|
|
14784
|
+
validated
|
|
14774
14785
|
);
|
|
14775
14786
|
} catch (err) {
|
|
14776
14787
|
if (err instanceof import_server.TRPCError) throw err;
|