@hasna/todos 0.15.28 → 0.15.32
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/cli/cloud-router.d.ts +15 -0
- package/dist/cli/cloud-router.d.ts.map +1 -1
- package/dist/cli/commands/project-registration-commands.d.ts +5 -0
- package/dist/cli/commands/project-registration-commands.d.ts.map +1 -0
- package/dist/cli/commands/task-commands.d.ts.map +1 -1
- package/dist/cli/commands/task-manifest-commands.d.ts.map +1 -1
- package/dist/cli/index.js +13040 -10368
- package/dist/contracts.js +64 -2
- package/dist/db/task-crud.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1489 -149
- package/dist/lib/task-parent-integrity.d.ts +14 -0
- package/dist/lib/task-parent-integrity.d.ts.map +1 -0
- package/dist/mcp/index.js +2073 -140
- package/dist/mcp/tools/task-crud.d.ts.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/project-registration/adoption-validation.d.ts +3 -0
- package/dist/project-registration/adoption-validation.d.ts.map +1 -0
- package/dist/project-registration/authority.d.ts +3 -1
- package/dist/project-registration/authority.d.ts.map +1 -1
- package/dist/project-registration/backend.d.ts +26 -1
- package/dist/project-registration/backend.d.ts.map +1 -1
- package/dist/project-registration/http.d.ts +3 -1
- package/dist/project-registration/http.d.ts.map +1 -1
- package/dist/project-registration/index.d.ts +2 -1
- package/dist/project-registration/index.d.ts.map +1 -1
- package/dist/project-registration/page-validation.d.ts +5 -0
- package/dist/project-registration/page-validation.d.ts.map +1 -0
- package/dist/project-registration/postgres.d.ts +13 -1
- package/dist/project-registration/postgres.d.ts.map +1 -1
- package/dist/project-registration/schema.d.ts.map +1 -1
- package/dist/project-registration/sqlite.d.ts +13 -1
- package/dist/project-registration/sqlite.d.ts.map +1 -1
- package/dist/project-registration/types.d.ts +68 -1
- package/dist/project-registration/types.d.ts.map +1 -1
- package/dist/project-registration.js +873 -63
- package/dist/registry.js +64 -2
- package/dist/release-provenance.json +5 -5
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +151 -0
- package/dist/sdk/v1.generated.d.ts +282 -0
- package/dist/sdk/v1.generated.d.ts.map +1 -1
- package/dist/server/index.js +2064 -131
- package/dist/server/openapi.d.ts +2856 -1357
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/v1.d.ts.map +1 -1
- package/dist/storage/postgres-adapter.d.ts.map +1 -1
- package/dist/storage/postgres-sync.d.ts +8 -0
- package/dist/storage/postgres-sync.d.ts.map +1 -1
- package/dist/storage.js +244 -19
- package/dist/task-manifest/authority.d.ts +13 -1
- package/dist/task-manifest/authority.d.ts.map +1 -1
- package/dist/task-manifest/backend.d.ts +5 -0
- package/dist/task-manifest/backend.d.ts.map +1 -1
- package/dist/task-manifest/index.d.ts +2 -2
- package/dist/task-manifest/index.d.ts.map +1 -1
- package/dist/task-manifest/plan-slug.d.ts +20 -0
- package/dist/task-manifest/plan-slug.d.ts.map +1 -1
- package/dist/task-manifest/postgres.d.ts +1 -0
- package/dist/task-manifest/postgres.d.ts.map +1 -1
- package/dist/task-manifest/schema-sql.d.ts.map +1 -1
- package/dist/task-manifest/schema.d.ts.map +1 -1
- package/dist/task-manifest/sqlite.d.ts +1 -0
- package/dist/task-manifest/sqlite.d.ts.map +1 -1
- package/dist/task-manifest/types.d.ts +21 -1
- package/dist/task-manifest/types.d.ts.map +1 -1
- package/dist/task-manifest.js +592 -61
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/registry.js
CHANGED
|
@@ -77,6 +77,12 @@ function sqliteTodosProjectRegistrationSchemaSql() {
|
|
|
77
77
|
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
78
78
|
resource_kind, direction, idempotency_key
|
|
79
79
|
);
|
|
80
|
+
CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_source_identity
|
|
81
|
+
ON todos_project_registration_receipts (
|
|
82
|
+
authority_id, tenant_id, corpus_id, route, package_version,
|
|
83
|
+
operation_id, step_id, resource_kind, direction, idempotency_key,
|
|
84
|
+
target_selector
|
|
85
|
+
);
|
|
80
86
|
CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_step
|
|
81
87
|
ON todos_project_registration_receipts (
|
|
82
88
|
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
@@ -176,6 +182,12 @@ function postgresTodosProjectRegistrationSchemaSql() {
|
|
|
176
182
|
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
177
183
|
resource_kind, direction, idempotency_key
|
|
178
184
|
)`,
|
|
185
|
+
`CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_source_identity_idx
|
|
186
|
+
ON todos_project_registration_receipts (
|
|
187
|
+
authority_id, tenant_id, corpus_id, route, package_version,
|
|
188
|
+
operation_id, step_id, resource_kind, direction, idempotency_key,
|
|
189
|
+
target_selector
|
|
190
|
+
)`,
|
|
179
191
|
`CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_step_idx
|
|
180
192
|
ON todos_project_registration_receipts (
|
|
181
193
|
authority_id, tenant_id, corpus_id, operation_id, step_id,
|
|
@@ -7905,6 +7917,46 @@ function guardPlanRowsSqlite(planIds, db) {
|
|
|
7905
7917
|
}
|
|
7906
7918
|
}
|
|
7907
7919
|
|
|
7920
|
+
// src/lib/task-parent-integrity.ts
|
|
7921
|
+
function parentCycleError(taskId, parentId) {
|
|
7922
|
+
return new ResourceConflictError("TASK_PARENT_CYCLE", `TASK_PARENT_CYCLE: assigning parent ${parentId} to task ${taskId} would create or retain a parent cycle`);
|
|
7923
|
+
}
|
|
7924
|
+
function assertTaskParentIntegrity(taskId, parentId, getTask) {
|
|
7925
|
+
if (parentId === undefined || parentId === null)
|
|
7926
|
+
return;
|
|
7927
|
+
const visited = new Set;
|
|
7928
|
+
let cursor = parentId;
|
|
7929
|
+
while (cursor) {
|
|
7930
|
+
if (cursor === taskId || visited.has(cursor)) {
|
|
7931
|
+
throw parentCycleError(taskId, parentId);
|
|
7932
|
+
}
|
|
7933
|
+
visited.add(cursor);
|
|
7934
|
+
const parent = getTask(cursor);
|
|
7935
|
+
if (!parent)
|
|
7936
|
+
throw new TaskNotFoundError(cursor);
|
|
7937
|
+
cursor = parent.parent_id;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
async function assertTaskParentIntegrityAsync(taskId, parentId, getTask) {
|
|
7941
|
+
if (parentId === undefined || parentId === null)
|
|
7942
|
+
return;
|
|
7943
|
+
const visited = new Set;
|
|
7944
|
+
let cursor = parentId;
|
|
7945
|
+
while (cursor) {
|
|
7946
|
+
if (cursor === taskId || visited.has(cursor)) {
|
|
7947
|
+
throw parentCycleError(taskId, parentId);
|
|
7948
|
+
}
|
|
7949
|
+
visited.add(cursor);
|
|
7950
|
+
const parent = await getTask(cursor);
|
|
7951
|
+
if (!parent)
|
|
7952
|
+
throw new TaskNotFoundError(cursor);
|
|
7953
|
+
cursor = parent.parent_id;
|
|
7954
|
+
}
|
|
7955
|
+
}
|
|
7956
|
+
var init_task_parent_integrity = __esm(() => {
|
|
7957
|
+
init_types();
|
|
7958
|
+
});
|
|
7959
|
+
|
|
7908
7960
|
// src/lib/creator-identity.ts
|
|
7909
7961
|
function canonicalAgentRef(value) {
|
|
7910
7962
|
return value.trim().toLowerCase();
|
|
@@ -9428,6 +9480,7 @@ function createTaskStored(input, d) {
|
|
|
9428
9480
|
let id = uuid();
|
|
9429
9481
|
for (let attempt = 0;attempt < 3; attempt++) {
|
|
9430
9482
|
try {
|
|
9483
|
+
assertTaskParentIntegrity(id, input.parent_id, (candidateId) => getTask(candidateId, d));
|
|
9431
9484
|
d.run(`INSERT INTO tasks (id, short_id, project_id, parent_id, plan_id, task_list_id, cycle_id, title, description, status, priority, agent_id, assigned_to, session_id, working_dir, tags, metadata, version, created_at, updated_at, due_at, estimated_minutes, sla_minutes, confidence, retry_count, max_retries, retry_after, requires_approval, approved_by, approved_at, recurrence_rule, recurrence_parent_id, spawns_template_id, reason, spawned_from_session, assigned_by, created_by, assigned_from_project, task_type, machine_id)
|
|
9432
9485
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
9433
9486
|
id,
|
|
@@ -9806,6 +9859,7 @@ function updateTaskStored(id, input, db) {
|
|
|
9806
9859
|
throw new VersionConflictError(id, input.version, task.version);
|
|
9807
9860
|
}
|
|
9808
9861
|
input = sanitizeUpdateTaskInput(input);
|
|
9862
|
+
assertTaskParentIntegrity(id, input.parent_id, (candidateId) => getTask(candidateId, d));
|
|
9809
9863
|
const effectivePlanId = input.plan_id !== undefined ? input.plan_id : task.plan_id;
|
|
9810
9864
|
const linkedProjectId = linkedPlanProjectId(effectivePlanId, d);
|
|
9811
9865
|
if (linkedProjectId) {
|
|
@@ -9859,6 +9913,10 @@ function updateTaskStored(id, input, db) {
|
|
|
9859
9913
|
sets.push("project_id = ?");
|
|
9860
9914
|
params.push(input.project_id);
|
|
9861
9915
|
}
|
|
9916
|
+
if (input.parent_id !== undefined) {
|
|
9917
|
+
sets.push("parent_id = ?");
|
|
9918
|
+
params.push(input.parent_id);
|
|
9919
|
+
}
|
|
9862
9920
|
if (input.assigned_to !== undefined) {
|
|
9863
9921
|
sets.push("assigned_to = ?");
|
|
9864
9922
|
params.push(input.assigned_to);
|
|
@@ -9974,6 +10032,8 @@ function updateTaskStored(id, input, db) {
|
|
|
9974
10032
|
logTaskChange(id, "update", "priority", task.priority, input.priority, agentId, d);
|
|
9975
10033
|
if (input.title !== undefined && input.title !== task.title)
|
|
9976
10034
|
logTaskChange(id, "update", "title", task.title, input.title, agentId, d);
|
|
10035
|
+
if (input.parent_id !== undefined && input.parent_id !== task.parent_id)
|
|
10036
|
+
logTaskChange(id, "update", "parent_id", task.parent_id, input.parent_id, agentId, d);
|
|
9977
10037
|
if (input.assigned_to !== undefined && input.assigned_to !== task.assigned_to)
|
|
9978
10038
|
logTaskChange(id, "update", "assigned_to", task.assigned_to, input.assigned_to, agentId, d);
|
|
9979
10039
|
if (input.working_dir !== undefined && input.working_dir !== task.working_dir)
|
|
@@ -10031,7 +10091,8 @@ function updateTask(id, input, db) {
|
|
|
10031
10091
|
if (!before)
|
|
10032
10092
|
throw new TaskNotFoundError(id);
|
|
10033
10093
|
const guardedPlanIds = [before.plan_id, input.plan_id];
|
|
10034
|
-
|
|
10094
|
+
const needsSerializedWrite = input.parent_id !== undefined || guardedPlanIds.some(Boolean);
|
|
10095
|
+
if (!needsSerializedWrite)
|
|
10035
10096
|
return updateTaskStored(id, input, d);
|
|
10036
10097
|
return d.transaction(() => {
|
|
10037
10098
|
guardPlanRowsSqlite(guardedPlanIds, d);
|
|
@@ -10067,6 +10128,7 @@ var init_task_crud = __esm(() => {
|
|
|
10067
10128
|
init_checklists();
|
|
10068
10129
|
init_storage_tombstones();
|
|
10069
10130
|
init_prewrite_secrets();
|
|
10131
|
+
init_task_parent_integrity();
|
|
10070
10132
|
});
|
|
10071
10133
|
|
|
10072
10134
|
// src/db/task-status.ts
|
|
@@ -12658,7 +12720,7 @@ var init_tasks = __esm(() => {
|
|
|
12658
12720
|
// package.json
|
|
12659
12721
|
var package_default = {
|
|
12660
12722
|
name: "@hasna/todos",
|
|
12661
|
-
version: "0.15.
|
|
12723
|
+
version: "0.15.32",
|
|
12662
12724
|
description: "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
|
|
12663
12725
|
type: "module",
|
|
12664
12726
|
main: "dist/index.js",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "@hasna/todos",
|
|
3
|
-
"packageVersion": "0.15.
|
|
3
|
+
"packageVersion": "0.15.32",
|
|
4
4
|
"repository": "https://github.com/hasna/todos.git",
|
|
5
|
-
"gitCommit": "
|
|
6
|
-
"gitTree": "
|
|
7
|
-
"sourceTreeSha256": "
|
|
8
|
-
"generatedAt": "2026-08-
|
|
5
|
+
"gitCommit": "1d458a0ef6acb9e821cba89b3b7cf1ae316781d7",
|
|
6
|
+
"gitTree": "c8bbdfbedab0c0af164640532aaaebc102441968",
|
|
7
|
+
"sourceTreeSha256": "defc279f0e698221d01999e646dfa52f5012c930cfa97fb20a596c936ad21060",
|
|
8
|
+
"generatedAt": "2026-08-12T17:50:57.000Z"
|
|
9
9
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { TodosClient, createClient } from "./client.js";
|
|
11
11
|
export type { TodosClientOptions } from "./client.js";
|
|
12
12
|
export { TodosV1Client, ApiError as TodosV1ApiError } from "./v1.generated.js";
|
|
13
|
-
export type { TodosV1ClientOptions, Task as TodosV1Task, Project as TodosV1Project, TaskManifestBindingLookupRequest as TodosV1TaskManifestBindingLookupRequest, TaskManifestBindingLookupResult as TodosV1TaskManifestBindingLookupResult, TaskManifestBindingLookupResponse as TodosV1TaskManifestBindingLookupResponse, TaskComment as TodosV1TaskComment, CreateTaskInput as TodosV1CreateTaskInput, UpdateTaskInput as TodosV1UpdateTaskInput, FailTaskInput as TodosV1FailTaskInput, TaskFailureResult as TodosV1TaskFailureResult, CreateProjectInput as TodosV1CreateProjectInput, ProjectTaskListEnsureApplyInput as TodosV1ProjectTaskListEnsureApplyInput, ProjectTaskListRollbackInput as TodosV1ProjectTaskListRollbackInput, ProjectTaskListEnsureReceipt as TodosV1ProjectTaskListEnsureReceipt, ProjectTaskListEnsureResult as TodosV1ProjectTaskListEnsureResult, ProjectTaskListRollbackResult as TodosV1ProjectTaskListRollbackResult, CreateTaskCommentInput as TodosV1CreateTaskCommentInput, AdmitPrGroupInput as TodosV1AdmitPrGroupInput, RecoverPrGroupInput as TodosV1RecoverPrGroupInput, AppendPrGroupEventInput as TodosV1AppendPrGroupEventInput, PrGroupCiProof as TodosV1PrGroupCiProof, PrGroupCleanupProof as TodosV1PrGroupCleanupProof, PrGroupRecord as TodosV1PrGroupRecord, PrGroupAttemptRecord as TodosV1PrGroupAttemptRecord, PrGroupEventRecord as TodosV1PrGroupEventRecord, PrGroupStateView as TodosV1PrGroupStateView, PrGroupEventPage as TodosV1PrGroupEventPage, PrGroupMutationResult as TodosV1PrGroupMutationResult, } from "./v1.generated.js";
|
|
13
|
+
export type { TodosV1ClientOptions, Task as TodosV1Task, Project as TodosV1Project, TaskManifestBindingLookupRequest as TodosV1TaskManifestBindingLookupRequest, TaskManifestBindingLookupResult as TodosV1TaskManifestBindingLookupResult, TaskManifestBindingLookupResponse as TodosV1TaskManifestBindingLookupResponse, ProjectRegistrationCapability as TodosV1ProjectRegistrationCapability, ProjectRegistrationReceipt as TodosV1ProjectRegistrationReceipt, ProjectRegistrationRequest as TodosV1ProjectRegistrationRequest, ProjectRegistrationLookupRequest as TodosV1ProjectRegistrationLookupRequest, ProjectResource as TodosV1ProjectResource, ProjectResourcePage as TodosV1ProjectResourcePage, TaskComment as TodosV1TaskComment, CreateTaskInput as TodosV1CreateTaskInput, UpdateTaskInput as TodosV1UpdateTaskInput, FailTaskInput as TodosV1FailTaskInput, TaskFailureResult as TodosV1TaskFailureResult, CreateProjectInput as TodosV1CreateProjectInput, ProjectTaskListEnsureApplyInput as TodosV1ProjectTaskListEnsureApplyInput, ProjectTaskListRollbackInput as TodosV1ProjectTaskListRollbackInput, ProjectTaskListEnsureReceipt as TodosV1ProjectTaskListEnsureReceipt, ProjectTaskListEnsureResult as TodosV1ProjectTaskListEnsureResult, ProjectTaskListRollbackResult as TodosV1ProjectTaskListRollbackResult, CreateTaskCommentInput as TodosV1CreateTaskCommentInput, AdmitPrGroupInput as TodosV1AdmitPrGroupInput, RecoverPrGroupInput as TodosV1RecoverPrGroupInput, AppendPrGroupEventInput as TodosV1AppendPrGroupEventInput, PrGroupCiProof as TodosV1PrGroupCiProof, PrGroupCleanupProof as TodosV1PrGroupCleanupProof, PrGroupRecord as TodosV1PrGroupRecord, PrGroupAttemptRecord as TodosV1PrGroupAttemptRecord, PrGroupEventRecord as TodosV1PrGroupEventRecord, PrGroupStateView as TodosV1PrGroupStateView, PrGroupEventPage as TodosV1PrGroupEventPage, PrGroupMutationResult as TodosV1PrGroupMutationResult, } from "./v1.generated.js";
|
|
14
14
|
export type { AdmitPrGroupInput, AppendPrGroupEventInput, PrGroupAdapterViews, PrGroupAttemptRecord, PrGroupCiProof, PrGroupCleanupProof, PrGroupDecisionEnvelopeAdapter, PrGroupEventListOptions, PrGroupEventPage, PrGroupEventRecord, PrGroupEvidenceRefAdapter, PrGroupMutationResult, PrGroupProofBundleAdapter, PrGroupRecord, PrGroupStateView, PrGroupWorkRunAdapter, RecoverPrGroupInput, } from "../pr-groups/types.js";
|
|
15
15
|
export { TodosAPIError, TodosNotFoundError, TodosConflictError, TodosUnauthorizedError, TodosRateLimitError, TodosTimeoutError, } from "./types.js";
|
|
16
16
|
export type { SSEEvent, CursorPage, ListOptions, TaskListResponse, TaskStatusResponse, TaskNextResponse, TaskActiveResponse, TaskStaleResponse, TaskChangedResponse, TaskContextResponse, TaskProgressResponse, TaskAttachmentsResponse, TaskFailResponse, TaskBulkResponse, AgentMeResponse, AgentQueueResponse, OrgNode, PlanWithTasks, ReportResponse, DoctorResponse, DoctorIssue, } from "./types.js";
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,OAAO,EAAE,aAAa,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/E,YAAY,EACV,oBAAoB,EACpB,IAAI,IAAI,WAAW,EACnB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vD,iBAAiB,IAAI,wBAAwB,EAC7C,mBAAmB,IAAI,0BAA0B,EACjD,uBAAuB,IAAI,8BAA8B,EACzD,cAAc,IAAI,qBAAqB,EACvC,mBAAmB,IAAI,0BAA0B,EACjD,aAAa,IAAI,oBAAoB,EACrC,oBAAoB,IAAI,2BAA2B,EACnD,kBAAkB,IAAI,yBAAyB,EAC/C,gBAAgB,IAAI,uBAAuB,EAC3C,gBAAgB,IAAI,uBAAuB,EAC3C,qBAAqB,IAAI,4BAA4B,GACtD,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,8BAA8B,EAC9B,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
package/dist/sdk/index.js
CHANGED
|
@@ -652,6 +652,77 @@ class TodosClient {
|
|
|
652
652
|
function createClient(options) {
|
|
653
653
|
return new TodosClient(options);
|
|
654
654
|
}
|
|
655
|
+
// src/project-registration/types.ts
|
|
656
|
+
class TodosProjectRegistrationError extends Error {
|
|
657
|
+
code;
|
|
658
|
+
details;
|
|
659
|
+
constructor(code, message, details = {}) {
|
|
660
|
+
super(message);
|
|
661
|
+
this.code = code;
|
|
662
|
+
this.details = details;
|
|
663
|
+
this.name = "TodosProjectRegistrationError";
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// src/project-registration/adoption-validation.ts
|
|
668
|
+
var VALIDATION_KEYS = [
|
|
669
|
+
"valid",
|
|
670
|
+
"resource_kind",
|
|
671
|
+
"target_id",
|
|
672
|
+
"source_receipt_id",
|
|
673
|
+
"accepted_receipt_id",
|
|
674
|
+
"source_outcome",
|
|
675
|
+
"created_at",
|
|
676
|
+
"current_revision",
|
|
677
|
+
"accepted_result_digest"
|
|
678
|
+
];
|
|
679
|
+
function isRecord(value) {
|
|
680
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
681
|
+
}
|
|
682
|
+
function isNonEmptyString(value) {
|
|
683
|
+
return typeof value === "string" && value.length > 0;
|
|
684
|
+
}
|
|
685
|
+
function hasExactKeys(value, expected) {
|
|
686
|
+
const actual = Object.keys(value).sort();
|
|
687
|
+
const wanted = [...expected].sort();
|
|
688
|
+
return actual.length === wanted.length && actual.every((key, index) => key === wanted[index]);
|
|
689
|
+
}
|
|
690
|
+
function adoptionRejected(message) {
|
|
691
|
+
throw new TodosProjectRegistrationError("TODOS_PROJECT_REGISTRATION_ADOPTION_REJECTED", `TODOS_PROJECT_REGISTRATION_ADOPTION_REJECTED: ${message}`);
|
|
692
|
+
}
|
|
693
|
+
function assertTodosPriorRegistrationAdoptionValidationEnvelope(value, input) {
|
|
694
|
+
if (!isRecord(input) || !hasExactKeys(input, [
|
|
695
|
+
"source_request",
|
|
696
|
+
"source_receipt",
|
|
697
|
+
"current_record"
|
|
698
|
+
])) {
|
|
699
|
+
adoptionRejected("prior-adoption validation input is incomplete");
|
|
700
|
+
}
|
|
701
|
+
const request = input["source_request"];
|
|
702
|
+
const receipt = input["source_receipt"];
|
|
703
|
+
const current = input["current_record"];
|
|
704
|
+
if (!isRecord(request) || !isRecord(receipt) || !isRecord(current)) {
|
|
705
|
+
adoptionRejected("prior-adoption validation input records are incomplete");
|
|
706
|
+
}
|
|
707
|
+
const resourceKind = request["resource_kind"];
|
|
708
|
+
const sourceOutcome = receipt["outcome"];
|
|
709
|
+
const acceptedReceiptId = sourceOutcome === "accepted" ? receipt["receipt_id"] : sourceOutcome === "duplicate_of_accepted" ? receipt["duplicate_of_receipt_id"] : null;
|
|
710
|
+
if (resourceKind !== "project" && resourceKind !== "task_list" || request["direction"] !== "forward" || sourceOutcome !== "accepted" && sourceOutcome !== "duplicate_of_accepted" || !isNonEmptyString(acceptedReceiptId) || !isNonEmptyString(receipt["receipt_id"]) || !isNonEmptyString(receipt["target_id"]) || !isNonEmptyString(receipt["result_revision"]) || !isNonEmptyString(receipt["result_digest"]) || !isNonEmptyString(current["id"]) || !isNonEmptyString(current["created_at"]) || !isNonEmptyString(current["updated_at"]) || receipt["authority"] !== "todos" || receipt["route"] !== request["authority_route"] || receipt["package_version"] !== request["package_version"] || receipt["authority_id"] !== request["authority_id"] || receipt["tenant_id"] !== request["tenant_id"] || receipt["corpus_id"] !== request["corpus_id"] || receipt["operation_id"] !== request["operation_id"] || receipt["step_id"] !== request["step_id"] || receipt["resource_kind"] !== resourceKind || receipt["direction"] !== "forward" || receipt["idempotency_key"] !== request["idempotency_key"] || receipt["request_digest"] !== request["request_digest"] || receipt["precondition_digest"] !== request["precondition_digest"] || receipt["accepted_receipt_id"] !== null || receipt["target_id"] !== current["id"] || receipt["result_revision"] !== current["created_at"]) {
|
|
711
|
+
adoptionRejected("prior-adoption validation input does not carry one complete accepted receipt and current target incarnation");
|
|
712
|
+
}
|
|
713
|
+
if (sourceOutcome === "accepted" && receipt["duplicate_of_receipt_id"] !== null || sourceOutcome === "duplicate_of_accepted" && receipt["duplicate_of_receipt_id"] !== acceptedReceiptId) {
|
|
714
|
+
adoptionRejected("prior-adoption validation source receipt lineage is incomplete");
|
|
715
|
+
}
|
|
716
|
+
if (!isRecord(value) || !hasExactKeys(value, ["validation"]) || !isRecord(value["validation"]) || !hasExactKeys(value["validation"], VALIDATION_KEYS)) {
|
|
717
|
+
adoptionRejected("prior-adoption validation response envelope is incomplete");
|
|
718
|
+
}
|
|
719
|
+
const validation = value["validation"];
|
|
720
|
+
if (validation["valid"] !== true || validation["resource_kind"] !== resourceKind || validation["target_id"] !== current["id"] || validation["source_receipt_id"] !== receipt["receipt_id"] || validation["accepted_receipt_id"] !== acceptedReceiptId || validation["source_outcome"] !== sourceOutcome || validation["created_at"] !== current["created_at"] || validation["current_revision"] !== current["updated_at"] || validation["accepted_result_digest"] !== receipt["result_digest"]) {
|
|
721
|
+
adoptionRejected("prior-adoption validation response does not prove the exact accepted receipt and current target");
|
|
722
|
+
}
|
|
723
|
+
return validation;
|
|
724
|
+
}
|
|
725
|
+
|
|
655
726
|
// src/sdk/v1.generated.ts
|
|
656
727
|
class ApiError extends Error {
|
|
657
728
|
status;
|
|
@@ -805,6 +876,65 @@ class TodosV1Client {
|
|
|
805
876
|
init
|
|
806
877
|
});
|
|
807
878
|
}
|
|
879
|
+
async getProjectRegistrationCapability(init) {
|
|
880
|
+
return this.request("GET", `/v1/project-registration/capability`, {
|
|
881
|
+
body: undefined,
|
|
882
|
+
query: undefined,
|
|
883
|
+
init
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
async compensateProjectRegistrationResource(body, init) {
|
|
887
|
+
return this.request("POST", `/v1/project-registration/compensate`, {
|
|
888
|
+
body,
|
|
889
|
+
query: undefined,
|
|
890
|
+
init
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
async createProjectRegistrationResource(body, init) {
|
|
894
|
+
return this.request("POST", `/v1/project-registration/create`, {
|
|
895
|
+
body,
|
|
896
|
+
query: undefined,
|
|
897
|
+
init
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
async readExactProjectRegistrationResource(body, init) {
|
|
901
|
+
return this.request("POST", `/v1/project-registration/read-exact`, {
|
|
902
|
+
body,
|
|
903
|
+
query: undefined,
|
|
904
|
+
init
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
async lookupProjectRegistrationReceipt(body, init) {
|
|
908
|
+
return this.request("POST", `/v1/project-registration/receipts/lookup`, {
|
|
909
|
+
body,
|
|
910
|
+
query: undefined,
|
|
911
|
+
init
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
async listProjectRegistrationResources(query, init) {
|
|
915
|
+
return this.request("GET", `/v1/project-registration/resources`, {
|
|
916
|
+
body: undefined,
|
|
917
|
+
query,
|
|
918
|
+
init
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
async validatePriorRegistrationAdoption(body, init) {
|
|
922
|
+
const response = await this.request("POST", `/v1/project-registration/validate-prior-adoption`, {
|
|
923
|
+
body,
|
|
924
|
+
query: undefined,
|
|
925
|
+
init
|
|
926
|
+
});
|
|
927
|
+
return {
|
|
928
|
+
validation: assertTodosPriorRegistrationAdoptionValidationEnvelope(response, body)
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
async verifyInverseProjectRegistrationResource(body, init) {
|
|
932
|
+
return this.request("POST", `/v1/project-registration/verify-inverse`, {
|
|
933
|
+
body,
|
|
934
|
+
query: undefined,
|
|
935
|
+
init
|
|
936
|
+
});
|
|
937
|
+
}
|
|
808
938
|
async listProjects(init) {
|
|
809
939
|
return this.request("GET", `/v1/projects`, {
|
|
810
940
|
body: undefined,
|
|
@@ -917,6 +1047,13 @@ class TodosV1Client {
|
|
|
917
1047
|
init
|
|
918
1048
|
});
|
|
919
1049
|
}
|
|
1050
|
+
async applyTaskManifest(body, init) {
|
|
1051
|
+
return this.request("POST", `/v1/task-manifest/apply`, {
|
|
1052
|
+
body,
|
|
1053
|
+
query: undefined,
|
|
1054
|
+
init
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
920
1057
|
async lookupTaskManifestBinding(body, init) {
|
|
921
1058
|
return this.request("POST", `/v1/task-manifest/bindings/lookup`, {
|
|
922
1059
|
body,
|
|
@@ -931,6 +1068,20 @@ class TodosV1Client {
|
|
|
931
1068
|
init
|
|
932
1069
|
});
|
|
933
1070
|
}
|
|
1071
|
+
async compensateTaskManifest(body, init) {
|
|
1072
|
+
return this.request("POST", `/v1/task-manifest/compensate`, {
|
|
1073
|
+
body,
|
|
1074
|
+
query: undefined,
|
|
1075
|
+
init
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
async readExactTaskManifest(body, init) {
|
|
1079
|
+
return this.request("POST", `/v1/task-manifest/read-exact`, {
|
|
1080
|
+
body,
|
|
1081
|
+
query: undefined,
|
|
1082
|
+
init
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
934
1085
|
async listTasks(query, init) {
|
|
935
1086
|
return this.request("GET", `/v1/tasks`, {
|
|
936
1087
|
body: undefined,
|