@distilled.cloud/typesense 0.17.0 → 0.18.1
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 +12 -16
- package/lib/credentials.js.map +1 -1
- package/package.json +3 -3
- package/src/credentials.ts +20 -19
package/lib/credentials.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
1
2
|
import * as Layer from "effect/Layer";
|
|
2
3
|
import * as Redacted from "effect/Redacted";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
4
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
5
5
|
/**
|
|
6
6
|
* Typesense has no fixed default base URL — users run their own server
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;;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,8CAe9B,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import * as EffectConfig from "effect/Config";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
1
3
|
import * as Effect from "effect/Effect";
|
|
2
4
|
import * as Layer from "effect/Layer";
|
|
3
5
|
import * as Redacted from "effect/Redacted";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
6
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
7
|
/**
|
|
7
8
|
* Typesense has no fixed default base URL — users run their own server
|
|
@@ -11,19 +12,14 @@ import { ConfigError } from "@distilled.cloud/core/errors";
|
|
|
11
12
|
export const DEFAULT_API_BASE_URL = "";
|
|
12
13
|
export class Credentials extends Context.Service()("TypesenseCredentials") {
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
message: "TYPESENSE_API_URL environment variable is required",
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return { apiKey: Redacted.make(apiKey), apiBaseUrl };
|
|
28
|
-
}));
|
|
15
|
+
const envConfig = EffectConfig.all({
|
|
16
|
+
apiKey: EffectConfig.string("TYPESENSE_API_KEY"),
|
|
17
|
+
apiBaseUrl: EffectConfig.string("TYPESENSE_API_URL"),
|
|
18
|
+
});
|
|
19
|
+
export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
|
|
20
|
+
message: "TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
|
|
21
|
+
})), Effect.map(({ apiKey, apiBaseUrl }) => ({
|
|
22
|
+
apiKey: Redacted.make(apiKey),
|
|
23
|
+
apiBaseUrl,
|
|
24
|
+
}))));
|
|
29
25
|
//# sourceMappingURL=credentials.js.map
|
package/lib/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,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;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAOvC,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAAuB,CACrE,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,MAAM,CAC5C,WAAW,EACX,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CACvB,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EACL,4EAA4E;CAC/E,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU;CACX,CAAC,CAAC,CACJ,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/typesense",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"publish:npm": "bun run build && bun publish --access public",
|
|
71
71
|
"generate": "bun run scripts/generate.ts && oxlint --fix src && oxfmt --write src && oxfmt --write src",
|
|
72
72
|
"specs:fetch": "git submodule update --force --init --recursive --depth=1 specs/typesense-api-spec && git -C specs/typesense-api-spec checkout -- .",
|
|
73
|
-
"specs:update": "git -C specs/typesense-api-spec fetch && git -C specs/typesense-api-spec checkout
|
|
73
|
+
"specs:update": "git -C specs/typesense-api-spec fetch && git -C specs/typesense-api-spec checkout master && git -C specs/typesense-api-spec pull"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@distilled.cloud/core": "0.
|
|
76
|
+
"@distilled.cloud/core": "0.18.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/bun": "^1.3.0",
|
package/src/credentials.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import * as EffectConfig from "effect/Config";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
1
3
|
import * as Effect from "effect/Effect";
|
|
2
4
|
import * as Layer from "effect/Layer";
|
|
3
5
|
import * as Redacted from "effect/Redacted";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
6
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -20,24 +21,24 @@ export class Credentials extends Context.Service<Credentials, Config>()(
|
|
|
20
21
|
"TypesenseCredentials",
|
|
21
22
|
) {}
|
|
22
23
|
|
|
24
|
+
const envConfig = EffectConfig.all({
|
|
25
|
+
apiKey: EffectConfig.string("TYPESENSE_API_KEY"),
|
|
26
|
+
apiBaseUrl: EffectConfig.string("TYPESENSE_API_URL"),
|
|
27
|
+
});
|
|
28
|
+
|
|
23
29
|
export const CredentialsFromEnv = Layer.effect(
|
|
24
30
|
Credentials,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return { apiKey: Redacted.make(apiKey), apiBaseUrl };
|
|
42
|
-
}),
|
|
31
|
+
envConfig.asEffect().pipe(
|
|
32
|
+
Effect.mapError(
|
|
33
|
+
() =>
|
|
34
|
+
new ConfigError({
|
|
35
|
+
message:
|
|
36
|
+
"TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required",
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
39
|
+
Effect.map(({ apiKey, apiBaseUrl }) => ({
|
|
40
|
+
apiKey: Redacted.make(apiKey),
|
|
41
|
+
apiBaseUrl,
|
|
42
|
+
})),
|
|
43
|
+
),
|
|
43
44
|
);
|