ankka 0.11.0 → 0.13.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/README.md +1 -0
- package/dist/_proto/ankka/protocol/v1/client_pb.d.ts +910 -0
- package/dist/_proto/ankka/protocol/v1/client_pb.js +239 -23
- package/dist/_proto/ankka/protocol/v1/consumer_pb.d.ts +10 -1
- package/dist/_proto/ankka/protocol/v1/consumer_pb.js +1 -1
- package/dist/_proto/ankka/protocol/v1/discovery_pb.d.ts +177 -0
- package/dist/_proto/ankka/protocol/v1/discovery_pb.js +51 -36
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.d.ts +26 -0
- package/dist/_proto/ankka/protocol/v1/endpoint_pb.js +15 -10
- package/dist/_proto/ankka/protocol/v1/event_sourced_pb.d.ts +86 -0
- package/dist/_proto/ankka/protocol/v1/event_sourced_pb.js +11 -1
- package/dist/_proto/ankka/protocol/v1/mcp_pb.d.ts +120 -0
- package/dist/_proto/ankka/protocol/v1/mcp_pb.js +29 -0
- package/dist/_proto/ankka/protocol/v1/payload_pb.d.ts +61 -0
- package/dist/_proto/ankka/protocol/v1/payload_pb.js +18 -1
- package/dist/_proto/ankka/protocol/v1/view_pb.d.ts +7 -1
- package/dist/_proto/ankka/protocol/v1/view_pb.js +1 -1
- package/dist/_proto/ankka/protocol/v1/wasm_pb.d.ts +12 -0
- package/dist/_proto/ankka/protocol/v1/wasm_pb.js +1 -1
- package/dist/agent.d.ts +10 -0
- package/dist/agent.js +20 -0
- package/dist/autonomous.d.ts +5 -0
- package/dist/autonomous.js +10 -0
- package/dist/client-keys.d.ts +89 -0
- package/dist/client-keys.js +182 -0
- package/dist/client.d.ts +96 -3
- package/dist/client.js +228 -6
- package/dist/consumer.d.ts +23 -1
- package/dist/consumer.js +25 -1
- package/dist/context.d.ts +25 -1
- package/dist/context.js +5 -2
- package/dist/contract.d.ts +4 -0
- package/dist/contract.js +2 -0
- package/dist/effects/common.d.ts +7 -0
- package/dist/effects/common.js +9 -1
- package/dist/effects/eventSourced.d.ts +26 -1
- package/dist/effects/eventSourced.js +58 -5
- package/dist/endpoint.d.ts +10 -0
- package/dist/endpoint.js +20 -0
- package/dist/eventSourcedEntity.d.ts +8 -3
- package/dist/graph.d.ts +14 -1
- package/dist/graph.js +17 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.js +8 -2
- package/dist/keyedView.d.ts +4 -1
- package/dist/keyedView.js +7 -1
- package/dist/kinds.js +2 -0
- package/dist/mcp-endpoint.d.ts +144 -0
- package/dist/mcp-endpoint.js +256 -0
- package/dist/routes.d.ts +46 -3
- package/dist/routes.js +56 -3
- package/dist/server/discovery.d.ts +12 -0
- package/dist/server/discovery.js +115 -4
- package/dist/server/eventSourced.d.ts +4 -1
- package/dist/server/eventSourced.js +24 -6
- package/dist/server/http.d.ts +8 -0
- package/dist/server/http.js +12 -4
- package/dist/server/mcp.d.ts +17 -0
- package/dist/server/mcp.js +157 -0
- package/dist/server/server.d.ts +11 -1
- package/dist/server/server.js +19 -0
- package/dist/server/stateless.js +5 -4
- package/dist/server/storageEndpoint.d.ts +14 -0
- package/dist/server/storageEndpoint.js +82 -0
- package/dist/service.d.ts +12 -1
- package/dist/service.js +73 -5
- package/dist/sigv4.d.ts +47 -0
- package/dist/sigv4.js +149 -0
- package/dist/spec.d.ts +8 -2
- package/dist/spec.js +62 -6
- package/dist/standing.d.ts +18 -0
- package/dist/standing.js +26 -0
- package/dist/startFrom.d.ts +4 -0
- package/dist/startFrom.js +8 -1
- package/dist/storage.d.ts +288 -0
- package/dist/storage.js +1081 -0
- package/dist/testkit/index.d.ts +1 -1
- package/dist/testkit/integration.d.ts +9 -0
- package/dist/testkit/integration.js +5 -1
- package/dist/testkit/kinds.d.ts +25 -9
- package/dist/testkit/kinds.js +53 -28
- package/dist/testkit/unit.d.ts +31 -3
- package/dist/testkit/unit.js +55 -11
- package/dist/timedAction.d.ts +10 -0
- package/dist/timedAction.js +20 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/view.d.ts +18 -3
- package/dist/view.js +13 -4
- package/dist/workflow.d.ts +8 -0
- package/dist/workflow.js +15 -0
- package/package.json +1 -1
package/dist/view.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { Metadata } from "./effects/common.ts";
|
|
|
5
5
|
import type { ComponentClient } from "./client.ts";
|
|
6
6
|
import type { ComponentRef } from "./client.ts";
|
|
7
7
|
import { ViewEffects, type ViewEffect } from "./effects/stateless.ts";
|
|
8
|
+
import type { Standing } from "./standing.ts";
|
|
8
9
|
type MaybePromise<T> = T | Promise<T>;
|
|
9
10
|
/**
|
|
10
11
|
* A question a view can be asked by name: one SQL statement over the view's own table, whose values
|
|
@@ -16,9 +17,16 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
16
17
|
export interface DeclaredQuery {
|
|
17
18
|
readonly name: string;
|
|
18
19
|
readonly statement: string;
|
|
20
|
+
/** Whether it may be watched: its statement selects `row_key` beside `payload`, with no limit and no aggregate. */
|
|
21
|
+
readonly watched?: boolean;
|
|
19
22
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Declares a query for a view's `static declared`. The SDK sends the statement as written.
|
|
25
|
+
* `{ watched: true }` declares that it may also be watched, which the platform checks at start.
|
|
26
|
+
*/
|
|
27
|
+
export declare function declaredQuery(name: string, statement: string, options?: {
|
|
28
|
+
readonly watched?: boolean;
|
|
29
|
+
}): DeclaredQuery;
|
|
22
30
|
/** The table a view's rows are kept in, for a declared query's statement to name. */
|
|
23
31
|
export declare function tableOf(componentId: string): string;
|
|
24
32
|
export declare abstract class View<E, Row> {
|
|
@@ -30,6 +38,8 @@ export declare abstract class View<E, Row> {
|
|
|
30
38
|
get metadata(): Metadata;
|
|
31
39
|
/** The id of the source instance the change came from. */
|
|
32
40
|
get subject(): string;
|
|
41
|
+
/** Of a change from a workflow: where it stood once the effect that recorded the state was applied. `undefined` for a change from an entity or a topic. */
|
|
42
|
+
get standing(): Standing | undefined;
|
|
33
43
|
get client(): ComponentClient;
|
|
34
44
|
/** @internal */
|
|
35
45
|
get _kind(): "view";
|
|
@@ -38,7 +48,7 @@ export declare abstract class View<E, Row> {
|
|
|
38
48
|
/** The source was deleted. The row goes with it unless this says otherwise — an order history keeps a checked-out cart's row. */
|
|
39
49
|
onDelete(): MaybePromise<ViewEffect<Row>>;
|
|
40
50
|
/** @internal */
|
|
41
|
-
_bind(row: Row | null, metadata: Metadata, client: ComponentClient): void;
|
|
51
|
+
_bind(row: Row | null, metadata: Metadata, client: ComponentClient, standing?: Standing): void;
|
|
42
52
|
}
|
|
43
53
|
export interface ViewClass<E = unknown, Row = unknown, C extends View<E, Row> = View<E, Row>> {
|
|
44
54
|
new (): C;
|
|
@@ -57,6 +67,11 @@ export interface ViewClass<E = unknown, Row = unknown, C extends View<E, Row> =
|
|
|
57
67
|
readonly contract?: Contract;
|
|
58
68
|
/** The declared broker the topic read is on; absent is the installation's. */
|
|
59
69
|
readonly broker?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Another project's topic (1.15): the id of the project whose topic `topic` is. The broker serves it
|
|
72
|
+
* while that project grants this service consume on it.
|
|
73
|
+
*/
|
|
74
|
+
readonly project?: string;
|
|
60
75
|
/** Whether the partitions an instance holds are handled at once, each in order. */
|
|
61
76
|
readonly parallel?: boolean;
|
|
62
77
|
readonly events: Shape<E>;
|
package/dist/view.js
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
// onChange(event) { ... return this.effects.updateRow(...) }
|
|
10
10
|
// }
|
|
11
11
|
import { ViewEffects } from "./effects/stateless.js";
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Declares a query for a view's `static declared`. The SDK sends the statement as written.
|
|
14
|
+
* `{ watched: true }` declares that it may also be watched, which the platform checks at start.
|
|
15
|
+
*/
|
|
16
|
+
export function declaredQuery(name, statement, options = {}) {
|
|
17
|
+
return Object.freeze({ name, statement, watched: options.watched ?? false });
|
|
15
18
|
}
|
|
16
19
|
/** The table a view's rows are kept in, for a declared query's statement to name. */
|
|
17
20
|
export function tableOf(componentId) {
|
|
@@ -21,6 +24,7 @@ export class View {
|
|
|
21
24
|
effects = new ViewEffects();
|
|
22
25
|
#row = null;
|
|
23
26
|
#metadata = {};
|
|
27
|
+
#standing = undefined;
|
|
24
28
|
#client;
|
|
25
29
|
#bound = false;
|
|
26
30
|
/** The current row, or `null` when there is none yet. */
|
|
@@ -37,6 +41,10 @@ export class View {
|
|
|
37
41
|
get subject() {
|
|
38
42
|
return this.#metadata["ce-subject"] ?? "";
|
|
39
43
|
}
|
|
44
|
+
/** Of a change from a workflow: where it stood once the effect that recorded the state was applied. `undefined` for a change from an entity or a topic. */
|
|
45
|
+
get standing() {
|
|
46
|
+
return this.#standing;
|
|
47
|
+
}
|
|
40
48
|
get client() {
|
|
41
49
|
if (!this.#client)
|
|
42
50
|
throw new Error("client is only available inside onChange or onDelete");
|
|
@@ -51,9 +59,10 @@ export class View {
|
|
|
51
59
|
return this.effects.deleteRow();
|
|
52
60
|
}
|
|
53
61
|
/** @internal */
|
|
54
|
-
_bind(row, metadata, client) {
|
|
62
|
+
_bind(row, metadata, client, standing) {
|
|
55
63
|
this.#row = row;
|
|
56
64
|
this.#metadata = metadata;
|
|
65
|
+
this.#standing = standing;
|
|
57
66
|
this.#client = client;
|
|
58
67
|
this.#bound = true;
|
|
59
68
|
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { HandlerTable } from "./handlers.ts";
|
|
|
4
4
|
import { type ComponentClient, type Secrets } from "./client.ts";
|
|
5
5
|
import { StepEffects, WorkflowEffects, type WorkflowSettings } from "./effects/workflow.ts";
|
|
6
6
|
import { type Services } from "./services.ts";
|
|
7
|
+
import { type Buckets } from "./storage.ts";
|
|
7
8
|
export declare abstract class Workflow<S> {
|
|
8
9
|
#private;
|
|
9
10
|
/** Inside a command handler. */
|
|
@@ -21,6 +22,13 @@ export declare abstract class Workflow<S> {
|
|
|
21
22
|
get secrets(): Secrets;
|
|
22
23
|
/** A unit test's store in place of the runtime's. */
|
|
23
24
|
set secrets(store: Secrets);
|
|
25
|
+
/**
|
|
26
|
+
* The service's buckets, in a step. A command handler is refused: a wait on a store would hold the
|
|
27
|
+
* workflow's other commands behind it.
|
|
28
|
+
*/
|
|
29
|
+
get storage(): Buckets;
|
|
30
|
+
/** A unit test's store in place of the runtime's. */
|
|
31
|
+
set storage(buckets: Buckets);
|
|
24
32
|
/**
|
|
25
33
|
* Other services, called as this one, in a step. A command handler is refused, as for the secret
|
|
26
34
|
* store: it would block the workflow's other commands behind another service.
|
package/dist/workflow.js
CHANGED
|
@@ -9,6 +9,7 @@ import { secretsFor } from "./client.js";
|
|
|
9
9
|
import { CommandError } from "./effects/common.js";
|
|
10
10
|
import { StepEffects, WorkflowEffects } from "./effects/workflow.js";
|
|
11
11
|
import { servicesFor } from "./services.js";
|
|
12
|
+
import { processStorage, StorageRefusals } from "./storage.js";
|
|
12
13
|
export class Workflow {
|
|
13
14
|
/** Inside a command handler. */
|
|
14
15
|
effects = new WorkflowEffects();
|
|
@@ -55,6 +56,20 @@ export class Workflow {
|
|
|
55
56
|
set secrets(store) {
|
|
56
57
|
this.#secrets = store;
|
|
57
58
|
}
|
|
59
|
+
#storage;
|
|
60
|
+
/**
|
|
61
|
+
* The service's buckets, in a step. A command handler is refused: a wait on a store would hold the
|
|
62
|
+
* workflow's other commands behind it.
|
|
63
|
+
*/
|
|
64
|
+
get storage() {
|
|
65
|
+
if (!this.#inStep)
|
|
66
|
+
throw StorageRefusals.stepsOnly();
|
|
67
|
+
return this.#storage ?? processStorage();
|
|
68
|
+
}
|
|
69
|
+
/** A unit test's store in place of the runtime's. */
|
|
70
|
+
set storage(buckets) {
|
|
71
|
+
this.#storage = buckets;
|
|
72
|
+
}
|
|
58
73
|
#services;
|
|
59
74
|
/**
|
|
60
75
|
* Other services, called as this one, in a step. A command handler is refused, as for the secret
|
package/package.json
CHANGED