@boerules/sdk 0.0.0-stage → 5.0.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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/dist/client.d.ts +22 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +241 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/errors.d.ts +81 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +109 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +18 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +33 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/sdk-package-version.d.ts +2 -0
  16. package/dist/sdk-package-version.d.ts.map +1 -0
  17. package/dist/sdk-package-version.js +10 -0
  18. package/dist/sdk-package-version.js.map +1 -0
  19. package/dist/types/account.d.ts +87 -0
  20. package/dist/types/account.d.ts.map +1 -0
  21. package/dist/types/account.js +39 -0
  22. package/dist/types/account.js.map +1 -0
  23. package/dist/types/config.d.ts +11 -0
  24. package/dist/types/config.d.ts.map +1 -0
  25. package/dist/types/config.js +3 -0
  26. package/dist/types/config.js.map +1 -0
  27. package/dist/types/execution.d.ts +69 -0
  28. package/dist/types/execution.d.ts.map +1 -0
  29. package/dist/types/execution.js +3 -0
  30. package/dist/types/execution.js.map +1 -0
  31. package/dist/types/index.d.ts +4 -0
  32. package/dist/types/index.d.ts.map +1 -0
  33. package/dist/types/index.js +20 -0
  34. package/dist/types/index.js.map +1 -0
  35. package/dist/types/project.d.ts +40 -0
  36. package/dist/types/project.d.ts.map +1 -0
  37. package/dist/types/project.js +12 -0
  38. package/dist/types/project.js.map +1 -0
  39. package/dist/types/ruleset.d.ts +75 -0
  40. package/dist/types/ruleset.d.ts.map +1 -0
  41. package/dist/types/ruleset.js +3 -0
  42. package/dist/types/ruleset.js.map +1 -0
  43. package/package.json +50 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BOE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # @boerules/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The TypeScript client for BOE. The wire protocol is `packages/sdk/implementation.md`.
