opacacms 0.3.18 → 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.
@@ -1,13 +1,9 @@
1
1
  import {
2
2
  createAPIRouter
3
- } from "../chunk-2abqb0h6.js";
4
- import"../chunk-b1g8jmth.js";
5
- import"../chunk-2vbfc4q8.js";
3
+ } from "../chunk-9dsw6x4x.js";
4
+ import"../chunk-mvz5hmdb.js";
6
5
  import"../chunk-hthm9srb.js";
7
- import"../chunk-q5sb5dcr.js";
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
@@ -3,14 +3,10 @@ import {
3
3
  } from "../chunk-a3qae86h.js";
4
4
  import {
5
5
  createAPIRouter
6
- } from "../chunk-2abqb0h6.js";
7
- import"../chunk-b1g8jmth.js";
8
- import"../chunk-2vbfc4q8.js";
6
+ } from "../chunk-9dsw6x4x.js";
7
+ import"../chunk-mvz5hmdb.js";
9
8
  import"../chunk-hthm9srb.js";
10
- import"../chunk-q5sb5dcr.js";
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-2abqb0h6.js";
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-q5sb5dcr.js";
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,
@@ -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 writeStream = __require("node:fs").createWriteStream(fullPath);
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 fs.access(getFullPath(path.basename(filename)), __require("node:fs").constants.F_OK);
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 nodeStream = __require("node:fs").createReadStream(fullPath);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opacacms",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "license": "MIT",
5
5
  "description": "OpacaCMS: A lightweight, type-safe, and developer-first Headless CMS for the edge and beyond.",
6
6
  "keywords": [
@@ -1,10 +0,0 @@
1
- import {
2
- getSystemCollections,
3
- init_system_schema
4
- } from "./chunk-h8v093av.js";
5
- import"./chunk-8sqjbsgt.js";
6
- init_system_schema();
7
-
8
- export {
9
- getSystemCollections
10
- };
@@ -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 };