@zixcel/projection-contracts 0.10.2 → 0.10.4
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/README.md +1 -1
- package/package.json +16 -10
- package/src/canonical.d.mts +1 -0
- package/src/client.d.mts +2 -11
- package/src/client.mjs +16 -3
- package/src/contract.d.mts +28 -0
- package/src/contract.mjs +177 -55
- package/src/hash-browser.d.mts +1 -0
- package/src/hash-browser.mjs +11 -5
- package/src/hash-node.d.mts +1 -0
- package/src/hash-node.mjs +8 -2
- package/src/index.d.mts +5 -26
- package/src/index.mjs +20 -3
- package/src/produce.d.mts +3 -0
- package/src/producer.d.mts +4 -0
- package/src/producer.mjs +283 -166
- package/src/publication.d.mts +15 -0
- package/src/publication.mjs +58 -32
- package/src/recovery.d.mts +16 -0
- package/src/scene-actions.d.mts +2 -0
- package/src/scene-bindings.d.mts +6 -0
- package/src/scene.d.mts +4 -0
- package/src/seal.d.mts +6 -0
- package/src/snapshot.d.mts +2 -0
- package/src/source-items.d.mts +4 -0
- package/src/types/input.d.mts +54 -15
- package/src/types/publication.d.mts +16 -0
- package/src/types/snapshot.d.mts +102 -28
package/src/scene.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DataProjection, SceneProjection } from './types/snapshot.mjs';
|
|
2
|
+
import type { SceneConfiguration } from './types/input.mjs';
|
|
3
|
+
export declare function scene(data: DataProjection, configuration: SceneConfiguration): SceneProjection;
|
|
4
|
+
export declare function buildScene(value: unknown, configuration: unknown): SceneProjection;
|
package/src/seal.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Snapshot } from './types/publication.mjs';
|
|
2
|
+
type ForKind<K extends Snapshot['kind']> = Extract<Snapshot, {
|
|
3
|
+
kind: K;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function seal<K extends Snapshot['kind']>(kind: K, key: string, lineage: ForKind<K>['lineage'], data: ForKind<K>['data'], maximum: number): ForKind<K>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Item, Relation, SourceRef, Unresolved } from './types/snapshot.mjs';
|
|
2
|
+
export declare function item(v: unknown, source: SourceRef): Item | null;
|
|
3
|
+
export declare function unresolved(v: unknown, source: SourceRef): Unresolved;
|
|
4
|
+
export declare function relation(v: unknown, source: SourceRef): Relation;
|
package/src/types/input.d.mts
CHANGED
|
@@ -1,24 +1,63 @@
|
|
|
1
1
|
import type { Item, SourceRef, Unresolved, Relation, Region, Action } from './snapshot.mjs';
|
|
2
2
|
/** Exact producer identity: no request-provided code or implicit latest revision. */
|
|
3
|
-
export interface ProducerIdentity {
|
|
4
|
-
|
|
3
|
+
export interface ProducerIdentity {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly contract: string;
|
|
7
|
+
readonly configuration: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectionLimits {
|
|
10
|
+
sources: number;
|
|
11
|
+
items: number;
|
|
12
|
+
relations: number;
|
|
13
|
+
provenance: number;
|
|
14
|
+
unresolved: number;
|
|
15
|
+
regions: number;
|
|
16
|
+
actions: number;
|
|
17
|
+
snapshotBytes: number;
|
|
18
|
+
}
|
|
5
19
|
export interface ProjectionRequest {
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
readonly key: string;
|
|
21
|
+
readonly producer: ProducerIdentity;
|
|
22
|
+
readonly sources: readonly SourceRef[];
|
|
23
|
+
readonly focus: string;
|
|
24
|
+
readonly purpose: string;
|
|
25
|
+
readonly visibilityRef: string;
|
|
26
|
+
readonly limits: Partial<ProjectionLimits>;
|
|
8
27
|
}
|
|
9
28
|
export interface ExactSource {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
29
|
+
readonly source: SourceRef;
|
|
30
|
+
readonly items: readonly (Omit<Item, 'sourceRefs' | 'visibility'> & {
|
|
31
|
+
readonly visibility: 'visible' | 'redacted' | 'omitted';
|
|
32
|
+
})[];
|
|
33
|
+
readonly unresolved: readonly Omit<Unresolved, 'sourceRefs'>[];
|
|
34
|
+
readonly relations: readonly Omit<Relation, 'sourceRefs'>[];
|
|
35
|
+
readonly truncated: boolean;
|
|
13
36
|
}
|
|
14
37
|
export interface SceneConfiguration {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
readonly key: string;
|
|
39
|
+
readonly focus: string;
|
|
40
|
+
readonly purpose: string;
|
|
41
|
+
readonly regions: readonly Region[];
|
|
42
|
+
readonly actions: readonly Action[];
|
|
43
|
+
readonly temporal?: {
|
|
44
|
+
readonly label: string;
|
|
45
|
+
readonly items: readonly {
|
|
46
|
+
readonly itemId: string;
|
|
47
|
+
readonly valuePath: readonly string[];
|
|
48
|
+
readonly format: 'utcInstant' | 'unixMilliseconds';
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
readonly presentation?: readonly {
|
|
52
|
+
readonly itemId: string;
|
|
53
|
+
readonly title?: string;
|
|
54
|
+
readonly titlePath?: readonly string[];
|
|
55
|
+
readonly summaryPath?: readonly string[];
|
|
56
|
+
readonly symbol?: string;
|
|
57
|
+
readonly fields?: readonly {
|
|
58
|
+
readonly label: string;
|
|
59
|
+
readonly valuePath: readonly string[];
|
|
60
|
+
}[];
|
|
61
|
+
}[];
|
|
23
62
|
}
|
|
24
63
|
export type ReadExact = (source: SourceRef) => ExactSource | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DataProjection, SceneProjection } from './snapshot.mjs';
|
|
2
|
+
import type { ProjectionRequest } from './input.mjs';
|
|
3
|
+
export type Snapshot = DataProjection | SceneProjection;
|
|
4
|
+
export interface PublicationTicket {
|
|
5
|
+
readonly key: string;
|
|
6
|
+
readonly expected: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PublicationReceipt extends PublicationTicket {
|
|
9
|
+
readonly publication: string;
|
|
10
|
+
readonly revision: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PendingRepair {
|
|
13
|
+
readonly ticket: PublicationTicket;
|
|
14
|
+
readonly request: ProjectionRequest;
|
|
15
|
+
readonly failure: 'ProjectionUnavailable' | 'ProjectionLimitExceeded';
|
|
16
|
+
}
|
package/src/types/snapshot.d.mts
CHANGED
|
@@ -1,43 +1,117 @@
|
|
|
1
1
|
import type { InputDeclaration } from '@zixcel/interaction/input';
|
|
2
2
|
import type { ProducerIdentity, ProjectionRequest, SceneConfiguration } from './input.mjs';
|
|
3
|
-
export type Json = null | boolean | number | string | readonly Json[] | {
|
|
4
|
-
|
|
3
|
+
export type Json = null | boolean | number | string | readonly Json[] | {
|
|
4
|
+
readonly [key: string]: Json;
|
|
5
|
+
};
|
|
6
|
+
export interface SourceRef {
|
|
7
|
+
readonly owner: string;
|
|
8
|
+
readonly ref: string;
|
|
9
|
+
readonly revision: string;
|
|
10
|
+
readonly kind: string;
|
|
11
|
+
}
|
|
5
12
|
export interface Item {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly semanticRef: string | null;
|
|
15
|
+
readonly group: {
|
|
16
|
+
readonly kind: 'semantic' | 'structural' | 'presentation';
|
|
17
|
+
readonly ref: string;
|
|
18
|
+
};
|
|
19
|
+
readonly value: Json;
|
|
20
|
+
readonly evidence: readonly string[];
|
|
21
|
+
readonly provenance: readonly string[];
|
|
22
|
+
readonly resolutionRefs: readonly string[];
|
|
23
|
+
readonly visibility: 'visible' | 'redacted';
|
|
24
|
+
readonly sourceRefs: readonly SourceRef[];
|
|
10
25
|
}
|
|
11
26
|
export interface Unresolved {
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
readonly evidence: readonly string[];
|
|
30
|
+
readonly contextRefs: readonly string[];
|
|
31
|
+
readonly actionRefs: readonly string[];
|
|
32
|
+
readonly sourceRefs: readonly SourceRef[];
|
|
14
33
|
}
|
|
15
34
|
export type RegionRole = 'Primary' | 'Context' | 'Interpretation' | 'Evidence' | 'Provenance' | 'Resolution' | 'Inspector' | 'Actions' | 'Activity';
|
|
16
|
-
export interface Region {
|
|
35
|
+
export interface Region {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly role: RegionRole;
|
|
38
|
+
readonly itemIds: readonly string[];
|
|
39
|
+
}
|
|
17
40
|
export interface ProjectedInteraction {
|
|
18
|
-
|
|
41
|
+
readonly ref: string;
|
|
42
|
+
readonly generation: string;
|
|
43
|
+
readonly inputContractRef: string;
|
|
44
|
+
readonly input: InputDeclaration;
|
|
19
45
|
}
|
|
20
46
|
export interface Action {
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly targetOwner: string;
|
|
49
|
+
readonly commandRef: string;
|
|
50
|
+
readonly label: string;
|
|
51
|
+
readonly contextRefs: readonly string[];
|
|
52
|
+
readonly sourceRefs: readonly SourceRef[];
|
|
53
|
+
readonly interaction?: ProjectedInteraction;
|
|
54
|
+
}
|
|
55
|
+
export interface Relation {
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly from: string;
|
|
58
|
+
readonly to: string;
|
|
59
|
+
readonly relationRef: string;
|
|
60
|
+
readonly sourceRefs: readonly SourceRef[];
|
|
61
|
+
}
|
|
62
|
+
export interface SourceLineage {
|
|
63
|
+
readonly sources: readonly SourceRef[];
|
|
64
|
+
readonly producer: ProducerIdentity;
|
|
65
|
+
readonly request: ProjectionRequest;
|
|
66
|
+
}
|
|
67
|
+
export interface ProjectionIdentity {
|
|
68
|
+
readonly key: string;
|
|
69
|
+
readonly revision: string;
|
|
70
|
+
readonly lineage: SourceLineage;
|
|
23
71
|
}
|
|
24
|
-
export interface Relation { readonly id: string; readonly from: string; readonly to: string; readonly relationRef: string; readonly sourceRefs: readonly SourceRef[] }
|
|
25
|
-
export interface SourceLineage { readonly sources: readonly SourceRef[]; readonly producer: ProducerIdentity; readonly request: ProjectionRequest }
|
|
26
|
-
export interface ProjectionIdentity { readonly key: string; readonly revision: string; readonly lineage: SourceLineage }
|
|
27
72
|
export interface ProjectionData {
|
|
28
|
-
|
|
29
|
-
|
|
73
|
+
readonly items: readonly Item[];
|
|
74
|
+
readonly unresolved: readonly Unresolved[];
|
|
75
|
+
readonly relations: readonly Relation[];
|
|
76
|
+
readonly truncated: boolean;
|
|
77
|
+
readonly omittedByPolicy: number;
|
|
78
|
+
}
|
|
79
|
+
export interface DataProjection extends ProjectionIdentity {
|
|
80
|
+
readonly contract: 'projection/0.10.0';
|
|
81
|
+
readonly kind: 'Data';
|
|
82
|
+
readonly data: ProjectionData;
|
|
30
83
|
}
|
|
31
|
-
export interface DataProjection extends ProjectionIdentity { readonly contract: 'projection/0.10.0'; readonly kind: 'Data'; readonly data: ProjectionData }
|
|
32
84
|
export interface SceneProjection extends ProjectionIdentity {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
85
|
+
readonly contract: 'projection/0.10.0';
|
|
86
|
+
readonly kind: 'Scene';
|
|
87
|
+
readonly lineage: SourceLineage & {
|
|
88
|
+
readonly dataProjection: {
|
|
89
|
+
readonly key: string;
|
|
90
|
+
readonly revision: string;
|
|
91
|
+
};
|
|
92
|
+
readonly sceneConfiguration: SceneConfiguration;
|
|
93
|
+
};
|
|
94
|
+
readonly data: ProjectionData & {
|
|
95
|
+
readonly regions: readonly Region[];
|
|
96
|
+
readonly actions: readonly Action[];
|
|
97
|
+
readonly focus: string;
|
|
98
|
+
readonly purpose: string;
|
|
99
|
+
readonly temporal?: {
|
|
100
|
+
readonly label: string;
|
|
101
|
+
readonly items: readonly {
|
|
102
|
+
readonly itemId: string;
|
|
103
|
+
readonly at: string;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
readonly presentation?: readonly {
|
|
107
|
+
readonly itemId: string;
|
|
108
|
+
readonly title: string;
|
|
109
|
+
readonly summary?: string;
|
|
110
|
+
readonly symbol?: string;
|
|
111
|
+
readonly fields?: readonly {
|
|
112
|
+
readonly label: string;
|
|
113
|
+
readonly value: string | number | boolean | null;
|
|
114
|
+
}[];
|
|
115
|
+
}[];
|
|
116
|
+
};
|
|
43
117
|
}
|