@ariestools/datalake-cli 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,3 +15,27 @@ import { createDatalakeClient, ExactRootArchive, startRetainedDatalake } from '@
15
15
  ```
16
16
 
17
17
  `startRetainedDatalake` forks `retainedDatalakeWorker.mjs` from beside the library. The worker bundles the private control and plane, so installing this package needs no private or restricted package.
18
+
19
+ Its type declarations are the facade's own: self-contained, with payloads typed as JSON values and the payload client taking and returning `unknown`, so code written against `@ariestools/cli/datalake` compiles once its import path changes.
20
+
21
+ ### Retained local datalake
22
+
23
+ `startRetainedDatalake` starts a datalake for disposable local
24
+ qualification. It owns an isolated loopback worker and returns `url`, `restart()`
25
+ and `stop()`. Supply an absolute `directory` and, for a new corpus, a
26
+ `DatalakeDescriptor`. The directory holds public descriptor/payload data only;
27
+ the signing secret is ephemeral. Restart retains the endpoint and refuses to
28
+ recreate a missing descriptor or overwrite a conflicting descriptor. A successful
29
+ stop means the owned child and its pipes have closed. Readiness and stop deadlines
30
+ are configurable positive integers up to 60 seconds.
31
+
32
+ Optional `initialPayloads` seed at most 4096 public bodies and 16 MiB into a newly
33
+ created descriptor. They are never replayed during restart; trying to seed an
34
+ existing descriptor fails. This is a local fixture facility, not a managed
35
+ production service or an account recovery journal.
36
+
37
+ The same export provides `ExactRootArchive` and its self-contained types.
38
+ It requires a trusted native-root `identify` callback, explicit resource limits,
39
+ and an append-only token supplier. Reads are anonymous and verify original roots.
40
+ A matching hash establishes integrity; the consuming protocol decides authority
41
+ and admissibility. No private control/plane dependency is needed downstream.
@@ -1,19 +1,346 @@
1
- /**
2
- * The programmatic datalake surface of `@ariestools/datalake-cli`, which
3
- * replaces `@ariestools/cli/datalake`: the public client and core APIs, the
4
- * local dev-server inspection, and a retained local datalake for fixtures.
5
- * The client and core are public dependencies; the retained datalake's worker
6
- * bundles the private control and plane, so consumers install no private
7
- * package.
8
- */
9
- export type { RetainedDatalake, RetainedDatalakeOptions } from './retainedDatalake.ts';
10
- export { startRetainedDatalake } from './retainedDatalake.ts';
11
- export type { CreateDatalakeClientOptions } from '@ariestools/aries-datalake-client';
12
- export type { AuthTokenSource, DatalakeClient, PayloadsAuthTokenSource, PayloadsClient, RestDatalakeClientOptions, RestPayloadsClientOptions, StoredCredentials, WalletJwtCredentials, } from '@ariestools/aries-datalake-client';
13
- export type { ExactRootArchiveBody, ExactRootArchiveCallOptions, ExactRootArchiveErrorCode, ExactRootArchiveLimits, ExactRootArchiveOptions, ExactRootArchiveRoot, ExactRootArchiveTokenRequest, ExactRootArchiveWriteState, } from '@ariestools/aries-datalake-client';
14
- export { clearCredentials, clearDefaultDatalake, createDatalakeClient, getCredentialsLocation, getDefaultDatalake, loadCredentials, LocalDatalakeClient, RestDatalakeClient, RestPayloadsClient, saveCredentials, setDefaultDatalake, } from '@ariestools/aries-datalake-client';
15
- export { ExactRootArchive, ExactRootArchiveError } from '@ariestools/aries-datalake-client';
16
- export type { DatalakeDevServerEndpointReport, DatalakeDevServerExitCode, DatalakeDevServerReport, DatalakeDevServerStatus, InspectDatalakeDevServerOptions, } from '@ariestools/aries-datalake-client/dev';
17
- export { inspectDatalakeDevServer } from '@ariestools/aries-datalake-client/dev';
18
- export type { DatalakeDescriptor, Payload } from '@ariestools/aries-datalake-core';
19
- //# sourceMappingURL=index.d.ts.map
1
+ /** Programmatic datalake client API of @ariestools/datalake-cli, self-contained: it names no other package's types. */
2
+
3
+ export interface AuthTokenRequest {
4
+ audience: string
5
+ }
6
+ export type AuthTokenSupplier = (request: AuthTokenRequest) => Promise<string>
7
+ export type AuthTokenSource = string | AuthTokenSupplier
8
+ export type PayloadsAuthTokenSource = AuthTokenSource
9
+
10
+ export type DatalakeRole = 'viewer' | 'runner'
11
+ export type DatalakePrincipal = string
12
+ export type DatalakeTier = 'small' | 'medium' | 'large' | 'archive'
13
+ export type DatalakeRegion = 'us-west-2' | 'us-east-1' | 'eu-west-1'
14
+ export type DatalakeStatus =
15
+ | 'pending'
16
+ | 'provisioning'
17
+ | 'ready'
18
+ | 'resizing'
19
+ | 'deprovisioning'
20
+ | 'deleted'
21
+ | 'error'
22
+
23
+ export interface RateLimitOverrides {
24
+ anonymousPerMinute?: number
25
+ authenticatedPerMinute?: number
26
+ burstFactor?: number
27
+ }
28
+
29
+ export interface DatalakeConfig {
30
+ allowedSchemas?: string[]
31
+ disallowedSchemas?: string[]
32
+ iops?: number
33
+ rateLimits?: RateLimitOverrides
34
+ region?: DatalakeRegion
35
+ retentionDays?: number | null
36
+ sizeBytes?: number
37
+ tier: DatalakeTier
38
+ /** @deprecated No-op; archivist recomputes hashes trustlessly. */
39
+ verifyHashes?: boolean
40
+ }
41
+
42
+ export interface AclEntry {
43
+ grantedAt: string
44
+ grantedBy?: string
45
+ principal: DatalakePrincipal
46
+ role: DatalakeRole
47
+ }
48
+
49
+ export interface DatalakeUsage {
50
+ bytesStored: number
51
+ bytesStoredLimit: number
52
+ payloadCount: number
53
+ readsLast24h: number
54
+ writesLast24h: number
55
+ }
56
+
57
+ export interface DatalakeDescriptor {
58
+ acl: AclEntry[]
59
+ config: DatalakeConfig
60
+ createdAt: string
61
+ errorMessage?: string
62
+ id: string
63
+ name: string
64
+ ownerId: string
65
+ status: DatalakeStatus
66
+ updatedAt: string
67
+ url?: string
68
+ usage?: DatalakeUsage
69
+ }
70
+
71
+ export interface DatalakeToken {
72
+ datalakeId: string
73
+ expiresAt: string
74
+ role: DatalakeRole
75
+ token: string
76
+ url: string
77
+ }
78
+
79
+ export interface CreateDatalakeRequest {
80
+ config: DatalakeConfig
81
+ name: string
82
+ }
83
+
84
+ export interface GrantRequest {
85
+ datalakeId: string
86
+ principal: DatalakePrincipal
87
+ role: DatalakeRole
88
+ }
89
+
90
+ export interface RevokeRequest {
91
+ datalakeId: string
92
+ principal: DatalakePrincipal
93
+ }
94
+
95
+ export interface TokenRequest {
96
+ datalakeId: string
97
+ role: DatalakeRole
98
+ ttlSeconds?: number
99
+ }
100
+
101
+ export interface WalletJwtCredentials {
102
+ controlAudience?: string
103
+ offset?: string
104
+ ttlSeconds?: number
105
+ }
106
+
107
+ export interface StoredCredentials {
108
+ authToken?: string
109
+ baseUrl: string
110
+ expiresAt?: string
111
+ refreshToken?: string
112
+ userId?: string
113
+ walletJwt?: WalletJwtCredentials
114
+ }
115
+
116
+ export interface CreateDatalakeClientOptions {
117
+ authToken?: AuthTokenSource
118
+ baseUrl?: string
119
+ driver?: 'local' | 'rest'
120
+ }
121
+
122
+ export interface RestDatalakeClientOptions {
123
+ authToken: AuthTokenSource
124
+ audience?: string
125
+ baseUrl: string
126
+ fetchImpl?: typeof fetch
127
+ }
128
+
129
+ export interface RestPayloadsClientOptions {
130
+ authToken: PayloadsAuthTokenSource
131
+ baseUrl: string
132
+ datalakeId: string
133
+ fetchImpl?: typeof fetch
134
+ }
135
+
136
+ export interface DatalakeInsertSummary {
137
+ duplicates: number
138
+ rejected: string[]
139
+ }
140
+
141
+ /** Result of PayloadsClient.insert — matches RestPayloadsClient runtime. */
142
+ export interface InsertPayloadsResult {
143
+ inserted: unknown[]
144
+ summary: DatalakeInsertSummary
145
+ }
146
+
147
+ export interface NextPayloadsResult {
148
+ nextCursor?: string
149
+ payloads: unknown[]
150
+ }
151
+
152
+ export interface DatalakeUsageReport {
153
+ datalakeId: string
154
+ payloadCount: number
155
+ rateLimits?: {
156
+ anonymous?: { limit: number; remaining: number }
157
+ authenticated?: { limit: number; remaining: number }
158
+ }
159
+ }
160
+
161
+ export type DatalakeDevServerStatus =
162
+ | 'healthy'
163
+ | 'degraded'
164
+ | 'unresponsive'
165
+ | 'stale'
166
+ | 'stopped'
167
+
168
+ export type DatalakeDevServerExitCode = 0 | 2 | 3
169
+
170
+ export interface DatalakeDevServerEndpointReport {
171
+ healthy: boolean
172
+ url: string
173
+ }
174
+
175
+ export interface DatalakeDevServerReport {
176
+ schemaVersion: 1
177
+ status: DatalakeDevServerStatus
178
+ exitCode: DatalakeDevServerExitCode
179
+ process: {
180
+ running: boolean
181
+ pid: number | null
182
+ startedAt: string | null
183
+ }
184
+ endpoints: {
185
+ control: DatalakeDevServerEndpointReport | null
186
+ plane: DatalakeDevServerEndpointReport | null
187
+ }
188
+ }
189
+
190
+ export interface InspectDatalakeDevServerOptions {
191
+ timeoutMs?: number
192
+ }
193
+
194
+ export interface PayloadsClient {
195
+ clear(): Promise<{ removed: number }>
196
+ delete(hash: string): Promise<void>
197
+ get(hash: string): Promise<unknown>
198
+ getMany(hashes: string[]): Promise<unknown[]>
199
+ insert(payloads: unknown[]): Promise<InsertPayloadsResult>
200
+ next(options?: {
201
+ cursor?: string
202
+ limit?: number
203
+ order?: 'asc' | 'desc'
204
+ schemas?: string[]
205
+ }): Promise<NextPayloadsResult>
206
+ usage(): Promise<DatalakeUsageReport>
207
+ }
208
+
209
+ export interface DatalakeClient {
210
+ create(request: CreateDatalakeRequest): Promise<DatalakeDescriptor>
211
+ describe(idOrName: string): Promise<DatalakeDescriptor>
212
+ destroy(idOrName: string): Promise<void>
213
+ grant(request: GrantRequest): Promise<DatalakeDescriptor>
214
+ list(): Promise<DatalakeDescriptor[]>
215
+ mintToken(request: TokenRequest): Promise<DatalakeToken>
216
+ revoke(request: RevokeRequest): Promise<DatalakeDescriptor>
217
+ }
218
+
219
+ export declare function createDatalakeClient(options?: CreateDatalakeClientOptions): DatalakeClient
220
+ export declare function inspectDatalakeDevServer(
221
+ options?: InspectDatalakeDevServerOptions,
222
+ ): Promise<DatalakeDevServerReport>
223
+ export declare class LocalDatalakeClient implements DatalakeClient {
224
+ create(request: CreateDatalakeRequest): Promise<DatalakeDescriptor>
225
+ describe(idOrName: string): Promise<DatalakeDescriptor>
226
+ destroy(idOrName: string): Promise<void>
227
+ grant(request: GrantRequest): Promise<DatalakeDescriptor>
228
+ list(): Promise<DatalakeDescriptor[]>
229
+ mintToken(request: TokenRequest): Promise<DatalakeToken>
230
+ revoke(request: RevokeRequest): Promise<DatalakeDescriptor>
231
+ }
232
+ export declare class RestDatalakeClient implements DatalakeClient {
233
+ constructor(options: RestDatalakeClientOptions)
234
+ create(request: CreateDatalakeRequest): Promise<DatalakeDescriptor>
235
+ describe(idOrName: string): Promise<DatalakeDescriptor>
236
+ destroy(idOrName: string): Promise<void>
237
+ grant(request: GrantRequest): Promise<DatalakeDescriptor>
238
+ list(): Promise<DatalakeDescriptor[]>
239
+ mintToken(request: TokenRequest): Promise<DatalakeToken>
240
+ revoke(request: RevokeRequest): Promise<DatalakeDescriptor>
241
+ }
242
+ export declare class RestPayloadsClient implements PayloadsClient {
243
+ constructor(options: RestPayloadsClientOptions)
244
+ clear(): Promise<{ removed: number }>
245
+ delete(hash: string): Promise<void>
246
+ get(hash: string): Promise<unknown>
247
+ getMany(hashes: string[]): Promise<unknown[]>
248
+ insert(payloads: unknown[]): Promise<InsertPayloadsResult>
249
+ next(options?: {
250
+ cursor?: string
251
+ limit?: number
252
+ order?: 'asc' | 'desc'
253
+ schemas?: string[]
254
+ }): Promise<NextPayloadsResult>
255
+ usage(): Promise<DatalakeUsageReport>
256
+ }
257
+
258
+ export declare function loadCredentials(): StoredCredentials | undefined
259
+ export declare function saveCredentials(credentials: StoredCredentials): void
260
+ export declare function clearCredentials(): void
261
+ export declare function getCredentialsLocation(): string
262
+ export declare function getDefaultDatalake(): string | undefined
263
+ export declare function setDefaultDatalake(name: string, id?: string): void
264
+ export declare function clearDefaultDatalake(): void
265
+ export type JsonPrimitive = boolean | null | number | string
266
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[]
267
+ export interface JsonObject { [key: string]: JsonValue }
268
+ export interface Payload { schema: string; $sources?: string[]; [key: string]: JsonValue | undefined }
269
+
270
+ export interface ExactRootArchiveLimits {
271
+ readonly maxConcurrentOperations: number
272
+ readonly maxOperationMilliseconds: number
273
+ readonly maxRequestBytes: number
274
+ readonly maxResponseBytes: number
275
+ readonly maxRoots: number
276
+ readonly maxTokenBytes: number
277
+ }
278
+
279
+ export interface ExactRootArchiveTokenRequest {
280
+ readonly audience: string
281
+ readonly scope: 'payload:append'
282
+ readonly signal: AbortSignal
283
+ }
284
+
285
+ export interface ExactRootArchiveOptions {
286
+ /** Absolute, credential-free configured plane URL. */
287
+ readonly baseUrl: string
288
+ readonly datalakeId: string
289
+ /** Trusted transport preserving signal, no redirects and credential policy. */
290
+ readonly fetchImpl?: typeof fetch
291
+ /** Explicit domain of the native SDK identity callback, not a JSON digest. */
292
+ readonly hashDomain: string
293
+ /** Trusted owning SDK algorithm; preserve client metadata and ignore only SDK storage metadata. */
294
+ readonly identify: (this: void, payload: Payload) => Promise<string>
295
+ readonly limits: ExactRootArchiveLimits
296
+ /** Trusted private issuer adapter, invoked only for append on this lake. */
297
+ readonly tokenSupplier: (this: void, request: ExactRootArchiveTokenRequest) => Promise<string>
298
+ }
299
+
300
+ export interface ExactRootArchiveBody {
301
+ readonly hashDomain: string
302
+ readonly payload: Payload
303
+ readonly root: string
304
+ }
305
+
306
+ export interface ExactRootArchiveRoot {
307
+ readonly hashDomain: string
308
+ readonly root: string
309
+ }
310
+
311
+ export interface ExactRootArchiveCallOptions {
312
+ readonly signal?: AbortSignal
313
+ }
314
+
315
+ export type ExactRootArchiveErrorCode = 'invalid-request' | 'unsupported-domain' | 'capacity' | 'cancelled'
316
+ | 'deadline' | 'token' | 'transport' | 'resource' | 'private' | 'missing' | 'altered' | 'invalid-response'
317
+ export type ExactRootArchiveWriteState = 'not-started' | 'uncertain' | 'acknowledged'
318
+
319
+
320
+ export declare class ExactRootArchiveError extends Error {
321
+ readonly code: ExactRootArchiveErrorCode
322
+ readonly writeState: ExactRootArchiveWriteState
323
+ constructor(code: ExactRootArchiveErrorCode, writeState?: ExactRootArchiveWriteState)
324
+ }
325
+ export declare class ExactRootArchive {
326
+ readonly hashDomain: string
327
+ readonly limits: ExactRootArchiveLimits
328
+ constructor(options: ExactRootArchiveOptions)
329
+ get outstandingOperations(): number
330
+ read(roots: readonly ExactRootArchiveRoot[], options?: ExactRootArchiveCallOptions): Promise<ExactRootArchiveBody[]>
331
+ write(bodies: readonly ExactRootArchiveBody[], options?: ExactRootArchiveCallOptions): Promise<ExactRootArchiveBody[]>
332
+ }
333
+ export interface RetainedDatalakeOptions {
334
+ readonly descriptor?: DatalakeDescriptor
335
+ readonly directory: string
336
+ readonly initialPayloads?: readonly Payload[]
337
+ readonly readinessTimeoutMilliseconds?: number
338
+ readonly stopTimeoutMilliseconds?: number
339
+ }
340
+ export interface RetainedDatalake {
341
+ readonly url: string
342
+ restart(): Promise<void>
343
+ stop(): Promise<void>
344
+ }
345
+ export declare function startRetainedDatalake(options: RetainedDatalakeOptions): Promise<RetainedDatalake>
346
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariestools/datalake-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "The datalake CLI that aries and ariesi spawn, and the programmatic datalake client surface",
5
5
  "keywords": [
6
6
  "ariestools",
@@ -41,8 +41,8 @@
41
41
  "README.md"
42
42
  ],
43
43
  "dependencies": {
44
- "@ariestools/aries-datalake-client": "~0.3.0",
45
- "@ariestools/aries-datalake-core": "~0.3.0",
44
+ "@ariestools/aries-datalake-client": "~0.3.1",
45
+ "@ariestools/aries-datalake-core": "~0.3.1",
46
46
  "@ariestools/cli-kit": "~2.1.0",
47
47
  "@ariestools/cli-kit-daemon": "~2.1.0",
48
48
  "@ariestools/cli-kit-node": "~2.1.0",
@@ -57,8 +57,8 @@
57
57
  "devDependencies": {
58
58
  "@ariestools/actor-model": "~2.0.0",
59
59
  "@ariestools/actor-system": "~2.0.0",
60
- "@ariestools/aries-datalake-control": "~0.3.0",
61
- "@ariestools/aries-datalake-plane": "~0.3.0",
60
+ "@ariestools/aries-datalake-control": "~0.3.1",
61
+ "@ariestools/aries-datalake-plane": "~0.3.1",
62
62
  "@ariestools/eslint-config-flat": "~10.2.1",
63
63
  "@ariestools/sdk": "~9.0.2",
64
64
  "@ariestools/toolchain": "~10.2.1",
@@ -86,6 +86,6 @@
86
86
  },
87
87
  "scripts": {
88
88
  "aries-datalake": "node dist/node/bin/datalake.mjs",
89
- "package-compile": "tsc -p tsconfig.build.json --noEmit && package-compile-only && rolldown -c rolldown.config.ts && node scripts/embedDaemon.mjs"
89
+ "package-compile": "tsc -p tsconfig.build.json --noEmit && package-compile-only && rolldown -c rolldown.config.ts && node scripts/embedDaemon.mjs && node scripts/emitLibraryTypes.mjs"
90
90
  }
91
91
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,YAAY,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AACpF,YAAY,EACV,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mCAAmC,CAAA;AAC1C,YAAY,EACV,oBAAoB,EAAE,2BAA2B,EAAE,yBAAyB,EAC5E,sBAAsB,EAAE,uBAAuB,EAAE,oBAAoB,EACrE,4BAA4B,EAAE,0BAA0B,GACzD,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC3F,YAAY,EACV,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAA"}