@supacloud/commands 0.3.1 → 0.4.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/external.d.ts +7 -3
- package/dist/transactional.d.ts +8 -3
- package/package.json +2 -2
package/dist/external.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type CommandIdentity } from "@supacloud/contracts";
|
|
2
2
|
import { type PersistentCommandDefinition, type RecoveryPrincipal } from "./context";
|
|
3
|
-
import type { OperationReference } from "./store";
|
|
3
|
+
import type { CommandStore, OperationReference } from "./store";
|
|
4
4
|
export interface ExternalDispatch {
|
|
5
5
|
idempotencyKey: string;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type TransactionOf<Store extends CommandStore<unknown>> = Store extends CommandStore<infer Transaction> ? Transaction : never;
|
|
8
|
+
type ExternalCommandDefinition<Input, Result, Store extends CommandStore<unknown>> = Omit<PersistentCommandDefinition<Input, Result, TransactionOf<Store>>, "store"> & {
|
|
9
|
+
store: Store;
|
|
8
10
|
send(input: Input, dispatch: ExternalDispatch): Promise<unknown>;
|
|
9
11
|
lookup(input: Input, dispatch: ExternalDispatch): Promise<unknown>;
|
|
10
12
|
matches(input: Input, result: Result): boolean;
|
|
11
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export declare function createExternalCommand<Input, Result, Store extends CommandStore<unknown>>(definition: ExternalCommandDefinition<Input, Result, Store>): {
|
|
12
15
|
kind: "external";
|
|
13
16
|
execute(identity: CommandIdentity, key: string, value: unknown): Promise<import("@supacloud/contracts").DurableCommandReceipt<Result>>;
|
|
14
17
|
lookup: (identity: CommandIdentity, key: string, value: unknown, principal?: RecoveryPrincipal) => Promise<import("@supacloud/contracts").DurableCommandReceipt<Result> | null>;
|
|
@@ -19,3 +22,4 @@ export declare function createExternalCommand<Input, Result, Transaction>(defini
|
|
|
19
22
|
flushAuditByReference(identity: CommandIdentity, key: string): Promise<import("@supacloud/contracts").DurableCommandReceipt<Result> | null>;
|
|
20
23
|
recover(principal: RecoveryPrincipal, reference: OperationReference): Promise<import("@supacloud/contracts").DurableCommandReceipt<Result> | null>;
|
|
21
24
|
};
|
|
25
|
+
export {};
|
package/dist/transactional.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { type CommandIdentity, type DurableCommandReceipt } from "@supacloud/contracts";
|
|
2
2
|
import { type PersistentCommandDefinition } from "./context";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { CommandStore } from "./store";
|
|
4
|
+
type TransactionOf<Store extends CommandStore<unknown>> = Store extends CommandStore<infer Transaction> ? Transaction : never;
|
|
5
|
+
type TransactionalCommandDefinition<Input, Result, Store extends CommandStore<unknown>> = Omit<PersistentCommandDefinition<Input, Result, TransactionOf<Store>>, "store"> & {
|
|
6
|
+
store: Store;
|
|
7
|
+
execute(transaction: TransactionOf<Store>, input: Input, identity: CommandIdentity): Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
export declare function createTransactionalCommand<Input, Result, Store extends CommandStore<unknown>>(definition: TransactionalCommandDefinition<Input, Result, Store>): {
|
|
6
10
|
kind: "transactional";
|
|
7
11
|
execute(identity: CommandIdentity, key: string, value: unknown): Promise<DurableCommandReceipt<Result>>;
|
|
8
12
|
lookup(identity: CommandIdentity, key: string, value: unknown): Promise<DurableCommandReceipt<Result> | null>;
|
|
9
13
|
lookupByReference(identity: CommandIdentity, key: string): Promise<DurableCommandReceipt<Result> | null>;
|
|
10
14
|
};
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/commands",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Storage-independent durable command execution and recovery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepublishOnly": "bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@supacloud/contracts": "0.
|
|
28
|
+
"@supacloud/contracts": "0.4.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/bun": "1.4.2",
|