@things-factory/compliance 0.0.0-stage → 10.1.255
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/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +28 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/compliance-case-form.d.ts +42 -0
- package/dist-client/components/compliance-case-form.js +313 -0
- package/dist-client/components/compliance-case-form.js.map +1 -0
- package/dist-client/components/compliance-case-sheet.d.ts +35 -0
- package/dist-client/components/compliance-case-sheet.js +335 -0
- package/dist-client/components/compliance-case-sheet.js.map +1 -0
- package/dist-client/components/compliance-my-inventions.d.ts +17 -0
- package/dist-client/components/compliance-my-inventions.js +133 -0
- package/dist-client/components/compliance-my-inventions.js.map +1 -0
- package/dist-client/components/compliance-my-privacy-requests.d.ts +34 -0
- package/dist-client/components/compliance-my-privacy-requests.js +232 -0
- package/dist-client/components/compliance-my-privacy-requests.js.map +1 -0
- package/dist-client/components/compliance-my-reports.d.ts +19 -0
- package/dist-client/components/compliance-my-reports.js +137 -0
- package/dist-client/components/compliance-my-reports.js.map +1 -0
- package/dist-client/components/guide-link.d.ts +13 -0
- package/dist-client/components/guide-link.js +55 -0
- package/dist-client/components/guide-link.js.map +1 -0
- package/dist-client/components/invention-report-form.d.ts +30 -0
- package/dist-client/components/invention-report-form.js +188 -0
- package/dist-client/components/invention-report-form.js.map +1 -0
- package/dist-client/components/legal-todo.d.ts +10 -0
- package/dist-client/components/legal-todo.js +43 -0
- package/dist-client/components/legal-todo.js.map +1 -0
- package/dist-client/components/my-trainings.d.ts +18 -0
- package/dist-client/components/my-trainings.js +149 -0
- package/dist-client/components/my-trainings.js.map +1 -0
- package/dist-client/components/regulation-form.d.ts +26 -0
- package/dist-client/components/regulation-form.js +161 -0
- package/dist-client/components/regulation-form.js.map +1 -0
- package/dist-client/components/seal-use-form.d.ts +47 -0
- package/dist-client/components/seal-use-form.js +300 -0
- package/dist-client/components/seal-use-form.js.map +1 -0
- package/dist-client/components/training-attendance-form.d.ts +37 -0
- package/dist-client/components/training-attendance-form.js +186 -0
- package/dist-client/components/training-attendance-form.js.map +1 -0
- package/dist-client/components/training-certificate-form.d.ts +41 -0
- package/dist-client/components/training-certificate-form.js +198 -0
- package/dist-client/components/training-certificate-form.js.map +1 -0
- package/dist-client/components/training-session-form.d.ts +39 -0
- package/dist-client/components/training-session-form.js +270 -0
- package/dist-client/components/training-session-form.js.map +1 -0
- package/dist-client/components/training-setting-form.d.ts +45 -0
- package/dist-client/components/training-setting-form.js +175 -0
- package/dist-client/components/training-setting-form.js.map +1 -0
- package/dist-client/index.d.ts +4 -0
- package/dist-client/index.js +8 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/legal-record/dispute-calendar-source.d.ts +1 -0
- package/dist-client/legal-record/dispute-calendar-source.js +51 -0
- package/dist-client/legal-record/dispute-calendar-source.js.map +1 -0
- package/dist-client/legal-record/legal-child-grid.d.ts +31 -0
- package/dist-client/legal-record/legal-child-grid.js +76 -0
- package/dist-client/legal-record/legal-child-grid.js.map +1 -0
- package/dist-client/legal-record/legal-codes.d.ts +3 -0
- package/dist-client/legal-record/legal-codes.js +5 -0
- package/dist-client/legal-record/legal-codes.js.map +1 -0
- package/dist-client/legal-record/legal-grid.d.ts +59 -0
- package/dist-client/legal-record/legal-grid.js +68 -0
- package/dist-client/legal-record/legal-grid.js.map +1 -0
- package/dist-client/legal-record/legal-record-files.d.ts +26 -0
- package/dist-client/legal-record/legal-record-files.js +162 -0
- package/dist-client/legal-record/legal-record-files.js.map +1 -0
- package/dist-client/pages/compliance-case-list.d.ts +35 -0
- package/dist-client/pages/compliance-case-list.js +112 -0
- package/dist-client/pages/compliance-case-list.js.map +1 -0
- package/dist-client/pages/dispute-list.d.ts +57 -0
- package/dist-client/pages/dispute-list.js +156 -0
- package/dist-client/pages/dispute-list.js.map +1 -0
- package/dist-client/pages/invention-list.d.ts +57 -0
- package/dist-client/pages/invention-list.js +166 -0
- package/dist-client/pages/invention-list.js.map +1 -0
- package/dist-client/pages/legal-registration-list.d.ts +63 -0
- package/dist-client/pages/legal-registration-list.js +206 -0
- package/dist-client/pages/legal-registration-list.js.map +1 -0
- package/dist-client/pages/privacy-record-list.d.ts +52 -0
- package/dist-client/pages/privacy-record-list.js +225 -0
- package/dist-client/pages/privacy-record-list.js.map +1 -0
- package/dist-client/pages/regulation-detail.d.ts +43 -0
- package/dist-client/pages/regulation-detail.js +370 -0
- package/dist-client/pages/regulation-detail.js.map +1 -0
- package/dist-client/pages/regulation-list.d.ts +52 -0
- package/dist-client/pages/regulation-list.js +144 -0
- package/dist-client/pages/regulation-list.js.map +1 -0
- package/dist-client/pages/regulations.d.ts +49 -0
- package/dist-client/pages/regulations.js +412 -0
- package/dist-client/pages/regulations.js.map +1 -0
- package/dist-client/pages/seal-use-list.d.ts +57 -0
- package/dist-client/pages/seal-use-list.js +168 -0
- package/dist-client/pages/seal-use-list.js.map +1 -0
- package/dist-client/pages/training-list.d.ts +51 -0
- package/dist-client/pages/training-list.js +333 -0
- package/dist-client/pages/training-list.js.map +1 -0
- package/dist-client/regulation/regulation-fragments.d.ts +1 -0
- package/dist-client/regulation/regulation-fragments.js +37 -0
- package/dist-client/regulation/regulation-fragments.js.map +1 -0
- package/dist-client/regulation/regulation-guide.d.ts +19 -0
- package/dist-client/regulation/regulation-guide.js +48 -0
- package/dist-client/regulation/regulation-guide.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +36 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/training-words.d.ts +11 -0
- package/dist-client/training-words.js +11 -0
- package/dist-client/training-words.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/words.d.ts +15 -0
- package/dist-client/words.js +20 -0
- package/dist-client/words.js.map +1 -0
- package/dist-server/activities/index.d.ts +6 -0
- package/dist-server/activities/index.js +37 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/activities/legal-todo-activity-names.d.ts +1 -0
- package/dist-server/activities/legal-todo-activity-names.js +5 -0
- package/dist-server/activities/legal-todo-activity-names.js.map +1 -0
- package/dist-server/activities/legal-todo-activity.d.ts +37 -0
- package/dist-server/activities/legal-todo-activity.js +41 -0
- package/dist-server/activities/legal-todo-activity.js.map +1 -0
- package/dist-server/activities/regulation-activity-names.d.ts +1 -0
- package/dist-server/activities/regulation-activity-names.js +5 -0
- package/dist-server/activities/regulation-activity-names.js.map +1 -0
- package/dist-server/activities/regulation-activity.d.ts +48 -0
- package/dist-server/activities/regulation-activity.js +47 -0
- package/dist-server/activities/regulation-activity.js.map +1 -0
- package/dist-server/activities/seal-use-activity-names.d.ts +2 -0
- package/dist-server/activities/seal-use-activity-names.js +6 -0
- package/dist-server/activities/seal-use-activity-names.js.map +1 -0
- package/dist-server/activities/seal-use-activity.d.ts +48 -0
- package/dist-server/activities/seal-use-activity.js +47 -0
- package/dist-server/activities/seal-use-activity.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +21 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/role-tasks.d.ts +2 -0
- package/dist-server/role-tasks.js +28 -0
- package/dist-server/role-tasks.js.map +1 -0
- package/dist-server/service/common/correction.d.ts +32 -0
- package/dist-server/service/common/correction.js +98 -0
- package/dist-server/service/common/correction.js.map +1 -0
- package/dist-server/service/common/employee-reader.d.ts +11 -0
- package/dist-server/service/common/employee-reader.js +46 -0
- package/dist-server/service/common/employee-reader.js.map +1 -0
- package/dist-server/service/common/legal-todo.d.ts +19 -0
- package/dist-server/service/common/legal-todo.js +37 -0
- package/dist-server/service/common/legal-todo.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.d.ts +9 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.js +73 -0
- package/dist-server/service/compliance-case/compliance-case-mutation.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-query.d.ts +28 -0
- package/dist-server/service/compliance-case/compliance-case-query.js +212 -0
- package/dist-server/service/compliance-case/compliance-case-query.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-rules.d.ts +71 -0
- package/dist-server/service/compliance-case/compliance-case-rules.js +111 -0
- package/dist-server/service/compliance-case/compliance-case-rules.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-service.d.ts +76 -0
- package/dist-server/service/compliance-case/compliance-case-service.js +425 -0
- package/dist-server/service/compliance-case/compliance-case-service.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case-type.d.ts +56 -0
- package/dist-server/service/compliance-case/compliance-case-type.js +200 -0
- package/dist-server/service/compliance-case/compliance-case-type.js.map +1 -0
- package/dist-server/service/compliance-case/compliance-case.d.ts +76 -0
- package/dist-server/service/compliance-case/compliance-case.js +260 -0
- package/dist-server/service/compliance-case/compliance-case.js.map +1 -0
- package/dist-server/service/compliance-case/index.d.ts +7 -0
- package/dist-server/service/compliance-case/index.js +17 -0
- package/dist-server/service/compliance-case/index.js.map +1 -0
- package/dist-server/service/dispute/dispute-mutation.d.ts +9 -0
- package/dist-server/service/dispute/dispute-mutation.js +64 -0
- package/dist-server/service/dispute/dispute-mutation.js.map +1 -0
- package/dist-server/service/dispute/dispute-query.d.ts +16 -0
- package/dist-server/service/dispute/dispute-query.js +124 -0
- package/dist-server/service/dispute/dispute-query.js.map +1 -0
- package/dist-server/service/dispute/dispute-rules.d.ts +20 -0
- package/dist-server/service/dispute/dispute-rules.js +42 -0
- package/dist-server/service/dispute/dispute-rules.js.map +1 -0
- package/dist-server/service/dispute/dispute-service.d.ts +17 -0
- package/dist-server/service/dispute/dispute-service.js +96 -0
- package/dist-server/service/dispute/dispute-service.js.map +1 -0
- package/dist-server/service/dispute/dispute-type.d.ts +39 -0
- package/dist-server/service/dispute/dispute-type.js +149 -0
- package/dist-server/service/dispute/dispute-type.js.map +1 -0
- package/dist-server/service/dispute/dispute.d.ts +48 -0
- package/dist-server/service/dispute/dispute.js +198 -0
- package/dist-server/service/dispute/dispute.js.map +1 -0
- package/dist-server/service/dispute/index.d.ts +5 -0
- package/dist-server/service/dispute/index.js +9 -0
- package/dist-server/service/dispute/index.js.map +1 -0
- package/dist-server/service/index.d.ts +46 -0
- package/dist-server/service/index.js +112 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/invention/index.d.ts +5 -0
- package/dist-server/service/invention/index.js +9 -0
- package/dist-server/service/invention/index.js.map +1 -0
- package/dist-server/service/invention/invention-mutation.d.ts +10 -0
- package/dist-server/service/invention/invention-mutation.js +79 -0
- package/dist-server/service/invention/invention-mutation.js.map +1 -0
- package/dist-server/service/invention/invention-query.d.ts +18 -0
- package/dist-server/service/invention/invention-query.js +141 -0
- package/dist-server/service/invention/invention-query.js.map +1 -0
- package/dist-server/service/invention/invention-rules.d.ts +28 -0
- package/dist-server/service/invention/invention-rules.js +54 -0
- package/dist-server/service/invention/invention-rules.js.map +1 -0
- package/dist-server/service/invention/invention-service.d.ts +25 -0
- package/dist-server/service/invention/invention-service.js +176 -0
- package/dist-server/service/invention/invention-service.js.map +1 -0
- package/dist-server/service/invention/invention-type.d.ts +34 -0
- package/dist-server/service/invention/invention-type.js +129 -0
- package/dist-server/service/invention/invention-type.js.map +1 -0
- package/dist-server/service/invention/invention.d.ts +55 -0
- package/dist-server/service/invention/invention.js +214 -0
- package/dist-server/service/invention/invention.js.map +1 -0
- package/dist-server/service/legal-record/attachment-readers.d.ts +1 -0
- package/dist-server/service/legal-record/attachment-readers.js +27 -0
- package/dist-server/service/legal-record/attachment-readers.js.map +1 -0
- package/dist-server/service/legal-record/days.d.ts +7 -0
- package/dist-server/service/legal-record/days.js +26 -0
- package/dist-server/service/legal-record/days.js.map +1 -0
- package/dist-server/service/legal-record/legal-record-support.d.ts +24 -0
- package/dist-server/service/legal-record/legal-record-support.js +51 -0
- package/dist-server/service/legal-record/legal-record-support.js.map +1 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.d.ts +9 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.js +50 -0
- package/dist-server/service/legal-registration/centre-change-subscriber.js.map +1 -0
- package/dist-server/service/legal-registration/index.d.ts +7 -0
- package/dist-server/service/legal-registration/index.js +11 -0
- package/dist-server/service/legal-registration/index.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.d.ts +10 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.js +77 -0
- package/dist-server/service/legal-registration/legal-registration-mutation.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-query.d.ts +26 -0
- package/dist-server/service/legal-registration/legal-registration-query.js +199 -0
- package/dist-server/service/legal-registration/legal-registration-query.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-rules.d.ts +80 -0
- package/dist-server/service/legal-registration/legal-registration-rules.js +106 -0
- package/dist-server/service/legal-registration/legal-registration-rules.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-service.d.ts +37 -0
- package/dist-server/service/legal-registration/legal-registration-service.js +248 -0
- package/dist-server/service/legal-registration/legal-registration-service.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration-type.d.ts +55 -0
- package/dist-server/service/legal-registration/legal-registration-type.js +207 -0
- package/dist-server/service/legal-registration/legal-registration-type.js.map +1 -0
- package/dist-server/service/legal-registration/legal-registration.d.ts +76 -0
- package/dist-server/service/legal-registration/legal-registration.js +311 -0
- package/dist-server/service/legal-registration/legal-registration.js.map +1 -0
- package/dist-server/service/privacy-record/index.d.ts +5 -0
- package/dist-server/service/privacy-record/index.js +9 -0
- package/dist-server/service/privacy-record/index.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.d.ts +7 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.js +56 -0
- package/dist-server/service/privacy-record/privacy-record-mutation.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-query.d.ts +18 -0
- package/dist-server/service/privacy-record/privacy-record-query.js +131 -0
- package/dist-server/service/privacy-record/privacy-record-query.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-rules.d.ts +52 -0
- package/dist-server/service/privacy-record/privacy-record-rules.js +91 -0
- package/dist-server/service/privacy-record/privacy-record-rules.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-service.d.ts +33 -0
- package/dist-server/service/privacy-record/privacy-record-service.js +133 -0
- package/dist-server/service/privacy-record/privacy-record-service.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record-type.d.ts +40 -0
- package/dist-server/service/privacy-record/privacy-record-type.js +153 -0
- package/dist-server/service/privacy-record/privacy-record-type.js.map +1 -0
- package/dist-server/service/privacy-record/privacy-record.d.ts +69 -0
- package/dist-server/service/privacy-record/privacy-record.js +245 -0
- package/dist-server/service/privacy-record/privacy-record.js.map +1 -0
- package/dist-server/service/regulation/index.d.ts +5 -0
- package/dist-server/service/regulation/index.js +9 -0
- package/dist-server/service/regulation/index.js.map +1 -0
- package/dist-server/service/regulation/regulation-mutation.d.ts +15 -0
- package/dist-server/service/regulation/regulation-mutation.js +152 -0
- package/dist-server/service/regulation/regulation-mutation.js.map +1 -0
- package/dist-server/service/regulation/regulation-query.d.ts +10 -0
- package/dist-server/service/regulation/regulation-query.js +109 -0
- package/dist-server/service/regulation/regulation-query.js.map +1 -0
- package/dist-server/service/regulation/regulation-read.d.ts +21 -0
- package/dist-server/service/regulation/regulation-read.js +111 -0
- package/dist-server/service/regulation/regulation-read.js.map +1 -0
- package/dist-server/service/regulation/regulation-rules.d.ts +83 -0
- package/dist-server/service/regulation/regulation-rules.js +170 -0
- package/dist-server/service/regulation/regulation-rules.js.map +1 -0
- package/dist-server/service/regulation/regulation-service.d.ts +63 -0
- package/dist-server/service/regulation/regulation-service.js +365 -0
- package/dist-server/service/regulation/regulation-service.js.map +1 -0
- package/dist-server/service/regulation/regulation-type.d.ts +61 -0
- package/dist-server/service/regulation/regulation-type.js +226 -0
- package/dist-server/service/regulation/regulation-type.js.map +1 -0
- package/dist-server/service/regulation/regulation.d.ts +113 -0
- package/dist-server/service/regulation/regulation.js +382 -0
- package/dist-server/service/regulation/regulation.js.map +1 -0
- package/dist-server/service/seal-use/index.d.ts +5 -0
- package/dist-server/service/seal-use/index.js +9 -0
- package/dist-server/service/seal-use/index.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-mutation.d.ts +8 -0
- package/dist-server/service/seal-use/seal-use-mutation.js +69 -0
- package/dist-server/service/seal-use/seal-use-mutation.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-query.d.ts +14 -0
- package/dist-server/service/seal-use/seal-use-query.js +100 -0
- package/dist-server/service/seal-use/seal-use-query.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-rules.d.ts +35 -0
- package/dist-server/service/seal-use/seal-use-rules.js +64 -0
- package/dist-server/service/seal-use/seal-use-rules.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-service.d.ts +20 -0
- package/dist-server/service/seal-use/seal-use-service.js +168 -0
- package/dist-server/service/seal-use/seal-use-service.js.map +1 -0
- package/dist-server/service/seal-use/seal-use-type.d.ts +24 -0
- package/dist-server/service/seal-use/seal-use-type.js +93 -0
- package/dist-server/service/seal-use/seal-use-type.js.map +1 -0
- package/dist-server/service/seal-use/seal-use.d.ts +57 -0
- package/dist-server/service/seal-use/seal-use.js +181 -0
- package/dist-server/service/seal-use/seal-use.js.map +1 -0
- package/dist-server/service/training/index.d.ts +5 -0
- package/dist-server/service/training/index.js +9 -0
- package/dist-server/service/training/index.js.map +1 -0
- package/dist-server/service/training/training-checks.d.ts +20 -0
- package/dist-server/service/training/training-checks.js +56 -0
- package/dist-server/service/training/training-checks.js.map +1 -0
- package/dist-server/service/training/training-kinds.d.ts +24 -0
- package/dist-server/service/training/training-kinds.js +42 -0
- package/dist-server/service/training/training-kinds.js.map +1 -0
- package/dist-server/service/training/training-mutation.d.ts +14 -0
- package/dist-server/service/training/training-mutation.js +140 -0
- package/dist-server/service/training/training-mutation.js.map +1 -0
- package/dist-server/service/training/training-query.d.ts +21 -0
- package/dist-server/service/training/training-query.js +196 -0
- package/dist-server/service/training/training-query.js.map +1 -0
- package/dist-server/service/training/training-read.d.ts +5 -0
- package/dist-server/service/training/training-read.js +35 -0
- package/dist-server/service/training/training-read.js.map +1 -0
- package/dist-server/service/training/training-register.d.ts +1 -0
- package/dist-server/service/training/training-register.js +27 -0
- package/dist-server/service/training/training-register.js.map +1 -0
- package/dist-server/service/training/training-rules.d.ts +72 -0
- package/dist-server/service/training/training-rules.js +143 -0
- package/dist-server/service/training/training-rules.js.map +1 -0
- package/dist-server/service/training/training-service.d.ts +98 -0
- package/dist-server/service/training/training-service.js +455 -0
- package/dist-server/service/training/training-service.js.map +1 -0
- package/dist-server/service/training/training-type.d.ts +94 -0
- package/dist-server/service/training/training-type.js +352 -0
- package/dist-server/service/training/training-type.js.map +1 -0
- package/dist-server/service/training/training.d.ts +127 -0
- package/dist-server/service/training/training.js +448 -0
- package/dist-server/service/training/training.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +61 -4
- package/things-factory.config.js +19 -0
- package/translations/en.json +612 -0
- package/translations/es.json +612 -0
- package/translations/ja.json +612 -0
- package/translations/ko.json +612 -0
- package/translations/ms.json +612 -0
- package/translations/zh.json +612 -0
- package/README.md +0 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrivacyIncidentQuery = exports.PrivacyRequestQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
7
|
+
const organization_1 = require("@things-factory/organization");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
const correction_1 = require("../common/correction");
|
|
10
|
+
const privacy_record_1 = require("./privacy-record");
|
|
11
|
+
const privacy_record_service_1 = require("./privacy-record-service");
|
|
12
|
+
const privacy_record_type_1 = require("./privacy-record-type");
|
|
13
|
+
let PrivacyRequestQuery = class PrivacyRequestQuery {
|
|
14
|
+
async privacyRequests(params, context) {
|
|
15
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
16
|
+
domain: context.state.domain,
|
|
17
|
+
params,
|
|
18
|
+
repository: (0, shell_1.getRepository)(privacy_record_1.PrivacyRequest),
|
|
19
|
+
searchables: ['requesterName', 'details', 'handling'],
|
|
20
|
+
alias: 'request',
|
|
21
|
+
defaultSortings: [{ name: 'receivedOn', desc: true }]
|
|
22
|
+
});
|
|
23
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
24
|
+
return { items, total };
|
|
25
|
+
}
|
|
26
|
+
async myPrivacyRequests(context) {
|
|
27
|
+
return await (0, privacy_record_service_1.myPrivacyRequests)(context);
|
|
28
|
+
}
|
|
29
|
+
async requesterEmployee(row) {
|
|
30
|
+
return row.requesterEmployeeId ? await (0, shell_1.getRepository)(organization_1.Employee).findOne({ where: { id: row.requesterEmployeeId } }) : null;
|
|
31
|
+
}
|
|
32
|
+
async corrections(row, context) {
|
|
33
|
+
return await (0, correction_1.correctionsOf)((0, shell_1.getRepository)(privacy_record_1.PrivacyRequest).manager, context.state.domain, { kind: privacy_record_service_1.PRIVACY_REQUEST_KIND, id: row.id });
|
|
34
|
+
}
|
|
35
|
+
async updater(row) {
|
|
36
|
+
return row.updaterId ? await (0, shell_1.getRepository)(auth_base_1.User).findOne({ where: { id: row.updaterId } }) : null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.PrivacyRequestQuery = PrivacyRequestQuery;
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Directive)('@privilege(category: "privacy-record", privilege: "query", domainOwnerGranted: true)'),
|
|
42
|
+
(0, type_graphql_1.Query)(returns => privacy_record_type_1.PrivacyRequestList, { description: '개인정보 요구 - requests to see, correct, delete or stop the processing of personal information (ADR-0187 decision 22)' }),
|
|
43
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
44
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
45
|
+
tslib_1.__metadata("design:type", Function),
|
|
46
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
47
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
48
|
+
], PrivacyRequestQuery.prototype, "privacyRequests", null);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, type_graphql_1.Query)(returns => [privacy_record_1.PrivacyRequest], { description: 'The requests the request\'s employee raised of their own personal information' }),
|
|
51
|
+
tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
|
|
52
|
+
tslib_1.__metadata("design:type", Function),
|
|
53
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
54
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
55
|
+
], PrivacyRequestQuery.prototype, "myPrivacyRequests", null);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.FieldResolver)(type => organization_1.Employee, { nullable: true }),
|
|
58
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
59
|
+
tslib_1.__metadata("design:type", Function),
|
|
60
|
+
tslib_1.__metadata("design:paramtypes", [privacy_record_1.PrivacyRequest]),
|
|
61
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
62
|
+
], PrivacyRequestQuery.prototype, "requesterEmployee", null);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, type_graphql_1.FieldResolver)(type => [correction_1.ComplianceCorrection], { description: 'The values changed after they were written' }),
|
|
65
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
66
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
67
|
+
tslib_1.__metadata("design:type", Function),
|
|
68
|
+
tslib_1.__metadata("design:paramtypes", [privacy_record_1.PrivacyRequest, Object]),
|
|
69
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
70
|
+
], PrivacyRequestQuery.prototype, "corrections", null);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
73
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
74
|
+
tslib_1.__metadata("design:type", Function),
|
|
75
|
+
tslib_1.__metadata("design:paramtypes", [privacy_record_1.PrivacyRequest]),
|
|
76
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
77
|
+
], PrivacyRequestQuery.prototype, "updater", null);
|
|
78
|
+
exports.PrivacyRequestQuery = PrivacyRequestQuery = tslib_1.__decorate([
|
|
79
|
+
(0, type_graphql_1.Resolver)(privacy_record_1.PrivacyRequest),
|
|
80
|
+
(0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
|
|
81
|
+
], PrivacyRequestQuery);
|
|
82
|
+
let PrivacyIncidentQuery = class PrivacyIncidentQuery {
|
|
83
|
+
async privacyIncidents(params, context) {
|
|
84
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
85
|
+
domain: context.state.domain,
|
|
86
|
+
params,
|
|
87
|
+
repository: (0, shell_1.getRepository)(privacy_record_1.PrivacyIncident),
|
|
88
|
+
searchables: ['items', 'measures', 'reportReceiptNo'],
|
|
89
|
+
alias: 'incident',
|
|
90
|
+
defaultSortings: [{ name: 'knownAt', desc: true }]
|
|
91
|
+
});
|
|
92
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
93
|
+
return { items, total };
|
|
94
|
+
}
|
|
95
|
+
async corrections(row, context) {
|
|
96
|
+
return await (0, correction_1.correctionsOf)((0, shell_1.getRepository)(privacy_record_1.PrivacyIncident).manager, context.state.domain, { kind: privacy_record_service_1.PRIVACY_INCIDENT_KIND, id: row.id });
|
|
97
|
+
}
|
|
98
|
+
async updater(row) {
|
|
99
|
+
return row.updaterId ? await (0, shell_1.getRepository)(auth_base_1.User).findOne({ where: { id: row.updaterId } }) : null;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
exports.PrivacyIncidentQuery = PrivacyIncidentQuery;
|
|
103
|
+
tslib_1.__decorate([
|
|
104
|
+
(0, type_graphql_1.Directive)('@privilege(category: "privacy-record", privilege: "query", domainOwnerGranted: true)'),
|
|
105
|
+
(0, type_graphql_1.Query)(returns => privacy_record_type_1.PrivacyIncidentList, { description: '개인정보 유출 사고 - leaks known or possible, their 72 hours, the subjects told and the report (ADR-0187 decision 22)' }),
|
|
106
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
107
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
108
|
+
tslib_1.__metadata("design:type", Function),
|
|
109
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
110
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
111
|
+
], PrivacyIncidentQuery.prototype, "privacyIncidents", null);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
(0, type_graphql_1.FieldResolver)(type => [correction_1.ComplianceCorrection], { description: 'The values changed after they were written' }),
|
|
114
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
115
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
116
|
+
tslib_1.__metadata("design:type", Function),
|
|
117
|
+
tslib_1.__metadata("design:paramtypes", [privacy_record_1.PrivacyIncident, Object]),
|
|
118
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
119
|
+
], PrivacyIncidentQuery.prototype, "corrections", null);
|
|
120
|
+
tslib_1.__decorate([
|
|
121
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
122
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
123
|
+
tslib_1.__metadata("design:type", Function),
|
|
124
|
+
tslib_1.__metadata("design:paramtypes", [privacy_record_1.PrivacyIncident]),
|
|
125
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
126
|
+
], PrivacyIncidentQuery.prototype, "updater", null);
|
|
127
|
+
exports.PrivacyIncidentQuery = PrivacyIncidentQuery = tslib_1.__decorate([
|
|
128
|
+
(0, type_graphql_1.Resolver)(privacy_record_1.PrivacyIncident),
|
|
129
|
+
(0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
|
|
130
|
+
], PrivacyIncidentQuery);
|
|
131
|
+
//# sourceMappingURL=privacy-record-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-record-query.js","sourceRoot":"","sources":["../../../server/service/privacy-record/privacy-record-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,yDAAgD;AAChD,+DAAuD;AACvD,iDAA8G;AAE9G,qDAA0E;AAC1E,qDAAkE;AAClE,qEAAyG;AACzG,+DAA+E;AAIxE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,eAAe,CAA0B,MAAiB,EAAS,OAAwB;QAC/F,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;YAC5B,MAAM;YACN,UAAU,EAAE,IAAA,qBAAa,EAAC,+BAAc,CAAC;YACzC,WAAW,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,UAAU,CAAC;YACrD,KAAK,EAAE,SAAS;YAChB,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;SACtD,CAAC,CAAA;QACF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAC3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CAAQ,OAAwB;QACrD,OAAO,MAAM,IAAA,0CAAiB,EAAC,OAAO,CAAC,CAAA;IACzC,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CAAS,GAAmB;QACjD,OAAO,GAAG,CAAC,m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A,IAAA,mBAAI,GAAE,CAAA;;6CAAM,gCAAe;;mDAEzC;+BAxBU,oBAAoB;IAFhC,IAAA,uBAAQ,EAAC,gCAAe,CAAC;IACzB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,oBAAoB,CAyBhC","sourcesContent":["import { Args, Ctx, Directive, FieldResolver, Query, Resolver, Root, UseMiddleware } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { Employee } from '@things-factory/organization'\nimport { getQueryBuilderFromListParams, getRepository, ListParam, SpeakRefusals } from '@things-factory/shell'\n\nimport { ComplianceCorrection, correctionsOf } from '../common/correction'\nimport { PrivacyIncident, PrivacyRequest } from './privacy-record'\nimport { myPrivacyRequests, PRIVACY_INCIDENT_KIND, PRIVACY_REQUEST_KIND } from './privacy-record-service'\nimport { PrivacyIncidentList, PrivacyRequestList } from './privacy-record-type'\n\n@Resolver(PrivacyRequest)\n@UseMiddleware(SpeakRefusals)\nexport class PrivacyRequestQuery {\n @Directive('@privilege(category: \"privacy-record\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => PrivacyRequestList, { description: '개인정보 요구 - requests to see, correct, delete or stop the processing of personal information (ADR-0187 decision 22)' })\n async privacyRequests(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<PrivacyRequestList> {\n const queryBuilder = getQueryBuilderFromListParams({\n domain: context.state.domain,\n params,\n repository: getRepository(PrivacyRequest),\n searchables: ['requesterName', 'details', 'handling'],\n alias: 'request',\n defaultSortings: [{ name: 'receivedOn', desc: true }]\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @Query(returns => [PrivacyRequest], { description: 'The requests the request\\'s employee raised of their own personal information' })\n async myPrivacyRequests(@Ctx() context: ResolverContext): Promise<PrivacyRequest[]> {\n return await myPrivacyRequests(context)\n }\n\n @FieldResolver(type => Employee, { nullable: true })\n async requesterEmployee(@Root() row: PrivacyRequest): Promise<Employee | null> {\n return row.requesterEmployeeId ? await getRepository(Employee).findOne({ where: { id: row.requesterEmployeeId } }) : null\n }\n\n @FieldResolver(type => [ComplianceCorrection], { description: 'The values changed after they were written' })\n async corrections(@Root() row: PrivacyRequest, @Ctx() context: ResolverContext): Promise<ComplianceCorrection[]> {\n return await correctionsOf(getRepository(PrivacyRequest).manager, context.state.domain, { kind: PRIVACY_REQUEST_KIND, id: row.id })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async updater(@Root() row: PrivacyRequest): Promise<User | null> {\n return row.updaterId ? await getRepository(User).findOne({ where: { id: row.updaterId } }) : null\n }\n}\n\n@Resolver(PrivacyIncident)\n@UseMiddleware(SpeakRefusals)\nexport class PrivacyIncidentQuery {\n @Directive('@privilege(category: \"privacy-record\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => PrivacyIncidentList, { description: '개인정보 유출 사고 - leaks known or possible, their 72 hours, the subjects told and the report (ADR-0187 decision 22)' })\n async privacyIncidents(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<PrivacyIncidentList> {\n const queryBuilder = getQueryBuilderFromListParams({\n domain: context.state.domain,\n params,\n repository: getRepository(PrivacyIncident),\n searchables: ['items', 'measures', 'reportReceiptNo'],\n alias: 'incident',\n defaultSortings: [{ name: 'knownAt', desc: true }]\n })\n const [items, total] = await queryBuilder.getManyAndCount()\n return { items, total }\n }\n\n @FieldResolver(type => [ComplianceCorrection], { description: 'The values changed after they were written' })\n async corrections(@Root() row: PrivacyIncident, @Ctx() context: ResolverContext): Promise<ComplianceCorrection[]> {\n return await correctionsOf(getRepository(PrivacyIncident).manager, context.state.domain, { kind: PRIVACY_INCIDENT_KIND, id: row.id })\n }\n\n @FieldResolver(type => User, { nullable: true })\n async updater(@Root() row: PrivacyIncident): Promise<User | null> {\n return row.updaterId ? await getRepository(User).findOne({ where: { id: row.updaterId } }) : null\n }\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Refusal } from '@things-factory/shell';
|
|
2
|
+
export declare const REQUEST_KINDS: string[];
|
|
3
|
+
export declare const INCIDENT_CERTAINTIES: string[];
|
|
4
|
+
/** Days from receipt a request is to be answered in. */
|
|
5
|
+
export declare const REQUEST_DUE_DAYS = 10;
|
|
6
|
+
/** Hours from its being known an incident is to be reported and told in. */
|
|
7
|
+
export declare const INCIDENT_DUE_HOURS = 72;
|
|
8
|
+
/** The day a request received on `receivedOn` is due. */
|
|
9
|
+
export declare const requestDueOn: (receivedOn: string) => string;
|
|
10
|
+
/** The moment an incident known at `knownAt` is due - 72 hours on, to the minute. */
|
|
11
|
+
export declare const incidentDueAt: (knownAt: Date) => Date;
|
|
12
|
+
/** Whole hours left before `dueAt` - below zero once it has passed. */
|
|
13
|
+
export declare function hoursLeft(dueAt: Date, now: Date): number;
|
|
14
|
+
/** A request not answered past the day it is due - the extended day when it was extended. */
|
|
15
|
+
export declare function requestOverdue(row: {
|
|
16
|
+
repliedOn?: string | null;
|
|
17
|
+
dueOn: string;
|
|
18
|
+
extendedDueOn?: string | null;
|
|
19
|
+
}, today: string): boolean;
|
|
20
|
+
/** An incident not yet both reported and told - what the check counts the hours of. */
|
|
21
|
+
export declare function incidentOpen(row: {
|
|
22
|
+
reportedAt?: Date | null;
|
|
23
|
+
subjectsToldAt?: Date | null;
|
|
24
|
+
}): boolean;
|
|
25
|
+
export interface PrivacyRequestInput {
|
|
26
|
+
kind?: string | null;
|
|
27
|
+
receivedOn?: string | null;
|
|
28
|
+
requesterName?: string | null;
|
|
29
|
+
hasEmployee?: boolean;
|
|
30
|
+
details?: string | null;
|
|
31
|
+
}
|
|
32
|
+
/** What a request asks for before it is written, or nothing. */
|
|
33
|
+
export declare function privacyRequestRefusal(input: PrivacyRequestInput): Refusal | null;
|
|
34
|
+
/** What the handling of a request asks for, or nothing. */
|
|
35
|
+
export declare function privacyHandlingRefusal(next: {
|
|
36
|
+
receivedOn: string;
|
|
37
|
+
dueOn: string;
|
|
38
|
+
extendedDueOn?: string | null;
|
|
39
|
+
extensionReason?: string | null;
|
|
40
|
+
repliedOn?: string | null;
|
|
41
|
+
handling?: string | null;
|
|
42
|
+
}): Refusal | null;
|
|
43
|
+
export interface PrivacyIncidentInput {
|
|
44
|
+
knownAt?: Date | string | null;
|
|
45
|
+
certainty?: string | null;
|
|
46
|
+
items?: string | null;
|
|
47
|
+
subjectCount?: number | null;
|
|
48
|
+
subjectsToldAt?: Date | string | null;
|
|
49
|
+
reportedAt?: Date | string | null;
|
|
50
|
+
}
|
|
51
|
+
/** What an incident asks for before it is written, or nothing. */
|
|
52
|
+
export declare function privacyIncidentRefusal(input: PrivacyIncidentInput): Refusal | null;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.incidentDueAt = exports.requestDueOn = exports.INCIDENT_DUE_HOURS = exports.REQUEST_DUE_DAYS = exports.INCIDENT_CERTAINTIES = exports.REQUEST_KINDS = void 0;
|
|
4
|
+
exports.hoursLeft = hoursLeft;
|
|
5
|
+
exports.requestOverdue = requestOverdue;
|
|
6
|
+
exports.incidentOpen = incidentOpen;
|
|
7
|
+
exports.privacyRequestRefusal = privacyRequestRefusal;
|
|
8
|
+
exports.privacyHandlingRefusal = privacyHandlingRefusal;
|
|
9
|
+
exports.privacyIncidentRefusal = privacyIncidentRefusal;
|
|
10
|
+
const shell_1 = require("@things-factory/shell");
|
|
11
|
+
const compliance_case_rules_1 = require("../compliance-case/compliance-case-rules");
|
|
12
|
+
/*
|
|
13
|
+
* What a privacy request and a privacy incident hold to (ADR-0187 decision 22): a request is answered within ten days
|
|
14
|
+
* of its receipt (개인정보보호법 §35~§37 ⚖), an incident is reported and its subjects told within 72 hours of its being
|
|
15
|
+
* known (§34) - counted in hours, not days. Pure.
|
|
16
|
+
*/
|
|
17
|
+
exports.REQUEST_KINDS = ['ACCESS', 'CORRECTION', 'DELETION', 'SUSPENSION'];
|
|
18
|
+
exports.INCIDENT_CERTAINTIES = ['CONFIRMED', 'POSSIBLE'];
|
|
19
|
+
/** Days from receipt a request is to be answered in. */
|
|
20
|
+
exports.REQUEST_DUE_DAYS = 10;
|
|
21
|
+
/** Hours from its being known an incident is to be reported and told in. */
|
|
22
|
+
exports.INCIDENT_DUE_HOURS = 72;
|
|
23
|
+
const HOUR = 3600 * 1000;
|
|
24
|
+
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
25
|
+
/** The day a request received on `receivedOn` is due. */
|
|
26
|
+
const requestDueOn = (receivedOn) => (0, compliance_case_rules_1.dayPlus)(receivedOn, exports.REQUEST_DUE_DAYS);
|
|
27
|
+
exports.requestDueOn = requestDueOn;
|
|
28
|
+
/** The moment an incident known at `knownAt` is due - 72 hours on, to the minute. */
|
|
29
|
+
const incidentDueAt = (knownAt) => new Date(knownAt.getTime() + exports.INCIDENT_DUE_HOURS * HOUR);
|
|
30
|
+
exports.incidentDueAt = incidentDueAt;
|
|
31
|
+
/** Whole hours left before `dueAt` - below zero once it has passed. */
|
|
32
|
+
function hoursLeft(dueAt, now) {
|
|
33
|
+
const left = (dueAt.getTime() - now.getTime()) / HOUR;
|
|
34
|
+
return left >= 0 ? Math.floor(left) : -Math.ceil(-left);
|
|
35
|
+
}
|
|
36
|
+
/** A request not answered past the day it is due - the extended day when it was extended. */
|
|
37
|
+
function requestOverdue(row, today) {
|
|
38
|
+
return !row.repliedOn && (row.extendedDueOn || row.dueOn) < today;
|
|
39
|
+
}
|
|
40
|
+
/** An incident not yet both reported and told - what the check counts the hours of. */
|
|
41
|
+
function incidentOpen(row) {
|
|
42
|
+
return !row.reportedAt || !row.subjectsToldAt;
|
|
43
|
+
}
|
|
44
|
+
/** What a request asks for before it is written, or nothing. */
|
|
45
|
+
function privacyRequestRefusal(input) {
|
|
46
|
+
if (!exports.REQUEST_KINDS.includes(input.kind ?? ''))
|
|
47
|
+
return new shell_1.Refusal('privacy-request-kind-required', {}, 'pick access, correction, deletion or suspension');
|
|
48
|
+
if (!input.receivedOn || !DAY.test(input.receivedOn))
|
|
49
|
+
return new shell_1.Refusal('privacy-request-received-on-invalid', {}, 'give the day it was received as YYYY-MM-DD');
|
|
50
|
+
if (!input.hasEmployee && !input.requesterName?.trim())
|
|
51
|
+
return new shell_1.Refusal('privacy-request-requester-required', {}, 'name who asked - an employee, or the outside person by name');
|
|
52
|
+
if (!input.details?.trim())
|
|
53
|
+
return new shell_1.Refusal('privacy-request-details-required', {}, 'say what was asked');
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
/** What the handling of a request asks for, or nothing. */
|
|
57
|
+
function privacyHandlingRefusal(next) {
|
|
58
|
+
for (const field of ['extendedDueOn', 'repliedOn']) {
|
|
59
|
+
const day = next[field];
|
|
60
|
+
if (day && (!DAY.test(day) || day < next.receivedOn))
|
|
61
|
+
return new shell_1.Refusal(`privacy-request-${(0, compliance_case_rules_1.kebabOf)(field)}-invalid`, { receivedOn: next.receivedOn }, `give ${field} as YYYY-MM-DD, on or after the day it was received`);
|
|
62
|
+
}
|
|
63
|
+
if (next.extendedDueOn && next.extendedDueOn <= next.dueOn)
|
|
64
|
+
return new shell_1.Refusal('privacy-request-extension-not-later', { dueOn: next.dueOn }, `an extended day comes after the due day (${next.dueOn})`);
|
|
65
|
+
if (!!next.extendedDueOn !== !!next.extensionReason?.trim())
|
|
66
|
+
return new shell_1.Refusal('privacy-request-extension-reason', {}, 'an extension gives both its new day and its reason');
|
|
67
|
+
if (next.repliedOn && !next.handling?.trim())
|
|
68
|
+
return new shell_1.Refusal('privacy-request-handling-required', {}, 'write how it was handled before the day it was answered');
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const moment = (value) => (value ? new Date(value) : null);
|
|
72
|
+
const valid = (value) => !!value && !isNaN(value.getTime());
|
|
73
|
+
/** What an incident asks for before it is written, or nothing. */
|
|
74
|
+
function privacyIncidentRefusal(input) {
|
|
75
|
+
const knownAt = moment(input.knownAt);
|
|
76
|
+
if (!valid(knownAt))
|
|
77
|
+
return new shell_1.Refusal('privacy-incident-known-at-required', {}, 'give the time it became known');
|
|
78
|
+
if (!exports.INCIDENT_CERTAINTIES.includes(input.certainty ?? ''))
|
|
79
|
+
return new shell_1.Refusal('privacy-incident-certainty-required', {}, 'say whether it is confirmed or possible');
|
|
80
|
+
if (!input.items?.trim())
|
|
81
|
+
return new shell_1.Refusal('privacy-incident-items-required', {}, 'say which items of personal information');
|
|
82
|
+
if (input.subjectCount !== undefined && input.subjectCount !== null && !(Number.isInteger(input.subjectCount) && input.subjectCount >= 0))
|
|
83
|
+
return new shell_1.Refusal('privacy-incident-count-invalid', {}, 'give the number of people as a whole number of 0 or more');
|
|
84
|
+
for (const field of ['subjectsToldAt', 'reportedAt']) {
|
|
85
|
+
const at = moment(input[field]);
|
|
86
|
+
if (input[field] && (!valid(at) || at.getTime() < knownAt.getTime()))
|
|
87
|
+
return new shell_1.Refusal(`privacy-incident-${(0, compliance_case_rules_1.kebabOf)(field)}-before-known`, {}, `${field} cannot be before the time it became known`);
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=privacy-record-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-record-rules.js","sourceRoot":"","sources":["../../../server/service/privacy-record/privacy-record-rules.ts"],"names":[],"mappings":";;;AA4BA,8BAGC;AAGD,wCAEC;AAGD,oCAEC;AAWD,sDAMC;AAGD,wDASC;AAeD,wDAYC;AAjGD,iDAA+C;AAE/C,oFAA2E;AAE3E;;;;GAIG;AAEU,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAA;AAClE,QAAA,oBAAoB,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAE7D,wDAAwD;AAC3C,QAAA,gBAAgB,GAAG,EAAE,CAAA;AAClC,4EAA4E;AAC/D,QAAA,kBAAkB,GAAG,EAAE,CAAA;AAEpC,MAAM,IAAI,GAAG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,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC;QACvI,OAAO,IAAI,eAAO,CAAC,gCAAgC,EAAE,EAAE,EAAE,0DAA0D,CAAC,CAAA;IACtH,KAAK,MAAM,KAAK,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAU,EAAE,CAAC;QAC9D,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;QAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAG,CAAC,OAAO,EAAE,GAAG,OAAQ,CAAC,OAAO,EAAE,CAAC;YAAE,OAAO,IAAI,eAAO,CAAC,oBAAoB,IAAA,+BAAO,EAAC,KAAK,CAAC,eAAe,EAAE,EAAE,EAAE,GAAG,KAAK,4CAA4C,CAAC,CAAA;IACzM,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { Refusal } from '@things-factory/shell'\n\nimport { dayPlus, kebabOf } from '../compliance-case/compliance-case-rules'\n\n/*\n * What a privacy request and a privacy incident hold to (ADR-0187 decision 22): a request is answered within ten days\n * of its receipt (개인정보보호법 §35~§37 ⚖), an incident is reported and its subjects told within 72 hours of its being\n * known (§34) - counted in hours, not days. Pure.\n */\n\nexport const REQUEST_KINDS = ['ACCESS', 'CORRECTION', 'DELETION', 'SUSPENSION']\nexport const INCIDENT_CERTAINTIES = ['CONFIRMED', 'POSSIBLE']\n\n/** Days from receipt a request is to be answered in. */\nexport const REQUEST_DUE_DAYS = 10\n/** Hours from its being known an incident is to be reported and told in. */\nexport const INCIDENT_DUE_HOURS = 72\n\nconst HOUR = 3600 * 1000\nconst DAY = /^\\d{4}-\\d{2}-\\d{2}$/\n\n/** The day a request received on `receivedOn` is due. */\nexport const requestDueOn = (receivedOn: string) => dayPlus(receivedOn, REQUEST_DUE_DAYS)\n\n/** The moment an incident known at `knownAt` is due - 72 hours on, to the minute. */\nexport const incidentDueAt = (knownAt: Date) => new Date(knownAt.getTime() + INCIDENT_DUE_HOURS * HOUR)\n\n/** Whole hours left before `dueAt` - below zero once it has passed. */\nexport function hoursLeft(dueAt: Date, now: Date): number {\n const left = (dueAt.getTime() - now.getTime()) / HOUR\n return left >= 0 ? Math.floor(left) : -Math.ceil(-left)\n}\n\n/** A request not answered past the day it is due - the extended day when it was extended. */\nexport function requestOverdue(row: { repliedOn?: string | null; dueOn: string; extendedDueOn?: string | null }, today: string): boolean {\n return !row.repliedOn && (row.extendedDueOn || row.dueOn) < today\n}\n\n/** An incident not yet both reported and told - what the check counts the hours of. */\nexport function incidentOpen(row: { reportedAt?: Date | null; subjectsToldAt?: Date | null }): boolean {\n return !row.reportedAt || !row.subjectsToldAt\n}\n\nexport interface PrivacyRequestInput {\n kind?: string | null\n receivedOn?: string | null\n requesterName?: string | null\n hasEmployee?: boolean\n details?: string | null\n}\n\n/** What a request asks for before it is written, or nothing. */\nexport function privacyRequestRefusal(input: PrivacyRequestInput): Refusal | null {\n if (!REQUEST_KINDS.includes(input.kind ?? '')) return new Refusal('privacy-request-kind-required', {}, 'pick access, correction, deletion or suspension')\n if (!input.receivedOn || !DAY.test(input.receivedOn)) return new Refusal('privacy-request-received-on-invalid', {}, 'give the day it was received as YYYY-MM-DD')\n if (!input.hasEmployee && !input.requesterName?.trim()) return new Refusal('privacy-request-requester-required', {}, 'name who asked - an employee, or the outside person by name')\n if (!input.details?.trim()) return new Refusal('privacy-request-details-required', {}, 'say what was asked')\n return null\n}\n\n/** What the handling of a request asks for, or nothing. */\nexport function privacyHandlingRefusal(next: { receivedOn: string; dueOn: string; extendedDueOn?: string | null; extensionReason?: string | null; repliedOn?: string | null; handling?: string | null }): Refusal | null {\n for (const field of ['extendedDueOn', 'repliedOn'] as const) {\n const day = next[field]\n if (day && (!DAY.test(day) || day < next.receivedOn)) return new Refusal(`privacy-request-${kebabOf(field)}-invalid`, { receivedOn: next.receivedOn }, `give ${field} as YYYY-MM-DD, on or after the day it was received`)\n }\n if (next.extendedDueOn && next.extendedDueOn <= next.dueOn) return new Refusal('privacy-request-extension-not-later', { dueOn: next.dueOn }, `an extended day comes after the due day (${next.dueOn})`)\n if (!!next.extendedDueOn !== !!next.extensionReason?.trim()) return new Refusal('privacy-request-extension-reason', {}, 'an extension gives both its new day and its reason')\n if (next.repliedOn && !next.handling?.trim()) return new Refusal('privacy-request-handling-required', {}, 'write how it was handled before the day it was answered')\n return null\n}\n\nexport interface PrivacyIncidentInput {\n knownAt?: Date | string | null\n certainty?: string | null\n items?: string | null\n subjectCount?: number | null\n subjectsToldAt?: Date | string | null\n reportedAt?: Date | string | null\n}\n\nconst moment = (value: Date | string | null | undefined) => (value ? new Date(value as any) : null)\nconst valid = (value: Date | null) => !!value && !isNaN(value.getTime())\n\n/** What an incident asks for before it is written, or nothing. */\nexport function privacyIncidentRefusal(input: PrivacyIncidentInput): Refusal | null {\n const knownAt = moment(input.knownAt)\n if (!valid(knownAt)) return new Refusal('privacy-incident-known-at-required', {}, 'give the time it became known')\n if (!INCIDENT_CERTAINTIES.includes(input.certainty ?? '')) return new Refusal('privacy-incident-certainty-required', {}, 'say whether it is confirmed or possible')\n if (!input.items?.trim()) return new Refusal('privacy-incident-items-required', {}, 'say which items of personal information')\n if (input.subjectCount !== undefined && input.subjectCount !== null && !(Number.isInteger(input.subjectCount) && input.subjectCount >= 0))\n return new Refusal('privacy-incident-count-invalid', {}, 'give the number of people as a whole number of 0 or more')\n for (const field of ['subjectsToldAt', 'reportedAt'] as const) {\n const at = moment(input[field])\n if (input[field] && (!valid(at) || at!.getTime() < knownAt!.getTime())) return new Refusal(`privacy-incident-${kebabOf(field)}-before-known`, {}, `${field} cannot be before the time it became known`)\n }\n return null\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EntityManager } from 'typeorm';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
import { PrivacyIncident, PrivacyRequest } from './privacy-record';
|
|
4
|
+
import { NewMyPrivacyRequest, PrivacyIncidentPatch, PrivacyRequestPatch } from './privacy-record-type';
|
|
5
|
+
export declare const PRIVACY_REQUEST_KIND = "PrivacyRequest";
|
|
6
|
+
export declare const PRIVACY_INCIDENT_KIND = "PrivacyIncident";
|
|
7
|
+
/** An employee raises a request of their own - a partner, or an account with no employee record, is refused. */
|
|
8
|
+
export declare function raiseMyPrivacyRequest(input: NewMyPrivacyRequest, context: any): Promise<PrivacyRequest>;
|
|
9
|
+
/** The requests the request's employee raised, newest first. */
|
|
10
|
+
export declare function myPrivacyRequests(context: any): Promise<PrivacyRequest[]>;
|
|
11
|
+
/** The manager writes requests - new ones from outside or by an employee, and their handling. */
|
|
12
|
+
export declare function savePrivacyRequests(patches: PrivacyRequestPatch[], context: any): Promise<PrivacyRequest[]>;
|
|
13
|
+
/** The manager writes incidents - new ones, and what followed: the subjects told, the report, the measures. */
|
|
14
|
+
export declare function savePrivacyIncidents(patches: PrivacyIncidentPatch[], context: any): Promise<PrivacyIncident[]>;
|
|
15
|
+
/** Requests not answered past the day they are due - the extended day when extended. */
|
|
16
|
+
export declare function privacyRequestsOverdue(tx: EntityManager, domain: Domain, today: string): Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
kind: string;
|
|
19
|
+
receivedOn: string;
|
|
20
|
+
dueOn: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Incidents not yet both reported and told, with the hours left to their due moment - below zero once past. Counted
|
|
24
|
+
* in hours from `now`, the 72 hours of the law to the minute.
|
|
25
|
+
*/
|
|
26
|
+
export declare function privacyIncidentsDue(tx: EntityManager, domain: Domain, now?: Date): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
knownAt: Date;
|
|
29
|
+
dueAt: Date;
|
|
30
|
+
hoursLeft: number;
|
|
31
|
+
reported: boolean;
|
|
32
|
+
told: boolean;
|
|
33
|
+
}[]>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRIVACY_INCIDENT_KIND = exports.PRIVACY_REQUEST_KIND = void 0;
|
|
4
|
+
exports.raiseMyPrivacyRequest = raiseMyPrivacyRequest;
|
|
5
|
+
exports.myPrivacyRequests = myPrivacyRequests;
|
|
6
|
+
exports.savePrivacyRequests = savePrivacyRequests;
|
|
7
|
+
exports.savePrivacyIncidents = savePrivacyIncidents;
|
|
8
|
+
exports.privacyRequestsOverdue = privacyRequestsOverdue;
|
|
9
|
+
exports.privacyIncidentsDue = privacyIncidentsDue;
|
|
10
|
+
const typeorm_1 = require("typeorm");
|
|
11
|
+
const organization_1 = require("@things-factory/organization");
|
|
12
|
+
const shell_1 = require("@things-factory/shell");
|
|
13
|
+
const correction_1 = require("../common/correction");
|
|
14
|
+
const employee_reader_1 = require("../common/employee-reader");
|
|
15
|
+
const privacy_record_1 = require("./privacy-record");
|
|
16
|
+
const privacy_record_rules_1 = require("./privacy-record-rules");
|
|
17
|
+
/*
|
|
18
|
+
* 개인정보 요구와 사고 (ADR-0187 decision 22) and the database. Written by the holders of `privacy-record`
|
|
19
|
+
* (`compliance.managing`); an employee raises and reads only their own requests. Nothing is deleted - a value changed
|
|
20
|
+
* after it was written keeps a correction.
|
|
21
|
+
*/
|
|
22
|
+
exports.PRIVACY_REQUEST_KIND = 'PrivacyRequest';
|
|
23
|
+
exports.PRIVACY_INCIDENT_KIND = 'PrivacyIncident';
|
|
24
|
+
const REQUEST_FIELDS = ['requesterEmployeeId', 'requesterName', 'requesterContact', 'kind', 'details', 'receivedOn', 'dueOn', 'extendedDueOn', 'extensionReason', 'handling', 'repliedOn'];
|
|
25
|
+
const INCIDENT_FIELDS = ['knownAt', 'dueAt', 'certainty', 'items', 'subjectCount', 'subjectsToldAt', 'subjectsToldHow', 'reportedAt', 'reportReceiptNo', 'measures'];
|
|
26
|
+
const text = (value) => (typeof value === 'string' ? (value.trim() ? value.trim() : null) : value === undefined ? undefined : value);
|
|
27
|
+
const notFound = (what) => new shell_1.Refusal(`${what}-not-found`, {}, 'the record was not found. reload and try again.');
|
|
28
|
+
/** The fields a patch names, emptied strings as null. */
|
|
29
|
+
function valuesOf(patch, fields) {
|
|
30
|
+
const values = {};
|
|
31
|
+
for (const field of fields)
|
|
32
|
+
if (patch[field] !== undefined)
|
|
33
|
+
values[field] = text(patch[field]);
|
|
34
|
+
return values;
|
|
35
|
+
}
|
|
36
|
+
/** An employee raises a request of their own - a partner, or an account with no employee record, is refused. */
|
|
37
|
+
async function raiseMyPrivacyRequest(input, context) {
|
|
38
|
+
const { domain, user, tx } = context.state;
|
|
39
|
+
const me = await (0, employee_reader_1.requireWorkingEmployee)(context);
|
|
40
|
+
const receivedOn = (0, employee_reader_1.todayIn)(domain);
|
|
41
|
+
const refusal = (0, privacy_record_rules_1.privacyRequestRefusal)({ ...input, receivedOn, hasEmployee: true });
|
|
42
|
+
if (refusal)
|
|
43
|
+
throw refusal;
|
|
44
|
+
const repository = tx.getRepository(privacy_record_1.PrivacyRequest);
|
|
45
|
+
return await repository.save(repository.create({ domain, requesterEmployee: me, kind: input.kind, details: input.details.trim(), receivedOn, dueOn: (0, privacy_record_rules_1.requestDueOn)(receivedOn), creator: user, updater: user }));
|
|
46
|
+
}
|
|
47
|
+
/** The requests the request's employee raised, newest first. */
|
|
48
|
+
async function myPrivacyRequests(context) {
|
|
49
|
+
const { domain } = context.state;
|
|
50
|
+
const me = await (0, employee_reader_1.requireWorkingEmployee)(context);
|
|
51
|
+
return await (0, shell_1.getRepository)(privacy_record_1.PrivacyRequest).find({ where: { domain: { id: domain.id }, requesterEmployee: { id: me.id } }, order: { receivedOn: 'DESC', createdAt: 'DESC' } });
|
|
52
|
+
}
|
|
53
|
+
/** The manager writes requests - new ones from outside or by an employee, and their handling. */
|
|
54
|
+
async function savePrivacyRequests(patches, context) {
|
|
55
|
+
const { domain, user, tx } = context.state;
|
|
56
|
+
const repository = tx.getRepository(privacy_record_1.PrivacyRequest);
|
|
57
|
+
const saved = [];
|
|
58
|
+
for (const patch of patches) {
|
|
59
|
+
const values = valuesOf(patch, REQUEST_FIELDS);
|
|
60
|
+
const fresh = patch.cuFlag === '+' || !patch.id;
|
|
61
|
+
const row = fresh ? repository.create({ domain, creator: user }) : await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } });
|
|
62
|
+
if (!row)
|
|
63
|
+
throw notFound('privacy-request');
|
|
64
|
+
const before = { ...row };
|
|
65
|
+
if (values.requesterEmployeeId !== undefined) {
|
|
66
|
+
const employee = values.requesterEmployeeId ? await tx.getRepository(organization_1.Employee).findOne({ where: { id: values.requesterEmployeeId, domain: { id: domain.id } } }) : null;
|
|
67
|
+
if (values.requesterEmployeeId && !employee)
|
|
68
|
+
throw new shell_1.Refusal('privacy-request-requester-unknown', {}, 'the one who asked must be an employee of this domain');
|
|
69
|
+
row.requesterEmployee = employee;
|
|
70
|
+
}
|
|
71
|
+
const next = { ...row, requesterEmployeeId: row.requesterEmployee ? row.requesterEmployee.id : row.requesterEmployeeId, ...values };
|
|
72
|
+
if (next.receivedOn)
|
|
73
|
+
next.dueOn = (0, privacy_record_rules_1.requestDueOn)(next.receivedOn);
|
|
74
|
+
const refusal = (0, privacy_record_rules_1.privacyRequestRefusal)({ kind: next.kind, receivedOn: next.receivedOn, requesterName: next.requesterName, hasEmployee: !!next.requesterEmployeeId, details: next.details }) ?? (0, privacy_record_rules_1.privacyHandlingRefusal)(next);
|
|
75
|
+
if (refusal)
|
|
76
|
+
throw refusal;
|
|
77
|
+
Object.assign(row, { ...values, dueOn: next.dueOn, updater: user });
|
|
78
|
+
delete row.requesterEmployeeId;
|
|
79
|
+
const written = await repository.save(row);
|
|
80
|
+
if (!fresh)
|
|
81
|
+
await (0, correction_1.recordCorrections)(tx, domain, user, { kind: exports.PRIVACY_REQUEST_KIND, id: written.id }, before, { ...values, dueOn: next.dueOn }, REQUEST_FIELDS);
|
|
82
|
+
saved.push(written);
|
|
83
|
+
}
|
|
84
|
+
return saved;
|
|
85
|
+
}
|
|
86
|
+
/** The manager writes incidents - new ones, and what followed: the subjects told, the report, the measures. */
|
|
87
|
+
async function savePrivacyIncidents(patches, context) {
|
|
88
|
+
const { domain, user, tx } = context.state;
|
|
89
|
+
const repository = tx.getRepository(privacy_record_1.PrivacyIncident);
|
|
90
|
+
const saved = [];
|
|
91
|
+
for (const patch of patches) {
|
|
92
|
+
const values = valuesOf(patch, INCIDENT_FIELDS);
|
|
93
|
+
for (const field of ['knownAt', 'subjectsToldAt', 'reportedAt'])
|
|
94
|
+
if (values[field])
|
|
95
|
+
values[field] = new Date(values[field]);
|
|
96
|
+
const fresh = patch.cuFlag === '+' || !patch.id;
|
|
97
|
+
const row = fresh ? repository.create({ domain, creator: user }) : await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } });
|
|
98
|
+
if (!row)
|
|
99
|
+
throw notFound('privacy-incident');
|
|
100
|
+
const before = { ...row };
|
|
101
|
+
const next = { ...row, ...values };
|
|
102
|
+
const refusal = (0, privacy_record_rules_1.privacyIncidentRefusal)(next);
|
|
103
|
+
if (refusal)
|
|
104
|
+
throw refusal;
|
|
105
|
+
if (values.knownAt)
|
|
106
|
+
values.dueAt = (0, privacy_record_rules_1.incidentDueAt)(values.knownAt);
|
|
107
|
+
Object.assign(row, { ...values, updater: user });
|
|
108
|
+
const written = await repository.save(row);
|
|
109
|
+
if (!fresh)
|
|
110
|
+
await (0, correction_1.recordCorrections)(tx, domain, user, { kind: exports.PRIVACY_INCIDENT_KIND, id: written.id }, before, values, INCIDENT_FIELDS);
|
|
111
|
+
saved.push(written);
|
|
112
|
+
}
|
|
113
|
+
return saved;
|
|
114
|
+
}
|
|
115
|
+
/*
|
|
116
|
+
* ---------------------------------------------------------------- the management check (ADR-0146)
|
|
117
|
+
*/
|
|
118
|
+
/** Requests not answered past the day they are due - the extended day when extended. */
|
|
119
|
+
async function privacyRequestsOverdue(tx, domain, today) {
|
|
120
|
+
const open = await tx.getRepository(privacy_record_1.PrivacyRequest).find({ where: { domain: { id: domain.id }, repliedOn: (0, typeorm_1.IsNull)() }, order: { receivedOn: 'ASC' } });
|
|
121
|
+
return open.filter(one => (0, privacy_record_rules_1.requestOverdue)(one, today)).map(one => ({ id: one.id, kind: one.kind, receivedOn: one.receivedOn, dueOn: one.extendedDueOn || one.dueOn }));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Incidents not yet both reported and told, with the hours left to their due moment - below zero once past. Counted
|
|
125
|
+
* in hours from `now`, the 72 hours of the law to the minute.
|
|
126
|
+
*/
|
|
127
|
+
async function privacyIncidentsDue(tx, domain, now = new Date()) {
|
|
128
|
+
const rows = await tx.getRepository(privacy_record_1.PrivacyIncident).find({ where: { domain: { id: domain.id } }, order: { dueAt: 'ASC' } });
|
|
129
|
+
return rows
|
|
130
|
+
.filter(privacy_record_rules_1.incidentOpen)
|
|
131
|
+
.map(one => ({ id: one.id, knownAt: new Date(one.knownAt), dueAt: new Date(one.dueAt), hoursLeft: (0, privacy_record_rules_1.hoursLeft)(new Date(one.dueAt), now), reported: !!one.reportedAt, told: !!one.subjectsToldAt }));
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=privacy-record-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-record-service.js","sourceRoot":"","sources":["../../../server/service/privacy-record/privacy-record-service.ts"],"names":[],"mappings":";;;AAkCA,sDAUC;AAGD,8CAIC;AAGD,kDA6BC;AAGD,oDAqBC;AAOD,wDAGC;AAMD,kDASC;AApID,qCAA+C;AAE/C,+DAAuD;AACvD,iDAAsE;AAEtE,qDAAwD;AACxD,+DAA2E;AAC3E,qDAAkE;AAClE,iEAAoL;AAGpL;;;;GAIG;AAEU,QAAA,oBAAoB,GAAG,gBAAgB,CAAA;AACvC,QAAA,qBAAqB,GAAG,iBAAiB,CAAA;AAEtD,MAAM,cAAc,GAAG,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AE,CAAC,IAAA,qCAAc,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;AACvK,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CACvC,EAAiB,EACjB,MAAc,EACd,MAAY,IAAI,IAAI,EAAE;IAEtB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,gCAAe,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAS,EAAE,CAAC,CAAA;IAC1I,OAAO,IAAI;SACR,MAAM,CAAC,mCAAY,CAAC;SACpB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAA,gCAAS,EAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC,CAAA;AACrM,CAAC","sourcesContent":["import { EntityManager, IsNull } from 'typeorm'\n\nimport { Employee } from '@things-factory/organization'\nimport { Domain, getRepository, Refusal } from '@things-factory/shell'\n\nimport { recordCorrections } from '../common/correction'\nimport { requireWorkingEmployee, todayIn } from '../common/employee-reader'\nimport { PrivacyIncident, PrivacyRequest } from './privacy-record'\nimport { hoursLeft, incidentDueAt, incidentOpen, privacyHandlingRefusal, privacyIncidentRefusal, privacyRequestRefusal, requestDueOn, requestOverdue } from './privacy-record-rules'\nimport { NewMyPrivacyRequest, PrivacyIncidentPatch, PrivacyRequestPatch } from './privacy-record-type'\n\n/*\n * 개인정보 요구와 사고 (ADR-0187 decision 22) and the database. Written by the holders of `privacy-record`\n * (`compliance.managing`); an employee raises and reads only their own requests. Nothing is deleted - a value changed\n * after it was written keeps a correction.\n */\n\nexport const PRIVACY_REQUEST_KIND = 'PrivacyRequest'\nexport const PRIVACY_INCIDENT_KIND = 'PrivacyIncident'\n\nconst REQUEST_FIELDS = ['requesterEmployeeId', 'requesterName', 'requesterContact', 'kind', 'details', 'receivedOn', 'dueOn', 'extendedDueOn', 'extensionReason', 'handling', 'repliedOn']\nconst INCIDENT_FIELDS = ['knownAt', 'dueAt', 'certainty', 'items', 'subjectCount', 'subjectsToldAt', 'subjectsToldHow', 'reportedAt', 'reportReceiptNo', 'measures']\n\nconst text = (value: unknown) => (typeof value === 'string' ? (value.trim() ? value.trim() : null) : value === undefined ? undefined : (value as any))\nconst notFound = (what: string) => new Refusal(`${what}-not-found`, {}, 'the record was not found. reload and try again.')\n\n/** The fields a patch names, emptied strings as null. */\nfunction valuesOf(patch: Record<string, any>, fields: readonly string[]): Record<string, any> {\n const values: Record<string, any> = {}\n for (const field of fields) if (patch[field] !== undefined) values[field] = text(patch[field])\n return values\n}\n\n/** An employee raises a request of their own - a partner, or an account with no employee record, is refused. */\nexport async function raiseMyPrivacyRequest(input: NewMyPrivacyRequest, context: any): Promise<PrivacyRequest> {\n const { domain, user, tx } = context.state\n const me = await requireWorkingEmployee(context)\n const receivedOn = todayIn(domain)\n const refusal = privacyRequestRefusal({ ...input, receivedOn, hasEmployee: true })\n if (refusal) throw refusal\n const repository = tx.getRepository(PrivacyRequest)\n return await repository.save(\n repository.create({ domain, requesterEmployee: me, kind: input.kind, details: input.details.trim(), receivedOn, dueOn: requestDueOn(receivedOn), creator: user, updater: user } as any) as unknown as PrivacyRequest\n )\n}\n\n/** The requests the request's employee raised, newest first. */\nexport async function myPrivacyRequests(context: any): Promise<PrivacyRequest[]> {\n const { domain } = context.state\n const me = await requireWorkingEmployee(context)\n return await getRepository(PrivacyRequest).find({ where: { domain: { id: domain.id }, requesterEmployee: { id: me.id } } as any, order: { receivedOn: 'DESC', createdAt: 'DESC' } as any })\n}\n\n/** The manager writes requests - new ones from outside or by an employee, and their handling. */\nexport async function savePrivacyRequests(patches: PrivacyRequestPatch[], context: any): Promise<PrivacyRequest[]> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(PrivacyRequest)\n const saved: PrivacyRequest[] = []\n for (const patch of patches) {\n const values = valuesOf(patch, REQUEST_FIELDS)\n const fresh = patch.cuFlag === '+' || !patch.id\n const row = fresh ? (repository.create({ domain, creator: user } as any) as unknown as PrivacyRequest) : await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } as any })\n if (!row) throw notFound('privacy-request')\n const before: Record<string, any> = { ...row }\n\n if (values.requesterEmployeeId !== undefined) {\n const employee = values.requesterEmployeeId ? await tx.getRepository(Employee).findOne({ where: { id: values.requesterEmployeeId, domain: { id: domain.id } } as any }) : null\n if (values.requesterEmployeeId && !employee) throw new Refusal('privacy-request-requester-unknown', {}, 'the one who asked must be an employee of this domain')\n row.requesterEmployee = employee\n }\n const next: Record<string, any> = { ...row, requesterEmployeeId: row.requesterEmployee ? row.requesterEmployee.id : row.requesterEmployeeId, ...values }\n if (next.receivedOn) next.dueOn = requestDueOn(next.receivedOn)\n const refusal =\n privacyRequestRefusal({ kind: next.kind, receivedOn: next.receivedOn, requesterName: next.requesterName, hasEmployee: !!next.requesterEmployeeId, details: next.details }) ?? privacyHandlingRefusal(next as any)\n if (refusal) throw refusal\n\n Object.assign(row, { ...values, dueOn: next.dueOn, updater: user })\n delete (row as any).requesterEmployeeId\n const written = await repository.save(row)\n if (!fresh) await recordCorrections(tx, domain, user, { kind: PRIVACY_REQUEST_KIND, id: written.id }, before, { ...values, dueOn: next.dueOn }, REQUEST_FIELDS)\n saved.push(written)\n }\n return saved\n}\n\n/** The manager writes incidents - new ones, and what followed: the subjects told, the report, the measures. */\nexport async function savePrivacyIncidents(patches: PrivacyIncidentPatch[], context: any): Promise<PrivacyIncident[]> {\n const { domain, user, tx } = context.state\n const repository = tx.getRepository(PrivacyIncident)\n const saved: PrivacyIncident[] = []\n for (const patch of patches) {\n const values = valuesOf(patch, INCIDENT_FIELDS)\n for (const field of ['knownAt', 'subjectsToldAt', 'reportedAt']) if (values[field]) values[field] = new Date(values[field])\n const fresh = patch.cuFlag === '+' || !patch.id\n const row = fresh ? (repository.create({ domain, creator: user } as any) as unknown as PrivacyIncident) : await repository.findOne({ where: { id: patch.id, domain: { id: domain.id } } as any })\n if (!row) throw notFound('privacy-incident')\n const before: Record<string, any> = { ...row }\n const next: Record<string, any> = { ...row, ...values }\n const refusal = privacyIncidentRefusal(next)\n if (refusal) throw refusal\n if (values.knownAt) values.dueAt = incidentDueAt(values.knownAt)\n Object.assign(row, { ...values, updater: user })\n const written = await repository.save(row)\n if (!fresh) await recordCorrections(tx, domain, user, { kind: PRIVACY_INCIDENT_KIND, id: written.id }, before, values, INCIDENT_FIELDS)\n saved.push(written)\n }\n return saved\n}\n\n/*\n * ---------------------------------------------------------------- the management check (ADR-0146)\n */\n\n/** Requests not answered past the day they are due - the extended day when extended. */\nexport async function privacyRequestsOverdue(tx: EntityManager, domain: Domain, today: string): Promise<{ id: string; kind: string; receivedOn: string; dueOn: string }[]> {\n const open = await tx.getRepository(PrivacyRequest).find({ where: { domain: { id: domain.id }, repliedOn: IsNull() } as any, order: { receivedOn: 'ASC' } as any })\n return open.filter(one => requestOverdue(one, today)).map(one => ({ id: one.id, kind: one.kind, receivedOn: one.receivedOn, dueOn: one.extendedDueOn || one.dueOn }))\n}\n\n/**\n * Incidents not yet both reported and told, with the hours left to their due moment - below zero once past. Counted\n * in hours from `now`, the 72 hours of the law to the minute.\n */\nexport async function privacyIncidentsDue(\n tx: EntityManager,\n domain: Domain,\n now: Date = new Date()\n): Promise<{ id: string; knownAt: Date; dueAt: Date; hoursLeft: number; reported: boolean; told: boolean }[]> {\n const rows = await tx.getRepository(PrivacyIncident).find({ where: { domain: { id: domain.id } } as any, order: { dueAt: 'ASC' } as any })\n return rows\n .filter(incidentOpen)\n .map(one => ({ id: one.id, knownAt: new Date(one.knownAt), dueAt: new Date(one.dueAt), hoursLeft: hoursLeft(new Date(one.dueAt), now), reported: !!one.reportedAt, told: !!one.subjectsToldAt }))\n}\n\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PrivacyIncident, PrivacyIncidentCertainty, PrivacyRequest, PrivacyRequestKind } from './privacy-record';
|
|
2
|
+
export declare class NewMyPrivacyRequest {
|
|
3
|
+
kind: PrivacyRequestKind;
|
|
4
|
+
details: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class PrivacyRequestPatch {
|
|
7
|
+
id?: string;
|
|
8
|
+
cuFlag?: string;
|
|
9
|
+
requesterEmployeeId?: string;
|
|
10
|
+
requesterName?: string;
|
|
11
|
+
requesterContact?: string;
|
|
12
|
+
kind?: PrivacyRequestKind;
|
|
13
|
+
details?: string;
|
|
14
|
+
receivedOn?: string;
|
|
15
|
+
extendedDueOn?: string;
|
|
16
|
+
extensionReason?: string;
|
|
17
|
+
handling?: string;
|
|
18
|
+
repliedOn?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class PrivacyIncidentPatch {
|
|
21
|
+
id?: string;
|
|
22
|
+
cuFlag?: string;
|
|
23
|
+
knownAt?: Date;
|
|
24
|
+
certainty?: PrivacyIncidentCertainty;
|
|
25
|
+
items?: string;
|
|
26
|
+
subjectCount?: number;
|
|
27
|
+
subjectsToldAt?: Date;
|
|
28
|
+
subjectsToldHow?: string;
|
|
29
|
+
reportedAt?: Date;
|
|
30
|
+
reportReceiptNo?: string;
|
|
31
|
+
measures?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class PrivacyRequestList {
|
|
34
|
+
items: PrivacyRequest[];
|
|
35
|
+
total: number;
|
|
36
|
+
}
|
|
37
|
+
export declare class PrivacyIncidentList {
|
|
38
|
+
items: PrivacyIncident[];
|
|
39
|
+
total: number;
|
|
40
|
+
}
|