@forgezero/providers 0.1.12 → 0.1.13
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 +159 -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,197 @@ 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. Named value imports: ProviderError, STRIKES_TO_OFFLINE, VERSION, chainCredentials, chainScopedCredentials, createRegistry, createService, defineProvider, defineProviderMethod, defineService, defineSingleMethodProvider, envCredentials, nextHealth, scopeCredentials, serviceMethod, staticConfig. Named type imports: AnyProviderMethod, Attempt, CallOptions, CallResult, ConfigSource, CredentialSource, DirectAttempt, DirectCallResult, DirectServiceAttachment, DirectServiceConfig, DirectServiceOptions, EmailBatch, EmailBatchItemResult, EmailBatchResult, EmailMessage, FailureKind, InvokeContext, ProviderDefinition, ProviderHealth, ProviderInstanceConfig, ProviderMethodSpec, ProviderMethods, RegistryOptions, ScopedCredentialSource, ServiceDefinition, ServiceMethodAttachment, ServiceMethodContract, ServiceMethods, StaticRegistryConfig. Import only the names used by this file.
|
|
33
63
|
|
|
34
64
|
```text
|
|
35
|
-
import
|
|
65
|
+
import { ProviderError, STRIKES_TO_OFFLINE, VERSION, chainCredentials, chainScopedCredentials, createRegistry } from '@forgezero/providers';
|
|
66
|
+
import { createService, defineProvider, defineProviderMethod, defineService, defineSingleMethodProvider, envCredentials } from '@forgezero/providers';
|
|
67
|
+
import { nextHealth, scopeCredentials, serviceMethod, staticConfig } from '@forgezero/providers';
|
|
68
|
+
import type { AnyProviderMethod, Attempt, CallOptions, CallResult, ConfigSource, CredentialSource } from '@forgezero/providers';
|
|
69
|
+
import type { DirectAttempt, DirectCallResult, DirectServiceAttachment, DirectServiceConfig, DirectServiceOptions, EmailBatch } from '@forgezero/providers';
|
|
70
|
+
import type { EmailBatchItemResult, EmailBatchResult, EmailMessage, FailureKind, InvokeContext, ProviderDefinition } from '@forgezero/providers';
|
|
71
|
+
import type { ProviderHealth, ProviderInstanceConfig, ProviderMethodSpec, ProviderMethods, RegistryOptions, ScopedCredentialSource } from '@forgezero/providers';
|
|
72
|
+
import type { ServiceDefinition, ServiceMethodAttachment, ServiceMethodContract, ServiceMethods, StaticRegistryConfig } from '@forgezero/providers';
|
|
36
73
|
```
|
|
37
74
|
|
|
38
|
-
## @forgezero/providers
|
|
75
|
+
## @forgezero/providers — Extend with a custom provider and service
|
|
39
76
|
|
|
40
|
-
|
|
77
|
+
Public consumers define provider capabilities and application services independently, then attach them with the same ordered-array API.
|
|
41
78
|
|
|
42
79
|
```text
|
|
43
|
-
import
|
|
80
|
+
import { createService, defineService, defineSingleMethodProvider, serviceMethod } from '@forgezero/providers';
|
|
81
|
+
import { createVault } from '@forgezero/vault';
|
|
82
|
+
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
83
|
+
|
|
84
|
+
type Notice = { text: string };
|
|
85
|
+
type Receipt = { id: string };
|
|
86
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
87
|
+
|
|
88
|
+
const postmark = defineSingleMethodProvider({
|
|
89
|
+
id: 'postmark', label: 'Postmark', method: 'deliver',
|
|
90
|
+
async invoke(context, notice: Notice): Promise<Receipt> {
|
|
91
|
+
const response = await fetch('https://api.postmarkapp.com/email', {
|
|
92
|
+
method: 'POST', signal: context.signal,
|
|
93
|
+
headers: { 'x-postmark-server-token': await context.secret('apiKey') },
|
|
94
|
+
body: JSON.stringify(notice)
|
|
95
|
+
});
|
|
96
|
+
if (!response.ok) throw new Error(`Postmark returned ${response.status}`);
|
|
97
|
+
return { id: response.headers.get('x-message-id') ?? crypto.randomUUID() };
|
|
98
|
+
},
|
|
99
|
+
classify: () => 'retryable'
|
|
100
|
+
});
|
|
101
|
+
const notifications = defineService({
|
|
102
|
+
key: 'notifications', methods: { deliver: serviceMethod<Notice, Receipt>() }
|
|
103
|
+
});
|
|
104
|
+
const service = createService(notifications, {
|
|
105
|
+
deliver: [{ provider: postmark, method: 'deliver', credentials: vaultCredentials(vault, 'postmark'), priority: 1 }]
|
|
106
|
+
});
|
|
44
107
|
```
|
|
45
108
|
|
|
46
|
-
## @forgezero/providers
|
|
109
|
+
## @forgezero/providers — Vault first, systemd credential fallback
|
|
47
110
|
|
|
48
|
-
|
|
111
|
+
Bootstrap tries the scoped Vault entry first and the identically named systemd credential second. If neither exists, the provider call fails.
|
|
49
112
|
|
|
50
113
|
```text
|
|
51
|
-
import
|
|
114
|
+
import { chainScopedCredentials, scopeCredentials } from '@forgezero/providers';
|
|
115
|
+
import { createVault, systemdCredentials } from '@forgezero/vault';
|
|
116
|
+
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
117
|
+
|
|
118
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
119
|
+
const credentials = chainScopedCredentials(
|
|
120
|
+
vaultCredentials(vault, 'jetemail'),
|
|
121
|
+
scopeCredentials(systemdCredentials({
|
|
122
|
+
nameFor: (reference, field) => `${reference}-${field}`
|
|
123
|
+
}), 'jetemail')
|
|
124
|
+
);
|
|
52
125
|
```
|
|
53
126
|
|
|
54
|
-
|
|
127
|
+
<a id="forgezero-providers-email"></a>
|
|
128
|
+
## @forgezero/providers/email
|
|
55
129
|
|
|
56
|
-
|
|
130
|
+
JetEmail (`send`, `sendBatch`), SMTP (`send` only), and the typed email service contract; SMTP transport is injected. Named value imports: emailProviders, emailService, jetemail, smtp. Named type imports: JetEmailConfig, SmtpTransport. Import only the names used by this file.
|
|
57
131
|
|
|
58
132
|
```text
|
|
59
|
-
import
|
|
133
|
+
import { emailProviders, emailService, jetemail, smtp } from '@forgezero/providers/email';
|
|
134
|
+
import type { JetEmailConfig, SmtpTransport } from '@forgezero/providers/email';
|
|
60
135
|
```
|
|
61
136
|
|
|
62
|
-
## @forgezero/providers/
|
|
137
|
+
## @forgezero/providers/email — Email with ordered provider fallback
|
|
63
138
|
|
|
64
|
-
|
|
139
|
+
The service owns send/sendBatch. Attach provider methods directly in priority arrays; SMTP is never presented as batch-capable.
|
|
65
140
|
|
|
66
141
|
```text
|
|
67
|
-
import
|
|
68
|
-
|
|
142
|
+
import { createService, type EmailMessage } from '@forgezero/providers';
|
|
143
|
+
import { emailService, jetemail, smtp, type SmtpTransport } from '@forgezero/providers/email';
|
|
144
|
+
import { createVault } from '@forgezero/vault';
|
|
145
|
+
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
69
146
|
|
|
70
|
-
|
|
147
|
+
// Adapt Nodemailer, Bun, or an HTTP SMTP relay once at the host boundary.
|
|
148
|
+
declare const transport: SmtpTransport;
|
|
71
149
|
|
|
72
|
-
|
|
150
|
+
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
151
|
+
const email = createService(emailService, {
|
|
152
|
+
send: [
|
|
153
|
+
{ provider: jetemail, method: 'send', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 },
|
|
154
|
+
{ provider: smtp, method: 'send', credentials: vaultCredentials(vault, 'smtp'), config: { host: 'smtp.example.com', port: 587, from: 'ops@example.com', transport }, priority: 2 }
|
|
155
|
+
],
|
|
156
|
+
sendBatch: [
|
|
157
|
+
{ provider: jetemail, method: 'sendBatch', credentials: vaultCredentials(vault, 'jetemail'), config: { from: 'ops@example.com' }, priority: 1 }
|
|
158
|
+
]
|
|
159
|
+
});
|
|
73
160
|
|
|
74
|
-
|
|
75
|
-
|
|
161
|
+
const message: EmailMessage = { to: 'user@example.com', subject: 'Hello', text: 'Sent by ForgeZero' };
|
|
162
|
+
const outcome = await email.call('send', message);
|
|
163
|
+
if (!outcome.ok) throw outcome.error;
|
|
164
|
+
console.log(outcome.result, outcome.attempts);
|
|
76
165
|
```
|
|
77
166
|
|
|
78
|
-
|
|
167
|
+
<a id="forgezero-providers-database"></a>
|
|
168
|
+
## @forgezero/providers/database
|
|
79
169
|
|
|
80
|
-
|
|
170
|
+
ArangoDB in the registry for credential rotation and health — with failover off by default. Named value imports: ARANGO_COMMUNITY_VERSION, ARANGO_SERVER_MODE_PATH, MAX_ARANGO_COORDINATORS, arangoCoordinatorUrls, arangodb, databaseProviders, resetPools. Named type imports: ArangoConfig, ArangoConnectOptions, ArangoCoordinatorMember, ArangoLike, ArangoMembershipSnapshot, ArangoMembershipVerifier, Query. Import only the names used by this file.
|
|
81
171
|
|
|
82
172
|
```text
|
|
83
|
-
import
|
|
173
|
+
import { ARANGO_COMMUNITY_VERSION, ARANGO_SERVER_MODE_PATH, MAX_ARANGO_COORDINATORS, arangoCoordinatorUrls, arangodb, databaseProviders } from '@forgezero/providers/database';
|
|
174
|
+
import { resetPools } from '@forgezero/providers/database';
|
|
175
|
+
import type { ArangoConfig, ArangoConnectOptions, ArangoCoordinatorMember, ArangoLike, ArangoMembershipSnapshot, ArangoMembershipVerifier } from '@forgezero/providers/database';
|
|
176
|
+
import type { Query } from '@forgezero/providers/database';
|
|
84
177
|
```
|
|
85
178
|
|
|
86
|
-
|
|
179
|
+
<a id="forgezero-providers-http"></a>
|
|
180
|
+
## @forgezero/providers/http
|
|
87
181
|
|
|
88
|
-
|
|
182
|
+
Outbound HTTP with a per-host weight budget reserved before the call and settled from the response. Named value imports: BudgetExhausted, binanceWeight, budgetState, createHttpClient, http, httpProviders, resetBudgets, settle, spend. Named type imports: HostBudget, HttpClient, HttpConfig, HttpRequest, HttpResponse. Import only the names used by this file.
|
|
89
183
|
|
|
90
184
|
```text
|
|
91
|
-
import
|
|
185
|
+
import { BudgetExhausted, binanceWeight, budgetState, createHttpClient, http, httpProviders } from '@forgezero/providers/http';
|
|
186
|
+
import { resetBudgets, settle, spend } from '@forgezero/providers/http';
|
|
187
|
+
import type { HostBudget, HttpClient, HttpConfig, HttpRequest, HttpResponse } from '@forgezero/providers/http';
|
|
92
188
|
```
|
|
93
189
|
|
|
94
|
-
|
|
190
|
+
<a id="forgezero-providers-pool"></a>
|
|
191
|
+
## @forgezero/providers/pool
|
|
95
192
|
|
|
96
|
-
|
|
193
|
+
Which outbound address a request leaves by, sticky per key, over the same budget as everything else. Named value imports: PoolEmpty, PoolExhausted, createAddressPool. Named type imports: AddressPool, Lease, PoolAddress, PoolOptions. Import only the names used by this file.
|
|
97
194
|
|
|
98
195
|
```text
|
|
99
|
-
import
|
|
196
|
+
import { PoolEmpty, PoolExhausted, createAddressPool } from '@forgezero/providers/pool';
|
|
197
|
+
import type { AddressPool, Lease, PoolAddress, PoolOptions } from '@forgezero/providers/pool';
|
|
100
198
|
```
|
|
101
199
|
|
|
102
|
-
|
|
200
|
+
<a id="forgezero-providers-chain"></a>
|
|
201
|
+
## @forgezero/providers/chain
|
|
103
202
|
|
|
104
|
-
|
|
203
|
+
An EVM node behind the same failover as any other service: read logs, broadcast, and never stop scanning because one endpoint rate-limited. Named value imports: evmRpc. Named type imports: ChainCall, ChainLog, ChainReceipt, ChainResult. Import only the names used by this file.
|
|
105
204
|
|
|
106
205
|
```text
|
|
107
|
-
import
|
|
206
|
+
import { evmRpc } from '@forgezero/providers/chain';
|
|
207
|
+
import type { ChainCall, ChainLog, ChainReceipt, ChainResult } from '@forgezero/providers/chain';
|
|
108
208
|
```
|
|
109
209
|
|
|
110
|
-
|
|
210
|
+
<a id="forgezero-providers-binance"></a>
|
|
211
|
+
## @forgezero/providers/binance
|
|
111
212
|
|
|
112
|
-
|
|
213
|
+
Binance behind the venue adapter: three hosts, one weight budget, signed over the exact string that is sent. Named value imports: binanceSymbol, createBinanceAdapter, readBinanceError, toOrderStatus. Named type imports: BinanceCredentials, BinanceOptions. Import only the names used by this file.
|
|
113
214
|
|
|
114
215
|
```text
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
|
|
118
|
-
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
216
|
+
import { binanceSymbol, createBinanceAdapter, readBinanceError, toOrderStatus } from '@forgezero/providers/binance';
|
|
217
|
+
import type { BinanceCredentials, BinanceOptions } from '@forgezero/providers/binance';
|
|
218
|
+
```
|
|
119
219
|
|
|
120
|
-
|
|
121
|
-
|
|
220
|
+
<a id="forgezero-providers-storage"></a>
|
|
221
|
+
## @forgezero/providers/storage
|
|
122
222
|
|
|
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
|
-
});
|
|
223
|
+
S3-compatible object storage, SigV4 signed with Web Crypto and no vendor SDK. Named value imports: MAX_SINGLE_PUT_BYTES, StorageError, amzDate, createS3Client, encodeSegment, parseListXml, s3, signRequest, storageProviders. Named type imports: ObjectSummary, PutObjectArgs, S3Client, S3Config, S3Credentials, SignedRequest, StorageRequest. Import only the names used by this file.
|
|
133
224
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
225
|
+
```text
|
|
226
|
+
import { MAX_SINGLE_PUT_BYTES, StorageError, amzDate, createS3Client, encodeSegment, parseListXml } from '@forgezero/providers/storage';
|
|
227
|
+
import { s3, signRequest, storageProviders } from '@forgezero/providers/storage';
|
|
228
|
+
import type { ObjectSummary, PutObjectArgs, S3Client, S3Config, S3Credentials, SignedRequest } from '@forgezero/providers/storage';
|
|
229
|
+
import type { StorageRequest } from '@forgezero/providers/storage';
|
|
138
230
|
```
|
|
139
231
|
|
|
140
|
-
|
|
232
|
+
<a id="forgezero-providers-translation"></a>
|
|
233
|
+
## @forgezero/providers/translation
|
|
141
234
|
|
|
142
|
-
|
|
235
|
+
Google AI Studio translation with strict batch alignment and classified quota failures. Named value imports: TranslationError, googleAiStudio, parseStrings, translationProviders. Named type imports: TranslateRequest, TranslateResult, TranslationProvider. Import only the names used by this file.
|
|
143
236
|
|
|
144
237
|
```text
|
|
145
|
-
import {
|
|
146
|
-
import {
|
|
147
|
-
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
148
|
-
|
|
149
|
-
type Notice = { text: string };
|
|
150
|
-
type Receipt = { id: string };
|
|
151
|
-
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
152
|
-
|
|
153
|
-
const postmark = defineSingleMethodProvider({
|
|
154
|
-
id: 'postmark', label: 'Postmark', method: 'deliver',
|
|
155
|
-
async invoke(context, notice: Notice): Promise<Receipt> {
|
|
156
|
-
const response = await fetch('https://api.postmarkapp.com/email', {
|
|
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
|
-
});
|
|
238
|
+
import { TranslationError, googleAiStudio, parseStrings, translationProviders } from '@forgezero/providers/translation';
|
|
239
|
+
import type { TranslateRequest, TranslateResult, TranslationProvider } from '@forgezero/providers/translation';
|
|
172
240
|
```
|
|
173
241
|
|
|
174
|
-
|
|
242
|
+
<a id="forgezero-providers-realtime"></a>
|
|
243
|
+
## @forgezero/providers/realtime
|
|
175
244
|
|
|
176
|
-
|
|
245
|
+
Cloudflare KV node-directory and Durable Object fan-out clients for project-defined realtime services. Named value imports: RealtimeProviderError, cloudflareRealtime. Named type imports: RealtimeProviderOptions. Import only the names used by this file.
|
|
177
246
|
|
|
178
247
|
```text
|
|
179
|
-
import {
|
|
180
|
-
import {
|
|
181
|
-
import { vaultCredentials } from '@forgezero/vault/providers';
|
|
182
|
-
|
|
183
|
-
const vault = createVault({ project: 'my-project', environment: 'production' });
|
|
184
|
-
const credentials = chainScopedCredentials(
|
|
185
|
-
vaultCredentials(vault, 'jetemail'),
|
|
186
|
-
scopeCredentials(systemdCredentials({
|
|
187
|
-
nameFor: (reference, field) => `${reference}-${field}`
|
|
188
|
-
}), 'jetemail')
|
|
189
|
-
);
|
|
248
|
+
import { RealtimeProviderError, cloudflareRealtime } from '@forgezero/providers/realtime';
|
|
249
|
+
import type { RealtimeProviderOptions } from '@forgezero/providers/realtime';
|
|
190
250
|
```
|
|
191
251
|
|
|
192
252
|
## 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.13",
|
|
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.8"
|
|
90
89
|
}
|
|
91
90
|
}
|