@unson/brainbase-mcp 0.5.0 → 0.7.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/README.md +8 -0
- package/contracts/judgment-dag/digest.json +2 -2
- package/dist/canonical-task-contract.d.ts +9 -0
- package/dist/canonical-task-contract.js +39 -0
- package/dist/canonical-task-principal.d.ts +16 -0
- package/dist/canonical-task-principal.js +36 -0
- package/dist/canonical-task-service.d.ts +251 -0
- package/dist/canonical-task-service.js +809 -0
- package/dist/company-os-evaluation.d.ts +193 -0
- package/dist/company-os-evaluation.js +1150 -0
- package/dist/company-os-impact-review.d.ts +248 -0
- package/dist/company-os-impact-review.js +663 -0
- package/dist/company-os-learning-adoption.d.ts +288 -0
- package/dist/company-os-learning-adoption.js +944 -0
- package/dist/company-os-objectives.d.ts +52 -0
- package/dist/company-os-objectives.js +197 -0
- package/dist/company-os-receipt-adapter.d.ts +109 -0
- package/dist/company-os-receipt-adapter.js +636 -0
- package/dist/constraint-exception-store.d.ts +23 -0
- package/dist/constraint-exception-store.js +108 -0
- package/dist/constraint-resolution.d.ts +175 -0
- package/dist/constraint-resolution.js +922 -0
- package/dist/decision-adapter.d.ts +145 -0
- package/dist/decision-adapter.js +586 -0
- package/dist/durable-wait-http.d.ts +51 -0
- package/dist/durable-wait-http.js +497 -0
- package/dist/durable-waits.d.ts +234 -0
- package/dist/durable-waits.js +944 -0
- package/dist/execution-authority-http.d.ts +28 -0
- package/dist/execution-authority-http.js +359 -0
- package/dist/execution-authority.d.ts +201 -0
- package/dist/execution-authority.js +634 -0
- package/dist/foundation-catalog.d.ts +26 -0
- package/dist/foundation-catalog.js +206 -0
- package/dist/foundation-constraint-store.d.ts +50 -0
- package/dist/foundation-constraint-store.js +215 -0
- package/dist/foundation-http.d.ts +90 -0
- package/dist/foundation-http.js +439 -0
- package/dist/foundation-store.d.ts +132 -0
- package/dist/foundation-store.js +654 -0
- package/dist/judgment-dag-composition.d.ts +224 -0
- package/dist/judgment-dag-composition.js +731 -0
- package/dist/judgment-dag.d.ts +2 -0
- package/dist/judgment-dag.js +1 -0
- package/dist/judgment-problem-snapshot.d.ts +185 -0
- package/dist/judgment-problem-snapshot.js +777 -0
- package/dist/judgment-view-http.d.ts +22 -0
- package/dist/judgment-view-http.js +128 -0
- package/dist/judgment-view.d.ts +222 -0
- package/dist/judgment-view.js +627 -0
- package/dist/knowledge-adapter.d.ts +112 -0
- package/dist/knowledge-adapter.js +691 -0
- package/dist/ontology-foundation.d.ts +209 -0
- package/dist/ontology-foundation.js +1000 -0
- package/dist/ontology.d.ts +13 -0
- package/dist/ontology.js +14 -0
- package/dist/organization-connection.d.ts +164 -0
- package/dist/organization-connection.js +428 -0
- package/dist/personal-knowledge.d.ts +120 -0
- package/dist/personal-knowledge.js +750 -0
- package/dist/problem-candidates.d.ts +149 -0
- package/dist/problem-candidates.js +898 -0
- package/dist/problem-selection.d.ts +238 -0
- package/dist/problem-selection.js +995 -0
- package/dist/resource-reservation-http.d.ts +31 -0
- package/dist/resource-reservation-http.js +371 -0
- package/dist/resource-reservations.d.ts +221 -0
- package/dist/resource-reservations.js +577 -0
- package/dist/server.d.ts +97 -0
- package/dist/server.js +180 -1
- package/dist/ssot.d.ts +6 -1
- package/dist/ssot.js +63 -5
- package/dist/streamable-http.d.ts +42 -0
- package/dist/streamable-http.js +288 -0
- package/dist/types.d.ts +20 -0
- package/dist/world-model.d.ts +181 -0
- package/dist/world-model.js +873 -0
- package/package.json +145 -3
- package/ui/icons/mana/LICENSE.tabler.txt +21 -0
- package/ui/icons/mana/affiliate.svg +20 -0
- package/ui/icons/mana/brand-github.svg +15 -0
- package/ui/icons/mana/brand-google-drive.svg +17 -0
- package/ui/icons/mana/brand-slack.svg +18 -0
- package/ui/icons/mana/cpu.svg +24 -0
- package/ui/judgment-view.css +238 -0
- package/ui/judgment-view.js +508 -0
- package/ui/objective-editor.css +180 -0
- package/ui/objective-editor.js +1139 -0
- package/ui/outcome-knowledge.css +365 -0
- package/ui/outcome-knowledge.js +1570 -0
- package/ui/outcome-mana.css +255 -0
- package/ui/outcome-mana.js +2325 -0
package/README.md
CHANGED
|
@@ -49,6 +49,14 @@ Brainbaseの価値は、情報を多く保存することではありません
|
|
|
49
49
|
|
|
50
50
|
組織向けのRBAC、承認、監査、マルチユーザー、managed connector、hosted runtimeは、共通の脳モデルを変えずに組織版で追加する領域です。
|
|
51
51
|
|
|
52
|
+
### UIの所有境界
|
|
53
|
+
|
|
54
|
+
- 単一利用者でも成立する共通UIは、このOSSリポジトリが所有します。
|
|
55
|
+
- 組織版はOSS UIを依存として組み込み、組織・メンバー・権限・承認・監査・tenant管理だけを追加します。
|
|
56
|
+
- 顧客固有のbranding、feature flag、接続先設定は顧客設定リポジトリが所有し、共通UIを複製しません。
|
|
57
|
+
|
|
58
|
+
共通UIの最初の公開単位として、知識UIとMana委任UIを `@unson/brainbase-mcp/ui/*` から利用できます。
|
|
59
|
+
|
|
52
60
|
実装済み・develop・計画中の境界は、[現在の状態](https://brainbase.pages.dev/guide/status)を参照してください。
|
|
53
61
|
|
|
54
62
|
## 10分で試す
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "README.md",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "eec54fc479eee1deba5c0abbfb3d733596229c87a2c4bacfc446b52e3c0140ed"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
"digest": "
|
|
31
|
+
"digest": "f4b1b5eb55f71eaa481666c5f9503959a6c3ccf6fa8e7d28536653e8e1ab2f38"
|
|
32
32
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const CANONICAL_TASK_STATUSES: readonly ["pending", "in_progress", "waiting", "completed", "cancelled"];
|
|
2
|
+
export type CanonicalTaskStatus = typeof CANONICAL_TASK_STATUSES[number];
|
|
3
|
+
export declare const CANONICAL_TASK_PRIORITIES: readonly ["low", "medium", "high", "urgent"];
|
|
4
|
+
export type CanonicalTaskPriority = typeof CANONICAL_TASK_PRIORITIES[number];
|
|
5
|
+
export declare function isCanonicalTaskStatus(value: unknown): value is CanonicalTaskStatus;
|
|
6
|
+
export declare function isCanonicalTaskPriority(value: unknown): value is CanonicalTaskPriority;
|
|
7
|
+
export declare function normalizeCanonicalTaskProjectCodes(value: unknown): string[];
|
|
8
|
+
export declare function hasInvalidCanonicalTaskProjectCode(value: unknown): boolean;
|
|
9
|
+
export declare function canTransitionCanonicalTaskStatus(from: unknown, to: unknown): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const CANONICAL_TASK_STATUSES = [
|
|
2
|
+
'pending',
|
|
3
|
+
'in_progress',
|
|
4
|
+
'waiting',
|
|
5
|
+
'completed',
|
|
6
|
+
'cancelled',
|
|
7
|
+
];
|
|
8
|
+
export const CANONICAL_TASK_PRIORITIES = ['low', 'medium', 'high', 'urgent'];
|
|
9
|
+
const STATUS_SET = new Set(CANONICAL_TASK_STATUSES);
|
|
10
|
+
const PRIORITY_SET = new Set(CANONICAL_TASK_PRIORITIES);
|
|
11
|
+
const TRANSITIONS = Object.freeze({
|
|
12
|
+
pending: new Set(['in_progress', 'waiting', 'completed', 'cancelled']),
|
|
13
|
+
in_progress: new Set(['waiting', 'completed', 'cancelled']),
|
|
14
|
+
waiting: new Set(['in_progress', 'completed', 'cancelled']),
|
|
15
|
+
completed: new Set(),
|
|
16
|
+
cancelled: new Set(['pending']),
|
|
17
|
+
});
|
|
18
|
+
export function isCanonicalTaskStatus(value) {
|
|
19
|
+
return typeof value === 'string' && STATUS_SET.has(value);
|
|
20
|
+
}
|
|
21
|
+
export function isCanonicalTaskPriority(value) {
|
|
22
|
+
return typeof value === 'string' && PRIORITY_SET.has(value);
|
|
23
|
+
}
|
|
24
|
+
export function normalizeCanonicalTaskProjectCodes(value) {
|
|
25
|
+
const values = Array.isArray(value) ? value : (value == null ? [] : [value]);
|
|
26
|
+
return [...new Set(values.flatMap((item) => String(item).split(','))
|
|
27
|
+
.map((item) => item.trim())
|
|
28
|
+
.filter(Boolean))];
|
|
29
|
+
}
|
|
30
|
+
export function hasInvalidCanonicalTaskProjectCode(value) {
|
|
31
|
+
const values = Array.isArray(value) ? value : (value == null ? [] : [value]);
|
|
32
|
+
return values.some((item) => typeof item !== 'string'
|
|
33
|
+
|| item.split(',').some((code) => !code.trim() || code.trim().length > 100));
|
|
34
|
+
}
|
|
35
|
+
export function canTransitionCanonicalTaskStatus(from, to) {
|
|
36
|
+
return isCanonicalTaskStatus(from)
|
|
37
|
+
&& isCanonicalTaskStatus(to)
|
|
38
|
+
&& TRANSITIONS[from].has(to);
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type CanonicalTaskPrincipalType = 'person' | 'service' | 'internal';
|
|
2
|
+
export type CanonicalTaskPrincipal = Readonly<{
|
|
3
|
+
type: CanonicalTaskPrincipalType;
|
|
4
|
+
id: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function normalizeCanonicalTaskPrincipal(principal: {
|
|
7
|
+
type?: unknown;
|
|
8
|
+
id?: unknown;
|
|
9
|
+
} | null | undefined): CanonicalTaskPrincipal;
|
|
10
|
+
export declare function createCanonicalTaskPrincipal({ authSource, personId, serviceId, internalId, }?: {
|
|
11
|
+
authSource?: string;
|
|
12
|
+
personId?: string;
|
|
13
|
+
serviceId?: string;
|
|
14
|
+
internalId?: string;
|
|
15
|
+
}): CanonicalTaskPrincipal;
|
|
16
|
+
export declare function principalNamespace(principal: CanonicalTaskPrincipal): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const ALLOWED_TYPES = new Set(['person', 'service', 'internal']);
|
|
2
|
+
const TRUSTED_AUTH_SOURCES = new Set(['bearer', 'service-token', 'internal']);
|
|
3
|
+
function normalizePart(value, label) {
|
|
4
|
+
const normalized = String(value || '').normalize('NFC');
|
|
5
|
+
if (!normalized)
|
|
6
|
+
throw new Error(`Canonical Task principal ${label} is required`);
|
|
7
|
+
if (/\p{Cc}/u.test(normalized))
|
|
8
|
+
throw new Error(`Canonical Task principal ${label} contains control characters`);
|
|
9
|
+
return normalized;
|
|
10
|
+
}
|
|
11
|
+
export function normalizeCanonicalTaskPrincipal(principal) {
|
|
12
|
+
const type = String(principal?.type || '').toLowerCase();
|
|
13
|
+
if (!ALLOWED_TYPES.has(type))
|
|
14
|
+
throw new Error('Canonical Task principal type is invalid');
|
|
15
|
+
return Object.freeze({ type, id: normalizePart(principal?.id, 'id') });
|
|
16
|
+
}
|
|
17
|
+
export function createCanonicalTaskPrincipal({ authSource, personId, serviceId, internalId, } = {}) {
|
|
18
|
+
if (personId && ['bearer', 'session'].includes(authSource ?? '')) {
|
|
19
|
+
return normalizeCanonicalTaskPrincipal({ type: 'person', id: personId });
|
|
20
|
+
}
|
|
21
|
+
if (!TRUSTED_AUTH_SOURCES.has(authSource ?? '')) {
|
|
22
|
+
throw new Error('Canonical Task principal requires trusted authentication');
|
|
23
|
+
}
|
|
24
|
+
if (authSource === 'service-token') {
|
|
25
|
+
return normalizeCanonicalTaskPrincipal({ type: 'service', id: serviceId });
|
|
26
|
+
}
|
|
27
|
+
if (authSource === 'internal') {
|
|
28
|
+
return normalizeCanonicalTaskPrincipal({ type: 'internal', id: internalId });
|
|
29
|
+
}
|
|
30
|
+
return normalizeCanonicalTaskPrincipal({ type: 'person', id: personId });
|
|
31
|
+
}
|
|
32
|
+
export function principalNamespace(principal) {
|
|
33
|
+
const normalized = normalizeCanonicalTaskPrincipal(principal);
|
|
34
|
+
const payload = JSON.stringify({ type: normalized.type, id: normalized.id });
|
|
35
|
+
return `v1.${Buffer.from(payload, 'utf8').toString('base64url')}`;
|
|
36
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { type CanonicalTaskPriority, type CanonicalTaskStatus } from './canonical-task-contract.js';
|
|
2
|
+
import { type CanonicalTaskPrincipal } from './canonical-task-principal.js';
|
|
3
|
+
type JsonRecord = Record<string, unknown>;
|
|
4
|
+
export type CanonicalTaskAction = 'list' | 'search' | 'read' | 'create' | 'update' | 'transition' | 'delete';
|
|
5
|
+
export type CanonicalTaskAuditAction = 'canonical_task.created' | 'canonical_task.updated' | 'canonical_task.transitioned' | 'canonical_task.deleted';
|
|
6
|
+
export interface CanonicalTaskContext extends JsonRecord {
|
|
7
|
+
principal: CanonicalTaskPrincipal;
|
|
8
|
+
authSource?: string | null;
|
|
9
|
+
auditPrincipal?: CanonicalTaskPrincipal | null;
|
|
10
|
+
auditAuthSource?: string | null;
|
|
11
|
+
idempotencyKey?: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface CanonicalTaskRecord extends JsonRecord {
|
|
14
|
+
id: string;
|
|
15
|
+
version: number;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string | null;
|
|
18
|
+
status: CanonicalTaskStatus;
|
|
19
|
+
priority: CanonicalTaskPriority;
|
|
20
|
+
assignee_person_id?: string | null;
|
|
21
|
+
assignee_display_name?: string | null;
|
|
22
|
+
due_at?: string | null;
|
|
23
|
+
waiting_on?: string | null;
|
|
24
|
+
review_at?: string | null;
|
|
25
|
+
completed_at?: string | null;
|
|
26
|
+
source_refs?: unknown[];
|
|
27
|
+
project_codes?: string[];
|
|
28
|
+
created_at?: string | null;
|
|
29
|
+
updated_at?: string | null;
|
|
30
|
+
web_url?: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface CanonicalTaskCreateInput extends JsonRecord {
|
|
33
|
+
title: string;
|
|
34
|
+
description?: string | null;
|
|
35
|
+
priority?: CanonicalTaskPriority | string | null;
|
|
36
|
+
assignee_person_id?: string | null;
|
|
37
|
+
due_at?: string | null;
|
|
38
|
+
waiting_on?: string | null;
|
|
39
|
+
review_at?: string | null;
|
|
40
|
+
source_refs?: unknown[];
|
|
41
|
+
project_codes?: unknown;
|
|
42
|
+
}
|
|
43
|
+
export interface CanonicalTaskUpdateInput extends JsonRecord {
|
|
44
|
+
title?: string;
|
|
45
|
+
description?: string | null;
|
|
46
|
+
priority?: CanonicalTaskPriority | string | null;
|
|
47
|
+
assignee_person_id?: string | null;
|
|
48
|
+
due_at?: string | null;
|
|
49
|
+
waiting_on?: string | null;
|
|
50
|
+
review_at?: string | null;
|
|
51
|
+
source_refs?: unknown[];
|
|
52
|
+
project_codes?: unknown;
|
|
53
|
+
}
|
|
54
|
+
export interface CanonicalTaskListFilters extends JsonRecord {
|
|
55
|
+
statuses?: unknown;
|
|
56
|
+
status?: unknown;
|
|
57
|
+
priorities?: unknown;
|
|
58
|
+
priority?: unknown;
|
|
59
|
+
projectCodes?: unknown;
|
|
60
|
+
projectCode?: unknown;
|
|
61
|
+
project_code?: unknown;
|
|
62
|
+
assigneePersonId?: string | null;
|
|
63
|
+
dueAfter?: string | null;
|
|
64
|
+
dueBefore?: string | null;
|
|
65
|
+
limit?: number | string | null;
|
|
66
|
+
cursor?: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface CanonicalTaskSearchFilters extends CanonicalTaskListFilters {
|
|
69
|
+
q?: string | null;
|
|
70
|
+
query?: string | null;
|
|
71
|
+
}
|
|
72
|
+
export interface CanonicalTaskPage {
|
|
73
|
+
items: CanonicalTaskRecord[];
|
|
74
|
+
totalCount?: number | null;
|
|
75
|
+
countStatus?: string | null;
|
|
76
|
+
nextCursor?: string | null;
|
|
77
|
+
readStatus?: string | null;
|
|
78
|
+
total_count?: number | null;
|
|
79
|
+
count_status?: string | null;
|
|
80
|
+
next_cursor?: string | null;
|
|
81
|
+
read_status?: string | null;
|
|
82
|
+
has_more?: boolean;
|
|
83
|
+
as_of?: string;
|
|
84
|
+
warnings?: string[];
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
export interface CanonicalTaskSearchPage extends CanonicalTaskPage {
|
|
88
|
+
query: string;
|
|
89
|
+
}
|
|
90
|
+
export interface CanonicalTaskAuditEntry extends JsonRecord {
|
|
91
|
+
id: string;
|
|
92
|
+
actor: CanonicalTaskPrincipal;
|
|
93
|
+
actor_id: string;
|
|
94
|
+
actor_type: CanonicalTaskPrincipal['type'];
|
|
95
|
+
actor_principal: CanonicalTaskPrincipal;
|
|
96
|
+
actor_namespace: string;
|
|
97
|
+
auth_source: string | null;
|
|
98
|
+
action: CanonicalTaskAuditAction;
|
|
99
|
+
target_type: 'canonical_task';
|
|
100
|
+
target_id: string;
|
|
101
|
+
changes: JsonRecord;
|
|
102
|
+
source_refs: unknown[];
|
|
103
|
+
}
|
|
104
|
+
export interface CanonicalTaskRepository {
|
|
105
|
+
list(filters: CanonicalTaskListFilters): Promise<CanonicalTaskPage>;
|
|
106
|
+
search(filters: CanonicalTaskSearchFilters): Promise<CanonicalTaskPage>;
|
|
107
|
+
get(taskId: string): Promise<CanonicalTaskRecord | null>;
|
|
108
|
+
findByIdempotencyKey(key: string): Promise<CanonicalTaskRecord | null>;
|
|
109
|
+
create(input: JsonRecord): Promise<CanonicalTaskRecord>;
|
|
110
|
+
update(taskId: string, patch: JsonRecord): Promise<CanonicalTaskRecord>;
|
|
111
|
+
delete(taskId: string, expectedVersion: number): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
export interface CanonicalTaskAuditRepository {
|
|
114
|
+
upsertAuditLog(entry: CanonicalTaskAuditEntry): Promise<void>;
|
|
115
|
+
}
|
|
116
|
+
export interface CanonicalTaskAuthorizationRequest {
|
|
117
|
+
action: CanonicalTaskAction;
|
|
118
|
+
context: CanonicalTaskContext;
|
|
119
|
+
task?: CanonicalTaskRecord | null;
|
|
120
|
+
input?: unknown;
|
|
121
|
+
}
|
|
122
|
+
export interface CanonicalTaskPolicy {
|
|
123
|
+
normalizeContext?(context: CanonicalTaskContext): CanonicalTaskContext | Promise<CanonicalTaskContext>;
|
|
124
|
+
authorize(request: CanonicalTaskAuthorizationRequest): void | Promise<void>;
|
|
125
|
+
scopeFilters?(input: {
|
|
126
|
+
operation: 'list' | 'search';
|
|
127
|
+
context: CanonicalTaskContext;
|
|
128
|
+
filters: CanonicalTaskListFilters | CanonicalTaskSearchFilters;
|
|
129
|
+
}): Partial<CanonicalTaskListFilters | CanonicalTaskSearchFilters> | void | Promise<Partial<CanonicalTaskListFilters | CanonicalTaskSearchFilters> | void>;
|
|
130
|
+
}
|
|
131
|
+
export type CanonicalTaskClock = () => Date;
|
|
132
|
+
export type CanonicalTaskBaseUrl = string | (() => string | null | undefined);
|
|
133
|
+
export interface CanonicalTaskOperationRequest<T> {
|
|
134
|
+
scope: string;
|
|
135
|
+
operationKey: string;
|
|
136
|
+
fingerprint: string;
|
|
137
|
+
/**
|
|
138
|
+
* Persist only the stable reference needed to resume an operation. The
|
|
139
|
+
* coordinator must not need to serialize the complete Task payload.
|
|
140
|
+
*/
|
|
141
|
+
projectResult?: (result: T) => unknown;
|
|
142
|
+
/**
|
|
143
|
+
* Inspect durable state after a caller or coordinator restart. A recovery
|
|
144
|
+
* result is deliberately explicit so a missing record is not mistaken for
|
|
145
|
+
* a successful replay.
|
|
146
|
+
*/
|
|
147
|
+
recover?: () => Promise<CanonicalTaskOperationRecovery<T>>;
|
|
148
|
+
run: () => Promise<T>;
|
|
149
|
+
}
|
|
150
|
+
export interface CanonicalTaskOperationRecovery<T> {
|
|
151
|
+
recovered: boolean;
|
|
152
|
+
result?: T;
|
|
153
|
+
}
|
|
154
|
+
export interface CanonicalTaskPreparedDeleteRequest<T> {
|
|
155
|
+
scope?: string;
|
|
156
|
+
operationKey: string;
|
|
157
|
+
fingerprint: string;
|
|
158
|
+
/** Fingerprint for the task-version claim paired with the delete intent. */
|
|
159
|
+
versionFingerprint: string;
|
|
160
|
+
versionClaimKey: string;
|
|
161
|
+
principalNamespace: string;
|
|
162
|
+
prepare: () => Promise<{
|
|
163
|
+
result: T;
|
|
164
|
+
task?: CanonicalTaskRecord | null;
|
|
165
|
+
authorizationSnapshot?: JsonRecord;
|
|
166
|
+
}>;
|
|
167
|
+
findTask: () => Promise<CanonicalTaskRecord | null>;
|
|
168
|
+
removeTask: (task?: CanonicalTaskRecord) => Promise<void>;
|
|
169
|
+
projectResult?: (result: T) => unknown;
|
|
170
|
+
recover?: () => Promise<CanonicalTaskOperationRecovery<T>>;
|
|
171
|
+
}
|
|
172
|
+
export interface CanonicalTaskOperationRepository {
|
|
173
|
+
execute<T>(request: CanonicalTaskOperationRequest<T>): Promise<T>;
|
|
174
|
+
executePreparedDelete?<T>(request: CanonicalTaskPreparedDeleteRequest<T>): Promise<T>;
|
|
175
|
+
}
|
|
176
|
+
export interface CanonicalTaskServiceOptions {
|
|
177
|
+
repository: CanonicalTaskRepository;
|
|
178
|
+
auditRepository?: CanonicalTaskAuditRepository;
|
|
179
|
+
policy?: CanonicalTaskPolicy;
|
|
180
|
+
operationRepository?: CanonicalTaskOperationRepository;
|
|
181
|
+
clock?: CanonicalTaskClock;
|
|
182
|
+
baseUrl?: CanonicalTaskBaseUrl;
|
|
183
|
+
}
|
|
184
|
+
export declare class CanonicalTaskError extends Error {
|
|
185
|
+
readonly code: string;
|
|
186
|
+
readonly status: number;
|
|
187
|
+
readonly details: JsonRecord;
|
|
188
|
+
readonly fieldErrors: Record<string, string[]>;
|
|
189
|
+
readonly currentTask?: CanonicalTaskRecord;
|
|
190
|
+
constructor(code: string, message: string, status?: number, details?: JsonRecord, options?: {
|
|
191
|
+
fieldErrors?: Record<string, string[]>;
|
|
192
|
+
currentTask?: CanonicalTaskRecord;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
export declare class CanonicalTaskService {
|
|
196
|
+
private readonly repository;
|
|
197
|
+
private readonly auditRepository?;
|
|
198
|
+
private readonly policy;
|
|
199
|
+
private readonly operationRepository?;
|
|
200
|
+
private readonly clock;
|
|
201
|
+
private readonly baseUrl?;
|
|
202
|
+
constructor(options: CanonicalTaskServiceOptions);
|
|
203
|
+
listTasks(filters: CanonicalTaskListFilters | undefined, context: CanonicalTaskContext): Promise<CanonicalTaskPage>;
|
|
204
|
+
searchTasks(filters: CanonicalTaskSearchFilters | undefined, context: CanonicalTaskContext): Promise<CanonicalTaskSearchPage>;
|
|
205
|
+
getTask(taskId: string, context: CanonicalTaskContext): Promise<CanonicalTaskRecord>;
|
|
206
|
+
createTask(input: CanonicalTaskCreateInput, context: CanonicalTaskContext): Promise<CanonicalTaskRecord>;
|
|
207
|
+
updateTask(taskId: string, input: CanonicalTaskUpdateInput & {
|
|
208
|
+
expected_version?: number;
|
|
209
|
+
}, expectedVersion: number, context: CanonicalTaskContext): Promise<CanonicalTaskRecord>;
|
|
210
|
+
updateTask(taskId: string, input: CanonicalTaskUpdateInput & {
|
|
211
|
+
expected_version?: number;
|
|
212
|
+
}, context: CanonicalTaskContext): Promise<CanonicalTaskRecord>;
|
|
213
|
+
transitionTask(taskId: string, status: unknown, expectedVersion: number, context: CanonicalTaskContext, input?: {
|
|
214
|
+
waitingOn?: unknown;
|
|
215
|
+
reviewAt?: unknown;
|
|
216
|
+
}): Promise<CanonicalTaskRecord>;
|
|
217
|
+
transitionTask(taskId: string, input: {
|
|
218
|
+
to_status?: unknown;
|
|
219
|
+
expected_version?: number;
|
|
220
|
+
waiting_on?: unknown;
|
|
221
|
+
review_at?: unknown;
|
|
222
|
+
}, context: CanonicalTaskContext): Promise<CanonicalTaskRecord>;
|
|
223
|
+
deleteTask(taskId: string, expectedVersion: number, context: CanonicalTaskContext): Promise<{
|
|
224
|
+
task_id: string;
|
|
225
|
+
deleted: true;
|
|
226
|
+
version: number;
|
|
227
|
+
}>;
|
|
228
|
+
deleteTask(taskId: string, input: {
|
|
229
|
+
expected_version?: number;
|
|
230
|
+
}, context: CanonicalTaskContext): Promise<{
|
|
231
|
+
task_id: string;
|
|
232
|
+
deleted: true;
|
|
233
|
+
version: number;
|
|
234
|
+
}>;
|
|
235
|
+
private versionedMutation;
|
|
236
|
+
private normalizeCreateInput;
|
|
237
|
+
private normalizeUpdateInput;
|
|
238
|
+
private normalizeListFilters;
|
|
239
|
+
private normalizeSearchFilters;
|
|
240
|
+
private normalizeContext;
|
|
241
|
+
private authorize;
|
|
242
|
+
private scopeFilters;
|
|
243
|
+
private requireIdempotencyKey;
|
|
244
|
+
private requireExpectedVersion;
|
|
245
|
+
private assertVersion;
|
|
246
|
+
private executeOperation;
|
|
247
|
+
private audit;
|
|
248
|
+
private read;
|
|
249
|
+
private normalizeResponse;
|
|
250
|
+
}
|
|
251
|
+
export {};
|