opacacms 0.1.0 → 0.1.2

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.
Files changed (247) hide show
  1. package/dist/admin/index.js +49 -0
  2. package/dist/{chunk-2zm8cy1w.js → admin/webcomponent.js} +116 -168
  3. package/dist/{chunk-6dhs73zq.js → chunk-2yz1nsxs.js} +1 -1
  4. package/dist/chunk-fa5mg0hr.js +96 -0
  5. package/dist/{chunk-kwp83w8b.js → chunk-m09hahe2.js} +7 -7
  6. package/dist/{chunk-hmhcense.js → chunk-ry15hke8.js} +253 -4
  7. package/dist/chunk-vtvqfhgy.js +2442 -0
  8. package/dist/{chunk-f3nvxn63.js → chunk-y8hc6nm4.js} +1 -1
  9. package/dist/{src/cli → cli}/index.js +10 -10
  10. package/dist/{src/client.js → client.js} +2 -2
  11. package/dist/{src/db → db}/bun-sqlite.js +10 -10
  12. package/dist/{src/db → db}/d1.js +8 -8
  13. package/dist/db/index.d.ts +2 -0
  14. package/dist/db/index.js +7 -0
  15. package/dist/db/migration.d.ts +39 -0
  16. package/dist/{src/db → db}/postgres.js +10 -10
  17. package/dist/{src/db → db}/sqlite.js +8 -8
  18. package/dist/index.d.ts +0 -2
  19. package/dist/index.js +13 -0
  20. package/dist/{src/runtimes → runtimes}/bun.js +5 -6
  21. package/dist/{src/runtimes → runtimes}/cloudflare-workers.js +5 -6
  22. package/dist/{src/runtimes → runtimes}/next.js +5 -6
  23. package/dist/{src/runtimes → runtimes}/node.js +5 -6
  24. package/dist/{src/server.js → server.js} +7 -8
  25. package/dist/storage/index.d.ts +0 -3
  26. package/dist/storage/index.js +35 -0
  27. package/dist/types.d.ts +5 -2
  28. package/package.json +161 -39
  29. package/bun.lock +0 -34
  30. package/dist/api.d.ts +0 -6
  31. package/dist/chunk-8gkhn1d4.js +0 -309
  32. package/dist/chunk-dy5t83hr.js +0 -261
  33. package/dist/src/admin/index.js +0 -176
  34. package/dist/src/admin/webcomponent.js +0 -19
  35. package/dist/src/api.js +0 -27
  36. package/dist/src/index.js +0 -20
  37. package/dist/src/storage/index.js +0 -355
  38. package/global.d.ts +0 -11
  39. package/src/admin/api-client.ts +0 -63
  40. package/src/admin/auth-client.ts +0 -40
  41. package/src/admin/custom-field.ts +0 -179
  42. package/src/admin/index.ts +0 -15
  43. package/src/admin/react.tsx +0 -72
  44. package/src/admin/router.ts +0 -9
  45. package/src/admin/stores/admin-queries.ts +0 -121
  46. package/src/admin/stores/auth.ts +0 -61
  47. package/src/admin/stores/column-visibility.ts +0 -67
  48. package/src/admin/stores/config.ts +0 -15
  49. package/src/admin/stores/media.ts +0 -95
  50. package/src/admin/stores/query.ts +0 -13
  51. package/src/admin/stores/ui.ts +0 -29
  52. package/src/admin/ui/admin-client.tsx +0 -283
  53. package/src/admin/ui/admin-layout.tsx +0 -276
  54. package/src/admin/ui/components/ColumnVisibilityToggle.tsx +0 -141
  55. package/src/admin/ui/components/DataDetailSheet.tsx +0 -141
  56. package/src/admin/ui/components/DataDetailView.tsx +0 -175
  57. package/src/admin/ui/components/Table.tsx +0 -67
  58. package/src/admin/ui/components/fields/ArrayField.tsx +0 -166
  59. package/src/admin/ui/components/fields/BlocksField.tsx +0 -202
  60. package/src/admin/ui/components/fields/BooleanField.tsx +0 -50
  61. package/src/admin/ui/components/fields/CollapsibleField.tsx +0 -75
  62. package/src/admin/ui/components/fields/DateField.tsx +0 -45
  63. package/src/admin/ui/components/fields/FileField.tsx +0 -322
  64. package/src/admin/ui/components/fields/GroupField.tsx +0 -50
  65. package/src/admin/ui/components/fields/JoinField.tsx +0 -23
  66. package/src/admin/ui/components/fields/NumberField.tsx +0 -46
  67. package/src/admin/ui/components/fields/RadioField.tsx +0 -62
  68. package/src/admin/ui/components/fields/RelationshipField.tsx +0 -278
  69. package/src/admin/ui/components/fields/RowField.tsx +0 -40
  70. package/src/admin/ui/components/fields/SelectField.tsx +0 -59
  71. package/src/admin/ui/components/fields/TabsField.tsx +0 -101
  72. package/src/admin/ui/components/fields/TextAreaField.tsx +0 -54
  73. package/src/admin/ui/components/fields/TextField.tsx +0 -49
  74. package/src/admin/ui/components/fields/VirtualField.tsx +0 -53
  75. package/src/admin/ui/components/fields/index.tsx +0 -371
  76. package/src/admin/ui/components/fields/richtext-editor/index.tsx +0 -211
  77. package/src/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.tsx +0 -142
  78. package/src/admin/ui/components/fields/richtext-editor/nodes/ImageNode.tsx +0 -95
  79. package/src/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.tsx +0 -226
  80. package/src/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.tsx +0 -16
  81. package/src/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.tsx +0 -184
  82. package/src/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.tsx +0 -240
  83. package/src/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.tsx +0 -40
  84. package/src/admin/ui/components/fields/utils.ts +0 -1
  85. package/src/admin/ui/components/link.tsx +0 -41
  86. package/src/admin/ui/components/media/AssetManagerModal.tsx +0 -334
  87. package/src/admin/ui/components/toast.tsx +0 -72
  88. package/src/admin/ui/components/ui/accordion.tsx +0 -51
  89. package/src/admin/ui/components/ui/alert-dialog.tsx +0 -98
  90. package/src/admin/ui/components/ui/blocks.tsx +0 -32
  91. package/src/admin/ui/components/ui/breadcrumbs.tsx +0 -59
  92. package/src/admin/ui/components/ui/button.tsx +0 -26
  93. package/src/admin/ui/components/ui/collapsible.tsx +0 -124
  94. package/src/admin/ui/components/ui/dialog.tsx +0 -79
  95. package/src/admin/ui/components/ui/group.tsx +0 -20
  96. package/src/admin/ui/components/ui/index.ts +0 -17
  97. package/src/admin/ui/components/ui/input.tsx +0 -12
  98. package/src/admin/ui/components/ui/join.tsx +0 -53
  99. package/src/admin/ui/components/ui/label.tsx +0 -11
  100. package/src/admin/ui/components/ui/radio-group.tsx +0 -75
  101. package/src/admin/ui/components/ui/relationship-detail-sheet.tsx +0 -122
  102. package/src/admin/ui/components/ui/relationship.tsx +0 -58
  103. package/src/admin/ui/components/ui/scroll-area.tsx +0 -19
  104. package/src/admin/ui/components/ui/select.tsx +0 -187
  105. package/src/admin/ui/components/ui/separator.tsx +0 -21
  106. package/src/admin/ui/components/ui/sheet.tsx +0 -106
  107. package/src/admin/ui/components/ui/tabs.tsx +0 -116
  108. package/src/admin/ui/components/ui/utils.ts +0 -3
  109. package/src/admin/ui/hooks/use-debounce.ts +0 -15
  110. package/src/admin/ui/styles/_locale-switcher.scss +0 -33
  111. package/src/admin/ui/styles/accordion.scss +0 -60
  112. package/src/admin/ui/styles/animations.scss +0 -41
  113. package/src/admin/ui/styles/asset-manager.scss +0 -547
  114. package/src/admin/ui/styles/badge.scss +0 -13
  115. package/src/admin/ui/styles/base.scss +0 -22
  116. package/src/admin/ui/styles/button.scss +0 -161
  117. package/src/admin/ui/styles/card.scss +0 -13
  118. package/src/admin/ui/styles/collapsible.scss +0 -75
  119. package/src/admin/ui/styles/data-detail.scss +0 -92
  120. package/src/admin/ui/styles/dialog.scss +0 -102
  121. package/src/admin/ui/styles/empty-state.scss +0 -22
  122. package/src/admin/ui/styles/group.scss +0 -19
  123. package/src/admin/ui/styles/index.scss +0 -33
  124. package/src/admin/ui/styles/input.scss +0 -80
  125. package/src/admin/ui/styles/label.scss +0 -12
  126. package/src/admin/ui/styles/layout.scss +0 -56
  127. package/src/admin/ui/styles/lexical.scss +0 -469
  128. package/src/admin/ui/styles/loading.scss +0 -102
  129. package/src/admin/ui/styles/media-registry.scss +0 -597
  130. package/src/admin/ui/styles/pagination.scss +0 -20
  131. package/src/admin/ui/styles/radio-group.scss +0 -66
  132. package/src/admin/ui/styles/row.scss +0 -17
  133. package/src/admin/ui/styles/scrollbar.scss +0 -36
  134. package/src/admin/ui/styles/select.scss +0 -121
  135. package/src/admin/ui/styles/separator.scss +0 -14
  136. package/src/admin/ui/styles/sheet.scss +0 -152
  137. package/src/admin/ui/styles/sidebar.scss +0 -148
  138. package/src/admin/ui/styles/switch.scss +0 -59
  139. package/src/admin/ui/styles/table.scss +0 -207
  140. package/src/admin/ui/styles/tabs.scss +0 -62
  141. package/src/admin/ui/styles/toast.scss +0 -45
  142. package/src/admin/ui/styles/variables.scss +0 -24
  143. package/src/admin/ui/views/collection-list-view.tsx +0 -720
  144. package/src/admin/ui/views/dashboard-view.tsx +0 -263
  145. package/src/admin/ui/views/document-edit-view.tsx +0 -384
  146. package/src/admin/ui/views/global-edit-view.tsx +0 -226
  147. package/src/admin/ui/views/init-view.tsx +0 -182
  148. package/src/admin/ui/views/login-view.tsx +0 -123
  149. package/src/admin/ui/views/media-registry-view.tsx +0 -1104
  150. package/src/admin/ui/views/settings-view.tsx +0 -729
  151. package/src/admin/webcomponent.tsx +0 -15
  152. package/src/api.ts +0 -9
  153. package/src/auth/index.ts +0 -194
  154. package/src/auth/migrations.ts +0 -87
  155. package/src/auth/premissions.ts +0 -46
  156. package/src/cli/commands/generate-types.ts +0 -116
  157. package/src/cli/commands/init.ts +0 -95
  158. package/src/cli/commands/migrate-commands.ts +0 -160
  159. package/src/cli/commands/seed-command.ts +0 -11
  160. package/src/cli/d1-mock.ts +0 -101
  161. package/src/cli/index.test.ts +0 -84
  162. package/src/cli/index.ts +0 -183
  163. package/src/cli/r2-mock.ts +0 -217
  164. package/src/cli/seeding.ts +0 -405
  165. package/src/client.ts +0 -181
  166. package/src/config-utils.ts +0 -102
  167. package/src/config.ts +0 -49
  168. package/src/db/adapter.ts +0 -53
  169. package/src/db/better-sqlite.ts +0 -630
  170. package/src/db/bun-sqlite.ts +0 -646
  171. package/src/db/d1.ts +0 -711
  172. package/src/db/kysely/data-mapper.ts +0 -142
  173. package/src/db/kysely/field-mapper.ts +0 -148
  174. package/src/db/kysely/migration-generator.ts +0 -223
  175. package/src/db/kysely/query-builder.ts +0 -92
  176. package/src/db/kysely/schema-builder.ts +0 -439
  177. package/src/db/kysely/sql-utils.ts +0 -13
  178. package/src/db/postgres.ts +0 -621
  179. package/src/db/sqlite.ts +0 -658
  180. package/src/db/system-schema.ts +0 -121
  181. package/src/index.ts +0 -13
  182. package/src/runtimes/README.md +0 -59
  183. package/src/runtimes/bun.ts +0 -49
  184. package/src/runtimes/cloudflare-workers.ts +0 -38
  185. package/src/runtimes/next.ts +0 -26
  186. package/src/runtimes/node.ts +0 -52
  187. package/src/schema/collection.ts +0 -184
  188. package/src/schema/fields/base.ts +0 -164
  189. package/src/schema/fields/index.ts +0 -427
  190. package/src/schema/global.ts +0 -145
  191. package/src/schema/index.ts +0 -4
  192. package/src/schema/infer.ts +0 -72
  193. package/src/server/admin-router.ts +0 -20
  194. package/src/server/admin.ts +0 -142
  195. package/src/server/assets.ts +0 -306
  196. package/src/server/collection-router.ts +0 -55
  197. package/src/server/handlers.ts +0 -722
  198. package/src/server/middlewares/admin.ts +0 -27
  199. package/src/server/middlewares/auth.ts +0 -89
  200. package/src/server/middlewares/context.ts +0 -17
  201. package/src/server/middlewares/cors.ts +0 -24
  202. package/src/server/middlewares/database-init.ts +0 -74
  203. package/src/server/middlewares/rate-limit.ts +0 -71
  204. package/src/server/router.ts +0 -47
  205. package/src/server/setup-middlewares.ts +0 -58
  206. package/src/server/system-router.ts +0 -35
  207. package/src/server.ts +0 -9
  208. package/src/storage/adapters/cloudflare-r2.ts +0 -136
  209. package/src/storage/adapters/local.ts +0 -146
  210. package/src/storage/adapters/s3.ts +0 -186
  211. package/src/storage/errors.ts +0 -46
  212. package/src/storage/index.ts +0 -5
  213. package/src/storage/types.ts +0 -39
  214. package/src/types.ts +0 -577
  215. package/src/utils/lexical.ts +0 -37
  216. package/src/utils/logger.ts +0 -73
  217. package/src/validation.ts +0 -429
  218. package/src/validator.ts +0 -179
  219. package/test/admin-custom-field.test.ts +0 -162
  220. package/test/admin-react-field.test.tsx +0 -134
  221. package/test/api-features.test.ts +0 -78
  222. package/test/api.test.ts +0 -178
  223. package/test/auth.test.ts +0 -62
  224. package/test/cli-integration.test.ts +0 -146
  225. package/test/cli.test.ts +0 -25
  226. package/test/db/postgres.test.ts +0 -95
  227. package/test/db/sqlite-filter.test.ts +0 -53
  228. package/test/db/sqlite.test.ts +0 -82
  229. package/test/engine-features.test.ts +0 -79
  230. package/test/globals.test.ts +0 -74
  231. package/test/integration-tmp/db-app/opacacms.config.ts +0 -15
  232. package/test/integration-tmp/my-sqlite-app/opacacms.config.ts +0 -25
  233. package/test/integration-tmp/my-test-app/index.ts +0 -8
  234. package/test/integration-tmp/my-test-app/opacacms.config.ts +0 -16
  235. package/test/integration-tmp/my-test-app/package.json +0 -12
  236. package/test/populate.test.ts +0 -79
  237. package/test/runtimes.test.ts +0 -43
  238. package/test/schema-builder.test.ts +0 -107
  239. package/test/schema-features.test.ts +0 -63
  240. package/test/seeding.test.ts +0 -68
  241. package/test/storage/local.test.ts +0 -72
  242. package/test/storage/s3.test.ts +0 -60
  243. package/test/structural-data.test.ts +0 -100
  244. package/test/test-setup.ts +0 -11
  245. package/test/validation.test.ts +0 -162
  246. package/tsconfig.json +0 -42
  247. /package/dist/{src/admin/index.css → admin/webcomponent.css} +0 -0
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "opacacms",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
+ "sideEffects": false,
4
5
  "scripts": {
5
6
  "build": "bun run ../../scripts/build.ts && tsc --emitDeclarationOnly",
6
7
  "build:publish": "bun run ../../scripts/build.ts --publish && tsc --emitDeclarationOnly",
@@ -13,6 +14,49 @@
13
14
  "check-types": "tsc --noEmit",
14
15
  "lint": "bunx biome check ."
15
16
  },
