@ontemper/sdk 0.7.1-postgresql.1 → 0.7.1-postgresql.3
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 +50 -6
- 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/DatabaseTunnelAuthorization.d.ts +11 -0
- package/dist/DatabaseTunnelAuthorization.d.ts.map +1 -0
- package/dist/DatabaseTunnelAuthorization.js +35 -0
- package/dist/DatabaseTunnelAuthorization.js.map +1 -0
- package/dist/ExpiringMap.d.ts +21 -0
- package/dist/ExpiringMap.d.ts.map +1 -0
- package/dist/ExpiringMap.js +79 -0
- package/dist/ExpiringMap.js.map +1 -0
- package/dist/HttpApiResource.d.ts +2904 -177
- package/dist/HttpApiResource.d.ts.map +1 -1
- package/dist/HttpApiResource.js +81 -59
- 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 +2 -2
- package/dist/PostgreSql.d.ts.map +1 -1
- package/dist/PostgreSql.js +4 -13
- package/dist/PostgreSql.js.map +1 -1
- package/dist/PostgreSqlPool.d.ts +2 -40
- package/dist/PostgreSqlPool.d.ts.map +1 -1
- package/dist/PostgreSqlPool.js +13 -26
- package/dist/PostgreSqlPool.js.map +1 -1
- package/dist/PostgreSqlTimeouts.d.ts +4 -2
- package/dist/PostgreSqlTimeouts.d.ts.map +1 -1
- package/dist/PostgreSqlTimeouts.js +5 -4
- package/dist/PostgreSqlTimeouts.js.map +1 -1
- package/dist/Redaction.d.ts +2 -0
- package/dist/Redaction.d.ts.map +1 -1
- package/dist/Redaction.js +16 -4
- package/dist/Redaction.js.map +1 -1
- 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 +17 -0
- package/dist/Resources.d.ts.map +1 -0
- package/dist/Resources.js +15 -0
- package/dist/Resources.js.map +1 -0
- package/dist/ResourcesCache.d.ts +33 -0
- package/dist/ResourcesCache.d.ts.map +1 -0
- package/dist/ResourcesCache.js +205 -0
- package/dist/ResourcesCache.js.map +1 -0
- package/dist/ResourcesEnv.d.ts +81 -0
- package/dist/ResourcesEnv.d.ts.map +1 -0
- package/dist/ResourcesEnv.js +104 -0
- package/dist/ResourcesEnv.js.map +1 -0
- package/dist/ResourcesErrors.d.ts +5 -1
- package/dist/ResourcesErrors.d.ts.map +1 -1
- package/dist/ResourcesErrors.js +5 -2
- package/dist/ResourcesErrors.js.map +1 -1
- package/dist/ResourcesToken.d.ts +9 -0
- package/dist/ResourcesToken.d.ts.map +1 -1
- package/dist/ResourcesToken.js +20 -7
- package/dist/ResourcesToken.js.map +1 -1
- package/dist/RuntimeResources.d.ts +18 -3
- package/dist/RuntimeResources.d.ts.map +1 -1
- package/dist/RuntimeResources.js +54 -30
- 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/dist/Workflow.js +2 -2
- package/dist/Workflow.js.map +1 -1
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -326,11 +326,11 @@ no crypto.
|
|
|
326
326
|
|
|
327
327
|
## PostgreSQL
|
|
328
328
|
|
|
329
|
-
`@temper/workflow/
|
|
330
|
-
the workflow installs;
|
|
329
|
+
`@temper/workflow/resources` opens a `pg.Pool` for a PostgreSQL Resource by key. A pool loads `pg`, and a builder's
|
|
330
|
+
tunnel to a Temper-managed database loads `ws`, which the workflow installs; importing the entry point loads neither. TypeScript code also needs `@types/pg`.
|
|
331
331
|
|
|
332
332
|
```ts
|
|
333
|
-
import { createPostgresqlPool, makePostgresqlPool } from '@temper/workflow/
|
|
333
|
+
import { createPostgresqlPool, makePostgresqlPool } from '@temper/workflow/resources';
|
|
334
334
|
|
|
335
335
|
// A script or a module-level pool; the caller ends it with `pool.end()`.
|
|
336
336
|
const pool = await createPostgresqlPool('orders-db');
|
|
@@ -353,6 +353,49 @@ WebSocket tunnel. Each physical connection reads the current runtime token, and
|
|
|
353
353
|
connection without a TCP fallback. `createPostgresqlPool` registers the password in the process-wide secret
|
|
354
354
|
registry; inside a workflow handler, prefer `makePostgresqlPool`, which registers it in the workflow's own.
|
|
355
355
|
|
|
356
|
+
## Resource records and Kafka
|
|
357
|
+
|
|
358
|
+
`@temper/workflow/resources` gives Effect workflows what `@ontemper/resources` gives legacy ones: record schemas
|
|
359
|
+
(`KafkaResource`, `S3Resource`, `AzureBlobResource`, `SftpResource`, `PostgresqlResource`), `kafkaConfig`, and a promise
|
|
360
|
+
`env` for code that cannot run an Effect. Declare the Resource with `Resource` from the root; its secrets arrive as
|
|
361
|
+
`Redacted` values, and `kafkaConfig` unwraps them itself. It loads the optional peers `@aws-sdk/credential-providers` and
|
|
362
|
+
`aws-msk-iam-sasl-signer-js` only for AWS MSK IAM.
|
|
363
|
+
|
|
364
|
+
```ts
|
|
365
|
+
import { Resource } from '@temper/workflow';
|
|
366
|
+
import { KafkaResource, kafkaConfig } from '@temper/workflow/resources';
|
|
367
|
+
import { Kafka } from 'kafkajs';
|
|
368
|
+
|
|
369
|
+
class Events extends Resource<Events>()('events', { type: 'kafka', schema: KafkaResource }) {}
|
|
370
|
+
|
|
371
|
+
// In an Effect: const kafka = new Kafka(kafkaConfig(yield* Events));
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
For scripts outside Effect, the subpath exports the promise-style `env`:
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
import { env, S3Resource } from '@temper/workflow/resources';
|
|
378
|
+
|
|
379
|
+
const archive = await env.resources.resolve('archive', S3Resource);
|
|
380
|
+
const metadata = await env.resources.inspect('archive');
|
|
381
|
+
const { key } = await env.resources.select({ resourceTypeKey: 'http_api', match: { tenantKey } });
|
|
382
|
+
const region = await env.variables.get('PARTNER_REGION');
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Without a schema, `resolve` returns the JSON object; with one, it decodes it and keeps extension fields.
|
|
386
|
+
`ResourceNotFoundError` means the key or selection has no record. A found record with a missing reference
|
|
387
|
+
fails with `InvalidResourceError`; unknown closed values in a built-in schema fail with `UnknownRecordValueError`.
|
|
388
|
+
Authorization failures use `ResourcesUnauthorizedError`; outages use `ResourcesUnavailableError`.
|
|
389
|
+
|
|
390
|
+
Promise reads use the same runtime API and Run token as the declarations. Their cache matches the legacy
|
|
391
|
+
resolver: a 30 s TTL, up to 15 min of stale reads through an outage (5 min for selections), and a separate
|
|
392
|
+
10 s select-miss cache with a cap of 60 distinct misses per minute. `{ cache: false }` bypasses it;
|
|
393
|
+
`{ ttlMs }` sets a read's TTL. The legacy cache environment settings still apply.
|
|
394
|
+
|
|
395
|
+
The runtime API cannot list Variables, so snapshot `initialize`, `reload`, `variables.tryGet`, and
|
|
396
|
+
`variables.has` have no equivalent. The legacy partners and connections APIs are also excluded.
|
|
397
|
+
Existing workflows can keep `@ontemper/resources`; this entry does not modify that package.
|
|
398
|
+
|
|
356
399
|
## Versions
|
|
357
400
|
|
|
358
401
|
CI publishes every version to npm as `@ontemper/sdk`; nobody publishes by hand. Workflow code keeps
|
|
@@ -366,10 +409,11 @@ npm install --save-exact @temper/workflow@npm:@ontemper/sdk@<version>
|
|
|
366
409
|
A published version never changes. The workflow template and the examples pin one exact
|
|
367
410
|
version; `pnpm sdk:pin` moves them all together.
|
|
368
411
|
|
|
369
|
-
The package has
|
|
412
|
+
The package has ten entry points: `@temper/workflow`, `@temper/workflow/testing`,
|
|
370
413
|
`@temper/workflow/contract`, `@temper/workflow/sftp`, `@temper/workflow/sftp/testing`,
|
|
371
|
-
`@temper/workflow/edi`, `@temper/workflow/as2`, `@temper/workflow/as2/testing`, and `@temper/workflow/
|
|
372
|
-
Only `/sftp` loads `ssh2`,
|
|
414
|
+
`@temper/workflow/edi`, `@temper/workflow/as2`, `@temper/workflow/as2/testing`, and `@temper/workflow/resources`.
|
|
415
|
+
Only `/sftp` loads `ssh2`. In `/resources`, only a PostgreSQL pool loads `pg` and `ws`, and only AWS MSK IAM loads
|
|
416
|
+
`@aws-sdk/credential-providers` and `aws-msk-iam-sasl-signer-js` (optional peer dependencies).
|
|
373
417
|
`@temper/workflow/contract` holds the runtime Resources HttpApi and the
|
|
374
418
|
manifest, trigger, and invocation schemas that the platform imports. Workflow code rarely needs it.
|
|
375
419
|
|