ark-runtime-kernel 1.0.0 → 1.1.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/dist/index.cjs CHANGED
@@ -1105,6 +1105,12 @@ function createEventBus(options) {
1105
1105
  }
1106
1106
 
1107
1107
  // src/kernel/event-contracts/EventContractRegistry.ts
1108
+ function formatStandardSchemaPath(path) {
1109
+ if (!path || path.length === 0) return void 0;
1110
+ return path.map(
1111
+ (segment) => typeof segment === "object" && segment !== null && "key" in segment ? String(segment.key) : String(segment)
1112
+ ).join(".");
1113
+ }
1108
1114
  function actualType(value) {
1109
1115
  if (Array.isArray(value)) return "array";
1110
1116
  if (value === null) return "object";
@@ -1249,6 +1255,25 @@ var EventContractRegistryImpl = class {
1249
1255
  }
1250
1256
  }
1251
1257
  }
1258
+ if (contract.standardSchema) {
1259
+ const result = contract.standardSchema["~standard"].validate(event.payload);
1260
+ if (result instanceof Promise) {
1261
+ issues.push({
1262
+ intent: event.intent,
1263
+ version: contract.version,
1264
+ message: "Standard Schema validator returned a Promise; event contract validation is synchronous."
1265
+ });
1266
+ } else if (result.issues) {
1267
+ for (const issue of result.issues) {
1268
+ issues.push({
1269
+ intent: event.intent,
1270
+ version: contract.version,
1271
+ field: formatStandardSchemaPath(issue.path),
1272
+ message: issue.message
1273
+ });
1274
+ }
1275
+ }
1276
+ }
1252
1277
  return { ok: issues.length === 0, contract, issues };
1253
1278
  }
1254
1279
  clear() {