@supacloud/commands 0.9.0 → 0.9.1
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/typebox.d.ts +6 -16
- package/dist/typebox.js +3 -3
- package/package.json +6 -6
package/dist/typebox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Static, TSchema } from "
|
|
1
|
+
import type { Static, TSchema } from "typebox";
|
|
2
2
|
import type { CommandIdentity } from "@supacloud/contracts";
|
|
3
3
|
import type { CommandStore } from "./store";
|
|
4
4
|
import type { PersistentCommandDefinition } from "./context";
|
|
@@ -21,20 +21,10 @@ export type TypeBoxCommandDefinition<InputSchema extends TSchema, ResultSchema e
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function createTypeBoxTransactionalCommand<const InputSchema extends TSchema, const ResultSchema extends TSchema, Store extends CommandStore<unknown>>(definition: TypeBoxCommandDefinition<InputSchema, ResultSchema, Store>): Readonly<{
|
|
23
23
|
kind: "transactional";
|
|
24
|
-
execute(identity: CommandIdentity, key: string, value: Static<InputSchema>, signal?: AbortSignal): Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})["static"]>> | null>;
|
|
30
|
-
executeUnknown: (identity: CommandIdentity, key: string, value: unknown, signal?: AbortSignal) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<(ResultSchema & {
|
|
31
|
-
params: [];
|
|
32
|
-
})["static"]>>>;
|
|
33
|
-
lookupUnknown: (identity: CommandIdentity, key: string, value: unknown) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<(ResultSchema & {
|
|
34
|
-
params: [];
|
|
35
|
-
})["static"]>> | null>;
|
|
36
|
-
lookupByReference: (identity: CommandIdentity, key: string) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<(ResultSchema & {
|
|
37
|
-
params: [];
|
|
38
|
-
})["static"]>> | null>;
|
|
24
|
+
execute(identity: CommandIdentity, key: string, value: Static<InputSchema>, signal?: AbortSignal): Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<import("typebox").StaticType<[], "Encode", {}, {}, ResultSchema>>>>;
|
|
25
|
+
lookup(identity: CommandIdentity, key: string, value: Static<InputSchema>): Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<import("typebox").StaticType<[], "Encode", {}, {}, ResultSchema>>> | null>;
|
|
26
|
+
executeUnknown: (identity: CommandIdentity, key: string, value: unknown, signal?: AbortSignal) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<import("typebox").StaticType<[], "Encode", {}, {}, ResultSchema>>>>;
|
|
27
|
+
lookupUnknown: (identity: CommandIdentity, key: string, value: unknown) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<import("typebox").StaticType<[], "Encode", {}, {}, ResultSchema>>> | null>;
|
|
28
|
+
lookupByReference: (identity: CommandIdentity, key: string) => Promise<import("@supacloud/contracts").DurableCommandReceipt<NoInfer<import("typebox").StaticType<[], "Encode", {}, {}, ResultSchema>>> | null>;
|
|
39
29
|
}>;
|
|
40
30
|
export {};
|
package/dist/typebox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/typebox.ts
|
|
2
|
-
import {
|
|
3
|
-
import { Value } from "
|
|
2
|
+
import { Compile } from "typebox/compile";
|
|
3
|
+
import { Value } from "typebox/value";
|
|
4
4
|
|
|
5
5
|
// src/transactional.ts
|
|
6
6
|
import {
|
|
@@ -338,7 +338,7 @@ function createTransactionalCommand(definition) {
|
|
|
338
338
|
|
|
339
339
|
// src/typebox.ts
|
|
340
340
|
function decoder(schema) {
|
|
341
|
-
const validator =
|
|
341
|
+
const validator = Compile(Value.Clone(schema));
|
|
342
342
|
return (value) => {
|
|
343
343
|
if (!validator.Check(value))
|
|
344
344
|
throw new TypeError("Invalid command schema value");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/commands",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Storage-independent durable command execution and recovery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "bun run build:js && bun run build:types",
|
|
26
|
-
"build:js": "bun build src/index.ts src/typebox.ts --outdir dist --target node --external @supacloud/contracts --external
|
|
26
|
+
"build:js": "bun build src/index.ts src/typebox.ts --outdir dist --target node --external @supacloud/contracts --external typebox",
|
|
27
27
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
28
28
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
29
29
|
"typecheck:test": "tsc -p tsconfig.test.json --noEmit",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"prepublishOnly": "bun run build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@supacloud/contracts": "0.
|
|
34
|
+
"@supacloud/contracts": "0.8.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"
|
|
37
|
+
"typebox": "1.3.34",
|
|
38
38
|
"@types/bun": "1.4.2",
|
|
39
39
|
"typescript": "7.0.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"
|
|
42
|
+
"typebox": "1.3.34"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
|
-
"
|
|
45
|
+
"typebox": {
|
|
46
46
|
"optional": true
|
|
47
47
|
}
|
|
48
48
|
},
|