@tinycloud/sdk-services 3.5.0 → 3.6.0-beta.3
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-YLoDIq_I.d.cts → BaseService-D-29xShG.d.cts} +1 -1
- package/dist/{BaseService-BHBfRXT_.d.ts → BaseService-DO7vZ67k.d.ts} +1 -1
- package/dist/context.cjs +831 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +168 -0
- package/dist/context.d.ts +168 -0
- package/dist/context.js +804 -0
- package/dist/context.js.map +1 -0
- package/dist/encryption/index.d.cts +2 -2
- package/dist/encryption/index.d.ts +2 -2
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -171
- package/dist/index.d.ts +7 -171
- package/dist/index.js +19 -2
- 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.d.cts +4 -4
- package/dist/kv/index.d.ts +4 -4
- package/dist/kv/replication/index.d.cts +3 -3
- package/dist/kv/replication/index.d.ts +3 -3
- package/dist/{scope-CSYhzlJw.d.cts → scope-44m8GKdi.d.cts} +1 -1
- package/dist/{scope-BRX9hLVh.d.ts → scope-CAJbG-yz.d.ts} +1 -1
- package/dist/sql/index.cjs +17 -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 +17 -1
- package/dist/sql/index.js.map +1 -1
- package/dist/telemetry/requestLog.d.cts +1 -1
- package/dist/telemetry/requestLog.d.ts +1 -1
- package/dist/{types-CJylea1R.d.cts → types-DAOyIbXu.d.cts} +1 -1
- package/dist/{types-CJylea1R.d.ts → types-DAOyIbXu.d.ts} +1 -1
- package/package.json +6 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { k as ErrorCode, l as ErrorCodes, m as InvocationFact, n as InvocationFacts, o as InvokeAnyEntry,
|
|
1
|
+
import { f as ServiceError, h as Result, P as PermissionHint, c as IService, S as ServiceSession, I as IServiceContext, j as StorageQuotaInfo } from './types-DAOyIbXu.cjs';
|
|
2
|
+
export { k as ErrorCode, l as ErrorCodes, E as EventHandler, F as FetchFunction, d as FetchRequestInit, e as FetchResponse, m as InvocationFact, n as InvocationFacts, o as InvokeAnyEntry, b as InvokeAnyFunction, a as InvokeFunction, R as RetryPolicy, i as RetryStats, p as ServiceErrorEvent, g as ServiceHeaders, q as ServiceRequestEvent, r as ServiceResponseEvent, s as ServiceRetryEvent, T as TelemetryConfig, t as TelemetryEventHandler, u as TelemetryEvents, v as TelemetrySpanEvent, w as defaultRetryPolicy, x as err, y as ok, z as serviceError } from './types-DAOyIbXu.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
export { ServiceContext, ServiceContextConfig } from './context.cjs';
|
|
4
5
|
export { RequestEvent, RequestLog, RequestLogReader, RequestService, RequestSink } from './telemetry/requestLog.cjs';
|
|
5
|
-
import { B as BaseService } from './BaseService-
|
|
6
|
-
export { a as BaseServiceOptions, R as RequestSignal, S as ServiceConstructor, b as ServiceRegistration } from './BaseService-
|
|
6
|
+
import { B as BaseService } from './BaseService-D-29xShG.cjs';
|
|
7
|
+
export { a as BaseServiceOptions, R as RequestSignal, S as ServiceConstructor, b as ServiceRegistration } from './BaseService-D-29xShG.cjs';
|
|
7
8
|
import { IKVService } from './kv/index.cjs';
|
|
8
9
|
export { IPrefixedKVService, KVService, PrefixedKVService } from './kv/index.cjs';
|
|
9
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aw as KVBatchReadResponse, ax as KVChange, ay as KVChangesAuthority, az as KVChangesOptions, aA as KVChangesResponse, aB as KVCreateSignedReadUrlOptions, aC as KVDeleteOptions, aD as KVGetOptions, aE as KVHeadOptions, aF as KVListOptions, b as KVListPage, aG as KVListResponse, aH as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aI as KVResponse, aJ as KVResponseHeaders, aK as KVServiceConfig, aL as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaPageAdmission, a3 as ReplicaPartitionEraser, a4 as ReplicaPartitionIndexEntry, a5 as ReplicaPeerCommit, a6 as ReplicaPrivateGateHash, a7 as ReplicaPurgeIntent, a8 as ReplicaQuotaLedger, a9 as ReplicaQuotaSpec, aa as ReplicaSessionStamp, ab as ReplicaStampedReply, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, am as SaltedHash, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from './scope-
|
|
10
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aw as KVBatchReadResponse, ax as KVChange, ay as KVChangesAuthority, az as KVChangesOptions, aA as KVChangesResponse, aB as KVCreateSignedReadUrlOptions, aC as KVDeleteOptions, aD as KVGetOptions, aE as KVHeadOptions, aF as KVListOptions, b as KVListPage, aG as KVListResponse, aH as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aI as KVResponse, aJ as KVResponseHeaders, aK as KVServiceConfig, aL as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaPageAdmission, a3 as ReplicaPartitionEraser, a4 as ReplicaPartitionIndexEntry, a5 as ReplicaPeerCommit, a6 as ReplicaPrivateGateHash, a7 as ReplicaPurgeIntent, a8 as ReplicaQuotaLedger, a9 as ReplicaQuotaSpec, aa as ReplicaSessionStamp, ab as ReplicaStampedReply, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, am as SaltedHash, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from './scope-44m8GKdi.cjs';
|
|
10
11
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './kv/replication/grantPolicyTypes.cjs';
|
|
11
12
|
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';
|
|
12
13
|
import { IEncryptionService, DecryptCapabilityProof } from './encryption/index.cjs';
|
|
@@ -883,171 +884,6 @@ declare function validateTelemetrySpanEvent(data: unknown): {
|
|
|
883
884
|
error: ValidationError;
|
|
884
885
|
};
|
|
885
886
|
|
|
886
|
-
/**
|
|
887
|
-
* ServiceContext implementation for TinyCloud SDK Services
|
|
888
|
-
* @module @tinycloud/sdk-services
|
|
889
|
-
*/
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Configuration options for ServiceContext.
|
|
893
|
-
*/
|
|
894
|
-
interface ServiceContextConfig {
|
|
895
|
-
/** Function to invoke WASM operations */
|
|
896
|
-
invoke: InvokeFunction;
|
|
897
|
-
/** Optional function to mint a single authorization header for multiple capabilities */
|
|
898
|
-
invokeAny?: InvokeAnyFunction;
|
|
899
|
-
/** Function to make HTTP requests (defaults to globalThis.fetch) */
|
|
900
|
-
fetch?: FetchFunction;
|
|
901
|
-
/** List of TinyCloud host URLs */
|
|
902
|
-
hosts: string[];
|
|
903
|
-
/** Initial session (optional) */
|
|
904
|
-
session?: ServiceSession | null;
|
|
905
|
-
/** Retry policy configuration */
|
|
906
|
-
retryPolicy?: Partial<RetryPolicy>;
|
|
907
|
-
/** Default-off telemetry event delivery. */
|
|
908
|
-
telemetry?: TelemetryConfig;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* ServiceContext provides platform dependencies and cross-service access to services.
|
|
912
|
-
* This is the primary interface services use to interact with the SDK runtime.
|
|
913
|
-
*
|
|
914
|
-
* @example
|
|
915
|
-
* ```typescript
|
|
916
|
-
* const context = new ServiceContext({
|
|
917
|
-
* invoke: wasmInvoke,
|
|
918
|
-
* hosts: ['https://node.tinycloud.xyz'],
|
|
919
|
-
* retryPolicy: { maxAttempts: 5 },
|
|
920
|
-
* });
|
|
921
|
-
*
|
|
922
|
-
* // Register a service
|
|
923
|
-
* const kvService = new KVService({});
|
|
924
|
-
* context.registerService('kv', kvService);
|
|
925
|
-
* kvService.initialize(context);
|
|
926
|
-
*
|
|
927
|
-
* // Update session when user signs in
|
|
928
|
-
* context.setSession(userSession);
|
|
929
|
-
* ```
|
|
930
|
-
*/
|
|
931
|
-
declare class ServiceContext implements IServiceContext {
|
|
932
|
-
private _session;
|
|
933
|
-
private _services;
|
|
934
|
-
private _eventHandlers;
|
|
935
|
-
private _abortController;
|
|
936
|
-
private _operationAbortSignal?;
|
|
937
|
-
private _retired;
|
|
938
|
-
private readonly _invoke;
|
|
939
|
-
private readonly _invokeAny?;
|
|
940
|
-
private readonly _fetch;
|
|
941
|
-
private readonly _hosts;
|
|
942
|
-
private readonly _retryPolicy;
|
|
943
|
-
private readonly _telemetryEnabled;
|
|
944
|
-
private readonly _telemetryHandler?;
|
|
945
|
-
constructor(config: ServiceContextConfig);
|
|
946
|
-
/**
|
|
947
|
-
* Get the current session.
|
|
948
|
-
*/
|
|
949
|
-
get session(): ServiceSession | null;
|
|
950
|
-
/**
|
|
951
|
-
* Check if the context has an authenticated session.
|
|
952
|
-
*/
|
|
953
|
-
get isAuthenticated(): boolean;
|
|
954
|
-
/**
|
|
955
|
-
* Update the session and notify all registered services.
|
|
956
|
-
*
|
|
957
|
-
* @param session - New session or null to clear
|
|
958
|
-
*/
|
|
959
|
-
setSession(session: ServiceSession | null): void;
|
|
960
|
-
/**
|
|
961
|
-
* Get the invoke function for WASM operations.
|
|
962
|
-
*/
|
|
963
|
-
get invoke(): InvokeFunction;
|
|
964
|
-
/**
|
|
965
|
-
* Get the multi-resource invoke function when available.
|
|
966
|
-
*/
|
|
967
|
-
get invokeAny(): InvokeAnyFunction | undefined;
|
|
968
|
-
/**
|
|
969
|
-
* Get the fetch function for HTTP requests.
|
|
970
|
-
*/
|
|
971
|
-
get fetch(): FetchFunction;
|
|
972
|
-
/**
|
|
973
|
-
* Get the list of TinyCloud host URLs.
|
|
974
|
-
*/
|
|
975
|
-
get hosts(): string[];
|
|
976
|
-
/**
|
|
977
|
-
* Register a service with the context.
|
|
978
|
-
*
|
|
979
|
-
* @param name - Service name (e.g., 'kv')
|
|
980
|
-
* @param service - Service instance
|
|
981
|
-
*/
|
|
982
|
-
registerService(name: string, service: IService): void;
|
|
983
|
-
/**
|
|
984
|
-
* Unregister a service from the context.
|
|
985
|
-
*
|
|
986
|
-
* @param name - Service name to remove
|
|
987
|
-
*/
|
|
988
|
-
unregisterService(name: string): void;
|
|
989
|
-
/**
|
|
990
|
-
* Get a registered service by name.
|
|
991
|
-
*
|
|
992
|
-
* @param name - Service name
|
|
993
|
-
* @returns The service instance or undefined if not registered
|
|
994
|
-
*/
|
|
995
|
-
getService<T extends IService>(name: string): T | undefined;
|
|
996
|
-
/**
|
|
997
|
-
* Emit a telemetry event.
|
|
998
|
-
*
|
|
999
|
-
* @param event - Event name
|
|
1000
|
-
* @param data - Event data
|
|
1001
|
-
*/
|
|
1002
|
-
emit(event: string, data: unknown): void;
|
|
1003
|
-
/**
|
|
1004
|
-
* Subscribe to telemetry events.
|
|
1005
|
-
*
|
|
1006
|
-
* @param event - Event name to subscribe to
|
|
1007
|
-
* @param handler - Handler function
|
|
1008
|
-
* @returns Unsubscribe function
|
|
1009
|
-
*/
|
|
1010
|
-
on(event: string, handler: EventHandler): () => void;
|
|
1011
|
-
/**
|
|
1012
|
-
* Remove all event handlers for an event.
|
|
1013
|
-
*
|
|
1014
|
-
* @param event - Event name (if omitted, clears all events)
|
|
1015
|
-
*/
|
|
1016
|
-
clearEventHandlers(event?: string): void;
|
|
1017
|
-
/**
|
|
1018
|
-
* Get the abort signal for cancelling operations.
|
|
1019
|
-
*/
|
|
1020
|
-
get abortSignal(): AbortSignal;
|
|
1021
|
-
get operationAbortSignal(): AbortSignal | undefined;
|
|
1022
|
-
setOperationAbortSignal(signal: AbortSignal | undefined): void;
|
|
1023
|
-
/**
|
|
1024
|
-
* Permanently retire this graph after its owner installs a replacement.
|
|
1025
|
-
* Unlike `abort()`, retirement never creates a fresh controller, so captured
|
|
1026
|
-
* services cannot resume calls under a superseded session.
|
|
1027
|
-
*/
|
|
1028
|
-
retire(): void;
|
|
1029
|
-
/**
|
|
1030
|
-
* Abort all pending operations and notify services.
|
|
1031
|
-
* Creates a new AbortController for future operations.
|
|
1032
|
-
*/
|
|
1033
|
-
abort(): void;
|
|
1034
|
-
/**
|
|
1035
|
-
* Sign out - abort operations and clear session.
|
|
1036
|
-
*/
|
|
1037
|
-
signOut(): void;
|
|
1038
|
-
/**
|
|
1039
|
-
* Get the retry policy configuration.
|
|
1040
|
-
*/
|
|
1041
|
-
get retryPolicy(): RetryPolicy;
|
|
1042
|
-
private wrapInvoke;
|
|
1043
|
-
private assertActive;
|
|
1044
|
-
private wrapInvokeAny;
|
|
1045
|
-
/** Retry `NODE_BUSY` / `REQUEST_TIMEOUT`; `build` must re-sign per attempt (the node 409s a repeated invocation). */
|
|
1046
|
-
invokeWithRetry(url: string, build: () => FetchRequestInit | Promise<FetchRequestInit>): Promise<FetchResponse>;
|
|
1047
|
-
private wrapFetch;
|
|
1048
|
-
private combineSignals;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
887
|
/** Validate one structured node permission hint without accepting raw errors. */
|
|
1052
888
|
declare function parsePermissionHint(value: unknown): PermissionHint | undefined;
|
|
1053
889
|
/** Extract only a validated structured hint from an SDK-owned error body. */
|
|
@@ -2692,4 +2528,4 @@ declare class SecretsService implements ISecretsService {
|
|
|
2692
2528
|
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2693
2529
|
}
|
|
2694
2530
|
|
|
2695
|
-
export { type AuthorizationVerdict, BaseService, 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,
|
|
2531
|
+
export { type AuthorizationVerdict, BaseService, 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, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookStreamRetryConfig, 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, type IStorageService, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, MAX_SECRET_SCOPE_LENGTH, type ParsedSecretCatalogKey, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, SECRET_SCOPE_RE, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_NEARLY_FULL_RATIO, STORAGE_WRITE_TOO_LARGE_MESSAGE, type SchemaInfo, type SecretCatalogEntry, type SecretPayload, type SecretPutOptions, type SecretScopeOptions, type SecretsError, SecretsService, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, type StorageAccountUsage, type StorageFullEvent, type StorageFullHandler, StorageFullMonitor, StorageQuotaInfo, type StorageRejectionDetails, type StorageStatus, type StorageStatusOptions, type StorageUsage, type StorageUsageState, type SubscribeOptions, TC832_RESERVED_SCOPES, type TableInfo, 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, appSecretScope, authExpiredError, authRequiredError, authUnauthorizedError, authorizationVerdictOf, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isStorageFullError, networkError, nodeRetryError, notFoundError, parseAuthError, parseCapabilityResource, parsePermissionHint, parsePermissionHintFromErrorText, parseSecretCatalogKey, parseStorageQuotaBytes, parseStorageRejection, parseStorageStatus, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, storageRejectionError, storageUsageState, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, validatedCapabilityOf, wrapError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { k as ErrorCode, l as ErrorCodes, m as InvocationFact, n as InvocationFacts, o as InvokeAnyEntry,
|
|
1
|
+
import { f as ServiceError, h as Result, P as PermissionHint, c as IService, S as ServiceSession, I as IServiceContext, j as StorageQuotaInfo } from './types-DAOyIbXu.js';
|
|
2
|
+
export { k as ErrorCode, l as ErrorCodes, E as EventHandler, F as FetchFunction, d as FetchRequestInit, e as FetchResponse, m as InvocationFact, n as InvocationFacts, o as InvokeAnyEntry, b as InvokeAnyFunction, a as InvokeFunction, R as RetryPolicy, i as RetryStats, p as ServiceErrorEvent, g as ServiceHeaders, q as ServiceRequestEvent, r as ServiceResponseEvent, s as ServiceRetryEvent, T as TelemetryConfig, t as TelemetryEventHandler, u as TelemetryEvents, v as TelemetrySpanEvent, w as defaultRetryPolicy, x as err, y as ok, z as serviceError } from './types-DAOyIbXu.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
export { ServiceContext, ServiceContextConfig } from './context.js';
|
|
4
5
|
export { RequestEvent, RequestLog, RequestLogReader, RequestService, RequestSink } from './telemetry/requestLog.js';
|
|
5
|
-
import { B as BaseService } from './BaseService-
|
|
6
|
-
export { a as BaseServiceOptions, R as RequestSignal, S as ServiceConstructor, b as ServiceRegistration } from './BaseService-
|
|
6
|
+
import { B as BaseService } from './BaseService-DO7vZ67k.js';
|
|
7
|
+
export { a as BaseServiceOptions, R as RequestSignal, S as ServiceConstructor, b as ServiceRegistration } from './BaseService-DO7vZ67k.js';
|
|
7
8
|
import { IKVService } from './kv/index.js';
|
|
8
9
|
export { IPrefixedKVService, KVService, PrefixedKVService } from './kv/index.js';
|
|
9
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aw as KVBatchReadResponse, ax as KVChange, ay as KVChangesAuthority, az as KVChangesOptions, aA as KVChangesResponse, aB as KVCreateSignedReadUrlOptions, aC as KVDeleteOptions, aD as KVGetOptions, aE as KVHeadOptions, aF as KVListOptions, b as KVListPage, aG as KVListResponse, aH as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aI as KVResponse, aJ as KVResponseHeaders, aK as KVServiceConfig, aL as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaPageAdmission, a3 as ReplicaPartitionEraser, a4 as ReplicaPartitionIndexEntry, a5 as ReplicaPeerCommit, a6 as ReplicaPrivateGateHash, a7 as ReplicaPurgeIntent, a8 as ReplicaQuotaLedger, a9 as ReplicaQuotaSpec, aa as ReplicaSessionStamp, ab as ReplicaStampedReply, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, am as SaltedHash, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from './scope-
|
|
10
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aw as KVBatchReadResponse, ax as KVChange, ay as KVChangesAuthority, az as KVChangesOptions, aA as KVChangesResponse, aB as KVCreateSignedReadUrlOptions, aC as KVDeleteOptions, aD as KVGetOptions, aE as KVHeadOptions, aF as KVListOptions, b as KVListPage, aG as KVListResponse, aH as KVPutOptions, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aI as KVResponse, aJ as KVResponseHeaders, aK as KVServiceConfig, aL as KVSignedReadUrlResponse, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaPageAdmission, a3 as ReplicaPartitionEraser, a4 as ReplicaPartitionIndexEntry, a5 as ReplicaPeerCommit, a6 as ReplicaPrivateGateHash, a7 as ReplicaPurgeIntent, a8 as ReplicaQuotaLedger, a9 as ReplicaQuotaSpec, aa as ReplicaSessionStamp, ab as ReplicaStampedReply, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, am as SaltedHash, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from './scope-CAJbG-yz.js';
|
|
10
11
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './kv/replication/grantPolicyTypes.js';
|
|
11
12
|
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';
|
|
12
13
|
import { IEncryptionService, DecryptCapabilityProof } from './encryption/index.js';
|
|
@@ -883,171 +884,6 @@ declare function validateTelemetrySpanEvent(data: unknown): {
|
|
|
883
884
|
error: ValidationError;
|
|
884
885
|
};
|
|
885
886
|
|
|
886
|
-
/**
|
|
887
|
-
* ServiceContext implementation for TinyCloud SDK Services
|
|
888
|
-
* @module @tinycloud/sdk-services
|
|
889
|
-
*/
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Configuration options for ServiceContext.
|
|
893
|
-
*/
|
|
894
|
-
interface ServiceContextConfig {
|
|
895
|
-
/** Function to invoke WASM operations */
|
|
896
|
-
invoke: InvokeFunction;
|
|
897
|
-
/** Optional function to mint a single authorization header for multiple capabilities */
|
|
898
|
-
invokeAny?: InvokeAnyFunction;
|
|
899
|
-
/** Function to make HTTP requests (defaults to globalThis.fetch) */
|
|
900
|
-
fetch?: FetchFunction;
|
|
901
|
-
/** List of TinyCloud host URLs */
|
|
902
|
-
hosts: string[];
|
|
903
|
-
/** Initial session (optional) */
|
|
904
|
-
session?: ServiceSession | null;
|
|
905
|
-
/** Retry policy configuration */
|
|
906
|
-
retryPolicy?: Partial<RetryPolicy>;
|
|
907
|
-
/** Default-off telemetry event delivery. */
|
|
908
|
-
telemetry?: TelemetryConfig;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* ServiceContext provides platform dependencies and cross-service access to services.
|
|
912
|
-
* This is the primary interface services use to interact with the SDK runtime.
|
|
913
|
-
*
|
|
914
|
-
* @example
|
|
915
|
-
* ```typescript
|
|
916
|
-
* const context = new ServiceContext({
|
|
917
|
-
* invoke: wasmInvoke,
|
|
918
|
-
* hosts: ['https://node.tinycloud.xyz'],
|
|
919
|
-
* retryPolicy: { maxAttempts: 5 },
|
|
920
|
-
* });
|
|
921
|
-
*
|
|
922
|
-
* // Register a service
|
|
923
|
-
* const kvService = new KVService({});
|
|
924
|
-
* context.registerService('kv', kvService);
|
|
925
|
-
* kvService.initialize(context);
|
|
926
|
-
*
|
|
927
|
-
* // Update session when user signs in
|
|
928
|
-
* context.setSession(userSession);
|
|
929
|
-
* ```
|
|
930
|
-
*/
|
|
931
|
-
declare class ServiceContext implements IServiceContext {
|
|
932
|
-
private _session;
|
|
933
|
-
private _services;
|
|
934
|
-
private _eventHandlers;
|
|
935
|
-
private _abortController;
|
|
936
|
-
private _operationAbortSignal?;
|
|
937
|
-
private _retired;
|
|
938
|
-
private readonly _invoke;
|
|
939
|
-
private readonly _invokeAny?;
|
|
940
|
-
private readonly _fetch;
|
|
941
|
-
private readonly _hosts;
|
|
942
|
-
private readonly _retryPolicy;
|
|
943
|
-
private readonly _telemetryEnabled;
|
|
944
|
-
private readonly _telemetryHandler?;
|
|
945
|
-
constructor(config: ServiceContextConfig);
|
|
946
|
-
/**
|
|
947
|
-
* Get the current session.
|
|
948
|
-
*/
|
|
949
|
-
get session(): ServiceSession | null;
|
|
950
|
-
/**
|
|
951
|
-
* Check if the context has an authenticated session.
|
|
952
|
-
*/
|
|
953
|
-
get isAuthenticated(): boolean;
|
|
954
|
-
/**
|
|
955
|
-
* Update the session and notify all registered services.
|
|
956
|
-
*
|
|
957
|
-
* @param session - New session or null to clear
|
|
958
|
-
*/
|
|
959
|
-
setSession(session: ServiceSession | null): void;
|
|
960
|
-
/**
|
|
961
|
-
* Get the invoke function for WASM operations.
|
|
962
|
-
*/
|
|
963
|
-
get invoke(): InvokeFunction;
|
|
964
|
-
/**
|
|
965
|
-
* Get the multi-resource invoke function when available.
|
|
966
|
-
*/
|
|
967
|
-
get invokeAny(): InvokeAnyFunction | undefined;
|
|
968
|
-
/**
|
|
969
|
-
* Get the fetch function for HTTP requests.
|
|
970
|
-
*/
|
|
971
|
-
get fetch(): FetchFunction;
|
|
972
|
-
/**
|
|
973
|
-
* Get the list of TinyCloud host URLs.
|
|
974
|
-
*/
|
|
975
|
-
get hosts(): string[];
|
|
976
|
-
/**
|
|
977
|
-
* Register a service with the context.
|
|
978
|
-
*
|
|
979
|
-
* @param name - Service name (e.g., 'kv')
|
|
980
|
-
* @param service - Service instance
|
|
981
|
-
*/
|
|
982
|
-
registerService(name: string, service: IService): void;
|
|
983
|
-
/**
|
|
984
|
-
* Unregister a service from the context.
|
|
985
|
-
*
|
|
986
|
-
* @param name - Service name to remove
|
|
987
|
-
*/
|
|
988
|
-
unregisterService(name: string): void;
|
|
989
|
-
/**
|
|
990
|
-
* Get a registered service by name.
|
|
991
|
-
*
|
|
992
|
-
* @param name - Service name
|
|
993
|
-
* @returns The service instance or undefined if not registered
|
|
994
|
-
*/
|
|
995
|
-
getService<T extends IService>(name: string): T | undefined;
|
|
996
|
-
/**
|
|
997
|
-
* Emit a telemetry event.
|
|
998
|
-
*
|
|
999
|
-
* @param event - Event name
|
|
1000
|
-
* @param data - Event data
|
|
1001
|
-
*/
|
|
1002
|
-
emit(event: string, data: unknown): void;
|
|
1003
|
-
/**
|
|
1004
|
-
* Subscribe to telemetry events.
|
|
1005
|
-
*
|
|
1006
|
-
* @param event - Event name to subscribe to
|
|
1007
|
-
* @param handler - Handler function
|
|
1008
|
-
* @returns Unsubscribe function
|
|
1009
|
-
*/
|
|
1010
|
-
on(event: string, handler: EventHandler): () => void;
|
|
1011
|
-
/**
|
|
1012
|
-
* Remove all event handlers for an event.
|
|
1013
|
-
*
|
|
1014
|
-
* @param event - Event name (if omitted, clears all events)
|
|
1015
|
-
*/
|
|
1016
|
-
clearEventHandlers(event?: string): void;
|
|
1017
|
-
/**
|
|
1018
|
-
* Get the abort signal for cancelling operations.
|
|
1019
|
-
*/
|
|
1020
|
-
get abortSignal(): AbortSignal;
|
|
1021
|
-
get operationAbortSignal(): AbortSignal | undefined;
|
|
1022
|
-
setOperationAbortSignal(signal: AbortSignal | undefined): void;
|
|
1023
|
-
/**
|
|
1024
|
-
* Permanently retire this graph after its owner installs a replacement.
|
|
1025
|
-
* Unlike `abort()`, retirement never creates a fresh controller, so captured
|
|
1026
|
-
* services cannot resume calls under a superseded session.
|
|
1027
|
-
*/
|
|
1028
|
-
retire(): void;
|
|
1029
|
-
/**
|
|
1030
|
-
* Abort all pending operations and notify services.
|
|
1031
|
-
* Creates a new AbortController for future operations.
|
|
1032
|
-
*/
|
|
1033
|
-
abort(): void;
|
|
1034
|
-
/**
|
|
1035
|
-
* Sign out - abort operations and clear session.
|
|
1036
|
-
*/
|
|
1037
|
-
signOut(): void;
|
|
1038
|
-
/**
|
|
1039
|
-
* Get the retry policy configuration.
|
|
1040
|
-
*/
|
|
1041
|
-
get retryPolicy(): RetryPolicy;
|
|
1042
|
-
private wrapInvoke;
|
|
1043
|
-
private assertActive;
|
|
1044
|
-
private wrapInvokeAny;
|
|
1045
|
-
/** Retry `NODE_BUSY` / `REQUEST_TIMEOUT`; `build` must re-sign per attempt (the node 409s a repeated invocation). */
|
|
1046
|
-
invokeWithRetry(url: string, build: () => FetchRequestInit | Promise<FetchRequestInit>): Promise<FetchResponse>;
|
|
1047
|
-
private wrapFetch;
|
|
1048
|
-
private combineSignals;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
887
|
/** Validate one structured node permission hint without accepting raw errors. */
|
|
1052
888
|
declare function parsePermissionHint(value: unknown): PermissionHint | undefined;
|
|
1053
889
|
/** Extract only a validated structured hint from an SDK-owned error body. */
|
|
@@ -2692,4 +2528,4 @@ declare class SecretsService implements ISecretsService {
|
|
|
2692
2528
|
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2693
2529
|
}
|
|
2694
2530
|
|
|
2695
|
-
export { type AuthorizationVerdict, BaseService, 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,
|
|
2531
|
+
export { type AuthorizationVerdict, BaseService, 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, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookStreamRetryConfig, 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, type IStorageService, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, MAX_SECRET_SCOPE_LENGTH, type ParsedSecretCatalogKey, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, SECRET_SCOPE_RE, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_NEARLY_FULL_RATIO, STORAGE_WRITE_TOO_LARGE_MESSAGE, type SchemaInfo, type SecretCatalogEntry, type SecretPayload, type SecretPutOptions, type SecretScopeOptions, type SecretsError, SecretsService, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, type StorageAccountUsage, type StorageFullEvent, type StorageFullHandler, StorageFullMonitor, StorageQuotaInfo, type StorageRejectionDetails, type StorageStatus, type StorageStatusOptions, type StorageUsage, type StorageUsageState, type SubscribeOptions, TC832_RESERVED_SCOPES, type TableInfo, 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, appSecretScope, authExpiredError, authRequiredError, authUnauthorizedError, authorizationVerdictOf, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isStorageFullError, networkError, nodeRetryError, notFoundError, parseAuthError, parseCapabilityResource, parsePermissionHint, parsePermissionHintFromErrorText, parseSecretCatalogKey, parseStorageQuotaBytes, parseStorageRejection, parseStorageStatus, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, storageRejectionError, storageUsageState, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, validatedCapabilityOf, wrapError };
|
package/dist/index.js
CHANGED
|
@@ -3456,6 +3456,21 @@ function requiresSecretsOptIn(space, prefix) {
|
|
|
3456
3456
|
return prefix.split("/", 1)[0] === "vault";
|
|
3457
3457
|
}
|
|
3458
3458
|
|
|
3459
|
+
// src/statementSize.ts
|
|
3460
|
+
function requestTooLargeError(engine, operation, status, errorText) {
|
|
3461
|
+
if (status !== 413) return void 0;
|
|
3462
|
+
const nodeCode = errorText.split(":", 1)[0].trim();
|
|
3463
|
+
let request;
|
|
3464
|
+
if (nodeCode === `${engine}_request_too_large`) {
|
|
3465
|
+
request = true;
|
|
3466
|
+
} else if (nodeCode === `${engine}_response_too_large`) {
|
|
3467
|
+
request = false;
|
|
3468
|
+
} else {
|
|
3469
|
+
request = ["batch", "executeStatement", "import"].includes(operation);
|
|
3470
|
+
}
|
|
3471
|
+
return request ? `${engine.toUpperCase()}_REQUEST_TOO_LARGE` : void 0;
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3459
3474
|
// src/sql/SQLMigrations.ts
|
|
3460
3475
|
var SQLMigrations = class {
|
|
3461
3476
|
constructor(service, dbName) {
|
|
@@ -3875,7 +3890,8 @@ var SQLService = class extends BaseService {
|
|
|
3875
3890
|
const retryError = nodeRetryError("sql", `SQL ${operation} failed: ${response.status} - ${errorText}`, response, errorText);
|
|
3876
3891
|
if (retryError) return err(retryError);
|
|
3877
3892
|
const errorBody = parseServiceErrorBody(errorText);
|
|
3878
|
-
const
|
|
3893
|
+
const sizeCode = requestTooLargeError("sql", operation, response.status, errorText);
|
|
3894
|
+
const errorCode = sizeCode ?? this.mapHttpStatusToErrorCode(
|
|
3879
3895
|
response.status,
|
|
3880
3896
|
errorBody.error
|
|
3881
3897
|
);
|
|
@@ -4341,7 +4357,8 @@ var DuckDbService = class extends BaseService {
|
|
|
4341
4357
|
const retryError = nodeRetryError("duckdb", `DuckDB ${operation} failed: ${response.status} - ${errorText}`, response, errorText);
|
|
4342
4358
|
if (retryError) return err(retryError);
|
|
4343
4359
|
const errorBody = parseServiceErrorBody(errorText);
|
|
4344
|
-
const
|
|
4360
|
+
const sizeCode = requestTooLargeError("duckdb", operation, response.status, errorText);
|
|
4361
|
+
const errorCode = sizeCode ?? this.mapHttpStatusToErrorCode(
|
|
4345
4362
|
response.status,
|
|
4346
4363
|
errorBody.error
|
|
4347
4364
|
);
|