@openplanr/protocol 0.6.0 → 0.6.2
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/lib/dashboard/closed-json-contract.mjs +99 -109
- package/lib/dashboard/operate-experience-audit-display-contract.d.mts +128 -153
- package/lib/dashboard/operate-experience-audit-display-contract.mjs +530 -585
- package/lib/dashboard/operate-experience-display-contract.d.mts +415 -437
- package/lib/dashboard/operate-experience-display-contract.mjs +768 -831
- package/lib/dashboard/operate-experience-surface-contract.d.mts +143 -148
- package/lib/dashboard/operate-experience-surface-contract.mjs +72 -73
- package/lib/dashboard/operate-review-contract.d.mts +7 -14
- package/lib/dashboard/operate-review-contract.mjs +46 -42
- package/lib/dashboard/operate-review-display-workspace-contract.d.mts +2 -5
- package/lib/dashboard/operate-review-display-workspace-contract.mjs +158 -104
- package/lib/dashboard/operate-review-payload-safety.mjs +4 -2
- package/lib/dashboard/operate-review-workspace-projection-v2.d.mts +47 -33
- package/lib/protocol/index.d.ts +2647 -543
- package/package.json +1 -1
- package/registries/commands.json +7 -7
- package/registries/skills.json +6 -6
- package/src/browser-contracts.d.mts +4 -1
- package/src/browser-contracts.mjs +16 -5
- package/src/canonical-json.d.mts +3 -1
- package/src/canonical-json.mjs +57 -20
- package/src/compat/live-evidence-v2.mjs +1604 -485
- package/src/compat/operate-experience-live-patch.mjs +67 -15
- package/src/compat/operating-planning-contracts.mjs +183 -51
- package/src/contracts.d.mts +54 -13
- package/src/contracts.mjs +655 -345
- package/src/design-contracts.mjs +58 -21
- package/src/design-handoff-contracts.d.mts +67 -11
- package/src/design-handoff-contracts.mjs +243 -98
- package/src/design-publication-contracts.mjs +98 -33
- package/src/diagram-authoring-contracts.d.mts +422 -78
- package/src/diagram-authoring-contracts.mjs +1697 -326
- package/src/diagram-contracts.d.mts +4 -1
- package/src/diagram-contracts.mjs +16 -4
- package/src/enterprise-contracts.d.mts +211 -46
- package/src/enterprise-contracts.mjs +727 -175
- package/src/errors.mjs +4 -0
- package/src/generated/canonical-registries.mjs +13 -13
- package/src/index.d.mts +8 -8
- package/src/index.mjs +36 -20
- package/src/json-schema.d.mts +21 -6
- package/src/json-schema.mjs +66 -18
- package/src/planning-contracts.d.mts +8 -2
- package/src/planning-contracts.mjs +33 -7
- package/src/registries.d.mts +11 -3
- package/src/registries.mjs +369 -87
- package/src/review-experience-contracts.d.mts +7 -2
- package/src/review-experience-contracts.mjs +198 -49
- package/src/semver.mjs +5 -1
- package/src/skill-source-contracts.d.mts +36 -16
- package/src/skill-source-contracts.mjs +25 -6
- package/src/task-contracts.d.mts +13 -3
- package/src/task-contracts.mjs +181 -40
- package/src/workspace-contracts.d.mts +38 -10
- package/src/workspace-contracts.mjs +147 -33
|
@@ -1,157 +1,152 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from
|
|
20
|
-
import type { OperateSharedTruthSummaryV1 } from
|
|
2
|
+
JsonValue,
|
|
3
|
+
OperateExperienceAccessLevelV1,
|
|
4
|
+
OperateExperienceActionV1,
|
|
5
|
+
OperateExperienceAttentionV1,
|
|
6
|
+
OperateExperienceClaimV1,
|
|
7
|
+
OperateExperienceCycleV1,
|
|
8
|
+
OperateExperienceDomainMetricV1,
|
|
9
|
+
OperateExperienceEventHeadV1,
|
|
10
|
+
OperateExperienceEvidenceV1,
|
|
11
|
+
OperateExperienceHistoryV1,
|
|
12
|
+
OperateExperienceInboxItemV1,
|
|
13
|
+
OperateExperienceLearningV1,
|
|
14
|
+
OperateExperienceOutcomeV1,
|
|
15
|
+
OperateExperienceRationaleV1,
|
|
16
|
+
OperateExperienceReplayV1,
|
|
17
|
+
OperateExperienceViewV1,
|
|
18
|
+
ProtocolValidationError,
|
|
19
|
+
} from '../protocol/index.js';
|
|
20
|
+
import type { OperateSharedTruthSummaryV1 } from './operate-review-workspace-projection-v2.mjs';
|
|
21
21
|
|
|
22
|
-
export type OperateExperienceSurfaceStatusV1 =
|
|
23
|
-
OperateExperienceViewV1["status"];
|
|
22
|
+
export type OperateExperienceSurfaceStatusV1 = OperateExperienceViewV1['status'];
|
|
24
23
|
export interface OperateExperienceSurfaceBaseV1 {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
24
|
+
ok: true;
|
|
25
|
+
kind: 'operate-experience-surface';
|
|
26
|
+
schemaVersion: '1.0.0';
|
|
27
|
+
protocolVersion: '2.0.0';
|
|
28
|
+
surface:
|
|
29
|
+
| 'today'
|
|
30
|
+
| 'inbox'
|
|
31
|
+
| 'cycles'
|
|
32
|
+
| 'cycle'
|
|
33
|
+
| 'actions'
|
|
34
|
+
| 'action'
|
|
35
|
+
| 'evidence'
|
|
36
|
+
| 'outcomes'
|
|
37
|
+
| 'outcome'
|
|
38
|
+
| 'history'
|
|
39
|
+
| 'search'
|
|
40
|
+
| 'export';
|
|
41
|
+
readOnly: true;
|
|
42
|
+
mutationEnabled: boolean;
|
|
43
|
+
scopeId: string;
|
|
44
|
+
domainId: string;
|
|
45
|
+
domainVersion: string;
|
|
46
|
+
actorId: string;
|
|
47
|
+
accessLevel: OperateExperienceAccessLevelV1;
|
|
48
|
+
generatedAt: string;
|
|
49
|
+
eventHead: OperateExperienceEventHeadV1;
|
|
50
|
+
viewHash: string;
|
|
51
|
+
truthSummary: OperateSharedTruthSummaryV1;
|
|
52
|
+
status: OperateExperienceSurfaceStatusV1;
|
|
53
|
+
reasonCodes: string[];
|
|
55
54
|
}
|
|
56
55
|
export type OperateExperienceTodaySurfaceV1 = OperateExperienceSurfaceBaseV1 & {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
surface: 'today';
|
|
57
|
+
data: {
|
|
58
|
+
attention: OperateExperienceAttentionV1[];
|
|
59
|
+
domainMetrics: OperateExperienceDomainMetricV1[];
|
|
60
|
+
activeCycle: OperateExperienceCycleV1 | null;
|
|
61
|
+
inbox: OperateExperienceInboxItemV1[];
|
|
62
|
+
actions: OperateExperienceActionV1[];
|
|
63
|
+
outcomes: OperateExperienceOutcomeV1[];
|
|
64
|
+
allowedActions: OperateExperienceViewV1['allowedActions'];
|
|
65
|
+
};
|
|
67
66
|
};
|
|
68
67
|
export type OperateExperienceSurfaceV1 = OperateExperienceSurfaceBaseV1 &
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
68
|
+
(
|
|
69
|
+
| { surface: 'today'; data: OperateExperienceTodaySurfaceV1['data'] }
|
|
70
|
+
| {
|
|
71
|
+
surface: 'inbox';
|
|
72
|
+
data: {
|
|
73
|
+
inbox: OperateExperienceInboxItemV1[];
|
|
74
|
+
requestBinding: {
|
|
75
|
+
projectId: string;
|
|
76
|
+
generation: number;
|
|
77
|
+
subjectId: string | null;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
| { surface: 'cycles'; data: { cycles: OperateExperienceCycleV1[] } }
|
|
82
|
+
| { surface: 'cycle'; data: { cycle: OperateExperienceCycleV1 } }
|
|
83
|
+
| {
|
|
84
|
+
surface: 'actions';
|
|
85
|
+
data: {
|
|
86
|
+
actions: OperateExperienceActionV1[];
|
|
87
|
+
requestBinding: { projectId: string; generation: number };
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
| {
|
|
91
|
+
surface: 'action';
|
|
92
|
+
data: {
|
|
93
|
+
action: OperateExperienceActionV1;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
surface: 'evidence';
|
|
98
|
+
data: {
|
|
99
|
+
evidence: OperateExperienceEvidenceV1[];
|
|
100
|
+
claims: OperateExperienceClaimV1[];
|
|
101
|
+
rationale: OperateExperienceRationaleV1[];
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
| {
|
|
105
|
+
surface: 'outcomes';
|
|
106
|
+
data: {
|
|
107
|
+
domainMetrics: OperateExperienceDomainMetricV1[];
|
|
108
|
+
outcomes: OperateExperienceOutcomeV1[];
|
|
109
|
+
learnings: OperateExperienceLearningV1[];
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
| {
|
|
113
|
+
surface: 'outcome';
|
|
114
|
+
data: {
|
|
115
|
+
outcome: OperateExperienceOutcomeV1;
|
|
116
|
+
learnings: OperateExperienceLearningV1[];
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
| {
|
|
120
|
+
surface: 'history';
|
|
121
|
+
data: {
|
|
122
|
+
history: OperateExperienceHistoryV1[];
|
|
123
|
+
replay: OperateExperienceReplayV1;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
| {
|
|
127
|
+
surface: 'search';
|
|
128
|
+
data: {
|
|
129
|
+
query: string;
|
|
130
|
+
results: Array<{
|
|
131
|
+
kind: string;
|
|
132
|
+
subjectId: string;
|
|
133
|
+
title: string;
|
|
134
|
+
summary: string;
|
|
135
|
+
state: string;
|
|
136
|
+
deepLink?: string;
|
|
137
|
+
}>;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
| {
|
|
141
|
+
surface: 'export';
|
|
142
|
+
data: {
|
|
143
|
+
format: 'json' | 'html';
|
|
144
|
+
mediaType: 'application/json' | 'text/html; charset=utf-8';
|
|
145
|
+
content: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
);
|
|
150
149
|
|
|
151
|
-
export function validateOperateExperienceSurfaceV1(
|
|
152
|
-
value: unknown,
|
|
153
|
-
): ProtocolValidationError[];
|
|
150
|
+
export function validateOperateExperienceSurfaceV1(value: unknown): ProtocolValidationError[];
|
|
154
151
|
export function assertOperateExperienceSurfaceV1<T>(value: T): T;
|
|
155
|
-
export const OPERATE_EXPERIENCE_SURFACE_SCHEMA_V1: Readonly<
|
|
156
|
-
Record<string, JsonValue>
|
|
157
|
-
>;
|
|
152
|
+
export const OPERATE_EXPERIENCE_SURFACE_SCHEMA_V1: Readonly<Record<string, JsonValue>>;
|
|
@@ -1,91 +1,90 @@
|
|
|
1
1
|
import { validateJson } from '../../src/json-schema.mjs';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from
|
|
3
|
+
OPERATE_ALLOWED_ACTION_SCHEMA as allowedActionSchema,
|
|
4
|
+
OPERATING_DELIVERY_ROUTE_SCHEMA as deliveryRouteSchema,
|
|
5
|
+
OPERATING_EVIDENCE_RESOLUTION_SCHEMA as evidenceResolutionSchema,
|
|
6
|
+
OPERATING_EXECUTION_RESULT_SCHEMA as executionResultSchema,
|
|
7
|
+
OPERATE_EXPERIENCE_VIEW_SCHEMA as experienceViewSchema,
|
|
8
|
+
OPERATING_FINDING_SCHEMA as findingSchema,
|
|
9
|
+
OPERATING_GOVERNED_OPERATION_SCHEMA as governedOperationSchema,
|
|
10
|
+
OPERATING_REVIEW_SCHEMA as reviewSchema,
|
|
11
|
+
OPERATE_REVIEW_DISPLAY_WORKSPACE_SCHEMA as reviewWorkspaceSchema,
|
|
12
|
+
OPERATE_EXPERIENCE_SURFACE_SCHEMA as surfaceSchema,
|
|
13
|
+
OPERATING_TRACE_MATRIX_SCHEMA as traceMatrixSchema,
|
|
14
|
+
} from './generated/operate-experience-surface-schema-data.mjs';
|
|
15
15
|
|
|
16
16
|
const schemas = new Map([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
['operate-experience-view.schema.json', experienceViewSchema],
|
|
18
|
+
['operating-finding.schema.json', findingSchema],
|
|
19
|
+
['operate-allowed-action.schema.json', allowedActionSchema],
|
|
20
|
+
['operating-delivery-route.schema.json', deliveryRouteSchema],
|
|
21
|
+
['operating-evidence-resolution.schema.json', evidenceResolutionSchema],
|
|
22
|
+
['operating-execution-result.schema.json', executionResultSchema],
|
|
23
|
+
['operating-governed-operation.schema.json', governedOperationSchema],
|
|
24
|
+
['operating-review.schema.json', reviewSchema],
|
|
25
|
+
['operating-trace-matrix.schema.json', traceMatrixSchema],
|
|
26
|
+
['operate-review-display-workspace.schema.json', reviewWorkspaceSchema],
|
|
27
27
|
]);
|
|
28
28
|
|
|
29
29
|
function jsonPointer(root, fragment) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
if (!fragment || fragment === '#') return root;
|
|
31
|
+
if (!fragment.startsWith('#/')) return null;
|
|
32
|
+
return fragment
|
|
33
|
+
.slice(2)
|
|
34
|
+
.split('/')
|
|
35
|
+
.map((part) => part.replaceAll('~1', '/').replaceAll('~0', '~'))
|
|
36
|
+
.reduce((value, part) => value?.[part], root);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function resolveSurfaceRef(reference) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const [path, pointer = ''] = reference.split('#');
|
|
41
|
+
const filename = path.split('/').at(-1);
|
|
42
|
+
const rootSchema = schemas.get(filename);
|
|
43
|
+
if (!rootSchema) return null;
|
|
44
|
+
return {
|
|
45
|
+
schema: jsonPointer(rootSchema, pointer ? `#${pointer}` : '#'),
|
|
46
|
+
rootSchema,
|
|
47
|
+
base: filename,
|
|
48
|
+
};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export function validateOperateExperienceSurfaceV1(value) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
52
|
+
const errors = validateJson(value, surfaceSchema, {
|
|
53
|
+
base: 'schemas/v1.2.0/operate-experience-surface.schema.json',
|
|
54
|
+
resolveRef: resolveSurfaceRef,
|
|
55
|
+
});
|
|
56
|
+
if (errors.length > 0) return errors;
|
|
57
|
+
const summary = value.truthSummary;
|
|
58
|
+
if (
|
|
59
|
+
summary.sourceViewHash !== value.viewHash ||
|
|
60
|
+
summary.sourceEventHead.sequence !== value.eventHead.sequence ||
|
|
61
|
+
summary.sourceEventHead.hash !== value.eventHead.hash ||
|
|
62
|
+
summary.stages.total !== summary.stages.cycles * 7 ||
|
|
63
|
+
summary.evidence.linked > summary.evidence.total ||
|
|
64
|
+
summary.proof.linkedEvidence !== summary.evidence.linked ||
|
|
65
|
+
summary.seats.total !== summary.seats.terminal + summary.seats.active + summary.seats.pending
|
|
66
|
+
) {
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
path: '$.truthSummary',
|
|
70
|
+
rule: 'sharedTruth',
|
|
71
|
+
detail: 'does not bind one internally consistent shared truth summary',
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
export function assertOperateExperienceSurfaceV1(value) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
const errors = validateOperateExperienceSurfaceV1(value);
|
|
80
|
+
if (errors.length > 0) {
|
|
81
|
+
const error = new TypeError(
|
|
82
|
+
`operate-experience-surface: ${errors[0].path} ${errors[0].detail}`,
|
|
83
|
+
);
|
|
84
|
+
error.code = 'E_OPERATE_EXPERIENCE_SURFACE_INVALID';
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
export const OPERATE_EXPERIENCE_SURFACE_SCHEMA_V1 = Object.freeze(
|
|
90
|
-
structuredClone(surfaceSchema),
|
|
91
|
-
);
|
|
90
|
+
export const OPERATE_EXPERIENCE_SURFACE_SCHEMA_V1 = Object.freeze(structuredClone(surfaceSchema));
|
|
@@ -3,32 +3,25 @@ import type {
|
|
|
3
3
|
OperatingReviewReceiptV2,
|
|
4
4
|
} from '../protocol/index.js';
|
|
5
5
|
|
|
6
|
-
export {
|
|
7
|
-
assertOperateReviewDisplayWorkspaceV1,
|
|
8
|
-
} from './operate-review-display-workspace-contract.mjs';
|
|
9
|
-
|
|
10
6
|
export type {
|
|
11
7
|
OperateReviewDisplayWorkspaceExpectedBindingV1,
|
|
12
8
|
OperateReviewDisplayWorkspaceIntegrityV1,
|
|
13
9
|
OperateReviewDisplayWorkspaceV1,
|
|
14
10
|
} from './operate-review-display-workspace-contract.mjs';
|
|
11
|
+
export { assertOperateReviewDisplayWorkspaceV1 } from './operate-review-display-workspace-contract.mjs';
|
|
15
12
|
|
|
16
|
-
export type {
|
|
17
|
-
OperateReviewBoundSubmissionV1,
|
|
18
|
-
OperatingReviewReceiptV2,
|
|
19
|
-
};
|
|
13
|
+
export type { OperateReviewBoundSubmissionV1, OperatingReviewReceiptV2 };
|
|
20
14
|
|
|
21
|
-
export const OPERATE_REVIEW_BOUND_SUBMISSION_DOMAIN:
|
|
22
|
-
'openplanr:operate-review-bound-submission:project-write:operating-review@2.0.0#/$defs/workDisposition:1.0.0';
|
|
15
|
+
export const OPERATE_REVIEW_BOUND_SUBMISSION_DOMAIN: 'openplanr:operate-review-bound-submission:project-write:operating-review@2.0.0#/$defs/workDisposition:1.0.0';
|
|
23
16
|
|
|
24
17
|
export function computeOperatingReviewBoundSubmissionHashV1(
|
|
25
|
-
value:
|
|
18
|
+
value:
|
|
19
|
+
| Omit<OperateReviewBoundSubmissionV1, 'boundSubmissionHash'>
|
|
20
|
+
| OperateReviewBoundSubmissionV1,
|
|
26
21
|
): string;
|
|
27
22
|
|
|
28
23
|
export function assertOperatingReviewBoundSubmissionV1(
|
|
29
24
|
value: unknown,
|
|
30
25
|
): OperateReviewBoundSubmissionV1;
|
|
31
26
|
|
|
32
|
-
export function assertOperatingReviewReceiptV2(
|
|
33
|
-
value: unknown,
|
|
34
|
-
): OperatingReviewReceiptV2;
|
|
27
|
+
export function assertOperatingReviewReceiptV2(value: unknown): OperatingReviewReceiptV2;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { validateJson } from '../../src/json-schema.mjs';
|
|
2
|
+
import { exactEventHead, exactJson, jcsHash, safeDataClone } from './closed-json-contract.mjs';
|
|
2
3
|
import {
|
|
3
|
-
exactEventHead,
|
|
4
|
-
exactJson,
|
|
5
|
-
jcsHash,
|
|
6
|
-
safeDataClone,
|
|
7
|
-
} from './closed-json-contract.mjs';
|
|
8
|
-
import {
|
|
9
|
-
OPERATE_REVIEW_BOUND_SUBMISSION_SCHEMA_REVIEW_SLICE as boundSubmissionSchema,
|
|
10
4
|
OPERATING_ASSIGNMENT_SCHEMA_REVIEW_SLICE as assignmentSchema,
|
|
5
|
+
OPERATE_REVIEW_BOUND_SUBMISSION_SCHEMA_REVIEW_SLICE as boundSubmissionSchema,
|
|
11
6
|
OPERATING_REVIEW_READ_SCHEMA_REVIEW_SLICE as reviewReadSchema,
|
|
12
7
|
OPERATING_REVIEW_RECEIPT_SCHEMA_REVIEW_SLICE as reviewReceiptSchema,
|
|
13
8
|
OPERATING_REVIEW_SCHEMA_REVIEW_SLICE as reviewSchema,
|
|
14
9
|
} from './generated/operate-review-schema-data.mjs';
|
|
15
10
|
import { assertOperateReviewWorkspacePayloadSafeV1 } from './operate-review-payload-safety.mjs';
|
|
16
11
|
|
|
17
|
-
export {
|
|
18
|
-
assertOperateReviewDisplayWorkspaceV1,
|
|
19
|
-
} from './operate-review-display-workspace-contract.mjs';
|
|
12
|
+
export { assertOperateReviewDisplayWorkspaceV1 } from './operate-review-display-workspace-contract.mjs';
|
|
20
13
|
|
|
21
14
|
export const OPERATE_REVIEW_BOUND_SUBMISSION_DOMAIN =
|
|
22
15
|
'openplanr:operate-review-bound-submission:project-write:operating-review@2.0.0#/$defs/workDisposition:1.0.0';
|
|
@@ -93,8 +86,10 @@ export function assertOperatingReviewBoundSubmissionV1(value) {
|
|
|
93
86
|
'RESULT_CONTRACT_INVALID',
|
|
94
87
|
'The bound Review submission does not satisfy its closed integrity contract.',
|
|
95
88
|
);
|
|
96
|
-
if (
|
|
97
|
-
|
|
89
|
+
if (
|
|
90
|
+
candidate.choiceHash !== jcsHash(candidate.submitArguments) ||
|
|
91
|
+
candidate.boundSubmissionHash !== computeOperatingReviewBoundSubmissionHashV1(candidate)
|
|
92
|
+
) {
|
|
98
93
|
fail(
|
|
99
94
|
'RESULT_CONTRACT_INVALID',
|
|
100
95
|
'The bound Review submission does not satisfy its closed integrity contract.',
|
|
@@ -104,43 +99,50 @@ export function assertOperatingReviewBoundSubmissionV1(value) {
|
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
function exactChoiceBinding(choice, receipt) {
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
return (
|
|
103
|
+
choice.choiceHash === jcsHash(choice.submitArguments) &&
|
|
104
|
+
choice.submitArguments.reviewId === receipt.review.reviewId &&
|
|
105
|
+
choice.submitArguments.cycleId === receipt.cycleId &&
|
|
106
|
+
exactJson(choice.submitArguments.actor, receipt.actor) &&
|
|
107
|
+
exactJson(choice.submitArguments.scope, receipt.scope)
|
|
108
|
+
);
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
function exactReceiptSemantics(receipt) {
|
|
115
112
|
const choices = receipt.dispositionChoices;
|
|
116
113
|
const choiceIds = new Set(choices.map(({ choiceId }) => choiceId));
|
|
117
114
|
const choiceHashes = new Set(choices.map(({ choiceHash }) => choiceHash));
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
if (
|
|
116
|
+
choiceIds.size !== choices.length ||
|
|
117
|
+
choiceHashes.size !== choices.length ||
|
|
118
|
+
choices.some((choice) => !exactChoiceBinding(choice, receipt)) ||
|
|
119
|
+
receipt.review.reviewId.length === 0 ||
|
|
120
|
+
receipt.review.cycleId !== receipt.cycleId ||
|
|
121
|
+
receipt.review.ownerActorId !== receipt.actor.actorId ||
|
|
122
|
+
receipt.review.state !== receipt.decision ||
|
|
123
|
+
receipt.review.disposition !== receipt.decision ||
|
|
124
|
+
!exactJson(receipt.review.workDispositions, receipt.appliedWorkDispositions) ||
|
|
125
|
+
receipt.eventHead.sequence !== receipt.readEventHead.sequence + 1
|
|
126
|
+
) {
|
|
128
127
|
return false;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
|
-
const applied = choices.filter(
|
|
132
|
-
choice
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
const applied = choices.filter(
|
|
131
|
+
(choice) =>
|
|
132
|
+
choice.choiceId === receipt.appliedChoiceId &&
|
|
133
|
+
choice.choiceHash === receipt.appliedChoiceHash,
|
|
134
|
+
);
|
|
135
135
|
if (applied.length !== 1) return false;
|
|
136
136
|
const [choice] = applied;
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
if (
|
|
138
|
+
choice.submitArguments.disposition !== receipt.decision ||
|
|
139
|
+
!exactJson(choice.submitArguments.workDispositions, receipt.appliedWorkDispositions) ||
|
|
140
|
+
receipt.summary.decisionCount !== receipt.decisions.length ||
|
|
141
|
+
receipt.summary.actionCount !== receipt.actions.length ||
|
|
142
|
+
receipt.summary.findingCount !== receipt.findings.length ||
|
|
143
|
+
receipt.summary.dissentCount !== receipt.dissent.length ||
|
|
144
|
+
receipt.summary.gapCount !== receipt.gaps.length
|
|
145
|
+
) {
|
|
144
146
|
return false;
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -150,10 +152,12 @@ function exactReceiptSemantics(receipt) {
|
|
|
150
152
|
} catch {
|
|
151
153
|
return false;
|
|
152
154
|
}
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
return (
|
|
156
|
+
exactEventHead(receipt.boundSubmission.expectedReadEventHead, receipt.readEventHead) &&
|
|
157
|
+
receipt.boundSubmission.choiceId === choice.choiceId &&
|
|
158
|
+
receipt.boundSubmission.choiceHash === choice.choiceHash &&
|
|
159
|
+
exactJson(receipt.boundSubmission.submitArguments, choice.submitArguments)
|
|
160
|
+
);
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
export function assertOperatingReviewReceiptV2(value) {
|