opacacms 0.3.17 → 0.3.19
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/admin/webcomponent.js +14 -14
- package/dist/admin.css +1 -1
- package/dist/{chunk-1bd7fz7n.js → chunk-8mqs2q7j.js} +1 -1
- package/dist/{chunk-2abqb0h6.js → chunk-9dsw6x4x.js} +23 -16
- package/dist/{chunk-b1g8jmth.js → chunk-mvz5hmdb.js} +263 -8
- package/dist/cli/core/seeding/auto-seed.d.ts +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/config.d.ts +2 -6
- package/dist/db/adapter.d.ts +1 -1
- package/dist/db/better-sqlite.d.ts +1 -1
- package/dist/db/better-sqlite.js +1633 -39
- package/dist/db/bun-sqlite.js +1627 -37
- package/dist/db/d1.d.ts +1 -1
- package/dist/db/d1.js +2326 -31
- package/dist/db/index.js +29 -4
- package/dist/db/kysely/plugins/draft-swapper.d.ts +2 -2
- package/dist/db/kysely/plugins/i18n-fallback.d.ts +2 -2
- package/dist/db/kysely/plugins/json-flattener.d.ts +2 -2
- package/dist/db/kysely/plugins/virtual-field-resolver.d.ts +2 -2
- package/dist/db/kysely/schema-builder.d.ts +1 -1
- package/dist/db/kysely/snapshot/snapshot-manager.d.ts +1 -1
- package/dist/db/postgres.js +1623 -32
- package/dist/db/sqlite.d.ts +1 -1
- package/dist/db/sqlite.js +1632 -38
- package/dist/index.js +7 -9
- package/dist/runtimes/bun.js +3 -7
- package/dist/runtimes/cloudflare-workers.js +3068 -13
- package/dist/runtimes/next.js +3 -7
- package/dist/runtimes/node.js +3 -7
- package/dist/server.js +18 -13
- package/dist/storage/index.js +6 -3
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
- package/dist/chunk-40tky6qh.js +0 -10
- package/dist/chunk-5xpf5jxd.js +0 -114
- package/dist/chunk-gzbz5jwy.js +0 -700
- package/dist/chunk-h8v093av.js +0 -185
- package/dist/chunk-jq1drsen.js +0 -82
- package/dist/chunk-q5sb5dcr.js +0 -15
- package/dist/chunk-re459gm9.js +0 -429
- package/dist/chunk-s8mqwnm1.js +0 -14
- package/dist/chunk-z9ek88xr.js +0 -15
package/dist/runtimes/next.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAPIRouter
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import"../chunk-
|
|
5
|
-
import"../chunk-2vbfc4q8.js";
|
|
3
|
+
} from "../chunk-9dsw6x4x.js";
|
|
4
|
+
import"../chunk-mvz5hmdb.js";
|
|
6
5
|
import"../chunk-hthm9srb.js";
|
|
7
|
-
import"../chunk-
|
|
8
|
-
import"../chunk-5xpf5jxd.js";
|
|
9
|
-
import"../chunk-jq1drsen.js";
|
|
10
|
-
import"../chunk-h8v093av.js";
|
|
6
|
+
import"../chunk-2vbfc4q8.js";
|
|
11
7
|
import"../chunk-8sqjbsgt.js";
|
|
12
8
|
|
|
13
9
|
// src/runtimes/next.ts
|
package/dist/runtimes/node.js
CHANGED
|
@@ -3,14 +3,10 @@ import {
|
|
|
3
3
|
} from "../chunk-a3qae86h.js";
|
|
4
4
|
import {
|
|
5
5
|
createAPIRouter
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import"../chunk-
|
|
8
|
-
import"../chunk-2vbfc4q8.js";
|
|
6
|
+
} from "../chunk-9dsw6x4x.js";
|
|
7
|
+
import"../chunk-mvz5hmdb.js";
|
|
9
8
|
import"../chunk-hthm9srb.js";
|
|
10
|
-
import"../chunk-
|
|
11
|
-
import"../chunk-5xpf5jxd.js";
|
|
12
|
-
import"../chunk-jq1drsen.js";
|
|
13
|
-
import"../chunk-h8v093av.js";
|
|
9
|
+
import"../chunk-2vbfc4q8.js";
|
|
14
10
|
import"../chunk-8sqjbsgt.js";
|
|
15
11
|
|
|
16
12
|
// src/runtimes/node.ts
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineConfig
|
|
3
|
+
} from "./chunk-8mqs2q7j.js";
|
|
1
4
|
import {
|
|
2
5
|
createAPIRouter,
|
|
3
6
|
createAdminHandlers,
|
|
@@ -7,21 +10,23 @@ import {
|
|
|
7
10
|
hydrateDoc,
|
|
8
11
|
parsePopulate,
|
|
9
12
|
populateDoc
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import
|
|
12
|
-
defineConfig
|
|
13
|
-
} from "./chunk-1bd7fz7n.js";
|
|
14
|
-
import"./chunk-b1g8jmth.js";
|
|
15
|
-
import"./chunk-2vbfc4q8.js";
|
|
13
|
+
} from "./chunk-9dsw6x4x.js";
|
|
14
|
+
import"./chunk-mvz5hmdb.js";
|
|
16
15
|
import"./chunk-hthm9srb.js";
|
|
17
|
-
import"./chunk-
|
|
18
|
-
import"./chunk-5xpf5jxd.js";
|
|
19
|
-
import"./chunk-jq1drsen.js";
|
|
20
|
-
import"./chunk-h8v093av.js";
|
|
21
|
-
import {
|
|
22
|
-
BaseDatabaseAdapter
|
|
23
|
-
} from "./chunk-s8mqwnm1.js";
|
|
16
|
+
import"./chunk-2vbfc4q8.js";
|
|
24
17
|
import"./chunk-8sqjbsgt.js";
|
|
18
|
+
// src/db/adapter.ts
|
|
19
|
+
class BaseDatabaseAdapter {
|
|
20
|
+
get raw() {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
get db() {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
push;
|
|
27
|
+
pushDestructive;
|
|
28
|
+
migrationDir;
|
|
29
|
+
}
|
|
25
30
|
export {
|
|
26
31
|
populateDoc,
|
|
27
32
|
parsePopulate,
|
package/dist/storage/index.js
CHANGED
|
@@ -151,7 +151,8 @@ function createLocalAdapter(config) {
|
|
|
151
151
|
} else if (file.buffer) {
|
|
152
152
|
await fs.writeFile(fullPath, file.buffer);
|
|
153
153
|
} else if (file.stream) {
|
|
154
|
-
const
|
|
154
|
+
const { createWriteStream } = await import("node:fs");
|
|
155
|
+
const writeStream = createWriteStream(fullPath);
|
|
155
156
|
const reader = file.stream.getReader();
|
|
156
157
|
try {
|
|
157
158
|
while (true) {
|
|
@@ -193,7 +194,8 @@ function createLocalAdapter(config) {
|
|
|
193
194
|
},
|
|
194
195
|
async exists(filename) {
|
|
195
196
|
try {
|
|
196
|
-
await
|
|
197
|
+
const { constants } = await import("node:fs");
|
|
198
|
+
await fs.access(getFullPath(path.basename(filename)), constants.F_OK);
|
|
197
199
|
return true;
|
|
198
200
|
} catch {
|
|
199
201
|
return false;
|
|
@@ -204,7 +206,8 @@ function createLocalAdapter(config) {
|
|
|
204
206
|
if (typeof globalThis.Bun !== "undefined") {
|
|
205
207
|
return globalThis.Bun.file(fullPath).stream();
|
|
206
208
|
}
|
|
207
|
-
const
|
|
209
|
+
const { createReadStream } = await import("node:fs");
|
|
210
|
+
const nodeStream = createReadStream(fullPath);
|
|
208
211
|
return new ReadableStream({
|
|
209
212
|
start(controller) {
|
|
210
213
|
nodeStream.on("data", (chunk) => controller.enqueue(new Uint8Array(chunk)));
|
package/dist/types.d.ts
CHANGED
|
@@ -524,9 +524,9 @@ export interface OpacaConfig<Resource extends string = string> {
|
|
|
524
524
|
/** Configuration for the internal logger. */
|
|
525
525
|
logger?: OpacaLoggerConfig;
|
|
526
526
|
/** List of collections that define your content models. */
|
|
527
|
-
collections: Collection[];
|
|
527
|
+
collections: Collection[] | readonly Collection[];
|
|
528
528
|
/** List of global singletons for site-wide settings. */
|
|
529
|
-
globals?: Global[];
|
|
529
|
+
globals?: Global[] | readonly Global[];
|
|
530
530
|
/** Configuration for the Admin UI dashboard and layout. */
|
|
531
531
|
admin?: AdminConfig;
|
|
532
532
|
/** Configuration for the REST and GraphQL APIs. */
|
|
@@ -685,7 +685,7 @@ export interface DatabaseAdapter {
|
|
|
685
685
|
deleteMany?(collection: string, query: Record<string, unknown>): Promise<number>;
|
|
686
686
|
findGlobal?<T extends object>(slug: string): Promise<T | null>;
|
|
687
687
|
updateGlobal?<T extends object>(slug: string, data: Partial<T>): Promise<T>;
|
|
688
|
-
migrate(collections: Collection[], globals?: Global[]): Promise<void>;
|
|
688
|
+
migrate(collections: Collection[] | readonly Collection[], globals?: Global[] | readonly Global[]): Promise<void>;
|
|
689
689
|
/**
|
|
690
690
|
* Run file-based migrations from the migrations directory.
|
|
691
691
|
*/
|
package/package.json
CHANGED
package/dist/chunk-40tky6qh.js
DELETED
package/dist/chunk-5xpf5jxd.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// src/db/kysely/field-mapper.ts
|
|
2
|
-
function toSnakeCase(str) {
|
|
3
|
-
const res = str.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
4
|
-
if (res.startsWith("_") && !str.startsWith("_")) {
|
|
5
|
-
return res.slice(1);
|
|
6
|
-
}
|
|
7
|
-
return res;
|
|
8
|
-
}
|
|
9
|
-
function mapFieldToPostgresType(field) {
|
|
10
|
-
switch (field.type) {
|
|
11
|
-
case "text":
|
|
12
|
-
case "richtext":
|
|
13
|
-
case "select":
|
|
14
|
-
case "radio":
|
|
15
|
-
case "relationship":
|
|
16
|
-
return "text";
|
|
17
|
-
case "number":
|
|
18
|
-
return "double precision";
|
|
19
|
-
case "boolean":
|
|
20
|
-
return "boolean";
|
|
21
|
-
case "date":
|
|
22
|
-
return "timestamptz";
|
|
23
|
-
case "json":
|
|
24
|
-
case "file":
|
|
25
|
-
return "jsonb";
|
|
26
|
-
default:
|
|
27
|
-
return "text";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function mapFieldToSQLiteType(field) {
|
|
31
|
-
switch (field.type) {
|
|
32
|
-
case "text":
|
|
33
|
-
case "richtext":
|
|
34
|
-
case "select":
|
|
35
|
-
case "radio":
|
|
36
|
-
case "relationship":
|
|
37
|
-
case "date":
|
|
38
|
-
case "json":
|
|
39
|
-
case "file":
|
|
40
|
-
return "text";
|
|
41
|
-
case "number":
|
|
42
|
-
return "numeric";
|
|
43
|
-
case "boolean":
|
|
44
|
-
return "integer";
|
|
45
|
-
default:
|
|
46
|
-
return "text";
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function flattenFields(fields, prefix = "") {
|
|
50
|
-
const result = [];
|
|
51
|
-
for (const field of fields) {
|
|
52
|
-
if (field.type === "join" || field.type === "virtual" || field.type === "ui")
|
|
53
|
-
continue;
|
|
54
|
-
const currentName = field.name ? `${prefix}${field.name}` : undefined;
|
|
55
|
-
if (field.type === "group") {
|
|
56
|
-
if (field.fields && Array.isArray(field.fields)) {
|
|
57
|
-
const nextPrefix = currentName ? `${currentName}__` : "";
|
|
58
|
-
result.push(...flattenFields(field.fields, nextPrefix));
|
|
59
|
-
}
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (field.type === "blocks") {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (currentName) {
|
|
69
|
-
result.push({ ...field, name: currentName });
|
|
70
|
-
}
|
|
71
|
-
if (field.type === "row" || field.type === "collapsible") {
|
|
72
|
-
if (field.fields && Array.isArray(field.fields)) {
|
|
73
|
-
result.push(...flattenFields(field.fields, prefix));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (field.type === "tabs" && field.tabs && Array.isArray(field.tabs)) {
|
|
77
|
-
for (const tab of field.tabs) {
|
|
78
|
-
if (tab.fields && Array.isArray(tab.fields)) {
|
|
79
|
-
result.push(...flattenFields(tab.fields, prefix));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
function getRelationalFields(fields, prefix = "") {
|
|
87
|
-
const result = [];
|
|
88
|
-
for (const field of fields) {
|
|
89
|
-
const currentName = field.name ? `${prefix}${field.name}` : undefined;
|
|
90
|
-
if (field.type === "relationship" && "hasMany" in field && field.hasMany || field.type === "blocks") {
|
|
91
|
-
if (currentName) {
|
|
92
|
-
result.push({ ...field, name: currentName });
|
|
93
|
-
}
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (field.type === "group" || field.type === "row" || field.type === "collapsible") {
|
|
97
|
-
if (field.fields && Array.isArray(field.fields)) {
|
|
98
|
-
const nextPrefix = field.type === "group" && field.name ? `${currentName}__` : prefix;
|
|
99
|
-
result.push(...getRelationalFields(field.fields, nextPrefix));
|
|
100
|
-
}
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (field.type === "tabs" && field.tabs && Array.isArray(field.tabs)) {
|
|
104
|
-
for (const tab of field.tabs) {
|
|
105
|
-
if (tab.fields && Array.isArray(tab.fields)) {
|
|
106
|
-
result.push(...getRelationalFields(tab.fields, prefix));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export { toSnakeCase, mapFieldToPostgresType, mapFieldToSQLiteType, flattenFields, getRelationalFields };
|