@ankhorage/graph-hydradb 0.0.0-stage → 0.3.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.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -2
  3. package/dist/constants/infra.d.ts +4 -0
  4. package/dist/constants/infra.d.ts.map +1 -0
  5. package/dist/constants/infra.js +11 -0
  6. package/dist/constants/infra.js.map +1 -0
  7. package/dist/features/graphPersistence/adapters/hydraHttp.d.ts +18 -0
  8. package/dist/features/graphPersistence/adapters/hydraHttp.d.ts.map +1 -0
  9. package/dist/features/graphPersistence/adapters/hydraHttp.js +48 -0
  10. package/dist/features/graphPersistence/adapters/hydraHttp.js.map +1 -0
  11. package/dist/features/graphPersistence/composition/createHydraDbGraphPersistence.d.ts +5 -0
  12. package/dist/features/graphPersistence/composition/createHydraDbGraphPersistence.d.ts.map +1 -0
  13. package/dist/features/graphPersistence/composition/createHydraDbGraphPersistence.js +104 -0
  14. package/dist/features/graphPersistence/composition/createHydraDbGraphPersistence.js.map +1 -0
  15. package/dist/features/hydraDbInfrastructure/application/createHydraDbWorkload.d.ts +4 -0
  16. package/dist/features/hydraDbInfrastructure/application/createHydraDbWorkload.d.ts.map +1 -0
  17. package/dist/features/hydraDbInfrastructure/application/createHydraDbWorkload.js +46 -0
  18. package/dist/features/hydraDbInfrastructure/application/createHydraDbWorkload.js.map +1 -0
  19. package/dist/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.d.ts +4 -0
  20. package/dist/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.d.ts.map +1 -0
  21. package/dist/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.js +140 -0
  22. package/dist/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.js.map +1 -0
  23. package/dist/graphHydraDb.d.ts +5 -0
  24. package/dist/graphHydraDb.d.ts.map +1 -0
  25. package/dist/graphHydraDb.js +4 -0
  26. package/dist/graphHydraDb.js.map +1 -0
  27. package/dist/types/config.d.ts +16 -0
  28. package/dist/types/config.d.ts.map +1 -0
  29. package/dist/types/config.js +2 -0
  30. package/dist/types/config.js.map +1 -0
  31. package/examples/basic-usage/index.ts +13 -0
  32. package/examples/local-acceptance/README.md +5 -0
  33. package/package.json +68 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ankhorage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,60 @@
