@disclosureos/schema 2.0.0-beta.0 → 2.0.0-beta.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9e7c76a: Add experimental observation-context 0.1.0 and an explicit claim-history 0.2.0 parser for typed context entity/field subjects and assertion inputs. Resolve caller-supplied exact document snapshots, preserve descriptive vocabularies and missingness, and link contextual quantities to existing measurements. Existing schema identities and claim-history 0.1.0 remain unchanged. No source authentication, time normalization or sensor-fusion validation is implied.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [9e7c76a]
|
|
12
|
+
- @disclosureos/records@2.0.0-beta.1
|
|
13
|
+
- @disclosureos/instruments@2.0.0-beta.1
|
|
14
|
+
- @disclosureos/observables@2.0.0-beta.1
|
|
15
|
+
- @disclosureos/origins@2.0.0-beta.1
|
|
16
|
+
|
|
3
17
|
## 2.0.0-beta.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClaimHistoryIssueCode, parseExperimentalClaimHistory, ClaimSubject } from '@disclosureos/records/experimental/v2';
|
|
1
|
+
import { ClaimHistoryIssueCode, parseExperimentalClaimHistory, ClaimSubject, ContextIssue, DocumentSnapshotRef } from '@disclosureos/records/experimental/v2';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { parseAcquisitionContext, AcquisitionContextIssueCode } from '@disclosureos/instruments/experimental/v2';
|
|
4
4
|
|
|
@@ -1599,4 +1599,107 @@ declare const MigrationCompatibilitySchema: z.ZodObject<{
|
|
|
1599
1599
|
type MigrationCompatibility = z.infer<typeof MigrationCompatibilitySchema>;
|
|
1600
1600
|
declare function migrationCompatibilityJsonSchema(): Record<string, unknown>;
|
|
1601
1601
|
|
|
1602
|
-
|
|
1602
|
+
interface ContextReviewOptions {
|
|
1603
|
+
/** Exact UTF-8 document bytes keyed by SHA-256. Nothing is fetched or normalized. */
|
|
1604
|
+
documents: ReadonlyMap<string, Uint8Array>;
|
|
1605
|
+
}
|
|
1606
|
+
interface ContextReviewResult {
|
|
1607
|
+
success: boolean;
|
|
1608
|
+
issues: ContextIssue[];
|
|
1609
|
+
snapshots: Array<DocumentSnapshotRef & {
|
|
1610
|
+
status: "passed" | "failed" | "unavailable";
|
|
1611
|
+
}>;
|
|
1612
|
+
checks: {
|
|
1613
|
+
structural: 'passed' | 'failed';
|
|
1614
|
+
semantic: 'passed' | 'failed' | 'not_checked';
|
|
1615
|
+
profile: 'not_checked';
|
|
1616
|
+
external: 'passed' | 'failed' | 'not_checked';
|
|
1617
|
+
};
|
|
1618
|
+
currentClaimRefs: string[];
|
|
1619
|
+
integrityScope: "supplied_context_observation_and_acquisition_snapshot_bytes";
|
|
1620
|
+
temporalNormalization: "not_checked";
|
|
1621
|
+
sourceArtifactIntegrity: "not_checked";
|
|
1622
|
+
scientificInterpretation: "not_checked";
|
|
1623
|
+
multiSensorFusion: "not_checked";
|
|
1624
|
+
}
|
|
1625
|
+
/** Closed C1 role table: no unit guessing, conversion or unrestricted quantity synonyms. */
|
|
1626
|
+
declare const CONTEXT_MEASUREMENT_ROLES: {
|
|
1627
|
+
readonly size: {
|
|
1628
|
+
readonly entities: readonly ["reported_object"];
|
|
1629
|
+
readonly quantities: readonly ["size", "length"];
|
|
1630
|
+
readonly units: readonly ["m", "km"];
|
|
1631
|
+
};
|
|
1632
|
+
readonly count: {
|
|
1633
|
+
readonly entities: readonly ["reported_object"];
|
|
1634
|
+
readonly quantities: readonly ["count"];
|
|
1635
|
+
readonly units: readonly ["1"];
|
|
1636
|
+
};
|
|
1637
|
+
readonly speed: {
|
|
1638
|
+
readonly entities: readonly ["reported_object", "platform"];
|
|
1639
|
+
readonly quantities: readonly ["speed"];
|
|
1640
|
+
readonly units: readonly ["m/s", "km/h"];
|
|
1641
|
+
};
|
|
1642
|
+
readonly altitude: {
|
|
1643
|
+
readonly entities: readonly ["reported_object", "platform", "place"];
|
|
1644
|
+
readonly quantities: readonly ["altitude", "elevation"];
|
|
1645
|
+
readonly units: readonly ["m", "km"];
|
|
1646
|
+
};
|
|
1647
|
+
readonly heading: {
|
|
1648
|
+
readonly entities: readonly ["reported_object", "platform"];
|
|
1649
|
+
readonly quantities: readonly ["heading"];
|
|
1650
|
+
readonly units: readonly ["deg"];
|
|
1651
|
+
};
|
|
1652
|
+
readonly ambient_temperature: {
|
|
1653
|
+
readonly entities: readonly ["environment"];
|
|
1654
|
+
readonly quantities: readonly ["temperature", "ambient_temperature"];
|
|
1655
|
+
readonly units: readonly ["Cel", "K"];
|
|
1656
|
+
};
|
|
1657
|
+
readonly relative_humidity: {
|
|
1658
|
+
readonly entities: readonly ["environment"];
|
|
1659
|
+
readonly quantities: readonly ["relative_humidity"];
|
|
1660
|
+
readonly units: readonly ["%"];
|
|
1661
|
+
};
|
|
1662
|
+
readonly wind_speed: {
|
|
1663
|
+
readonly entities: readonly ["environment"];
|
|
1664
|
+
readonly quantities: readonly ["wind_speed"];
|
|
1665
|
+
readonly units: readonly ["m/s", "km/h"];
|
|
1666
|
+
};
|
|
1667
|
+
readonly moon_illumination: {
|
|
1668
|
+
readonly entities: readonly ["environment"];
|
|
1669
|
+
readonly quantities: readonly ["moon_illumination"];
|
|
1670
|
+
readonly units: readonly ["%", "1"];
|
|
1671
|
+
};
|
|
1672
|
+
readonly duration: {
|
|
1673
|
+
readonly entities: readonly ["temporal", "collection"];
|
|
1674
|
+
readonly quantities: readonly ["duration"];
|
|
1675
|
+
readonly units: readonly ["s", "min", "h"];
|
|
1676
|
+
};
|
|
1677
|
+
readonly distance: {
|
|
1678
|
+
readonly entities: readonly ["place"];
|
|
1679
|
+
readonly quantities: readonly ["distance"];
|
|
1680
|
+
readonly units: readonly ["m", "km"];
|
|
1681
|
+
};
|
|
1682
|
+
readonly bearing: {
|
|
1683
|
+
readonly entities: readonly ["place"];
|
|
1684
|
+
readonly quantities: readonly ["bearing"];
|
|
1685
|
+
readonly units: readonly ["deg"];
|
|
1686
|
+
};
|
|
1687
|
+
readonly water_depth: {
|
|
1688
|
+
readonly entities: readonly ["place"];
|
|
1689
|
+
readonly quantities: readonly ["water_depth"];
|
|
1690
|
+
readonly units: readonly ["m"];
|
|
1691
|
+
};
|
|
1692
|
+
readonly coordinate_precision: {
|
|
1693
|
+
readonly entities: readonly ["place"];
|
|
1694
|
+
readonly quantities: readonly ["coordinate_precision"];
|
|
1695
|
+
readonly units: readonly ["m"];
|
|
1696
|
+
};
|
|
1697
|
+
readonly time_alignment: {
|
|
1698
|
+
readonly entities: readonly ["collection"];
|
|
1699
|
+
readonly quantities: readonly ["time_alignment_uncertainty"];
|
|
1700
|
+
readonly units: readonly ["s", "ms"];
|
|
1701
|
+
};
|
|
1702
|
+
};
|
|
1703
|
+
declare function evaluateContextClaimHistory(input: unknown, options: ContextReviewOptions): Promise<ContextReviewResult>;
|
|
1704
|
+
|
|
1705
|
+
export { ACQUISITION_BINDINGS_PROFILE, ACQUISITION_BINDINGS_SCHEMA_ID, ASSESSMENT_DOCUMENTATION_PROFILE, type AcquisitionBindingOptions, type AcquisitionBindingResult, type AcquisitionBindings, AcquisitionBindingsSchema, type AssessmentDocumentation, type AssessmentDocumentationCompletion, type AssetCheck, type BindingAssetCheck, type BindingIssue, type BindingIssueCode, CONTEXT_MEASUREMENT_ROLES, type CompletionStatus, type ContextReviewOptions, type ContextReviewResult, DATASET_RELEASE_PROFILE, DATASET_RELEASE_SCHEMA_ID, DOCUMENTATION_COMPLETION_POLICY, DOCUMENTATION_REQUIREMENTS, type DatasetIssue, type DatasetPacketInput, type DatasetRelease, type DatasetReleaseResult, DatasetReleaseSchema, type DocumentationAction, type DocumentationCompletionResult, type DocumentationIssue, type DocumentationIssueCode, type DocumentationOptions, type DocumentationRequirement, type DocumentationRequirementId, type DocumentationResult, HISTORICAL_TESTIMONY_PROFILE, HISTORICAL_TESTIMONY_REQUIREMENTS, HISTORICAL_TESTIMONY_SELECTION_SCHEMA_ID, type HistoricalTestimonyCompletionStatus, type HistoricalTestimonyIssue, type HistoricalTestimonyReport, type HistoricalTestimonyRequirement, type HistoricalTestimonyRequirementId, type HistoricalTestimonyResult, type HistoricalTestimonySelection, HistoricalTestimonySelectionSchema, INSTRUMENT_RESEARCH_COMPLETION_POLICY, INSTRUMENT_RESEARCH_PREREQUISITES_PROFILE, INSTRUMENT_RESEARCH_REQUIREMENTS, INSTRUMENT_RESEARCH_REVIEW_SCHEMA_ID, type InstrumentResearchCompletionResult, type InstrumentResearchOptions, type InstrumentResearchResult, type InstrumentResearchReview, InstrumentResearchReviewSchema, MEASUREMENT_BINDINGS_PROFILE, MEASUREMENT_BINDINGS_SCHEMA_ID, MIGRATION_COMPATIBILITY_SCHEMA_ID, MIGRATION_LEGACY_SCORES_SCHEMA_ID, MIGRATION_RESOLUTION_SCHEMA_ID, MIGRATION_REVIEW_SCHEMA_ID, type MeasurementBindingIssue, type MeasurementBindingResult, type MeasurementBindings, MeasurementBindingsSchema, type MigrationCompatibility, MigrationCompatibilitySchema, type MigrationLegacyScores, MigrationLegacyScoresSchema, type MigrationResolution, MigrationResolutionSchema, type MigrationReview, MigrationReviewSchema, PHYSICAL_SAMPLE_PROFILE, PHYSICAL_SAMPLE_REQUIREMENTS, PHYSICAL_SAMPLE_SELECTION_SCHEMA_ID, PROFILE_EVALUATION_POLICY, PROFILE_EVALUATION_SCHEMA_ID, PROFILE_PREPARATION_SCHEMA_ID, type PhysicalSampleIssue, type PhysicalSampleRecordCheck, type PhysicalSampleReport, type PhysicalSampleRequirement, type PhysicalSampleRequirementId, type PhysicalSampleResult, type PhysicalSampleSelection, PhysicalSampleSelectionSchema, type ProductBindingCheck, type ProfileEvaluation, type ProfileEvaluationOptions, type ProfileEvaluationReceipt, type ProfileEvaluationResult, ProfileEvaluationSchema, type ProfilePreparation, ProfilePreparationSchema, RELEASED_DOCUMENT_PROFILE, RELEASED_DOCUMENT_REQUIREMENTS, RELEASED_DOCUMENT_SELECTION_SCHEMA_ID, REPRODUCTION_PACKET_PROFILE, REPRODUCTION_PACKET_SCHEMA_ID, RESEARCH_EVALUATION_POLICY, RESEARCH_EVALUATION_SCHEMA_ID, type ReleasedDocumentCompletionStatus, type ReleasedDocumentIssue, type ReleasedDocumentReport, type ReleasedDocumentRequirement, type ReleasedDocumentRequirementId, type ReleasedDocumentResult, type ReleasedDocumentSelection, ReleasedDocumentSelectionSchema, type ReproductionFileCheck, type ReproductionPacket, type ReproductionPacketResult, ReproductionPacketSchema, type ResearchCompletionAction, type ResearchCompletionRequirement, type ResearchCompletionStatus, type ResearchEvaluation, type ResearchEvaluationOptions, type ResearchEvaluationOutput, type ResearchEvaluationReceipt, type ResearchEvaluationResult, ResearchEvaluationSchema, type ResearchRequirementId, type ResearchReviewAssetCheck, SOURCE_INTAKE_PROFILE, SOURCE_INTAKE_SCHEMA_ID, type SourceIntake, type SourceIntakeResult, SourceIntakeSchema, acquisitionBindingsJsonSchema, datasetReleaseJsonSchema, evaluateAcquisitionBindings, evaluateAssessmentDocumentation, evaluateContextClaimHistory, evaluateDatasetRelease, evaluateDocumentationCompletion, evaluateHistoricalTestimony, evaluateInstrumentResearchCompletion, evaluateInstrumentResearchPrerequisites, evaluateMeasurementBindings, evaluatePhysicalSamples, evaluateProfileEvaluation, evaluateReleasedDocuments, evaluateReproductionPacket, evaluateResearchEvaluation, evaluateSourceIntake, historicalTestimonySelectionJsonSchema, instrumentResearchReviewJsonSchema, measurementBindingsJsonSchema, migrationCompatibilityJsonSchema, migrationLegacyScoresJsonSchema, migrationResolutionJsonSchema, migrationReviewJsonSchema, physicalSampleSelectionJsonSchema, profileEvaluationJsonSchema, profilePreparationJsonSchema, releasedDocumentSelectionJsonSchema, reproductionPacketJsonSchema, researchEvaluationJsonSchema, sourceIntakeJsonSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseExperimentalClaimHistory, compareUtcInstants } from '@disclosureos/records/experimental/v2';
|
|
1
|
+
import { parseExperimentalClaimHistory, compareUtcInstants, parseContextClaimHistory, parseObservationContext, parseExperimentalObservation, contextAssertions } from '@disclosureos/records/experimental/v2';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { parseAcquisitionContext } from '@disclosureos/instruments/experimental/v2';
|
|
4
4
|
|
|
@@ -4526,7 +4526,410 @@ function migrationCompatibilityJsonSchema() {
|
|
|
4526
4526
|
$id: MIGRATION_COMPATIBILITY_SCHEMA_ID
|
|
4527
4527
|
};
|
|
4528
4528
|
}
|
|
4529
|
+
var CONTEXT_MEASUREMENT_ROLES = {
|
|
4530
|
+
size: {
|
|
4531
|
+
entities: ["reported_object"],
|
|
4532
|
+
quantities: ["size", "length"],
|
|
4533
|
+
units: ["m", "km"]
|
|
4534
|
+
},
|
|
4535
|
+
count: { entities: ["reported_object"], quantities: ["count"], units: ["1"] },
|
|
4536
|
+
speed: {
|
|
4537
|
+
entities: ["reported_object", "platform"],
|
|
4538
|
+
quantities: ["speed"],
|
|
4539
|
+
units: ["m/s", "km/h"]
|
|
4540
|
+
},
|
|
4541
|
+
altitude: {
|
|
4542
|
+
entities: ["reported_object", "platform", "place"],
|
|
4543
|
+
quantities: ["altitude", "elevation"],
|
|
4544
|
+
units: ["m", "km"]
|
|
4545
|
+
},
|
|
4546
|
+
heading: {
|
|
4547
|
+
entities: ["reported_object", "platform"],
|
|
4548
|
+
quantities: ["heading"],
|
|
4549
|
+
units: ["deg"]
|
|
4550
|
+
},
|
|
4551
|
+
ambient_temperature: {
|
|
4552
|
+
entities: ["environment"],
|
|
4553
|
+
quantities: ["temperature", "ambient_temperature"],
|
|
4554
|
+
units: ["Cel", "K"]
|
|
4555
|
+
},
|
|
4556
|
+
relative_humidity: {
|
|
4557
|
+
entities: ["environment"],
|
|
4558
|
+
quantities: ["relative_humidity"],
|
|
4559
|
+
units: ["%"]
|
|
4560
|
+
},
|
|
4561
|
+
wind_speed: {
|
|
4562
|
+
entities: ["environment"],
|
|
4563
|
+
quantities: ["wind_speed"],
|
|
4564
|
+
units: ["m/s", "km/h"]
|
|
4565
|
+
},
|
|
4566
|
+
moon_illumination: {
|
|
4567
|
+
entities: ["environment"],
|
|
4568
|
+
quantities: ["moon_illumination"],
|
|
4569
|
+
units: ["%", "1"]
|
|
4570
|
+
},
|
|
4571
|
+
duration: {
|
|
4572
|
+
entities: ["temporal", "collection"],
|
|
4573
|
+
quantities: ["duration"],
|
|
4574
|
+
units: ["s", "min", "h"]
|
|
4575
|
+
},
|
|
4576
|
+
distance: {
|
|
4577
|
+
entities: ["place"],
|
|
4578
|
+
quantities: ["distance"],
|
|
4579
|
+
units: ["m", "km"]
|
|
4580
|
+
},
|
|
4581
|
+
bearing: { entities: ["place"], quantities: ["bearing"], units: ["deg"] },
|
|
4582
|
+
water_depth: {
|
|
4583
|
+
entities: ["place"],
|
|
4584
|
+
quantities: ["water_depth"],
|
|
4585
|
+
units: ["m"]
|
|
4586
|
+
},
|
|
4587
|
+
coordinate_precision: {
|
|
4588
|
+
entities: ["place"],
|
|
4589
|
+
quantities: ["coordinate_precision"],
|
|
4590
|
+
units: ["m"]
|
|
4591
|
+
},
|
|
4592
|
+
time_alignment: {
|
|
4593
|
+
entities: ["collection"],
|
|
4594
|
+
quantities: ["time_alignment_uncertainty"],
|
|
4595
|
+
units: ["s", "ms"]
|
|
4596
|
+
}
|
|
4597
|
+
};
|
|
4598
|
+
function equal(a, b) {
|
|
4599
|
+
if (a === b) return true;
|
|
4600
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
|
|
4601
|
+
if (Array.isArray(a) || Array.isArray(b))
|
|
4602
|
+
return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((v, i) => equal(v, b[i]));
|
|
4603
|
+
const x = a, y = b;
|
|
4604
|
+
return Object.keys(x).length === Object.keys(y).length && Object.keys(x).every(
|
|
4605
|
+
(k) => Object.prototype.hasOwnProperty.call(y, k) && equal(x[k], y[k])
|
|
4606
|
+
);
|
|
4607
|
+
}
|
|
4608
|
+
async function evaluateContextClaimHistory(input, options) {
|
|
4609
|
+
const history = parseContextClaimHistory(input);
|
|
4610
|
+
const issues = history.issues.map((i) => ({
|
|
4611
|
+
code: i.code,
|
|
4612
|
+
stage: i.stage,
|
|
4613
|
+
pointer: i.pointer,
|
|
4614
|
+
message: i.message
|
|
4615
|
+
}));
|
|
4616
|
+
const snapshots = [];
|
|
4617
|
+
const contexts = /* @__PURE__ */ new Map();
|
|
4618
|
+
const problem = (code, pointer6, message, stage = "semantic") => issues.push({ code, pointer: pointer6, message, stage });
|
|
4619
|
+
async function load(ref5, pointer6) {
|
|
4620
|
+
const supplied = options.documents.get(ref5.sha256);
|
|
4621
|
+
const bytes = supplied ? Uint8Array.from(supplied) : void 0;
|
|
4622
|
+
if (!bytes) {
|
|
4623
|
+
snapshots.push({ ...ref5, status: "unavailable" });
|
|
4624
|
+
problem(
|
|
4625
|
+
"SNAPSHOT.UNAVAILABLE",
|
|
4626
|
+
pointer6,
|
|
4627
|
+
"Required snapshot bytes were not supplied.",
|
|
4628
|
+
"external"
|
|
4629
|
+
);
|
|
4630
|
+
return;
|
|
4631
|
+
}
|
|
4632
|
+
if ([
|
|
4633
|
+
...new Uint8Array(
|
|
4634
|
+
await globalThis.crypto.subtle.digest("SHA-256", bytes)
|
|
4635
|
+
)
|
|
4636
|
+
].map((b) => b.toString(16).padStart(2, "0")).join("") !== ref5.sha256) {
|
|
4637
|
+
snapshots.push({ ...ref5, status: "failed" });
|
|
4638
|
+
problem(
|
|
4639
|
+
"SNAPSHOT.DIGEST",
|
|
4640
|
+
pointer6,
|
|
4641
|
+
"Supplied bytes do not match the reference digest.",
|
|
4642
|
+
"external"
|
|
4643
|
+
);
|
|
4644
|
+
return;
|
|
4645
|
+
}
|
|
4646
|
+
let value;
|
|
4647
|
+
try {
|
|
4648
|
+
value = JSON.parse(
|
|
4649
|
+
new TextDecoder("utf-8", { fatal: true }).decode(bytes)
|
|
4650
|
+
);
|
|
4651
|
+
} catch {
|
|
4652
|
+
snapshots.push({ ...ref5, status: "failed" });
|
|
4653
|
+
problem(
|
|
4654
|
+
"SNAPSHOT.JSON",
|
|
4655
|
+
pointer6,
|
|
4656
|
+
"Snapshot is not a UTF-8 JSON document.",
|
|
4657
|
+
"external"
|
|
4658
|
+
);
|
|
4659
|
+
return;
|
|
4660
|
+
}
|
|
4661
|
+
snapshots.push({ ...ref5, status: "passed" });
|
|
4662
|
+
if (!value || typeof value !== "object" || value.id !== ref5.documentId) {
|
|
4663
|
+
problem(
|
|
4664
|
+
"SNAPSHOT.IDENTITY",
|
|
4665
|
+
pointer6,
|
|
4666
|
+
"Snapshot document ID does not match its reference."
|
|
4667
|
+
);
|
|
4668
|
+
return;
|
|
4669
|
+
}
|
|
4670
|
+
return value;
|
|
4671
|
+
}
|
|
4672
|
+
async function checkContext(context, observation, p) {
|
|
4673
|
+
const sources = new Map([
|
|
4674
|
+
...observation.sources.map((s) => [`source:${s.id}`, s]),
|
|
4675
|
+
...observation.products.map((s) => [`product:${s.id}`, s])
|
|
4676
|
+
]);
|
|
4677
|
+
const methods = new Map(
|
|
4678
|
+
observation.methods.map((m) => [`method:${m.id}`, m])
|
|
4679
|
+
);
|
|
4680
|
+
const measurements = new Map(
|
|
4681
|
+
observation.measurements.map((m) => [m.id, m])
|
|
4682
|
+
);
|
|
4683
|
+
let acquisitionIds;
|
|
4684
|
+
if (context.acquisitionRef) {
|
|
4685
|
+
const value = await load(context.acquisitionRef, `${p}/acquisitionRef`);
|
|
4686
|
+
if (value !== void 0) {
|
|
4687
|
+
const acquisition = parseAcquisitionContext(value);
|
|
4688
|
+
if (!acquisition.success)
|
|
4689
|
+
problem(
|
|
4690
|
+
"CONTEXT.ACQUISITION",
|
|
4691
|
+
`${p}/acquisitionRef`,
|
|
4692
|
+
"Acquisition snapshot does not satisfy its declared contract.",
|
|
4693
|
+
acquisition.checks.structural === "failed" ? "structural" : "semantic"
|
|
4694
|
+
);
|
|
4695
|
+
else
|
|
4696
|
+
acquisitionIds = new Set(
|
|
4697
|
+
acquisition.data.acquisitions.map((a) => a.id)
|
|
4698
|
+
);
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
for (const [index, entity] of context.entities.entries()) {
|
|
4702
|
+
const ep = `${p}/entities/${index}`;
|
|
4703
|
+
for (const { field, assertion } of contextAssertions(entity)) {
|
|
4704
|
+
const prov = assertion.content.provenance;
|
|
4705
|
+
if (prov) {
|
|
4706
|
+
const source = sources.get(prov.sourceRef);
|
|
4707
|
+
if (!source)
|
|
4708
|
+
problem(
|
|
4709
|
+
"REF.LOCAL_RESOLUTION",
|
|
4710
|
+
ep,
|
|
4711
|
+
"Context source is absent from the scoped observation."
|
|
4712
|
+
);
|
|
4713
|
+
else if (source.digest && prov.sourceDigest && source.digest.value !== prov.sourceDigest.value)
|
|
4714
|
+
problem(
|
|
4715
|
+
"SOURCE.DIGEST_MISMATCH",
|
|
4716
|
+
ep,
|
|
4717
|
+
"Source digest declarations differ."
|
|
4718
|
+
);
|
|
4719
|
+
}
|
|
4720
|
+
const value = assertion.content.value;
|
|
4721
|
+
if (value === void 0) continue;
|
|
4722
|
+
if (field === "productRefs") {
|
|
4723
|
+
for (const ref5 of value)
|
|
4724
|
+
if (!sources.has(ref5))
|
|
4725
|
+
problem(
|
|
4726
|
+
"REF.LOCAL_RESOLUTION",
|
|
4727
|
+
ep,
|
|
4728
|
+
"Collection artifact is not declared."
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4731
|
+
if (field === "acquisitionIds") {
|
|
4732
|
+
for (const id12 of value)
|
|
4733
|
+
if (!acquisitionIds?.has(id12))
|
|
4734
|
+
problem(
|
|
4735
|
+
"REF.ACQUISITION",
|
|
4736
|
+
ep,
|
|
4737
|
+
"Acquisition ID needs a supplied, valid acquisition snapshot."
|
|
4738
|
+
);
|
|
4739
|
+
}
|
|
4740
|
+
if (field === "position") {
|
|
4741
|
+
const checked = parseExperimentalObservation({
|
|
4742
|
+
...observation,
|
|
4743
|
+
position: { state: "known", value, sourceRefs: [prov.sourceRef] }
|
|
4744
|
+
});
|
|
4745
|
+
if (!checked.success)
|
|
4746
|
+
problem(
|
|
4747
|
+
"CONTEXT.POSITION",
|
|
4748
|
+
ep,
|
|
4749
|
+
"Context position must satisfy the observation frame, unit and source-reference rules."
|
|
4750
|
+
);
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
for (const selection of entity.selections ?? []) {
|
|
4754
|
+
if (methods.get(selection.methodRef)?.version !== selection.methodVersion)
|
|
4755
|
+
problem(
|
|
4756
|
+
"METHOD.VERSION_MISMATCH",
|
|
4757
|
+
ep,
|
|
4758
|
+
"Selection method/version must match the observation inventory."
|
|
4759
|
+
);
|
|
4760
|
+
}
|
|
4761
|
+
const proximityLinks = contextAssertions(entity).flatMap(
|
|
4762
|
+
({ field, assertion }) => {
|
|
4763
|
+
if (field !== "proximity" || !assertion.content.value) return [];
|
|
4764
|
+
const value = assertion.content.value;
|
|
4765
|
+
return [
|
|
4766
|
+
...value.distanceMeasurementId ? [
|
|
4767
|
+
{
|
|
4768
|
+
id: assertion.id,
|
|
4769
|
+
role: "distance",
|
|
4770
|
+
measurementId: value.distanceMeasurementId,
|
|
4771
|
+
relatedPlaceId: value.targetPlaceId
|
|
4772
|
+
}
|
|
4773
|
+
] : [],
|
|
4774
|
+
...value.bearingMeasurementId ? [
|
|
4775
|
+
{
|
|
4776
|
+
id: assertion.id,
|
|
4777
|
+
role: "bearing",
|
|
4778
|
+
measurementId: value.bearingMeasurementId,
|
|
4779
|
+
relatedPlaceId: value.targetPlaceId
|
|
4780
|
+
}
|
|
4781
|
+
] : []
|
|
4782
|
+
];
|
|
4783
|
+
}
|
|
4784
|
+
);
|
|
4785
|
+
for (const link of [...entity.measurements ?? [], ...proximityLinks]) {
|
|
4786
|
+
const role = CONTEXT_MEASUREMENT_ROLES[link.role];
|
|
4787
|
+
const measurement = measurements.get(link.measurementId);
|
|
4788
|
+
if (!measurement) {
|
|
4789
|
+
problem(
|
|
4790
|
+
"REF.MEASUREMENT",
|
|
4791
|
+
ep,
|
|
4792
|
+
"Measurement is absent from the scoped observation."
|
|
4793
|
+
);
|
|
4794
|
+
continue;
|
|
4795
|
+
}
|
|
4796
|
+
if (!role.entities.includes(entity.kind) || !role.quantities.includes(
|
|
4797
|
+
measurement.quantity
|
|
4798
|
+
) || !role.units.includes(measurement.value.unit))
|
|
4799
|
+
problem(
|
|
4800
|
+
"CONTEXT.MEASUREMENT_ROLE",
|
|
4801
|
+
ep,
|
|
4802
|
+
"Measurement entity, quantity and unit must match the declared role."
|
|
4803
|
+
);
|
|
4804
|
+
const value = measurement.value.value;
|
|
4805
|
+
if ([
|
|
4806
|
+
"count",
|
|
4807
|
+
"size",
|
|
4808
|
+
"speed",
|
|
4809
|
+
"wind_speed",
|
|
4810
|
+
"duration",
|
|
4811
|
+
"distance",
|
|
4812
|
+
"water_depth",
|
|
4813
|
+
"coordinate_precision",
|
|
4814
|
+
"time_alignment"
|
|
4815
|
+
].includes(link.role) && value < 0)
|
|
4816
|
+
problem(
|
|
4817
|
+
"CONTEXT.MEASUREMENT_RANGE",
|
|
4818
|
+
ep,
|
|
4819
|
+
"This role cannot be negative."
|
|
4820
|
+
);
|
|
4821
|
+
if (link.role === "count" && !Number.isInteger(value))
|
|
4822
|
+
problem("CONTEXT.MEASUREMENT_RANGE", ep, "Count must be an integer.");
|
|
4823
|
+
if (["heading", "bearing"].includes(link.role) && (value < 0 || value > 360))
|
|
4824
|
+
problem(
|
|
4825
|
+
"CONTEXT.MEASUREMENT_RANGE",
|
|
4826
|
+
ep,
|
|
4827
|
+
"Direction must lie between zero and 360 degrees."
|
|
4828
|
+
);
|
|
4829
|
+
if (["relative_humidity", "moon_illumination"].includes(link.role) && (value < 0 || value > (measurement.value.unit === "1" ? 1 : 100)))
|
|
4830
|
+
problem(
|
|
4831
|
+
"CONTEXT.MEASUREMENT_RANGE",
|
|
4832
|
+
ep,
|
|
4833
|
+
"Fraction lies outside its unit range."
|
|
4834
|
+
);
|
|
4835
|
+
if (["distance", "bearing"].includes(link.role) && !link.relatedPlaceId)
|
|
4836
|
+
problem(
|
|
4837
|
+
"CONTEXT.RELATED_PLACE",
|
|
4838
|
+
ep,
|
|
4839
|
+
"Distance and bearing must identify the other place."
|
|
4840
|
+
);
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
if (history.success) {
|
|
4845
|
+
let resolve2 = function(reference, pointer6, assertionId) {
|
|
4846
|
+
const context = contexts.get(reference.document.sha256);
|
|
4847
|
+
if (!context) return;
|
|
4848
|
+
const entity = context.entities.find(
|
|
4849
|
+
(e) => e.kind === reference.target.kind && e.id === reference.target.id
|
|
4850
|
+
);
|
|
4851
|
+
if (!entity) {
|
|
4852
|
+
problem(
|
|
4853
|
+
"REF.ENTITY",
|
|
4854
|
+
pointer6,
|
|
4855
|
+
"Typed entity is absent from the selected snapshot."
|
|
4856
|
+
);
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
const assertions = contextAssertions(entity);
|
|
4860
|
+
if (reference.target.field && !assertions.some((a) => a.field === reference.target.field))
|
|
4861
|
+
problem(
|
|
4862
|
+
"REF.FIELD",
|
|
4863
|
+
pointer6,
|
|
4864
|
+
"Target field has no supplied assertions."
|
|
4865
|
+
);
|
|
4866
|
+
if (assertionId && (!reference.target.field || !assertions.some(
|
|
4867
|
+
(a) => a.field === reference.target.field && a.assertion.id === assertionId
|
|
4868
|
+
)))
|
|
4869
|
+
problem(
|
|
4870
|
+
"REF.ASSERTION",
|
|
4871
|
+
pointer6,
|
|
4872
|
+
"Assessment input must select an existing assertion on its named field."
|
|
4873
|
+
);
|
|
4874
|
+
};
|
|
4875
|
+
for (const [i, ref5] of history.data.contextRefs.entries()) {
|
|
4876
|
+
const p = `/contextRefs/${i}`;
|
|
4877
|
+
const value = await load(ref5, p);
|
|
4878
|
+
if (value === void 0) continue;
|
|
4879
|
+
const parsed = parseObservationContext(value);
|
|
4880
|
+
if (!parsed.success) {
|
|
4881
|
+
issues.push(
|
|
4882
|
+
...parsed.issues.map((i2) => ({ ...i2, pointer: p + i2.pointer }))
|
|
4883
|
+
);
|
|
4884
|
+
continue;
|
|
4885
|
+
}
|
|
4886
|
+
const context = parsed.data;
|
|
4887
|
+
const observationBytes = await load(
|
|
4888
|
+
context.observationRef,
|
|
4889
|
+
`${p}/observationRef`
|
|
4890
|
+
);
|
|
4891
|
+
if (observationBytes === void 0) continue;
|
|
4892
|
+
const observation = parseExperimentalObservation(observationBytes);
|
|
4893
|
+
if (!observation.success || !equal(observationBytes, history.data.observation)) {
|
|
4894
|
+
problem(
|
|
4895
|
+
"CONTEXT.OBSERVATION_SCOPE",
|
|
4896
|
+
p,
|
|
4897
|
+
"Context must select the same complete observation snapshot as the history.",
|
|
4898
|
+
observation.checks.structural === "failed" ? "structural" : "semantic"
|
|
4899
|
+
);
|
|
4900
|
+
continue;
|
|
4901
|
+
}
|
|
4902
|
+
await checkContext(context, observation.data, p);
|
|
4903
|
+
contexts.set(ref5.sha256, context);
|
|
4904
|
+
}
|
|
4905
|
+
for (const [i, claim] of history.data.claims.entries()) {
|
|
4906
|
+
if (claim.subject.kind === "context")
|
|
4907
|
+
resolve2(claim.subject.reference, `/claims/${i}/subject`);
|
|
4908
|
+
if (claim.kind === "assessment")
|
|
4909
|
+
for (const [j, ref5] of (claim.contextInputRefs ?? []).entries())
|
|
4910
|
+
resolve2(ref5, `/claims/${i}/contextInputRefs/${j}`, ref5.assertionId);
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
const external = snapshots.some((s) => s.status === "failed") ? "failed" : snapshots.some((s) => s.status === "unavailable") || !snapshots.length ? "not_checked" : "passed";
|
|
4914
|
+
return {
|
|
4915
|
+
success: history.success && issues.length === 0,
|
|
4916
|
+
issues,
|
|
4917
|
+
snapshots,
|
|
4918
|
+
checks: {
|
|
4919
|
+
structural: issues.some((i) => i.stage === "structural") ? "failed" : history.checks.structural,
|
|
4920
|
+
semantic: history.checks.structural === "failed" || issues.some((i) => i.stage === "structural") ? "not_checked" : issues.some((i) => i.stage !== "external") ? "failed" : issues.length ? "not_checked" : "passed",
|
|
4921
|
+
profile: "not_checked",
|
|
4922
|
+
external
|
|
4923
|
+
},
|
|
4924
|
+
currentClaimRefs: history.success && issues.length === 0 ? history.currentClaimRefs : [],
|
|
4925
|
+
integrityScope: "supplied_context_observation_and_acquisition_snapshot_bytes",
|
|
4926
|
+
temporalNormalization: "not_checked",
|
|
4927
|
+
sourceArtifactIntegrity: "not_checked",
|
|
4928
|
+
scientificInterpretation: "not_checked",
|
|
4929
|
+
multiSensorFusion: "not_checked"
|
|
4930
|
+
};
|
|
4931
|
+
}
|
|
4529
4932
|
|
|
4530
|
-
export { ACQUISITION_BINDINGS_PROFILE, ACQUISITION_BINDINGS_SCHEMA_ID, ASSESSMENT_DOCUMENTATION_PROFILE, AcquisitionBindingsSchema, DATASET_RELEASE_PROFILE, DATASET_RELEASE_SCHEMA_ID, DOCUMENTATION_COMPLETION_POLICY, DOCUMENTATION_REQUIREMENTS, DatasetReleaseSchema, HISTORICAL_TESTIMONY_PROFILE, HISTORICAL_TESTIMONY_REQUIREMENTS, HISTORICAL_TESTIMONY_SELECTION_SCHEMA_ID, HistoricalTestimonySelectionSchema, INSTRUMENT_RESEARCH_COMPLETION_POLICY, INSTRUMENT_RESEARCH_PREREQUISITES_PROFILE, INSTRUMENT_RESEARCH_REQUIREMENTS, INSTRUMENT_RESEARCH_REVIEW_SCHEMA_ID, InstrumentResearchReviewSchema, MEASUREMENT_BINDINGS_PROFILE, MEASUREMENT_BINDINGS_SCHEMA_ID, MIGRATION_COMPATIBILITY_SCHEMA_ID, MIGRATION_LEGACY_SCORES_SCHEMA_ID, MIGRATION_RESOLUTION_SCHEMA_ID, MIGRATION_REVIEW_SCHEMA_ID, MeasurementBindingsSchema, MigrationCompatibilitySchema, MigrationLegacyScoresSchema, MigrationResolutionSchema, MigrationReviewSchema, PHYSICAL_SAMPLE_PROFILE, PHYSICAL_SAMPLE_REQUIREMENTS, PHYSICAL_SAMPLE_SELECTION_SCHEMA_ID, PROFILE_EVALUATION_POLICY, PROFILE_EVALUATION_SCHEMA_ID, PROFILE_PREPARATION_SCHEMA_ID, PhysicalSampleSelectionSchema, ProfileEvaluationSchema, ProfilePreparationSchema, RELEASED_DOCUMENT_PROFILE, RELEASED_DOCUMENT_REQUIREMENTS, RELEASED_DOCUMENT_SELECTION_SCHEMA_ID, REPRODUCTION_PACKET_PROFILE, REPRODUCTION_PACKET_SCHEMA_ID, RESEARCH_EVALUATION_POLICY, RESEARCH_EVALUATION_SCHEMA_ID, ReleasedDocumentSelectionSchema, ReproductionPacketSchema, ResearchEvaluationSchema, SOURCE_INTAKE_PROFILE, SOURCE_INTAKE_SCHEMA_ID, SourceIntakeSchema, acquisitionBindingsJsonSchema, datasetReleaseJsonSchema, evaluateAcquisitionBindings, evaluateAssessmentDocumentation, evaluateDatasetRelease, evaluateDocumentationCompletion, evaluateHistoricalTestimony, evaluateInstrumentResearchCompletion, evaluateInstrumentResearchPrerequisites, evaluateMeasurementBindings, evaluatePhysicalSamples, evaluateProfileEvaluation, evaluateReleasedDocuments, evaluateReproductionPacket, evaluateResearchEvaluation, evaluateSourceIntake, historicalTestimonySelectionJsonSchema, instrumentResearchReviewJsonSchema, measurementBindingsJsonSchema, migrationCompatibilityJsonSchema, migrationLegacyScoresJsonSchema, migrationResolutionJsonSchema, migrationReviewJsonSchema, physicalSampleSelectionJsonSchema, profileEvaluationJsonSchema, profilePreparationJsonSchema, releasedDocumentSelectionJsonSchema, reproductionPacketJsonSchema, researchEvaluationJsonSchema, sourceIntakeJsonSchema };
|
|
4933
|
+
export { ACQUISITION_BINDINGS_PROFILE, ACQUISITION_BINDINGS_SCHEMA_ID, ASSESSMENT_DOCUMENTATION_PROFILE, AcquisitionBindingsSchema, CONTEXT_MEASUREMENT_ROLES, DATASET_RELEASE_PROFILE, DATASET_RELEASE_SCHEMA_ID, DOCUMENTATION_COMPLETION_POLICY, DOCUMENTATION_REQUIREMENTS, DatasetReleaseSchema, HISTORICAL_TESTIMONY_PROFILE, HISTORICAL_TESTIMONY_REQUIREMENTS, HISTORICAL_TESTIMONY_SELECTION_SCHEMA_ID, HistoricalTestimonySelectionSchema, INSTRUMENT_RESEARCH_COMPLETION_POLICY, INSTRUMENT_RESEARCH_PREREQUISITES_PROFILE, INSTRUMENT_RESEARCH_REQUIREMENTS, INSTRUMENT_RESEARCH_REVIEW_SCHEMA_ID, InstrumentResearchReviewSchema, MEASUREMENT_BINDINGS_PROFILE, MEASUREMENT_BINDINGS_SCHEMA_ID, MIGRATION_COMPATIBILITY_SCHEMA_ID, MIGRATION_LEGACY_SCORES_SCHEMA_ID, MIGRATION_RESOLUTION_SCHEMA_ID, MIGRATION_REVIEW_SCHEMA_ID, MeasurementBindingsSchema, MigrationCompatibilitySchema, MigrationLegacyScoresSchema, MigrationResolutionSchema, MigrationReviewSchema, PHYSICAL_SAMPLE_PROFILE, PHYSICAL_SAMPLE_REQUIREMENTS, PHYSICAL_SAMPLE_SELECTION_SCHEMA_ID, PROFILE_EVALUATION_POLICY, PROFILE_EVALUATION_SCHEMA_ID, PROFILE_PREPARATION_SCHEMA_ID, PhysicalSampleSelectionSchema, ProfileEvaluationSchema, ProfilePreparationSchema, RELEASED_DOCUMENT_PROFILE, RELEASED_DOCUMENT_REQUIREMENTS, RELEASED_DOCUMENT_SELECTION_SCHEMA_ID, REPRODUCTION_PACKET_PROFILE, REPRODUCTION_PACKET_SCHEMA_ID, RESEARCH_EVALUATION_POLICY, RESEARCH_EVALUATION_SCHEMA_ID, ReleasedDocumentSelectionSchema, ReproductionPacketSchema, ResearchEvaluationSchema, SOURCE_INTAKE_PROFILE, SOURCE_INTAKE_SCHEMA_ID, SourceIntakeSchema, acquisitionBindingsJsonSchema, datasetReleaseJsonSchema, evaluateAcquisitionBindings, evaluateAssessmentDocumentation, evaluateContextClaimHistory, evaluateDatasetRelease, evaluateDocumentationCompletion, evaluateHistoricalTestimony, evaluateInstrumentResearchCompletion, evaluateInstrumentResearchPrerequisites, evaluateMeasurementBindings, evaluatePhysicalSamples, evaluateProfileEvaluation, evaluateReleasedDocuments, evaluateReproductionPacket, evaluateResearchEvaluation, evaluateSourceIntake, historicalTestimonySelectionJsonSchema, instrumentResearchReviewJsonSchema, measurementBindingsJsonSchema, migrationCompatibilityJsonSchema, migrationLegacyScoresJsonSchema, migrationResolutionJsonSchema, migrationReviewJsonSchema, physicalSampleSelectionJsonSchema, profileEvaluationJsonSchema, profilePreparationJsonSchema, releasedDocumentSelectionJsonSchema, reproductionPacketJsonSchema, researchEvaluationJsonSchema, sourceIntakeJsonSchema };
|
|
4531
4934
|
//# sourceMappingURL=index.js.map
|
|
4532
4935
|
//# sourceMappingURL=index.js.map
|