@crombolo/data 0.69.0 → 0.70.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/package.json +2 -2
- package/src/environments.ts +44 -0
- package/src/index.ts +15 -0
- package/src/relations.ts +2 -1
- package/src/repositories/changes.ts +525 -0
- package/src/repositories/content-types.ts +432 -4
- package/src/repositories/data-types.ts +141 -2
- package/src/repositories/documents.ts +1584 -78
- package/src/repositories/nodes.ts +47 -2
- package/src/repositories/transfer-runs.ts +6 -0
- package/src/repositories/workspace-files.ts +208 -0
- package/src/repositories/workspace-links.ts +97 -0
- package/src/repositories/workspaces.ts +547 -0
- package/src/schema/change-transfer.ts +30 -0
- package/src/schema/changes.ts +67 -0
- package/src/schema/content-places.ts +56 -0
- package/src/schema/environment-values.ts +27 -0
- package/src/schema/form-library-types.ts +2 -0
- package/src/schema/plan.ts +18 -0
- package/src/schema/seed.ts +5 -2
- package/src/schema/workspace-links.ts +37 -0
- package/src/schema/workspace-merge.ts +58 -0
- package/src/schema/workspace-privacy.ts +32 -0
- package/src/schema/workspace-schema.ts +113 -0
- package/src/schema/workspaces.ts +138 -0
- package/src/site-search.ts +1 -0
- package/src/tables.gen.ts +111 -0
- package/src/workspace-keys.ts +22 -0
package/src/tables.gen.ts
CHANGED
|
@@ -15,6 +15,12 @@ type Default<C> = C extends ColumnType<infer S, infer I, infer U>
|
|
|
15
15
|
: Generated<C>
|
|
16
16
|
|
|
17
17
|
export interface CoreTables {
|
|
18
|
+
applied_change: {
|
|
19
|
+
applied_at: Timestamp
|
|
20
|
+
change_key: string
|
|
21
|
+
name: string | null
|
|
22
|
+
run_id: string
|
|
23
|
+
}
|
|
18
24
|
approval_history: {
|
|
19
25
|
comment: string | null
|
|
20
26
|
create_date: Timestamp
|
|
@@ -136,6 +142,15 @@ export interface CoreTables {
|
|
|
136
142
|
kind: string
|
|
137
143
|
payload: string | null
|
|
138
144
|
}
|
|
145
|
+
change_item: {
|
|
146
|
+
after_hash: string | null
|
|
147
|
+
before_hash: string | null
|
|
148
|
+
class: string
|
|
149
|
+
id: Generated<number>
|
|
150
|
+
kind: string
|
|
151
|
+
path: string
|
|
152
|
+
run_id: string
|
|
153
|
+
}
|
|
139
154
|
change_report: {
|
|
140
155
|
code: string
|
|
141
156
|
culture: string | null
|
|
@@ -226,6 +241,7 @@ export interface CoreTables {
|
|
|
226
241
|
id: Generated<number>
|
|
227
242
|
language_id: number | null
|
|
228
243
|
node_id: number
|
|
244
|
+
workspace_id: number | null
|
|
229
245
|
}
|
|
230
246
|
content_transfer_change: {
|
|
231
247
|
action: string
|
|
@@ -242,9 +258,14 @@ export interface CoreTables {
|
|
|
242
258
|
bundle_id: string
|
|
243
259
|
bundle_label: string | null
|
|
244
260
|
bundle_type: string | null
|
|
261
|
+
change_key: string | null
|
|
262
|
+
change_kind: Generated<string>
|
|
263
|
+
closed_at: Timestamp | null
|
|
245
264
|
direction: string
|
|
246
265
|
finished_at: Timestamp | null
|
|
247
266
|
id: string
|
|
267
|
+
made_by: string | null
|
|
268
|
+
name: string | null
|
|
248
269
|
node_count: number
|
|
249
270
|
package_name: string | null
|
|
250
271
|
package_version: string | null
|
|
@@ -253,6 +274,7 @@ export interface CoreTables {
|
|
|
253
274
|
signed_by: string | null
|
|
254
275
|
started_at: Timestamp
|
|
255
276
|
status: string
|
|
277
|
+
workspace_key: string | null
|
|
256
278
|
}
|
|
257
279
|
content_type: {
|
|
258
280
|
alias: string
|
|
@@ -266,6 +288,7 @@ export interface CoreTables {
|
|
|
266
288
|
keep_latest_version_per_day_for_days: number | null
|
|
267
289
|
list_view: string | null
|
|
268
290
|
node_id: Generated<number>
|
|
291
|
+
origin_key: string | null
|
|
269
292
|
prevent_cleanup: Bool
|
|
270
293
|
retired_at: Timestamp | null
|
|
271
294
|
seo: string | null
|
|
@@ -275,6 +298,7 @@ export interface CoreTables {
|
|
|
275
298
|
site_settings: Default<Bool>
|
|
276
299
|
thumbnail: string | null
|
|
277
300
|
variations: number
|
|
301
|
+
workspace_id: number | null
|
|
278
302
|
}
|
|
279
303
|
content_type_allowed_child: {
|
|
280
304
|
allowed_content_type_id: number
|
|
@@ -299,6 +323,7 @@ export interface CoreTables {
|
|
|
299
323
|
text: string | null
|
|
300
324
|
user_id: number | null
|
|
301
325
|
version_date: Timestamp
|
|
326
|
+
workspace_id: number | null
|
|
302
327
|
}
|
|
303
328
|
content_version_culture_variation: {
|
|
304
329
|
available_user_id: number | null
|
|
@@ -315,9 +340,11 @@ export interface CoreTables {
|
|
|
315
340
|
editor_alias: string
|
|
316
341
|
editor_ui_alias: string | null
|
|
317
342
|
node_id: Generated<number>
|
|
343
|
+
origin_key: string | null
|
|
318
344
|
retired_at: Timestamp | null
|
|
319
345
|
since_state_id: number | null
|
|
320
346
|
since_version: string | null
|
|
347
|
+
workspace_id: number | null
|
|
321
348
|
}
|
|
322
349
|
delivery_member_token: {
|
|
323
350
|
client_id: string
|
|
@@ -428,6 +455,11 @@ export interface CoreTables {
|
|
|
428
455
|
name: string
|
|
429
456
|
value: string
|
|
430
457
|
}
|
|
458
|
+
file_blob: {
|
|
459
|
+
hash: string
|
|
460
|
+
size: number
|
|
461
|
+
text: string
|
|
462
|
+
}
|
|
431
463
|
form_entry: {
|
|
432
464
|
create_date: Timestamp
|
|
433
465
|
culture: string | null
|
|
@@ -588,6 +620,7 @@ export interface CoreTables {
|
|
|
588
620
|
trashed: Bool
|
|
589
621
|
tree_group: Generated<number>
|
|
590
622
|
unique_id: string
|
|
623
|
+
workspace_id: number | null
|
|
591
624
|
}
|
|
592
625
|
node_file: {
|
|
593
626
|
node_id: number
|
|
@@ -603,6 +636,7 @@ export interface CoreTables {
|
|
|
603
636
|
mandatory: Bool
|
|
604
637
|
mandatory_message: string | null
|
|
605
638
|
name: string
|
|
639
|
+
origin_key: string | null
|
|
606
640
|
property_type_group_id: number | null
|
|
607
641
|
retired_at: Timestamp | null
|
|
608
642
|
searchable: Default<Bool>
|
|
@@ -619,6 +653,7 @@ export interface CoreTables {
|
|
|
619
653
|
alias: string | null
|
|
620
654
|
content_type_node_id: number
|
|
621
655
|
id: Generated<number>
|
|
656
|
+
origin_key: string | null
|
|
622
657
|
parent_id: number | null
|
|
623
658
|
sort_order: number
|
|
624
659
|
text: string | null
|
|
@@ -628,6 +663,7 @@ export interface CoreTables {
|
|
|
628
663
|
property_value: {
|
|
629
664
|
date_value: Timestamp | null
|
|
630
665
|
decimal_value: Decimal | null
|
|
666
|
+
environment: string | null
|
|
631
667
|
event_id: number
|
|
632
668
|
id: Generated<number>
|
|
633
669
|
int_value: number | null
|
|
@@ -640,6 +676,7 @@ export interface CoreTables {
|
|
|
640
676
|
sortable_value: string | null
|
|
641
677
|
text_value: string | null
|
|
642
678
|
varchar_value: string | null
|
|
679
|
+
workspace_id: number | null
|
|
643
680
|
}
|
|
644
681
|
public_access: {
|
|
645
682
|
create_date: Timestamp
|
|
@@ -965,4 +1002,78 @@ export interface CoreTables {
|
|
|
965
1002
|
success: Bool
|
|
966
1003
|
url: string
|
|
967
1004
|
}
|
|
1005
|
+
workspace: {
|
|
1006
|
+
created_at: Timestamp
|
|
1007
|
+
id: Generated<number>
|
|
1008
|
+
key: string
|
|
1009
|
+
merged_at: Timestamp | null
|
|
1010
|
+
merged_by: string | null
|
|
1011
|
+
name: string
|
|
1012
|
+
owner_key: string
|
|
1013
|
+
personal: Default<Bool>
|
|
1014
|
+
schema_built: Default<Bool>
|
|
1015
|
+
staged_changes: string | null
|
|
1016
|
+
state: Generated<string>
|
|
1017
|
+
tell_others: Default<Bool>
|
|
1018
|
+
updated_at: Timestamp
|
|
1019
|
+
visibility: Generated<string>
|
|
1020
|
+
}
|
|
1021
|
+
workspace_document: {
|
|
1022
|
+
base_event_id: number | null
|
|
1023
|
+
base_published: Bool | null
|
|
1024
|
+
created: Bool
|
|
1025
|
+
edited: Bool
|
|
1026
|
+
node_id: number
|
|
1027
|
+
published: Bool
|
|
1028
|
+
published_event_id: number | null
|
|
1029
|
+
workspace_id: Generated<number>
|
|
1030
|
+
}
|
|
1031
|
+
workspace_document_culture: {
|
|
1032
|
+
available: Bool
|
|
1033
|
+
base_published: Bool | null
|
|
1034
|
+
base_published_event_id: number | null
|
|
1035
|
+
edited: Bool
|
|
1036
|
+
language_id: number
|
|
1037
|
+
name: string | null
|
|
1038
|
+
node_id: number
|
|
1039
|
+
published: Bool
|
|
1040
|
+
published_event_id: number | null
|
|
1041
|
+
published_name: string | null
|
|
1042
|
+
workspace_id: Generated<number>
|
|
1043
|
+
}
|
|
1044
|
+
workspace_file: {
|
|
1045
|
+
base_hash: string | null
|
|
1046
|
+
class: string | null
|
|
1047
|
+
hash: string | null
|
|
1048
|
+
path: string
|
|
1049
|
+
workspace_id: Generated<number>
|
|
1050
|
+
}
|
|
1051
|
+
workspace_link: {
|
|
1052
|
+
created_at: Timestamp
|
|
1053
|
+
expires_at: Timestamp
|
|
1054
|
+
id: Generated<number>
|
|
1055
|
+
made_by: string
|
|
1056
|
+
secret_hash: string
|
|
1057
|
+
withdrawn_at: Timestamp | null
|
|
1058
|
+
workspace_id: number
|
|
1059
|
+
}
|
|
1060
|
+
workspace_member: {
|
|
1061
|
+
added_at: Timestamp
|
|
1062
|
+
user_key: string
|
|
1063
|
+
workspace_id: Generated<number>
|
|
1064
|
+
}
|
|
1065
|
+
workspace_pending: {
|
|
1066
|
+
base_event_id: number | null
|
|
1067
|
+
base_parent_id: number | null
|
|
1068
|
+
base_sort_order: number | null
|
|
1069
|
+
id: Generated<number>
|
|
1070
|
+
kind: string
|
|
1071
|
+
name: string | null
|
|
1072
|
+
node_id: number
|
|
1073
|
+
recorded_at: Timestamp
|
|
1074
|
+
sort_order: number | null
|
|
1075
|
+
target_parent_id: number | null
|
|
1076
|
+
user_id: number | null
|
|
1077
|
+
workspace_id: number
|
|
1078
|
+
}
|
|
968
1079
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keys of a workspace's own rows (story 376). A workspace's copy of a type, a data
|
|
3
|
+
* type, a group or a property is stored under a key derived from the workspace's
|
|
4
|
+
* and the item's own, so it never clashes with Shared's, and keeps the item's own
|
|
5
|
+
* key beside it, which is the key the workspace reads and writes it by.
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from 'node:crypto'
|
|
8
|
+
|
|
9
|
+
/** The key a workspace stores its copy of `key` under: stable, a version-4-shaped uuid. */
|
|
10
|
+
export function workspaceRowKey(workspaceKey: string, key: string): string {
|
|
11
|
+
const hex = createHash('sha256')
|
|
12
|
+
.update(`${workspaceKey.toLowerCase()}:${key.toLowerCase()}`)
|
|
13
|
+
.digest('hex')
|
|
14
|
+
const variant = ((Number.parseInt(hex[16] as string, 16) & 0x3) | 0x8).toString(16)
|
|
15
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A workspace as a repository reads and writes in it: its row id and its key. */
|
|
19
|
+
export interface WorkspaceScope {
|
|
20
|
+
id: number
|
|
21
|
+
key: string
|
|
22
|
+
}
|