@things-factory/compliance 10.1.267 → 10.1.269
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-client/components/compliance-case-form.d.ts +1 -0
- package/dist-client/components/compliance-case-form.js +3 -2
- package/dist-client/components/compliance-case-form.js.map +1 -1
- package/dist-client/components/compliance-case-sheet.d.ts +1 -0
- package/dist-client/components/compliance-case-sheet.js +3 -2
- package/dist-client/components/compliance-case-sheet.js.map +1 -1
- package/dist-client/components/invention-report-form.d.ts +1 -0
- package/dist-client/components/invention-report-form.js +2 -1
- package/dist-client/components/invention-report-form.js.map +1 -1
- package/dist-client/components/seal-use-form.d.ts +5 -0
- package/dist-client/components/seal-use-form.js +37 -7
- package/dist-client/components/seal-use-form.js.map +1 -1
- package/dist-client/components/training-attendance-form.d.ts +1 -0
- package/dist-client/components/training-attendance-form.js +2 -1
- package/dist-client/components/training-attendance-form.js.map +1 -1
- package/dist-client/components/training-certificate-form.d.ts +1 -0
- package/dist-client/components/training-certificate-form.js +2 -1
- package/dist-client/components/training-certificate-form.js.map +1 -1
- package/dist-client/components/training-session-form.d.ts +1 -0
- package/dist-client/components/training-session-form.js +3 -2
- package/dist-client/components/training-session-form.js.map +1 -1
- package/dist-client/pages/regulation-detail.d.ts +1 -0
- package/dist-client/pages/regulation-detail.js +3 -2
- package/dist-client/pages/regulation-detail.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/activities/regulation-activity.js +4 -2
- package/dist-server/activities/regulation-activity.js.map +1 -1
- package/dist-server/activities/seal-use-activity.js +4 -1
- package/dist-server/activities/seal-use-activity.js.map +1 -1
- package/dist-server/index.js +2 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -0
- package/dist-server/service/index.js +1 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/seal-use/seal-use-mutation.d.ts +2 -1
- package/dist-server/service/seal-use/seal-use-mutation.js +6 -4
- package/dist-server/service/seal-use/seal-use-mutation.js.map +1 -1
- package/dist-server/service/seal-use/seal-use-paper.d.ts +16 -0
- package/dist-server/service/seal-use/seal-use-paper.js +45 -0
- package/dist-server/service/seal-use/seal-use-paper.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-service.d.ts +2 -1
- package/dist-server/service/seal-use/seal-use-service.js +21 -3
- package/dist-server/service/seal-use/seal-use-service.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/translations/en.json +3 -1
- package/translations/es.json +3 -1
- package/translations/ja.json +3 -1
- package/translations/ko.json +3 -1
- package/translations/ms.json +3 -1
- package/translations/zh.json +3 -1
|
@@ -6,7 +6,8 @@ const regulation_service_1 = require("../service/regulation/regulation-service")
|
|
|
6
6
|
const regulation_activity_names_1 = require("./regulation-activity-names");
|
|
7
7
|
const MODEL = [
|
|
8
8
|
{ name: 'versionId', description: 'The version this approval adopts', tag: 'versionId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
|
|
9
|
-
{ name: 'regulation', description: 'The rule', tag: 'regulation', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }
|
|
9
|
+
{ name: 'regulation', description: 'The rule', tag: 'regulation', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
|
|
10
|
+
{ name: 'requester', description: 'Who put the version up', tag: 'requester', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }
|
|
10
11
|
];
|
|
11
12
|
/** 규정 채택 - a version of a company rule adopted, to take effect on its day (ADR-0187 decision 5). */
|
|
12
13
|
exports.REGULATION_ACTIVITIES = [
|
|
@@ -32,7 +33,8 @@ exports.REGULATION_ACTIVITIES = [
|
|
|
32
33
|
searchKeys: [{ name: 'regulation', description: 'The rule', inputKey: 'regulation', tKey: 'field.name' }],
|
|
33
34
|
decisionKeys: [
|
|
34
35
|
{ role: 'headline', inputPath: 'headline', name: 'which rule, which version, from when' },
|
|
35
|
-
|
|
36
|
+
/* Who put it up - the rule's name is in the headline already (2026-11-10). */
|
|
37
|
+
{ role: 'subject', inputPath: 'requester', tKey: 'field.requester', name: 'who put it up' },
|
|
36
38
|
{ role: 'reason', inputPath: 'reason', name: 'what changed and the procedure taken' },
|
|
37
39
|
{ role: 'consequence', inputPath: 'consequence', name: 'what approving does' }
|
|
38
40
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regulation-activity.js","sourceRoot":"","sources":["../../server/activities/regulation-activity.ts"],"names":[],"mappings":";;;AAAA,iDAAsD;AAGtD,iFAAkF;AAClF,2EAAuE;AAEvE,MAAM,KAAK,GAAG;IACZ,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,kCAAkC,EAAE,GAAG,EAAE,WAAW,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;IACxM,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,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;
|
|
1
|
+
{"version":3,"file":"regulation-activity.js","sourceRoot":"","sources":["../../server/activities/regulation-activity.ts"],"names":[],"mappings":";;;AAAA,iDAAsD;AAGtD,iFAAkF;AAClF,2EAAuE;AAEvE,MAAM,KAAK,GAAG;IACZ,EAAE,I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B,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QACzG,YAAY,EAAE;YACZ,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,sCAAsC,EAAE;YACzF,8EAA8E;YAC9E,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE;YAC3F,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,sCAAsC,EAAE;YACrF,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,qBAAqB,EAAE;SAC/E;QACD,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;QAC9B,mFAAmF;QACnF,QAAQ,EAAE,IAAA,sBAAc,EAAC,KAAK,EAAE,QAA0B,EAAE,QAA6C,EAAE,OAAwB,EAAE,EAAE;YACrI,MAAM,IAAA,4CAAuB,EAAC,QAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,IAAI,EAAE,CAAQ,EAAE,OAAO,CAAC,CAAA;QAC5F,CAAC,CAAC;KACH;CACF,CAAA","sourcesContent":["import { speaksRefusals } from '@things-factory/shell'\nimport { ActivityInstance, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'\n\nimport { decideRegulationVersion } from '../service/regulation/regulation-service'\nimport { REGULATION_ADOPT_ACTIVITY } from './regulation-activity-names'\n\nconst MODEL = [\n { name: 'versionId', description: 'The version this approval adopts', tag: 'versionId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'regulation', description: 'The rule', tag: 'regulation', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'requester', description: 'Who put the version up', tag: 'requester', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }\n]\n\n/** 규정 채택 - a version of a company rule adopted, to take effect on its day (ADR-0187 decision 5). */\nexport const REGULATION_ACTIVITIES = [\n {\n name: REGULATION_ADOPT_ACTIVITY,\n label: 'regulation adoption',\n description: 'Approval of adopting a version of a company rule',\n guide: [\n 'a version of a company rule - work rules, an annex, the privacy policy - is adopted to take effect on its day.',\n 'the approver reads its text, what changed of the version before, and the procedure the law asks with its papers.',\n 'approving adopts it; an approval that ends after its effective day leaves it unadopted, to be put up again with a new day.',\n 'with no approver named for this domain the version is adopted as the work door says.'\n ],\n release: '1.0.0',\n provider: 'hatiolab.com',\n category: 'compliance',\n activityType: 'user',\n priority: 1,\n startingType: 'post',\n multiple: 'single',\n viewType: '',\n viewSource: '',\n searchKeys: [{ name: 'regulation', description: 'The rule', inputKey: 'regulation', tKey: 'field.name' }],\n decisionKeys: [\n { role: 'headline', inputPath: 'headline', name: 'which rule, which version, from when' },\n /* Who put it up - the rule's name is in the headline already (2026-11-10). */\n { role: 'subject', inputPath: 'requester', tKey: 'field.requester', name: 'who put it up' },\n { role: 'reason', inputPath: 'reason', name: 'what changed and the procedure taken' },\n { role: 'consequence', inputPath: 'consequence', name: 'what approving does' }\n ],\n model: MODEL,\n standardTime: 3 * 24 * 60 * 60,\n /* Runs inside worklist's mutation, where no resolver's `SpeakRefusals` reaches. */\n callback: speaksRefusals(async (instance: ActivityInstance, addendum: UpdateActivityInstanceStateAddendum, context: ResolverContext) => {\n await decideRegulationVersion(instance as any, (addendum?.causedBy ?? []) as any, context)\n })\n }\n]\n"]}
|
|
@@ -6,7 +6,8 @@ const seal_use_service_1 = require("../service/seal-use/seal-use-service");
|
|
|
6
6
|
const seal_use_activity_names_1 = require("./seal-use-activity-names");
|
|
7
7
|
const MODEL = [
|
|
8
8
|
{ name: 'sealUseId', description: 'The use this approval decides', tag: 'sealUseId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
|
|
9
|
-
{ name: 'requester', description: 'Who asked for it', tag: 'requester', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} }
|
|
9
|
+
{ name: 'requester', description: 'Who asked for it', tag: 'requester', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },
|
|
10
|
+
{ name: 'papers', description: 'The paper to be stamped', tag: 'papers', hidden: true, mandatory: false, inout: 'in', type: 'object', options: {}, unit: null, quantifier: [1], spec: {} }
|
|
10
11
|
];
|
|
11
12
|
/** 인감 사용 - the corporate seal stamped, a seal taken out, or a certificate of the corporate seal issued (ADR-0188). */
|
|
12
13
|
exports.SEAL_USE_ACTIVITIES = [
|
|
@@ -34,6 +35,8 @@ exports.SEAL_USE_ACTIVITIES = [
|
|
|
34
35
|
{ role: 'headline', inputPath: 'headline', name: 'which seal, for what' },
|
|
35
36
|
{ role: 'subject', inputPath: 'requester', tKey: 'field.requester', name: 'who asks' },
|
|
36
37
|
{ role: 'reason', inputPath: 'reason', name: 'what the approver should know' },
|
|
38
|
+
/* The paper to be stamped, opened from the card (2026-11-10). */
|
|
39
|
+
{ role: 'evidence', inputPath: 'papers', tKey: 'field.seal-use-papers', name: 'the paper to be stamped' },
|
|
37
40
|
{ role: 'consequence', inputPath: 'consequence', name: 'what approving does' }
|
|
38
41
|
],
|
|
39
42
|
model: MODEL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal-use-activity.js","sourceRoot":"","sources":["../../server/activities/seal-use-activity.ts"],"names":[],"mappings":";;;AAAA,iDAAsD;AAGtD,2EAAoE;AACpE,uEAA6D;AAE7D,MAAM,KAAK,GAAG;IACZ,EAAE,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E,IAAI,EAAE,+BAA+B,EAAE;YAC9E,iEAAiE;YACjE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,yBAAyB,EAAE;YACzG,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,qBAAqB,EAAE;SAC/E;QACD,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;QAC1B,mFAAmF;QACnF,QAAQ,EAAE,IAAA,sBAAc,EAAC,KAAK,EAAE,QAA0B,EAAE,QAA6C,EAAE,OAAwB,EAAE,EAAE;YACrI,MAAM,IAAA,gCAAa,EAAC,QAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,IAAI,EAAE,CAAQ,EAAE,OAAO,CAAC,CAAA;QAClF,CAAC,CAAC;KACH;CACF,CAAA","sourcesContent":["import { speaksRefusals } from '@things-factory/shell'\nimport { ActivityInstance, UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'\n\nimport { decideSealUse } from '../service/seal-use/seal-use-service'\nimport { SEAL_USE_ACTIVITY } from './seal-use-activity-names'\n\nconst MODEL = [\n { name: 'sealUseId', description: 'The use this approval decides', tag: 'sealUseId', hidden: true, mandatory: true, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'requester', description: 'Who asked for it', tag: 'requester', hidden: true, mandatory: false, inout: 'in', type: 'string', options: {}, unit: null, quantifier: [1], spec: {} },\n { name: 'papers', description: 'The paper to be stamped', tag: 'papers', hidden: true, mandatory: false, inout: 'in', type: 'object', options: {}, unit: null, quantifier: [1], spec: {} }\n]\n\n/** 인감 사용 - the corporate seal stamped, a seal taken out, or a certificate of the corporate seal issued (ADR-0188). */\nexport const SEAL_USE_ACTIVITIES = [\n {\n name: SEAL_USE_ACTIVITY,\n label: 'seal use',\n description: \"Approval of using the company's corporate seal, or of taking a seal out\",\n guide: [\n 'the corporate seal is stamped on a paper, a seal goes out of the office, or a certificate of the corporate seal is issued.',\n 'approving lets it happen; a seal taken out is written back in when it returns.',\n 'a use seal or the official stamp stamped in the office needs no approval - it is written down.',\n 'with no approver named for this domain the use cannot be put up.'\n ],\n release: '1.0.0',\n provider: 'hatiolab.com',\n category: 'compliance',\n activityType: 'user',\n priority: 1,\n startingType: 'post',\n multiple: 'single',\n viewType: '',\n viewSource: '',\n searchKeys: [{ name: 'requester', description: 'Who asked for it', inputKey: 'requester', tKey: 'field.requester' }],\n decisionKeys: [\n { role: 'headline', inputPath: 'headline', name: 'which seal, for what' },\n { role: 'subject', inputPath: 'requester', tKey: 'field.requester', name: 'who asks' },\n { role: 'reason', inputPath: 'reason', name: 'what the approver should know' },\n /* The paper to be stamped, opened from the card (2026-11-10). */\n { role: 'evidence', inputPath: 'papers', tKey: 'field.seal-use-papers', name: 'the paper to be stamped' },\n { role: 'consequence', inputPath: 'consequence', name: 'what approving does' }\n ],\n model: MODEL,\n standardTime: 24 * 60 * 60,\n /* Runs inside worklist's mutation, where no resolver's `SpeakRefusals` reaches. */\n callback: speaksRefusals(async (instance: ActivityInstance, addendum: UpdateActivityInstanceStateAddendum, context: ResolverContext) => {\n await decideSealUse(instance as any, (addendum?.causedBy ?? []) as any, context)\n })\n }\n]\n"]}
|
package/dist-server/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const role_tasks_1 = require("./role-tasks");
|
|
|
13
13
|
const training_register_1 = require("./service/training/training-register");
|
|
14
14
|
const compliance_case_1 = require("./service/compliance-case");
|
|
15
15
|
const attachment_readers_1 = require("./service/legal-record/attachment-readers");
|
|
16
|
+
const seal_use_paper_1 = require("./service/seal-use/seal-use-paper");
|
|
16
17
|
const regulation_read_1 = require("./service/regulation/regulation-read");
|
|
17
18
|
const regulation_service_1 = require("./service/regulation/regulation-service");
|
|
18
19
|
for (const task of role_tasks_1.ROLE_TASKS)
|
|
@@ -23,5 +24,6 @@ for (const task of role_tasks_1.ROLE_TASKS)
|
|
|
23
24
|
(0, training_register_1.registerTrainings)();
|
|
24
25
|
(0, compliance_case_1.registerComplianceCaseFiles)();
|
|
25
26
|
(0, attachment_readers_1.registerLegalRecordFiles)();
|
|
27
|
+
(0, seal_use_paper_1.registerSealUsePapers)();
|
|
26
28
|
require("./work-doors");
|
|
27
29
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;AAAA,oDAAyB;AACzB,uDAA4B;AAC5B,uCAAoD;AAA3C,mHAAA,uBAAuB,OAAA;AAEhC,+DAA0E;AAC1E,yDAA4D;AAE5D,yCAAoD;AACpD,6CAAyC;AACzC,4EAAwE;AACxE,+DAAuE;AACvE,kFAAoF;AACpF,0EAAgF;AAChF,gFAAoF;AAEpF,KAAK,MAAM,IAAI,IAAI,uBAAU;IAAE,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAA;AAErD,IAAA,2CAAyB,GAAE,CAAA;AAC3B,IAAA,kCAAuB,GAAE,CAAA;AACzB,IAAA,0CAA2B,EAAC,EAAE,IAAI,EAAE,+CAA0B,EAAE,WAAW,EAAE,0HAA0H,EAAE,CAAC,CAAA;AAC1M,IAAA,qCAAiB,GAAE,CAAA;AACnB,IAAA,6CAA2B,GAAE,CAAA;AAC7B,IAAA,6CAAwB,GAAE,CAAA;AAC1B,wBAAqB","sourcesContent":["export * from './service'\nexport * from './activities'\nexport { COMPLIANCE_READ_TARGETS } from './ai-reads'\n\nimport { registerAnnouncementTrigger } from '@things-factory/announcement'\nimport { registerRoleTask } from '@things-factory/auth-base'\n\nimport { registerComplianceReads } from './ai-reads'\nimport { ROLE_TASKS } from './role-tasks'\nimport { registerTrainings } from './service/training/training-register'\nimport { registerComplianceCaseFiles } from './service/compliance-case'\nimport { registerLegalRecordFiles } from './service/legal-record/attachment-readers'\nimport { registerRegulationReaders } from './service/regulation/regulation-read'\nimport { REGULATION_ADOPTED_TRIGGER } from './service/regulation/regulation-service'\n\nfor (const task of ROLE_TASKS) registerRoleTask(task)\n\nregisterRegulationReaders()\nregisterComplianceReads()\nregisterAnnouncementTrigger({ name: REGULATION_ADOPTED_TRIGGER, description: 'a version of a company rule adopted - its employees are told and asked to acknowledge they read it (ADR-0187 decision 6)' })\nregisterTrainings()\nregisterComplianceCaseFiles()\nregisterLegalRecordFiles()\nimport './work-doors'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;AAAA,oDAAyB;AACzB,uDAA4B;AAC5B,uCAAoD;AAA3C,mHAAA,uBAAuB,OAAA;AAEhC,+DAA0E;AAC1E,yDAA4D;AAE5D,yCAAoD;AACpD,6CAAyC;AACzC,4EAAwE;AACxE,+DAAuE;AACvE,kFAAoF;AACpF,sEAAyE;AACzE,0EAAgF;AAChF,gFAAoF;AAEpF,KAAK,MAAM,IAAI,IAAI,uBAAU;IAAE,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAA;AAErD,IAAA,2CAAyB,GAAE,CAAA;AAC3B,IAAA,kCAAuB,GAAE,CAAA;AACzB,IAAA,0CAA2B,EAAC,EAAE,IAAI,EAAE,+CAA0B,EAAE,WAAW,EAAE,0HAA0H,EAAE,CAAC,CAAA;AAC1M,IAAA,qCAAiB,GAAE,CAAA;AACnB,IAAA,6CAA2B,GAAE,CAAA;AAC7B,IAAA,6CAAwB,GAAE,CAAA;AAC1B,IAAA,sCAAqB,GAAE,CAAA;AACvB,wBAAqB","sourcesContent":["export * from './service'\nexport * from './activities'\nexport { COMPLIANCE_READ_TARGETS } from './ai-reads'\n\nimport { registerAnnouncementTrigger } from '@things-factory/announcement'\nimport { registerRoleTask } from '@things-factory/auth-base'\n\nimport { registerComplianceReads } from './ai-reads'\nimport { ROLE_TASKS } from './role-tasks'\nimport { registerTrainings } from './service/training/training-register'\nimport { registerComplianceCaseFiles } from './service/compliance-case'\nimport { registerLegalRecordFiles } from './service/legal-record/attachment-readers'\nimport { registerSealUsePapers } from './service/seal-use/seal-use-paper'\nimport { registerRegulationReaders } from './service/regulation/regulation-read'\nimport { REGULATION_ADOPTED_TRIGGER } from './service/regulation/regulation-service'\n\nfor (const task of ROLE_TASKS) registerRoleTask(task)\n\nregisterRegulationReaders()\nregisterComplianceReads()\nregisterAnnouncementTrigger({ name: REGULATION_ADOPTED_TRIGGER, description: 'a version of a company rule adopted - its employees are told and asked to acknowledge they read it (ADR-0187 decision 6)' })\nregisterTrainings()\nregisterComplianceCaseFiles()\nregisterLegalRecordFiles()\nregisterSealUsePapers()\nimport './work-doors'\n"]}
|
|
@@ -2,6 +2,7 @@ export * from './seal-use/seal-use';
|
|
|
2
2
|
export * from './seal-use/seal-use-rules';
|
|
3
3
|
export * from './seal-use/seal-use-type';
|
|
4
4
|
export * from './seal-use/seal-use-service';
|
|
5
|
+
export * from './seal-use/seal-use-paper';
|
|
5
6
|
export * from './regulation/regulation';
|
|
6
7
|
export * from './regulation/regulation-rules';
|
|
7
8
|
export * from './regulation/regulation-type';
|
|
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./seal-use/seal-use"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./seal-use/seal-use-rules"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./seal-use/seal-use-type"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./seal-use/seal-use-service"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./seal-use/seal-use-paper"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./regulation/regulation"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./regulation/regulation-rules"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./regulation/regulation-type"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,8DAAmC;AACnC,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OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AACjF,wEAA4E;AAAnE,8HAAA,wBAAwB,OAAA;AACjC,mEAAwC;AACxC,8DAAmC;AAEnC,mCAAmC;AACnC,yCAAuF;AACvF,6CAA+F;AAC/F,yCAAyF;AACzF,oDAAoE;AACpE,uDAA4G;AAC5G,qDAAyG;AACzG,6DAAkK;AAClK,2CAA4F;AAC5F,uCAAsF;AAEzE,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,mBAAe;IAClB,GAAG,qBAAkB;IACrB,GAAG,mBAAgB;IACnB,GAAG,qBAAkB;IACrB,GAAG,0BAAsB;IACzB,GAAG,yBAAqB;IACxB,GAAG,6BAAyB;IAC5B,GAAG,oBAAiB;IACpB,GAAG,kBAAe;CACnB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,oBAAgB;QACnB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,2BAAuB;QAC1B,GAAG,0BAAsB;QACzB,GAAG,8BAA0B;QAC7B,GAAG,qBAAkB;QACrB,GAAG,mBAAgB;KACpB;CACF,CAAA;AAED,iHAAiH;AACpG,QAAA,WAAW,GAAG,CAAC,GAAG,gCAA4B,CAAC,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './seal-use/seal-use'\nexport * from './seal-use/seal-use-rules'\nexport * from './seal-use/seal-use-type'\nexport * from './seal-use/seal-use-service'\nexport * from './regulation/regulation'\nexport * from './regulation/regulation-rules'\nexport * from './regulation/regulation-type'\nexport { REGULATION_ADOPTED_TRIGGER, REGULATION_HELP_SOURCE, REGULATION_ORIGINAL_REF_TYPE, REGULATION_PROCEDURE_REF_TYPE, regulationsWithoutFiling } from './regulation/regulation-service'\nexport * from './training/training'\nexport * from './training/training-kinds'\nexport * from './training/training-rules'\nexport * from './training/training-type'\nexport * from './training/training-service'\nexport * from './training/training-checks'\nexport { TRAINING_STANDINGS_READ, TRAINING_READ_TARGETS } from './training/training-read'\nexport { registerTrainings } from './training/training-register'\nexport * from './common/correction'\nexport * from './compliance-case/compliance-case'\nexport * from './compliance-case/compliance-case-rules'\nexport * from './compliance-case/compliance-case-type'\nexport * from './compliance-case/compliance-case-service'\nexport { registerComplianceCaseFiles } from './compliance-case'\nexport * from './privacy-record/privacy-record'\nexport * from './privacy-record/privacy-record-rules'\nexport * from './privacy-record/privacy-record-type'\nexport * from './privacy-record/privacy-record-service'\nexport * from './legal-registration/legal-registration'\nexport * from './legal-registration/legal-registration-rules'\nexport * from './legal-registration/legal-registration-type'\nexport { saveLegalRegistrations, saveLegalResearchers, fileCentreChanges, noteCentreEmployeeChange, legalRegistrationsExpiring, legalRegistrationsInRenewalWindow, legalRegistrationFeesDue, legalCentreChangesNotFiled, LEGAL_REGISTRATION_REF_TYPE } from './legal-registration/legal-registration-service'\nexport * from './invention/invention'\nexport * from './invention/invention-rules'\nexport * from './invention/invention-type'\nexport { reportInvention, visibleInvention, updateInventions, saveInventionRewards, inventionDecisionsDue, INVENTION_REF_TYPE } from './invention/invention-service'\nexport * from './dispute/dispute'\nexport * from './dispute/dispute-rules'\nexport * from './dispute/dispute-type'\nexport { saveDisputes, saveDisputeHearings, disputeHearingsSoon, DISPUTE_REF_TYPE } from './dispute/dispute-service'\nexport { registerLegalRecordFiles } from './legal-record/attachment-readers'\nexport * from './common/employee-reader'\nexport * from './common/legal-todo'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as SealUseEntities, resolvers as SealUseResolvers } from './seal-use'\nimport { entities as RegulationEntities, resolvers as RegulationResolvers } from './regulation'\nimport { entities as TrainingEntities, resolvers as TrainingResolvers } from './training'\nimport { entities as CorrectionEntities } from './common/correction'\nimport { entities as ComplianceCaseEntities, resolvers as ComplianceCaseResolvers } from './compliance-case'\nimport { entities as PrivacyRecordEntities, resolvers as PrivacyRecordResolvers } from './privacy-record'\nimport { entities as LegalRegistrationEntities, resolvers as LegalRegistrationResolvers, subscribers as LegalRegistrationSubscribers } from './legal-registration'\nimport { entities as InventionEntities, resolvers as InventionResolvers } from './invention'\nimport { entities as DisputeEntities, resolvers as DisputeResolvers } from './dispute'\n\nexport const entities = [\n /* ENTITIES */\n ...SealUseEntities,\n ...RegulationEntities,\n ...TrainingEntities,\n ...CorrectionEntities,\n ...ComplianceCaseEntities,\n ...PrivacyRecordEntities,\n ...LegalRegistrationEntities,\n ...InventionEntities,\n ...DisputeEntities\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...SealUseResolvers,\n ...RegulationResolvers,\n ...TrainingResolvers,\n ...ComplianceCaseResolvers,\n ...PrivacyRecordResolvers,\n ...LegalRegistrationResolvers,\n ...InventionResolvers,\n ...DisputeResolvers\n ]\n}\n\n/* A research centre's change of staff is caught where organization saves the employee (ADR-0187 decision 23). */\nexport const subscribers = [...LegalRegistrationSubscribers]\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,8DAAmC;AACnC,oEAAyC;AACzC,mEAAwC;AACxC,sEAA2C;AAC3C,oEAAyC;AACzC,kEAAuC;AACvC,wEAA6C;AAC7C,uEAA4C;AAC5C,sEAA2L;AAAlL,gIAAA,0BAA0B,OAAA;AAAE,4HAAA,sBAAsB,OAAA;AAAE,kIAAA,4BAA4B,OAAA;AAAE,mIAAA,6BAA6B,OAAA;AAAE,8HAAA,wBAAwB,OAAA;AAClJ,8DAAmC;AACnC,oEAAyC;AACzC,oEAAyC;AACzC,mEAAwC;AACxC,sEAA2C;AAC3C,qEAA0C;AAC1C,0DAAyF;AAAhF,wHAAA,uBAAuB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AACvD,kEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAC1B,8DAAmC;AACnC,4EAAiD;AACjD,kFAAuD;AACv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AC5B,GAAG,oBAAiB;IACpB,GAAG,kBAAe;CACnB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACtB,GAAG,oBAAgB;QACnB,GAAG,sBAAmB;QACtB,GAAG,oBAAiB;QACpB,GAAG,2BAAuB;QAC1B,GAAG,0BAAsB;QACzB,GAAG,8BAA0B;QAC7B,GAAG,qBAAkB;QACrB,GAAG,mBAAgB;KACpB;CACF,CAAA;AAED,iHAAiH;AACpG,QAAA,WAAW,GAAG,CAAC,GAAG,gCAA4B,CAAC,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './seal-use/seal-use'\nexport * from './seal-use/seal-use-rules'\nexport * from './seal-use/seal-use-type'\nexport * from './seal-use/seal-use-service'\nexport * from './seal-use/seal-use-paper'\nexport * from './regulation/regulation'\nexport * from './regulation/regulation-rules'\nexport * from './regulation/regulation-type'\nexport { REGULATION_ADOPTED_TRIGGER, REGULATION_HELP_SOURCE, REGULATION_ORIGINAL_REF_TYPE, REGULATION_PROCEDURE_REF_TYPE, regulationsWithoutFiling } from './regulation/regulation-service'\nexport * from './training/training'\nexport * from './training/training-kinds'\nexport * from './training/training-rules'\nexport * from './training/training-type'\nexport * from './training/training-service'\nexport * from './training/training-checks'\nexport { TRAINING_STANDINGS_READ, TRAINING_READ_TARGETS } from './training/training-read'\nexport { registerTrainings } from './training/training-register'\nexport * from './common/correction'\nexport * from './compliance-case/compliance-case'\nexport * from './compliance-case/compliance-case-rules'\nexport * from './compliance-case/compliance-case-type'\nexport * from './compliance-case/compliance-case-service'\nexport { registerComplianceCaseFiles } from './compliance-case'\nexport * from './privacy-record/privacy-record'\nexport * from './privacy-record/privacy-record-rules'\nexport * from './privacy-record/privacy-record-type'\nexport * from './privacy-record/privacy-record-service'\nexport * from './legal-registration/legal-registration'\nexport * from './legal-registration/legal-registration-rules'\nexport * from './legal-registration/legal-registration-type'\nexport { saveLegalRegistrations, saveLegalResearchers, fileCentreChanges, noteCentreEmployeeChange, legalRegistrationsExpiring, legalRegistrationsInRenewalWindow, legalRegistrationFeesDue, legalCentreChangesNotFiled, LEGAL_REGISTRATION_REF_TYPE } from './legal-registration/legal-registration-service'\nexport * from './invention/invention'\nexport * from './invention/invention-rules'\nexport * from './invention/invention-type'\nexport { reportInvention, visibleInvention, updateInventions, saveInventionRewards, inventionDecisionsDue, INVENTION_REF_TYPE } from './invention/invention-service'\nexport * from './dispute/dispute'\nexport * from './dispute/dispute-rules'\nexport * from './dispute/dispute-type'\nexport { saveDisputes, saveDisputeHearings, disputeHearingsSoon, DISPUTE_REF_TYPE } from './dispute/dispute-service'\nexport { registerLegalRecordFiles } from './legal-record/attachment-readers'\nexport * from './common/employee-reader'\nexport * from './common/legal-todo'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as SealUseEntities, resolvers as SealUseResolvers } from './seal-use'\nimport { entities as RegulationEntities, resolvers as RegulationResolvers } from './regulation'\nimport { entities as TrainingEntities, resolvers as TrainingResolvers } from './training'\nimport { entities as CorrectionEntities } from './common/correction'\nimport { entities as ComplianceCaseEntities, resolvers as ComplianceCaseResolvers } from './compliance-case'\nimport { entities as PrivacyRecordEntities, resolvers as PrivacyRecordResolvers } from './privacy-record'\nimport { entities as LegalRegistrationEntities, resolvers as LegalRegistrationResolvers, subscribers as LegalRegistrationSubscribers } from './legal-registration'\nimport { entities as InventionEntities, resolvers as InventionResolvers } from './invention'\nimport { entities as DisputeEntities, resolvers as DisputeResolvers } from './dispute'\n\nexport const entities = [\n /* ENTITIES */\n ...SealUseEntities,\n ...RegulationEntities,\n ...TrainingEntities,\n ...CorrectionEntities,\n ...ComplianceCaseEntities,\n ...PrivacyRecordEntities,\n ...LegalRegistrationEntities,\n ...InventionEntities,\n ...DisputeEntities\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n ...SealUseResolvers,\n ...RegulationResolvers,\n ...TrainingResolvers,\n ...ComplianceCaseResolvers,\n ...PrivacyRecordResolvers,\n ...LegalRegistrationResolvers,\n ...InventionResolvers,\n ...DisputeResolvers\n ]\n}\n\n/* A research centre's change of staff is caught where organization saves the employee (ADR-0187 decision 23). */\nexport const subscribers = [...LegalRegistrationSubscribers]\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js';
|
|
1
2
|
import { SealUse } from './seal-use';
|
|
2
3
|
import { NewSealUse, SealUsePatch } from './seal-use-type';
|
|
3
4
|
export declare class SealUseMutation {
|
|
4
|
-
recordSealUse(use: NewSealUse, context: ResolverContext): Promise<SealUse>;
|
|
5
|
+
recordSealUse(use: NewSealUse, files: FileUpload[], context: ResolverContext): Promise<SealUse>;
|
|
5
6
|
withdrawSealUse(id: string, context: ResolverContext): Promise<SealUse>;
|
|
6
7
|
updateMultipleSealUse(patches: SealUsePatch[], context: ResolverContext): Promise<SealUse[]>;
|
|
7
8
|
deleteSealUses(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SealUseMutation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
5
6
|
const type_graphql_1 = require("type-graphql");
|
|
6
7
|
const shell_1 = require("@things-factory/shell");
|
|
7
8
|
const seal_use_1 = require("./seal-use");
|
|
8
9
|
const seal_use_service_1 = require("./seal-use-service");
|
|
9
10
|
const seal_use_type_1 = require("./seal-use-type");
|
|
10
11
|
let SealUseMutation = class SealUseMutation {
|
|
11
|
-
async recordSealUse(use, context) {
|
|
12
|
-
return await (0, seal_use_service_1.recordSealUse)(use, context);
|
|
12
|
+
async recordSealUse(use, files, context) {
|
|
13
|
+
return await (0, seal_use_service_1.recordSealUse)(use, context, files);
|
|
13
14
|
}
|
|
14
15
|
async withdrawSealUse(id, context) {
|
|
15
16
|
return await (0, seal_use_service_1.withdrawSealUse)(id, context);
|
|
@@ -27,9 +28,10 @@ tslib_1.__decorate([
|
|
|
27
28
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
28
29
|
(0, type_graphql_1.Mutation)(returns => seal_use_1.SealUse, { description: 'To write down a use of a seal - put up for approval when it is the corporate seal or a taking out (ADR-0188)' }),
|
|
29
30
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('use', type => seal_use_type_1.NewSealUse)),
|
|
30
|
-
tslib_1.__param(1, (0, type_graphql_1.
|
|
31
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('files', type => [GraphQLUpload_js_1.default], { nullable: true, description: 'The paper to be stamped - a copy the approver opens' })),
|
|
32
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
31
33
|
tslib_1.__metadata("design:type", Function),
|
|
32
|
-
tslib_1.__metadata("design:paramtypes", [seal_use_type_1.NewSealUse, Object]),
|
|
34
|
+
tslib_1.__metadata("design:paramtypes", [seal_use_type_1.NewSealUse, Array, Object]),
|
|
33
35
|
tslib_1.__metadata("design:returntype", Promise)
|
|
34
36
|
], SealUseMutation.prototype, "recordSealUse", null);
|
|
35
37
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal-use-mutation.js","sourceRoot":"","sources":["../../../server/service/seal-use/seal-use-mutation.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"seal-use-mutation.js","sourceRoot":"","sources":["../../../server/service/seal-use/seal-use-mutation.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAqF;AAErF,iDAAqD;AAErD,yCAAoC;AACpC,yDAAmG;AACnG,mDAA0D;AAInD,IAAM,eAAe,GAArB,MAAM,eAAe;IAIpB,AAAN,KAAK,CAAC,aAAa,CACe,GAAe,EACgF,KAAmB,EAC3I,OAAwB;QAE/B,OAAO,MAAM,IAAA,gCAAa,EAAC,GAAG,EAAE,O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Ac,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sDAElD;AAKK;IAHL,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,kBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IACvE,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAY,CAAC,CAAC,CAAA;IAA2B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4DAElG;AAKK;IAHL,IAAA,wBAAS,EAAC,mFAAmF,CAAC;IAC9F,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAC1D,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;qDAEvE;0BA/BU,eAAe;IAF3B,IAAA,uBAAQ,EAAC,kBAAO,CAAC;IACjB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,eAAe,CAgC3B","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { Arg, Ctx, Directive, Mutation, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { SpeakRefusals } from '@things-factory/shell'\n\nimport { SealUse } from './seal-use'\nimport { deleteSealUses, recordSealUse, updateSealUses, withdrawSealUse } from './seal-use-service'\nimport { NewSealUse, SealUsePatch } from './seal-use-type'\n\n@Resolver(SealUse)\n@UseMiddleware(SpeakRefusals)\nexport class SealUseMutation {\n @Directive('@privilege(category: \"seal-use\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => SealUse, { description: 'To write down a use of a seal - put up for approval when it is the corporate seal or a taking out (ADR-0188)' })\n async recordSealUse(\n @Arg('use', type => NewSealUse) use: NewSealUse,\n @Arg('files', type => [GraphQLUpload], { nullable: true, description: 'The paper to be stamped - a copy the approver opens' }) files: FileUpload[],\n @Ctx() context: ResolverContext\n ): Promise<SealUse> {\n return await recordSealUse(use, context, files)\n }\n\n @Directive('@privilege(category: \"seal-use\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => SealUse, { description: 'To take back a use waiting on approval - only the one who put it up' })\n async withdrawSealUse(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<SealUse> {\n return await withdrawSealUse(id, context)\n }\n\n @Directive('@privilege(category: \"seal-use\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [SealUse], { description: 'To write the day a seal came back, and the notes' })\n async updateMultipleSealUse(@Arg('patches', type => [SealUsePatch]) patches: SealUsePatch[], @Ctx() context: ResolverContext): Promise<SealUse[]> {\n return await updateSealUses(patches, context)\n }\n\n @Directive('@privilege(category: \"seal-use\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete uses nobody approved' })\n async deleteSealUses(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n return await deleteSealUses(ids, context)\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The papers of a use are attached under this kind, by the use's id. */
|
|
2
|
+
export declare const SEAL_USE_REF_TYPE = "SealUse";
|
|
3
|
+
/** What the rule asks of the world - passed in so it is tested without a database. */
|
|
4
|
+
export interface SealUsePaperFacts {
|
|
5
|
+
useOf(id: string, domainId: string): Promise<{
|
|
6
|
+
creatorId?: string;
|
|
7
|
+
activityInstanceId?: string;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
readsEveryUse(context: any): Promise<boolean>;
|
|
10
|
+
takesPart(activityInstanceId: string, context: any): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
export declare function mayReadSealUsePaper(attachment: {
|
|
13
|
+
refBy?: string;
|
|
14
|
+
}, context: any, facts: SealUsePaperFacts): Promise<boolean>;
|
|
15
|
+
export declare const SEAL_USE_PAPER_FACTS: SealUsePaperFacts;
|
|
16
|
+
export declare function registerSealUsePapers(): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEAL_USE_PAPER_FACTS = exports.SEAL_USE_REF_TYPE = void 0;
|
|
4
|
+
exports.mayReadSealUsePaper = mayReadSealUsePaper;
|
|
5
|
+
exports.registerSealUsePapers = registerSealUsePapers;
|
|
6
|
+
/*
|
|
7
|
+
* Who may open the paper of a seal use by its path (2026-11-10) - the document to be stamped, attached when the use is
|
|
8
|
+
* written: whoever wrote it down, the seal's keepers (`seal-use` query), and whoever decides it in the worklist.
|
|
9
|
+
* attachment-base has already checked the file is of the request's domain.
|
|
10
|
+
*/
|
|
11
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
12
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
13
|
+
const shell_1 = require("@things-factory/shell");
|
|
14
|
+
const worklist_1 = require("@things-factory/worklist");
|
|
15
|
+
const seal_use_1 = require("./seal-use");
|
|
16
|
+
/** The papers of a use are attached under this kind, by the use's id. */
|
|
17
|
+
exports.SEAL_USE_REF_TYPE = 'SealUse';
|
|
18
|
+
async function mayReadSealUsePaper(attachment, context, facts) {
|
|
19
|
+
const { domain, user } = context?.state ?? {};
|
|
20
|
+
if (!domain || !user || !attachment.refBy)
|
|
21
|
+
return false;
|
|
22
|
+
const use = await facts.useOf(attachment.refBy, domain.id);
|
|
23
|
+
if (!use)
|
|
24
|
+
return false;
|
|
25
|
+
if (use.creatorId === user.id)
|
|
26
|
+
return true;
|
|
27
|
+
if (await facts.readsEveryUse(context))
|
|
28
|
+
return true;
|
|
29
|
+
return !!use.activityInstanceId && (await facts.takesPart(use.activityInstanceId, context));
|
|
30
|
+
}
|
|
31
|
+
exports.SEAL_USE_PAPER_FACTS = {
|
|
32
|
+
async useOf(id, domainId) {
|
|
33
|
+
const use = await (0, shell_1.getRepository)(seal_use_1.SealUse).findOne({ where: { id, domain: { id: domainId } } });
|
|
34
|
+
return use ? { creatorId: use.creatorId, activityInstanceId: use.activityInstanceId ?? undefined } : undefined;
|
|
35
|
+
},
|
|
36
|
+
readsEveryUse: context => (0, auth_base_1.requestHolds)(context, 'seal-use', 'query'),
|
|
37
|
+
async takesPart(activityInstanceId, context) {
|
|
38
|
+
const instance = await (0, shell_1.getRepository)(worklist_1.ActivityInstance).findOne({ where: { id: activityInstanceId, domain: { id: context.state.domain.id } } });
|
|
39
|
+
return !!instance && (await (0, worklist_1.mayReadInstance)(instance, context));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function registerSealUsePapers() {
|
|
43
|
+
(0, attachment_base_1.registerAttachmentReader)(exports.SEAL_USE_REF_TYPE, (attachment, context) => mayReadSealUsePaper(attachment, context, exports.SEAL_USE_PAPER_FACTS));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=seal-use-paper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seal-use-paper.js","sourceRoot":"","sources":["../../../server/service/seal-use/seal-use-paper.ts"],"names":[],"mappings":";;;AAsBA,kDAQC;AAcD,sDAEC;AA9CD;;;;GAIG;AACH,qEAA0E;AAC1E,yDAAwD;AACxD,iDAAqD;AACrD,uDAA4E;AAE5E,yCAAoC;AAEpC,yEAAyE;AAC5D,QAAA,iBAAiB,GAAG,SAAS,CAAA;AASnC,KAAK,UAAU,mBAAmB,CAAC,UAA8B,EAAE,OAAY,EAAE,KAAwB;IAC9G,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,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,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,CAAC,CAAA;QACrJ,OAAO,CAAC,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAA,0BAAe,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,SAAgB,qBAAqB;IACnC,IAAA,0CAAwB,EAAC,yBAAiB,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,4BAAoB,CAAC,CAAC,CAAA;AACtI,CAAC","sourcesContent":["/*\n * Who may open the paper of a seal use by its path (2026-11-10) - the document to be stamped, attached when the use is\n * written: whoever wrote it down, the seal's keepers (`seal-use` query), and whoever decides it in the worklist.\n * attachment-base has already checked the file is of the request's domain.\n */\nimport { registerAttachmentReader } from '@things-factory/attachment-base'\nimport { requestHolds } from '@things-factory/auth-base'\nimport { getRepository } from '@things-factory/shell'\nimport { ActivityInstance, mayReadInstance } from '@things-factory/worklist'\n\nimport { SealUse } from './seal-use'\n\n/** The papers of a use are attached under this kind, by the use's id. */\nexport const SEAL_USE_REF_TYPE = 'SealUse'\n\n/** What the rule asks of the world - passed in so it is tested without a database. */\nexport interface SealUsePaperFacts {\n useOf(id: string, domainId: string): Promise<{ creatorId?: string; activityInstanceId?: string } | undefined>\n readsEveryUse(context: any): Promise<boolean>\n takesPart(activityInstanceId: string, context: any): Promise<boolean>\n}\n\nexport async function mayReadSealUsePaper(attachment: { refBy?: string }, context: any, facts: SealUsePaperFacts): Promise<boolean> {\n const { domain, user } = context?.state ?? {}\n if (!domain || !user || !attachment.refBy) return false\n const use = await facts.useOf(attachment.refBy, domain.id)\n if (!use) return false\n if (use.creatorId === user.id) return true\n if (await facts.readsEveryUse(context)) return true\n return !!use.activityInstanceId && (await facts.takesPart(use.activityInstanceId, context))\n}\n\nexport const SEAL_USE_PAPER_FACTS: SealUsePaperFacts = {\n async useOf(id, domainId) {\n const use = await getRepository(SealUse).findOne({ where: { id, domain: { id: domainId } } as any })\n return use ? { creatorId: use.creatorId, activityInstanceId: use.activityInstanceId ?? undefined } : undefined\n },\n readsEveryUse: context => requestHolds(context, 'seal-use', 'query'),\n async takesPart(activityInstanceId, context) {\n const instance = await getRepository(ActivityInstance).findOne({ where: { id: activityInstanceId, domain: { id: context.state.domain.id } } as any })\n return !!instance && (await mayReadInstance(instance, context))\n }\n}\n\nexport function registerSealUsePapers(): void {\n registerAttachmentReader(SEAL_USE_REF_TYPE, (attachment, context) => mayReadSealUsePaper(attachment, context, SEAL_USE_PAPER_FACTS))\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js';
|
|
1
2
|
import { SealUse } from './seal-use';
|
|
2
3
|
import { NewSealUse, SealUsePatch } from './seal-use-type';
|
|
3
|
-
export declare function recordSealUse(input: NewSealUse, context: ResolverContext): Promise<SealUse>;
|
|
4
|
+
export declare function recordSealUse(input: NewSealUse, context: ResolverContext, files?: FileUpload[]): Promise<SealUse>;
|
|
4
5
|
/** Take a use waiting on approval back - only the one who put it up. */
|
|
5
6
|
export declare function withdrawSealUse(id: string, context: ResolverContext): Promise<SealUse>;
|
|
6
7
|
/** The day it came back and the notes - nothing the approvers saw. */
|
|
@@ -5,6 +5,7 @@ exports.withdrawSealUse = withdrawSealUse;
|
|
|
5
5
|
exports.updateSealUses = updateSealUses;
|
|
6
6
|
exports.deleteSealUses = deleteSealUses;
|
|
7
7
|
exports.decideSealUse = decideSealUse;
|
|
8
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
8
9
|
const worklist_1 = require("@things-factory/worklist");
|
|
9
10
|
const accounting_1 = require("@things-factory/accounting");
|
|
10
11
|
const biz_base_1 = require("@things-factory/biz-base");
|
|
@@ -12,6 +13,7 @@ const organization_1 = require("@things-factory/organization");
|
|
|
12
13
|
const shell_1 = require("@things-factory/shell");
|
|
13
14
|
const seal_use_activity_names_1 = require("../../activities/seal-use-activity-names");
|
|
14
15
|
const seal_use_1 = require("./seal-use");
|
|
16
|
+
const seal_use_paper_1 = require("./seal-use-paper");
|
|
15
17
|
const seal_use_rules_1 = require("./seal-use-rules");
|
|
16
18
|
/*
|
|
17
19
|
* Writing down a use of a seal (ADR-0188 decision 2), and what an approval does to it. The one way a use is written: a
|
|
@@ -19,7 +21,7 @@ const seal_use_rules_1 = require("./seal-use-rules");
|
|
|
19
21
|
*/
|
|
20
22
|
const KIND_WORDS = { STAMP: '날인', TAKE_OUT: '반출', CERTIFICATE: '인감증명서 발급' };
|
|
21
23
|
const text = (value) => (typeof value === 'string' && value.trim() ? value.trim() : null);
|
|
22
|
-
async function recordSealUse(input, context) {
|
|
24
|
+
async function recordSealUse(input, context, files) {
|
|
23
25
|
const { domain, user, tx } = context.state;
|
|
24
26
|
const seal = await (0, biz_base_1.companySealOf)(domain, input.sealId, tx);
|
|
25
27
|
const refusal = (0, seal_use_rules_1.sealUseRefusal)(input, seal);
|
|
@@ -47,8 +49,11 @@ async function recordSealUse(input, context) {
|
|
|
47
49
|
creator: user,
|
|
48
50
|
updater: user
|
|
49
51
|
});
|
|
50
|
-
if (!(0, seal_use_rules_1.needsApproval)(input.kind, seal.kind))
|
|
51
|
-
|
|
52
|
+
if (!(0, seal_use_rules_1.needsApproval)(input.kind, seal.kind)) {
|
|
53
|
+
const recorded = await repository.save(row);
|
|
54
|
+
await attachPapers(recorded.id, files, context);
|
|
55
|
+
return recorded;
|
|
56
|
+
}
|
|
52
57
|
const carrier = await (0, worklist_1.activityNamed)(seal_use_activity_names_1.SEAL_USE_ACTIVITY, context);
|
|
53
58
|
if (!carrier)
|
|
54
59
|
throw new shell_1.Refusal('seal-use-approval-not-installed', { form: seal_use_activity_names_1.SEAL_USE_ACTIVITY }, `the approval '${seal_use_activity_names_1.SEAL_USE_ACTIVITY}' is not installed in this domain`);
|
|
@@ -57,6 +62,8 @@ async function recordSealUse(input, context) {
|
|
|
57
62
|
throw (0, worklist_1.approvalLineRefusal)(line.refusal);
|
|
58
63
|
row.status = seal_use_1.SealUseStatus.SUBMITTED;
|
|
59
64
|
const saved = await repository.save(row);
|
|
65
|
+
/* The paper to be stamped goes up with the use - the approver opens it from the card (2026-11-10). */
|
|
66
|
+
const papers = await attachPapers(saved.id, files, context);
|
|
60
67
|
const what = `${seal.name} ${KIND_WORDS[input.kind]}`;
|
|
61
68
|
const who = requester?.name ?? user.name ?? '';
|
|
62
69
|
const instance = await (0, worklist_1.issue)({
|
|
@@ -73,8 +80,10 @@ async function recordSealUse(input, context) {
|
|
|
73
80
|
...(saved.submittedTo ? [`제출처: ${saved.submittedTo}`] : []),
|
|
74
81
|
...(saved.returnDueOn ? [`반납 예정일: ${saved.returnDueOn}`] : []),
|
|
75
82
|
...(saved.copies ? [`통수: ${saved.copies}`] : []),
|
|
83
|
+
...(saved.notes ? [`메모: ${saved.notes}`] : []),
|
|
76
84
|
...(seal.custodianId ? [] : ['보관자가 정해지지 않은 인감입니다'])
|
|
77
85
|
],
|
|
86
|
+
papers: papers.map(one => ({ __typename: 'Attachment', id: one.id, name: one.name, fullpath: one.fullpath })),
|
|
78
87
|
consequence: input.kind === seal_use_1.SealUseKind.TAKE_OUT ? `승인하면 ${seal.name}을(를) ${saved.returnDueOn}까지 내보냅니다` : `승인하면 ${seal.name}을(를) ${input.kind === seal_use_1.SealUseKind.CERTIFICATE ? '인감증명서 발급에' : '이 서류에'} 씁니다`
|
|
79
88
|
},
|
|
80
89
|
threadsMin: 1,
|
|
@@ -84,6 +93,15 @@ async function recordSealUse(input, context) {
|
|
|
84
93
|
saved.activityInstanceId = instance.id;
|
|
85
94
|
return await repository.save(saved);
|
|
86
95
|
}
|
|
96
|
+
/** Attaches the papers of a use - the document to be stamped - and reads back every paper it has. */
|
|
97
|
+
async function attachPapers(id, files, context) {
|
|
98
|
+
const { domain, tx } = context.state;
|
|
99
|
+
for (const file of files ?? [])
|
|
100
|
+
await (0, attachment_base_1.createAttachment)(null, { attachment: { file, refType: seal_use_paper_1.SEAL_USE_REF_TYPE, refBy: id } }, context);
|
|
101
|
+
if (!files?.length)
|
|
102
|
+
return [];
|
|
103
|
+
return await tx.getRepository(attachment_base_1.Attachment).find({ where: { domain: { id: domain.id }, refType: seal_use_paper_1.SEAL_USE_REF_TYPE, refBy: id }, order: { createdAt: 'ASC' } });
|
|
104
|
+
}
|
|
87
105
|
/** Take a use waiting on approval back - only the one who put it up. */
|
|
88
106
|
async function withdrawSealUse(id, context) {
|
|
89
107
|
const { domain, user, tx } = context.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seal-use-service.js","sourceRoot":"","sources":["../../../server/service/seal-use/seal-use-service.ts"],"names":[],"mappings":";;AAoBA,sCAmEC;AAGD,0CAWC;AAGD,wCAoBC;AAGD,wCAUC;AAMD,sCAmBC;AAlKD,uDAAiH;AACjH,2DAAuD;AACvD,uDAAwD;AACxD,+DAAuD;AACvD,iDAA+C;AAE/C,sFAA4E;AAC5E,yCAAgE;AAChE,qDAAyG;AAGzG;;;GAGG;AAEH,MAAM,UAAU,GAA2B,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAA;AAEnG,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAE3F,KAAK,UAAU,aAAa,CAAC,KAAiB,EAAE,OAAwB;IAC7E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC1C,MA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,EAAE,CAAC,CAAC,EACnD,EAAE,MAAM,EAAE,GAAG,CAAC,MAAa,EAAE,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAC1E,CAAA;IACD,IAAI,CAAC,QAAQ;QAAE,OAAM;IACrB,GAAG,CAAC,MAAM,GAAG,wBAAa,CAAC,QAAQ,CAAC,CAAA;IACpC,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;QAC1B,GAAG,CAAC,SAAS,GAAG,IAAI,CAAA;IACtB,CAAC;IACD,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["import { abort, activityNamed, approvalLineRefusal, approvalLineStanding, issue } from '@things-factory/worklist'\nimport { decisionOf } from '@things-factory/accounting'\nimport { companySealOf } from '@things-factory/biz-base'\nimport { Employee } from '@things-factory/organization'\nimport { Refusal } from '@things-factory/shell'\n\nimport { SEAL_USE_ACTIVITY } from '../../activities/seal-use-activity-names'\nimport { SealUse, SealUseKind, SealUseStatus } from './seal-use'\nimport { AFTER_WRITTEN, deletable, needsApproval, sealUseRefusal, usableUntilOf } from './seal-use-rules'\nimport { NewSealUse, SealUsePatch } from './seal-use-type'\n\n/*\n * Writing down a use of a seal (ADR-0188 decision 2), and what an approval does to it. The one way a use is written: a\n * use that needs approval is put up in the same transaction, so none is written that its approvers did not see.\n */\n\nconst KIND_WORDS: Record<string, string> = { STAMP: '날인', TAKE_OUT: '반출', CERTIFICATE: '인감증명서 발급' }\n\nconst text = (value: unknown) => (typeof value === 'string' && value.trim() ? value.trim() : null)\n\nexport async function recordSealUse(input: NewSealUse, context: ResolverContext): Promise<SealUse> {\n const { domain, user, tx } = context.state\n const seal = await companySealOf(domain, input.sealId, tx)\n const refusal = sealUseRefusal(input, seal)\n if (refusal) throw refusal\n\n const requester = input.requesterId ? await tx.getRepository(Employee).findOne({ where: { id: input.requesterId, domain: { id: domain.id } } as any }) : null\n if (input.requesterId && !requester) throw new Refusal('seal-use-requester-unknown', {}, 'the one who asked must be an employee of this domain')\n\n const certificate = input.kind === SealUseKind.CERTIFICATE\n const repository = tx.getRepository(SealUse)\n const row = repository.create({\n domain,\n kind: input.kind,\n seal,\n requester,\n usedOn: input.usedOn,\n document: text(input.document),\n purpose: text(input.purpose),\n submittedTo: text(input.submittedTo),\n returnDueOn: input.kind === SealUseKind.TAKE_OUT ? input.returnDueOn : null,\n copies: certificate ? input.copies : null,\n usableUntil: certificate ? text(input.usableUntil) ?? usableUntilOf(input.usedOn) : null,\n notes: text(input.notes),\n status: SealUseStatus.RECORDED,\n creator: user,\n updater: user\n } as any) as unknown as SealUse\n\n if (!needsApproval(input.kind, seal!.kind)) return await repository.save(row)\n\n const carrier = await activityNamed(SEAL_USE_ACTIVITY, context)\n if (!carrier) throw new Refusal('seal-use-approval-not-installed', { form: SEAL_USE_ACTIVITY }, `the approval '${SEAL_USE_ACTIVITY}' is not installed in this domain`)\n const line = await approvalLineStanding(carrier, context)\n if (line.refusal) throw approvalLineRefusal(line.refusal)\n\n row.status = SealUseStatus.SUBMITTED\n const saved = await repository.save(row)\n const what = `${seal!.name} ${KIND_WORDS[input.kind]}`\n const who = requester?.name ?? user.name ?? ''\n const instance = await issue(\n {\n name: `${what} ${saved.document ?? saved.purpose ?? ''}`.trim(),\n description: [saved.purpose, saved.submittedTo].filter(Boolean).join(' · '),\n activityId: carrier.id,\n approvalLine: carrier.approvalLine,\n input: {\n sealUseId: saved.id,\n requester: who,\n headline: `${what} · ${saved.usedOn}${saved.document ? ` · ${saved.document}` : ''}`,\n reason: [\n `목적: ${saved.purpose ?? ''}`,\n ...(saved.submittedTo ? [`제출처: ${saved.submittedTo}`] : []),\n ...(saved.returnDueOn ? [`반납 예정일: ${saved.returnDueOn}`] : []),\n ...(saved.copies ? [`통수: ${saved.copies}`] : []),\n ...(seal!.custodianId ? [] : ['보관자가 정해지지 않은 인감입니다'])\n ],\n consequence: input.kind === SealUseKind.TAKE_OUT ? `승인하면 ${seal!.name}을(를) ${saved.returnDueOn}까지 내보냅니다` : `승인하면 ${seal!.name}을(를) ${input.kind === SealUseKind.CERTIFICATE ? '인감증명서 발급에' : '이 서류에'} 씁니다`\n },\n threadsMin: 1,\n threadsMax: 1,\n requireApproval: true\n } as any,\n context\n )\n saved.activityInstanceId = instance.id\n return await repository.save(saved)\n}\n\n/** Take a use waiting on approval back - only the one who put it up. */\nexport async function withdrawSealUse(id: string, context: ResolverContext): Promise<SealUse> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(SealUse)\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) throw new Refusal('seal-use-not-found', {}, 'the record was not found. reload and try again.')\n if (row.creatorId !== user.id) throw new Refusal('seal-use-not-yours', {}, 'only the one who put it up can take it back')\n if (row.status !== SealUseStatus.SUBMITTED) throw new Refusal('seal-use-not-submitted', {}, 'only a use waiting on approval can be taken back')\n if (row.activityInstanceId) await abort({ id: row.activityInstanceId, reason: '올린 사람이 회수함' } as any, context)\n row.status = SealUseStatus.WITHDRAWN\n row.updater = user\n return await repository.save(row)\n}\n\n/** The day it came back and the notes - nothing the approvers saw. */\nexport async function updateSealUses(patches: SealUsePatch[], context: ResolverContext): Promise<SealUse[]> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(SealUse)\n const saved: SealUse[] = []\n for (const patch of patches) {\n const row = await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } as any })\n if (!row) throw new Refusal('seal-use-not-found', {}, 'the record was not found. reload and try again.')\n const changed = Object.keys(patch).filter(field => !['id', 'cuFlag'].includes(field) && (patch as any)[field] !== undefined)\n if (changed.some(field => !(AFTER_WRITTEN as readonly string[]).includes(field))) throw new Refusal('seal-use-written', {}, 'what was written stays - only the day it came back and the notes change')\n if (patch.returnedOn !== undefined) {\n const day = text(patch.returnedOn)\n if (day && (row.kind !== SealUseKind.TAKE_OUT || row.status !== SealUseStatus.APPROVED)) throw new Refusal('seal-use-not-out', {}, 'only a seal let out comes back')\n if (day && (!/^\\d{4}-\\d{2}-\\d{2}$/.test(day) || day < row.usedOn)) throw new Refusal('seal-use-returned-invalid', {}, 'it comes back on or after the day it went out, YYYY-MM-DD')\n row.returnedOn = day\n }\n if (patch.notes !== undefined) row.notes = text(patch.notes)\n row.updater = user\n saved.push(await repository.save(row))\n }\n return saved\n}\n\n/** Delete uses nobody approved. */\nexport async function deleteSealUses(ids: string[], context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n const repository = tx.getRepository(SealUse)\n for (const id of ids) {\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) continue\n if (!deletable(row.status)) throw new Refusal('seal-use-not-deletable', {}, 'a use that went through approval is kept - one waiting is taken back instead')\n await repository.delete(row.id)\n }\n return true\n}\n\n/**\n * What an approver's decision does to the use - worklist calls it on every state change of the instance, more than once\n * for one; a decision lands only on the use still waiting on that very instance.\n */\nexport async function decideSealUse(instance: { id: string; state: any; input?: any }, causedBy: readonly { state?: any }[], context: ResolverContext) {\n const { domain, user, tx } = context.state\n const id = instance.input?.sealUseId\n if (!id) return\n const repository = tx.getRepository(SealUse)\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) return\n const decision = decisionOf(\n { id: instance.id, state: String(instance.state) },\n causedBy.map(one => ({ state: String(one.state) })),\n { status: row.status as any, activityInstanceId: row.activityInstanceId }\n )\n if (!decision) return\n row.status = SealUseStatus[decision]\n if (decision !== 'WITHDRAWN') {\n row.decidedAt = new Date()\n row.decidedBy = user\n }\n await repository.save(row)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"seal-use-service.js","sourceRoot":"","sources":["../../../server/service/seal-use/seal-use-service.ts"],"names":[],"mappings":";;AAyBA,sCA2EC;AAWD,0CAWC;AAGD,wCAoBC;AAGD,wCAUC;AAMD,sCAmBC;AApLD,qEAA8E;AAC9E,uDAAiH;AACjH,2DAAuD;AACvD,uDAAw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,GAAG,OAAO,CAAC,KAAK,CAAA;IAC1C,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACpC,IAAI,CAAC,EAAE;QAAE,OAAM;IACf,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,kBAAO,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,CAAC,CAAA;IACzF,IAAI,CAAC,GAAG;QAAE,OAAM;IAChB,MAAM,QAAQ,GAAG,IAAA,uBAAU,EACzB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAClD,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EACnD,EAAE,MAAM,EAAE,GAAG,CAAC,MAAa,EAAE,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAC1E,CAAA;IACD,IAAI,CAAC,QAAQ;QAAE,OAAM;IACrB,GAAG,CAAC,MAAM,GAAG,wBAAa,CAAC,QAAQ,CAAC,CAAA;IACpC,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAA;QAC1B,GAAG,CAAC,SAAS,GAAG,IAAI,CAAA;IACtB,CAAC;IACD,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport type { EntityManager } from 'typeorm'\n\nimport { Attachment, createAttachment } from '@things-factory/attachment-base'\nimport { abort, activityNamed, approvalLineRefusal, approvalLineStanding, issue } from '@things-factory/worklist'\nimport { decisionOf } from '@things-factory/accounting'\nimport { companySealOf } from '@things-factory/biz-base'\nimport { Employee } from '@things-factory/organization'\nimport { Refusal } from '@things-factory/shell'\n\nimport { SEAL_USE_ACTIVITY } from '../../activities/seal-use-activity-names'\nimport { SealUse, SealUseKind, SealUseStatus } from './seal-use'\nimport { SEAL_USE_REF_TYPE } from './seal-use-paper'\nimport { AFTER_WRITTEN, deletable, needsApproval, sealUseRefusal, usableUntilOf } from './seal-use-rules'\nimport { NewSealUse, SealUsePatch } from './seal-use-type'\n\n/*\n * Writing down a use of a seal (ADR-0188 decision 2), and what an approval does to it. The one way a use is written: a\n * use that needs approval is put up in the same transaction, so none is written that its approvers did not see.\n */\n\nconst KIND_WORDS: Record<string, string> = { STAMP: '날인', TAKE_OUT: '반출', CERTIFICATE: '인감증명서 발급' }\n\nconst text = (value: unknown) => (typeof value === 'string' && value.trim() ? value.trim() : null)\n\nexport async function recordSealUse(input: NewSealUse, context: ResolverContext, files?: FileUpload[]): Promise<SealUse> {\n const { domain, user, tx } = context.state\n const seal = await companySealOf(domain, input.sealId, tx)\n const refusal = sealUseRefusal(input, seal)\n if (refusal) throw refusal\n\n const requester = input.requesterId ? await tx.getRepository(Employee).findOne({ where: { id: input.requesterId, domain: { id: domain.id } } as any }) : null\n if (input.requesterId && !requester) throw new Refusal('seal-use-requester-unknown', {}, 'the one who asked must be an employee of this domain')\n\n const certificate = input.kind === SealUseKind.CERTIFICATE\n const repository = tx.getRepository(SealUse)\n const row = repository.create({\n domain,\n kind: input.kind,\n seal,\n requester,\n usedOn: input.usedOn,\n document: text(input.document),\n purpose: text(input.purpose),\n submittedTo: text(input.submittedTo),\n returnDueOn: input.kind === SealUseKind.TAKE_OUT ? input.returnDueOn : null,\n copies: certificate ? input.copies : null,\n usableUntil: certificate ? text(input.usableUntil) ?? usableUntilOf(input.usedOn) : null,\n notes: text(input.notes),\n status: SealUseStatus.RECORDED,\n creator: user,\n updater: user\n } as any) as unknown as SealUse\n\n if (!needsApproval(input.kind, seal!.kind)) {\n const recorded = await repository.save(row)\n await attachPapers(recorded.id, files, context)\n return recorded\n }\n\n const carrier = await activityNamed(SEAL_USE_ACTIVITY, context)\n if (!carrier) throw new Refusal('seal-use-approval-not-installed', { form: SEAL_USE_ACTIVITY }, `the approval '${SEAL_USE_ACTIVITY}' is not installed in this domain`)\n const line = await approvalLineStanding(carrier, context)\n if (line.refusal) throw approvalLineRefusal(line.refusal)\n\n row.status = SealUseStatus.SUBMITTED\n const saved = await repository.save(row)\n /* The paper to be stamped goes up with the use - the approver opens it from the card (2026-11-10). */\n const papers = await attachPapers(saved.id, files, context)\n const what = `${seal!.name} ${KIND_WORDS[input.kind]}`\n const who = requester?.name ?? user.name ?? ''\n const instance = await issue(\n {\n name: `${what} ${saved.document ?? saved.purpose ?? ''}`.trim(),\n description: [saved.purpose, saved.submittedTo].filter(Boolean).join(' · '),\n activityId: carrier.id,\n approvalLine: carrier.approvalLine,\n input: {\n sealUseId: saved.id,\n requester: who,\n headline: `${what} · ${saved.usedOn}${saved.document ? ` · ${saved.document}` : ''}`,\n reason: [\n `목적: ${saved.purpose ?? ''}`,\n ...(saved.submittedTo ? [`제출처: ${saved.submittedTo}`] : []),\n ...(saved.returnDueOn ? [`반납 예정일: ${saved.returnDueOn}`] : []),\n ...(saved.copies ? [`통수: ${saved.copies}`] : []),\n ...(saved.notes ? [`메모: ${saved.notes}`] : []),\n ...(seal!.custodianId ? [] : ['보관자가 정해지지 않은 인감입니다'])\n ],\n papers: papers.map(one => ({ __typename: 'Attachment', id: one.id, name: one.name, fullpath: one.fullpath })),\n consequence: input.kind === SealUseKind.TAKE_OUT ? `승인하면 ${seal!.name}을(를) ${saved.returnDueOn}까지 내보냅니다` : `승인하면 ${seal!.name}을(를) ${input.kind === SealUseKind.CERTIFICATE ? '인감증명서 발급에' : '이 서류에'} 씁니다`\n },\n threadsMin: 1,\n threadsMax: 1,\n requireApproval: true\n } as any,\n context\n )\n saved.activityInstanceId = instance.id\n return await repository.save(saved)\n}\n\n/** Attaches the papers of a use - the document to be stamped - and reads back every paper it has. */\nasync function attachPapers(id: string, files: FileUpload[] | undefined, context: ResolverContext): Promise<Attachment[]> {\n const { domain, tx } = context.state as { domain: { id: string }; tx: EntityManager }\n for (const file of files ?? []) await createAttachment(null, { attachment: { file, refType: SEAL_USE_REF_TYPE, refBy: id } } as any, context)\n if (!files?.length) return []\n return await tx.getRepository(Attachment).find({ where: { domain: { id: domain.id }, refType: SEAL_USE_REF_TYPE, refBy: id } as any, order: { createdAt: 'ASC' } as any })\n}\n\n/** Take a use waiting on approval back - only the one who put it up. */\nexport async function withdrawSealUse(id: string, context: ResolverContext): Promise<SealUse> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(SealUse)\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) throw new Refusal('seal-use-not-found', {}, 'the record was not found. reload and try again.')\n if (row.creatorId !== user.id) throw new Refusal('seal-use-not-yours', {}, 'only the one who put it up can take it back')\n if (row.status !== SealUseStatus.SUBMITTED) throw new Refusal('seal-use-not-submitted', {}, 'only a use waiting on approval can be taken back')\n if (row.activityInstanceId) await abort({ id: row.activityInstanceId, reason: '올린 사람이 회수함' } as any, context)\n row.status = SealUseStatus.WITHDRAWN\n row.updater = user\n return await repository.save(row)\n}\n\n/** The day it came back and the notes - nothing the approvers saw. */\nexport async function updateSealUses(patches: SealUsePatch[], context: ResolverContext): Promise<SealUse[]> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(SealUse)\n const saved: SealUse[] = []\n for (const patch of patches) {\n const row = await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } as any })\n if (!row) throw new Refusal('seal-use-not-found', {}, 'the record was not found. reload and try again.')\n const changed = Object.keys(patch).filter(field => !['id', 'cuFlag'].includes(field) && (patch as any)[field] !== undefined)\n if (changed.some(field => !(AFTER_WRITTEN as readonly string[]).includes(field))) throw new Refusal('seal-use-written', {}, 'what was written stays - only the day it came back and the notes change')\n if (patch.returnedOn !== undefined) {\n const day = text(patch.returnedOn)\n if (day && (row.kind !== SealUseKind.TAKE_OUT || row.status !== SealUseStatus.APPROVED)) throw new Refusal('seal-use-not-out', {}, 'only a seal let out comes back')\n if (day && (!/^\\d{4}-\\d{2}-\\d{2}$/.test(day) || day < row.usedOn)) throw new Refusal('seal-use-returned-invalid', {}, 'it comes back on or after the day it went out, YYYY-MM-DD')\n row.returnedOn = day\n }\n if (patch.notes !== undefined) row.notes = text(patch.notes)\n row.updater = user\n saved.push(await repository.save(row))\n }\n return saved\n}\n\n/** Delete uses nobody approved. */\nexport async function deleteSealUses(ids: string[], context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n const repository = tx.getRepository(SealUse)\n for (const id of ids) {\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) continue\n if (!deletable(row.status)) throw new Refusal('seal-use-not-deletable', {}, 'a use that went through approval is kept - one waiting is taken back instead')\n await repository.delete(row.id)\n }\n return true\n}\n\n/**\n * What an approver's decision does to the use - worklist calls it on every state change of the instance, more than once\n * for one; a decision lands only on the use still waiting on that very instance.\n */\nexport async function decideSealUse(instance: { id: string; state: any; input?: any }, causedBy: readonly { state?: any }[], context: ResolverContext) {\n const { domain, user, tx } = context.state\n const id = instance.input?.sealUseId\n if (!id) return\n const repository = tx.getRepository(SealUse)\n const row = await repository.findOne({ where: { id, domain: { id: domain.id } } as any })\n if (!row) return\n const decision = decisionOf(\n { id: instance.id, state: String(instance.state) },\n causedBy.map(one => ({ state: String(one.state) })),\n { status: row.status as any, activityInstanceId: row.activityInstanceId }\n )\n if (!decision) return\n row.status = SealUseStatus[decision]\n if (decision !== 'WITHDRAWN') {\n row.decidedAt = new Date()\n row.decidedBy = user\n }\n await repository.save(row)\n}\n"]}
|