@terrascale/sdk 0.0.2 → 0.0.4
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/CHANGELOG.md +43 -0
- package/README.md +193 -56
- package/package.json +14 -5
- package/sdk-public-v1-route-manifest.json +81 -0
- package/sdk-v1-route-manifest.json +8996 -1697
- package/src/database-codec.js +21 -26
- package/src/database-types.js +11 -11
- package/src/database-view.js +6 -6
- package/src/http.js +13 -48
- package/src/ids.js +22 -0
- package/src/index.js +77 -2
- package/src/local/better-auth.js +17 -6
- package/src/local/environment.js +0 -1
- package/src/local/index.js +2 -2
- package/src/local/legacy-client.js +5 -5
- package/src/local/router.js +12 -12
- package/src/local/store.js +29 -28
- package/src/local/test-environment.js +3 -2
- package/src/postgres.js +5 -4
- package/src/react/core.js +2 -2
- package/src/ts-auth-ids.js +122 -0
- package/src/ts-auth.js +75 -77
- package/src/v1/backups.js +111 -0
- package/src/v1/catalog.js +210 -0
- package/src/v1/changes.js +225 -0
- package/src/v1/database-schema.js +45 -0
- package/src/v1/decode.js +20 -8
- package/src/v1/errors.js +23 -3
- package/src/v1/ids.js +9 -59
- package/src/v1/imports.js +72 -0
- package/src/v1/indexes.js +76 -0
- package/src/v1/json.js +4 -3
- package/src/v1/management-decode.js +24 -0
- package/src/v1/management-routes.js +67 -0
- package/src/v1/management-validation.js +25 -0
- package/src/v1/routes.js +36 -11
- package/src/v1/saved-queries.js +58 -0
- package/src/v1/shape-crypto.js +125 -0
- package/src/v1/shape-manifest.js +31 -0
- package/src/v1/shape-reader.js +212 -0
- package/src/v1/shape-subscription.js +208 -0
- package/src/v1/shapes.js +15 -10
- package/src/v1/sql.js +98 -0
- package/src/v1/system.js +80 -0
- package/src/v1/terrabase-v1.js +192 -33
- package/src/v1/transport.js +80 -34
- package/src/v1/usage.js +101 -0
- package/types/database-codec.d.ts +1 -6
- package/types/database-types.d.ts +11 -11
- package/types/http.d.ts +2 -8
- package/types/ids.d.ts +10 -0
- package/types/index.d.ts +70 -1
- package/types/local/environment.d.ts +1 -1
- package/types/local/store.d.ts +10 -0
- package/types/local/test-environment.d.ts +2 -2
- package/types/postgres.d.ts +4 -4
- package/types/ts-auth-ids.d.ts +14 -0
- package/types/ts-auth.d.ts +99 -101
- package/types/v1/backups.d.ts +128 -0
- package/types/v1/catalog.d.ts +92 -0
- package/types/v1/changes.d.ts +53 -0
- package/types/v1/database-schema.d.ts +82 -0
- package/types/v1/decode.d.ts +17 -4
- package/types/v1/errors.d.ts +16 -1
- package/types/v1/ids.d.ts +4 -16
- package/types/v1/imports.d.ts +132 -0
- package/types/v1/indexes.d.ts +75 -0
- package/types/v1/management-decode.d.ts +15 -0
- package/types/v1/management-routes.d.ts +3 -0
- package/types/v1/management-validation.d.ts +8 -0
- package/types/v1/routes.d.ts +5 -2
- package/types/v1/saved-queries.d.ts +33 -0
- package/types/v1/shape-crypto.d.ts +39 -0
- package/types/v1/shape-manifest.d.ts +28 -0
- package/types/v1/shape-reader.d.ts +45 -0
- package/types/v1/shape-subscription.d.ts +35 -0
- package/types/v1/shapes.d.ts +14 -0
- package/types/v1/sql.d.ts +47 -0
- package/types/v1/system.d.ts +85 -0
- package/types/v1/terrabase-v1.d.ts +116 -7
- package/types/v1/transport.d.ts +27 -10
- package/types/v1/usage.d.ts +171 -0
- package/src/ts-auth-discovery.js +0 -207
- package/types/ts-auth-discovery.d.ts +0 -19
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @param {JsonValue | undefined} value
|
|
3
|
+
* @returns {V1QueryPage}
|
|
4
|
+
*/
|
|
5
|
+
export function decodeQueryPage(value: JsonValue | undefined): V1QueryPage;
|
|
6
|
+
/** @typedef {{ readonly id: import("../ids.js").EntityId; readonly name: string; readonly createdAt: string }} V1CollectionInfo */
|
|
7
|
+
/** @typedef {{ readonly items: readonly V1CollectionInfo[]; readonly nextCursor: string | null }} V1CollectionPage */
|
|
8
|
+
/** @typedef {{ readonly limit?: number | undefined; readonly cursor?: string | undefined }} V1CollectionListOptions */
|
|
9
|
+
/** @param {JsonValue | undefined} value @returns {V1CollectionInfo} */
|
|
10
|
+
export function decodeCollection(value: JsonValue | undefined): V1CollectionInfo;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a project-scoped TerraBase client for documents, SQL, changes and catalog operations.
|
|
3
13
|
* @param {TerraBaseV1ClientConfig} config
|
|
4
14
|
* @returns {TerraBaseV1Client}
|
|
5
15
|
*/
|
|
@@ -33,7 +43,7 @@ export class V1Collection {
|
|
|
33
43
|
*/
|
|
34
44
|
put(id: string, document: JsonInputObject, options?: V1WriteOptions): Promise<V1WriteResult>;
|
|
35
45
|
/**
|
|
36
|
-
* Creates a document under a server-generated
|
|
46
|
+
* Creates a document under a server-generated ULID.
|
|
37
47
|
* @param {JsonInputObject} document
|
|
38
48
|
* @param {V1CreateOptions} [options]
|
|
39
49
|
* @returns {Promise<V1WriteResult>}
|
|
@@ -61,6 +71,17 @@ export class V1Collection {
|
|
|
61
71
|
* @returns {Promise<V1QueryPage>}
|
|
62
72
|
*/
|
|
63
73
|
query(query?: V1Query, options?: V1RequestOptions): Promise<V1QueryPage>;
|
|
74
|
+
/** @param {{ readonly limit?: number | undefined; readonly cursor?: string | undefined }} [request] @param {V1RequestOptions} [options] @returns {Promise<V1QueryPage>} */
|
|
75
|
+
list(request?: {
|
|
76
|
+
readonly limit?: number | undefined;
|
|
77
|
+
readonly cursor?: string | undefined;
|
|
78
|
+
}, options?: V1RequestOptions): Promise<V1QueryPage>;
|
|
79
|
+
/** @param {V1RequestOptions} [options] */
|
|
80
|
+
getSchema(options?: V1RequestOptions): Promise<import("./catalog.js").V1CollectionSchema>;
|
|
81
|
+
/** @param {import("./json.js").JsonInputObject | boolean} schema @param {V1RequestOptions} [options] */
|
|
82
|
+
putSchema(schema: import("./json.js").JsonInputObject | boolean, options?: V1RequestOptions): Promise<import("./catalog.js").V1CollectionSchema>;
|
|
83
|
+
/** @param {V1RequestOptions} [options] */
|
|
84
|
+
deleteSchema(options?: V1RequestOptions): Promise<import("./catalog.js").V1CollectionSchema>;
|
|
64
85
|
/**
|
|
65
86
|
* Iterates over every page, following `nextCursor`. `count`
|
|
66
87
|
* is sent with the first page only.
|
|
@@ -79,11 +100,50 @@ export class V1Collection {
|
|
|
79
100
|
/**
|
|
80
101
|
* Reads one C# shape snapshot page or change-log chunk. Bootstrap defaults to offset -1.
|
|
81
102
|
* Echo handle, nextOffset and cursor on the following read; discard state on must_refetch.
|
|
103
|
+
* ifNoneMatch sends a complete entity-tag list or *; 304 throws not_modified with cache headers.
|
|
82
104
|
* @param {V1ShapeRequest} [request]
|
|
105
|
+
* @param {V1RequestOptions & {readonly ifNoneMatch?: string}} [options]
|
|
106
|
+
* @returns {Promise<V1ShapePage>}
|
|
107
|
+
*/
|
|
108
|
+
shape(request?: V1ShapeRequest, options?: V1RequestOptions & {
|
|
109
|
+
readonly ifNoneMatch?: string;
|
|
110
|
+
}): Promise<V1ShapePage>;
|
|
111
|
+
/**
|
|
112
|
+
* Subscribe to the free-read v1 protocol. Stop with close() or the request signal.
|
|
113
|
+
* @param {{where?: V1Filter | undefined}} [request]
|
|
114
|
+
* @param {import("./shape-subscription.js").V1ShapeSubscribeOptions} [options]
|
|
115
|
+
* @returns {V1ShapeSubscription}
|
|
116
|
+
*/
|
|
117
|
+
subscribeShape(request?: {
|
|
118
|
+
where?: V1Filter | undefined;
|
|
119
|
+
}, options?: import("./shape-subscription.js").V1ShapeSubscribeOptions): V1ShapeSubscription;
|
|
120
|
+
/** @param {import("./shape-manifest.js").V1ShapeManifestRequest} request @param {V1RequestOptions} [options] */
|
|
121
|
+
shapeManifest(request: import("./shape-manifest.js").V1ShapeManifestRequest, options?: V1RequestOptions): Promise<Readonly<{
|
|
122
|
+
handle: string;
|
|
123
|
+
objects: readonly Readonly<{
|
|
124
|
+
offset: string;
|
|
125
|
+
next_offset: string;
|
|
126
|
+
binding: string;
|
|
127
|
+
object: string;
|
|
128
|
+
url: string;
|
|
129
|
+
expires_at: string;
|
|
130
|
+
epoch: string;
|
|
131
|
+
key_id: string;
|
|
132
|
+
sha256: string;
|
|
133
|
+
size: number | ExactDecimal;
|
|
134
|
+
}>[];
|
|
135
|
+
}>>;
|
|
136
|
+
/** @param {import("./shape-reader.js").V1ShapeKeyRequest} request @param {V1RequestOptions} [options] */
|
|
137
|
+
shapeKey(request: import("./shape-reader.js").V1ShapeKeyRequest, options?: V1RequestOptions): Promise<import("./shape-reader.js").V1ShapeKey>;
|
|
138
|
+
/**
|
|
139
|
+
* Verify a complete TBS1 object using its authenticated epoch key. Applies no state.
|
|
140
|
+
* Object delivery through manifests is pending the producer's FR-22 contract.
|
|
141
|
+
* @param {Uint8Array} bytes
|
|
142
|
+
* @param {import("./shape-reader.js").V1SealedShapePosition} position
|
|
83
143
|
* @param {V1RequestOptions} [options]
|
|
84
144
|
* @returns {Promise<V1ShapePage>}
|
|
85
145
|
*/
|
|
86
|
-
|
|
146
|
+
decryptShapeObject(bytes: Uint8Array, position: import("./shape-reader.js").V1SealedShapePosition, options?: V1RequestOptions): Promise<V1ShapePage>;
|
|
87
147
|
#private;
|
|
88
148
|
}
|
|
89
149
|
/**
|
|
@@ -107,7 +167,7 @@ export class V1Transaction {
|
|
|
107
167
|
get size(): number;
|
|
108
168
|
/**
|
|
109
169
|
* Adds a create (a put requiring absence). Omit `id` to have the server
|
|
110
|
-
* generate a
|
|
170
|
+
* generate a ULID, returned in the op's result.
|
|
111
171
|
* @param {string} collection
|
|
112
172
|
* @param {JsonInputObject} document
|
|
113
173
|
* @param {string} [id]
|
|
@@ -197,6 +257,16 @@ export class V1Database {
|
|
|
197
257
|
* @param {string} name
|
|
198
258
|
*/
|
|
199
259
|
constructor(transport: V1Transport, name: string);
|
|
260
|
+
/** @type {V1Imports} */
|
|
261
|
+
imports: V1Imports;
|
|
262
|
+
/** @type {V1Backups} */
|
|
263
|
+
backups: V1Backups;
|
|
264
|
+
/** @type {V1DatabaseUsageClient} */
|
|
265
|
+
metrics: V1DatabaseUsageClient;
|
|
266
|
+
/** @type {V1Indexes} */
|
|
267
|
+
indexes: V1Indexes;
|
|
268
|
+
/** @type {V1DatabaseSchemaClient} */
|
|
269
|
+
schema: V1DatabaseSchemaClient;
|
|
200
270
|
/** @type {V1Collections} */
|
|
201
271
|
collections: V1Collections;
|
|
202
272
|
/** @type {string} */
|
|
@@ -208,10 +278,18 @@ export class V1Database {
|
|
|
208
278
|
collection(name: string): V1Collection;
|
|
209
279
|
/** @returns {V1Transaction} */
|
|
210
280
|
transaction(): V1Transaction;
|
|
281
|
+
/** @param {string} statement @param {V1RequestOptions} [options] */
|
|
282
|
+
sql(statement: string, options?: V1RequestOptions): Promise<import("./sql.js").V1SqlResult>;
|
|
283
|
+
/** @param {string} statement @param {V1RequestOptions} [options] */
|
|
284
|
+
checkSql(statement: string, options?: V1RequestOptions): Promise<import("./sql.js").V1SqlCheck>;
|
|
285
|
+
/** @param {string} statement @param {V1RequestOptions} [options] */
|
|
286
|
+
explainSql(statement: string, options?: V1RequestOptions): Promise<import("./sql.js").V1SqlCheck>;
|
|
287
|
+
/** @param {import("./changes.js").V1ChangeStreamRequest} [request] @param {V1RequestOptions} [options] */
|
|
288
|
+
changes(request?: import("./changes.js").V1ChangeStreamRequest, options?: V1RequestOptions): AsyncGenerator<import("./changes.js").V1DatabaseChange | import("./changes.js").V1DatabaseChangeCursor, void, undefined>;
|
|
211
289
|
#private;
|
|
212
290
|
}
|
|
213
291
|
/**
|
|
214
|
-
* A TerraBase v1 data-plane client for one project and
|
|
292
|
+
* A TerraBase v1 data-plane client for one project and access token. The token is held
|
|
215
293
|
* privately; it is never serialized, logged or forwarded to redirects.
|
|
216
294
|
*/
|
|
217
295
|
export class TerraBaseV1Client {
|
|
@@ -222,9 +300,22 @@ export class TerraBaseV1Client {
|
|
|
222
300
|
* @returns {V1Database}
|
|
223
301
|
*/
|
|
224
302
|
database(name: string): V1Database;
|
|
303
|
+
/** @returns {V1Databases} Project-scoped database catalog. */
|
|
304
|
+
get databases(): V1Databases;
|
|
305
|
+
/** @returns {V1SavedQueries} */
|
|
306
|
+
get savedQueries(): V1SavedQueries;
|
|
307
|
+
/** @returns {V1ProjectUsageClient} */
|
|
308
|
+
get metrics(): V1ProjectUsageClient;
|
|
309
|
+
/** @returns {V1BackupDestinationClient} */
|
|
310
|
+
get backupDestination(): V1BackupDestinationClient;
|
|
311
|
+
/** @returns {V1Health} */
|
|
312
|
+
get health(): V1Health;
|
|
313
|
+
/** @returns {V1Platform} */
|
|
314
|
+
get platform(): V1Platform;
|
|
225
315
|
#private;
|
|
226
316
|
}
|
|
227
317
|
export type V1CollectionInfo = {
|
|
318
|
+
readonly id: import("../ids.js").EntityId;
|
|
228
319
|
readonly name: string;
|
|
229
320
|
readonly createdAt: string;
|
|
230
321
|
};
|
|
@@ -277,6 +368,10 @@ export type V1PatchOp = {
|
|
|
277
368
|
readonly op: "inc";
|
|
278
369
|
readonly path: string;
|
|
279
370
|
readonly by: number | bigint | ExactDecimal;
|
|
371
|
+
} | {
|
|
372
|
+
readonly op: "add" | "remove";
|
|
373
|
+
readonly path: string;
|
|
374
|
+
readonly value: import("./filter.js").V1Scalar;
|
|
280
375
|
} | {
|
|
281
376
|
readonly op: "append";
|
|
282
377
|
readonly path: string;
|
|
@@ -344,6 +439,7 @@ export type V1Precondition = {
|
|
|
344
439
|
export type V1TransactionOpResult = {
|
|
345
440
|
readonly id: string;
|
|
346
441
|
readonly version: string;
|
|
442
|
+
readonly document?: import("./json.js").JsonObject;
|
|
347
443
|
} | {
|
|
348
444
|
readonly asserted: true;
|
|
349
445
|
readonly count?: string;
|
|
@@ -360,15 +456,28 @@ export type V1TransactionResult = {
|
|
|
360
456
|
*/
|
|
361
457
|
results: readonly V1TransactionOpResult[];
|
|
362
458
|
};
|
|
459
|
+
import type { JsonValue } from "./json.js";
|
|
363
460
|
import type { TerraBaseV1ClientConfig } from "./transport.js";
|
|
364
461
|
import type { V1Document } from "./decode.js";
|
|
365
462
|
import type { JsonInputObject } from "./json.js";
|
|
366
463
|
import type { V1WriteResult } from "./decode.js";
|
|
367
464
|
import type { V1ShapeRequest } from "./shapes.js";
|
|
368
465
|
import type { V1ShapePage } from "./shapes.js";
|
|
369
|
-
import { V1Transport } from "./transport.js";
|
|
370
466
|
import type { V1Filter } from "./filter.js";
|
|
371
|
-
import
|
|
467
|
+
import { V1ShapeSubscription } from "./shape-subscription.js";
|
|
372
468
|
import { ExactDecimal } from "./json.js";
|
|
469
|
+
import { V1Transport } from "./transport.js";
|
|
470
|
+
import { V1Imports } from "./imports.js";
|
|
471
|
+
import { V1Backups } from "./backups.js";
|
|
472
|
+
import { V1DatabaseUsageClient } from "./usage.js";
|
|
473
|
+
import { V1Indexes } from "./indexes.js";
|
|
474
|
+
import { V1DatabaseSchemaClient } from "./database-schema.js";
|
|
475
|
+
import { V1Databases } from "./catalog.js";
|
|
476
|
+
import { V1SavedQueries } from "./saved-queries.js";
|
|
477
|
+
import { V1ProjectUsageClient } from "./usage.js";
|
|
478
|
+
import { V1BackupDestinationClient } from "./backups.js";
|
|
479
|
+
import { V1Health } from "./system.js";
|
|
480
|
+
import { V1Platform } from "./system.js";
|
|
481
|
+
import type { JsonInput } from "./json.js";
|
|
373
482
|
import type { V1Path } from "./filter.js";
|
|
374
483
|
import type { V1Durability } from "./decode.js";
|
package/types/v1/transport.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export class BodyTransportError extends Error {
|
|
|
23
23
|
/** @param {unknown} cause */
|
|
24
24
|
constructor(cause: unknown);
|
|
25
25
|
}
|
|
26
|
-
/** Internal transport bound to one
|
|
26
|
+
/** Internal transport bound to one project credential. */
|
|
27
27
|
export class V1Transport {
|
|
28
28
|
/**
|
|
29
29
|
* @param {Response} response
|
|
@@ -31,8 +31,11 @@ export class V1Transport {
|
|
|
31
31
|
* @returns {JsonValue | undefined}
|
|
32
32
|
*/
|
|
33
33
|
static "__#private@#decodeJson"(response: Response, text: string): JsonValue | undefined;
|
|
34
|
-
/** @param {TerraBaseV1ClientConfig} config */
|
|
35
|
-
constructor(config: TerraBaseV1ClientConfig)
|
|
34
|
+
/** @param {TerraBaseV1ClientConfig | (import("./system.js").TerraBaseSystemClientConfig & { project?: undefined; endpointResolver?: undefined })} config */
|
|
35
|
+
constructor(config: TerraBaseV1ClientConfig | (import("./system.js").TerraBaseSystemClientConfig & {
|
|
36
|
+
project?: undefined;
|
|
37
|
+
endpointResolver?: undefined;
|
|
38
|
+
}));
|
|
36
39
|
/**
|
|
37
40
|
* @param {V1Operation} operation
|
|
38
41
|
* @param {Readonly<Record<string, string>>} params
|
|
@@ -44,21 +47,24 @@ export class V1Transport {
|
|
|
44
47
|
* Reads a response body as UTF-8 text within the response byte bound. A
|
|
45
48
|
* connection failure while reading is a BodyTransportError.
|
|
46
49
|
* @param {Response} response
|
|
50
|
+
* @param {AbortSignal | undefined} [signal]
|
|
47
51
|
* @returns {Promise<string>}
|
|
48
52
|
*/
|
|
49
|
-
readText(response: Response): Promise<string>;
|
|
53
|
+
readText(response: Response, signal?: AbortSignal | undefined): Promise<string>;
|
|
50
54
|
/**
|
|
51
55
|
* Parses a JSON response body exactly.
|
|
52
56
|
* @param {Response} response
|
|
57
|
+
* @param {AbortSignal | undefined} [signal]
|
|
53
58
|
* @returns {Promise<JsonValue | undefined>}
|
|
54
59
|
*/
|
|
55
|
-
readJson(response: Response): Promise<JsonValue | undefined>;
|
|
60
|
+
readJson(response: Response, signal?: AbortSignal | undefined): Promise<JsonValue | undefined>;
|
|
56
61
|
/**
|
|
57
62
|
* Converts a non-success response to a TerraBaseV1Error.
|
|
58
63
|
* @param {Response} response
|
|
64
|
+
* @param {AbortSignal | undefined} [signal]
|
|
59
65
|
* @returns {Promise<TerraBaseV1Error>}
|
|
60
66
|
*/
|
|
61
|
-
error(response: Response): Promise<TerraBaseV1Error>;
|
|
67
|
+
error(response: Response, signal?: AbortSignal | undefined): Promise<TerraBaseV1Error>;
|
|
62
68
|
/**
|
|
63
69
|
* Calls only a named producer route. Redirects and failed mutations are never replayed.
|
|
64
70
|
* @param {V1Operation} operation
|
|
@@ -67,14 +73,21 @@ export class V1Transport {
|
|
|
67
73
|
* @returns {Promise<V1CallResult>}
|
|
68
74
|
*/
|
|
69
75
|
call(operation: V1Operation, params: Readonly<Record<string, string>>, options?: V1CallOptions): Promise<V1CallResult>;
|
|
76
|
+
/**
|
|
77
|
+
* @param {"streamDatabaseChanges"} operation
|
|
78
|
+
* @param {Readonly<Record<string, string>>} params
|
|
79
|
+
* @param {V1CallOptions} [options]
|
|
80
|
+
* @returns {Promise<Response>}
|
|
81
|
+
*/
|
|
82
|
+
openStream(operation: "streamDatabaseChanges", params: Readonly<Record<string, string>>, options?: V1CallOptions): Promise<Response>;
|
|
70
83
|
#private;
|
|
71
84
|
}
|
|
72
85
|
/**
|
|
73
86
|
* Resolver input contains no credential. A successful URL is cached for this client/database.
|
|
74
87
|
*/
|
|
75
88
|
export type V1EndpointContext = {
|
|
76
|
-
readonly project: string;
|
|
77
|
-
readonly database
|
|
89
|
+
readonly project: string | undefined;
|
|
90
|
+
readonly database?: string | undefined;
|
|
78
91
|
readonly signal?: AbortSignal | undefined;
|
|
79
92
|
};
|
|
80
93
|
export type V1EndpointResolver = (context: V1EndpointContext) => string | Promise<string>;
|
|
@@ -85,7 +98,7 @@ export type V1EndpointResolver = (context: V1EndpointContext) => string | Promis
|
|
|
85
98
|
export type TerraBaseV1ClientConfig = {
|
|
86
99
|
project: string;
|
|
87
100
|
/**
|
|
88
|
-
* A tb_
|
|
101
|
+
* A ts-auth project access JWT (or a legacy C# tb_ key); held privately.
|
|
89
102
|
*/
|
|
90
103
|
token: string;
|
|
91
104
|
baseUrl?: string | undefined;
|
|
@@ -97,7 +110,7 @@ export type TerraBaseV1ClientConfig = {
|
|
|
97
110
|
maxResponseBytes?: number | undefined;
|
|
98
111
|
};
|
|
99
112
|
export type V1CallOptions = {
|
|
100
|
-
body?: string;
|
|
113
|
+
body?: string | Uint8Array;
|
|
101
114
|
contentType?: string;
|
|
102
115
|
/**
|
|
103
116
|
* Contract headers only (If-Match, If-None-Match).
|
|
@@ -105,6 +118,10 @@ export type V1CallOptions = {
|
|
|
105
118
|
headers?: Readonly<Record<string, string>>;
|
|
106
119
|
query?: URLSearchParams | undefined;
|
|
107
120
|
signal?: AbortSignal | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Authenticated shape epoch keys must bypass caches.
|
|
123
|
+
*/
|
|
124
|
+
cache?: "no-store" | undefined;
|
|
108
125
|
};
|
|
109
126
|
export type V1CallResult = {
|
|
110
127
|
status: number;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/** Project and database usage retain the producer's separate response envelopes. */
|
|
2
|
+
export class V1ProjectUsageClient {
|
|
3
|
+
/** @param {V1Transport} transport */
|
|
4
|
+
constructor(transport: V1Transport);
|
|
5
|
+
/** @param {V1UsageRequest} [request] @param {V1RequestOptions} [options] @returns {Promise<V1ProjectUsage>} */
|
|
6
|
+
usage(request?: V1UsageRequest, options?: V1RequestOptions): Promise<V1ProjectUsage>;
|
|
7
|
+
/** @param {V1AnalyticsRequest} [request] @param {V1RequestOptions} [options] @returns {Promise<V1Analytics>} */
|
|
8
|
+
analytics(request?: V1AnalyticsRequest, options?: V1RequestOptions): Promise<V1Analytics>;
|
|
9
|
+
/** @param {V1AnalyticsRequest} [request] @param {V1RequestOptions} [options] @returns {Promise<V1Replication>} */
|
|
10
|
+
replication(request?: V1AnalyticsRequest, options?: V1RequestOptions): Promise<V1Replication>;
|
|
11
|
+
#private;
|
|
12
|
+
}
|
|
13
|
+
export class V1DatabaseUsageClient {
|
|
14
|
+
/** @param {V1Transport} transport @param {string} database */
|
|
15
|
+
constructor(transport: V1Transport, database: string);
|
|
16
|
+
/** @param {V1UsageRequest} [request] @param {V1RequestOptions} [options] @returns {Promise<V1DatabaseUsage>} */
|
|
17
|
+
usage(request?: V1UsageRequest, options?: V1RequestOptions): Promise<V1DatabaseUsage>;
|
|
18
|
+
/** @param {Omit<V1AnalyticsRequest, "database">} [request] @param {V1RequestOptions} [options] @returns {Promise<V1Analytics>} */
|
|
19
|
+
analytics(request?: Omit<V1AnalyticsRequest, "database">, options?: V1RequestOptions): Promise<V1Analytics>;
|
|
20
|
+
/** @param {Omit<V1AnalyticsRequest, "database">} [request] @param {V1RequestOptions} [options] @returns {Promise<V1Replication>} */
|
|
21
|
+
replication(request?: Omit<V1AnalyticsRequest, "database">, options?: V1RequestOptions): Promise<V1Replication>;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
24
|
+
export type V1DatabaseUsage = ReturnType<typeof databaseUsage>;
|
|
25
|
+
export type V1ProjectUsage = ReturnType<typeof projectUsage>;
|
|
26
|
+
export type V1Analytics = ReturnType<typeof analytics>;
|
|
27
|
+
export type V1Replication = ReturnType<typeof replication>;
|
|
28
|
+
export type V1UsageRequest = {
|
|
29
|
+
readonly granularity?: "hour" | "day";
|
|
30
|
+
readonly from?: string;
|
|
31
|
+
readonly to?: string;
|
|
32
|
+
};
|
|
33
|
+
export type V1AnalyticsRequest = {
|
|
34
|
+
readonly range?: "1h" | "24h" | "7d" | "30d";
|
|
35
|
+
readonly database?: string;
|
|
36
|
+
readonly region?: string;
|
|
37
|
+
};
|
|
38
|
+
import type { V1RequestOptions } from "./terrabase-v1.js";
|
|
39
|
+
import type { V1Transport } from "./transport.js";
|
|
40
|
+
declare const databaseUsage: import("./management-decode.js").Decoder<Readonly<{
|
|
41
|
+
databaseId: string;
|
|
42
|
+
storageBytes: number | import("./json.js").ExactDecimal;
|
|
43
|
+
logicalBytes: number | import("./json.js").ExactDecimal;
|
|
44
|
+
collections: number | import("./json.js").ExactDecimal;
|
|
45
|
+
documents: number | import("./json.js").ExactDecimal;
|
|
46
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
47
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
48
|
+
period: Readonly<{
|
|
49
|
+
from: string;
|
|
50
|
+
to: string;
|
|
51
|
+
granularity: string;
|
|
52
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
53
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
54
|
+
}>;
|
|
55
|
+
series: readonly Readonly<{
|
|
56
|
+
start: string;
|
|
57
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
58
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
59
|
+
}>[];
|
|
60
|
+
}>>;
|
|
61
|
+
declare const projectUsage: import("./management-decode.js").Decoder<Readonly<{
|
|
62
|
+
projectId: string;
|
|
63
|
+
databases: number | import("./json.js").ExactDecimal;
|
|
64
|
+
storageBytes: number | import("./json.js").ExactDecimal;
|
|
65
|
+
logicalBytes: number | import("./json.js").ExactDecimal;
|
|
66
|
+
documents: number | import("./json.js").ExactDecimal;
|
|
67
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
68
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
69
|
+
period: Readonly<{
|
|
70
|
+
from: string;
|
|
71
|
+
to: string;
|
|
72
|
+
granularity: string;
|
|
73
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
74
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
75
|
+
}>;
|
|
76
|
+
series: readonly Readonly<{
|
|
77
|
+
start: string;
|
|
78
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
79
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
80
|
+
}>[];
|
|
81
|
+
items: readonly Readonly<{
|
|
82
|
+
databaseId: string;
|
|
83
|
+
storageBytes: number | import("./json.js").ExactDecimal;
|
|
84
|
+
logicalBytes: number | import("./json.js").ExactDecimal;
|
|
85
|
+
collections: number | import("./json.js").ExactDecimal;
|
|
86
|
+
documents: number | import("./json.js").ExactDecimal;
|
|
87
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
88
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
89
|
+
period: Readonly<{
|
|
90
|
+
from: string;
|
|
91
|
+
to: string;
|
|
92
|
+
granularity: string;
|
|
93
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
94
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
95
|
+
}>;
|
|
96
|
+
series: readonly Readonly<{
|
|
97
|
+
start: string;
|
|
98
|
+
reads: number | import("./json.js").ExactDecimal;
|
|
99
|
+
writes: number | import("./json.js").ExactDecimal;
|
|
100
|
+
}>[];
|
|
101
|
+
}>[];
|
|
102
|
+
}>>;
|
|
103
|
+
declare const analytics: import("./management-decode.js").Decoder<Readonly<{
|
|
104
|
+
projectId: string;
|
|
105
|
+
range: string;
|
|
106
|
+
from: string;
|
|
107
|
+
to: string;
|
|
108
|
+
bucketSeconds: number | import("./json.js").ExactDecimal;
|
|
109
|
+
items: readonly Readonly<{
|
|
110
|
+
databaseId: string;
|
|
111
|
+
databaseName: string;
|
|
112
|
+
region: string;
|
|
113
|
+
series: readonly Readonly<{
|
|
114
|
+
start: string;
|
|
115
|
+
requests: Readonly<Record<string, number | import("./json.js").ExactDecimal>>;
|
|
116
|
+
operations: Readonly<Record<string, number | import("./json.js").ExactDecimal>>;
|
|
117
|
+
errors: number | import("./json.js").ExactDecimal;
|
|
118
|
+
latency: Readonly<{
|
|
119
|
+
p50Ms: /*elided*/ any;
|
|
120
|
+
p95Ms: /*elided*/ any;
|
|
121
|
+
p99Ms: /*elided*/ any;
|
|
122
|
+
}>;
|
|
123
|
+
storageBytes: number | import("./json.js").ExactDecimal | null;
|
|
124
|
+
clientBandwidth: Readonly<{
|
|
125
|
+
bytesSent: /*elided*/ any;
|
|
126
|
+
bytesReceived: /*elided*/ any;
|
|
127
|
+
}>;
|
|
128
|
+
replicationBandwidth: Readonly<{
|
|
129
|
+
bytesSent: /*elided*/ any;
|
|
130
|
+
bytesReceived: /*elided*/ any;
|
|
131
|
+
}>;
|
|
132
|
+
}>[];
|
|
133
|
+
}>[];
|
|
134
|
+
}>>;
|
|
135
|
+
declare const replication: import("./management-decode.js").Decoder<Readonly<{
|
|
136
|
+
projectId: string;
|
|
137
|
+
range: string;
|
|
138
|
+
from: string;
|
|
139
|
+
to: string;
|
|
140
|
+
bucketSeconds: number | import("./json.js").ExactDecimal;
|
|
141
|
+
items: readonly Readonly<{
|
|
142
|
+
databaseId: string;
|
|
143
|
+
databaseName: string;
|
|
144
|
+
region: string;
|
|
145
|
+
status: string;
|
|
146
|
+
replicatedOps: number | import("./json.js").ExactDecimal;
|
|
147
|
+
lagMs: number | import("./json.js").ExactDecimal | null;
|
|
148
|
+
divergence: boolean | null;
|
|
149
|
+
convergenceMs: number | import("./json.js").ExactDecimal | null;
|
|
150
|
+
lastApplied: string | null;
|
|
151
|
+
bandwidth: readonly Readonly<{
|
|
152
|
+
sourceRegion: string;
|
|
153
|
+
destinationRegion: string;
|
|
154
|
+
kind: string;
|
|
155
|
+
bytesSent: number | import("./json.js").ExactDecimal;
|
|
156
|
+
bytesReceived: number | import("./json.js").ExactDecimal;
|
|
157
|
+
}>[];
|
|
158
|
+
series: readonly Readonly<{
|
|
159
|
+
start: string;
|
|
160
|
+
replicatedOps: number | import("./json.js").ExactDecimal;
|
|
161
|
+
bandwidth: readonly Readonly<{
|
|
162
|
+
sourceRegion: /*elided*/ any;
|
|
163
|
+
destinationRegion: /*elided*/ any;
|
|
164
|
+
kind: /*elided*/ any;
|
|
165
|
+
bytesSent: /*elided*/ any;
|
|
166
|
+
bytesReceived: /*elided*/ any;
|
|
167
|
+
}>[];
|
|
168
|
+
}>[];
|
|
169
|
+
}>[];
|
|
170
|
+
}>>;
|
|
171
|
+
export {};
|