@ontemper/sdk 0.7.1-postgresql.5 → 0.8.0

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.
Files changed (93) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +8 -81
  3. package/dist/As2Resource.d.ts +76 -431
  4. package/dist/As2Resource.d.ts.map +1 -1
  5. package/dist/As2Resource.js +30 -31
  6. package/dist/As2Resource.js.map +1 -1
  7. package/dist/As2Transport.d.ts.map +1 -1
  8. package/dist/As2Transport.js +1 -3
  9. package/dist/As2Transport.js.map +1 -1
  10. package/dist/As2Wire.d.ts +0 -39
  11. package/dist/As2Wire.d.ts.map +1 -1
  12. package/dist/Contract/RuntimeApi.d.ts +0 -19
  13. package/dist/Contract/RuntimeApi.d.ts.map +1 -1
  14. package/dist/Contract/RuntimeApi.js +1 -1
  15. package/dist/Contract/RuntimeApi.js.map +1 -1
  16. package/dist/Edi.d.ts.map +1 -1
  17. package/dist/Edi.js +5 -6
  18. package/dist/Edi.js.map +1 -1
  19. package/dist/HttpApiResource.d.ts +160 -2899
  20. package/dist/HttpApiResource.d.ts.map +1 -1
  21. package/dist/HttpApiResource.js +60 -82
  22. package/dist/HttpApiResource.js.map +1 -1
  23. package/dist/Manifest.d.ts +1 -1
  24. package/dist/Manifest.d.ts.map +1 -1
  25. package/dist/Manifest.js +1 -1
  26. package/dist/Manifest.js.map +1 -1
  27. package/dist/Redaction.d.ts +1 -5
  28. package/dist/Redaction.d.ts.map +1 -1
  29. package/dist/Redaction.js +6 -28
  30. package/dist/Redaction.js.map +1 -1
  31. package/dist/ResourcesErrors.d.ts +1 -5
  32. package/dist/ResourcesErrors.d.ts.map +1 -1
  33. package/dist/ResourcesErrors.js +2 -5
  34. package/dist/ResourcesErrors.js.map +1 -1
  35. package/dist/ResourcesToken.d.ts +0 -9
  36. package/dist/ResourcesToken.d.ts.map +1 -1
  37. package/dist/ResourcesToken.js +7 -20
  38. package/dist/ResourcesToken.js.map +1 -1
  39. package/dist/RuntimeResources.d.ts +2 -29
  40. package/dist/RuntimeResources.d.ts.map +1 -1
  41. package/dist/RuntimeResources.js +19 -58
  42. package/dist/RuntimeResources.js.map +1 -1
  43. package/dist/TransportResource.d.ts +32 -1
  44. package/dist/TransportResource.d.ts.map +1 -1
  45. package/dist/TransportResource.js +19 -1
  46. package/dist/TransportResource.js.map +1 -1
  47. package/dist/Workflow.js +2 -2
  48. package/dist/Workflow.js.map +1 -1
  49. package/package.json +7 -39
  50. package/dist/DatabaseTunnelAuthorization.d.ts +0 -11
  51. package/dist/DatabaseTunnelAuthorization.d.ts.map +0 -1
  52. package/dist/DatabaseTunnelAuthorization.js +0 -35
  53. package/dist/DatabaseTunnelAuthorization.js.map +0 -1
  54. package/dist/ExpiringMap.d.ts +0 -21
  55. package/dist/ExpiringMap.d.ts.map +0 -1
  56. package/dist/ExpiringMap.js +0 -79
  57. package/dist/ExpiringMap.js.map +0 -1
  58. package/dist/Kafka.d.ts +0 -89
  59. package/dist/Kafka.d.ts.map +0 -1
  60. package/dist/Kafka.js +0 -297
  61. package/dist/Kafka.js.map +0 -1
  62. package/dist/PostgreSql.d.ts +0 -24
  63. package/dist/PostgreSql.d.ts.map +0 -1
  64. package/dist/PostgreSql.js +0 -55
  65. package/dist/PostgreSql.js.map +0 -1
  66. package/dist/PostgreSqlPool.d.ts +0 -32
  67. package/dist/PostgreSqlPool.d.ts.map +0 -1
  68. package/dist/PostgreSqlPool.js +0 -118
  69. package/dist/PostgreSqlPool.js.map +0 -1
  70. package/dist/PostgreSqlTimeouts.d.ts +0 -6
  71. package/dist/PostgreSqlTimeouts.d.ts.map +0 -1
  72. package/dist/PostgreSqlTimeouts.js +0 -17
  73. package/dist/PostgreSqlTimeouts.js.map +0 -1
  74. package/dist/PostgreSqlTunnel.d.ts +0 -25
  75. package/dist/PostgreSqlTunnel.d.ts.map +0 -1
  76. package/dist/PostgreSqlTunnel.js +0 -114
  77. package/dist/PostgreSqlTunnel.js.map +0 -1
  78. package/dist/ResourceRecords.d.ts +0 -1086
  79. package/dist/ResourceRecords.d.ts.map +0 -1
  80. package/dist/ResourceRecords.js +0 -303
  81. package/dist/ResourceRecords.js.map +0 -1
  82. package/dist/Resources.d.ts +0 -17
  83. package/dist/Resources.d.ts.map +0 -1
  84. package/dist/Resources.js +0 -15
  85. package/dist/Resources.js.map +0 -1
  86. package/dist/ResourcesCache.d.ts +0 -33
  87. package/dist/ResourcesCache.d.ts.map +0 -1
  88. package/dist/ResourcesCache.js +0 -205
  89. package/dist/ResourcesCache.js.map +0 -1
  90. package/dist/ResourcesEnv.d.ts +0 -95
  91. package/dist/ResourcesEnv.d.ts.map +0 -1
  92. package/dist/ResourcesEnv.js +0 -135
  93. package/dist/ResourcesEnv.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ Temper SDK License