4
+
5
+ ```ts
6
+ import { createBOE } from '@boerules/sdk';
7
+
8
+ const boe = createBOE(); // reads BOE_API_KEY, targets https://api.boerules.com/v1
9
+
10
+ const ruleset = await boe.register(creditScoreRuleset);
11
+ const decision = await boe.execute(ruleset.shortCode, { income: 82000, missedPayments: 0 });
12
+ const pinned = await boe.execute(ruleset.shortCode, { income: 82000 }, { version: '1.0.0' });
13
+
14
+ console.log(decision.result, ruleset.executeUrl);
15
+ ```
16
+
17
+ ## Configuration
18
+
19
+ Every field of `createBOE(config?)` is optional.
20
+
21
+ | Setting | Config field | Environment variable | Default |
22
+ |---|---|---|---|
23
+ | API key | `apiKey` | `BOE_API_KEY` | none. A missing key throws `BOEConfigurationError` at construction. |
24
+ | Control plane base URL | `baseUrl` | `BOE_BASE_URL` | `https://api.boerules.com/v1` |
25
+ | Execute base URL | `executeBaseUrl` | none | the value of `baseUrl` |
26
+ | Request timeout in milliseconds | `timeout` | none | `30000` |
27
+ | Retries after the first attempt | `maxRetries` | none | `3` |
28
+
29
+ An explicit field wins over its environment variable. `register`, `listExecutions` and
30
+ `getExecution` use `baseUrl`. `execute` and the batch methods use `executeBaseUrl`.
31
+
32
+ ## Methods
33
+
34
+ `register`, `execute`, `submitBatch`, `getBatchStatus`, `getBatchItems`, `pollBatch`,
35
+ `listExecutions`, `getExecution`. `BOEClient` also offers `iterateExecutions`.
36
+
37
+ ## Errors
38
+
39
+ Every error extends `BOEError` and carries `code` and `status` when the server sent them.
40
+
41
+ | Class | Raised when |
42
+ |---|---|
43
+ | `BOEConfigurationError` | No API key at construction. |
44
+ | `BOEProductionKeyCannotRegisterError` | 403 `production_environment_key_cannot_register`: a Production key called `register`. Register with a Dev key. |
45
+ | `BOERulesetNotLiveInEnvironmentError` | 404 `ruleset_not_live_in_environment`: nothing is live in the key's environment. Promote a version. |
46
+ | `BOEApiError` | Any other refusal whose body carries a code. Fields: `code`, `status`, `serverMessage`. |
47
+ | `BOERegistrationError` | 400 without a code. |
48
+ | `BOEAuthorizationError` | 401 or 403 without a code. |
49
+ | `BOENotFoundError` | 404 without a code. |
50
+ | `BOEExecutionError` | 422: the engine ran and failed. |
51
+ | `BOEConnectionError` | Network failure, timeout, or a 5xx after retries. |
52
+
53
+ ```ts
54
+ try {
55
+ await boe.execute(shortCode, facts);
56
+ } catch (error) {
57
+ if (error instanceof BOERulesetNotLiveInEnvironmentError) {
58
+ console.error(error.serverMessage);
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## Migrating from 4.x to 5.0.0
64
+
65
+ - `RegisterResult.endpoint` is now `RegisterResult.executeUrl`, an absolute URL.
66
+ - `execute` pins a version with `{ version }`, sent as `?version=`. It no longer travels in the body.
67
+ - `baseUrl` and `apiKey` are optional. `baseUrl` now includes `/v1`, and every path is relative to it.
68
+ - The 24 methods that threw "not implemented" are removed from `BOEClient`, `BOE` and `createBOE`:
69
+ `getProfile`, `updateProfile`, `listOrganizations`, `getOrganization`, `createChildOrganization`,
70
+ `updateOrganization`, `listMembers`, `inviteMember`, `updateMemberRole`, `suspendMember`,
71
+ `removeMember`, `listProjects`, `getProject`, `createProject`, `updateProject`, `deleteProject`,
72
+ `listProjectMembers`, `assignProjectMember`, `updateProjectMemberRole`, `removeProjectMember`,
73
+ `checkPermission`, `listPermissions`, `checkProjectPermission`, `listProjectPermissions`.
74
+ Their types and enums (`AccountStatus`, `OrgRole`, `MembershipStatus`, `Operation`, `ProjectRole`) are removed too.
75
+ - A 403 raises `BOEAuthorizationError`. A refusal with a `code` raises `BOEApiError` or a named subclass.
76
+ - `X-BOE-SDK-Version` reports the package version.
@@ -0,0 +1,22 @@
1
+ import type { BOEConfig, RegisterResult, ExecuteResult, ExecuteOptions, BatchSubmitResult, BatchStatusResult, BatchItemsResult, BatchItemsOptions, ExecutionLogEntry, ListExecutionsOptions, ListExecutionsResult } from './types';
2
+ export declare class BOEClient {
3
+ private readonly baseUrl;
4
+ private readonly executeBaseUrl;
5
+ private readonly apiKey;
6
+ private readonly timeout;
7
+ private readonly maxRetries;
8
+ constructor(config?: BOEConfig);
9
+ register<T extends Record<string, unknown>>(ruleset: T): Promise<RegisterResult>;
10
+ execute<T = unknown>(shortCode: string, facts: Record<string, unknown>, options?: ExecuteOptions): Promise<ExecuteResult<T>>;
11
+ submitBatch(shortCode: string, items: Array<{
12
+ facts: Record<string, unknown>;
13
+ }>, options?: Record<string, unknown>): Promise<BatchSubmitResult>;
14
+ getBatchStatus(batchCode: string): Promise<BatchStatusResult>;
15
+ getBatchItems(batchCode: string, options?: BatchItemsOptions): Promise<BatchItemsResult>;
16
+ pollBatch(batchCode: string, intervalMs?: number): Promise<BatchStatusResult>;
17
+ listExecutions(options?: ListExecutionsOptions): Promise<ListExecutionsResult>;
18
+ getExecution(executionId: string): Promise<ExecutionLogEntry>;
19
+ iterateExecutions(options?: ListExecutionsOptions): AsyncGenerator<ExecutionLogEntry, void, void>;
20
+ private request;
21
+ }
22
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAiCjB,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,MAAM,GAAE,SAAc;IAoB5B,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAShF,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAatB,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,EAChD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,iBAAiB,CAAC;IASvB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAS7D,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IActB,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,UAAU,SAAO,GAChB,OAAO,CAAC,iBAAiB,CAAC;IAYvB,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB9E,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAO5D,iBAAiB,CACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,cAAc,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC;YAclC,OAAO;CA4ItB"}
package/dist/client.js ADDED
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BOEClient = void 0;
4
+ const errors_1 = require("./errors");
5
+ const sdk_package_version_1 = require("./sdk-package-version");
6
+ const DEFAULT_BASE_URL = 'https://api.boerules.com/v1';
7
+ // An `error` value that is itself a code (ruleset_archived on register 409 and
8
+ // execute 410). implementation.md, "Body shapes".
9
+ const ERROR_VALUES_THAT_ARE_CODES = new Set(['ruleset_archived']);
10
+ function trimTrailingSlash(url) {
11
+ return url.replace(/\/$/, '');
12
+ }
13
+ function readEnvironmentVariable(name) {
14
+ const value = typeof process !== 'undefined' ? process.env?.[name] : undefined;
15
+ return value ? value : undefined;
16
+ }
17
+ class BOEClient {
18
+ baseUrl;
19
+ executeBaseUrl;
20
+ apiKey;
21
+ timeout;
22
+ maxRetries;
23
+ constructor(config = {}) {
24
+ const apiKey = config.apiKey || readEnvironmentVariable('BOE_API_KEY');
25
+ if (!apiKey) {
26
+ throw new errors_1.BOEConfigurationError('No API key. Pass { apiKey } or set the BOE_API_KEY environment variable.');
27
+ }
28
+ this.apiKey = apiKey;
29
+ this.baseUrl = trimTrailingSlash(config.baseUrl || readEnvironmentVariable('BOE_BASE_URL') || DEFAULT_BASE_URL);
30
+ this.executeBaseUrl = config.executeBaseUrl
31
+ ? trimTrailingSlash(config.executeBaseUrl)
32
+ : this.baseUrl;
33
+ this.timeout = config.timeout ?? 30_000;
34
+ this.maxRetries = config.maxRetries ?? 3;
35
+ }
36
+ // ── Rulesets ──
37
+ async register(ruleset) {
38
+ const result = await this.request('POST', '/register', ruleset);
39
+ // A register Lambda deployed before #1114 answers no executeUrl.
40
+ if (!result.executeUrl && typeof result.shortCode === 'string') {
41
+ result.executeUrl = `${this.executeBaseUrl}/execute/${encodeURIComponent(result.shortCode)}`;
42
+ }
43
+ return result;
44
+ }
45
+ async execute(shortCode, facts, options) {
46
+ const { version, ...bodyOptions } = options ?? {};
47
+ const qs = version ? `?version=${encodeURIComponent(version)}` : '';
48
+ return this.request('POST', `/execute/${encodeURIComponent(shortCode)}${qs}`, { facts, options: bodyOptions }, this.executeBaseUrl);
49
+ }
50
+ // ── Batch ──
51
+ async submitBatch(shortCode, items, options) {
52
+ return this.request('POST', `/execute-batch/${encodeURIComponent(shortCode)}`, { items, options }, this.executeBaseUrl);
53
+ }
54
+ async getBatchStatus(batchCode) {
55
+ return this.request('GET', `/execute-batch/${encodeURIComponent(batchCode)}`, undefined, this.executeBaseUrl);
56
+ }
57
+ async getBatchItems(batchCode, options) {
58
+ const params = new URLSearchParams();
59
+ if (options?.offset != null)
60
+ params.set('offset', String(options.offset));
61
+ if (options?.limit != null)
62
+ params.set('limit', String(options.limit));
63
+ if (options?.status)
64
+ params.set('status', options.status);
65
+ const qs = params.toString();
66
+ return this.request('GET', `/execute-batch/${encodeURIComponent(batchCode)}/items${qs ? `?${qs}` : ''}`, undefined, this.executeBaseUrl);
67
+ }
68
+ async pollBatch(batchCode, intervalMs = 2000) {
69
+ const terminalStatuses = new Set(['completed', 'partial', 'failed']);
70
+ let status = await this.getBatchStatus(batchCode);
71
+ while (!terminalStatuses.has(status.status)) {
72
+ await sleep(intervalMs);
73
+ status = await this.getBatchStatus(batchCode);
74
+ }
75
+ return status;
76
+ }
77
+ // ── Executions ──
78
+ async listExecutions(options) {
79
+ const params = new URLSearchParams();
80
+ if (options?.rulesetId)
81
+ params.set('rulesetId', options.rulesetId);
82
+ if (options?.engineMode) {
83
+ const modes = Array.isArray(options.engineMode) ? options.engineMode : [options.engineMode];
84
+ for (const mode of modes)
85
+ params.append('engineMode', mode);
86
+ }
87
+ if (options?.createdFrom)
88
+ params.set('createdFrom', options.createdFrom);
89
+ if (options?.createdUntil)
90
+ params.set('createdUntil', options.createdUntil);
91
+ if (options?.searchText !== undefined)
92
+ params.set('searchText', options.searchText);
93
+ if (options?.limit != null)
94
+ params.set('limit', String(options.limit));
95
+ if (options?.pageCursor)
96
+ params.set('pageCursor', options.pageCursor);
97
+ const qs = params.toString();
98
+ return this.request('GET', `/executions${qs ? `?${qs}` : ''}`);
99
+ }
100
+ async getExecution(executionId) {
101
+ return this.request('GET', `/executions/${encodeURIComponent(executionId)}`);
102
+ }
103
+ async *iterateExecutions(options) {
104
+ let pageCursor = options?.pageCursor;
105
+ for (;;) {
106
+ const page = await this.listExecutions({ ...options, pageCursor });
107
+ for (const execution of page.executions) {
108
+ yield execution;
109
+ }
110
+ if (!page.nextPageCursor)
111
+ return;
112
+ pageCursor = page.nextPageCursor;
113
+ }
114
+ }
115
+ // ── HTTP ──
116
+ async request(method, path, body, baseUrl = this.baseUrl) {
117
+ const url = `${baseUrl}${path}`;
118
+ let lastError;
119
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
120
+ if (attempt > 0) {
121
+ await sleep(100 * Math.pow(2, attempt - 1));
122
+ }
123
+ let timeoutId;
124
+ try {
125
+ const controller = new AbortController();
126
+ timeoutId = setTimeout(() => controller.abort(), this.timeout);
127
+ const response = await fetch(url, {
128
+ method,
129
+ headers: {
130
+ 'Content-Type': 'application/json',
131
+ 'Authorization': `Bearer ${this.apiKey}`,
132
+ 'X-BOE-SDK': 'typescript',
133
+ 'X-BOE-SDK-Version': sdk_package_version_1.BOE_SDK_PACKAGE_VERSION,
134
+ },
135
+ body: body ? JSON.stringify(body) : undefined,
136
+ signal: controller.signal,
137
+ });
138
+ clearTimeout(timeoutId);
139
+ if (response.ok) {
140
+ try {
141
+ return await response.json();
142
+ }
143
+ catch (parseError) {
144
+ // The server answered 2xx, so the call may have taken effect.
145
+ // Retrying would repeat it, and a bad body does not heal.
146
+ throw new errors_1.BOEInvalidResponseError(`Server returned ${response.status} with a body that is not valid JSON: ` +
147
+ `${parseError instanceof Error ? parseError.message : String(parseError)}`, { endpoint: url, status: response.status });
148
+ }
149
+ }
150
+ const errorBody = await response.json().catch(() => ({}));
151
+ const errorMessage = errorBody.error || response.statusText;
152
+ const code = classifyErrorCode(errorBody);
153
+ if (response.status === 429 || response.status >= 500) {
154
+ // 429 is final on the wire (implementation.md, Retry semantics) and
155
+ // carries its reason in executionRefusalReason.
156
+ if (response.status === 429 && code) {
157
+ throw new errors_1.BOEApiError(errorMessage, { code, status: response.status });
158
+ }
159
+ lastError = code
160
+ ? new errors_1.BOEApiError(errorMessage, { code, status: response.status })
161
+ : new errors_1.BOEConnectionError(`Server returned ${response.status}: ${errorMessage}`, { endpoint: url, status: response.status });
162
+ continue;
163
+ }
164
+ if (code === 'production_environment_key_cannot_register') {
165
+ throw new errors_1.BOEProductionKeyCannotRegisterError(errorMessage, { status: response.status });
166
+ }
167
+ if (code === 'ruleset_not_live_in_environment') {
168
+ throw new errors_1.BOERulesetNotLiveInEnvironmentError(errorMessage, { status: response.status });
169
+ }
170
+ if (code) {
171
+ throw new errors_1.BOEApiError(errorMessage, { code, status: response.status });
172
+ }
173
+ if (response.status === 400) {
174
+ throw new errors_1.BOERegistrationError(errorMessage, {
175
+ rulesetId: errorBody.rulesetId ?? undefined,
176
+ statusCode: response.status,
177
+ });
178
+ }
179
+ if (response.status === 401 || response.status === 403) {
180
+ throw new errors_1.BOEAuthorizationError(errorMessage, {
181
+ statusCode: response.status,
182
+ });
183
+ }
184
+ if (response.status === 404) {
185
+ throw new errors_1.BOENotFoundError(errorMessage, {
186
+ shortCode: errorBody.shortCode ?? undefined,
187
+ });
188
+ }
189
+ if (response.status === 422) {
190
+ throw new errors_1.BOEExecutionError(errorMessage, {
191
+ shortCode: errorBody.shortCode ?? undefined,
192
+ statusCode: response.status,
193
+ });
194
+ }
195
+ throw new errors_1.BOEConnectionError(`Unexpected response ${response.status}: ${errorMessage}`, { endpoint: url, status: response.status });
196
+ }
197
+ catch (error) {
198
+ if (error instanceof errors_1.BOEError && !(error instanceof errors_1.BOEConnectionError) &&
199
+ !(error instanceof errors_1.BOEApiError && (error.status ?? 0) >= 500)) {
200
+ throw error;
201
+ }
202
+ if (error instanceof Error && error.name === 'AbortError') {
203
+ lastError = new errors_1.BOEConnectionError(`Request timed out after ${this.timeout}ms`, { endpoint: url });
204
+ continue;
205
+ }
206
+ if (error instanceof errors_1.BOEConnectionError || error instanceof errors_1.BOEApiError) {
207
+ lastError = error;
208
+ continue;
209
+ }
210
+ lastError = new errors_1.BOEConnectionError(`Network error: ${error instanceof Error ? error.message : String(error)}`, { endpoint: url });
211
+ continue;
212
+ }
213
+ finally {
214
+ // A rejected fetch skips the clearTimeout above; the timer would
215
+ // otherwise keep the process alive for the full timeout.
216
+ clearTimeout(timeoutId);
217
+ }
218
+ }
219
+ throw lastError ?? new errors_1.BOEConnectionError('Request failed after retries', { endpoint: url });
220
+ }
221
+ }
222
+ exports.BOEClient = BOEClient;
223
+ /**
224
+ * The code a refusal carries: the `code` member, then an `error` value that is
225
+ * itself a known code, then the 429 `executionRefusalReason`.
226
+ */
227
+ function classifyErrorCode(errorBody) {
228
+ if (typeof errorBody.code === 'string' && errorBody.code)
229
+ return errorBody.code;
230
+ if (typeof errorBody.error === 'string' && ERROR_VALUES_THAT_ARE_CODES.has(errorBody.error)) {
231
+ return errorBody.error;
232
+ }
233
+ if (typeof errorBody.executionRefusalReason === 'string' && errorBody.executionRefusalReason) {
234
+ return errorBody.executionRefusalReason;
235
+ }
236
+ return undefined;
237
+ }
238
+ function sleep(ms) {
239
+ return new Promise(resolve => setTimeout(resolve, ms));
240
+ }
241
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAcA,qCAYkB;AAElB,+DAAgE;AAEhE,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAEvD,+EAA+E;AAC/E,kDAAkD;AAClD,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAElE,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC;AAED,MAAa,SAAS;IACH,OAAO,CAAS;IAChB,cAAc,CAAS;IACvB,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,UAAU,CAAS;IAEpC,YAAY,SAAoB,EAAE;QAChC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,8BAAqB,CAC7B,0EAA0E,CAC3E,CAAC;QACJ,CAAC;QACD,IAAI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F;AA9RD,8BA8RC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CAAC,SAAkC;IAC3D,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC,IAAI,CAAC;IAChF,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,IAAI,2BAA2B,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC,KAAK,CAAC;IACzB,CAAC;IACD,IAAI,OAAO,SAAS,CAAC,sBAAsB,KAAK,QAAQ,IAAI,SAAS,CAAC,sBAAsB,EAAE,CAAC;QAC7F,OAAO,SAAS,CAAC,sBAAsB,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,81 @@
1
+ export declare class BOEError extends Error {
2
+ readonly code?: string;
3
+ readonly status?: number;
4
+ constructor(message: string, options?: {
5
+ code?: string;
6
+ status?: number;
7
+ });
8
+ }
9
+ /** Thrown at construction when no API key is passed and BOE_API_KEY is unset. */
10
+ export declare class BOEConfigurationError extends BOEError {
11
+ constructor(message: string);
12
+ }
13
+ /** A non 2xx response whose body carries a machine readable code. */
14
+ export declare class BOEApiError extends BOEError {
15
+ readonly serverMessage: string;
16
+ constructor(message: string, options: {
17
+ code?: string;
18
+ status: number;
19
+ });
20
+ }
21
+ export declare class BOEProductionKeyCannotRegisterError extends BOEApiError {
22
+ constructor(message: string, options: {
23
+ status: number;
24
+ });
25
+ }
26
+ export declare class BOERulesetNotLiveInEnvironmentError extends BOEApiError {
27
+ constructor(message: string, options: {
28
+ status: number;
29
+ });
30
+ }
31
+ export declare class BOERegistrationError extends BOEError {
32
+ readonly rulesetId?: string;
33
+ readonly statusCode?: number;
34
+ constructor(message: string, options?: {
35
+ rulesetId?: string;
36
+ statusCode?: number;
37
+ code?: string;
38
+ });
39
+ }
40
+ export declare class BOEExecutionError extends BOEError {
41
+ readonly shortCode?: string;
42
+ readonly statusCode?: number;
43
+ constructor(message: string, options?: {
44
+ shortCode?: string;
45
+ statusCode?: number;
46
+ code?: string;
47
+ });
48
+ }
49
+ export declare class BOEConnectionError extends BOEError {
50
+ readonly endpoint?: string;
51
+ constructor(message: string, options?: {
52
+ endpoint?: string;
53
+ status?: number;
54
+ });
55
+ }
56
+ export declare class BOENotFoundError extends BOEError {
57
+ readonly shortCode?: string;
58
+ constructor(message: string, options?: {
59
+ shortCode?: string;
60
+ code?: string;
61
+ });
62
+ }
63
+ export declare class BOEAuthorizationError extends BOEError {
64
+ readonly statusCode?: number;
65
+ constructor(message: string, options?: {
66
+ statusCode?: number;
67
+ code?: string;
68
+ });
69
+ }
70
+ /**
71
+ * A 2xx response whose body is not valid JSON. The server answered, so the
72
+ * request is not retried; the status and endpoint say which call to inspect.
73
+ */
74
+ export declare class BOEInvalidResponseError extends BOEError {
75
+ readonly endpoint?: string;
76
+ constructor(message: string, options?: {
77
+ endpoint?: string;
78
+ status?: number;
79
+ });
80
+ }
81
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAM1E;AAED,iFAAiF;AACjF,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC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QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAK9E;AAED,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAK7E;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;IACjD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEjB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAK9E;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CAK9E"}
package/dist/errors.js ADDED
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BOEInvalidResponseError = exports.BOEAuthorizationError = exports.BOENotFoundError = exports.BOEConnectionError = exports.BOEExecutionError = exports.BOERegistrationError = exports.BOERulesetNotLiveInEnvironmentError = exports.BOEProductionKeyCannotRegisterError = exports.BOEApiError = exports.BOEConfigurationError = exports.BOEError = void 0;
4
+ class BOEError extends Error {
5
+ code;
6
+ status;
7
+ constructor(message, options) {
8
+ super(message);
9
+ this.name = 'BOEError';
10
+ this.code = options?.code;
11
+ this.status = options?.status;
12
+ }
13
+ }
14
+ exports.BOEError = BOEError;
15
+ /** Thrown at construction when no API key is passed and BOE_API_KEY is unset. */
16
+ class BOEConfigurationError extends BOEError {
17
+ constructor(message) {
18
+ super(message);
19
+ this.name = 'BOEConfigurationError';
20
+ }
21
+ }
22
+ exports.BOEConfigurationError = BOEConfigurationError;
23
+ /** A non 2xx response whose body carries a machine readable code. */
24
+ class BOEApiError extends BOEError {
25
+ serverMessage;
26
+ constructor(message, options) {
27
+ super(message, options);
28
+ this.name = 'BOEApiError';
29
+ this.serverMessage = message;
30
+ }
31
+ }
32
+ exports.BOEApiError = BOEApiError;
33
+ class BOEProductionKeyCannotRegisterError extends BOEApiError {
34
+ constructor(message, options) {
35
+ super(message, { code: 'production_environment_key_cannot_register', status: options.status });
36
+ this.name = 'BOEProductionKeyCannotRegisterError';
37
+ }
38
+ }
39
+ exports.BOEProductionKeyCannotRegisterError = BOEProductionKeyCannotRegisterError;
40
+ class BOERulesetNotLiveInEnvironmentError extends BOEApiError {
41
+ constructor(message, options) {
42
+ super(message, { code: 'ruleset_not_live_in_environment', status: options.status });
43
+ this.name = 'BOERulesetNotLiveInEnvironmentError';
44
+ }
45
+ }
46
+ exports.BOERulesetNotLiveInEnvironmentError = BOERulesetNotLiveInEnvironmentError;
47
+ class BOERegistrationError extends BOEError {
48
+ rulesetId;
49
+ statusCode;
50
+ constructor(message, options) {
51
+ super(message, { code: options?.code, status: options?.statusCode });
52
+ this.name = 'BOERegistrationError';
53
+ this.rulesetId = options?.rulesetId;
54
+ this.statusCode = options?.statusCode;
55
+ }
56
+ }
57
+ exports.BOERegistrationError = BOERegistrationError;
58
+ class BOEExecutionError extends BOEError {
59
+ shortCode;
60
+ statusCode;
61
+ constructor(message, options) {
62
+ super(message, { code: options?.code, status: options?.statusCode });
63
+ this.name = 'BOEExecutionError';
64
+ this.shortCode = options?.shortCode;
65
+ this.statusCode = options?.statusCode;
66
+ }
67
+ }
68
+ exports.BOEExecutionError = BOEExecutionError;
69
+ class BOEConnectionError extends BOEError {
70
+ endpoint;
71
+ constructor(message, options) {
72
+ super(message, { status: options?.status });
73
+ this.name = 'BOEConnectionError';
74
+ this.endpoint = options?.endpoint;
75
+ }
76
+ }
77
+ exports.BOEConnectionError = BOEConnectionError;
78
+ class BOENotFoundError extends BOEError {
79
+ shortCode;
80
+ constructor(message, options) {
81
+ super(message, { code: options?.code, status: 404 });
82
+ this.name = 'BOENotFoundError';
83
+ this.shortCode = options?.shortCode;
84
+ }
85
+ }
86
+ exports.BOENotFoundError = BOENotFoundError;
87
+ class BOEAuthorizationError extends BOEError {
88
+ statusCode;
89
+ constructor(message, options) {
90
+ super(message, { code: options?.code, status: options?.statusCode });
91
+ this.name = 'BOEAuthorizationError';
92
+ this.statusCode = options?.statusCode;
93
+ }
94
+ }
95
+ exports.BOEAuthorizationError = BOEAuthorizationError;
96
+ /**
97
+ * A 2xx response whose body is not valid JSON. The server answered, so the
98
+ * request is not retried; the status and endpoint say which call to inspect.
99
+ */
100
+ class BOEInvalidResponseError extends BOEError {
101
+ endpoint;
102
+ constructor(message, options) {
103
+ super(message, { status: options?.status });
104
+ this.name = 'BOEInvalidResponseError';
105
+ this.endpoint = options?.endpoint;
106
+ }
107
+ }
108
+ exports.BOEInvalidResponseError = BOEInvalidResponseError;
109
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAU;IACd,MAAM,CAAU;IAEzB,YAAY,OAAe,EAAE,OAA4C;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAChC,CAAC;CACF;AAVD,4BAUC;AAED,iFAAiF;AACjF,MAAa,qBAAsB,SAAQ,QAAQ;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAA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UAAU,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;IACxC,CAAC;CACF;AARD,sDAQC;AAED;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,QAAQ;IAC1C,QAAQ,CAAU;IAE3B,YAAY,OAAe,EAAE,OAAgD;QAC3E,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;IACpC,CAAC;CACF;AARD,0DAQC"}
@@ -0,0 +1,18 @@
1
+ import type { BOEConfig, RegisterResult, ExecuteResult, ExecuteOptions, BatchSubmitResult, BatchStatusResult, BatchItemsResult, BatchItemsOptions, ExecutionLogEntry, ListExecutionsOptions, ListExecutionsResult } from './types';
2
+ export type { BOEConfig, RegisterResult, ExecuteResult, ExecuteOptions, BatchSubmitResult, BatchStatusResult, BatchItemsResult, BatchItemsOptions, ExecutionLogEntry, ScoringOutputBounds, ListExecutionsOptions, ListExecutionsResult, } from './types';
3
+ export { BOEError, BOEConfigurationError, BOEApiError, BOEProductionKeyCannotRegisterError, BOERulesetNotLiveInEnvironmentError, BOERegistrationError, BOEExecutionError, BOEConnectionError, BOEInvalidResponseError, BOENotFoundError, BOEAuthorizationError, } from './errors';
4
+ export { BOEClient } from './client';
5
+ export type BOE = {
6
+ register<T extends Record<string, unknown>>(ruleset: T): Promise<RegisterResult>;
7
+ execute<T = unknown>(shortCode: string, facts: Record<string, unknown>, options?: ExecuteOptions): Promise<ExecuteResult<T>>;
8
+ submitBatch(shortCode: string, items: Array<{
9
+ facts: Record<string, unknown>;
10
+ }>, options?: Record<string, unknown>): Promise<BatchSubmitResult>;
11
+ getBatchStatus(batchCode: string): Promise<BatchStatusResult>;
12
+ getBatchItems(batchCode: string, options?: BatchItemsOptions): Promise<BatchItemsResult>;
13
+ pollBatch(batchCode: string, intervalMs?: number): Promise<BatchStatusResult>;
14
+ listExecutions(options?: ListExecutionsOptions): Promise<ListExecutionsResult>;
15
+ getExecution(executionId: string): Promise<ExecutionLogEntry>;
16
+ };
17
+ export declare function createBOE(config?: BOEConfig): BOE;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,mCAAmC,EACnC,mCAAmC,EACnC,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACjF,OAAO,CAAC,CAAC,GAAG,OAAO,EACjB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,EAChD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9D,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACzF,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9E,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/E,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/D,CAAC;AAEF,wBAAgB,SAAS,CAAC,MAAM,GAAE,SAAc,GAAG,GAAG,CAarD"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BOEClient = exports.BOEAuthorizationError = exports.BOENotFoundError = exports.BOEInvalidResponseError = exports.BOEConnectionError = exports.BOEExecutionError = exports.BOERegistrationError = exports.BOERulesetNotLiveInEnvironmentError = exports.BOEProductionKeyCannotRegisterError = exports.BOEApiError = exports.BOEConfigurationError = exports.BOEError = void 0;
4
+ exports.createBOE = createBOE;
5
+ const client_1 = require("./client");
6
+ var errors_1 = require("./errors");
7
+ Object.defineProperty(exports, "BOEError", { enumerable: true, get: function () { return errors_1.BOEError; } });
8
+ Object.defineProperty(exports, "BOEConfigurationError", { enumerable: true, get: function () { return errors_1.BOEConfigurationError; } });
9
+ Object.defineProperty(exports, "BOEApiError", { enumerable: true, get: function () { return errors_1.BOEApiError; } });
10
+ Object.defineProperty(exports, "BOEProductionKeyCannotRegisterError", { enumerable: true, get: function () { return errors_1.BOEProductionKeyCannotRegisterError; } });
11
+ Object.defineProperty(exports, "BOERulesetNotLiveInEnvironmentError", { enumerable: true, get: function () { return errors_1.BOERulesetNotLiveInEnvironmentError; } });
12
+ Object.defineProperty(exports, "BOERegistrationError", { enumerable: true, get: function () { return errors_1.BOERegistrationError; } });
13
+ Object.defineProperty(exports, "BOEExecutionError", { enumerable: true, get: function () { return errors_1.BOEExecutionError; } });
14
+ Object.defineProperty(exports, "BOEConnectionError", { enumerable: true, get: function () { return errors_1.BOEConnectionError; } });
15
+ Object.defineProperty(exports, "BOEInvalidResponseError", { enumerable: true, get: function () { return errors_1.BOEInvalidResponseError; } });
16
+ Object.defineProperty(exports, "BOENotFoundError", { enumerable: true, get: function () { return errors_1.BOENotFoundError; } });
17
+ Object.defineProperty(exports, "BOEAuthorizationError", { enumerable: true, get: function () { return errors_1.BOEAuthorizationError; } });
18
+ var client_2 = require("./client");
19
+ Object.defineProperty(exports, "BOEClient", { enumerable: true, get: function () { return client_2.BOEClient; } });
20
+ function createBOE(config = {}) {
21
+ const client = new client_1.BOEClient(config);
22
+ return {
23
+ register: (ruleset) => client.register(ruleset),
24
+ execute: (shortCode, facts, options) => client.execute(shortCode, facts, options),
25
+ submitBatch: (shortCode, items, options) => client.submitBatch(shortCode, items, options),
26
+ getBatchStatus: (batchCode) => client.getBatchStatus(batchCode),
27
+ getBatchItems: (batchCode, options) => client.getBatchItems(batchCode, options),
28
+ pollBatch: (batchCode, intervalMs) => client.pollBatch(batchCode, intervalMs),
29
+ listExecutions: (options) => client.listExecutions(options),
30
+ getExecution: (executionId) => client.getExecution(executionId),
31
+ };
32
+ }
33
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CAAC,SAAS,EAAE,UAAU,CAAC;QAC7E,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;QAC3D,YAAY,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;KAChE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const BOE_SDK_PACKAGE_VERSION: string;
2
+ //# sourceMappingURL=sdk-package-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-package-version.d.ts","sourceRoot":"","sources":["../src/sdk-package-version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,EAAE,MAA+B,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BOE_SDK_PACKAGE_VERSION = void 0;
4
+ // The version this client reports in X-BOE-SDK-Version, read from the
5
+ // package.json that ships beside dist/, so the header and the published
6
+ // package cannot disagree (#1115). implementation.md names this rule.
7
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
8
+ const sdkPackageJson = require('../package.json');
9
+ exports.BOE_SDK_PACKAGE_VERSION = sdkPackageJson.version;
10
+ //# sourceMappingURL=sdk-package-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-package-version.js","sourceRoot":"","sources":["../src/sdk-package-version.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACtE,wEAAwE;AACxE,sEAAsE;AACtE,iEAAiE;AACjE,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAE5D,QAAA,uBAAuB,GAAW,cAAc,CAAC,OAAO,CAAC"}
@@ -0,0 +1,87 @@
1
+ export declare enum AccountStatus {
2
+ Active = "active",
3
+ Suspended = "suspended",
4
+ Deactivated = "deactivated"
5
+ }
6
+ export declare enum OrgRole {
7
+ Owner = "owner",
8
+ Admin = "admin",
9
+ Author = "author",
10
+ Member = "member",
11
+ Viewer = "viewer"
12
+ }
13
+ export declare enum MembershipStatus {
14
+ Active = "active",
15
+ Suspended = "suspended"
16
+ }
17
+ export declare enum Operation {
18
+ AccountSuspend = "account:suspend",
19
+ AccountDeactivate = "account:deactivate",
20
+ AccountReactivate = "account:reactivate",
21
+ PlanEdit = "plan:edit",
22
+ PlanPublish = "plan:publish",
23
+ PlanArchive = "plan:archive",
24
+ ProjectEdit = "project:edit",
25
+ ProjectDelete = "project:delete",
26
+ ProjectManageMembers = "project:manage_members",
27
+ RulesetCreate = "ruleset:create",
28
+ RulesetEdit = "ruleset:edit",
29
+ RulesetDelete = "ruleset:delete",
30
+ RulesetPublish = "ruleset:publish"
31
+ }
32
+ export type AccountProfile = {
33
+ id: string;
34
+ name: string;
35
+ planId: string;
36
+ status: AccountStatus;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ };
40
+ export type UpdateProfileInput = {
41
+ name?: string;
42
+ };
43
+ export type OrganizationSummary = {
44
+ id: string;
45
+ accountId: string;
46
+ parentOrgId: string | null;
47
+ name: string;
48
+ depth: number;
49
+ createdAt: string;
50
+ };
51
+ export type CreateChildOrgInput = {
52
+ parentOrgId: string;
53
+ name: string;
54
+ };
55
+ export type UpdateOrgInput = {
56
+ name?: string;
57
+ };
58
+ export type OrgMember = {
59
+ id: string;
60
+ userId: string;
61
+ email: string;
62
+ displayName: string;
63
+ role: OrgRole;
64
+ status: MembershipStatus;
65
+ joinedAt: string;
66
+ };
67
+ export type InviteMemberInput = {
68
+ email: string;
69
+ role: OrgRole;
70
+ };
71
+ export type UpdateMemberRoleInput = {
72
+ role: OrgRole;
73
+ };
74
+ export type InviteResult = {
75
+ membershipId: string;
76
+ userId: string;
77
+ role: OrgRole;
78
+ };
79
+ export type PermissionCheck = {
80
+ allowed: boolean;
81
+ reason: string;
82
+ };
83
+ export type PermissionEntry = {
84
+ operation: Operation;
85
+ allowed: boolean;
86
+ };
87
+ //# sourceMappingURL=account.d.ts.map
@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AM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Operation = exports.MembershipStatus = exports.OrgRole = exports.AccountStatus = void 0;
4
+ var AccountStatus;
5
+ (function (AccountStatus) {
6
+ AccountStatus["Active"] = "active";
7
+ AccountStatus["Suspended"] = "suspended";
8
+ AccountStatus["Deactivated"] = "deactivated";
9
+ })(AccountStatus || (exports.AccountStatus = AccountStatus = {}));
10
+ var OrgRole;
11
+ (function (OrgRole) {
12
+ OrgRole["Owner"] = "owner";
13
+ OrgRole["Admin"] = "admin";
14
+ OrgRole["Author"] = "author";
15
+ OrgRole["Member"] = "member";
16
+ OrgRole["Viewer"] = "viewer";
17
+ })(OrgRole || (exports.OrgRole = OrgRole = {}));
18
+ var MembershipStatus;
19
+ (function (MembershipStatus) {
20
+ MembershipStatus["Active"] = "active";
21
+ MembershipStatus["Suspended"] = "suspended";
22
+ })(MembershipStatus || (exports.MembershipStatus = MembershipStatus = {}));
23
+ var Operation;
24
+ (function (Operation) {
25
+ Operation["AccountSuspend"] = "account:suspend";
26
+ Operation["AccountDeactivate"] = "account:deactivate";
27
+ Operation["AccountReactivate"] = "account:reactivate";
28
+ Operation["PlanEdit"] = "plan:edit";
29
+ Operation["PlanPublish"] = "plan:publish";
30
+ Operation["PlanArchive"] = "plan:archive";
31
+ Operation["ProjectEdit"] = "project:edit";
32
+ Operation["ProjectDelete"] = "project:delete";
33
+ Operation["ProjectManageMembers"] = "project:manage_members";
34
+ Operation["RulesetCreate"] = "ruleset:create";
35
+ Operation["RulesetEdit"] = "ruleset:edit";
36
+ Operation["RulesetDelete"] = "ruleset:delete";
37
+ Operation["RulesetPublish"] = "ruleset:publish";
38
+ })(Operation || (exports.Operation = Operation = {}));
39
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,wCAAuB,CAAA;IACvB,4CAA2B,CAAA;AAC7B,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;AACnB,CAAC,EANW,OAAO,uBAAP,OAAO,QAMlB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,SAcX;AAdD,WAAY,SAAS;IACnB,+CAAkC,CAAA;IAClC,qDAAwC,CAAA;IACxC,qDAAwC,CAAA;IACxC,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,yCAA4B,CAAA;IAC5B,6CAAgC,CAAA;IAChC,4DAA+C,CAAA;IAC/C,6CAAgC,CAAA;IAChC,yCAA4B,CAAA;IAC5B,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;AACpC,CAAC,EAdW,SAAS,yBAAT,SAAS,QAcpB"}
@@ -0,0 +1,11 @@
1
+ export type BOEConfig = {
2
+ /** API key. Defaults to the BOE_API_KEY environment variable. */
3
+ apiKey?: string;
4
+ /** Control plane base URL. Defaults to BOE_BASE_URL, then https://api.boerules.com/v1. */
5
+ baseUrl?: string;
6
+ /** Base URL for execute and batch calls. Defaults to baseUrl. */
7
+ executeBaseUrl?: string;
8
+ timeout?: number;
9
+ maxRetries?: number;
10
+ };
11
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The 40 routable engine modes, mirroring VALID_MODES in
3
+ * packages/sdk/server/lambda/shared/types.ts. Copied rather than imported:
4
+ * this package does not depend on packages/sdk/server, whose types carry AWS
5
+ * Lambda types this client has no business pulling in.
6
+ */
7
+ export type EngineMode = 'allocation' | 'anomaly' | 'audit' | 'authorship' | 'backward' | 'bayesian' | 'classify' | 'constraint' | 'decay' | 'defeasible' | 'eligibility' | 'ensemble' | 'expert' | 'flow' | 'forward' | 'fuzzy' | 'leadtime' | 'loyalty' | 'matching' | 'menu-engineering' | 'monte-carlo' | 'negotiation' | 'pipeline' | 'policy' | 'prediction' | 'pricing' | 'q-evaluate' | 'queue' | 'ranking' | 'recipe-costing' | 'recommendation' | 'relay' | 'risk' | 'scoring' | 'sentiment' | 'sequential' | 'state-machine' | 'takt' | 'time-series' | 'utility';
8
+ /** The inclusive range a scoring ruleset clamps totalScore to. */
9
+ export type ScoringOutputBounds = {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ export type ExecutionLogEntry = {
14
+ executionId: string;
15
+ createdAt: string;
16
+ rulesetId: string;
17
+ rulesetShortCode: string | null;
18
+ rulesetName: string | null;
19
+ rulesetVersionId: string | null;
20
+ /** boe.ruleset_versions.version, e.g. `"1.0.0"`. Null when the version row is gone. */
21
+ rulesetVersion: string | null;
22
+ engineMode: string;
23
+ apiKeyId: string | null;
24
+ totalDispatchDurationMs: number;
25
+ executionSucceeded: boolean;
26
+ executionFailureReason: string | null;
27
+ executionResultFragment: Record<string, unknown> | null;
28
+ /**
29
+ * The scale of `totalScore`: the range the scoring engine clamped it to,
30
+ * from the executed ruleset version's `config.outputBounds`, with presets
31
+ * such as `'percentage'` already resolved to `{ min: 0, max: 100 }`.
32
+ * Derived by the API at read time, never stored. Null for any mode other
33
+ * than `'scoring'`, for a ruleset that declares no bounds, and when the
34
+ * version row is gone.
35
+ */
36
+ scoringOutputBounds: ScoringOutputBounds | null;
37
+ lineageRequested: boolean;
38
+ lineageAvailable: boolean;
39
+ executionResultRequested: boolean;
40
+ executionResultAvailable: boolean;
41
+ };
42
+ export type ListExecutionsOptions = {
43
+ rulesetId?: string;
44
+ /**
45
+ * One mode or several. Several serialize as repeated `engineMode` query
46
+ * parameters (`?engineMode=scoring&engineMode=pricing`), matched with OR
47
+ * semantics by the API. A single mode behaves exactly as before.
48
+ */
49
+ engineMode?: EngineMode | EngineMode[];
50
+ /** ISO 8601 instant, inclusive. */
51
+ createdFrom?: string;
52
+ /** ISO 8601 instant, exclusive. */
53
+ createdUntil?: string;
54
+ /**
55
+ * Free text, 1 to 100 characters once the API trims it. Matches an
56
+ * execution id (in full, or a prefix of 8 or more hex digits), a ruleset
57
+ * id in full, a ruleset short code, or text inside the ruleset name. The
58
+ * last two ignore case. ANDed with every other option. Sent whenever it is
59
+ * set, including `''`, so the API, not the client, decides what is valid.
60
+ */
61
+ searchText?: string;
62
+ limit?: number;
63
+ pageCursor?: string;
64
+ };
65
+ export type ListExecutionsResult = {
66
+ executions: ExecutionLogEntry[];
67
+ nextPageCursor: string | null;
68
+ };
69
+ //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,SAAS,GACT,OAAO,GACP,YAAY,GACZ,UAAU,GACV,UAAU,GACV,UAAU,GACV,YAAY,GACZ,OAAO,GACP,YAAY,GACZ,aAAa,GACb,UAAU,GACV,QAAQ,GACR,MAAM,GACN,SAAS,GACT,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN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OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './config';
2
+ export * from './ruleset';
3
+ export * from './execution';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./config"), exports);
18
+ __exportStar(require("./ruleset"), exports);
19
+ __exportStar(require("./execution"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B"}
@@ -0,0 +1,40 @@
1
+ export declare enum ProjectRole {
2
+ Owner = "owner",
3
+ Admin = "admin",
4
+ Author = "author",
5
+ Member = "member",
6
+ Viewer = "viewer"
7
+ }
8
+ export type ProjectSummary = {
9
+ id: string;
10
+ orgId: string;
11
+ name: string;
12
+ description: string | null;
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ };
16
+ export type CreateProjectInput = {
17
+ orgId: string;
18
+ name: string;
19
+ description?: string;
20
+ };
21
+ export type UpdateProjectInput = {
22
+ name?: string;
23
+ description?: string;
24
+ };
25
+ export type ProjectMember = {
26
+ id: string;
27
+ userId: string;
28
+ email: string;
29
+ displayName: string;
30
+ role: ProjectRole;
31
+ assignedAt: string;
32
+ };
33
+ export type AssignProjectMemberInput = {
34
+ userId: string;
35
+ role: ProjectRole;
36
+ };
37
+ export type UpdateProjectMemberRoleInput = {
38
+ role: ProjectRole;
39
+ };
40
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/types/project.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectRole = void 0;
4
+ var ProjectRole;
5
+ (function (ProjectRole) {
6
+ ProjectRole["Owner"] = "owner";
7
+ ProjectRole["Admin"] = "admin";
8
+ ProjectRole["Author"] = "author";
9
+ ProjectRole["Member"] = "member";
10
+ ProjectRole["Viewer"] = "viewer";
11
+ })(ProjectRole || (exports.ProjectRole = ProjectRole = {}));
12
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/types/project.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;AACnB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB"}
@@ -0,0 +1,75 @@
1
+ export type RegisterResult = {
2
+ rulesetId: string;
3
+ shortCode: string;
4
+ engineMode: string;
5
+ version: string;
6
+ created: boolean;
7
+ executeUrl: string;
8
+ };
9
+ export type ExecuteResult<T = unknown> = {
10
+ executionId: string;
11
+ ruleset: string;
12
+ result: T;
13
+ engineMode: string;
14
+ shortCode: string;
15
+ version: string;
16
+ executionTimeMs: number;
17
+ totalTimeMs: number;
18
+ lineage?: Record<string, unknown>;
19
+ };
20
+ export type ExecuteOptions = {
21
+ /** Pins a published version. Sent as the version query string parameter. */
22
+ version?: string;
23
+ lineage?: boolean;
24
+ archiveExecutionResult?: boolean;
25
+ runtime?: string;
26
+ correlationId?: string;
27
+ parentExecutionId?: string;
28
+ };
29
+ export type BatchSubmitResult = {
30
+ batchCode: string;
31
+ batchId: string;
32
+ rulesetShortCode: string;
33
+ engineMode: string;
34
+ version: string;
35
+ totalItems: number;
36
+ status: 'pending';
37
+ };
38
+ export type BatchStatusResult = {
39
+ batchCode: string;
40
+ status: 'pending' | 'processing' | 'completed' | 'partial' | 'failed';
41
+ totalItems: number;
42
+ completedCount: number;
43
+ errorCount: number;
44
+ progress: number;
45
+ engineMode: string;
46
+ version: string;
47
+ rulesetShortCode: string;
48
+ createdAt: string;
49
+ startedAt: string | null;
50
+ completedAt: string | null;
51
+ };
52
+ export type BatchItem = {
53
+ position: number;
54
+ status: 'queued' | 'processing' | 'completed' | 'error';
55
+ result: unknown | null;
56
+ errorMessage: string | null;
57
+ executionMs: number | null;
58
+ executionId: string | null;
59
+ completedAt: string | null;
60
+ };
61
+ export type BatchItemsResult = {
62
+ batchCode: string;
63
+ items: BatchItem[];
64
+ pagination: {
65
+ offset: number;
66
+ limit: number;
67
+ total: number;
68
+ };
69
+ };
70
+ export type BatchItemsOptions = {
71
+ offset?: number;
72
+ limit?: number;
73
+ status?: 'queued' | 'processing' | 'completed' | 'error';
74
+ };
75
+ //# sourceMappingURL=ruleset.d.ts.map
@@ -0,0 +1 @@
1
+ {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}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ruleset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../../src/types/ruleset.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@boerules/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "5.0.0",
4
+ "description": "BOE business rule engine SDK. Register and execute rulesets, and manage accounts and organizations.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "dev": "tsc --watch",
16
+ "cdk": "cdk",
17
+ "test": "node --import tsx --test src/*.test.ts"
18
+ },
19
+ "author": "Kamau Washington",
20
+ "license": "MIT",
21
+ "homepage": "https://boerules.com",
22
+ "keywords": [
23
+ "rules-engine",
24
+ "business-rule-engine",
25
+ "scoring",
26
+ "sdk",
27
+ "json"
28
+ ],
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org/"
35
+ },
36
+ "devDependencies": {
37
+ "@types/aws-lambda": "^8.10.145",
38
+ "@types/node": "^24.10.0",
39
+ "@types/pg": "^8.11.0",
40
+ "aws-cdk": "^2.1149.0",
41
+ "aws-cdk-lib": "^2.170.0",
42
+ "constructs": "^10.0.0",
43
+ "esbuild": "^0.24.0",
44
+ "source-map-support": "^0.5.21",
45
+ "ts-node": "^10.9.2",
46
+ "tsx": "^4.19.0",
47
+ "typescript": "^5.9.3"
48
+ },
49
+ "dependencies": {
50
+ "ajv-formats": "^3.0.1"
51
+ }
52
+ }