@distilled.cloud/typesense 1.0.0-rc.15 → 1.0.0-rc.17

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/.lazy.json ADDED
@@ -0,0 +1 @@
1
+ {"serviceDirs":["services"],"twins":["index.js"]}
@@ -0,0 +1,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{api$D as e,api$call as t,api$error as ee,api$named as n,api$newError as r,api$op as i,category$withBadRequestError as a,category$withConflictError as te,category$withParseError as ne,category$withServerError as re,config$String as o,config$all as ie,retry$capped as s,retry$jittered as c,retry$makeDefault as l,retry$throttlingFactory as u,retry$throttlingOptions as d,retry$transientFactory as f,retry$transientOptions as p,trait$Body as m,trait$FormDataFile as h,trait$Header as g,trait$Http as _,trait$HttpBody as v,trait$KeyDictionary as y,trait$Label as b,trait$Query as x,trait$ResponseCode as S,trait$UnionCases as C,trait$applyErrorMatchers as w,trait$bodySymbol as T,trait$errorMatchersSymbol as E,trait$formDataFileSymbol as D,trait$getErrorMatchers as O,trait$headerSymbol as k,trait$httpBodySymbol as A,trait$httpSymbol as j,trait$keyDictionarySymbol as M,trait$labelSymbol as N,trait$querySymbol as P,trait$responseCodeSymbol as F,trait$unionCasesSymbol as I}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as L,errors$BadGateway as R,errors$BadRequest as z,errors$ConfigError as B,errors$Conflict as V,errors$DEFAULT_ERRORS as H,errors$Forbidden as U,errors$GatewayTimeout as W,errors$HTTP_STATUS_MAP as G,errors$InternalServerError as K,errors$Locked as ae,errors$NotFound as q,errors$ServiceUnavailable as J,errors$TooManyRequests as oe,errors$Unauthorized as se,errors$UnprocessableEntity as ce,protocol_rest$RawResponse as le,protocol_rest$RawResponseRoot as ue,protocol_rest$SensitiveValue as de,protocol_rest$makeRestProtocol as fe,protocol_rest$rawResponseRootSymbol as pe,protocol_rest$rawResponseSymbol as me,protocol_rest$sensitiveValueSymbol as he,schema_lite$Array as ge,schema_lite$Boolean as _e,schema_lite$Number as ve,schema_lite$Record as ye,schema_lite$String as be,schema_lite$Struct as xe,schema_lite$TaggedError as Se,schema_lite$Unknown as Ce,schema_lite$at as we,schema_lite$optional as Te,schema_lite$suspend as Ee}from"@distilled.cloud/core/_bundle/rest";import*as Y from"effect/Context";import*as X from"effect/Effect";import*as Z from"effect/Layer";import*as Q from"effect/Redacted";import*as $ from"@distilled.cloud/core/schema-lite-typed";const De=``;var Credentials=class extends (/*@__PURE__*/ Y.Service()(`TypesenseCredentials`)){};const Oe=/*@__PURE__*/ ie({apiKey:/*@__PURE__*/ o(`TYPESENSE_API_KEY`),apiBaseUrl:/*@__PURE__*/ o(`TYPESENSE_API_URL`)});const ke=/*@__PURE__*/ Z.succeed(Credentials,/*@__PURE__*/ Oe.pipe(/*@__PURE__*/ X.mapError(()=>new B({message:`TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required`})),/*@__PURE__*/ X.map(({apiKey:e,apiBaseUrl:t})=>({apiKey:Q.make(e),apiBaseUrl:t})),X.orDie));const credentials=e=>Z.succeed(Credentials,X.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl}));const formatHeaders=e=>({"X-TYPESENSE-API-KEY":Q.value(e.apiKey)});var UnknownTypesenseError=class extends (/*@__PURE__*/ $.TaggedError()(`UnknownTypesenseError`,{code:/*@__PURE__*/ $.optional($.String),message:/*@__PURE__*/ $.optional($.String),body:$.Unknown}).pipe(re)){};var TypesenseParseError=class extends (/*@__PURE__*/ $.TaggedError()(`TypesenseParseError`,{body:$.Unknown,cause:$.Unknown}).pipe(ne)){};const Ae=/*@__PURE__*/ fe({credentials:/*@__PURE__*/ X.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:formatHeaders,unknownError:({message:e,body:t})=>new UnknownTypesenseError({message:e,body:t}),parseError:({body:e,cause:t})=>new TypesenseParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ Y.Service()(`TypesenseRetry`)){};const policy=e=>X.provide(Z.succeed(Retry,e));const je=/*@__PURE__*/ X.provide(/*@__PURE__*/ Z.succeed(Retry,{while:()=>false}));const Me=/*@__PURE__*/ policy(u);const Ne=/*@__PURE__*/ policy(f);export{i as _,be as a,Ce as c,Credentials as credentials$Credentials,ke as credentials$CredentialsFromEnv,De as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,formatHeaders as credentials$formatHeaders,Ee as d,L as errors$API_ERRORS,R as errors$BadGateway,z as errors$BadRequest,B as errors$ConfigError,V as errors$Conflict,H as errors$DEFAULT_ERRORS,U as errors$Forbidden,W as errors$GatewayTimeout,G as errors$HTTP_STATUS_MAP,K as errors$InternalServerError,ae as errors$Locked,q as errors$NotFound,J as errors$ServiceUnavailable,oe as errors$TooManyRequests,TypesenseParseError as errors$TypesenseParseError,se as errors$Unauthorized,UnknownTypesenseError as errors$UnknownTypesenseError,ce as errors$UnprocessableEntity,e as f,r as g,n as h,ye as i,we as l,ee as m,_e as n,xe as o,t as p,Ae as protocol$TypesenseProtocol,ve as r,Retry as retry$Retry,s as retry$capped,c as retry$jittered,l as retry$makeDefault,je as retry$none,policy as retry$policy,Me as retry$throttling,u as retry$throttlingFactory,d as retry$throttlingOptions,Ne as retry$transient,f as retry$transientFactory,p as retry$transientOptions,Se as s,ge as t,m as traits$Body,h as traits$FormDataFile,g as traits$Header,_ as traits$Http,v as traits$HttpBody,y as traits$KeyDictionary,b as traits$Label,x as traits$Query,le as traits$RawResponse,ue as traits$RawResponseRoot,S as traits$ResponseCode,de as traits$SensitiveValue,C as traits$UnionCases,w as traits$applyErrorMatchers,T as traits$bodySymbol,E as traits$errorMatchersSymbol,D as traits$formDataFileSymbol,O as traits$getErrorMatchers,k as traits$headerSymbol,A as traits$httpBodySymbol,j as traits$httpSymbol,M as traits$keyDictionarySymbol,N as traits$labelSymbol,P as traits$querySymbol,pe as traits$rawResponseRootSymbol,me as traits$rawResponseSymbol,F as traits$responseCodeSymbol,he as traits$sensitiveValueSymbol,I as traits$unionCasesSymbol,Te as u,a as v,te as y};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Category.withServerError","Category.withParseError","D","call","error","named","newError","op","withBadRequestError","withConflictError","withParseError","withServerError","String$1","all$1","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","Array","Boolean","Number","Record","String","Struct","TaggedError","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","Schema","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","apiKey","config","TypesenseProtocol","resolve","creds","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"+pEAoBA,MAAamF,GAAuB,GAOpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,sBACF,EAAA,AAAE,CAAC,EAEL,MAAMC,GAA0B,iBAAiB,CAC/C,OAAsB,gBAAoB,mBAAmB,EAC7D,WAA0B,gBAAoB,mBAAmB,CAC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O,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAO5E,CAAiB,EAGhE,MAAa6E,GAA0B,qBAAO3E,CAAgB"}
@@ -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,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
- * Typesense credentials — 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
- */
9
- import { ConfigError } from "@distilled.cloud/core/errors";
10
- import * as EffectConfig from "effect/Config";
11
- import * as Context from "effect/Context";
12
- import * as Effect from "effect/Effect";
13
- import * as Layer from "effect/Layer";
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
- */
20
- export const DEFAULT_API_BASE_URL = "";
21
- export class Credentials extends Context.Service()("TypesenseCredentials") {
22
- }
23
- const envConfig = EffectConfig.all({
24
- apiKey: EffectConfig.String("TYPESENSE_API_KEY"),
25
- apiBaseUrl: EffectConfig.String("TYPESENSE_API_URL"),
26
- });
27
- export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
28
- message: "TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
29
- })), Effect.map(({ apiKey, apiBaseUrl }) => ({
30
- apiKey: Redacted.make(apiKey),
31
- apiBaseUrl,
32
- })), Effect.orDie));
33
- /** Convenience layer from a redacted key + base URL (kept for local tests). */
34
- export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
35
- apiKey: config.apiKey,
36
- apiBaseUrl: config.apiBaseUrl,
37
- }));
38
- /** Auth headers for a resolved credentials config. */
39
- export const formatHeaders = (config) => ({
40
- "X-TYPESENSE-API-KEY": Redacted.value(config.apiKey),
41
- });
42
- //# sourceMappingURL=credentials.js.map
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL, credentials$credentials as credentials, credentials$formatHeaders as formatHeaders } from "./_bundle/sdk.js";
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,24 +1 @@
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
- */
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
- import * as Category from "@distilled.cloud/core/category";
10
- import * as Schema from "effect/Schema";
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),
15
- body: Schema.Unknown,
16
- }).pipe(Category.withServerError) {
17
- }
18
- // Schema parse error wrapper
19
- export class TypesenseParseError extends Schema.TaggedError()("TypesenseParseError", {
20
- body: Schema.Unknown,
21
- cause: Schema.Unknown,
22
- }).pipe(Category.withParseError) {
23
- }
24
- //# sourceMappingURL=errors.js.map
1
+ export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$TooManyRequests as TooManyRequests, errors$TypesenseParseError as TypesenseParseError, errors$Unauthorized as Unauthorized, errors$UnknownTypesenseError as UnknownTypesenseError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
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,14 +1,6 @@
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
- */
8
1
  export * from "./credentials.js";
