@tinycloud/sdk-services 2.10.0-beta.0 → 2.11.0-beta.5
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/{BaseService-DxSU4U-v.d.cts → BaseService-BhpVpA9b.d.cts} +1 -1
- package/dist/{BaseService-BiYeqCRT.d.ts → BaseService-CuV-ZVPs.d.ts} +1 -1
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +2 -2
- package/dist/encryption/index.d.ts +2 -2
- package/dist/encryption/index.js.map +1 -1
- package/dist/index.cjs +100 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +100 -12
- package/dist/index.js.map +1 -1
- package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
- package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
- package/dist/kv/index.cjs +85 -9
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +6 -2
- package/dist/kv/index.d.ts +6 -2
- package/dist/kv/index.js +85 -9
- package/dist/kv/index.js.map +1 -1
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +2 -2
- package/dist/sql/index.d.ts +2 -2
- package/dist/sql/index.js.map +1 -1
- package/dist/{types-KCcgZiab.d.cts → types-qwMmB7qB.d.cts} +1 -0
- package/dist/{types-KCcgZiab.d.ts → types-qwMmB7qB.d.ts} +1 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as IServiceContext, c as InvokeFunction, d as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, e as RetryPolicy, T as TelemetryConfig, I as IService, E as EventHandler, b as ServiceError, R as Result, P as PermissionHint, f as StorageQuotaInfo } from './types-
|
|
2
|
-
export { g as ErrorCode, h as ErrorCodes, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, s as TelemetryEventHandler, t as TelemetryEvents, u as TelemetrySpanEvent, v as defaultRetryPolicy, w as err, x as ok, y as serviceError } from './types-
|
|
1
|
+
import { a as IServiceContext, c as InvokeFunction, d as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, e as RetryPolicy, T as TelemetryConfig, I as IService, E as EventHandler, b as ServiceError, R as Result, P as PermissionHint, f as StorageQuotaInfo } from './types-qwMmB7qB.cjs';
|
|
2
|
+
export { g as ErrorCode, h as ErrorCodes, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, s as TelemetryEventHandler, t as TelemetryEvents, u as TelemetrySpanEvent, v as defaultRetryPolicy, w as err, x as ok, y as serviceError } from './types-qwMmB7qB.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { B as BaseService } from './BaseService-
|
|
4
|
+
import { B as BaseService } from './BaseService-BhpVpA9b.cjs';
|
|
5
5
|
import { IKVService } from './kv/index.cjs';
|
|
6
6
|
export { DEFAULT_SIGNED_READ_URL_EXPIRY_MS, IPrefixedKVService, KVAction, KVActionType, KVBatchPutItem, KVBatchPutOptions, KVBatchPutResponse, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, PrefixedKVService } from './kv/index.cjs';
|
|
7
7
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLMigrations, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLMigrations, SQLService, SQLServiceConfig, SqlMigration, SqlMigrationApplyOptions, SqlMigrationApplyResponse, SqlStatement, SqlValue } from './sql/index.cjs';
|
|
@@ -418,10 +418,16 @@ type GenericKVResponseType = z.infer<typeof GenericKVResponseSchema>;
|
|
|
418
418
|
declare const KVListResponseSchema: z.ZodObject<{
|
|
419
419
|
/** Array of keys matching the list criteria */
|
|
420
420
|
keys: z.ZodArray<z.ZodString, "many">;
|
|
421
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
421
423
|
}, "strip", z.ZodTypeAny, {
|
|
422
424
|
keys: string[];
|
|
425
|
+
truncated?: boolean | undefined;
|
|
426
|
+
nextCursor?: string | undefined;
|
|
423
427
|
}, {
|
|
424
428
|
keys: string[];
|
|
429
|
+
truncated?: boolean | undefined;
|
|
430
|
+
nextCursor?: string | undefined;
|
|
425
431
|
}>;
|
|
426
432
|
type KVListResponseType = z.infer<typeof KVListResponseSchema>;
|
|
427
433
|
/**
|
|
@@ -432,19 +438,29 @@ declare const KVListResultSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
|
|
|
432
438
|
data: z.ZodObject<{
|
|
433
439
|
/** Array of keys matching the list criteria */
|
|
434
440
|
keys: z.ZodArray<z.ZodString, "many">;
|
|
441
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
442
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
435
443
|
}, "strip", z.ZodTypeAny, {
|
|
436
444
|
keys: string[];
|
|
445
|
+
truncated?: boolean | undefined;
|
|
446
|
+
nextCursor?: string | undefined;
|
|
437
447
|
}, {
|
|
438
448
|
keys: string[];
|
|
449
|
+
truncated?: boolean | undefined;
|
|
450
|
+
nextCursor?: string | undefined;
|
|
439
451
|
}>;
|
|
440
452
|
}, "strip", z.ZodTypeAny, {
|
|
441
453
|
data: {
|
|
442
454
|
keys: string[];
|
|
455
|
+
truncated?: boolean | undefined;
|
|
456
|
+
nextCursor?: string | undefined;
|
|
443
457
|
};
|
|
444
458
|
ok: true;
|
|
445
459
|
}, {
|
|
446
460
|
data: {
|
|
447
461
|
keys: string[];
|
|
462
|
+
truncated?: boolean | undefined;
|
|
463
|
+
nextCursor?: string | undefined;
|
|
448
464
|
};
|
|
449
465
|
ok: true;
|
|
450
466
|
}>, z.ZodObject<{
|
|
@@ -1595,6 +1611,15 @@ interface VaultListOptions {
|
|
|
1595
1611
|
prefix?: string;
|
|
1596
1612
|
/** Remove prefix from returned keys */
|
|
1597
1613
|
removePrefix?: boolean;
|
|
1614
|
+
/** Maximum number of keys to return. */
|
|
1615
|
+
limit?: number;
|
|
1616
|
+
/** Opaque cursor returned by a prior bounded page. */
|
|
1617
|
+
cursor?: string;
|
|
1618
|
+
}
|
|
1619
|
+
interface VaultListPage {
|
|
1620
|
+
keys: string[];
|
|
1621
|
+
truncated: boolean;
|
|
1622
|
+
nextCursor?: string;
|
|
1598
1623
|
}
|
|
1599
1624
|
/**
|
|
1600
1625
|
* Options for vault grant (sharing) operations.
|
|
@@ -1763,6 +1788,8 @@ interface IDataVaultService extends IService {
|
|
|
1763
1788
|
* @returns Result with the decrypted entry
|
|
1764
1789
|
*/
|
|
1765
1790
|
get<T = unknown>(key: string, options?: VaultGetOptions<T>): Promise<Result<VaultEntry<T>, VaultError>>;
|
|
1791
|
+
/** Read a network-encrypted value with safe, phase-classified failures. */
|
|
1792
|
+
readNetworkEncrypted<T = unknown>(key: string, options?: VaultGetOptions<T>): Promise<VaultNetworkReadResult<T>>;
|
|
1766
1793
|
/**
|
|
1767
1794
|
* Delete an encrypted key.
|
|
1768
1795
|
*
|
|
@@ -1776,6 +1803,8 @@ interface IDataVaultService extends IService {
|
|
|
1776
1803
|
* @returns Result with array of key names
|
|
1777
1804
|
*/
|
|
1778
1805
|
list(options?: VaultListOptions): Promise<Result<string[], VaultError>>;
|
|
1806
|
+
/** List one bounded, cursor-aware page of vault keys. */
|
|
1807
|
+
listPage(options?: VaultListOptions): Promise<Result<VaultListPage, VaultError>>;
|
|
1779
1808
|
/**
|
|
1780
1809
|
* Get envelope metadata for a key without decrypting the value.
|
|
1781
1810
|
*
|
|
@@ -2049,6 +2078,7 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
2049
2078
|
* @returns Result with array of key names (vault/ prefix stripped)
|
|
2050
2079
|
*/
|
|
2051
2080
|
list(options?: VaultListOptions): Promise<Result<string[], VaultError>>;
|
|
2081
|
+
listPage(options?: VaultListOptions): Promise<Result<VaultListPage, VaultError>>;
|
|
2052
2082
|
/**
|
|
2053
2083
|
* Get envelope metadata for a key without decrypting the value.
|
|
2054
2084
|
*
|
|
@@ -2200,4 +2230,4 @@ declare class SecretsService implements ISecretsService {
|
|
|
2200
2230
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2201
2231
|
}
|
|
2202
2232
|
|
|
2203
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
|
2233
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as IServiceContext, c as InvokeFunction, d as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, e as RetryPolicy, T as TelemetryConfig, I as IService, E as EventHandler, b as ServiceError, R as Result, P as PermissionHint, f as StorageQuotaInfo } from './types-
|
|
2
|
-
export { g as ErrorCode, h as ErrorCodes, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, s as TelemetryEventHandler, t as TelemetryEvents, u as TelemetrySpanEvent, v as defaultRetryPolicy, w as err, x as ok, y as serviceError } from './types-
|
|
1
|
+
import { a as IServiceContext, c as InvokeFunction, d as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, e as RetryPolicy, T as TelemetryConfig, I as IService, E as EventHandler, b as ServiceError, R as Result, P as PermissionHint, f as StorageQuotaInfo } from './types-qwMmB7qB.js';
|
|
2
|
+
export { g as ErrorCode, h as ErrorCodes, i as FetchRequestInit, j as FetchResponse, k as InvocationFact, l as InvocationFacts, m as InvokeAnyEntry, n as ServiceErrorEvent, o as ServiceHeaders, p as ServiceRequestEvent, q as ServiceResponseEvent, r as ServiceRetryEvent, s as TelemetryEventHandler, t as TelemetryEvents, u as TelemetrySpanEvent, v as defaultRetryPolicy, w as err, x as ok, y as serviceError } from './types-qwMmB7qB.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { B as BaseService } from './BaseService-
|
|
4
|
+
import { B as BaseService } from './BaseService-CuV-ZVPs.js';
|
|
5
5
|
import { IKVService } from './kv/index.js';
|
|
6
6
|
export { DEFAULT_SIGNED_READ_URL_EXPIRY_MS, IPrefixedKVService, KVAction, KVActionType, KVBatchPutItem, KVBatchPutOptions, KVBatchPutResponse, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVDeleteOptions, KVGetOptions, KVHeadOptions, KVListOptions, KVListResponse, KVPutOptions, KVResponse, KVResponseHeaders, KVService, KVServiceConfig, KVSignedReadUrlResponse, PrefixedKVService } from './kv/index.js';
|
|
7
7
|
export { BatchOptions, BatchResponse, DatabaseHandle, ExecuteOptions, ExecuteResponse, IDatabaseHandle, ISQLMigrations, ISQLService, QueryOptions, QueryResponse, SQLAction, SQLActionType, SQLMigrations, SQLService, SQLServiceConfig, SqlMigration, SqlMigrationApplyOptions, SqlMigrationApplyResponse, SqlStatement, SqlValue } from './sql/index.js';
|
|
@@ -418,10 +418,16 @@ type GenericKVResponseType = z.infer<typeof GenericKVResponseSchema>;
|
|
|
418
418
|
declare const KVListResponseSchema: z.ZodObject<{
|
|
419
419
|
/** Array of keys matching the list criteria */
|
|
420
420
|
keys: z.ZodArray<z.ZodString, "many">;
|
|
421
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
422
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
421
423
|
}, "strip", z.ZodTypeAny, {
|
|
422
424
|
keys: string[];
|
|
425
|
+
truncated?: boolean | undefined;
|
|
426
|
+
nextCursor?: string | undefined;
|
|
423
427
|
}, {
|
|
424
428
|
keys: string[];
|
|
429
|
+
truncated?: boolean | undefined;
|
|
430
|
+
nextCursor?: string | undefined;
|
|
425
431
|
}>;
|
|
426
432
|
type KVListResponseType = z.infer<typeof KVListResponseSchema>;
|
|
427
433
|
/**
|
|
@@ -432,19 +438,29 @@ declare const KVListResultSchema: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
|
|
|
432
438
|
data: z.ZodObject<{
|
|
433
439
|
/** Array of keys matching the list criteria */
|
|
434
440
|
keys: z.ZodArray<z.ZodString, "many">;
|
|
441
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
442
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
435
443
|
}, "strip", z.ZodTypeAny, {
|
|
436
444
|
keys: string[];
|
|
445
|
+
truncated?: boolean | undefined;
|
|
446
|
+
nextCursor?: string | undefined;
|
|
437
447
|
}, {
|
|
438
448
|
keys: string[];
|
|
449
|
+
truncated?: boolean | undefined;
|
|
450
|
+
nextCursor?: string | undefined;
|
|
439
451
|
}>;
|
|
440
452
|
}, "strip", z.ZodTypeAny, {
|
|
441
453
|
data: {
|
|
442
454
|
keys: string[];
|
|
455
|
+
truncated?: boolean | undefined;
|
|
456
|
+
nextCursor?: string | undefined;
|
|
443
457
|
};
|
|
444
458
|
ok: true;
|
|
445
459
|
}, {
|
|
446
460
|
data: {
|
|
447
461
|
keys: string[];
|
|
462
|
+
truncated?: boolean | undefined;
|
|
463
|
+
nextCursor?: string | undefined;
|
|
448
464
|
};
|
|
449
465
|
ok: true;
|
|
450
466
|
}>, z.ZodObject<{
|
|
@@ -1595,6 +1611,15 @@ interface VaultListOptions {
|
|
|
1595
1611
|
prefix?: string;
|
|
1596
1612
|
/** Remove prefix from returned keys */
|
|
1597
1613
|
removePrefix?: boolean;
|
|
1614
|
+
/** Maximum number of keys to return. */
|
|
1615
|
+
limit?: number;
|
|
1616
|
+
/** Opaque cursor returned by a prior bounded page. */
|
|
1617
|
+
cursor?: string;
|
|
1618
|
+
}
|
|
1619
|
+
interface VaultListPage {
|
|
1620
|
+
keys: string[];
|
|
1621
|
+
truncated: boolean;
|
|
1622
|
+
nextCursor?: string;
|
|
1598
1623
|
}
|
|
1599
1624
|
/**
|
|
1600
1625
|
* Options for vault grant (sharing) operations.
|
|
@@ -1763,6 +1788,8 @@ interface IDataVaultService extends IService {
|
|
|
1763
1788
|
* @returns Result with the decrypted entry
|
|
1764
1789
|
*/
|
|
1765
1790
|
get<T = unknown>(key: string, options?: VaultGetOptions<T>): Promise<Result<VaultEntry<T>, VaultError>>;
|
|
1791
|
+
/** Read a network-encrypted value with safe, phase-classified failures. */
|
|
1792
|
+
readNetworkEncrypted<T = unknown>(key: string, options?: VaultGetOptions<T>): Promise<VaultNetworkReadResult<T>>;
|
|
1766
1793
|
/**
|
|
1767
1794
|
* Delete an encrypted key.
|
|
1768
1795
|
*
|
|
@@ -1776,6 +1803,8 @@ interface IDataVaultService extends IService {
|
|
|
1776
1803
|
* @returns Result with array of key names
|
|
1777
1804
|
*/
|
|
1778
1805
|
list(options?: VaultListOptions): Promise<Result<string[], VaultError>>;
|
|
1806
|
+
/** List one bounded, cursor-aware page of vault keys. */
|
|
1807
|
+
listPage(options?: VaultListOptions): Promise<Result<VaultListPage, VaultError>>;
|
|
1779
1808
|
/**
|
|
1780
1809
|
* Get envelope metadata for a key without decrypting the value.
|
|
1781
1810
|
*
|
|
@@ -2049,6 +2078,7 @@ declare class DataVaultService extends BaseService implements IDataVaultService
|
|
|
2049
2078
|
* @returns Result with array of key names (vault/ prefix stripped)
|
|
2050
2079
|
*/
|
|
2051
2080
|
list(options?: VaultListOptions): Promise<Result<string[], VaultError>>;
|
|
2081
|
+
listPage(options?: VaultListOptions): Promise<Result<VaultListPage, VaultError>>;
|
|
2052
2082
|
/**
|
|
2053
2083
|
* Get envelope metadata for a key without decrypting the value.
|
|
2054
2084
|
*
|
|
@@ -2200,4 +2230,4 @@ declare class SecretsService implements ISecretsService {
|
|
|
2200
2230
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2201
2231
|
}
|
|
2202
2232
|
|
|
2203
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
|
2233
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
package/dist/index.js
CHANGED
|
@@ -373,7 +373,9 @@ function createKVResponseSchema(dataSchema) {
|
|
|
373
373
|
var GenericKVResponseSchema = createKVResponseSchema(z.unknown());
|
|
374
374
|
var KVListResponseSchema = z.object({
|
|
375
375
|
/** Array of keys matching the list criteria */
|
|
376
|
-
keys: z.array(z.string())
|
|
376
|
+
keys: z.array(z.string()),
|
|
377
|
+
truncated: z.boolean().optional(),
|
|
378
|
+
nextCursor: z.string().optional()
|
|
377
379
|
});
|
|
378
380
|
var KVListResultSchema = createResultSchema(KVListResponseSchema);
|
|
379
381
|
var ServiceRequestEventSchema = z.object({
|
|
@@ -2048,6 +2050,7 @@ var KVService = class extends BaseService {
|
|
|
2048
2050
|
}
|
|
2049
2051
|
seen.add(path);
|
|
2050
2052
|
}
|
|
2053
|
+
let requestMayHaveDispatched = false;
|
|
2051
2054
|
try {
|
|
2052
2055
|
const body = new FormData();
|
|
2053
2056
|
for (let index = 0; index < items.length; index++) {
|
|
@@ -2065,14 +2068,31 @@ var KVService = class extends BaseService {
|
|
|
2065
2068
|
action: KVAction.PUT
|
|
2066
2069
|
}))
|
|
2067
2070
|
);
|
|
2068
|
-
const
|
|
2071
|
+
const url = `${this.host}/invoke`;
|
|
2072
|
+
const init = {
|
|
2069
2073
|
method: "POST",
|
|
2070
2074
|
headers,
|
|
2071
2075
|
body,
|
|
2072
2076
|
signal: this.combineSignals(options?.signal)
|
|
2073
|
-
}
|
|
2077
|
+
};
|
|
2078
|
+
const fetchFn = this.context.fetch;
|
|
2079
|
+
requestMayHaveDispatched = true;
|
|
2080
|
+
const response = await fetchFn(url, init);
|
|
2074
2081
|
if (!response.ok) {
|
|
2075
|
-
|
|
2082
|
+
let errorText;
|
|
2083
|
+
try {
|
|
2084
|
+
errorText = await response.text();
|
|
2085
|
+
} catch (textError) {
|
|
2086
|
+
const cause = textError instanceof Error ? textError : new Error(String(textError));
|
|
2087
|
+
return err(
|
|
2088
|
+
serviceError(
|
|
2089
|
+
ErrorCodes.KV_WRITE_FAILED,
|
|
2090
|
+
`Failed to batch put ${items.length} key(s): ${response.status} - <response body could not be read: ${cause.message}>`,
|
|
2091
|
+
"kv",
|
|
2092
|
+
{ cause, meta: { status: response.status, statusText: response.statusText } }
|
|
2093
|
+
)
|
|
2094
|
+
);
|
|
2095
|
+
}
|
|
2076
2096
|
if (response.status === 401 || response.status === 403) {
|
|
2077
2097
|
const { resource, action } = parseAuthError(errorText);
|
|
2078
2098
|
return err(authUnauthorizedError("kv", errorText, {
|
|
@@ -2098,19 +2118,73 @@ var KVService = class extends BaseService {
|
|
|
2098
2118
|
)
|
|
2099
2119
|
);
|
|
2100
2120
|
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2121
|
+
let rawBody;
|
|
2122
|
+
try {
|
|
2123
|
+
rawBody = await response.json();
|
|
2124
|
+
} catch (jsonError) {
|
|
2125
|
+
const cause = jsonError instanceof Error ? jsonError : new Error(String(jsonError));
|
|
2126
|
+
return err(
|
|
2127
|
+
serviceError(
|
|
2128
|
+
ErrorCodes.NETWORK_ERROR,
|
|
2129
|
+
`KV batchPut response was not valid JSON: ${cause.message}`,
|
|
2130
|
+
"kv",
|
|
2131
|
+
{
|
|
2132
|
+
cause,
|
|
2133
|
+
meta: {
|
|
2134
|
+
requestMayHaveDispatched: true,
|
|
2135
|
+
responseReceived: true,
|
|
2136
|
+
status: response.status,
|
|
2137
|
+
outcome: "batch-unconfirmed"
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
)
|
|
2141
|
+
);
|
|
2142
|
+
}
|
|
2143
|
+
const batchResponse = this.normalizeBatchPutResponse(rawBody);
|
|
2144
|
+
if (!batchResponse) {
|
|
2103
2145
|
return err(
|
|
2104
2146
|
serviceError(
|
|
2105
2147
|
ErrorCodes.NETWORK_ERROR,
|
|
2106
2148
|
"KV batchPut response did not include matching written keys and count",
|
|
2107
|
-
"kv"
|
|
2149
|
+
"kv",
|
|
2150
|
+
{
|
|
2151
|
+
meta: {
|
|
2152
|
+
requestMayHaveDispatched: true,
|
|
2153
|
+
responseReceived: true,
|
|
2154
|
+
status: response.status,
|
|
2155
|
+
outcome: "batch-unconfirmed"
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
)
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
const requestedPaths = new Set(paths);
|
|
2162
|
+
const writtenPaths = new Set(batchResponse.written);
|
|
2163
|
+
const matchesRequest = batchResponse.count === paths.length && batchResponse.written.length === paths.length && writtenPaths.size === paths.length && batchResponse.written.every((key) => requestedPaths.has(key));
|
|
2164
|
+
if (!matchesRequest) {
|
|
2165
|
+
return err(
|
|
2166
|
+
serviceError(
|
|
2167
|
+
ErrorCodes.NETWORK_ERROR,
|
|
2168
|
+
`KV batchPut response did not confirm all ${paths.length} requested key(s) were written`,
|
|
2169
|
+
"kv",
|
|
2170
|
+
{
|
|
2171
|
+
meta: {
|
|
2172
|
+
requestMayHaveDispatched: true,
|
|
2173
|
+
responseReceived: true,
|
|
2174
|
+
status: response.status,
|
|
2175
|
+
outcome: "batch-unconfirmed"
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2108
2178
|
)
|
|
2109
2179
|
);
|
|
2110
2180
|
}
|
|
2111
2181
|
return ok(batchResponse);
|
|
2112
2182
|
} catch (error) {
|
|
2113
|
-
|
|
2183
|
+
const wrapped = wrapError("kv", error);
|
|
2184
|
+
return err({
|
|
2185
|
+
...wrapped,
|
|
2186
|
+
meta: { ...wrapped.meta, requestMayHaveDispatched }
|
|
2187
|
+
});
|
|
2114
2188
|
}
|
|
2115
2189
|
});
|
|
2116
2190
|
}
|
|
@@ -2139,7 +2213,10 @@ var KVService = class extends BaseService {
|
|
|
2139
2213
|
KVAction.LIST,
|
|
2140
2214
|
void 0,
|
|
2141
2215
|
options?.signal,
|
|
2142
|
-
options?.limit === void 0 ? void 0 : {
|
|
2216
|
+
options?.limit === void 0 && options?.cursor === void 0 ? void 0 : {
|
|
2217
|
+
...options?.limit === void 0 ? {} : { "x-tinycloud-limit": String(options.limit) },
|
|
2218
|
+
...options?.cursor === void 0 ? {} : { "x-tinycloud-cursor": options.cursor }
|
|
2219
|
+
}
|
|
2143
2220
|
);
|
|
2144
2221
|
if (!response.ok) {
|
|
2145
2222
|
if (response.status === 401) {
|
|
@@ -2171,7 +2248,8 @@ var KVService = class extends BaseService {
|
|
|
2171
2248
|
}
|
|
2172
2249
|
return ok({
|
|
2173
2250
|
keys,
|
|
2174
|
-
...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" }
|
|
2251
|
+
...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" },
|
|
2252
|
+
...response.headers.get("x-tinycloud-next-cursor") === null ? {} : { nextCursor: response.headers.get("x-tinycloud-next-cursor") ?? void 0 }
|
|
2175
2253
|
});
|
|
2176
2254
|
} catch (error) {
|
|
2177
2255
|
return err(wrapError("kv", error));
|
|
@@ -4896,6 +4974,10 @@ var DataVaultService = class extends BaseService {
|
|
|
4896
4974
|
* @returns Result with array of key names (vault/ prefix stripped)
|
|
4897
4975
|
*/
|
|
4898
4976
|
async list(options) {
|
|
4977
|
+
const page = await this.listPage(options);
|
|
4978
|
+
return page.ok ? { ok: true, data: page.data.keys } : page;
|
|
4979
|
+
}
|
|
4980
|
+
async listPage(options) {
|
|
4899
4981
|
return this.withTelemetry("list", options?.prefix, async () => {
|
|
4900
4982
|
if (!this.isUnlocked) {
|
|
4901
4983
|
return vaultError({
|
|
@@ -4913,7 +4995,9 @@ var DataVaultService = class extends BaseService {
|
|
|
4913
4995
|
const listPrefix = options?.prefix ? `vault/${options.prefix}` : "vault/";
|
|
4914
4996
|
const listResult = await this.tc.kv.list({
|
|
4915
4997
|
prefix: listPrefix,
|
|
4916
|
-
removePrefix: true
|
|
4998
|
+
removePrefix: true,
|
|
4999
|
+
...options?.limit === void 0 ? {} : { limit: options.limit },
|
|
5000
|
+
...options?.cursor === void 0 ? {} : { cursor: options.cursor }
|
|
4917
5001
|
});
|
|
4918
5002
|
if (!listResult.ok) {
|
|
4919
5003
|
return vaultError({
|
|
@@ -4930,7 +5014,11 @@ var DataVaultService = class extends BaseService {
|
|
|
4930
5014
|
(k) => k.startsWith(userPrefix) ? k.slice(userPrefix.length) : k
|
|
4931
5015
|
);
|
|
4932
5016
|
}
|
|
4933
|
-
return ok(
|
|
5017
|
+
return ok({
|
|
5018
|
+
keys,
|
|
5019
|
+
truncated: listResult.data.truncated === true,
|
|
5020
|
+
...listResult.data.nextCursor === void 0 ? {} : { nextCursor: listResult.data.nextCursor }
|
|
5021
|
+
});
|
|
4934
5022
|
} catch (error) {
|
|
4935
5023
|
return vaultError({
|
|
4936
5024
|
code: "STORAGE_ERROR",
|