@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.
@@ -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 — users run their own server
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). */
@@ -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,WAAY,SAAQ,gBAEhC;CAAG;AAOJ,eAAO,MAAM,kBAAkB,wCAe9B,CAA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entials — hand-written.
3
- *
4
- * API-compatible port of the distilled repo's typesense credentials module:
5
- * a static API key sent as the `X-TYPESENSE-API-KEY` header plus a
6
- * caller-supplied base URL. The `Credentials` service holds an *effect* so
7
- * layers may resolve the key lazily (env, vaults, …).
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
- * Typesense has no fixed default base URL — users run their own server
17
- * (e.g. http://localhost:8108) or use Typesense Cloud (per-cluster URLs
18
- * like https://xxx.a1.typesense.net). Users must supply TYPESENSE_API_URL.
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, envConfig.pipe(Effect.mapError(() => new ConfigError({
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
- })), Effect.map(({ apiKey, apiBaseUrl }) => ({
31
+ })),
32
+ /*@__PURE__*/ Effect.map(({ apiKey, apiBaseUrl }) => ({
30
33
  apiKey: Redacted.make(apiKey),
31
34
  apiBaseUrl,
32
35
  })), Effect.orDie));
33
- /** Convenience layer from a redacted key + base URL (kept for local tests). */
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
- /** Auth headers for a resolved credentials config. */
41
+
39
42
  export const formatHeaders = (config) => ({
40
43
  "X-TYPESENSE-API-KEY": Redacted.value(config.apiKey),
41
44
  });
@@ -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;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAOvC,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAAsC,CACpF,sBAAsB,CACvB;CAAG;AAEJ,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAChD,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC;CACrD,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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S,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC9D,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,mBAAmB,CAAC;CACnE,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,4EAA4E;CACtF,CAAC,CACL;AACD,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACpD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU;CACX,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAG3B,EAA4B,EAAE,CAC7B,KAAK,CAAC,OAAO,CACX,WAAW,EACX,MAAM,CAAC,OAAO,CAAC;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 "effect/Schema";
11
- declare const UnknownTypesenseError_base: Schema.Class<UnknownTypesenseError, Schema.TaggedStruct<"UnknownTypesenseError", {
12
- readonly code: Schema.optional<Schema.String>;
13
- readonly message: Schema.optional<Schema.String>;
14
- readonly body: Schema.Unknown;
15
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
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.Class<TypesenseParseError, Schema.TaggedStruct<"TypesenseParseError", {
23
- readonly body: Schema.Unknown;
24
- readonly cause: Schema.Unknown;
25
- }>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
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
@@ -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,eAAe,CAAC;;;;;;;;;;AAGxC,qBAAa,qBAAsB,SAAQ,0BAOX;CAAG;;;;;;;;;AAGnC,qBAAa,mBAAoB,SAAQ,wBAMV;CAAG;AAElC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC"}
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
- * Typesense-specific error types.
3
- *
4
- * Re-exports common HTTP errors from core and adds Typesense-specific
5
- * error types (unknown-error fallback + parse-error wrapper), matching the
6
- * distilled repo's typesense error surface.
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 "effect/Schema";
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,eAAe,CAAC;AAExC,0EAA0E;AAC1E,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,EAAyB,CACpF,uBAAuB,EACvB;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,6BAA6B;AAC7B,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,qBAAqB,EACrB;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;;;;;;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 — Typesense SDK for Effect.
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
- * @distilled.cloud/typesense — Typesense SDK for Effect.
3
- *
4
- * `./services` is generated by `scripts/generate.ts` from the Smithy model
5
- * in `.generated-specs` (converted from the Typesense OpenAPI spec by
6
- * `scripts/convert.ts`). Everything else in this folder is hand-written.
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";
@@ -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,CAatD,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;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
- * TypesenseProtocol — the shared bearer/header-auth REST factory from core,
4
- * instantiated with Typesense's specifics:
5
- *
6
- * request: base URL from the caller's credentials (Typesense has no fixed
7
- * default — self-hosted servers and per-cluster Cloud URLs), auth
8
- * via the `X-TYPESENSE-API-KEY` header
9
- *
10
- * response: plain JSON, no envelope. Non-2xx bodies decode against
11
- * Typesense's ApiResponse (`{ message }`) via the factory's
12
- * default envelope reader; per-op typed errors match first, then
13
- * the shared HTTP status map, then UnknownTypesenseError.
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 — the Credentials service
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.gen(function* () {
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 }` — covered by the
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 }),
@@ -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;IACnF,uEAAuE;IACvE,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,aAAa;IACtB,uEAAuE;IACvE,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"}
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>>;
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../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zD,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
- * Typesense retry configuration.
4
- *
5
- * Defines the per-SDK `Retry` Context.Service tag that the generated
6
- * operations wire into their config. Callers can install a blanket retry
7
- * policy at the layer level and have every Typesense API call below it pick
8
- * it up:
9
- *
10
- * @example
11
- * ```ts
12
- * import * as Typesense from "@distilled.cloud/typesense";
13
- *
14
- * myEffect.pipe(Typesense.Retry.transient);
15
- * Effect.provide(myEffect, Layer.succeed(Typesense.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 Typesense API calls. */
23
- export class Retry extends Context.Service()("TypesenseRetry") {
22
+
23
+ export class Retry extends /*@__PURE__*/ /*@__PURE__*/ Context.Service()("TypesenseRetry") {
24
24
  }
25
- /** Provides a custom retry policy to every Typesense 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,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,yEAAyE;AACzE,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAAiB,CAAC,gBAAgB,CAAC;CAAG;AAEhF,2EAA2E;AAC3E,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"}
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