2
+
3
+ Copyright (c) 2026 Temper. All rights reserved.
4
+
5
+ Temper grants you a limited, non-exclusive, non-transferable, revocable license to
6
+ install and use this package only to build, test, and run workflows on the Temper
7
+ platform under your agreement with Temper. Temper grants no other rights.
8
+
9
+ You may not:
10
+
11
+ 1. use this package, or any part of it, with a service other than the Temper
12
+ platform;
13
+ 2. copy, modify, distribute, sublicense, or publish this package, except as part
14
+ of a workflow that runs on the Temper platform;
15
+ 3. extract EDI standards content that this package contains or receives, such as
16
+ ASC X12 segment, element, and code definitions, or use that content outside
17
+ the Temper platform, including with any artificial intelligence system; or
18
+ 4. license this package, or software that contains it, under an open-source
19
+ license.
20
+
21
+ EDI standards content belongs to its owners. You receive it only inside the
22
+ Temper platform.
23
+
24
+ This license ends when your agreement with Temper ends. You must then stop using
25
+ this package.
26
+
27
+ THIS PACKAGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. TO THE EXTENT THE
28
+ LAW ALLOWS, TEMPER IS NOT LIABLE FOR ANY DAMAGES THAT ARISE FROM ITS USE.
package/README.md CHANGED
@@ -295,7 +295,8 @@ service's `/edifact/*` routes. `toEdifact` serializes the interchange as given,
295
295
  first; no platform counter numbers EDIFACT yet. `acknowledgeEdifact` returns the CONTRL interchanges, or none; set a new UNB 0020 and UNH 0062 on each before
296
296
  `toEdifact`, because the service fills in the same reference every time.
297
297
 
298
- Provide `Edi.layer`. The service URL is `UNNBOUND_EDI_BASE_URL`; `UNNBOUND_EDI_API_KEY`, when set, replaces the
298
+ Provide `Edi.layer`. The service URL is `UNNBOUND_EDI_BASE_URL`, which Temper sets. The client has no default URL, so
299
+ without it every call fails with `reason: 'configuration'`. `UNNBOUND_EDI_API_KEY`, when set, replaces the
299
300
  Run token. The Run token goes only to `<UNNBOUND_API_URL>/api/edi-gateway`, and no EDI call follows a redirect. Lines such as `JSON to X12 completed.` carry the envelope (sender, receiver, counts), not the
300
301
  document. A failure is an `EdiError` whose `reason` is `validation`, `unauthorized`, `service`,
301
302
  `control_number`, or `configuration`, and whose `retryable` says whether the same call may succeed later.
@@ -324,81 +325,6 @@ approved; another runtime refuses a partner with TLS settings or a proxy. In tes
324
325
  `@temper/workflow/as2/testing` and pass its `fetch` to `testPlatform`; it keeps the platform ledger rules and runs
325
326
  no crypto.
326
327
 
