@ontemper/sdk 0.8.0 → 0.8.2
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 +56 -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 +146 -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,57 @@ 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 stale password (over 30 s old) is re-read in the background for later
|
|
346
|
+
connections, so a rotated password applies without a restart; a failed re-read keeps the last password and logs
|
|
347
|
+
`temper.database.password.refresh.failed`. Changes to other fields apply at the next restart. A record with an SSH tunnel or RDS IAM authentication fails with
|
|
348
|
+
`InvalidResourceError`.
|
|
349
|
+
|
|
350
|
+
Deployed workflows and external databases connect over native TCP. In a builder sandbox
|
|
351
|
+
(`TEMPER_DATABASE_TUNNEL=websocket`), a Temper-managed Resource connects through the Resources-authenticated
|
|
352
|
+
WebSocket tunnel. Each physical connection reads the current runtime token, and a refused tunnel fails the
|
|
353
|
+
connection without a TCP fallback.
|
|
354
|
+
|
|
355
|
+
## Resource records and Kafka
|
|
356
|
+
|
|
357
|
+
`@temper/workflow/resources` gives Effect workflows the record schemas and Kafka options of `@ontemper/resources`:
|
|
358
|
+
`KafkaResource`, `S3Resource`, `AzureBlobResource`, `SftpResource`, `PostgresqlResource`, and `kafkaConfig`. Declare the Resource with `Resource` from the root; its secrets arrive as
|
|
359
|
+
`Redacted` values, and `kafkaConfig` unwraps them itself. It loads the optional peers `@aws-sdk/credential-providers` and
|
|
360
|
+
`aws-msk-iam-sasl-signer-js` only for AWS MSK IAM.
|
|
361
|
+
|
|
362
|
+
```ts
|
|
363
|
+
import { Resource } from '@temper/workflow';
|
|
364
|
+
import { KafkaResource, kafkaConfig } from '@temper/workflow/resources';
|
|
365
|
+
import { Kafka } from 'kafkajs';
|
|
366
|
+
|
|
367
|
+
class Events extends Resource<Events>()('events', { type: 'kafka', schema: KafkaResource }) {}
|
|
368
|
+
|
|
369
|
+
// In an Effect: const kafka = new Kafka(kafkaConfig(yield* Events));
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
A record that a built-in schema rejects fails the read with the field name, never the value. An unknown closed
|
|
373
|
+
value, such as a new `sslmode`, fails with `UnknownRecordValueError`.
|
|
374
|
+
|
|
375
|
+
This release has no promise-style `env`: no `env.resources`, `env.variables`, `initialize`, or `reload`. Code that
|
|
376
|
+
cannot run an Effect keeps `@ontemper/resources`; this entry does not modify that package. The legacy partners and
|
|
377
|
+
connections APIs are excluded.
|
|
378
|
+
|
|
328
379
|
## Versions
|
|
329
380
|
|
|
330
381
|
CI publishes every version to npm as `@ontemper/sdk`; nobody publishes by hand. Workflow code keeps
|
|
@@ -338,9 +389,12 @@ npm install --save-exact @temper/workflow@npm:@ontemper/sdk@<version>
|
|
|
338
389
|
A published version never changes. The workflow template and the examples pin one exact
|
|
339
390
|
version; `pnpm sdk:pin` moves them all together.
|
|
340
391
|
|
|
341
|
-
The package has
|
|
392
|
+
The package has nine entry points: `@temper/workflow`, `@temper/workflow/testing`,
|
|
342
393
|
`@temper/workflow/contract`, `@temper/workflow/sftp`, `@temper/workflow/sftp/testing`,
|
|
343
|
-
`@temper/workflow/edi`, `@temper/workflow/as2`,
|
|
394
|
+
`@temper/workflow/edi`, `@temper/workflow/as2`, `@temper/workflow/as2/testing`, and `@temper/workflow/resources`.
|
|
395
|
+
Only `/sftp` loads `ssh2`. In `/resources`, only a PostgreSQL pool loads `pg` and `ws`, and only AWS MSK IAM loads
|
|
396
|
+
`@aws-sdk/credential-providers` and `aws-msk-iam-sasl-signer-js` (optional peer dependencies).
|
|
397
|
+
`@temper/workflow/contract` holds the runtime Resources HttpApi and the
|
|
344
398
|
manifest, trigger, and invocation schemas that the platform imports. Workflow code rarely needs it.
|
|
345
399
|
|
|
346
400
|
## Develop and release
|