@lostgradient/weft 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 -1
- package/dist/cli/api.d.ts +2 -0
- package/dist/cli/api.js +3 -4
- package/dist/cli/generated/operation-catalog.snapshot.json +5167 -0
- package/dist/cli/generated/operation-client.generated.d.ts +119 -10
- package/dist/cli/generated/operation-client.generated.js +74 -1
- package/dist/cli/index.js +1 -0
- package/dist/cli/operation-catalog-snapshot.d.ts +11 -2
- package/dist/cli/operation-catalog-snapshot.js +14 -5
- package/dist/cli/operation-client-runtime.d.ts +29 -0
- package/dist/cli-main.js +227 -401
- package/dist/client/client-storage.d.ts +24 -0
- package/dist/client/client-storage.js +14 -0
- package/dist/client/handle-delegation.d.ts +3 -3
- package/dist/client/handle-delegation.js +2 -2
- package/dist/client/http-client-requests.d.ts +5 -3
- package/dist/client/http-client-requests.js +20 -2
- package/dist/client/http-client-storage.d.ts +3 -0
- package/dist/client/http-client-storage.js +110 -0
- package/dist/client/http-client.d.ts +9 -6
- package/dist/client/http-client.js +13 -18
- package/dist/client/http-operations.d.ts +3 -1
- package/dist/client/http-operations.js +84 -2
- package/dist/client/http-request.d.ts +35 -6
- package/dist/client/http-request.js +31 -10
- package/dist/client/in-process-operations.d.ts +2 -2
- package/dist/client/in-process-operations.js +2 -2
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +18 -0
- package/dist/client/interface.d.ts +26 -26
- package/dist/client/local.d.ts +9 -6
- package/dist/client/local.js +9 -4
- package/dist/client/search-params.js +10 -6
- package/dist/client/start-body.d.ts +3 -1
- package/dist/client/start-body.js +9 -0
- package/dist/connection.d.ts +8 -0
- package/dist/connection.js +41 -17
- package/dist/core/bulk-workflow-filter.d.ts +2 -1
- package/dist/core/bulk-workflow-filter.js +5 -1
- package/dist/core/engine/async-activity-records.d.ts +12 -1
- package/dist/core/engine/async-activity-records.js +81 -2
- package/dist/core/engine/bulk-operations-purge.js +16 -1
- package/dist/core/engine/bulk-operations-shared.js +2 -0
- package/dist/core/engine/callback-creators-core.js +2 -1
- package/dist/core/engine/callback-creators-schedule.d.ts +2 -1
- package/dist/core/engine/callback-creators-schedule.js +3 -3
- package/dist/core/engine/checkpoint-reads.js +11 -1
- package/dist/core/engine/child-workflow.js +15 -6
- package/dist/core/engine/construction.js +3 -0
- package/dist/core/engine/disposal.js +2 -0
- package/dist/core/engine/engine-internal-types.d.ts +4 -1
- package/dist/core/engine/fenced-write.d.ts +5 -3
- package/dist/core/engine/finalizer-status.d.ts +10 -0
- package/dist/core/engine/finalizer-status.js +82 -0
- package/dist/core/engine/index.d.ts +69 -2
- package/dist/core/engine/index.js +71 -8
- package/dist/core/engine/internals.d.ts +3 -0
- package/dist/core/engine/lease-health.d.ts +64 -0
- package/dist/core/engine/lease-health.js +0 -0
- package/dist/core/engine/lease-manager.d.ts +4 -2
- package/dist/core/engine/lease-manager.js +32 -4
- package/dist/core/engine/lifecycle/recovered-services.js +0 -2
- package/dist/core/engine/lifecycle/shared.d.ts +28 -0
- package/dist/core/engine/lifecycle/start-batch.js +12 -0
- package/dist/core/engine/lifecycle/start.d.ts +1 -1
- package/dist/core/engine/lifecycle/start.js +34 -5
- package/dist/core/engine/lifecycle/transition.js +19 -9
- package/dist/core/engine/operations-coordination.d.ts +1 -12
- package/dist/core/engine/operations-coordination.js +57 -10
- package/dist/core/engine/operations-speculate.d.ts +1 -1
- package/dist/core/engine/operations-speculate.js +19 -5
- package/dist/core/engine/registration.js +14 -0
- package/dist/core/engine/schedule-handle.d.ts +4 -4
- package/dist/core/engine/schedule-handle.js +2 -2
- package/dist/core/engine/schedule-overlap.d.ts +11 -0
- package/dist/core/engine/schedule-overlap.js +50 -0
- package/dist/core/engine/schedule-run.d.ts +11 -3
- package/dist/core/engine/schedule-run.js +27 -4
- package/dist/core/engine/schedule-timer.js +10 -1
- package/dist/core/engine/schedules.d.ts +5 -4
- package/dist/core/engine/schedules.js +62 -56
- package/dist/core/engine/state-utilities.js +1 -1
- package/dist/core/engine/storage-io.d.ts +12 -0
- package/dist/core/engine/storage-io.js +49 -10
- package/dist/core/engine/termination/finalizer-claim.d.ts +8 -6
- package/dist/core/engine/termination/finalizer-claim.js +2 -1
- package/dist/core/engine/termination/finalizer.js +10 -14
- package/dist/core/engine/timeline-coordinator-constants.d.ts +3 -0
- package/dist/core/engine/timeline-coordinator-constants.js +1 -0
- package/dist/core/engine/timeline-coordinator-detail.d.ts +13 -0
- package/dist/core/engine/timeline-coordinator-detail.js +76 -0
- package/dist/core/engine/validation/schedule-options.d.ts +8 -1
- package/dist/core/engine/validation/schedule-options.js +18 -0
- package/dist/core/engine/validation/schedule.d.ts +1 -1
- package/dist/core/engine/validation/schedule.js +27 -3
- package/dist/core/engine/validation.js +66 -2
- package/dist/core/engine/workflow-state-stream.d.ts +5 -1
- package/dist/core/engine/workflow-state-stream.js +37 -14
- package/dist/core/events/schedule-events.d.ts +3 -4
- package/dist/core/events/workflow-events.d.ts +2 -1
- package/dist/core/list-filter-validation.d.ts +3 -0
- package/dist/core/list-filter-validation.js +11 -0
- package/dist/core/registry-snapshot.d.ts +32 -0
- package/dist/core/registry-snapshot.js +28 -0
- package/dist/core/review/index.d.ts +4 -4
- package/dist/core/types/activity.d.ts +52 -5
- package/dist/core/types/bulk.d.ts +1 -0
- package/dist/core/types/definition-schema-to-json.d.ts +11 -0
- package/dist/core/types/definition-schema-to-json.js +11 -2
- package/dist/core/types/list-options.d.ts +6 -0
- package/dist/core/types/options.d.ts +6 -5
- package/dist/core/types/reviews.d.ts +2 -2
- package/dist/core/types/schedules.d.ts +45 -2
- package/dist/core/types/services-resolution.d.ts +5 -5
- package/dist/core/types/state.d.ts +64 -0
- package/dist/core/types/workflow-log.d.ts +3 -2
- package/dist/core/types/workflow-observability.d.ts +50 -0
- package/dist/core/types/workflow-observability.js +0 -0
- package/dist/core/types/workflow-registry.d.ts +7 -0
- package/dist/core/types.d.ts +1 -0
- package/dist/core/types.js +1 -0
- package/dist/http.js +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/indexeddb.js +1 -0
- package/dist/json-schema.js +3 -3
- package/dist/mcp/cli.js +63 -61
- package/dist/mcp/http.d.ts +7 -2
- package/dist/mcp/session.d.ts +3 -3
- package/dist/mcp/session.js +3 -2
- package/dist/mcp/stdio.d.ts +7 -2
- package/dist/observability/index.js +2 -2
- package/dist/runtime/portable.d.ts +33 -0
- package/dist/runtime/portable.js +17 -6
- package/dist/server/access-policy-metadata.d.ts +92 -0
- package/dist/server/access-policy-metadata.js +78 -0
- package/dist/server/engine-event-feed-backend.d.ts +22 -3
- package/dist/server/fault-to-http.d.ts +3 -7
- package/dist/server/fault-to-http.js +2 -34
- package/dist/server/fleet-event-feed.d.ts +65 -0
- package/dist/server/handler/index.d.ts +11 -2
- package/dist/server/handler/index.js +8 -1
- package/dist/server/handler/route-dispatch.d.ts +10 -3
- package/dist/server/handler/route-dispatch.js +19 -4
- package/dist/server/handler.js +1 -56
- package/dist/server/index.d.ts +13 -2
- package/dist/server/index.js +88 -64
- package/dist/server/interactive-operations.js +2 -0
- package/dist/server/openapi-error-responses.js +55 -4
- package/dist/server/openapi.d.ts +3 -1
- package/dist/server/openapi.js +4 -0
- package/dist/server/openrpc-document-schema.d.ts +64 -0
- package/dist/server/openrpc-document-schema.js +6 -26
- package/dist/server/openrpc.d.ts +4 -0
- package/dist/server/openrpc.js +9 -33
- package/dist/server/operation-fault.d.ts +24 -7
- package/dist/server/operation-fault.js +65 -13
- package/dist/server/operations/aggregate-workflows.d.ts +6 -0
- package/dist/server/operations/aggregate-workflows.js +3 -2
- package/dist/server/operations/async-activity.d.ts +14 -0
- package/dist/server/operations/async-activity.js +88 -4
- package/dist/server/operations/bulk-filter-helpers.d.ts +3 -0
- package/dist/server/operations/bulk-filter-helpers.js +27 -3
- package/dist/server/operations/bulk-mutate-workflow-tags.d.ts +6 -0
- package/dist/server/operations/bulk-signal-workflows.d.ts +6 -0
- package/dist/server/operations/get-stream-chunks.js +2 -7
- package/dist/server/operations/get-system-lease.d.ts +19 -0
- package/dist/server/operations/get-system-lease.js +48 -0
- package/dist/server/operations/get-workflow-observability.d.ts +24 -0
- package/dist/server/operations/get-workflow-observability.js +80 -0
- package/dist/server/operations/get-workflow-result.js +2 -2
- package/dist/server/operations/get-workflow.d.ts +2 -2
- package/dist/server/operations/list-filter-query-extractor.js +15 -0
- package/dist/server/operations/list-workflows.d.ts +6 -0
- package/dist/server/operations/list-workflows.js +12 -3
- package/dist/server/operations/operation-helpers.d.ts +9 -18
- package/dist/server/operations/operation-helpers.js +5 -23
- package/dist/server/operations/purge-workflows.d.ts +3 -0
- package/dist/server/operations/recover-all.js +2 -1
- package/dist/server/operations/single-workflow-tag-mutation.js +2 -2
- package/dist/server/operations/sse-stream.js +2 -7
- package/dist/server/operations/storage-capabilities.d.ts +34 -0
- package/dist/server/operations/storage-capabilities.js +38 -0
- package/dist/server/operations/storage.js +8 -17
- package/dist/server/operations/stream-workflow-sse.js +3 -9
- package/dist/server/operations/submit-review-decision.d.ts +2 -0
- package/dist/server/operations/submit-review-decision.js +19 -2
- package/dist/server/operations/update-schedule.d.ts +8 -0
- package/dist/server/operations/update-schedule.js +70 -7
- package/dist/server/operations/workflow-events-sse.js +2 -2
- package/dist/server/replay-live-feed-internals.d.ts +19 -0
- package/dist/server/replay-live-feed-internals.js +76 -0
- package/dist/server/rest-binding.d.ts +7 -6
- package/dist/server/rest-bindings.d.ts +2 -13
- package/dist/server/rest-bindings.js +19 -10
- package/dist/server/runtime/authentication-bridge.d.ts +2 -2
- package/dist/server/serve-internals.js +3 -3
- package/dist/server/task-queue.d.ts +7 -5
- package/dist/server/workflow-event-feed.d.ts +100 -11
- package/dist/server/workflow-event-feed.js +1 -140
- package/dist/service-worker/index.d.ts +8 -2
- package/dist/service-worker/index.js +37 -56
- package/dist/service-worker/setup.d.ts +6 -2
- package/dist/storage/auto.js +1 -1
- package/dist/storage/bun-sql.js +3 -3
- package/dist/storage/capabilities.d.ts +1 -1
- package/dist/storage/cloudflare-durable-object-sql.d.ts +75 -0
- package/dist/storage/cloudflare-durable-object-sql.js +0 -0
- package/dist/storage/cloudflare-value-codec.d.ts +67 -0
- package/dist/storage/cloudflare-value-codec.js +46 -0
- package/dist/storage/cloudflare.d.ts +140 -0
- package/dist/storage/cloudflare.js +127 -0
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/http.js +200 -2
- package/dist/storage/index.d.ts +8 -1
- package/dist/storage/indexeddb.js +311 -1
- package/dist/storage/interface.d.ts +16 -4
- package/dist/storage/interface.js +1 -1
- package/dist/storage/key-prefixes.d.ts +1 -1
- package/dist/storage/key-prefixes.js +4 -0
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon.js +4 -4
- package/dist/storage/node-sqlite.js +3 -3
- package/dist/storage/postgres-key-value-queries.d.ts +6 -0
- package/dist/storage/postgres-key-value-queries.js +2 -3
- package/dist/storage/postgres.js +4 -4
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/sql-identifier.d.ts +35 -0
- package/dist/storage/sql-identifier.js +5 -0
- package/dist/storage/sqlite-key-value-queries.d.ts +11 -6
- package/dist/storage/sqlite-key-value-queries.js +3 -3
- package/dist/storage/testing.js +1 -1
- package/dist/storage/turso.js +2 -2
- package/dist/storage/typed-storage.js +138 -2
- package/dist/storage/web-extension.js +298 -1
- package/dist/testing/index.js +21 -60
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/web-extension.js +1 -0
- package/dist/worker/protocol.js +1 -1
- package/package.json +8 -3
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module server/handler
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { RegistryAgnosticEngine } from '../../core/engine.ts';
|
|
13
13
|
import { type HandlerOptions } from './route-dispatch.ts';
|
|
14
14
|
export { authContextToPrincipal } from './auth-context-principal.ts';
|
|
15
15
|
export { isOperationFaultLike, type HandlerOptions } from './route-dispatch.ts';
|
|
16
16
|
export { extractRouteParameters, getRequiredRouteParameter } from './route-matching.ts';
|
|
17
|
+
export { createEngineEventFeedBackend } from '../engine-event-feed-backend.ts';
|
|
18
|
+
export { createFleetEventFeed, type FleetEventEnvelope, type FleetEventFeed, } from '../fleet-event-feed.ts';
|
|
19
|
+
export { createWorkflowEventFeed, type Cursor, type EventEnvelope, type WorkflowEventFeed, type WorkflowEventFeedBackend, } from '../workflow-event-feed.ts';
|
|
17
20
|
/**
|
|
18
21
|
* Pure HTTP request handler. Maps Request to Response.
|
|
19
22
|
*
|
|
23
|
+
* `engine` is typed as {@link RegistryAgnosticEngine} (see its JSDoc) rather
|
|
24
|
+
* than the plain default `Engine`, so both `new Engine({ storage })` and
|
|
25
|
+
* `Engine.create({ workflows })` type-check here directly. This module's
|
|
26
|
+
* dispatch chain only calls registry-erased `Engine` methods, so the value is
|
|
27
|
+
* registry-erased back to the plain `Engine` once, internally.
|
|
28
|
+
*
|
|
20
29
|
* @example
|
|
21
30
|
* ```ts
|
|
22
31
|
* import { workflow, Engine, MemoryStorage, handleRequest } from '@lostgradient/weft';
|
|
@@ -29,4 +38,4 @@ export { extractRouteParameters, getRequiredRouteParameter } from './route-match
|
|
|
29
38
|
* console.log(response.status); // 200
|
|
30
39
|
* ```
|
|
31
40
|
*/
|
|
32
|
-
export declare function handleRequest(request: Request, engine:
|
|
41
|
+
export declare function handleRequest(request: Request, engine: RegistryAgnosticEngine, options?: HandlerOptions): Promise<Response>;
|
|
@@ -12,6 +12,13 @@ import { matchDirectRoute } from "./route-matching.js";
|
|
|
12
12
|
export { authContextToPrincipal } from "./auth-context-principal.js";
|
|
13
13
|
export { isOperationFaultLike } from "./route-dispatch.js";
|
|
14
14
|
export { extractRouteParameters, getRequiredRouteParameter } from "./route-matching.js";
|
|
15
|
+
export { createEngineEventFeedBackend } from "../engine-event-feed-backend.js";
|
|
16
|
+
export {
|
|
17
|
+
createFleetEventFeed
|
|
18
|
+
} from "../fleet-event-feed.js";
|
|
19
|
+
export {
|
|
20
|
+
createWorkflowEventFeed
|
|
21
|
+
} from "../workflow-event-feed.js";
|
|
15
22
|
function matchRouteBoundary(matcher) {
|
|
16
23
|
try {
|
|
17
24
|
return { kind: "matched", value: matcher() };
|
|
@@ -68,7 +75,7 @@ async function dispatchMatchedRoute(request, engine, options, url) {
|
|
|
68
75
|
return directRouteLookup.response;
|
|
69
76
|
if (directRouteLookup.value !== null)
|
|
70
77
|
return dispatchDirectRoute(request, engine, directRouteLookup.value, options, url);
|
|
71
|
-
const restBindings = options?.restBindings ?? defaultRestBindings(), operationRegistry = options?.operationRegistry ?? defaultOperationRegistry(), bindingLookup = matchRouteBoundary(() => matchRestBinding(request.method, url.pathname, restBindings));
|
|
78
|
+
const restBindings = options?.restBindings ?? defaultRestBindings(), operationRegistry = options?.operationRegistry ?? defaultOperationRegistry(options), bindingLookup = matchRouteBoundary(() => matchRestBinding(request.method, url.pathname, restBindings));
|
|
72
79
|
if (bindingLookup.kind === "malformed")
|
|
73
80
|
return bindingLookup.response;
|
|
74
81
|
if (bindingLookup.value !== null)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Engine } from '../../core/engine.ts';
|
|
2
2
|
import { type PrometheusExporter } from '../../observability/metrics.ts';
|
|
3
|
+
import type { WorkerRegistry } from '../../worker/registry.ts';
|
|
3
4
|
import type { AuthContext } from '../authentication.ts';
|
|
4
5
|
import type { DiscoveryInfo } from '../discovery-info.ts';
|
|
5
6
|
import type { FleetEventFeed } from '../fleet-event-feed.ts';
|
|
@@ -9,6 +10,7 @@ import type { OperationFault } from '../operation-fault.ts';
|
|
|
9
10
|
import type { WorkflowStreamConnectionAcquirer } from '../operations/workflow-events-sse.ts';
|
|
10
11
|
import type { Principal } from '../principal.ts';
|
|
11
12
|
import { type UnknownRestBinding } from '../rest-bindings.ts';
|
|
13
|
+
import type { TaskQueue } from '../task-queue.ts';
|
|
12
14
|
import type { WorkflowEventFeed } from '../workflow-event-feed.ts';
|
|
13
15
|
import type { DirectRouteHandlerName } from './route-matching.ts';
|
|
14
16
|
import { type LiveEventStreamContext } from './sse-route-dispatch.ts';
|
|
@@ -16,8 +18,9 @@ import { type LiveEventStreamContext } from './sse-route-dispatch.ts';
|
|
|
16
18
|
* Options bag passed to `handleRequest` by the HTTP server wrapper.
|
|
17
19
|
*
|
|
18
20
|
* Injects the resolved authentication context, custom metrics exporters, and
|
|
19
|
-
* an optional override for the operation registry and REST bindings.
|
|
20
|
-
* `operationRegistry` and `restBindings` together to use the live defaults
|
|
21
|
+
* an optional override for the operation registry and REST bindings. Omit
|
|
22
|
+
* `operationRegistry` and `restBindings` together to use the live defaults,
|
|
23
|
+
* optionally bound to the supplied worker registry and task queue.
|
|
21
24
|
*
|
|
22
25
|
* @example
|
|
23
26
|
* ```ts
|
|
@@ -41,6 +44,10 @@ export interface HandlerOptions {
|
|
|
41
44
|
* from the OpenTelemetry SDK (e.g. via `@opentelemetry/exporter-prometheus`).
|
|
42
45
|
*/
|
|
43
46
|
prometheusExporter?: PrometheusExporter;
|
|
47
|
+
/** Live worker state used by worker and task-diagnostics operations. */
|
|
48
|
+
workerRegistry?: WorkerRegistry;
|
|
49
|
+
/** Live task-queue state used by queue and task-diagnostics operations. */
|
|
50
|
+
taskQueue?: TaskQueue;
|
|
44
51
|
/**
|
|
45
52
|
* Operation registry for pipeline dispatch. Must be supplied together
|
|
46
53
|
* with `restBindings` — a caller that overrides one but not the other
|
|
@@ -133,5 +140,5 @@ export declare function dispatchViaExecuteOperation(request: Request, engine: En
|
|
|
133
140
|
* ```
|
|
134
141
|
*/
|
|
135
142
|
export declare function isOperationFaultLike(value: unknown): value is OperationFault;
|
|
136
|
-
export declare function defaultOperationRegistry(): OperationRegistry;
|
|
143
|
+
export declare function defaultOperationRegistry(options?: Pick<HandlerOptions, 'workerRegistry' | 'taskQueue'>): OperationRegistry;
|
|
137
144
|
export declare function defaultRestBindings(): ReadonlyArray<UnknownRestBinding>;
|
|
@@ -94,19 +94,19 @@ export const DIRECT_ROUTE_EXECUTORS = {
|
|
|
94
94
|
return jsonResponse(generateMcpDiscovery({ origin: originResolution.origin }));
|
|
95
95
|
},
|
|
96
96
|
openApiDocument: async ({ options }) => jsonResponse(generateOpenApiDocument({
|
|
97
|
-
registry: options?.operationRegistry ?? defaultOperationRegistry(),
|
|
97
|
+
registry: options?.operationRegistry ?? defaultOperationRegistry(options),
|
|
98
98
|
...options?.restBindings !== void 0 ? { restBindings: options.restBindings } : {},
|
|
99
99
|
...options?.supportedAuthenticationSchemes !== void 0 ? { supportedSchemes: options.supportedAuthenticationSchemes } : {},
|
|
100
100
|
...options?.discoveryInfo !== void 0 ? { discoveryInfo: options.discoveryInfo } : {}
|
|
101
101
|
})),
|
|
102
102
|
openRpcDocument: async ({ engine, options }) => jsonResponse(generateOpenRpcDocument({
|
|
103
|
-
registry: options?.operationRegistry ?? defaultOperationRegistry(),
|
|
103
|
+
registry: options?.operationRegistry ?? defaultOperationRegistry(options),
|
|
104
104
|
transports: ["http", "websocket"],
|
|
105
105
|
mcpTools: listMcpTools(engine),
|
|
106
106
|
...options?.discoveryInfo !== void 0 ? { discoveryInfo: options.discoveryInfo } : {}
|
|
107
107
|
})),
|
|
108
108
|
asyncApiDocument: async ({ options }) => jsonResponse(generateAsyncApiDocument({
|
|
109
|
-
registry: options?.operationRegistry ?? defaultOperationRegistry(),
|
|
109
|
+
registry: options?.operationRegistry ?? defaultOperationRegistry(options),
|
|
110
110
|
...options?.restBindings !== void 0 ? { restBindings: options.restBindings } : {},
|
|
111
111
|
...options?.discoveryInfo !== void 0 ? { discoveryInfo: options.discoveryInfo } : {}
|
|
112
112
|
}))
|
|
@@ -173,7 +173,22 @@ export function isOperationFaultLike(value) {
|
|
|
173
173
|
return typeof fields.code === "string" && Object.hasOwn(FAULT_CODE_TO_HTTP_STATUS, fields.code) && typeof fields.message === "string" && typeof fields.data === "object" && fields.data !== null && !Array.isArray(fields.data);
|
|
174
174
|
}
|
|
175
175
|
let defaultOperationRegistryCache;
|
|
176
|
-
|
|
176
|
+
const missingWorkerRegistryCacheKey = {}, missingTaskQueueCacheKey = {}, liveOperationRegistryCache = new WeakMap;
|
|
177
|
+
export function defaultOperationRegistry(options) {
|
|
178
|
+
if (options?.workerRegistry !== void 0 || options?.taskQueue !== void 0) {
|
|
179
|
+
const workerRegistryCacheKey = options.workerRegistry ?? missingWorkerRegistryCacheKey, taskQueueCacheKey = options.taskQueue ?? missingTaskQueueCacheKey;
|
|
180
|
+
let registriesByTaskQueue = liveOperationRegistryCache.get(workerRegistryCacheKey);
|
|
181
|
+
if (registriesByTaskQueue === void 0) {
|
|
182
|
+
registriesByTaskQueue = new WeakMap;
|
|
183
|
+
liveOperationRegistryCache.set(workerRegistryCacheKey, registriesByTaskQueue);
|
|
184
|
+
}
|
|
185
|
+
let registry = registriesByTaskQueue.get(taskQueueCacheKey);
|
|
186
|
+
if (registry === void 0) {
|
|
187
|
+
registry = createLiveOperationRegistry(options);
|
|
188
|
+
registriesByTaskQueue.set(taskQueueCacheKey, registry);
|
|
189
|
+
}
|
|
190
|
+
return registry;
|
|
191
|
+
}
|
|
177
192
|
if (defaultOperationRegistryCache === void 0)
|
|
178
193
|
defaultOperationRegistryCache = createLiveOperationRegistry();
|
|
179
194
|
return defaultOperationRegistryCache;
|