@distilled.cloud/turso 1.0.0-rc.12 → 1.0.0-rc.14

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/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @distilled.cloud/turso
2
+
3
+ Effect-native SDK for [turso](https://www.npmjs.com/package/@distilled.cloud/turso).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @distilled.cloud/turso effect
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { Effect, Layer } from "effect";
15
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
16
+ import * as Turso from "@distilled.cloud/turso";
17
+
18
+ const program = Effect.gen(function* () {
19
+ const result = yield* Turso.listAPITokens({});
20
+ return result;
21
+ });
22
+
23
+ const Live = Layer.mergeAll(
24
+ FetchHttpClient.layer,
25
+ Turso.CredentialsFromEnv,
26
+ Turso.TursoProtocol,
27
+ );
28
+
29
+ program.pipe(Effect.provide(Live), Effect.runPromise);
30
+ ```
31
+
32
+ ## Auth
33
+
34
+ Required: `TURSO_API_KEY`. Sent as `Authorization: Bearer`.
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAGV;CAAG;AAM1B,eAAO,MAAM,kBAAkB,wCAe9B,CAAC"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAMJ,eAAO,MAAM,kBAAkB,wCAe9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAO7D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAG7C,CAAC,kBAAkB,CAAC;CAAG;AAE1B,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAC7C,WAAW,EACX,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EAAE,gDAAgD;CAC1D,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC"}
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAO7D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAAsC,CACpF,kBAAkB,CACnB;CAAG;AAEJ,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAC7C,WAAW,EACX,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EAAE,gDAAgD;CAC1D,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAC5B,QAAQ,IAAI,YAAY,EACxB,aAAa,IAAI,iBAAiB,EAClC,SAAS,IAAI,aAAa,EAC1B,MAAM,IAAI,UAAU,EACpB,QAAQ,IAAI,YAAY,EACxB,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;;AAGxC;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,sBAOP;CAAG;;;;;;;;;AAEnC;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAMN;CAAG;AAElC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,uBAAuB,GACvB,UAAU,GACV,YAAY,CAAC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAC5B,QAAQ,IAAI,YAAY,EACxB,aAAa,IAAI,iBAAiB,EAClC,SAAS,IAAI,aAAa,EAC1B,MAAM,IAAI,UAAU,EACpB,QAAQ,IAAI,YAAY,EACxB,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;;AAExC;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,sBAOP;CAAG;;;;;;;;;AAEnC;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAGL;CAAG;AAEnC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,uBAAuB,GACvB,UAAU,GACV,YAAY,CAAC"}
package/lib/errors.js CHANGED
@@ -7,8 +7,8 @@
7
7
  * Turso error bodies have the shape `{ error: string, code?: string }`.
8
8
  */
9
9
  export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
10
- import * as Schema from "effect/Schema";
11
10
  import * as Category from "@distilled.cloud/core/category";
11
+ import * as Schema from "effect/Schema";
12
12
  /**
13
13
  * Unknown Turso error — returned when an error response cannot be mapped to
14
14
  * a shared HTTP status class. Carries the raw `code` string Turso sometimes
package/lib/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAWtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,mBAAmB,EACnB;IACE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEnC;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CACxE,iBAAiB,EACjB;IACE,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAU3D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,mBAAmB,EACnB;IACE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEnC;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CAAC,iBAAiB,EAAE;IAC5F,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG"}
package/lib/index.d.ts CHANGED
@@ -14,6 +14,6 @@ export * from "./credentials.ts";
14
14
  export * from "./errors.ts";
15
15
  export * as T from "./traits.ts";
16
16
  export * as Retry from "./retry.ts";
17
- export { TursoProtocol, type TursoOpError, type TursoOpContext, } from "./protocol.ts";
17
+ export { TursoProtocol, type TursoOpError, type TursoOpContext } from "./protocol.ts";
18
18
  export * as Services from "./services/index.ts";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -14,6 +14,6 @@ export * from "./credentials.js";
14
14
  export * from "./errors.js";
15
15
  export * as T from "./traits.js";
16
16
  export * as Retry from "./retry.js";
17
- export { TursoProtocol, } from "./protocol.js";
17
+ export { TursoProtocol } from "./protocol.js";
18
18
  export * as Services from "./services/index.js";
19
19
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EACL,aAAa,GAGd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAA0C,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
package/lib/protocol.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type * as Layer from "effect/Layer";
2
- import type * as HttpClient from "effect/unstable/http/HttpClient";
3
- import type * as HttpClientError from "effect/unstable/http/HttpClientError";
4
1
  import type * as API from "@distilled.cloud/core/api";
5
2
  import type { ConfigError } from "@distilled.cloud/core/errors";
3
+ import type * as HttpClient from "effect/http/HttpClient";
4
+ import type * as HttpClientError from "effect/http/HttpClientError";
5
+ import type * as Layer from "effect/Layer";
6
6
  import { Credentials } from "./credentials.ts";
7
7
  import { type DefaultErrors } from "./errors.ts";
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,WAAW,GACX,eAAe,CAAC,eAAe,CAAC;AAEpC,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAEjE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CA0BhD,CAAC"}
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAmBhE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAqB,KAAK,aAAa,EAAmB,MAAM,aAAa,CAAC;AAErF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,CAAC,eAAe,CAAC;AAEzF,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAEjE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAqBlD,CAAC"}
package/lib/protocol.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
1
2
  /**
2
3
  * TursoProtocol — hand-written.
3
4
  *
@@ -16,9 +17,8 @@
16
17
  */
17
18
  import * as Effect from "effect/Effect";
18
19
  import * as Redacted from "effect/Redacted";
19
- import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
20
20
  import { Credentials } from "./credentials.js";
21
- import { UnknownTursoError } from "./errors.js";
21
+ import { UnknownTursoError, TursoParseError } from "./errors.js";
22
22
  export const TursoProtocol = makeRestProtocol({
23
23
  // The Credentials service holds an effect — resolving it here (per
24
24
  // request) picks up rotations. Its error channel is erased at the protocol
@@ -34,13 +34,10 @@ export const TursoProtocol = makeRestProtocol({
34
34
  // Turso error bodies are `{ error: string, code?: string }` — covered by
35
35
  // the default lenient envelope (message ?? error, string codes kept).
36
36
  unknownError: ({ code, message, body }) => new UnknownTursoError({
37
- code: typeof code === "string"
38
- ? code
39
- : code !== undefined
40
- ? String(code)
41
- : undefined,
37
+ code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
42
38
  message,
43
39
  body,
44
40
  }),
41
+ parseError: ({ body, cause }) => new TursoParseError({ body, cause }),
45
42
  });
46
43
  //# sourceMappingURL=protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAsB,MAAM,aAAa,CAAC;AAgBpE,MAAM,CAAC,MAAM,aAAa,GACxB,gBAAgB,CAAS;IACvB,mEAAmE;IACnE,2EAA2E;IAC3E,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;QACnC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC;IACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnB,aAAa,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;KACxD,CAAC;IACF,yEAAyE;IACzE,sEAAsE;IACtE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CACxC,IAAI,iBAAiB,CAAC;QACpB,IAAI,EACF,OAAO,IAAI,KAAK,QAAQ;YACtB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI,KAAK,SAAS;gBAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,SAAS;QACjB,OAAO;QACP,IAAI;KACL,CAAC;CACL,CAAC,CAAC"}
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAsB,eAAe,EAAE,MAAM,aAAa,CAAC;AAarF,MAAM,CAAC,MAAM,aAAa,GAA8B,gBAAgB,CAAS;IAC/E,mEAAmE;IACnE,2EAA2E;IAC3E,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;QACnC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC;IACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnB,aAAa,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;KACxD,CAAC;IACF,yEAAyE;IACzE,sEAAsE;IACtE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CACxC,IAAI,iBAAiB,CAAC;QACpB,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QACrF,OAAO;QACP,IAAI;KACL,CAAC;IACJ,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;CACtE,CAAC,CAAC"}
package/lib/retry.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type Policy } from "@distilled.cloud/core/retry";
1
2
  /**
2
3
  * Turso retry configuration.
3
4
  *
@@ -16,7 +17,6 @@
16
17
  */
17
18
  import * as Context from "effect/Context";
18
19
  import * as Effect from "effect/Effect";
19
- import { type Policy } from "@distilled.cloud/core/retry";
20
20
  export { type Options, type Factory, type Policy, makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
21
21
  declare const Retry_base: Context.ServiceClass<Retry, "TursoRetry", Policy>;
22
22
  /** Context tag for configuring retry behavior of Turso API calls. */
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EACL,KAAK,MAAM,EAGZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,UAA8C;CAAG;AAE5E,uEAAuE;AACvE,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAEhB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA4B,CAAC;AAEpD,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAA2B,CAAC"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAuC,MAAM,6BAA6B,CAAC;AAC/F;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,UAA8C;CAAG;AAE5E,uEAAuE;AACvE,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAA+D,CAAC;AAEjF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA4B,CAAC;AAEpD,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAA2B,CAAC"}
package/lib/retry.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
1
2
  /**
2
3
  * Turso retry configuration.
3
4
  *
@@ -17,7 +18,6 @@
17
18
  import * as Context from "effect/Context";
18
19
  import * as Effect from "effect/Effect";
19
20
  import * as Layer from "effect/Layer";
20
- import { throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
21
21
  export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
22
22
  /** Context tag for configuring retry behavior of Turso API calls. */
23
23
  export class Retry extends Context.Service()("TursoRetry") {
package/lib/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAIL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,YAAY,CAAC;CAAG;AAE5E,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,gBAAwB,EAAE,EAAE,CACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sCAAsC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAChC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAC7C,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEpD,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/F;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAIL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,YAAY,CAAC;CAAG;AAE5E,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,gBAAwB,EAAE,EAAE,CACjD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sCAAsC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAEjF,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEpD,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
- import * as S from "@distilled.cloud/core/schema";
2
1
  import * as API from "@distilled.cloud/core/api";
2
+ import * as S from "@distilled.cloud/core/schema";
3
+ import * as Redacted from "effect/Redacted";
3
4
  import { type TursoOpError, type TursoOpContext } from "../protocol.ts";
4
5
  export type { TursoOpError, TursoOpContext };
5
6
  declare const BadRequest_base: S.Class<BadRequest, S.TaggedStruct<"BadRequest", {
@@ -114,7 +115,7 @@ export interface CreateAPITokenResponse {
114
115
  name?: string;
115
116
  id?: string;
116
117
  /** The actual token contents as a JWT. This is used with the `Bearer` header, see [Authentication](/authentication) for more details. **This token is never revealed again.** */
117
- token?: string;
118
+ token?: Redacted.Redacted<string>;
118
119
  }
119
120
  export declare const CreateAPITokenResponse: S.Schema<CreateAPITokenResponse>;
120
121
  /** The type of seed to be used to create a new database. Use `database` to copy from an existing database, or `database_upload` to [upload a SQLite database file](/api-reference/databases/upload). */
@@ -195,7 +196,7 @@ export interface CreateDatabaseTokenRequest {
195
196
  export declare const CreateDatabaseTokenRequest: S.Schema<CreateDatabaseTokenRequest>;
196
197
  export interface CreateDatabaseTokenResponse {
197
198
  /** The generated authorization token (JWT). */
198
- jwt?: string;
199
+ jwt?: Redacted.Redacted<string>;
199
200
  }
200
201
  export declare const CreateDatabaseTokenResponse: S.Schema<CreateDatabaseTokenResponse>;
201
202
  /** Set to `all` to enable all extensions. */
@@ -254,7 +255,7 @@ export interface CreateGroupTokenRequest {
254
255
  export declare const CreateGroupTokenRequest: S.Schema<CreateGroupTokenRequest>;
255
256
  export interface CreateGroupTokenResponse {
256
257
  /** The generated authorization token (JWT). */
257
- jwt?: string;
258
+ jwt?: Redacted.Redacted<string>;
258
259
  }
259
260
  export declare const CreateGroupTokenResponse: S.Schema<CreateGroupTokenResponse>;
260
261
  export interface DeleteDatabaseRequest {
@@ -352,6 +353,8 @@ export interface Database {
352
353
  /** The current status for delete protection. If enabled, the database cannot be deleted. */
353
354
  delete_protection?: boolean;
354
355
  parent?: DatabaseParent | null;
356
+ /** Whether other databases may be attached to this database with `ATTACH`. */
357
+ allow_attach?: boolean;
355
358
  }
356
359
  export declare const Database: S.Schema<Database>;
357
360
  export interface GetDatabaseResponse {
@@ -538,6 +541,8 @@ export interface Organization {
538
541
  plan_timeline?: string;
539
542
  /** The external platform this organization is managed by. Will be empty for Turso managed organizations. */
540
543
  platform?: string;
544
+ /** Whether deleted database and group recovery is enabled for the organization. Returned when retrieving a single organization. */
545
+ restore_enabled?: boolean;
541
546
  }
542
547
  export declare const Organization: S.Schema<Organization>;
543
548
  export interface GetOrganizationResponse {
@@ -735,6 +740,86 @@ export interface ListDatabasesResponse {
735
740
  databases?: ListDatabasesResponseDatabasesList;
736
741
  }
737
742
  export declare const ListDatabasesResponse: S.Schema<ListDatabasesResponse>;
743
+ export interface ListDeletedDatabasesRequest {
744
+ /** The UUID of the organization. Retrieve it with the Retrieve Organization endpoint (the `id` field). */
745
+ organizationId: string;
746
+ /** Must be `true` to list deleted databases. */
747
+ deleted: boolean;
748
+ /** Filter deleted databases by name. */
749
+ search?: string;
750
+ /** Page size, from 1 to 1000. */
751
+ limit?: number;
752
+ /** Opaque pagination cursor from the previous page's `pagination.next`. */
753
+ cursor?: string;
754
+ }
755
+ export declare const ListDeletedDatabasesRequest: S.Schema<ListDeletedDatabasesRequest>;
756
+ /** The regions the database was located in. */
757
+ export type DeletedDatabaseRegionsList = Array<string>;
758
+ export declare const DeletedDatabaseRegionsList: S.Schema<DeletedDatabaseRegionsList>;
759
+ export interface DeletedDatabase {
760
+ /** The database name. */
761
+ Name?: string;
762
+ /** The database UUID. Use it to restore the database. */
763
+ DbId?: string;
764
+ /** The DNS hostname the database had, used for client and HTTP connections. */
765
+ Hostname?: string;
766
+ /** The name of the group the database belonged to. */
767
+ group?: string;
768
+ /** The UUID of the group the database belonged to. */
769
+ group_id?: string;
770
+ /** The UUID of the organization. */
771
+ organization_id?: string;
772
+ /** The regions the database was located in. */
773
+ regions?: DeletedDatabaseRegionsList;
774
+ /** The primary region of the database. */
775
+ primaryRegion?: string;
776
+ /** Whether delete protection was enabled for the database. */
777
+ delete_protection?: boolean;
778
+ /** When the database was deleted. */
779
+ deleted_at?: string;
780
+ /** Set when the database's group was deleted with it. Restoring the database also restores the group. */
781
+ group_deleted_at?: string;
782
+ }
783
+ export declare const DeletedDatabase: S.Schema<DeletedDatabase>;
784
+ export type ListDeletedDatabasesResponseDatabasesList = Array<DeletedDatabase>;
785
+ export declare const ListDeletedDatabasesResponseDatabasesList: S.Schema<ListDeletedDatabasesResponseDatabasesList>;
786
+ export interface Pagination {
787
+ /** Opaque cursor for the next page. Pass it back as the `cursor` query parameter. Absent on the last page. */
788
+ next?: string;
789
+ }
790
+ export declare const Pagination: S.Schema<Pagination>;
791
+ export interface ListDeletedDatabasesResponse {
792
+ databases?: ListDeletedDatabasesResponseDatabasesList;
793
+ pagination?: Pagination;
794
+ }
795
+ export declare const ListDeletedDatabasesResponse: S.Schema<ListDeletedDatabasesResponse>;
796
+ export interface ListDeletedGroupsRequest {
797
+ /** The UUID of the organization. Retrieve it with the Retrieve Organization endpoint (the `id` field). */
798
+ organizationId: string;
799
+ /** Page size, from 1 to 1000. */
800
+ limit?: number;
801
+ /** Opaque pagination cursor from the previous page's `pagination.next`. */
802
+ cursor?: string;
803
+ }
804
+ export declare const ListDeletedGroupsRequest: S.Schema<ListDeletedGroupsRequest>;
805
+ export interface DeletedGroup {
806
+ /** The group UUID. Use it to restore the group. */
807
+ uuid?: string;
808
+ /** The group name. */
809
+ name?: string;
810
+ /** When the group was deleted. */
811
+ deleted_at?: string;
812
+ /** The number of member databases that restoring the group would bring back with it. */
813
+ cascade_databases?: number;
814
+ }
815
+ export declare const DeletedGroup: S.Schema<DeletedGroup>;
816
+ export type ListDeletedGroupsResponseGroupsList = Array<DeletedGroup>;
817
+ export declare const ListDeletedGroupsResponseGroupsList: S.Schema<ListDeletedGroupsResponseGroupsList>;
818
+ export interface ListDeletedGroupsResponse {
819
+ groups?: ListDeletedGroupsResponseGroupsList;
820
+ pagination?: Pagination;
821
+ }
822
+ export declare const ListDeletedGroupsResponse: S.Schema<ListDeletedGroupsResponse>;
738
823
  export interface ListGroupsRequest {
739
824
  /** The slug of the organization or user account. */
740
825
  organizationSlug: string;
@@ -989,6 +1074,44 @@ export interface RemoveOrganizationMemberResponse {
989
1074
  member?: string;
990
1075
  }
991
1076
  export declare const RemoveOrganizationMemberResponse: S.Schema<RemoveOrganizationMemberResponse>;
1077
+ export interface RestoreDatabaseRequest {
1078
+ /** The UUID of the organization. Retrieve it with the Retrieve Organization endpoint (the `id` field). */
1079
+ organizationId: string;
1080
+ /** The UUID of the database, as returned when listing deleted databases (the `DbId` field). */
1081
+ databaseId: string;
1082
+ /** Optional new name for the restored database. If omitted, the original name is reused. The hostname is re-derived from the name. */
1083
+ name?: string;
1084
+ }
1085
+ export declare const RestoreDatabaseRequest: S.Schema<RestoreDatabaseRequest>;
1086
+ export interface RestoreDatabaseResponse {
1087
+ /** The restored database. */
1088
+ database?: DeletedDatabase;
1089
+ }
1090
+ export declare const RestoreDatabaseResponse: S.Schema<RestoreDatabaseResponse>;
1091
+ export interface RestoreGroupRequest {
1092
+ /** The UUID of the organization. Retrieve it with the Retrieve Organization endpoint (the `id` field). */
1093
+ organizationId: string;
1094
+ /** The UUID of the group, as returned when listing deleted groups (the `uuid` field). */
1095
+ groupId: string;
1096
+ }
1097
+ export declare const RestoreGroupRequest: S.Schema<RestoreGroupRequest>;
1098
+ /** The member databases restored with the group, in restore order. */
1099
+ export type RestoreGroupResponseDatabasesList = Array<DeletedDatabase>;
1100
+ export declare const RestoreGroupResponseDatabasesList: S.Schema<RestoreGroupResponseDatabasesList>;
1101
+ /** Maps database UUID to error message for members whose restore failed. Retry them individually with Restore Database. */
1102
+ export type RestoreGroupResponseFailuresMap = {
1103
+ [key: string]: string | undefined;
1104
+ };
1105
+ export declare const RestoreGroupResponseFailuresMap: S.Schema<RestoreGroupResponseFailuresMap>;
1106
+ export interface RestoreGroupResponse {
1107
+ /** The restored group. */
1108
+ group?: Group;
1109
+ /** The member databases restored with the group, in restore order. */
1110
+ databases?: RestoreGroupResponseDatabasesList;
1111
+ /** Maps database UUID to error message for members whose restore failed. Retry them individually with Restore Database. */
1112
+ failures?: RestoreGroupResponseFailuresMap;
1113
+ }
1114
+ export declare const RestoreGroupResponse: S.Schema<RestoreGroupResponse>;
992
1115
  export interface RevokeAPITokenRequest {
993
1116
  /** The name of the api token. */
994
1117
  tokenName: string;
@@ -1131,6 +1254,8 @@ export interface UpdateOrganizationRequest {
1131
1254
  overages?: boolean;
1132
1255
  /** Require all members of the organization to have multi-factor authentication enabled. The requesting user must have MFA enabled on their own account before enabling this requirement. */
1133
1256
  require_mfa?: boolean;
1257
+ /** Enable or disable deleted database and group recovery for the organization. Must be updated separately from other organization settings. Requires an admin or owner. */
1258
+ restore_enabled?: boolean;
1134
1259
  }
1135
1260
  export declare const UpdateOrganizationRequest: S.Schema<UpdateOrganizationRequest>;
1136
1261
  export interface UpdateOrganizationResponse {
@@ -1152,7 +1277,7 @@ export declare const addLocationToGroup: API.OperationMethod<AddLocationToGroupR
1152
1277
  export type AddOrganizationMemberError = BadRequest | NotFound | Conflict | TursoOpError;
1153
1278
  /** Add Member Add an existing Turso user to an organization. */
1154
1279
  export declare const addOrganizationMember: API.OperationMethod<AddOrganizationMemberRequest, AddOrganizationMemberResponse, AddOrganizationMemberError, TursoOpContext>;
1155
- export type CreateAPITokenError = TursoOpError;
1280
+ export type CreateAPITokenError = BadRequest | NotFound | Conflict | TursoOpError;
1156
1281
  /** Create API Token Returns a new API token belonging to a user. The token can be minted at three levels of restriction, in increasing order of narrowness: - **Organization-scoped** — pass `organization`. The token can only act on resources inside that organization. - **Group-scoped** — pass `organization`, `group`, and `scopes`. The token is pinned to a single group inside the organization and only the operations listed in `scopes` are allowed. The caller must be an admin or owner of the organization. - **Unrestricted** *(deprecated)* — no request body. The token can act on every organization the caller belongs to. **Unrestricted tokens are deprecated and will be removed in a future release.** Always pass `organization` for new tokens and rotate existing unrestricted tokens to scoped tokens. Group-scoped tokens are designed for automations that should be able to provision and manage databases inside a single group without being able to touch the rest of the organization. */
1157
1282
  export declare const createAPIToken: API.OperationMethod<CreateAPITokenRequest, CreateAPITokenResponse, CreateAPITokenError, TursoOpContext>;
1158
1283
  export type CreateDatabaseError = BadRequest | Conflict | TursoOpError;
@@ -1230,6 +1355,12 @@ export declare const listDatabaseInstances: API.OperationMethod<ListDatabaseInst
1230
1355
  export type ListDatabasesError = TursoOpError;
1231
1356
  /** List Databases Returns a list of databases belonging to the organization or user. */
1232
1357
  export declare const listDatabases: API.OperationMethod<ListDatabasesRequest, ListDatabasesResponse, ListDatabasesError, TursoOpContext>;
1358
+ export type ListDeletedDatabasesError = Forbidden | TursoOpError;
1359
+ /** List Deleted Databases Returns databases deleted within the last five days, which can still be restored. Requires a paid plan. Available even while recovery is disabled for the organization. */
1360
+ export declare const listDeletedDatabases: API.OperationMethod<ListDeletedDatabasesRequest, ListDeletedDatabasesResponse, ListDeletedDatabasesError, TursoOpContext>;
1361
+ export type ListDeletedGroupsError = Forbidden | TursoOpError;
1362
+ /** List Deleted Groups Returns groups deleted within the last five days, including empty groups, which can still be restored. Requires a paid plan and an organization-level token. Available even while recovery is disabled for the organization. */
1363
+ export declare const listDeletedGroups: API.OperationMethod<ListDeletedGroupsRequest, ListDeletedGroupsResponse, ListDeletedGroupsError, TursoOpContext>;
1233
1364
  export type ListGroupsError = TursoOpError;
1234
1365
  /** List Groups Returns a list of groups belonging to the organization or user. */
1235
1366
  export declare const listGroups: API.OperationMethod<ListGroupsRequest, ListGroupsResponse, ListGroupsError, TursoOpContext>;
@@ -1263,10 +1394,16 @@ export declare const removeLocationFromGroup: API.OperationMethod<RemoveLocation
1263
1394
  export type RemoveOrganizationMemberError = NotFound | TursoOpError;
1264
1395
  /** Remove Member Remove a user from the organization by username. */
1265
1396
  export declare const removeOrganizationMember: API.OperationMethod<RemoveOrganizationMemberRequest, RemoveOrganizationMemberResponse, RemoveOrganizationMemberError, TursoOpContext>;
1397
+ export type RestoreDatabaseError = BadRequest | Forbidden | NotFound | TursoOpError;
1398
+ /** Restore Database Restore a database deleted within the last five days, exactly as it was at the moment it was deleted. Requires a paid plan, an admin or owner of the organization, and recovery enabled for the organization. */
1399
+ export declare const restoreDatabase: API.OperationMethod<RestoreDatabaseRequest, RestoreDatabaseResponse, RestoreDatabaseError, TursoOpContext>;
1400
+ export type RestoreGroupError = BadRequest | Forbidden | NotFound | TursoOpError;
1401
+ /** Restore Group Restore a group deleted within the last five days, along with the member databases that were deleted with it. Requires a paid plan, an admin or owner of the organization, and recovery enabled for the organization. If some databases fail to restore, the group still becomes active: retry the failed database UUIDs individually with Restore Database. */
1402
+ export declare const restoreGroup: API.OperationMethod<RestoreGroupRequest, RestoreGroupResponse, RestoreGroupError, TursoOpContext>;
1266
1403
  export type RevokeAPITokenError = NotFound | TursoOpError;
1267
1404
  /** Revoke API Token Revokes the provided API token belonging to a user. */
1268
1405
  export declare const revokeAPIToken: API.OperationMethod<RevokeAPITokenRequest, RevokeAPITokenResponse, RevokeAPITokenError, TursoOpContext>;
1269
- export type RevokeOrganizationAPITokenError = TursoOpError;
1406
+ export type RevokeOrganizationAPITokenError = NotFound | TursoOpError;
1270
1407
  /** Revoke Organization API Token Revokes a token scoped to this organization. The path takes a token **ID**, not a name, because names are unique per user but not across users — an admin revoking a member's token can't disambiguate by name alone. Authorization is symmetric with the list endpoint: - **Admins and owners** can revoke any token scoped to the organization (org-scoped or group-scoped, regardless of who minted it). - **Members and viewers** can revoke only tokens they minted themselves. A token scoped to a different organization returns `404`, not `403`, so the endpoint does not leak the existence of cross-org token IDs. Unrestricted tokens are also unreachable here and must be revoked via [`DELETE /v1/auth/api-tokens/{tokenName}`](/api-reference/tokens/revoke). */
1271
1408
  export declare const revokeOrganizationAPIToken: API.OperationMethod<RevokeOrganizationAPITokenRequest, RevokeOrganizationAPITokenResponse, RevokeOrganizationAPITokenError, TursoOpContext>;
1272
1409
  export type TransferGroupError = NotFound | TursoOpError;