17
+ "typesVersions": {
18
+ "*": {
19
+ "server": [
20
+ "./dist/server.d.ts"
21
+ ],
22
+ "admin": [
23
+ "./dist/admin/index.d.ts"
24
+ ],
25
+ "admin/wc": [
26
+ "./dist/admin/webcomponent.d.ts"
27
+ ],
28
+ "client": [
29
+ "./dist/client.d.ts"
30
+ ],
31
+ "schema": [
32
+ "./dist/schema/index.ts"
33
+ ],
34
+ "db/*": [
35
+ "./dist/db/*.d.ts"
36
+ ],
37
+ "db": [
38
+ "./dist/db/index.d.ts"
39
+ ],
40
+ "storage/*": [
41
+ "./dist/storage/adapters/*.d.ts"
42
+ ],
43
+ "storage": [
44
+ "./dist/storage/index.d.ts"
45
+ ],
46
+ "runtimes/*": [
47
+ "./dist/runtimes/*.d.ts"
48
+ ],
49
+ "*": [
50
+ "./dist/*.d.ts",
51
+ "./dist/*/index.d.ts"
52
+ ]
53
+ }
54
+ },
55
+ "files": [
56
+ "dist",
57
+ "README.md",
58
+ "LICENSE"
59
+ ],
16
60
  "module": "dist/index.js",
