@distilled.cloud/steel 0.0.0 → 1.0.0-rc.20
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 +66 -4
- 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 +24 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +39 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.lazy.js +7 -0
- package/lib/index.lazy.js.map +1 -0
- package/lib/pagination.d.ts +10 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +19 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +50 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/api_keys.d.ts +63 -0
- package/lib/services/api_keys.d.ts.map +1 -0
- package/lib/services/api_keys.js +2 -0
- package/lib/services/api_keys.js.map +1 -0
- package/lib/services/auth.d.ts +32 -0
- package/lib/services/auth.d.ts.map +1 -0
- package/lib/services/auth.js +2 -0
- package/lib/services/auth.js.map +1 -0
- package/lib/services/browser_tools.d.ts +166 -0
- package/lib/services/browser_tools.d.ts.map +1 -0
- package/lib/services/browser_tools.js +2 -0
- package/lib/services/browser_tools.js.map +1 -0
- package/lib/services/captchas.d.ts +72 -0
- package/lib/services/captchas.d.ts.map +1 -0
- package/lib/services/captchas.js +2 -0
- package/lib/services/captchas.js.map +1 -0
- package/lib/services/credentials.d.ts +127 -0
- package/lib/services/credentials.d.ts.map +1 -0
- package/lib/services/credentials.js +2 -0
- package/lib/services/credentials.js.map +1 -0
- package/lib/services/extensions.d.ts +122 -0
- package/lib/services/extensions.d.ts.map +1 -0
- package/lib/services/extensions.js +2 -0
- package/lib/services/extensions.js.map +1 -0
- package/lib/services/files.d.ts +144 -0
- package/lib/services/files.d.ts.map +1 -0
- package/lib/services/files.js +2 -0
- package/lib/services/files.js.map +1 -0
- package/lib/services/index.d.ts +11 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +10 -0
- package/lib/services/profiles.d.ts +422 -0
- package/lib/services/profiles.d.ts.map +1 -0
- package/lib/services/profiles.js +2 -0
- package/lib/services/profiles.js.map +1 -0
- package/lib/services/projects.d.ts +50 -0
- package/lib/services/projects.d.ts.map +1 -0
- package/lib/services/projects.js +2 -0
- package/lib/services/projects.js.map +1 -0
- package/lib/services/sessions.d.ts +1977 -0
- package/lib/services/sessions.d.ts.map +1 -0
- package/lib/services/sessions.js +44 -0
- package/lib/services/sessions.js.map +1 -0
- package/lib/services.lazy/api_keys.js +1 -0
- package/lib/services.lazy/auth.js +1 -0
- package/lib/services.lazy/browser_tools.js +1 -0
- package/lib/services.lazy/captchas.js +1 -0
- package/lib/services.lazy/credentials.js +1 -0
- package/lib/services.lazy/extensions.js +1 -0
- package/lib/services.lazy/files.js +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/profiles.js +1 -0
- package/lib/services.lazy/projects.js +1 -0
- package/lib/services.lazy/sessions.js +4 -0
- package/lib/traits.d.ts +11 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/package.json +83 -2
- package/src/credentials.ts +63 -0
- package/src/errors.ts +51 -0
- package/src/index.ts +25 -0
- package/src/pagination.ts +9 -0
- package/src/protocol.ts +76 -0
- package/src/retry.ts +69 -0
- package/src/services/api_keys.ts +124 -0
- package/src/services/auth.ts +101 -0
- package/src/services/browser_tools.ts +338 -0
- package/src/services/captchas.ts +216 -0
- package/src/services/credentials.ts +292 -0
- package/src/services/extensions.ts +338 -0
- package/src/services/files.ts +456 -0
- package/src/services/index.ts +11 -0
- package/src/services/profiles.ts +871 -0
- package/src/services/projects.ts +146 -0
- package/src/services/sessions.ts +4515 -0
- package/src/traits.ts +46 -0
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
CHANGED
|
@@ -1,9 +1,71 @@
|
|
|
1
1
|
# @distilled.cloud/steel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Effect-native SDK for the [Steel](https://steel.dev) browser API, generated from Steel's
|
|
4
|
+
[OpenAPI description](https://api.steel.dev/sdk-openapi.json) (linked from
|
|
5
|
+
`https://docs.steel.dev/openapi.json`), the one Steel's own SDKs are generated from.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install @distilled.cloud/steel effect
|
|
11
|
+
```
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Effect, Layer } from "effect";
|
|
17
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
18
|
+
import * as Steel from "@distilled.cloud/steel";
|
|
19
|
+
|
|
20
|
+
const program = Effect.gen(function* () {
|
|
21
|
+
// A one-shot scrape runs in a throwaway browser.
|
|
22
|
+
const page = yield* Steel.browserTools.scrape({ url: "https://example.com", format: ["markdown"] });
|
|
23
|
+
|
|
24
|
+
// A session is a long-lived browser you drive over CDP: hand
|
|
25
|
+
// `Redacted.value(session.websocketUrl)` to Playwright or Puppeteer.
|
|
26
|
+
const session = yield* Steel.sessions.createSession({ blockAds: true });
|
|
27
|
+
yield* Steel.sessions.releaseSession({ id: session.id });
|
|
28
|
+
|
|
29
|
+
return { markdown: page.content.markdown, viewer: session.sessionViewerUrl };
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const Live = Layer.mergeAll(FetchHttpClient.layer, Steel.CredentialsFromEnv, Steel.SteelProtocol);
|
|
33
|
+
|
|
34
|
+
program.pipe(Effect.provide(Live), Effect.runPromise);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
One module per API area: `sessions`, `browserTools`, `files`, `captchas`, `credentials`,
|
|
38
|
+
`extensions`, `profiles`, `projects`, `apiKeys` and `auth`.
|
|
39
|
+
|
|
40
|
+
`sessions.listSessions` pages by cursor, so `.pages()` and `.items()` stream every page:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import * as Stream from "effect/Stream";
|
|
44
|
+
|
|
45
|
+
const live = yield* Steel.sessions.listSessions.items({ status: "live" }).pipe(Stream.runCollect);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`websocketUrl` and `debugUrl` come back `Redacted`: the first carries a session token that grants
|
|
49
|
+
control of the browser, and the second opens the session player without an API key.
|
|
50
|
+
|
|
51
|
+
Downloads (`files.downloadFile`, `files.downloadArchive`, `extensions.downloadExtension`, …) return
|
|
52
|
+
the body as a `Uint8Array`. Uploads are multipart and take a `Blob`, `Uint8Array` or `ArrayBuffer`.
|
|
53
|
+
|
|
54
|
+
## Auth
|
|
55
|
+
|
|
56
|
+
`STEEL_API_KEY` as the `steel-api-key` header. `STEEL_BASE_URL` points it at a self-hosted Steel
|
|
57
|
+
browser and defaults to `https://api.steel.dev`. Both names match Steel's official clients. To pass
|
|
58
|
+
a key directly, use `Steel.fromApiKey({ apiKey: Redacted.make(key) })`.
|
|
59
|
+
|
|
60
|
+
## Errors
|
|
61
|
+
|
|
62
|
+
Steel errors carry a machine-readable `code`. The ones callers act on are typed per operation:
|
|
63
|
+
|
|
64
|
+
| Tag | Code | Raised by |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `SessionEnded` | `session_ended` (410) | `runCommands`, `getCommandExecution`, `cancelCommandExecution` on a released or timed-out session |
|
|
67
|
+
| `ProfileNotFound` | `profile_not_found` (404) | `createSession` with an unknown or expired `profileId` |
|
|
68
|
+
|
|
69
|
+
Everything else fails with the statuses the spec declares as typed classes (`NotFound`,
|
|
70
|
+
`Conflict`, `Gone`, `PayloadTooLarge`, …), then the shared HTTP status classes, then
|
|
71
|
+
`UnknownSteelError`, whose `code` is Steel's reason (`budget_exceeded`, `queue_full`, …).
|
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,api$opPaginated as o,category$withAuthError as s,category$withBadRequestError as ee,category$withConflictError as te,category$withParseError as ne,config$Redacted as re,config$String as ie,config$all as ae,config$withDefault as c,pagination$paginateCursor as l,retry$capped as u,retry$jittered as d,retry$makeDefault as f,retry$throttlingFactory as p,retry$throttlingOptions as m,retry$transientFactory as h,retry$transientOptions as g,schema_lite_typed$TaggedError as _,schema_lite_typed$Unknown as v,trait$Body as y,trait$FormDataFile as b,trait$Header as x,trait$Http as S,trait$HttpBody as C,trait$KeyDictionary as w,trait$Label as T,trait$Query as E,trait$ResponseCode as D,trait$UnionCases as O,trait$applyErrorMatchers as k,trait$bodySymbol as A,trait$errorMatchersSymbol as j,trait$formDataFileSymbol as M,trait$getErrorMatchers as N,trait$headerSymbol as P,trait$httpBodySymbol as F,trait$httpSymbol as I,trait$keyDictionarySymbol as L,trait$labelSymbol as R,trait$querySymbol as z,trait$responseCodeSymbol as B,trait$unionCasesSymbol as V}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as H,errors$BadGateway as U,errors$BadRequest as W,errors$ConfigError as G,errors$Conflict as K,errors$DEFAULT_ERRORS as q,errors$Forbidden as J,errors$GatewayTimeout as oe,errors$HTTP_STATUS_MAP as se,errors$InternalServerError as ce,errors$Locked as le,errors$NotFound as ue,errors$ServiceUnavailable as de,errors$TooManyRequests as fe,errors$Unauthorized as pe,errors$UnknownErrorFields as me,errors$UnprocessableEntity as he,protocol_rest$BinaryResponse as ge,protocol_rest$RawResponse as _e,protocol_rest$RawResponseRoot as ve,protocol_rest$SensitiveValue as ye,protocol_rest$makeRestProtocol as be,protocol_rest$rawResponseRootSymbol as xe,protocol_rest$rawResponseSymbol as Se,protocol_rest$sensitiveValueSymbol as Ce,protocol_rest$unknownErrorProps as we,schema_lite$Array as Te,schema_lite$Boolean as Ee,schema_lite$NullOr as De,schema_lite$Number as Oe,schema_lite$Record as ke,schema_lite$String as Ae,schema_lite$Struct as je,schema_lite$StructWithRest as Me,schema_lite$TaggedError as Ne,schema_lite$Union as Pe,schema_lite$Unknown as Fe,schema_lite$at as Ie,schema_lite$instanceOf as Le,schema_lite$optional as Re,schema_lite$suspend as ze}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 Be from"effect/Redacted";const Q=`https://api.steel.dev`;var Credentials=class extends (/*@__PURE__*/ Y.Service()(`SteelCredentials`)){};const Ve=/*@__PURE__*/ ae({apiKey:/*@__PURE__*/ re(`STEEL_API_KEY`),baseUrl:/*@__PURE__*/ ie(`STEEL_BASE_URL`).pipe(/*@__PURE__*/ c(Q))});const He=/*@__PURE__*/ Z.succeed(Credentials,/*@__PURE__*/ Ve.pipe(/*@__PURE__*/ X.map(({apiKey:e,baseUrl:t})=>({apiKey:e,baseUrl:t.replace(/\/+$/,``)})),/*@__PURE__*/ X.mapError(()=>new G({message:`STEEL_API_KEY environment variable is required`}))));const fromApiKey=e=>Z.succeed(Credentials,X.succeed({apiKey:e.apiKey,baseUrl:(e.baseUrl??`https://api.steel.dev`).replace(/\/+$/,``)}));var UnknownSteelError=class extends (/*@__PURE__*/ _()(`UnknownSteelError`,me)){};var SteelParseError=class extends (/*@__PURE__*/ _()(`SteelParseError`,{body:v,cause:v}).pipe(ne)){};const str=e=>typeof e===`string`?e:void 0;const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=t.error!==null&&typeof t.error===`object`?t.error:t;const r=str(n.code);const i=str(n.message)??str(t.error);if(r===void 0&&i===void 0)return void 0;return{code:r,message:i}};const Ue=/*@__PURE__*/ be({credentials:/*@__PURE__*/ X.flatMap(Credentials,e=>e),baseUrl:e=>e.baseUrl,headers:e=>({"steel-api-key":Be.value(e.apiKey)}),errorEnvelope,unknownError:e=>new UnknownSteelError(we(e)),parseError:({body:e,cause:t})=>new SteelParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ Y.Service()(`SteelRetry`)){};const policy=e=>X.provide(Z.succeed(Retry,e));const We=/*@__PURE__*/ X.provide(/*@__PURE__*/ Z.succeed(Retry,{while:()=>false}));const $=f;const Ge=d;const Ke=u;const qe=m;const Je=/*@__PURE__*/ policy(p);const Ye=g;const Xe=/*@__PURE__*/ policy(h);export{Ne as Ac,te as Ba,Pe as Cc,Fe as Dc,Ie as Fc,Le as Ic,Re as Kc,ze as Lc,e as a,t as c,Credentials as credentials$Credentials,He as credentials$CredentialsFromEnv,Q as credentials$DEFAULT_BASE_URL,fromApiKey as credentials$fromApiKey,n as e,H as errors$API_ERRORS,U as errors$BadGateway,W as errors$BadRequest,G as errors$ConfigError,K as errors$Conflict,q as errors$DEFAULT_ERRORS,J as errors$Forbidden,oe as errors$GatewayTimeout,se as errors$HTTP_STATUS_MAP,ce as errors$InternalServerError,le as errors$Locked,ue as errors$NotFound,de as errors$ServiceUnavailable,SteelParseError as errors$SteelParseError,fe as errors$TooManyRequests,pe as errors$Unauthorized,UnknownSteelError as errors$UnknownSteelError,he as errors$UnprocessableEntity,r as k,i as l,Te as lc,a as m,Ee as mc,o as n,l as pagination$paginateCursor,Ue as protocol$SteelProtocol,Retry as retry$Retry,Ke as retry$capped,Ge as retry$jittered,$ as retry$makeDefault,We as retry$none,policy as retry$policy,Je as retry$throttling,qe as retry$throttlingOptions,Xe as retry$transient,Ye as retry$transientOptions,De as tc,ge as traits$BinaryResponse,y as traits$Body,b as traits$FormDataFile,x as traits$Header,S as traits$Http,C as traits$HttpBody,w as traits$KeyDictionary,T as traits$Label,E as traits$Query,_e as traits$RawResponse,ve as traits$RawResponseRoot,D as traits$ResponseCode,ye as traits$SensitiveValue,O as traits$UnionCases,k as traits$applyErrorMatchers,A as traits$bodySymbol,j as traits$errorMatchersSymbol,M as traits$formDataFileSymbol,N as traits$getErrorMatchers,P as traits$headerSymbol,F as traits$httpBodySymbol,I as traits$httpSymbol,L as traits$keyDictionarySymbol,R as traits$labelSymbol,z as traits$querySymbol,xe as traits$rawResponseRootSymbol,Se as traits$rawResponseSymbol,B as traits$responseCodeSymbol,Ce as traits$sensitiveValueSymbol,V as traits$unionCasesSymbol,Oe as uc,ke as vc,s as xa,Ae as xc,ee as ya,je as yc,Me as zc};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Schema.Unknown","Category.withParseError","Retries.makeDefault","Retries.jittered","Retries.capped","Retries.throttlingOptions","Retries.throttlingFactory","Retries.transientOptions","Retries.transientFactory","D","call","error","named","newError","op","opPaginated","withAuthError","withBadRequestError","withConflictError","withParseError","Redacted$3","String$2","all$1","withDefault","paginateCursor","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","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","BinaryResponse","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","unknownErrorProps","Array","Boolean","NullOr","Number","Record","String","Struct","StructWithRest","TaggedError","Union","Unknown","at","instanceOf","optional","suspend","Context","Effect","Layer","Redacted","DEFAULT_BASE_URL","envConfig","CredentialsFromEnv","baseUrl","config","value","body","rec","nested","code","message","SteelProtocol","resolve","creds","info","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"q+EAiBA,MAAasG,EAAmB,wBAQhC,IAAa,YAAb,eACwB,gBAAQ,QAAyD,CAAC,CACtF,kBACF,EAAA,AAAE,CAAC,EAEL,MAAMC,GAA0B,iBAAiB,CAC/C,OAAsB,iBAAsB,eAAe,EAC3D,QAAuB,iBAAoB,gBAAgB,CAAC,CAAC,KAC7C,gBAAyBD,CAAgB,CACzD,CACF,CAAC,EAGD,MAAaE,GAA6D,gBAAM,QAC9E,YACc,iBAAU,KACR,gBAAO,KAAK,CAAE,SAAQ,cAAe,CACjD,SACA,QAASC,EAAQ,QAAQ,OAAQ,EAAE,CACrC,EAAE,EACY,gBAAO,aACb,IAAI7C,EAAY,CAAE,QAAS,gDAAiD,CAAC,CACrF,CACF,CACF,EAGA,MAAa,WAAc,GAIzBwC,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQO,EAAO,OACf,SAAUA,EAAO,SAAA,wBAAA,CAA6B,QAAQ,OAAQ,EAAE,CAClE,CAAC,CACH,ECvBF,IAAa,kBAAb,eACwB,gBAAsC,CAAC,CAC3D,oBACAlC,EACF,EAAA,AAAE,CAAC,EAGL,IAAa,gBAAb,eACwB,gBAAoC,CAAC,CAAC,kBAAmB,CAC7E,KAAMxE,EACN,MAAOA,CACT,CAAC,CAAC,CAAC,KAAKC,EAAuB,EAAA,AAAE,CAAC,ECHpC,MAAM,IAAO,GAAwC,OAAO0G,IAAU,SAAWA,EAAQ,IAAA,GAEzF,MAAM,cAAiB,GAAiD,CACtE,GAAIC,IAAS,MAAQ,OAAOA,IAAS,SAAU,OAAO,IAAA,GACtD,MAAMC,EAAMD,EAGZ,MAAME,EACJD,EAAI,QAAU,MAAQ,OAAOA,EAAI,QAAU,SACtCA,EAAI,MACLA,EACN,MAAME,EAAO,IAAID,EAAO,IAAI,EAC5B,MAAME,EAAU,IAAIF,EAAO,OAAO,GAAK,IAAID,EAAI,KAAK,EACpD,GAAIE,IAAS,IAAA,IAAaC,IAAY,IAAA,GAAW,OAAO,IAAA,GACxD,MAAO,CAAE,OAAM,SAAQ,CACzB,EAEA,MAAaC,GAAyD,iBAAyB,CAG7F,YAA2B,gBAAO,QAAQ,YAAc,GAAYC,CAAO,EAC3E,QAAU,GAAUC,EAAM,QAC1B,QAAU,IAAW,CACnB,gBAAiBd,GAAS,MAAMc,EAAM,MAAM,CAC9C,GACA,cACA,aAAe,GAAS,IAAI,kBAAkBjC,GAAkBkC,CAAI,CAAC,EACrE,YAAa,CAAE,OAAM,WAAY,IAAI,gBAAgB,CAAE,OAAM,OAAM,CAAC,CACtE,CAAC,EClDD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,YAAY,EAAA,AAAE,CAAC,EAGzF,MAAa,OAOR,GAAwCjB,EAAO,QAAQC,EAAM,QAAQ,MAAOiB,CAAgB,CAAC,EAGlG,MAAaC,GAE+C,gBAAO,QACnD,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAOA,MAAaC,EAAuBrH,EAEpC,MAAasH,GAAWrH,EACxB,MAAasH,GAASrH,EAGtB,MAAasH,GAA6BrH,EAG1C,MAAasH,GAE+C,qBAAOrH,CAAyB,EAG5F,MAAasH,GAA4BrH,EAGzC,MAAasH,GAE+C,qBAAOrH,CAAwB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
/** Steel Cloud's API (the spec's `servers` entry). */
|
|
7
|
+
export declare const DEFAULT_BASE_URL = "https://api.steel.dev";
|
|
8
|
+
export interface Config {
|
|
9
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
10
|
+
/** API base URL, without a trailing slash. */
|
|
11
|
+
readonly baseUrl: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "SteelCredentials", Effect.Effect<Config, ConfigError, never>>;
|
|
14
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
15
|
+
}
|
|
16
|
+
/** Reads `STEEL_API_KEY` (required) and `STEEL_BASE_URL` (optional). */
|
|
17
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials>;
|
|
18
|
+
/** Credentials from a redacted API key and an optional base URL. */
|
|
19
|
+
export declare const fromApiKey: (config: {
|
|
20
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
21
|
+
readonly baseUrl?: string;
|
|
22
|
+
}) => Layer.Layer<Credentials>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,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,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AASN,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAWvD,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,UAAU,WAAY;IACjC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$DEFAULT_BASE_URL as DEFAULT_BASE_URL, credentials$fromApiKey as fromApiKey } from "./_bundle/sdk.js";
|
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steel-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the shared HTTP status errors from core and adds the Steel
|
|
5
|
+
* fallback and parse errors.
|
|
6
|
+
*
|
|
7
|
+
* Steel error bodies are `{ error, message, code?, param?, retryable?,
|
|
8
|
+
* retryAfterSeconds? }`, where `code` is the stable machine-readable reason
|
|
9
|
+
* (`budget_exceeded`, `profile_not_ready`). The session-commands endpoints
|
|
10
|
+
* nest it instead: `{ error: { code, message } }`. The protocol reads both,
|
|
11
|
+
* and reports `code` as the code of an `UnknownSteelError`.
|
|
12
|
+
*/
|
|
13
|
+
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";
|
|
14
|
+
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
15
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
16
|
+
declare const UnknownSteelError_base: Schema.TaggedErrorClass<"UnknownSteelError", {
|
|
17
|
+
status: import("effect/Schema").Number;
|
|
18
|
+
code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
19
|
+
message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
20
|
+
body: import("effect/Schema").Unknown;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Unknown Steel error -- returned when an error response matches neither an
|
|
24
|
+
* operation's typed errors nor a shared HTTP status class.
|
|
25
|
+
*/
|
|
26
|
+
export declare class UnknownSteelError extends /*@__PURE__*/ UnknownSteelError_base {
|
|
27
|
+
}
|
|
28
|
+
declare const SteelParseError_base: Schema.TaggedErrorClass<"SteelParseError", {
|
|
29
|
+
readonly body: import("effect/Schema").Unknown;
|
|
30
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
31
|
+
}> & (new (...args: any[]) => {
|
|
32
|
+
"@distilled.cloud/error/categories": {
|
|
33
|
+
ParseError: true;
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
/** A 2xx response that does not match the operation's output schema. */
|
|
37
|
+
export declare class SteelParseError extends /*@__PURE__*/ SteelParseError_base {
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;AAElE;;;GAGG;AACH,qBAAa,iBACX,SAAQ,aAAa,CAAC,sBAGrB;CAAG;;;;;;;;;AAEN,wEAAwE;AACxE,qBAAa,eACX,SAAQ,aAAa,CAAC,oBAGU;CAAG"}
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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$SteelParseError as SteelParseError, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownSteelError as UnknownSteelError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @distilled.cloud/steel -- Steel browser API SDK for Effect.
|
|
3
|
+
*
|
|
4
|
+
* `./services` is generated by `scripts/generate.ts` from the Smithy models
|
|
5
|
+
* that `scripts/convert.ts` converts from the OpenAPI document mirrored at
|
|
6
|
+
* `specs/spec-mirror-steel/specs/openapi.json`. Everything else in this
|
|
7
|
+
* folder is hand-written.
|
|
8
|
+
*
|
|
9
|
+
* One module per API area: `sessions`, `browserTools`, `files`, `captchas`,
|
|
10
|
+
* `credentials`, `extensions`, `profiles`, `projects`, `apiKeys` and `auth`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import * as Steel from "@distilled.cloud/steel";
|
|
15
|
+
*
|
|
16
|
+
* const session = yield* Steel.sessions.createSession({ blockAds: true });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export * from "./credentials.ts";
|
|
20
|
+
export * from "./errors.ts";
|
|
21
|
+
export * as T from "./traits.ts";
|
|
22
|
+
export { SteelProtocol, type SteelOpError, type SteelOpContext } from "./protocol.ts";
|
|
23
|
+
export { paginateCursor } from "./pagination.ts";
|
|
24
|
+
export * as Retry from "./retry.ts";
|
|
25
|
+
export * from "./services/index.ts";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./credentials.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * as T from "./traits.js";
|
|
4
|
+
export { SteelProtocol } from "./protocol.js";
|
|
5
|
+
export { paginateCursor } from "./pagination.js";
|
|
6
|
+
export * as Retry from "./retry.js";
|
|
7
|
+
export * from "./services/index.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./credentials.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * as T from "./traits.js";
|
|
4
|
+
export { SteelProtocol } from "./protocol.js";
|
|
5
|
+
export { paginateCursor } from "./pagination.js";
|
|
6
|
+
export * as Retry from "./retry.js";
|
|
7
|
+
export * from "./services.lazy/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAA0C,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steel pagination -- hand-written.
|
|
3
|
+
*
|
|
4
|
+
* Steel's paginated list (`sessions.listSessions`) is cursor-mode:
|
|
5
|
+
* `cursorId` in, `nextCursor` out, null on the last page. Generated
|
|
6
|
+
* operations pass core's {@link paginateCursor} strategy to
|
|
7
|
+
* `API.makePaginated`.
|
|
8
|
+
*/
|
|
9
|
+
export { paginateCursor } from "@distilled.cloud/core/pagination";
|
|
10
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pagination$paginateCursor as paginateCursor } from "./_bundle/sdk.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as API from "@distilled.cloud/core/api";
|
|
2
|
+
import type { API_ERRORS, ConfigError, InvalidInput } from "@distilled.cloud/core/errors";
|
|
3
|
+
import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
4
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
5
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
6
|
+
import type * as Layer from "effect/Layer";
|
|
7
|
+
import { Credentials } from "./credentials.ts";
|
|
8
|
+
import { SteelParseError, UnknownSteelError } from "./errors.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Error channel shared by every generated Steel operation. Generated service
|
|
11
|
+
* files annotate operations with `API.OperationMethod<I, O, SteelOpError,
|
|
12
|
+
* SteelOpContext>` explicitly so the compiler never infers these back out of
|
|
13
|
+
* the schema generics.
|
|
14
|
+
*/
|
|
15
|
+
export type SteelOpError = InstanceType<(typeof API_ERRORS)[number]> | UnknownSteelError | ConfigError | HttpClientError.HttpClientError | SteelParseError | InvalidInput | SdkError;
|
|
16
|
+
/** Context (requirements) shared by every generated Steel operation. */
|
|
17
|
+
export type SteelOpContext = Credentials | HttpClient.HttpClient;
|
|
18
|
+
export declare const SteelProtocol: Layer.Layer<API.Protocol>;
|
|
19
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +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,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAM1F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAehE,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,iBAAiB,GACjB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,eAAe,GACf,YAAY,GACZ,QAAQ,CAAC;AAEb,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAmBjE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAWlD,CAAC"}
|
package/lib/protocol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { protocol$SteelProtocol as SteelProtocol } from "./_bundle/sdk.js";
|
package/lib/retry.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Retries from "@distilled.cloud/core/retry";
|
|
2
|
+
/**
|
|
3
|
+
* Steel retry surface -- a veneer over `@distilled.cloud/core/retry`.
|
|
4
|
+
*
|
|
5
|
+
* The `Retry` service tag is threaded into every generated operation via
|
|
6
|
+
* `API.make({ retry: Retry })`, so a caller-installed policy applies to all
|
|
7
|
+
* Steel calls below it and core's `makeDefault` is the fallback when none is
|
|
8
|
+
* provided.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import * as Steel from "@distilled.cloud/steel";
|
|
13
|
+
*
|
|
14
|
+
* myEffect.pipe(Steel.Retry.transient);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import * as Context from "effect/Context";
|
|
18
|
+
import * as Effect from "effect/Effect";
|
|
19
|
+
export type Options = Retries.Options;
|
|
20
|
+
export type Factory = Retries.Factory;
|
|
21
|
+
export type Policy = Retries.Policy;
|
|
22
|
+
declare const Retry_base: Context.ServiceClass<Retry, "SteelRetry", Retries.Policy>;
|
|
23
|
+
/** Context tag for configuring retry behavior of Steel API calls. */
|
|
24
|
+
export declare class Retry extends /*@__PURE__*/ Retry_base {
|
|
25
|
+
}
|
|
26
|
+
/** Provides a custom retry policy to every Steel API call below it. */
|
|
27
|
+
export declare const policy: {
|
|
28
|
+
(options: Options): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
29
|
+
(factory: Factory): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
30
|
+
};
|
|
31
|
+
/** Disables all automatic retries. */
|
|
32
|
+
export declare const none: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
33
|
+
/**
|
|
34
|
+
* The default retry policy (core's): transient/throttling/retryable errors,
|
|
35
|
+
* capped exponential backoff with jitter, server `retryAfter` hints honored
|
|
36
|
+
* with precedence.
|
|
37
|
+
*/
|
|
38
|
+
export declare const makeDefault: Factory;
|
|
39
|
+
export declare const jittered: <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
|
|
40
|
+
export declare const capped: (max: import("effect/Duration").Duration) => <Error, Env>(self: import("effect/Schedule").Schedule<unknown, unknown, Error, Env>) => import("effect/Schedule").Schedule<unknown, unknown, Error, Env>;
|
|
41
|
+
/** Retry options that retry all throttling errors indefinitely. */
|
|
42
|
+
export declare const throttlingOptions: Options;
|
|
43
|
+
/** Retries all throttling errors indefinitely (honoring server hints). */
|
|
44
|
+
export declare const throttling: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
45
|
+
/** Retry options that retry all transient errors indefinitely. */
|
|
46
|
+
export declare const transientOptions: Options;
|
|
47
|
+
/** Retries all transient errors indefinitely. */
|
|
48
|
+
export declare const transient: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;;AAEpC,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAA8C;CAAG;AAE1F,uEAAuE;AACvE,eAAO,MAAM,MAAM,EAAE;IACnB,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACvF,CACE,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;CACU,CAAC;AAEpG,sCAAsC;AACtC,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,OAA6B,CAAC;AAExD,eAAO,MAAM,QAAQ,0JAAmB,CAAC;AACzC,eAAO,MAAM,MAAM,uMAAiB,CAAC;AAErC,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,OAAmC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAmD,CAAC;AAE9F,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,EAAE,OAAkC,CAAC;AAElE,iDAAiD;AACjD,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAkD,CAAC"}
|
package/lib/retry.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as API from "@distilled.cloud/core/api";
|
|
2
|
+
import * as S from "@distilled.cloud/core/schema-lite";
|
|
3
|
+
import type * as Redacted from "effect/Redacted";
|
|
4
|
+
import { type SteelOpError, type SteelOpContext } from "../protocol.ts";
|
|
5
|
+
export type { SteelOpError, SteelOpContext };
|
|
6
|
+
declare const BadRequest_base: S.TaggedErrorClass<"BadRequest", {
|
|
7
|
+
readonly code: any;
|
|
8
|
+
readonly message: any;
|
|
9
|
+
}> & (new (...args: any[]) => {
|
|
10
|
+
"@distilled.cloud/error/categories": {
|
|
11
|
+
BadRequestError: true;
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
|
|
15
|
+
}
|
|
16
|
+
declare const Forbidden_base: S.TaggedErrorClass<"Forbidden", {
|
|
17
|
+
readonly code: any;
|
|
18
|
+
readonly message: any;
|
|
19
|
+
}> & (new (...args: any[]) => {
|
|
20
|
+
"@distilled.cloud/error/categories": {
|
|
21
|
+
AuthError: true;
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
export declare class Forbidden extends /*@__PURE__*/ Forbidden_base {
|
|
25
|
+
}
|
|
26
|
+
declare const NotFound_base: S.TaggedErrorClass<"NotFound", {
|
|
27
|
+
readonly code: any;
|
|
28
|
+
readonly message: any;
|
|
29
|
+
}> & (new (...args: any[]) => {
|
|
30
|
+
"@distilled.cloud/error/categories": {
|
|
31
|
+
BadRequestError: true;
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
export declare class NotFound extends /*@__PURE__*/ NotFound_base {
|
|
35
|
+
}
|
|
36
|
+
/** Defaults to `project`. Global API keys may only create project-scoped keys. Only organization admins using dashboard authentication may create a `global` key; projectId is ignored for those keys. */
|
|
37
|
+
export type CreateApiKeyRequestScopeType = "project" | "global";
|
|
38
|
+
export interface CreateApiKeyRequest {
|
|
39
|
+
/** A human-readable label for the new key. Defaults to Default. */
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
/** The active project to bind the new key to, belonging to the authenticated organization. Required when authenticating with a global API key. Dashboard users may omit it to use their default project. */
|
|
42
|
+
projectId?: string | undefined;
|
|
43
|
+
/** Defaults to `project`. Global API keys may only create project-scoped keys. Only organization admins using dashboard authentication may create a `global` key; projectId is ignored for those keys. */
|
|
44
|
+
scopeType?: CreateApiKeyRequestScopeType | (string & {}) | undefined;
|
|
45
|
+
}
|
|
46
|
+
/** `project` pins the key to one project. `global` authorizes access across the organization and has no project binding. */
|
|
47
|
+
export type ApiKeyResponseScopeType = "project" | "global";
|
|
48
|
+
export interface ApiKeyResponse {
|
|
49
|
+
createdAt: string;
|
|
50
|
+
id: string;
|
|
51
|
+
/** The full secret on creation or rotation only. Metadata reads return a masked preview. Store a newly created secret securely; it cannot be retrieved later. */
|
|
52
|
+
key: string | Redacted.Redacted<string>;
|
|
53
|
+
name?: string | undefined;
|
|
54
|
+
/** The pinned project, or null for a global key, which binds to no project. */
|
|
55
|
+
projectId: string | null;
|
|
56
|
+
/** `project` pins the key to one project. `global` authorizes access across the organization and has no project binding. */
|
|
57
|
+
scopeType: ApiKeyResponseScopeType;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
}
|
|
60
|
+
export type CreateApiKeyError = BadRequest | Forbidden | NotFound | SteelOpError;
|
|
61
|
+
/** Create an API key Create a project-scoped API key using a global (organization-scoped) API key. Supply projectId for an active project in the authenticated organization; scopeType must be project or omitted. Project-scoped API keys cannot create keys, and global keys cannot create other global keys. Dashboard users may also create project keys, or global keys with organization admin access. Returns the full secret once with Cache-Control: no-store; save it securely. The new key is independent: revoking the creating global key does not revoke keys it created. Missing projectId returns 400; insufficient scope returns 403; an unavailable or foreign project returns 404. */
|
|
62
|
+
export declare const createApiKey: API.OperationMethod<CreateApiKeyRequest, ApiKeyResponse, CreateApiKeyError, SteelOpContext>;
|
|
63
|
+
//# sourceMappingURL=api_keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api_keys.d.ts","sourceRoot":"","sources":["../../src/services/api_keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAGjD,OAAO,KAAK,CAAC,MAAM,mCAAmC,CAAC;AAEvD,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;;;;;;;;;AAc7C,qBAAa,UACX,SAAQ,aAAa,CAAC,eAMrB;CAAG;;;;;;;;;AAEN,qBAAa,SACX,SAAQ,aAAa,CAAC,cAMrB;CAAG;;;;;;;;;AAEN,qBAAa,QACX,SAAQ,aAAa,CAAC,aAMrB;CAAG;AAEN,0MAA0M;AAC1M,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,QAAQ,CAAC;AAChE,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,4MAA4M;IAC5M,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,0MAA0M;IAC1M,SAAS,CAAC,EAAE,4BAA4B,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;CACtE;AACD,4HAA4H;AAC5H,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC3D,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iKAAiK;IACjK,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4HAA4H;IAC5H,SAAS,EAAE,uBAAuB,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC;AACjF,yqBAAyqB;AACzqB,eAAO,MAAM,YAAY,EAAE,GAAG,CAAC,eAAe,CAC5C,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,cAAc,CASb,CAAC"}
|