@distilled.cloud/typesense 1.0.0-rc.2 → 1.0.0-rc.21
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/LICENSE +201 -0
- package/README.md +33 -0
- package/lib/.lazy.json +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +18 -5
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +1 -42
- package/lib/errors.d.ts +20 -16
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -24
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -9
- package/lib/index.lazy.js +6 -0
- package/lib/index.lazy.js.map +1 -0
- package/lib/protocol.d.ts +10 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -31
- package/lib/retry.d.ts +2 -2
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -33
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +0 -2
- package/lib/services/typesense.d.ts +1319 -1574
- package/lib/services/typesense.d.ts.map +1 -1
- package/lib/services/typesense.js +112 -2916
- package/lib/services/typesense.js.map +1 -1
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/typesense.js +4 -0
- package/lib/traits.d.ts +1 -1
- package/lib/traits.d.ts.map +1 -1
- package/lib/traits.js +1 -11
- package/package.json +40 -17
- package/src/credentials.ts +32 -27
- package/src/errors.ts +19 -16
- package/src/index.ts +5 -9
- package/src/protocol.ts +28 -33
- package/src/retry.ts +6 -10
- package/src/services/typesense.ts +4377 -5048
- package/src/traits.ts +1 -1
- package/lib/credentials.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/protocol.js.map +0 -1
- package/lib/retry.js.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/traits.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @distilled.cloud/typesense
|
|
2
|
+
|
|
3
|
+
Effect-native SDK for [typesense](https://www.npmjs.com/package/@distilled.cloud/typesense).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @distilled.cloud/typesense effect
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Effect, Layer } from "effect";
|
|
15
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
16
|
+
import * as Typesense from "@distilled.cloud/typesense";
|
|
17
|
+
|
|
18
|
+
const program = Effect.gen(function* () {
|
|
19
|
+
const result = yield* Typesense.getCollections({});
|
|
20
|
+
return result;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const Live = Layer.mergeAll(
|
|
24
|
+
FetchHttpClient.layer,
|
|
25
|
+
Typesense.CredentialsFromEnv,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
program.pipe(Effect.provide(Live), Effect.runPromise);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Auth
|
|
32
|
+
|
|
33
|
+
Required: `TYPESENSE_API_KEY`. Optional: `TYPESENSE_API_URL`.
|
package/lib/.lazy.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"serviceDirs":["services"],"twins":["index.js"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as i,api$op as a,category$withBadRequestError as o,category$withConflictError as s,category$withParseError as c,config$String as l,config$all as ee,retry$capped as te,retry$jittered as ne,retry$makeDefault as re,retry$throttlingFactory as u,retry$throttlingOptions as d,retry$transientFactory as f,retry$transientOptions as p,schema_lite_typed$TaggedError as m,schema_lite_typed$Unknown as h,trait$Body as g,trait$FormDataFile as _,trait$Header as v,trait$Http as y,trait$HttpBody as b,trait$KeyDictionary as x,trait$Label as S,trait$Query as C,trait$ResponseCode as w,trait$UnionCases as T,trait$applyErrorMatchers as E,trait$bodySymbol as D,trait$errorMatchersSymbol as O,trait$formDataFileSymbol as k,trait$getErrorMatchers as A,trait$headerSymbol as j,trait$httpBodySymbol as M,trait$httpSymbol as N,trait$keyDictionarySymbol as P,trait$labelSymbol as F,trait$querySymbol as I,trait$responseCodeSymbol as L,trait$unionCasesSymbol as R}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as z,errors$BadGateway as B,errors$BadRequest as V,errors$ConfigError as H,errors$Conflict as U,errors$DEFAULT_ERRORS as W,errors$Forbidden as G,errors$GatewayTimeout as K,errors$HTTP_STATUS_MAP as q,errors$InternalServerError as J,errors$Locked as Y,errors$NotFound as ie,errors$ServiceUnavailable as ae,errors$TooManyRequests as oe,errors$Unauthorized as se,errors$UnknownErrorFields as ce,errors$UnprocessableEntity as le,protocol_rest$RawResponse as ue,protocol_rest$RawResponseRoot as de,protocol_rest$SensitiveValue as fe,protocol_rest$rawResponseRootSymbol as pe,protocol_rest$rawResponseSymbol as me,protocol_rest$restProtocol as he,protocol_rest$sensitiveValueSymbol as ge,protocol_rest$unknownErrorProps as _e,schema_lite$Array as ve,schema_lite$Boolean as ye,schema_lite$Number as be,schema_lite$Record as xe,schema_lite$String as Se,schema_lite$Struct as Ce,schema_lite$TaggedError as we,schema_lite$Union as Te,schema_lite$Unknown as Ee,schema_lite$at as De,schema_lite$optional as Oe,schema_lite$suspend as ke}from"@distilled.cloud/core/_bundle/rest";import*as X from"effect/Context";import*as Z from"effect/Effect";import*as Q from"effect/Layer";import*as $ from"effect/Redacted";const Ae=``;var Credentials=class extends (/*@__PURE__*/ X.Service()(`TypesenseCredentials`)){};const je=/*@__PURE__*/ ee({apiKey:/*@__PURE__*/ l(`TYPESENSE_API_KEY`),apiBaseUrl:/*@__PURE__*/ l(`TYPESENSE_API_URL`)});const Me=/*@__PURE__*/ Q.effect(Credentials,/*@__PURE__*/ Z.map(/*@__PURE__*/ je.pipe(/*@__PURE__*/ Z.mapError(()=>new H({message:`TYPESENSE_API_KEY and TYPESENSE_API_URL environment variables are required`})),/*@__PURE__*/ Z.map(({apiKey:e,apiBaseUrl:t})=>({apiKey:$.make(e),apiBaseUrl:t}))),e=>Z.succeed(e)));const credentials=e=>Q.succeed(Credentials,Z.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl}));const formatHeaders=e=>({"X-TYPESENSE-API-KEY":$.value(e.apiKey)});var UnknownTypesenseError=class extends (/*@__PURE__*/ m()(`UnknownTypesenseError`,ce)){};var TypesenseParseError=class extends (/*@__PURE__*/ m()(`TypesenseParseError`,{body:h,cause:h}).pipe(c)){};const Ne=z;const Pe=/*@__PURE__*/ he({credentials:/*@__PURE__*/ Z.flatten(Credentials),baseUrl:e=>e.apiBaseUrl,headers:formatHeaders,unknownError:e=>new UnknownTypesenseError(_e(e)),parseError:({body:e,cause:t})=>new TypesenseParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ X.Service()(`TypesenseRetry`)){};const policy=e=>Z.provide(Q.succeed(Retry,e));const Fe=/*@__PURE__*/ Z.provide(/*@__PURE__*/ Q.succeed(Retry,{while:()=>false}));const Ie=/*@__PURE__*/ policy(u);const Le=/*@__PURE__*/ policy(f);export{De as Bc,s as Ca,Oe as Gc,ke as Hc,e as a,t as b,Credentials as credentials$Credentials,Me as credentials$CredentialsFromEnv,Ae as credentials$DEFAULT_API_BASE_URL,credentials as credentials$credentials,formatHeaders as credentials$formatHeaders,z as errors$API_ERRORS,B as errors$BadGateway,V as errors$BadRequest,H as errors$ConfigError,U as errors$Conflict,W as errors$DEFAULT_ERRORS,G as errors$Forbidden,K as errors$GatewayTimeout,q as errors$HTTP_STATUS_MAP,J as errors$InternalServerError,Y as errors$Locked,ie as errors$NotFound,ae as errors$ServiceUnavailable,oe as errors$TooManyRequests,TypesenseParseError as errors$TypesenseParseError,Ne as errors$TypesenseServiceErrors,se as errors$Unauthorized,UnknownTypesenseError as errors$UnknownTypesenseError,le as errors$UnprocessableEntity,n as f,ve as gc,ye as hc,r as l,i as m,a as n,Pe as protocol$TypesenseProtocol,be as qc,xe as rc,Retry as retry$Retry,te as retry$capped,ne as retry$jittered,re as retry$makeDefault,Fe as retry$none,policy as retry$policy,Ie as retry$throttling,u as retry$throttlingFactory,d as retry$throttlingOptions,Le as retry$transient,f as retry$transientFactory,p as retry$transientOptions,Se as tc,g as traits$Body,_ as traits$FormDataFile,v as traits$Header,y as traits$Http,b as traits$HttpBody,x as traits$KeyDictionary,S as traits$Label,C as traits$Query,ue as traits$RawResponse,de as traits$RawResponseRoot,w as traits$ResponseCode,fe as traits$SensitiveValue,T as traits$UnionCases,E as traits$applyErrorMatchers,D as traits$bodySymbol,O as traits$errorMatchersSymbol,k as traits$formDataFileSymbol,A as traits$getErrorMatchers,j as traits$headerSymbol,M as traits$httpBodySymbol,N as traits$httpSymbol,P as traits$keyDictionarySymbol,F as traits$labelSymbol,I as traits$querySymbol,pe as traits$rawResponseRootSymbol,me as traits$rawResponseSymbol,L as traits$responseCodeSymbol,ge as traits$sensitiveValueSymbol,R as traits$unionCasesSymbol,Ce as uc,we as wc,Te as yc,o as za,Ee as zc};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Schema.Unknown","Category.withParseError","D","call","error","named","newError","op","withBadRequestError","withConflictError","withParseError","String$2","all$1","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","TaggedError$1","Unknown$1","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","UnknownErrorFields","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","restProtocol","sensitiveValueSymbol","unknownErrorProps","Array","Boolean","Number","Record","String","Struct","TaggedError","Union","Unknown","at","optional","suspend","Context","Effect","Layer","Redacted","DEFAULT_API_BASE_URL","envConfig","CredentialsFromEnv","apiKey","config","TypesenseServiceErrors","TypesenseProtocol","creds","info","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"muEAoBA,MAAasF,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,CACnE,CAAC,EAMD,MAAaC,GAAmC,gBAAM,OACpD,YACc,gBAAO,IACL,iBAAU,KACR,gBAAO,aAEjB,IAAIxC,EAAY,CACd,QAAS,4EACX,CAAC,CACL,EACc,gBAAO,KAAK,CAAE,SAAQ,iBAAkB,CACpD,OAAQqC,EAAS,KAAKI,CAAM,EAC5B,YACF,EAAE,CACJ,EACC,GAAWN,EAAO,QAAQO,CAAM,CACnC,CACF,EAGA,MAAa,YAAe,GAI1BN,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQO,EAAO,OACf,WAAYA,EAAO,UACrB,CAAC,CACH,EAGF,MAAa,cAAiB,IAA4C,CACxE,sBAAuBL,EAAS,MAAMK,EAAO,MAAM,CACrD,GC7CA,IAAa,sBAAb,eACwB,gBAA0C,CAAC,CAC/D,wBACA9B,EACF,EAAA,AAAE,CAAC,EAGL,IAAa,oBAAb,eACwB,gBAAwC,CAAC,CAAC,sBAAuB,CACrF,KAAM5D,EACN,MAAOA,CACT,CAAC,CAAC,CAAC,KAAKC,CAAuB,EAAA,AAAE,CAAC,EAmBpC,MAAa0F,GAAyB9C,ECzBtC,MAAa+C,GAAkC,iBAAa,CAG1D,YAA2B,gBAAO,QAAQ,WAAW,EACrD,QAAU,GAAUC,EAAM,WAC1B,QAAS,cAGT,aAAe,GAAS,IAAI,sBAAsBxB,GAAkByB,CAAI,CAAC,EACzE,YAAa,CAAE,OAAM,WAAY,IAAI,oBAAoB,CAAE,OAAM,OAAM,CAAC,CAC1E,CAAC,ECXD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,gBAAgB,EAAA,AAAE,CAAC,EAG7F,MAAa,OAAU,GACrBX,EAAO,QAAQC,EAAM,QAAQ,MAAOW,CAAgB,CAAC,EAGvD,MAAaC,GAAqB,gBAAO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAOjF,CAAiB,EAGhE,MAAakF,GAA0B,qBAAOhF,CAAgB"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 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";
|
|
1
10
|
import * as Context from "effect/Context";
|
|
2
11
|
import * as Effect from "effect/Effect";
|
|
3
12
|
import * as Layer from "effect/Layer";
|
|
4
13
|
import * as Redacted from "effect/Redacted";
|
|
5
14
|
/**
|
|
6
|
-
* Typesense has no fixed default base URL
|
|
15
|
+
* Typesense has no fixed default base URL -- users run their own server
|
|
7
16
|
* (e.g. http://localhost:8108) or use Typesense Cloud (per-cluster URLs
|
|
8
17
|
* like https://xxx.a1.typesense.net). Users must supply TYPESENSE_API_URL.
|
|
9
18
|
*/
|
|
@@ -13,12 +22,16 @@ export interface Config {
|
|
|
13
22
|
readonly apiBaseUrl: string;
|
|
14
23
|
}
|
|
15
24
|
declare const Credentials_base: Context.ServiceClass<Credentials, "TypesenseCredentials", Effect.Effect<Config, never, never>>;
|
|
16
|
-
export declare class Credentials extends Credentials_base {
|
|
25
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
17
26
|
}
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Its configuration is read and checked once, when the layer is built: a
|
|
29
|
+
* problem there fails the layer with `ConfigError`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError, never>;
|
|
32
|
+
/** Convenience layer from a redacted key + base URL (kept for local tests). */
|
|
20
33
|
export declare const credentials: (config: {
|
|
21
|
-
readonly apiKey: string
|
|
34
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
22
35
|
readonly apiBaseUrl: string;
|
|
23
36
|
}) => Layer.Layer<Credentials>;
|
|
24
37
|
/** Auth headers for a resolved credentials config. */
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,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;;;GAGG;AACH,eAAO,MAAM,kBAAkB,8CAiB9B,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,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 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 plain key + base URL (kept for local tests). */
|
|
34
|
-
export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
35
|
-
apiKey: Redacted.make(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,24 @@
|
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
export declare class UnknownTypesenseError extends UnknownTypesenseError_base {
|
|
10
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
11
|
+
declare const UnknownTypesenseError_base: Schema.TaggedErrorClass<"UnknownTypesenseError", {
|
|
12
|
+
status: import("effect/Schema").Number;
|
|
13
|
+
code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
14
|
+
message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
15
|
+
body: import("effect/Schema").Unknown;
|
|
16
|
+
}>;
|
|
17
|
+
export declare class UnknownTypesenseError extends /*@__PURE__*/ UnknownTypesenseError_base {
|
|
21
18
|
}
|
|
22
|
-
declare const TypesenseParseError_base: Schema.
|
|
23
|
-
readonly body: Schema.Unknown;
|
|
24
|
-
readonly cause: Schema.Unknown;
|
|
25
|
-
}
|
|
19
|
+
declare const TypesenseParseError_base: Schema.TaggedErrorClass<"TypesenseParseError", {
|
|
20
|
+
readonly body: import("effect/Schema").Unknown;
|
|
21
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
22
|
+
}> & (new (...args: any[]) => {
|
|
26
23
|
"@distilled.cloud/error/categories": {
|
|
27
24
|
ParseError: true;
|
|
28
25
|
};
|
|
29
26
|
});
|
|
30
|
-
export declare class TypesenseParseError extends TypesenseParseError_base {
|
|
27
|
+
export declare class TypesenseParseError extends /*@__PURE__*/ TypesenseParseError_base {
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
30
|
* Errors that any Typesense operation may surface in addition to
|
|
@@ -39,4 +36,11 @@ export type ClientErrors = TypesenseParseError | UnknownTypesenseError;
|
|
|
39
36
|
* core plus the client-level fallback/decode errors.
|
|
40
37
|
*/
|
|
41
38
|
export type DefaultErrors = CoreDefaultErrors | ClientErrors;
|
|
39
|
+
/**
|
|
40
|
+
* The errors declared on the Typesense service: any operation can return them,
|
|
41
|
+
* and every generated operation lists them as its `serviceErrors`. Today that
|
|
42
|
+
* is each of core's status classes (401, 403, 404, 429, the 5xx ...).
|
|
43
|
+
*/
|
|
44
|
+
export declare const TypesenseServiceErrors: readonly [typeof import("@distilled.cloud/core/errors").Unauthorized, typeof import("@distilled.cloud/core/errors").Forbidden, typeof import("@distilled.cloud/core/errors").NotFound, typeof import("@distilled.cloud/core/errors").BadRequest, typeof import("@distilled.cloud/core/errors").Conflict, typeof import("@distilled.cloud/core/errors").UnprocessableEntity, typeof import("@distilled.cloud/core/errors").TooManyRequests, typeof import("@distilled.cloud/core/errors").Locked, typeof import("@distilled.cloud/core/errors").InternalServerError, typeof import("@distilled.cloud/core/errors").BadGateway, typeof import("@distilled.cloud/core/errors").ServiceUnavailable, typeof import("@distilled.cloud/core/errors").GatewayTimeout];
|
|
45
|
+
export type TypesenseServiceError = InstanceType<(typeof TypesenseServiceErrors)[number]>;
|
|
42
46
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","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;AAEvF,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;AAGlE,qBAAa,qBACX,SAAQ,aAAa,CAAC,0BAGrB;CAAG;;;;;;;;;AAGN,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;AAE7D;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+tBAAa,CAAC;AACjD,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,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 Schema from "effect/Schema";
|
|
10
|
-
import * as Category from "@distilled.cloud/core/category";
|
|
11
|
-
// Unknown Typesense error - returned when an error code is not recognized
|
|
12
|
-
export class UnknownTypesenseError extends Schema.TaggedErrorClass()("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.TaggedErrorClass()("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$TypesenseServiceErrors as TypesenseServiceErrors, errors$Unauthorized as Unauthorized, errors$UnknownTypesenseError as UnknownTypesenseError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @distilled.cloud/typesense
|
|
2
|
+
* @distilled.cloud/typesense -- Typesense SDK for Effect.
|
|
3
3
|
*
|
|
4
|
-
* `./services` is generated by `scripts/generate.ts` from the Smithy model
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `./services` is generated by `scripts/generate.ts` from the Smithy model that
|
|
5
|
+
* `scripts/convert.ts` converts from the Typesense OpenAPI spec. Everything
|
|
6
|
+
* else in this folder is hand-written.
|
|
7
7
|
*/
|
|
8
8
|
export * from "./credentials.ts";
|
|
9
9
|
export * from "./errors.ts";
|
|
10
10
|
export * as T from "./traits.ts";
|
|
11
|
-
export { TypesenseProtocol, type TypesenseOpError, type TypesenseOpContext
|
|
11
|
+
export { TypesenseProtocol, type TypesenseOpError, type TypesenseOpContext } from "./protocol.ts";
|
|
12
12
|
export * as Retry from "./retry.ts";
|
|
13
13
|
export * as Services from "./services/index.ts";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
|
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
|
-
export { TypesenseProtocol
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAkD,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
|
package/lib/protocol.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type * as HttpClient from "effect/
|
|
3
|
-
import type * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
4
|
-
import type * as API from "@distilled.cloud/core/api";
|
|
5
|
-
import type { ConfigError } from "@distilled.cloud/core/errors";
|
|
1
|
+
import type { ErrorOf } from "@distilled.cloud/core/protocol";
|
|
2
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
6
3
|
import { Credentials } from "./credentials.ts";
|
|
7
|
-
import { type
|
|
4
|
+
import { UnknownTypesenseError, TypesenseParseError, type TypesenseServiceError } from "./errors.ts";
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* service
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* What every generated Typesense operation fails with besides its own errors:
|
|
7
|
+
* the service's errors, the protocol's, and what resolving the credentials
|
|
8
|
+
* fails with. Generated service files annotate operations with
|
|
9
|
+
* `API.OperationMethod<I, O, TypesenseOpError, TypesenseOpContext>` explicitly
|
|
10
|
+
* so the compiler never infers these back out of the schema generics.
|
|
13
11
|
*/
|
|
14
|
-
export type TypesenseOpError =
|
|
12
|
+
export type TypesenseOpError = TypesenseServiceError | ErrorOf<typeof TypesenseProtocol>;
|
|
15
13
|
/** Context (requirements) shared by every generated Typesense operation. */
|
|
16
14
|
export type TypesenseOpContext = Credentials | HttpClient.HttpClient;
|
|
17
|
-
export declare const TypesenseProtocol:
|
|
15
|
+
export declare const TypesenseProtocol: import("@distilled.cloud/core/protocol").Protocol<TypesenseParseError | UnknownTypesenseError | import("@distilled.cloud/core/protocol-rest").RestProtocolError, Credentials>;
|
|
18
16
|
//# sourceMappingURL=protocol.d.ts.map
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAgB9D,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAErE,eAAO,MAAM,iBAAiB,+KAU5B,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* TypesenseProtocol — the shared bearer/header-auth REST factory from core,
|
|
3
|
-
* instantiated with Typesense's specifics:
|
|
4
|
-
*
|
|
5
|
-
* request: base URL from the caller's credentials (Typesense has no fixed
|
|
6
|
-
* default — self-hosted servers and per-cluster Cloud URLs), auth
|
|
7
|
-
* via the `X-TYPESENSE-API-KEY` header
|
|
8
|
-
*
|
|
9
|
-
* response: plain JSON, no envelope. Non-2xx bodies decode against
|
|
10
|
-
* Typesense's ApiResponse (`{ message }`) via the factory's
|
|
11
|
-
* default envelope reader; per-op typed errors match first, then
|
|
12
|
-
* the shared HTTP status map, then UnknownTypesenseError.
|
|
13
|
-
*/
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
|
-
import { makeRestProtocol } from "@distilled.cloud/core/protocol-rest";
|
|
16
|
-
import { Credentials, formatHeaders } from "./credentials.js";
|
|
17
|
-
import { UnknownTypesenseError } 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
|
-
});
|
|
31
|
-
//# sourceMappingURL=protocol.js.map
|
|
1
|
+
export { protocol$TypesenseProtocol as TypesenseProtocol } from "./_bundle/sdk.js";
|
package/lib/retry.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Policy } from "@distilled.cloud/core/retry";
|
|
1
2
|
/**
|
|
2
3
|
* Typesense retry configuration.
|
|
3
4
|
*
|
|
@@ -16,11 +17,10 @@
|
|
|
16
17
|
*/
|
|
17
18
|
import * as Context from "effect/Context";
|
|
18
19
|
import * as Effect from "effect/Effect";
|
|
19
|
-
import { type Policy } from "@distilled.cloud/core/retry";
|
|
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","
|
|
1
|
+
{"version":3,"file":"retry.d.ts","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"}
|