@nodii/dsar 0.31.0 → 0.32.1
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/bind-pattern-a.d.ts +54 -2
- package/dist/bind-pattern-a.d.ts.map +1 -1
- package/dist/bind-pattern-a.js +502 -100
- package/dist/bind-pattern-a.js.map +1 -1
- package/dist/generated/embedded-proto-source.d.ts +1 -1
- package/dist/generated/embedded-proto-source.d.ts.map +1 -1
- package/dist/generated/embedded-proto-source.js +1 -1
- package/dist/generated/embedded-proto-source.js.map +1 -1
- package/dist/generated/package-version.d.ts +1 -1
- package/dist/generated/package-version.js +1 -1
- package/dist/grpc/dsar-service.d.ts +15 -5
- package/dist/grpc/dsar-service.d.ts.map +1 -1
- package/dist/grpc/dsar-service.js +9 -3
- package/dist/grpc/dsar-service.js.map +1 -1
- package/dist/handler-status.d.ts +24 -0
- package/dist/handler-status.d.ts.map +1 -0
- package/dist/handler-status.js +37 -0
- package/dist/handler-status.js.map +1 -0
- package/dist/hold-failure-mode.d.ts +6 -0
- package/dist/hold-failure-mode.d.ts.map +1 -1
- package/dist/hold-failure-mode.js +31 -1
- package/dist/hold-failure-mode.js.map +1 -1
- package/dist/identity.d.ts +278 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +876 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +57 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/orchestrator.d.ts +11 -3
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +97 -20
- package/dist/orchestrator.js.map +1 -1
- package/dist/rectify.d.ts +87 -0
- package/dist/rectify.d.ts.map +1 -0
- package/dist/rectify.js +194 -0
- package/dist/rectify.js.map +1 -0
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +15 -2
- package/dist/register.js.map +1 -1
- package/dist/retention.d.ts.map +1 -1
- package/dist/retention.js +6 -2
- package/dist/retention.js.map +1 -1
- package/dist/s3-artifact.d.ts +30 -1
- package/dist/s3-artifact.d.ts.map +1 -1
- package/dist/s3-artifact.js +34 -0
- package/dist/s3-artifact.js.map +1 -1
- package/dist/types.d.ts +57 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +47 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/proto/nodii/dsar/v1/dsar.proto +158 -9
- package/src/migrations/001-lifecycle-requests.sql +81 -2
- package/src/migrations/002-retention-schedules-own-table-checks.sql +56 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
-- 002 — retention_schedules CHECKs on the table's own schema (LIBS-107).
|
|
2
|
+
--
|
|
3
|
+
-- For services that copy these files into a VERSIONED migration runner
|
|
4
|
+
-- (Flyway / golang-migrate / alembic). Before @nodii/dsar 0.32.1 the
|
|
5
|
+
-- retention_schedules guards looked their constraint names up across every
|
|
6
|
+
-- schema, so a second schema in one database could get the table without its
|
|
7
|
+
-- anchor and window CHECKs; a versioned runner never re-applies 001, so this
|
|
8
|
+
-- file carries the fixed, idempotent DDL to add them. It is byte-identical to
|
|
9
|
+
-- createRetentionSchedulesTable().ddl. On a table already holding a row that
|
|
10
|
+
-- breaks a CHECK it fails, naming the constraint: fix or delete that row, then
|
|
11
|
+
-- apply this file again. Services using applyDsarMigrations() need nothing here.
|
|
12
|
+
|
|
13
|
+
CREATE TABLE IF NOT EXISTS retention_schedules (
|
|
14
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
15
|
+
jurisdiction TEXT NOT NULL,
|
|
16
|
+
document_class TEXT NOT NULL,
|
|
17
|
+
entity_kind TEXT NOT NULL,
|
|
18
|
+
retention_period TEXT NOT NULL,
|
|
19
|
+
anchor TEXT NOT NULL,
|
|
20
|
+
extended_by_proceeding BOOLEAN NOT NULL DEFAULT false,
|
|
21
|
+
statute_citation TEXT,
|
|
22
|
+
effective_from TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
23
|
+
effective_to TIMESTAMPTZ,
|
|
24
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
25
|
+
);
|
|
26
|
+
ALTER TABLE retention_schedules ADD COLUMN IF NOT EXISTS statute_citation TEXT;
|
|
27
|
+
ALTER TABLE retention_schedules ADD COLUMN IF NOT EXISTS effective_to TIMESTAMPTZ;
|
|
28
|
+
DO $retention_schedules_anchor$
|
|
29
|
+
BEGIN
|
|
30
|
+
IF NOT EXISTS (
|
|
31
|
+
SELECT 1 FROM pg_constraint
|
|
32
|
+
WHERE conname = 'retention_schedules_anchor_valid'
|
|
33
|
+
AND conrelid = 'retention_schedules'::regclass
|
|
34
|
+
) THEN
|
|
35
|
+
ALTER TABLE retention_schedules ADD CONSTRAINT retention_schedules_anchor_valid
|
|
36
|
+
CHECK (anchor IN ('creation', 'last_activity', 'relationship_end', 'filing'));
|
|
37
|
+
END IF;
|
|
38
|
+
END
|
|
39
|
+
$retention_schedules_anchor$;
|
|
40
|
+
DO $retention_schedules_window$
|
|
41
|
+
BEGIN
|
|
42
|
+
IF NOT EXISTS (
|
|
43
|
+
SELECT 1 FROM pg_constraint
|
|
44
|
+
WHERE conname = 'retention_schedules_window_valid'
|
|
45
|
+
AND conrelid = 'retention_schedules'::regclass
|
|
46
|
+
) THEN
|
|
47
|
+
ALTER TABLE retention_schedules ADD CONSTRAINT retention_schedules_window_valid
|
|
48
|
+
CHECK (effective_to IS NULL OR effective_to > effective_from);
|
|
49
|
+
END IF;
|
|
50
|
+
END
|
|
51
|
+
$retention_schedules_window$;
|
|
52
|
+
CREATE UNIQUE INDEX IF NOT EXISTS uq_retention_schedules_effective
|
|
53
|
+
ON retention_schedules (jurisdiction, document_class, entity_kind, effective_from);
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_retention_schedules_lookup
|
|
55
|
+
ON retention_schedules (jurisdiction, document_class, entity_kind)
|
|
56
|
+
WHERE effective_to IS NULL;
|