@supacloud/elysia 0.31.1 → 0.32.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/index.js +20 -8
- package/dist/transactional-command.d.ts +3 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1176,6 +1176,16 @@ function createTransactionalCommandGovernance(options) {
|
|
|
1176
1176
|
throw new ApplicationError("Unsupported transactional command", { status: 501, code: "COMMAND_BINDING_MISMATCH" });
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
+
function failure(error) {
|
|
1180
|
+
const code = commandErrorCode(error);
|
|
1181
|
+
if (!code)
|
|
1182
|
+
throw error;
|
|
1183
|
+
throw new ApplicationError(code, {
|
|
1184
|
+
code,
|
|
1185
|
+
status: commandErrorStatus(code),
|
|
1186
|
+
metadata: commandFailureMetadata2(code)
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1179
1189
|
const command = createTransactionalCommand({
|
|
1180
1190
|
...definition,
|
|
1181
1191
|
async execute(transaction) {
|
|
@@ -1196,6 +1206,15 @@ function createTransactionalCommandGovernance(options) {
|
|
|
1196
1206
|
});
|
|
1197
1207
|
return {
|
|
1198
1208
|
transaction: () => current().transaction,
|
|
1209
|
+
async lookup(invocation) {
|
|
1210
|
+
assertBinding(invocation);
|
|
1211
|
+
try {
|
|
1212
|
+
const actor = decodeCommandIdentity2(await identity(invocation));
|
|
1213
|
+
return await command.lookup(actor, requireIdempotencyKey(invocation), input(invocation));
|
|
1214
|
+
} catch (error) {
|
|
1215
|
+
return failure(error);
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1199
1218
|
governance: {
|
|
1200
1219
|
async authorize(invocation) {
|
|
1201
1220
|
assertBinding(invocation);
|
|
@@ -1212,14 +1231,7 @@ function createTransactionalCommandGovernance(options) {
|
|
|
1212
1231
|
throw new CommandError2("COMMAND_OUTCOME_UNKNOWN");
|
|
1213
1232
|
return receipt.result;
|
|
1214
1233
|
} catch (error) {
|
|
1215
|
-
|
|
1216
|
-
if (!code)
|
|
1217
|
-
throw error;
|
|
1218
|
-
throw new ApplicationError(code, {
|
|
1219
|
-
code,
|
|
1220
|
-
status: commandErrorStatus(code),
|
|
1221
|
-
metadata: commandFailureMetadata2(code)
|
|
1222
|
-
});
|
|
1234
|
+
return failure(error);
|
|
1223
1235
|
}
|
|
1224
1236
|
},
|
|
1225
1237
|
transaction(invocation, next) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PersistentCommandDefinition } from "@supacloud/commands";
|
|
2
|
-
import { CommandError, type CommandIdentity } from "@supacloud/contracts";
|
|
2
|
+
import { CommandError, type CommandIdentity, type DurableCommandReceipt } from "@supacloud/contracts";
|
|
3
3
|
import { type CommandGovernance, type CommandInvocation } from "./index";
|
|
4
4
|
export interface TransactionalCommandGovernanceOptions<Input, Result, Transaction> {
|
|
5
5
|
definition: PersistentCommandDefinition<Input, Result, Transaction>;
|
|
@@ -17,4 +17,6 @@ export interface TransactionalCommandGovernanceOptions<Input, Result, Transactio
|
|
|
17
17
|
export declare function createTransactionalCommandGovernance<Input, Result, Transaction>(options: TransactionalCommandGovernanceOptions<Input, Result, Transaction>): {
|
|
18
18
|
governance: CommandGovernance;
|
|
19
19
|
transaction(): Transaction;
|
|
20
|
+
/** Reauthorize and inspect the original key/input, without invoking the handler. */
|
|
21
|
+
lookup(invocation: CommandInvocation): Promise<DurableCommandReceipt<Result> | null>;
|
|
20
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/elysia",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Elysia runtime adapter for SupaCloud compiled modules: application/request scopes, route registration and validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@supacloud/app": "0.27.1",
|
|
53
53
|
"@supacloud/commands": "0.9.3",
|
|
54
|
-
"@supacloud/contracts": "0.
|
|
54
|
+
"@supacloud/contracts": "0.11.1",
|
|
55
55
|
"effect": "4.0.5",
|
|
56
56
|
"exact-mirror": "1.2.6",
|
|
57
57
|
"jose": "^6.2.12",
|
|
58
58
|
"typebox": "1.3.37"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
|
-
"@supacloud/delivery": "0.
|
|
62
|
-
"@supacloud/contracts": "0.
|
|
61
|
+
"@supacloud/delivery": "0.19.0",
|
|
62
|
+
"@supacloud/contracts": "0.11.1",
|
|
63
63
|
"@supacloud/commands": "0.9.3",
|
|
64
64
|
"@graphql-tools/utils": "^12.0.4"
|
|
65
65
|
},
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"elysia": "2.0.0-beta.32"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@supacloud/compiler": "0.46.
|
|
71
|
-
"@supacloud/delivery": "0.
|
|
72
|
-
"@supacloud/db": "0.
|
|
70
|
+
"@supacloud/compiler": "0.46.4",
|
|
71
|
+
"@supacloud/delivery": "0.19.0",
|
|
72
|
+
"@supacloud/db": "0.18.0",
|
|
73
73
|
"@types/bun": "^1.4.3",
|
|
74
74
|
"elysia": "2.0.0-beta.32",
|
|
75
75
|
"typescript": "^7.0.2"
|