9
2
  export * from "./errors.js";
10
3
  export * as T from "./traits.js";
11
4
  export { TypesenseProtocol } from "./protocol.js";
12
5
  export * as Retry from "./retry.js";
13
6
  export * as Services from "./services/index.js";
14
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { TypesenseProtocol } from "./protocol.js";
5
+ export * as Retry from "./retry.js";
6
+ export * as Services from "./services.lazy/index.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,wBAAw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 +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
- */
15
- import * as Effect from "effect/Effect";
16
- import { Credentials, formatHeaders } from "./credentials.js";
17
- import { UnknownTypesenseError, TypesenseParseError } from "./errors.js";
18
- export const TypesenseProtocol = makeRestProtocol({
19
- // Resolved on the calling fiber, per request — the Credentials service
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
- }),
25
- baseUrl: (creds) => creds.apiBaseUrl,
26
- headers: formatHeaders,
27
- // Typesense's ApiResponse error body is `{ message }` — covered by the
28
- // factory's default envelope reader.
29
- unknownError: ({ message, body }) => new UnknownTypesenseError({ message, body }),
30
- parseError: ({ body, cause }) => new TypesenseParseError({ body, cause }),
31
- });
32
- //# sourceMappingURL=protocol.js.map
1
+ export { protocol$TypesenseProtocol as TypesenseProtocol } from "./_bundle/sdk.js";
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":["../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;AAEhF,2EAA2E;AAC3E,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,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 @@
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
- */
18
- import * as Context from "effect/Context";
19
- import * as Effect from "effect/Effect";
20
- import * as Layer from "effect/Layer";
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") {
24
- }
25
- /** Provides a custom retry policy to every Typesense API call below it. */
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);
33
- //# sourceMappingURL=retry.js.map
1
+ export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingFactory as throttlingFactory, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientFactory as transientFactory, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
@@ -1,3 +1 @@
1
- // AUTO-GENERATED by scripts/generate.ts. Do not edit.
2
1
  export * as typesense from "./typesense.js";
3
- //# sourceMappingURL=index.js.map