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

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.
@@ -8,7 +8,7 @@ export interface Config {
8
8
  readonly apiBaseUrl: string;
9
9
  }
10
10
  declare const Credentials_base: Context.ServiceClass<Credentials, "TursoCredentials", Effect.Effect<Config, never, never>>;
11
- export declare class Credentials extends Credentials_base {
11
+ export declare class Credentials extends /*@__PURE__*/ Credentials_base {
12
12
  }
13
13
  export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
14
14
  export {};
@@ -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,gBAEhC;CAAG;AAMJ,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,WACX,SAAQ,aAAa,CAAC,gBAAyE;CAAG;AAMpG,eAAO,MAAM,kBAAkB,wCAe9B,CAAC"}
@@ -1,26 +1,29 @@
1
- /**
2
- * Turso credentials — hand-written.
3
- *
4
- * API-compatible port of the distilled repo's turso credentials module: the
5
- * `Credentials` service holds an *effect* that resolves the current
6
- * credentials, so the protocol layer picks up rotations per request. Turso
7
- * auth is a plain bearer token (`Authorization: Bearer <apiKey>`).
8
- */
1
+ import * as EffectConfig from "@distilled.cloud/core/config";
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
9
10
  import { ConfigError } from "@distilled.cloud/core/errors";
10
- import * as EffectConfig from "effect/Config";
11
11
  import * as Context from "effect/Context";
12
12
  import * as Effect from "effect/Effect";
13
13
  import * as Layer from "effect/Layer";
14
14
  import * as Redacted from "effect/Redacted";
15
15
  export const DEFAULT_API_BASE_URL = "https://api.turso.tech";
16
- export class Credentials extends Context.Service()("TursoCredentials") {
16
+ export class Credentials extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TursoCredentials") {
17
17
  }
18
- const envConfig = EffectConfig.all({
19
- apiKey: EffectConfig.String("TURSO_API_KEY"),
18
+ const envConfig = /*@__PURE__*/ EffectConfig.all({
19
+ apiKey: /*@__PURE__*/ EffectConfig.String("TURSO_API_KEY"),
20
20
  });
21
- export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
21
+ export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
22
+ /*@__PURE__*/ envConfig.pipe(
23
+ /*@__PURE__*/ Effect.mapError(() => new ConfigError({
22
24
  message: "TURSO_API_KEY environment variable is required",
23
- })), Effect.map(({ apiKey }) => ({
25
+ })),
26
+ /*@__PURE__*/ Effect.map(({ apiKey }) => ({
24
27
  apiKey: Redacted.make(apiKey),
25
28
  apiBaseUrl: DEFAULT_API_BASE_URL,
26
29
  })), Effect.orDie));
@@ -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,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
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAC7D;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,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,WACX,SAAQ,aAAa,CAAb,aAAa,CAAC,OAAO,CAAC,OAAO,EAAsC,CAAC,kBAAkB,CAAC;CAAG;AAEpG,MAAM,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAC3D,WAAW;AACX,aAAa,CAAC,SAAS,CAAC,IAAI;AAC1B,aAAa,CAAC,MAAM,CAAC,QAAQ,CAC3B,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EAAE,gDAAgD;CAC1D,CAAC,CACL;AACD,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC"}
package/lib/errors.d.ts CHANGED
@@ -8,36 +8,36 @@
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
10
  import type { BadRequest as CoreBadRequest, Conflict as CoreConflict, DefaultErrors as CoreDefaultErrors, Forbidden as CoreForbidden, Locked as CoreLocked, NotFound as CoreNotFound, UnprocessableEntity as CoreUnprocessableEntity } from "@distilled.cloud/core/errors";
11
- import * as Schema from "effect/Schema";
12
- declare const UnknownTursoError_base: Schema.Class<UnknownTursoError, Schema.TaggedStruct<"UnknownTursoError", {
13
- readonly code: Schema.optional<Schema.String>;
14
- readonly message: Schema.optional<Schema.String>;
15
- readonly body: Schema.Unknown;
16
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
11
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
12
+ declare const UnknownTursoError_base: Schema.TaggedErrorClass<"UnknownTursoError", {
13
+ readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
14
+ readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
15
+ readonly body: import("effect/Schema").Unknown;
16
+ }> & (new (...args: any[]) => {
17
17
  "@distilled.cloud/error/categories": {
18
18
  ServerError: true;
19
19
  };
20
20
  });
21
21
  /**
22
- * Unknown Turso error — returned when an error response cannot be mapped to
22
+ * Unknown Turso error -- returned when an error response cannot be mapped to
23
23
  * a shared HTTP status class. Carries the raw `code` string Turso sometimes
24
24
  * includes in its error body.
25
25
  */
26
- export declare class UnknownTursoError extends UnknownTursoError_base {
26
+ export declare class UnknownTursoError extends /*@__PURE__*/ UnknownTursoError_base {
27
27
  }
28
- declare const TursoParseError_base: Schema.Class<TursoParseError, Schema.TaggedStruct<"TursoParseError", {
29
- readonly body: Schema.Unknown;
30
- readonly cause: Schema.Unknown;
31
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
28
+ declare const TursoParseError_base: Schema.TaggedErrorClass<"TursoParseError", {
29
+ readonly body: import("effect/Schema").Unknown;
30
+ readonly cause: import("effect/Schema").Unknown;
31
+ }> & (new (...args: any[]) => {
32
32
  "@distilled.cloud/error/categories": {
33
33
  ParseError: true;
34
34
  };
35
35
  });
36
36
  /**
37
- * Schema parse error wrapper — kept for parity with the distilled turso SDK's
37
+ * Schema parse error wrapper -- kept for parity with the distilled turso SDK's
38
38
  * error surface.
39
39
  */
40
- export declare class TursoParseError extends TursoParseError_base {
40
+ export declare class TursoParseError extends /*@__PURE__*/ TursoParseError_base {
41
41
  }
42
42
  /**
43
43
  * Errors any Turso operation may surface beyond the core HTTP defaults.
@@ -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;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"}
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,yCAAyC,CAAC;;;;;;;;;;AAElE;;;;GAIG;AACH,qBAAa,iBACX,SAAQ,aAAa,CAAC,sBAIW;CAAG;;;;;;;;;AAEtC;;;GAGG;AACH,qBAAa,eACX,SAAQ,aAAa,CAAC,oBAGU;CAAG;AAErC;;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
@@ -1,30 +1,30 @@
1
- /**
2
- * Turso-specific error types.
3
- *
4
- * Re-exports common HTTP errors from sdk-core and adds the Turso-specific
5
- * fallback/parse error types (ported from the distilled repo's turso SDK).
6
- *
7
- * Turso error bodies have the shape `{ error: string, code?: string }`.
8
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
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
10
  import * as Category from "@distilled.cloud/core/category";
11
- import * as Schema from "effect/Schema";
12
- /**
13
- * Unknown Turso error — returned when an error response cannot be mapped to
14
- * a shared HTTP status class. Carries the raw `code` string Turso sometimes
15
- * includes in its error body.
16
- */
17
- export class UnknownTursoError extends Schema.TaggedError()("UnknownTursoError", {
18
- code: Schema.optional(Schema.String),
19
- message: Schema.optional(Schema.String),
11
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
12
+
13
+
14
+
15
+
16
+
17
+ export class UnknownTursoError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownTursoError", {
18
+ code: /*@__PURE__*/ Schema.optional(Schema.String),
19
+ message: /*@__PURE__*/ Schema.optional(Schema.String),
20
20
  body: Schema.Unknown,
21
21
  }).pipe(Category.withServerError) {
22
22
  }
23
- /**
24
- * Schema parse error wrapper — kept for parity with the distilled turso SDK's
25
- * error surface.
26
- */
27
- export class TursoParseError extends Schema.TaggedError()("TursoParseError", {
23
+
24
+
25
+
26
+
27
+ export class TursoParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("TursoParseError", {
28
28
  body: Schema.Unknown,
29
29
  cause: Schema.Unknown,
30
30
  }).pipe(Category.withParseError) {
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,8BAA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C,MAAM,CAAC;IAClD,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEtC;;;GAGG;AACH,MAAM,OAAO,eACX,SAAQ,aAAa,CAAb,aAAa,CAAC,MAAM,CAAC,WAAW,EAAmB,CAAC,iBAAiB,EAAE;IAC7E,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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @distilled.cloud/turso — Turso SDK for Effect.
2
+ * @distilled.cloud/turso -- Turso SDK for Effect.
3
3
  *
4
4
  * `./services` is generated by `scripts/generate.ts` from the Smithy model in
5
5
  * `.generated-specs` (converted from the Turso OpenAPI spec by
package/lib/index.js CHANGED
@@ -1,15 +1,15 @@
1
- /**
2
- * @distilled.cloud/turso — Turso SDK for Effect.
3
- *
4
- * `./services` is generated by `scripts/generate.ts` from the Smithy model in
5
- * `.generated-specs` (converted from the Turso OpenAPI spec by
6
- * `scripts/convert.ts`). Everything else in this folder is hand-written.
7
- *
8
- * @example
9
- * ```ts
10
- * import * as Turso from "@distilled.cloud/turso";
11
- * ```
12
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
13
  export * from "./credentials.js";
14
14
  export * from "./errors.js";
15
15
  export * as T from "./traits.js";
@@ -1 +1 @@
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,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/protocol.js CHANGED
@@ -1,37 +1,34 @@
1
1
  import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
2
- /**
3
- * TursoProtocol — hand-written.
4
- *
5
- * Turso's platform API is plain bearer-REST JSON (`Authorization: Bearer
6
- * <apiKey>`, no response envelope), so the protocol is a direct
7
- * `makeRestProtocol` instantiation from `core/protocol-rest`:
8
- *
9
- * request: credentials resolved per request from the Credentials service,
10
- * bearer auth header, base URL from `creds.apiBaseUrl`
11
- *
12
- * response: non-2xx → typed error matched like the distilled turso client:
13
- * per-op matcher classes first, then the shared HTTP status map
14
- * (`{ error: string, code?: string }` bodies parsed leniently,
15
- * `retryAfter` hints stamped on retryable statuses), unmapped
16
- * failures fall back to `UnknownTursoError`.
17
- */
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
18
  import * as Effect from "effect/Effect";
19
19
  import * as Redacted from "effect/Redacted";
20
20
  import { Credentials } from "./credentials.js";
21
21
  import { UnknownTursoError, TursoParseError } from "./errors.js";
22
- export const TursoProtocol = makeRestProtocol({
23
- // The Credentials service holds an effect — resolving it here (per
22
+ export const TursoProtocol = /*@__PURE__*/ makeRestProtocol({
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
25
25
  // boundary; TursoOpError reintroduces it for callers.
26
- credentials: Effect.gen(function* () {
27
- const resolve = yield* Credentials;
28
- return yield* resolve;
29
- }),
26
+ credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
30
27
  baseUrl: (creds) => creds.apiBaseUrl,
31
28
  headers: (creds) => ({
32
29
  Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
33
30
  }),
34
- // Turso error bodies are `{ error: string, code?: string }` — covered by
31
+ // Turso error bodies are `{ error: string, code?: string }` -- covered by
35
32
  // the default lenient envelope (message ?? error, string codes kept).
36
33
  unknownError: ({ code, message, body }) => new UnknownTursoError({
37
34
  code: typeof code === "string" ? code : code !== undefined ? String(code) : undefined,
@@ -1 +1 @@
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,UAA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AO;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
@@ -20,7 +20,7 @@ import * as Effect from "effect/Effect";
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. */
23
- export declare class Retry extends Retry_base {
23
+ export declare class Retry extends /*@__PURE__*/ Retry_base {
24
24
  }
25
25
  /** Provides a custom retry policy to every Turso API call below it. */
26
26
  export declare const policy: (optionsOrFactory: Policy) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
@@ -1 +1 @@
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"}
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,aAAa,CAAC,UAA8C;CAAG;AAE1F,uEAAuE;AACvE,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAEhB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA0C,CAAC;AAElE,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAAyC,CAAC"}
package/lib/retry.js CHANGED
@@ -1,33 +1,34 @@
1
1
  import { throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
2
- /**
3
- * Turso retry configuration.
4
- *
5
- * Defines the per-SDK `Retry` Context.Service tag that generated operations
6
- * wire into `API.make({ retry: Retry.Retry })`. Callers can install a
7
- * blanket retry policy at the layer level and have every Turso API call
8
- * below it pick it up:
9
- *
10
- * @example
11
- * ```ts
12
- * import * as Turso from "@distilled.cloud/turso";
13
- *
14
- * myEffect.pipe(Turso.Retry.transient);
15
- * Effect.provide(myEffect, Layer.succeed(Turso.Retry.Retry, customPolicy));
16
- * ```
17
- */
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
18
  import * as Context from "effect/Context";
19
19
  import * as Effect from "effect/Effect";
20
20
  import * as Layer from "effect/Layer";
21
21
  export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
22
- /** Context tag for configuring retry behavior of Turso API calls. */
23
- export class Retry extends Context.Service()("TursoRetry") {
22
+
23
+ export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TursoRetry") {
24
24
  }
25
- /** Provides a custom retry policy to every Turso API call below it. */
25
+
26
26
  export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
27
- /** Disables all automatic retries. */
28
- export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
29
- /** Apply the throttling retry policy (retries throttling errors indefinitely). */
30
- export const throttling = policy(throttlingFactory);
31
- /** Apply the transient retry policy (retries all transient errors indefinitely). */
32
- export const transient = policy(transientFactory);
27
+
28
+ export const none = /*@__PURE__*/ Effect.provide(
29
+ /*@__PURE__*/ Layer.succeed(Retry, { while: () => false }));
30
+
31
+ export const throttling = /*@__PURE__*/ policy(throttlingFactory);
32
+
33
+ export const transient = /*@__PURE__*/ policy(transientFactory);
33
34
  //# sourceMappingURL=retry.js.map
package/lib/retry.js.map CHANGED
@@ -1 +1 @@
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,EA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