1
- # Temporary Holding Version
1
+ <!-- markdownlint-disable MD013 MD033 -->
2
+ <!-- This file is generated by Paradox. Do not edit manually. -->
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ # @ankhorage/graph-hydradb
5
+
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.3.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: canonical](././paradox/badges/docs.svg)
7
+
8
+ Provides a native HTTP persistence adapter for the canonical Ankhorage graph persistence port.
9
+
10
+ Translate canonical graph persistence reads into HydraDB HTTP queries without leaking HydraDB transport or credentials into graph consumers.
11
+
12
+ ## Configuration
13
+
14
+ ### HydraDB graph persistence configuration
15
+
16
+ Configuration for the server-side HydraDB HTTP persistence adapter.
17
+
18
+ <details>
19
+ <summary>Configuration options</summary>
20
+
21
+ | Field | Type | Required | Default | Description |
22
+ | --- | --- | --- | --- | --- |
23
+ | endpoint | `string` | yes | — | |
24
+ | token | `string` | yes | — | |
25
+ | namespace | `string` | yes | — | |
26
+ | graphId | `string` | yes | — | |
27
+ | cellId | `string` | yes | — | |
28
+ | timeoutMilliseconds | `number \| undefined` | no | — | |
29
+ | allowInsecureLoopbackHttp | `boolean \| undefined` | no | — | |
30
+
31
+ </details>
32
+
33
+ ## Documentation
34
+
35
+ Open `./paradox/index.html` locally in your browser to browse the complete documentation.
36
+
37
+ ## Public API
38
+
39
+ ### Types
40
+
41
+ <details>
42
+ <summary>HydraDB graph persistence configuration</summary>
43
+
44
+ Configuration for the server-side HydraDB HTTP persistence adapter.
45
+
46
+ Module: `src/types/config.ts`
47
+ Source: `src/types/config.ts:7:1`
48
+
49
+ </details>
50
+
51
+ ## Contributors
52
+
53
+ <a href="https://github.com/faeb187"><img src="https://avatars.githubusercontent.com/u/389333?s=64" width="40" height="40" alt="faeb187" /></a>
54
+ <a href="https://github.com/artiphishle"><img src="https://avatars.githubusercontent.com/u/137318798?s=64" width="40" height="40" alt="artiphishle" /></a>
55
+
56
+ ## Donation
57
+
58
+ If this project is useful to you, you can support its continued development.
59
+
60
+ [Support @ankhorage](https://github.com/sponsors/ankhorage)
@@ -0,0 +1,4 @@
1
+ import type { InfraAdapterDescriptor } from '@ankhorage/contracts/infra';
2
+ /*** Describe the HydraDB service adapter registered by this package. */
3
+ export declare const hydraDbInfraAdapterDescriptor: InfraAdapterDescriptor<'hydradb'>;
4
+ //# sourceMappingURL=infra.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infra.d.ts","sourceRoot":"","sources":["../../src/constants/infra.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,wEAAwE;AACxE,eAAO,MAAM,6BAA6B,EAAE,sBAAsB,CAAC,SAAS,CAQ3E,CAAC"}
@@ -0,0 +1,11 @@
1
+ /*** Describe the HydraDB service adapter registered by this package. */
2
+ export const hydraDbInfraAdapterDescriptor = {
3
+ id: 'hydradb',
4
+ package: '@ankhorage/graph-hydradb',
5
+ kind: 'service',
6
+ configVersion: 1,
7
+ capabilities: ['graphDatabase'],
8
+ targets: [],
9
+ dependencies: ['workloads'],
10
+ };
11
+ //# sourceMappingURL=infra.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infra.js","sourceRoot":"","sources":["../../src/constants/infra.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,MAAM,CAAC,MAAM,6BAA6B,GAAsC;IAC9E,EAAE,EAAE,SAAS;IACb,OAAO,EAAE,0BAA0B;IACnC,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC,eAAe,CAAC;IAC/B,OAAO,EAAE,EAAE;IACX,YAAY,EAAE,CAAC,WAAW,CAAC;CAC5B,CAAC","sourcesContent":["import type { InfraAdapterDescriptor } from '@ankhorage/contracts/infra';\n\n/*** Describe the HydraDB service adapter registered by this package. */\nexport const hydraDbInfraAdapterDescriptor: InfraAdapterDescriptor<'hydradb'> = {\n id: 'hydradb',\n package: '@ankhorage/graph-hydradb',\n kind: 'service',\n configVersion: 1,\n capabilities: ['graphDatabase'],\n targets: [],\n dependencies: ['workloads'],\n};\n"]}
@@ -0,0 +1,18 @@
1
+ import type { GraphScalar } from '@ankhorage/graph/persistence';
2
+ import type { HydraDbGraphPersistenceConfiguration } from '../../../types/config.js';
3
+ interface HydraCell {
4
+ readonly type: string;
5
+ readonly value?: unknown;
6
+ }
7
+ interface HydraResponse {
8
+ readonly columns: readonly string[];
9
+ readonly rows: readonly (readonly HydraCell[])[];
10
+ }
11
+ /*** Execute one bounded, parameterized HydraDB HTTP query and validate its response envelope. */
12
+ export declare function executeHydraQueryAsync(input: {
13
+ readonly configuration: HydraDbGraphPersistenceConfiguration;
14
+ readonly query: string;
15
+ readonly parameters: Readonly<Record<string, GraphScalar>>;
16
+ }): Promise<HydraResponse>;
17
+ export {};
18
+ //# sourceMappingURL=hydraHttp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydraHttp.d.ts","sourceRoot":"","sources":["../../../../src/features/graphPersistence/adapters/hydraHttp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAErF,UAAU,SAAS;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AACD,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC;CAClD;AAED,iGAAiG;AACjG,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,aAAa,EAAE,oCAAoC,CAAC;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;CAC5D,GAAG,OAAO,CAAC,aAAa,CAAC,CA6BzB"}
@@ -0,0 +1,48 @@
1
+ /*** Execute one bounded, parameterized HydraDB HTTP query and validate its response envelope. */
2
+ export async function executeHydraQueryAsync(input) {
3
+ const url = createQueryUrl(input.configuration);
4
+ const controller = new AbortController();
5
+ const timeout = setTimeout(() => controller.abort(), input.configuration.timeoutMilliseconds ?? 10_000);
6
+ try {
7
+ const response = await fetch(url, {
8
+ method: 'POST',
9
+ signal: controller.signal,
10
+ headers: {
11
+ Authorization: `Bearer ${input.configuration.token}`,
12
+ 'Content-Type': 'application/json',
13
+ 'X-Graph-Namespace': input.configuration.namespace,
14
+ },
15
+ body: JSON.stringify({
16
+ cell_id: input.configuration.cellId,
17
+ query: input.query,
18
+ parameters: input.parameters,
19
+ }),
20
+ });
21
+ const payload = await response.json().catch(() => undefined);
22
+ if (!response.ok || !isHydraResponse(payload))
23
+ throw new Error(`HydraDB query failed with HTTP ${response.status}.`);
24
+ return payload;
25
+ }
26
+ finally {
27
+ clearTimeout(timeout);
28
+ }
29
+ }
30
+ /*** Construct a secure native HTTP query URL from explicit provider configuration. */
31
+ function createQueryUrl(configuration) {
32
+ const endpoint = new URL(configuration.endpoint);
33
+ const loopback = endpoint.hostname === '127.0.0.1' ||
34
+ endpoint.hostname === 'localhost' ||
35
+ endpoint.hostname === '::1';
36
+ if (endpoint.protocol !== 'https:' &&
37
+ !(configuration.allowInsecureLoopbackHttp === true && endpoint.protocol === 'http:' && loopback))
38
+ throw new Error('HydraDB endpoints must use HTTPS unless explicit loopback development HTTP is enabled.');
39
+ return new URL(`/v1/graphs/${encodeURIComponent(configuration.graphId)}/query`, endpoint).toString();
40
+ }
41
+ /*** Narrow an untrusted JSON response to HydraDB's documented success envelope. */
42
+ function isHydraResponse(value) {
43
+ return (typeof value === 'object' &&
44
+ value !== null &&
45
+ Array.isArray(value.columns) &&
46
+ Array.isArray(value.rows));
47
+ }
48
+ //# sourceMappingURL=hydraHttp.js.map
@@ -0,0 +1 @@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CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,SAAS,cAAc,CAAC,aAAmD;IACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,QAAQ,GACZ,QAAQ,CAAC,QAAQ,KAAK,WAAW;QACjC,QAAQ,CAAC,QAAQ,KAAK,WAAW;QACjC,QAAQ,CAAC,QAAQ,KAAK,KAAK,CAAC;IAC9B,IACE,QAAQ,CAAC,QAAQ,KAAK,QAAQ;QAC9B,CAAC,CAAC,aAAa,CAAC,yBAAyB,KAAK,IAAI,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC;QAEhG,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;IACJ,OAAO,IAAI,GAAG,CACZ,cAAc,kBAAkB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAC/D,QAAQ,CACT,CAAC,QAAQ,EAAE,CAAC;AACf,CAAC;AAED,mFAAmF;AACnF,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,OAAO,CAAE,KAA+B,CAAC,OAAO,CAAC;QACvD,KAAK,CAAC,OAAO,CAAE,KAA4B,CAAC,IAAI,CAAC,CAClD,CAAC;AACJ,CAAC","sourcesContent":["import type { GraphScalar } from '@ankhorage/graph/persistence';\n\nimport type { HydraDbGraphPersistenceConfiguration } from '../../../types/config.js';\n\ninterface HydraCell {\n readonly type: string;\n readonly value?: unknown;\n}\ninterface HydraResponse {\n readonly columns: readonly string[];\n readonly rows: readonly (readonly HydraCell[])[];\n}\n\n/*** Execute one bounded, parameterized HydraDB HTTP query and validate its response envelope. */\nexport async function executeHydraQueryAsync(input: {\n readonly configuration: HydraDbGraphPersistenceConfiguration;\n readonly query: string;\n readonly parameters: Readonly<Record<string, GraphScalar>>;\n}): Promise<HydraResponse> {\n const url = createQueryUrl(input.configuration);\n const controller = new AbortController();\n const timeout = setTimeout(\n () => controller.abort(),\n input.configuration.timeoutMilliseconds ?? 10_000,\n );\n try {\n const response = await fetch(url, {\n method: 'POST',\n signal: controller.signal,\n headers: {\n Authorization: `Bearer ${input.configuration.token}`,\n 'Content-Type': 'application/json',\n 'X-Graph-Namespace': input.configuration.namespace,\n },\n body: JSON.stringify({\n cell_id: input.configuration.cellId,\n query: input.query,\n parameters: input.parameters,\n }),\n });\n const payload: unknown = await response.json().catch(() => undefined);\n if (!response.ok || !isHydraResponse(payload))\n throw new Error(`HydraDB query failed with HTTP ${response.status}.`);\n return payload;\n } finally {\n clearTimeout(timeout);\n }\n}\n\n/*** Construct a secure native HTTP query URL from explicit provider configuration. */\nfunction createQueryUrl(configuration: HydraDbGraphPersistenceConfiguration): string {\n const endpoint = new URL(configuration.endpoint);\n const loopback =\n endpoint.hostname === '127.0.0.1' ||\n endpoint.hostname === 'localhost' ||\n endpoint.hostname === '::1';\n if (\n endpoint.protocol !== 'https:' &&\n !(configuration.allowInsecureLoopbackHttp === true && endpoint.protocol === 'http:' && loopback)\n )\n throw new Error(\n 'HydraDB endpoints must use HTTPS unless explicit loopback development HTTP is enabled.',\n );\n return new URL(\n `/v1/graphs/${encodeURIComponent(configuration.graphId)}/query`,\n endpoint,\n ).toString();\n}\n\n/*** Narrow an untrusted JSON response to HydraDB's documented success envelope. */\nfunction isHydraResponse(value: unknown): value is HydraResponse {\n return (\n typeof value === 'object' &&\n value !== null &&\n Array.isArray((value as { columns?: unknown }).columns) &&\n Array.isArray((value as { rows?: unknown }).rows)\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { GraphPersistencePort } from '@ankhorage/graph/persistence';
2
+ import type { HydraDbGraphPersistenceConfiguration } from '../../../types/config.js';
3
+ /*** Create a server-side HydraDB adapter for the canonical Graph persistence boundary. */
4
+ export declare function createHydraDbGraphPersistence(configuration: HydraDbGraphPersistenceConfiguration): GraphPersistencePort;
5
+ //# sourceMappingURL=createHydraDbGraphPersistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbGraphPersistence.d.ts","sourceRoot":"","sources":["../../../../src/features/graphPersistence/composition/createHydraDbGraphPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EAKrB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAGrF,0FAA0F;AAC1F,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,oCAAoC,GAClD,oBAAoB,CAsCtB"}
@@ -0,0 +1,104 @@
1
+ import { assertGraphPersistenceOperation, assertGraphStorageData, } from '@ankhorage/graph/persistence';
2
+ import { executeHydraQueryAsync } from '../adapters/hydraHttp.js';
3
+ /*** Create a server-side HydraDB adapter for the canonical Graph persistence boundary. */
4
+ export function createHydraDbGraphPersistence(configuration) {
5
+ return {
6
+ openAsync() {
7
+ let closed = false;
8
+ return Promise.resolve({
9
+ capabilities: ['nodes', 'snapshots'],
10
+ async executeAsync(operation) {
11
+ if (closed)
12
+ throw new Error('The HydraDB graph persistence session is closed.');
13
+ assertGraphPersistenceOperation(operation);
14
+ if (operation.kind === 'storeSnapshot') {
15
+ await storeSnapshotAsync(configuration, operation.revision, operation.graph);
16
+ return { kind: 'snapshot', graph: operation.graph };
17
+ }
18
+ if (operation.kind === 'loadSnapshot') {
19
+ return {
20
+ kind: 'snapshot',
21
+ ...(await loadSnapshotAsync(configuration, operation.revision)),
22
+ };
23
+ }
24
+ if (operation.kind !== 'nodes')
25
+ return {
26
+ kind: 'unsupported',
27
+ capability: operation.kind === 'mutate' ? 'mutate' : 'traverse',
28
+ };
29
+ return {
30
+ kind: 'nodes',
31
+ nodes: await Promise.all(operation.nodeIds.map((id) => readNodeAsync(configuration, id))).then((nodes) => nodes.filter((node) => node !== undefined)),
32
+ };
33
+ },
34
+ closeAsync() {
35
+ closed = true;
36
+ return Promise.resolve();
37
+ },
38
+ });
39
+ },
40
+ };
41
+ }
42
+ /*** Store one complete immutable graph revision through HydraDB's statement-atomic MERGE. */
43
+ async function storeSnapshotAsync(configuration, revision, graph) {
44
+ const document = JSON.stringify(graph);
45
+ const response = await executeHydraQueryAsync({
46
+ configuration,
47
+ query: 'MERGE (snapshot:AnkhorageGraphSnapshot {revision: $revision}) ON CREATE SET snapshot.document = $document RETURN snapshot.document AS document',
48
+ parameters: { document, revision },
49
+ });
50
+ const storedDocument = readSnapshotDocument(response.rows.at(0));
51
+ if (storedDocument !== document)
52
+ throw new Error(`Graph snapshot revision ${revision} is already stored with different content.`);
53
+ }
54
+ /*** Restore one complete immutable graph revision without reconstructing individual graph elements. */
55
+ async function loadSnapshotAsync(configuration, revision) {
56
+ const response = await executeHydraQueryAsync({
57
+ configuration,
58
+ query: 'MATCH (snapshot:AnkhorageGraphSnapshot {revision: $revision}) RETURN snapshot.document AS document',
59
+ parameters: { revision },
60
+ });
61
+ const row = response.rows.at(0);
62
+ if (row === undefined)
63
+ return {};
64
+ const document = readSnapshotDocument(row);
65
+ const graph = JSON.parse(document);
66
+ assertGraphPersistenceOperation({ kind: 'storeSnapshot', revision, graph: graph });
67
+ return { graph: graph };
68
+ }
69
+ /*** Extract the JSON snapshot document from one verified HydraDB result row. */
70
+ function readSnapshotDocument(row) {
71
+ const document = row?.at(0)?.value;
72
+ if (row?.length !== 1 || typeof document !== 'string')
73
+ throw new Error('HydraDB returned malformed graph snapshot data.');
74
+ return document;
75
+ }
76
+ /*** Read one losslessly mapped canonical node through the documented typed-cell response. */
77
+ async function readNodeAsync(configuration, id) {
78
+ const response = await executeHydraQueryAsync({
79
+ configuration,
80
+ query: 'MATCH (n) WHERE n.__ankhorage_id = $id RETURN n.__ankhorage_id AS id, n.__ankhorage_labels AS labels, n.__ankhorage_properties AS properties, n.__ankhorage_document AS document',
81
+ parameters: { id },
82
+ });
83
+ const [row] = response.rows;
84
+ if (row?.length !== 4)
85
+ return undefined;
86
+ const values = row.map((cell) => cell.value);
87
+ if (values.some((value) => typeof value !== 'string'))
88
+ throw new Error('HydraDB returned malformed canonical node metadata.');
89
+ const [nodeId, labelsText, propertiesText, documentText] = values;
90
+ const labels = JSON.parse(labelsText);
91
+ const parsedProperties = JSON.parse(propertiesText);
92
+ const parsedDocument = documentText === 'null' ? undefined : JSON.parse(documentText);
93
+ const data = {
94
+ properties: parsedProperties,
95
+ ...(parsedDocument === undefined ? {} : { document: parsedDocument }),
96
+ };
97
+ if (!Array.isArray(labels) ||
98
+ labels.length === 0 ||
99
+ labels.some((label) => typeof label !== 'string'))
100
+ throw new Error('HydraDB returned invalid node labels.');
101
+ assertGraphStorageData(data);
102
+ return { id: nodeId, labels: labels, data };
103
+ }
104
+ //# sourceMappingURL=createHydraDbGraphPersistence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbGraphPersistence.js","sourceRoot":"","sources":["../../../../src/features/graphPersistence/composition/createHydraDbGraphPersistence.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,0FAA0F;AAC1F,MAAM,UAAU,6BAA6B,CAC3C,aAAmD;IAEnD,OAAO;QACL,SAAS;YACP,IAAI,MAAM,GAAG,KAAK,CAAC;YACnB,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,YAAY,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;gBACpC,KAAK,CAAC,YAAY,CAAC,SAAoC;oBACrD,IAAI,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;oBAChF,+BAA+B,CAAC,SAAS,CAAC,CAAC;oBAC3C,IAAI,SAAS,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;wBACvC,MAAM,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS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AAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QAEjD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAA+B,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC","sourcesContent":["import type {\n GraphPersistenceOperation,\n GraphPersistencePort,\n GraphPersistenceResult,\n GraphPersistenceSession,\n StoredGraph,\n StoredGraphNode,\n} from '@ankhorage/graph/persistence';\nimport {\n assertGraphPersistenceOperation,\n assertGraphStorageData,\n} from '@ankhorage/graph/persistence';\n\nimport type { HydraDbGraphPersistenceConfiguration } from '../../../types/config.js';\nimport { executeHydraQueryAsync } from '../adapters/hydraHttp.js';\n\n/*** Create a server-side HydraDB adapter for the canonical Graph persistence boundary. */\nexport function createHydraDbGraphPersistence(\n configuration: HydraDbGraphPersistenceConfiguration,\n): GraphPersistencePort {\n return {\n openAsync(): Promise<GraphPersistenceSession> {\n let closed = false;\n return Promise.resolve({\n capabilities: ['nodes', 'snapshots'],\n async executeAsync(operation: GraphPersistenceOperation): Promise<GraphPersistenceResult> {\n if (closed) throw new Error('The HydraDB graph persistence session is closed.');\n assertGraphPersistenceOperation(operation);\n if (operation.kind === 'storeSnapshot') {\n await storeSnapshotAsync(configuration, operation.revision, operation.graph);\n return { kind: 'snapshot', graph: operation.graph };\n }\n if (operation.kind === 'loadSnapshot') {\n return {\n kind: 'snapshot',\n ...(await loadSnapshotAsync(configuration, operation.revision)),\n };\n }\n if (operation.kind !== 'nodes')\n return {\n kind: 'unsupported',\n capability: operation.kind === 'mutate' ? 'mutate' : 'traverse',\n };\n return {\n kind: 'nodes',\n nodes: await Promise.all(\n operation.nodeIds.map((id) => readNodeAsync(configuration, id)),\n ).then((nodes) => nodes.filter((node): node is StoredGraphNode => node !== undefined)),\n };\n },\n closeAsync(): Promise<void> {\n closed = true;\n return Promise.resolve();\n },\n });\n },\n };\n}\n\n/*** Store one complete immutable graph revision through HydraDB's statement-atomic MERGE. */\nasync function storeSnapshotAsync(\n configuration: HydraDbGraphPersistenceConfiguration,\n revision: string,\n graph: StoredGraph,\n): Promise<void> {\n const document = JSON.stringify(graph);\n const response = await executeHydraQueryAsync({\n configuration,\n query:\n 'MERGE (snapshot:AnkhorageGraphSnapshot {revision: $revision}) ON CREATE SET snapshot.document = $document RETURN snapshot.document AS document',\n parameters: { document, revision },\n });\n const storedDocument = readSnapshotDocument(response.rows.at(0));\n if (storedDocument !== document)\n throw new Error(\n `Graph snapshot revision ${revision} is already stored with different content.`,\n );\n}\n\n/*** Restore one complete immutable graph revision without reconstructing individual graph elements. */\nasync function loadSnapshotAsync(\n configuration: HydraDbGraphPersistenceConfiguration,\n revision: string,\n): Promise<{ readonly graph?: StoredGraph }> {\n const response = await executeHydraQueryAsync({\n configuration,\n query:\n 'MATCH (snapshot:AnkhorageGraphSnapshot {revision: $revision}) RETURN snapshot.document AS document',\n parameters: { revision },\n });\n const row = response.rows.at(0);\n if (row === undefined) return {};\n const document = readSnapshotDocument(row);\n const graph: unknown = JSON.parse(document);\n assertGraphPersistenceOperation({ kind: 'storeSnapshot', revision, graph: graph as StoredGraph });\n return { graph: graph as StoredGraph };\n}\n\n/*** Extract the JSON snapshot document from one verified HydraDB result row. */\nfunction readSnapshotDocument(row: readonly { readonly value?: unknown }[] | undefined): string {\n const document = row?.at(0)?.value;\n if (row?.length !== 1 || typeof document !== 'string')\n throw new Error('HydraDB returned malformed graph snapshot data.');\n return document;\n}\n\n/*** Read one losslessly mapped canonical node through the documented typed-cell response. */\nasync function readNodeAsync(\n configuration: HydraDbGraphPersistenceConfiguration,\n id: string,\n): Promise<StoredGraphNode | undefined> {\n const response = await executeHydraQueryAsync({\n configuration,\n query:\n 'MATCH (n) WHERE n.__ankhorage_id = $id RETURN n.__ankhorage_id AS id, n.__ankhorage_labels AS labels, n.__ankhorage_properties AS properties, n.__ankhorage_document AS document',\n parameters: { id },\n });\n const [row] = response.rows;\n if (row?.length !== 4) return undefined;\n const values = row.map((cell) => cell.value);\n if (values.some((value) => typeof value !== 'string'))\n throw new Error('HydraDB returned malformed canonical node metadata.');\n const [nodeId, labelsText, propertiesText, documentText] = values as [\n string,\n string,\n string,\n string,\n ];\n const labels = JSON.parse(labelsText) as unknown;\n const parsedProperties: unknown = JSON.parse(propertiesText);\n const parsedDocument: unknown = documentText === 'null' ? undefined : JSON.parse(documentText);\n const data: unknown = {\n properties: parsedProperties,\n ...(parsedDocument === undefined ? {} : { document: parsedDocument }),\n };\n if (\n !Array.isArray(labels) ||\n labels.length === 0 ||\n labels.some((label) => typeof label !== 'string')\n )\n throw new Error('HydraDB returned invalid node labels.');\n assertGraphStorageData(data);\n return { id: nodeId, labels: labels as [string, ...string[]], data };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { InfraExecutionContext, InfraWorkloadSpec } from '@ankhorage/contracts/infra';
2
+ /*** Project an explicit HydraDB selection into one persistent local-object-store workload. */
3
+ export declare function createHydraDbWorkload(context: InfraExecutionContext): InfraWorkloadSpec;
4
+ //# sourceMappingURL=createHydraDbWorkload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbWorkload.d.ts","sourceRoot":"","sources":["../../../../src/features/hydraDbInfrastructure/application/createHydraDbWorkload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE3F,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,iBAAiB,CA4CvF"}
@@ -0,0 +1,46 @@
1
+ /*** Project an explicit HydraDB selection into one persistent local-object-store workload. */
2
+ export function createHydraDbWorkload(context) {
3
+ const { graphDatabase } = context.desired;
4
+ if (graphDatabase?.provider !== 'hydradb')
5
+ throw new Error('HydraDB requires the canonical HydraDB graph database selection.');
6
+ return {
7
+ id: 'hydradb',
8
+ artifact: {
9
+ kind: 'image',
10
+ image: 'ghcr.io/hydra-db/hydradb@sha256:6edb164cfe06015443bbc67003c68ee5e04e42b2d4f088779867ff1654b9bc0b',
11
+ },
12
+ ports: { http: { port: 8443 } },
13
+ environment: {
14
+ CLOUD_PROVIDER: { kind: 'literal', value: 'local' },
15
+ GRAPH_ALLOW_PLAINTEXT: { kind: 'literal', value: 'true' },
16
+ GRAPH_AUTH_TOKEN_FILE: {
17
+ kind: 'literal',
18
+ value: '/var/run/secrets/slatedb-graph/auth-token',
19
+ },
20
+ GRAPH_CELL_ID: { kind: 'literal', value: 'cell-0' },
21
+ GRAPH_CELLS: { kind: 'literal', value: 'cell-0' },
22
+ GRAPH_CYPHER_ENGINE: { kind: 'literal', value: graphDatabase.cypherEngine },
23
+ GRAPH_CYPHER_MUTATION_ATOMICITY: { kind: 'literal', value: graphDatabase.mutationAtomicity },
24
+ GRAPH_DATA_CACHE_DIR: { kind: 'literal', value: '/var/lib/hydradb/cache' },
25
+ GRAPH_DATA_PATH: { kind: 'literal', value: 'data' },
26
+ GRAPH_HTTP_ADDR: { kind: 'literal', value: '0.0.0.0:8443' },
27
+ GRAPH_ID: { kind: 'literal', value: 'default' },
28
+ GRAPH_NAMESPACE: { kind: 'literal', value: 'default' },
29
+ LOCAL_PATH: { kind: 'literal', value: '/var/lib/hydradb/store' },
30
+ },
31
+ files: {
32
+ '/var/run/secrets/slatedb-graph/auth-token': {
33
+ kind: 'secret',
34
+ reference: graphDatabase.credentials,
35
+ },
36
+ },
37
+ health: { kind: 'http', port: 8443, path: '/healthz' },
38
+ persistence: {
39
+ cache: { id: 'cache', mountPath: '/var/lib/hydradb/cache', sizeGiB: 2, retention: 'retain' },
40
+ store: { id: 'store', mountPath: '/var/lib/hydradb/store', sizeGiB: 20, retention: 'retain' },
41
+ },
42
+ exposure: 'internal',
43
+ replicas: 1,
44
+ };
45
+ }
46
+ //# sourceMappingURL=createHydraDbWorkload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbWorkload.js","sourceRoot":"","sources":["../../../../src/features/hydraDbInfrastructure/application/createHydraDbWorkload.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,MAAM,UAAU,qBAAqB,CAAC,OAA8B;IAClE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAC1C,IAAI,aAAa,EAAE,QAAQ,KAAK,SAAS;QACvC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,OAAO;QACL,EAAE,EAAE,SAAS;QACb,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EACH,kGAAkG;SACrG;QACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC/B,WAAW,EAAE;YACX,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE;YACnD,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;YACzD,qBAAqB,EAAE;gBACrB,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,2CAA2C;aACnD;YACD,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;YACnD,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;YACjD,mBAAmB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,CAAC,YAAY,EAAE;YAC3E,+BAA+B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,CAAC,iBAAiB,EAAE;YAC5F,oBAAoB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,wBAAwB,EAAE;YAC1E,eAAe,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;YACnD,eAAe,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE;YAC3D,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YAC/C,eAAe,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtD,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,wBAAwB,EAAE;SACjE;QACD,KAAK,EAAE;YACL,2CAA2C,EAAE;gBAC3C,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,aAAa,CAAC,WAAW;aACrC;SACF;QACD,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;QACtD,WAAW,EAAE;YACX,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;YAC5F,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC9F;QACD,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,CAAC;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraExecutionContext, InfraWorkloadSpec } from '@ankhorage/contracts/infra';\n\n/*** Project an explicit HydraDB selection into one persistent local-object-store workload. */\nexport function createHydraDbWorkload(context: InfraExecutionContext): InfraWorkloadSpec {\n const { graphDatabase } = context.desired;\n if (graphDatabase?.provider !== 'hydradb')\n throw new Error('HydraDB requires the canonical HydraDB graph database selection.');\n return {\n id: 'hydradb',\n artifact: {\n kind: 'image',\n image:\n 'ghcr.io/hydra-db/hydradb@sha256:6edb164cfe06015443bbc67003c68ee5e04e42b2d4f088779867ff1654b9bc0b',\n },\n ports: { http: { port: 8443 } },\n environment: {\n CLOUD_PROVIDER: { kind: 'literal', value: 'local' },\n GRAPH_ALLOW_PLAINTEXT: { kind: 'literal', value: 'true' },\n GRAPH_AUTH_TOKEN_FILE: {\n kind: 'literal',\n value: '/var/run/secrets/slatedb-graph/auth-token',\n },\n GRAPH_CELL_ID: { kind: 'literal', value: 'cell-0' },\n GRAPH_CELLS: { kind: 'literal', value: 'cell-0' },\n GRAPH_CYPHER_ENGINE: { kind: 'literal', value: graphDatabase.cypherEngine },\n GRAPH_CYPHER_MUTATION_ATOMICITY: { kind: 'literal', value: graphDatabase.mutationAtomicity },\n GRAPH_DATA_CACHE_DIR: { kind: 'literal', value: '/var/lib/hydradb/cache' },\n GRAPH_DATA_PATH: { kind: 'literal', value: 'data' },\n GRAPH_HTTP_ADDR: { kind: 'literal', value: '0.0.0.0:8443' },\n GRAPH_ID: { kind: 'literal', value: 'default' },\n GRAPH_NAMESPACE: { kind: 'literal', value: 'default' },\n LOCAL_PATH: { kind: 'literal', value: '/var/lib/hydradb/store' },\n },\n files: {\n '/var/run/secrets/slatedb-graph/auth-token': {\n kind: 'secret',\n reference: graphDatabase.credentials,\n },\n },\n health: { kind: 'http', port: 8443, path: '/healthz' },\n persistence: {\n cache: { id: 'cache', mountPath: '/var/lib/hydradb/cache', sizeGiB: 2, retention: 'retain' },\n store: { id: 'store', mountPath: '/var/lib/hydradb/store', sizeGiB: 20, retention: 'retain' },\n },\n exposure: 'internal',\n replicas: 1,\n };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { InfraServiceAdapter } from '@ankhorage/contracts/infra';
2
+ /*** Create the runtime-neutral persistent HydraDB infrastructure service adapter. */
3
+ export declare function createHydraDbInfraAdapter(): InfraServiceAdapter;
4
+ //# sourceMappingURL=createHydraDbInfraAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbInfraAdapter.d.ts","sourceRoot":"","sources":["../../../../src/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAKpC,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,mBAAmB,CAU/D"}
@@ -0,0 +1,140 @@
1
+ import { hydraDbInfraAdapterDescriptor } from '../../../constants/infra.js';
2
+ import { createHydraDbWorkload } from '../application/createHydraDbWorkload.js';
3
+ /*** Create the runtime-neutral persistent HydraDB infrastructure service adapter. */
4
+ export function createHydraDbInfraAdapter() {
5
+ return {
6
+ descriptor: hydraDbInfraAdapterDescriptor,
7
+ validateAsync: (context) => Promise.resolve(validateHydraDb(context)),
8
+ planAsync: (context) => Promise.resolve(planHydraDb(context)),
9
+ desiredWorkloadsAsync: (context) => Promise.resolve(createHydraDbDesiredWorkloads(context)),
10
+ reconcileAsync: (context) => Promise.resolve(reconcileHydraDb(context)),
11
+ statusAsync: (context) => Promise.resolve(getHydraDbStatus(context)),
12
+ destroyAsync: (context, request) => Promise.resolve(destroyHydraDb(context, request)),
13
+ };
14
+ }
15
+ function validateHydraDb(context) {
16
+ return context.desired.graphDatabase?.provider === 'hydradb'
17
+ ? { ok: true, value: null, diagnostics: [] }
18
+ : {
19
+ ok: false,
20
+ diagnostics: [
21
+ {
22
+ severity: 'error',
23
+ code: 'hydradb-selection-invalid',
24
+ message: 'HydraDB requires the canonical HydraDB graph database selection.',
25
+ },
26
+ ],
27
+ };
28
+ }
29
+ function createHydraDbDesiredWorkloads(context) {
30
+ const validation = validateHydraDb(context);
31
+ return validation.ok
32
+ ? { ok: true, value: [createHydraDbWorkload(context)], diagnostics: [] }
33
+ : validation;
34
+ }
35
+ function planHydraDb(context) {
36
+ const validation = validateHydraDb(context);
37
+ if (!validation.ok)
38
+ return validation;
39
+ const owner = createHydraDbOwner(context);
40
+ const exists = hasPreviousOwner(context);
41
+ return {
42
+ ok: true,
43
+ value: [
44
+ {
45
+ owner: owner.identity,
46
+ operation: exists ? 'noop' : 'create',
47
+ impact: 'none',
48
+ detail: `HydraDB graph service: ${exists ? 'noop' : 'create'}.`,
49
+ dependsOn: owner.dependsOn,
50
+ },
51
+ ],
52
+ diagnostics: [],
53
+ };
54
+ }
55
+ function reconcileHydraDb(context) {
56
+ const validation = validateHydraDb(context);
57
+ if (!validation.ok)
58
+ return validation;
59
+ const owner = createHydraDbOwner(context);
60
+ const endpoint = context.desired.graphDatabase?.provider === 'hydradb'
61
+ ? context.desired.graphDatabase.endpoint
62
+ : '';
63
+ return {
64
+ ok: true,
65
+ value: {
66
+ resources: [owner],
67
+ outputs: [
68
+ {
69
+ owner: owner.identity,
70
+ name: 'endpoint',
71
+ visibility: 'public',
72
+ value: endpoint,
73
+ environmentVariable: 'HYDRADB_ENDPOINT',
74
+ },
75
+ ],
76
+ },
77
+ diagnostics: [],
78
+ };
79
+ }
80
+ function getHydraDbStatus(context) {
81
+ const validation = validateHydraDb(context);
82
+ if (!validation.ok)
83
+ return validation;
84
+ const owner = createHydraDbOwner(context);
85
+ return {
86
+ ok: true,
87
+ value: [
88
+ {
89
+ owner: owner.identity,
90
+ state: hasPreviousOwner(context) ? 'ready' : 'absent',
91
+ },
92
+ ],
93
+ diagnostics: [],
94
+ };
95
+ }
96
+ function destroyHydraDb(context, request) {
97
+ if (!isConfirmed(context, request))
98
+ return {
99
+ ok: false,
100
+ diagnostics: [
101
+ {
102
+ severity: 'error',
103
+ code: 'hydradb-destroy-unconfirmed',
104
+ message: 'HydraDB destroy requires exact project and environment confirmation.',
105
+ },
106
+ ],
107
+ };
108
+ return { ok: true, value: { resources: [], outputs: [] }, diagnostics: [] };
109
+ }
110
+ function createHydraDbOwner(context) {
111
+ return {
112
+ identity: {
113
+ projectId: context.projectId,
114
+ environment: context.environment,
115
+ adapter: 'hydradb',
116
+ resourceId: 'service',
117
+ },
118
+ externalId: `${context.projectId}-${context.environment}-hydradb`,
119
+ persistent: true,
120
+ retention: 'retain',
121
+ dependsOn: [
122
+ {
123
+ projectId: context.projectId,
124
+ environment: context.environment,
125
+ adapter: context.desired.deployment.runtime.provider,
126
+ resourceId: 'workload:hydradb',
127
+ },
128
+ ],
129
+ };
130
+ }
131
+ function hasPreviousOwner(context) {
132
+ return (context.previous?.resources.some((resource) => resource.identity.adapter === 'hydradb') ?? false);
133
+ }
134
+ function isConfirmed(context, request) {
135
+ return (request.projectId === context.projectId &&
136
+ request.environment === context.environment &&
137
+ request.confirmation.projectId === context.projectId &&
138
+ request.confirmation.environment === context.environment);
139
+ }
140
+ //# sourceMappingURL=createHydraDbInfraAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createHydraDbInfraAdapter.js","sourceRoot":"","sources":["../../../../src/features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,qFAAqF;AACrF,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,UAAU,EAAE,6BAA6B;QACzC,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACrE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC7D,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;QAC3F,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACvE,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACpE,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,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AAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,OAA8B,EAAE,OAA4B;IAC/E,OAAO,CACL,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;QACvC,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW;QAC3C,OAAO,CAAC,YAAY,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;QACpD,OAAO,CAAC,YAAY,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,CACzD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraDestroyRequest,\n InfraExecutionContext,\n InfraServiceAdapter,\n} from '@ankhorage/contracts/infra';\n\nimport { hydraDbInfraAdapterDescriptor } from '../../../constants/infra.js';\nimport { createHydraDbWorkload } from '../application/createHydraDbWorkload.js';\n\n/*** Create the runtime-neutral persistent HydraDB infrastructure service adapter. */\nexport function createHydraDbInfraAdapter(): InfraServiceAdapter {\n return {\n descriptor: hydraDbInfraAdapterDescriptor,\n validateAsync: (context) => Promise.resolve(validateHydraDb(context)),\n planAsync: (context) => Promise.resolve(planHydraDb(context)),\n desiredWorkloadsAsync: (context) => Promise.resolve(createHydraDbDesiredWorkloads(context)),\n reconcileAsync: (context) => Promise.resolve(reconcileHydraDb(context)),\n statusAsync: (context) => Promise.resolve(getHydraDbStatus(context)),\n destroyAsync: (context, request) => Promise.resolve(destroyHydraDb(context, request)),\n };\n}\n\nfunction validateHydraDb(context: InfraExecutionContext) {\n return context.desired.graphDatabase?.provider === 'hydradb'\n ? { ok: true as const, value: null, diagnostics: [] }\n : {\n ok: false as const,\n diagnostics: [\n {\n severity: 'error' as const,\n code: 'hydradb-selection-invalid',\n message: 'HydraDB requires the canonical HydraDB graph database selection.',\n },\n ],\n };\n}\n\nfunction createHydraDbDesiredWorkloads(context: InfraExecutionContext) {\n const validation = validateHydraDb(context);\n return validation.ok\n ? { ok: true as const, value: [createHydraDbWorkload(context)], diagnostics: [] }\n : validation;\n}\n\nfunction planHydraDb(context: InfraExecutionContext) {\n const validation = validateHydraDb(context);\n if (!validation.ok) return validation;\n const owner = createHydraDbOwner(context);\n const exists = hasPreviousOwner(context);\n return {\n ok: true as const,\n value: [\n {\n owner: owner.identity,\n operation: exists ? ('noop' as const) : ('create' as const),\n impact: 'none' as const,\n detail: `HydraDB graph service: ${exists ? 'noop' : 'create'}.`,\n dependsOn: owner.dependsOn,\n },\n ],\n diagnostics: [],\n };\n}\n\nfunction reconcileHydraDb(context: InfraExecutionContext) {\n const validation = validateHydraDb(context);\n if (!validation.ok) return validation;\n const owner = createHydraDbOwner(context);\n const endpoint =\n context.desired.graphDatabase?.provider === 'hydradb'\n ? context.desired.graphDatabase.endpoint\n : '';\n return {\n ok: true as const,\n value: {\n resources: [owner],\n outputs: [\n {\n owner: owner.identity,\n name: 'endpoint',\n visibility: 'public' as const,\n value: endpoint,\n environmentVariable: 'HYDRADB_ENDPOINT',\n },\n ],\n },\n diagnostics: [],\n };\n}\n\nfunction getHydraDbStatus(context: InfraExecutionContext) {\n const validation = validateHydraDb(context);\n if (!validation.ok) return validation;\n const owner = createHydraDbOwner(context);\n return {\n ok: true as const,\n value: [\n {\n owner: owner.identity,\n state: hasPreviousOwner(context) ? ('ready' as const) : ('absent' as const),\n },\n ],\n diagnostics: [],\n };\n}\n\nfunction destroyHydraDb(context: InfraExecutionContext, request: InfraDestroyRequest) {\n if (!isConfirmed(context, request))\n return {\n ok: false as const,\n diagnostics: [\n {\n severity: 'error' as const,\n code: 'hydradb-destroy-unconfirmed',\n message: 'HydraDB destroy requires exact project and environment confirmation.',\n },\n ],\n };\n return { ok: true as const, value: { resources: [], outputs: [] }, diagnostics: [] };\n}\n\nfunction createHydraDbOwner(context: InfraExecutionContext) {\n return {\n identity: {\n projectId: context.projectId,\n environment: context.environment,\n adapter: 'hydradb' as const,\n resourceId: 'service',\n },\n externalId: `${context.projectId}-${context.environment}-hydradb`,\n persistent: true,\n retention: 'retain' as const,\n dependsOn: [\n {\n projectId: context.projectId,\n environment: context.environment,\n adapter: context.desired.deployment.runtime.provider,\n resourceId: 'workload:hydradb',\n },\n ],\n };\n}\n\nfunction hasPreviousOwner(context: InfraExecutionContext): boolean {\n return (\n context.previous?.resources.some((resource) => resource.identity.adapter === 'hydradb') ?? false\n );\n}\n\nfunction isConfirmed(context: InfraExecutionContext, request: InfraDestroyRequest): boolean {\n return (\n request.projectId === context.projectId &&\n request.environment === context.environment &&\n request.confirmation.projectId === context.projectId &&\n request.confirmation.environment === context.environment\n );\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { hydraDbInfraAdapterDescriptor } from './constants/infra.js';
2
+ export { createHydraDbGraphPersistence } from './features/graphPersistence/composition/createHydraDbGraphPersistence.js';
3
+ export { createHydraDbInfraAdapter } from './features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.js';
4
+ export type { HydraDbGraphPersistenceConfiguration } from './types/config.js';
5
+ //# sourceMappingURL=graphHydraDb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphHydraDb.d.ts","sourceRoot":"","sources":["../src/graphHydraDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0EAA0E,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC;AACtH,YAAY,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { hydraDbInfraAdapterDescriptor } from './constants/infra.js';
2
+ export { createHydraDbGraphPersistence } from './features/graphPersistence/composition/createHydraDbGraphPersistence.js';
3
+ export { createHydraDbInfraAdapter } from './features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.js';
4
+ //# sourceMappingURL=graphHydraDb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphHydraDb.js","sourceRoot":"","sources":["../src/graphHydraDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0EAA0E,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAE,MAAM,2EAA2E,CAAC","sourcesContent":["export { hydraDbInfraAdapterDescriptor } from './constants/infra.js';\nexport { createHydraDbGraphPersistence } from './features/graphPersistence/composition/createHydraDbGraphPersistence.js';\nexport { createHydraDbInfraAdapter } from './features/hydraDbInfrastructure/composition/createHydraDbInfraAdapter.js';\nexport type { HydraDbGraphPersistenceConfiguration } from './types/config.js';\n"]}
@@ -0,0 +1,16 @@
1
+ /***
2
+ * Configuration for the server-side HydraDB HTTP persistence adapter.
3
+ * @config
4
+ * @readme
5
+ * @title HydraDB graph persistence configuration
6
+ */
7
+ export interface HydraDbGraphPersistenceConfiguration {
8
+ readonly endpoint: string;
9
+ readonly token: string;
10
+ readonly namespace: string;
11
+ readonly graphId: string;
12
+ readonly cellId: string;
13
+ readonly timeoutMilliseconds?: number;
14
+ readonly allowInsecureLoopbackHttp?: boolean;
15
+ }
16
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["/***\n * Configuration for the server-side HydraDB HTTP persistence adapter.\n * @config\n * @readme\n * @title HydraDB graph persistence configuration\n */\nexport interface HydraDbGraphPersistenceConfiguration {\n readonly endpoint: string;\n readonly token: string;\n readonly namespace: string;\n readonly graphId: string;\n readonly cellId: string;\n readonly timeoutMilliseconds?: number;\n readonly allowInsecureLoopbackHttp?: boolean;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import { createHydraDbGraphPersistence } from '@ankhorage/graph-hydradb';
2
+
3
+ /*** Open an explicit server-side HydraDB graph persistence session. @usage @readme @title HydraDB graph persistence */
4
+ const persistence = createHydraDbGraphPersistence({
5
+ endpoint: 'https://hydradb.example',
6
+ token: 'server-side-token',
7
+ namespace: 'architecture',
8
+ graphId: 'default',
9
+ cellId: 'cell-0',
10
+ });
11
+ const session = await persistence.openAsync();
12
+ console.log(session.capabilities);
13
+ await session.closeAsync();
@@ -0,0 +1,5 @@
1
+ # Local acceptance
2
+
3
+ The pinned HydraDB v0.5.0 image is `ghcr.io/hydra-db/hydradb@sha256:6edb164cfe06015443bbc67003c68ee5e04e42b2d4f088779867ff1654b9bc0b`.
4
+
5
+ Use the upstream `USING-HYDRADB.md` local development environment values and configure the adapter with loopback HTTP explicitly enabled. The provider token is server-side configuration, never an environment lookup by this package.
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "@ankhorage/graph-hydradb",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "type": "module",
5
+ "description": "Native HydraDB HTTP persistence adapter for the canonical Ankhorage graph port.",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ankhorage/graph-hydradb.git"
10
+ },
11
+ "homepage": "https://github.com/ankhorage/graph-hydradb#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/ankhorage/graph-hydradb/issues"
14
+ },
15
+ "keywords": [
16
+ "ankhorage",
17
+ "graph",
18
+ "hydradb",
19
+ "persistence",
20
+ "adapter"
21
+ ],
22
+ "sideEffects": false,
23
+ "files": [
24
+ "dist",
25
+ "LICENSE",
26
+ "examples"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/graphHydraDb.d.ts",
31
+ "import": "./dist/graphHydraDb.js"
32
+ },
33
+ "./package.json": "./package.json"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "engines": {
39
+ "node": ">=24"
40
+ },
41
+ "main": "./dist/graphHydraDb.js",
42
+ "types": "./dist/graphHydraDb.d.ts",
43
+ "scripts": {
44
+ "lint": "ankhorage-eslint . --max-warnings=0",
45
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
46
+ "format": "ankhorage-prettier --write .",
47
+ "format:check": "ankhorage-prettier --check .",
48
+ "knip:check": "ankhorage-knip",
49
+ "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.build.json",
50
+ "typecheck": "bun x tsc --noEmit -p tsconfig.json",
51
+ "check-types": "bun x tsc --noEmit -p tsconfig.json",
52
+ "test": "bun test src",
53
+ "docs": "paradox",
54
+ "changeset": "ankhorage-changeset",
55
+ "changeset:status": "ankhorage-changeset status --since=origin/main",
56
+ "version-packages": "ankhorage-changeset version"
57
+ },
58
+ "dependencies": {
59
+ "@ankhorage/contracts": "^26.20.0",
60
+ "@ankhorage/graph": "^0.5.0"
61
+ },
62
+ "devDependencies": {
63
+ "@ankhorage/devtools": "^2.12.8",
64
+ "@ankhorage/paradox": "^0.6.1",
65
+ "@types/bun": "^1.4.5",
66
+ "@types/node": "^25.6.0",
67
+ "typescript": "^5.9.3"
68
+ },
69
+ "packageManager": "bun@1.4.5"
70
+ }