@things-factory/compliance 10.1.269 → 10.1.271

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.
@@ -18,9 +18,14 @@ export declare const LEGAL_TODO_ACTIVITIES: {
18
18
  inputKey: string;
19
19
  tKey: string;
20
20
  }[];
21
+ decisionKeys: {
22
+ role: string;
23
+ inputPath: string;
24
+ name: string;
25
+ }[];
21
26
  viewType: string;
22
27
  viewSource: string;
23
- model: {
28
+ model: ({
24
29
  name: string;
25
30
  description: string;
26
31
  tag: string;
@@ -32,6 +37,18 @@ export declare const LEGAL_TODO_ACTIVITIES: {
32
37
  unit: any;
33
38
  quantifier: number[];
34
39
  spec: {};
35
- }[];
40
+ } | {
41
+ name: string;
42
+ description: string;
43
+ tag: string;
44
+ inout: string;
45
+ type: string;
46
+ options: {};
47
+ unit: any;
48
+ quantifier: number[];
49
+ spec: {};
50
+ hidden?: undefined;
51
+ mandatory?: undefined;
52
+ })[];
36
53
  standardTime: number;
37
54
  }[];
@@ -27,13 +27,16 @@ exports.LEGAL_TODO_ACTIVITIES = [
27
27
  uiType: 'custom-element',
28
28
  uiSource: 'compliance-todo',
29
29
  searchKeys: [{ name: 'headline', description: 'What is asked', inputKey: 'headline', tKey: 'field.subject' }],
30
+ /* What was asked and what was done, on the case itself (worklist finished-case.ts). */
31
+ decisionKeys: [{ role: 'headline', inputPath: 'headline', name: 'what is asked, by when' }],
30
32
  viewType: '',
31
33
  viewSource: '',
32
34
  model: [
33
35
  { name: 'subjectKind', description: 'The kind of record it is about', tag: 'subjectKind', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
34
36
  { name: 'subjectId', description: 'The record it is about', tag: 'subjectId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
35
37
  { name: 'headline', description: 'What is asked, by when', tag: 'headline', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
36
- { name: 'address', description: 'The screen that records it', tag: 'address', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }
38
+ { name: 'address', description: 'The screen that records it', tag: 'address', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
39
+ { name: 'outcome', description: 'What was recorded - attended, completion confirmed, filed', tag: 'outcome', inout: 'out', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }
37
40
  ],
38
41
  standardTime: 7 * 24 * 60 * 60
39
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"legal-todo-activity.js","sourceRoot":"","sources":["../../server/activities/legal-todo-activity.ts"],"names":[],"mappings":";;;AAAA,2EAAiE;AAEjE;;;;GAIG;AACU,QAAA,qBAAqB,GAAG;IACnC;QACE,IAAI,EAAE,+CAAmB;QACzB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE;YACL,kHAAkH;YAClH,4EAA4E;YAC5E,6DAA6D;SAC9D;QACD,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,cAAc;QACxB,QAAQ,EAAE,YAAY;QACtB,YAAY,EAAE,MAAM;QACpB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,OAAO;QACrB,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,iBAAiB;QAC3B,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;QAC7G,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,gCAAgC,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAA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to do one thing the\n * law sets a day for - finish a training, file a change of the research centre - and it shows what and by when, with\n * the way to the record (`compliance-todo`). Recording what was asked closes it; nothing is answered on the to-do.\n */\nexport const LEGAL_TODO_ACTIVITIES = [\n {\n name: LEGAL_TODO_ACTIVITY,\n label: 'legal to-do',\n description: 'A thing the law asks of the company or a person by a day',\n guide: [\n 'the compliance records hand it out - a training not finished this year, a change of the research centre to file.',\n 'it opens the record it is about; recording what was asked there closes it.',\n 'a to-do past its day is reminded as every overdue to-do is.'\n ],\n release: '1.0.0',\n provider: 'hatiolab.com',\n category: 'compliance',\n activityType: 'user',\n priority: 1,\n startingType: 'issue',\n multiple: 'single',\n uiType: 'custom-element',\n uiSource: 'compliance-todo',\n searchKeys: [{ name: 'headline', description: 'What is asked', inputKey: 'headline', tKey: 'field.subject' }],\n viewType: '',\n viewSource: '',\n model: [\n { name: 'subjectKind', description: 'The kind of record it is about', tag: 'subjectKind', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'subjectId', description: 'The record it is about', tag: 'subjectId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'headline', description: 'What is asked, by when', tag: 'headline', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'address', description: 'The screen that records it', tag: 'address', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }\n ],\n standardTime: 7 * 24 * 60 * 60\n }\n]\n"]}
1
+ {"version":3,"file":"legal-todo-activity.js","sourceRoot":"","sources":["../../server/activities/legal-todo-activity.ts"],"names":[],"mappings":";;;AAAA,2EAAiE;AAEjE;;;;GAIG;AACU,QAAA,qBAAqB,GAAG;IACnC;QACE,IAAI,EAAE,+CAAmB;QACzB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,0DAA0D;QACvE,KAAK,EAAE;YACL,kHAAkH;YAClH,4EAA4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G,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAC5L,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,4BAA4B,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9L,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,2DAA2D,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;SAChM;QACD,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;KAC/B;CACF,CAAA","sourcesContent":["import { LEGAL_TODO_ACTIVITY } from './legal-todo-activity-names'\n\n/*\n * 법무 할 일 (ADR-0187 decisions 18, 23 · ADR-0147 decision 9) - not an approval: one person is asked to do one thing the\n * law sets a day for - finish a training, file a change of the research centre - and it shows what and by when, with\n * the way to the record (`compliance-todo`). Recording what was asked closes it; nothing is answered on the to-do.\n */\nexport const LEGAL_TODO_ACTIVITIES = [\n {\n name: LEGAL_TODO_ACTIVITY,\n label: 'legal to-do',\n description: 'A thing the law asks of the company or a person by a day',\n guide: [\n 'the compliance records hand it out - a training not finished this year, a change of the research centre to file.',\n 'it opens the record it is about; recording what was asked there closes it.',\n 'a to-do past its day is reminded as every overdue to-do is.'\n ],\n release: '1.0.0',\n provider: 'hatiolab.com',\n category: 'compliance',\n activityType: 'user',\n priority: 1,\n startingType: 'issue',\n multiple: 'single',\n uiType: 'custom-element',\n uiSource: 'compliance-todo',\n searchKeys: [{ name: 'headline', description: 'What is asked', inputKey: 'headline', tKey: 'field.subject' }],\n /* What was asked and what was done, on the case itself (worklist finished-case.ts). */\n decisionKeys: [{ role: 'headline', inputPath: 'headline', name: 'what is asked, by when' }],\n viewType: '',\n viewSource: '',\n model: [\n { name: 'subjectKind', description: 'The kind of record it is about', tag: 'subjectKind', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'subjectId', description: 'The record it is about', tag: 'subjectId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'headline', description: 'What is asked, by when', tag: 'headline', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'address', description: 'The screen that records it', tag: 'address', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'outcome', description: 'What was recorded - attended, completion confirmed, filed', tag: 'outcome', inout: 'out', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }\n ],\n standardTime: 7 * 24 * 60 * 60\n }\n]\n"]}
@@ -21,5 +21,9 @@ export interface LegalTodo {
21
21
  * 상신함 (2026-11-08).
22
22
  */
23
23
  export declare function issueLegalTodo(tx: EntityManager, domain: any, todo: LegalTodo): Promise<string | null>;
24
- /** Closes the to-do once what it asked is recorded - left alone when it is closed already. */
25
- export declare function closeLegalTodo(tx: EntityManager, domain: any, instanceId: string | null | undefined, by: User, reason?: string): Promise<void>;
24
+ /**
25
+ * Ends the to-do as done once what it asked is recorded, with what was recorded as its outcome - left alone when it is
26
+ * closed already. It was aborted with the outcome as the reason: the work done showed as cancelled, in nobody's 완료,
27
+ * and the finished to-do showed nothing of what was recorded (2026-11-11).
28
+ */
29
+ export declare function closeLegalTodo(tx: EntityManager, domain: any, instanceId: string | null | undefined, by: User, outcome?: string): Promise<void>;
@@ -24,16 +24,20 @@ async function issueLegalTodo(tx, domain, todo) {
24
24
  return null;
25
25
  }
26
26
  const context = contextOf(tx, domain, todo.by ?? todo.assignee);
27
- const input = { subjectKind: todo.subjectKind, subjectId: todo.subjectId, headline: todo.headline, address: todo.address };
27
+ const input = { subjectKind: todo.subjectKind, subjectId: todo.subjectId, headline: todo.headline, address: todo.address, sourceHref: todo.address };
28
28
  const instance = await (0, worklist_1.handOut)({ activityId: activity.id, name: todo.name, description: todo.headline, input, assignee: todo.assignee, dueAt: todo.dueAt ?? undefined }, context);
29
29
  return instance.id;
30
30
  }
31
- /** Closes the to-do once what it asked is recorded - left alone when it is closed already. */
32
- async function closeLegalTodo(tx, domain, instanceId, by, reason = '기록함') {
31
+ /**
32
+ * Ends the to-do as done once what it asked is recorded, with what was recorded as its outcome - left alone when it is
33
+ * closed already. It was aborted with the outcome as the reason: the work done showed as cancelled, in nobody's 완료,
34
+ * and the finished to-do showed nothing of what was recorded (2026-11-11).
35
+ */
36
+ async function closeLegalTodo(tx, domain, instanceId, by, outcome = '기록함') {
33
37
  if (!instanceId)
34
38
  return;
35
39
  const open = await tx.getRepository(worklist_1.ActivityThread).count({ where: { activityInstance: { id: instanceId }, state: (0, typeorm_1.In)(['assigned', 'started', 'unassigned']) } });
36
40
  if (open)
37
- await (0, worklist_1.abort)({ id: instanceId, reason }, contextOf(tx, domain, by));
41
+ await (0, worklist_1.complete)({ id: instanceId, output: { outcome } }, contextOf(tx, domain, by));
38
42
  }
39
43
  //# sourceMappingURL=legal-todo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"legal-todo.js","sourceRoot":"","sources":["../../../server/service/common/legal-todo.ts"],"names":[],"mappings":";;AAyCA,wCAUC;AAGD,wCAIC;AA1DD,qCAA2C;AAG3C,6C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AAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;IACjL,OAAO,QAAQ,CAAC,EAAE,CAAA;AACpB,CAAC;AAED,8FAA8F;AACvF,KAAK,UAAU,cAAc,CAAC,EAAiB,EAAE,MAAW,EAAE,UAAqC,EAAE,EAAQ,EAAE,MAAM,GAAG,KAAK;IAClI,IAAI,CAAC,UAAU;QAAE,OAAM;IACvB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,yBAAc,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAA,YAAE,EAAC,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,EAAS,EAAE,CAAC,CAAA;IACvK,IAAI,IAAI;QAAE,MAAM,IAAA,gBAAK,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAS,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;AACrF,CAAC","sourcesContent":["import { EntityManager, In } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { translatorFor } from '@things-factory/i18n-base/translator'\nimport { abort, Activity, ActivityThread, handOut } from '@things-factory/worklist'\n\nimport { LEGAL_TODO_ACTIVITY } from '../../activities/legal-todo-activity-names'\n\n/*\n * Handing out a legal to-do and closing it (ADR-0187 decisions 18, 23 · ADR-0147 decision 9). The record it is about\n * keeps the instance id; recording what was asked closes it. Reminding one past its day is worklist's (ADR-0186).\n */\n\nexport interface LegalTodo {\n /** The one asked. */\n assignee: User\n /** 「성희롱 예방교육 이수 — 2026」. */\n name: string\n /** 「2026-12-31 까지」 - what the to-do shows. */\n headline: string\n /** The screen that records it - `regulations?tab=trainings`. */\n address: string\n subjectKind: string\n subjectId: string\n dueAt?: Date | null\n /** Who set it off - the manager opening the training year; the one asked when nobody did (an employee's change). */\n by?: User\n}\n\n/** The context worklist works the to-do under - its user is who acts; worklist speaks its refusals through `t`. */\nfunction contextOf(tx: EntityManager, domain: any, user: User) {\n const t = translatorFor(user.locale || 'ko')\n return { state: { domain, user, tx }, t: (key: string, options?: any) => t(key, options) } as any\n}\n\n/**\n * Hands out one to-do; answers its instance id, or nothing where the domain has not installed the to-do. worklist's\n * handOut: the one asked has it in 할 일 and nobody in 상신함 - issued as its own assignee, it went to the person's\n * 상신함 (2026-11-08).\n */\nexport async function issueLegalTodo(tx: EntityManager, domain: any, todo: LegalTodo): Promise<string | null> {\n const activity = await tx.getRepository(Activity).findOne({ where: { domain: { id: domain.id }, name: LEGAL_TODO_ACTIVITY } as any })\n if (!activity) {\n logger.warn(`[Compliance] ${domain.subdomain}: the activity \"${LEGAL_TODO_ACTIVITY}\" is not installed - \"${todo.name}\" not handed out`)\n return null\n }\n const context = contextOf(tx, domain, todo.by ?? todo.assignee)\n const input = { subjectKind: todo.subjectKind, subjectId: todo.subjectId, headline: todo.headline, address: todo.address }\n const instance = await handOut({ activityId: activity.id, name: todo.name, description: todo.headline, input, assignee: todo.assignee, dueAt: todo.dueAt ?? undefined }, context)\n return instance.id\n}\n\n/** Closes the to-do once what it asked is recorded - left alone when it is closed already. */\nexport async function closeLegalTodo(tx: EntityManager, domain: any, instanceId: string | null | undefined, by: User, reason = '기록함'): Promise<void> {\n if (!instanceId) return\n const open = await tx.getRepository(ActivityThread).count({ where: { activityInstance: { id: instanceId }, state: In(['assigned', 'started', 'unassigned']) } as any })\n if (open) await abort({ id: instanceId, reason } as any, contextOf(tx, domain, by))\n}\n"]}
1
+ {"version":3,"file":"legal-todo.js","sour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,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;IACpJ,MAAM,QAAQ,GAAG,MAAM,IAAA,kBAAO,EAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;IACjL,OAAO,QAAQ,CAAC,EAAE,CAAA;AACpB,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,EAAiB,EAAE,MAAW,EAAE,UAAqC,EAAE,EAAQ,EAAE,OAAO,GAAG,KAAK;IACnI,IAAI,CAAC,UAAU;QAAE,OAAM;IACvB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,yBAAc,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAA,YAAE,EAAC,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,EAAS,EAAE,CAAC,CAAA;IACvK,IAAI,IAAI;QAAE,MAAM,IAAA,mBAAQ,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;AAC9F,CAAC","sourcesContent":["import { EntityManager, In } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { logger } from '@things-factory/env'\nimport { translatorFor } from '@things-factory/i18n-base/translator'\nimport { Activity, ActivityThread, complete, handOut } from '@things-factory/worklist'\n\nimport { LEGAL_TODO_ACTIVITY } from '../../activities/legal-todo-activity-names'\n\n/*\n * Handing out a legal to-do and closing it (ADR-0187 decisions 18, 23 · ADR-0147 decision 9). The record it is about\n * keeps the instance id; recording what was asked closes it. Reminding one past its day is worklist's (ADR-0186).\n */\n\nexport interface LegalTodo {\n /** The one asked. */\n assignee: User\n /** 「성희롱 예방교육 이수 — 2026」. */\n name: string\n /** 「2026-12-31 까지」 - what the to-do shows. */\n headline: string\n /** The screen that records it - `regulations?tab=trainings`. */\n address: string\n subjectKind: string\n subjectId: string\n dueAt?: Date | null\n /** Who set it off - the manager opening the training year; the one asked when nobody did (an employee's change). */\n by?: User\n}\n\n/** The context worklist works the to-do under - its user is who acts; worklist speaks its refusals through `t`. */\nfunction contextOf(tx: EntityManager, domain: any, user: User) {\n const t = translatorFor(user.locale || 'ko')\n return { state: { domain, user, tx }, t: (key: string, options?: any) => t(key, options) } as any\n}\n\n/**\n * Hands out one to-do; answers its instance id, or nothing where the domain has not installed the to-do. worklist's\n * handOut: the one asked has it in 할 일 and nobody in 상신함 - issued as its own assignee, it went to the person's\n * 상신함 (2026-11-08).\n */\nexport async function issueLegalTodo(tx: EntityManager, domain: any, todo: LegalTodo): Promise<string | null> {\n const activity = await tx.getRepository(Activity).findOne({ where: { domain: { id: domain.id }, name: LEGAL_TODO_ACTIVITY } as any })\n if (!activity) {\n logger.warn(`[Compliance] ${domain.subdomain}: the activity \"${LEGAL_TODO_ACTIVITY}\" is not installed - \"${todo.name}\" not handed out`)\n return null\n }\n const context = contextOf(tx, domain, todo.by ?? todo.assignee)\n const input = { subjectKind: todo.subjectKind, subjectId: todo.subjectId, headline: todo.headline, address: todo.address, sourceHref: todo.address }\n const instance = await handOut({ activityId: activity.id, name: todo.name, description: todo.headline, input, assignee: todo.assignee, dueAt: todo.dueAt ?? undefined }, context)\n return instance.id\n}\n\n/**\n * Ends the to-do as done once what it asked is recorded, with what was recorded as its outcome - left alone when it is\n * closed already. It was aborted with the outcome as the reason: the work done showed as cancelled, in nobody's 완료,\n * and the finished to-do showed nothing of what was recorded (2026-11-11).\n */\nexport async function closeLegalTodo(tx: EntityManager, domain: any, instanceId: string | null | undefined, by: User, outcome = '기록함'): Promise<void> {\n if (!instanceId) return\n const open = await tx.getRepository(ActivityThread).count({ where: { activityInstance: { id: instanceId }, state: In(['assigned', 'started', 'unassigned']) } as any })\n if (open) await complete({ id: instanceId, output: { outcome } }, contextOf(tx, domain, by))\n}\n"]}