@distilled.cloud/typesense 1.0.0-rc.13 → 1.0.0-rc.14

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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@distilled.cloud/typesense",
3
- "version": "1.0.0-rc.13",
3
+ "version": "1.0.0-rc.14",
4
+ "license": "Apache-2.0",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/alchemy-run/distilled",
7
8
  "directory": "packages/typesense"
8
9
  },
9
- "license": "Apache-2.0",
10
- "type": "module",
11
- "sideEffects": false,
12
10
  "files": [
13
11
  "lib",
14
12
  "src"
15
13
  ],
14
+ "type": "module",
15
+ "sideEffects": false,
16
16
  "exports": {
17
17
  "./Credentials": {
18
18
  "types": "./lib/credentials.d.ts",
@@ -64,20 +64,23 @@
64
64
  }
65
65
  },
66
66
  "dependencies": {
67
- "@distilled.cloud/core": "1.0.0-rc.13"
67
+ "@distilled.cloud/core": "1.0.0-rc.14"
68
68
  },
69
69
  "devDependencies": {
70
- "@types/bun": "1.3.14",
71
70
  "@types/node": "26.2.0",
72
- "@effect/platform-bun": "^4.0.0"
71
+ "yaml": "^2.9.0"
73
72
  },
74
73
  "peerDependencies": {
75
74
  "effect": "^4.0.0"
76
75
  },
