@ontemper/sdk 0.8.0 → 0.8.1
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 +55 -2
- package/dist/As2Resource.d.ts +431 -76
- package/dist/As2Resource.d.ts.map +1 -1
- package/dist/As2Resource.js +31 -30
- package/dist/As2Resource.js.map +1 -1
- package/dist/As2Transport.d.ts.map +1 -1
- package/dist/As2Transport.js +3 -1
- package/dist/As2Transport.js.map +1 -1
- package/dist/As2Wire.d.ts +39 -0
- package/dist/As2Wire.d.ts.map +1 -1
- package/dist/Contract/RuntimeApi.d.ts +19 -0
- package/dist/Contract/RuntimeApi.d.ts.map +1 -1
- package/dist/Contract/RuntimeApi.js +1 -1
- package/dist/Contract/RuntimeApi.js.map +1 -1
- package/dist/DatabaseTunnelAuthorization.d.ts +3 -0
- package/dist/DatabaseTunnelAuthorization.d.ts.map +1 -0
- package/dist/DatabaseTunnelAuthorization.js +12 -0
- package/dist/DatabaseTunnelAuthorization.js.map +1 -0
- package/dist/HttpApiResource.d.ts +2916 -177
- package/dist/HttpApiResource.d.ts.map +1 -1
- package/dist/HttpApiResource.js +82 -60
- package/dist/HttpApiResource.js.map +1 -1
- package/dist/Kafka.d.ts +89 -0
- package/dist/Kafka.d.ts.map +1 -0
- package/dist/Kafka.js +297 -0
- package/dist/Kafka.js.map +1 -0
- package/dist/Manifest.d.ts +1 -1
- package/dist/Manifest.js +1 -1
- package/dist/PostgreSql.d.ts +18 -0
- package/dist/PostgreSql.d.ts.map +1 -0
- package/dist/PostgreSql.js +40 -0
- package/dist/PostgreSql.js.map +1 -0
- package/dist/PostgreSqlPool.d.ts +34 -0
- package/dist/PostgreSqlPool.d.ts.map +1 -0
- package/dist/PostgreSqlPool.js +133 -0
- package/dist/PostgreSqlPool.js.map +1 -0
- package/dist/PostgreSqlTimeouts.d.ts +6 -0
- package/dist/PostgreSqlTimeouts.d.ts.map +1 -0
- package/dist/PostgreSqlTimeouts.js +17 -0
- package/dist/PostgreSqlTimeouts.js.map +1 -0
- package/dist/PostgreSqlTunnel.d.ts +25 -0
- package/dist/PostgreSqlTunnel.d.ts.map +1 -0
- package/dist/PostgreSqlTunnel.js +114 -0
- package/dist/PostgreSqlTunnel.js.map +1 -0
- package/dist/ResourceRecords.d.ts +1086 -0
- package/dist/ResourceRecords.d.ts.map +1 -0
- package/dist/ResourceRecords.js +303 -0
- package/dist/ResourceRecords.js.map +1 -0
- package/dist/Resources.d.ts +13 -0
- package/dist/Resources.d.ts.map +1 -0
- package/dist/Resources.js +13 -0
- package/dist/Resources.js.map +1 -0
- package/dist/RuntimeResources.d.ts +15 -1
- package/dist/RuntimeResources.d.ts.map +1 -1
- package/dist/RuntimeResources.js +42 -13
- package/dist/RuntimeResources.js.map +1 -1
- package/dist/TransportResource.d.ts +1 -32
- package/dist/TransportResource.d.ts.map +1 -1
- package/dist/TransportResource.js +1 -19
- package/dist/TransportResource.js.map +1 -1
- package/package.json +37 -4
package/README.md
CHANGED
|
@@ -325,6 +325,56 @@ approved; another runtime refuses a partner with TLS settings or a proxy. In tes
|
|
|
325
325
|
`@temper/workflow/as2/testing` and pass its `fetch` to `testPlatform`; it keeps the platform ledger rules and runs
|
|
326
326
|
no crypto.
|
|
327
327
|
|
|
328
|
+
## PostgreSQL
|
|
329
|
+
|
|
330
|
+
`@temper/workflow/resources` opens a `pg.Pool` for a PostgreSQL Resource by key. A pool loads `pg`, and a builder's
|
|
331
|
+
tunnel to a Temper-managed database loads `ws`, which the workflow installs; importing the entry point loads neither. TypeScript code also needs `@types/pg`.
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
import { makePostgresqlPool } from '@temper/workflow/resources';
|
|
335
|
+
|
|
336
|
+
// In an Effect service: the pool ends with the scope, and its password masks the workflow's log lines.
|
|
337
|
+
const Ledger = Layer.effect(LedgerService, Effect.map(makePostgresqlPool('orders-db'), makeLedger));
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The pool resolves the Resource through the runtime API and opens no connection until the first query. It
|
|
341
|
+
holds at most 5 connections, with a 10 s connect timeout, a 30 s idle timeout, and a 10 s statement timeout.
|
|
342
|
+
A statement timeout logs `temper.database.query.timeout`, and an idle connection error logs
|
|
343
|
+
`temper.database.connection.error`, without the query or the server text. `sslmode` maps to TLS as libpq does
|
|
344
|
+
(`disable`, `require`, `verify-ca`, `verify-full`; default `verify-full`). A Resource without a password sends an
|
|
345
|
+
empty one, never `PGPASSWORD` or `.pgpass`. A new connection re-reads the password at most every 30 s, so a rotated
|
|
346
|
+
password applies without a restart; a failed read keeps the last password. A record with an SSH tunnel or RDS IAM authentication fails with
|
|
347
|
+
`InvalidResourceError`.
|
|
348
|
+
|
|
349
|
+
Deployed workflows and external databases connect over native TCP. In a builder sandbox
|
|
350
|
+
(`TEMPER_DATABASE_TUNNEL=websocket`), a Temper-managed Resource connects through the Resources-authenticated
|
|
351
|
+
WebSocket tunnel. Each physical connection reads the current runtime token, and a refused tunnel fails the
|
|
352
|
+
connection without a TCP fallback.
|
|
353
|
+
|
|
354
|
+
## Resource records and Kafka
|
|
355
|
+
|
|
356
|
+
`@temper/workflow/resources` gives Effect workflows the record schemas and Kafka options of `@ontemper/resources`:
|
|
357
|
+
`KafkaResource`, `S3Resource`, `AzureBlobResource`, `SftpResource`, `PostgresqlResource`, and `kafkaConfig`. Declare the Resource with `Resource` from the root; its secrets arrive as
|
|
358
|
+
`Redacted` values, and `kafkaConfig` unwraps them itself. It loads the optional peers `@aws-sdk/credential-providers` and
|
|
359
|
+
`aws-msk-iam-sasl-signer-js` only for AWS MSK IAM.
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
import { Resource } from '@temper/workflow';
|
|
363
|
+
import { KafkaResource, kafkaConfig } from '@temper/workflow/resources';
|
|
364
|
+
import { Kafka } from 'kafkajs';
|
|
365
|
+
|
|
366
|
+
class Events extends Resource<Events>()('events', { type: 'kafka', schema: KafkaResource }) {}
|
|
367
|
+
|
|
368
|
+
// In an Effect: const kafka = new Kafka(kafkaConfig(yield* Events));
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
A record that a built-in schema rejects fails the read with the field name, never the value. An unknown closed
|
|
372
|
+
value, such as a new `sslmode`, fails with `UnknownRecordValueError`.
|
|
373
|
+
|
|
374
|
+
This release has no promise-style `env`: no `env.resources`, `env.variables`, `initialize`, or `reload`. Code that
|
|
375
|
+
cannot run an Effect keeps `@ontemper/resources`; this entry does not modify that package. The legacy partners and
|
|
376
|
+
connections APIs are excluded.
|
|
377
|
+
|
|
328
378
|
## Versions
|
|
329
379
|
|
|
330
380
|
CI publishes every version to npm as `@ontemper/sdk`; nobody publishes by hand. Workflow code keeps
|
|
@@ -338,9 +388,12 @@ npm install --save-exact @temper/workflow@npm:@ontemper/sdk@<version>
|
|
|
338
388
|
A published version never changes. The workflow template and the examples pin one exact
|
|
339
389
|
version; `pnpm sdk:pin` moves them all together.
|
|
340
390
|
|
|
341
|
-
The package has
|
|
391
|
+
The package has nine entry points: `@temper/workflow`, `@temper/workflow/testing`,
|
|
342
392
|
`@temper/workflow/contract`, `@temper/workflow/sftp`, `@temper/workflow/sftp/testing`,
|
|
343
|
-
`@temper/workflow/edi`, `@temper/workflow/as2`,
|
|
393
|
+
`@temper/workflow/edi`, `@temper/workflow/as2`, `@temper/workflow/as2/testing`, and `@temper/workflow/resources`.
|
|
394
|
+
Only `/sftp` loads `ssh2`. In `/resources`, only a PostgreSQL pool loads `pg` and `ws`, and only AWS MSK IAM loads
|
|
395
|
+
`@aws-sdk/credential-providers` and `aws-msk-iam-sasl-signer-js` (optional peer dependencies).
|
|
396
|
+
`@temper/workflow/contract` holds the runtime Resources HttpApi and the
|
|
344
397
|
manifest, trigger, and invocation schemas that the platform imports. Workflow code rarely needs it.
|
|
345
398
|
|
|
346
399
|
## Develop and release
|