@codemation/core 0.12.0 → 0.13.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.
- package/CHANGELOG.md +22 -0
- package/dist/{CostCatalogContract-DD7fQ4FF.d.cts → CostCatalogContract-Dxq1BTyi.d.cts} +2 -2
- package/dist/{EngineRuntimeRegistration.types-DTV5_7Jw.d.cts → EngineRuntimeRegistration.types-CqcTWexS.d.cts} +3 -3
- package/dist/{EngineRuntimeRegistration.types-Dl92Hdoi.d.ts → EngineRuntimeRegistration.types-Cr75cSfL.d.ts} +2 -2
- package/dist/{InMemoryRunDataFactory-qMiYjhCK.d.cts → InMemoryRunDataFactory-Csy2evr_.d.cts} +5 -2
- package/dist/{ItemsInputNormalizer-Div-fb6a.cjs → ItemsInputNormalizer-57EdA1ad.cjs} +2 -2
- package/dist/{ItemsInputNormalizer-Div-fb6a.cjs.map → ItemsInputNormalizer-57EdA1ad.cjs.map} +1 -1
- package/dist/{ItemsInputNormalizer-C09a7iFP.d.ts → ItemsInputNormalizer-BWtlwdVI.d.ts} +2 -2
- package/dist/{ItemsInputNormalizer-BhuxvZh5.js → ItemsInputNormalizer-BkSvmfAW.js} +2 -2
- package/dist/{ItemsInputNormalizer-BhuxvZh5.js.map → ItemsInputNormalizer-BkSvmfAW.js.map} +1 -1
- package/dist/{ItemsInputNormalizer-DLaD6rTl.d.cts → ItemsInputNormalizer-pLrWwUAP.d.cts} +3 -3
- package/dist/{RunIntentService-CWMMrAP4.d.cts → RunIntentService-BitgkKaT.d.cts} +2 -2
- package/dist/{RunIntentService-BOSGwmqn.d.ts → RunIntentService-DYpqfu6D.d.ts} +2 -2
- package/dist/{agentMcpTypes-DUmniLOY.d.cts → agentMcpTypes-DGIwk6Ue.d.cts} +20 -2
- package/dist/bootstrap/index.cjs +3 -3
- package/dist/bootstrap/index.d.cts +5 -5
- package/dist/bootstrap/index.d.ts +5 -5
- package/dist/bootstrap/index.js +3 -3
- package/dist/{bootstrap-D460dCgS.cjs → bootstrap-BEu1fJBM.cjs} +3 -3
- package/dist/{bootstrap-D460dCgS.cjs.map → bootstrap-BEu1fJBM.cjs.map} +1 -1
- package/dist/{bootstrap-CKTMMNmL.js → bootstrap-CSeInbj1.js} +3 -3
- package/dist/{bootstrap-CKTMMNmL.js.map → bootstrap-CSeInbj1.js.map} +1 -1
- package/dist/browser.cjs +3 -2
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -3
- package/dist/contracts.d.cts +5 -5
- package/dist/contracts.d.ts +2 -2
- package/dist/{di-tO6R7VJV.cjs → di-C-2ep8NZ.cjs} +9 -1
- package/dist/di-C-2ep8NZ.cjs.map +1 -0
- package/dist/{di-DdsgWfVy.js → di-D9Mv3kF3.js} +4 -2
- package/dist/di-D9Mv3kF3.js.map +1 -0
- package/dist/{executionPersistenceContracts-DenJJK2T.d.cts → executionPersistenceContracts-CN9d7AnL.d.cts} +2 -2
- package/dist/{index-BZDhEQ6W.d.ts → index-CqZeNGAp.d.ts} +71 -5
- package/dist/{index-CSKKuK60.d.ts → index-rllWL4r-.d.ts} +20 -2
- package/dist/index.cjs +23 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -8
- package/dist/index.d.ts +5 -5
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/{params-DqRvku2h.d.cts → params-DRUr0F5v.d.cts} +2 -2
- package/dist/{runtime-BPZgnZ9G.js → runtime-6-U2Cou5.js} +81 -4
- package/dist/runtime-6-U2Cou5.js.map +1 -0
- package/dist/{runtime-CyW9c9XM.cjs → runtime-DjYXgOo0.cjs} +81 -4
- package/dist/runtime-DjYXgOo0.cjs.map +1 -0
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +3 -3
- package/package.json +1 -1
- package/src/binaries/DefaultExecutionBinaryServiceFactory.ts +27 -2
- package/src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts +14 -0
- package/src/binaries/boundedReadBinary.types.ts +90 -0
- package/src/contracts/runtimeTypes.ts +19 -0
- package/src/contracts/workspaceFileTypes.ts +73 -0
- package/src/index.ts +2 -0
- package/dist/di-DdsgWfVy.js.map +0 -1
- package/dist/di-tO6R7VJV.cjs.map +0 -1
- package/dist/runtime-BPZgnZ9G.js.map +0 -1
- package/dist/runtime-CyW9c9XM.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_di = require('./di-
|
|
1
|
+
const require_di = require('./di-C-2ep8NZ.cjs');
|
|
2
2
|
let zod = require("zod");
|
|
3
3
|
zod = require_di.__toESM(zod);
|
|
4
4
|
let node_stream_web = require("node:stream/web");
|
|
@@ -895,6 +895,58 @@ var NodeEventPublisher = class {
|
|
|
895
895
|
}
|
|
896
896
|
};
|
|
897
897
|
|
|
898
|
+
//#endregion
|
|
899
|
+
//#region src/binaries/boundedReadBinary.types.ts
|
|
900
|
+
/**
|
|
901
|
+
* Reads all bytes from an already-opened binary stream into a contiguous `Uint8Array`.
|
|
902
|
+
*
|
|
903
|
+
* Safety contract:
|
|
904
|
+
* - `attachment.size` is checked against `maxBytes` *before* any allocation (no OOM).
|
|
905
|
+
* - A single buffer of exactly `attachment.size` is pre-allocated; the stream fills it
|
|
906
|
+
* directly — no chunks array, no doubling.
|
|
907
|
+
* - A byte-count mismatch between the declared size and actual stream content is an error.
|
|
908
|
+
*
|
|
909
|
+
* This is the single canonical implementation; `ExecutionBinaryService.getBytes`,
|
|
910
|
+
* `getText`, and `getJson` all delegate here. The per-package `readBinaryBody` helpers
|
|
911
|
+
* in `core-nodes` and `core-nodes-ocr` have been removed in favour of this function.
|
|
912
|
+
*/
|
|
913
|
+
async function boundedReadBinary(result, attachment, maxBytes = require_di.BINARY_DEFAULT_MAX_BYTES) {
|
|
914
|
+
if (attachment.size > maxBytes) throw new Error(`Binary attachment size ${attachment.size} bytes exceeds maxBytes ${maxBytes}. Raise the node's maxBytes setting if this document is expected to be larger.`);
|
|
915
|
+
const out = new Uint8Array(attachment.size);
|
|
916
|
+
const reader = result.body.getReader();
|
|
917
|
+
let offset = 0;
|
|
918
|
+
while (true) {
|
|
919
|
+
const { done, value } = await reader.read();
|
|
920
|
+
if (done) break;
|
|
921
|
+
if (!value) continue;
|
|
922
|
+
if (offset + value.byteLength > out.byteLength) throw new Error(`Binary stream produced more bytes than the attachment's declared size (${attachment.size}).`);
|
|
923
|
+
out.set(value, offset);
|
|
924
|
+
offset += value.byteLength;
|
|
925
|
+
}
|
|
926
|
+
if (offset !== out.byteLength) throw new Error(`Binary stream produced ${offset} bytes but attachment declared size ${attachment.size}.`);
|
|
927
|
+
return out;
|
|
928
|
+
}
|
|
929
|
+
/** Shared implementation of `getBytes` used by both binary-service classes. */
|
|
930
|
+
async function readBinaryAsBytes(storage, attachment, maxBytes) {
|
|
931
|
+
const result = await storage.openReadStream(attachment.storageKey);
|
|
932
|
+
if (!result) throw new Error("Binary attachment stream is unavailable.");
|
|
933
|
+
return boundedReadBinary(result, attachment, maxBytes);
|
|
934
|
+
}
|
|
935
|
+
/** Shared implementation of `getText` used by both binary-service classes. */
|
|
936
|
+
async function readBinaryAsText(storage, attachment, maxBytes) {
|
|
937
|
+
const bytes = await readBinaryAsBytes(storage, attachment, maxBytes);
|
|
938
|
+
return new TextDecoder().decode(bytes);
|
|
939
|
+
}
|
|
940
|
+
/** Shared implementation of `getJson` used by both binary-service classes. */
|
|
941
|
+
async function readBinaryAsJson(storage, attachment, maxBytes) {
|
|
942
|
+
const text = await readBinaryAsText(storage, attachment, maxBytes);
|
|
943
|
+
try {
|
|
944
|
+
return JSON.parse(text);
|
|
945
|
+
} catch (cause) {
|
|
946
|
+
throw new SyntaxError(`Binary attachment at storage key "${attachment.storageKey}" is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
898
950
|
//#endregion
|
|
899
951
|
//#region src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts
|
|
900
952
|
var DefaultNodeBinaryAttachmentService = class DefaultNodeBinaryAttachmentService {
|
|
@@ -945,6 +997,15 @@ var DefaultNodeBinaryAttachmentService = class DefaultNodeBinaryAttachmentServic
|
|
|
945
997
|
async openReadStream(attachment) {
|
|
946
998
|
return await this.storage.openReadStream(attachment.storageKey);
|
|
947
999
|
}
|
|
1000
|
+
async getBytes(attachment, maxBytes) {
|
|
1001
|
+
return readBinaryAsBytes(this.storage, attachment, maxBytes);
|
|
1002
|
+
}
|
|
1003
|
+
async getText(attachment, maxBytes) {
|
|
1004
|
+
return readBinaryAsText(this.storage, attachment, maxBytes);
|
|
1005
|
+
}
|
|
1006
|
+
async getJson(attachment, maxBytes) {
|
|
1007
|
+
return readBinaryAsJson(this.storage, attachment, maxBytes);
|
|
1008
|
+
}
|
|
948
1009
|
createAttachmentId() {
|
|
949
1010
|
return DefaultNodeBinaryAttachmentService.createAttachmentIdValue(`${this.activationId}-${this.now().getTime()}`);
|
|
950
1011
|
}
|
|
@@ -1008,8 +1069,24 @@ var DefaultExecutionBinaryService = class {
|
|
|
1008
1069
|
forNode(args) {
|
|
1009
1070
|
return new DefaultNodeBinaryAttachmentService(this.storage, this.workflowId, this.runId, args.nodeId, args.activationId, this.now);
|
|
1010
1071
|
}
|
|
1011
|
-
|
|
1012
|
-
return
|
|
1072
|
+
openReadStream(attachment) {
|
|
1073
|
+
return this.storage.openReadStream(attachment.storageKey);
|
|
1074
|
+
}
|
|
1075
|
+
async getBytes(attachment, maxBytes) {
|
|
1076
|
+
const stream = await this.openReadStream(attachment);
|
|
1077
|
+
if (!stream) throw new Error("Binary attachment stream is unavailable.");
|
|
1078
|
+
return boundedReadBinary(stream, attachment, maxBytes);
|
|
1079
|
+
}
|
|
1080
|
+
async getText(attachment, maxBytes) {
|
|
1081
|
+
return new TextDecoder().decode(await this.getBytes(attachment, maxBytes));
|
|
1082
|
+
}
|
|
1083
|
+
async getJson(attachment, maxBytes) {
|
|
1084
|
+
const text = await this.getText(attachment, maxBytes);
|
|
1085
|
+
try {
|
|
1086
|
+
return JSON.parse(text);
|
|
1087
|
+
} catch (cause) {
|
|
1088
|
+
throw new SyntaxError(`Binary attachment at storage key "${attachment.storageKey}" is not valid JSON: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
1089
|
+
}
|
|
1013
1090
|
}
|
|
1014
1091
|
};
|
|
1015
1092
|
|
|
@@ -7056,4 +7133,4 @@ Object.defineProperty(exports, 'tool', {
|
|
|
7056
7133
|
return tool;
|
|
7057
7134
|
}
|
|
7058
7135
|
});
|
|
7059
|
-
//# sourceMappingURL=runtime-
|
|
7136
|
+
//# sourceMappingURL=runtime-DjYXgOo0.cjs.map
|