@geonosis/document 0.2.0 → 0.4.0

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.
@@ -7,11 +7,11 @@ create table if not exists "documents" (
7
7
  "updated_at" bigint not null,
8
8
  "retired_at" bigint,
9
9
  "version" integer not null default 1,
10
- "status" text,
11
- "issueDate" text,
12
- "dueDate" text,
10
+ "status" text not null,
11
+ "issue_date" text,
12
+ "due_date" text,
13
13
  "counterparty" text,
14
- "externalRef" text,
14
+ "external_ref" text,
15
15
  "revision" text,
16
16
  "total" numeric,
17
17
  constraint "documents_pkey" primary key ("tenant_id", "entity", "number")
@@ -19,38 +19,46 @@ create table if not exists "documents" (
19
19
 
20
20
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
21
21
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
22
- create index if not exists "documents_listing_idx" on "documents" ("tenant_id", "number" asc);
22
+ create index if not exists "documents_listing_idx" on "documents" ("tenant_id", "entity", "number" asc);
23
23
 
24
24
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
25
25
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
26
- create index if not exists "documents_by_status_idx" on "documents" ("tenant_id", "status" asc, "number" asc);
26
+ create index if not exists "documents_by_status_idx" on "documents" ("tenant_id", "entity", "status" asc, "number" asc);
27
27
 
28
28
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
29
29
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
30
- create index if not exists "documents_by_issueDate_idx" on "documents" ("tenant_id", "issueDate" asc, "number" asc);
30
+ create index if not exists "documents_by_issue_date_idx" on "documents" ("tenant_id", "entity", "issue_date" asc, "number" asc);
31
31
 
32
32
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
33
33
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
34
- create index if not exists "documents_by_dueDate_idx" on "documents" ("tenant_id", "dueDate" asc, "number" asc);
34
+ create index if not exists "documents_by_due_date_idx" on "documents" ("tenant_id", "entity", "due_date" asc, "number" asc);
35
35
 
36
36
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
37
37
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
38
- create index if not exists "documents_by_counterparty_idx" on "documents" ("tenant_id", "counterparty" asc, "number" asc);
38
+ create index if not exists "documents_by_counterparty_idx" on "documents" ("tenant_id", "entity", "counterparty" asc, "number" asc);
39
39
 
40
40
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
41
41
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
42
- create index if not exists "documents_by_externalRef_idx" on "documents" ("tenant_id", "externalRef" asc, "number" asc);
42
+ create index if not exists "documents_by_external_ref_idx" on "documents" ("tenant_id", "entity", "external_ref" asc, "number" asc);
43
43
 
44
44
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
45
45
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
46
- create index if not exists "documents_by_revision_idx" on "documents" ("tenant_id", "revision" asc, "number" asc);
46
+ create index if not exists "documents_by_revision_idx" on "documents" ("tenant_id", "entity", "revision" asc, "number" asc);
47
47
 
48
48
  -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
49
49
  -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
50
- create index if not exists "documents_by_total_idx" on "documents" ("tenant_id", "total" asc, "number" asc);
50
+ create index if not exists "documents_by_total_idx" on "documents" ("tenant_id", "entity", "total" asc, "number" asc);
51
51
 
52
- create index if not exists "documents_entity_issueDate_idx" on "documents" ("entity", "issueDate");
52
+ -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
53
+ -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
54
+ create index if not exists "documents_by_created_at_idx" on "documents" ("tenant_id", "entity", "created_at" asc, "number" asc);
53
55
 
54
- alter table "documents" add column if not exists "lineage" integer not null default 1;
56
+ -- The migrator applies this file inside a transaction, which is also why CONCURRENTLY is not available here; the index is created in the same migration as its table, over no rows. lock_timeout and statement_timeout are one deployment’s numbers, and a value written into shipped DDL imposes that deployment’s budget on every consumer: set them in the session that migrates.
57
+ -- squawk-ignore require-concurrent-index-creation, require-lock-timeout, require-statement-timeout
58
+ create index if not exists "documents_by_updated_at_idx" on "documents" ("tenant_id", "entity", "updated_at" asc, "number" asc);
55
59
 
56
60
  alter table "documents" add column if not exists "hash" text;
61
+
62
+ alter table "documents" add column if not exists "lineage" integer not null default 1;
63
+
64
+ create index if not exists "documents_entity_issue_date_idx" on "documents" ("entity", "issue_date");
@@ -3,15 +3,14 @@ create table if not exists "document_revisions" (
3
3
  "entity" text not null,
4
4
  "ref" text not null,
5
5
  "lineage" integer not null,
6
- "version" integer not null,
7
- "revision_kind" text not null,
6
+ "version" bigint not null,
8
7
  "body" jsonb not null,
9
8
  "actor" text not null,
10
9
  "reason" text,
11
10
  "at" bigint not null default (extract(epoch from clock_timestamp()) * 1000)::bigint,
12
11
  "prev_hash" text,
13
12
  "hash" text not null,
14
- "compensation_of" integer,
15
- constraint "document_revisions_pkey" primary key ("tenant_id", "entity", "ref", "lineage", "version"),
16
- constraint "document_revisions_revision_kind_check" check ("revision_kind" in ('committed', 'retired', 'reinstated'))
13
+ "compensation_of" bigint,
14
+ "revision_kind" text check ("revision_kind" in ('committed', 'retired', 'reinstated')) not null,
15
+ constraint "document_revisions_pkey" primary key ("tenant_id", "entity", "ref", "lineage", "version")
17
16
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/document",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "The abstract Document: an entity-first base every kind of paper-trail record extends, a derived entity registry whose name union keeps every consumer map total, and per-entity body versioning — engine-free, SQL-free, the pure core the store, the workflows and the wire contract build on.",
6
6
  "keywords": [
@@ -39,8 +39,7 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "@standard-schema/spec": "^1.1.0",
42
- "@geonosis/conformance": "^0.3.0",
43
- "@geonosis/db": "^0.8.0"
42
+ "@geonosis/db": "^0.10.0"
44
43
  },
45
44
  "devDependencies": {
46
45
  "embedded-postgres-17": "npm:embedded-postgres@17.10.0-beta.17",