@murumets-ee/content 0.3.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.
- package/LICENSE +94 -0
- package/dist/{block-diff-H1AttKiz.mjs → block-diff-BBH6FoFT.mjs} +1 -1
- package/dist/{block-diff-H1AttKiz.mjs.map → block-diff-BBH6FoFT.mjs.map} +1 -1
- package/dist/blocks/index.d.mts +3 -3
- package/dist/blocks/index.mjs +1 -1
- package/dist/client.d.mts +160 -18
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +1 -1
- package/dist/client.mjs.map +1 -1
- package/dist/{define-block-D-7OpIn5.mjs → define-block-DpMPEEdA.mjs} +1 -1
- package/dist/{define-block-D-7OpIn5.mjs.map → define-block-DpMPEEdA.mjs.map} +1 -1
- package/dist/drafts-CyOivEtr.mjs +2 -0
- package/dist/drafts-CyOivEtr.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/locale-status-DTyv4wcn.mjs +2 -0
- package/dist/locale-status-DTyv4wcn.mjs.map +1 -0
- package/dist/lock-service.d.mts +3 -4
- package/dist/lock-service.d.mts.map +1 -1
- package/dist/lock-service.mjs +1 -1
- package/dist/lock-service.mjs.map +1 -1
- package/dist/locks-BkO2qMfm.mjs +2 -0
- package/dist/locks-BkO2qMfm.mjs.map +1 -0
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.mjs +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/query-client.d.mts +80 -14
- package/dist/query-client.d.mts.map +1 -1
- package/dist/query-client.mjs +1 -1
- package/dist/query-client.mjs.map +1 -1
- package/dist/registry-BJSOGFEN.mjs +2 -0
- package/dist/registry-BJSOGFEN.mjs.map +1 -0
- package/dist/rolldown-runtime-DR3Ue2cl.mjs +1 -0
- package/dist/{types-nXbE5Ufa.d.mts → types-COcneY5H.d.mts} +1 -1
- package/dist/{types-nXbE5Ufa.d.mts.map → types-COcneY5H.d.mts.map} +1 -1
- package/dist/{types-wLHyjcWf.d.mts → types-D-ATlx7t.d.mts} +1 -1
- package/dist/{types-wLHyjcWf.d.mts.map → types-D-ATlx7t.d.mts.map} +1 -1
- package/dist/versions-CO6oDyet.mjs +2 -0
- package/dist/versions-CO6oDyet.mjs.map +1 -0
- package/package.json +12 -12
- package/dist/drafts-BYyRdmiT.mjs +0 -2
- package/dist/drafts-BYyRdmiT.mjs.map +0 -1
- package/dist/locale-status-CGttT38v.mjs +0 -2
- package/dist/locale-status-CGttT38v.mjs.map +0 -1
- package/dist/locks-CNxQJieo.mjs +0 -2
- package/dist/locks-CNxQJieo.mjs.map +0 -1
- package/dist/versions-cotph2VG.mjs +0 -2
- package/dist/versions-cotph2VG.mjs.map +0 -1
package/dist/query-client.d.mts
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
import { Entity } from "@murumets-ee/entity";
|
|
2
|
-
import {
|
|
3
|
-
import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
4
|
-
import { CountOptions, FindByIdOptions, FindManyOptions } from "@murumets-ee/entity/query";
|
|
2
|
+
import { CountOptions, FindByIdOptions, FindManyOptions, QueryClient } from "@murumets-ee/entity/query";
|
|
5
3
|
|
|
6
4
|
//#region src/query-client.d.ts
|
|
7
5
|
interface ContentQueryClientConfig {
|
|
6
|
+
query: QueryClient;
|
|
8
7
|
entity: Entity;
|
|
9
|
-
db: PostgresJsDatabase;
|
|
10
|
-
logger?: Logger;
|
|
11
8
|
}
|
|
12
9
|
declare class ContentQueryClient {
|
|
13
10
|
private entity;
|
|
14
|
-
private db;
|
|
15
|
-
private logger?;
|
|
16
11
|
private query;
|
|
17
12
|
constructor(config: ContentQueryClientConfig);
|
|
18
|
-
private getQuery;
|
|
19
13
|
findById(id: string, options?: FindByIdOptions): Promise<({
|
|
20
14
|
id: string;
|
|
21
15
|
} & {} & {
|
|
22
|
-
[x: string]: string | number | boolean |
|
|
16
|
+
[x: string]: Date | Record<string, unknown>[] | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
17
|
+
[key: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
18
|
+
} | null)[] | {
|
|
19
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null;
|
|
20
|
+
} | null)[] | {
|
|
21
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
22
|
+
} | null)[] | {
|
|
23
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
24
|
+
} | null)[] | {
|
|
25
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
26
|
+
} | null)[] | {
|
|
27
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
28
|
+
} | null)[] | {
|
|
29
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
30
|
+
} | null)[] | {
|
|
31
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
32
|
+
} | null)[] | {
|
|
33
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
34
|
+
} | null)[] | {
|
|
35
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
36
|
+
} | null)[] | {
|
|
37
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
38
|
+
} | null)[] | {
|
|
39
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
40
|
+
} | null) | {
|
|
23
41
|
[key: string]: unknown;
|
|
24
42
|
_block: string;
|
|
25
43
|
_id: string;
|
|
26
|
-
}[] |
|
|
44
|
+
}[] | undefined;
|
|
27
45
|
}) | null>;
|
|
28
46
|
/**
|
|
29
47
|
* Find entity by slug — convenience for slug-based lookups.
|
|
@@ -33,20 +51,68 @@ declare class ContentQueryClient {
|
|
|
33
51
|
}): Promise<({
|
|
34
52
|
id: string;
|
|
35
53
|
} & {} & {
|
|
36
|
-
[x: string]: string | number | boolean |
|
|
54
|
+
[x: string]: Date | Record<string, unknown>[] | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
55
|
+
[key: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
56
|
+
} | null)[] | {
|
|
57
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null;
|
|
58
|
+
} | null)[] | {
|
|
59
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
60
|
+
} | null)[] | {
|
|
61
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
62
|
+
} | null)[] | {
|
|
63
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
64
|
+
} | null)[] | {
|
|
65
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
66
|
+
} | null)[] | {
|
|
67
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
68
|
+
} | null)[] | {
|
|
69
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
70
|
+
} | null)[] | {
|
|
71
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
72
|
+
} | null)[] | {
|
|
73
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
74
|
+
} | null)[] | {
|
|
75
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
76
|
+
} | null)[] | {
|
|
77
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
78
|
+
} | null) | {
|
|
37
79
|
[key: string]: unknown;
|
|
38
80
|
_block: string;
|
|
39
81
|
_id: string;
|
|
40
|
-
}[] |
|
|
82
|
+
}[] | undefined;
|
|
41
83
|
}) | null>;
|
|
42
84
|
findMany(options?: FindManyOptions): Promise<({
|
|
43
85
|
id: string;
|
|
44
86
|
} & {} & {
|
|
45
|
-
[x: string]: string | number | boolean |
|
|
87
|
+
[x: string]: Date | Record<string, unknown>[] | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | {
|
|
88
|
+
[key: string]: string | number | boolean | /*elided*/any | /*elided*/any | null;
|
|
89
|
+
} | null)[] | {
|
|
90
|
+
[key: string]: string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null;
|
|
91
|
+
} | null)[] | {
|
|
92
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
93
|
+
} | null)[] | {
|
|
94
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
95
|
+
} | null)[] | {
|
|
96
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
97
|
+
} | null)[] | {
|
|
98
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
99
|
+
} | null)[] | {
|
|
100
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
101
|
+
} | null)[] | {
|
|
102
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
103
|
+
} | null)[] | {
|
|
104
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
105
|
+
} | null)[] | {
|
|
106
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
107
|
+
} | null)[] | {
|
|
108
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
109
|
+
} | null)[] | {
|
|
110
|
+
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/any | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null)[] | /*elided*/any | null;
|
|
111
|
+
} | null) | {
|
|
46
112
|
[key: string]: unknown;
|
|
47
113
|
_block: string;
|
|
48
114
|
_id: string;
|
|
49
|
-
}[] |
|
|
115
|
+
}[] | undefined;
|
|
50
116
|
})[]>;
|
|
51
117
|
count(options?: CountOptions): Promise<number>;
|
|
52
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-client.d.mts","names":[],"sources":["../src/query-client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-client.d.mts","names":[],"sources":["../src/query-client.ts"],"mappings":";;;;UAiBiB,wBAAA;EACf,KAAA,EAAO,WAAA;EACP,MAAA,EAAQ,MAAA;AAAA;AAAA,cAGG,kBAAA;EAAA,QACH,MAAA;EAAA,QACA,KAAA;cAEI,MAAA,EAAQ,wBAAA;EASd,QAAA,CAAS,EAAA,UAAY,OAAA,GAAU,eAAA,GAAe,OAAA;;;gZAAA;MAAA;;8EAOQ,gBAAA,0BAAA;IAAA;MAAA;;wIAiBpB,gBAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,+JAIN,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,4LAAA,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,yNAvC1B,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,sPAEY,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,mRASd,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,gTAA+B,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,6UAAe,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA;;;;;;;;;;EAO9C,UAAA,CAAW,IAAA,UAAc,OAAA;IAAY,MAAA;EAAA,IAAiB,OAAA;;;;;;8EAAtD,gBAAA,0BAAA;IAAA;MAAA,qGAAqC,gBAAA,0BAAA,0BAAA;IAAA;MAAA,kIAAiB,gBAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA;;;;;;;;;;;;;;;;;;;;;EAiBtD,QAAA,CAAS,OAAA,GAAU,eAAA,GAAe,OAAA;;;;;;;;;;;;;;;;;;;;yRAIlC,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,gTAAM,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,6UAAsB,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA,0WASU,gBAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA,0BAAA;IAAA;MAAA;;;;;EATtC,KAAA,CAAM,OAAA,GAAU,YAAA,GAAY,OAAA;AAAA;;;;;iBASd,wBAAA,CAAyB,MAAA,EAAQ,MAAA,GAAS,OAAA,CAAQ,kBAAA"}
|
package/dist/query-client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class{entity;
|
|
1
|
+
var e=class{entity;query;constructor(e){this.entity=e.entity,this.query=e.query}async findById(e,t){return this.query.findById(e,t)}async findBySlug(e,t){let{schemaRegistry:n}=await import(`@murumets-ee/db`),{eq:r}=await import(`drizzle-orm`),i=n.get(this.entity.name);return!i||!i.slug?null:(await this.query.findMany({where:r(i.slug,e),limit:1,locale:t?.locale}))[0]??null}async findMany(e){return this.query.findMany(e)}async count(e){return this.query.count(e)}};async function t(t){let{createQueryClient:n}=await import(`@murumets-ee/core/clients`);return new e({query:n(t),entity:t})}export{e as ContentQueryClient,t as createContentQueryClient};
|
|
2
2
|
//# sourceMappingURL=query-client.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-client.mjs","names":[],"sources":["../src/query-client.ts"],"sourcesContent":["/**\n * ContentQueryClient — read-only content queries, safe for client bundles.\n *\n * Usage:\n * import { createContentQueryClient } from '@murumets-ee/content/query'\n * const pages = createContentQueryClient(Page)\n * const page = await pages.findBySlug('about', { locale: 'de' })\n */\n\nimport type {
|
|
1
|
+
{"version":3,"file":"query-client.mjs","names":[],"sources":["../src/query-client.ts"],"sourcesContent":["/**\n * ContentQueryClient — read-only content queries, safe for client bundles.\n *\n * Usage:\n * import { createContentQueryClient } from '@murumets-ee/content/query'\n * const pages = createContentQueryClient(Page)\n * const page = await pages.findBySlug('about', { locale: 'de' })\n */\n\nimport type { Entity } from '@murumets-ee/entity'\nimport type {\n CountOptions,\n FindByIdOptions,\n FindManyOptions,\n QueryClient,\n} from '@murumets-ee/entity/query'\n\nexport interface ContentQueryClientConfig {\n query: QueryClient\n entity: Entity\n}\n\nexport class ContentQueryClient {\n private entity: Entity\n private query: QueryClient\n\n constructor(config: ContentQueryClientConfig) {\n this.entity = config.entity\n this.query = config.query\n }\n\n // ---------------------------------------------------------------\n // Read operations (delegated to QueryClient)\n // ---------------------------------------------------------------\n\n async findById(id: string, options?: FindByIdOptions) {\n return this.query.findById(id, options)\n }\n\n /**\n * Find entity by slug — convenience for slug-based lookups.\n */\n async findBySlug(slug: string, options?: { locale?: string }) {\n const { schemaRegistry } = await import('@murumets-ee/db')\n const { eq } = await import('drizzle-orm')\n\n const table = schemaRegistry.get(this.entity.name)\n if (!table || !table.slug) return null\n\n // Build where clause with slug filter\n const results = await this.query.findMany({\n where: eq(table.slug, slug),\n limit: 1,\n locale: options?.locale,\n })\n\n return results[0] ?? null\n }\n\n async findMany(options?: FindManyOptions) {\n return this.query.findMany(options)\n }\n\n async count(options?: CountOptions) {\n return this.query.count(options)\n }\n}\n\n/**\n * Factory — creates a ContentQueryClient for an entity.\n * Must be called after createApp().\n */\nexport async function createContentQueryClient(entity: Entity): Promise<ContentQueryClient> {\n const { createQueryClient } = await import('@murumets-ee/core/clients')\n const query = createQueryClient(entity)\n return new ContentQueryClient({\n query,\n entity,\n })\n}\n"],"mappings":"AAsBA,IAAa,EAAb,KAAgC,CAC9B,OACA,MAEA,YAAY,EAAkC,CAC5C,KAAK,OAAS,EAAO,OACrB,KAAK,MAAQ,EAAO,MAOtB,MAAM,SAAS,EAAY,EAA2B,CACpD,OAAO,KAAK,MAAM,SAAS,EAAI,EAAQ,CAMzC,MAAM,WAAW,EAAc,EAA+B,CAC5D,GAAM,CAAE,kBAAmB,MAAM,OAAO,mBAClC,CAAE,MAAO,MAAM,OAAO,eAEtB,EAAQ,EAAe,IAAI,KAAK,OAAO,KAAK,CAUlD,MATI,CAAC,GAAS,CAAC,EAAM,KAAa,MAGlB,MAAM,KAAK,MAAM,SAAS,CACxC,MAAO,EAAG,EAAM,KAAM,EAAK,CAC3B,MAAO,EACP,OAAQ,GAAS,OAClB,CAAC,EAEa,IAAM,KAGvB,MAAM,SAAS,EAA2B,CACxC,OAAO,KAAK,MAAM,SAAS,EAAQ,CAGrC,MAAM,MAAM,EAAwB,CAClC,OAAO,KAAK,MAAM,MAAM,EAAQ,GAQpC,eAAsB,EAAyB,EAA6C,CAC1F,GAAM,CAAE,qBAAsB,MAAM,OAAO,6BAE3C,OAAO,IAAI,EAAmB,CAC5B,MAFY,EAAkB,EAAO,CAGrC,SACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DR3Ue2cl.mjs";var t=e({getContentTables:()=>i,registerContentTables:()=>r});const n=new Map;function r(e,t){let r=n.get(e)??{};n.set(e,{...r,...t})}function i(e){return n.get(e)??{}}export{t as n,i as t};
|
|
2
|
+
//# sourceMappingURL=registry-BJSOGFEN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-BJSOGFEN.mjs","names":[],"sources":["../src/schema/registry.ts"],"sourcesContent":["/**\n * Per-entity content table registry.\n *\n * Maps an entity name to its content infrastructure tables — drafts,\n * versions, locale_status. Each entry stores the `DefinedTable` (from\n * `defineTable`), which exposes a typed `.makeClient(db)` for CRUD via\n * `TableClient` and a raw `.table` for legacy callers.\n *\n * The content plugin populates this registry at `init` time; ContentClient\n * reads from it lazily on first use. Tables that don't apply to an entity\n * (non-publishable entities have no drafts, etc.) are simply absent.\n */\n\nimport type { DraftsTable } from './drafts.js'\nimport type { LocaleStatusTable } from './locale-status.js'\nimport type { VersionsTable } from './versions.js'\n\n/**\n * The full set of optional content infra tables attached to an entity.\n * Every field is optional — entities without the relevant behavior don't\n * get the corresponding table.\n */\nexport interface ContentTables {\n /** `{entity}_drafts` — present when the entity has `publishable()`. */\n drafts?: DraftsTable\n /** `{entity}_versions` — present when the entity has `versionable()`. */\n versions?: VersionsTable\n /** `{entity}_locale_status` — present when the entity is publishable + has translatable fields. */\n localeStatus?: LocaleStatusTable\n}\n\n// Module-level map. Single source of truth for ContentClient lookups.\nconst tables = new Map<string, ContentTables>()\n\n/**\n * Register content tables for an entity. Called from `content().init()`.\n *\n * Subsequent calls for the same entity name MERGE the provided patch into\n * the existing entry. This lets the plugin add tables one at a time (drafts,\n * then versions, then locale_status) without the caller needing to build the\n * whole object up front.\n */\nexport function registerContentTables(entityName: string, patch: ContentTables): void {\n const existing = tables.get(entityName) ?? {}\n tables.set(entityName, { ...existing, ...patch })\n}\n\n/**\n * Get the content tables for an entity. Returns an empty object (rather\n * than undefined) when the entity has no registered tables — that\n * simplifies the common ContentClient lookup idiom:\n *\n * const { drafts } = getContentTables(entity.name)\n * if (!drafts) return null\n */\nexport function getContentTables(entityName: string): ContentTables {\n return tables.get(entityName) ?? {}\n}\n\n/**\n * Clear the registry. **Test-only.** Throws in production.\n */\nexport function clearContentTables(): void {\n if (process.env.NODE_ENV === 'production') {\n throw new Error(\n 'clearContentTables() is not allowed in production — this is a test-only utility.',\n )\n }\n tables.clear()\n}\n"],"mappings":"kHAgCA,MAAM,EAAS,IAAI,IAUnB,SAAgB,EAAsB,EAAoB,EAA4B,CACpF,IAAM,EAAW,EAAO,IAAI,EAAW,EAAI,EAAE,CAC7C,EAAO,IAAI,EAAY,CAAE,GAAG,EAAU,GAAG,EAAO,CAAC,CAWnD,SAAgB,EAAiB,EAAmC,CAClE,OAAO,EAAO,IAAI,EAAW,EAAI,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-COcneY5H.d.mts","names":[],"sources":["../src/diff/types.ts"],"mappings":";;AAKA;;;UAAiB,WAAA;EACf,IAAA;EACA,KAAA;AAAA;;UAIe,SAAA;EACf,KAAA;EACA,IAAA;EAWA,IAAA;EACA,EAAA;EAEA;EAAA,QAAA,GAAW,WAAA;EAEX;EAAA,UAAA,GAAa,cAAA;AAAA;;KAIH,eAAA;;UAGK,cAAA;EACf,OAAA;EACA,SAAA;EACA,MAAA,EAAQ,eAAA;EACR,SAAA;EACA,OAAA;EAEoB;EAApB,SAAA,GAAY,QAAA;AAAA;;UAIG,QAAA;EACf,KAAA;EACA,IAAA;EACA,EAAA;EAPY;EASZ,QAAA,GAAW,WAAA;AAAA"}
|
|
@@ -92,4 +92,4 @@ interface LockInfo {
|
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
94
|
export { InferBlocksUnion as a, LockInfo as c, TranslationStatus as d, VersionEntry as f, InferBlockData as i, TranslationFieldStatus as l, ContentConfig as n, LocaleConfig as o, VersionableOptions as p, DraftEntry as r, LocalePublishStatus as s, BlockDefinition as t, TranslationReport as u };
|
|
95
|
-
//# sourceMappingURL=types-
|
|
95
|
+
//# sourceMappingURL=types-D-ATlx7t.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-D-ATlx7t.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;UAeiB,eAAA,WACL,MAAA,SAAe,WAAA,IAAe,MAAA,SAAe,WAAA;EAEvD,IAAA;EACA,KAAA;EACA,MAAA,EAAQ,CAAA;AAAA;;;;;KAWE,cAAA,WAAyB,eAAA,IACnC,CAAA,SAAU,eAAA;EACJ,MAAA,EAAQ,CAAA;EAAW,GAAA;AAAA,IAAgB,IAAA,CAAK,cAAA,CAAe,CAAA;;;AAF/D;;;;;KAYY,gBAAA,oBAAoC,eAAA,oBAClC,CAAA,GAAI,CAAA,CAAE,CAAA,UAAW,eAAA,GAAkB,cAAA,CAAe,CAAA,CAAE,CAAA;AAAA,UAOjD,YAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,OAAA,EAAS,YAAA;EACT,aAAA;AAAA;AAAA,UAOe,kBAAA;EAhCT;EAkCN,SAAA;EAlCyB;EAoCzB,QAAA;AAAA;AAAA,UAOe,YAAA;EACf,EAAA;EACA,QAAA;EACA,OAAA;EACA,MAAA;EACA,IAAA,EAAM,MAAA;EACN,KAAA,EAAO,MAAA;EACP,MAAA;EACA,SAAA;EACA,aAAA;EACA,SAAA,EAAW,IAAA;EACX,UAAA;AAAA;AAAA,UAae,sBAAA;EACf,QAAA;EACA,KAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,UAGe,iBAAA;EAAA,CACd,MAAA,WAAiB,sBAAA;AAAA;AAAA,UAGH,iBAAA;EACf,KAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;AAAA;AAAA,UAOe,mBAAA;EACf,MAAA;EACA,MAAA;EACA,WAAA,EAAa,IAAA;AAAA;AAAA,UAOE,UAAA;EACf,EAAA;EACA,QAAA;EACA,MAAA;EACA,IAAA,EAAM,MAAA;EACN,SAAA;EACA,aAAA;EACA,SAAA,EAAW,IAAA;EACX,SAAA,EAAW,IAAA;AAAA;AAAA,UAOI,QAAA;EACf,QAAA;EACA,YAAA;EACA,QAAA,EAAU,IAAA;EACV,SAAA,EAAW,IAAA;AAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{column as e,defineTable as t}from"@murumets-ee/db";function n(n){return t({name:`${n.name}_versions`,columns:{id:e.uuid({primaryKey:!0,defaultRandom:!0}),entityId:e.uuid({notNull:!0,pgName:`entity_id`}),version:e.integer({notNull:!0}),locale:e.varchar({length:10,notNull:!0,default:`_`}),data:e.jsonb({notNull:!0}),delta:e.jsonb(),status:e.varchar({length:20}),createdBy:e.varchar({length:255,pgName:`created_by`}),createdByName:e.varchar({length:255,pgName:`created_by_name`}),createdAt:e.timestamp({notNull:!0,defaultNow:!0,withTimezone:!0,pgName:`created_at`}),isAutosave:e.boolean({notNull:!0,default:!1,pgName:`is_autosave`})},unique:[{on:[`entityId`,`version`,`locale`]}]})}export{n as generateVersionsTable};
|
|
2
|
+
//# sourceMappingURL=versions-CO6oDyet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions-CO6oDyet.mjs","names":[],"sources":["../src/schema/versions.ts"],"sourcesContent":["/**\n * Version history table schema generator\n *\n * Generates a {entity}_versions table for entities with the versionable() behavior.\n * Each version stores a full snapshot + delta (changed fields only).\n *\n * Uses `defineTable` so ContentClient can operate on versions through a typed\n * TableClient. The migration pipeline uses the entity-package generator\n * (which emits FK references) — this one produces a runtime-only table shape\n * for read/write via TableClient.\n */\n\nimport { column, defineTable } from '@murumets-ee/db'\nimport type { Entity } from '@murumets-ee/entity'\n\n/**\n * Generate a `DefinedTable` for a versionable entity's versions table.\n *\n * Schema:\n * {entity}_versions (\n * id uuid PK,\n * entity_id uuid NOT NULL,\n * version integer NOT NULL,\n * locale varchar(10) NOT NULL DEFAULT '_', -- locale this snapshot belongs to\n * data jsonb NOT NULL, -- full snapshot (locale-merged view)\n * delta jsonb, -- only changed fields\n * status varchar(20), -- 'draft' | 'published' at time of save\n * created_by varchar(255),\n * created_by_name varchar(255),\n * created_at timestamptz NOT NULL DEFAULT now(),\n * is_autosave boolean NOT NULL DEFAULT false,\n * UNIQUE(entity_id, version, locale)\n * )\n *\n * Each locale has its own version sequence. The default locale uses '_'\n * as the locale value (distinguishable from actual locale codes).\n */\nexport function generateVersionsTable(entity: Entity) {\n return defineTable({\n name: `${entity.name}_versions`,\n columns: {\n id: column.uuid({ primaryKey: true, defaultRandom: true }),\n entityId: column.uuid({ notNull: true, pgName: 'entity_id' }),\n version: column.integer({ notNull: true }),\n locale: column.varchar({ length: 10, notNull: true, default: '_' }),\n data: column.jsonb<Record<string, unknown>, true>({ notNull: true }),\n delta: column.jsonb<Record<string, unknown>>(),\n status: column.varchar({ length: 20 }),\n createdBy: column.varchar({ length: 255, pgName: 'created_by' }),\n createdByName: column.varchar({ length: 255, pgName: 'created_by_name' }),\n createdAt: column.timestamp({\n notNull: true,\n defaultNow: true,\n withTimezone: true,\n pgName: 'created_at',\n }),\n isAutosave: column.boolean({ notNull: true, default: false, pgName: 'is_autosave' }),\n },\n unique: [{ on: ['entityId', 'version', 'locale'] }],\n })\n}\n\n/**\n * Backwards-compatible wrapper: returns the raw Drizzle pgTable.\n * Still used by `plugin.ts` to register the table in `schemaRegistry`.\n */\nexport function generateVersionsSchema(entity: Entity) {\n return generateVersionsTable(entity).table\n}\n\n/** Public type export — the full DefinedTable returned by the generator. */\nexport type VersionsTable = ReturnType<typeof generateVersionsTable>\n"],"mappings":"0DAqCA,SAAgB,EAAsB,EAAgB,CACpD,OAAO,EAAY,CACjB,KAAM,GAAG,EAAO,KAAK,WACrB,QAAS,CACP,GAAI,EAAO,KAAK,CAAE,WAAY,GAAM,cAAe,GAAM,CAAC,CAC1D,SAAU,EAAO,KAAK,CAAE,QAAS,GAAM,OAAQ,YAAa,CAAC,CAC7D,QAAS,EAAO,QAAQ,CAAE,QAAS,GAAM,CAAC,CAC1C,OAAQ,EAAO,QAAQ,CAAE,OAAQ,GAAI,QAAS,GAAM,QAAS,IAAK,CAAC,CACnE,KAAM,EAAO,MAAqC,CAAE,QAAS,GAAM,CAAC,CACpE,MAAO,EAAO,OAAgC,CAC9C,OAAQ,EAAO,QAAQ,CAAE,OAAQ,GAAI,CAAC,CACtC,UAAW,EAAO,QAAQ,CAAE,OAAQ,IAAK,OAAQ,aAAc,CAAC,CAChE,cAAe,EAAO,QAAQ,CAAE,OAAQ,IAAK,OAAQ,kBAAmB,CAAC,CACzE,UAAW,EAAO,UAAU,CAC1B,QAAS,GACT,WAAY,GACZ,aAAc,GACd,OAAQ,aACT,CAAC,CACF,WAAY,EAAO,QAAQ,CAAE,QAAS,GAAM,QAAS,GAAO,OAAQ,cAAe,CAAC,CACrF,CACD,OAAQ,CAAC,CAAE,GAAI,CAAC,WAAY,UAAW,SAAS,CAAE,CAAC,CACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@murumets-ee/content",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -32,24 +32,24 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsdown",
|
|
37
|
-
"dev": "tsdown --watch",
|
|
38
|
-
"test": "vitest"
|
|
39
|
-
},
|
|
40
35
|
"dependencies": {
|
|
41
|
-
"@murumets-ee/core": "workspace:*",
|
|
42
|
-
"@murumets-ee/db": "workspace:*",
|
|
43
|
-
"@murumets-ee/entity": "workspace:*",
|
|
44
|
-
"@murumets-ee/logging": "workspace:*",
|
|
45
36
|
"drizzle-orm": "^0.45.1",
|
|
46
37
|
"server-only": "^0.0.1",
|
|
47
|
-
"zod": "^3.24.1"
|
|
38
|
+
"zod": "^3.24.1",
|
|
39
|
+
"@murumets-ee/core": "0.4.0",
|
|
40
|
+
"@murumets-ee/entity": "0.4.0",
|
|
41
|
+
"@murumets-ee/db": "0.4.0",
|
|
42
|
+
"@murumets-ee/logging": "0.4.0"
|
|
48
43
|
},
|
|
49
44
|
"devDependencies": {
|
|
50
45
|
"@types/node": "^22.10.5",
|
|
51
46
|
"tsdown": "^0.21.7",
|
|
52
47
|
"typescript": "^5.7.3",
|
|
53
48
|
"vitest": "^2.1.8"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsdown",
|
|
52
|
+
"dev": "tsdown --watch",
|
|
53
|
+
"test": "vitest"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
package/dist/drafts-BYyRdmiT.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsonb as e,pgTable as t,timestamp as n,unique as r,uuid as i,varchar as a}from"drizzle-orm/pg-core";function o(o){return t(`${o.name}_drafts`,{id:i(`id`).primaryKey().defaultRandom(),entityId:i(`entity_id`).notNull(),locale:a(`locale`,{length:10}).notNull().default(`_`),data:e(`data`).notNull(),createdBy:a(`created_by`,{length:255}).notNull(),createdByName:a(`created_by_name`,{length:255}),createdAt:n(`created_at`,{withTimezone:!0}).notNull().defaultNow(),updatedAt:n(`updated_at`,{withTimezone:!0}).notNull().defaultNow()},e=>({uniqueEntityLocale:r().on(e.entityId,e.locale)}))}export{o as generateDraftsSchema};
|
|
2
|
-
//# sourceMappingURL=drafts-BYyRdmiT.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drafts-BYyRdmiT.mjs","names":[],"sources":["../src/schema/drafts.ts"],"sourcesContent":["/**\n * Draft overlay table schema generator\n *\n * Generates a {entity}_drafts table for entities with the publishable() behavior.\n * Stores a mutable work-in-progress snapshot that non-publishers edit instead of\n * writing directly to the live published row.\n *\n * One draft per entity+locale. Drafts are upserted, discarded, or promoted to live.\n */\n\nimport type { Entity } from '@murumets-ee/entity'\nimport { jsonb, pgTable, timestamp, unique, uuid, varchar } from 'drizzle-orm/pg-core'\n\n/**\n * Generate drafts table schema for a publishable entity.\n *\n * Schema:\n * {entity}_drafts (\n * id uuid PK,\n * entity_id uuid NOT NULL,\n * locale varchar(10) NOT NULL DEFAULT '_',\n * data jsonb NOT NULL, -- full entity snapshot\n * created_by varchar(255) NOT NULL, -- user ID (varchar, NOT uuid!)\n * created_by_name varchar(255),\n * created_at timestamptz NOT NULL DEFAULT now(),\n * updated_at timestamptz NOT NULL DEFAULT now(),\n * UNIQUE(entity_id, locale)\n * )\n */\nexport function generateDraftsSchema(entity: Entity) {\n const tableName = `${entity.name}_drafts`\n\n return pgTable(\n tableName,\n {\n id: uuid('id').primaryKey().defaultRandom(),\n entityId: uuid('entity_id').notNull(),\n locale: varchar('locale', { length: 10 }).notNull().default('_'),\n data: jsonb('data').notNull(),\n createdBy: varchar('created_by', { length: 255 }).notNull(),\n createdByName: varchar('created_by_name', { length: 255 }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n },\n (table) => ({\n uniqueEntityLocale: unique().on(table.entityId, table.locale),\n }),\n )\n}\n"],"mappings":"2GA6BA,SAAgB,EAAqB,EAAgB,CAGnD,OAAO,EAFW,GAAG,EAAO,KAAK,SAI/B,CACE,GAAI,EAAK,KAAK,CAAC,YAAY,CAAC,eAAe,CAC3C,SAAU,EAAK,YAAY,CAAC,SAAS,CACrC,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,IAAI,CAChE,KAAM,EAAM,OAAO,CAAC,SAAS,CAC7B,UAAW,EAAQ,aAAc,CAAE,OAAQ,IAAK,CAAC,CAAC,SAAS,CAC3D,cAAe,EAAQ,kBAAmB,CAAE,OAAQ,IAAK,CAAC,CAC1D,UAAW,EAAU,aAAc,CAAE,aAAc,GAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CACjF,UAAW,EAAU,aAAc,CAAE,aAAc,GAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CAClF,CACA,IAAW,CACV,mBAAoB,GAAQ,CAAC,GAAG,EAAM,SAAU,EAAM,OAAO,CAC9D,EACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{pgTable as e,timestamp as t,unique as n,uuid as r,varchar as i}from"drizzle-orm/pg-core";function a(a){return e(`${a.name}_locale_status`,{id:r(`id`).primaryKey().defaultRandom(),entityId:r(`entity_id`).notNull(),locale:i(`locale`,{length:10}).notNull(),status:i(`status`,{length:20}).notNull().default(`draft`),publishedAt:t(`published_at`,{withTimezone:!0})},e=>({uniqueEntityLocale:n().on(e.entityId,e.locale)}))}export{a as generateLocaleStatusSchema};
|
|
2
|
-
//# sourceMappingURL=locale-status-CGttT38v.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locale-status-CGttT38v.mjs","names":[],"sources":["../src/schema/locale-status.ts"],"sourcesContent":["/**\n * Per-locale publish status table schema generator\n *\n * Generates a {entity}_locale_status table for entities that have both\n * publishable() behavior AND translatable fields. This allows different\n * locales to have independent publish statuses.\n *\n * Fallback rule: no row for a locale = inherit base entity status.\n */\n\nimport type { Entity } from '@murumets-ee/entity'\nimport { pgTable, timestamp, unique, uuid, varchar } from 'drizzle-orm/pg-core'\n\n/**\n * Generate locale status table schema for a publishable + translatable entity.\n *\n * Schema:\n * {entity}_locale_status (\n * id uuid PK,\n * entity_id uuid NOT NULL,\n * locale varchar(10) NOT NULL,\n * status varchar(20) NOT NULL DEFAULT 'draft',\n * published_at timestamptz,\n * UNIQUE(entity_id, locale)\n * )\n */\nexport function generateLocaleStatusSchema(entity: Entity) {\n const tableName = `${entity.name}_locale_status`\n\n return pgTable(\n tableName,\n {\n id: uuid('id').primaryKey().defaultRandom(),\n entityId: uuid('entity_id').notNull(),\n locale: varchar('locale', { length: 10 }).notNull(),\n status: varchar('status', { length: 20 }).notNull().default('draft'),\n publishedAt: timestamp('published_at', { withTimezone: true }),\n },\n (table) => ({\n uniqueEntityLocale: unique().on(table.entityId, table.locale),\n }),\n )\n}\n"],"mappings":"gGA0BA,SAAgB,EAA2B,EAAgB,CAGzD,OAAO,EAFW,GAAG,EAAO,KAAK,gBAI/B,CACE,GAAI,EAAK,KAAK,CAAC,YAAY,CAAC,eAAe,CAC3C,SAAU,EAAK,YAAY,CAAC,SAAS,CACrC,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CAAC,SAAS,CACnD,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,QAAQ,CACpE,YAAa,EAAU,eAAgB,CAAE,aAAc,GAAM,CAAC,CAC/D,CACA,IAAW,CACV,mBAAoB,GAAQ,CAAC,GAAG,EAAM,SAAU,EAAM,OAAO,CAC9D,EACF"}
|
package/dist/locks-CNxQJieo.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{pgTable as e,timestamp as t,unique as n,uuid as r,varchar as i}from"drizzle-orm/pg-core";const a=e(`toolkit_content_locks`,{id:r(`id`).primaryKey().defaultRandom(),entityType:i(`entity_type`,{length:100}).notNull(),entityId:i(`entity_id`,{length:255}).notNull(),locale:i(`locale`,{length:10}).notNull().default(`_`),lockedBy:i(`locked_by`,{length:255}).notNull(),lockedByName:i(`locked_by_name`,{length:255}),lockedAt:t(`locked_at`,{withTimezone:!0}).notNull().defaultNow(),expiresAt:t(`expires_at`,{withTimezone:!0}).notNull()},e=>({uniqueEntityLock:n().on(e.entityType,e.entityId,e.locale)}));export{a as toolkitContentLocks};
|
|
2
|
-
//# sourceMappingURL=locks-CNxQJieo.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locks-CNxQJieo.mjs","names":[],"sources":["../src/schema/locks.ts"],"sourcesContent":["/**\n * Content lock table schema\n *\n * Single shared table (not per-entity) for pessimistic content locking.\n * Prevents concurrent edit conflicts by allowing only one editor at a time\n * per entity+locale combination.\n *\n * Locks expire after 5 minutes and must be renewed via heartbeat.\n */\n\nimport { pgTable, timestamp, unique, uuid, varchar } from 'drizzle-orm/pg-core'\n\nexport const toolkitContentLocks = pgTable(\n 'toolkit_content_locks',\n {\n id: uuid('id').primaryKey().defaultRandom(),\n entityType: varchar('entity_type', { length: 100 }).notNull(),\n entityId: varchar('entity_id', { length: 255 }).notNull(),\n locale: varchar('locale', { length: 10 }).notNull().default('_'),\n lockedBy: varchar('locked_by', { length: 255 }).notNull(),\n lockedByName: varchar('locked_by_name', { length: 255 }),\n lockedAt: timestamp('locked_at', { withTimezone: true }).notNull().defaultNow(),\n expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),\n },\n (table) => ({\n uniqueEntityLock: unique().on(table.entityType, table.entityId, table.locale),\n }),\n)\n"],"mappings":"gGAYA,MAAa,EAAsB,EACjC,wBACA,CACE,GAAI,EAAK,KAAK,CAAC,YAAY,CAAC,eAAe,CAC3C,WAAY,EAAQ,cAAe,CAAE,OAAQ,IAAK,CAAC,CAAC,SAAS,CAC7D,SAAU,EAAQ,YAAa,CAAE,OAAQ,IAAK,CAAC,CAAC,SAAS,CACzD,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,IAAI,CAChE,SAAU,EAAQ,YAAa,CAAE,OAAQ,IAAK,CAAC,CAAC,SAAS,CACzD,aAAc,EAAQ,iBAAkB,CAAE,OAAQ,IAAK,CAAC,CACxD,SAAU,EAAU,YAAa,CAAE,aAAc,GAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CAC/E,UAAW,EAAU,aAAc,CAAE,aAAc,GAAM,CAAC,CAAC,SAAS,CACrE,CACA,IAAW,CACV,iBAAkB,GAAQ,CAAC,GAAG,EAAM,WAAY,EAAM,SAAU,EAAM,OAAO,CAC9E,EACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{boolean as e,integer as t,jsonb as n,pgTable as r,timestamp as i,unique as a,uuid as o,varchar as s}from"drizzle-orm/pg-core";function c(c){return r(`${c.name}_versions`,{id:o(`id`).primaryKey().defaultRandom(),entityId:o(`entity_id`).notNull(),version:t(`version`).notNull(),locale:s(`locale`,{length:10}).notNull().default(`_`),data:n(`data`).notNull(),delta:n(`delta`),status:s(`status`,{length:20}),createdBy:s(`created_by`,{length:255}),createdByName:s(`created_by_name`,{length:255}),createdAt:i(`created_at`,{withTimezone:!0}).notNull().defaultNow(),isAutosave:e(`is_autosave`).notNull().default(!1)},e=>({uniqueEntityVersionLocale:a().on(e.entityId,e.version,e.locale)}))}export{c as generateVersionsSchema};
|
|
2
|
-
//# sourceMappingURL=versions-cotph2VG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions-cotph2VG.mjs","names":[],"sources":["../src/schema/versions.ts"],"sourcesContent":["/**\n * Version history table schema generator\n *\n * Generates a {entity}_versions table for entities with the versionable() behavior.\n * Each version stores a full snapshot + delta (changed fields only).\n */\n\nimport type { Entity } from '@murumets-ee/entity'\nimport {\n boolean,\n integer,\n jsonb,\n pgTable,\n timestamp,\n unique,\n uuid,\n varchar,\n} from 'drizzle-orm/pg-core'\n\n/**\n * Generate versions table schema for a versionable entity.\n *\n * Schema:\n * {entity}_versions (\n * id uuid PK,\n * entity_id uuid NOT NULL,\n * version integer NOT NULL,\n * locale varchar(10) NOT NULL DEFAULT '_', -- locale this snapshot belongs to\n * data jsonb NOT NULL, -- full snapshot (locale-merged view)\n * delta jsonb, -- only changed fields\n * status varchar(20), -- 'draft' | 'published' at time of save\n * created_by uuid,\n * created_at timestamp NOT NULL DEFAULT now(),\n * is_autosave boolean NOT NULL DEFAULT false,\n * UNIQUE(entity_id, version, locale)\n * )\n *\n * Each locale has its own version sequence. The default locale uses '_'\n * as the locale value (distinguishable from actual locale codes).\n */\nexport function generateVersionsSchema(entity: Entity) {\n const tableName = `${entity.name}_versions`\n\n return pgTable(\n tableName,\n {\n id: uuid('id').primaryKey().defaultRandom(),\n entityId: uuid('entity_id').notNull(),\n version: integer('version').notNull(),\n locale: varchar('locale', { length: 10 }).notNull().default('_'),\n data: jsonb('data').notNull(),\n delta: jsonb('delta'),\n status: varchar('status', { length: 20 }),\n createdBy: varchar('created_by', { length: 255 }),\n createdByName: varchar('created_by_name', { length: 255 }),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n isAutosave: boolean('is_autosave').notNull().default(false),\n },\n (table) => ({\n uniqueEntityVersionLocale: unique().on(table.entityId, table.version, table.locale),\n }),\n )\n}\n"],"mappings":"qIAwCA,SAAgB,EAAuB,EAAgB,CAGrD,OAAO,EAFW,GAAG,EAAO,KAAK,WAI/B,CACE,GAAI,EAAK,KAAK,CAAC,YAAY,CAAC,eAAe,CAC3C,SAAU,EAAK,YAAY,CAAC,SAAS,CACrC,QAAS,EAAQ,UAAU,CAAC,SAAS,CACrC,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,IAAI,CAChE,KAAM,EAAM,OAAO,CAAC,SAAS,CAC7B,MAAO,EAAM,QAAQ,CACrB,OAAQ,EAAQ,SAAU,CAAE,OAAQ,GAAI,CAAC,CACzC,UAAW,EAAQ,aAAc,CAAE,OAAQ,IAAK,CAAC,CACjD,cAAe,EAAQ,kBAAmB,CAAE,OAAQ,IAAK,CAAC,CAC1D,UAAW,EAAU,aAAc,CAAE,aAAc,GAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CACjF,WAAY,EAAQ,cAAc,CAAC,SAAS,CAAC,QAAQ,GAAM,CAC5D,CACA,IAAW,CACV,0BAA2B,GAAQ,CAAC,GAAG,EAAM,SAAU,EAAM,QAAS,EAAM,OAAO,CACpF,EACF"}
|