@distilled.cloud/steel 0.0.0-stage → 1.0.0-rc.19

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.
Files changed (102) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +70 -2
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +24 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +42 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +26 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +7 -0
  16. package/lib/index.lazy.js +7 -0
  17. package/lib/index.lazy.js.map +1 -0
  18. package/lib/pagination.d.ts +10 -0
  19. package/lib/pagination.d.ts.map +1 -0
  20. package/lib/pagination.js +1 -0
  21. package/lib/protocol.d.ts +19 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +1 -0
  24. package/lib/retry.d.ts +50 -0
  25. package/lib/retry.d.ts.map +1 -0
  26. package/lib/retry.js +1 -0
  27. package/lib/services/api_keys.d.ts +63 -0
  28. package/lib/services/api_keys.d.ts.map +1 -0
  29. package/lib/services/api_keys.js +2 -0
  30. package/lib/services/api_keys.js.map +1 -0
  31. package/lib/services/auth.d.ts +32 -0
  32. package/lib/services/auth.d.ts.map +1 -0
  33. package/lib/services/auth.js +2 -0
  34. package/lib/services/auth.js.map +1 -0
  35. package/lib/services/browser_tools.d.ts +166 -0
  36. package/lib/services/browser_tools.d.ts.map +1 -0
  37. package/lib/services/browser_tools.js +2 -0
  38. package/lib/services/browser_tools.js.map +1 -0
  39. package/lib/services/captchas.d.ts +72 -0
  40. package/lib/services/captchas.d.ts.map +1 -0
  41. package/lib/services/captchas.js +2 -0
  42. package/lib/services/captchas.js.map +1 -0
  43. package/lib/services/credentials.d.ts +127 -0
  44. package/lib/services/credentials.d.ts.map +1 -0
  45. package/lib/services/credentials.js +2 -0
  46. package/lib/services/credentials.js.map +1 -0
  47. package/lib/services/extensions.d.ts +122 -0
  48. package/lib/services/extensions.d.ts.map +1 -0
  49. package/lib/services/extensions.js +2 -0
  50. package/lib/services/extensions.js.map +1 -0
  51. package/lib/services/files.d.ts +144 -0
  52. package/lib/services/files.d.ts.map +1 -0
  53. package/lib/services/files.js +2 -0
  54. package/lib/services/files.js.map +1 -0
  55. package/lib/services/index.d.ts +11 -0
  56. package/lib/services/index.d.ts.map +1 -0
  57. package/lib/services/index.js +10 -0
  58. package/lib/services/profiles.d.ts +422 -0
  59. package/lib/services/profiles.d.ts.map +1 -0
  60. package/lib/services/profiles.js +2 -0
  61. package/lib/services/profiles.js.map +1 -0
  62. package/lib/services/projects.d.ts +50 -0
  63. package/lib/services/projects.d.ts.map +1 -0
  64. package/lib/services/projects.js +2 -0
  65. package/lib/services/projects.js.map +1 -0
  66. package/lib/services/sessions.d.ts +1977 -0
  67. package/lib/services/sessions.d.ts.map +1 -0
  68. package/lib/services/sessions.js +44 -0
  69. package/lib/services/sessions.js.map +1 -0
  70. package/lib/services.lazy/api_keys.js +1 -0
  71. package/lib/services.lazy/auth.js +1 -0
  72. package/lib/services.lazy/browser_tools.js +1 -0
  73. package/lib/services.lazy/captchas.js +1 -0
  74. package/lib/services.lazy/credentials.js +1 -0
  75. package/lib/services.lazy/extensions.js +1 -0
  76. package/lib/services.lazy/files.js +1 -0
  77. package/lib/services.lazy/index.js +3 -0
  78. package/lib/services.lazy/profiles.js +1 -0
  79. package/lib/services.lazy/projects.js +1 -0
  80. package/lib/services.lazy/sessions.js +4 -0
  81. package/lib/traits.d.ts +11 -0
  82. package/lib/traits.d.ts.map +1 -0
  83. package/lib/traits.js +1 -0
  84. package/package.json +87 -3
  85. package/src/credentials.ts +63 -0
  86. package/src/errors.ts +51 -0
  87. package/src/index.ts +25 -0
  88. package/src/pagination.ts +9 -0
  89. package/src/protocol.ts +77 -0
  90. package/src/retry.ts +69 -0
  91. package/src/services/api_keys.ts +124 -0
  92. package/src/services/auth.ts +101 -0
  93. package/src/services/browser_tools.ts +338 -0
  94. package/src/services/captchas.ts +216 -0
  95. package/src/services/credentials.ts +292 -0
  96. package/src/services/extensions.ts +338 -0
  97. package/src/services/files.ts +456 -0
  98. package/src/services/index.ts +11 -0
  99. package/src/services/profiles.ts +871 -0
  100. package/src/services/projects.ts +146 -0
  101. package/src/services/sessions.ts +4515 -0
  102. 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,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # @distilled.cloud/steel
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @distilled.cloud/steel effect
11
+ ```
12
+
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,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as i,api$op as a,api$opPaginated as o,category$withAuthError as s,category$withBadRequestError as c,category$withConflictError as l,category$withParseError as ee,category$withServerError as te,config$Redacted as ne,config$String as re,config$all as ie,config$withDefault as ae,pagination$paginateCursor as u,retry$capped as d,retry$jittered as f,retry$makeDefault as p,retry$throttlingFactory as m,retry$throttlingOptions as h,retry$transientFactory as g,retry$transientOptions as _,schema_lite_typed$String as v,schema_lite_typed$TaggedError as y,schema_lite_typed$Unknown as b,schema_lite_typed$optional as x,trait$Body as S,trait$FormDataFile as C,trait$Header as w,trait$Http as T,trait$HttpBody as E,trait$KeyDictionary as D,trait$Label as O,trait$Query as k,trait$ResponseCode as A,trait$UnionCases as j,trait$applyErrorMatchers as M,trait$bodySymbol as N,trait$errorMatchersSymbol as P,trait$formDataFileSymbol as F,trait$getErrorMatchers as I,trait$headerSymbol as L,trait$httpBodySymbol as R,trait$httpSymbol as z,trait$keyDictionarySymbol as B,trait$labelSymbol as V,trait$querySymbol as H,trait$responseCodeSymbol as U,trait$unionCasesSymbol as W}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as G,errors$BadGateway as K,errors$BadRequest as q,errors$ConfigError as J,errors$Conflict as oe,errors$DEFAULT_ERRORS as se,errors$Forbidden as ce,errors$GatewayTimeout as le,errors$HTTP_STATUS_MAP as ue,errors$InternalServerError as de,errors$Locked as fe,errors$NotFound as pe,errors$ServiceUnavailable as me,errors$TooManyRequests as he,errors$Unauthorized as ge,errors$UnprocessableEntity as _e,protocol_rest$BinaryResponse as ve,protocol_rest$RawResponse as ye,protocol_rest$RawResponseRoot as be,protocol_rest$SensitiveValue as xe,protocol_rest$makeRestProtocol as Se,protocol_rest$rawResponseRootSymbol as Ce,protocol_rest$rawResponseSymbol as we,protocol_rest$sensitiveValueSymbol as Te,schema_lite$Array as Ee,schema_lite$Boolean as De,schema_lite$NullOr as Oe,schema_lite$Number as ke,schema_lite$Record as Ae,schema_lite$String as je,schema_lite$Struct as Me,schema_lite$StructWithRest as Ne,schema_lite$TaggedError as Pe,schema_lite$Union as Fe,schema_lite$Unknown as Ie,schema_lite$at as Le,schema_lite$instanceOf as Re,schema_lite$optional as ze,schema_lite$suspend as Be}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 Ve from"effect/Redacted";const Q=`https://api.steel.dev`;var Credentials=class extends (/*@__PURE__*/ Y.Service()(`SteelCredentials`)){};const He=/*@__PURE__*/ ie({apiKey:/*@__PURE__*/ ne(`STEEL_API_KEY`),baseUrl:/*@__PURE__*/ re(`STEEL_BASE_URL`).pipe(/*@__PURE__*/ ae(Q))});const Ue=/*@__PURE__*/ Z.succeed(Credentials,/*@__PURE__*/ He.pipe(/*@__PURE__*/ X.map(({apiKey:e,baseUrl:t})=>({apiKey:e,baseUrl:t.replace(/\/+$/,``)})),/*@__PURE__*/ X.mapError(()=>new J({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__*/ y()(`UnknownSteelError`,{code:/*@__PURE__*/ x(v),message:/*@__PURE__*/ x(v),body:b}).pipe(te)){};var SteelParseError=class extends (/*@__PURE__*/ y()(`SteelParseError`,{body:b,cause:b}).pipe(ee)){};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 We=/*@__PURE__*/ Se({credentials:/*@__PURE__*/ X.flatMap(Credentials,e=>e),baseUrl:e=>e.baseUrl,headers:e=>({"steel-api-key":Ve.value(e.apiKey)}),errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownSteelError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,body:n}),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 $=/*@__PURE__*/ X.provide(/*@__PURE__*/ Z.succeed(Retry,{while:()=>false}));const Ge=p;const Ke=f;const qe=d;const Je=h;const Ye=/*@__PURE__*/ policy(m);const Xe=_;const Ze=/*@__PURE__*/ policy(g);export{Fe as Ac,l as Ba,Ie as Bc,Le as Dc,Re as Gc,ze as Ic,Be as Jc,e as a,t as c,Credentials as credentials$Credentials,Ue as credentials$CredentialsFromEnv,Q as credentials$DEFAULT_BASE_URL,fromApiKey as credentials$fromApiKey,n as e,G as errors$API_ERRORS,K as errors$BadGateway,q as errors$BadRequest,J as errors$ConfigError,oe as errors$Conflict,se as errors$DEFAULT_ERRORS,ce as errors$Forbidden,le as errors$GatewayTimeout,ue as errors$HTTP_STATUS_MAP,de as errors$InternalServerError,fe as errors$Locked,pe as errors$NotFound,me as errors$ServiceUnavailable,SteelParseError as errors$SteelParseError,he as errors$TooManyRequests,ge as errors$Unauthorized,UnknownSteelError as errors$UnknownSteelError,_e as errors$UnprocessableEntity,Ee as jc,r as k,De as kc,i as l,a as m,o as n,u as pagination$paginateCursor,We as protocol$SteelProtocol,Oe as rc,Retry as retry$Retry,qe as retry$capped,Ke as retry$jittered,Ge as retry$makeDefault,$ as retry$none,policy as retry$policy,Ye as retry$throttling,Je as retry$throttlingOptions,Ze as retry$transient,Xe as retry$transientOptions,ke as sc,Ae as tc,ve as traits$BinaryResponse,S as traits$Body,C as traits$FormDataFile,w as traits$Header,T as traits$Http,E as traits$HttpBody,D as traits$KeyDictionary,O as traits$Label,k as traits$Query,ye as traits$RawResponse,be as traits$RawResponseRoot,A as traits$ResponseCode,xe as traits$SensitiveValue,j as traits$UnionCases,M as traits$applyErrorMatchers,N as traits$bodySymbol,P as traits$errorMatchersSymbol,F as traits$formDataFileSymbol,I as traits$getErrorMatchers,L as traits$headerSymbol,R as traits$httpBodySymbol,z as traits$httpSymbol,B as traits$keyDictionarySymbol,V as traits$labelSymbol,H as traits$querySymbol,Ce as traits$rawResponseRootSymbol,we as traits$rawResponseSymbol,U as traits$responseCodeSymbol,Te as traits$sensitiveValueSymbol,W as traits$unionCasesSymbol,je as vc,Me as wc,s as xa,Ne as xc,c as ya,Pe as yc};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Schema.String","Schema.Unknown","Category.withServerError","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","withServerError","Redacted$3","String$3","all$1","withDefault","paginateCursor","capped$1","jittered$1","makeDefault$1","throttlingFactory","throttlingOptions$1","transientFactory","transientOptions$1","String$2","TaggedError$1","Unknown$1","optional$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","UnprocessableEntity","BinaryResponse","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","Array","Boolean","NullOr","Number","Record","String$1","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","optionsOrFactory","none","makeDefault","jittered","capped","throttlingOptions","throttling","transientOptions","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"8/EAiBA,MAAayG,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,iBAAyBD,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,IAAI3C,EAAY,CAAE,QAAS,gDAAiD,CAAC,CACrF,CACF,CACF,EAGA,MAAa,WAAc,GAIzBsC,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQO,EAAO,OACf,SAAUA,EAAO,SAAA,wBAAA,CAA6B,QAAQ,OAAQ,EAAE,CAClE,CAAC,CACH,ECxBF,IAAa,kBAAb,eACwB,gBAAsC,CAAC,CAAC,oBAAqB,CACjF,KAAoB,gBAAgB7G,CAAa,EACjD,QAAuB,gBAAgBA,CAAa,EACpD,KAAMC,CACR,CAAC,CAAC,CAAC,KAAKC,EAAwB,EAAA,AAAE,CAAC,EAGrC,IAAa,gBAAb,eACwB,gBAAoC,CAAC,CAAC,kBAAmB,CAC7E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AASrH,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";
@@ -0,0 +1,42 @@
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
+ readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
18
+ readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
19
+ readonly body: import("effect/Schema").Unknown;
20
+ }> & (new (...args: any[]) => {
21
+ "@distilled.cloud/error/categories": {
22
+ ServerError: true;
23
+ };
24
+ });
25
+ /**
26
+ * Unknown Steel error -- returned when an error response matches neither an
27
+ * operation's typed errors nor a shared HTTP status class.
28
+ */
29
+ export declare class UnknownSteelError extends /*@__PURE__*/ UnknownSteelError_base {
30
+ }
31
+ declare const SteelParseError_base: Schema.TaggedErrorClass<"SteelParseError", {
32
+ readonly body: import("effect/Schema").Unknown;
33
+ readonly cause: import("effect/Schema").Unknown;
34
+ }> & (new (...args: any[]) => {
35
+ "@distilled.cloud/error/categories": {
36
+ ParseError: true;
37
+ };
38
+ });
39
+ /** A 2xx response that does not match the operation's output schema. */
40
+ export declare class SteelParseError extends /*@__PURE__*/ SteelParseError_base {
41
+ }
42
+ //# 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;AAElE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;;;AAElE;;;GAGG;AACH,qBAAa,iBACX,SAAQ,aAAa,CAAC,sBAIW;CAAG;;;;;;;;;AAEtC,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;AAE1F,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,CAgBlD,CAAC"}
@@ -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":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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;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