@mooloo-ai/eutaxy 0.1.0 → 0.2.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/README.md +1 -1
- package/dist/aws.d.mts +15464 -0
- package/dist/aws.d.mts.map +1 -0
- package/dist/aws.mjs +24057 -0
- package/dist/aws.mjs.map +1 -0
- package/dist/bin.mjs +2 -2
- package/dist/checksum-DhS6ofSm.mjs +6049 -0
- package/dist/checksum-DhS6ofSm.mjs.map +1 -0
- package/dist/cli-DnPkIL8h.mjs +2 -0
- package/dist/cli.mjs +2 -2
- package/dist/cloudflare.d.mts +17 -1
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +41 -9
- package/dist/cloudflare.mjs.map +1 -1
- package/dist/es5-DtZuPEgt.mjs +1721 -0
- package/dist/es5-DtZuPEgt.mjs.map +1 -0
- package/dist/event-streams-BANyO9xt.mjs +801 -0
- package/dist/event-streams-BANyO9xt.mjs.map +1 -0
- package/dist/explore-C5fDFOoY.d.mts +63 -0
- package/dist/explore-C5fDFOoY.d.mts.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/{explore-BB77_V0x.d.mts → platform-CGVkTa16.d.mts} +30 -65
- package/dist/platform-CGVkTa16.d.mts.map +1 -0
- package/dist/rolldown-runtime-C1I3wEg2.mjs +43 -0
- package/dist/{src-dP-0Apun.mjs → src-B66we2mG.mjs} +3 -2
- package/dist/{src-dP-0Apun.mjs.map → src-B66we2mG.mjs.map} +1 -1
- package/dist/{src-Bef00JwK.mjs → src-BP6Iqc_9.mjs} +3 -88
- package/dist/src-BP6Iqc_9.mjs.map +1 -0
- package/dist/{src-Dn3Lm5Us.mjs → src-BrCsF5RZ.mjs} +223 -28
- package/dist/src-BrCsF5RZ.mjs.map +1 -0
- package/dist/src-s6uYyC0B.mjs +89 -0
- package/dist/src-s6uYyC0B.mjs.map +1 -0
- package/dist/verdict-evEM5Gxx.mjs +12 -0
- package/dist/verdict-evEM5Gxx.mjs.map +1 -0
- package/package.json +20 -3
- package/dist/cli-DTuDOgGM.mjs +0 -2
- package/dist/explore-BB77_V0x.d.mts.map +0 -1
- package/dist/src-Bef00JwK.mjs.map +0 -1
- package/dist/src-Dn3Lm5Us.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-streams-BANyO9xt.mjs","names":["Crc32","Crc32","EventStreamMarshaller","UniversalEventStreamMarshaller"],"sources":["../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/MessageDecoderStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/MessageEncoderStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageDecoderStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageEncoderStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getChunkedStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/getUnmarshalledStream.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde-universal/EventStreamMarshaller.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/EventStreamMarshaller.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js","../../../node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/index.js"],"sourcesContent":["import { toHex } from \"@smithy/core/serde\";\nexport class Int64 {\n bytes;\n constructor(bytes) {\n this.bytes = bytes;\n if (bytes.byteLength !== 8) {\n throw new Error(\"Int64 buffers must be exactly 8 bytes\");\n }\n }\n static fromNumber(number) {\n if (number > 9_223_372_036_854_775_807 || number < -9_223_372_036_854_775_808) {\n throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);\n }\n const bytes = new Uint8Array(8);\n for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {\n bytes[i] = remaining;\n }\n if (number < 0) {\n negate(bytes);\n }\n return new Int64(bytes);\n }\n valueOf() {\n const bytes = this.bytes.slice(0);\n const negative = bytes[0] & 0b10000000;\n if (negative) {\n negate(bytes);\n }\n return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);\n }\n toString() {\n return String(this.valueOf());\n }\n}\nfunction negate(bytes) {\n for (let i = 0; i < 8; i++) {\n bytes[i] ^= 0xff;\n }\n for (let i = 7; i > -1; i--) {\n bytes[i]++;\n if (bytes[i] !== 0)\n break;\n }\n}\n","import { hasOwn } from \"@smithy/core/transport\";\nimport { fromHex, toHex } from \"@smithy/core/serde\";\nimport { Int64 } from \"./Int64\";\nexport class HeaderMarshaller {\n toUtf8;\n fromUtf8;\n constructor(toUtf8, fromUtf8) {\n this.toUtf8 = toUtf8;\n this.fromUtf8 = fromUtf8;\n }\n format(headers) {\n const chunks = [];\n for (const headerName in headers) {\n if (!hasOwn(headers, headerName))\n continue;\n const bytes = this.fromUtf8(headerName);\n if (bytes.byteLength > 255) {\n throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);\n }\n chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));\n }\n const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));\n let position = 0;\n for (const chunk of chunks) {\n out.set(chunk, position);\n position += chunk.byteLength;\n }\n return out;\n }\n formatHeaderValue(header) {\n switch (header.type) {\n case \"boolean\":\n return Uint8Array.from([header.value ? 0 : 1]);\n case \"byte\":\n return Uint8Array.from([2, header.value]);\n case \"short\":\n const shortView = new DataView(new ArrayBuffer(3));\n shortView.setUint8(0, 3);\n shortView.setInt16(1, header.value, false);\n return new Uint8Array(shortView.buffer);\n case \"integer\":\n const intView = new DataView(new ArrayBuffer(5));\n intView.setUint8(0, 4);\n intView.setInt32(1, header.value, false);\n return new Uint8Array(intView.buffer);\n case \"long\":\n const longBytes = new Uint8Array(9);\n longBytes[0] = 5;\n longBytes.set(header.value.bytes, 1);\n return longBytes;\n case \"binary\":\n if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {\n throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);\n }\n const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));\n binView.setUint8(0, 6);\n binView.setUint16(1, header.value.byteLength, false);\n const binBytes = new Uint8Array(binView.buffer);\n binBytes.set(header.value, 3);\n return binBytes;\n case \"string\":\n const utf8Bytes = this.fromUtf8(header.value);\n if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {\n throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);\n }\n const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));\n strView.setUint8(0, 7);\n strView.setUint16(1, utf8Bytes.byteLength, false);\n const strBytes = new Uint8Array(strView.buffer);\n strBytes.set(utf8Bytes, 3);\n return strBytes;\n case \"timestamp\":\n const tsBytes = new Uint8Array(9);\n tsBytes[0] = 8;\n tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);\n return tsBytes;\n case \"uuid\":\n if (!UUID_PATTERN.test(header.value)) {\n throw new Error(`Invalid UUID received: ${header.value}`);\n }\n const uuidBytes = new Uint8Array(17);\n uuidBytes[0] = 9;\n uuidBytes.set(fromHex(header.value.replace(/-/g, \"\")), 1);\n return uuidBytes;\n }\n }\n parse(headers) {\n const out = {};\n let position = 0;\n while (position < headers.byteLength) {\n const nameLength = headers.getUint8(position++);\n const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));\n position += nameLength;\n switch (headers.getUint8(position++)) {\n case 0:\n out[name] = {\n type: BOOLEAN_TAG,\n value: true,\n };\n break;\n case 1:\n out[name] = {\n type: BOOLEAN_TAG,\n value: false,\n };\n break;\n case 2:\n out[name] = {\n type: BYTE_TAG,\n value: headers.getInt8(position++),\n };\n break;\n case 3:\n out[name] = {\n type: SHORT_TAG,\n value: headers.getInt16(position, false),\n };\n position += 2;\n break;\n case 4:\n out[name] = {\n type: INT_TAG,\n value: headers.getInt32(position, false),\n };\n position += 4;\n break;\n case 5:\n out[name] = {\n type: LONG_TAG,\n value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),\n };\n position += 8;\n break;\n case 6:\n const binaryLength = headers.getUint16(position, false);\n position += 2;\n out[name] = {\n type: BINARY_TAG,\n value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength),\n };\n position += binaryLength;\n break;\n case 7:\n const stringLength = headers.getUint16(position, false);\n position += 2;\n out[name] = {\n type: STRING_TAG,\n value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength)),\n };\n position += stringLength;\n break;\n case 8:\n out[name] = {\n type: TIMESTAMP_TAG,\n value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),\n };\n position += 8;\n break;\n case 9:\n const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);\n position += 16;\n out[name] = {\n type: UUID_TAG,\n value: `${toHex(uuidBytes.subarray(0, 4))}-${toHex(uuidBytes.subarray(4, 6))}-${toHex(uuidBytes.subarray(6, 8))}-${toHex(uuidBytes.subarray(8, 10))}-${toHex(uuidBytes.subarray(10))}`,\n };\n break;\n default:\n throw new Error(`Unrecognized header type tag`);\n }\n }\n return out;\n }\n}\nvar HEADER_VALUE_TYPE;\n(function (HEADER_VALUE_TYPE) {\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"boolTrue\"] = 0] = \"boolTrue\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"boolFalse\"] = 1] = \"boolFalse\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"byte\"] = 2] = \"byte\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"short\"] = 3] = \"short\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"integer\"] = 4] = \"integer\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"long\"] = 5] = \"long\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"byteArray\"] = 6] = \"byteArray\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"string\"] = 7] = \"string\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"timestamp\"] = 8] = \"timestamp\";\n HEADER_VALUE_TYPE[HEADER_VALUE_TYPE[\"uuid\"] = 9] = \"uuid\";\n})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));\nconst BOOLEAN_TAG = \"boolean\";\nconst BYTE_TAG = \"byte\";\nconst SHORT_TAG = \"short\";\nconst INT_TAG = \"integer\";\nconst LONG_TAG = \"long\";\nconst BINARY_TAG = \"binary\";\nconst STRING_TAG = \"string\";\nconst TIMESTAMP_TAG = \"timestamp\";\nconst UUID_TAG = \"uuid\";\nconst UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;\nconst MAX_HEADER_VALUE_BYTES = 32767;\n","import { Crc32 } from \"@smithy/core/checksum\";\nconst PRELUDE_MEMBER_LENGTH = 4;\nconst PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;\nconst CHECKSUM_LENGTH = 4;\nconst MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;\nexport function splitMessage({ byteLength, byteOffset, buffer }) {\n if (byteLength < MINIMUM_MESSAGE_LENGTH) {\n throw new Error(\"Provided message too short to accommodate event stream message overhead\");\n }\n const view = new DataView(buffer, byteOffset, byteLength);\n const messageLength = view.getUint32(0, false);\n if (byteLength !== messageLength) {\n throw new Error(\"Reported message length does not match received message length\");\n }\n const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);\n const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);\n const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);\n const checksummer = new Crc32();\n checksummer.update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));\n if (expectedPreludeChecksum !== checksummer.digestSync()) {\n throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digestSync()})`);\n }\n checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));\n if (expectedMessageChecksum !== checksummer.digestSync()) {\n throw new Error(`The message checksum (${checksummer.digestSync()}) did not match the expected value of ${expectedMessageChecksum}`);\n }\n return {\n headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),\n body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH)),\n };\n}\n","import { Crc32 } from \"@smithy/core/checksum\";\nimport { HeaderMarshaller } from \"./HeaderMarshaller\";\nimport { splitMessage } from \"./splitMessage\";\nexport class EventStreamCodec {\n headerMarshaller;\n messageBuffer;\n isEndOfStream;\n constructor(toUtf8, fromUtf8) {\n this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);\n this.messageBuffer = [];\n this.isEndOfStream = false;\n }\n feed(message) {\n this.messageBuffer.push(this.decode(message));\n }\n endOfStream() {\n this.isEndOfStream = true;\n }\n getMessage() {\n const message = this.messageBuffer.pop();\n const isEndOfStream = this.isEndOfStream;\n return {\n getMessage() {\n return message;\n },\n isEndOfStream() {\n return isEndOfStream;\n },\n };\n }\n getAvailableMessages() {\n const messages = this.messageBuffer;\n this.messageBuffer = [];\n const isEndOfStream = this.isEndOfStream;\n return {\n getMessages() {\n return messages;\n },\n isEndOfStream() {\n return isEndOfStream;\n },\n };\n }\n encode({ headers: rawHeaders, body }) {\n const headers = this.headerMarshaller.format(rawHeaders);\n const length = headers.byteLength + body.byteLength + 16;\n const out = new Uint8Array(length);\n const view = new DataView(out.buffer, out.byteOffset, out.byteLength);\n const checksum = new Crc32();\n view.setUint32(0, length, false);\n view.setUint32(4, headers.byteLength, false);\n checksum.update(out.subarray(0, 8));\n view.setUint32(8, checksum.digestSync(), false);\n out.set(headers, 12);\n out.set(body, headers.byteLength + 12);\n checksum.update(out.subarray(8, length - 4));\n view.setUint32(length - 4, checksum.digestSync(), false);\n return out;\n }\n decode(message) {\n const { headers, body } = splitMessage(message);\n return { headers: this.headerMarshaller.parse(headers), body };\n }\n formatHeaders(rawHeaders) {\n return this.headerMarshaller.format(rawHeaders);\n }\n}\n","export class MessageDecoderStream {\n options;\n constructor(options) {\n this.options = options;\n }\n [Symbol.asyncIterator]() {\n return this.asyncIterator();\n }\n async *asyncIterator() {\n for await (const bytes of this.options.inputStream) {\n const decoded = this.options.decoder.decode(bytes);\n yield decoded;\n }\n }\n}\n","export class MessageEncoderStream {\n options;\n constructor(options) {\n this.options = options;\n }\n [Symbol.asyncIterator]() {\n return this.asyncIterator();\n }\n async *asyncIterator() {\n for await (const msg of this.options.messageStream) {\n const encoded = this.options.encoder.encode(msg);\n yield encoded;\n }\n if (this.options.includeEndFrame) {\n yield new Uint8Array(0);\n }\n }\n}\n","export class SmithyMessageDecoderStream {\n options;\n constructor(options) {\n this.options = options;\n }\n [Symbol.asyncIterator]() {\n return this.asyncIterator();\n }\n async *asyncIterator() {\n for await (const message of this.options.messageStream) {\n const deserialized = await this.options.deserializer(message);\n if (deserialized === undefined)\n continue;\n yield deserialized;\n }\n }\n}\n","export class SmithyMessageEncoderStream {\n options;\n constructor(options) {\n this.options = options;\n }\n [Symbol.asyncIterator]() {\n return this.asyncIterator();\n }\n async *asyncIterator() {\n for await (const chunk of this.options.inputStream) {\n const payloadBuf = this.options.serializer(chunk);\n yield payloadBuf;\n }\n }\n}\n","export function getChunkedStream(source) {\n let currentMessageTotalLength = 0;\n let currentMessagePendingLength = 0;\n let currentMessage = null;\n let messageLengthBuffer = null;\n const allocateMessage = (size) => {\n if (typeof size !== \"number\") {\n throw new Error(\"Attempted to allocate an event message where size was not a number: \" + size);\n }\n currentMessageTotalLength = size;\n currentMessagePendingLength = 4;\n currentMessage = new Uint8Array(size);\n const currentMessageView = new DataView(currentMessage.buffer);\n currentMessageView.setUint32(0, size, false);\n };\n const iterator = async function* () {\n const sourceIterator = source[Symbol.asyncIterator]();\n while (true) {\n const { value, done } = await sourceIterator.next();\n if (done) {\n if (!currentMessageTotalLength) {\n return;\n }\n else if (currentMessageTotalLength === currentMessagePendingLength) {\n yield currentMessage;\n }\n else {\n throw new Error(\"Truncated event message received.\");\n }\n return;\n }\n const chunkLength = value.length;\n let currentOffset = 0;\n while (currentOffset < chunkLength) {\n if (!currentMessage) {\n const bytesRemaining = chunkLength - currentOffset;\n if (!messageLengthBuffer) {\n messageLengthBuffer = new Uint8Array(4);\n }\n const numBytesForTotal = Math.min(4 - currentMessagePendingLength, bytesRemaining);\n messageLengthBuffer.set(value.slice(currentOffset, currentOffset + numBytesForTotal), currentMessagePendingLength);\n currentMessagePendingLength += numBytesForTotal;\n currentOffset += numBytesForTotal;\n if (currentMessagePendingLength < 4) {\n break;\n }\n allocateMessage(new DataView(messageLengthBuffer.buffer).getUint32(0, false));\n messageLengthBuffer = null;\n }\n const numBytesToWrite = Math.min(currentMessageTotalLength - currentMessagePendingLength, chunkLength - currentOffset);\n currentMessage.set(value.slice(currentOffset, currentOffset + numBytesToWrite), currentMessagePendingLength);\n currentMessagePendingLength += numBytesToWrite;\n currentOffset += numBytesToWrite;\n if (currentMessageTotalLength && currentMessageTotalLength === currentMessagePendingLength) {\n yield currentMessage;\n currentMessage = null;\n currentMessageTotalLength = 0;\n currentMessagePendingLength = 0;\n }\n }\n }\n };\n return {\n [Symbol.asyncIterator]: iterator,\n };\n}\n","export function getUnmarshalledStream(source, options) {\n const messageUnmarshaller = getMessageUnmarshaller(options.deserializer, options.toUtf8);\n return {\n [Symbol.asyncIterator]: async function* () {\n for await (const chunk of source) {\n const message = options.eventStreamCodec.decode(chunk);\n const type = await messageUnmarshaller(message);\n if (type === undefined)\n continue;\n yield type;\n }\n },\n };\n}\nexport function getMessageUnmarshaller(deserializer, toUtf8) {\n return async function (message) {\n const { value: messageType } = message.headers[\":message-type\"];\n if (messageType === \"error\") {\n const unmodeledError = new Error(message.headers[\":error-message\"].value || \"UnknownError\");\n unmodeledError.name = message.headers[\":error-code\"].value;\n throw unmodeledError;\n }\n else if (messageType === \"exception\") {\n const code = message.headers[\":exception-type\"].value;\n const exception = { [code]: message };\n const deserializedException = await deserializer(exception);\n if (deserializedException.$unknown) {\n const error = new Error(toUtf8(message.body));\n error.name = code;\n throw error;\n }\n throw deserializedException[code];\n }\n else if (messageType === \"event\") {\n const event = {\n [message.headers[\":event-type\"].value]: message,\n };\n const deserialized = await deserializer(event);\n if (deserialized.$unknown)\n return;\n return deserialized;\n }\n else {\n throw Error(`Unrecognizable event type: ${message.headers[\":event-type\"].value}`);\n }\n };\n}\n","import { EventStreamCodec } from \"../eventstream-codec/EventStreamCodec\";\nimport { MessageDecoderStream } from \"../eventstream-codec/MessageDecoderStream\";\nimport { MessageEncoderStream } from \"../eventstream-codec/MessageEncoderStream\";\nimport { SmithyMessageDecoderStream } from \"../eventstream-codec/SmithyMessageDecoderStream\";\nimport { SmithyMessageEncoderStream } from \"../eventstream-codec/SmithyMessageEncoderStream\";\nimport { getChunkedStream } from \"./getChunkedStream\";\nimport { getMessageUnmarshaller } from \"./getUnmarshalledStream\";\nexport class EventStreamMarshaller {\n eventStreamCodec;\n utfEncoder;\n constructor({ utf8Encoder, utf8Decoder }) {\n this.eventStreamCodec = new EventStreamCodec(utf8Encoder, utf8Decoder);\n this.utfEncoder = utf8Encoder;\n }\n deserialize(body, deserializer) {\n const inputStream = getChunkedStream(body);\n return new SmithyMessageDecoderStream({\n messageStream: new MessageDecoderStream({ inputStream, decoder: this.eventStreamCodec }),\n deserializer: getMessageUnmarshaller(deserializer, this.utfEncoder),\n });\n }\n serialize(inputStream, serializer) {\n return new MessageEncoderStream({\n messageStream: new SmithyMessageEncoderStream({ inputStream, serializer }),\n encoder: this.eventStreamCodec,\n includeEndFrame: true,\n });\n }\n}\nexport const eventStreamSerdeProvider = (options) => new EventStreamMarshaller(options);\n","import { Readable } from \"node:stream\";\nimport { EventStreamMarshaller as UniversalEventStreamMarshaller } from \"../eventstream-serde-universal/EventStreamMarshaller\";\nexport class EventStreamMarshaller {\n universalMarshaller;\n constructor({ utf8Encoder, utf8Decoder }) {\n this.universalMarshaller = new UniversalEventStreamMarshaller({\n utf8Decoder,\n utf8Encoder,\n });\n }\n deserialize(body, deserializer) {\n const bodyIterable = typeof body[Symbol.asyncIterator] === \"function\" ? body : readableToIterable(body);\n return this.universalMarshaller.deserialize(bodyIterable, deserializer);\n }\n serialize(input, serializer) {\n return Readable.from(this.universalMarshaller.serialize(input, serializer));\n }\n}\nexport const eventStreamSerdeProvider = (options) => new EventStreamMarshaller(options);\nexport async function* readableToIterable(readStream) {\n let streamEnded = false;\n let generationEnded = false;\n const records = new Array();\n readStream.on(\"error\", (err) => {\n if (!streamEnded) {\n streamEnded = true;\n }\n if (err) {\n throw err;\n }\n });\n readStream.on(\"data\", (data) => {\n records.push(data);\n });\n readStream.on(\"end\", () => {\n streamEnded = true;\n });\n while (!generationEnded) {\n const value = await new Promise((resolve) => setTimeout(() => resolve(records.shift()), 0));\n if (value) {\n yield value;\n }\n generationEnded = streamEnded && records.length === 0;\n }\n}\n","import { hasOwn } from \"@smithy/core/transport\";\nimport { TypeRegistry } from \"@smithy/core/schema\";\nimport { fromUtf8, toUtf8 } from \"@smithy/core/serde\";\nexport class EventStreamSerde {\n marshaller;\n serializer;\n deserializer;\n serdeContext;\n defaultContentType;\n compositeErrorRegistry;\n constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, compositeErrorRegistry, }) {\n this.marshaller = marshaller;\n this.serializer = serializer;\n this.deserializer = deserializer;\n this.serdeContext = serdeContext;\n this.defaultContentType = defaultContentType;\n this.compositeErrorRegistry = compositeErrorRegistry;\n }\n async serializeEventStream({ eventStream, requestSchema, initialRequest, initialMessageType, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = requestSchema.getEventStreamMember();\n const unionSchema = requestSchema.getMemberSchema(eventStreamMember);\n const serializer = this.serializer;\n const defaultContentType = this.defaultContentType;\n const initialRequestMarker = Symbol(\"initialRequestMarker\");\n const eventStreamIterable = {\n async *[Symbol.asyncIterator]() {\n if (initialRequest) {\n const headers = {\n \":event-type\": { type: \"string\", value: initialMessageType ?? \"initial-request\" },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: defaultContentType },\n };\n serializer.write(requestSchema, initialRequest);\n const body = serializer.flush();\n yield {\n [initialRequestMarker]: true,\n headers,\n body,\n };\n }\n for await (const page of eventStream) {\n yield page;\n }\n },\n };\n return marshaller.serialize(eventStreamIterable, (event) => {\n if (event[initialRequestMarker]) {\n return {\n headers: event.headers,\n body: event.body,\n };\n }\n let unionMember = \"\";\n for (const key in event) {\n if (!hasOwn(event, key))\n continue;\n if (key !== \"__type\") {\n unionMember = key;\n break;\n }\n }\n const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);\n const headers = {\n \":event-type\": { type: \"string\", value: eventType },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: explicitPayloadContentType ?? defaultContentType },\n ...additionalHeaders,\n };\n return {\n headers,\n body,\n };\n });\n }\n async deserializeEventStream({ response, responseSchema, initialResponseContainer, initialMessageType, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = responseSchema.getEventStreamMember();\n const unionSchema = responseSchema.getMemberSchema(eventStreamMember);\n const memberSchemas = unionSchema.getMemberSchemas();\n const initialResponseMarker = Symbol(\"initialResponseMarker\");\n const asyncIterable = marshaller.deserialize(response.body, async (event) => {\n let unionMember = \"\";\n for (const key in event) {\n if (!hasOwn(event, key))\n continue;\n if (key !== \"__type\") {\n unionMember = key;\n break;\n }\n }\n const body = event[unionMember].body;\n if (unionMember === (initialMessageType ?? \"initial-response\")) {\n const dataObject = await this.deserializer.read(responseSchema, body);\n delete dataObject[eventStreamMember];\n return {\n [initialResponseMarker]: true,\n ...dataObject,\n };\n }\n else if (unionMember in memberSchemas) {\n const eventStreamSchema = memberSchemas[unionMember];\n if (eventStreamSchema.isStructSchema()) {\n const out = {};\n let hasBindings = false;\n for (const [name, member] of eventStreamSchema.structIterator()) {\n const { eventHeader, eventPayload } = member.getMergedTraits();\n hasBindings = hasBindings || Boolean(eventHeader || eventPayload);\n if (eventPayload) {\n if (member.isBlobSchema()) {\n out[name] = body;\n }\n else if (member.isStringSchema()) {\n out[name] = (this.serdeContext?.utf8Encoder ?? toUtf8)(body);\n }\n else if (member.isStructSchema()) {\n out[name] = await this.deserializer.read(member, body);\n }\n }\n else if (eventHeader) {\n const value = event[unionMember].headers[name]?.value;\n if (value != null) {\n if (member.isNumericSchema()) {\n if (value && typeof value === \"object\" && \"bytes\" in value) {\n out[name] = BigInt(value.toString());\n }\n else {\n out[name] = Number(value);\n }\n }\n else {\n out[name] = value;\n }\n }\n }\n }\n return {\n [unionMember]: await this.readEventMember(eventStreamSchema, body, hasBindings, out),\n };\n }\n return {\n [unionMember]: await this.deserializer.read(eventStreamSchema, body),\n };\n }\n else {\n return {\n $unknown: event,\n };\n }\n });\n const asyncIterator = asyncIterable[Symbol.asyncIterator]();\n const firstEvent = await asyncIterator.next();\n if (firstEvent.done) {\n return asyncIterable;\n }\n if (firstEvent.value?.[initialResponseMarker]) {\n if (!responseSchema) {\n throw new Error(\"@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.\");\n }\n for (const key in firstEvent.value) {\n if (!hasOwn(firstEvent.value, key))\n continue;\n initialResponseContainer[key] = firstEvent.value[key];\n }\n }\n return {\n async *[Symbol.asyncIterator]() {\n if (!firstEvent?.value?.[initialResponseMarker]) {\n yield firstEvent.value;\n }\n while (true) {\n const { done, value } = await asyncIterator.next();\n if (done) {\n break;\n }\n yield value;\n }\n },\n };\n }\n async readEventMember(eventStreamSchema, body, hasBindings, out) {\n let ErrCtor;\n const staticStructuralSchema = eventStreamSchema.getSchema();\n if (Array.isArray(staticStructuralSchema) && staticStructuralSchema[0] === -3) {\n const namespace = staticStructuralSchema[1];\n const nsRegistry = TypeRegistry.for(namespace);\n this.compositeErrorRegistry?.copyFrom(nsRegistry);\n ErrCtor = (this.compositeErrorRegistry ?? nsRegistry)?.getErrorCtor(staticStructuralSchema);\n }\n const dataObject = hasBindings\n ? out\n : body.byteLength === 0\n ? {}\n : await this.deserializer.read(eventStreamSchema, body);\n if (ErrCtor) {\n const message = dataObject.message ?? dataObject.Message ?? \"Unknown\";\n const metadata = {};\n const $fault = eventStreamSchema.getMergedTraits().error;\n if ($fault) {\n metadata.$fault = $fault;\n }\n return Object.assign(new ErrCtor({}), metadata, {\n message,\n }, dataObject);\n }\n return dataObject;\n }\n writeEventBody(unionMember, unionSchema, event) {\n const serializer = this.serializer;\n let eventType = unionMember;\n let explicitPayloadMember = null;\n let explicitPayloadContentType;\n const isKnownSchema = (() => {\n const struct = unionSchema.getSchema();\n return struct[4].includes(unionMember);\n })();\n const additionalHeaders = {};\n if (!isKnownSchema) {\n const [type, value] = event[unionMember];\n eventType = type;\n serializer.write(15, value);\n }\n else {\n const eventSchema = unionSchema.getMemberSchema(unionMember);\n if (eventSchema.isStructSchema()) {\n for (const [memberName, memberSchema] of eventSchema.structIterator()) {\n const { eventHeader, eventPayload } = memberSchema.getMergedTraits();\n if (eventPayload) {\n explicitPayloadMember = memberName;\n }\n else if (eventHeader) {\n const value = event[unionMember][memberName];\n let type = \"binary\";\n if (memberSchema.isNumericSchema()) {\n if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {\n type = \"integer\";\n }\n else {\n type = \"long\";\n }\n }\n else if (memberSchema.isTimestampSchema()) {\n type = \"timestamp\";\n }\n else if (memberSchema.isStringSchema()) {\n type = \"string\";\n }\n else if (memberSchema.isBooleanSchema()) {\n type = \"boolean\";\n }\n if (value != null) {\n additionalHeaders[memberName] = {\n type,\n value,\n };\n delete event[unionMember][memberName];\n }\n }\n }\n if (explicitPayloadMember !== null) {\n const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);\n if (payloadSchema.isBlobSchema()) {\n explicitPayloadContentType = \"application/octet-stream\";\n }\n else if (payloadSchema.isStringSchema()) {\n explicitPayloadContentType = \"text/plain\";\n }\n serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);\n }\n else {\n serializer.write(eventSchema, event[unionMember]);\n }\n }\n else if (eventSchema.isUnitSchema()) {\n serializer.write(eventSchema, {});\n }\n else {\n throw new Error(\"@smithy/core/event-streams - non-struct member not supported in event stream union.\");\n }\n }\n const messageSerialization = serializer.flush() ?? new Uint8Array();\n const body = typeof messageSerialization === \"string\"\n ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization)\n : messageSerialization;\n return {\n body,\n eventType,\n explicitPayloadContentType,\n additionalHeaders,\n };\n }\n}\n","export { EventStreamCodec } from \"./eventstream-codec/EventStreamCodec\";\nexport { HeaderMarshaller } from \"./eventstream-codec/HeaderMarshaller\";\nexport { Int64 } from \"./eventstream-codec/Int64\";\nexport { MessageDecoderStream } from \"./eventstream-codec/MessageDecoderStream\";\nexport { MessageEncoderStream } from \"./eventstream-codec/MessageEncoderStream\";\nexport { SmithyMessageDecoderStream } from \"./eventstream-codec/SmithyMessageDecoderStream\";\nexport { SmithyMessageEncoderStream } from \"./eventstream-codec/SmithyMessageEncoderStream\";\nexport { EventStreamMarshaller, eventStreamSerdeProvider } from \"./eventstream-serde/EventStreamMarshaller\";\nexport { readableStreamToIterable, iterableToReadableStream } from \"./eventstream-serde/utils\";\nexport { EventStreamMarshaller as UniversalEventStreamMarshaller, eventStreamSerdeProvider as universalEventStreamSerdeProvider, } from \"./eventstream-serde-universal/EventStreamMarshaller\";\nexport { getChunkedStream } from \"./eventstream-serde-universal/getChunkedStream\";\nexport { getUnmarshalledStream, getMessageUnmarshaller } from \"./eventstream-serde-universal/getUnmarshalledStream\";\nexport { resolveEventStreamSerdeConfig } from \"./eventstream-serde-config-resolver/EventStreamSerdeConfig\";\nexport { EventStreamSerde } from \"./EventStreamSerde\";\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"mappings":";;;;AAkCA,SAAS,OAAO,OAAO;CACnB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACnB,MAAM,MAAM;CAEhB,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK;EACzB,MAAM,EAAE;EACR,IAAI,MAAM,OAAO,GACb;CACR;AACJ;;;CA3C0C,WAAA;CAC7B,QAAb,MAAa,MAAM;EACf;EACA,YAAY,OAAO;GACf,KAAK,QAAQ;GACb,IAAI,MAAM,eAAe,GACrB,MAA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
|
1
|
+
import { C as Schedule, n as Platform, o as ScenarioSpec, r as Bounds, v as Violation, w as EffectLog } from "./platform-CGVkTa16.mjs";
|
|
2
|
+
interface BoundsReached {
|
|
3
|
+
readonly runs: number;
|
|
4
|
+
readonly effectPoints: number;
|
|
5
|
+
readonly faultsInjected: number;
|
|
6
|
+
readonly elapsedMs: number;
|
|
7
|
+
}
|
|
8
|
+
interface VerdictBase {
|
|
9
|
+
readonly scenario: string;
|
|
10
|
+
readonly seed: number | string;
|
|
11
|
+
readonly reached: BoundsReached;
|
|
12
|
+
readonly assumptions: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
interface Shrunk {
|
|
15
|
+
readonly faultsRemoved: number;
|
|
16
|
+
readonly eventsRemoved: number;
|
|
17
|
+
readonly runs: number;
|
|
18
|
+
}
|
|
19
|
+
interface Violated extends VerdictBase {
|
|
20
|
+
readonly kind: "VIOLATED";
|
|
21
|
+
readonly violation: Violation;
|
|
22
|
+
/** The replayed, shrunk trace that breaks the invariant. */
|
|
23
|
+
readonly trace: EffectLog;
|
|
24
|
+
readonly schedule: Schedule;
|
|
25
|
+
/** Ids of the drive's events that remain after shrinking. */
|
|
26
|
+
readonly keptEvents: readonly string[];
|
|
27
|
+
readonly shrunk: Shrunk;
|
|
28
|
+
}
|
|
29
|
+
interface Bounded extends VerdictBase {
|
|
30
|
+
readonly kind: "BOUNDED";
|
|
31
|
+
readonly bounds: Bounds;
|
|
32
|
+
}
|
|
33
|
+
type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
|
|
34
|
+
interface Unsupported extends VerdictBase {
|
|
35
|
+
readonly kind: "UNSUPPORTED";
|
|
36
|
+
readonly cause: UnsupportedCause;
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
}
|
|
39
|
+
type ScenarioVerdict = Violated | Bounded | Unsupported;
|
|
40
|
+
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
41
|
+
declare function describeVerdict(v: ScenarioVerdict): string;
|
|
42
|
+
interface ExploreOptions {
|
|
43
|
+
readonly seed: number | string;
|
|
44
|
+
/** Hard cap on runs, in addition to the scenario's time budget. */
|
|
45
|
+
readonly maxRuns?: number;
|
|
46
|
+
/** Probability of injecting at an eligible effect point. */
|
|
47
|
+
readonly faultProbability?: number;
|
|
48
|
+
/** Clock for the time budget; injectable for tests. */
|
|
49
|
+
readonly now?: () => number;
|
|
50
|
+
/** Hard cap on replay runs spent shrinking a violation. */
|
|
51
|
+
readonly maxShrinkRuns?: number;
|
|
52
|
+
/**
|
|
53
|
+
* How many of the first exploration runs to replay in reverse order
|
|
54
|
+
* before reporting BOUNDED, to detect module-level state leaking between
|
|
55
|
+
* runs. 0 disables the pass.
|
|
56
|
+
*/
|
|
57
|
+
readonly leakCheckRuns?: number;
|
|
58
|
+
}
|
|
59
|
+
/** Re-run a recorded schedule exactly. */
|
|
60
|
+
declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
|
|
61
|
+
declare function explore(spec: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
|
|
62
|
+
export { BoundsReached as a, Violated as c, Bounded as i, describeVerdict as l, explore as n, ScenarioVerdict as o, replay as r, Unsupported as s, ExploreOptions as t };
|
|
63
|
+
//# sourceMappingURL=explore-C5fDFOoY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore-C5fDFOoY.d.mts","names":[],"sources":["../../core/src/verdict.ts","../../engine/src/explore.ts"],"mappings":";UAOiB;WACN;WACA;WACA;WACA;;UAGD;WACC;WACA;WACA,SAAS;WACT;;UAGM;WACN;WACA;WACA;;UAGM,iBAAiB;WACvB;WACA,WAAW;;WAEX,OAAO;WACP,UAAU;;WAEV;WACA,QAAQ;;UAGF,gBAAgB;WACtB;WACA,QAAQ;;KAGP;UAMK,oBAAoB;WAC1B;WACA,OAAO;WACP;;KAGC,kBAAkB,WAAW,UAAU;;iBAGnC,gBAAgB,GAAG;UCnClB;WACN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;;iBAuDW,OACpB,MAAM,cACN,UAAU,UACV,UAAU,WACT,QAAQ;iBAIW,QACpB,MAAM,cACN,UAAU,UACV,SAAS,iBACR,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Schedule, S as FaultKind, T as EffectRecord, _ as StateQuery, b as checkInvariants, d as AtMostOncePerKey, f as EffectSelector, g as RowCondition, h as Invariant, l as validateScenario, m as Implies, n as Platform, o as ScenarioSpec, p as EveryRow, r as Bounds, t as EventRef, u as AtLeastOnce, v as Violation, w as EffectLog, x as FaultDecision, y as checkInvariant } from "./platform-CGVkTa16.mjs";
|
|
2
|
+
import { a as BoundsReached, c as Violated, i as Bounded, l as describeVerdict, n as explore, o as ScenarioVerdict, r as replay, s as Unsupported, t as ExploreOptions } from "./explore-C5fDFOoY.mjs";
|
|
2
3
|
/** The scenario restricted to the kept events, with per-message invariants re-derived. */
|
|
3
4
|
export declare function restrictSpec(platform: Platform, spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
|
|
4
5
|
interface RegressionTestOptions {
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../engine/src/shrink.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../engine/src/shrink.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":";;;wBAsCgB,aACd,UAAU,UACV,MAAM,cACN,6BACC;UC7Bc;;WAEN;;WAEA;;WAEA;;WAEA;WACA;;wBAGK,mBAAmB,SAAS,UAAU,SAAS;;wBCf/C,WAAW,SAAS;;wBAiBpB,YAAY,KAAK,WAAW;;wBAuB5B,WAAW,SAAS"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "./src-s6uYyC0B.mjs";
|
|
2
|
+
import { d as validateScenario, f as checkInvariant, n as replay, p as checkInvariants, r as restrictSpec, t as explore } from "./src-BrCsF5RZ.mjs";
|
|
3
|
+
import { t as describeVerdict } from "./verdict-evEM5Gxx.mjs";
|
|
4
|
+
import { i as emitRegressionTest, n as renderText, r as renderTrace, t as renderJson } from "./src-BP6Iqc_9.mjs";
|
|
3
5
|
export { checkInvariant, checkInvariants, describeVerdict, emitRegressionTest, explore, renderJson, renderText, renderTrace, replay, restrictSpec, validateScenario };
|
|
@@ -145,15 +145,38 @@ interface WorkerRef {
|
|
|
145
145
|
readonly entry: string;
|
|
146
146
|
readonly config: string;
|
|
147
147
|
}
|
|
148
|
-
/**
|
|
148
|
+
/** A scripted reply from an external: the first matching entry answers a request. */
|
|
149
|
+
interface ScriptedResponse {
|
|
150
|
+
/** HTTP method to match; any when absent. */
|
|
151
|
+
readonly method?: string;
|
|
152
|
+
/** URL path to match exactly, or a prefix when it ends with "*"; any when absent. */
|
|
153
|
+
readonly path?: string;
|
|
154
|
+
readonly status: number;
|
|
155
|
+
readonly headers?: {
|
|
156
|
+
readonly [name: string]: string;
|
|
157
|
+
};
|
|
158
|
+
/** JSON body (sent as application/json) or a string body. */
|
|
159
|
+
readonly body?: JsonValue;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* An external service the Worker talks to, what it promises, and how it
|
|
163
|
+
* answers. Requests never reach the network: they are answered from
|
|
164
|
+
* `responses`, and an undeclared host makes the run UNSUPPORTED.
|
|
165
|
+
*/
|
|
149
166
|
interface ExternalDecl {
|
|
150
167
|
readonly name: string;
|
|
151
|
-
/** Host
|
|
168
|
+
/** Host to match exactly, or a suffix pattern such as "*.example.com". */
|
|
152
169
|
readonly host: string;
|
|
153
170
|
readonly guarantees: {
|
|
154
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* Header whose value makes repeated requests idempotent: a request
|
|
173
|
+
* repeating an earlier one's key gets the earlier response and is
|
|
174
|
+
* recorded as not effective.
|
|
175
|
+
*/
|
|
155
176
|
readonly dedupeBy?: string;
|
|
156
177
|
};
|
|
178
|
+
/** Omitted: every request gets 200 with an empty body. Present but unmatched: the run is UNSUPPORTED. */
|
|
179
|
+
readonly responses?: readonly ScriptedResponse[];
|
|
157
180
|
}
|
|
158
181
|
/** Exploration bounds. Every verdict reports the bounds actually reached. */
|
|
159
182
|
interface Bounds {
|
|
@@ -165,6 +188,8 @@ interface Bounds {
|
|
|
165
188
|
interface ScenarioSpec {
|
|
166
189
|
readonly version: 1;
|
|
167
190
|
readonly name: string;
|
|
191
|
+
/** Which platform package built and runs this scenario, e.g. "cloudflare" or "aws". Absent means cloudflare. */
|
|
192
|
+
readonly platform?: string;
|
|
168
193
|
readonly worker: WorkerRef;
|
|
169
194
|
/** How the scenario drives the Worker (which events, with what payloads). */
|
|
170
195
|
readonly drive: PlatformData;
|
|
@@ -238,65 +263,5 @@ interface Platform {
|
|
|
238
263
|
/** Called once all events are delivered; the place to record end-of-run state snapshots. */
|
|
239
264
|
finish?(spec: ScenarioSpec, hooks: RunHooks): Promise<void>;
|
|
240
265
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
readonly effectPoints: number;
|
|
244
|
-
readonly faultsInjected: number;
|
|
245
|
-
readonly elapsedMs: number;
|
|
246
|
-
}
|
|
247
|
-
interface VerdictBase {
|
|
248
|
-
readonly scenario: string;
|
|
249
|
-
readonly seed: number | string;
|
|
250
|
-
readonly reached: BoundsReached;
|
|
251
|
-
readonly assumptions: readonly string[];
|
|
252
|
-
}
|
|
253
|
-
interface Shrunk {
|
|
254
|
-
readonly faultsRemoved: number;
|
|
255
|
-
readonly eventsRemoved: number;
|
|
256
|
-
readonly runs: number;
|
|
257
|
-
}
|
|
258
|
-
interface Violated extends VerdictBase {
|
|
259
|
-
readonly kind: "VIOLATED";
|
|
260
|
-
readonly violation: Violation;
|
|
261
|
-
/** The replayed, shrunk trace that breaks the invariant. */
|
|
262
|
-
readonly trace: EffectLog;
|
|
263
|
-
readonly schedule: Schedule;
|
|
264
|
-
/** Ids of the drive's events that remain after shrinking. */
|
|
265
|
-
readonly keptEvents: readonly string[];
|
|
266
|
-
readonly shrunk: Shrunk;
|
|
267
|
-
}
|
|
268
|
-
interface Bounded extends VerdictBase {
|
|
269
|
-
readonly kind: "BOUNDED";
|
|
270
|
-
readonly bounds: Bounds;
|
|
271
|
-
}
|
|
272
|
-
type UnsupportedCause = "unsupported_api" | "not_replayable" | "module_state_leak" | "unsupported_bounds";
|
|
273
|
-
interface Unsupported extends VerdictBase {
|
|
274
|
-
readonly kind: "UNSUPPORTED";
|
|
275
|
-
readonly cause: UnsupportedCause;
|
|
276
|
-
readonly reason: string;
|
|
277
|
-
}
|
|
278
|
-
type ScenarioVerdict = Violated | Bounded | Unsupported;
|
|
279
|
-
/** One line per verdict, for error messages; full rendering lives in `report`. */
|
|
280
|
-
declare function describeVerdict(v: ScenarioVerdict): string;
|
|
281
|
-
interface ExploreOptions {
|
|
282
|
-
readonly seed: number | string;
|
|
283
|
-
/** Hard cap on runs, in addition to the scenario's time budget. */
|
|
284
|
-
readonly maxRuns?: number;
|
|
285
|
-
/** Probability of injecting at an eligible effect point. */
|
|
286
|
-
readonly faultProbability?: number;
|
|
287
|
-
/** Clock for the time budget; injectable for tests. */
|
|
288
|
-
readonly now?: () => number;
|
|
289
|
-
/** Hard cap on replay runs spent shrinking a violation. */
|
|
290
|
-
readonly maxShrinkRuns?: number;
|
|
291
|
-
/**
|
|
292
|
-
* How many of the first exploration runs to replay in reverse order
|
|
293
|
-
* before reporting BOUNDED, to detect module-level state leaking between
|
|
294
|
-
* runs. 0 disables the pass.
|
|
295
|
-
*/
|
|
296
|
-
readonly leakCheckRuns?: number;
|
|
297
|
-
}
|
|
298
|
-
/** Re-run a recorded schedule exactly. */
|
|
299
|
-
declare function replay(spec: ScenarioSpec, platform: Platform, schedule: Schedule): Promise<EffectLog>;
|
|
300
|
-
declare function explore(spec: ScenarioSpec, platform: Platform, options: ExploreOptions): Promise<ScenarioVerdict>;
|
|
301
|
-
export { FaultKind as A, Invariant as C, checkInvariant as D, Violation as E, EffectLog as M, EffectRecord as N, checkInvariants as O, JsonValue as P, Implies as S, StateQuery as T, validateScenario as _, BoundsReached as a, EffectSelector as b, Violated as c, Platform as d, Bounds as f, WorkerRef as g, ScenarioSpec as h, Bounded as i, Schedule as j, FaultDecision as k, describeVerdict as l, PlatformData as m, explore as n, ScenarioVerdict as o, ExternalDecl as p, replay as r, Unsupported as s, ExploreOptions as t, EventRef as u, AtLeastOnce as v, RowCondition as w, EveryRow as x, AtMostOncePerKey as y };
|
|
302
|
-
//# sourceMappingURL=explore-BB77_V0x.d.mts.map
|
|
266
|
+
export { Schedule as C, JsonValue as E, FaultKind as S, EffectRecord as T, StateQuery as _, PlatformData as a, checkInvariants as b, WorkerRef as c, AtMostOncePerKey as d, EffectSelector as f, RowCondition as g, Invariant as h, ExternalDecl as i, validateScenario as l, Implies as m, Platform as n, ScenarioSpec as o, EveryRow as p, Bounds as r, ScriptedResponse as s, EventRef as t, AtLeastOnce as u, Violation as v, EffectLog as w, FaultDecision as x, checkInvariant as y };
|
|
267
|
+
//# sourceMappingURL=platform-CGVkTa16.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-CGVkTa16.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/effect-log.ts","../../core/src/faults.ts","../../core/src/invariants.ts","../../core/src/scenario.ts","../../core/src/platform.d.ts"],"mappings":";;;;;KAMY,wDAKC;YACG,cAAc;;;KCDlB;UAEK;;WAEN;WACA,MAAM;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;UAGH;WACN,kBAAkB;;;;;;;KChBjB;UAUK;;WAEN;;WAEA;WACA,OAAO;;WAEP;WACA;;UAGM;;WAEN;WACA,iBAAiB;;;UC1BX;WACN;WACA;WACA,OAAO;;WAEP;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;;UAE7C;WACN;;WAEA,oBAAoB;;UAEd;WACN;;WAEA;;EAET,MAAM,MAAM,eAAe;;EAE3B,cAAc,MAAM,wBAAwB;;EAE5C,QAAQ,OAAO,UAAU,OAAO,UAAU,MAAM,eAAe,QAAQ;;EAEvE,eAAe,MAAM,cAAc,6BAA6B;;EAEhE,QAAQ,MAAM,cAAc,OAAO,WAAW"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esmMin = (fn, res, err) => () => {
|
|
10
|
+
if (err) throw err[0];
|
|
11
|
+
try {
|
|
12
|
+
return fn && (res = fn(fn = 0)), res;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw err = [e], e;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
18
|
+
var __exportAll = (all, no_symbols) => {
|
|
19
|
+
let target = {};
|
|
20
|
+
for (var name in all) __defProp(target, name, {
|
|
21
|
+
get: all[name],
|
|
22
|
+
enumerable: true
|
|
23
|
+
});
|
|
24
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
29
|
+
key = keys[i];
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
31
|
+
get: ((k) => from[k]).bind(null, key),
|
|
32
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
38
|
+
value: mod,
|
|
39
|
+
enumerable: true
|
|
40
|
+
}) : target, mod));
|
|
41
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
43
|
+
export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as canonicalJson } from "./src-s6uYyC0B.mjs";
|
|
2
|
+
import { i as emitRegressionTest, n as renderText } from "./src-BP6Iqc_9.mjs";
|
|
2
3
|
import { createRequire } from "node:module";
|
|
3
4
|
import { spawn } from "node:child_process";
|
|
4
5
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -307,4 +308,4 @@ async function main(argv, io) {
|
|
|
307
308
|
}
|
|
308
309
|
export { cloudflareRegressionTest as n, main as t };
|
|
309
310
|
|
|
310
|
-
//# sourceMappingURL=src-
|
|
311
|
+
//# sourceMappingURL=src-B66we2mG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src-dP-0Apun.mjs","names":[],"sources":["../../cli/src/args.ts","../../cli/src/generate.ts","../../cli/src/regression.ts","../../cli/src/check.ts","../../cli/src/main.ts"],"sourcesContent":["/** A small argument parser: positionals, `--flag value`, `--flag=value` and boolean `--flag`. */\n\nexport interface ParsedArgs {\n readonly positionals: readonly string[];\n readonly flags: Readonly<Record<string, string | true>>;\n}\n\nexport function parseArgs(argv: readonly string[], booleans: readonly string[] = []): ParsedArgs {\n const positionals: string[] = [];\n const flags: Record<string, string | true> = {};\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i] as string;\n if (!a.startsWith(\"--\")) {\n positionals.push(a);\n continue;\n }\n const eq = a.indexOf(\"=\");\n if (eq !== -1) {\n flags[a.slice(2, eq)] = a.slice(eq + 1);\n continue;\n }\n const name = a.slice(2);\n const next = argv[i + 1];\n if (booleans.includes(name) || next === undefined || next.startsWith(\"--\")) {\n flags[name] = true;\n } else {\n flags[name] = next;\n i++;\n }\n }\n return { positionals, flags };\n}\n","/**\n * The files `eutaxy check` writes into `<scenario dir>/.eutaxy/` before\n * running Vitest: a test that performs the check inside workerd and prints\n * the verdict on one marked line, and a Vitest config with the Cloudflare\n * plugin pointed at the scenario's wrangler config.\n */\n\n/** Key under which the generated test stores its result in the Vitest task meta, read back from the JSON reporter. */\nexport const metaKey = \"eutaxy\";\n\nexport interface GeneratedCheck {\n readonly seed: string;\n readonly maxRuns?: number;\n /** Import specifier of the scenario from the generated test (e.g. \"../scenario.sim.ts\"). */\n readonly scenarioImport: string;\n}\n\n/** What the generated test stores in its task meta. */\nexport interface CheckTransport {\n readonly report: unknown;\n readonly worker: { readonly entry: string; readonly config: string };\n readonly setup: readonly { readonly kind: string; readonly [key: string]: unknown }[];\n}\n\nexport function checkTestSource(g: GeneratedCheck): string {\n const maxRuns = g.maxRuns === undefined ? \"\" : `, maxRuns: ${g.maxRuns}`;\n return `// Generated by eutaxy check; deleted after the run.\nimport { renderJson } from \"@mooloo-ai/eutaxy\";\nimport { check, createCloudflarePlatform, type QueueHandler } from \"@mooloo-ai/eutaxy/cloudflare\";\nimport { env } from \"cloudflare:workers\";\nimport { test } from \"vitest\";\nimport scenario from ${JSON.stringify(g.scenarioImport)};\n\nconst sqlFiles = import.meta.glob(\"../**/*.sql\", { query: \"?raw\", import: \"default\", eager: true }) as Record<string, string>;\nconst modules = import.meta.glob([\"../**/*.ts\", \"!../**/*.test.ts\", \"!../**/*.sim.ts\", \"!../**/node_modules/**\", \"!../**/.eutaxy/**\"]) as Record<string, () => Promise<{ default: QueueHandler }>>;\n\nfunction key(path: string): string {\n return \\`../\\${path.replace(/^\\\\.\\\\//, \"\")}\\`;\n}\n\ntest(\"eutaxy check\", async ({ task }) => {\n const schemas: Record<string, string> = {};\n for (const step of scenario.setup) {\n if (step.kind !== \"d1\") continue;\n const sql = sqlFiles[key(String(step.schemaFile))];\n if (sql === undefined) throw new Error(\\`schema file \\${String(step.schemaFile)} not found next to the scenario\\`);\n schemas[String(step.binding)] = sql;\n }\n const load = modules[key(scenario.worker.entry)];\n if (!load) throw new Error(\\`worker entry \\${scenario.worker.entry} not found next to the scenario\\`);\n const handler = (await load()).default;\n const platform = createCloudflarePlatform({ env, handler, schemas });\n const verdict = await check(scenario, platform, { seed: ${JSON.stringify(g.seed)}${maxRuns} });\n task.meta[${JSON.stringify(metaKey)}] = { report: JSON.parse(renderJson(verdict)), worker: scenario.worker, setup: scenario.setup };\n});\n`;\n}\n\nexport function vitestConfigSource(\n wranglerConfigPath: string,\n testPath: string,\n outputFile: string,\n): string {\n return `// Generated by eutaxy check; deleted after the run.\nimport { cloudflareTest } from \"@cloudflare/vitest-plugin\";\nimport { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n plugins: [cloudflareTest({ wrangler: { configPath: ${JSON.stringify(wranglerConfigPath)} } })],\n test: {\n include: [${JSON.stringify(testPath)}],\n testTimeout: 600_000,\n reporters: [\"json\"],\n outputFile: ${JSON.stringify(outputFile)},\n },\n});\n`;\n}\n","import type { Violated } from \"@eutaxy/core\";\nimport { emitRegressionTest } from \"@eutaxy/report\";\n\nexport interface CloudflareRegressionOptions {\n /** Import path of the scenario module, relative to the emitted file. */\n readonly scenarioPath: string;\n /** Import path of the Worker module. */\n readonly workerPath: string;\n /** D1 binding name to schema file path, imported with `?raw`. */\n readonly schemaPaths: Readonly<Record<string, string>>;\n /** The platform's retry limit, when the scenario was checked with a non-default one. */\n readonly maxRetries?: number;\n readonly expect?: \"holds\" | \"violates\";\n readonly engineModule?: string;\n}\n\n/** A Vitest regression test for a Cloudflare scenario, to run under the Cloudflare Vitest plugin. */\nexport function cloudflareRegressionTest(\n verdict: Violated,\n options: CloudflareRegressionOptions,\n): string {\n const bindings = Object.keys(options.schemaPaths).sort();\n const imports = [\n 'import { createCloudflarePlatform } from \"@mooloo-ai/eutaxy/cloudflare\";',\n 'import { env } from \"cloudflare:workers\";',\n `import scenario from ${JSON.stringify(options.scenarioPath)};`,\n ...bindings.map(\n (b) => `import schema_${b} from ${JSON.stringify(`${options.schemaPaths[b]}?raw`)};`,\n ),\n `import handler from ${JSON.stringify(options.workerPath)};`,\n ];\n const schemas = `{ ${bindings.map((b) => `${b}: schema_${b}`).join(\", \")} }`;\n const retries = options.maxRetries === undefined ? \"\" : `, maxRetries: ${options.maxRetries}`;\n return emitRegressionTest(verdict, {\n imports,\n platform: `createCloudflarePlatform({ env, handler, schemas: ${schemas}${retries} })`,\n scenario: \"scenario\",\n ...(options.expect ? { expect: options.expect } : {}),\n ...(options.engineModule ? { engineModule: options.engineModule } : {}),\n });\n}\n","/**\n * `eutaxy check <scenario.sim.ts>`: run a scenario inside workerd through\n * the user's Vitest and the Cloudflare plugin, print the verdict as text or\n * JSON, and on a violation write a regression test next to the scenario.\n */\n\nimport { spawn } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { canonicalJson, type JsonValue, type ScenarioVerdict, type Violated } from \"@eutaxy/core\";\nimport { renderText } from \"@eutaxy/report\";\nimport { type CheckTransport, checkTestSource, metaKey, vitestConfigSource } from \"./generate.ts\";\nimport { cloudflareRegressionTest } from \"./regression.ts\";\n\nexport interface CheckOptions {\n readonly scenario: string;\n readonly cwd: string;\n readonly wrangler?: string;\n readonly seed?: string;\n readonly maxRuns?: number;\n readonly json: boolean;\n /** Where to write the regression test on a violation; default `<name>.regression.test.ts` beside the scenario. */\n readonly out?: string;\n readonly noRegression: boolean;\n /** Emit a regression test that asserts the violation (for corpora) rather than one that expects it fixed. */\n readonly expectViolation: boolean;\n /** Keep the generated `.eutaxy/` files for inspection. */\n readonly keep: boolean;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\nexport const exitCodes = { BOUNDED: 0, VIOLATED: 1, UNSUPPORTED: 2, error: 3 } as const;\n\nfunction findWrangler(dir: string, explicit: string | undefined, cwd: string): string | null {\n if (explicit) return resolve(cwd, explicit);\n for (const name of [\"wrangler.jsonc\", \"wrangler.json\", \"wrangler.toml\"]) {\n const p = join(dir, name);\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction vitestBin(from: string): string {\n const req = createRequire(join(from, \"package.json\"));\n return join(dirname(req.resolve(\"vitest/package.json\")), \"vitest.mjs\");\n}\n\nfunction runVitest(\n bin: string,\n configPath: string,\n cwd: string,\n): Promise<{ code: number; output: string }> {\n return new Promise((resolveRun) => {\n const child = spawn(process.execPath, [bin, \"run\", \"--config\", configPath], {\n cwd,\n env: { ...process.env, CI: \"1\", FORCE_COLOR: \"0\" },\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let output = \"\";\n child.stdout.on(\"data\", (d: Buffer) => {\n output += d.toString();\n });\n child.stderr.on(\"data\", (d: Buffer) => {\n output += d.toString();\n });\n child.on(\"close\", (code) => resolveRun({ code: code ?? 1, output }));\n });\n}\n\n/** The transport the generated test left in its task meta, via Vitest's JSON reporter. */\nfunction readTransport(reportPath: string): CheckTransport | null {\n if (!existsSync(reportPath)) return null;\n const report = JSON.parse(readFileSync(reportPath, \"utf8\")) as {\n testResults?: { assertionResults?: { meta?: Record<string, unknown> }[] }[];\n };\n for (const file of report.testResults ?? []) {\n for (const t of file.assertionResults ?? []) {\n const m = t.meta?.[metaKey];\n if (m) return m as CheckTransport;\n }\n }\n return null;\n}\n\nfunction toPosix(p: string): string {\n const s = p.split(\"\\\\\").join(\"/\");\n return s.startsWith(\".\") ? s : `./${s}`;\n}\n\nexport async function runCheck(o: CheckOptions): Promise<number> {\n const scenarioPath = resolve(o.cwd, o.scenario);\n if (!existsSync(scenarioPath)) {\n o.stderr(`scenario not found: ${scenarioPath}\\n`);\n return exitCodes.error;\n }\n const dir = dirname(scenarioPath);\n const name = basename(scenarioPath)\n .replace(/\\.sim\\.ts$/, \"\")\n .replace(/\\.ts$/, \"\");\n const wrangler = findWrangler(dir, o.wrangler, o.cwd);\n if (!wrangler || !existsSync(wrangler)) {\n o.stderr(`no wrangler config found next to the scenario; pass --wrangler <path>\\n`);\n return exitCodes.error;\n }\n const workDir = join(dir, \".eutaxy\");\n const testPath = join(workDir, `${name}.check.test.ts`);\n const configPath = join(workDir, \"vitest.config.mts\");\n mkdirSync(workDir, { recursive: true });\n try {\n writeFileSync(\n testPath,\n checkTestSource({\n seed: o.seed ?? name,\n ...(o.maxRuns === undefined ? {} : { maxRuns: o.maxRuns }),\n scenarioImport: `../${basename(scenarioPath)}`,\n }),\n );\n const reportPath = join(workDir, \"vitest-report.json\");\n rmSync(reportPath, { force: true }); // never read a report left by an earlier --keep run\n writeFileSync(configPath, vitestConfigSource(wrangler, testPath, reportPath));\n const { code, output } = await runVitest(vitestBin(dir), configPath, dir);\n const transport = code === 0 ? readTransport(reportPath) : null;\n if (!transport) {\n o.stderr(`eutaxy check could not read a verdict from Vitest (exit ${code}):\\n${output}\\n`);\n return exitCodes.error;\n }\n const report = transport.report as { verdict: ScenarioVerdict };\n const verdict = report.verdict;\n if (o.json) o.stdout(`${canonicalJson(transport.report as JsonValue)}\\n`);\n else o.stdout(`${renderText(verdict)}\\n`);\n\n if (verdict.kind === \"VIOLATED\" && !o.noRegression) {\n const outPath = o.out ? resolve(o.cwd, o.out) : join(dir, `${name}.regression.test.ts`);\n const outDir = dirname(outPath);\n const schemaPaths: Record<string, string> = {};\n for (const step of transport.setup) {\n if (step.kind === \"d1\") {\n schemaPaths[String(step[\"binding\"])] = toPosix(\n relative(outDir, resolve(dir, String(step[\"schemaFile\"]))),\n );\n }\n }\n const source = cloudflareRegressionTest(verdict as Violated, {\n scenarioPath: toPosix(relative(outDir, scenarioPath)),\n workerPath: toPosix(relative(outDir, resolve(dir, transport.worker.entry))),\n schemaPaths,\n ...(o.expectViolation ? { expect: \"violates\" as const } : {}),\n });\n mkdirSync(outDir, { recursive: true });\n writeFileSync(outPath, source);\n if (!o.json)\n o.stdout(`\\nRegression test written to ${relative(o.cwd, outPath) || outPath}\\n`);\n }\n return exitCodes[verdict.kind];\n } finally {\n if (!o.keep) rmSync(workDir, { recursive: true, force: true });\n }\n}\n","import { parseArgs } from \"./args.ts\";\nimport { exitCodes, runCheck } from \"./check.ts\";\n\nconst usage = `eutaxy — deterministic simulation checks for Cloudflare Workers\n\nUsage:\n eutaxy check <scenario.sim.ts> [options]\n\nOptions:\n --wrangler <path> wrangler config (default: wrangler.jsonc/json/toml beside the scenario)\n --seed <seed> exploration seed (default: the scenario file name)\n --max-runs <n> cap on exploration runs in addition to the scenario's time budget\n --json print the versioned JSON report instead of text\n --out <path> where to write the regression test on a violation\n --no-regression do not write a regression test\n --expect-violation write a regression test that asserts the violation (for corpora)\n --keep keep the generated .eutaxy/ files\n\nExit codes: 0 BOUNDED, 1 VIOLATED, 2 UNSUPPORTED, 3 error.\n`;\n\nexport interface Io {\n readonly cwd: string;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\nexport async function main(argv: readonly string[], io: Io): Promise<number> {\n const { positionals, flags } = parseArgs(argv, [\n \"json\",\n \"no-regression\",\n \"expect-violation\",\n \"keep\",\n \"help\",\n ]);\n const command = positionals[0];\n if (!command || command === \"help\" || flags[\"help\"] === true) {\n io.stdout(usage);\n return command ? exitCodes.BOUNDED : exitCodes.error;\n }\n if (command !== \"check\") {\n io.stderr(`unknown command ${command}\\n\\n${usage}`);\n return exitCodes.error;\n }\n const scenario = positionals[1];\n if (!scenario) {\n io.stderr(`check needs a scenario file\\n\\n${usage}`);\n return exitCodes.error;\n }\n const str = (k: string): string | undefined =>\n typeof flags[k] === \"string\" ? (flags[k] as string) : undefined;\n const maxRunsText = str(\"max-runs\");\n const maxRuns = maxRunsText === undefined ? undefined : Number(maxRunsText);\n if (maxRuns !== undefined && !(Number.isInteger(maxRuns) && maxRuns > 0)) {\n io.stderr(`--max-runs must be a positive integer, got ${JSON.stringify(maxRunsText)}\\n`);\n return exitCodes.error;\n }\n return runCheck({\n scenario,\n cwd: io.cwd,\n ...(str(\"wrangler\") ? { wrangler: str(\"wrangler\") as string } : {}),\n ...(str(\"seed\") ? { seed: str(\"seed\") as string } : {}),\n ...(maxRuns === undefined ? {} : { maxRuns }),\n json: flags[\"json\"] === true,\n ...(str(\"out\") ? { out: str(\"out\") as string } : {}),\n noRegression: flags[\"no-regression\"] === true,\n expectViolation: flags[\"expect-violation\"] === true,\n keep: flags[\"keep\"] === true,\n stdout: io.stdout,\n stderr: io.stderr,\n });\n}\n"],"mappings":";;;;;;AAOA,SAAgB,UAAU,MAAyB,WAA8B,CAAC,GAAe;CAC/F,MAAM,cAAwB,CAAC;CAC/B,MAAM,QAAuC,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,IAAI,KAAK;EACf,IAAI,CAAC,EAAE,WAAW,IAAI,GAAG;GACvB,YAAY,KAAK,CAAC;GAClB;EACF;EACA,MAAM,KAAK,EAAE,QAAQ,GAAG;EACxB,IAAI,OAAO,IAAI;GACb,MAAM,EAAE,MAAM,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;GACtC;EACF;EACA,MAAM,OAAO,EAAE,MAAM,CAAC;EACtB,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,SAAS,SAAS,IAA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AAG;CACb,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"src-B66we2mG.mjs","names":[],"sources":["../../cli/src/args.ts","../../cli/src/generate.ts","../../cli/src/regression.ts","../../cli/src/check.ts","../../cli/src/main.ts"],"sourcesContent":["/** A small argument parser: positionals, `--flag value`, `--flag=value` and boolean `--flag`. */\n\nexport interface ParsedArgs {\n readonly positionals: readonly string[];\n readonly flags: Readonly<Record<string, string | true>>;\n}\n\nexport function parseArgs(argv: readonly string[], booleans: readonly string[] = []): ParsedArgs {\n const positionals: string[] = [];\n const flags: Record<string, string | true> = {};\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i] as string;\n if (!a.startsWith(\"--\")) {\n positionals.push(a);\n continue;\n }\n const eq = a.indexOf(\"=\");\n if (eq !== -1) {\n flags[a.slice(2, eq)] = a.slice(eq + 1);\n continue;\n }\n const name = a.slice(2);\n const next = argv[i + 1];\n if (booleans.includes(name) || next === undefined || next.startsWith(\"--\")) {\n flags[name] = true;\n } else {\n flags[name] = next;\n i++;\n }\n }\n return { positionals, flags };\n}\n","/**\n * The files `eutaxy check` writes into `<scenario dir>/.eutaxy/` before\n * running Vitest: a test that performs the check inside workerd and prints\n * the verdict on one marked line, and a Vitest config with the Cloudflare\n * plugin pointed at the scenario's wrangler config.\n */\n\n/** Key under which the generated test stores its result in the Vitest task meta, read back from the JSON reporter. */\nexport const metaKey = \"eutaxy\";\n\nexport interface GeneratedCheck {\n readonly seed: string;\n readonly maxRuns?: number;\n /** Import specifier of the scenario from the generated test (e.g. \"../scenario.sim.ts\"). */\n readonly scenarioImport: string;\n}\n\n/** What the generated test stores in its task meta. */\nexport interface CheckTransport {\n readonly report: unknown;\n readonly worker: { readonly entry: string; readonly config: string };\n readonly setup: readonly { readonly kind: string; readonly [key: string]: unknown }[];\n}\n\nexport function checkTestSource(g: GeneratedCheck): string {\n const maxRuns = g.maxRuns === undefined ? \"\" : `, maxRuns: ${g.maxRuns}`;\n return `// Generated by eutaxy check; deleted after the run.\nimport { renderJson } from \"@mooloo-ai/eutaxy\";\nimport { check, createCloudflarePlatform, type QueueHandler } from \"@mooloo-ai/eutaxy/cloudflare\";\nimport { env } from \"cloudflare:workers\";\nimport { test } from \"vitest\";\nimport scenario from ${JSON.stringify(g.scenarioImport)};\n\nconst sqlFiles = import.meta.glob(\"../**/*.sql\", { query: \"?raw\", import: \"default\", eager: true }) as Record<string, string>;\nconst modules = import.meta.glob([\"../**/*.ts\", \"!../**/*.test.ts\", \"!../**/*.sim.ts\", \"!../**/node_modules/**\", \"!../**/.eutaxy/**\"]) as Record<string, () => Promise<{ default: QueueHandler }>>;\n\nfunction key(path: string): string {\n return \\`../\\${path.replace(/^\\\\.\\\\//, \"\")}\\`;\n}\n\ntest(\"eutaxy check\", async ({ task }) => {\n const schemas: Record<string, string> = {};\n for (const step of scenario.setup) {\n if (step.kind !== \"d1\") continue;\n const sql = sqlFiles[key(String(step.schemaFile))];\n if (sql === undefined) throw new Error(\\`schema file \\${String(step.schemaFile)} not found next to the scenario\\`);\n schemas[String(step.binding)] = sql;\n }\n const load = modules[key(scenario.worker.entry)];\n if (!load) throw new Error(\\`worker entry \\${scenario.worker.entry} not found next to the scenario\\`);\n const handler = (await load()).default;\n const platform = createCloudflarePlatform({ env, handler, schemas });\n const verdict = await check(scenario, platform, { seed: ${JSON.stringify(g.seed)}${maxRuns} });\n task.meta[${JSON.stringify(metaKey)}] = { report: JSON.parse(renderJson(verdict)), worker: scenario.worker, setup: scenario.setup };\n});\n`;\n}\n\nexport function vitestConfigSource(\n wranglerConfigPath: string,\n testPath: string,\n outputFile: string,\n): string {\n return `// Generated by eutaxy check; deleted after the run.\nimport { cloudflareTest } from \"@cloudflare/vitest-plugin\";\nimport { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n plugins: [cloudflareTest({ wrangler: { configPath: ${JSON.stringify(wranglerConfigPath)} } })],\n test: {\n include: [${JSON.stringify(testPath)}],\n testTimeout: 600_000,\n reporters: [\"json\"],\n outputFile: ${JSON.stringify(outputFile)},\n },\n});\n`;\n}\n","import type { Violated } from \"@eutaxy/core\";\nimport { emitRegressionTest } from \"@eutaxy/report\";\n\nexport interface CloudflareRegressionOptions {\n /** Import path of the scenario module, relative to the emitted file. */\n readonly scenarioPath: string;\n /** Import path of the Worker module. */\n readonly workerPath: string;\n /** D1 binding name to schema file path, imported with `?raw`. */\n readonly schemaPaths: Readonly<Record<string, string>>;\n /** The platform's retry limit, when the scenario was checked with a non-default one. */\n readonly maxRetries?: number;\n readonly expect?: \"holds\" | \"violates\";\n readonly engineModule?: string;\n}\n\n/** A Vitest regression test for a Cloudflare scenario, to run under the Cloudflare Vitest plugin. */\nexport function cloudflareRegressionTest(\n verdict: Violated,\n options: CloudflareRegressionOptions,\n): string {\n const bindings = Object.keys(options.schemaPaths).sort();\n const imports = [\n 'import { createCloudflarePlatform } from \"@mooloo-ai/eutaxy/cloudflare\";',\n 'import { env } from \"cloudflare:workers\";',\n `import scenario from ${JSON.stringify(options.scenarioPath)};`,\n ...bindings.map(\n (b) => `import schema_${b} from ${JSON.stringify(`${options.schemaPaths[b]}?raw`)};`,\n ),\n `import handler from ${JSON.stringify(options.workerPath)};`,\n ];\n const schemas = `{ ${bindings.map((b) => `${b}: schema_${b}`).join(\", \")} }`;\n const retries = options.maxRetries === undefined ? \"\" : `, maxRetries: ${options.maxRetries}`;\n return emitRegressionTest(verdict, {\n imports,\n platform: `createCloudflarePlatform({ env, handler, schemas: ${schemas}${retries} })`,\n scenario: \"scenario\",\n ...(options.expect ? { expect: options.expect } : {}),\n ...(options.engineModule ? { engineModule: options.engineModule } : {}),\n });\n}\n","/**\n * `eutaxy check <scenario.sim.ts>`: run a scenario inside workerd through\n * the user's Vitest and the Cloudflare plugin, print the verdict as text or\n * JSON, and on a violation write a regression test next to the scenario.\n */\n\nimport { spawn } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { canonicalJson, type JsonValue, type ScenarioVerdict, type Violated } from \"@eutaxy/core\";\nimport { renderText } from \"@eutaxy/report\";\nimport { type CheckTransport, checkTestSource, metaKey, vitestConfigSource } from \"./generate.ts\";\nimport { cloudflareRegressionTest } from \"./regression.ts\";\n\nexport interface CheckOptions {\n readonly scenario: string;\n readonly cwd: string;\n readonly wrangler?: string;\n readonly seed?: string;\n readonly maxRuns?: number;\n readonly json: boolean;\n /** Where to write the regression test on a violation; default `<name>.regression.test.ts` beside the scenario. */\n readonly out?: string;\n readonly noRegression: boolean;\n /** Emit a regression test that asserts the violation (for corpora) rather than one that expects it fixed. */\n readonly expectViolation: boolean;\n /** Keep the generated `.eutaxy/` files for inspection. */\n readonly keep: boolean;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\nexport const exitCodes = { BOUNDED: 0, VIOLATED: 1, UNSUPPORTED: 2, error: 3 } as const;\n\nfunction findWrangler(dir: string, explicit: string | undefined, cwd: string): string | null {\n if (explicit) return resolve(cwd, explicit);\n for (const name of [\"wrangler.jsonc\", \"wrangler.json\", \"wrangler.toml\"]) {\n const p = join(dir, name);\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction vitestBin(from: string): string {\n const req = createRequire(join(from, \"package.json\"));\n return join(dirname(req.resolve(\"vitest/package.json\")), \"vitest.mjs\");\n}\n\nfunction runVitest(\n bin: string,\n configPath: string,\n cwd: string,\n): Promise<{ code: number; output: string }> {\n return new Promise((resolveRun) => {\n const child = spawn(process.execPath, [bin, \"run\", \"--config\", configPath], {\n cwd,\n env: { ...process.env, CI: \"1\", FORCE_COLOR: \"0\" },\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let output = \"\";\n child.stdout.on(\"data\", (d: Buffer) => {\n output += d.toString();\n });\n child.stderr.on(\"data\", (d: Buffer) => {\n output += d.toString();\n });\n child.on(\"close\", (code) => resolveRun({ code: code ?? 1, output }));\n });\n}\n\n/** The transport the generated test left in its task meta, via Vitest's JSON reporter. */\nfunction readTransport(reportPath: string): CheckTransport | null {\n if (!existsSync(reportPath)) return null;\n const report = JSON.parse(readFileSync(reportPath, \"utf8\")) as {\n testResults?: { assertionResults?: { meta?: Record<string, unknown> }[] }[];\n };\n for (const file of report.testResults ?? []) {\n for (const t of file.assertionResults ?? []) {\n const m = t.meta?.[metaKey];\n if (m) return m as CheckTransport;\n }\n }\n return null;\n}\n\nfunction toPosix(p: string): string {\n const s = p.split(\"\\\\\").join(\"/\");\n return s.startsWith(\".\") ? s : `./${s}`;\n}\n\nexport async function runCheck(o: CheckOptions): Promise<number> {\n const scenarioPath = resolve(o.cwd, o.scenario);\n if (!existsSync(scenarioPath)) {\n o.stderr(`scenario not found: ${scenarioPath}\\n`);\n return exitCodes.error;\n }\n const dir = dirname(scenarioPath);\n const name = basename(scenarioPath)\n .replace(/\\.sim\\.ts$/, \"\")\n .replace(/\\.ts$/, \"\");\n const wrangler = findWrangler(dir, o.wrangler, o.cwd);\n if (!wrangler || !existsSync(wrangler)) {\n o.stderr(`no wrangler config found next to the scenario; pass --wrangler <path>\\n`);\n return exitCodes.error;\n }\n const workDir = join(dir, \".eutaxy\");\n const testPath = join(workDir, `${name}.check.test.ts`);\n const configPath = join(workDir, \"vitest.config.mts\");\n mkdirSync(workDir, { recursive: true });\n try {\n writeFileSync(\n testPath,\n checkTestSource({\n seed: o.seed ?? name,\n ...(o.maxRuns === undefined ? {} : { maxRuns: o.maxRuns }),\n scenarioImport: `../${basename(scenarioPath)}`,\n }),\n );\n const reportPath = join(workDir, \"vitest-report.json\");\n rmSync(reportPath, { force: true }); // never read a report left by an earlier --keep run\n writeFileSync(configPath, vitestConfigSource(wrangler, testPath, reportPath));\n const { code, output } = await runVitest(vitestBin(dir), configPath, dir);\n const transport = code === 0 ? readTransport(reportPath) : null;\n if (!transport) {\n o.stderr(`eutaxy check could not read a verdict from Vitest (exit ${code}):\\n${output}\\n`);\n return exitCodes.error;\n }\n const report = transport.report as { verdict: ScenarioVerdict };\n const verdict = report.verdict;\n if (o.json) o.stdout(`${canonicalJson(transport.report as JsonValue)}\\n`);\n else o.stdout(`${renderText(verdict)}\\n`);\n\n if (verdict.kind === \"VIOLATED\" && !o.noRegression) {\n const outPath = o.out ? resolve(o.cwd, o.out) : join(dir, `${name}.regression.test.ts`);\n const outDir = dirname(outPath);\n const schemaPaths: Record<string, string> = {};\n for (const step of transport.setup) {\n if (step.kind === \"d1\") {\n schemaPaths[String(step[\"binding\"])] = toPosix(\n relative(outDir, resolve(dir, String(step[\"schemaFile\"]))),\n );\n }\n }\n const source = cloudflareRegressionTest(verdict as Violated, {\n scenarioPath: toPosix(relative(outDir, scenarioPath)),\n workerPath: toPosix(relative(outDir, resolve(dir, transport.worker.entry))),\n schemaPaths,\n ...(o.expectViolation ? { expect: \"violates\" as const } : {}),\n });\n mkdirSync(outDir, { recursive: true });\n writeFileSync(outPath, source);\n if (!o.json)\n o.stdout(`\\nRegression test written to ${relative(o.cwd, outPath) || outPath}\\n`);\n }\n return exitCodes[verdict.kind];\n } finally {\n if (!o.keep) rmSync(workDir, { recursive: true, force: true });\n }\n}\n","import { parseArgs } from \"./args.ts\";\nimport { exitCodes, runCheck } from \"./check.ts\";\n\nconst usage = `eutaxy — deterministic simulation checks for Cloudflare Workers\n\nUsage:\n eutaxy check <scenario.sim.ts> [options]\n\nOptions:\n --wrangler <path> wrangler config (default: wrangler.jsonc/json/toml beside the scenario)\n --seed <seed> exploration seed (default: the scenario file name)\n --max-runs <n> cap on exploration runs in addition to the scenario's time budget\n --json print the versioned JSON report instead of text\n --out <path> where to write the regression test on a violation\n --no-regression do not write a regression test\n --expect-violation write a regression test that asserts the violation (for corpora)\n --keep keep the generated .eutaxy/ files\n\nExit codes: 0 BOUNDED, 1 VIOLATED, 2 UNSUPPORTED, 3 error.\n`;\n\nexport interface Io {\n readonly cwd: string;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\nexport async function main(argv: readonly string[], io: Io): Promise<number> {\n const { positionals, flags } = parseArgs(argv, [\n \"json\",\n \"no-regression\",\n \"expect-violation\",\n \"keep\",\n \"help\",\n ]);\n const command = positionals[0];\n if (!command || command === \"help\" || flags[\"help\"] === true) {\n io.stdout(usage);\n return command ? exitCodes.BOUNDED : exitCodes.error;\n }\n if (command !== \"check\") {\n io.stderr(`unknown command ${command}\\n\\n${usage}`);\n return exitCodes.error;\n }\n const scenario = positionals[1];\n if (!scenario) {\n io.stderr(`check needs a scenario file\\n\\n${usage}`);\n return exitCodes.error;\n }\n const str = (k: string): string | undefined =>\n typeof flags[k] === \"string\" ? (flags[k] as string) : undefined;\n const maxRunsText = str(\"max-runs\");\n const maxRuns = maxRunsText === undefined ? undefined : Number(maxRunsText);\n if (maxRuns !== undefined && !(Number.isInteger(maxRuns) && maxRuns > 0)) {\n io.stderr(`--max-runs must be a positive integer, got ${JSON.stringify(maxRunsText)}\\n`);\n return exitCodes.error;\n }\n return runCheck({\n scenario,\n cwd: io.cwd,\n ...(str(\"wrangler\") ? { wrangler: str(\"wrangler\") as string } : {}),\n ...(str(\"seed\") ? { seed: str(\"seed\") as string } : {}),\n ...(maxRuns === undefined ? {} : { maxRuns }),\n json: flags[\"json\"] === true,\n ...(str(\"out\") ? { out: str(\"out\") as string } : {}),\n noRegression: flags[\"no-regression\"] === true,\n expectViolation: flags[\"expect-violation\"] === true,\n keep: flags[\"keep\"] === true,\n stdout: io.stdout,\n stderr: io.stderr,\n });\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,UAAU,MAAyB,WAA8B,CAAC,GAAe;CAC/F,MAAM,cAAwB,CAAC;CAC/B,MAAM,QAAuC,CAAC;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,IAAI,KAAK;EACf,IAAI,CAAC,EAAE,WAAW,IAAI,GAAG;GACvB,YAAY,KAAK,CAAC;GAClB;EACF;EACA,MAAM,KAAK,EAAE,QAAQ,GAAG;EACxB,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;EACxB,GAAI,IAAI,KAAK,IAAI,EAAE,KAAK,IAAI,KAAK,EAAY,IAAI,CAAC;EAClD,cAAc,MAAM,qBAAqB;EACzC,iBAAiB,MAAM,wBAAwB;EAC/C,MAAM,MAAM,YAAY;EACxB,QAAQ,GAAG;EACX,QAAQ,GAAG;CACb,CAAC;AACH"}
|
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function canonicalJson(value) {
|
|
3
|
-
if (value === null) return "null";
|
|
4
|
-
switch (typeof value) {
|
|
5
|
-
case "boolean": return value ? "true" : "false";
|
|
6
|
-
case "number":
|
|
7
|
-
if (!Number.isFinite(value)) throw new TypeError(`non-finite number: ${value}`);
|
|
8
|
-
return Object.is(value, -0) ? "0" : JSON.stringify(value);
|
|
9
|
-
case "string": return JSON.stringify(value);
|
|
10
|
-
case "object": {
|
|
11
|
-
if (Array.isArray(value)) {
|
|
12
|
-
const items = [];
|
|
13
|
-
for (let i = 0; i < value.length; i++) {
|
|
14
|
-
const v = value[i];
|
|
15
|
-
if (v === void 0) throw new TypeError(`hole or undefined at index ${i}`);
|
|
16
|
-
items.push(canonicalJson(v));
|
|
17
|
-
}
|
|
18
|
-
return `[${items.join(",")}]`;
|
|
19
|
-
}
|
|
20
|
-
const keys = Object.keys(value).sort();
|
|
21
|
-
const parts = [];
|
|
22
|
-
for (const k of keys) {
|
|
23
|
-
const v = value[k];
|
|
24
|
-
if (v === void 0) throw new TypeError(`undefined at key ${JSON.stringify(k)}`);
|
|
25
|
-
parts.push(`${JSON.stringify(k)}:${canonicalJson(v)}`);
|
|
26
|
-
}
|
|
27
|
-
return `{${parts.join(",")}}`;
|
|
28
|
-
}
|
|
29
|
-
default: throw new TypeError(`not JSON data: ${typeof value}`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// packages/core/src/utf8.ts
|
|
33
|
-
/**
|
|
34
|
-
* UTF-8 encode a string, with no runtime dependency on TextEncoder. An unpaired
|
|
35
|
-
* surrogate becomes U+FFFD, exactly as TextEncoder does, so the output is
|
|
36
|
-
* always valid UTF-8.
|
|
37
|
-
*/
|
|
38
|
-
function utf8Encode(s) {
|
|
39
|
-
const out = [];
|
|
40
|
-
for (const ch of s) {
|
|
41
|
-
let cp = ch.codePointAt(0) ?? 0;
|
|
42
|
-
if (cp >= 55296 && cp <= 57343) cp = 65533;
|
|
43
|
-
if (cp < 128) out.push(cp);
|
|
44
|
-
else if (cp < 2048) out.push(192 | cp >> 6, 128 | cp & 63);
|
|
45
|
-
else if (cp < 65536) out.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
46
|
-
else out.push(240 | cp >> 18, 128 | cp >> 12 & 63, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
47
|
-
}
|
|
48
|
-
return Uint8Array.from(out);
|
|
49
|
-
}
|
|
50
|
-
// packages/core/src/effect-log.ts
|
|
51
|
-
/**
|
|
52
|
-
* The effect log: the complete, ordered record of what a simulated run did at
|
|
53
|
-
* its effect boundaries. It is plain data, appended immutably, and has one
|
|
54
|
-
* canonical serialisation, so two runs are identical exactly when their
|
|
55
|
-
* serialised logs are byte-identical.
|
|
56
|
-
*/
|
|
57
|
-
const emptyLog = Object.freeze({ entries: Object.freeze([]) });
|
|
58
|
-
/** Append one effect, assigning its sequence number. The input log is unchanged. */
|
|
59
|
-
function appendEffect(log, effect) {
|
|
60
|
-
const record = {
|
|
61
|
-
...effect,
|
|
62
|
-
seq: log.entries.length
|
|
63
|
-
};
|
|
64
|
-
return { entries: [...log.entries, record] };
|
|
65
|
-
}
|
|
66
|
-
/** One canonical JSON object per line, in sequence order. */
|
|
67
|
-
function serializeLog(log) {
|
|
68
|
-
return log.entries.map((e) => canonicalJson({
|
|
69
|
-
seq: e.seq,
|
|
70
|
-
kind: e.kind,
|
|
71
|
-
invocation: e.invocation,
|
|
72
|
-
target: e.target,
|
|
73
|
-
op: e.op,
|
|
74
|
-
payload: e.payload
|
|
75
|
-
})).join("\n");
|
|
76
|
-
}
|
|
77
|
-
/** A 64-bit FNV-1a digest of the serialised log, as 16 hex digits. Not cryptographic. */
|
|
78
|
-
function digestLog(log) {
|
|
79
|
-
const bytes = utf8Encode(serializeLog(log));
|
|
80
|
-
let h = 14695981039346656037n;
|
|
81
|
-
for (const b of bytes) {
|
|
82
|
-
h ^= BigInt(b);
|
|
83
|
-
h = h * 1099511628211n & 18446744073709551615n;
|
|
84
|
-
}
|
|
85
|
-
return h.toString(16).padStart(16, "0");
|
|
86
|
-
}
|
|
1
|
+
import { i as canonicalJson } from "./src-s6uYyC0B.mjs";
|
|
87
2
|
// packages/report/src/regression.ts
|
|
88
3
|
/**
|
|
89
4
|
* The Vitest regression emitter. Given a violation, produce a test file that
|
|
@@ -197,6 +112,6 @@ function renderText(verdict) {
|
|
|
197
112
|
for (const a of verdict.assumptions) out.push(` - ${a}`);
|
|
198
113
|
return out.join("\n");
|
|
199
114
|
}
|
|
200
|
-
export {
|
|
115
|
+
export { emitRegressionTest as i, renderText as n, renderTrace as r, renderJson as t };
|
|
201
116
|
|
|
202
|
-
//# sourceMappingURL=src-
|
|
117
|
+
//# sourceMappingURL=src-BP6Iqc_9.mjs.map
|