@fougere/schema 0.12.0-alpha.0 → 0.12.1-alpha.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/SchemaError.js +1 -1
- package/dist/SchemaError.js.map +1 -1
- package/dist/axis/Axes.d.ts +16 -0
- package/dist/axis/Axes.d.ts.map +1 -0
- package/dist/axis/Axes.js +27 -0
- package/dist/axis/Axes.js.map +1 -0
- package/dist/axis/Axis.d.ts +5 -9
- package/dist/axis/Axis.d.ts.map +1 -1
- package/dist/axis/Axis.js +1 -10
- package/dist/axis/Axis.js.map +1 -1
- package/dist/axis/boundary/Boundary.d.ts +29 -3
- package/dist/axis/boundary/Boundary.d.ts.map +1 -1
- package/dist/axis/boundary/Boundary.js +12 -9
- package/dist/axis/boundary/Boundary.js.map +1 -1
- package/dist/axis/boundary/Decoder.d.ts +8 -2
- package/dist/axis/boundary/Decoder.d.ts.map +1 -1
- package/dist/axis/lifecycle/Lifecycle.d.ts +16 -4
- package/dist/axis/lifecycle/Lifecycle.d.ts.map +1 -1
- package/dist/axis/lifecycle/Lifecycle.js +18 -7
- package/dist/axis/lifecycle/Lifecycle.js.map +1 -1
- package/dist/axis/lifecycle/apply.d.ts.map +1 -1
- package/dist/axis/lifecycle/apply.js +2 -3
- package/dist/axis/lifecycle/apply.js.map +1 -1
- package/dist/axis/role/Role.d.ts +18 -6
- package/dist/axis/role/Role.d.ts.map +1 -1
- package/dist/axis/role/Role.js +30 -16
- package/dist/axis/role/Role.js.map +1 -1
- package/dist/axis/shape/{Formats.d.ts → StringFormats.d.ts} +3 -3
- package/dist/axis/shape/StringFormats.d.ts.map +1 -0
- package/dist/axis/shape/{Formats.js → StringFormats.js} +3 -3
- package/dist/axis/shape/StringFormats.js.map +1 -0
- package/dist/field/Field.d.ts +11 -5
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +5 -3
- package/dist/field/Field.js.map +1 -1
- package/dist/field/FieldFormat.d.ts +9 -0
- package/dist/field/FieldFormat.d.ts.map +1 -0
- package/dist/field/FieldFormat.js +12 -0
- package/dist/field/FieldFormat.js.map +1 -0
- package/dist/field/FougereFieldAxes.d.ts +3 -0
- package/dist/field/FougereFieldAxes.d.ts.map +1 -0
- package/dist/field/FougereFieldAxes.js +2 -0
- package/dist/field/FougereFieldAxes.js.map +1 -0
- package/dist/field/Meta.d.ts +5 -3
- package/dist/field/Meta.d.ts.map +1 -1
- package/dist/field/Meta.js +2 -1
- package/dist/field/Meta.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/Format.d.ts +56 -0
- package/dist/lib/Format.d.ts.map +1 -0
- package/dist/lib/Format.js +95 -0
- package/dist/lib/Format.js.map +1 -0
- package/dist/lib/JsonSchema.d.ts +2 -0
- package/dist/lib/JsonSchema.d.ts.map +1 -0
- package/dist/lib/JsonSchema.js +2 -0
- package/dist/lib/JsonSchema.js.map +1 -0
- package/dist/lib/Registry.d.ts +4 -2
- package/dist/lib/Registry.d.ts.map +1 -1
- package/dist/lib/Registry.js +11 -5
- package/dist/lib/Registry.js.map +1 -1
- package/dist/lib/ValidationResult.d.ts +2 -0
- package/dist/lib/ValidationResult.d.ts.map +1 -1
- package/dist/lib/ValidationResult.js +6 -0
- package/dist/lib/ValidationResult.js.map +1 -1
- package/dist/projection/Visibility.d.ts +11 -0
- package/dist/projection/Visibility.d.ts.map +1 -1
- package/dist/projection/Visibility.js +22 -0
- package/dist/projection/Visibility.js.map +1 -1
- package/dist/projection/card/Card.d.ts.map +1 -1
- package/dist/projection/card/Card.js +12 -9
- package/dist/projection/card/Card.js.map +1 -1
- package/dist/projection/card/CardForm.d.ts +7 -0
- package/dist/projection/card/CardForm.d.ts.map +1 -0
- package/dist/projection/card/CardForm.js +2 -0
- package/dist/projection/card/CardForm.js.map +1 -0
- package/dist/projection/card/CardForms.d.ts +10 -0
- package/dist/projection/card/CardForms.d.ts.map +1 -0
- package/dist/projection/card/CardForms.js +12 -0
- package/dist/projection/card/CardForms.js.map +1 -0
- package/dist/projection/card/Change.d.ts +2 -2
- package/dist/projection/card/Change.d.ts.map +1 -1
- package/dist/projection/card/Diff.js +2 -2
- package/dist/projection/card/Diff.js.map +1 -1
- package/dist/projection/card/FieldExtension.d.ts +4 -2
- package/dist/projection/card/FieldExtension.d.ts.map +1 -1
- package/dist/projection/card/RoleDescriptor.d.ts +9 -2
- package/dist/projection/card/RoleDescriptor.d.ts.map +1 -1
- package/dist/projection/card/RoleDescriptor.js +40 -1
- package/dist/projection/card/RoleDescriptor.js.map +1 -1
- package/dist/projection/card/admission.d.ts +0 -14
- package/dist/projection/card/admission.d.ts.map +1 -1
- package/dist/projection/card/admission.js +0 -20
- package/dist/projection/card/admission.js.map +1 -1
- package/dist/validator/FieldDeclarationValidator.d.ts.map +1 -1
- package/dist/validator/FieldDeclarationValidator.js +5 -17
- package/dist/validator/FieldDeclarationValidator.js.map +1 -1
- package/dist/validator/FieldValueValidator.d.ts.map +1 -1
- package/dist/validator/FieldValueValidator.js +9 -27
- package/dist/validator/FieldValueValidator.js.map +1 -1
- package/dist/validator/JsonSchemaValidator.d.ts +23 -0
- package/dist/validator/JsonSchemaValidator.d.ts.map +1 -0
- package/dist/validator/JsonSchemaValidator.js +113 -0
- package/dist/validator/JsonSchemaValidator.js.map +1 -0
- package/dist/vocabulary/vocabulary.js +7 -5
- package/dist/vocabulary/vocabulary.js.map +1 -1
- package/package.json +1 -1
- package/src/SchemaError.ts +1 -1
- package/src/axis/Axes.ts +34 -0
- package/src/axis/Axis.ts +5 -20
- package/src/axis/boundary/Boundary.ts +23 -11
- package/src/axis/boundary/Decoder.ts +1 -1
- package/src/axis/lifecycle/Lifecycle.ts +28 -11
- package/src/axis/lifecycle/apply.ts +11 -5
- package/src/axis/role/Role.ts +35 -19
- package/src/axis/shape/{Formats.ts → StringFormats.ts} +2 -2
- package/src/field/Field.ts +18 -8
- package/src/field/FieldFormat.ts +18 -0
- package/src/field/FougereFieldAxes.ts +2 -0
- package/src/field/Meta.ts +5 -3
- package/src/index.ts +6 -3
- package/src/lib/Format.ts +139 -0
- package/src/lib/JsonSchema.ts +1 -0
- package/src/lib/Registry.ts +14 -6
- package/src/lib/ValidationResult.ts +8 -0
- package/src/projection/Visibility.ts +22 -0
- package/src/projection/card/Card.ts +12 -9
- package/src/projection/card/CardForm.ts +8 -0
- package/src/projection/card/CardForms.ts +13 -0
- package/src/projection/card/Change.ts +2 -2
- package/src/projection/card/Diff.ts +2 -2
- package/src/projection/card/FieldExtension.ts +5 -2
- package/src/projection/card/RoleDescriptor.ts +48 -2
- package/src/projection/card/admission.ts +0 -33
- package/src/validator/FieldDeclarationValidator.ts +5 -17
- package/src/validator/FieldValueValidator.ts +10 -35
- package/src/validator/JsonSchemaValidator.ts +142 -0
- package/src/vocabulary/vocabulary.ts +7 -5
- package/dist/axis/boundary/BoundaryAxis.d.ts +0 -4
- package/dist/axis/boundary/BoundaryAxis.d.ts.map +0 -1
- package/dist/axis/boundary/BoundaryAxis.js +0 -30
- package/dist/axis/boundary/BoundaryAxis.js.map +0 -1
- package/dist/axis/boundary/BoundaryRef.d.ts +0 -3
- package/dist/axis/boundary/BoundaryRef.d.ts.map +0 -1
- package/dist/axis/boundary/BoundaryRef.js +0 -2
- package/dist/axis/boundary/BoundaryRef.js.map +0 -1
- package/dist/axis/boundary/BoundaryRules.d.ts +0 -9
- package/dist/axis/boundary/BoundaryRules.d.ts.map +0 -1
- package/dist/axis/boundary/BoundaryRules.js +0 -2
- package/dist/axis/boundary/BoundaryRules.js.map +0 -1
- package/dist/axis/lifecycle/Clock.d.ts +0 -10
- package/dist/axis/lifecycle/Clock.d.ts.map +0 -1
- package/dist/axis/lifecycle/Clock.js +0 -19
- package/dist/axis/lifecycle/Clock.js.map +0 -1
- package/dist/axis/lifecycle/LifecycleAxis.d.ts +0 -4
- package/dist/axis/lifecycle/LifecycleAxis.d.ts.map +0 -1
- package/dist/axis/lifecycle/LifecycleAxis.js +0 -52
- package/dist/axis/lifecycle/LifecycleAxis.js.map +0 -1
- package/dist/axis/lifecycle/LifecycleRules.d.ts +0 -12
- package/dist/axis/lifecycle/LifecycleRules.d.ts.map +0 -1
- package/dist/axis/lifecycle/LifecycleRules.js +0 -3
- package/dist/axis/lifecycle/LifecycleRules.js.map +0 -1
- package/dist/axis/role/RoleAxis.d.ts +0 -5
- package/dist/axis/role/RoleAxis.d.ts.map +0 -1
- package/dist/axis/role/RoleAxis.js +0 -93
- package/dist/axis/role/RoleAxis.js.map +0 -1
- package/dist/axis/role/RoleRules.d.ts +0 -8
- package/dist/axis/role/RoleRules.d.ts.map +0 -1
- package/dist/axis/role/RoleRules.js +0 -2
- package/dist/axis/role/RoleRules.js.map +0 -1
- package/dist/axis/shape/Formats.d.ts.map +0 -1
- package/dist/axis/shape/Formats.js.map +0 -1
- package/dist/projection/card/RelationDescriptor.d.ts +0 -5
- package/dist/projection/card/RelationDescriptor.d.ts.map +0 -1
- package/dist/projection/card/RelationDescriptor.js +0 -2
- package/dist/projection/card/RelationDescriptor.js.map +0 -1
- package/dist/validator/AdapterFieldValidator.d.ts +0 -14
- package/dist/validator/AdapterFieldValidator.d.ts.map +0 -1
- package/dist/validator/AdapterFieldValidator.js +0 -37
- package/dist/validator/AdapterFieldValidator.js.map +0 -1
- package/src/axis/boundary/BoundaryAxis.ts +0 -32
- package/src/axis/boundary/BoundaryRef.ts +0 -3
- package/src/axis/boundary/BoundaryRules.ts +0 -4
- package/src/axis/lifecycle/Clock.ts +0 -22
- package/src/axis/lifecycle/LifecycleAxis.ts +0 -55
- package/src/axis/lifecycle/LifecycleRules.ts +0 -9
- package/src/axis/role/RoleAxis.ts +0 -104
- package/src/axis/role/RoleRules.ts +0 -8
- package/src/projection/card/RelationDescriptor.ts +0 -3
- package/src/validator/AdapterFieldValidator.ts +0 -41
package/dist/SchemaError.js
CHANGED
package/dist/SchemaError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaError.js","sourceRoot":"","sources":["../src/SchemaError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"SchemaError.js","sourceRoot":"","sources":["../src/SchemaError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Registry } from '../lib/Registry.js';
|
|
2
|
+
import type { JsonSchema } from '../lib/JsonSchema.js';
|
|
3
|
+
import type { Axis } from './Axis.js';
|
|
4
|
+
declare class AxisRegistry extends Registry<Axis> {
|
|
5
|
+
private composed?;
|
|
6
|
+
register(slot: string, axis: Axis): Axis;
|
|
7
|
+
/** The document a field declaration is judged against, rebuilt the next time one arrives. */
|
|
8
|
+
get fieldFormat(): JsonSchema;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The axes this process reads, and the door an axis declared elsewhere comes through.
|
|
12
|
+
* `Axes.register('tenancy', Tenancy)` — from a `vocabulary/` file, read before `entities/`
|
|
13
|
+
*/
|
|
14
|
+
export declare const Axes: AxisRegistry;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=Axes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Axes.d.ts","sourceRoot":"","sources":["../../src/axis/Axes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKtC,cAAM,YAAa,SAAQ,QAAQ,CAAC,IAAI,CAAC;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAa;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAIvC;IAED,6FAA6F;IAC7F,IAAI,WAAW,IAAI,UAAU,CAI5B;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,cAIf,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Registry } from '../lib/Registry.js';
|
|
2
|
+
import { fieldFormat } from '../field/FieldFormat.js';
|
|
3
|
+
import { Boundary } from './boundary/Boundary.js';
|
|
4
|
+
import { Lifecycle } from './lifecycle/Lifecycle.js';
|
|
5
|
+
import { Role } from './role/Role.js';
|
|
6
|
+
class AxisRegistry extends Registry {
|
|
7
|
+
composed;
|
|
8
|
+
register(slot, axis) {
|
|
9
|
+
this.composed = undefined;
|
|
10
|
+
return super.register(slot, axis);
|
|
11
|
+
}
|
|
12
|
+
/** The document a field declaration is judged against, rebuilt the next time one arrives. */
|
|
13
|
+
get fieldFormat() {
|
|
14
|
+
this.composed ??= fieldFormat(this.entries);
|
|
15
|
+
return this.composed;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The axes this process reads, and the door an axis declared elsewhere comes through.
|
|
20
|
+
* `Axes.register('tenancy', Tenancy)` — from a `vocabulary/` file, read before `entities/`
|
|
21
|
+
*/
|
|
22
|
+
export const Axes = new AxisRegistry('axis', 'call Axes.register(slot, axis)', [
|
|
23
|
+
['role', Role],
|
|
24
|
+
['lifecycle', Lifecycle],
|
|
25
|
+
['boundary', Boundary],
|
|
26
|
+
]);
|
|
27
|
+
//# sourceMappingURL=Axes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Axes.js","sourceRoot":"","sources":["../../src/axis/Axes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,YAAa,SAAQ,QAAc;IAC/B,QAAQ,CAAc;IAE9B,QAAQ,CAAC,IAAY,EAAE,IAAU;QAC/B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAE1B,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,6FAA6F;IAC7F,IAAI,WAAW;QACb,IAAI,CAAC,QAAQ,KAAK,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,gCAAgC,EAAE;IAC7E,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,WAAW,EAAE,SAAS,CAAC;IACxB,CAAC,UAAU,EAAE,QAAQ,CAAC;CACvB,CAAC,CAAC"}
|
package/dist/axis/Axis.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
+
import type { Format } from '../lib/Format.js';
|
|
1
2
|
import type { ValidationError } from '../lib/ValidationError.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
describe(value: Declared, key: string): Wire | undefined;
|
|
7
|
-
reconstruct(wire: Wire, resolve?: Resolver): Declared;
|
|
3
|
+
export interface Axis {
|
|
4
|
+
readonly format: Format;
|
|
5
|
+
/** What a format cannot state: `role.relation.to` is a function, and JSON holds none. */
|
|
6
|
+
refusals?(value: unknown): ValidationError[];
|
|
8
7
|
}
|
|
9
|
-
export declare const EXTENSION_AXES: readonly Axis[];
|
|
10
|
-
/** The slots they occupy: the keys of `x-fougere` on a field descriptor. */
|
|
11
|
-
export declare const EXTENSION_SLOTS: ("boundary" | "lifecycle" | "role")[];
|
|
12
8
|
//# sourceMappingURL=Axis.d.ts.map
|
package/dist/axis/Axis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../src/axis/Axis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../src/axis/Axis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,yFAAyF;IACzF,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAAC;CAC9C"}
|
package/dist/axis/Axis.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { lifecycleAxis } from './lifecycle/LifecycleAxis.js';
|
|
3
|
-
import { boundaryAxis } from './boundary/BoundaryAxis.js';
|
|
4
|
-
export const EXTENSION_AXES = [
|
|
5
|
-
roleAxis,
|
|
6
|
-
lifecycleAxis,
|
|
7
|
-
boundaryAxis,
|
|
8
|
-
];
|
|
9
|
-
/** The slots they occupy: the keys of `x-fougere` on a field descriptor. */
|
|
10
|
-
export const EXTENSION_SLOTS = EXTENSION_AXES.map((axis) => axis.slot);
|
|
1
|
+
export {};
|
|
11
2
|
//# sourceMappingURL=Axis.js.map
|
package/dist/axis/Axis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis.js","sourceRoot":"","sources":["../../src/axis/Axis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Axis.js","sourceRoot":"","sources":["../../src/axis/Axis.ts"],"names":[],"mappings":""}
|
|
@@ -2,10 +2,35 @@ import type { Decoder } from './Decoder.js';
|
|
|
2
2
|
import type { Encoder } from './Encoder.js';
|
|
3
3
|
import type { Field } from '../../field/Field.js';
|
|
4
4
|
import { type Shape } from '../shape/Shape.js';
|
|
5
|
-
import type
|
|
5
|
+
import { Format, type Accepted } from '../../lib/Format.js';
|
|
6
|
+
declare const RULES: Format<{
|
|
7
|
+
in?: "closed" | {
|
|
8
|
+
decode: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
out?: "closed" | {
|
|
11
|
+
encode: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
declare const BOUNDARY: Format<"isoDate" | {
|
|
15
|
+
in?: "closed" | {
|
|
16
|
+
decode: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
out?: "closed" | {
|
|
19
|
+
encode: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
} | (string & {})>;
|
|
22
|
+
export type BoundaryRules = Accepted<typeof RULES>;
|
|
23
|
+
export type BoundaryRef = Accepted<typeof BOUNDARY>;
|
|
6
24
|
export declare class Boundary {
|
|
7
|
-
private readonly
|
|
8
|
-
|
|
25
|
+
private readonly rules;
|
|
26
|
+
static readonly format: Format<"isoDate" | {
|
|
27
|
+
in?: "closed" | {
|
|
28
|
+
decode: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
out?: "closed" | {
|
|
31
|
+
encode: string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
} | (string & {})>;
|
|
9
34
|
readonly decode: Decoder;
|
|
10
35
|
readonly encode: Encoder;
|
|
11
36
|
private constructor();
|
|
@@ -19,4 +44,5 @@ export declare class Boundary {
|
|
|
19
44
|
get readOnly(): boolean;
|
|
20
45
|
get writeOnly(): boolean;
|
|
21
46
|
}
|
|
47
|
+
export {};
|
|
22
48
|
//# sourceMappingURL=Boundary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Boundary.d.ts","sourceRoot":"","sources":["../../../src/axis/boundary/Boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Boundary.d.ts","sourceRoot":"","sources":["../../../src/axis/boundary/Boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAK5D,QAAA,MAAM,KAAK;;;;;;;EAAoF,CAAC;AAEhG,QAAA,MAAM,QAAQ;;;;;;;kBAGb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAMpD,qBAAa,QAAQ;IAOjB,OAAO,CAAC,QAAQ,CAAC,KAAK;IANxB,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;uBAAY;IAElC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,OAAO,eAMN;IAED,mCAAmC;IACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAQtC;IAED,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAiBhC;IAED,8EAA8E;IAC9E,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAGlD;IAED,uFAAuF;IACvF,SAAS,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,CAEjD;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Boundaries } from './Decoder.js';
|
|
2
2
|
import { Shapes } from '../shape/Shape.js';
|
|
3
3
|
import { SchemaError } from '../../SchemaError.js';
|
|
4
|
+
import { Format } from '../../lib/Format.js';
|
|
5
|
+
const closedOr = (verb) => Format.either(Format.tokens(['closed']), Format.of().key(verb, Format.text).needs(verb).closed());
|
|
6
|
+
const RULES = Format.of().key('in', closedOr('decode')).key('out', closedOr('encode')).closed();
|
|
7
|
+
const BOUNDARY = Format.named('axis/boundary', Format.either(Format.text.as(), RULES));
|
|
4
8
|
const identityDecoder = (value) => ({ value });
|
|
5
9
|
const identityEncoder = (value) => value;
|
|
6
10
|
export class Boundary {
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
rules;
|
|
12
|
+
static format = BOUNDARY;
|
|
9
13
|
decode;
|
|
10
14
|
encode;
|
|
11
15
|
constructor(rules = {}, codecs) {
|
|
12
|
-
this.
|
|
13
|
-
this.out = rules.out;
|
|
16
|
+
this.rules = rules;
|
|
14
17
|
this.decode = codecs?.decode ?? identityDecoder;
|
|
15
18
|
this.encode = codecs?.encode ?? identityEncoder;
|
|
16
19
|
}
|
|
@@ -30,8 +33,8 @@ export class Boundary {
|
|
|
30
33
|
const declared = Boundary.declared(field);
|
|
31
34
|
const derived = Boundary.forShape(field.shape);
|
|
32
35
|
const rules = {
|
|
33
|
-
in: declared.in ?? derived.in,
|
|
34
|
-
out: declared.out ?? derived.out,
|
|
36
|
+
in: declared.rules.in ?? derived.rules.in,
|
|
37
|
+
out: declared.rules.out ?? derived.rules.out,
|
|
35
38
|
};
|
|
36
39
|
return new Boundary(rules, {
|
|
37
40
|
decode: typeof rules.in === 'object'
|
|
@@ -50,13 +53,13 @@ export class Boundary {
|
|
|
50
53
|
}
|
|
51
54
|
/** The dual of `declared`: what `readOnly()` writes back on the field, not a judge. */
|
|
52
55
|
declaring(overrides) {
|
|
53
|
-
return { in: overrides.in ?? this.in, out: overrides.out ?? this.out };
|
|
56
|
+
return { in: overrides.in ?? this.rules.in, out: overrides.out ?? this.rules.out };
|
|
54
57
|
}
|
|
55
58
|
get readOnly() {
|
|
56
|
-
return this.in === 'closed';
|
|
59
|
+
return this.rules.in === 'closed';
|
|
57
60
|
}
|
|
58
61
|
get writeOnly() {
|
|
59
|
-
return this.out === 'closed';
|
|
62
|
+
return this.rules.out === 'closed';
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
//# sourceMappingURL=Boundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Boundary.js","sourceRoot":"","sources":["../../../src/axis/boundary/Boundary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Boundary.js","sourceRoot":"","sources":["../../../src/axis/boundary/Boundary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAiB,MAAM,qBAAqB,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAmC,IAAU,EAAE,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K,CAAC,KAAK,MAAM;YAAE,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QAChG,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,uFAAuF;IACvF,SAAS,CAAC,SAAwB;QAChC,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACrF,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;IACpC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { BoundaryRules } from './BoundaryRules.js';
|
|
2
1
|
import { Registry } from '../../lib/Registry.js';
|
|
3
2
|
import type { Encoder } from './Encoder.js';
|
|
4
3
|
import type { Verdict } from '../../lib/Verdict.js';
|
|
@@ -18,6 +17,13 @@ export type Decoder = (value: unknown) => Verdict;
|
|
|
18
17
|
export declare const Boundaries: {
|
|
19
18
|
decoders: Registry<Decoder>;
|
|
20
19
|
encoders: Registry<Encoder>;
|
|
21
|
-
aliases: Registry<
|
|
20
|
+
aliases: Registry<{
|
|
21
|
+
in?: "closed" | {
|
|
22
|
+
decode: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
out?: "closed" | {
|
|
25
|
+
encode: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}>;
|
|
22
28
|
};
|
|
23
29
|
//# sourceMappingURL=Decoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decoder.d.ts","sourceRoot":"","sources":["../../../src/axis/boundary/Decoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Decoder.d.ts","sourceRoot":"","sources":["../../../src/axis/boundary/Decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;IACrB,QAAQ;IAIR,QAAQ;IAIR,OAAO;;;;;;;;CACR,CAAC"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { Format, type Accepted } from '../../lib/Format.js';
|
|
2
|
+
import type { GeneratorRef } from './Generators.js';
|
|
3
|
+
export type LifecycleRules = Accepted<typeof Lifecycle.format>;
|
|
2
4
|
export declare class Lifecycle {
|
|
3
|
-
private readonly
|
|
4
|
-
|
|
5
|
+
private readonly rules;
|
|
6
|
+
static readonly CREATE: readonly ['now', 'optional'];
|
|
7
|
+
static readonly UPDATE: readonly ['now', 'forbidden'];
|
|
8
|
+
static readonly format: Format<{
|
|
9
|
+
create?: "now" | "optional" | {
|
|
10
|
+
generate: GeneratorRef;
|
|
11
|
+
} | {
|
|
12
|
+
value: unknown;
|
|
13
|
+
} | undefined;
|
|
14
|
+
update?: "forbidden" | "now" | undefined;
|
|
15
|
+
}>;
|
|
5
16
|
private constructor();
|
|
6
17
|
static of(field: {
|
|
7
18
|
lifecycle?: LifecycleRules;
|
|
8
19
|
}): Lifecycle;
|
|
20
|
+
private get create();
|
|
21
|
+
private get update();
|
|
9
22
|
bornWith(instant: number): {
|
|
10
23
|
value: unknown;
|
|
11
24
|
} | undefined;
|
|
12
25
|
get requiredAtCreate(): boolean;
|
|
13
26
|
get stampedAtCreate(): boolean;
|
|
14
|
-
get stampedOnce(): boolean;
|
|
15
27
|
get immutable(): boolean;
|
|
16
28
|
get stampedOnUpdate(): boolean;
|
|
17
29
|
get literal(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lifecycle.d.ts","sourceRoot":"","sources":["../../../src/axis/lifecycle/Lifecycle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Lifecycle.d.ts","sourceRoot":"","sources":["../../../src/axis/lifecycle/Lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/D,qBAAa,SAAS;IAkBA,OAAO,CAAC,QAAQ,CAAC,KAAK;IAjB1C,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAI,KAAK,EAAE,UAAU,EAAW;IACtD,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAI,KAAK,EAAE,WAAW,EAAW;IAEvD,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;OAYV;IAEZ,OAAO,eAA4D;IAEnE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,cAAc,CAAA;KAAE,GAAG,SAAS,CAE1D;IAED,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,MAAM,GAEjB;IAED,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAUxD;IAED,IAAI,gBAAgB,IAAI,OAAO,CAE9B;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,IAAI,OAAO,IAAI;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAM5C;CACF"}
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
import { Format } from '../../lib/Format.js';
|
|
1
2
|
import { Generators } from './Generators.js';
|
|
2
3
|
export class Lifecycle {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
rules;
|
|
5
|
+
static CREATE = ['now', 'optional'];
|
|
6
|
+
static UPDATE = ['now', 'forbidden'];
|
|
7
|
+
static format = Format.of('axis/lifecycle')
|
|
8
|
+
.key('create', Format.either(Format.tokens(Lifecycle.CREATE), Format.exactlyOne({
|
|
9
|
+
value: Format.anything,
|
|
10
|
+
generate: Format.text.as(),
|
|
11
|
+
})))
|
|
12
|
+
.key('update', Format.tokens(Lifecycle.UPDATE))
|
|
13
|
+
.closed();
|
|
5
14
|
constructor(rules = {}) {
|
|
6
|
-
this.
|
|
7
|
-
this.update = rules.update;
|
|
15
|
+
this.rules = rules;
|
|
8
16
|
}
|
|
9
17
|
static of(field) {
|
|
10
18
|
return new Lifecycle(field.lifecycle);
|
|
11
19
|
}
|
|
20
|
+
get create() {
|
|
21
|
+
return this.rules.create;
|
|
22
|
+
}
|
|
23
|
+
get update() {
|
|
24
|
+
return this.rules.update;
|
|
25
|
+
}
|
|
12
26
|
bornWith(instant) {
|
|
13
27
|
const rule = this.create;
|
|
14
28
|
if (rule === 'now')
|
|
@@ -25,9 +39,6 @@ export class Lifecycle {
|
|
|
25
39
|
get stampedAtCreate() {
|
|
26
40
|
return this.create === 'now';
|
|
27
41
|
}
|
|
28
|
-
get stampedOnce() {
|
|
29
|
-
return this.stampedAtCreate && !this.stampedOnUpdate;
|
|
30
|
-
}
|
|
31
42
|
get immutable() {
|
|
32
43
|
return this.update === 'forbidden';
|
|
33
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lifecycle.js","sourceRoot":"","sources":["../../../src/axis/lifecycle/Lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO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M,CAAC;QAEzB,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAExD,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAE/C,IAAI,OAAO,IAAI,IAAI;YAAE,OAAO,EAAE,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAEnE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;IACxD,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;IACnC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC;IAC/B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC;IACrC,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC;IAC/B,CAAC;IAED,IAAI,OAAO;QACT,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QAEzB,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,IAAI;YACjE,CAAC,CAAC,EAAE,KAAK,EAAG,IAA2B,CAAC,KAAK,EAAE;YAC/C,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/axis/lifecycle/apply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/axis/lifecycle/apply.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Lifecycle } from './Lifecycle.js';
|
|
2
|
-
import { Clock } from './Clock.js';
|
|
3
2
|
/**
|
|
4
3
|
* Fills what the declaration leaves to the storage, so no handler stamps a date itself.
|
|
5
4
|
* FR : remplit ce que la déclaration laisse au storage : aucun handler n'estampe lui-même.
|
|
@@ -7,7 +6,7 @@ import { Clock } from './Clock.js';
|
|
|
7
6
|
*/
|
|
8
7
|
export function applyCreate(fields, input) {
|
|
9
8
|
const values = { ...input };
|
|
10
|
-
const instant =
|
|
9
|
+
const instant = Date.now();
|
|
11
10
|
for (const [name, field] of Object.entries(fields)) {
|
|
12
11
|
if (name in values)
|
|
13
12
|
continue;
|
|
@@ -25,7 +24,7 @@ export function applyCreate(fields, input) {
|
|
|
25
24
|
*/
|
|
26
25
|
export function applyUpdate(fields, patch) {
|
|
27
26
|
const values = { ...patch };
|
|
28
|
-
const instant =
|
|
27
|
+
const instant = Date.now();
|
|
29
28
|
for (const [name, field] of Object.entries(fields)) {
|
|
30
29
|
if (Lifecycle.of(field).stampedOnUpdate && !(name in values))
|
|
31
30
|
values[name] = new Date(instant);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/axis/lifecycle/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/axis/lifecycle/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI3C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,KAA8B;IAE9B,MAAM,MAAM,GAA4B,EAAE,GAAG,KAAK,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE3B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAsB,EAAE,CAAC;QACxE,IAAI,IAAI,IAAI,MAAM;YAAE,SAAS;QAE7B,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,KAA8B;IAE9B,MAAM,MAAM,GAA4B,EAAE,GAAG,KAAK,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE3B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAsB,EAAE,CAAC;QACxE,IAAI,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC;YAC1D,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/axis/role/Role.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import type { EntityConstructor } from './EntityConstructor.js';
|
|
2
1
|
import type { Relation } from './Relation.js';
|
|
3
|
-
import type {
|
|
2
|
+
import type { EntityConstructor } from './EntityConstructor.js';
|
|
3
|
+
import { Format, type Accepted } from '../../lib/Format.js';
|
|
4
4
|
export declare class Role {
|
|
5
|
-
private readonly
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
private readonly rules;
|
|
6
|
+
static readonly format: Format<{
|
|
7
|
+
index?: boolean | undefined;
|
|
8
|
+
primary?: boolean | undefined;
|
|
9
|
+
relation?: {
|
|
10
|
+
kind: "many" | "one";
|
|
11
|
+
onDelete?: "cascade" | "restrict" | "set null" | undefined;
|
|
12
|
+
to: () => EntityConstructor;
|
|
13
|
+
} | undefined;
|
|
14
|
+
unique?: boolean | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
static refusals(value: unknown): {
|
|
17
|
+
path: string[];
|
|
18
|
+
message: string;
|
|
19
|
+
}[];
|
|
9
20
|
private constructor();
|
|
10
21
|
static of(field: {
|
|
11
22
|
role?: RoleRules;
|
|
@@ -22,4 +33,5 @@ export declare class Role {
|
|
|
22
33
|
get target(): EntityConstructor | undefined;
|
|
23
34
|
get onDelete(): Relation['onDelete'];
|
|
24
35
|
}
|
|
36
|
+
export type RoleRules = Accepted<typeof Role.format>;
|
|
25
37
|
//# sourceMappingURL=Role.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Role.d.ts","sourceRoot":"","sources":["../../../src/axis/role/Role.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Role.d.ts","sourceRoot":"","sources":["../../../src/axis/role/Role.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG5D,qBAAa,IAAI;IAuBK,OAAO,CAAC,QAAQ,CAAC,KAAK;IAtB1C,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;sBAOoB,iBAAiB;;;OAM/C;IAEZ,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO;;;QAK7B;IAED,OAAO,eAAuD;IAE9D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAE3C;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,iFAAiF;IACjF,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,4EAA4E;IAC5E,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,8CAA8C;IAC9C,IAAI,MAAM,IAAI,iBAAiB,GAAG,SAAS,CAE1C;IAED,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,CAEnC;CACF;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/axis/role/Role.js
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
1
|
+
import { isObject } from '../../lib/utils.js';
|
|
2
|
+
import { Format } from '../../lib/Format.js';
|
|
3
|
+
import { ON_DELETE, RELATION_KINDS } from './Relation.js';
|
|
1
4
|
export class Role {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
rules;
|
|
6
|
+
static format = Format.of('axis/role')
|
|
7
|
+
.key('primary', Format.flag)
|
|
8
|
+
.key('index', Format.flag)
|
|
9
|
+
.key('unique', Format.flag)
|
|
10
|
+
.key('relation', Format.of()
|
|
11
|
+
.key('to', Format.anything.as())
|
|
12
|
+
.key('kind', Format.tokens(RELATION_KINDS))
|
|
13
|
+
.key('onDelete', Format.tokens(ON_DELETE))
|
|
14
|
+
.needs('to', 'kind')
|
|
15
|
+
.closed())
|
|
16
|
+
.closed();
|
|
17
|
+
static refusals(value) {
|
|
18
|
+
const relation = isObject(value) ? value.relation : undefined;
|
|
19
|
+
if (!isObject(relation) || !('to' in relation) || typeof relation.to === 'function')
|
|
20
|
+
return [];
|
|
21
|
+
return [{ path: ['role', 'relation', 'to'], message: 'Expected a function returning the target entity, such as () => Post' }];
|
|
22
|
+
}
|
|
6
23
|
constructor(rules = {}) {
|
|
7
|
-
this.
|
|
8
|
-
this.index = rules.index;
|
|
9
|
-
this.unique = rules.unique;
|
|
10
|
-
this.relation = rules.relation;
|
|
24
|
+
this.rules = rules;
|
|
11
25
|
}
|
|
12
26
|
static of(field) {
|
|
13
27
|
return new Role(field.role);
|
|
14
28
|
}
|
|
15
29
|
get isPrimary() {
|
|
16
|
-
return this.primary === true;
|
|
30
|
+
return this.rules.primary === true;
|
|
17
31
|
}
|
|
18
32
|
get isIndexed() {
|
|
19
|
-
return this.index === true;
|
|
33
|
+
return this.rules.index === true;
|
|
20
34
|
}
|
|
21
35
|
/** A field unique on its own. A group spanning several belongs to the schema. */
|
|
22
36
|
get isUnique() {
|
|
23
|
-
return this.unique === true;
|
|
37
|
+
return this.rules.unique === true;
|
|
24
38
|
}
|
|
25
39
|
get isCollection() {
|
|
26
|
-
return this.relation?.kind === 'many';
|
|
40
|
+
return this.rules.relation?.kind === 'many';
|
|
27
41
|
}
|
|
28
42
|
get isReference() {
|
|
29
|
-
return this.relation?.kind === 'one';
|
|
43
|
+
return this.rules.relation?.kind === 'one';
|
|
30
44
|
}
|
|
31
45
|
/** Either kind — what a CLI flag and a GraphQL selection both leave out. */
|
|
32
46
|
get isRelation() {
|
|
33
|
-
return this.relation !== undefined;
|
|
47
|
+
return this.rules.relation !== undefined;
|
|
34
48
|
}
|
|
35
49
|
/** Calls `() => Post` so no caller has to. */
|
|
36
50
|
get target() {
|
|
37
|
-
return this.relation?.to();
|
|
51
|
+
return this.rules.relation?.to();
|
|
38
52
|
}
|
|
39
53
|
get onDelete() {
|
|
40
|
-
return this.relation?.onDelete;
|
|
54
|
+
return this.rules.relation?.onDelete;
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
57
|
//# sourceMappingURL=Role.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/axis/role/Role.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Role.js","sourceRoot":"","sources":["../../../src/axis/role/Role.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAiB,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,IAAI;IAuBsB,KAAK;IAtB1C,MAAM,CAAU,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC;SAC5C,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;SAC3B,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;SACzB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;SAC1B,GAAG,CACF,UAAU,EACV,MAAM,CAAC,EAAE,EAAE;SACR,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,EAA2B,CAAC;SACxD,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;SAC1C,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACzC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;SACnB,MAAM,EAAE,CACZ;SACA,MAAM,EAAE,CAAC;IAEZ,MAAM,CAAC,QAAQ,CAAC,KAAc;QAC5B,MA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Q,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -4,7 +4,7 @@ import type { FormatPredicate } from './FormatPredicate.js';
|
|
|
4
4
|
* String formats the JSON Schema engine does not know. `find` answers `undefined` for
|
|
5
5
|
* `email` or `uuid`, which it validates on its own.
|
|
6
6
|
* FR : les formats de chaîne que le moteur ignore ; `find` rend `undefined` pour les siens.
|
|
7
|
-
* `
|
|
7
|
+
* `StringFormats.register('siret', (v) => /^\d{14}$/.test(v))`
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
10
|
-
//# sourceMappingURL=
|
|
9
|
+
export declare const StringFormats: Registry<FormatPredicate>;
|
|
10
|
+
//# sourceMappingURL=StringFormats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringFormats.d.ts","sourceRoot":"","sources":["../../../src/axis/shape/StringFormats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,aAAa,2BAA0C,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Registry } from '../../lib/Registry.js';
|
|
|
3
3
|
* String formats the JSON Schema engine does not know. `find` answers `undefined` for
|
|
4
4
|
* `email` or `uuid`, which it validates on its own.
|
|
5
5
|
* FR : les formats de chaîne que le moteur ignore ; `find` rend `undefined` pour les siens.
|
|
6
|
-
* `
|
|
6
|
+
* `StringFormats.register('siret', (v) => /^\d{14}$/.test(v))`
|
|
7
7
|
*/
|
|
8
|
-
export const
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export const StringFormats = new Registry('format');
|
|
9
|
+
//# sourceMappingURL=StringFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringFormats.js","sourceRoot":"","sources":["../../../src/axis/shape/StringFormats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAkB,QAAQ,CAAC,CAAC"}
|
package/dist/field/Field.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Shape } from '../axis/shape/Shape.js';
|
|
2
|
-
import type { RoleRules } from '../axis/role/
|
|
3
|
-
import type { LifecycleRules } from '../axis/lifecycle/
|
|
4
|
-
import type { BoundaryRef } from '../axis/boundary/
|
|
2
|
+
import type { RoleRules } from '../axis/role/Role.js';
|
|
3
|
+
import type { LifecycleRules } from '../axis/lifecycle/Lifecycle.js';
|
|
4
|
+
import type { BoundaryRef } from '../axis/boundary/Boundary.js';
|
|
5
5
|
import type { Meta } from './Meta.js';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
6
|
+
import type { FougereFieldAxes } from './FougereFieldAxes.js';
|
|
7
|
+
interface FieldDeclaration extends FougereFieldAxes {
|
|
8
|
+
shape: Shape;
|
|
9
|
+
role?: RoleRules;
|
|
10
|
+
lifecycle?: LifecycleRules;
|
|
11
|
+
boundary?: BoundaryRef;
|
|
12
|
+
meta?: Meta;
|
|
13
|
+
}
|
|
8
14
|
export declare class Field<T = unknown> {
|
|
9
15
|
readonly shape: Shape;
|
|
10
16
|
readonly role?: RoleRules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.ts"],"names":[],"mappings":"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axis/Axes.js';
|
|
1
2
|
import { FieldDeclarationValidator } from '../validator/FieldDeclarationValidator.js';
|
|
2
3
|
import { FieldValueValidator } from '../validator/FieldValueValidator.js';
|
|
3
4
|
import { dotted } from '../lib/ValidationResult.js';
|
|
@@ -15,10 +16,11 @@ export class Field {
|
|
|
15
16
|
verdict.errors.map((e) => `${dotted(e.path)}: ${e.message}`).join('; '));
|
|
16
17
|
}
|
|
17
18
|
this.shape = init.shape;
|
|
18
|
-
this.role = init.role;
|
|
19
|
-
this.lifecycle = init.lifecycle;
|
|
20
|
-
this.boundary = init.boundary;
|
|
21
19
|
this.meta = init.meta;
|
|
20
|
+
const stated = init;
|
|
21
|
+
for (const slot of Axes.names) {
|
|
22
|
+
this[slot] = stated[slot];
|
|
23
|
+
}
|
|
22
24
|
const create = this.lifecycle?.create;
|
|
23
25
|
if (typeof create === 'object' && create !== null && 'value' in create) {
|
|
24
26
|
const checked = FieldValueValidator.of(this).validate(create.value);
|