@terrascale/sdk 0.0.2 → 0.0.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/types/v1/ids.d.ts CHANGED
@@ -5,16 +5,13 @@
5
5
  */
6
6
  export function requireName(kind: "database" | "collection", name: unknown): string;
7
7
  /**
8
- * The producer resolves this opaque catalog project id (normally a UUID), not its display name.
8
+ * The catalog project ID is a canonical ULID; database and collection routes use names.
9
9
  * @param {unknown} project
10
- * @returns {string}
11
- */
12
- export function requireProject(project: unknown): string;
13
- /**
14
- * @param {unknown} id
15
- * @returns {string}
10
+ * @returns {import("../ids.js").EntityId}
16
11
  */
17
- export function requireDocumentId(id: unknown): string;
12
+ export function requireProject(project: unknown): import("../ids.js").EntityId;
13
+ /** @param {unknown} id @returns {import("../ids.js").EntityId} */
14
+ export function requireDocumentId(id: unknown): import("../ids.js").EntityId;
18
15
  /**
19
16
  * @param {unknown} version
20
17
  * @returns {string}
@@ -33,12 +30,3 @@ export function parseU64(value: unknown): bigint | undefined;
33
30
  * @returns {bigint}
34
31
  */
35
32
  export function requireU64(value: unknown, what: string): bigint;
36
- /**
37
- * The deterministic document ID for a natural key in a collection:
38
- * `uuidv5(uuidv5(NAMESPACE_URL, "terrabase:collection:" + collection), key)`.
39
- * Uses WebCrypto, so it works in Node.js, browsers and workers.
40
- * @param {string} collection
41
- * @param {string} key
42
- * @returns {Promise<string>}
43
- */
44
- export function documentIdFor(collection: string, key: string): Promise<string>;
@@ -42,12 +42,12 @@ export type V1ShapeRequest = {
42
42
  };
43
43
  export type V1ShapeOp = {
44
44
  readonly op: "upsert";
45
- readonly id: string;
45
+ readonly id: import("../ids.js").EntityId;
46
46
  readonly version: string;
47
47
  readonly document: JsonObject;
48
48
  } | {
49
49
  readonly op: "delete";
50
- readonly id: string;
50
+ readonly id: import("../ids.js").EntityId;
51
51
  };
52
52
  export type V1ShapeChange = {
53
53
  readonly offset: string;
@@ -33,7 +33,7 @@ export class V1Collection {
33
33
  */
34
34
  put(id: string, document: JsonInputObject, options?: V1WriteOptions): Promise<V1WriteResult>;
35
35
  /**
36
- * Creates a document under a server-generated UUIDv7.
36
+ * Creates a document under a server-generated ULID.
37
37
  * @param {JsonInputObject} document
38
38
  * @param {V1CreateOptions} [options]
39
39
  * @returns {Promise<V1WriteResult>}
@@ -107,7 +107,7 @@ export class V1Transaction {
107
107
  get size(): number;
108
108
  /**
109
109
  * Adds a create (a put requiring absence). Omit `id` to have the server
110
- * generate a UUIDv7, returned in the op's result.
110
+ * generate a ULID, returned in the op's result.
111
111
  * @param {string} collection
112
112
  * @param {JsonInputObject} document
113
113
  * @param {string} [id]
@@ -211,7 +211,7 @@ export class V1Database {
211
211
  #private;
212
212
  }
213
213
  /**
214
- * A TerraBase v1 data-plane client for one project and `tb_` API key. The key is held
214
+ * A TerraBase v1 data-plane client for one project and access token. The token is held
215
215
  * privately; it is never serialized, logged or forwarded to redirects.
216
216
  */
217
217
  export class TerraBaseV1Client {
@@ -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 data key. */
26
+ /** Internal transport bound to one project credential. */
27
27
  export class V1Transport {
28
28
  /**
29
29
  * @param {Response} response
@@ -85,7 +85,7 @@ export type V1EndpointResolver = (context: V1EndpointContext) => string | Promis
85
85
  export type TerraBaseV1ClientConfig = {
86
86
  project: string;
87
87
  /**
88
- * A tb_ API key; held privately.
88
+ * A ts-auth project access JWT (or a legacy C# tb_ key); held privately.
89
89
  */
90
90
  token: string;
91
91
  baseUrl?: string | undefined;