@ontemper/edi 1.2.0-beta.5 → 1.2.0-beta.6

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 CHANGED
@@ -370,24 +370,18 @@ or invalid value causes a `ControlNumberError` with the `control_number_environm
370
370
  environment override. ISA15 (`UsageIndicator_15`) does not select a counter, and `toX12()` does not change it.
371
371
 
372
372
  ```typescript
373
- import { getCurrentControlNumber, getNextControlNumber, setControlNumber } from '@ontemper/edi';
373
+ import { getCurrentControlNumber, getNextControlNumber } from '@ontemper/edi';
374
374
 
375
375
  const senderId = 'ZZ:SENDER';
376
376
  const receiverId = 'ZZ:RECEIVER';
377
377
 
378
378
  const next = await getNextControlNumber('ISA13', senderId, receiverId);
379
379
  const current = await getCurrentControlNumber('ISA13', senderId, receiverId);
380
-
381
- // Legacy production migration: store 4599 as the last-used value.
382
- await setControlNumber('ISA13', senderId, receiverId, 4599);
383
380
  ```
384
381
 
385
- `setControlNumber()` is the legacy production setter. Its value is the last-used number, so setting `4599` makes the
386
- next allocation `4600`. It uses the flat production route and does not use the environment variables.
387
-
388
- Use the Builder agent `set_edi_control_number` tool for per-environment seeding. The tool value is the next number.
389
- For example, seeding `4600` makes the next allocation `4600`. Seeding is forward-only. Re-seeding the same value is
390
- a no-op.
382
+ The SDK has no seeding helper. Seed a counter through the Builder agent `set_edi_control_number` tool, which asks
383
+ the user to approve each seed. The tool value is the next number: seeding `4600` makes the next allocation `4600`.
384
+ Seeding is forward-only. Re-seeding the same value is a no-op.
391
385
 
392
386
  These helpers require `UNNBOUND_API_URL`. Temper configures it in workflow environments.
393
387
 
@@ -3,7 +3,7 @@ export type TemperEnvironment = 'sandbox' | 'staging' | 'production';
3
3
  /** @public */
4
4
  export type ControlNumberCounterName = 'ISA13' | 'GS06';
5
5
  /** @public */
6
- export type ControlNumberErrorCode = 'counter_already_started' | 'control_number_environment_missing' | 'control_number_bad_request' | 'control_number_unauthorized' | 'control_number_unknown_error';
6
+ export type ControlNumberErrorCode = 'control_number_environment_missing' | 'control_number_bad_request' | 'control_number_unauthorized' | 'control_number_unknown_error';
7
7
  interface ControlNumberErrorOptions extends ErrorOptions {
8
8
  code: ControlNumberErrorCode;
9
9
  message: string;
@@ -33,11 +33,4 @@ export declare function getNextControlNumber(counterName: ControlNumberCounterNa
33
33
  */
34
34
  /** @public */
35
35
  export declare function getCurrentControlNumber(counterName: ControlNumberCounterName, senderId: string, receiverId: string, maxDigits?: number): Promise<string>;
36
- /**
37
- * Set the last-used production control number through the legacy endpoint.
38
- *
39
- * Use the Builder agent `set_edi_control_number` tool for per-environment seeding.
40
- */
41
- /** @public */
42
- export declare function setControlNumber(counterName: ControlNumberCounterName, senderId: string, receiverId: string, value: number, maxDigits?: number): Promise<string>;
43
36
  export {};
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.isControlNumberError = exports.ControlNumberError = void 0;
37
37
  exports.getNextControlNumber = getNextControlNumber;
38
38
  exports.getCurrentControlNumber = getCurrentControlNumber;
39
- exports.setControlNumber = setControlNumber;
40
39
  const axios_1 = __importStar(require("axios"));
41
40
  let _client = null;
42
41
  function getApiClient() {
@@ -88,24 +87,17 @@ const requireEnvironment = () => {
88
87
  message: "TEMPER_ENVIRONMENT or UNNBOUND_ENVIRONMENT must be set to 'sandbox', 'staging', or 'production' because automatic control-number routing needs it.",
89
88
  });
90
89
  };
91
- function unwrapControlNumberError(error, environmentScoped = false) {
90
+ function unwrapControlNumberError(error) {
92
91
  if (error instanceof ControlNumberError)
93
92
  throw error;
94
93
  if ((0, axios_1.isAxiosError)(error)) {
95
- if (environmentScoped && error.response?.status === 404) {
94
+ if (error.response?.status === 404) {
96
95
  throw new ControlNumberError({
97
96
  code: 'control_number_unknown_error',
98
97
  message: 'The Temper API does not support environment-scoped EDI control numbers yet.',
99
98
  cause: error,
100
99
  });
101
100
  }
102
- if (error.response?.status === 409) {
103
- throw new ControlNumberError({
104
- code: 'counter_already_started',
105
- message: 'Cannot set EDI control number after counter has started. Set the starting value before calling getNextControlNumber or toX12 for this trading partner.',
106
- cause: error,
107
- });
108
- }
109
101
  if (error.response?.status === 400) {
110
102
  throw new ControlNumberError({
111
103
  code: 'control_number_bad_request',
@@ -149,7 +141,7 @@ async function getNextControlNumber(counterName, senderId, receiverId, maxDigits
149
141
  return String(data.value).padStart(maxDigits, '0');
150
142
  }
151
143
  catch (error) {
152
- return unwrapControlNumberError(error, true);
144
+ return unwrapControlNumberError(error);
153
145
  }
154
146
  }
155
147
  /**
@@ -167,25 +159,6 @@ async function getCurrentControlNumber(counterName, senderId, receiverId, maxDig
167
159
  });
168
160
  return String(data.value).padStart(maxDigits, '0');
169
161
  }
170
- catch (error) {
171
- return unwrapControlNumberError(error, true);
172
- }
173
- }
174
- /**
175
- * Set the last-used production control number through the legacy endpoint.
176
- *
177
- * Use the Builder agent `set_edi_control_number` tool for per-environment seeding.
178
- */
179
- /** @public */
180
- async function setControlNumber(counterName, senderId, receiverId, value, maxDigits = 9) {
181
- try {
182
- const { data } = await getApiClient().post('/api/v2/internal/edi/control-numbers/set', {
183
- tradingPartnerKey: `${senderId}:${receiverId}`,
184
- counterName,
185
- value,
186
- });
187
- return String(data.value).padStart(maxDigits, '0');
188
- }
189
162
  catch (error) {
190
163
  return unwrapControlNumberError(error);
191
164
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type X12Interchange } from './edination-client';
2
2
  export type { ControlNumberErrorCode } from './control-numbers';
3
- export { ControlNumberError, getCurrentControlNumber, getNextControlNumber, isControlNumberError, setControlNumber, } from './control-numbers';
3
+ export { ControlNumberError, getCurrentControlNumber, getNextControlNumber, isControlNumberError, } from './control-numbers';
4
4
  export * from './edination-client/model';
5
5
  interface UnnboundErrorOptions<C extends string = string> extends ErrorOptions {
6
6
  message: string;
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.TemperEdiClient = exports.isEdiInfrastructureError = exports.EdiInfrastructureError = exports.isTemperEdiClientError = exports.TemperEdiClientError = exports.setControlNumber = exports.isControlNumberError = exports.getNextControlNumber = exports.getCurrentControlNumber = exports.ControlNumberError = void 0;
39
+ exports.TemperEdiClient = exports.isEdiInfrastructureError = exports.EdiInfrastructureError = exports.isTemperEdiClientError = exports.TemperEdiClientError = exports.isControlNumberError = exports.getNextControlNumber = exports.getCurrentControlNumber = exports.ControlNumberError = void 0;
40
40
  const axios_1 = __importStar(require("axios"));
41
41
  const unnbound_logger_sdk_1 = require("unnbound-logger-sdk");
42
42
  const internal_1 = require("unnbound-logger-sdk/dist/internal");
@@ -47,7 +47,6 @@ Object.defineProperty(exports, "ControlNumberError", { enumerable: true, get: fu
47
47
  Object.defineProperty(exports, "getCurrentControlNumber", { enumerable: true, get: function () { return control_numbers_2.getCurrentControlNumber; } });
48
48
  Object.defineProperty(exports, "getNextControlNumber", { enumerable: true, get: function () { return control_numbers_2.getNextControlNumber; } });
49
49
  Object.defineProperty(exports, "isControlNumberError", { enumerable: true, get: function () { return control_numbers_2.isControlNumberError; } });
50
- Object.defineProperty(exports, "setControlNumber", { enumerable: true, get: function () { return control_numbers_2.setControlNumber; } });
51
50
  __exportStar(require("./edination-client/model"), exports);
52
51
  class UnnboundError extends Error {
53
52
  code;
package/package.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
2
  "name": "@ontemper/edi",
3
3
  "description": "An EDI client with structured logging.",
4
- "version": "1.2.0-beta.5",
4
+ "version": "1.2.0-beta.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "vitest run src",
10
+ "typecheck": "tsc --noEmit",
11
+ "format": "oxfmt --write .",
12
+ "format:check": "oxfmt --check .",
13
+ "prepublishOnly": "pnpm run build",
14
+ "start:example": "tsx watch examples/node-edi.ts",
15
+ "version:bump": "npm version patch",
16
+ "release": "pnpm run build && pnpm publish --access public",
17
+ "codegen": "npx --yes @openapitools/openapi-generator-cli generate -c openapitools.json -o ./src/edination-client"
18
+ },
7
19
  "author": "Unnbound Team",
8
20
  "license": "MIT",
9
21
  "repository": {
@@ -16,7 +28,7 @@
16
28
  },
17
29
  "dependencies": {
18
30
  "axios": "1.18.0",
19
- "unnbound-logger-sdk": "3.1.1"
31
+ "unnbound-logger-sdk": "workspace:3.1.1"
20
32
  },
21
33
  "devDependencies": {
22
34
  "@types/jest": "^29.5.12",
@@ -33,16 +45,5 @@
33
45
  "engines": {
34
46
  "node": ">=22"
35
47
  },
36
- "sideEffects": false,
37
- "scripts": {
38
- "build": "tsc",
39
- "test": "vitest run src",
40
- "typecheck": "tsc --noEmit",
41
- "format": "oxfmt --write .",
42
- "format:check": "oxfmt --check .",
43
- "start:example": "tsx watch examples/node-edi.ts",
44
- "version:bump": "npm version patch",
45
- "release": "pnpm run build && pnpm publish --access public",
46
- "codegen": "npx --yes @openapitools/openapi-generator-cli generate -c openapitools.json -o ./src/edination-client"
47
- }
48
- }
48
+ "sideEffects": false
49
+ }
package/CHANGELOG.md DELETED
@@ -1,23 +0,0 @@
1
- ## [1.1.7](https://github.com/ontemper/temper/releases/tag/%40ontemper%2Fedi-v1.1.7) (2026-07-28)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * stamp zero acknowledgment envelope control numbers ([#2421](https://github.com/ontemper/temper/pull/2421))
7
-
8
- ## [1.0.13](https://github.com/unnbounddev/unnbound-sdks/compare/unnbound-edi-sdk-v1.0.12...unnbound-edi-sdk-v1.0.13) (2025-11-25)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * setup ci/cd ([dd2640f](https://github.com/unnbounddev/unnbound-sdks/commit/dd2640f01e39f1342f3e08dc882164b50331c7bb))
14
- * setup ci/cd ([520c03a](https://github.com/unnbounddev/unnbound-sdks/commit/520c03aacd978d7923b3bcf45c4f74a870be019d))
15
-
16
- ## [1.0.12](https://github.com/unnbounddev/unnbound-sdks/compare/unnbound-edi-sdk-v1.0.11...unnbound-edi-sdk-v1.0.12) (2025-11-25)
17
-
18
-
19
- ### Bug Fixes
20
-
21
- * remove unused files ([6dc00c2](https://github.com/unnbounddev/unnbound-sdks/commit/6dc00c20b092b17e9eb2108ef83dc5beafdef3f5))
22
- * setup ci/cd ([d3759c1](https://github.com/unnbounddev/unnbound-sdks/commit/d3759c14f7863e4c8d2f5e80bdbbf2446df79f1a))
23
- * setup ci/cd ([7e06fc8](https://github.com/unnbounddev/unnbound-sdks/commit/7e06fc84ae7bafba3e9c2c0225f9f9d614fa9207))