@ontahi/react 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +154 -5
- package/dist/actions/fetch-operation-bridge-adapter.d.ts +10 -3
- package/dist/actions/fetch-operation-bridge-adapter.d.ts.map +1 -1
- package/dist/actions/fetch-operation-bridge-adapter.js +92 -29
- package/dist/actions/fetch-operation-bridge-adapter.js.map +1 -1
- package/dist/actions/operation-bridge.d.ts +2 -0
- package/dist/actions/operation-bridge.d.ts.map +1 -1
- package/dist/actions/operation-bridge.js.map +1 -1
- package/dist/graph/canonical-request-invalidation.d.ts +14 -0
- package/dist/graph/canonical-request-invalidation.d.ts.map +1 -0
- package/dist/graph/canonical-request-invalidation.js +42 -0
- package/dist/graph/canonical-request-invalidation.js.map +1 -0
- package/dist/graph/context.d.ts +10 -3
- package/dist/graph/context.d.ts.map +1 -1
- package/dist/graph/context.js +39 -4
- package/dist/graph/context.js.map +1 -1
- package/dist/graph/executor.d.ts +19 -1
- package/dist/graph/executor.d.ts.map +1 -1
- package/dist/graph/executor.js.map +1 -1
- package/dist/graph/fetch-graph-client.d.ts +20 -4
- package/dist/graph/fetch-graph-client.d.ts.map +1 -1
- package/dist/graph/fetch-graph-client.js +87 -17
- package/dist/graph/fetch-graph-client.js.map +1 -1
- package/dist/graph/fetch-graph-runtime.d.ts +9 -4
- package/dist/graph/fetch-graph-runtime.d.ts.map +1 -1
- package/dist/graph/fetch-graph-runtime.js +83 -6
- package/dist/graph/fetch-graph-runtime.js.map +1 -1
- package/dist/graph/fetch-runtime-transport.d.ts +4 -4
- package/dist/graph/fetch-runtime-transport.d.ts.map +1 -1
- package/dist/graph/fetch-runtime-transport.js +11 -14
- package/dist/graph/fetch-runtime-transport.js.map +1 -1
- package/dist/graph/graph-hooks.d.ts +3 -1
- package/dist/graph/graph-hooks.d.ts.map +1 -1
- package/dist/graph/graph-hooks.js +167 -40
- package/dist/graph/graph-hooks.js.map +1 -1
- package/dist/graph/index.d.ts +5 -0
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +5 -0
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/model-command-hooks.d.ts +2 -0
- package/dist/graph/model-command-hooks.d.ts.map +1 -0
- package/dist/graph/model-command-hooks.js +9 -0
- package/dist/graph/model-command-hooks.js.map +1 -0
- package/dist/graph/operation-hooks.d.ts +4 -2
- package/dist/graph/operation-hooks.d.ts.map +1 -1
- package/dist/graph/operation-hooks.js +95 -11
- package/dist/graph/operation-hooks.js.map +1 -1
- package/dist/graph/operation-types.d.ts +5 -1
- package/dist/graph/operation-types.d.ts.map +1 -1
- package/dist/graph/operation-types.js.map +1 -1
- package/dist/graph/runtime-graph-client.d.ts +13 -0
- package/dist/graph/runtime-graph-client.d.ts.map +1 -0
- package/dist/graph/runtime-graph-client.js +35 -0
- package/dist/graph/runtime-graph-client.js.map +1 -0
- package/dist/graph/semantic-invalidation.d.ts +27 -0
- package/dist/graph/semantic-invalidation.d.ts.map +1 -0
- package/dist/graph/semantic-invalidation.js +55 -0
- package/dist/graph/semantic-invalidation.js.map +1 -0
- package/dist/graph/websocket-runtime-transport.d.ts +32 -0
- package/dist/graph/websocket-runtime-transport.d.ts.map +1 -0
- package/dist/graph/websocket-runtime-transport.js +605 -0
- package/dist/graph/websocket-runtime-transport.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-graph-client.js","sourceRoot":"","sources":["../../src/graph/fetch-graph-client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAWb,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EACL,iCAAiC,EACjC,oCAAoC,GAGrC,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EACL,2BAA2B,GAE5B,MAAM,8BAA8B,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CAAC;QAC7F,GAAG,CAAC,0BAA0B,KAAK,KAAK;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,gCAAgC,EAAE,2CAA2C,CAC3E,0BAA0B,CAC3B;aACF,CAAC;KACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type {\n ReflectedEntityDataReader,\n ReflectedEntityDataResult,\n ReflectedRelatedEntityDataReader,\n ReflectedRelatedEntityDataQuery,\n ReflectedOperationInvoker,\n RemoteDataGraphError,\n RuntimeBoundDataGraphApi,\n} from '@ontahi/core/data-graph';\nimport { createRuntimeBoundDataGraphApi } from '@ontahi/core/data-graph';\nimport type { RuntimeTransport } from '@ontahi/core/runtime/protocol';\n\nimport {\n createFetchOperationBridgeAdapter,\n createFetchReflectedOperationInvoker,\n type AnyOperationBridgeAdapter,\n type FetchOperationBridgeOptions,\n} from '../actions/index.js';\n\nimport type { ReactGraphExecutor } from './executor.js';\nimport type { FetchGraphReadExecutorOptions } from './fetch-graph-read-executor.js';\nimport { createFetchGraphReadCapability } from './fetch-graph-runtime.js';\nimport {\n createFetchRuntimeTransport,\n type FetchRuntimeTransportOptions,\n} from './fetch-runtime-transport.js';\n\nexport type FetchReflectedEntityDataReaderOptions = {\n endpoint?: string;\n fetch?: typeof globalThis.fetch;\n};\n\nexport type FetchReflectedRelatedEntityDataReaderOptions = FetchReflectedEntityDataReaderOptions;\n\nexport type OntahiGraphClient<TReadOptions = unknown, TCommandOptions = TReadOptions> = {\n graph?: RuntimeBoundDataGraphApi<\n RemoteDataGraphError,\n TReadOptions,\n TCommandOptions,\n RemoteDataGraphError\n >;\n graphExecutor?: ReactGraphExecutor<TReadOptions, TCommandOptions>;\n runtimeTransport?: RuntimeTransport;\n operationBridgeAdapters?: AnyOperationBridgeAdapter[];\n reflectedEntityDataReader?: ReflectedEntityDataReader;\n reflectedRelatedEntityDataReader?: ReflectedRelatedEntityDataReader;\n reflectedOperationInvoker?: ReflectedOperationInvoker;\n};\n\nexport type FetchGraphClient<TOptions = undefined> = OntahiGraphClient<TOptions, TOptions> & {\n graph: RuntimeBoundDataGraphApi<RemoteDataGraphError, TOptions, TOptions, RemoteDataGraphError>;\n graphExecutor: ReactGraphExecutor<TOptions, TOptions>;\n};\n\nexport type FetchGraphClientOptions<TOptions = undefined> = {\n graphRead?: false | FetchGraphReadExecutorOptions<TOptions>;\n operations?: false | FetchOperationBridgeOptions;\n runtimeTransport?: false | FetchRuntimeTransportOptions;\n reflectedEntityData?: false | FetchReflectedEntityDataReaderOptions;\n reflectedRelatedEntityData?: false | FetchReflectedRelatedEntityDataReaderOptions;\n};\n\nconst DEFAULT_OPERATIONS_ENDPOINT = '/operations';\nconst DEFAULT_REFLECTED_ENTITY_DATA_ENDPOINT = '/explorer/entities';\nconst DEFAULT_REFLECTED_RELATED_ENTITY_DATA_ENDPOINT = '/explorer/related-entities';\n\nconst postReflectedEntityDataQuery = async (\n endpoint: string,\n query:\n | ReflectedRelatedEntityDataQuery\n | Parameters<ReflectedEntityDataReader['readEntityData']>[0],\n fetchRequest: typeof globalThis.fetch,\n) => {\n const response = await fetchRequest(endpoint, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n credentials: 'same-origin',\n body: JSON.stringify(query),\n });\n\n if (!response.ok) {\n throw new Error(`Reflected entity data request failed with status ${response.status}.`);\n }\n\n return response.json() as Promise<ReflectedEntityDataResult>;\n};\n\nconst conventionalOperationOptions = (\n options: FetchOperationBridgeOptions,\n): FetchOperationBridgeOptions =>\n options.mountPath === undefined\n ? {\n endpoint: DEFAULT_OPERATIONS_ENDPOINT,\n ...options,\n }\n : options;\n\nexport const createFetchReflectedEntityDataReader = ({\n endpoint = DEFAULT_REFLECTED_ENTITY_DATA_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n}: FetchReflectedEntityDataReaderOptions = {}): ReflectedEntityDataReader => ({\n readEntityData: query => postReflectedEntityDataQuery(endpoint, query, fetchRequest),\n});\n\nexport const createFetchReflectedRelatedEntityDataReader = ({\n endpoint = DEFAULT_REFLECTED_RELATED_ENTITY_DATA_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n}: FetchReflectedRelatedEntityDataReaderOptions = {}): ReflectedRelatedEntityDataReader => ({\n readRelatedEntityData: query => postReflectedEntityDataQuery(endpoint, query, fetchRequest),\n});\n\nexport function createFetchGraphClient<TOptions = undefined>(): FetchGraphClient<TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>(\n options: FetchGraphClientOptions<TOptions> & { graphRead: false },\n): OntahiGraphClient<TOptions, TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>(\n options: FetchGraphClientOptions<TOptions> & {\n graphRead?: FetchGraphReadExecutorOptions<TOptions>;\n },\n): FetchGraphClient<TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>({\n graphRead = {},\n operations = {},\n runtimeTransport = {},\n reflectedEntityData = {},\n reflectedRelatedEntityData = {},\n}: FetchGraphClientOptions<TOptions> = {}): OntahiGraphClient<TOptions, TOptions> {\n const operationOptions =\n operations === false ? undefined : conventionalOperationOptions(operations);\n const graphReadCapability =\n graphRead === false ? undefined : createFetchGraphReadCapability(graphRead);\n\n return {\n ...(graphReadCapability\n ? {\n graph: createRuntimeBoundDataGraphApi(() => graphReadCapability.runtime),\n graphExecutor: graphReadCapability.graphExecutor,\n }\n : {}),\n ...(runtimeTransport === false\n ? {}\n : { runtimeTransport: createFetchRuntimeTransport(runtimeTransport) }),\n ...(operationOptions\n ? {\n operationBridgeAdapters: [createFetchOperationBridgeAdapter(operationOptions)],\n reflectedOperationInvoker: createFetchReflectedOperationInvoker(operationOptions),\n }\n : {}),\n ...(reflectedEntityData === false\n ? {}\n : { reflectedEntityDataReader: createFetchReflectedEntityDataReader(reflectedEntityData) }),\n ...(reflectedRelatedEntityData === false\n ? {}\n : {\n reflectedRelatedEntityDataReader: createFetchReflectedRelatedEntityDataReader(\n reflectedRelatedEntityData,\n ),\n }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fetch-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B,EAAE,WAAW;gBACtC,CAAC,CAAC,EAAE,WAAW,EAAE,uBAAuB,CAAC,WAAW,EAAE;gBACtD,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,wBAAwB;gBAC1B,CAAC,CAAC,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,SAAS,EAAE;gBAC3D,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IAER,OAAO;QACL,GAAG,CAAC,mBAAmB;YACrB,CAAC,CAAC;gBACE,KAAK,EAAE,8BAA8B,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC;gBACxE,aAAa,EAAE,mBAAmB,CAAC,aAAa;gBAChD,WAAW,EAAE,WAAY;aAC1B;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,GAAG,CAAC,wBAAwB;YAC1B,CAAC,CAAC;gBACE,uBAAuB,EAAE,CAAC,iCAAiC,CAAC,wBAAwB,CAAC,CAAC;gBACtF,yBAAyB,EAAE,oCAAoC,CAAC,wBAAwB,CAAC;aAC1F;YACH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,mBAAmB,KAAK,KAAK;YAC/B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,yBAAyB,EAAE,oCAAoC,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC7F,GAAG,CAAC,0BAA0B,KAAK,KAAK;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,gCAAgC,EAAE,2CAA2C,CAC3E,0BAA0B,CAC3B;aACF,CAAC;KACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type {\n ClientApplication,\n GraphClientCache,\n ReflectedEntityDataReader,\n ReflectedEntityDataResult,\n ReflectedRelatedEntityDataReader,\n ReflectedRelatedEntityDataQuery,\n ReflectedOperationInvoker,\n RemoteDataGraphError,\n RuntimeBoundDataGraphApi,\n} from '@ontahi/core/data-graph';\nimport { createGraphClientCache, createRuntimeBoundDataGraphApi } from '@ontahi/core/data-graph';\nimport type { RuntimeTransport } from '@ontahi/core/runtime/protocol';\n\nimport {\n createFetchOperationBridgeAdapter,\n createFetchReflectedOperationInvoker,\n type AnyOperationBridgeAdapter,\n type FetchOperationBridgeOptions,\n} from '../actions/index.js';\n\nimport type { ReactGraphExecutor } from './executor.js';\nimport type { FetchGraphReadExecutorOptions } from './fetch-graph-read-executor.js';\nimport { createFetchGraphReadCapability } from './fetch-graph-runtime.js';\nimport {\n createFetchRuntimeTransport,\n type FetchRuntimeTransportOptions,\n} from './fetch-runtime-transport.js';\n\nexport type FetchReflectedEntityDataReaderOptions = {\n endpoint?: string;\n fetch?: typeof globalThis.fetch;\n};\n\nexport type FetchReflectedRelatedEntityDataReaderOptions = FetchReflectedEntityDataReaderOptions;\n\nexport type OntahiGraphClient<TReadOptions = unknown, TCommandOptions = TReadOptions> = {\n graph?: RuntimeBoundDataGraphApi<\n RemoteDataGraphError,\n TReadOptions,\n TCommandOptions,\n RemoteDataGraphError\n >;\n graphExecutor?: ReactGraphExecutor<TReadOptions, TCommandOptions>;\n clientCache?: GraphClientCache;\n application?: ClientApplication;\n runtimeTransport?: RuntimeTransport<TReadOptions | TCommandOptions>;\n operationBridgeAdapters?: AnyOperationBridgeAdapter[];\n reflectedEntityDataReader?: ReflectedEntityDataReader;\n reflectedRelatedEntityDataReader?: ReflectedRelatedEntityDataReader;\n reflectedOperationInvoker?: ReflectedOperationInvoker;\n};\n\nexport type FetchGraphClient<TOptions = undefined> = OntahiGraphClient<TOptions, TOptions> & {\n graph: RuntimeBoundDataGraphApi<RemoteDataGraphError, TOptions, TOptions, RemoteDataGraphError>;\n graphExecutor: ReactGraphExecutor<TOptions, TOptions>;\n clientCache: GraphClientCache;\n};\n\nexport type FetchGraphClientCompatibilityOptions = {\n operation?: {\n endpoint?: string;\n mountPath?: string;\n };\n graphRead?: {\n endpoint?: string;\n };\n graphCommand?: {\n endpoint?: string;\n };\n};\n\nexport type FetchGraphClientOptions<TOptions = undefined> = {\n compatibility?: FetchGraphClientCompatibilityOptions;\n graphRead?: false | FetchGraphReadExecutorOptions<TOptions>;\n operations?: false | FetchOperationBridgeOptions<TOptions>;\n runtimeTransport?: false | FetchRuntimeTransportOptions<TOptions>;\n reflectedEntityData?: false | FetchReflectedEntityDataReaderOptions;\n reflectedRelatedEntityData?: false | FetchReflectedRelatedEntityDataReaderOptions;\n};\n\nconst DEFAULT_LEGACY_OPERATION_ENDPOINT = '/operations';\nconst DEFAULT_LEGACY_GRAPH_READ_ENDPOINT = '/graph/reads';\nconst DEFAULT_LEGACY_GRAPH_COMMAND_ENDPOINT = '/graph/commands';\nconst DEFAULT_REFLECTED_ENTITY_DATA_ENDPOINT = '/explorer/entities';\nconst DEFAULT_REFLECTED_RELATED_ENTITY_DATA_ENDPOINT = '/explorer/related-entities';\n\nconst postReflectedEntityDataQuery = async (\n endpoint: string,\n query:\n | ReflectedRelatedEntityDataQuery\n | Parameters<ReflectedEntityDataReader['readEntityData']>[0],\n fetchRequest: typeof globalThis.fetch,\n) => {\n const response = await fetchRequest(endpoint, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n credentials: 'same-origin',\n body: JSON.stringify(query),\n });\n\n if (!response.ok) {\n throw new Error(`Reflected entity data request failed with status ${response.status}.`);\n }\n\n return response.json() as Promise<ReflectedEntityDataResult>;\n};\n\nexport const createFetchReflectedEntityDataReader = ({\n endpoint = DEFAULT_REFLECTED_ENTITY_DATA_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n}: FetchReflectedEntityDataReaderOptions = {}): ReflectedEntityDataReader => ({\n readEntityData: query => postReflectedEntityDataQuery(endpoint, query, fetchRequest),\n});\n\nexport const createFetchReflectedRelatedEntityDataReader = ({\n endpoint = DEFAULT_REFLECTED_RELATED_ENTITY_DATA_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n}: FetchReflectedRelatedEntityDataReaderOptions = {}): ReflectedRelatedEntityDataReader => ({\n readRelatedEntityData: query => postReflectedEntityDataQuery(endpoint, query, fetchRequest),\n});\n\nexport function createFetchGraphClient<TOptions = undefined>(): FetchGraphClient<TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>(\n options: FetchGraphClientOptions<TOptions> & { graphRead: false },\n): OntahiGraphClient<TOptions, TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>(\n options: FetchGraphClientOptions<TOptions> & {\n graphRead?: FetchGraphReadExecutorOptions<TOptions>;\n },\n): FetchGraphClient<TOptions>;\nexport function createFetchGraphClient<TOptions = undefined>({\n compatibility = {},\n graphRead = {},\n operations = {},\n runtimeTransport = {},\n reflectedEntityData = {},\n reflectedRelatedEntityData = {},\n}: FetchGraphClientOptions<TOptions> = {}): OntahiGraphClient<TOptions, TOptions> {\n const graphReadOptions =\n graphRead === false\n ? undefined\n : {\n ...graphRead,\n ...(compatibility.graphRead === undefined\n ? {}\n : {\n endpoint: compatibility.graphRead.endpoint ?? DEFAULT_LEGACY_GRAPH_READ_ENDPOINT,\n }),\n ...(compatibility.graphCommand === undefined\n ? {}\n : {\n commandEndpoint:\n compatibility.graphCommand.endpoint ?? DEFAULT_LEGACY_GRAPH_COMMAND_ENDPOINT,\n }),\n };\n const clientCache = graphReadOptions ? createGraphClientCache() : undefined;\n const operationOptions = (() => {\n if (operations === false) return undefined;\n if (compatibility.operation === undefined) return operations;\n const { endpoint: _endpoint, mountPath: _mountPath, ...sharedOptions } = operations;\n if (compatibility.operation.endpoint !== undefined) {\n return { ...sharedOptions, endpoint: compatibility.operation.endpoint };\n }\n if (compatibility.operation.mountPath !== undefined) {\n return { ...sharedOptions, mountPath: compatibility.operation.mountPath };\n }\n return { ...sharedOptions, endpoint: DEFAULT_LEGACY_OPERATION_ENDPOINT };\n })();\n const commonTransportRequired =\n (graphReadOptions !== undefined &&\n (graphReadOptions.endpoint === undefined ||\n graphReadOptions.commandEndpoint === undefined)) ||\n (operationOptions !== undefined &&\n operationOptions.endpoint === undefined &&\n operationOptions.mountPath === undefined);\n if (runtimeTransport === false && commonTransportRequired) {\n throw new TypeError(\n 'runtimeTransport cannot be disabled while a common Runtime Protocol family is enabled.',\n );\n }\n const requestId =\n runtimeTransport === false\n ? undefined\n : (runtimeTransport.requestId ?? graphReadOptions?.requestId ?? operationOptions?.requestId);\n const runtimeTransportOptions =\n runtimeTransport === false\n ? undefined\n : {\n ...(graphReadOptions?.fetch ? { fetch: graphReadOptions.fetch } : {}),\n ...(graphReadOptions?.requestInit ? { requestInit: graphReadOptions.requestInit } : {}),\n ...runtimeTransport,\n requestId,\n };\n const resolvedRuntimeTransport =\n runtimeTransportOptions === undefined\n ? undefined\n : createFetchRuntimeTransport<TOptions>(runtimeTransportOptions);\n const graphReadCapability =\n graphReadOptions === undefined\n ? undefined\n : createFetchGraphReadCapability({\n ...graphReadOptions,\n ...(runtimeTransportOptions?.fetch ? { fetch: runtimeTransportOptions.fetch } : {}),\n ...(runtimeTransportOptions?.requestInit\n ? { requestInit: runtimeTransportOptions.requestInit }\n : {}),\n ...(resolvedRuntimeTransport\n ? { runtimeTransport: resolvedRuntimeTransport, requestId }\n : {}),\n });\n const resolvedOperationOptions =\n operationOptions === undefined\n ? undefined\n : {\n ...operationOptions,\n ...(runtimeTransportOptions?.fetch ? { fetch: runtimeTransportOptions.fetch } : {}),\n ...(runtimeTransportOptions?.requestInit\n ? { requestInit: runtimeTransportOptions.requestInit }\n : {}),\n ...(resolvedRuntimeTransport\n ? { runtimeTransport: resolvedRuntimeTransport, requestId }\n : {}),\n };\n\n return {\n ...(graphReadCapability\n ? {\n graph: createRuntimeBoundDataGraphApi(() => graphReadCapability.runtime),\n graphExecutor: graphReadCapability.graphExecutor,\n clientCache: clientCache!,\n }\n : {}),\n ...(resolvedRuntimeTransport ? { runtimeTransport: resolvedRuntimeTransport } : {}),\n ...(resolvedOperationOptions\n ? {\n operationBridgeAdapters: [createFetchOperationBridgeAdapter(resolvedOperationOptions)],\n reflectedOperationInvoker: createFetchReflectedOperationInvoker(resolvedOperationOptions),\n }\n : {}),\n ...(reflectedEntityData === false\n ? {}\n : { reflectedEntityDataReader: createFetchReflectedEntityDataReader(reflectedEntityData) }),\n ...(reflectedRelatedEntityData === false\n ? {}\n : {\n reflectedRelatedEntityDataReader: createFetchReflectedRelatedEntityDataReader(\n reflectedRelatedEntityData,\n ),\n }),\n };\n}\n"]}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { type DataGraphExecutionRuntime, type EntityMutationCommandExecutionRuntime, type RemoteDataGraphError, type ManyToManyRelationshipCommandExecutionRuntime, type RelationshipCommandExecutionRuntime } from '@ontahi/core/data-graph';
|
|
1
|
+
import { type DataGraphExecutionRuntime, type DataGraphObservationRuntime, type EntityMutationCommandExecutionRuntime, type RemoteDataGraphError, type ManyToManyRelationshipCommandExecutionRuntime, type OrderedRelationshipCommandExecutionRuntime, type RelationshipCommandExecutionRuntime } from '@ontahi/core/data-graph';
|
|
2
|
+
import { type RuntimeTransport } from '@ontahi/core/runtime/protocol';
|
|
2
3
|
import type { ReactGraphExecutor } from './executor.js';
|
|
3
4
|
export type FetchGraphReadExecutorOptions<TOptions = undefined> = {
|
|
5
|
+
/** @deprecated Select the legacy Graph Read route through createFetchGraphClient compatibility. */
|
|
4
6
|
endpoint?: string;
|
|
7
|
+
/** @deprecated Select the legacy Graph Command route through createFetchGraphClient compatibility. */
|
|
5
8
|
commandEndpoint?: string;
|
|
6
9
|
fetch?: typeof globalThis.fetch;
|
|
10
|
+
requestId?: () => string;
|
|
7
11
|
requestInit?: (options?: TOptions) => Omit<RequestInit, 'body' | 'method'>;
|
|
12
|
+
runtimeTransport?: RuntimeTransport<TOptions>;
|
|
8
13
|
};
|
|
9
|
-
export type FetchGraphRuntime<TOptions = undefined> = DataGraphExecutionRuntime<RemoteDataGraphError, TOptions, TOptions, RemoteDataGraphError>;
|
|
10
|
-
export type FetchRelationshipRuntime<TOptions = undefined> = RelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions> & ManyToManyRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions>;
|
|
14
|
+
export type FetchGraphRuntime<TOptions = undefined> = DataGraphExecutionRuntime<RemoteDataGraphError, TOptions, TOptions, RemoteDataGraphError> & DataGraphObservationRuntime<RemoteDataGraphError, TOptions>;
|
|
15
|
+
export type FetchRelationshipRuntime<TOptions = undefined> = RelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions> & ManyToManyRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions> & OrderedRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions>;
|
|
11
16
|
export type FetchEntityMutationRuntime<TOptions = undefined> = EntityMutationCommandExecutionRuntime<RemoteDataGraphError, TOptions>;
|
|
12
17
|
export type FetchGraphReadCapability<TOptions = undefined> = {
|
|
13
18
|
runtime: FetchGraphRuntime<TOptions> & FetchRelationshipRuntime<TOptions> & FetchEntityMutationRuntime<TOptions>;
|
|
14
19
|
graphExecutor: ReactGraphExecutor<TOptions, TOptions>;
|
|
15
20
|
};
|
|
16
|
-
export declare const createFetchGraphReadCapability: <TOptions = undefined>({ endpoint, commandEndpoint, fetch: fetchRequest, requestInit, }?: FetchGraphReadExecutorOptions<TOptions>) => FetchGraphReadCapability<TOptions>;
|
|
21
|
+
export declare const createFetchGraphReadCapability: <TOptions = undefined>({ endpoint, commandEndpoint, fetch: fetchRequest, requestId, requestInit, runtimeTransport, }?: FetchGraphReadExecutorOptions<TOptions>) => FetchGraphReadCapability<TOptions>;
|
|
17
22
|
//# sourceMappingURL=fetch-graph-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-graph-runtime.d.ts","sourceRoot":"","sources":["../../src/graph/fetch-graph-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-graph-runtime.d.ts","sourceRoot":"","sources":["../../src/graph/fetch-graph-runtime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,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAExE,MAAM,MAAM,wBAAwB,CAAC,QAAQ,GAAG,SAAS,IAAI;IAC3D,OAAO,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAClC,wBAAwB,CAAC,QAAQ,CAAC,GAClC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IACvC,aAAa,EAAE,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,QAAQ,GAAG,SAAS,EAAE,gGAOlE,6BAA6B,CAAC,QAAQ,CAAM,KAAG,wBAAwB,CAAC,QAAQ,CAgLlF,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { Stream } from '@ontahi/core/computation/stream';
|
|
2
3
|
import { createRemoteDataGraphRuntime, isGraphCommandRejection, isGraphCommandProtocolError, isGraphReadProtocolError, } from '@ontahi/core/data-graph';
|
|
3
4
|
import { runBrowserEffect } from '@ontahi/core/runtime/browser';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const createFetchGraphReadCapability = ({ endpoint
|
|
7
|
-
const
|
|
5
|
+
import { createRuntimeProtocolExchange, createRuntimeProtocolExecutionExchange, } from '@ontahi/core/runtime/protocol';
|
|
6
|
+
import { createFetchRuntimeTransport } from './fetch-runtime-transport.js';
|
|
7
|
+
export const createFetchGraphReadCapability = ({ endpoint, commandEndpoint, fetch: fetchRequest = globalThis.fetch, requestId, requestInit, runtimeTransport, } = {}) => {
|
|
8
|
+
const legacyReadTransport = async (request, options) => {
|
|
8
9
|
const init = requestInit?.(options) ?? {};
|
|
9
10
|
const headers = new Headers(init.headers);
|
|
10
11
|
if (!headers.has('content-type'))
|
|
@@ -27,7 +28,7 @@ export const createFetchGraphReadCapability = ({ endpoint = DEFAULT_GRAPH_READ_E
|
|
|
27
28
|
throw new Error(`Graph read request failed with status ${response.status}.`);
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
|
-
const
|
|
31
|
+
const legacyCommandTransport = async (request, options) => {
|
|
31
32
|
const init = requestInit?.(options) ?? {};
|
|
32
33
|
const headers = new Headers(init.headers);
|
|
33
34
|
if (!headers.has('content-type'))
|
|
@@ -47,17 +48,93 @@ export const createFetchGraphReadCapability = ({ endpoint = DEFAULT_GRAPH_READ_E
|
|
|
47
48
|
}
|
|
48
49
|
return payload;
|
|
49
50
|
};
|
|
50
|
-
const
|
|
51
|
+
const exchange = endpoint && commandEndpoint
|
|
52
|
+
? undefined
|
|
53
|
+
: createRuntimeProtocolExchange({
|
|
54
|
+
transport: runtimeTransport ??
|
|
55
|
+
createFetchRuntimeTransport({ fetch: fetchRequest, requestInit }),
|
|
56
|
+
requestId,
|
|
57
|
+
});
|
|
58
|
+
const executionExchange = endpoint && commandEndpoint
|
|
59
|
+
? undefined
|
|
60
|
+
: createRuntimeProtocolExecutionExchange({
|
|
61
|
+
transport: runtimeTransport ??
|
|
62
|
+
createFetchRuntimeTransport({ fetch: fetchRequest, requestInit }),
|
|
63
|
+
requestId,
|
|
64
|
+
});
|
|
65
|
+
const exchangeOptions = (options) => options === undefined ? undefined : { transportOptions: options };
|
|
66
|
+
const transport = endpoint
|
|
67
|
+
? legacyReadTransport
|
|
68
|
+
: (request, options) => exchange({ family: 'graph.read', body: request }, exchangeOptions(options));
|
|
69
|
+
const commandTransport = commandEndpoint
|
|
70
|
+
? legacyCommandTransport
|
|
71
|
+
: (request, options) => exchange({ family: 'graph.command', body: request }, exchangeOptions(options));
|
|
72
|
+
const observeTransport = runtimeTransport?.graph
|
|
73
|
+
? (request, options, lifecycle) => runtimeTransport.graph.observe(request, {
|
|
74
|
+
...exchangeOptions(options),
|
|
75
|
+
signal: lifecycle?.signal,
|
|
76
|
+
})
|
|
77
|
+
: undefined;
|
|
78
|
+
const runtime = createRemoteDataGraphRuntime({
|
|
79
|
+
transport,
|
|
80
|
+
commandTransport,
|
|
81
|
+
...(observeTransport ? { observeTransport } : {}),
|
|
82
|
+
});
|
|
83
|
+
const runtimeCapturingMetadata = (capture) => createRemoteDataGraphRuntime({
|
|
84
|
+
transport,
|
|
85
|
+
commandTransport: commandEndpoint
|
|
86
|
+
? legacyCommandTransport
|
|
87
|
+
: async (request, options) => {
|
|
88
|
+
const execution = await executionExchange({ family: 'graph.command', body: request }, exchangeOptions(options));
|
|
89
|
+
capture(execution.metadata);
|
|
90
|
+
return execution.body;
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
const executeRelationshipWithMetadata = async (command, options) => {
|
|
94
|
+
let metadata;
|
|
95
|
+
const executionRuntime = runtimeCapturingMetadata(value => {
|
|
96
|
+
metadata = value;
|
|
97
|
+
});
|
|
98
|
+
const value = await runBrowserEffect(command.kind === 'many-to-many-relationship-command'
|
|
99
|
+
? executionRuntime.runManyToManyRelationshipCommand(command, options)
|
|
100
|
+
: command.kind === 'ordered-relationship-command'
|
|
101
|
+
? executionRuntime.runOrderedRelationshipCommand(command, options)
|
|
102
|
+
: executionRuntime.runRelationshipCommand(command, options));
|
|
103
|
+
return { value, ...(metadata ? { metadata } : {}) };
|
|
104
|
+
};
|
|
105
|
+
const executeEntityMutationWithMetadata = async (command, options) => {
|
|
106
|
+
let metadata;
|
|
107
|
+
const executionRuntime = runtimeCapturingMetadata(value => {
|
|
108
|
+
metadata = value;
|
|
109
|
+
});
|
|
110
|
+
const value = await runBrowserEffect(executionRuntime.runEntityMutationCommand(command, options));
|
|
111
|
+
return { value, ...(metadata ? { metadata } : {}) };
|
|
112
|
+
};
|
|
51
113
|
return {
|
|
52
114
|
runtime,
|
|
53
115
|
graphExecutor: {
|
|
116
|
+
...(runtimeTransport?.causality
|
|
117
|
+
? {
|
|
118
|
+
associateGraphReadRefreshes: runtimeTransport.causality.associateGraphReadRefreshes,
|
|
119
|
+
}
|
|
120
|
+
: {}),
|
|
54
121
|
get: (read, params, options) => runBrowserEffect(runtime.get(read, params, options)),
|
|
55
122
|
run: (read, params, options) => runBrowserEffect(runtime.run(read, params, options)),
|
|
123
|
+
observe: (read, params, options, lifecycle) => Stream.toAsyncIterable(lifecycle?.signal
|
|
124
|
+
? runtime
|
|
125
|
+
.observe(read, params, options)
|
|
126
|
+
.pipe(Stream.interruptWhen(Stream.runHead(Stream.fromEventListener(lifecycle.signal, 'abort'))))
|
|
127
|
+
: runtime.observe(read, params, options)),
|
|
56
128
|
count: (read, params, options) => runBrowserEffect(runtime.count(read, params, options)),
|
|
57
129
|
runCommand: (command, options) => runBrowserEffect(runtime.runCommand(command, options)),
|
|
58
130
|
runRelationshipCommand: (command, options) => runBrowserEffect(runtime.runRelationshipCommand(command, options)),
|
|
131
|
+
runRelationshipCommandExecution: executeRelationshipWithMetadata,
|
|
59
132
|
runManyToManyRelationshipCommand: (command, options) => runBrowserEffect(runtime.runManyToManyRelationshipCommand(command, options)),
|
|
133
|
+
runManyToManyRelationshipCommandExecution: executeRelationshipWithMetadata,
|
|
134
|
+
runOrderedRelationshipCommand: (command, options) => runBrowserEffect(runtime.runOrderedRelationshipCommand(command, options)),
|
|
135
|
+
runOrderedRelationshipCommandExecution: executeRelationshipWithMetadata,
|
|
60
136
|
runEntityMutationCommand: (command, options) => runBrowserEffect(runtime.runEntityMutationCommand(command, options)),
|
|
137
|
+
runEntityMutationCommandExecution: executeEntityMutationWithMetadata,
|
|
61
138
|
},
|
|
62
139
|
};
|
|
63
140
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-graph-runtime.js","sourceRoot":"","sources":["../../src/graph/fetch-graph-runtime.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,GAQzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAgChE,MAAM,2BAA2B,GAAG,cAAc,CAAC;AACnD,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;AAEz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pF,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACxF,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxF,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC3C,gBAAgB,CAAC,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpE,gCAAgC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CACrD,gBAAgB,CAAC,OAAO,CAAC,gCAAgC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9E,wBAAwB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC7C,gBAAgB,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;SACvE;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {\n createRemoteDataGraphRuntime,\n isGraphCommandRejection,\n isGraphCommandProtocolError,\n isGraphReadProtocolError,\n type DataGraphExecutionRuntime,\n type EntityMutationCommandExecutionRuntime,\n type RemoteDataGraphError,\n type RemoteGraphCommandTransport,\n type RemoteGraphReadTransport,\n type ManyToManyRelationshipCommandExecutionRuntime,\n type RelationshipCommandExecutionRuntime,\n} from '@ontahi/core/data-graph';\nimport { runBrowserEffect } from '@ontahi/core/runtime/browser';\n\nimport type { ReactGraphExecutor } from './executor.js';\n\nexport type FetchGraphReadExecutorOptions<TOptions = undefined> = {\n endpoint?: string;\n commandEndpoint?: string;\n fetch?: typeof globalThis.fetch;\n requestInit?: (options?: TOptions) => Omit<RequestInit, 'body' | 'method'>;\n};\n\nexport type FetchGraphRuntime<TOptions = undefined> = DataGraphExecutionRuntime<\n RemoteDataGraphError,\n TOptions,\n TOptions,\n RemoteDataGraphError\n>;\nexport type FetchRelationshipRuntime<TOptions = undefined> = RelationshipCommandExecutionRuntime<\n RemoteDataGraphError,\n TOptions\n> &\n ManyToManyRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions>;\nexport type FetchEntityMutationRuntime<TOptions = undefined> =\n EntityMutationCommandExecutionRuntime<RemoteDataGraphError, TOptions>;\n\nexport type FetchGraphReadCapability<TOptions = undefined> = {\n runtime: FetchGraphRuntime<TOptions> &\n FetchRelationshipRuntime<TOptions> &\n FetchEntityMutationRuntime<TOptions>;\n graphExecutor: ReactGraphExecutor<TOptions, TOptions>;\n};\n\nconst DEFAULT_GRAPH_READ_ENDPOINT = '/graph/reads';\nconst DEFAULT_GRAPH_COMMAND_ENDPOINT = '/graph/commands';\n\nexport const createFetchGraphReadCapability = <TOptions = undefined>({\n endpoint = DEFAULT_GRAPH_READ_ENDPOINT,\n commandEndpoint = DEFAULT_GRAPH_COMMAND_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n requestInit,\n}: FetchGraphReadExecutorOptions<TOptions> = {}): FetchGraphReadCapability<TOptions> => {\n const transport: RemoteGraphReadTransport<TOptions> = async (request, options) => {\n const init = requestInit?.(options) ?? {};\n const headers = new Headers(init.headers);\n if (!headers.has('content-type')) headers.set('content-type', 'application/json');\n\n const response = await fetchRequest(endpoint, {\n ...init,\n method: 'POST',\n headers,\n credentials: init.credentials ?? 'same-origin',\n body: JSON.stringify(request),\n });\n\n try {\n const payload: unknown = await response.json();\n if (!response.ok && !isGraphReadProtocolError(payload)) {\n throw new Error(`Graph read request failed with status ${response.status}.`);\n }\n return payload;\n } catch {\n throw new Error(`Graph read request failed with status ${response.status}.`);\n }\n };\n const commandTransport: RemoteGraphCommandTransport<TOptions> = async (request, options) => {\n const init = requestInit?.(options) ?? {};\n const headers = new Headers(init.headers);\n if (!headers.has('content-type')) headers.set('content-type', 'application/json');\n const response = await fetchRequest(commandEndpoint, {\n ...init,\n method: 'POST',\n headers,\n credentials: init.credentials ?? 'same-origin',\n body: JSON.stringify(request),\n });\n const payload: unknown = await response.json();\n if (\n !response.ok &&\n !isGraphCommandProtocolError(payload) &&\n !isGraphCommandRejection(payload)\n ) {\n throw new Error(`Graph Command request failed with status ${response.status}.`);\n }\n return payload;\n };\n const runtime = createRemoteDataGraphRuntime({ transport, commandTransport });\n\n return {\n runtime,\n graphExecutor: {\n get: (read, params, options) => runBrowserEffect(runtime.get(read, params, options)),\n run: (read, params, options) => runBrowserEffect(runtime.run(read, params, options)),\n count: (read, params, options) => runBrowserEffect(runtime.count(read, params, options)),\n runCommand: (command, options) => runBrowserEffect(runtime.runCommand(command, options)),\n runRelationshipCommand: (command, options) =>\n runBrowserEffect(runtime.runRelationshipCommand(command, options)),\n runManyToManyRelationshipCommand: (command, options) =>\n runBrowserEffect(runtime.runManyToManyRelationshipCommand(command, options)),\n runEntityMutationCommand: (command, options) =>\n runBrowserEffect(runtime.runEntityMutationCommand(command, options)),\n },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"fetch-graph-runtime.js","sourceRoot":"","sources":["../../src/graph/fetch-graph-runtime.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,GAezB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,6BAA6B,EAC7B,sCAAsC,GAIvC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAoC3E,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAuB,EACnE,QAAQ,EACR,eAAe,EACf,KAAK,EAAE,YAAY,GAAG,UAAU,CAAC,KAAK,EACtC,SA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U,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxF,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC3C,gBAAgB,CAAC,OAAO,CAAC,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpE,+BAA+B,EAAE,+BAA+B;YAChE,gCAAgC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CACrD,gBAAgB,CAAC,OAAO,CAAC,gCAAgC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9E,yCAAyC,EAAE,+BAA+B;YAC1E,6BAA6B,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAClD,gBAAgB,CAAC,OAAO,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC3E,sCAAsC,EAAE,+BAA+B;YACvE,wBAAwB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC7C,gBAAgB,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACtE,iCAAiC,EAAE,iCAAiC;SACrE;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { Stream } from '@ontahi/core/computation/stream';\nimport {\n createRemoteDataGraphRuntime,\n isGraphCommandRejection,\n isGraphCommandProtocolError,\n isGraphReadProtocolError,\n type DataGraphExecutionRuntime,\n type DataGraphObservationRuntime,\n type EntityMutationCommand,\n type EntityMutationCommandExecutionRuntime,\n type RemoteDataGraphError,\n type RemoteGraphCommandTransport,\n type RemoteGraphObservationTransport,\n type RemoteGraphReadTransport,\n type ManyToManyRelationshipCommandExecutionRuntime,\n type ManyToManyRelationshipCommand,\n type OrderedRelationshipCommand,\n type OrderedRelationshipCommandExecutionRuntime,\n type RelationshipCommandExecutionRuntime,\n type RelationshipCommand,\n} from '@ontahi/core/data-graph';\nimport { runBrowserEffect } from '@ontahi/core/runtime/browser';\nimport {\n createRuntimeProtocolExchange,\n createRuntimeProtocolExecutionExchange,\n type RuntimeProtocolExecutionMetadata,\n type RuntimeTransport,\n type RuntimeTransportRequestOptions,\n} from '@ontahi/core/runtime/protocol';\n\nimport type { ReactGraphExecutor } from './executor.js';\nimport { createFetchRuntimeTransport } from './fetch-runtime-transport.js';\n\nexport type FetchGraphReadExecutorOptions<TOptions = undefined> = {\n /** @deprecated Select the legacy Graph Read route through createFetchGraphClient compatibility. */\n endpoint?: string;\n /** @deprecated Select the legacy Graph Command route through createFetchGraphClient compatibility. */\n commandEndpoint?: string;\n fetch?: typeof globalThis.fetch;\n requestId?: () => string;\n requestInit?: (options?: TOptions) => Omit<RequestInit, 'body' | 'method'>;\n runtimeTransport?: RuntimeTransport<TOptions>;\n};\n\nexport type FetchGraphRuntime<TOptions = undefined> = DataGraphExecutionRuntime<\n RemoteDataGraphError,\n TOptions,\n TOptions,\n RemoteDataGraphError\n> &\n DataGraphObservationRuntime<RemoteDataGraphError, TOptions>;\nexport type FetchRelationshipRuntime<TOptions = undefined> = RelationshipCommandExecutionRuntime<\n RemoteDataGraphError,\n TOptions\n> &\n ManyToManyRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions> &\n OrderedRelationshipCommandExecutionRuntime<RemoteDataGraphError, TOptions>;\nexport type FetchEntityMutationRuntime<TOptions = undefined> =\n EntityMutationCommandExecutionRuntime<RemoteDataGraphError, TOptions>;\n\nexport type FetchGraphReadCapability<TOptions = undefined> = {\n runtime: FetchGraphRuntime<TOptions> &\n FetchRelationshipRuntime<TOptions> &\n FetchEntityMutationRuntime<TOptions>;\n graphExecutor: ReactGraphExecutor<TOptions, TOptions>;\n};\n\nexport const createFetchGraphReadCapability = <TOptions = undefined>({\n endpoint,\n commandEndpoint,\n fetch: fetchRequest = globalThis.fetch,\n requestId,\n requestInit,\n runtimeTransport,\n}: FetchGraphReadExecutorOptions<TOptions> = {}): FetchGraphReadCapability<TOptions> => {\n const legacyReadTransport: RemoteGraphReadTransport<TOptions> = async (request, options) => {\n const init = requestInit?.(options) ?? {};\n const headers = new Headers(init.headers);\n if (!headers.has('content-type')) headers.set('content-type', 'application/json');\n\n const response = await fetchRequest(endpoint!, {\n ...init,\n method: 'POST',\n headers,\n credentials: init.credentials ?? 'same-origin',\n body: JSON.stringify(request),\n });\n\n try {\n const payload: unknown = await response.json();\n if (!response.ok && !isGraphReadProtocolError(payload)) {\n throw new Error(`Graph read request failed with status ${response.status}.`);\n }\n return payload;\n } catch {\n throw new Error(`Graph read request failed with status ${response.status}.`);\n }\n };\n const legacyCommandTransport: RemoteGraphCommandTransport<TOptions> = async (\n request,\n options,\n ) => {\n const init = requestInit?.(options) ?? {};\n const headers = new Headers(init.headers);\n if (!headers.has('content-type')) headers.set('content-type', 'application/json');\n const response = await fetchRequest(commandEndpoint!, {\n ...init,\n method: 'POST',\n headers,\n credentials: init.credentials ?? 'same-origin',\n body: JSON.stringify(request),\n });\n const payload: unknown = await response.json();\n if (\n !response.ok &&\n !isGraphCommandProtocolError(payload) &&\n !isGraphCommandRejection(payload)\n ) {\n throw new Error(`Graph Command request failed with status ${response.status}.`);\n }\n return payload;\n };\n const exchange =\n endpoint && commandEndpoint\n ? undefined\n : createRuntimeProtocolExchange({\n transport:\n runtimeTransport ??\n createFetchRuntimeTransport<TOptions>({ fetch: fetchRequest, requestInit }),\n requestId,\n });\n const executionExchange =\n endpoint && commandEndpoint\n ? undefined\n : createRuntimeProtocolExecutionExchange({\n transport:\n runtimeTransport ??\n createFetchRuntimeTransport<TOptions>({ fetch: fetchRequest, requestInit }),\n requestId,\n });\n const exchangeOptions = (\n options: TOptions | undefined,\n ): RuntimeTransportRequestOptions<TOptions> | undefined =>\n options === undefined ? undefined : { transportOptions: options };\n const transport: RemoteGraphReadTransport<TOptions> = endpoint\n ? legacyReadTransport\n : (request, options) =>\n exchange!({ family: 'graph.read', body: request }, exchangeOptions(options));\n const commandTransport: RemoteGraphCommandTransport<TOptions> = commandEndpoint\n ? legacyCommandTransport\n : (request, options) =>\n exchange!({ family: 'graph.command', body: request }, exchangeOptions(options));\n const observeTransport: RemoteGraphObservationTransport<TOptions> | undefined =\n runtimeTransport?.graph\n ? (request, options, lifecycle) =>\n runtimeTransport.graph!.observe(request, {\n ...exchangeOptions(options),\n signal: lifecycle?.signal,\n })\n : undefined;\n const runtime = createRemoteDataGraphRuntime({\n transport,\n commandTransport,\n ...(observeTransport ? { observeTransport } : {}),\n });\n const runtimeCapturingMetadata = (\n capture: (metadata: RuntimeProtocolExecutionMetadata | undefined) => void,\n ) =>\n createRemoteDataGraphRuntime({\n transport,\n commandTransport: commandEndpoint\n ? legacyCommandTransport\n : async (request, options) => {\n const execution = await executionExchange!(\n { family: 'graph.command', body: request },\n exchangeOptions(options),\n );\n capture(execution.metadata);\n return execution.body;\n },\n });\n const executeRelationshipWithMetadata = async (\n command: RelationshipCommand | ManyToManyRelationshipCommand | OrderedRelationshipCommand,\n options?: TOptions,\n ) => {\n let metadata: RuntimeProtocolExecutionMetadata | undefined;\n const executionRuntime = runtimeCapturingMetadata(value => {\n metadata = value;\n });\n const value = await runBrowserEffect(\n command.kind === 'many-to-many-relationship-command'\n ? executionRuntime.runManyToManyRelationshipCommand(command, options)\n : command.kind === 'ordered-relationship-command'\n ? executionRuntime.runOrderedRelationshipCommand(command, options)\n : executionRuntime.runRelationshipCommand(command, options),\n );\n return { value, ...(metadata ? { metadata } : {}) };\n };\n const executeEntityMutationWithMetadata = async (\n command: EntityMutationCommand,\n options?: TOptions,\n ) => {\n let metadata: RuntimeProtocolExecutionMetadata | undefined;\n const executionRuntime = runtimeCapturingMetadata(value => {\n metadata = value;\n });\n const value = await runBrowserEffect(\n executionRuntime.runEntityMutationCommand(command, options),\n );\n return { value, ...(metadata ? { metadata } : {}) };\n };\n\n return {\n runtime,\n graphExecutor: {\n ...(runtimeTransport?.causality\n ? {\n associateGraphReadRefreshes: runtimeTransport.causality.associateGraphReadRefreshes,\n }\n : {}),\n get: (read, params, options) => runBrowserEffect(runtime.get(read, params, options)),\n run: (read, params, options) => runBrowserEffect(runtime.run(read, params, options)),\n observe: (read, params, options, lifecycle) =>\n Stream.toAsyncIterable(\n lifecycle?.signal\n ? runtime\n .observe(read, params, options)\n .pipe(\n Stream.interruptWhen(\n Stream.runHead(Stream.fromEventListener(lifecycle.signal, 'abort')),\n ),\n )\n : runtime.observe(read, params, options),\n ),\n count: (read, params, options) => runBrowserEffect(runtime.count(read, params, options)),\n runCommand: (command, options) => runBrowserEffect(runtime.runCommand(command, options)),\n runRelationshipCommand: (command, options) =>\n runBrowserEffect(runtime.runRelationshipCommand(command, options)),\n runRelationshipCommandExecution: executeRelationshipWithMetadata,\n runManyToManyRelationshipCommand: (command, options) =>\n runBrowserEffect(runtime.runManyToManyRelationshipCommand(command, options)),\n runManyToManyRelationshipCommandExecution: executeRelationshipWithMetadata,\n runOrderedRelationshipCommand: (command, options) =>\n runBrowserEffect(runtime.runOrderedRelationshipCommand(command, options)),\n runOrderedRelationshipCommandExecution: executeRelationshipWithMetadata,\n runEntityMutationCommand: (command, options) =>\n runBrowserEffect(runtime.runEntityMutationCommand(command, options)),\n runEntityMutationCommandExecution: executeEntityMutationWithMetadata,\n },\n };\n};\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type DurableOperationObservationCapability, type RuntimeTransport } from '@ontahi/core/runtime/protocol';
|
|
2
|
-
export type FetchRuntimeTransportOptions = {
|
|
2
|
+
export type FetchRuntimeTransportOptions<TTransportOptions = undefined> = {
|
|
3
3
|
endpoint?: string;
|
|
4
4
|
fetch?: typeof globalThis.fetch;
|
|
5
5
|
requestId?: () => string;
|
|
6
|
-
requestInit?: () => Omit<RequestInit, 'body' | 'method'
|
|
6
|
+
requestInit?: (options?: TTransportOptions) => Omit<RequestInit, 'body' | 'method'>;
|
|
7
7
|
durableOperation?: {
|
|
8
8
|
pollIntervalMs?: number;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export type FetchRuntimeTransport = RuntimeTransport & {
|
|
11
|
+
export type FetchRuntimeTransport<TTransportOptions = undefined> = RuntimeTransport<TTransportOptions> & {
|
|
12
12
|
readonly durableOperation: DurableOperationObservationCapability;
|
|
13
13
|
};
|
|
14
|
-
export declare const createFetchRuntimeTransport: ({ endpoint, fetch: fetchRequest, requestId, requestInit, durableOperation, }?: FetchRuntimeTransportOptions) => FetchRuntimeTransport
|
|
14
|
+
export declare const createFetchRuntimeTransport: <TTransportOptions = undefined>({ endpoint, fetch: fetchRequest, requestId, requestInit, durableOperation, }?: FetchRuntimeTransportOptions<TTransportOptions>) => FetchRuntimeTransport<TTransportOptions>;
|
|
15
15
|
//# sourceMappingURL=fetch-runtime-transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-runtime-transport.d.ts","sourceRoot":"","sources":["../../src/graph/fetch-runtime-transport.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,qCAAqC,EAE1C,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,4BAA4B,GAAG;
|
|
1
|
+
{"version":3,"file":"fetch-runtime-transport.d.ts","sourceRoot":"","sources":["../../src/graph/fetch-runtime-transport.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,qCAAqC,EAE1C,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,4BAA4B,CAAC,iBAAiB,GAAG,SAAS,IAAI;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IACpF,gBAAgB,CAAC,EAAE;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,iBAAiB,GAAG,SAAS,IAC7D,gBAAgB,CAAC,iBAAiB,CAAC,GAAG;IACpC,QAAQ,CAAC,gBAAgB,EAAE,qCAAqC,CAAC;CAClE,CAAC;AA4BJ,eAAO,MAAM,2BAA2B,GAAI,iBAAiB,GAAG,SAAS,EAAE,+EAMxE,4BAA4B,CAAC,iBAAiB,CAAM,KAAG,qBAAqB,CAAC,iBAAiB,CAoEhG,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { createRuntimeProtocolExchange, isRuntimeProtocolError, parseDurableOperationProtocolResponse, parseRuntimeProtocolResponse, toDurableOperationProtocolRequest, } from '@ontahi/core/runtime/protocol';
|
|
3
3
|
const DEFAULT_RUNTIME_ENDPOINT = '/runtime';
|
|
4
4
|
const DEFAULT_POLL_INTERVAL_MS = 500;
|
|
5
5
|
const terminalTaskStatuses = new Set(['completed', 'failed', 'cancelled']);
|
|
6
|
-
let fallbackRequestSequence = 0;
|
|
7
|
-
const defaultRequestId = () => globalThis.crypto?.randomUUID?.() ??
|
|
8
|
-
`ontahi-runtime-${Date.now()}-${(fallbackRequestSequence += 1)}`;
|
|
9
6
|
const waitForNextInspection = (intervalMs, signal) => {
|
|
10
7
|
if (signal?.aborted)
|
|
11
8
|
return Promise.resolve(false);
|
|
@@ -26,13 +23,13 @@ const waitForNextInspection = (intervalMs, signal) => {
|
|
|
26
23
|
signal?.addEventListener('abort', abort, { once: true });
|
|
27
24
|
});
|
|
28
25
|
};
|
|
29
|
-
export const createFetchRuntimeTransport = ({ endpoint = DEFAULT_RUNTIME_ENDPOINT, fetch: fetchRequest = globalThis.fetch, requestId
|
|
26
|
+
export const createFetchRuntimeTransport = ({ endpoint = DEFAULT_RUNTIME_ENDPOINT, fetch: fetchRequest = globalThis.fetch, requestId, requestInit, durableOperation = {}, } = {}) => {
|
|
30
27
|
const pollIntervalMs = durableOperation.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
31
28
|
if (!Number.isFinite(pollIntervalMs) || pollIntervalMs < 0) {
|
|
32
29
|
throw new TypeError('Durable Operation poll interval must be a non-negative finite number.');
|
|
33
30
|
}
|
|
34
31
|
const request = async (runtimeRequest, options) => {
|
|
35
|
-
const init = requestInit?.() ?? {};
|
|
32
|
+
const init = requestInit?.(options?.transportOptions) ?? {};
|
|
36
33
|
const headers = new Headers(init.headers);
|
|
37
34
|
if (!headers.has('content-type'))
|
|
38
35
|
headers.set('content-type', 'application/json');
|
|
@@ -53,18 +50,17 @@ export const createFetchRuntimeTransport = ({ endpoint = DEFAULT_RUNTIME_ENDPOIN
|
|
|
53
50
|
}
|
|
54
51
|
return parsed.response;
|
|
55
52
|
};
|
|
53
|
+
const exchange = createRuntimeProtocolExchange({
|
|
54
|
+
transport: { request },
|
|
55
|
+
requestId,
|
|
56
|
+
});
|
|
56
57
|
const observe = async function* (run, options) {
|
|
57
58
|
while (!options?.signal?.aborted) {
|
|
58
|
-
const
|
|
59
|
-
id: requestId(),
|
|
59
|
+
const responseBody = await exchange({
|
|
60
60
|
family: 'durable.operation',
|
|
61
61
|
body: toDurableOperationProtocolRequest(run),
|
|
62
|
-
});
|
|
63
|
-
const
|
|
64
|
-
if (isRuntimeProtocolError(runtimeResponse)) {
|
|
65
|
-
throw new Error(runtimeResponse.error.message);
|
|
66
|
-
}
|
|
67
|
-
const parsed = parseDurableOperationProtocolResponse(runtimeResponse.body);
|
|
62
|
+
}, options?.signal ? { signal: options.signal } : undefined);
|
|
63
|
+
const parsed = parseDurableOperationProtocolResponse(responseBody);
|
|
68
64
|
if (!parsed.success)
|
|
69
65
|
throw new Error(parsed.error.error.message);
|
|
70
66
|
if (parsed.response.kind === 'protocol-error') {
|
|
@@ -82,6 +78,7 @@ export const createFetchRuntimeTransport = ({ endpoint = DEFAULT_RUNTIME_ENDPOIN
|
|
|
82
78
|
}
|
|
83
79
|
};
|
|
84
80
|
return {
|
|
81
|
+
descriptor: { kind: 'fetch' },
|
|
85
82
|
request,
|
|
86
83
|
durableOperation: { observe },
|
|
87
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-runtime-transport.js","sourceRoot":"","sources":["../../src/graph/fetch-runtime-transport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"fetch-runtime-transport.js","sourceRoot":"","sources":["../../src/graph/fetch-runtime-transport.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,qCAAqC,EACrC,4BAA4B,EAC5B,iCAAiC,GAKlC,MAAM,+BAA+B,CAAC;AAiBvC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAC5C,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAE3E,MAAM,qBAAqB,GAAG,CAC5B,UAAkB,EAClB,MAA+B,EACb,EAAE;IACpB,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,cAAuB,EAAE,EAAE;YACzC,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE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,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CACzD,CAAC;YAEF,MAAM,MAAM,GAAG,qCAAqC,CAAC,YAAY,CAAC,CAAC;YACnE,IAAI,CAAC,MAAM,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAiC,CAAC;YACnE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC;gBACnE,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;YAC1F,CAAC;YACD,MAAM,QAAQ,CAAC;YACf,IAAI,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,OAAO;YACtD,IAAI,CAAC,CAAC,MAAM,qBAAqB,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;gBAAE,OAAO;QAC9E,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC7B,OAAO;QACP,gBAAgB,EAAE,EAAE,OAAO,EAAE;KAC9B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport type { TaskRunIdentity, TaskSnapshot } from '@ontahi/core/runtime/contracts';\nimport {\n createRuntimeProtocolExchange,\n isRuntimeProtocolError,\n parseDurableOperationProtocolResponse,\n parseRuntimeProtocolResponse,\n toDurableOperationProtocolRequest,\n type DurableOperationObservationCapability,\n type RuntimeProtocolRequestEnvelope,\n type RuntimeTransport,\n type RuntimeTransportRequestOptions,\n} from '@ontahi/core/runtime/protocol';\n\nexport type FetchRuntimeTransportOptions<TTransportOptions = undefined> = {\n endpoint?: string;\n fetch?: typeof globalThis.fetch;\n requestId?: () => string;\n requestInit?: (options?: TTransportOptions) => Omit<RequestInit, 'body' | 'method'>;\n durableOperation?: {\n pollIntervalMs?: number;\n };\n};\n\nexport type FetchRuntimeTransport<TTransportOptions = undefined> =\n RuntimeTransport<TTransportOptions> & {\n readonly durableOperation: DurableOperationObservationCapability;\n };\n\nconst DEFAULT_RUNTIME_ENDPOINT = '/runtime';\nconst DEFAULT_POLL_INTERVAL_MS = 500;\nconst terminalTaskStatuses = new Set(['completed', 'failed', 'cancelled']);\n\nconst waitForNextInspection = (\n intervalMs: number,\n signal: AbortSignal | undefined,\n): Promise<boolean> => {\n if (signal?.aborted) return Promise.resolve(false);\n if (intervalMs === 0) return Promise.resolve(true);\n\n return new Promise(resolve => {\n let settled = false;\n const finish = (shouldContinue: boolean) => {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n signal?.removeEventListener('abort', abort);\n resolve(shouldContinue);\n };\n const abort = () => finish(false);\n const timeout = setTimeout(() => finish(true), intervalMs);\n signal?.addEventListener('abort', abort, { once: true });\n });\n};\n\nexport const createFetchRuntimeTransport = <TTransportOptions = undefined>({\n endpoint = DEFAULT_RUNTIME_ENDPOINT,\n fetch: fetchRequest = globalThis.fetch,\n requestId,\n requestInit,\n durableOperation = {},\n}: FetchRuntimeTransportOptions<TTransportOptions> = {}): FetchRuntimeTransport<TTransportOptions> => {\n const pollIntervalMs = durableOperation.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n if (!Number.isFinite(pollIntervalMs) || pollIntervalMs < 0) {\n throw new TypeError('Durable Operation poll interval must be a non-negative finite number.');\n }\n\n const request = async (\n runtimeRequest: RuntimeProtocolRequestEnvelope,\n options?: RuntimeTransportRequestOptions<TTransportOptions>,\n ) => {\n const init = requestInit?.(options?.transportOptions) ?? {};\n const headers = new Headers(init.headers);\n if (!headers.has('content-type')) headers.set('content-type', 'application/json');\n const response = await fetchRequest(endpoint, {\n ...init,\n method: 'POST',\n headers,\n credentials: init.credentials ?? 'same-origin',\n body: JSON.stringify(runtimeRequest),\n ...(options?.signal ? { signal: options.signal } : {}),\n });\n const payload: unknown = await response.json().catch(() => null);\n const parsed = parseRuntimeProtocolResponse(payload, runtimeRequest);\n if (!parsed.success) throw new Error(parsed.error.error.message);\n if (!response.ok && !isRuntimeProtocolError(parsed.response)) {\n throw new Error(`Runtime Protocol request failed with status ${response.status}.`);\n }\n return parsed.response;\n };\n const exchange = createRuntimeProtocolExchange({\n transport: { request },\n requestId,\n });\n\n const observe: DurableOperationObservationCapability['observe'] = async function* <TResult>(\n run: TaskRunIdentity,\n options?: RuntimeTransportRequestOptions,\n ): AsyncIterable<TaskSnapshot<TResult>> {\n while (!options?.signal?.aborted) {\n const responseBody = await exchange(\n {\n family: 'durable.operation',\n body: toDurableOperationProtocolRequest(run),\n },\n options?.signal ? { signal: options.signal } : undefined,\n );\n\n const parsed = parseDurableOperationProtocolResponse(responseBody);\n if (!parsed.success) throw new Error(parsed.error.error.message);\n if (parsed.response.kind === 'protocol-error') {\n throw new Error(parsed.response.error.message);\n }\n\n const snapshot = parsed.response.snapshot as TaskSnapshot<TResult>;\n if (snapshot.taskId !== run.taskId || snapshot.runId !== run.runId) {\n throw new Error('Durable Operation snapshot identity does not match the observed run.');\n }\n yield snapshot;\n if (terminalTaskStatuses.has(snapshot.status)) return;\n if (!(await waitForNextInspection(pollIntervalMs, options?.signal))) return;\n }\n };\n\n return {\n descriptor: { kind: 'fetch' },\n request,\n durableOperation: { observe },\n };\n};\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type ManyToManyRelationshipCommand, type RelationshipCommandResult } from '@ontahi/core/data-graph';
|
|
1
|
+
import { type EntityMutationCommand, type EntityMutationDelta, type ManyToManyRelationshipCommand, type OrderedRelationshipCommand, type RelationshipCommandResult } from '@ontahi/core/data-graph';
|
|
2
2
|
import { type UseMutationResult, type UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import type { GraphCommandBuilder, GraphCommandHookOptions, GraphOperationLike, GraphOperationClientInput, GraphOperationResult, GraphQueryData, GraphQueryMode, GraphQueryOptions, GraphReadSource } from './executor.js';
|
|
4
4
|
export declare function useGraphQuery<TRead extends GraphReadSource<any>, TMode extends GraphQueryMode = 'run', TReadOptions = unknown, TCommandOptions = TReadOptions>(read: TRead, options?: GraphQueryOptions<TRead, TMode, TReadOptions>): UseQueryResult<GraphQueryData<TRead, TMode>, Error>;
|
|
5
5
|
export declare function useGraphCommand<TVariables, TResult = void, TContext = unknown, TReadOptions = unknown, TCommandOptions = TReadOptions>(buildCommand: GraphCommandBuilder<TVariables, TResult>, options?: GraphCommandHookOptions<TResult, TVariables, TContext, TCommandOptions>): UseMutationResult<TResult, Error, TVariables, TContext>;
|
|
6
|
+
export declare function useEntityMutationCommand<TVariables, TContext = unknown, TReadOptions = unknown, TCommandOptions = TReadOptions>(buildCommand: (variables: TVariables) => EntityMutationCommand, options?: GraphCommandHookOptions<EntityMutationDelta, TVariables, TContext, TCommandOptions>): UseMutationResult<EntityMutationDelta, Error, TVariables, TContext>;
|
|
6
7
|
export declare function useManyToManyRelationshipCommand<TVariables, TContext = unknown, TReadOptions = unknown, TCommandOptions = TReadOptions>(buildCommand: (variables: TVariables) => ManyToManyRelationshipCommand, options?: GraphCommandHookOptions<RelationshipCommandResult, TVariables, TContext, TCommandOptions>): UseMutationResult<RelationshipCommandResult, Error, TVariables, TContext>;
|
|
8
|
+
export declare function useOrderedRelationshipCommand<TVariables, TContext = unknown, TReadOptions = unknown, TCommandOptions = TReadOptions>(buildCommand: (variables: TVariables) => OrderedRelationshipCommand, options?: GraphCommandHookOptions<RelationshipCommandResult, TVariables, TContext, TCommandOptions>): UseMutationResult<RelationshipCommandResult, Error, TVariables, TContext>;
|
|
7
9
|
export declare function useGraphOperation<TOperation extends GraphOperationLike<any, any>, TContext = unknown, TReadOptions = unknown, TCommandOptions = TReadOptions>(operation: TOperation, options?: GraphCommandHookOptions<GraphOperationResult<TOperation>, GraphOperationClientInput<TOperation>, TContext, TCommandOptions>): UseMutationResult<GraphOperationResult<TOperation>, Error, GraphOperationClientInput<TOperation>, TContext>;
|
|
8
10
|
//# sourceMappingURL=graph-hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-hooks.d.ts","sourceRoot":"","sources":["../../src/graph/graph-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"graph-hooks.d.ts","sourceRoot":"","sources":["../../src/graph/graph-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAYL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAG/B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAGV,mBAAmB,EACnB,uBAAuB,EAEvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EAIhB,MAAM,eAAe,CAAC;AAqKvB,wBAAgB,aAAa,CAC3B,KAAK,SAAS,eAAe,CAAC,GAAG,CAAC,EAClC,KAAK,SAAS,cAAc,GAAG,KAAK,EACpC,YAAY,GAAG,OAAO,EACtB,eAAe,GAAG,YAAY,EAE9B,IAAI,EAAE,KAAK,EACX,OAAO,CAAC,EAAE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,GACtD,cAAc,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAoFrD;AAED,wBAAgB,eAAe,CAC7B,UAAU,EACV,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