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.
- package/dist/admin/index.js +49 -0
- package/dist/{chunk-2zm8cy1w.js → admin/webcomponent.js} +116 -168
- package/dist/{chunk-6dhs73zq.js → chunk-2yz1nsxs.js} +1 -1
- package/dist/chunk-fa5mg0hr.js +96 -0
- package/dist/{chunk-kwp83w8b.js → chunk-m09hahe2.js} +7 -7
- package/dist/{chunk-hmhcense.js → chunk-ry15hke8.js} +253 -4
- package/dist/chunk-vtvqfhgy.js +2442 -0
- package/dist/{chunk-f3nvxn63.js → chunk-y8hc6nm4.js} +1 -1
- package/dist/{src/cli → cli}/index.js +10 -10
- package/dist/{src/client.js → client.js} +2 -2
- package/dist/{src/db → db}/bun-sqlite.js +10 -10
- package/dist/{src/db → db}/d1.js +8 -8
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +7 -0
- package/dist/db/migration.d.ts +39 -0
- package/dist/{src/db → db}/postgres.js +10 -10
- package/dist/{src/db → db}/sqlite.js +8 -8
- package/dist/index.d.ts +0 -2
- package/dist/index.js +13 -0
- package/dist/{src/runtimes → runtimes}/bun.js +5 -6
- package/dist/{src/runtimes → runtimes}/cloudflare-workers.js +5 -6
- package/dist/{src/runtimes → runtimes}/next.js +5 -6
- package/dist/{src/runtimes → runtimes}/node.js +5 -6
- package/dist/{src/server.js → server.js} +7 -8
- package/dist/storage/index.d.ts +0 -3
- package/dist/storage/index.js +35 -0
- package/dist/types.d.ts +5 -2
- package/package.json +161 -39
- package/bun.lock +0 -34
- package/dist/api.d.ts +0 -6
- package/dist/chunk-8gkhn1d4.js +0 -309
- package/dist/chunk-dy5t83hr.js +0 -261
- package/dist/src/admin/index.js +0 -176
- package/dist/src/admin/webcomponent.js +0 -19
- package/dist/src/api.js +0 -27
- package/dist/src/index.js +0 -20
- package/dist/src/storage/index.js +0 -355
- package/global.d.ts +0 -11
- package/src/admin/api-client.ts +0 -63
- package/src/admin/auth-client.ts +0 -40
- package/src/admin/custom-field.ts +0 -179
- package/src/admin/index.ts +0 -15
- package/src/admin/react.tsx +0 -72
- package/src/admin/router.ts +0 -9
- package/src/admin/stores/admin-queries.ts +0 -121
- package/src/admin/stores/auth.ts +0 -61
- package/src/admin/stores/column-visibility.ts +0 -67
- package/src/admin/stores/config.ts +0 -15
- package/src/admin/stores/media.ts +0 -95
- package/src/admin/stores/query.ts +0 -13
- package/src/admin/stores/ui.ts +0 -29
- package/src/admin/ui/admin-client.tsx +0 -283
- package/src/admin/ui/admin-layout.tsx +0 -276
- package/src/admin/ui/components/ColumnVisibilityToggle.tsx +0 -141
- package/src/admin/ui/components/DataDetailSheet.tsx +0 -141
- package/src/admin/ui/components/DataDetailView.tsx +0 -175
- package/src/admin/ui/components/Table.tsx +0 -67
- package/src/admin/ui/components/fields/ArrayField.tsx +0 -166
- package/src/admin/ui/components/fields/BlocksField.tsx +0 -202
- package/src/admin/ui/components/fields/BooleanField.tsx +0 -50
- package/src/admin/ui/components/fields/CollapsibleField.tsx +0 -75
- package/src/admin/ui/components/fields/DateField.tsx +0 -45
- package/src/admin/ui/components/fields/FileField.tsx +0 -322
- package/src/admin/ui/components/fields/GroupField.tsx +0 -50
- package/src/admin/ui/components/fields/JoinField.tsx +0 -23
- package/src/admin/ui/components/fields/NumberField.tsx +0 -46
- package/src/admin/ui/components/fields/RadioField.tsx +0 -62
- package/src/admin/ui/components/fields/RelationshipField.tsx +0 -278
- package/src/admin/ui/components/fields/RowField.tsx +0 -40
- package/src/admin/ui/components/fields/SelectField.tsx +0 -59
- package/src/admin/ui/components/fields/TabsField.tsx +0 -101
- package/src/admin/ui/components/fields/TextAreaField.tsx +0 -54
- package/src/admin/ui/components/fields/TextField.tsx +0 -49
- package/src/admin/ui/components/fields/VirtualField.tsx +0 -53
- package/src/admin/ui/components/fields/index.tsx +0 -371
- package/src/admin/ui/components/fields/richtext-editor/index.tsx +0 -211
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.tsx +0 -142
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageNode.tsx +0 -95
- package/src/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.tsx +0 -226
- package/src/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.tsx +0 -16
- package/src/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.tsx +0 -184
- package/src/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.tsx +0 -240
- package/src/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.tsx +0 -40
- package/src/admin/ui/components/fields/utils.ts +0 -1
- package/src/admin/ui/components/link.tsx +0 -41
- package/src/admin/ui/components/media/AssetManagerModal.tsx +0 -334
- package/src/admin/ui/components/toast.tsx +0 -72
- package/src/admin/ui/components/ui/accordion.tsx +0 -51
- package/src/admin/ui/components/ui/alert-dialog.tsx +0 -98
- package/src/admin/ui/components/ui/blocks.tsx +0 -32
- package/src/admin/ui/components/ui/breadcrumbs.tsx +0 -59
- package/src/admin/ui/components/ui/button.tsx +0 -26
- package/src/admin/ui/components/ui/collapsible.tsx +0 -124
- package/src/admin/ui/components/ui/dialog.tsx +0 -79
- package/src/admin/ui/components/ui/group.tsx +0 -20
- package/src/admin/ui/components/ui/index.ts +0 -17
- package/src/admin/ui/components/ui/input.tsx +0 -12
- package/src/admin/ui/components/ui/join.tsx +0 -53
- package/src/admin/ui/components/ui/label.tsx +0 -11
- package/src/admin/ui/components/ui/radio-group.tsx +0 -75
- package/src/admin/ui/components/ui/relationship-detail-sheet.tsx +0 -122
- package/src/admin/ui/components/ui/relationship.tsx +0 -58
- package/src/admin/ui/components/ui/scroll-area.tsx +0 -19
- package/src/admin/ui/components/ui/select.tsx +0 -187
- package/src/admin/ui/components/ui/separator.tsx +0 -21
- package/src/admin/ui/components/ui/sheet.tsx +0 -106
- package/src/admin/ui/components/ui/tabs.tsx +0 -116
- package/src/admin/ui/components/ui/utils.ts +0 -3
- package/src/admin/ui/hooks/use-debounce.ts +0 -15
- package/src/admin/ui/styles/_locale-switcher.scss +0 -33
- package/src/admin/ui/styles/accordion.scss +0 -60
- package/src/admin/ui/styles/animations.scss +0 -41
- package/src/admin/ui/styles/asset-manager.scss +0 -547
- package/src/admin/ui/styles/badge.scss +0 -13
- package/src/admin/ui/styles/base.scss +0 -22
- package/src/admin/ui/styles/button.scss +0 -161
- package/src/admin/ui/styles/card.scss +0 -13
- package/src/admin/ui/styles/collapsible.scss +0 -75
- package/src/admin/ui/styles/data-detail.scss +0 -92
- package/src/admin/ui/styles/dialog.scss +0 -102
- package/src/admin/ui/styles/empty-state.scss +0 -22
- package/src/admin/ui/styles/group.scss +0 -19
- package/src/admin/ui/styles/index.scss +0 -33
- package/src/admin/ui/styles/input.scss +0 -80
- package/src/admin/ui/styles/label.scss +0 -12
- package/src/admin/ui/styles/layout.scss +0 -56
- package/src/admin/ui/styles/lexical.scss +0 -469
- package/src/admin/ui/styles/loading.scss +0 -102
- package/src/admin/ui/styles/media-registry.scss +0 -597
- package/src/admin/ui/styles/pagination.scss +0 -20
- package/src/admin/ui/styles/radio-group.scss +0 -66
- package/src/admin/ui/styles/row.scss +0 -17
- package/src/admin/ui/styles/scrollbar.scss +0 -36
- package/src/admin/ui/styles/select.scss +0 -121
- package/src/admin/ui/styles/separator.scss +0 -14
- package/src/admin/ui/styles/sheet.scss +0 -152
- package/src/admin/ui/styles/sidebar.scss +0 -148
- package/src/admin/ui/styles/switch.scss +0 -59
- package/src/admin/ui/styles/table.scss +0 -207
- package/src/admin/ui/styles/tabs.scss +0 -62
- package/src/admin/ui/styles/toast.scss +0 -45
- package/src/admin/ui/styles/variables.scss +0 -24
- package/src/admin/ui/views/collection-list-view.tsx +0 -720
- package/src/admin/ui/views/dashboard-view.tsx +0 -263
- package/src/admin/ui/views/document-edit-view.tsx +0 -384
- package/src/admin/ui/views/global-edit-view.tsx +0 -226
- package/src/admin/ui/views/init-view.tsx +0 -182
- package/src/admin/ui/views/login-view.tsx +0 -123
- package/src/admin/ui/views/media-registry-view.tsx +0 -1104
- package/src/admin/ui/views/settings-view.tsx +0 -729
- package/src/admin/webcomponent.tsx +0 -15
- package/src/api.ts +0 -9
- package/src/auth/index.ts +0 -194
- package/src/auth/migrations.ts +0 -87
- package/src/auth/premissions.ts +0 -46
- package/src/cli/commands/generate-types.ts +0 -116
- package/src/cli/commands/init.ts +0 -95
- package/src/cli/commands/migrate-commands.ts +0 -160
- package/src/cli/commands/seed-command.ts +0 -11
- package/src/cli/d1-mock.ts +0 -101
- package/src/cli/index.test.ts +0 -84
- package/src/cli/index.ts +0 -183
- package/src/cli/r2-mock.ts +0 -217
- package/src/cli/seeding.ts +0 -405
- package/src/client.ts +0 -181
- package/src/config-utils.ts +0 -102
- package/src/config.ts +0 -49
- package/src/db/adapter.ts +0 -53
- package/src/db/better-sqlite.ts +0 -630
- package/src/db/bun-sqlite.ts +0 -646
- package/src/db/d1.ts +0 -711
- package/src/db/kysely/data-mapper.ts +0 -142
- package/src/db/kysely/field-mapper.ts +0 -148
- package/src/db/kysely/migration-generator.ts +0 -223
- package/src/db/kysely/query-builder.ts +0 -92
- package/src/db/kysely/schema-builder.ts +0 -439
- package/src/db/kysely/sql-utils.ts +0 -13
- package/src/db/postgres.ts +0 -621
- package/src/db/sqlite.ts +0 -658
- package/src/db/system-schema.ts +0 -121
- package/src/index.ts +0 -13
- package/src/runtimes/README.md +0 -59
- package/src/runtimes/bun.ts +0 -49
- package/src/runtimes/cloudflare-workers.ts +0 -38
- package/src/runtimes/next.ts +0 -26
- package/src/runtimes/node.ts +0 -52
- package/src/schema/collection.ts +0 -184
- package/src/schema/fields/base.ts +0 -164
- package/src/schema/fields/index.ts +0 -427
- package/src/schema/global.ts +0 -145
- package/src/schema/index.ts +0 -4
- package/src/schema/infer.ts +0 -72
- package/src/server/admin-router.ts +0 -20
- package/src/server/admin.ts +0 -142
- package/src/server/assets.ts +0 -306
- package/src/server/collection-router.ts +0 -55
- package/src/server/handlers.ts +0 -722
- package/src/server/middlewares/admin.ts +0 -27
- package/src/server/middlewares/auth.ts +0 -89
- package/src/server/middlewares/context.ts +0 -17
- package/src/server/middlewares/cors.ts +0 -24
- package/src/server/middlewares/database-init.ts +0 -74
- package/src/server/middlewares/rate-limit.ts +0 -71
- package/src/server/router.ts +0 -47
- package/src/server/setup-middlewares.ts +0 -58
- package/src/server/system-router.ts +0 -35
- package/src/server.ts +0 -9
- package/src/storage/adapters/cloudflare-r2.ts +0 -136
- package/src/storage/adapters/local.ts +0 -146
- package/src/storage/adapters/s3.ts +0 -186
- package/src/storage/errors.ts +0 -46
- package/src/storage/index.ts +0 -5
- package/src/storage/types.ts +0 -39
- package/src/types.ts +0 -577
- package/src/utils/lexical.ts +0 -37
- package/src/utils/logger.ts +0 -73
- package/src/validation.ts +0 -429
- package/src/validator.ts +0 -179
- package/test/admin-custom-field.test.ts +0 -162
- package/test/admin-react-field.test.tsx +0 -134
- package/test/api-features.test.ts +0 -78
- package/test/api.test.ts +0 -178
- package/test/auth.test.ts +0 -62
- package/test/cli-integration.test.ts +0 -146
- package/test/cli.test.ts +0 -25
- package/test/db/postgres.test.ts +0 -95
- package/test/db/sqlite-filter.test.ts +0 -53
- package/test/db/sqlite.test.ts +0 -82
- package/test/engine-features.test.ts +0 -79
- package/test/globals.test.ts +0 -74
- package/test/integration-tmp/db-app/opacacms.config.ts +0 -15
- package/test/integration-tmp/my-sqlite-app/opacacms.config.ts +0 -25
- package/test/integration-tmp/my-test-app/index.ts +0 -8
- package/test/integration-tmp/my-test-app/opacacms.config.ts +0 -16
- package/test/integration-tmp/my-test-app/package.json +0 -12
- package/test/populate.test.ts +0 -79
- package/test/runtimes.test.ts +0 -43
- package/test/schema-builder.test.ts +0 -107
- package/test/schema-features.test.ts +0 -63
- package/test/seeding.test.ts +0 -68
- package/test/storage/local.test.ts +0 -72
- package/test/storage/s3.test.ts +0 -60
- package/test/structural-data.test.ts +0 -100
- package/test/test-setup.ts +0 -11
- package/test/validation.test.ts +0 -162
- package/tsconfig.json +0 -42
- /package/dist/{src/admin/index.css → admin/webcomponent.css} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/cli/commands/seed-command.ts
|
|
6
6
|
async function seedCommand(opaca, count, reset, type) {
|
|
7
|
-
const { autoSeed } = await import("./chunk-
|
|
7
|
+
const { autoSeed } = await import("./chunk-vtvqfhgy.js");
|
|
8
8
|
try {
|
|
9
9
|
await autoSeed(opaca, count, reset, type);
|
|
10
10
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
__require
|
|
4
|
-
} from "
|
|
4
|
+
} from "../chunk-8sqjbsgt.js";
|
|
5
5
|
|
|
6
6
|
// src/cli/index.ts
|
|
7
7
|
import fs from "node:fs";
|
|
@@ -24,8 +24,8 @@ async function loadConfig(configPath) {
|
|
|
24
24
|
}
|
|
25
25
|
let opaca = mod.default;
|
|
26
26
|
if (typeof opaca === "function") {
|
|
27
|
-
const { createD1Mock } = await import("
|
|
28
|
-
const { createR2Mock } = await import("
|
|
27
|
+
const { createD1Mock } = await import("../chunk-9kxpbcb1.js");
|
|
28
|
+
const { createR2Mock } = await import("../chunk-5gvbp2qa.js");
|
|
29
29
|
const mockDb = createD1Mock();
|
|
30
30
|
const mockBucket = createR2Mock();
|
|
31
31
|
const mockSecureBucket = createR2Mock(".opaca/local-r2/secure");
|
|
@@ -90,12 +90,12 @@ Commands:`);
|
|
|
90
90
|
process.exit(1);
|
|
91
91
|
}
|
|
92
92
|
if (command === "init") {
|
|
93
|
-
const { initCommand } = await import("
|
|
93
|
+
const { initCommand } = await import("../chunk-srsac177.js");
|
|
94
94
|
await initCommand(positionals[1] || "my-opaca-app", values.example);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
if (command === "generate:types") {
|
|
98
|
-
const { generateTypesCommand } = await import("
|
|
98
|
+
const { generateTypesCommand } = await import("../chunk-7a9kn0np.js");
|
|
99
99
|
await generateTypesCommand(values.url, values.token, values.out || "opaca-types.d.ts");
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -116,28 +116,28 @@ Commands:`);
|
|
|
116
116
|
const opaca = await loadConfig(configPath);
|
|
117
117
|
switch (command) {
|
|
118
118
|
case "migrate:create": {
|
|
119
|
-
const { migrateCreateCommand } = await import("
|
|
119
|
+
const { migrateCreateCommand } = await import("../chunk-2yz1nsxs.js");
|
|
120
120
|
await migrateCreateCommand(opaca, positionals[1], values.out);
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
case "migrate": {
|
|
124
|
-
const { migrateRunCommand } = await import("
|
|
124
|
+
const { migrateRunCommand } = await import("../chunk-2yz1nsxs.js");
|
|
125
125
|
await migrateRunCommand(opaca.db);
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
case "migrate:status": {
|
|
129
|
-
const { migrateStatusCommand } = await import("
|
|
129
|
+
const { migrateStatusCommand } = await import("../chunk-2yz1nsxs.js");
|
|
130
130
|
await migrateStatusCommand(opaca);
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
133
|
case "migrate:d1": {
|
|
134
|
-
const { migrateD1Command } = await import("
|
|
134
|
+
const { migrateD1Command } = await import("../chunk-2yz1nsxs.js");
|
|
135
135
|
await migrateD1Command(values.out || "./migrations", !!values.remote, values.binding || "DB");
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
case "seed":
|
|
139
139
|
case "seed:assets": {
|
|
140
|
-
const { seedCommand } = await import("
|
|
140
|
+
const { seedCommand } = await import("../chunk-y8hc6nm4.js");
|
|
141
141
|
await seedCommand(opaca, parseInt(values.count) || 10, !!values.reset, command === "seed:assets" ? "assets" : "collections");
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
flattenPayload,
|
|
4
4
|
pushSchema,
|
|
5
5
|
unflattenRow
|
|
6
|
-
} from "
|
|
7
|
-
import {
|
|
8
|
-
BaseDatabaseAdapter
|
|
9
|
-
} from "../../chunk-s8mqwnm1.js";
|
|
6
|
+
} from "../chunk-6ew02s0c.js";
|
|
10
7
|
import {
|
|
11
8
|
logger
|
|
12
|
-
} from "
|
|
9
|
+
} from "../chunk-62ev8gnc.js";
|
|
13
10
|
import {
|
|
14
11
|
flattenFields,
|
|
15
12
|
getRelationalFields,
|
|
16
13
|
toSnakeCase
|
|
17
|
-
} from "
|
|
18
|
-
import"
|
|
19
|
-
import
|
|
14
|
+
} from "../chunk-cvdd4eqh.js";
|
|
15
|
+
import"../chunk-ybbbqj63.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseDatabaseAdapter
|
|
18
|
+
} from "../chunk-s8mqwnm1.js";
|
|
19
|
+
import"../chunk-8sqjbsgt.js";
|
|
20
20
|
|
|
21
21
|
// src/db/bun-sqlite.ts
|
|
22
22
|
import { Database } from "bun:sqlite";
|
|
@@ -412,13 +412,13 @@ class BunSQLiteAdapter extends BaseDatabaseAdapter {
|
|
|
412
412
|
continue;
|
|
413
413
|
const snakeName = toSnakeCase(field.name);
|
|
414
414
|
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
415
|
-
const joinTableName = `${collection}_${snakeName}_relations`.toLowerCase();
|
|
415
|
+
const joinTableName = `${toSnakeCase(collection)}_${snakeName}_relations`.toLowerCase();
|
|
416
416
|
try {
|
|
417
417
|
await tx.deleteFrom(joinTableName).where("source_id", "=", current.id).execute();
|
|
418
418
|
} catch (e) {}
|
|
419
419
|
} else if (field.type === "blocks" && field.blocks) {
|
|
420
420
|
for (const b of field.blocks) {
|
|
421
|
-
const blockTableName = `${collection}_${snakeName}_${toSnakeCase(b.slug)}`.toLowerCase();
|
|
421
|
+
const blockTableName = `${toSnakeCase(collection)}_${snakeName}_${toSnakeCase(b.slug)}`.toLowerCase();
|
|
422
422
|
try {
|
|
423
423
|
await tx.deleteFrom(blockTableName).where("_parent_id", "=", current.id).execute();
|
|
424
424
|
} catch (e) {}
|
package/dist/{src/db → db}/d1.js
RENAMED
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
flattenPayload,
|
|
4
4
|
pushSchema,
|
|
5
5
|
unflattenRow
|
|
6
|
-
} from "
|
|
7
|
-
import {
|
|
8
|
-
BaseDatabaseAdapter
|
|
9
|
-
} from "../../chunk-s8mqwnm1.js";
|
|
6
|
+
} from "../chunk-6ew02s0c.js";
|
|
10
7
|
import {
|
|
11
8
|
logger
|
|
12
|
-
} from "
|
|
9
|
+
} from "../chunk-62ev8gnc.js";
|
|
13
10
|
import {
|
|
14
11
|
flattenFields,
|
|
15
12
|
getRelationalFields,
|
|
16
13
|
toSnakeCase
|
|
17
|
-
} from "
|
|
18
|
-
import"
|
|
19
|
-
import
|
|
14
|
+
} from "../chunk-cvdd4eqh.js";
|
|
15
|
+
import"../chunk-ybbbqj63.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseDatabaseAdapter
|
|
18
|
+
} from "../chunk-s8mqwnm1.js";
|
|
19
|
+
import"../chunk-8sqjbsgt.js";
|
|
20
20
|
|
|
21
21
|
// src/db/d1.ts
|
|
22
22
|
import fs from "node:fs/promises";
|
package/dist/db/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The database query builder interface passed to migration `up` and `down` functions.
|
|
3
|
+
* This is a structural alias for Kysely's database instance — you do not need to
|
|
4
|
+
* install `kysely` in your project to write migrations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { OpacaMigrationDb } from 'opacacms/db';
|
|
9
|
+
*
|
|
10
|
+
* export async function up(db: OpacaMigrationDb): Promise<void> {
|
|
11
|
+
* await db.schema
|
|
12
|
+
* .createTable('my_table')
|
|
13
|
+
* .addColumn('id', 'text', (col) => col.primaryKey())
|
|
14
|
+
* .execute();
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* export async function down(db: OpacaMigrationDb): Promise<void> {
|
|
18
|
+
* await db.schema.dropTable('my_table').execute();
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export type OpacaMigrationDb = {
|
|
23
|
+
schema: {
|
|
24
|
+
createTable(name: string): unknown;
|
|
25
|
+
dropTable(name: string): unknown;
|
|
26
|
+
alterTable(name: string): unknown;
|
|
27
|
+
createIndex(name: string): unknown;
|
|
28
|
+
dropIndex(name: string): unknown;
|
|
29
|
+
};
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The shape of an OpacaCMS migration module.
|
|
34
|
+
* Both `up` and `down` receive an `OpacaMigrationDb` instance.
|
|
35
|
+
*/
|
|
36
|
+
export interface OpacaMigration {
|
|
37
|
+
up(db: OpacaMigrationDb): Promise<void>;
|
|
38
|
+
down?(db: OpacaMigrationDb): Promise<void>;
|
|
39
|
+
}
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
flattenPayload,
|
|
4
4
|
pushSchema,
|
|
5
5
|
unflattenRow
|
|
6
|
-
} from "
|
|
7
|
-
import {
|
|
8
|
-
BaseDatabaseAdapter
|
|
9
|
-
} from "../../chunk-s8mqwnm1.js";
|
|
6
|
+
} from "../chunk-6ew02s0c.js";
|
|
10
7
|
import {
|
|
11
8
|
logger
|
|
12
|
-
} from "
|
|
9
|
+
} from "../chunk-62ev8gnc.js";
|
|
13
10
|
import {
|
|
14
11
|
toSnakeCase
|
|
15
|
-
} from "
|
|
16
|
-
import"
|
|
12
|
+
} from "../chunk-cvdd4eqh.js";
|
|
13
|
+
import"../chunk-ybbbqj63.js";
|
|
14
|
+
import {
|
|
15
|
+
BaseDatabaseAdapter
|
|
16
|
+
} from "../chunk-s8mqwnm1.js";
|
|
17
17
|
import {
|
|
18
18
|
__require
|
|
19
|
-
} from "
|
|
19
|
+
} from "../chunk-8sqjbsgt.js";
|
|
20
20
|
|
|
21
21
|
// src/db/postgres.ts
|
|
22
22
|
import fs from "node:fs/promises";
|
|
@@ -185,7 +185,7 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
185
185
|
const unflattened = unflattenRow(row);
|
|
186
186
|
const colDef = this._collections.find((c) => c.slug === collection);
|
|
187
187
|
if (colDef) {
|
|
188
|
-
const { getRelationalFields, toSnakeCase: toSnakeCase2 } = await import("
|
|
188
|
+
const { getRelationalFields, toSnakeCase: toSnakeCase2 } = await import("../chunk-xg35h5a3.js");
|
|
189
189
|
const relationalFields = getRelationalFields(colDef.fields);
|
|
190
190
|
for (const field of relationalFields) {
|
|
191
191
|
if (!field.name)
|
|
@@ -501,7 +501,7 @@ class PostgresAdapter extends BaseDatabaseAdapter {
|
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
async migrate(collections, globals = []) {
|
|
504
|
-
const { getSystemCollections } = await import("
|
|
504
|
+
const { getSystemCollections } = await import("../chunk-v521d72w.js");
|
|
505
505
|
this._collections = [...getSystemCollections(), ...collections];
|
|
506
506
|
this._globals = globals;
|
|
507
507
|
if (this.push && this._db) {
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
flattenPayload,
|
|
4
4
|
pushSchema,
|
|
5
5
|
unflattenRow
|
|
6
|
-
} from "
|
|
7
|
-
import {
|
|
8
|
-
BaseDatabaseAdapter
|
|
9
|
-
} from "../../chunk-s8mqwnm1.js";
|
|
6
|
+
} from "../chunk-6ew02s0c.js";
|
|
10
7
|
import {
|
|
11
8
|
logger
|
|
12
|
-
} from "
|
|
9
|
+
} from "../chunk-62ev8gnc.js";
|
|
13
10
|
import {
|
|
14
11
|
flattenFields,
|
|
15
12
|
getRelationalFields,
|
|
16
13
|
toSnakeCase
|
|
17
|
-
} from "
|
|
18
|
-
import"
|
|
19
|
-
import
|
|
14
|
+
} from "../chunk-cvdd4eqh.js";
|
|
15
|
+
import"../chunk-ybbbqj63.js";
|
|
16
|
+
import {
|
|
17
|
+
BaseDatabaseAdapter
|
|
18
|
+
} from "../chunk-s8mqwnm1.js";
|
|
19
|
+
import"../chunk-8sqjbsgt.js";
|
|
20
20
|
|
|
21
21
|
// src/db/sqlite.ts
|
|
22
22
|
import fs from "node:fs/promises";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
ADDED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAPIRouter
|
|
3
|
-
} from "
|
|
4
|
-
import"
|
|
5
|
-
import"
|
|
6
|
-
import"
|
|
7
|
-
import"
|
|
8
|
-
import"../../chunk-8sqjbsgt.js";
|
|
3
|
+
} from "../chunk-ry15hke8.js";
|
|
4
|
+
import"../chunk-62ev8gnc.js";
|
|
5
|
+
import"../chunk-cvdd4eqh.js";
|
|
6
|
+
import"../chunk-ybbbqj63.js";
|
|
7
|
+
import"../chunk-8sqjbsgt.js";
|
|
9
8
|
|
|
10
9
|
// src/runtimes/bun.ts
|
|
11
10
|
import { Hono } from "hono";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAPIRouter
|
|
3
|
-
} from "
|
|
4
|
-
import"
|
|
5
|
-
import"
|
|
6
|
-
import"
|
|
7
|
-
import"
|
|
8
|
-
import"../../chunk-8sqjbsgt.js";
|
|
3
|
+
} from "../chunk-ry15hke8.js";
|
|
4
|
+
import"../chunk-62ev8gnc.js";
|
|
5
|
+
import"../chunk-cvdd4eqh.js";
|
|
6
|
+
import"../chunk-ybbbqj63.js";
|
|
7
|
+
import"../chunk-8sqjbsgt.js";
|
|
9
8
|
|
|
10
9
|
// src/runtimes/cloudflare-workers.ts
|
|
11
10
|
import { Hono } from "hono";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAPIRouter
|
|
3
|
-
} from "
|
|
4
|
-
import"
|
|
5
|
-
import"
|
|
6
|
-
import"
|
|
7
|
-
import"
|
|
8
|
-
import"../../chunk-8sqjbsgt.js";
|
|
3
|
+
} from "../chunk-ry15hke8.js";
|
|
4
|
+
import"../chunk-62ev8gnc.js";
|
|
5
|
+
import"../chunk-cvdd4eqh.js";
|
|
6
|
+
import"../chunk-ybbbqj63.js";
|
|
7
|
+
import"../chunk-8sqjbsgt.js";
|
|
9
8
|
|
|
10
9
|
// src/runtimes/next.ts
|
|
11
10
|
import { handle } from "hono/vercel";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAPIRouter
|
|
3
|
-
} from "
|
|
4
|
-
import"
|
|
5
|
-
import"
|
|
6
|
-
import"
|
|
7
|
-
import"
|
|
8
|
-
import"../../chunk-8sqjbsgt.js";
|
|
3
|
+
} from "../chunk-ry15hke8.js";
|
|
4
|
+
import"../chunk-62ev8gnc.js";
|
|
5
|
+
import"../chunk-cvdd4eqh.js";
|
|
6
|
+
import"../chunk-ybbbqj63.js";
|
|
7
|
+
import"../chunk-8sqjbsgt.js";
|
|
9
8
|
|
|
10
9
|
// src/runtimes/node.ts
|
|
11
10
|
import { serve } from "@hono/node-server";
|
|
@@ -4,18 +4,17 @@ import {
|
|
|
4
4
|
createGlobalHandlers,
|
|
5
5
|
createHandlers,
|
|
6
6
|
hydrateDoc
|
|
7
|
-
} from "
|
|
7
|
+
} from "./chunk-ry15hke8.js";
|
|
8
8
|
import {
|
|
9
9
|
defineConfig
|
|
10
|
-
} from "
|
|
11
|
-
import"
|
|
10
|
+
} from "./chunk-zvwb67nd.js";
|
|
11
|
+
import"./chunk-62ev8gnc.js";
|
|
12
|
+
import"./chunk-cvdd4eqh.js";
|
|
13
|
+
import"./chunk-ybbbqj63.js";
|
|
12
14
|
import {
|
|
13
15
|
BaseDatabaseAdapter
|
|
14
|
-
} from "
|
|
15
|
-
import"
|
|
16
|
-
import"../chunk-cvdd4eqh.js";
|
|
17
|
-
import"../chunk-ybbbqj63.js";
|
|
18
|
-
import"../chunk-8sqjbsgt.js";
|
|
16
|
+
} from "./chunk-s8mqwnm1.js";
|
|
17
|
+
import"./chunk-8sqjbsgt.js";
|
|
19
18
|
export {
|
|
20
19
|
hydrateDoc,
|
|
21
20
|
defineConfig,
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import"../chunk-8sqjbsgt.js";
|
|
2
|
+
|
|
3
|
+
// src/storage/errors.ts
|
|
4
|
+
class StorageError extends Error {
|
|
5
|
+
provider;
|
|
6
|
+
operation;
|
|
7
|
+
originalError;
|
|
8
|
+
constructor(provider, operation, message, originalError) {
|
|
9
|
+
const originalMessage = originalError instanceof Error ? `: ${originalError.message}` : originalError ? `: ${String(originalError)}` : "";
|
|
10
|
+
super(`[OpacaStorage::${provider}] Failed to ${operation}: ${message}${originalMessage}`);
|
|
11
|
+
this.name = "StorageError";
|
|
12
|
+
this.provider = provider;
|
|
13
|
+
this.operation = operation;
|
|
14
|
+
this.originalError = originalError;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class FileTooLargeError extends StorageError {
|
|
19
|
+
constructor(provider, maxBytes, actualBytes) {
|
|
20
|
+
super(provider, "upload", `File size (${actualBytes} bytes) exceeds the maximum allowed (${maxBytes} bytes).`);
|
|
21
|
+
this.name = "FileTooLargeError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class Invalidmime_typeError extends StorageError {
|
|
26
|
+
constructor(provider, allowedTypes, actualType) {
|
|
27
|
+
super(provider, "upload", `MIME type '${actualType}' is not allowed. Expected one of: ${allowedTypes.join(", ")}.`);
|
|
28
|
+
this.name = "Invalidmime_typeError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
StorageError,
|
|
33
|
+
Invalidmime_typeError,
|
|
34
|
+
FileTooLargeError
|
|
35
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { Session, User } from "better-auth";
|
|
2
2
|
import type { Context } from "hono";
|
|
3
|
-
import type { icons } from "lucide-react";
|
|
4
3
|
import type { AdminConfig, CollectionHooks, FieldType, AccessConfig as ValidationAccessConfig, Collection as ValidationCollection, Global as ValidationGlobal, OpacaConfig as ValidationOpacaConfig } from "./validation";
|
|
5
4
|
export type { FieldType };
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Names of icons available in the OpacaCMS admin UI (subset of lucide-react).
|
|
7
|
+
* Using a static list avoids forcing consumers to resolve the entire lucide-react module.
|
|
8
|
+
*/
|
|
9
|
+
export type IconName = "Activity" | "AlertCircle" | "AlertTriangle" | "Archive" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "BarChart" | "BarChart2" | "Bell" | "Book" | "BookOpen" | "Bookmark" | "Box" | "Calendar" | "Camera" | "Check" | "CheckCircle" | "ChevronDown" | "ChevronLeft" | "ChevronRight" | "ChevronUp" | "Circle" | "Clipboard" | "Clock" | "Cloud" | "Code" | "Columns" | "Command" | "Copy" | "CreditCard" | "Database" | "Download" | "Edit" | "ExternalLink" | "Eye" | "EyeOff" | "File" | "FileText" | "Filter" | "Flag" | "Folder" | "FolderOpen" | "Globe" | "Grid" | "Hash" | "Heart" | "Home" | "Image" | "Info" | "Key" | "Layers" | "Layout" | "LayoutDashboard" | "Link" | "List" | "Lock" | "LogIn" | "LogOut" | "Mail" | "Map" | "Menu" | "MessageCircle" | "MessageSquare" | "Minus" | "Monitor" | "Moon" | "MoreHorizontal" | "MoreVertical" | "Move" | "Navigation" | "Package" | "Paperclip" | "Pencil" | "Phone" | "PieChart" | "Pin" | "Play" | "Plus" | "PlusCircle" | "Power" | "Printer" | "RefreshCw" | "Search" | "Send" | "Server" | "Settings" | "Share" | "Shield" | "ShieldCheck" | "ShoppingCart" | "Sidebar" | "Slash" | "Sliders" | "Square" | "Star" | "Sun" | "Table" | "Tag" | "Terminal" | "Trash" | "Trash2" | "TrendingUp" | "Type" | "Undo" | "Upload" | "User" | "UserCheck" | "UserPlus" | "Users" | "Video" | "Wallet" | "Wrench" | "X" | "XCircle" | "ZoomIn" | "ZoomOut" | (string & {});
|
|
7
10
|
export interface BaseField {
|
|
8
11
|
name: string;
|
|
9
12
|
label?: string;
|