@blue-labs/language 4.1.2 → 5.0.0-rc.1
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/Blue-B7SYp5QY.mjs +8237 -0
- package/dist/Blue-CTQkRrnu.js +98 -0
- package/dist/conformance.d.ts +3 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +6 -0
- package/dist/conformance.mjs +1258 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -27
- package/dist/index.mjs +679 -6799
- package/dist/lib/Blue.d.ts +5 -2
- package/dist/lib/Blue.d.ts.map +1 -1
- package/dist/lib/conformance/BlueConformanceSuiteRunner.d.ts +68 -0
- package/dist/lib/conformance/BlueConformanceSuiteRunner.d.ts.map +1 -0
- package/dist/lib/conformance/BlueLanguageConformanceReport.d.ts +37 -0
- package/dist/lib/conformance/BlueLanguageConformanceReport.d.ts.map +1 -0
- package/dist/lib/conformance/JavaBlueIdCalculator.d.ts +19 -0
- package/dist/lib/conformance/JavaBlueIdCalculator.d.ts.map +1 -0
- package/dist/lib/conformance/conformance-expect.d.ts +17 -0
- package/dist/lib/conformance/conformance-expect.d.ts.map +1 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/.gitkeep +1 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_double_1e0.yaml +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_double_negative_zero.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_double_overflow_rejected.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_empty_list.yaml +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_empty_object_list_element_rejected.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_empty_placeholder.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_integer_1_vs_double_1_0.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_invalid_this_placeholder_rejected.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_large_integer_quoted_explicit_integer.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_list_sugar_equivalence.yaml +12 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_malformed_empty_rejected.yaml +8 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_null_list_element_rejected.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_object_field_null_removal.yaml +8 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_payload_only_scalar_typed_identity.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_plain_blueid_validation.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_pos_rejected.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_previous_invalid_blueid_rejected.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_replace_rejected.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_root_empty_object.yaml +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_root_list.yaml +8 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_root_null_rejected.yaml +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_root_pure_reference.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_root_scalar.yaml +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_scalar_sugar_equivalence.yaml +8 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_type_alias_rejected_in_direct_blueid_input.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/blueid/B_unquoted_large_integer_rejected.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/circular/C_circular_reference_set_ids.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/circular/C_duplicate_preliminary_ids_deterministic_or_rejected.yaml +12 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/circular/C_this_placeholder_rejected_outside_cyclic_api.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/circular/C_three_document_cycle_stable_order.yaml +18 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/circular/C_zero_blueid_rejected_in_final_input.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/lint/L_no_profile_era_language_conformance_terms.yaml +45 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/manifest.yaml +234 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_collapse_does_not_produce_mixed_blueid.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_collapse_nested_subtree_preserves_node_blueid.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_collapse_preserves_node_blueid.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_expand_missing_nested_content_fails.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_expand_nested_reference_preserves_node_blueid.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_expand_preserves_node_blueid.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_expand_wrong_nested_provider_content_fails.yaml +12 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_provider_missing_content_fails.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/provider/F_provider_wrong_blueid_rejected.yaml +13 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/changingCoreTypeDescriptionChangesBlueId.yaml +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryBooleanNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryDictionaryNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryDoubleNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryIntegerNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryListNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/registry/coreRegistryTextNodeHashesToPublishedBlueId.yaml +7 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_blue_imports.yaml +15 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_blue_imports_type_itemType_keyType_valueType.yaml +24 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_canonical_overlay_no_previous_no_pos.yaml +18 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_canonicalization_deterministic_for_same_resolved_view.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_child_field_labels_materialize_until_overridden.yaml +26 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_contracts_canonicalization_deterministic.yaml +18 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_contracts_merge_as_content.yaml +21 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_core_type_compatibility_nominal_by_blueid.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_enum_integer_vs_double.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_inherited_append_only_policy.yaml +16 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_inherited_item_type.yaml +13 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_inherited_keyType_valueType.yaml +16 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_instance_field_kept.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_provider_reference_canonicalizes_back.yaml +13 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_provider_reference_with_overlay_keeps_overlay.yaml +16 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_double_multiple_of_exact.yaml +17 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_double_multiple_of_rejects_decimal_approximation.yaml +12 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_enum_order_and_duplicates_canonical.yaml +26 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_integer_multiple_of_lcm_merge.yaml +17 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_large_integer_minimum_with_type_alias.yaml +15 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_value_shapes.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_schema_wrong_kind_keywords_rejected.yaml +10 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_source_empty_object_list_to_empty.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_source_null_list_to_empty.yaml +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_source_recursive_empty_object_list_to_empty.yaml +15 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_top_level_type_name_description_not_inherited.yaml +21 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_type_aliases_removed_from_canonical_overlay.yaml +15 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_type_derived_field_removed.yaml +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/fixtures/resolver/R_view_path_root_is_empty_string.yaml +25 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/language/1.0/spec.md +2932 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/Boolean.blue +6 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/Dictionary.blue +17 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/Double.blue +12 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/Integer.blue +11 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/List.blue +14 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/Text.blue +9 -0
- package/dist/lib/conformance/fixtures/blue-language-1.0/registry/blue-language-1.0/manifest.yaml +8 -0
- package/dist/lib/errors/BlueError.d.ts +23 -1
- package/dist/lib/errors/BlueError.d.ts.map +1 -1
- package/dist/lib/identity/CyclicSetIdentityService.d.ts +1 -1
- package/dist/lib/identity/CyclicSetIdentityService.d.ts.map +1 -1
- package/dist/lib/identity/SemanticIdentityService.d.ts.map +1 -1
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/mapping/ComplexObjectConverter.d.ts.map +1 -1
- package/dist/lib/mapping/ConverterFactory.d.ts.map +1 -1
- package/dist/lib/mapping/ValueConverter.d.ts.map +1 -1
- package/dist/lib/merge/Merger.d.ts +4 -0
- package/dist/lib/merge/Merger.d.ts.map +1 -1
- package/dist/lib/merge/MergingProcessor.d.ts +10 -0
- package/dist/lib/merge/MergingProcessor.d.ts.map +1 -1
- package/dist/lib/merge/processors/DictionaryProcessor.d.ts.map +1 -1
- package/dist/lib/merge/processors/ListProcessor.d.ts +2 -0
- package/dist/lib/merge/processors/ListProcessor.d.ts.map +1 -1
- package/dist/lib/merge/processors/SchemaPropagator.d.ts +13 -0
- package/dist/lib/merge/processors/SchemaPropagator.d.ts.map +1 -0
- package/dist/lib/merge/processors/SchemaVerifier.d.ts +16 -0
- package/dist/lib/merge/processors/SchemaVerifier.d.ts.map +1 -0
- package/dist/lib/merge/processors/SequentialMergingProcessor.d.ts +2 -0
- package/dist/lib/merge/processors/SequentialMergingProcessor.d.ts.map +1 -1
- package/dist/lib/merge/processors/TypeAssigner.d.ts.map +1 -1
- package/dist/lib/merge/processors/ValuePropagator.d.ts.map +1 -1
- package/dist/lib/merge/processors/index.d.ts +2 -0
- package/dist/lib/merge/processors/index.d.ts.map +1 -1
- package/dist/lib/merge/utils/default.d.ts.map +1 -1
- package/dist/lib/model/Node.d.ts +18 -1
- package/dist/lib/model/Node.d.ts.map +1 -1
- package/dist/lib/model/NodeDeserializer.d.ts +5 -0
- package/dist/lib/model/NodeDeserializer.d.ts.map +1 -1
- package/dist/lib/model/ResolvedNode.d.ts.map +1 -1
- package/dist/lib/model/Schema.d.ts +14 -0
- package/dist/lib/model/Schema.d.ts.map +1 -0
- package/dist/lib/model/index.d.ts +1 -0
- package/dist/lib/model/index.d.ts.map +1 -1
- package/dist/lib/preprocess/Preprocessor.d.ts +8 -1
- package/dist/lib/preprocess/Preprocessor.d.ts.map +1 -1
- package/dist/lib/provider/InMemoryNodeProvider.d.ts.map +1 -1
- package/dist/lib/provider/RepositoryBasedNodeProvider.d.ts +2 -0
- package/dist/lib/provider/RepositoryBasedNodeProvider.d.ts.map +1 -1
- package/dist/lib/provider/VerifyingNodeProvider.d.ts +14 -0
- package/dist/lib/provider/VerifyingNodeProvider.d.ts.map +1 -0
- package/dist/lib/repository/BuiltinRuntimeTypes.d.ts +360 -0
- package/dist/lib/repository/BuiltinRuntimeTypes.d.ts.map +1 -0
- package/dist/lib/repository/RepositoryContentCanonicalizer.d.ts.map +1 -1
- package/dist/lib/repository/RepositoryRuntime.d.ts +1 -1
- package/dist/lib/repository/RepositoryRuntime.d.ts.map +1 -1
- package/dist/lib/snapshot/CanonicalOverlayPatchEngine.d.ts +6 -0
- package/dist/lib/snapshot/CanonicalOverlayPatchEngine.d.ts.map +1 -0
- package/dist/lib/snapshot/FrozenNode.d.ts +80 -0
- package/dist/lib/snapshot/FrozenNode.d.ts.map +1 -0
- package/dist/lib/snapshot/FrozenNodeToBlueIdInput.d.ts +5 -0
- package/dist/lib/snapshot/FrozenNodeToBlueIdInput.d.ts.map +1 -0
- package/dist/lib/snapshot/ResolvedReferenceCache.d.ts +8 -0
- package/dist/lib/snapshot/ResolvedReferenceCache.d.ts.map +1 -0
- package/dist/lib/snapshot/ResolvedSnapshot.d.ts +8 -0
- package/dist/lib/snapshot/ResolvedSnapshot.d.ts.map +1 -0
- package/dist/lib/snapshot/index.d.ts +6 -0
- package/dist/lib/snapshot/index.d.ts.map +1 -0
- package/dist/lib/types/BlueRepository.d.ts +1 -1
- package/dist/lib/utils/BlueIdCalculator.d.ts +19 -1
- package/dist/lib/utils/BlueIdCalculator.d.ts.map +1 -1
- package/dist/lib/utils/BlueIds.d.ts +9 -1
- package/dist/lib/utils/BlueIds.d.ts.map +1 -1
- package/dist/lib/utils/BlueNumbers.d.ts +7 -0
- package/dist/lib/utils/BlueNumbers.d.ts.map +1 -0
- package/dist/lib/utils/ListControls.d.ts.map +1 -1
- package/dist/lib/utils/MergeReverser.d.ts +10 -0
- package/dist/lib/utils/MergeReverser.d.ts.map +1 -1
- package/dist/lib/utils/NodePatch/patch-utils.d.ts +1 -1
- package/dist/lib/utils/NodeProviderWrapper.d.ts +4 -0
- package/dist/lib/utils/NodeProviderWrapper.d.ts.map +1 -1
- package/dist/lib/utils/NodeToBlueIdInput.d.ts +34 -0
- package/dist/lib/utils/NodeToBlueIdInput.d.ts.map +1 -0
- package/dist/lib/utils/NodeToMapListOrValue.d.ts.map +1 -1
- package/dist/lib/utils/NodeTransformer.d.ts.map +1 -1
- package/dist/lib/utils/NodeTypeMatcher.d.ts +27 -1
- package/dist/lib/utils/NodeTypeMatcher.d.ts.map +1 -1
- package/dist/lib/utils/NodeTypes.d.ts +1 -0
- package/dist/lib/utils/NodeTypes.d.ts.map +1 -1
- package/dist/lib/utils/Properties.d.ts +97 -10
- package/dist/lib/utils/Properties.d.ts.map +1 -1
- package/dist/lib/utils/TypeSchema.d.ts +0 -1
- package/dist/lib/utils/TypeSchema.d.ts.map +1 -1
- package/dist/lib/utils/index.d.ts +4 -1
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/schema/jsonBlue.d.ts +1 -1
- package/dist/schema/utils.d.ts.map +1 -1
- package/dist/utils/yamlBlue/type/float.d.ts.map +1 -1
- package/package.json +8 -3
|
@@ -0,0 +1,1258 @@
|
|
|
1
|
+
import h from "node:fs";
|
|
2
|
+
import a from "node:path";
|
|
3
|
+
import { createHash as re } from "node:crypto";
|
|
4
|
+
import { fileURLToPath as _ } from "node:url";
|
|
5
|
+
import se from "js-yaml";
|
|
6
|
+
import O from "node:assert/strict";
|
|
7
|
+
import { am as v, c as P, p as C, q as ne, an as y, ao as L, ap as oe, aq as ae, ar as ce, y as le, s as ue, C as de, g as D, as as he, N as fe, at as pe, l as ye, au as ge, av as me } from "./Blue-B7SYp5QY.mjs";
|
|
8
|
+
import "big.js";
|
|
9
|
+
import { OBJECT_CONTRACTS as x } from "@blue-labs/repository-contract";
|
|
10
|
+
class Ie {
|
|
11
|
+
static toBlueIdInput(e) {
|
|
12
|
+
return e.isListElementContext() ? v.getListElement(e.toNode(), 0) : v.get(e.toNode());
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class u {
|
|
16
|
+
constructor(e, i = !1, r = !1, s = !0, o = !1) {
|
|
17
|
+
this.strictCanonical = i, this.resolvedStructural = r, this.strictBlueIdValidation = s, this.listElementContext = o, this.name = e.getName(), this.description = e.getDescription(), this.type = this.freezeChild(e.getType(), !1), this.itemType = this.freezeChild(e.getItemType(), !1), this.keyType = this.freezeChild(e.getKeyType(), !1), this.valueType = this.freezeChild(e.getValueType(), !1), this.value = e.getValue(), this.items = this.freezeItems(e.getItems()), this.properties = this.freezeProperties(e.getProperties()), this.contracts = this.freezeChild(e.getContractsNode(), !1), this.referenceBlueId = e.getReferenceBlueId(), this.schema = e.getSchema()?.clone(), this.mergePolicy = e.getMergePolicy(), this.previousBlueId = e.getPreviousBlueId(), this.position = e.getPosition(), this.blue = this.freezeChild(e.getBlue(), !1), this.inlineValue = e.isInlineValue(), this.validatePayloadShape(), this.blueIdValue = this.computeBlueId();
|
|
18
|
+
}
|
|
19
|
+
name;
|
|
20
|
+
description;
|
|
21
|
+
type;
|
|
22
|
+
itemType;
|
|
23
|
+
keyType;
|
|
24
|
+
valueType;
|
|
25
|
+
value;
|
|
26
|
+
items;
|
|
27
|
+
properties;
|
|
28
|
+
contracts;
|
|
29
|
+
referenceBlueId;
|
|
30
|
+
schema;
|
|
31
|
+
mergePolicy;
|
|
32
|
+
previousBlueId;
|
|
33
|
+
position;
|
|
34
|
+
blue;
|
|
35
|
+
inlineValue;
|
|
36
|
+
blueIdValue;
|
|
37
|
+
static empty() {
|
|
38
|
+
return new u(new P(), !0, !1);
|
|
39
|
+
}
|
|
40
|
+
static fromNode(e) {
|
|
41
|
+
return new u(e, !0, !1);
|
|
42
|
+
}
|
|
43
|
+
static fromResolvedNode(e) {
|
|
44
|
+
return new u(e, !1, !0, !1);
|
|
45
|
+
}
|
|
46
|
+
static fromUncheckedCanonicalNode(e) {
|
|
47
|
+
return new u(e, !0, !1, !1);
|
|
48
|
+
}
|
|
49
|
+
static calculateBlueId(e) {
|
|
50
|
+
return C.calculateBlueIdSync(
|
|
51
|
+
e.map((i) => i.toNode())
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
toNode() {
|
|
55
|
+
const e = new P().setName(this.name).setDescription(this.description).setType(this.type?.toNode()).setItemType(this.itemType?.toNode()).setKeyType(this.keyType?.toNode()).setValueType(this.valueType?.toNode()).setReferenceBlueId(this.referenceBlueId).setSchema(this.schema?.clone()).setMergePolicy(this.mergePolicy).setPreviousBlueId(this.previousBlueId).setPosition(this.position).setBlue(this.blue?.toNode()).setInlineValue(this.inlineValue);
|
|
56
|
+
return this.value !== void 0 && e.setValue(this.value), this.items !== void 0 && e.setItems(this.items.map((i) => i.toNode())), this.properties !== void 0 && e.setProperties(
|
|
57
|
+
Object.fromEntries(
|
|
58
|
+
Object.entries(this.properties).map(([i, r]) => [
|
|
59
|
+
i,
|
|
60
|
+
r.toNode()
|
|
61
|
+
])
|
|
62
|
+
)
|
|
63
|
+
), this.contracts !== void 0 && e.setContractsNode(this.contracts.toNode()), e;
|
|
64
|
+
}
|
|
65
|
+
blueId() {
|
|
66
|
+
return this.blueIdValue;
|
|
67
|
+
}
|
|
68
|
+
getName() {
|
|
69
|
+
return this.name;
|
|
70
|
+
}
|
|
71
|
+
getDescription() {
|
|
72
|
+
return this.description;
|
|
73
|
+
}
|
|
74
|
+
getType() {
|
|
75
|
+
return this.type;
|
|
76
|
+
}
|
|
77
|
+
getItemType() {
|
|
78
|
+
return this.itemType;
|
|
79
|
+
}
|
|
80
|
+
getKeyType() {
|
|
81
|
+
return this.keyType;
|
|
82
|
+
}
|
|
83
|
+
getValueType() {
|
|
84
|
+
return this.valueType;
|
|
85
|
+
}
|
|
86
|
+
getValue() {
|
|
87
|
+
return this.value;
|
|
88
|
+
}
|
|
89
|
+
getItems() {
|
|
90
|
+
return this.items;
|
|
91
|
+
}
|
|
92
|
+
getProperties() {
|
|
93
|
+
return this.properties;
|
|
94
|
+
}
|
|
95
|
+
getContracts() {
|
|
96
|
+
return this.contracts;
|
|
97
|
+
}
|
|
98
|
+
getReferenceBlueId() {
|
|
99
|
+
return this.referenceBlueId;
|
|
100
|
+
}
|
|
101
|
+
getSchema() {
|
|
102
|
+
return this.schema?.clone();
|
|
103
|
+
}
|
|
104
|
+
getMergePolicy() {
|
|
105
|
+
return this.mergePolicy;
|
|
106
|
+
}
|
|
107
|
+
getPreviousBlueId() {
|
|
108
|
+
return this.previousBlueId;
|
|
109
|
+
}
|
|
110
|
+
getPosition() {
|
|
111
|
+
return this.position;
|
|
112
|
+
}
|
|
113
|
+
getBlue() {
|
|
114
|
+
return this.blue;
|
|
115
|
+
}
|
|
116
|
+
isInlineValue() {
|
|
117
|
+
return this.inlineValue;
|
|
118
|
+
}
|
|
119
|
+
property(e) {
|
|
120
|
+
return e === x ? this.contracts : this.properties?.[e];
|
|
121
|
+
}
|
|
122
|
+
item(e) {
|
|
123
|
+
return e >= 0 ? this.items?.[e] : void 0;
|
|
124
|
+
}
|
|
125
|
+
at(e) {
|
|
126
|
+
const i = typeof e == "string" ? this.pointerSegments(e) : e.map(String);
|
|
127
|
+
return u.atSegments(this, i);
|
|
128
|
+
}
|
|
129
|
+
static atSegments(e, i) {
|
|
130
|
+
let r = e;
|
|
131
|
+
for (const s of i) {
|
|
132
|
+
if (r === void 0)
|
|
133
|
+
return;
|
|
134
|
+
r.items !== void 0 && s !== x ? r = r.item(u.parseArrayIndex(s)) : r = r.property(s);
|
|
135
|
+
}
|
|
136
|
+
return r;
|
|
137
|
+
}
|
|
138
|
+
pathIndex() {
|
|
139
|
+
const e = /* @__PURE__ */ new Map();
|
|
140
|
+
return this.indexPaths("/", e), e;
|
|
141
|
+
}
|
|
142
|
+
hasItems() {
|
|
143
|
+
return this.items !== void 0;
|
|
144
|
+
}
|
|
145
|
+
hasProperties() {
|
|
146
|
+
return this.properties !== void 0;
|
|
147
|
+
}
|
|
148
|
+
isReferenceOnly() {
|
|
149
|
+
return this.referenceBlueId !== void 0 && this.name === void 0 && this.description === void 0 && this.type === void 0 && this.itemType === void 0 && this.keyType === void 0 && this.valueType === void 0 && (this.value === void 0 || this.value === null) && this.items === void 0 && this.properties === void 0 && this.contracts === void 0 && this.schema === void 0 && this.mergePolicy === void 0 && this.previousBlueId === void 0 && this.position === void 0 && this.blue === void 0;
|
|
150
|
+
}
|
|
151
|
+
isPreviousOnly() {
|
|
152
|
+
return this.previousBlueId !== void 0 && this.name === void 0 && this.description === void 0 && this.type === void 0 && this.itemType === void 0 && this.keyType === void 0 && this.valueType === void 0 && (this.value === void 0 || this.value === null) && this.items === void 0 && this.properties === void 0 && this.contracts === void 0 && this.schema === void 0 && this.mergePolicy === void 0 && this.position === void 0 && this.blue === void 0 && this.referenceBlueId === void 0;
|
|
153
|
+
}
|
|
154
|
+
isStrictCanonical() {
|
|
155
|
+
return this.strictCanonical;
|
|
156
|
+
}
|
|
157
|
+
isResolvedStructural() {
|
|
158
|
+
return this.resolvedStructural;
|
|
159
|
+
}
|
|
160
|
+
isStrictBlueIdValidation() {
|
|
161
|
+
return this.strictBlueIdValidation;
|
|
162
|
+
}
|
|
163
|
+
isListElementContext() {
|
|
164
|
+
return this.listElementContext;
|
|
165
|
+
}
|
|
166
|
+
isEmptyNode() {
|
|
167
|
+
return this.name === void 0 && this.description === void 0 && this.type === void 0 && this.itemType === void 0 && this.keyType === void 0 && this.valueType === void 0 && (this.value === void 0 || this.value === null) && this.items === void 0 && this.properties === void 0 && this.contracts === void 0 && this.referenceBlueId === void 0 && this.schema === void 0 && this.mergePolicy === void 0 && this.previousBlueId === void 0 && this.position === void 0 && this.blue === void 0;
|
|
168
|
+
}
|
|
169
|
+
withProperty(e, i) {
|
|
170
|
+
const r = this.toNode();
|
|
171
|
+
if (e === x)
|
|
172
|
+
r.setContractsNode(this.nodeOrUndefined(i));
|
|
173
|
+
else if (i === void 0)
|
|
174
|
+
r.removeProperty(e);
|
|
175
|
+
else {
|
|
176
|
+
const s = i instanceof u ? i.toNode() : i.clone();
|
|
177
|
+
r.addProperty(e, s);
|
|
178
|
+
}
|
|
179
|
+
return new u(
|
|
180
|
+
r,
|
|
181
|
+
this.strictCanonical,
|
|
182
|
+
this.resolvedStructural,
|
|
183
|
+
this.strictBlueIdValidation,
|
|
184
|
+
this.listElementContext
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
withItems(e) {
|
|
188
|
+
const i = this.toNode();
|
|
189
|
+
return i.setItems(
|
|
190
|
+
e.map(
|
|
191
|
+
(r) => r instanceof u ? r.toNode() : r.clone()
|
|
192
|
+
)
|
|
193
|
+
), new u(
|
|
194
|
+
i,
|
|
195
|
+
this.strictCanonical,
|
|
196
|
+
this.resolvedStructural,
|
|
197
|
+
this.strictBlueIdValidation,
|
|
198
|
+
this.listElementContext
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
withoutPosition() {
|
|
202
|
+
if (this.position === void 0)
|
|
203
|
+
return this;
|
|
204
|
+
const e = this.toNode();
|
|
205
|
+
return e.setPosition(void 0), new u(
|
|
206
|
+
e,
|
|
207
|
+
this.strictCanonical,
|
|
208
|
+
this.resolvedStructural,
|
|
209
|
+
this.strictBlueIdValidation,
|
|
210
|
+
this.listElementContext
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
freezeChild(e, i) {
|
|
214
|
+
return e === void 0 ? void 0 : new u(
|
|
215
|
+
e,
|
|
216
|
+
this.strictCanonical,
|
|
217
|
+
this.resolvedStructural,
|
|
218
|
+
this.strictBlueIdValidation,
|
|
219
|
+
i
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
freezeItems(e) {
|
|
223
|
+
if (e !== void 0)
|
|
224
|
+
return Object.freeze(
|
|
225
|
+
e.map(
|
|
226
|
+
(i) => new u(
|
|
227
|
+
i,
|
|
228
|
+
this.strictCanonical,
|
|
229
|
+
this.resolvedStructural,
|
|
230
|
+
this.strictBlueIdValidation,
|
|
231
|
+
!0
|
|
232
|
+
)
|
|
233
|
+
)
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
freezeProperties(e) {
|
|
237
|
+
if (e === void 0)
|
|
238
|
+
return;
|
|
239
|
+
const i = Object.entries(e).flatMap(([r, s]) => {
|
|
240
|
+
if (r === x)
|
|
241
|
+
return [];
|
|
242
|
+
const o = new u(
|
|
243
|
+
s,
|
|
244
|
+
this.strictCanonical,
|
|
245
|
+
this.resolvedStructural,
|
|
246
|
+
this.strictBlueIdValidation,
|
|
247
|
+
!1
|
|
248
|
+
);
|
|
249
|
+
return this.strictCanonical && o.isEmptyNode() ? [] : [[r, o]];
|
|
250
|
+
});
|
|
251
|
+
return i.length === 0 ? void 0 : Object.freeze(Object.fromEntries(i));
|
|
252
|
+
}
|
|
253
|
+
validatePayloadShape() {
|
|
254
|
+
if ([
|
|
255
|
+
this.value !== void 0 && this.value !== null,
|
|
256
|
+
this.items !== void 0,
|
|
257
|
+
this.properties !== void 0 && Object.keys(this.properties).length > 0
|
|
258
|
+
].filter(Boolean).length > 1)
|
|
259
|
+
throw new Error(
|
|
260
|
+
"A Blue node may contain only one payload kind: value, items, or object fields."
|
|
261
|
+
);
|
|
262
|
+
if (this.strictCanonical && this.referenceBlueId !== void 0 && !this.isReferenceOnly())
|
|
263
|
+
throw new Error(
|
|
264
|
+
'"blueId" nodes must be reference-only and cannot contain sibling fields.'
|
|
265
|
+
);
|
|
266
|
+
if (this.strictCanonical && this.previousBlueId !== void 0) {
|
|
267
|
+
if (!this.isPreviousOnly())
|
|
268
|
+
throw new Error(
|
|
269
|
+
'"$previous" list anchors must be single-key list items.'
|
|
270
|
+
);
|
|
271
|
+
if (!this.listElementContext)
|
|
272
|
+
throw new Error(
|
|
273
|
+
'"$previous" is valid only as the first list item in direct BlueId input.'
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (this.strictCanonical && this.blue !== void 0)
|
|
277
|
+
throw new Error(
|
|
278
|
+
'"blue" is a preprocessing directive and must not appear in canonical BlueId input.'
|
|
279
|
+
);
|
|
280
|
+
if (this.strictCanonical && this.position !== void 0)
|
|
281
|
+
throw new Error('"$pos" overlays are not valid direct BlueId input.');
|
|
282
|
+
}
|
|
283
|
+
computeBlueId() {
|
|
284
|
+
return this.strictCanonical ? this.strictBlueIdValidation ? C.calculateBlueIdInputSync(
|
|
285
|
+
Ie.toBlueIdInput(this)
|
|
286
|
+
) : C.calculateBlueIdSync(this.toNode()) : this.isReferenceOnly() ? this.referenceBlueId : C.calculateBlueIdWithResolvedBlueIdMetadataSync(
|
|
287
|
+
this.toNode()
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
nodeOrUndefined(e) {
|
|
291
|
+
if (e !== void 0)
|
|
292
|
+
return e instanceof u ? e.toNode() : e.clone();
|
|
293
|
+
}
|
|
294
|
+
indexPaths(e, i) {
|
|
295
|
+
i.set(e, this), this.items?.forEach(
|
|
296
|
+
(r, s) => r.indexPaths(this.appendPointer(e, String(s)), i)
|
|
297
|
+
), Object.entries(this.properties ?? {}).forEach(
|
|
298
|
+
([r, s]) => s.indexPaths(this.appendPointer(e, r), i)
|
|
299
|
+
), this.contracts?.indexPaths(
|
|
300
|
+
this.appendPointer(e, x),
|
|
301
|
+
i
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
pointerSegments(e) {
|
|
305
|
+
return e === "" || e === "/" ? [] : e.replace(/^\//, "").split("/").filter((i) => i.length > 0).map((i) => i.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
306
|
+
}
|
|
307
|
+
appendPointer(e, i) {
|
|
308
|
+
const r = i.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
309
|
+
return e === "/" ? `/${r}` : `${e}/${r}`;
|
|
310
|
+
}
|
|
311
|
+
static parseArrayIndex(e) {
|
|
312
|
+
const i = Number(e);
|
|
313
|
+
return Number.isInteger(i) && i >= 0 ? i : -1;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const J = "sha256:3387cb4b6626fc56cec91d584b2df7f37c229e396dee990750ac50e762a1bc1d", ve = 77;
|
|
317
|
+
class Be {
|
|
318
|
+
constructor(e, i, r, s, o, E, p) {
|
|
319
|
+
this.specVersion = e, this.fixturePackageIdentity = i, this.passedIds = r, this.failed = s, this.identityMatches = o, this.requiredCoverage = E, this.exactFixtureSet = p;
|
|
320
|
+
}
|
|
321
|
+
fixturePackageIdentityMatchesFixtureFiles() {
|
|
322
|
+
return this.identityMatches;
|
|
323
|
+
}
|
|
324
|
+
hasRequiredFixtureCoverage() {
|
|
325
|
+
return this.requiredCoverage;
|
|
326
|
+
}
|
|
327
|
+
hasExactRequiredFixtureSet() {
|
|
328
|
+
return this.exactFixtureSet;
|
|
329
|
+
}
|
|
330
|
+
passedFixtureIds() {
|
|
331
|
+
return [...this.passedIds];
|
|
332
|
+
}
|
|
333
|
+
failedFixtureIds() {
|
|
334
|
+
return this.failed.map((e) => e.fixtureId);
|
|
335
|
+
}
|
|
336
|
+
failures() {
|
|
337
|
+
return [...this.failed];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const k = a.dirname(_(import.meta.url)), xe = Oe([
|
|
341
|
+
a.join(k, "fixtures/blue-language-1.0"),
|
|
342
|
+
a.join(k, "lib/conformance/fixtures/blue-language-1.0"),
|
|
343
|
+
a.resolve(
|
|
344
|
+
process.cwd(),
|
|
345
|
+
"libs/language/src/lib/conformance/fixtures/blue-language-1.0"
|
|
346
|
+
)
|
|
347
|
+
]), N = a.join(xe, "fixtures"), Ee = a.join(N, "manifest.yaml");
|
|
348
|
+
function Ce() {
|
|
349
|
+
return Se() === J;
|
|
350
|
+
}
|
|
351
|
+
function be() {
|
|
352
|
+
return R().length === ve;
|
|
353
|
+
}
|
|
354
|
+
function we() {
|
|
355
|
+
const t = new Set(
|
|
356
|
+
R().map((i) => i.path)
|
|
357
|
+
), e = Ne(N).filter(
|
|
358
|
+
(i) => i !== "manifest.yaml"
|
|
359
|
+
);
|
|
360
|
+
return e.length === t.size && e.every((i) => t.has(i));
|
|
361
|
+
}
|
|
362
|
+
function R() {
|
|
363
|
+
const t = Pe();
|
|
364
|
+
if (!Array.isArray(t.fixtures))
|
|
365
|
+
throw new Error('Fixture manifest field "fixtures" must be a list.');
|
|
366
|
+
return t.fixtures.map((e) => {
|
|
367
|
+
if (!$(e))
|
|
368
|
+
throw new Error("Fixture manifest entries must be objects.");
|
|
369
|
+
const i = z(b(e, "path"));
|
|
370
|
+
return {
|
|
371
|
+
id: b(e, "id"),
|
|
372
|
+
category: b(e, "category"),
|
|
373
|
+
path: b(e, "path"),
|
|
374
|
+
operation: $(i) ? Re(i, "operation") : void 0
|
|
375
|
+
};
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function Pe() {
|
|
379
|
+
return z("manifest.yaml");
|
|
380
|
+
}
|
|
381
|
+
function z(t) {
|
|
382
|
+
const e = se.load(
|
|
383
|
+
h.readFileSync(a.join(N, t), "utf8")
|
|
384
|
+
);
|
|
385
|
+
if (!$(e))
|
|
386
|
+
throw new Error(`Fixture ${t} must be an object.`);
|
|
387
|
+
return e;
|
|
388
|
+
}
|
|
389
|
+
function Se() {
|
|
390
|
+
const t = R(), e = re("sha256");
|
|
391
|
+
e.update(`manifest.yaml
|
|
392
|
+
`, "utf8"), e.update(
|
|
393
|
+
Te(h.readFileSync(Ee, "utf8")),
|
|
394
|
+
"utf8"
|
|
395
|
+
);
|
|
396
|
+
for (const i of t)
|
|
397
|
+
e.update(`
|
|
398
|
+
--- ${i.path}
|
|
399
|
+
`, "utf8"), e.update(
|
|
400
|
+
H(
|
|
401
|
+
h.readFileSync(a.join(N, i.path), "utf8")
|
|
402
|
+
),
|
|
403
|
+
"utf8"
|
|
404
|
+
);
|
|
405
|
+
return `sha256:${e.digest("hex")}`;
|
|
406
|
+
}
|
|
407
|
+
function Te(t) {
|
|
408
|
+
const e = H(t);
|
|
409
|
+
if (!/^fixturePackageIdentity:.*$/m.test(e))
|
|
410
|
+
throw new Error("Manifest is missing fixturePackageIdentity line.");
|
|
411
|
+
return e.replace(
|
|
412
|
+
/^fixturePackageIdentity:.*$/m,
|
|
413
|
+
'fixturePackageIdentity: ""'
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
function H(t) {
|
|
417
|
+
return t.replace(/\r\n/g, `
|
|
418
|
+
`).replace(/\r/g, `
|
|
419
|
+
`);
|
|
420
|
+
}
|
|
421
|
+
function Ne(t) {
|
|
422
|
+
return X(t).filter((e) => e.endsWith(".yaml") || e.endsWith(".yml")).map((e) => a.relative(t, e).split(a.sep).join("/")).sort();
|
|
423
|
+
}
|
|
424
|
+
function X(t) {
|
|
425
|
+
return h.readdirSync(t, { withFileTypes: !0 }).flatMap((e) => {
|
|
426
|
+
const i = a.join(t, e.name);
|
|
427
|
+
return e.isDirectory() ? X(i) : [i];
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function b(t, e) {
|
|
431
|
+
const i = t[e];
|
|
432
|
+
if (i == null)
|
|
433
|
+
throw new Error(`Fixture field "${e}" is required.`);
|
|
434
|
+
return String(i);
|
|
435
|
+
}
|
|
436
|
+
function Re(t, e) {
|
|
437
|
+
const i = t[e];
|
|
438
|
+
return i == null ? void 0 : String(i);
|
|
439
|
+
}
|
|
440
|
+
function $(t) {
|
|
441
|
+
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
442
|
+
}
|
|
443
|
+
function Oe(t) {
|
|
444
|
+
for (const e of t)
|
|
445
|
+
if (h.existsSync(e) && h.statSync(e).isDirectory())
|
|
446
|
+
return e;
|
|
447
|
+
throw new Error(
|
|
448
|
+
`Blue Language conformance fixtures are missing. Checked: ${t.join(
|
|
449
|
+
", "
|
|
450
|
+
)}`
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
function l(t, e) {
|
|
454
|
+
return new $e(t, e);
|
|
455
|
+
}
|
|
456
|
+
class $e {
|
|
457
|
+
constructor(e, i) {
|
|
458
|
+
this.actual = e, this.message = i, this.not = new je(e, i);
|
|
459
|
+
}
|
|
460
|
+
not;
|
|
461
|
+
toBe(e) {
|
|
462
|
+
O.equal(this.actual, e, this.message);
|
|
463
|
+
}
|
|
464
|
+
toEqual(e) {
|
|
465
|
+
O.deepEqual(this.actual, e, this.message);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
class je {
|
|
469
|
+
constructor(e, i) {
|
|
470
|
+
this.actual = e, this.message = i;
|
|
471
|
+
}
|
|
472
|
+
toBe(e) {
|
|
473
|
+
O.notEqual(this.actual, e, this.message);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const Ae = /* @__PURE__ */ new Set([oe, ae, ce]);
|
|
477
|
+
class d {
|
|
478
|
+
static hashProvider = new ne();
|
|
479
|
+
static calculateBlueIdSync(e) {
|
|
480
|
+
return this.calculateInputSync(v.get(e));
|
|
481
|
+
}
|
|
482
|
+
static calculateBlueIdAllowingCyclicPlaceholdersSync(e) {
|
|
483
|
+
return this.calculateInputSync(
|
|
484
|
+
v.getAllowingCyclicPlaceholders(e)
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
static calculateListBlueIdSync(e) {
|
|
488
|
+
return this.calculateInputSync(
|
|
489
|
+
e.map((i, r) => v.getListElement(i, r))
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
static calculateListBlueIdAllowingCyclicPlaceholdersSync(e) {
|
|
493
|
+
return this.calculateInputSync(
|
|
494
|
+
e.map(
|
|
495
|
+
(i, r) => v.getListElementAllowingCyclicPlaceholders(i, r)
|
|
496
|
+
)
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
static calculateInputSync(e) {
|
|
500
|
+
return this.calculateCleaned(this.cleanRoot(e));
|
|
501
|
+
}
|
|
502
|
+
static calculateCleaned(e) {
|
|
503
|
+
return this.isScalar(e) ? this.hashProvider.applySync(e) : Array.isArray(e) ? this.calculateList(e) : this.calculateMap(e);
|
|
504
|
+
}
|
|
505
|
+
static calculateMap(e) {
|
|
506
|
+
if (Object.keys(e).length === 1 && typeof e[y] == "string")
|
|
507
|
+
return e[y];
|
|
508
|
+
const i = {};
|
|
509
|
+
for (const r of Object.keys(e).sort()) {
|
|
510
|
+
const s = e[r];
|
|
511
|
+
Ae.has(r) ? i[r] = s : i[r] = {
|
|
512
|
+
[y]: this.calculateCleaned(s)
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
return this.hashProvider.applySync(i);
|
|
516
|
+
}
|
|
517
|
+
static calculateList(e) {
|
|
518
|
+
let i = this.hashProvider.applySync({ $list: "empty" }), r = 0;
|
|
519
|
+
e.length > 0 && this.isPreviousControl(e[0]) && (i = this.previousBlueId(e[0]), r = 1);
|
|
520
|
+
for (let s = r; s < e.length; s++) {
|
|
521
|
+
const o = this.calculateCleaned(e[s]);
|
|
522
|
+
i = this.hashProvider.applySync({
|
|
523
|
+
$listCons: {
|
|
524
|
+
elem: { [y]: o },
|
|
525
|
+
prev: { [y]: i }
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
return i;
|
|
530
|
+
}
|
|
531
|
+
static cleanRoot(e) {
|
|
532
|
+
if (e == null)
|
|
533
|
+
throw new Error("Root null is not valid BlueId input.");
|
|
534
|
+
if (this.isScalar(e))
|
|
535
|
+
return e;
|
|
536
|
+
if (Array.isArray(e))
|
|
537
|
+
return e.map((r) => this.cleanRoot(r));
|
|
538
|
+
const i = {};
|
|
539
|
+
for (const [r, s] of Object.entries(e)) {
|
|
540
|
+
const o = this.cleanObjectField(s);
|
|
541
|
+
o !== void 0 && (i[r] = o);
|
|
542
|
+
}
|
|
543
|
+
return i;
|
|
544
|
+
}
|
|
545
|
+
static cleanObjectField(e) {
|
|
546
|
+
if (e == null)
|
|
547
|
+
return;
|
|
548
|
+
if (this.isScalar(e))
|
|
549
|
+
return e;
|
|
550
|
+
if (Array.isArray(e))
|
|
551
|
+
return e.map((r) => this.cleanRoot(r));
|
|
552
|
+
const i = {};
|
|
553
|
+
for (const [r, s] of Object.entries(e)) {
|
|
554
|
+
const o = this.cleanObjectField(s);
|
|
555
|
+
o !== void 0 && (i[r] = o);
|
|
556
|
+
}
|
|
557
|
+
return Object.keys(i).length === 0 ? void 0 : i;
|
|
558
|
+
}
|
|
559
|
+
static isPreviousControl(e) {
|
|
560
|
+
if (typeof e != "object" || e === null || Array.isArray(e) || Object.keys(e).length !== 1)
|
|
561
|
+
return !1;
|
|
562
|
+
const i = e[L];
|
|
563
|
+
return typeof i == "object" && i !== null && !Array.isArray(i) && Object.keys(i).length === 1 && typeof i[y] == "string";
|
|
564
|
+
}
|
|
565
|
+
static previousBlueId(e) {
|
|
566
|
+
return e[L][y];
|
|
567
|
+
}
|
|
568
|
+
static isScalar(e) {
|
|
569
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
const M = a.dirname(_(import.meta.url)), S = et([
|
|
573
|
+
a.join(M, "fixtures/blue-language-1.0"),
|
|
574
|
+
a.join(M, "lib/conformance/fixtures/blue-language-1.0"),
|
|
575
|
+
a.resolve(
|
|
576
|
+
process.cwd(),
|
|
577
|
+
"libs/language/src/lib/conformance/fixtures/blue-language-1.0"
|
|
578
|
+
)
|
|
579
|
+
]), G = a.join(S, "fixtures"), Fe = a.join(
|
|
580
|
+
S,
|
|
581
|
+
"registry",
|
|
582
|
+
"blue-language-1.0"
|
|
583
|
+
), Ve = /* @__PURE__ */ new Set([
|
|
584
|
+
"parseSource",
|
|
585
|
+
"parseBlueIdInput",
|
|
586
|
+
"calculateBlueId",
|
|
587
|
+
"calculateCircularSetBlueIds",
|
|
588
|
+
"preprocess",
|
|
589
|
+
"resolve",
|
|
590
|
+
"canonicalize",
|
|
591
|
+
"calculateContentBlueId",
|
|
592
|
+
"calculateSemanticBlueId",
|
|
593
|
+
"expand",
|
|
594
|
+
"collapse",
|
|
595
|
+
"assertSameNodeBlueId",
|
|
596
|
+
"registryNodeHashesToPublishedBlueId",
|
|
597
|
+
"changingRegistryDescriptionChangesBlueId",
|
|
598
|
+
"lintPublishableDocumentation",
|
|
599
|
+
"assertViewPath"
|
|
600
|
+
]), Le = /* @__PURE__ */ new Set([
|
|
601
|
+
"alsoDifferentFrom",
|
|
602
|
+
"alsoEquivalentTo",
|
|
603
|
+
"assertions",
|
|
604
|
+
"category",
|
|
605
|
+
"description",
|
|
606
|
+
"document",
|
|
607
|
+
"documents",
|
|
608
|
+
"expectBlueIdChanged",
|
|
609
|
+
"expectError",
|
|
610
|
+
"expectedBlueIds",
|
|
611
|
+
"expectedCanonicalOverlay",
|
|
612
|
+
"expectedCollapsed",
|
|
613
|
+
"expectedContentBlueId",
|
|
614
|
+
"expectedErrorCategories",
|
|
615
|
+
"expectedErrorCategory",
|
|
616
|
+
"expectedExpanded",
|
|
617
|
+
"expectedNodeBlueId",
|
|
618
|
+
"expectedParsed",
|
|
619
|
+
"expectedPreprocessed",
|
|
620
|
+
"expectedPublishedBlueId",
|
|
621
|
+
"expectedResolved",
|
|
622
|
+
"forbiddenJoinedTerms",
|
|
623
|
+
"id",
|
|
624
|
+
"input",
|
|
625
|
+
"left",
|
|
626
|
+
"matchRule",
|
|
627
|
+
"mutation",
|
|
628
|
+
"operation",
|
|
629
|
+
"provider",
|
|
630
|
+
"publishableFiles",
|
|
631
|
+
"registryKey",
|
|
632
|
+
"registryKind",
|
|
633
|
+
"requiredHeadings",
|
|
634
|
+
"right",
|
|
635
|
+
"semanticDescriptionIdentityBearing",
|
|
636
|
+
"source"
|
|
637
|
+
]), W = {
|
|
638
|
+
Boolean: "Boolean.blue",
|
|
639
|
+
Dictionary: "Dictionary.blue",
|
|
640
|
+
Double: "Double.blue",
|
|
641
|
+
Integer: "Integer.blue",
|
|
642
|
+
List: "List.blue",
|
|
643
|
+
Text: "Text.blue"
|
|
644
|
+
}, De = A(
|
|
645
|
+
a.join(G, "manifest.yaml")
|
|
646
|
+
);
|
|
647
|
+
if (process.env.CI && process.env.BLUE_FIXTURE)
|
|
648
|
+
throw new Error("BLUE_FIXTURE must not be set in CI conformance runs.");
|
|
649
|
+
const ke = De.fixtures.filter((t) => {
|
|
650
|
+
const e = process.env.BLUE_FIXTURE;
|
|
651
|
+
return e === void 0 || t.id.includes(e);
|
|
652
|
+
});
|
|
653
|
+
function xt() {
|
|
654
|
+
return [...ke];
|
|
655
|
+
}
|
|
656
|
+
async function Et(t = {}) {
|
|
657
|
+
const e = R(), i = Ce(), r = be(), s = we(), o = [], E = [];
|
|
658
|
+
i || o.push(
|
|
659
|
+
w("manifest", "Manifest", "identity", "identity mismatch")
|
|
660
|
+
), r || o.push(
|
|
661
|
+
w(
|
|
662
|
+
"manifest",
|
|
663
|
+
"Manifest",
|
|
664
|
+
"coverage",
|
|
665
|
+
"fixture coverage is incomplete"
|
|
666
|
+
)
|
|
667
|
+
), s || o.push(
|
|
668
|
+
w(
|
|
669
|
+
"manifest",
|
|
670
|
+
"Manifest",
|
|
671
|
+
"fixture-set",
|
|
672
|
+
"fixture set is not exact"
|
|
673
|
+
)
|
|
674
|
+
);
|
|
675
|
+
for (const p of e)
|
|
676
|
+
try {
|
|
677
|
+
qe(p, t.mutateFixture), E.push(p.id);
|
|
678
|
+
} catch (V) {
|
|
679
|
+
o.push(
|
|
680
|
+
w(
|
|
681
|
+
p.id,
|
|
682
|
+
p.category,
|
|
683
|
+
p.operation ?? "unknown",
|
|
684
|
+
Me(V),
|
|
685
|
+
V
|
|
686
|
+
)
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
return new Be(
|
|
690
|
+
"1.0",
|
|
691
|
+
J,
|
|
692
|
+
E,
|
|
693
|
+
o,
|
|
694
|
+
i,
|
|
695
|
+
r,
|
|
696
|
+
s
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
function w(t, e, i, r, s) {
|
|
700
|
+
return {
|
|
701
|
+
fixtureId: t,
|
|
702
|
+
category: e,
|
|
703
|
+
operation: i,
|
|
704
|
+
message: r,
|
|
705
|
+
cause: s instanceof Error ? s.message : void 0,
|
|
706
|
+
classification: s instanceof Error ? s.name : void 0
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function Me(t) {
|
|
710
|
+
return t instanceof Error ? t.message : String(t);
|
|
711
|
+
}
|
|
712
|
+
function qe(t, e) {
|
|
713
|
+
const i = A(
|
|
714
|
+
a.join(G, t.path)
|
|
715
|
+
), r = e?.(t, i) ?? i;
|
|
716
|
+
l(r.id).toBe(t.id), l(r.category).toBe(t.category), Ue(r);
|
|
717
|
+
}
|
|
718
|
+
function Ue(t) {
|
|
719
|
+
if (Ke(t), j(t.operation), t.expectError === !0) {
|
|
720
|
+
Je(t);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
_e(t);
|
|
724
|
+
const e = Y(t);
|
|
725
|
+
switch (t.operation) {
|
|
726
|
+
case "calculateBlueId":
|
|
727
|
+
case "assertSameNodeBlueId":
|
|
728
|
+
l(e).toBe(
|
|
729
|
+
n(t.expectedNodeBlueId, "expectedNodeBlueId")
|
|
730
|
+
), t.operation === "calculateBlueId" && (ot(e, t.alsoEquivalentTo), at(e, t.alsoDifferentFrom));
|
|
731
|
+
return;
|
|
732
|
+
case "calculateCircularSetBlueIds":
|
|
733
|
+
l(e).toEqual(n(t.expectedBlueIds, "expectedBlueIds"));
|
|
734
|
+
return;
|
|
735
|
+
case "calculateContentBlueId":
|
|
736
|
+
case "calculateSemanticBlueId":
|
|
737
|
+
l(e).toBe(
|
|
738
|
+
n(t.expectedContentBlueId, "expectedContentBlueId")
|
|
739
|
+
);
|
|
740
|
+
return;
|
|
741
|
+
case "parseSource":
|
|
742
|
+
case "parseBlueIdInput":
|
|
743
|
+
I(t.expectedParsed, e);
|
|
744
|
+
return;
|
|
745
|
+
case "preprocess":
|
|
746
|
+
I(t.expectedPreprocessed, e);
|
|
747
|
+
return;
|
|
748
|
+
case "resolve":
|
|
749
|
+
I(t.expectedResolved, e);
|
|
750
|
+
return;
|
|
751
|
+
case "canonicalize":
|
|
752
|
+
I(t.expectedCanonicalOverlay, e), ct(e);
|
|
753
|
+
return;
|
|
754
|
+
case "expand":
|
|
755
|
+
I(t.expectedExpanded, e), K(t, e, t.source);
|
|
756
|
+
return;
|
|
757
|
+
case "collapse":
|
|
758
|
+
I(t.expectedCollapsed, e), K(t, e, t.source);
|
|
759
|
+
return;
|
|
760
|
+
case "registryNodeHashesToPublishedBlueId":
|
|
761
|
+
l(e).toBe(
|
|
762
|
+
n(t.expectedPublishedBlueId, "expectedPublishedBlueId")
|
|
763
|
+
);
|
|
764
|
+
return;
|
|
765
|
+
case "changingRegistryDescriptionChangesBlueId":
|
|
766
|
+
l(e).toBe(
|
|
767
|
+
n(t.expectBlueIdChanged, "expectBlueIdChanged")
|
|
768
|
+
);
|
|
769
|
+
return;
|
|
770
|
+
case "lintPublishableDocumentation":
|
|
771
|
+
case "assertViewPath":
|
|
772
|
+
l(e).toBe(!0);
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function Y(t) {
|
|
777
|
+
j(t.operation);
|
|
778
|
+
const e = new ue({ nodeProvider: nt(t.provider) });
|
|
779
|
+
switch (t.operation) {
|
|
780
|
+
case "parseSource":
|
|
781
|
+
return c(n(t.source, "source"));
|
|
782
|
+
case "parseBlueIdInput": {
|
|
783
|
+
const i = c(n(t.input, "input"));
|
|
784
|
+
return d.calculateBlueIdSync(i), i;
|
|
785
|
+
}
|
|
786
|
+
case "calculateBlueId": {
|
|
787
|
+
const i = c(n(t.input, "input")), r = d.calculateBlueIdSync(i);
|
|
788
|
+
return l(u.fromNode(i).blueId()).toBe(r), r;
|
|
789
|
+
}
|
|
790
|
+
case "calculateCircularSetBlueIds": {
|
|
791
|
+
const r = c(n(t.documents, "documents")).getItems();
|
|
792
|
+
if (r === void 0)
|
|
793
|
+
throw new Error("calculateCircularSetBlueIds requires documents list.");
|
|
794
|
+
return new de({
|
|
795
|
+
calculateBlueId: (s) => Array.isArray(s) ? d.calculateListBlueIdAllowingCyclicPlaceholdersSync(
|
|
796
|
+
s
|
|
797
|
+
) : d.calculateBlueIdAllowingCyclicPlaceholdersSync(
|
|
798
|
+
s
|
|
799
|
+
)
|
|
800
|
+
}).calculate(r).documentBlueIds;
|
|
801
|
+
}
|
|
802
|
+
case "preprocess":
|
|
803
|
+
return e.preprocess(c(n(t.source, "source")));
|
|
804
|
+
case "resolve":
|
|
805
|
+
return e.resolve(c(n(t.source, "source")));
|
|
806
|
+
case "canonicalize":
|
|
807
|
+
return q(e, c(n(t.source, "source")));
|
|
808
|
+
case "calculateContentBlueId":
|
|
809
|
+
case "calculateSemanticBlueId":
|
|
810
|
+
return d.calculateBlueIdSync(
|
|
811
|
+
q(e, c(n(t.source, "source")))
|
|
812
|
+
);
|
|
813
|
+
case "expand":
|
|
814
|
+
return B(c(n(t.source, "source")), e);
|
|
815
|
+
case "collapse":
|
|
816
|
+
return new P().setReferenceBlueId(
|
|
817
|
+
d.calculateBlueIdSync(
|
|
818
|
+
c(n(t.source, "source"))
|
|
819
|
+
)
|
|
820
|
+
);
|
|
821
|
+
case "assertSameNodeBlueId": {
|
|
822
|
+
const i = d.calculateBlueIdSync(
|
|
823
|
+
c(n(t.left, "left"))
|
|
824
|
+
), r = d.calculateBlueIdSync(
|
|
825
|
+
c(n(t.right, "right"))
|
|
826
|
+
);
|
|
827
|
+
return l(i).toBe(r), i;
|
|
828
|
+
}
|
|
829
|
+
case "registryNodeHashesToPublishedBlueId":
|
|
830
|
+
return Ge(t);
|
|
831
|
+
case "changingRegistryDescriptionChangesBlueId":
|
|
832
|
+
return We(t);
|
|
833
|
+
case "lintPublishableDocumentation":
|
|
834
|
+
return Qe(t), !0;
|
|
835
|
+
case "assertViewPath":
|
|
836
|
+
return it(t), !0;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function Ke(t) {
|
|
840
|
+
for (const e of Object.keys(t))
|
|
841
|
+
if (!Le.has(e))
|
|
842
|
+
throw new Error(`Unsupported fixture field "${e}" in ${t.id}.`);
|
|
843
|
+
}
|
|
844
|
+
function _e(t) {
|
|
845
|
+
switch (j(t.operation), t.operation) {
|
|
846
|
+
case "calculateBlueId":
|
|
847
|
+
case "assertSameNodeBlueId":
|
|
848
|
+
n(t.expectedNodeBlueId, "expectedNodeBlueId");
|
|
849
|
+
return;
|
|
850
|
+
case "calculateCircularSetBlueIds":
|
|
851
|
+
n(t.expectedBlueIds, "expectedBlueIds");
|
|
852
|
+
return;
|
|
853
|
+
case "calculateContentBlueId":
|
|
854
|
+
case "calculateSemanticBlueId":
|
|
855
|
+
n(t.expectedContentBlueId, "expectedContentBlueId");
|
|
856
|
+
return;
|
|
857
|
+
case "parseSource":
|
|
858
|
+
case "parseBlueIdInput":
|
|
859
|
+
n(t.expectedParsed, "expectedParsed");
|
|
860
|
+
return;
|
|
861
|
+
case "preprocess":
|
|
862
|
+
n(t.expectedPreprocessed, "expectedPreprocessed");
|
|
863
|
+
return;
|
|
864
|
+
case "resolve":
|
|
865
|
+
n(t.expectedResolved, "expectedResolved");
|
|
866
|
+
return;
|
|
867
|
+
case "canonicalize":
|
|
868
|
+
n(t.expectedCanonicalOverlay, "expectedCanonicalOverlay");
|
|
869
|
+
return;
|
|
870
|
+
case "expand":
|
|
871
|
+
n(t.expectedExpanded, "expectedExpanded");
|
|
872
|
+
return;
|
|
873
|
+
case "collapse":
|
|
874
|
+
n(t.expectedCollapsed, "expectedCollapsed");
|
|
875
|
+
return;
|
|
876
|
+
case "registryNodeHashesToPublishedBlueId":
|
|
877
|
+
n(t.expectedPublishedBlueId, "expectedPublishedBlueId");
|
|
878
|
+
return;
|
|
879
|
+
case "changingRegistryDescriptionChangesBlueId":
|
|
880
|
+
n(t.expectBlueIdChanged, "expectBlueIdChanged");
|
|
881
|
+
return;
|
|
882
|
+
case "lintPublishableDocumentation":
|
|
883
|
+
if (n(t.publishableFiles, "publishableFiles"), (t.requiredHeadings?.length ?? 0) === 0 && (t.forbiddenJoinedTerms?.length ?? 0) === 0)
|
|
884
|
+
throw new Error(
|
|
885
|
+
"lintPublishableDocumentation requires at least one lint assertion."
|
|
886
|
+
);
|
|
887
|
+
return;
|
|
888
|
+
case "assertViewPath":
|
|
889
|
+
n(t.assertions, "assertions");
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
function j(t) {
|
|
894
|
+
if (!Ve.has(t))
|
|
895
|
+
throw new Error(
|
|
896
|
+
`Unsupported Blue Language fixture operation: ${t}`
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
function Je(t) {
|
|
900
|
+
let e;
|
|
901
|
+
try {
|
|
902
|
+
Y(t);
|
|
903
|
+
} catch (i) {
|
|
904
|
+
e = i;
|
|
905
|
+
}
|
|
906
|
+
if (e === void 0)
|
|
907
|
+
throw new Error(
|
|
908
|
+
`Fixture ${t.id} expected an error, but none was thrown.`
|
|
909
|
+
);
|
|
910
|
+
ze(t, e);
|
|
911
|
+
}
|
|
912
|
+
function ze(t, e) {
|
|
913
|
+
const i = [
|
|
914
|
+
...t.expectedErrorCategory === void 0 ? [] : [t.expectedErrorCategory],
|
|
915
|
+
...t.expectedErrorCategories ?? []
|
|
916
|
+
];
|
|
917
|
+
if (i.length === 0)
|
|
918
|
+
return;
|
|
919
|
+
const r = He(e);
|
|
920
|
+
if (r === void 0 || !i.includes(r))
|
|
921
|
+
throw new Error(
|
|
922
|
+
`Fixture ${t.id} expected error category ${i.join(
|
|
923
|
+
" or "
|
|
924
|
+
)}, got ${r ?? "unclassified"} from ${Q(
|
|
925
|
+
e
|
|
926
|
+
)}.`
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
function He(t) {
|
|
930
|
+
const e = me(t);
|
|
931
|
+
if (e !== void 0)
|
|
932
|
+
return e;
|
|
933
|
+
const i = Xe(t), r = Q(t).toLowerCase();
|
|
934
|
+
if (i === "BLUE_ID_MISMATCH" || r.includes("provider") && r.includes("blueid") && (r.includes("mismatch") || r.includes("returned content")) || r.includes("calculated blueid"))
|
|
935
|
+
return "ProviderBlueIdMismatch";
|
|
936
|
+
if (r.includes("duplicate preliminary") || r.includes("circular") || r.includes("cyclic"))
|
|
937
|
+
return "CircularSetError";
|
|
938
|
+
if (r.includes("$previous"))
|
|
939
|
+
return "ListControlViolation";
|
|
940
|
+
if (r.includes("unresolved alias") || r.includes("unresolved type alias") || r.includes("invalid blueid input") || r.includes("invalid blueid") || r.includes("$pos") || r.includes("$replace") || r.includes("empty-object list element") || r.includes("root null"))
|
|
941
|
+
return "InvalidBlueIdInput";
|
|
942
|
+
if (r.includes("applies to wrong kind") || r.includes("multiple of") || r.includes("multipleof") || r.includes("minimum") || r.includes("maxlength") || r.includes("minlength"))
|
|
943
|
+
return "SchemaViolation";
|
|
944
|
+
if (r.includes("schema") && (r.includes("vocabulary") || r.includes("schema.required") || r.includes("must be a list") || r.includes("must be an array") || r.includes("must be a boolean")))
|
|
945
|
+
return "SchemaVocabularyError";
|
|
946
|
+
if (r.includes("schema"))
|
|
947
|
+
return "SchemaViolation";
|
|
948
|
+
}
|
|
949
|
+
function Xe(t) {
|
|
950
|
+
return F(t) && typeof t.code == "string" ? t.code : void 0;
|
|
951
|
+
}
|
|
952
|
+
function Q(t) {
|
|
953
|
+
return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
|
|
954
|
+
}
|
|
955
|
+
function Ge(t) {
|
|
956
|
+
const e = Z(t), i = ee(e), r = d.calculateBlueIdSync(i);
|
|
957
|
+
return l(r).toBe(he[e]), t.semanticDescriptionIdentityBearing === !0 && l(
|
|
958
|
+
d.calculateBlueIdSync(
|
|
959
|
+
te(i, { field: "description", append: " " })
|
|
960
|
+
)
|
|
961
|
+
).not.toBe(r), r;
|
|
962
|
+
}
|
|
963
|
+
function We(t) {
|
|
964
|
+
const e = Z(t), i = ee(e), r = te(
|
|
965
|
+
i,
|
|
966
|
+
n(t.mutation, "mutation")
|
|
967
|
+
);
|
|
968
|
+
return d.calculateBlueIdSync(i) !== d.calculateBlueIdSync(r);
|
|
969
|
+
}
|
|
970
|
+
function Z(t) {
|
|
971
|
+
const e = n(t.registryKind, "registryKind");
|
|
972
|
+
if (e !== "Blue Language core type registry")
|
|
973
|
+
throw new Error(`Unsupported registry kind: ${e}`);
|
|
974
|
+
const i = n(t.registryKey, "registryKey");
|
|
975
|
+
if (!Ye(i))
|
|
976
|
+
throw new Error(`Unsupported core registry key: ${i}`);
|
|
977
|
+
return i;
|
|
978
|
+
}
|
|
979
|
+
function Ye(t) {
|
|
980
|
+
return t in W;
|
|
981
|
+
}
|
|
982
|
+
function ee(t) {
|
|
983
|
+
return lt(
|
|
984
|
+
a.join(Fe, W[t])
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
function te(t, e) {
|
|
988
|
+
const i = t.clone();
|
|
989
|
+
switch (e.field) {
|
|
990
|
+
case "description":
|
|
991
|
+
return i.setDescription(
|
|
992
|
+
`${i.getDescription() ?? ""}${e.append ?? ""}`
|
|
993
|
+
), i;
|
|
994
|
+
default:
|
|
995
|
+
throw new Error(`Unsupported registry mutation field: ${e.field}`);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
function Qe(t) {
|
|
999
|
+
const e = n(t.publishableFiles, "publishableFiles");
|
|
1000
|
+
for (const i of e) {
|
|
1001
|
+
const r = Ze(i);
|
|
1002
|
+
for (const s of t.requiredHeadings ?? [])
|
|
1003
|
+
if (!r.includes(s))
|
|
1004
|
+
throw new Error(
|
|
1005
|
+
`Publishable file ${i} is missing required heading: ${s}`
|
|
1006
|
+
);
|
|
1007
|
+
for (const s of t.forbiddenJoinedTerms ?? []) {
|
|
1008
|
+
const o = tt(s);
|
|
1009
|
+
if (r.includes(o))
|
|
1010
|
+
throw new Error(
|
|
1011
|
+
`Publishable file ${i} contains forbidden text: ${o}`
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
function Ze(t) {
|
|
1017
|
+
const e = a.resolve(S, t), i = a.relative(S, e);
|
|
1018
|
+
if (i.startsWith("..") || a.isAbsolute(i))
|
|
1019
|
+
throw new Error(
|
|
1020
|
+
`Publishable fixture path escapes fixture package: ${t}`
|
|
1021
|
+
);
|
|
1022
|
+
return h.readFileSync(e, "utf8");
|
|
1023
|
+
}
|
|
1024
|
+
function et(t) {
|
|
1025
|
+
for (const e of t)
|
|
1026
|
+
if (h.existsSync(e) && h.statSync(e).isDirectory())
|
|
1027
|
+
return e;
|
|
1028
|
+
throw new Error(
|
|
1029
|
+
`Blue Language conformance fixtures are missing. Checked: ${t.join(
|
|
1030
|
+
", "
|
|
1031
|
+
)}`
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
function tt(t) {
|
|
1035
|
+
if (!Array.isArray(t.tokens) || typeof t.joiner != "string")
|
|
1036
|
+
throw new Error("forbiddenJoinedTerms entries require tokens and joiner.");
|
|
1037
|
+
return t.tokens.join(t.joiner);
|
|
1038
|
+
}
|
|
1039
|
+
function it(t) {
|
|
1040
|
+
const e = T(c(n(t.document, "document"))), i = n(t.assertions, "assertions");
|
|
1041
|
+
for (const r of i) {
|
|
1042
|
+
const s = rt(e, r.path);
|
|
1043
|
+
let o = !1;
|
|
1044
|
+
if (r.expectedRoot === !0 && (l(s).toEqual(e), o = !0), r.expectedNode !== void 0 && (l(s).toEqual(
|
|
1045
|
+
T(
|
|
1046
|
+
c(n(r.expectedNode, "expectedNode"))
|
|
1047
|
+
)
|
|
1048
|
+
), o = !0), !o)
|
|
1049
|
+
throw new Error(
|
|
1050
|
+
`View path assertion for ${r.path} has no expected value.`
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
function rt(t, e) {
|
|
1055
|
+
if (e === "")
|
|
1056
|
+
return t;
|
|
1057
|
+
if (!e.startsWith("/"))
|
|
1058
|
+
throw new Error(`Invalid view path: ${e}`);
|
|
1059
|
+
return e.slice(1).split("/").reduce((i, r) => {
|
|
1060
|
+
const s = st(r);
|
|
1061
|
+
if (Array.isArray(i))
|
|
1062
|
+
return /^(0|[1-9]\d*)$/.test(s) ? i[Number(s)] : void 0;
|
|
1063
|
+
if (F(i))
|
|
1064
|
+
return i[s];
|
|
1065
|
+
}, t);
|
|
1066
|
+
}
|
|
1067
|
+
function st(t) {
|
|
1068
|
+
return t.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
1069
|
+
}
|
|
1070
|
+
function q(t, e) {
|
|
1071
|
+
return new pe().reverseToCanonicalOverlay(
|
|
1072
|
+
t.resolve(t.preprocess(e.clone()))
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
function nt(t) {
|
|
1076
|
+
if (t == null)
|
|
1077
|
+
return D(() => []);
|
|
1078
|
+
if (!Array.isArray(t))
|
|
1079
|
+
throw new Error("Fixture provider must be a list.");
|
|
1080
|
+
const e = /* @__PURE__ */ new Map();
|
|
1081
|
+
for (const i of t) {
|
|
1082
|
+
if (!F(i))
|
|
1083
|
+
throw new Error("Fixture provider entry must be an object.");
|
|
1084
|
+
const r = String(i.requestedBlueId ?? i.blueId ?? ""), s = i.returnedNode ?? i.node;
|
|
1085
|
+
if (r.length === 0 || s === void 0)
|
|
1086
|
+
throw new Error(
|
|
1087
|
+
"Fixture provider entries require requestedBlueId and node/returnedNode."
|
|
1088
|
+
);
|
|
1089
|
+
e.set(r, c(s));
|
|
1090
|
+
}
|
|
1091
|
+
return D((i) => {
|
|
1092
|
+
const r = e.get(i);
|
|
1093
|
+
return r === void 0 ? [] : [r.clone()];
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
function B(t, e) {
|
|
1097
|
+
if (ie(t)) {
|
|
1098
|
+
const r = t.getReferenceBlueId(), s = r ? e.getNodeProvider().fetchByBlueId(r) : null;
|
|
1099
|
+
if (s === null || s.length === 0)
|
|
1100
|
+
throw new Error(`No content found for blueId: ${r}`);
|
|
1101
|
+
return s.length === 1 ? B(
|
|
1102
|
+
U(s[0]),
|
|
1103
|
+
e
|
|
1104
|
+
) : new P().setItems(
|
|
1105
|
+
s.map(
|
|
1106
|
+
(o) => B(U(o), e)
|
|
1107
|
+
)
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
const i = t.clone();
|
|
1111
|
+
return i.setType(m(i.getType(), e)), i.setItemType(m(i.getItemType(), e)), i.setKeyType(m(i.getKeyType(), e)), i.setValueType(m(i.getValueType(), e)), i.setBlue(m(i.getBlue(), e)), i.setContractsNode(m(i.getContractsNode(), e)), i.getItems() !== void 0 && i.setItems(
|
|
1112
|
+
i.getItems()?.map((r) => B(r, e))
|
|
1113
|
+
), i.getProperties() !== void 0 && i.setProperties(
|
|
1114
|
+
Object.fromEntries(
|
|
1115
|
+
Object.entries(i.getProperties() ?? {}).map(([r, s]) => [
|
|
1116
|
+
r,
|
|
1117
|
+
B(s, e)
|
|
1118
|
+
])
|
|
1119
|
+
)
|
|
1120
|
+
), i;
|
|
1121
|
+
}
|
|
1122
|
+
function m(t, e) {
|
|
1123
|
+
return t === void 0 ? void 0 : B(t, e);
|
|
1124
|
+
}
|
|
1125
|
+
function U(t) {
|
|
1126
|
+
const e = t.clone();
|
|
1127
|
+
return e.getReferenceBlueId() !== void 0 && !ie(e) && e.setReferenceBlueId(void 0), e;
|
|
1128
|
+
}
|
|
1129
|
+
function I(t, e) {
|
|
1130
|
+
const i = T(
|
|
1131
|
+
c(n(t, "expectedNode"))
|
|
1132
|
+
);
|
|
1133
|
+
l(T(e)).toEqual(i);
|
|
1134
|
+
}
|
|
1135
|
+
function K(t, e, i) {
|
|
1136
|
+
t.expectedNodeBlueId !== void 0 && (l(d.calculateBlueIdSync(e)).toBe(
|
|
1137
|
+
t.expectedNodeBlueId
|
|
1138
|
+
), l(
|
|
1139
|
+
d.calculateBlueIdSync(
|
|
1140
|
+
c(n(i, "source"))
|
|
1141
|
+
)
|
|
1142
|
+
).toBe(t.expectedNodeBlueId));
|
|
1143
|
+
}
|
|
1144
|
+
function ot(t, e) {
|
|
1145
|
+
if (e == null)
|
|
1146
|
+
return;
|
|
1147
|
+
const i = Array.isArray(e) ? e : [e];
|
|
1148
|
+
for (const r of i)
|
|
1149
|
+
l(d.calculateBlueIdSync(c(r))).toBe(
|
|
1150
|
+
t
|
|
1151
|
+
);
|
|
1152
|
+
}
|
|
1153
|
+
function at(t, e) {
|
|
1154
|
+
if (e == null)
|
|
1155
|
+
return;
|
|
1156
|
+
const i = Array.isArray(e) ? e : [e];
|
|
1157
|
+
for (const r of i)
|
|
1158
|
+
l(d.calculateBlueIdSync(c(r))).not.toBe(
|
|
1159
|
+
t
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
function ct(t) {
|
|
1163
|
+
d.calculateBlueIdSync(t), f(t, "/", !1);
|
|
1164
|
+
}
|
|
1165
|
+
function f(t, e, i) {
|
|
1166
|
+
if (t !== void 0) {
|
|
1167
|
+
if (t.getBlue() !== void 0)
|
|
1168
|
+
throw new Error(`Canonical Overlay contains blue at ${e}`);
|
|
1169
|
+
if (t.getPreviousBlueId() !== void 0)
|
|
1170
|
+
throw new Error(`Canonical Overlay contains $previous at ${e}`);
|
|
1171
|
+
if (t.getPosition() !== void 0)
|
|
1172
|
+
throw new Error(`Canonical Overlay contains $pos at ${e}`);
|
|
1173
|
+
if (t.getProperties()?.[ge] !== void 0)
|
|
1174
|
+
throw new Error(`Canonical Overlay contains $replace at ${e}`);
|
|
1175
|
+
if (i && ut(t) && !dt(t))
|
|
1176
|
+
throw new Error(
|
|
1177
|
+
`Canonical Overlay contains empty-object list element at ${e}`
|
|
1178
|
+
);
|
|
1179
|
+
f(
|
|
1180
|
+
t.getType(),
|
|
1181
|
+
g(e, "type"),
|
|
1182
|
+
!1
|
|
1183
|
+
), f(
|
|
1184
|
+
t.getItemType(),
|
|
1185
|
+
g(e, "itemType"),
|
|
1186
|
+
!1
|
|
1187
|
+
), f(
|
|
1188
|
+
t.getKeyType(),
|
|
1189
|
+
g(e, "keyType"),
|
|
1190
|
+
!1
|
|
1191
|
+
), f(
|
|
1192
|
+
t.getValueType(),
|
|
1193
|
+
g(e, "valueType"),
|
|
1194
|
+
!1
|
|
1195
|
+
), f(
|
|
1196
|
+
t.getContractsNode(),
|
|
1197
|
+
g(e, "contracts"),
|
|
1198
|
+
!1
|
|
1199
|
+
), t.getItems()?.forEach(
|
|
1200
|
+
(r, s) => f(
|
|
1201
|
+
r,
|
|
1202
|
+
g(e, String(s)),
|
|
1203
|
+
!0
|
|
1204
|
+
)
|
|
1205
|
+
);
|
|
1206
|
+
for (const [r, s] of Object.entries(t.getProperties() ?? {}))
|
|
1207
|
+
f(s, g(e, r), !1);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
function T(t) {
|
|
1211
|
+
return ye.get(t, "official");
|
|
1212
|
+
}
|
|
1213
|
+
function c(t) {
|
|
1214
|
+
return fe.deserialize(t);
|
|
1215
|
+
}
|
|
1216
|
+
function lt(t) {
|
|
1217
|
+
return c(A(t));
|
|
1218
|
+
}
|
|
1219
|
+
function A(t) {
|
|
1220
|
+
return n(
|
|
1221
|
+
le(h.readFileSync(t, "utf8")),
|
|
1222
|
+
t
|
|
1223
|
+
);
|
|
1224
|
+
}
|
|
1225
|
+
function n(t, e) {
|
|
1226
|
+
if (t === void 0)
|
|
1227
|
+
throw new Error(`Fixture is missing required field: ${e}`);
|
|
1228
|
+
return t;
|
|
1229
|
+
}
|
|
1230
|
+
function ie(t) {
|
|
1231
|
+
return t.getReferenceBlueId() !== void 0 && t.getName() === void 0 && t.getDescription() === void 0 && t.getType() === void 0 && t.getItemType() === void 0 && t.getKeyType() === void 0 && t.getValueType() === void 0 && t.getValue() === void 0 && t.getItems() === void 0 && t.getProperties() === void 0 && t.getContractsNode() === void 0 && t.getSchema() === void 0 && t.getMergePolicy() === void 0;
|
|
1232
|
+
}
|
|
1233
|
+
function ut(t) {
|
|
1234
|
+
return t.getName() === void 0 && t.getDescription() === void 0 && t.getType() === void 0 && t.getItemType() === void 0 && t.getKeyType() === void 0 && t.getValueType() === void 0 && t.getValue() === void 0 && t.getItems() === void 0 && t.getProperties() === void 0 && t.getContractsNode() === void 0 && t.getReferenceBlueId() === void 0 && t.getSchema() === void 0 && t.getMergePolicy() === void 0;
|
|
1235
|
+
}
|
|
1236
|
+
function dt(t) {
|
|
1237
|
+
const e = t.getProperties();
|
|
1238
|
+
return e !== void 0 && Object.keys(e).length === 1 && e.$empty?.getValue() === !0;
|
|
1239
|
+
}
|
|
1240
|
+
function g(t, e) {
|
|
1241
|
+
return t === "/" || t.length === 0 ? `/${e}` : `${t}/${e}`;
|
|
1242
|
+
}
|
|
1243
|
+
function F(t) {
|
|
1244
|
+
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1245
|
+
}
|
|
1246
|
+
export {
|
|
1247
|
+
ve as BLUE_LANGUAGE_1_0_FIXTURE_COUNT,
|
|
1248
|
+
J as BLUE_LANGUAGE_1_0_FIXTURE_PACKAGE_IDENTITY,
|
|
1249
|
+
Be as BlueLanguageConformanceReport,
|
|
1250
|
+
Ce as fixturePackageIdentityMatchesFixtureFiles,
|
|
1251
|
+
we as hasExactRequiredFixtureSet,
|
|
1252
|
+
be as hasRequiredFixtureCoverage,
|
|
1253
|
+
xt as languageConformanceFixtureEntries,
|
|
1254
|
+
R as loadLanguageConformanceFixtureEntries,
|
|
1255
|
+
Et as runLanguageConformanceSuite,
|
|
1256
|
+
qe as runLanguageFixtureEntry,
|
|
1257
|
+
Ue as runLanguageFixtureSpec
|
|
1258
|
+
};
|