@ariestools/aries-datalake-core 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/api/errors.d.ts +3 -1
- package/dist/browser/api/errors.d.ts.map +1 -1
- package/dist/browser/api/health.d.ts +3 -1
- package/dist/browser/api/health.d.ts.map +1 -1
- package/dist/browser/browser.mjs.map +2 -2
- package/dist/browser/types/AclEntry.d.ts +6 -2
- package/dist/browser/types/AclEntry.d.ts.map +1 -1
- package/dist/browser/types/BrowserPayload.d.ts +15 -5
- package/dist/browser/types/BrowserPayload.d.ts.map +1 -1
- package/dist/browser/types/DatalakeConfig.d.ts +27 -9
- package/dist/browser/types/DatalakeConfig.d.ts.map +1 -1
- package/dist/browser/types/DatalakeDescriptor.d.ts +30 -10
- package/dist/browser/types/DatalakeDescriptor.d.ts.map +1 -1
- package/dist/browser/types/Scope.d.ts +15 -5
- package/dist/browser/types/Scope.d.ts.map +1 -1
- package/dist/browser/types/Token.d.ts +15 -5
- package/dist/browser/types/Token.d.ts.map +1 -1
- package/dist/node/api/errors.d.ts +3 -1
- package/dist/node/api/errors.d.ts.map +1 -1
- package/dist/node/api/health.d.ts +3 -1
- package/dist/node/api/health.d.ts.map +1 -1
- package/dist/node/auth/sessionTokenCodec.d.ts +15 -5
- package/dist/node/auth/sessionTokenCodec.d.ts.map +1 -1
- package/dist/node/auth/tokenCodec.d.ts +21 -7
- package/dist/node/auth/tokenCodec.d.ts.map +1 -1
- package/dist/node/index.mjs.map +2 -2
- package/dist/node/store/DatalakeStore.d.ts +24 -8
- package/dist/node/store/DatalakeStore.d.ts.map +1 -1
- package/dist/node/types/AclEntry.d.ts +6 -2
- package/dist/node/types/AclEntry.d.ts.map +1 -1
- package/dist/node/types/BrowserPayload.d.ts +15 -5
- package/dist/node/types/BrowserPayload.d.ts.map +1 -1
- package/dist/node/types/DatalakeConfig.d.ts +27 -9
- package/dist/node/types/DatalakeConfig.d.ts.map +1 -1
- package/dist/node/types/DatalakeDescriptor.d.ts +30 -10
- package/dist/node/types/DatalakeDescriptor.d.ts.map +1 -1
- package/dist/node/types/Payload.d.ts +18 -6
- package/dist/node/types/Payload.d.ts.map +1 -1
- package/dist/node/types/Scope.d.ts +15 -5
- package/dist/node/types/Scope.d.ts.map +1 -1
- package/dist/node/types/Token.d.ts +15 -5
- package/dist/node/types/Token.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
export interface ApiErrorBody {
|
|
7
7
|
code: ApiErrorCode;
|
|
8
8
|
message: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Optional request-correlation id for server logs.
|
|
11
|
+
*/
|
|
10
12
|
requestId?: string;
|
|
11
13
|
}
|
|
12
14
|
export type ApiErrorCode = 'bad_request' | 'unauthorized' | 'forbidden' | 'not_found' | 'conflict' | 'unprocessable' | 'rate_limited' | 'internal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,YAAY,GAClB,aAAa,GACb,cAAc,GACd,WAAW,GACX,WAAW,GACX,UAAU,GACV,eAAe,GACf,cAAc,GACd,UAAU,CAAA;AAEhB,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CASzD,CAAA;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAEX,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;CAO/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/api/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAA;IACZ
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/api/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAA;IACZ;;MAEE;IACF,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/errors.ts", "../../src/api/paths.ts", "../../src/api/planePaths.ts", "../../src/types/Principal.ts", "../../src/types/Region.ts", "../../src/types/Scope.ts", "../../src/types/Tier.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Standard error body returned by the control plane for any non-2xx response.\n * The `code` is a stable machine-readable identifier; `message` is the\n * human-readable description.\n */\nexport interface ApiErrorBody {\n code: ApiErrorCode\n message: string\n
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Standard error body returned by the control plane for any non-2xx response.\n * The `code` is a stable machine-readable identifier; `message` is the\n * human-readable description.\n */\nexport interface ApiErrorBody {\n code: ApiErrorCode\n message: string\n /**\n Optional request-correlation id for server logs.\n */\n requestId?: string\n}\n\nexport type ApiErrorCode\n = | 'bad_request'\n | 'unauthorized'\n | 'forbidden'\n | 'not_found'\n | 'conflict'\n | 'unprocessable'\n | 'rate_limited'\n | 'internal'\n\nexport const API_ERROR_STATUS: Record<ApiErrorCode, number> = {\n bad_request: 400,\n unauthorized: 401,\n forbidden: 403,\n not_found: 404,\n conflict: 409,\n unprocessable: 422,\n rate_limited: 429,\n internal: 500,\n}\n\n/**\n * Thrown by `RestDatalakeClient` when the server returns a non-2xx response.\n * Carries the structured error body so callers can branch on `.code`.\n */\nexport class DatalakeApiError extends Error {\n readonly code: ApiErrorCode\n readonly requestId?: string\n readonly status: number\n\n constructor(status: number, body: ApiErrorBody) {\n super(body.message)\n this.name = 'DatalakeApiError'\n this.code = body.code\n this.status = status\n this.requestId = body.requestId\n }\n}\n", "/**\n * Canonical path builders for the datalake control-plane HTTP API.\n * Both the REST client and the control-plane service import from here so\n * the wire contract has a single source of truth.\n */\n\nexport const DATALAKE_API_VERSION = 'v1'\n\nexport function datalakeCollectionPath(): string {\n return `/${DATALAKE_API_VERSION}/datalakes`\n}\n\nexport function datalakeResourcePath(idOrName: string): string {\n return `${datalakeCollectionPath()}/${encodeURIComponent(idOrName)}`\n}\n\nexport function datalakeGrantsPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/grants`\n}\n\nexport function datalakeGrantPath(idOrName: string, principal: string): string {\n return `${datalakeGrantsPath(idOrName)}/${encodeURIComponent(principal)}`\n}\n\nexport function datalakeTokensPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/tokens`\n}\n\nexport function datalakeHealthPath(): string {\n return `/${DATALAKE_API_VERSION}/health`\n}\n", "/**\n * Data-plane path builders. The data plane is addressed by datalake id\n * (globally unique), not by name (which is scoped to owner). Route names\n * mirror the XYO archivist REST middleware (`/insert`, `/get/:hash`, `/next`)\n * so a generic archivist client can talk to a datalake-plane after picking\n * the per-datalake prefix.\n */\n\nimport { DATALAKE_API_VERSION } from './paths.ts'\n\n/**\n * Header that conveys how many payloads in the insert request were skipped\n * because their hash already existed in the datalake.\n */\nexport const DATALAKE_HEADER_DUPLICATES = 'x-datalake-duplicates'\n\n/**\n * Header that conveys the comma-separated list of archivist-computed\n * `_hash` values rejected by the datalake's schema policy.\n */\nexport const DATALAKE_HEADER_REJECTED = 'x-datalake-rejected'\n\n/**\n * Header that conveys the cursor (`_sequence`) of the last payload in a\n * `next` response page, when more pages may exist.\n */\nexport const DATALAKE_HEADER_NEXT_CURSOR = 'x-datalake-next-cursor'\n\nexport function datalakePlaneResourcePath(id: string): string {\n return `/${DATALAKE_API_VERSION}/datalakes/${encodeURIComponent(id)}`\n}\n\nexport function datalakePlaneInsertPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/insert`\n}\n\nexport function datalakePlaneGetPath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/get/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneGetManyPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/get`\n}\n\nexport function datalakePlaneNextPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/next`\n}\n\nexport function datalakePlaneDeletePath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/delete/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneClearPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/clear`\n}\n\nexport function datalakePlaneUsagePath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/usage`\n}\n", "/**\n * Access-control role granted to a principal on a datalake.\n * Maps 1:1 to XL1's DataLakeViewer (read) and DataLakeRunner (read/write) monikers.\n */\nexport type DatalakeRole = 'viewer' | 'runner'\n\n/**\n * A principal identifier. Either a control-plane user id, or the reserved\n * value `PUBLIC_PRINCIPAL` (`'public'`) which opens access to unauthenticated\n * callers at the granted role.\n */\nexport type DatalakePrincipal = string\n\nexport const PUBLIC_PRINCIPAL = 'public'\n\n/**\n * Type guard for the reserved `public` principal.\n */\nexport function isPublicPrincipal(principal: DatalakePrincipal): boolean {\n return principal === PUBLIC_PRINCIPAL\n}\n", "/**\n * Cloud regions where datalakes can be provisioned. Starts with AWS us-west-2;\n * additional regions are added as the control plane expands.\n */\nexport type DatalakeRegion = 'us-west-2' | 'us-east-1' | 'eu-west-1'\n\nexport const DATALAKE_REGIONS: readonly DatalakeRegion[] = ['us-west-2', 'us-east-1', 'eu-west-1'] as const\n\nexport const DEFAULT_REGION: DatalakeRegion = 'us-west-2'\n", "/**\nAudience used by browser wallet JWTs for control-plane operations.\n*/\nexport const DATALAKE_CONTROL_AUDIENCE = 'aries-datalake-control'\n\n/**\nSchema required on every wallet sign-in JWT accepted by Aries.\n*/\nexport const DATALAKE_WALLET_JWT_SCHEMA = 'network.xyo.auth.signin'\n\n/**\nBrowser operations intentionally exposed by the datalake control plane.\n*/\nexport const DATALAKE_CONTROL_OPERATIONS = [\n 'datalake:create',\n 'datalake:describe',\n 'datalake:list',\n] as const\n\n/**\nBrowser operations intentionally exposed by the datalake data plane.\n*/\nexport const DATALAKE_DATA_OPERATIONS = [\n 'payload:append',\n 'payload:read',\n 'usage:read',\n] as const\n\nexport type DatalakeControlOperation = typeof DATALAKE_CONTROL_OPERATIONS[number]\nexport type DatalakeDataOperation = typeof DATALAKE_DATA_OPERATIONS[number]\nexport type DatalakeOperation = DatalakeControlOperation | DatalakeDataOperation\n\n/**\nCanonical complete scope strings used when requesting browser wallet approval.\n*/\nexport const DATALAKE_CONTROL_SCOPE = DATALAKE_CONTROL_OPERATIONS.join(' ')\nexport const DATALAKE_DATA_SCOPE = DATALAKE_DATA_OPERATIONS.join(' ')\n\nexport function isDatalakeControlOperation(value: string): value is DatalakeControlOperation {\n return (DATALAKE_CONTROL_OPERATIONS as readonly string[]).includes(value)\n}\n\nexport function isDatalakeDataOperation(value: string): value is DatalakeDataOperation {\n return (DATALAKE_DATA_OPERATIONS as readonly string[]).includes(value)\n}\n", "/**\n * Datalake service tiers. Each tier maps to a storage driver + resource profile\n * on the control plane: small/medium use the shared hot pool, large gets a\n * dedicated RestDataLake pod, archive uses the S3 + DynamoDB cold driver.\n */\nexport type DatalakeTier = 'small' | 'medium' | 'large' | 'archive'\n\nexport const DATALAKE_TIERS: readonly DatalakeTier[] = ['small', 'medium', 'large', 'archive'] as const\n"],
|
|
5
|
+
"mappings": ";AAwBO,IAAM,mBAAiD;AAAA,EAC5D,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACZ;AAMO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAoB;AAC9C,UAAM,KAAK,OAAO;AAClB,SAAK,OAAO;AACZ,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS;AACd,SAAK,YAAY,KAAK;AAAA,EACxB;AACF;;;AC7CO,IAAM,uBAAuB;AAE7B,SAAS,yBAAiC;AAC/C,SAAO,IAAI,oBAAoB;AACjC;AAEO,SAAS,qBAAqB,UAA0B;AAC7D,SAAO,GAAG,uBAAuB,CAAC,IAAI,mBAAmB,QAAQ,CAAC;AACpE;AAEO,SAAS,mBAAmB,UAA0B;AAC3D,SAAO,GAAG,qBAAqB,QAAQ,CAAC;AAC1C;AAEO,SAAS,kBAAkB,UAAkB,WAA2B;AAC7E,SAAO,GAAG,mBAAmB,QAAQ,CAAC,IAAI,mBAAmB,SAAS,CAAC;AACzE;AAEO,SAAS,mBAAmB,UAA0B;AAC3D,SAAO,GAAG,qBAAqB,QAAQ,CAAC;AAC1C;AAEO,SAAS,qBAA6B;AAC3C,SAAO,IAAI,oBAAoB;AACjC;;;AChBO,IAAM,6BAA6B;AAMnC,IAAM,2BAA2B;AAMjC,IAAM,8BAA8B;AAEpC,SAAS,0BAA0B,IAAoB;AAC5D,SAAO,IAAI,oBAAoB,cAAc,mBAAmB,EAAE,CAAC;AACrE;AAEO,SAAS,wBAAwB,IAAoB;AAC1D,SAAO,GAAG,0BAA0B,EAAE,CAAC;AACzC;AAEO,SAAS,qBAAqB,IAAY,MAAsB;AACrE,SAAO,GAAG,0BAA0B,EAAE,CAAC,QAAQ,mBAAmB,IAAI,CAAC;AACzE;AAEO,SAAS,yBAAyB,IAAoB;AAC3D,SAAO,GAAG,0BAA0B,EAAE,CAAC;AACzC;AAEO,SAAS,sBAAsB,IAAoB;AACxD,SAAO,GAAG,0BAA0B,EAAE,CAAC;AACzC;AAEO,SAAS,wBAAwB,IAAY,MAAsB;AACxE,SAAO,GAAG,0BAA0B,EAAE,CAAC,WAAW,mBAAmB,IAAI,CAAC;AAC5E;AAEO,SAAS,uBAAuB,IAAoB;AACzD,SAAO,GAAG,0BAA0B,EAAE,CAAC;AACzC;AAEO,SAAS,uBAAuB,IAAoB;AACzD,SAAO,GAAG,0BAA0B,EAAE,CAAC;AACzC;;;AC7CO,IAAM,mBAAmB;AAKzB,SAAS,kBAAkB,WAAuC;AACvE,SAAO,cAAc;AACvB;;;ACdO,IAAM,mBAA8C,CAAC,aAAa,aAAa,WAAW;AAE1F,IAAM,iBAAiC;;;ACLvC,IAAM,4BAA4B;AAKlC,IAAM,6BAA6B;AAKnC,IAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF;AASO,IAAM,yBAAyB,4BAA4B,KAAK,GAAG;AACnE,IAAM,sBAAsB,yBAAyB,KAAK,GAAG;AAE7D,SAAS,2BAA2B,OAAkD;AAC3F,SAAQ,4BAAkD,SAAS,KAAK;AAC1E;AAEO,SAAS,wBAAwB,OAA+C;AACrF,SAAQ,yBAA+C,SAAS,KAAK;AACvE;;;ACrCO,IAAM,iBAA0C,CAAC,SAAS,UAAU,SAAS,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,9 +4,13 @@ import type { DatalakePrincipal, DatalakeRole } from './Principal.ts';
|
|
|
4
4
|
* (datalakeId, principal) pair; `role` is the highest privilege granted.
|
|
5
5
|
*/
|
|
6
6
|
export interface AclEntry {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
ISO-8601 timestamp of when the grant was created.
|
|
9
|
+
*/
|
|
8
10
|
grantedAt: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
Optional user id of the grantor.
|
|
13
|
+
*/
|
|
10
14
|
grantedBy?: string;
|
|
11
15
|
principal: DatalakePrincipal;
|
|
12
16
|
role: DatalakeRole;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AclEntry.d.ts","sourceRoot":"","sources":["../../../src/types/AclEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB
|
|
1
|
+
{"version":3,"file":"AclEntry.d.ts","sourceRoot":"","sources":["../../../src/types/AclEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;CACnB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
JSON values accepted and returned by the browser datalake wire API.
|
|
3
|
+
*/
|
|
2
4
|
export type JsonPrimitive = boolean | null | number | string;
|
|
3
5
|
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
4
6
|
export interface JsonObject {
|
|
@@ -10,19 +12,27 @@ export interface JsonObject {
|
|
|
10
12
|
*/
|
|
11
13
|
export interface Payload {
|
|
12
14
|
[key: string]: JsonValue | undefined;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Optional client-side lineage metadata.
|
|
17
|
+
*/
|
|
14
18
|
$sources?: string[];
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
XYO payload schema identifier.
|
|
21
|
+
*/
|
|
16
22
|
schema: string;
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
Storage metadata serialized by the datalake data plane.
|
|
26
|
+
*/
|
|
19
27
|
export interface StorageMeta {
|
|
20
28
|
_dataHash: string;
|
|
21
29
|
_hash: string;
|
|
22
30
|
_sequence: string;
|
|
23
31
|
}
|
|
24
32
|
export type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
|
|
25
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
A payload as it leaves the data plane after archivist processing.
|
|
35
|
+
*/
|
|
26
36
|
export type StoredPayload = WithStorageMeta<Payload>;
|
|
27
37
|
export interface NextPayloadsOptions {
|
|
28
38
|
cursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserPayload.d.ts","sourceRoot":"","sources":["../../../src/types/BrowserPayload.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BrowserPayload.d.ts","sourceRoot":"","sources":["../../../src/types/BrowserPayload.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,EAAE,CAAA;AAEhE,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;IACpC;;MAEE;IACF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB;;MAEE;IACF,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;EAEE;AACF,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,WAAW,CAAA;AAE1E;;EAEE;AACF,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,EAAE,CAAA;AAClD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,EAAE,CAAA;AACpD,MAAM,MAAM,sBAAsB,GAAG,aAAa,EAAE,CAAA;AAEpD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,OAAO,EAAE,qBAAqB,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B"}
|
|
@@ -5,11 +5,17 @@ import type { DatalakeTier } from './Tier.ts';
|
|
|
5
5
|
* optional except tier; the control plane applies defaults for the rest.
|
|
6
6
|
*/
|
|
7
7
|
export interface DatalakeConfig {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
Payload schemas allowed for insert; empty array means all allowed.
|
|
10
|
+
*/
|
|
9
11
|
allowedSchemas?: string[];
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
Payload schemas disallowed for insert.
|
|
14
|
+
*/
|
|
11
15
|
disallowedSchemas?: string[];
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
Provisioned IOPS target. Ignored for the archive tier.
|
|
18
|
+
*/
|
|
13
19
|
iops?: number;
|
|
14
20
|
/**
|
|
15
21
|
* Per-datalake rate-limit overrides. When omitted, the data plane's
|
|
@@ -17,13 +23,21 @@ export interface DatalakeConfig {
|
|
|
17
23
|
* datalakes or relax a limit for a trusted internal tenant.
|
|
18
24
|
*/
|
|
19
25
|
rateLimits?: RateLimitOverrides;
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
Deployment region.
|
|
28
|
+
*/
|
|
21
29
|
region?: DatalakeRegion;
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
Retention policy in days. `null` means keep forever.
|
|
32
|
+
*/
|
|
23
33
|
retentionDays?: number | null;
|
|
24
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
Provisioned capacity in bytes. Ignored for the archive tier.
|
|
36
|
+
*/
|
|
25
37
|
sizeBytes?: number;
|
|
26
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
Service tier (controls storage driver, IOPS ceiling, compute shape).
|
|
40
|
+
*/
|
|
27
41
|
tier: DatalakeTier;
|
|
28
42
|
/**
|
|
29
43
|
* Reserved. The archivist always recomputes `_hash` and `_dataHash` from
|
|
@@ -36,9 +50,13 @@ export interface DatalakeConfig {
|
|
|
36
50
|
verifyHashes?: boolean;
|
|
37
51
|
}
|
|
38
52
|
export interface RateLimitOverrides {
|
|
39
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
Max anonymous requests per minute.
|
|
55
|
+
*/
|
|
40
56
|
anonymousPerMinute?: number;
|
|
41
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
Max authenticated requests per minute.
|
|
59
|
+
*/
|
|
42
60
|
authenticatedPerMinute?: number;
|
|
43
61
|
/**
|
|
44
62
|
* Burst multiplier (1 = no burst). Bucket capacity = perMinute * burstFactor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalakeConfig.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B
|
|
1
|
+
{"version":3,"file":"DatalakeConfig.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;MAEE;IACF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB;;MAEE;IACF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B;;MAEE;IACF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B;;MAEE;IACF,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;MAEE;IACF,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;MAEE;IACF,IAAI,EAAE,YAAY,CAAA;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC;;MAEE;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;MAEE;IACF,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -6,26 +6,46 @@ import type { DatalakeStatus } from './Status.ts';
|
|
|
6
6
|
* `DatalakeClient.describe`, `DatalakeClient.list`, and `DatalakeClient.create`.
|
|
7
7
|
*/
|
|
8
8
|
export interface DatalakeDescriptor {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Access grants. Owner is implicit and not listed here.
|
|
11
|
+
*/
|
|
10
12
|
acl: AclEntry[];
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
Requested configuration.
|
|
15
|
+
*/
|
|
12
16
|
config: DatalakeConfig;
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
ISO-8601 timestamps.
|
|
19
|
+
*/
|
|
14
20
|
createdAt: string;
|
|
15
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
Human-readable message when status === 'error'.
|
|
23
|
+
*/
|
|
16
24
|
errorMessage?: string;
|
|
17
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
Opaque server-assigned id.
|
|
27
|
+
*/
|
|
18
28
|
id: string;
|
|
19
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
Human-friendly name scoped to the owner.
|
|
31
|
+
*/
|
|
20
32
|
name: string;
|
|
21
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
User id of the owner.
|
|
35
|
+
*/
|
|
22
36
|
ownerId: string;
|
|
23
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
Current lifecycle state.
|
|
39
|
+
*/
|
|
24
40
|
status: DatalakeStatus;
|
|
25
41
|
updatedAt: string;
|
|
26
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
Public HTTPS URL of the RestDataLake endpoint (set once status === 'ready').
|
|
44
|
+
*/
|
|
27
45
|
url?: string;
|
|
28
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
Current usage, refreshed periodically by the control plane.
|
|
48
|
+
*/
|
|
29
49
|
usage?: DatalakeUsage;
|
|
30
50
|
}
|
|
31
51
|
export interface DatalakeUsage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalakeDescriptor.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC
|
|
1
|
+
{"version":3,"file":"DatalakeDescriptor.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;MAEE;IACF,GAAG,EAAE,QAAQ,EAAE,CAAA;IACf;;MAEE;IACF,MAAM,EAAE,cAAc,CAAA;IACtB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;MAEE;IACF,EAAE,EAAE,MAAM,CAAA;IACV;;MAEE;IACF,IAAI,EAAE,MAAM,CAAA;IACZ;;MAEE;IACF,OAAO,EAAE,MAAM,CAAA;IACf;;MAEE;IACF,MAAM,EAAE,cAAc,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;MAEE;IACF,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
Audience used by browser wallet JWTs for control-plane operations.
|
|
3
|
+
*/
|
|
2
4
|
export declare const DATALAKE_CONTROL_AUDIENCE = "aries-datalake-control";
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
Schema required on every wallet sign-in JWT accepted by Aries.
|
|
7
|
+
*/
|
|
4
8
|
export declare const DATALAKE_WALLET_JWT_SCHEMA = "network.xyo.auth.signin";
|
|
5
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Browser operations intentionally exposed by the datalake control plane.
|
|
11
|
+
*/
|
|
6
12
|
export declare const DATALAKE_CONTROL_OPERATIONS: readonly ["datalake:create", "datalake:describe", "datalake:list"];
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
Browser operations intentionally exposed by the datalake data plane.
|
|
15
|
+
*/
|
|
8
16
|
export declare const DATALAKE_DATA_OPERATIONS: readonly ["payload:append", "payload:read", "usage:read"];
|
|
9
17
|
export type DatalakeControlOperation = typeof DATALAKE_CONTROL_OPERATIONS[number];
|
|
10
18
|
export type DatalakeDataOperation = typeof DATALAKE_DATA_OPERATIONS[number];
|
|
11
19
|
export type DatalakeOperation = DatalakeControlOperation | DatalakeDataOperation;
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
Canonical complete scope strings used when requesting browser wallet approval.
|
|
22
|
+
*/
|
|
13
23
|
export declare const DATALAKE_CONTROL_SCOPE: string;
|
|
14
24
|
export declare const DATALAKE_DATA_SCOPE: string;
|
|
15
25
|
export declare function isDatalakeControlOperation(value: string): value is DatalakeControlOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/types/Scope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/types/Scope.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,eAAO,MAAM,yBAAyB,2BAA2B,CAAA;AAEjE;;EAEE;AACF,eAAO,MAAM,0BAA0B,4BAA4B,CAAA;AAEnE;;EAEE;AACF,eAAO,MAAM,2BAA2B,oEAI9B,CAAA;AAEV;;EAEE;AACF,eAAO,MAAM,wBAAwB,2DAI3B,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAA;AACjF,MAAM,MAAM,qBAAqB,GAAG,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAA;AAC3E,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,GAAG,qBAAqB,CAAA;AAEhF;;EAEE;AACF,eAAO,MAAM,sBAAsB,QAAwC,CAAA;AAC3E,eAAO,MAAM,mBAAmB,QAAqC,CAAA;AAErE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,wBAAwB,CAE3F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,qBAAqB,CAErF"}
|
|
@@ -4,15 +4,25 @@ import type { DatalakeRole } from './Principal.ts';
|
|
|
4
4
|
* or CI. Expires; refresh via the control plane.
|
|
5
5
|
*/
|
|
6
6
|
export interface DatalakeToken {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
Datalake id the token is scoped to.
|
|
9
|
+
*/
|
|
8
10
|
datalakeId: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
ISO-8601 expiration.
|
|
13
|
+
*/
|
|
10
14
|
expiresAt: string;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Granted role.
|
|
17
|
+
*/
|
|
12
18
|
role: DatalakeRole;
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
The raw JWT string.
|
|
21
|
+
*/
|
|
14
22
|
token: string;
|
|
15
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
The URL the token should be used against.
|
|
25
|
+
*/
|
|
16
26
|
url: string;
|
|
17
27
|
}
|
|
18
28
|
//# sourceMappingURL=Token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../src/types/Token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../src/types/Token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;MAEE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,IAAI,EAAE,YAAY,CAAA;IAClB;;MAEE;IACF,KAAK,EAAE,MAAM,CAAA;IACb;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;CACZ"}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
export interface ApiErrorBody {
|
|
7
7
|
code: ApiErrorCode;
|
|
8
8
|
message: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Optional request-correlation id for server logs.
|
|
11
|
+
*/
|
|
10
12
|
requestId?: string;
|
|
11
13
|
}
|
|
12
14
|
export type ApiErrorCode = 'bad_request' | 'unauthorized' | 'forbidden' | 'not_found' | 'conflict' | 'unprocessable' | 'rate_limited' | 'internal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/api/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,YAAY,GAClB,aAAa,GACb,cAAc,GACd,WAAW,GACX,WAAW,GACX,UAAU,GACV,eAAe,GACf,cAAc,GACd,UAAU,CAAA;AAEhB,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CASzD,CAAA;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAEX,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;CAO/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/api/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAA;IACZ
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/api/health.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAA;IACZ;;MAEE;IACF,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -6,15 +6,25 @@
|
|
|
6
6
|
* them via `verifySessionToken`.
|
|
7
7
|
*/
|
|
8
8
|
export interface SessionTokenPayload {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Expiration (seconds since epoch).
|
|
11
|
+
*/
|
|
10
12
|
exp: number;
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
Issued-at (seconds since epoch).
|
|
15
|
+
*/
|
|
12
16
|
iat: number;
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
Unique token id.
|
|
19
|
+
*/
|
|
14
20
|
jti: string;
|
|
15
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
Wallet address that authenticated; used as the `ownerId`.
|
|
23
|
+
*/
|
|
16
24
|
sub: string;
|
|
17
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
Token kind. Always `'session'` for this codec.
|
|
27
|
+
*/
|
|
18
28
|
typ: 'session';
|
|
19
29
|
}
|
|
20
30
|
export interface SignSessionTokenInput {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTokenCodec.d.ts","sourceRoot":"","sources":["../../../src/auth/sessionTokenCodec.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"sessionTokenCodec.d.ts","sourceRoot":"","sources":["../../../src/auth/sessionTokenCodec.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH,MAAM,WAAW,mBAAmB;IAClC;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;IACX;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;IACX;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;IACX;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;IACX;;MAEE;IACF,GAAG,EAAE,SAAS,CAAA;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAOD,wBAAgB,gBAA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|
export interface TokenPayload {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
Datalake id the token grants access to.
|
|
12
|
+
*/
|
|
11
13
|
dl: string;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
Expiration (seconds since epoch).
|
|
16
|
+
*/
|
|
13
17
|
exp: number;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
Issued-at (seconds since epoch).
|
|
20
|
+
*/
|
|
15
21
|
iat: number;
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
Unique token id — helpful for future revocation lists.
|
|
24
|
+
*/
|
|
17
25
|
jti: string;
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
Role granted.
|
|
28
|
+
*/
|
|
19
29
|
role: DatalakeRole;
|
|
20
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
Owner (user id) that minted the token.
|
|
32
|
+
*/
|
|
21
33
|
sub: string;
|
|
22
34
|
}
|
|
23
35
|
export interface SignTokenInput {
|
|
@@ -35,7 +47,9 @@ export declare class TokenVerificationError extends Error {
|
|
|
35
47
|
constructor(code: TokenVerificationErrorCode, message: string);
|
|
36
48
|
}
|
|
37
49
|
export interface VerifyTokenInput {
|
|
38
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
Current wall-clock time (seconds since epoch). Injectable for tests.
|
|
52
|
+
*/
|
|
39
53
|
now?: number;
|
|
40
54
|
signingSecret: string;
|
|
41
55
|
token: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenCodec.d.ts","sourceRoot":"","sources":["../../../src/auth/tokenCodec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAKtD;;;;;GAKG;AAEH,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"tokenCodec.d.ts","sourceRoot":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1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/errors.ts", "../../src/api/paths.ts", "../../src/api/planePaths.ts", "../../src/auth/sessionTokenCodec.ts", "../../src/auth/strictHs256.ts", "../../src/auth/tokenCodec.ts", "../../src/store/DatalakeStore.ts", "../../src/types/Principal.ts", "../../src/types/Region.ts", "../../src/types/Scope.ts", "../../src/types/Tier.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Standard error body returned by the control plane for any non-2xx response.\n * The `code` is a stable machine-readable identifier; `message` is the\n * human-readable description.\n */\nexport interface ApiErrorBody {\n code: ApiErrorCode\n message: string\n /** Optional request-correlation id for server logs. */\n requestId?: string\n}\n\nexport type ApiErrorCode\n = | 'bad_request'\n | 'unauthorized'\n | 'forbidden'\n | 'not_found'\n | 'conflict'\n | 'unprocessable'\n | 'rate_limited'\n | 'internal'\n\nexport const API_ERROR_STATUS: Record<ApiErrorCode, number> = {\n bad_request: 400,\n unauthorized: 401,\n forbidden: 403,\n not_found: 404,\n conflict: 409,\n unprocessable: 422,\n rate_limited: 429,\n internal: 500,\n}\n\n/**\n * Thrown by `RestDatalakeClient` when the server returns a non-2xx response.\n * Carries the structured error body so callers can branch on `.code`.\n */\nexport class DatalakeApiError extends Error {\n readonly code: ApiErrorCode\n readonly requestId?: string\n readonly status: number\n\n constructor(status: number, body: ApiErrorBody) {\n super(body.message)\n this.name = 'DatalakeApiError'\n this.code = body.code\n this.status = status\n this.requestId = body.requestId\n }\n}\n", "/**\n * Canonical path builders for the datalake control-plane HTTP API.\n * Both the REST client and the control-plane service import from here so\n * the wire contract has a single source of truth.\n */\n\nexport const DATALAKE_API_VERSION = 'v1'\n\nexport function datalakeCollectionPath(): string {\n return `/${DATALAKE_API_VERSION}/datalakes`\n}\n\nexport function datalakeResourcePath(idOrName: string): string {\n return `${datalakeCollectionPath()}/${encodeURIComponent(idOrName)}`\n}\n\nexport function datalakeGrantsPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/grants`\n}\n\nexport function datalakeGrantPath(idOrName: string, principal: string): string {\n return `${datalakeGrantsPath(idOrName)}/${encodeURIComponent(principal)}`\n}\n\nexport function datalakeTokensPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/tokens`\n}\n\nexport function datalakeHealthPath(): string {\n return `/${DATALAKE_API_VERSION}/health`\n}\n", "/**\n * Data-plane path builders. The data plane is addressed by datalake id\n * (globally unique), not by name (which is scoped to owner). Route names\n * mirror the XYO archivist REST middleware (`/insert`, `/get/:hash`, `/next`)\n * so a generic archivist client can talk to a datalake-plane after picking\n * the per-datalake prefix.\n */\n\nimport { DATALAKE_API_VERSION } from './paths.ts'\n\n/**\n * Header that conveys how many payloads in the insert request were skipped\n * because their hash already existed in the datalake.\n */\nexport const DATALAKE_HEADER_DUPLICATES = 'x-datalake-duplicates'\n\n/**\n * Header that conveys the comma-separated list of archivist-computed\n * `_hash` values rejected by the datalake's schema policy.\n */\nexport const DATALAKE_HEADER_REJECTED = 'x-datalake-rejected'\n\n/**\n * Header that conveys the cursor (`_sequence`) of the last payload in a\n * `next` response page, when more pages may exist.\n */\nexport const DATALAKE_HEADER_NEXT_CURSOR = 'x-datalake-next-cursor'\n\nexport function datalakePlaneResourcePath(id: string): string {\n return `/${DATALAKE_API_VERSION}/datalakes/${encodeURIComponent(id)}`\n}\n\nexport function datalakePlaneInsertPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/insert`\n}\n\nexport function datalakePlaneGetPath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/get/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneGetManyPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/get`\n}\n\nexport function datalakePlaneNextPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/next`\n}\n\nexport function datalakePlaneDeletePath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/delete/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneClearPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/clear`\n}\n\nexport function datalakePlaneUsagePath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/usage`\n}\n", "import { createHmac, randomBytes } from 'node:crypto'\n\nimport {\n assertExactKeys, isFiniteInteger, isNonEmptyString, StrictHs256Error, verifyStrictHs256,\n} from './strictHs256.ts'\n\n/**\n * Session tokens issued after a successful XYO Wallet sign-in. The wire\n * format mirrors `tokenCodec.ts` (HS256 JWT) but the payload carries no\n * `dl` claim \u2014 sessions are scoped to a user (wallet address), not a\n * single datalake. The control plane mints these; both planes verify\n * them via `verifySessionToken`.\n */\n\nexport interface SessionTokenPayload {\n /** Expiration (seconds since epoch). */\n exp: number\n /** Issued-at (seconds since epoch). */\n iat: number\n /** Unique token id. */\n jti: string\n /** Wallet address that authenticated; used as the `ownerId`. */\n sub: string\n /** Token kind. Always `'session'` for this codec. */\n typ: 'session'\n}\n\nexport interface SignSessionTokenInput {\n address: string\n signingSecret: string\n ttlSeconds: number\n}\n\nexport interface SignedSessionToken {\n expiresAt: string\n token: string\n}\n\nfunction base64UrlEncode(input: Buffer | string): string {\n const buffer = typeof input === 'string' ? Buffer.from(input) : input\n return buffer.toString('base64url')\n}\n\nexport function signSessionToken(input: SignSessionTokenInput): SignedSessionToken {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: SessionTokenPayload = {\n sub: input.address.toLowerCase(),\n typ: 'session',\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n token: `${toSign}.${signature}`,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n }\n}\n\nexport type SessionTokenVerificationErrorCode = 'malformed' | 'bad_signature' | 'expired' | 'not_yet_valid' | 'wrong_type'\n\nexport class SessionTokenVerificationError extends Error {\n readonly code: SessionTokenVerificationErrorCode\n\n constructor(code: SessionTokenVerificationErrorCode, message: string) {\n super(message)\n this.name = 'SessionTokenVerificationError'\n this.code = code\n }\n}\n\nexport interface VerifySessionTokenInput {\n now?: number\n signingSecret: string\n token: string\n}\n\nexport function verifySessionToken(input: VerifySessionTokenInput): SessionTokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.token, input.signingSecret).payload\n assertExactKeys(raw, ['exp', 'iat', 'jti', 'sub', 'typ'], 'Payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new SessionTokenVerificationError(error.code, error.message)\n }\n throw error\n }\n if (raw.typ !== 'session') {\n throw new SessionTokenVerificationError('wrong_type', 'Not a session token')\n }\n if (!isNonEmptyString(raw.sub)) throw new SessionTokenVerificationError('malformed', 'Payload sub must be a non-empty string')\n if (!isNonEmptyString(raw.jti)) throw new SessionTokenVerificationError('malformed', 'Payload jti must be a non-empty string')\n if (!isFiniteInteger(raw.iat)) throw new SessionTokenVerificationError('malformed', 'Payload iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new SessionTokenVerificationError('malformed', 'Payload exp must be a finite integer')\n if (raw.exp <= raw.iat) throw new SessionTokenVerificationError('malformed', 'Payload exp must be greater than iat')\n\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (raw.exp <= now) {\n throw new SessionTokenVerificationError('expired', 'Token has expired')\n }\n if (raw.iat > now + 60) {\n throw new SessionTokenVerificationError('not_yet_valid', 'Token issued in the future')\n }\n return {\n sub: raw.sub,\n typ: raw.typ,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n}\n\n/**\n * Single-use challenge token. The wallet signs the entire `token` string\n * (the wallet doesn't need to parse it). The server stores no state \u2014 it\n * just verifies its own signature on the challenge then verifies the\n * wallet's signature over the challenge string.\n */\n\nexport interface ChallengeTokenPayload {\n address: string\n exp: number\n iat: number\n jti: string\n typ: 'challenge'\n}\n\nexport interface SignChallengeInput {\n address: string\n signingSecret: string\n ttlSeconds: number\n}\n\nexport interface SignedChallenge {\n challenge: string\n expiresAt: string\n}\n\nexport function signChallenge(input: SignChallengeInput): SignedChallenge {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: ChallengeTokenPayload = {\n address: input.address.toLowerCase(),\n typ: 'challenge',\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n challenge: `${toSign}.${signature}`,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n }\n}\n\nexport function verifyChallenge(input: { challenge: string; now?: number; signingSecret: string }): ChallengeTokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.challenge, input.signingSecret).payload\n assertExactKeys(raw, ['address', 'exp', 'iat', 'jti', 'typ'], 'Challenge payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new SessionTokenVerificationError(error.code, error.message)\n }\n throw error\n }\n if (raw.typ !== 'challenge') {\n throw new SessionTokenVerificationError('wrong_type', 'Not a challenge token')\n }\n if (!isNonEmptyString(raw.address) || !/^(?:0x)?[\\da-fA-F]{40}$/.test(raw.address)) {\n throw new SessionTokenVerificationError('malformed', 'Challenge address must be a 20-byte hex address')\n }\n if (!isNonEmptyString(raw.jti)) throw new SessionTokenVerificationError('malformed', 'Challenge jti must be a non-empty string')\n if (!isFiniteInteger(raw.iat)) throw new SessionTokenVerificationError('malformed', 'Challenge iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new SessionTokenVerificationError('malformed', 'Challenge exp must be a finite integer')\n if (raw.exp <= raw.iat) throw new SessionTokenVerificationError('malformed', 'Challenge exp must be greater than iat')\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (raw.exp <= now) {\n throw new SessionTokenVerificationError('expired', 'Challenge has expired')\n }\n if (raw.iat > now + 60) {\n throw new SessionTokenVerificationError('not_yet_valid', 'Challenge issued in the future')\n }\n return {\n address: raw.address,\n typ: raw.typ,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n}\n", "import { createHmac, timingSafeEqual } from 'node:crypto'\n\nexport type StrictHs256ErrorCode = 'bad_signature' | 'malformed'\n\nexport class StrictHs256Error extends Error {\n readonly code: StrictHs256ErrorCode\n\n constructor(code: StrictHs256ErrorCode, message: string) {\n super(message)\n this.name = 'StrictHs256Error'\n this.code = code\n }\n}\n\nexport interface StrictHs256Parts {\n payload: Record<string, unknown>\n}\n\nexport function verifyStrictHs256(token: string, signingSecret: string): StrictHs256Parts {\n const parts = token.split('.')\n if (parts.length !== 3) {\n throw new StrictHs256Error('malformed', 'Token is not a JWS compact serialization')\n }\n const [headerPart, payloadPart, signaturePart] = parts as [string, string, string]\n const header = decodeJsonObject(headerPart, 'Header')\n assertExactKeys(header, ['alg', 'typ'], 'Header')\n if (header.alg !== 'HS256') throw new StrictHs256Error('malformed', 'Header alg must be HS256')\n if (header.typ !== 'JWT') throw new StrictHs256Error('malformed', 'Header typ must be JWT')\n\n const provided = decodeBase64Url(signaturePart, 'Signature')\n const expected = createHmac('sha256', signingSecret)\n .update(`${headerPart}.${payloadPart}`)\n .digest()\n if (provided.length !== expected.length || !timingSafeEqual(provided, expected)) {\n throw new StrictHs256Error('bad_signature', 'Signature mismatch')\n }\n\n return { payload: decodeJsonObject(payloadPart, 'Payload') }\n}\n\nexport function assertExactKeys(\n value: Record<string, unknown>,\n expected: readonly string[],\n label: string,\n): void {\n const actual = Object.keys(value).sort()\n const canonical = [...expected].sort()\n if (actual.length !== canonical.length || actual.some((key, index) => key !== canonical[index])) {\n throw new StrictHs256Error('malformed', `${label} fields must be exactly: ${canonical.join(', ')}`)\n }\n}\n\nexport function isFiniteInteger(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value)\n}\n\nexport function isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0\n}\n\nfunction decodeJsonObject(value: string, label: string): Record<string, unknown> {\n let parsed: unknown\n try {\n parsed = JSON.parse(decodeBase64Url(value, label).toString('utf8'))\n } catch (error) {\n if (error instanceof StrictHs256Error) throw error\n throw new StrictHs256Error('malformed', `${label} is not valid JSON`)\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n throw new StrictHs256Error('malformed', `${label} must be a JSON object`)\n }\n return parsed as Record<string, unknown>\n}\n\nfunction decodeBase64Url(value: string, label: string): Buffer {\n if (value.length === 0 || !/^[\\w-]+$/.test(value)) {\n throw new StrictHs256Error('malformed', `${label} is not canonical base64url`)\n }\n const decoded = Buffer.from(value, 'base64url')\n if (decoded.toString('base64url') !== value) {\n throw new StrictHs256Error('malformed', `${label} is not canonical base64url`)\n }\n return decoded\n}\n", "import { createHmac, randomBytes } from 'node:crypto'\n\nimport type { DatalakeRole } from '../types/Principal.ts'\nimport type { DatalakeToken } from '../types/Token.ts'\nimport {\n assertExactKeys, isFiniteInteger, isNonEmptyString, StrictHs256Error, verifyStrictHs256,\n} from './strictHs256.ts'\n\n/**\n * HS256 token layout used for data-plane access. The signature is a small\n * subset of RFC 7519 \u2014 enough to interoperate with any JWT verifier but tiny\n * enough to implement without pulling a full JWT library. Replace with a\n * proper OIDC-signed JWT in P3.\n */\n\nexport interface TokenPayload {\n /** Datalake id the token grants access to. */\n dl: string\n /** Expiration (seconds since epoch). */\n exp: number\n /** Issued-at (seconds since epoch). */\n iat: number\n /** Unique token id \u2014 helpful for future revocation lists. */\n jti: string\n /** Role granted. */\n role: DatalakeRole\n /** Owner (user id) that minted the token. */\n sub: string\n}\n\nexport interface SignTokenInput {\n datalakeId: string\n ownerId: string\n role: DatalakeRole\n signingSecret: string\n ttlSeconds: number\n url: string\n}\n\nfunction base64UrlEncode(input: Buffer | string): string {\n const buffer = typeof input === 'string' ? Buffer.from(input) : input\n return buffer.toString('base64url')\n}\n\nexport function signToken(input: SignTokenInput): DatalakeToken {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: TokenPayload = {\n sub: input.ownerId,\n dl: input.datalakeId,\n role: input.role,\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n token: `${toSign}.${signature}`,\n datalakeId: input.datalakeId,\n role: input.role,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n url: input.url,\n }\n}\n\nexport type TokenVerificationErrorCode = 'malformed' | 'bad_signature' | 'expired' | 'not_yet_valid'\n\nexport class TokenVerificationError extends Error {\n readonly code: TokenVerificationErrorCode\n\n constructor(code: TokenVerificationErrorCode, message: string) {\n super(message)\n this.name = 'TokenVerificationError'\n this.code = code\n }\n}\n\nexport interface VerifyTokenInput {\n /** Current wall-clock time (seconds since epoch). Injectable for tests. */\n now?: number\n signingSecret: string\n token: string\n}\n\n/**\n * Verifies an HS256 token issued by `signToken` and returns its payload.\n * Throws `TokenVerificationError` if the token is malformed, bears a bad\n * signature, or has expired.\n */\nexport function verifyToken(input: VerifyTokenInput): TokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.token, input.signingSecret).payload\n assertExactKeys(raw, ['dl', 'exp', 'iat', 'jti', 'role', 'sub'], 'Payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new TokenVerificationError(error.code, error.message)\n }\n throw error\n }\n\n if (!isNonEmptyString(raw.sub)) throw new TokenVerificationError('malformed', 'Payload sub must be a non-empty string')\n if (!isNonEmptyString(raw.dl)) throw new TokenVerificationError('malformed', 'Payload dl must be a non-empty string')\n if (raw.role !== 'viewer' && raw.role !== 'runner') {\n throw new TokenVerificationError('malformed', 'Payload role must be viewer or runner')\n }\n if (!isFiniteInteger(raw.iat)) throw new TokenVerificationError('malformed', 'Payload iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new TokenVerificationError('malformed', 'Payload exp must be a finite integer')\n if (!isNonEmptyString(raw.jti)) throw new TokenVerificationError('malformed', 'Payload jti must be a non-empty string')\n if (raw.exp <= raw.iat) throw new TokenVerificationError('malformed', 'Payload exp must be greater than iat')\n\n const payload: TokenPayload = {\n sub: raw.sub,\n dl: raw.dl,\n role: raw.role,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (payload.exp <= now) {\n throw new TokenVerificationError('expired', 'Token has expired')\n }\n if (payload.iat > now + 60) {\n // Allow 60 seconds of clock skew into the future.\n throw new TokenVerificationError('not_yet_valid', 'Token issued in the future')\n }\n return payload\n}\n", "import type { AclEntry } from '../types/AclEntry.ts'\nimport type { DatalakeDescriptor } from '../types/DatalakeDescriptor.ts'\nimport type { DatalakePrincipal, DatalakeRole } from '../types/Principal.ts'\n\n/**\n * Storage interface for the control plane. Lives in `datalake-core` so\n * decorators (`@ariestools/aries-datalake-k8s-bridge`) and alternate\n * implementations can depend on the contract without taking a dependency\n * on the full control plane.\n *\n * The in-memory implementation is used in development and for tests; a\n * Postgres-backed implementation handles production. Both ship in\n * `@ariestools/aries-datalake-control`.\n */\nexport interface DatalakeStore {\n /** Find by globally unique id (no owner scoping). Used by the data plane. */\n findById(id: string): Promise<DatalakeDescriptor | undefined>\n /** Find by id or name, scoped to a single owner. */\n findByIdOrName(ownerId: string, idOrName: string): Promise<DatalakeDescriptor | undefined>\n /** Insert a fresh descriptor. Caller fills in id/timestamps. */\n insert(descriptor: DatalakeDescriptor): Promise<void>\n /** Return all datalakes owned by the given user. */\n listByOwner(ownerId: string): Promise<DatalakeDescriptor[]>\n /** Remove a datalake. */\n remove(id: string): Promise<void>\n /** Drop an ACL entry by principal. */\n removeAcl(id: string, principal: DatalakePrincipal): Promise<DatalakeDescriptor>\n /** Replace an existing descriptor (full update). */\n update(descriptor: DatalakeDescriptor): Promise<void>\n /** Add or overwrite an ACL entry on a datalake, returning the updated descriptor. */\n upsertAcl(id: string, entry: AclEntry): Promise<DatalakeDescriptor>\n}\n\n/**\n * Roles considered higher privilege than others. Used when merging grants.\n */\nexport const ROLE_RANK: Record<DatalakeRole, number> = {\n viewer: 1,\n runner: 2,\n}\n", "/**\n * Access-control role granted to a principal on a datalake.\n * Maps 1:1 to XL1's DataLakeViewer (read) and DataLakeRunner (read/write) monikers.\n */\nexport type DatalakeRole = 'viewer' | 'runner'\n\n/**\n * A principal identifier. Either a control-plane user id, or the reserved\n * value `PUBLIC_PRINCIPAL` (`'public'`) which opens access to unauthenticated\n * callers at the granted role.\n */\nexport type DatalakePrincipal = string\n\nexport const PUBLIC_PRINCIPAL = 'public'\n\n/**\n * Type guard for the reserved `public` principal.\n */\nexport function isPublicPrincipal(principal: DatalakePrincipal): boolean {\n return principal === PUBLIC_PRINCIPAL\n}\n", "/**\n * Cloud regions where datalakes can be provisioned. Starts with AWS us-west-2;\n * additional regions are added as the control plane expands.\n */\nexport type DatalakeRegion = 'us-west-2' | 'us-east-1' | 'eu-west-1'\n\nexport const DATALAKE_REGIONS: readonly DatalakeRegion[] = ['us-west-2', 'us-east-1', 'eu-west-1'] as const\n\nexport const DEFAULT_REGION: DatalakeRegion = 'us-west-2'\n", "/** Audience used by browser wallet JWTs for control-plane operations. */\nexport const DATALAKE_CONTROL_AUDIENCE = 'aries-datalake-control'\n\n/** Schema required on every wallet sign-in JWT accepted by Aries. */\nexport const DATALAKE_WALLET_JWT_SCHEMA = 'network.xyo.auth.signin'\n\n/** Browser operations intentionally exposed by the datalake control plane. */\nexport const DATALAKE_CONTROL_OPERATIONS = [\n 'datalake:create',\n 'datalake:describe',\n 'datalake:list',\n] as const\n\n/** Browser operations intentionally exposed by the datalake data plane. */\nexport const DATALAKE_DATA_OPERATIONS = [\n 'payload:append',\n 'payload:read',\n 'usage:read',\n] as const\n\nexport type DatalakeControlOperation = typeof DATALAKE_CONTROL_OPERATIONS[number]\nexport type DatalakeDataOperation = typeof DATALAKE_DATA_OPERATIONS[number]\nexport type DatalakeOperation = DatalakeControlOperation | DatalakeDataOperation\n\n/** Canonical complete scope strings used when requesting browser wallet approval. */\nexport const DATALAKE_CONTROL_SCOPE = DATALAKE_CONTROL_OPERATIONS.join(' ')\nexport const DATALAKE_DATA_SCOPE = DATALAKE_DATA_OPERATIONS.join(' ')\n\nexport function isDatalakeControlOperation(value: string): value is DatalakeControlOperation {\n return (DATALAKE_CONTROL_OPERATIONS as readonly string[]).includes(value)\n}\n\nexport function isDatalakeDataOperation(value: string): value is DatalakeDataOperation {\n return (DATALAKE_DATA_OPERATIONS as readonly string[]).includes(value)\n}\n", "/**\n * Datalake service tiers. Each tier maps to a storage driver + resource profile\n * on the control plane: small/medium use the shared hot pool, large gets a\n * dedicated RestDataLake pod, archive uses the S3 + DynamoDB cold driver.\n */\nexport type DatalakeTier = 'small' | 'medium' | 'large' | 'archive'\n\nexport const DATALAKE_TIERS: readonly DatalakeTier[] = ['small', 'medium', 'large', 'archive'] as const\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Standard error body returned by the control plane for any non-2xx response.\n * The `code` is a stable machine-readable identifier; `message` is the\n * human-readable description.\n */\nexport interface ApiErrorBody {\n code: ApiErrorCode\n message: string\n /**\n Optional request-correlation id for server logs.\n */\n requestId?: string\n}\n\nexport type ApiErrorCode\n = | 'bad_request'\n | 'unauthorized'\n | 'forbidden'\n | 'not_found'\n | 'conflict'\n | 'unprocessable'\n | 'rate_limited'\n | 'internal'\n\nexport const API_ERROR_STATUS: Record<ApiErrorCode, number> = {\n bad_request: 400,\n unauthorized: 401,\n forbidden: 403,\n not_found: 404,\n conflict: 409,\n unprocessable: 422,\n rate_limited: 429,\n internal: 500,\n}\n\n/**\n * Thrown by `RestDatalakeClient` when the server returns a non-2xx response.\n * Carries the structured error body so callers can branch on `.code`.\n */\nexport class DatalakeApiError extends Error {\n readonly code: ApiErrorCode\n readonly requestId?: string\n readonly status: number\n\n constructor(status: number, body: ApiErrorBody) {\n super(body.message)\n this.name = 'DatalakeApiError'\n this.code = body.code\n this.status = status\n this.requestId = body.requestId\n }\n}\n", "/**\n * Canonical path builders for the datalake control-plane HTTP API.\n * Both the REST client and the control-plane service import from here so\n * the wire contract has a single source of truth.\n */\n\nexport const DATALAKE_API_VERSION = 'v1'\n\nexport function datalakeCollectionPath(): string {\n return `/${DATALAKE_API_VERSION}/datalakes`\n}\n\nexport function datalakeResourcePath(idOrName: string): string {\n return `${datalakeCollectionPath()}/${encodeURIComponent(idOrName)}`\n}\n\nexport function datalakeGrantsPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/grants`\n}\n\nexport function datalakeGrantPath(idOrName: string, principal: string): string {\n return `${datalakeGrantsPath(idOrName)}/${encodeURIComponent(principal)}`\n}\n\nexport function datalakeTokensPath(idOrName: string): string {\n return `${datalakeResourcePath(idOrName)}/tokens`\n}\n\nexport function datalakeHealthPath(): string {\n return `/${DATALAKE_API_VERSION}/health`\n}\n", "/**\n * Data-plane path builders. The data plane is addressed by datalake id\n * (globally unique), not by name (which is scoped to owner). Route names\n * mirror the XYO archivist REST middleware (`/insert`, `/get/:hash`, `/next`)\n * so a generic archivist client can talk to a datalake-plane after picking\n * the per-datalake prefix.\n */\n\nimport { DATALAKE_API_VERSION } from './paths.ts'\n\n/**\n * Header that conveys how many payloads in the insert request were skipped\n * because their hash already existed in the datalake.\n */\nexport const DATALAKE_HEADER_DUPLICATES = 'x-datalake-duplicates'\n\n/**\n * Header that conveys the comma-separated list of archivist-computed\n * `_hash` values rejected by the datalake's schema policy.\n */\nexport const DATALAKE_HEADER_REJECTED = 'x-datalake-rejected'\n\n/**\n * Header that conveys the cursor (`_sequence`) of the last payload in a\n * `next` response page, when more pages may exist.\n */\nexport const DATALAKE_HEADER_NEXT_CURSOR = 'x-datalake-next-cursor'\n\nexport function datalakePlaneResourcePath(id: string): string {\n return `/${DATALAKE_API_VERSION}/datalakes/${encodeURIComponent(id)}`\n}\n\nexport function datalakePlaneInsertPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/insert`\n}\n\nexport function datalakePlaneGetPath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/get/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneGetManyPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/get`\n}\n\nexport function datalakePlaneNextPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/next`\n}\n\nexport function datalakePlaneDeletePath(id: string, hash: string): string {\n return `${datalakePlaneResourcePath(id)}/delete/${encodeURIComponent(hash)}`\n}\n\nexport function datalakePlaneClearPath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/clear`\n}\n\nexport function datalakePlaneUsagePath(id: string): string {\n return `${datalakePlaneResourcePath(id)}/usage`\n}\n", "import { createHmac, randomBytes } from 'node:crypto'\n\nimport {\n assertExactKeys, isFiniteInteger, isNonEmptyString, StrictHs256Error, verifyStrictHs256,\n} from './strictHs256.ts'\n\n/**\n * Session tokens issued after a successful XYO Wallet sign-in. The wire\n * format mirrors `tokenCodec.ts` (HS256 JWT) but the payload carries no\n * `dl` claim \u2014 sessions are scoped to a user (wallet address), not a\n * single datalake. The control plane mints these; both planes verify\n * them via `verifySessionToken`.\n */\n\nexport interface SessionTokenPayload {\n /**\n Expiration (seconds since epoch).\n */\n exp: number\n /**\n Issued-at (seconds since epoch).\n */\n iat: number\n /**\n Unique token id.\n */\n jti: string\n /**\n Wallet address that authenticated; used as the `ownerId`.\n */\n sub: string\n /**\n Token kind. Always `'session'` for this codec.\n */\n typ: 'session'\n}\n\nexport interface SignSessionTokenInput {\n address: string\n signingSecret: string\n ttlSeconds: number\n}\n\nexport interface SignedSessionToken {\n expiresAt: string\n token: string\n}\n\nfunction base64UrlEncode(input: Buffer | string): string {\n const buffer = typeof input === 'string' ? Buffer.from(input) : input\n return buffer.toString('base64url')\n}\n\nexport function signSessionToken(input: SignSessionTokenInput): SignedSessionToken {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: SessionTokenPayload = {\n sub: input.address.toLowerCase(),\n typ: 'session',\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n token: `${toSign}.${signature}`,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n }\n}\n\nexport type SessionTokenVerificationErrorCode = 'malformed' | 'bad_signature' | 'expired' | 'not_yet_valid' | 'wrong_type'\n\nexport class SessionTokenVerificationError extends Error {\n readonly code: SessionTokenVerificationErrorCode\n\n constructor(code: SessionTokenVerificationErrorCode, message: string) {\n super(message)\n this.name = 'SessionTokenVerificationError'\n this.code = code\n }\n}\n\nexport interface VerifySessionTokenInput {\n now?: number\n signingSecret: string\n token: string\n}\n\nexport function verifySessionToken(input: VerifySessionTokenInput): SessionTokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.token, input.signingSecret).payload\n assertExactKeys(raw, ['exp', 'iat', 'jti', 'sub', 'typ'], 'Payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new SessionTokenVerificationError(error.code, error.message)\n }\n throw error\n }\n if (raw.typ !== 'session') {\n throw new SessionTokenVerificationError('wrong_type', 'Not a session token')\n }\n if (!isNonEmptyString(raw.sub)) throw new SessionTokenVerificationError('malformed', 'Payload sub must be a non-empty string')\n if (!isNonEmptyString(raw.jti)) throw new SessionTokenVerificationError('malformed', 'Payload jti must be a non-empty string')\n if (!isFiniteInteger(raw.iat)) throw new SessionTokenVerificationError('malformed', 'Payload iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new SessionTokenVerificationError('malformed', 'Payload exp must be a finite integer')\n if (raw.exp <= raw.iat) throw new SessionTokenVerificationError('malformed', 'Payload exp must be greater than iat')\n\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (raw.exp <= now) {\n throw new SessionTokenVerificationError('expired', 'Token has expired')\n }\n if (raw.iat > now + 60) {\n throw new SessionTokenVerificationError('not_yet_valid', 'Token issued in the future')\n }\n return {\n sub: raw.sub,\n typ: raw.typ,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n}\n\n/**\n * Single-use challenge token. The wallet signs the entire `token` string\n * (the wallet doesn't need to parse it). The server stores no state \u2014 it\n * just verifies its own signature on the challenge then verifies the\n * wallet's signature over the challenge string.\n */\n\nexport interface ChallengeTokenPayload {\n address: string\n exp: number\n iat: number\n jti: string\n typ: 'challenge'\n}\n\nexport interface SignChallengeInput {\n address: string\n signingSecret: string\n ttlSeconds: number\n}\n\nexport interface SignedChallenge {\n challenge: string\n expiresAt: string\n}\n\nexport function signChallenge(input: SignChallengeInput): SignedChallenge {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: ChallengeTokenPayload = {\n address: input.address.toLowerCase(),\n typ: 'challenge',\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n challenge: `${toSign}.${signature}`,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n }\n}\n\nexport function verifyChallenge(input: { challenge: string; now?: number; signingSecret: string }): ChallengeTokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.challenge, input.signingSecret).payload\n assertExactKeys(raw, ['address', 'exp', 'iat', 'jti', 'typ'], 'Challenge payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new SessionTokenVerificationError(error.code, error.message)\n }\n throw error\n }\n if (raw.typ !== 'challenge') {\n throw new SessionTokenVerificationError('wrong_type', 'Not a challenge token')\n }\n if (!isNonEmptyString(raw.address) || !/^(?:0x)?[\\da-fA-F]{40}$/.test(raw.address)) {\n throw new SessionTokenVerificationError('malformed', 'Challenge address must be a 20-byte hex address')\n }\n if (!isNonEmptyString(raw.jti)) throw new SessionTokenVerificationError('malformed', 'Challenge jti must be a non-empty string')\n if (!isFiniteInteger(raw.iat)) throw new SessionTokenVerificationError('malformed', 'Challenge iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new SessionTokenVerificationError('malformed', 'Challenge exp must be a finite integer')\n if (raw.exp <= raw.iat) throw new SessionTokenVerificationError('malformed', 'Challenge exp must be greater than iat')\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (raw.exp <= now) {\n throw new SessionTokenVerificationError('expired', 'Challenge has expired')\n }\n if (raw.iat > now + 60) {\n throw new SessionTokenVerificationError('not_yet_valid', 'Challenge issued in the future')\n }\n return {\n address: raw.address,\n typ: raw.typ,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n}\n", "import { createHmac, timingSafeEqual } from 'node:crypto'\n\nexport type StrictHs256ErrorCode = 'bad_signature' | 'malformed'\n\nexport class StrictHs256Error extends Error {\n readonly code: StrictHs256ErrorCode\n\n constructor(code: StrictHs256ErrorCode, message: string) {\n super(message)\n this.name = 'StrictHs256Error'\n this.code = code\n }\n}\n\nexport interface StrictHs256Parts {\n payload: Record<string, unknown>\n}\n\nexport function verifyStrictHs256(token: string, signingSecret: string): StrictHs256Parts {\n const parts = token.split('.')\n if (parts.length !== 3) {\n throw new StrictHs256Error('malformed', 'Token is not a JWS compact serialization')\n }\n const [headerPart, payloadPart, signaturePart] = parts as [string, string, string]\n const header = decodeJsonObject(headerPart, 'Header')\n assertExactKeys(header, ['alg', 'typ'], 'Header')\n if (header.alg !== 'HS256') throw new StrictHs256Error('malformed', 'Header alg must be HS256')\n if (header.typ !== 'JWT') throw new StrictHs256Error('malformed', 'Header typ must be JWT')\n\n const provided = decodeBase64Url(signaturePart, 'Signature')\n const expected = createHmac('sha256', signingSecret)\n .update(`${headerPart}.${payloadPart}`)\n .digest()\n if (provided.length !== expected.length || !timingSafeEqual(provided, expected)) {\n throw new StrictHs256Error('bad_signature', 'Signature mismatch')\n }\n\n return { payload: decodeJsonObject(payloadPart, 'Payload') }\n}\n\nexport function assertExactKeys(\n value: Record<string, unknown>,\n expected: readonly string[],\n label: string,\n): void {\n const actual = Object.keys(value).sort()\n const canonical = [...expected].sort()\n if (actual.length !== canonical.length || actual.some((key, index) => key !== canonical[index])) {\n throw new StrictHs256Error('malformed', `${label} fields must be exactly: ${canonical.join(', ')}`)\n }\n}\n\nexport function isFiniteInteger(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value)\n}\n\nexport function isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.length > 0\n}\n\nfunction decodeJsonObject(value: string, label: string): Record<string, unknown> {\n let parsed: unknown\n try {\n parsed = JSON.parse(decodeBase64Url(value, label).toString('utf8'))\n } catch (error) {\n if (error instanceof StrictHs256Error) throw error\n throw new StrictHs256Error('malformed', `${label} is not valid JSON`)\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n throw new StrictHs256Error('malformed', `${label} must be a JSON object`)\n }\n return parsed as Record<string, unknown>\n}\n\nfunction decodeBase64Url(value: string, label: string): Buffer {\n if (value.length === 0 || !/^[\\w-]+$/.test(value)) {\n throw new StrictHs256Error('malformed', `${label} is not canonical base64url`)\n }\n const decoded = Buffer.from(value, 'base64url')\n if (decoded.toString('base64url') !== value) {\n throw new StrictHs256Error('malformed', `${label} is not canonical base64url`)\n }\n return decoded\n}\n", "import { createHmac, randomBytes } from 'node:crypto'\n\nimport type { DatalakeRole } from '../types/Principal.ts'\nimport type { DatalakeToken } from '../types/Token.ts'\nimport {\n assertExactKeys, isFiniteInteger, isNonEmptyString, StrictHs256Error, verifyStrictHs256,\n} from './strictHs256.ts'\n\n/**\n * HS256 token layout used for data-plane access. The signature is a small\n * subset of RFC 7519 \u2014 enough to interoperate with any JWT verifier but tiny\n * enough to implement without pulling a full JWT library. Replace with a\n * proper OIDC-signed JWT in P3.\n */\n\nexport interface TokenPayload {\n /**\n Datalake id the token grants access to.\n */\n dl: string\n /**\n Expiration (seconds since epoch).\n */\n exp: number\n /**\n Issued-at (seconds since epoch).\n */\n iat: number\n /**\n Unique token id \u2014 helpful for future revocation lists.\n */\n jti: string\n /**\n Role granted.\n */\n role: DatalakeRole\n /**\n Owner (user id) that minted the token.\n */\n sub: string\n}\n\nexport interface SignTokenInput {\n datalakeId: string\n ownerId: string\n role: DatalakeRole\n signingSecret: string\n ttlSeconds: number\n url: string\n}\n\nfunction base64UrlEncode(input: Buffer | string): string {\n const buffer = typeof input === 'string' ? Buffer.from(input) : input\n return buffer.toString('base64url')\n}\n\nexport function signToken(input: SignTokenInput): DatalakeToken {\n const issuedAt = Math.floor(Date.now() / 1000)\n const expiresAt = issuedAt + input.ttlSeconds\n const payload: TokenPayload = {\n sub: input.ownerId,\n dl: input.datalakeId,\n role: input.role,\n iat: issuedAt,\n exp: expiresAt,\n jti: randomBytes(8).toString('hex'),\n }\n const header = base64UrlEncode(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))\n const body = base64UrlEncode(JSON.stringify(payload))\n const toSign = `${header}.${body}`\n const signature = createHmac('sha256', input.signingSecret).update(toSign).digest('base64url')\n return {\n token: `${toSign}.${signature}`,\n datalakeId: input.datalakeId,\n role: input.role,\n expiresAt: new Date(expiresAt * 1000).toISOString(),\n url: input.url,\n }\n}\n\nexport type TokenVerificationErrorCode = 'malformed' | 'bad_signature' | 'expired' | 'not_yet_valid'\n\nexport class TokenVerificationError extends Error {\n readonly code: TokenVerificationErrorCode\n\n constructor(code: TokenVerificationErrorCode, message: string) {\n super(message)\n this.name = 'TokenVerificationError'\n this.code = code\n }\n}\n\nexport interface VerifyTokenInput {\n /**\n Current wall-clock time (seconds since epoch). Injectable for tests.\n */\n now?: number\n signingSecret: string\n token: string\n}\n\n/**\n * Verifies an HS256 token issued by `signToken` and returns its payload.\n * Throws `TokenVerificationError` if the token is malformed, bears a bad\n * signature, or has expired.\n */\nexport function verifyToken(input: VerifyTokenInput): TokenPayload {\n let raw: Record<string, unknown>\n try {\n raw = verifyStrictHs256(input.token, input.signingSecret).payload\n assertExactKeys(raw, ['dl', 'exp', 'iat', 'jti', 'role', 'sub'], 'Payload')\n } catch (error) {\n if (error instanceof StrictHs256Error) {\n throw new TokenVerificationError(error.code, error.message)\n }\n throw error\n }\n\n if (!isNonEmptyString(raw.sub)) throw new TokenVerificationError('malformed', 'Payload sub must be a non-empty string')\n if (!isNonEmptyString(raw.dl)) throw new TokenVerificationError('malformed', 'Payload dl must be a non-empty string')\n if (raw.role !== 'viewer' && raw.role !== 'runner') {\n throw new TokenVerificationError('malformed', 'Payload role must be viewer or runner')\n }\n if (!isFiniteInteger(raw.iat)) throw new TokenVerificationError('malformed', 'Payload iat must be a finite integer')\n if (!isFiniteInteger(raw.exp)) throw new TokenVerificationError('malformed', 'Payload exp must be a finite integer')\n if (!isNonEmptyString(raw.jti)) throw new TokenVerificationError('malformed', 'Payload jti must be a non-empty string')\n if (raw.exp <= raw.iat) throw new TokenVerificationError('malformed', 'Payload exp must be greater than iat')\n\n const payload: TokenPayload = {\n sub: raw.sub,\n dl: raw.dl,\n role: raw.role,\n iat: raw.iat,\n exp: raw.exp,\n jti: raw.jti,\n }\n\n const now = input.now ?? Math.floor(Date.now() / 1000)\n if (payload.exp <= now) {\n throw new TokenVerificationError('expired', 'Token has expired')\n }\n if (payload.iat > now + 60) {\n // Allow 60 seconds of clock skew into the future.\n throw new TokenVerificationError('not_yet_valid', 'Token issued in the future')\n }\n return payload\n}\n", "import type { AclEntry } from '../types/AclEntry.ts'\nimport type { DatalakeDescriptor } from '../types/DatalakeDescriptor.ts'\nimport type { DatalakePrincipal, DatalakeRole } from '../types/Principal.ts'\n\n/**\n * Storage interface for the control plane. Lives in `datalake-core` so\n * decorators (`@ariestools/aries-datalake-k8s-bridge`) and alternate\n * implementations can depend on the contract without taking a dependency\n * on the full control plane.\n *\n * The in-memory implementation is used in development and for tests; a\n * Postgres-backed implementation handles production. Both ship in\n * `@ariestools/aries-datalake-control`.\n */\nexport interface DatalakeStore {\n /**\n Find by globally unique id (no owner scoping). Used by the data plane.\n */\n findById(id: string): Promise<DatalakeDescriptor | undefined>\n /**\n Find by id or name, scoped to a single owner.\n */\n findByIdOrName(ownerId: string, idOrName: string): Promise<DatalakeDescriptor | undefined>\n /**\n Insert a fresh descriptor. Caller fills in id/timestamps.\n */\n insert(descriptor: DatalakeDescriptor): Promise<void>\n /**\n Return all datalakes owned by the given user.\n */\n listByOwner(ownerId: string): Promise<DatalakeDescriptor[]>\n /**\n Remove a datalake.\n */\n remove(id: string): Promise<void>\n /**\n Drop an ACL entry by principal.\n */\n removeAcl(id: string, principal: DatalakePrincipal): Promise<DatalakeDescriptor>\n /**\n Replace an existing descriptor (full update).\n */\n update(descriptor: DatalakeDescriptor): Promise<void>\n /**\n Add or overwrite an ACL entry on a datalake, returning the updated descriptor.\n */\n upsertAcl(id: string, entry: AclEntry): Promise<DatalakeDescriptor>\n}\n\n/**\n * Roles considered higher privilege than others. Used when merging grants.\n */\nexport const ROLE_RANK: Record<DatalakeRole, number> = {\n viewer: 1,\n runner: 2,\n}\n", "/**\n * Access-control role granted to a principal on a datalake.\n * Maps 1:1 to XL1's DataLakeViewer (read) and DataLakeRunner (read/write) monikers.\n */\nexport type DatalakeRole = 'viewer' | 'runner'\n\n/**\n * A principal identifier. Either a control-plane user id, or the reserved\n * value `PUBLIC_PRINCIPAL` (`'public'`) which opens access to unauthenticated\n * callers at the granted role.\n */\nexport type DatalakePrincipal = string\n\nexport const PUBLIC_PRINCIPAL = 'public'\n\n/**\n * Type guard for the reserved `public` principal.\n */\nexport function isPublicPrincipal(principal: DatalakePrincipal): boolean {\n return principal === PUBLIC_PRINCIPAL\n}\n", "/**\n * Cloud regions where datalakes can be provisioned. Starts with AWS us-west-2;\n * additional regions are added as the control plane expands.\n */\nexport type DatalakeRegion = 'us-west-2' | 'us-east-1' | 'eu-west-1'\n\nexport const DATALAKE_REGIONS: readonly DatalakeRegion[] = ['us-west-2', 'us-east-1', 'eu-west-1'] as const\n\nexport const DEFAULT_REGION: DatalakeRegion = 'us-west-2'\n", "/**\nAudience used by browser wallet JWTs for control-plane operations.\n*/\nexport const DATALAKE_CONTROL_AUDIENCE = 'aries-datalake-control'\n\n/**\nSchema required on every wallet sign-in JWT accepted by Aries.\n*/\nexport const DATALAKE_WALLET_JWT_SCHEMA = 'network.xyo.auth.signin'\n\n/**\nBrowser operations intentionally exposed by the datalake control plane.\n*/\nexport const DATALAKE_CONTROL_OPERATIONS = [\n 'datalake:create',\n 'datalake:describe',\n 'datalake:list',\n] as const\n\n/**\nBrowser operations intentionally exposed by the datalake data plane.\n*/\nexport const DATALAKE_DATA_OPERATIONS = [\n 'payload:append',\n 'payload:read',\n 'usage:read',\n] as const\n\nexport type DatalakeControlOperation = typeof DATALAKE_CONTROL_OPERATIONS[number]\nexport type DatalakeDataOperation = typeof DATALAKE_DATA_OPERATIONS[number]\nexport type DatalakeOperation = DatalakeControlOperation | DatalakeDataOperation\n\n/**\nCanonical complete scope strings used when requesting browser wallet approval.\n*/\nexport const DATALAKE_CONTROL_SCOPE = DATALAKE_CONTROL_OPERATIONS.join(' ')\nexport const DATALAKE_DATA_SCOPE = DATALAKE_DATA_OPERATIONS.join(' ')\n\nexport function isDatalakeControlOperation(value: string): value is DatalakeControlOperation {\n return (DATALAKE_CONTROL_OPERATIONS as readonly string[]).includes(value)\n}\n\nexport function isDatalakeDataOperation(value: string): value is DatalakeDataOperation {\n return (DATALAKE_DATA_OPERATIONS as readonly string[]).includes(value)\n}\n", "/**\n * Datalake service tiers. Each tier maps to a storage driver + resource profile\n * on the control plane: small/medium use the shared hot pool, large gets a\n * dedicated RestDataLake pod, archive uses the S3 + DynamoDB cold driver.\n */\nexport type DatalakeTier = 'small' | 'medium' | 'large' | 'archive'\n\nexport const DATALAKE_TIERS: readonly DatalakeTier[] = ['small', 'medium', 'large', 'archive'] as const\n"],
|
|
5
|
+
"mappings": ";AAwBO,IAAM,mBAAiD;AAAA,EAC5D,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AACZ;AAMO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAgB,MAAoB;AAC9C,UAAM,KAAK,OAAO;AAClB,SAAK,OAAO;AACZ,SAAK,OAAO,KAAK;AACjB,SAAK,SAAS;AACd,SAAK,YAAY,KAAK;AAAA,EACxB;AACF;;;AC7CO,IAAM,uBAAuB;AAE7B,SAAS,yBAAiC;AAC/C,SAAO,IAAI,oBAAoB;AACjC;AAEO,SAAS,qBAAqB,UAA0B;AAC7D,SAAO,GAAG,uBAAuB,CAAC,IAAI,mBAAmB,QAAQ,CAAC;AACpE;AAEO,SAAS,mBAAmB,UAA0B;AAC3D,SAAO,GAAG,qBAAqB,QAAQ,CAAC;AAC1C;AAEO,SAAS,kBAAkB,UAAkB,WAA2B;AAC7E,SAAO,GAAG,mBAAmB,QAAQ,CAAC,IAAI,mBAAmB,SAAS,CAAC;AACzE;AAEO,SAAS,mBAAmB,UAA0B;AAC3D,SAAO,GAAG,qBAAqB,QAAQ,CAAC;AAC1C;AAEO,SAAS,qBAA6B;AAC3C,SAAO,IAAI,oBAAoB;AACjC;;;AChBO,IAAM,6BAA6B;AAMnC,IAAM,2BAA2B;A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AAS,UAAU,SAAS,SAAS;",
|
|
6
6
|
"names": ["createHmac", "createHmac", "createHmac", "randomBytes", "base64UrlEncode", "randomBytes", "createHmac"]
|
|
7
7
|
}
|
|
@@ -12,21 +12,37 @@ import type { DatalakePrincipal, DatalakeRole } from '../types/Principal.ts';
|
|
|
12
12
|
* `@ariestools/aries-datalake-control`.
|
|
13
13
|
*/
|
|
14
14
|
export interface DatalakeStore {
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Find by globally unique id (no owner scoping). Used by the data plane.
|
|
17
|
+
*/
|
|
16
18
|
findById(id: string): Promise<DatalakeDescriptor | undefined>;
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
Find by id or name, scoped to a single owner.
|
|
21
|
+
*/
|
|
18
22
|
findByIdOrName(ownerId: string, idOrName: string): Promise<DatalakeDescriptor | undefined>;
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
Insert a fresh descriptor. Caller fills in id/timestamps.
|
|
25
|
+
*/
|
|
20
26
|
insert(descriptor: DatalakeDescriptor): Promise<void>;
|
|
21
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
Return all datalakes owned by the given user.
|
|
29
|
+
*/
|
|
22
30
|
listByOwner(ownerId: string): Promise<DatalakeDescriptor[]>;
|
|
23
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
Remove a datalake.
|
|
33
|
+
*/
|
|
24
34
|
remove(id: string): Promise<void>;
|
|
25
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
Drop an ACL entry by principal.
|
|
37
|
+
*/
|
|
26
38
|
removeAcl(id: string, principal: DatalakePrincipal): Promise<DatalakeDescriptor>;
|
|
27
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
Replace an existing descriptor (full update).
|
|
41
|
+
*/
|
|
28
42
|
update(descriptor: DatalakeDescriptor): Promise<void>;
|
|
29
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
Add or overwrite an ACL entry on a datalake, returning the updated descriptor.
|
|
45
|
+
*/
|
|
30
46
|
upsertAcl(id: string, entry: AclEntry): Promise<DatalakeDescriptor>;
|
|
31
47
|
}
|
|
32
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalakeStore.d.ts","sourceRoot":"","sources":["../../../src/store/DatalakeStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"DatalakeStore.d.ts","sourceRoot":"","sources":["../../../src/store/DatalakeStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B;;MAEE;IACF,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAA;IAC7D;;MAEE;IACF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAA;IAC1F;;MAEE;IACF,MAAM,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrD;;MAEE;IACF,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAC3D;;MAEE;IACF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC;;MAEE;IACF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChF;;MAEE;IACF,MAAM,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrD;;MAEE;IACF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACpE;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAGlD,CAAA"}
|
|
@@ -4,9 +4,13 @@ import type { DatalakePrincipal, DatalakeRole } from './Principal.ts';
|
|
|
4
4
|
* (datalakeId, principal) pair; `role` is the highest privilege granted.
|
|
5
5
|
*/
|
|
6
6
|
export interface AclEntry {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
ISO-8601 timestamp of when the grant was created.
|
|
9
|
+
*/
|
|
8
10
|
grantedAt: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
Optional user id of the grantor.
|
|
13
|
+
*/
|
|
10
14
|
grantedBy?: string;
|
|
11
15
|
principal: DatalakePrincipal;
|
|
12
16
|
role: DatalakeRole;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AclEntry.d.ts","sourceRoot":"","sources":["../../../src/types/AclEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB
|
|
1
|
+
{"version":3,"file":"AclEntry.d.ts","sourceRoot":"","sources":["../../../src/types/AclEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,YAAY,CAAA;CACnB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
JSON values accepted and returned by the browser datalake wire API.
|
|
3
|
+
*/
|
|
2
4
|
export type JsonPrimitive = boolean | null | number | string;
|
|
3
5
|
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
4
6
|
export interface JsonObject {
|
|
@@ -10,19 +12,27 @@ export interface JsonObject {
|
|
|
10
12
|
*/
|
|
11
13
|
export interface Payload {
|
|
12
14
|
[key: string]: JsonValue | undefined;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Optional client-side lineage metadata.
|
|
17
|
+
*/
|
|
14
18
|
$sources?: string[];
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
XYO payload schema identifier.
|
|
21
|
+
*/
|
|
16
22
|
schema: string;
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
Storage metadata serialized by the datalake data plane.
|
|
26
|
+
*/
|
|
19
27
|
export interface StorageMeta {
|
|
20
28
|
_dataHash: string;
|
|
21
29
|
_hash: string;
|
|
22
30
|
_sequence: string;
|
|
23
31
|
}
|
|
24
32
|
export type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
|
|
25
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
A payload as it leaves the data plane after archivist processing.
|
|
35
|
+
*/
|
|
26
36
|
export type StoredPayload = WithStorageMeta<Payload>;
|
|
27
37
|
export interface NextPayloadsOptions {
|
|
28
38
|
cursor?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserPayload.d.ts","sourceRoot":"","sources":["../../../src/types/BrowserPayload.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BrowserPayload.d.ts","sourceRoot":"","sources":["../../../src/types/BrowserPayload.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,EAAE,CAAA;AAEhE,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;IACpC;;MAEE;IACF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB;;MAEE;IACF,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;EAEE;AACF,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,WAAW,CAAA;AAE1E;;EAEE;AACF,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,EAAE,CAAA;AAClD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,EAAE,CAAA;AACpD,MAAM,MAAM,sBAAsB,GAAG,aAAa,EAAE,CAAA;AAEpD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,OAAO,EAAE,qBAAqB,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B"}
|
|
@@ -5,11 +5,17 @@ import type { DatalakeTier } from './Tier.ts';
|
|
|
5
5
|
* optional except tier; the control plane applies defaults for the rest.
|
|
6
6
|
*/
|
|
7
7
|
export interface DatalakeConfig {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
Payload schemas allowed for insert; empty array means all allowed.
|
|
10
|
+
*/
|
|
9
11
|
allowedSchemas?: string[];
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
Payload schemas disallowed for insert.
|
|
14
|
+
*/
|
|
11
15
|
disallowedSchemas?: string[];
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
Provisioned IOPS target. Ignored for the archive tier.
|
|
18
|
+
*/
|
|
13
19
|
iops?: number;
|
|
14
20
|
/**
|
|
15
21
|
* Per-datalake rate-limit overrides. When omitted, the data plane's
|
|
@@ -17,13 +23,21 @@ export interface DatalakeConfig {
|
|
|
17
23
|
* datalakes or relax a limit for a trusted internal tenant.
|
|
18
24
|
*/
|
|
19
25
|
rateLimits?: RateLimitOverrides;
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
Deployment region.
|
|
28
|
+
*/
|
|
21
29
|
region?: DatalakeRegion;
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
Retention policy in days. `null` means keep forever.
|
|
32
|
+
*/
|
|
23
33
|
retentionDays?: number | null;
|
|
24
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
Provisioned capacity in bytes. Ignored for the archive tier.
|
|
36
|
+
*/
|
|
25
37
|
sizeBytes?: number;
|
|
26
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
Service tier (controls storage driver, IOPS ceiling, compute shape).
|
|
40
|
+
*/
|
|
27
41
|
tier: DatalakeTier;
|
|
28
42
|
/**
|
|
29
43
|
* Reserved. The archivist always recomputes `_hash` and `_dataHash` from
|
|
@@ -36,9 +50,13 @@ export interface DatalakeConfig {
|
|
|
36
50
|
verifyHashes?: boolean;
|
|
37
51
|
}
|
|
38
52
|
export interface RateLimitOverrides {
|
|
39
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
Max anonymous requests per minute.
|
|
55
|
+
*/
|
|
40
56
|
anonymousPerMinute?: number;
|
|
41
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
Max authenticated requests per minute.
|
|
59
|
+
*/
|
|
42
60
|
authenticatedPerMinute?: number;
|
|
43
61
|
/**
|
|
44
62
|
* Burst multiplier (1 = no burst). Bucket capacity = perMinute * burstFactor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalakeConfig.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B
|
|
1
|
+
{"version":3,"file":"DatalakeConfig.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;MAEE;IACF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB;;MAEE;IACF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B;;MAEE;IACF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B;;MAEE;IACF,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;MAEE;IACF,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;MAEE;IACF,IAAI,EAAE,YAAY,CAAA;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC;;MAEE;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;MAEE;IACF,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -6,26 +6,46 @@ import type { DatalakeStatus } from './Status.ts';
|
|
|
6
6
|
* `DatalakeClient.describe`, `DatalakeClient.list`, and `DatalakeClient.create`.
|
|
7
7
|
*/
|
|
8
8
|
export interface DatalakeDescriptor {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Access grants. Owner is implicit and not listed here.
|
|
11
|
+
*/
|
|
10
12
|
acl: AclEntry[];
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
Requested configuration.
|
|
15
|
+
*/
|
|
12
16
|
config: DatalakeConfig;
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
ISO-8601 timestamps.
|
|
19
|
+
*/
|
|
14
20
|
createdAt: string;
|
|
15
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
Human-readable message when status === 'error'.
|
|
23
|
+
*/
|
|
16
24
|
errorMessage?: string;
|
|
17
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
Opaque server-assigned id.
|
|
27
|
+
*/
|
|
18
28
|
id: string;
|
|
19
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
Human-friendly name scoped to the owner.
|
|
31
|
+
*/
|
|
20
32
|
name: string;
|
|
21
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
User id of the owner.
|
|
35
|
+
*/
|
|
22
36
|
ownerId: string;
|
|
23
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
Current lifecycle state.
|
|
39
|
+
*/
|
|
24
40
|
status: DatalakeStatus;
|
|
25
41
|
updatedAt: string;
|
|
26
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
Public HTTPS URL of the RestDataLake endpoint (set once status === 'ready').
|
|
44
|
+
*/
|
|
27
45
|
url?: string;
|
|
28
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
Current usage, refreshed periodically by the control plane.
|
|
48
|
+
*/
|
|
29
49
|
usage?: DatalakeUsage;
|
|
30
50
|
}
|
|
31
51
|
export interface DatalakeUsage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalakeDescriptor.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC
|
|
1
|
+
{"version":3,"file":"DatalakeDescriptor.d.ts","sourceRoot":"","sources":["../../../src/types/DatalakeDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;MAEE;IACF,GAAG,EAAE,QAAQ,EAAE,CAAA;IACf;;MAEE;IACF,MAAM,EAAE,cAAc,CAAA;IACtB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;MAEE;IACF,EAAE,EAAE,MAAM,CAAA;IACV;;MAEE;IACF,IAAI,EAAE,MAAM,CAAA;IACZ;;MAEE;IACF,OAAO,EAAE,MAAM,CAAA;IACf;;MAEE;IACF,MAAM,EAAE,cAAc,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;MAEE;IACF,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -18,13 +18,21 @@ export type StoredPayload = WithStorageMeta<Payload>;
|
|
|
18
18
|
* `_sequence` of the last payload returned (archivist-canonical).
|
|
19
19
|
*/
|
|
20
20
|
export interface NextPayloadsOptions {
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
Resume after this sequence (exclusive).
|
|
23
|
+
*/
|
|
22
24
|
cursor?: string;
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
Maximum payloads to return. Server caps this.
|
|
27
|
+
*/
|
|
24
28
|
limit?: number;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
Sort direction by archivist-assigned sequence.
|
|
31
|
+
*/
|
|
26
32
|
order?: 'asc' | 'desc';
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
Restrict to payloads whose schema matches one of these.
|
|
35
|
+
*/
|
|
28
36
|
schemas?: string[];
|
|
29
37
|
}
|
|
30
38
|
/**
|
|
@@ -51,9 +59,13 @@ export type InsertPayloadsResponse = StoredPayload[];
|
|
|
51
59
|
* ignore them.
|
|
52
60
|
*/
|
|
53
61
|
export interface DatalakeInsertSummary {
|
|
54
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
Payloads in the request whose hash already existed in the datalake.
|
|
64
|
+
*/
|
|
55
65
|
duplicates: number;
|
|
56
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
Archivist-computed `_hash` values that were rejected by schema policy.
|
|
68
|
+
*/
|
|
57
69
|
rejected: string[];
|
|
58
70
|
}
|
|
59
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../../src/types/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AAEvF;;;;;;;;GAQG;AACH,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AAEvF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AAEpD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../../src/types/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AAEvF;;;;;;;;GAQG;AACH,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AAEvF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;AAEpD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;MAEE;IACF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;MAEE;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;MAEE;IACF,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB;;MAEE;IACF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,EAAE,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,EAAE,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,EAAE,CAAA;AAEpD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;MAEE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB;;MAEE;IACF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,OAAO,EAAE,qBAAqB,CAAA;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,aAAa,EAAE,CAAA;CAC1B"}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
Audience used by browser wallet JWTs for control-plane operations.
|
|
3
|
+
*/
|
|
2
4
|
export declare const DATALAKE_CONTROL_AUDIENCE = "aries-datalake-control";
|
|
3
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
Schema required on every wallet sign-in JWT accepted by Aries.
|
|
7
|
+
*/
|
|
4
8
|
export declare const DATALAKE_WALLET_JWT_SCHEMA = "network.xyo.auth.signin";
|
|
5
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
Browser operations intentionally exposed by the datalake control plane.
|
|
11
|
+
*/
|
|
6
12
|
export declare const DATALAKE_CONTROL_OPERATIONS: readonly ["datalake:create", "datalake:describe", "datalake:list"];
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
Browser operations intentionally exposed by the datalake data plane.
|
|
15
|
+
*/
|
|
8
16
|
export declare const DATALAKE_DATA_OPERATIONS: readonly ["payload:append", "payload:read", "usage:read"];
|
|
9
17
|
export type DatalakeControlOperation = typeof DATALAKE_CONTROL_OPERATIONS[number];
|
|
10
18
|
export type DatalakeDataOperation = typeof DATALAKE_DATA_OPERATIONS[number];
|
|
11
19
|
export type DatalakeOperation = DatalakeControlOperation | DatalakeDataOperation;
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
Canonical complete scope strings used when requesting browser wallet approval.
|
|
22
|
+
*/
|
|
13
23
|
export declare const DATALAKE_CONTROL_SCOPE: string;
|
|
14
24
|
export declare const DATALAKE_DATA_SCOPE: string;
|
|
15
25
|
export declare function isDatalakeControlOperation(value: string): value is DatalakeControlOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/types/Scope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/types/Scope.ts"],"names":[],"mappings":"AAAA;;EAEE;AACF,eAAO,MAAM,yBAAyB,2BAA2B,CAAA;AAEjE;;EAEE;AACF,eAAO,MAAM,0BAA0B,4BAA4B,CAAA;AAEnE;;EAEE;AACF,eAAO,MAAM,2BAA2B,oEAI9B,CAAA;AAEV;;EAEE;AACF,eAAO,MAAM,wBAAwB,2DAI3B,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAA;AACjF,MAAM,MAAM,qBAAqB,GAAG,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAA;AAC3E,MAAM,MAAM,iBAAiB,GAAG,wBAAwB,GAAG,qBAAqB,CAAA;AAEhF;;EAEE;AACF,eAAO,MAAM,sBAAsB,QAAwC,CAAA;AAC3E,eAAO,MAAM,mBAAmB,QAAqC,CAAA;AAErE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,wBAAwB,CAE3F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,qBAAqB,CAErF"}
|
|
@@ -4,15 +4,25 @@ import type { DatalakeRole } from './Principal.ts';
|
|
|
4
4
|
* or CI. Expires; refresh via the control plane.
|
|
5
5
|
*/
|
|
6
6
|
export interface DatalakeToken {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
Datalake id the token is scoped to.
|
|
9
|
+
*/
|
|
8
10
|
datalakeId: string;
|
|
9
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
ISO-8601 expiration.
|
|
13
|
+
*/
|
|
10
14
|
expiresAt: string;
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
Granted role.
|
|
17
|
+
*/
|
|
12
18
|
role: DatalakeRole;
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
The raw JWT string.
|
|
21
|
+
*/
|
|
14
22
|
token: string;
|
|
15
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
The URL the token should be used against.
|
|
25
|
+
*/
|
|
16
26
|
url: string;
|
|
17
27
|
}
|
|
18
28
|
//# sourceMappingURL=Token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../src/types/Token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../../src/types/Token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;MAEE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB;;MAEE;IACF,SAAS,EAAE,MAAM,CAAA;IACjB;;MAEE;IACF,IAAI,EAAE,YAAY,CAAA;IAClB;;MAEE;IACF,KAAK,EAAE,MAAM,CAAA;IACb;;MAEE;IACF,GAAG,EAAE,MAAM,CAAA;CACZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariestools/aries-datalake-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Shared types and contracts for Aries on-demand XL1 datalake provisioning",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@ariestools/toolchain": "~
|
|
46
|
-
"@ariestools/tsconfig": "~
|
|
47
|
-
"@types/node": "~26.
|
|
48
|
-
"@xyo-network/sdk-protocol": "~7.2.
|
|
45
|
+
"@ariestools/toolchain": "~9.0.2",
|
|
46
|
+
"@ariestools/tsconfig": "~9.0.2",
|
|
47
|
+
"@types/node": "~26.2.0",
|
|
48
|
+
"@xyo-network/sdk-protocol": "~7.2.4",
|
|
49
49
|
"typescript": "~6.0.3",
|
|
50
|
-
"vite": "~8.1
|
|
50
|
+
"vite": "~8.2.1",
|
|
51
51
|
"vitest": "~4.1.10"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|