17
61
  "type": "module",
18
62
  "bin": {
@@ -27,18 +71,18 @@
27
71
  "types": "./dist/server.d.ts",
28
72
  "import": "./dist/server.js"
29
73
  },
30
- "./api": {
31
- "types": "./dist/api.d.ts",
32
- "import": "./dist/api.js"
33
- },
34
74
  "./admin": {
35
75
  "types": "./dist/admin/index.d.ts",
36
76
  "import": "./dist/admin/index.js"
37
77
  },
38
- "./admin/webcomponent": {
78
+ "./admin/wc": {
39
79
  "types": "./dist/admin/webcomponent.d.ts",
40
80
  "import": "./dist/admin/webcomponent.js"
41
81
  },
82
+ "./db": {
83
+ "types": "./dist/db/index.d.ts",
84
+ "import": "./dist/db/index.js"
85
+ },
42
86
  "./db/postgres": {
43
87
  "types": "./dist/db/postgres.d.ts",
44
88
  "import": "./dist/db/postgres.js"
@@ -83,6 +127,18 @@
83
127
  "types": "./dist/storage/index.d.ts",
84
128
  "import": "./dist/storage/index.js"
85
129
  },
130
+ "./storage/s3": {
131
+ "types": "./dist/storage/adapters/s3.d.ts",
132
+ "import": "./dist/storage/adapters/s3.js"
133
+ },
134
+ "./storage/r2": {
135
+ "types": "./dist/storage/adapters/cloudflare-r2.d.ts",
136
+ "import": "./dist/storage/adapters/cloudflare-r2.js"
137
+ },
138
+ "./storage/local": {
139
+ "types": "./dist/storage/adapters/local.d.ts",
140
+ "import": "./dist/storage/adapters/local.js"
141
+ },
86
142
  "./schema": {
87
143
  "types": "./dist/schema/index.d.ts",
88
144
  "import": "./dist/schema/index.js"
@@ -90,6 +146,7 @@
90
146
  },
91
147
  "devDependencies": {
92
148
  "@cloudflare/workers-types": "^4.20260313.1",
149
+ "@faker-js/faker": "^10.3.0",
93
150
  "@happy-dom/global-registrator": "^20.8.4",
94
151
  "@testing-library/dom": "^10.4.1",
95
152
  "@testing-library/react": "^16.3.2",
@@ -97,55 +154,120 @@
97
154
  "@types/react": "^19.2.14",
98
155
  "@types/react-dom": "^19.2.3",
99
156
  "bun-plugin-scss": "^1.0.0",
157
+ "dotenv": "^17.3.1",
100
158
  "drizzle-kit": "^0.31.9",
101
159
  "happy-dom": "^20.8.4",
102
160
  "sass": "^1.98.0"
103
161
  },
104
162
  "peerDependencies": {
163
+ "@lexical/code": ">=0.41.0",
164
+ "@lexical/history": ">=0.41.0",
165
+ "@lexical/html": ">=0.41.0",
166
+ "@lexical/link": ">=0.41.0",
167
+ "@lexical/list": ">=0.41.0",
168
+ "@lexical/mark": ">=0.41.0",
169
+ "@lexical/react": ">=0.41.0",
170
+ "@lexical/rich-text": ">=0.41.0",
171
+ "@lexical/selection": ">=0.41.0",
172
+ "@lexical/utils": ">=0.41.0",
173
+ "@nanostores/persistent": ">=1.3.0",
174
+ "@nanostores/query": ">=0.3.0",
175
+ "@nanostores/react": ">=1.0.0",
176
+ "@nanostores/router": ">=1.0.0",
177
+ "@r2wc/react-to-web-component": ">=2.1.0",
178
+ "@tanstack/react-form": ">=1.0.0",
179
+ "lexical": ">=0.41.0",
180
+ "lucide-react": ">=0.400.0",
181
+ "nanostores": ">=1.0.0",
182
+ "react": ">=18.0.0",
183
+ "react-dom": ">=18.0.0",
105
184
  "typescript": "^5.9.3"
106
185
  },
107
- "dependencies": {
186
+ "peerDependenciesMeta": {
187
+ "@lexical/code": {
188
+ "optional": true
189
+ },
190
+ "@lexical/history": {
191
+ "optional": true
192
+ },
193
+ "@lexical/html": {
194
+ "optional": true
195
+ },
196
+ "@lexical/link": {
197
+ "optional": true
198
+ },
199
+ "@lexical/list": {
200
+ "optional": true
201
+ },
202
+ "@lexical/mark": {
203
+ "optional": true
204
+ },
205
+ "@lexical/react": {
206
+ "optional": true
207
+ },
208
+ "@lexical/rich-text": {
209
+ "optional": true
210
+ },
211
+ "@lexical/selection": {
212
+ "optional": true
213
+ },
214
+ "@lexical/utils": {
215
+ "optional": true
216
+ },
217
+ "@nanostores/persistent": {
218
+ "optional": true
219
+ },
220
+ "@nanostores/query": {
221
+ "optional": true
222
+ },
223
+ "@nanostores/react": {
224
+ "optional": true
225
+ },
226
+ "@nanostores/router": {
227
+ "optional": true
228
+ },
229
+ "@r2wc/react-to-web-component": {
230
+ "optional": true
231
+ },
232
+ "@tanstack/react-form": {
233
+ "optional": true
234
+ },
235
+ "lexical": {
236
+ "optional": true
237
+ },
238
+ "lucide-react": {
239
+ "optional": true
240
+ },
241
+ "nanostores": {
242
+ "optional": true
243
+ },
244
+ "react": {
245
+ "optional": true
246
+ },
247
+ "react-dom": {
248
+ "optional": true
249
+ }
250
+ },
251
+ "optionalDependencies": {
108
252
  "@aws-sdk/client-s3": "^3.1009.0",
109
253
  "@aws-sdk/s3-request-presigner": "^3.1009.0",
110
- "@better-auth/api-key": "^1.5.5",
111
- "@better-auth/core": "^1.5.5",
112
- "@faker-js/faker": "^10.3.0",
113
254
  "@hono-rate-limiter/cloudflare": "^0.2.2",
114
255
  "@hono/node-server": "^1.19.11",
115
- "@lexical/code": "^0.41.0",
116
- "@lexical/history": "^0.41.0",
117
- "@lexical/html": "^0.41.0",
118
- "@lexical/link": "^0.41.0",
119
- "@lexical/list": "^0.41.0",
120
- "@lexical/mark": "^0.41.0",
121
- "@lexical/react": "^0.41.0",
122
- "@lexical/rich-text": "^0.41.0",
123
- "@lexical/selection": "^0.41.0",
124
- "@lexical/utils": "^0.41.0",
125
- "@nanostores/persistent": "^1.3.3",
126
- "@nanostores/query": "^0.3.4",
127
- "@nanostores/react": "^1.0.0",
128
- "@nanostores/router": "^1.0.0",
129
- "@r2wc/react-to-web-component": "^2.1.1",
130
- "@tanstack/react-form": "^1.28.5",
131
- "@types/better-sqlite3": "^7.6.13",
132
- "better-auth": "^1.5.5",
133
256
  "better-sqlite3": "^12.6.2",
134
- "dotenv": "^17.3.1",
135
- "drizzle-orm": "^0.45.1",
136
- "hono": "^4.12.7",
137
257
  "hono-rate-limiter": "^0.5.3",
138
- "ky": "^1.14.3",
139
- "kysely": "^0.28.11",
140
258
  "kysely-bun-sqlite": "^0.4.0",
141
259
  "kysely-d1": "^0.4.0",
142
260
  "kysely-postgres-js": "^3.0.0",
143
- "lexical": "^0.41.0",
144
- "lucide-react": "^0.577.0",
145
- "nanostores": "^1.1.1",
146
- "postgres": "^3.4.8",
147
- "react": "^19.2.4",
148
- "react-dom": "^19.2.4",
261
+ "postgres": "^3.4.8"
262
+ },
263
+ "dependencies": {
264
+ "@better-auth/api-key": "^1.5.5",
265
+ "@better-auth/core": "^1.5.5",
266
+ "@types/better-sqlite3": "^7.6.13",
267
+ "better-auth": "^1.5.5",
268
+ "hono": "^4.12.7",
269
+ "ky": "^1.14.3",
270
+ "kysely": "^0.28.11",
149
271
  "zod": "^4.3.6"
150
272
  }
151
273
  }
package/bun.lock DELETED
@@ -1,34 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "configVersion": 1,
4
- "workspaces": {
5
- "": {
6
- "name": "opacacms",
7
- "dependencies": {
8
- "hono": "^4.11.4",
9
- "zod": "^4.3.5",
10
- },
11
- "devDependencies": {
12
- "@types/bun": "latest",
13
- },
14
- "peerDependencies": {
15
- "typescript": "^5",
16
- },
17
- },
18
- },
19
- "packages": {
20
- "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
21
-
22
- "@types/node": ["@types/node@25.0.9", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw=="],
23
-
24
- "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
25
-
26
- "hono": ["hono@4.11.4", "", {}, "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA=="],
27
-
28
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
29
-
30
- "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
31
-
32
- "zod": ["zod@4.3.5", "", {}, "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g=="],
33
- }
34
- }
package/dist/api.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from "./config";
2
- export * from "./db/adapter";
3
- export * from "./server/admin";
4
- export * from "./server/handlers";
5
- export * from "./server/router";
6
- export * from "./types";
@@ -1,309 +0,0 @@
1
- import {
2
- __require
3
- } from "./chunk-8sqjbsgt.js";
4
-
5
- // src/cli/seeding.ts
6
- import { faker } from "@faker-js/faker";
7
- var defaultFieldGenerators = {
8
- text: () => faker.lorem.words(3),
9
- textarea: () => faker.lorem.paragraph(),
10
- number: () => faker.number.int({ min: 1, max: 1000 }),
11
- richtext: () => JSON.stringify({
12
- root: {
13
- children: [
14
- {
15
- children: [
16
- {
17
- detail: 0,
18
- format: 0,
19
- mode: "normal",
20
- style: "",
21
- text: faker.lorem.sentence(),
22
- type: "text",
23
- version: 1
24
- }
25
- ],
26
- direction: "ltr",
27
- format: "",
28
- indent: 0,
29
- type: "heading",
30
- tag: "h1",
31
- version: 1
32
- },
33
- {
34
- children: [
35
- {
36
- detail: 0,
37
- format: 0,
38
- mode: "normal",
39
- style: "",
40
- text: faker.lorem.paragraphs(2),
41
- type: "text",
42
- version: 1
43
- }
44
- ],
45
- direction: "ltr",
46
- format: "",
47
- indent: 0,
48
- type: "paragraph",
49
- version: 1
50
- }
51
- ],
52
- direction: "ltr",
53
- format: "",
54
- indent: 0,
55
- type: "root",
56
- version: 1
57
- }
58
- }),
59
- boolean: () => faker.datatype.boolean(),
60
- date: () => faker.date.recent().toISOString(),
61
- email: () => faker.internet.email(),
62
- json: () => ({ [faker.lorem.word()]: faker.lorem.sentence() }),
63
- select: () => faker.lorem.word(),
64
- radio: () => faker.lorem.word(),
65
- blocks: () => []
66
- };
67
- async function getRandomIds(db, relationTo, count = 1) {
68
- try {
69
- const result = await db.find(relationTo, {}, { limit: 50 });
70
- const docs = result.docs || [];
71
- if (docs.length === 0) {
72
- if (!relationTo.startsWith("_")) {
73
- console.warn(`[Seeding] No documents found in '${relationTo}' for relationship.`);
74
- }
75
- return [];
76
- }
77
- const shuffled = [...docs].sort(() => 0.5 - Math.random());
78
- const selected = shuffled.slice(0, count).map((doc) => doc.id);
79
- return selected;
80
- } catch (e) {
81
- console.error(`[Seeding] Failed to fetch random IDs for ${relationTo}:`, e);
82
- return [];
83
- }
84
- }
85
- async function generateDataForFields(fields, db, locales = []) {
86
- const record = {};
87
- for (const field of fields) {
88
- if (field.type === "row" || field.type === "collapsible") {
89
- Object.assign(record, await generateDataForFields(field.fields, db, locales));
90
- continue;
91
- }
92
- if (field.type === "tabs") {
93
- for (const tab of field.tabs) {
94
- Object.assign(record, await generateDataForFields(tab.fields, db, locales));
95
- }
96
- continue;
97
- }
98
- if (field.type === "group" && field.name) {
99
- record[field.name] = await generateDataForFields(field.fields, db, locales);
100
- continue;
101
- }
102
- if (field.name) {
103
- const isLocalized = !!field.localized && locales.length > 0;
104
- const generateFieldValue = async () => {
105
- if (field.type === "relationship" && "relationTo" in field) {
106
- if (field.hasMany) {
107
- const count = faker.number.int({ min: 1, max: 3 });
108
- return await getRandomIds(db, field.relationTo, count);
109
- }
110
- const ids = await getRandomIds(db, field.relationTo, 1);
111
- return ids[0] || null;
112
- }
113
- if (field.type === "blocks" && field.blocks) {
114
- const blockCount = faker.number.int({ min: 1, max: 3 });
115
- const generatedBlocks = [];
116
- for (let i = 0;i < blockCount; i++) {
117
- const blockType = field.blocks[faker.number.int({ min: 0, max: field.blocks.length - 1 })];
118
- if (!blockType)
119
- continue;
120
- const blockData = await generateDataForFields(blockType.fields, db, locales);
121
- generatedBlocks.push({
122
- ...blockData,
123
- blockType: blockType.slug,
124
- id: faker.string.uuid()
125
- });
126
- }
127
- return generatedBlocks;
128
- }
129
- const generator = defaultFieldGenerators[field.type];
130
- if (generator) {
131
- if (field.type === "select" || field.type === "radio") {
132
- const options = field.options;
133
- const choices = options?.choices || [];
134
- if (choices.length > 0) {
135
- const choice = choices[Math.floor(Math.random() * choices.length)];
136
- return typeof choice === "string" ? choice : choice.value;
137
- }
138
- }
139
- return generator();
140
- }
141
- return null;
142
- };
143
- if (isLocalized) {
144
- const localizedValue = {};
145
- for (const locale of locales) {
146
- localizedValue[locale] = await generateFieldValue();
147
- }
148
- record[field.name] = localizedValue;
149
- } else {
150
- record[field.name] = await generateFieldValue();
151
- }
152
- }
153
- }
154
- return record;
155
- }
156
- async function generateRecord(db, collection, locales = []) {
157
- return generateDataForFields(collection.fields, db, locales);
158
- }
159
- function sortCollections(collections) {
160
- const sorted = [];
161
- const visited = new Set;
162
- const visiting = new Set;
163
- const visit = (collection) => {
164
- if (visited.has(collection.slug))
165
- return;
166
- if (visiting.has(collection.slug)) {
167
- throw new Error(`Circular dependency detected: ${collection.slug}`);
168
- }
169
- visiting.add(collection.slug);
170
- const deps = [];
171
- const findDeps = (fields) => {
172
- for (const f of fields) {
173
- if (f.type === "relationship") {
174
- deps.push(f.relationTo);
175
- } else if (f.type === "blocks" && f.blocks) {
176
- f.blocks.forEach((b) => findDeps(b.fields));
177
- } else if ("fields" in f && f.fields) {
178
- findDeps(f.fields);
179
- } else if ("tabs" in f && f.tabs) {
180
- f.tabs.forEach((t) => findDeps(t.fields));
181
- }
182
- }
183
- };
184
- findDeps(collection.fields);
185
- for (const depSlug of deps) {
186
- const depColl = collections.find((c) => c.slug === depSlug);
187
- if (depColl)
188
- visit(depColl);
189
- }
190
- visiting.delete(collection.slug);
191
- visited.add(collection.slug);
192
- sorted.push(collection);
193
- };
194
- for (const collection of collections) {
195
- visit(collection);
196
- }
197
- return sorted;
198
- }
199
- async function autoSeed(config, countPerCollection = 10, reset = false, type = "all") {
200
- const { collections, db, globals, storages, serverURL } = config;
201
- console.log(`\uD83C\uDF31 Starting automatic seed (${countPerCollection} records per collection)...`);
202
- const { getSystemCollections } = await import("./chunk-v521d72w.js");
203
- const systemCollections = getSystemCollections().filter((c) => c.slug === "_opaca_assets");
204
- const allCollections = [...systemCollections, ...collections];
205
- let collectionsToSeed = sortCollections(allCollections);
206
- if (type === "assets") {
207
- collectionsToSeed = collectionsToSeed.filter((c) => c.slug === "_opaca_assets");
208
- console.log("\uD83D\uDCC1 Seeding only assets...");
209
- } else if (type === "collections") {
210
- collectionsToSeed = collectionsToSeed.filter((c) => c.slug !== "_opaca_assets");
211
- console.log("\uD83D\uDCDA Seeding only user collections...");
212
- }
213
- await db.connect();
214
- await db.migrate(allCollections, globals || []);
215
- try {
216
- if (reset) {
217
- console.log("\uD83E\uDDF9 Resetting data (deleting existing records)...");
218
- const reversed = [...collectionsToSeed].reverse();
219
- for (const collection of reversed) {
220
- console.log(`Cleaning ${collection.slug}...`);
221
- await db.deleteMany?.(collection.slug, {});
222
- }
223
- }
224
- const storageAdapter = storages?.default || storages;
225
- const locales = config.i18n?.locales || [];
226
- for (const collection of collectionsToSeed) {
227
- console.log(`Seeding ${collection.slug}...`);
228
- const isAssetCollection = collection.slug === "_opaca_assets";
229
- for (let i = 0;i < countPerCollection; i++) {
230
- let data;
231
- if (isAssetCollection) {
232
- const id = faker.string.uuid();
233
- const width = faker.number.int({ min: 400, max: 1200 });
234
- const height = faker.number.int({ min: 300, max: 800 });
235
- const color = faker.color.rgb({ prefix: "" });
236
- const textColor = faker.color.rgb({ prefix: "" });
237
- const usePicsum = Math.random() > 0.5;
238
- let imageUrl = "";
239
- if (usePicsum) {
240
- const categories = ["nature", "city", "tech", "people", "animals", "architecture"];
241
- const category = faker.helpers.arrayElement(categories);
242
- imageUrl = `https://picsum.photos/seed/${category}-${id}/${width}/${height}`;
243
- } else {
244
- imageUrl = `https://placehold.co/${width}x${height}/${color}/${textColor}.png?text=Seed+${i}`;
245
- }
246
- const res = await fetch(imageUrl);
247
- if (!res.ok) {
248
- throw new Error(`Failed to fetch placeholder image: ${imageUrl}`);
249
- }
250
- const arrayBuffer = await res.arrayBuffer();
251
- const mime_type = res.headers.get("content-type")?.split(";")[0] || "image/png";
252
- const extMap = {
253
- "image/jpeg": "jpg",
254
- "image/png": "png",
255
- "image/webp": "webp",
256
- "image/gif": "gif",
257
- "image/svg+xml": "svg"
258
- };
259
- const ext = extMap[mime_type] || "png";
260
- const fileRecord = {
261
- filename: `seed-image-${i}.${ext}`,
262
- original_filename: `seed-image-${i}.${ext}`,
263
- mime_type,
264
- filesize: arrayBuffer.byteLength,
265
- buffer: new Uint8Array(arrayBuffer)
266
- };
267
- if (!storageAdapter || typeof storageAdapter.upload !== "function") {
268
- throw new Error("Storage adapter is required for seeding assets and must have an 'upload' method.");
269
- }
270
- const uploaded = await storageAdapter.upload(fileRecord, {
271
- generateUniqueName: true,
272
- customMetadata: {
273
- sourceUrl: imageUrl
274
- }
275
- });
276
- data = {
277
- id,
278
- key: uploaded.filename,
279
- filename: uploaded.filename,
280
- originalFilename: fileRecord.original_filename,
281
- mimeType: uploaded.mime_type,
282
- filesize: uploaded.filesize,
283
- width,
284
- height,
285
- bucket: "default",
286
- url: uploaded.url,
287
- thumbnailUrl: uploaded.url,
288
- altText: faker.lorem.sentence()
289
- };
290
- const baseURL = serverURL || "http://localhost:8787";
291
- console.log(`[Asset] Source: ${imageUrl}`);
292
- console.log(`[Asset] Seeded: ${baseURL}/api/assets/${id}/view (${uploaded.filename})`);
293
- } else {
294
- data = await generateRecord(db, collection, locales);
295
- }
296
- await db.create(collection.slug, data);
297
- }
298
- }
299
- console.log("✅ Seeding completed.");
300
- } finally {
301
- await db.disconnect();
302
- }
303
- }
304
- export {
305
- sortCollections,
306
- generateRecord,
307
- defaultFieldGenerators,
308
- autoSeed
309
- };