yarramate 1.15.3 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-mapping.js +1 -11
- package/dist/apply-command.js +1 -12
- package/dist/compiler.js +1 -13
- package/dist/core-contract.js +1 -11
- package/dist/evidence.js +1 -11
- package/dist/interrogate-command.js +1 -11
- package/dist/projection.js +1 -7
- package/dist/schema-validation.d.ts +39 -9
- package/dist/schema-validation.js +36 -39
- package/dist/schema-validators-operations.generated.d.ts +7 -0
- package/dist/schema-validators-operations.generated.js +3919 -0
- package/dist/schema-validators.generated.d.ts +55 -0
- package/dist/schema-validators.generated.js +11551 -0
- package/dist/visual-app/assets/{index-Bhq3K16z.js → index-CV1UFvsk.js} +1 -1
- package/dist/visual-app/index.html +1 -1
- package/dist/visual-app-lib/editor.js +43527 -34185
- package/dist/visual-app-lib/types/schema-validation.d.ts +39 -9
- package/dist/visual-app-lib/types/schema-validators-operations.generated.d.ts +7 -0
- package/dist/visual-app-lib/types/schema-validators.generated.d.ts +55 -0
- package/dist/workspace.js +1 -9
- package/package.json +2 -1
package/dist/adapter-mapping.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
2
1
|
import { diagnosticOrder, loadSourceDocument, locateSourcePath, } from './source-document.js';
|
|
3
|
-
import {
|
|
4
|
-
import adapterMappingSchema from '../schema/yarramate-adapter-mapping.schema.json' with { type: 'json'
|
|
5
|
-
};
|
|
6
|
-
// `.default ?? module`, not a bare `.default`: NodeNext sees the raw CJS
|
|
7
|
-
// `module.exports` and a bundler the unwrapped class. One shape for all of
|
|
8
|
-
// them, so which modules a browser happens to reach is not a thing anyone has
|
|
9
|
-
// to keep track of (#252).
|
|
10
|
-
const ajv2020Module = Ajv2020Module;
|
|
11
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
12
|
-
const validateSchema = compileValidator(adapterMappingSchema);
|
|
2
|
+
import { validateAdapterMapping as validateSchema } from './schema-validation.js';
|
|
13
3
|
const mappingLocations = new WeakMap();
|
|
14
4
|
export function loadAdapterMapping(source) {
|
|
15
5
|
const loaded = loadSourceDocument(source, validateSchema, 'Adapter mapping');
|
package/dist/apply-command.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isMap, isScalar, isSeq, parseDocument, } from 'yaml';
|
|
2
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
3
2
|
import { loadAdapterMapping } from './adapter-mapping.js';
|
|
4
3
|
import { compileWorkspace, withDiagnosticSubjects, } from './compiler.js';
|
|
5
4
|
import { evaluateEvidence, loadEvidence } from './evidence.js';
|
|
@@ -20,19 +19,9 @@ export const posixDirectoryOf = (path) => {
|
|
|
20
19
|
const cut = normalised.lastIndexOf('/');
|
|
21
20
|
return cut === -1 ? '' : normalised.slice(0, cut);
|
|
22
21
|
};
|
|
23
|
-
import
|
|
24
|
-
};
|
|
25
|
-
import { compileValidatorWith } from './schema-validation.js';
|
|
26
|
-
// `.default ?? module`, not a bare `.default`: NodeNext sees the raw CJS
|
|
27
|
-
// `module.exports` and a bundler sees the unwrapped class, and this file is
|
|
28
|
-
// reachable from a browser through `./apply-operations.js` (#252).
|
|
29
|
-
const ajv2020Module = Ajv2020Module;
|
|
30
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
22
|
+
import { validateOperations } from './schema-validation.js';
|
|
31
23
|
// `discriminator` routes a batch entry to the single branch its `op` names, so
|
|
32
24
|
// one malformed operation reports one fault instead of ten near-misses.
|
|
33
|
-
// Keeps its own Ajv instance: `discriminator` changes how a schema compiles,
|
|
34
|
-
// so it cannot share one with the nine that do not set it.
|
|
35
|
-
const validateOperations = compileValidatorWith({ allErrors: true, discriminator: true }, operationsSchema);
|
|
36
25
|
// Scalar fields replace; list fields append; `remove` retracts (ADR 0062).
|
|
37
26
|
// An answer enriches what is there and may explicitly take back what it
|
|
38
27
|
// asserted — it never silently shrinks anything.
|
package/dist/compiler.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import Ajv2020Import from 'ajv/dist/2020.js';
|
|
2
1
|
import { LineCounter, parse, parseDocument } from 'yaml';
|
|
3
2
|
import { conceptKinds, relationshipPolicies, } from './profile.js';
|
|
4
3
|
import { isCoreConceptKindId, matrixEndpointAspects, permittedRelationshipKinds as tablePermittedKinds, } from './relationship-matrix.js';
|
|
5
4
|
import { closestCandidate, describeSchemaViolation, } from './source-document.js';
|
|
6
|
-
import documentSchema from '../schema/yarramate-document.schema.json' with { type: 'json'
|
|
7
|
-
};
|
|
8
|
-
import profileSchema from '../schema/yarramate-profile.schema.json' with { type: 'json'
|
|
9
|
-
};
|
|
10
|
-
import patternSchema from '../schema/yarramate-pattern.schema.json' with { type: 'json'
|
|
11
|
-
};
|
|
12
5
|
import { ATTESTATION_PREDICATE_PREFIX, attestationClaimValue } from './graph-claims.js';
|
|
13
6
|
import { shippedPolicyIdentity, shippedPolicySource, } from './shipped-profile.js';
|
|
14
|
-
import {
|
|
7
|
+
import { validateDocument, validateProfile, validatePattern } from './schema-validation.js';
|
|
15
8
|
const coreProfile = 'yarramate/core@0.1';
|
|
16
|
-
const ajv2020Module = Ajv2020Import;
|
|
17
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
18
|
-
const validateDocument = compileValidator(documentSchema);
|
|
19
|
-
const validateProfile = compileValidator(profileSchema);
|
|
20
|
-
const validatePattern = compileValidator(patternSchema);
|
|
21
9
|
const immutableMap = (entries) => {
|
|
22
10
|
const backing = new Map(entries);
|
|
23
11
|
const facade = {
|
package/dist/core-contract.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
2
1
|
import { LineCounter, parseDocument } from 'yaml';
|
|
3
2
|
import { diagnosticOrder, loadSourceDocument, locateSourcePath, } from './source-document.js';
|
|
4
|
-
import {
|
|
5
|
-
import coreContractSchema from '../schema/yarramate-core-contract.schema.json' with { type: 'json'
|
|
6
|
-
};
|
|
7
|
-
// `.default ?? module`, not a bare `.default`: NodeNext sees the raw CJS
|
|
8
|
-
// `module.exports` and a bundler the unwrapped class. One shape for all of
|
|
9
|
-
// them, so which modules a browser happens to reach is not a thing anyone has
|
|
10
|
-
// to keep track of (#252).
|
|
11
|
-
const ajv2020Module = Ajv2020Module;
|
|
12
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
13
|
-
const validateCoreContract = compileValidator(coreContractSchema);
|
|
3
|
+
import { validateCoreContract } from './schema-validation.js';
|
|
14
4
|
export function loadCoreContract(source) {
|
|
15
5
|
const loaded = loadSourceDocument(source, validateCoreContract, 'Core contract');
|
|
16
6
|
if (!loaded.ok)
|
package/dist/evidence.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
2
1
|
import { diagnosticOrder, loadSourceDocument, locateSourcePath, } from './source-document.js';
|
|
3
|
-
import
|
|
4
|
-
};
|
|
5
|
-
// `.default ?? module`, not a bare `.default`: NodeNext sees the raw CJS
|
|
6
|
-
// `module.exports` and a bundler the unwrapped class. One shape for all of
|
|
7
|
-
// them, so which modules a browser happens to reach is not a thing anyone has
|
|
8
|
-
// to keep track of (#252).
|
|
9
|
-
const ajv2020Module = Ajv2020Module;
|
|
10
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
11
|
-
import { compileValidator } from './schema-validation.js';
|
|
12
|
-
const validateEvidenceSchema = compileValidator(evidenceSchema);
|
|
2
|
+
import { validateEvidence as validateEvidenceSchema } from './schema-validation.js';
|
|
13
3
|
const evidenceLocations = new WeakMap();
|
|
14
4
|
const observationTarget = (observation) => 'subject' in observation ? observation.subject : observation.claim;
|
|
15
5
|
export function loadEvidence(source) {
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
2
1
|
import { loadSourceDocument, locateSourcePath, } from './source-document.js';
|
|
3
2
|
import { nearDuplicateIndex } from './subject-identity.js';
|
|
4
3
|
import { sourceKindsPermitting, tableKnowsConceptKind, tableKnowsRelationshipKind, targetKindsPermitting, } from './relationship-matrix.js';
|
|
5
|
-
import
|
|
6
|
-
};
|
|
7
|
-
// `.default ?? module`, not a bare `.default`: NodeNext sees the raw CJS
|
|
8
|
-
// `module.exports` and a bundler the unwrapped class. One shape for all of
|
|
9
|
-
// them, so which modules a browser happens to reach is not a thing anyone has
|
|
10
|
-
// to keep track of (#252).
|
|
11
|
-
const ajv2020Module = Ajv2020Module;
|
|
12
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
13
|
-
import { compileValidator } from './schema-validation.js';
|
|
14
|
-
const validateCatalogue = compileValidator(catalogueSchema);
|
|
4
|
+
import { validateCatalogue } from './schema-validation.js';
|
|
15
5
|
/**
|
|
16
6
|
* The version of condition evaluation itself, not of the package.
|
|
17
7
|
*
|
package/dist/projection.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import Ajv2020Import from 'ajv/dist/2020.js';
|
|
2
1
|
import { isDeclaredNonGoal } from './brief.js';
|
|
3
2
|
import { loadSourceDocument } from './source-document.js';
|
|
4
3
|
import { similarity } from './subject-identity.js';
|
|
5
|
-
import projectionSchema from '../schema/yarramate-projection.schema.json' with { type: 'json'
|
|
6
|
-
};
|
|
7
|
-
const ajv2020Module = Ajv2020Import;
|
|
8
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
9
|
-
const validateProjection = compileValidator(projectionSchema);
|
|
10
4
|
/**
|
|
11
5
|
* A relationship kind a view may draw as nesting, and the default. Defined in
|
|
12
6
|
* `./nesting.js`, which imports nothing, and re-exported here so a consumer
|
|
@@ -20,7 +14,7 @@ export { DEFAULT_NESTING } from './nesting.js';
|
|
|
20
14
|
* nesting vocabulary above, and re-exported here on the same terms (ADR 0121).
|
|
21
15
|
*/
|
|
22
16
|
export { DEFAULT_DIRECTION } from './layout-direction.js';
|
|
23
|
-
import {
|
|
17
|
+
import { validateProjection } from './schema-validation.js';
|
|
24
18
|
export function loadProjection(source) {
|
|
25
19
|
const loaded = loadSourceDocument(source, validateProjection, 'Projection');
|
|
26
20
|
return loaded.ok
|
|
@@ -1,12 +1,42 @@
|
|
|
1
|
-
import Ajv2020Module from 'ajv/dist/2020.js';
|
|
2
1
|
import type { ValidateFunction } from 'ajv';
|
|
3
|
-
declare const Ajv2020: typeof Ajv2020Module & typeof Ajv2020Module.Ajv2020;
|
|
4
|
-
/** Compiles on the shared `allErrors` instance. */
|
|
5
|
-
export declare const compileValidator: <T = unknown>(schema: object) => ValidateFunction<T>;
|
|
6
2
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
3
|
+
* The package's JSON Schema validators, precompiled at BUILD time.
|
|
4
|
+
*
|
|
5
|
+
* Ajv normally compiles a schema by generating source and calling
|
|
6
|
+
* `new Function`, and where that happens decided two releases:
|
|
7
|
+
*
|
|
8
|
+
* - Cloudflare's `workerd` **permits** code generation during module
|
|
9
|
+
* evaluation and **forbids** it at request time. 1.15.2 deferred compilation
|
|
10
|
+
* to first use to save startup CPU, which put it inside a request, and every
|
|
11
|
+
* request that validated anything threw `EvalError`.
|
|
12
|
+
* - 1.15.3 moved compilation back to import, where it is allowed, but that
|
|
13
|
+
* only avoids the forbidden context. The codegen still ran, and Workers
|
|
14
|
+
* budget startup CPU separately (400ms) and refuse a Worker that exceeds it.
|
|
15
|
+
* An adopter's deploy came back at 439ms against that line.
|
|
16
|
+
*
|
|
17
|
+
* Precompiling removes the question instead of answering it: there is no
|
|
18
|
+
* compile step left to put in the wrong place, and no amount of future
|
|
19
|
+
* refactoring can move one back. `schema-validators.generated.js` is committed
|
|
20
|
+
* and regenerated by `pnpm generate:validators`;
|
|
21
|
+
* `test/generated-validators.test.ts` regenerates and compares byte for byte,
|
|
22
|
+
* so a schema edited without regenerating fails there rather than shipping a
|
|
23
|
+
* validator that checks the old shape.
|
|
24
|
+
*
|
|
25
|
+
* Behaviour is unchanged: same `allErrors` collection, same messages, same
|
|
26
|
+
* `errors` property on each validator. `validateOperations` is emitted from an
|
|
27
|
+
* instance with `discriminator` enabled, which is compiled into it.
|
|
28
|
+
*
|
|
29
|
+
* Ajv's COMPILER is a build dependency now rather than a runtime one. Two pure
|
|
30
|
+
* helpers - a deep-equal and a UCS-2 string length - are still imported from
|
|
31
|
+
* `ajv/dist/runtime` by the generated module, which is the accurate claim.
|
|
10
32
|
*/
|
|
11
|
-
export declare const
|
|
12
|
-
export
|
|
33
|
+
export declare const validateDocument: ValidateFunction;
|
|
34
|
+
export declare const validateProfile: ValidateFunction;
|
|
35
|
+
export declare const validatePattern: ValidateFunction;
|
|
36
|
+
export declare const validateWorkspace: ValidateFunction;
|
|
37
|
+
export declare const validateProjection: ValidateFunction;
|
|
38
|
+
export declare const validateEvidence: ValidateFunction;
|
|
39
|
+
export declare const validateCoreContract: ValidateFunction;
|
|
40
|
+
export declare const validateAdapterMapping: ValidateFunction;
|
|
41
|
+
export declare const validateCatalogue: ValidateFunction;
|
|
42
|
+
export declare const validateOperations: ValidateFunction;
|
|
@@ -1,46 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
// comment in `compiler.ts` for why (#252).
|
|
4
|
-
const ajv2020Module = Ajv2020Module;
|
|
5
|
-
const Ajv2020 = ajv2020Module.default ?? ajv2020Module;
|
|
1
|
+
import * as generatedOperations from './schema-validators-operations.generated.js';
|
|
2
|
+
import * as generated from './schema-validators.generated.js';
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
* other schema that wants the same options.
|
|
4
|
+
* The package's JSON Schema validators, precompiled at BUILD time.
|
|
9
5
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Cloudflare's `workerd` permits code generation during module evaluation and
|
|
13
|
-
* FORBIDS it at request time - measured on the real runtime binary:
|
|
6
|
+
* Ajv normally compiles a schema by generating source and calling
|
|
7
|
+
* `new Function`, and where that happens decided two releases:
|
|
14
8
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
9
|
+
* - Cloudflare's `workerd` **permits** code generation during module
|
|
10
|
+
* evaluation and **forbids** it at request time. 1.15.2 deferred compilation
|
|
11
|
+
* to first use to save startup CPU, which put it inside a request, and every
|
|
12
|
+
* request that validated anything threw `EvalError`.
|
|
13
|
+
* - 1.15.3 moved compilation back to import, where it is allowed, but that
|
|
14
|
+
* only avoids the forbidden context. The codegen still ran, and Workers
|
|
15
|
+
* budget startup CPU separately (400ms) and refuse a Worker that exceeds it.
|
|
16
|
+
* An adopter's deploy came back at 439ms against that line.
|
|
19
17
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
18
|
+
* Precompiling removes the question instead of answering it: there is no
|
|
19
|
+
* compile step left to put in the wrong place, and no amount of future
|
|
20
|
+
* refactoring can move one back. `schema-validators.generated.js` is committed
|
|
21
|
+
* and regenerated by `pnpm generate:validators`;
|
|
22
|
+
* `test/generated-validators.test.ts` regenerates and compares byte for byte,
|
|
23
|
+
* so a schema edited without regenerating fails there rather than shipping a
|
|
24
|
+
* validator that checks the old shape.
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* change to when anything runs. Sharing is safe here because no schema
|
|
32
|
-
* registers formats and all 39 ship distinct `$id`s, so nothing collides.
|
|
26
|
+
* Behaviour is unchanged: same `allErrors` collection, same messages, same
|
|
27
|
+
* `errors` property on each validator. `validateOperations` is emitted from an
|
|
28
|
+
* instance with `discriminator` enabled, which is compiled into it.
|
|
33
29
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
30
|
+
* Ajv's COMPILER is a build dependency now rather than a runtime one. Two pure
|
|
31
|
+
* helpers - a deep-equal and a UCS-2 string length - are still imported from
|
|
32
|
+
* `ajv/dist/runtime` by the generated module, which is the accurate claim.
|
|
37
33
|
*/
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
export const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export const
|
|
34
|
+
export const validateDocument = generated.validateDocument;
|
|
35
|
+
export const validateProfile = generated.validateProfile;
|
|
36
|
+
export const validatePattern = generated.validatePattern;
|
|
37
|
+
export const validateWorkspace = generated.validateWorkspace;
|
|
38
|
+
export const validateProjection = generated.validateProjection;
|
|
39
|
+
export const validateEvidence = generated.validateEvidence;
|
|
40
|
+
export const validateCoreContract = generated.validateCoreContract;
|
|
41
|
+
export const validateAdapterMapping = generated.validateAdapterMapping;
|
|
42
|
+
export const validateCatalogue = generated.validateCatalogue;
|
|
43
|
+
export const validateOperations = generatedOperations.validateOperations;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const validateOperations: typeof validate20;
|
|
2
|
+
declare function validate20(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
|
|
3
|
+
dynamicAnchors?: {} | undefined;
|
|
4
|
+
instancePath?: string | undefined;
|
|
5
|
+
rootData?: any;
|
|
6
|
+
}): boolean;
|
|
7
|
+
export {};
|