@tinycloud/sdk-services 3.8.0-beta.16 → 3.8.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseService-DO7vZ67k.d.ts → BaseService-Ma2MwJAd.d.ts} +1 -1
- package/dist/{BaseService-D-29xShG.d.cts → BaseService-O0iyuFLk.d.cts} +1 -1
- package/dist/IHooksService-4QNODVy6.d.cts +120 -0
- package/dist/IHooksService-CvTpJbQD.d.ts +120 -0
- package/dist/ISQLService-Aly1CBsW.d.ts +242 -0
- package/dist/ISQLService-BOgWzHLT.d.cts +242 -0
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/encryption/index.d.cts +4 -4
- package/dist/encryption/index.d.ts +4 -4
- package/dist/encryption/named-keys.d.cts +2 -2
- package/dist/encryption/named-keys.d.ts +2 -2
- package/dist/feed/index.cjs +787 -0
- package/dist/feed/index.cjs.map +1 -0
- package/dist/feed/index.d.cts +176 -0
- package/dist/feed/index.d.ts +176 -0
- package/dist/feed/index.js +739 -0
- package/dist/feed/index.js.map +1 -0
- package/dist/index.cjs +51 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -115
- package/dist/index.d.ts +15 -115
- package/dist/index.js +51 -8
- 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-1-8skVDk.d.ts → scope-BZr0QwxX.d.ts} +1 -1
- package/dist/{scope-Dv3IAXMr.d.cts → scope-DEgc9f-W.d.cts} +1 -1
- package/dist/sql/index.cjs +21 -6
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +6 -236
- package/dist/sql/index.d.ts +6 -236
- package/dist/sql/index.js +21 -6
- 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-DZBExWAf.d.ts → types-Bf91gup6.d.ts} +1 -1
- package/dist/{types-DAOyIbXu.d.ts → types-CSd0RYir.d.cts} +1 -1
- package/dist/{types-DAOyIbXu.d.cts → types-CSd0RYir.d.ts} +1 -1
- package/dist/{types-CBKrdtP8.d.cts → types-D4XbIfFJ.d.cts} +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { f as Result, c as IService } from './types-CSd0RYir.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SQL Service Types
|
|
5
|
+
*
|
|
6
|
+
* Type definitions for the SQL service operations.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for SQLService.
|
|
10
|
+
*/
|
|
11
|
+
interface SQLServiceConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Default database name.
|
|
14
|
+
* If not set, operations default to "default".
|
|
15
|
+
*/
|
|
16
|
+
defaultDatabase?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Timeout in milliseconds for each SQL request, including reading the
|
|
19
|
+
* response body. When it elapses the request is aborted and the operation
|
|
20
|
+
* returns an `ErrorCodes.TIMEOUT` error. Unset (the default), `0`, or
|
|
21
|
+
* `Infinity` means no timeout.
|
|
22
|
+
*/
|
|
23
|
+
timeout?: number;
|
|
24
|
+
/** Allow additional config properties */
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Options for SQL query operations.
|
|
29
|
+
*/
|
|
30
|
+
interface QueryOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Custom abort signal for this operation.
|
|
33
|
+
*/
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
/** Maximum rows the node may return. Nodes without limit support ignore it. */
|
|
36
|
+
maxRows?: number;
|
|
37
|
+
/** Maximum serialized result bytes the node may return. */
|
|
38
|
+
maxBytes?: number;
|
|
39
|
+
/** Redact query failure details before return and ordinary service-error events. */
|
|
40
|
+
redactErrors?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Options for SQL execute operations.
|
|
44
|
+
*/
|
|
45
|
+
interface ExecuteOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Schema initialization statements (CREATE TABLE IF NOT EXISTS ...).
|
|
48
|
+
* Executed before the main statement on first write.
|
|
49
|
+
*/
|
|
50
|
+
schema?: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Custom abort signal for this operation.
|
|
53
|
+
*/
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
/** Redact execute failure details before return and ordinary service-error events. */
|
|
56
|
+
redactErrors?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for SQL batch operations.
|
|
60
|
+
*/
|
|
61
|
+
interface BatchOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Custom abort signal for this operation.
|
|
64
|
+
*/
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
/** Redact batch failure details before return and ordinary service-error events. */
|
|
67
|
+
redactErrors?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A SQL value: null, number, string, or binary data.
|
|
71
|
+
*/
|
|
72
|
+
type SqlValue = null | number | string | Uint8Array;
|
|
73
|
+
/**
|
|
74
|
+
* A SQL statement with optional parameters.
|
|
75
|
+
*/
|
|
76
|
+
interface SqlStatement {
|
|
77
|
+
sql: string;
|
|
78
|
+
params?: SqlValue[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Response from SQL query operations.
|
|
82
|
+
*/
|
|
83
|
+
interface QueryResponse<T = Record<string, unknown>> {
|
|
84
|
+
columns: string[];
|
|
85
|
+
rows: T[][];
|
|
86
|
+
rowCount: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Response from SQL execute operations.
|
|
90
|
+
*/
|
|
91
|
+
interface ExecuteResponse {
|
|
92
|
+
changes: number;
|
|
93
|
+
lastInsertRowId: number | null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Response from SQL batch operations.
|
|
97
|
+
*/
|
|
98
|
+
interface BatchResponse {
|
|
99
|
+
results: ExecuteResponse[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A versioned SQL migration owned by an application or SDK subsystem.
|
|
103
|
+
*/
|
|
104
|
+
interface SqlMigration {
|
|
105
|
+
/**
|
|
106
|
+
* Stable migration id within the namespace, e.g. "001_initial".
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
/**
|
|
110
|
+
* SQL statements to apply when this migration has not been recorded.
|
|
111
|
+
* Statements should be idempotent where SQLite supports it.
|
|
112
|
+
*/
|
|
113
|
+
sql: Array<string | SqlStatement>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Options for applying SQL migrations.
|
|
117
|
+
*/
|
|
118
|
+
interface SqlMigrationApplyOptions {
|
|
119
|
+
/**
|
|
120
|
+
* Namespace for this migration set, usually an app id or SDK subsystem.
|
|
121
|
+
*/
|
|
122
|
+
namespace: string;
|
|
123
|
+
/**
|
|
124
|
+
* Ordered migration list.
|
|
125
|
+
*/
|
|
126
|
+
migrations: SqlMigration[];
|
|
127
|
+
/**
|
|
128
|
+
* Custom abort signal for migration operations.
|
|
129
|
+
*/
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Result from applying SQL migrations.
|
|
134
|
+
*/
|
|
135
|
+
interface SqlMigrationApplyResponse {
|
|
136
|
+
database: string;
|
|
137
|
+
namespace: string;
|
|
138
|
+
status: "already_current" | "applied";
|
|
139
|
+
applied: string[];
|
|
140
|
+
skipped: string[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* SQL service action types.
|
|
144
|
+
*
|
|
145
|
+
* URNs derive from the canonical capability registry in `@tinycloud/bootstrap`
|
|
146
|
+
* (TC-112 single source of truth, vendored from tinycloud-node). `insert`,
|
|
147
|
+
* `update`, and `delete` were dropped — zero client refs and never accepted
|
|
148
|
+
* node-side. `select` is a deprecated alias of `read`. `execute`/`export` are
|
|
149
|
+
* request-kind artifacts, not grantable capabilities: the node routes them by
|
|
150
|
+
* request-body kind, so they are absent from the registry but kept here as the
|
|
151
|
+
* invocation ability the client sends today (wire alignment tracked in TC-114).
|
|
152
|
+
*/
|
|
153
|
+
declare const SQLAction: {
|
|
154
|
+
readonly READ: "tinycloud.sql/read";
|
|
155
|
+
readonly WRITE: "tinycloud.sql/write";
|
|
156
|
+
readonly SCHEMA: "tinycloud.sql/schema";
|
|
157
|
+
readonly ADMIN: "tinycloud.sql/admin";
|
|
158
|
+
readonly SELECT: "tinycloud.sql/select";
|
|
159
|
+
readonly EXECUTE: "tinycloud.sql/execute";
|
|
160
|
+
readonly EXPORT: "tinycloud.sql/export";
|
|
161
|
+
readonly ALL: "tinycloud.sql/*";
|
|
162
|
+
};
|
|
163
|
+
type SQLActionType = (typeof SQLAction)[keyof typeof SQLAction];
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* ISQLService - Interface for SQL service.
|
|
167
|
+
*
|
|
168
|
+
* Platform-agnostic interface for SQL database operations.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Migration helper bound to a specific database.
|
|
173
|
+
*/
|
|
174
|
+
interface ISQLMigrations {
|
|
175
|
+
/**
|
|
176
|
+
* Apply ordered, app-owned migrations and record completed ids.
|
|
177
|
+
*/
|
|
178
|
+
apply(options: SqlMigrationApplyOptions): Promise<Result<SqlMigrationApplyResponse>>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Database handle interface for operations on a specific named database.
|
|
182
|
+
*/
|
|
183
|
+
interface IDatabaseHandle {
|
|
184
|
+
/** The database name */
|
|
185
|
+
readonly name: string;
|
|
186
|
+
/** Versioned schema migration helper. */
|
|
187
|
+
readonly migrations: ISQLMigrations;
|
|
188
|
+
/**
|
|
189
|
+
* Execute a SQL query and return rows.
|
|
190
|
+
*/
|
|
191
|
+
query<T = Record<string, unknown>>(sql: string, params?: SqlValue[], options?: QueryOptions): Promise<Result<QueryResponse<T>>>;
|
|
192
|
+
/**
|
|
193
|
+
* Execute a SQL statement and return change count.
|
|
194
|
+
*/
|
|
195
|
+
execute(sql: string, params?: SqlValue[], options?: ExecuteOptions): Promise<Result<ExecuteResponse>>;
|
|
196
|
+
/**
|
|
197
|
+
* Execute multiple statements in a transaction.
|
|
198
|
+
*/
|
|
199
|
+
batch(statements: SqlStatement[], options?: BatchOptions): Promise<Result<BatchResponse>>;
|
|
200
|
+
/**
|
|
201
|
+
* Execute a named prepared statement from delegation caveats.
|
|
202
|
+
*/
|
|
203
|
+
executeStatement(name: string, params?: SqlValue[], options?: QueryOptions): Promise<Result<QueryResponse | ExecuteResponse>>;
|
|
204
|
+
/**
|
|
205
|
+
* Export the raw SQLite database file.
|
|
206
|
+
*/
|
|
207
|
+
export(options?: QueryOptions): Promise<Result<Blob>>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* SQL service interface.
|
|
211
|
+
*
|
|
212
|
+
* Provides SQL database operations with:
|
|
213
|
+
* - Result type pattern (no throwing)
|
|
214
|
+
* - Named database handles
|
|
215
|
+
* - Configurable timeouts
|
|
216
|
+
* - Abort signal support
|
|
217
|
+
*/
|
|
218
|
+
interface ISQLService extends IService {
|
|
219
|
+
/**
|
|
220
|
+
* Get a handle to a named database.
|
|
221
|
+
* @param name - Database name (defaults to "default")
|
|
222
|
+
*/
|
|
223
|
+
db(name?: string): IDatabaseHandle;
|
|
224
|
+
/**
|
|
225
|
+
* Shortcut: query the default database.
|
|
226
|
+
*/
|
|
227
|
+
query<T = Record<string, unknown>>(sql: string, params?: SqlValue[], options?: QueryOptions): Promise<Result<QueryResponse<T>>>;
|
|
228
|
+
/**
|
|
229
|
+
* Shortcut: execute on the default database.
|
|
230
|
+
*/
|
|
231
|
+
execute(sql: string, params?: SqlValue[], options?: ExecuteOptions): Promise<Result<ExecuteResponse>>;
|
|
232
|
+
/**
|
|
233
|
+
* Shortcut: batch on the default database.
|
|
234
|
+
*/
|
|
235
|
+
batch(statements: SqlStatement[], options?: BatchOptions): Promise<Result<BatchResponse>>;
|
|
236
|
+
/**
|
|
237
|
+
* Service configuration.
|
|
238
|
+
*/
|
|
239
|
+
readonly config: SQLServiceConfig;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export { type BatchOptions as B, type ExecuteOptions as E, type IDatabaseHandle as I, type QueryOptions as Q, SQLAction as S, type BatchResponse as a, type ExecuteResponse as b, type ISQLMigrations as c, type ISQLService as d, type QueryResponse as e, type SQLActionType as f, type SQLServiceConfig as g, type SqlMigration as h, type SqlMigrationApplyOptions as i, type SqlMigrationApplyResponse as j, type SqlStatement as k, type SqlValue as l };
|
package/dist/context.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, T as TelemetryConfig, c as IService, E as EventHandler, d as FetchRequestInit, e as FetchResponse } from './types-
|
|
1
|
+
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, T as TelemetryConfig, c as IService, E as EventHandler, d as FetchRequestInit, e as FetchResponse } from './types-CSd0RYir.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ServiceContext implementation for TinyCloud SDK Services
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, T as TelemetryConfig, c as IService, E as EventHandler, d as FetchRequestInit, e as FetchResponse } from './types-
|
|
1
|
+
import { I as IServiceContext, a as InvokeFunction, b as InvokeAnyFunction, F as FetchFunction, S as ServiceSession, R as RetryPolicy, T as TelemetryConfig, c as IService, E as EventHandler, d as FetchRequestInit, e as FetchResponse } from './types-CSd0RYir.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ServiceContext implementation for TinyCloud SDK Services
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { c as IService,
|
|
3
|
-
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, p as ReceiverKeySigner, R as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation } from '../types-
|
|
4
|
-
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalize, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from '../types-
|
|
1
|
+
import { B as BaseService } from '../BaseService-O0iyuFLk.cjs';
|
|
2
|
+
import { c as IService, f as Result } from '../types-CSd0RYir.cjs';
|
|
3
|
+
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, p as ReceiverKeySigner, R as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation } from '../types-D4XbIfFJ.cjs';
|
|
4
|
+
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalize, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from '../types-D4XbIfFJ.cjs';
|
|
5
5
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { c as IService,
|
|
3
|
-
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, p as ReceiverKeySigner, R as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation } from '../types-
|
|
4
|
-
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalize, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from '../types-
|
|
1
|
+
import { B as BaseService } from '../BaseService-Ma2MwJAd.js';
|
|
2
|
+
import { c as IService, f as Result } from '../types-CSd0RYir.js';
|
|
3
|
+
import { N as NetworkDescriptor, n as EncryptionError, I as InlineEncryptedEnvelope, D as DecryptCapabilityProof, j as DecryptResponseBody, E as EncryptionCrypto, h as DecryptInvocationSigner, p as ReceiverKeySigner, R as ReceiverKeyPair, i as DecryptRequestBody, g as DecryptInvocationFact, B as BuildDecryptInvocationInput, a as BuiltDecryptInvocation } from '../types-Bf91gup6.js';
|
|
4
|
+
export { C as CanonicalJson, b as DECRYPT_ACTION, c as DECRYPT_FACT_TYPE, d as DECRYPT_RESULT_TYPE, e as DEFAULT_ENCRYPTION_ALG, f as DEFAULT_KEY_VERSION, k as ENCRYPTION_SERVICE, l as ENCRYPTION_SERVICE_SHORT, m as ENVELOPE_VERSION, o as EncryptionErrorInput, J as Json, q as base64Decode, r as base64Encode, s as canonicalHashHex, t as canonicalize, u as encryptionError, v as hexDecode, w as hexEncode, x as utf8Decode, y as utf8Encode } from '../types-Bf91gup6.js';
|
|
5
5
|
export { DecryptTransportResponseError } from '@tinycloud/sdk-services/internal/decrypt-transport-response-error';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EncryptionCrypto, I as InlineEncryptedEnvelope, J as Json } from '../types-
|
|
1
|
+
import { E as EncryptionCrypto, I as InlineEncryptedEnvelope, J as Json } from '../types-D4XbIfFJ.cjs';
|
|
2
2
|
import { ParsedKeyResource } from './resource.cjs';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-CSd0RYir.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Named-key client: key admin, descriptor reads, `ensureKey` and key-scoped
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EncryptionCrypto, I as InlineEncryptedEnvelope, J as Json } from '../types-
|
|
1
|
+
import { E as EncryptionCrypto, I as InlineEncryptedEnvelope, J as Json } from '../types-Bf91gup6.js';
|
|
2
2
|
import { ParsedKeyResource } from './resource.js';
|
|
3
|
-
import '../types-
|
|
3
|
+
import '../types-CSd0RYir.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Named-key client: key admin, descriptor reads, `ensureKey` and key-scoped
|