327
- ## PostgreSQL
328
-
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
-
332
- ```ts
333
- import { createPostgresqlPool, makePostgresqlPool } from '@temper/workflow/resources';
334
-
335
- // A script or a module-level pool; the caller ends it with `pool.end()`.
336
- const pool = await createPostgresqlPool('orders-db');
337
-
338
- // In an Effect service: the pool ends with the scope, and its password masks the workflow's log lines.
339
- const Ledger = Layer.effect(LedgerService, Effect.map(makePostgresqlPool('orders-db'), makeLedger));
340
- ```
341
-
342
- The pool resolves the Resource through the runtime API and opens no connection until the first query. It
343
- holds at most 5 connections, with a 10 s connect timeout, a 30 s idle timeout, and a 10 s statement timeout.
344
- A statement timeout logs `temper.database.query.timeout`, and an idle connection error logs
345
- `temper.database.connection.error`, without the query or the server text. `sslmode` maps to TLS as libpq does
346
- (`disable`, `require`, `verify-ca`, `verify-full`; default `verify-full`). A Resource without a password sends an
347
- empty one, never `PGPASSWORD` or `.pgpass`. 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. `createPostgresqlPool` registers the password in the process-wide secret
354
- registry; inside a workflow handler, prefer `makePostgresqlPool`, which registers it in the workflow's own.
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
- const timeout = (await env.variables.tryGet('PARTNER_TIMEOUT_MS')) ?? '30000';
384
- ```
385
-
386
- Without a schema, `resolve` returns the JSON object; with one, it decodes it and keeps extension fields.
387
- `ResourceNotFoundError` means the key or selection has no record. A found record with a missing reference
388
- fails with `InvalidResourceError`; unknown closed values in a built-in schema fail with `UnknownRecordValueError`.
389
- Authorization failures use `ResourcesUnauthorizedError`; outages use `ResourcesUnavailableError`.
390
-
391
- Promise reads use the same runtime API and Run token as the declarations. Their cache matches the legacy
392
- resolver: a 30 s TTL, up to 15 min of stale reads through an outage (5 min for selections), and a separate
393
- 10 s select-miss cache with a cap of 60 distinct misses per minute. `{ cache: false }` bypasses it;
394
- `{ ttlMs }` sets a read's TTL. The legacy cache environment settings still apply.
395
-
396
- `variables.tryGet` and `variables.has` read the runtime API like `get`, so they are awaited: `tryGet` answers
397
- `undefined` and `has` answers `false` when no Variable answers the key. Legacy read them from a boot snapshot that
398
- only `env.initialize()` filled. `initialize` and `reload` resolve at once, because every read is live. The legacy
399
- partners and connections APIs are excluded.
400
- Existing workflows can keep `@ontemper/resources`; this entry does not modify that package.
401
-
402
328
  ## Versions
403
329
 
404
330
  CI publishes every version to npm as `@ontemper/sdk`; nobody publishes by hand. Workflow code keeps
@@ -412,12 +338,9 @@ npm install --save-exact @temper/workflow@npm:@ontemper/sdk@<version>
412
338
  A published version never changes. The workflow template and the examples pin one exact
413
339
  version; `pnpm sdk:pin` moves them all together.
414
340
 
415
- The package has nine entry points: `@temper/workflow`, `@temper/workflow/testing`,
341
+ The package has eight entry points: `@temper/workflow`, `@temper/workflow/testing`,
416
342
  `@temper/workflow/contract`, `@temper/workflow/sftp`, `@temper/workflow/sftp/testing`,
417
- `@temper/workflow/edi`, `@temper/workflow/as2`, `@temper/workflow/as2/testing`, and `@temper/workflow/resources`.
418
- Only `/sftp` loads `ssh2`. In `/resources`, only a PostgreSQL pool loads `pg` and `ws`, and only AWS MSK IAM loads
419
- `@aws-sdk/credential-providers` and `aws-msk-iam-sasl-signer-js` (optional peer dependencies).
420
- `@temper/workflow/contract` holds the runtime Resources HttpApi and the
343
+ `@temper/workflow/edi`, `@temper/workflow/as2`, and `@temper/workflow/as2/testing`. Only `/sftp` loads `ssh2`. `@temper/workflow/contract` holds the runtime Resources HttpApi and the
421
344
  manifest, trigger, and invocation schemas that the platform imports. Workflow code rarely needs it.
422
345
 
423
346
  ## Develop and release
@@ -457,3 +380,7 @@ Raise `RUNTIME_API_VERSION` only when the SDK needs a changed platform runtime p
457
380
 
458
381
  Nothing more happens for prod. The template pin travels with the `stg` → `prod` release pull
459
382
  request, and customers get the version that the template pins on `prod`.
383
+
384
+ ## License
385
+
386
+ This package is licensed for use with the Temper platform only. It is not open source. See [LICENSE](LICENSE).