@aventara/core 1.0.0-rc.12 → 1.0.0-rc.13
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 +144 -1
- package/ERRORS.md +7 -6
- package/README.md +3 -2
- package/dist/avz/avz-check.factory.d.ts +2 -0
- package/dist/avz/avz-check.factory.js +12 -0
- package/dist/avz/avz.d.ts +6 -0
- package/dist/avz/avz.js +1 -0
- package/dist/compiler/contract-compiler-diagnostic.d.ts +10 -0
- package/dist/compiler/contract-compiler-diagnostic.guidance.js +5 -0
- package/dist/compiler/contract.compiler.js +102 -12
- package/dist/compiler/create-requirements.projector.d.ts +45 -3
- package/dist/compiler/create-requirements.projector.js +239 -28
- package/dist/compiler/managed-elsewhere.projector.d.ts +3 -0
- package/dist/compiler/managed-elsewhere.projector.js +1 -1
- package/dist/config/computed-fields.d.ts +8 -0
- package/dist/config/computed-fields.js +1 -1
- package/dist/config/config-diagnostic.guidance.js +2 -2
- package/dist/config/config.resolver.d.ts +2 -2
- package/dist/config/config.validator.js +15 -6
- package/dist/config/exact-framework-config.d.ts +1 -0
- package/dist/config/field-pipeline-config.d.ts +2 -2
- package/dist/config/forced-operation.validator.js +3 -2
- package/dist/config/framework-config.d.ts +8 -3
- package/dist/config/framework-exemptions-config.d.ts +13 -8
- package/dist/config/framework-resources-config.d.ts +11 -3
- package/dist/contracts/client-contract-structure.validator.d.ts +4 -1
- package/dist/contracts/client-contract-structure.validator.js +3 -2
- package/dist/contracts/contract-limits.d.ts +8 -1
- package/dist/contracts/contract-limits.js +1 -0
- package/dist/contracts/contract.d.ts +7 -3
- package/dist/contracts/transaction-capability.d.ts +8 -0
- package/dist/contracts/transaction-capability.js +7 -0
- package/dist/framework/access-facade.js +14 -6
- package/dist/framework/contract-view.d.ts +91 -9
- package/dist/framework/operation-facade.d.ts +8 -3
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +1 -0
- package/dist/operations/validation-code.guidance.js +1 -1
- package/dist/policy/access-provider.interface.d.ts +7 -2
- package/dist/policy/access-question.runtime.js +2 -1
- package/dist/prebuilt/core-version.generated.d.ts +1 -1
- package/dist/prebuilt/core-version.generated.js +1 -1
- package/dist/protocol/absent-route.responder.d.ts +2 -2
- package/dist/protocol/absent-route.responder.js +2 -1
- package/dist/protocol/av-protocol.d.ts +1 -0
- package/dist/protocol/av-protocol.js +1 -0
- package/dist/protocol/protocol-surface.js +2 -1
- package/dist/protocol/protocol.handler.js +3 -1
- package/dist/runtime/context-executor.runtime.js +2 -1
- package/dist/runtime/create-requirement.d.ts +5 -1
- package/dist/runtime/create-requirement.js +10 -2
- package/dist/runtime/field-check.evaluator.js +39 -2
- package/dist/runtime/field-validator.runtime.d.ts +4 -3
- package/dist/runtime/field-validator.runtime.js +29 -0
- package/dist/runtime/mutation-planner.js +26 -9
- package/dist/runtime/operation-code.guidance.js +3 -3
- package/dist/runtime/operation-runtime.d.ts +10 -9
- package/dist/runtime/operation-runtime.js +20 -18
- package/dist/runtime/pipeline.d.ts +1 -15
- package/dist/runtime/state-refusal.mapper.d.ts +16 -0
- package/dist/runtime/state-refusal.mapper.js +40 -0
- package/dist/transactions/operation-fingerprint.d.ts +15 -2
- package/dist/transactions/transaction-plan-validator.js +31 -1
- package/dist/transactions/transaction-runtime.js +1 -1
- package/package.json +1 -1
- package/src/runtime/field-check.evaluator.ts +46 -2
|
@@ -579,10 +579,54 @@ function plural(count: number, one: string, many: string): string {
|
|
|
579
579
|
return `${count} ${count === 1 ? one : many}`;
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
+
/** The characters a pattern reads as syntax: `AvZ.oneOf` escapes each in a value. */
|
|
583
|
+
const PATTERN_SYNTAX = "\\^$.*+?()[]{}|/";
|
|
584
|
+
|
|
585
|
+
// Source: rc.13 (CORE-08). `AvZ.oneOf` writes its values as `^(?:a|b)$`, each
|
|
586
|
+
// syntax character escaped, no flags: read back exactly, that form lists them.
|
|
587
|
+
// Any other pattern (an unescaped syntax character, a flag) lists nothing.
|
|
588
|
+
/** The values an `AvZ.oneOf` pattern lists, or `undefined` for any other pattern. */
|
|
589
|
+
function listedValues(pattern: {
|
|
590
|
+
readonly source: string;
|
|
591
|
+
readonly flags: string;
|
|
592
|
+
}): readonly string[] | undefined {
|
|
593
|
+
const { source, flags } = pattern;
|
|
594
|
+
if (flags !== "" || !source.startsWith("^(?:") || !source.endsWith(")$")) {
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
597
|
+
const body = source.slice(4, -2);
|
|
598
|
+
const values: string[] = [];
|
|
599
|
+
let value = "";
|
|
600
|
+
for (let index = 0; index < body.length; index += 1) {
|
|
601
|
+
const character = body.charAt(index);
|
|
602
|
+
if (character === "\\") {
|
|
603
|
+
const escaped = body.charAt(index + 1);
|
|
604
|
+
if (escaped === "" || !PATTERN_SYNTAX.includes(escaped)) {
|
|
605
|
+
return undefined;
|
|
606
|
+
}
|
|
607
|
+
value += escaped;
|
|
608
|
+
index += 1;
|
|
609
|
+
} else if (character === "|") {
|
|
610
|
+
values.push(value);
|
|
611
|
+
value = "";
|
|
612
|
+
} else if (PATTERN_SYNTAX.includes(character)) {
|
|
613
|
+
return undefined;
|
|
614
|
+
} else {
|
|
615
|
+
value += character;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
values.push(value);
|
|
619
|
+
return values;
|
|
620
|
+
}
|
|
621
|
+
|
|
582
622
|
function formatMessage(check: AvFieldFormatCheck): string {
|
|
583
623
|
switch (check.format) {
|
|
584
|
-
case "regex":
|
|
585
|
-
|
|
624
|
+
case "regex": {
|
|
625
|
+
const listed = listedValues(check.pattern);
|
|
626
|
+
return listed === undefined
|
|
627
|
+
? `Value must match the pattern /${check.pattern.source}/${check.pattern.flags}.`
|
|
628
|
+
: `Value must be one of ${listed.map((value) => JSON.stringify(value)).join(", ")}.`;
|
|
629
|
+
}
|
|
586
630
|
case "includes":
|
|
587
631
|
return `Value must include ${JSON.stringify(check.includes)}.`;
|
|
588
632
|
case "starts_with":
|