@nymbalhq/platform 1.0.0 → 1.2.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.
- package/dist/chunk-UBEGSSFI.js +5332 -0
- package/dist/chunk-UBEGSSFI.js.map +1 -0
- package/dist/{chunk-PW6ILJF7.js → chunk-XVUH34US.js} +138 -10
- package/dist/chunk-XVUH34US.js.map +1 -0
- package/dist/db/schema/index.d.ts +3717 -2105
- package/dist/db/schema/index.js +1 -2
- package/dist/index.d.ts +499 -44
- package/dist/index.js +2227 -1888
- package/dist/index.js.map +1 -1
- package/dist/register-NHG3TIRQ.js +8 -0
- package/migrations/postgres/0007_native_search.sql +12 -0
- package/migrations/postgres/0008_event_correlation.sql +6 -0
- package/migrations/postgres/0009_settings.sql +13 -0
- package/migrations/postgres/0010_catch_up_index.sql +2 -0
- package/migrations/postgres/0011_audit_entries.sql +27 -0
- package/migrations/postgres/meta/0007_snapshot.json +1598 -0
- package/migrations/postgres/meta/0008_snapshot.json +1625 -0
- package/migrations/postgres/meta/0009_snapshot.json +1705 -0
- package/migrations/postgres/meta/0010_snapshot.json +1732 -0
- package/migrations/postgres/meta/0011_snapshot.json +1887 -0
- package/migrations/postgres/meta/_journal.json +35 -0
- package/migrations/sqlite/0007_native_search.sql +39 -0
- package/migrations/sqlite/0008_event_correlation.sql +7 -0
- package/migrations/sqlite/0009_settings.sql +13 -0
- package/migrations/sqlite/0010_catch_up_index.sql +2 -0
- package/migrations/sqlite/0011_audit_entries.sql +26 -0
- package/migrations/sqlite/meta/0007_snapshot.json +1470 -0
- package/migrations/sqlite/meta/0008_snapshot.json +1485 -0
- package/migrations/sqlite/meta/0009_snapshot.json +1571 -0
- package/migrations/sqlite/meta/0010_snapshot.json +1580 -0
- package/migrations/sqlite/meta/0011_snapshot.json +1705 -0
- package/migrations/sqlite/meta/_journal.json +35 -0
- package/package.json +45 -17
- package/recipes/postgres.json +17 -0
- package/dist/chunk-74KODSYJ.js +0 -2564
- package/dist/chunk-74KODSYJ.js.map +0 -1
- package/dist/chunk-PW6ILJF7.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/register-IVFYBJSX.js +0 -8
- package/dist/register-IVFYBJSX.js.map +0 -1
- /package/dist/{chunk-PZ5AY32C.js.map → register-NHG3TIRQ.js.map} +0 -0
|
@@ -50,6 +50,41 @@
|
|
|
50
50
|
"when": 1792397472998,
|
|
51
51
|
"tag": "0006_minor_dragon_man",
|
|
52
52
|
"breakpoints": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"idx": 7,
|
|
56
|
+
"version": "7",
|
|
57
|
+
"when": 1792550523604,
|
|
58
|
+
"tag": "0007_native_search",
|
|
59
|
+
"breakpoints": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"idx": 8,
|
|
63
|
+
"version": "7",
|
|
64
|
+
"when": 1792609200206,
|
|
65
|
+
"tag": "0008_event_correlation",
|
|
66
|
+
"breakpoints": true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"idx": 9,
|
|
70
|
+
"version": "7",
|
|
71
|
+
"when": 1792617492782,
|
|
72
|
+
"tag": "0009_settings",
|
|
73
|
+
"breakpoints": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"idx": 10,
|
|
77
|
+
"version": "7",
|
|
78
|
+
"when": 1792645028362,
|
|
79
|
+
"tag": "0010_catch_up_index",
|
|
80
|
+
"breakpoints": true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"idx": 11,
|
|
84
|
+
"version": "7",
|
|
85
|
+
"when": 1792659500377,
|
|
86
|
+
"tag": "0011_audit_entries",
|
|
87
|
+
"breakpoints": true
|
|
53
88
|
}
|
|
54
89
|
]
|
|
55
90
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
-- The native search index. Rows are keyed by `id` (an upsert is a point write); `rid` is an INTEGER PRIMARY KEY so
|
|
2
|
+
-- the external-content FTS5 index keys on a rowid that VACUUM cannot renumber. The *_terms columns hold the adapter's
|
|
3
|
+
-- normalised terms, space-joined, so unicode61 sees exactly those tokens. The triggers keep the index in step.
|
|
4
|
+
CREATE TABLE `search_documents` (
|
|
5
|
+
`rid` integer PRIMARY KEY,
|
|
6
|
+
`id` text NOT NULL UNIQUE,
|
|
7
|
+
`type` text NOT NULL,
|
|
8
|
+
`fields` text NOT NULL,
|
|
9
|
+
`category_ids` text DEFAULT '[]' NOT NULL,
|
|
10
|
+
`name_terms` text DEFAULT '' NOT NULL,
|
|
11
|
+
`strong_terms` text DEFAULT '' NOT NULL,
|
|
12
|
+
`body_terms` text DEFAULT '' NOT NULL
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
CREATE VIRTUAL TABLE `search_documents_fts` USING fts5(
|
|
16
|
+
name_terms,
|
|
17
|
+
strong_terms,
|
|
18
|
+
body_terms,
|
|
19
|
+
content='search_documents',
|
|
20
|
+
content_rowid='rid',
|
|
21
|
+
tokenize='unicode61'
|
|
22
|
+
);
|
|
23
|
+
--> statement-breakpoint
|
|
24
|
+
CREATE TRIGGER `search_documents_ai` AFTER INSERT ON `search_documents` BEGIN
|
|
25
|
+
INSERT INTO search_documents_fts (rowid, name_terms, strong_terms, body_terms)
|
|
26
|
+
VALUES (new.rid, new.name_terms, new.strong_terms, new.body_terms);
|
|
27
|
+
END;
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE TRIGGER `search_documents_ad` AFTER DELETE ON `search_documents` BEGIN
|
|
30
|
+
INSERT INTO search_documents_fts (search_documents_fts, rowid, name_terms, strong_terms, body_terms)
|
|
31
|
+
VALUES ('delete', old.rid, old.name_terms, old.strong_terms, old.body_terms);
|
|
32
|
+
END;
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
CREATE TRIGGER `search_documents_au` AFTER UPDATE ON `search_documents` BEGIN
|
|
35
|
+
INSERT INTO search_documents_fts (search_documents_fts, rowid, name_terms, strong_terms, body_terms)
|
|
36
|
+
VALUES ('delete', old.rid, old.name_terms, old.strong_terms, old.body_terms);
|
|
37
|
+
INSERT INTO search_documents_fts (rowid, name_terms, strong_terms, body_terms)
|
|
38
|
+
VALUES (new.rid, new.name_terms, new.strong_terms, new.body_terms);
|
|
39
|
+
END;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- The correlation id as a column, so one operation's events are an index range. SQLite adds a NOT NULL column only
|
|
2
|
+
-- with a default; a table rebuild instead would reset the AUTOINCREMENT high-water mark when retention has deleted the
|
|
3
|
+
-- newest rows, and reuse their seqs. Every existing row is backfilled from its envelope, else its own id (the builder's
|
|
4
|
+
-- default), so no row keeps the placeholder.
|
|
5
|
+
ALTER TABLE `events` ADD `correlation_id` text DEFAULT '' NOT NULL;--> statement-breakpoint
|
|
6
|
+
UPDATE `events` SET `correlation_id` = COALESCE(json_extract(`envelope`, '$.correlationId'), `id`);--> statement-breakpoint
|
|
7
|
+
CREATE INDEX `events_correlation_idx` ON `events` (`correlation_id`,`seq`);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE `settings` (
|
|
2
|
+
`slot` text NOT NULL,
|
|
3
|
+
`path` text NOT NULL,
|
|
4
|
+
`ciphertext` blob,
|
|
5
|
+
`plain` text,
|
|
6
|
+
`iv` blob,
|
|
7
|
+
`tag` blob,
|
|
8
|
+
`key_id` text,
|
|
9
|
+
`updated_at` text NOT NULL,
|
|
10
|
+
`updated_by` text,
|
|
11
|
+
PRIMARY KEY(`slot`, `path`),
|
|
12
|
+
CONSTRAINT "settings_one_value" CHECK(("settings"."ciphertext" IS NULL) <> ("settings"."plain" IS NULL) AND ("settings"."ciphertext" IS NULL OR ("settings"."iv" IS NOT NULL AND "settings"."tag" IS NOT NULL AND "settings"."key_id" IS NOT NULL)))
|
|
13
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
-- Append-only: rows are written once, in the command's transaction, and never updated, deleted or pruned.
|
|
2
|
+
CREATE TABLE `audit_entries` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`at` text NOT NULL,
|
|
5
|
+
`actor_kind` text NOT NULL,
|
|
6
|
+
`actor_id` text NOT NULL,
|
|
7
|
+
`command` text NOT NULL,
|
|
8
|
+
`subjects` text NOT NULL,
|
|
9
|
+
`correlation_id` text,
|
|
10
|
+
`idempotency_key` text,
|
|
11
|
+
`request_hash` text,
|
|
12
|
+
`outcome` text NOT NULL,
|
|
13
|
+
`response_status` integer,
|
|
14
|
+
`response_body` text,
|
|
15
|
+
CONSTRAINT "audit_entries_outcome" CHECK("audit_entries"."outcome" IN ('applied', 'refused', 'replayed'))
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
CREATE UNIQUE INDEX `audit_entries_applied_key_unique` ON `audit_entries` (`actor_id`,`command`,`idempotency_key`) WHERE "audit_entries"."outcome" = 'applied' AND "audit_entries"."idempotency_key" IS NOT NULL;--> statement-breakpoint
|
|
19
|
+
CREATE INDEX `audit_entries_at_idx` ON `audit_entries` (`at`,`id`);--> statement-breakpoint
|
|
20
|
+
CREATE INDEX `audit_entries_correlation_idx` ON `audit_entries` (`correlation_id`);--> statement-breakpoint
|
|
21
|
+
CREATE TRIGGER `audit_entries_no_update` BEFORE UPDATE ON `audit_entries` BEGIN
|
|
22
|
+
SELECT RAISE(ABORT, 'audit_entries is append-only');
|
|
23
|
+
END;--> statement-breakpoint
|
|
24
|
+
CREATE TRIGGER `audit_entries_no_delete` BEFORE DELETE ON `audit_entries` BEGIN
|
|
25
|
+
SELECT RAISE(ABORT, 'audit_entries is append-only');
|
|
26
|
+
END;
|