@forgezero/providers 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +330 -99
- package/dist/binance.js +1 -1
- package/dist/chain.js +1 -1
- package/dist/database.js +1 -1
- package/dist/email.js +1 -1
- package/dist/http.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pool.js +1 -1
- package/dist/storage.js +1 -1
- package/dist/translation.js +1 -1
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
GENERATED FILE — do not edit.
|
|
3
3
|
|
|
4
|
-
Change
|
|
4
|
+
Change tools/generate-guides.ts or its typed sources, run `bun run guides`,
|
|
5
5
|
and commit the generator and rendered files together.
|
|
6
6
|
-->
|
|
7
7
|
|
|
@@ -9,14 +9,43 @@
|
|
|
9
9
|
|
|
10
10
|
Send through whichever provider is up. Priority and failover, reordered live.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Package overview
|
|
13
13
|
|
|
14
|
-
Anyone calling somebody else's API who needs the failure classified rather than guessed. Provider capabilities stay independent from application-owned services, which attach named methods by priority with health tracking. Supported runtimes: bun, node, workers, deno.
|
|
14
|
+
Anyone calling somebody else's API who needs the failure classified rather than guessed. Provider capabilities stay independent from application-owned services, which attach named methods by priority with health tracking. Supported runtimes: bun, node, workers, deno. Package root: @forgezero/providers. The sections below show the actual named imports emitted by each declaration entry point; wildcard imports are intentionally not used in the documentation.
|
|
15
15
|
|
|
16
16
|
```text
|
|
17
|
-
|
|
17
|
+
bun add @forgezero/providers
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
## ForgeZero package family
|
|
21
|
+
|
|
22
|
+
The five packages are installation boundaries. Choose a package by who installs it; choose a subpath by the capability used in that file.
|
|
23
|
+
|
|
24
|
+
| package | short description | runtimes | documentation |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| @forgezero/vault | Scoped secret access with Agent, API-key and systemd-credential sources. | bun, node, workers, deno | [Open](https://www.forgezero.net/docs/vault-package) |
|
|
27
|
+
| @forgezero/access | Typed route, principal, factor, RBAC and request-pipeline contracts. | bun, node, workers, deno | [Open](https://www.forgezero.net/docs/access) |
|
|
28
|
+
| @forgezero/providers | Typed external providers with priority, health and classified fallback. | bun, node, workers, deno | [Open](https://www.forgezero.net/docs/providers) |
|
|
29
|
+
| @forgezero/runtime | Portable runtime primitives for queries, jobs, events, schemas and finance. | bun, node | [Open](https://www.forgezero.net/docs/runtime) |
|
|
30
|
+
| @forgezero/agent | Operator CLI and managed-node agent for bootstrap, deploy and lifecycle. | bun, node | [Open](https://www.forgezero.net/docs/agent) |
|
|
31
|
+
|
|
32
|
+
## @forgezero/providers public imports and commands
|
|
33
|
+
|
|
34
|
+
Every row links to the detailed explanation and named-import/example area below. This table and those details are generated from the package inventory and emitted declarations.
|
|
35
|
+
|
|
36
|
+
| public entry | short description | runtime | details |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
| @forgezero/providers | The registry: priority, health, and a terminal-versus-retryable verdict per failure. | portable | [Details + example](#forgezero-providers) |
|
|
39
|
+
| @forgezero/providers/email | JetEmail (`send`, `sendBatch`), SMTP (`send` only), and the typed email service contract; SMTP transport is injected. | portable | [Details + example](#forgezero-providers-email) |
|
|
40
|
+
| @forgezero/providers/database | ArangoDB in the registry for credential rotation and health — with failover off by default. | portable | [Details + example](#forgezero-providers-database) |
|
|
41
|
+
| @forgezero/providers/http | Outbound HTTP with a per-host weight budget reserved before the call and settled from the response. | portable | [Details + example](#forgezero-providers-http) |
|
|
42
|
+
| @forgezero/providers/pool | Which outbound address a request leaves by, sticky per key, over the same budget as everything else. | portable | [Details + example](#forgezero-providers-pool) |
|
|
43
|
+
| @forgezero/providers/chain | An EVM node behind the same failover as any other service: read logs, broadcast, and never stop scanning because one endpoint rate-limited. | portable | [Details + example](#forgezero-providers-chain) |
|
|
44
|
+
| @forgezero/providers/binance | Binance behind the venue adapter: three hosts, one weight budget, signed over the exact string that is sent. | portable | [Details + example](#forgezero-providers-binance) |
|
|
45
|
+
| @forgezero/providers/storage | S3-compatible object storage, SigV4 signed with Web Crypto and no vendor SDK. | portable | [Details + example](#forgezero-providers-storage) |
|
|
46
|
+
| @forgezero/providers/translation | Google AI Studio translation with strict batch alignment and classified quota failures. | portable | [Details + example](#forgezero-providers-translation) |
|
|
47
|
+
| @forgezero/providers/realtime | Cloudflare KV node-directory and Durable Object fan-out clients for project-defined realtime services. | portable | [Details + example](#forgezero-providers-realtime) |
|
|
48
|
+
|
|
20
49
|
## Commands
|
|
21
50
|
|
|
22
51
|
bun add @forgezero/providers @forgezero/vault — Install provider/service routing and the optional ForgeZero Vault credential adapter.
|
|
@@ -27,166 +56,368 @@ bun add @forgezero/providers @forgezero/vault
|
|
|
27
56
|
bun test
|
|
28
57
|
```
|
|
29
58
|
|
|
59
|
+
<a id="forgezero-providers"></a>
|
|
30
60
|
## @forgezero/providers
|
|
31
61
|
|
|
32
|
-
The registry: priority, health, and a terminal-versus-retryable verdict per failure.
|
|
62
|
+
The registry: priority, health, and a terminal-versus-retryable verdict per failure. This entry exposes 16 named value exports and 29 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
33
63
|
|
|
34
64
|
```text
|
|
35
|
-
import
|
|
65
|
+
import {
|
|
66
|
+
ProviderError,
|
|
67
|
+
STRIKES_TO_OFFLINE,
|
|
68
|
+
VERSION,
|
|
69
|
+
chainCredentials,
|
|
70
|
+
chainScopedCredentials,
|
|
71
|
+
createRegistry,
|
|
72
|
+
createService,
|
|
73
|
+
defineProvider,
|
|
74
|
+
defineProviderMethod,
|
|
75
|
+
defineService,
|
|
76
|
+
defineSingleMethodProvider,
|
|
77
|
+
envCredentials,
|
|
78
|
+
nextHealth,
|
|
79
|
+
scopeCredentials,
|
|
80
|
+
serviceMethod,
|
|
81
|
+
staticConfig,
|
|
82
|
+
} from '@forgezero/providers';
|
|
83
|
+
|
|
84
|
+
import type {
|
|
85
|
+
AnyProviderMethod,
|
|
86
|
+
Attempt,
|
|
87
|
+
CallOptions,
|
|
88
|
+
CallResult,
|
|
89
|
+
ConfigSource,
|
|
90
|
+
CredentialSource,
|
|
91
|
+
DirectAttempt,
|
|
92
|
+
DirectCallResult,
|
|
93
|
+
DirectServiceAttachment,
|
|
94
|
+
DirectServiceConfig,
|
|
95
|
+
DirectServiceOptions,
|
|
96
|
+
EmailBatch,
|
|
97
|
+
EmailBatchItemResult,
|
|
98
|
+
EmailBatchResult,
|
|
99
|
+
EmailMessage,
|
|
100
|
+
FailureKind,
|
|
101
|
+
InvokeContext,
|
|
102
|
+
ProviderDefinition,
|
|
103
|
+
ProviderHealth,
|
|
104
|
+
ProviderInstanceConfig,
|
|
105
|
+
ProviderMethodSpec,
|
|
106
|
+
ProviderMethods,
|
|
107
|
+
RegistryOptions,
|
|
108
|
+
ScopedCredentialSource,
|
|
109
|
+
ServiceDefinition,
|
|
110
|
+
ServiceMethodAttachment,
|
|
111
|
+
ServiceMethodContract,
|
|
112
|
+
ServiceMethods,
|
|
113
|
+
StaticRegistryConfig,
|
|
114
|
+
} from '@forgezero/providers';
|
|
36
115
|
```
|
|
37
116
|
|
|
38
|
-
## @forgezero/providers
|
|
117
|
+
## @forgezero/providers — Extend with a custom provider and service
|
|
39
118
|
|
|
40
|
-
|
|
119
|
+
Public consumers define provider capabilities and application services independently, then attach them with the same ordered-array API.
|
|
41
120
|
|
|
42
121
|
```text
|
|
43
|
-
import
|
|
122
|
+
import {
|
|
123
|
+
createService,
|
|
124
|
+
defineService,
|
|
125
|
+
defineSingleMethodProvider,
|
|
126
|
+
serviceMethod,
|
|
127
|
+
} from '@forgezero/providers';
|
|
128
|
+
import {
|
|
129
|
+
createVault,
|
|
130
|
+
} from '@forgezero/vault';
|
|
131
|
+
import {
|
|
132
|
+
vaultCredentials,
|
|
133
|
+
} from '@forgezero/vault/providers';
|
|
134
|
+
|
|
135
|
+
type Notice = { text: string };
|
|
136
|
+
type Receipt = { id: string };
|
|
137
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
138
|
+
|
|
139
|
+
const postmark = defineSingleMethodProvider({
|
|
140
|
+
id: 'postmark', label: 'Postmark', method: 'deliver',
|
|
141
|
+
async invoke(context, notice: Notice): Promise<Receipt> {
|
|
142
|
+
const response = await fetch('https://api.postmarkapp.com/email', {
|
|
143
|
+
method: 'POST', signal: context.signal,
|
|
144
|
+
headers: { 'x-postmark-server-token': await context.secret('apiKey') },
|
|
145
|
+
body: JSON.stringify(notice)
|
|
146
|
+
});
|
|
147
|
+
if (!response.ok) throw new Error(`Postmark returned ${response.status}`);
|
|
148
|
+
return { id: response.headers.get('x-message-id') ?? crypto.randomUUID() };
|
|
149
|
+
},
|
|
150
|
+
classify: () => 'retryable'
|
|
151
|
+
});
|
|
152
|
+
const notifications = defineService({
|
|
153
|
+
key: 'notifications', methods: { deliver: serviceMethod<Notice, Receipt>() }
|
|
154
|
+
});
|
|
155
|
+
const service = createService(notifications, {
|
|
156
|
+
deliver: [{ provider: postmark, method: 'deliver', credentials: vaultCredentials(vault, 'postmark'), priority: 1 }]
|
|
157
|
+
});
|
|
44
158
|
```
|
|
45
159
|
|
|
46
|
-
## @forgezero/providers
|
|
160
|
+
## @forgezero/providers — Vault first, systemd credential fallback
|
|
47
161
|
|
|
48
|
-
|
|
162
|
+
Bootstrap tries the scoped Vault entry first and the identically named systemd credential second. If neither exists, the provider call fails.
|
|
49
163
|
|
|
50
164
|
```text
|
|
51
|
-
import
|
|
165
|
+
import {
|
|
166
|
+
chainScopedCredentials,
|
|
167
|
+
scopeCredentials,
|
|
168
|
+
} from '@forgezero/providers';
|
|
169
|
+
import {
|
|
170
|
+
createVault,
|
|
171
|
+
systemdCredentials,
|
|
172
|
+
} from '@forgezero/vault';
|
|
173
|
+
import {
|
|
174
|
+
vaultCredentials,
|
|
175
|
+
} from '@forgezero/vault/providers';
|
|
176
|
+
|
|
177
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
178
|
+
const credentials = chainScopedCredentials(
|
|
179
|
+
vaultCredentials(vault, 'jetemail'),
|
|
180
|
+
scopeCredentials(systemdCredentials({
|
|
181
|
+
nameFor: (reference, field) => `${reference}-${field}`
|
|
182
|
+
}), 'jetemail')
|
|
183
|
+
);
|
|
52
184
|
```
|
|
53
185
|
|
|
54
|
-
|
|
186
|
+
<a id="forgezero-providers-email"></a>
|
|
187
|
+
## @forgezero/providers/email
|
|
55
188
|
|
|
56
|
-
|
|
189
|
+
JetEmail (`send`, `sendBatch`), SMTP (`send` only), and the typed email service contract; SMTP transport is injected. This entry exposes 4 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
57
190
|
|
|
58
191
|
```text
|
|
59
|
-
import
|
|
192
|
+
import {
|
|
193
|
+
emailProviders,
|
|
194
|
+
emailService,
|
|
195
|
+
jetemail,
|
|
196
|
+
smtp,
|
|
197
|
+
} from '@forgezero/providers/email';
|
|
198
|
+
|
|
199
|
+
import type {
|
|
200
|
+
JetEmailConfig,
|
|
201
|
+
SmtpTransport,
|
|
202
|
+
} from '@forgezero/providers/email';
|
|
60
203
|
```
|
|
61
204
|
|
|
62
|
-
## @forgezero/providers/
|
|
205
|
+
## @forgezero/providers/email — Email with ordered provider fallback
|
|
63
206
|
|
|
64
|
-
|
|
207
|
+
The service owns send/sendBatch. Attach provider methods directly in priority arrays; SMTP is never presented as batch-capable.
|
|
65
208
|
|
|
66
209
|
```text
|
|
67
|
-
import
|
|
68
|
-
|
|
210
|
+
import {
|
|
211
|
+
createService,
|
|
212
|
+
type EmailMessage,
|
|
213
|
+
} from '@forgezero/providers';
|
|
214
|
+
import {
|
|
215
|
+
emailService,
|
|
216
|
+
jetemail,
|
|
217
|
+
smtp,
|
|
218
|
+
type SmtpTransport,
|
|
219
|
+
} from '@forgezero/providers/email';
|
|
220
|
+
import {
|
|
221
|
+
createVault,
|
|
222
|
+
} from '@forgezero/vault';
|
|
223
|
+
import {
|
|
224
|
+
vaultCredentials,
|
|
225
|
+
} from '@forgezero/vault/providers';
|
|
69
226
|
|
|
70
|
-
|
|
227
|
+
// Adapt Nodemailer, Bun, or an HTTP SMTP relay once at the host boundary.
|
|
228
|
+
declare const transport: SmtpTransport;
|
|
71
229
|
|
|
72
|
-
|
|
230
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
231
|
+
const email = createService(emailService, {
|
|
232
|
+
send: [
|
|
233
|
+
{ provider: jetemail, method: 'send', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 },
|
|
234
|
+
{ provider: smtp, method: 'send', credentials: vaultCredentials(vault, 'smtp'), config: { host: 'smtp.example.com', port: 587, from: 'ops@example.com', transport }, priority: 2 }
|
|
235
|
+
],
|
|
236
|
+
sendBatch: [
|
|
237
|
+
{ provider: jetemail, method: 'sendBatch', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 }
|
|
238
|
+
]
|
|
239
|
+
});
|
|
73
240
|
|
|
74
|
-
|
|
75
|
-
|
|
241
|
+
const message: EmailMessage = { to: 'user@example.com', subject: 'Hello', text: 'Sent by ForgeZero' };
|
|
242
|
+
const outcome = await email.call('send', message);
|
|
243
|
+
if (!outcome.ok) throw outcome.error;
|
|
244
|
+
console.log(outcome.result, outcome.attempts);
|
|
76
245
|
```
|
|
77
246
|
|
|
78
|
-
|
|
247
|
+
<a id="forgezero-providers-database"></a>
|
|
248
|
+
## @forgezero/providers/database
|
|
79
249
|
|
|
80
|
-
|
|
250
|
+
ArangoDB in the registry for credential rotation and health — with failover off by default. This entry exposes 7 named value exports and 7 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
81
251
|
|
|
82
252
|
```text
|
|
83
|
-
import
|
|
253
|
+
import {
|
|
254
|
+
ARANGO_COMMUNITY_VERSION,
|
|
255
|
+
ARANGO_SERVER_MODE_PATH,
|
|
256
|
+
MAX_ARANGO_COORDINATORS,
|
|
257
|
+
arangoCoordinatorUrls,
|
|
258
|
+
arangodb,
|
|
259
|
+
databaseProviders,
|
|
260
|
+
resetPools,
|
|
261
|
+
} from '@forgezero/providers/database';
|
|
262
|
+
|
|
263
|
+
import type {
|
|
264
|
+
ArangoConfig,
|
|
265
|
+
ArangoConnectOptions,
|
|
266
|
+
ArangoCoordinatorMember,
|
|
267
|
+
ArangoLike,
|
|
268
|
+
ArangoMembershipSnapshot,
|
|
269
|
+
ArangoMembershipVerifier,
|
|
270
|
+
Query,
|
|
271
|
+
} from '@forgezero/providers/database';
|
|
84
272
|
```
|
|
85
273
|
|
|
86
|
-
|
|
274
|
+
<a id="forgezero-providers-http"></a>
|
|
275
|
+
## @forgezero/providers/http
|
|
87
276
|
|
|
88
|
-
|
|
277
|
+
Outbound HTTP with a per-host weight budget reserved before the call and settled from the response. This entry exposes 9 named value exports and 5 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
89
278
|
|
|
90
279
|
```text
|
|
91
|
-
import
|
|
280
|
+
import {
|
|
281
|
+
BudgetExhausted,
|
|
282
|
+
binanceWeight,
|
|
283
|
+
budgetState,
|
|
284
|
+
createHttpClient,
|
|
285
|
+
http,
|
|
286
|
+
httpProviders,
|
|
287
|
+
resetBudgets,
|
|
288
|
+
settle,
|
|
289
|
+
spend,
|
|
290
|
+
} from '@forgezero/providers/http';
|
|
291
|
+
|
|
292
|
+
import type {
|
|
293
|
+
HostBudget,
|
|
294
|
+
HttpClient,
|
|
295
|
+
HttpConfig,
|
|
296
|
+
HttpRequest,
|
|
297
|
+
HttpResponse,
|
|
298
|
+
} from '@forgezero/providers/http';
|
|
92
299
|
```
|
|
93
300
|
|
|
94
|
-
|
|
301
|
+
<a id="forgezero-providers-pool"></a>
|
|
302
|
+
## @forgezero/providers/pool
|
|
95
303
|
|
|
96
|
-
|
|
304
|
+
Which outbound address a request leaves by, sticky per key, over the same budget as everything else. This entry exposes 3 named value exports and 4 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
97
305
|
|
|
98
306
|
```text
|
|
99
|
-
import
|
|
307
|
+
import {
|
|
308
|
+
PoolEmpty,
|
|
309
|
+
PoolExhausted,
|
|
310
|
+
createAddressPool,
|
|
311
|
+
} from '@forgezero/providers/pool';
|
|
312
|
+
|
|
313
|
+
import type {
|
|
314
|
+
AddressPool,
|
|
315
|
+
Lease,
|
|
316
|
+
PoolAddress,
|
|
317
|
+
PoolOptions,
|
|
318
|
+
} from '@forgezero/providers/pool';
|
|
100
319
|
```
|
|
101
320
|
|
|
102
|
-
|
|
321
|
+
<a id="forgezero-providers-chain"></a>
|
|
322
|
+
## @forgezero/providers/chain
|
|
103
323
|
|
|
104
|
-
|
|
324
|
+
An EVM node behind the same failover as any other service: read logs, broadcast, and never stop scanning because one endpoint rate-limited. This entry exposes 1 named value export and 4 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
105
325
|
|
|
106
326
|
```text
|
|
107
|
-
import
|
|
327
|
+
import {
|
|
328
|
+
evmRpc,
|
|
329
|
+
} from '@forgezero/providers/chain';
|
|
330
|
+
|
|
331
|
+
import type {
|
|
332
|
+
ChainCall,
|
|
333
|
+
ChainLog,
|
|
334
|
+
ChainReceipt,
|
|
335
|
+
ChainResult,
|
|
336
|
+
} from '@forgezero/providers/chain';
|
|
108
337
|
```
|
|
109
338
|
|
|
110
|
-
|
|
339
|
+
<a id="forgezero-providers-binance"></a>
|
|
340
|
+
## @forgezero/providers/binance
|
|
111
341
|
|
|
112
|
-
|
|
342
|
+
Binance behind the venue adapter: three hosts, one weight budget, signed over the exact string that is sent. This entry exposes 4 named value exports and 2 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
113
343
|
|
|
114
344
|
```text
|
|
115
|
-
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
345
|
+
import {
|
|
346
|
+
binanceSymbol,
|
|
347
|
+
createBinanceAdapter,
|
|
348
|
+
readBinanceError,
|
|
349
|
+
toOrderStatus,
|
|
350
|
+
} from '@forgezero/providers/binance';
|
|
351
|
+
|
|
352
|
+
import type {
|
|
353
|
+
BinanceCredentials,
|
|
354
|
+
BinanceOptions,
|
|
355
|
+
} from '@forgezero/providers/binance';
|
|
356
|
+
```
|
|
119
357
|
|
|
120
|
-
|
|
121
|
-
|
|
358
|
+
<a id="forgezero-providers-storage"></a>
|
|
359
|
+
## @forgezero/providers/storage
|
|
122
360
|
|
|
123
|
-
|
|
124
|
-
const email = createService(emailService, {
|
|
125
|
-
send: [
|
|
126
|
-
{ provider: jetemail, method: 'send', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 },
|
|
127
|
-
{ provider: smtp, method: 'send', credentials: vaultCredentials(vault, 'smtp'), config: { host: 'smtp.example.com', port: 587, from: 'ops@example.com', transport }, priority: 2 }
|
|
128
|
-
],
|
|
129
|
-
sendBatch: [
|
|
130
|
-
{ provider: jetemail, method: 'sendBatch', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 }
|
|
131
|
-
]
|
|
132
|
-
});
|
|
361
|
+
S3-compatible object storage, SigV4 signed with Web Crypto and no vendor SDK. This entry exposes 9 named value exports and 7 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
133
362
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
363
|
+
```text
|
|
364
|
+
import {
|
|
365
|
+
MAX_SINGLE_PUT_BYTES,
|
|
366
|
+
StorageError,
|
|
367
|
+
amzDate,
|
|
368
|
+
createS3Client,
|
|
369
|
+
encodeSegment,
|
|
370
|
+
parseListXml,
|
|
371
|
+
s3,
|
|
372
|
+
signRequest,
|
|
373
|
+
storageProviders,
|
|
374
|
+
} from '@forgezero/providers/storage';
|
|
375
|
+
|
|
376
|
+
import type {
|
|
377
|
+
ObjectSummary,
|
|
378
|
+
PutObjectArgs,
|
|
379
|
+
S3Client,
|
|
380
|
+
S3Config,
|
|
381
|
+
S3Credentials,
|
|
382
|
+
SignedRequest,
|
|
383
|
+
StorageRequest,
|
|
384
|
+
} from '@forgezero/providers/storage';
|
|
138
385
|
```
|
|
139
386
|
|
|
140
|
-
|
|
387
|
+
<a id="forgezero-providers-translation"></a>
|
|
388
|
+
## @forgezero/providers/translation
|
|
141
389
|
|
|
142
|
-
|
|
390
|
+
Google AI Studio translation with strict batch alignment and classified quota failures. This entry exposes 4 named value exports and 3 named type exports. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
143
391
|
|
|
144
392
|
```text
|
|
145
|
-
import {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
method: 'POST', signal: context.signal,
|
|
158
|
-
headers: { 'x-postmark-server-token': await context.secret('apiKey') },
|
|
159
|
-
body: JSON.stringify(notice)
|
|
160
|
-
});
|
|
161
|
-
if (!response.ok) throw new Error(`Postmark returned ${response.status}`);
|
|
162
|
-
return { id: response.headers.get('x-message-id') ?? crypto.randomUUID() };
|
|
163
|
-
},
|
|
164
|
-
classify: () => 'retryable'
|
|
165
|
-
});
|
|
166
|
-
const notifications = defineService({
|
|
167
|
-
key: 'notifications', methods: { deliver: serviceMethod<Notice, Receipt>() }
|
|
168
|
-
});
|
|
169
|
-
const service = createService(notifications, {
|
|
170
|
-
deliver: [{ provider: postmark, method: 'deliver', credentials: vaultCredentials(vault, 'postmark'), priority: 1 }]
|
|
171
|
-
});
|
|
393
|
+
import {
|
|
394
|
+
TranslationError,
|
|
395
|
+
googleAiStudio,
|
|
396
|
+
parseStrings,
|
|
397
|
+
translationProviders,
|
|
398
|
+
} from '@forgezero/providers/translation';
|
|
399
|
+
|
|
400
|
+
import type {
|
|
401
|
+
TranslateRequest,
|
|
402
|
+
TranslateResult,
|
|
403
|
+
TranslationProvider,
|
|
404
|
+
} from '@forgezero/providers/translation';
|
|
172
405
|
```
|
|
173
406
|
|
|
174
|
-
|
|
407
|
+
<a id="forgezero-providers-realtime"></a>
|
|
408
|
+
## @forgezero/providers/realtime
|
|
175
409
|
|
|
176
|
-
|
|
410
|
+
Cloudflare KV node-directory and Durable Object fan-out clients for project-defined realtime services. This entry exposes 2 named value exports and 1 named type export. The generated import block lists one name per line for scanning and copying; keep only the names used by your file.
|
|
177
411
|
|
|
178
412
|
```text
|
|
179
|
-
import {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
nameFor: (reference, field) => `${reference}-${field}`
|
|
188
|
-
}), 'jetemail')
|
|
189
|
-
);
|
|
413
|
+
import {
|
|
414
|
+
RealtimeProviderError,
|
|
415
|
+
cloudflareRealtime,
|
|
416
|
+
} from '@forgezero/providers/realtime';
|
|
417
|
+
|
|
418
|
+
import type {
|
|
419
|
+
RealtimeProviderOptions,
|
|
420
|
+
} from '@forgezero/providers/realtime';
|
|
190
421
|
```
|
|
191
422
|
|
|
192
423
|
## Built-in provider capabilities
|
package/dist/binance.js
CHANGED
package/dist/chain.js
CHANGED
package/dist/database.js
CHANGED
package/dist/email.js
CHANGED
package/dist/http.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/pool.js
CHANGED
package/dist/storage.js
CHANGED
package/dist/translation.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgezero/providers",
|
|
3
|
-
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
|
-
"provenance":
|
|
7
|
+
"provenance": false
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
@@ -42,17 +42,16 @@
|
|
|
42
42
|
"./translation": {
|
|
43
43
|
"types": "./dist/translation.d.ts",
|
|
44
44
|
"default": "./dist/translation.js"
|
|
45
|
-
|
|
45
|
+
},
|
|
46
46
|
"./realtime": {
|
|
47
47
|
"types": "./dist/realtime.d.ts",
|
|
48
48
|
"default": "./dist/realtime.js"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"prepublishOnly": "bun run check && bun run build"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"check": "tsc --noEmit",
|
|
53
|
+
"build": "bun ../tools/package-task.ts build providers",
|
|
54
|
+
"prepublishOnly": "bun ../tools/package-task.ts prepublish providers"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
57
|
"typescript": "^5.6.0",
|
|
@@ -86,6 +85,6 @@
|
|
|
86
85
|
"LICENSE"
|
|
87
86
|
],
|
|
88
87
|
"dependencies": {
|
|
89
|
-
|
|
88
|
+
"@forgezero/runtime": "^0.1.9"
|
|
90
89
|
}
|
|
91
90
|
}
|