@distilled.cloud/typesense 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.
- package/lib/credentials.d.ts +2 -2
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +25 -22
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +12 -12
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +12 -12
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -7
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +17 -20
- 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/typesense.d.ts +7 -342
- package/lib/services/typesense.d.ts.map +1 -1
- package/lib/services/typesense.js +258 -2624
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +8 -8
- package/package.json +15 -11
- package/src/credentials.ts +15 -14
- package/src/errors.ts +9 -13
- package/src/index.ts +1 -1
- package/src/protocol.ts +6 -9
- package/src/retry.ts +6 -4
- package/src/services/typesense.ts +2556 -3163
- package/src/traits.ts +1 -1
- package/lib/services/typesense.js.map +0 -1
package/lib/credentials.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
|
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Redacted from "effect/Redacted";
|
|
5
5
|
/**
|
|
6
|
-
* Typesense has no fixed default base URL
|
|
6
|
+
* Typesense has no fixed default base URL -- users run their own server
|
|
7
7
|
* (e.g. http://localhost:8108) or use Typesense Cloud (per-cluster URLs
|
|
8
8
|
* like https://xxx.a1.typesense.net). Users must supply TYPESENSE_API_URL.
|
|
9
9
|
*/
|
|
@@ -13,7 +13,7 @@ export interface Config {
|
|
|
13
13
|
readonly apiBaseUrl: string;
|
|
14
14
|
}
|
|
15
15
|
declare const Credentials_base: Context.ServiceClass<Credentials, "TypesenseCredentials", Effect.Effect<Config, never, never>>;
|
|
16
|
-
export declare class Credentials extends Credentials_base {
|
|
16
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
17
17
|
}
|
|
18
18
|
export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
|
|
19
19
|
/** Convenience layer from a redacted key + base URL (kept for local tests). */
|
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;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,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;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,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,gBAErB;CAAG;AAON,eAAO,MAAM,kBAAkB,wCAe9B,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC;AAEJ,sDAAsD;AACtD,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAElE,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
20
|
export const DEFAULT_API_BASE_URL = "";
|
|
21
|
-
export class Credentials extends Context.Service()("TypesenseCredentials") {
|
|
21
|
+
export class Credentials extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TypesenseCredentials") {
|
|
22
22
|
}
|
|
23
|
-
const envConfig = EffectConfig.all({
|
|
24
|
-
apiKey: EffectConfig.String("TYPESENSE_API_KEY"),
|
|
25
|
-
apiBaseUrl: EffectConfig.String("TYPESENSE_API_URL"),
|
|
23
|
+
const envConfig = /*@__PURE__*/ EffectConfig.all({
|
|
24
|
+
apiKey: /*@__PURE__*/ EffectConfig.String("TYPESENSE_API_KEY"),
|
|
25
|
+
apiBaseUrl: /*@__PURE__*/ EffectConfig.String("TYPESENSE_API_URL"),
|
|
26
26
|
});
|
|
27
|
-
export const CredentialsFromEnv = Layer.succeed(Credentials,
|
|
27
|
+
export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(Credentials,
|
|
28
|
+
/*@__PURE__*/ envConfig.pipe(
|
|
29
|
+
/*@__PURE__*/ Effect.mapError(() => new ConfigError({
|
|
28
30
|
message: "TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
|
|
29
|
-
})),
|
|
31
|
+
})),
|
|
32
|
+
/*@__PURE__*/ Effect.map(({ apiKey, apiBaseUrl }) => ({
|
|
30
33
|
apiKey: Redacted.make(apiKey),
|
|
31
34
|
apiBaseUrl,
|
|
32
35
|
})), Effect.orDie));
|
|
33
|
-
|
|
36
|
+
|
|
34
37
|
export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
35
38
|
apiKey: config.apiKey,
|
|
36
39
|
apiBaseUrl: config.apiBaseUrl,
|
|
37
40
|
}));
|
|
38
|
-
|
|
41
|
+
|
|
39
42
|
export const formatHeaders = (config) => ({
|
|
40
43
|
"X-TYPESENSE-API-KEY": Redacted.value(config.apiKey),
|
|
41
44
|
});
|
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;;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AAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC,UAAU;CAC9B,CAAC,CACH,CAAC;AAEJ,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAA0B,EAAE,CAAC,CAAC;IACxE,qBAAqB,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;CACrD,CAAC,CAAC"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -7,27 +7,27 @@
|
|
|
7
7
|
*/
|
|
8
8
|
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";
|
|
9
9
|
import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
|
|
10
|
-
import * as Schema from "
|
|
11
|
-
declare const UnknownTypesenseError_base: Schema.
|
|
12
|
-
readonly code: Schema.optional<Schema.String>;
|
|
13
|
-
readonly message: Schema.optional<Schema.String>;
|
|
14
|
-
readonly body: Schema.Unknown;
|
|
15
|
-
}
|
|
10
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
11
|
+
declare const UnknownTypesenseError_base: Schema.TaggedErrorClass<"UnknownTypesenseError", {
|
|
12
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
13
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
14
|
+
readonly body: import("effect/Schema").Unknown;
|
|
15
|
+
}> & (new (...args: any[]) => {
|
|
16
16
|
"@distilled.cloud/error/categories": {
|
|
17
17
|
ServerError: true;
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
|
-
export declare class UnknownTypesenseError extends UnknownTypesenseError_base {
|
|
20
|
+
export declare class UnknownTypesenseError extends /*@__PURE__*/ UnknownTypesenseError_base {
|
|
21
21
|
}
|
|
22
|
-
declare const TypesenseParseError_base: Schema.
|
|
23
|
-
readonly body: Schema.Unknown;
|
|
24
|
-
readonly cause: Schema.Unknown;
|
|
25
|
-
}
|
|
22
|
+
declare const TypesenseParseError_base: Schema.TaggedErrorClass<"TypesenseParseError", {
|
|
23
|
+
readonly body: import("effect/Schema").Unknown;
|
|
24
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
25
|
+
}> & (new (...args: any[]) => {
|
|
26
26
|
"@distilled.cloud/error/categories": {
|
|
27
27
|
ParseError: true;
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
|
-
export declare class TypesenseParseError extends TypesenseParseError_base {
|
|
30
|
+
export declare class TypesenseParseError extends /*@__PURE__*/ TypesenseParseError_base {
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Errors that any Typesense operation may surface in addition to
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;;;AAGlE,qBAAa,qBACX,SAAQ,aAAa,CAAC,0BAIW;CAAG;;;;;;;;;AAGtC,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAGU;CAAG;AAErC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC"}
|
package/lib/errors.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
8
|
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";
|
|
9
9
|
import * as Category from "@distilled.cloud/core/category";
|
|
10
|
-
import * as Schema from "
|
|
10
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
11
11
|
// Unknown Typesense error - returned when an error code is not recognized
|
|
12
|
-
export class UnknownTypesenseError extends Schema.TaggedError()("UnknownTypesenseError", {
|
|
13
|
-
code: Schema.optional(Schema.String),
|
|
14
|
-
message: Schema.optional(Schema.String),
|
|
12
|
+
export class UnknownTypesenseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("UnknownTypesenseError", {
|
|
13
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
14
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
15
15
|
body: Schema.Unknown,
|
|
16
16
|
}).pipe(Category.withServerError) {
|
|
17
17
|
}
|
|
18
18
|
// Schema parse error wrapper
|
|
19
|
-
export class TypesenseParseError extends Schema.TaggedError()("TypesenseParseError", {
|
|
19
|
+
export class TypesenseParseError extends /*@__PURE__*/ /*@__PURE__*/ Schema.TaggedError()("TypesenseParseError", {
|
|
20
20
|
body: Schema.Unknown,
|
|
21
21
|
cause: Schema.Unknown,
|
|
22
22
|
}).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;;;;;;GAMG;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;AAE3D,OAAO,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;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;AAE3D,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;AAElE,0EAA0E;AAC1E,MAAM,OAAO,qBACX,SAAQ,aAAa,CAAb,aAAa,CAAC,MAAM,CAAC,WAAW,EAAyB,CAAC,uBAAuB,EAAE;IACzF,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,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,6BAA6B;AAC7B,MAAM,OAAO,mBACX,SAAQ,aAAa,CAAb,aAAa,CAAC,MAAM,CAAC,WAAW,EAAuB,CAAC,qBAAqB,EAAE;IACrF,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/typesense
|
|
2
|
+
* @distilled.cloud/typesense -- Typesense SDK for Effect.
|
|
3
3
|
*
|
|
4
4
|
* `./services` is generated by `scripts/generate.ts` from the Smithy model
|
|
5
5
|
* in `.generated-specs` (converted from the Typesense OpenAPI spec by
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
8
|
export * from "./credentials.js";
|
|
9
9
|
export * from "./errors.js";
|
|
10
10
|
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;AAgBhE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,KAAK,aAAa,EAA8C,MAAM,aAAa,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,CAAC,eAAe,CAAC;AAE7F,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAErE,eAAO,MAAM,iBAAiB,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;AAgBhE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAe,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,KAAK,aAAa,EAA8C,MAAM,aAAa,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,CAAC,eAAe,CAAC;AAE7F,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAErE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAUtD,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
15
|
import * as Effect from "effect/Effect";
|
|
16
16
|
import { Credentials, formatHeaders } from "./credentials.js";
|
|
17
17
|
import { UnknownTypesenseError, TypesenseParseError } from "./errors.js";
|
|
18
|
-
export const TypesenseProtocol = makeRestProtocol({
|
|
19
|
-
// Resolved on the calling fiber, per request
|
|
18
|
+
export const TypesenseProtocol = /*@__PURE__*/ makeRestProtocol({
|
|
19
|
+
// Resolved on the calling fiber, per request -- the Credentials service
|
|
20
20
|
// holds an effect, so lazily-resolved keys Just Work.
|
|
21
|
-
credentials: Effect.
|
|
22
|
-
const resolve = yield* Credentials;
|
|
23
|
-
return yield* resolve;
|
|
24
|
-
}),
|
|
21
|
+
credentials: /*@__PURE__*/ Effect.flatMap(Credentials, (resolve) => resolve),
|
|
25
22
|
baseUrl: (creds) => creds.apiBaseUrl,
|
|
26
23
|
headers: formatHeaders,
|
|
27
|
-
// Typesense's ApiResponse error body is `{ message }`
|
|
24
|
+
// Typesense's ApiResponse error body is `{ message }` -- covered by the
|
|
28
25
|
// factory's default envelope reader.
|
|
29
26
|
unknownError: ({ message, body }) => new UnknownTypesenseError({ message, body }),
|
|
30
27
|
parseError: ({ body, cause }) => new TypesenseParseError({ body, cause }),
|
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;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAe,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAsB,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAa7F,MAAM,CAAC,MAAM,iBAAiB,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;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAe,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAsB,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAa7F,MAAM,CAAC,MAAM,iBAAiB,GAA8B,aAAa,CAAC,gBAAgB,CAAS;IACjG,wEAAwE;IACxE,sDAAsD;IACtD,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IAC5E,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IACpC,OAAO,EAAE,aAAa;IACtB,wEAAwE;IACxE,qCAAqC;IACrC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,qBAAqB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACjF,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;CAC1E,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, "TypesenseRetry", Policy>;
|
|
22
22
|
/** Context tag for configuring retry behavior of Typesense 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 Typesense 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,yEAAyE;AACzE,qBAAa,KAAM,SAAQ,UAAkD;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,yEAAyE;AACzE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAkD;CAAG;AAE9F,2EAA2E;AAC3E,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()("TypesenseRetry") {
|
|
22
|
+
|
|
23
|
+
export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TypesenseRetry") {
|
|
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,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