@distilled.cloud/turso 1.0.0-rc.15 → 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.
- package/lib/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +17 -14
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +14 -14
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +22 -22
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +20 -23
- package/lib/protocol.js.map +1 -1
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +26 -25
- package/lib/retry.js.map +1 -1
- package/lib/services/turso.d.ts +15 -209
- package/lib/services/turso.d.ts.map +1 -1
- package/lib/services/turso.js +193 -1375
- package/lib/traits.d.ts +2 -2
- package/lib/traits.js +10 -10
- package/package.json +13 -9
- package/src/credentials.ts +10 -11
- package/src/errors.ts +13 -14
- package/src/index.ts +1 -1
- package/src/protocol.ts +6 -9
- package/src/retry.ts +6 -4
- package/src/services/turso.ts +1639 -1663
- package/src/traits.ts +2 -2
- package/lib/services/turso.js.map +0 -1
package/lib/credentials.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,
|
|
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
|
-
})),
|
|
25
|
+
})),
|
|
26
|
+
/*@__PURE__*/ Effect.map(({ apiKey }) => ({
|
|
24
27
|
apiKey: Redacted.make(apiKey),
|
|
25
28
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
26
29
|
})), Effect.orDie));
|
package/lib/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA
|
|
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 "
|
|
12
|
-
declare const UnknownTursoError_base: Schema.
|
|
13
|
-
readonly code: Schema.optional<Schema.String>;
|
|
14
|
-
readonly message: Schema.optional<Schema.String>;
|
|
15
|
-
readonly body: Schema.Unknown;
|
|
16
|
-
}
|
|
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
|
|
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.
|
|
29
|
-
readonly body: Schema.Unknown;
|
|
30
|
-
readonly cause: Schema.Unknown;
|
|
31
|
-
}
|
|
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
|
|
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.
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 "
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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,8BAA8B,CAAC;AACtC,OAAO,KAAK,QAAQ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-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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";
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -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,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,
|
|
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,CAkBlD,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
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.
|
|
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 }`
|
|
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,
|
package/lib/protocol.js.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE;;;;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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>>;
|
package/lib/retry.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
export class Retry extends Context.Service()("TursoRetry") {
|
|
22
|
+
|
|
23
|
+
export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TursoRetry") {
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
27
|
-
|
|
28
|
-
export const none = Effect.provide(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,YAAY,CAAC;CAAG;
|
|
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,K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