76
+ "distilled": {
77
+ "generatedAt": "2026-10-05",
78
+ "specUpdatedAt": "2026-09-11"
79
+ },
77
80
  "scripts": {
78
81
  "build": "tsc -b",
79
- "convert": "bun scripts/convert.ts",
80
- "generate": "bun scripts/generate.ts",
82
+ "convert": "node --conditions=bun scripts/convert.ts",
83
+ "generate": "node --conditions=bun scripts/generate.ts",
81
84
  "typecheck": "tsc -p tsconfig.json",
82
85
  "typecheck:strict": "tsc -p tsconfig.strict.json",
83
86
  "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-typesense",
@@ -25,10 +25,9 @@ export interface Config {
25
25
  readonly apiBaseUrl: string;
26
26
  }
27
27
 
28
- export class Credentials extends Context.Service<
29
- Credentials,
30
- Effect.Effect<Config>
31
- >()("TypesenseCredentials") {}
28
+ export class Credentials extends Context.Service<Credentials, Effect.Effect<Config>>()(
29
+ "TypesenseCredentials",
30
+ ) {}
32
31
 
33
32
  const envConfig = EffectConfig.all({
34
33
  apiKey: EffectConfig.String("TYPESENSE_API_KEY"),
@@ -41,8 +40,7 @@ export const CredentialsFromEnv = Layer.succeed(
41
40
  Effect.mapError(
42
41
  () =>
43
42
  new ConfigError({
44
- message:
45
- "TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
43
+ message: "TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
46
44
  }),
47
45
  ),
48
46
  Effect.map(({ apiKey, apiBaseUrl }) => ({
@@ -53,15 +51,15 @@ export const CredentialsFromEnv = Layer.succeed(
53
51
  ),
54
52
  );
55
53
 
56
- /** Convenience layer from a plain key + base URL (kept for local tests). */
54
+ /** Convenience layer from a redacted key + base URL (kept for local tests). */
57
55
  export const credentials = (config: {
58
- readonly apiKey: string;
56
+ readonly apiKey: Redacted.Redacted<string>;
59
57
  readonly apiBaseUrl: string;
60
58
  }): Layer.Layer<Credentials> =>
61
59
  Layer.succeed(
62
60
  Credentials,
63
61
  Effect.succeed({
64
- apiKey: Redacted.make(config.apiKey),
62
+ apiKey: config.apiKey,
65
63
  apiBaseUrl: config.apiBaseUrl,
66
64
  }),
67
65
  );
package/src/errors.ts CHANGED
@@ -23,10 +23,9 @@ export {
23
23
  DEFAULT_ERRORS,
24
24
  API_ERRORS,
25
25
  } from "@distilled.cloud/core/errors";
26
+ import * as Category from "@distilled.cloud/core/category";
26
27
  import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
27
-
28
28
  import * as Schema from "effect/Schema";
29
- import * as Category from "@distilled.cloud/core/category";
30
29
 
31
30
  // Unknown Typesense error - returned when an error code is not recognized
32
31
  export class UnknownTypesenseError extends Schema.TaggedError<UnknownTypesenseError>()(
package/src/index.ts CHANGED
@@ -8,10 +8,6 @@
8
8
  export * from "./credentials.ts";
9
9
  export * from "./errors.ts";
10
10
  export * as T from "./traits.ts";
11
- export {
12
- TypesenseProtocol,
13
- type TypesenseOpError,
14
- type TypesenseOpContext,
15
- } from "./protocol.ts";
11
+ export { TypesenseProtocol, type TypesenseOpError, type TypesenseOpContext } from "./protocol.ts";
16
12
  export * as Retry from "./retry.ts";
17
13
  export * as Services from "./services/index.ts";
package/src/protocol.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import type * as API from "@distilled.cloud/core/api";
2
+ import type { ConfigError } from "@distilled.cloud/core/errors";
3
+ import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
1
4
  /**
2
5
  * TypesenseProtocol — the shared bearer/header-auth REST factory from core,
3
6
  * instantiated with Typesense's specifics:
@@ -12,18 +15,11 @@
12
15
  * the shared HTTP status map, then UnknownTypesenseError.
13
16
  */
14
17
  import * as Effect from "effect/Effect";
15
- import type * as Layer from "effect/Layer";
16
18
  import type * as HttpClient from "effect/http/HttpClient";
17
19
  import type * as HttpClientError from "effect/http/HttpClientError";
18
- import type * as API from "@distilled.cloud/core/api";
19
- import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
20
- import type { ConfigError } from "@distilled.cloud/core/errors";
20
+ import type * as Layer from "effect/Layer";
21
21
  import { type Config, Credentials, formatHeaders } from "./credentials.ts";
22
- import {
23
- type DefaultErrors,
24
- UnknownTypesenseError,
25
- TypesenseParseError,
26
- } from "./errors.ts";
22
+ import { type DefaultErrors, UnknownTypesenseError, TypesenseParseError } from "./errors.ts";
27
23
 
28
24
  /**
29
25
  * Error channel shared by every generated Typesense operation. Generated
@@ -31,27 +27,22 @@ import {
31
27
  * TypesenseOpError, TypesenseOpContext>` explicitly so the compiler never
32
28
  * infers these back out of the schema generics.
33
29
  */
34
- export type TypesenseOpError =
35
- | DefaultErrors
36
- | ConfigError
37
- | HttpClientError.HttpClientError;
30
+ export type TypesenseOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError;
38
31
 
39
32
  /** Context (requirements) shared by every generated Typesense operation. */
40
33
  export type TypesenseOpContext = Credentials | HttpClient.HttpClient;
41
34
 
42
- export const TypesenseProtocol: Layer.Layer<API.Protocol> =
43
- makeRestProtocol<Config>({
44
- // Resolved on the calling fiber, per request — the Credentials service
45
- // holds an effect, so lazily-resolved keys Just Work.
46
- credentials: Effect.gen(function* () {
47
- const resolve = yield* Credentials;
48
- return yield* resolve;
49
- }),
50
- baseUrl: (creds) => creds.apiBaseUrl,
51
- headers: formatHeaders,
52
- // Typesense's ApiResponse error body is `{ message }` — covered by the
53
- // factory's default envelope reader.
54
- unknownError: ({ message, body }) =>
55
- new UnknownTypesenseError({ message, body }),
56
- parseError: ({ body, cause }) => new TypesenseParseError({ body, cause }),
57
- });
35
+ export const TypesenseProtocol: Layer.Layer<API.Protocol> = makeRestProtocol<Config>({
36
+ // Resolved on the calling fiber, per request — the Credentials service
37
+ // holds an effect, so lazily-resolved keys Just Work.
38
+ credentials: Effect.gen(function* () {
39
+ const resolve = yield* Credentials;
40
+ return yield* resolve;
41
+ }),
42
+ baseUrl: (creds) => creds.apiBaseUrl,
43
+ headers: formatHeaders,
44
+ // Typesense's ApiResponse error body is `{ message }` — covered by the
45
+ // factory's default envelope reader.
46
+ unknownError: ({ message, body }) => new UnknownTypesenseError({ message, body }),
47
+ parseError: ({ body, cause }) => new TypesenseParseError({ body, cause }),
48
+ });
package/src/retry.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type Policy, throttlingFactory, transientFactory } from "@distilled.cloud/core/retry";
1
2
  /**
2
3
  * Typesense retry configuration.
3
4
  *
@@ -17,11 +18,6 @@
17
18
  import * as Context from "effect/Context";
18
19
  import * as Effect from "effect/Effect";
19
20
  import * as Layer from "effect/Layer";
20
- import {
21
- type Policy,
22
- throttlingFactory,
23
- transientFactory,
24
- } from "@distilled.cloud/core/retry";
25
21
 
26
22
  export {
27
23
  type Options,
@@ -44,9 +40,7 @@ export const policy = (optionsOrFactory: Policy) =>
44
40
  Effect.provide(Layer.succeed(Retry, optionsOrFactory));
45
41
 
46
42
  /** Disables all automatic retries. */
47
- export const none = Effect.provide(
48
- Layer.succeed(Retry, { while: () => false }),
49
- );
43
+ export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
50
44
 
51
45
  /** Apply the throttling retry policy (retries throttling errors indefinitely). */
52
46
  export const throttling = policy(throttlingFactory);