opacacms 0.2.0 → 0.3.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/README.md +31 -22
- package/dist/admin/auth-client.d.ts +39 -39
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +15 -10520
- package/dist/admin/plugin-client.d.ts +65 -0
- package/dist/admin/react.d.ts +2 -2
- package/dist/admin/react.js +34 -4
- package/dist/admin/stores/ui.d.ts +19 -4
- package/dist/admin/ui/components/PluginSettingsForm.d.ts +2 -2
- package/dist/admin/ui/components/custom-alert.d.ts +7 -0
- package/dist/admin/ui/components/{DetailSheet.d.ts → detail-sheet.d.ts} +1 -2
- package/dist/admin/ui/components/fields/FieldLabel.d.ts +1 -1
- package/dist/admin/ui/components/fields/RelationshipField.d.ts +1 -1
- package/dist/admin/ui/components/media/AssetManagerModal.d.ts +2 -2
- package/dist/admin/ui/components/plugin-iframe.d.ts +7 -0
- package/dist/admin/ui/components/ui/accordion.d.ts +17 -7
- package/dist/admin/ui/components/ui/alert-dialog.d.ts +16 -12
- package/dist/admin/ui/components/ui/button.d.ts +11 -7
- package/dist/admin/ui/components/ui/relationship.d.ts +1 -1
- package/dist/admin/ui/components/ui/sheet.d.ts +14 -27
- package/dist/admin/ui/components/ui/tooltip.d.ts +7 -0
- package/dist/admin/ui/components/versions-sheet.d.ts +4 -5
- package/dist/admin/ui/views/collection-list-view.d.ts +1 -1
- package/dist/admin/ui/views/dashboard-view.d.ts +1 -1
- package/dist/admin/ui/views/media-registry-view.d.ts +3 -3
- package/dist/admin/ui/views/settings-view.d.ts +2 -2
- package/dist/admin/vue.js +27 -4
- package/dist/admin/webcomponent.js +20 -2
- package/dist/admin.css +1 -1
- package/dist/auth/index.d.ts +43 -43
- package/dist/{chunk-7y1nbmw6.js → chunk-1bd7fz7n.js} +32 -2
- package/dist/chunk-1qm0m8r8.js +413 -0
- package/dist/chunk-2k3ysje3.js +31 -0
- package/dist/chunk-3j9zjfmn.js +376 -0
- package/dist/{chunk-byq8g0rd.js → chunk-48ywpd0a.js} +16 -22
- package/dist/{chunk-esrg9qj0.js → chunk-5422w4eq.js} +70 -54
- package/dist/chunk-56n342hs.js +95 -0
- package/dist/chunk-5b8r0v8c.js +47 -0
- package/dist/chunk-63yg00vx.js +263 -0
- package/dist/{chunk-8sqjbsgt.js → chunk-6bywt602.js} +26 -1
- package/dist/{chunk-v9z61v3g.js → chunk-6qs0g65f.js} +43 -3
- package/dist/chunk-7rr5p01g.js +581 -0
- package/dist/{chunk-51z3x7kq.js → chunk-a3qae86h.js} +1 -1
- package/dist/{chunk-3rdhbedb.js → chunk-adq2b75c.js} +2 -2
- package/dist/chunk-d0tb1xjw.js +93 -0
- package/dist/chunk-d7cgd6vn.js +318 -0
- package/dist/{chunk-0bq155dy.js → chunk-e0g6gn7n.js} +89 -100
- package/dist/chunk-ec4jhybj.js +1137 -0
- package/dist/chunk-fatyf6f7.js +221 -0
- package/dist/{chunk-526a3gqx.js → chunk-fnsf1dfm.js} +1 -1
- package/dist/chunk-g9bxb6h0.js +205 -0
- package/dist/chunk-gyaf5kgf.js +10 -0
- package/dist/{chunk-9kxpbcb1.js → chunk-h6dhexzr.js} +16 -7
- package/dist/{chunk-dykn5hr6.js → chunk-j8js1y0h.js} +31 -74
- package/dist/{chunk-t0zg026p.js → chunk-jq1drsen.js} +12 -1
- package/dist/{chunk-b3kr8w41.js → chunk-m24yqkeq.js} +38 -26
- package/dist/chunk-m5ems3hh.js +410 -0
- package/dist/{chunk-8scgdznr.js → chunk-m83ybzf8.js} +15 -18
- package/dist/chunk-majsbncm.js +98 -0
- package/dist/chunk-mp2gt9yh.js +237 -0
- package/dist/chunk-n1twhqmf.js +54 -0
- package/dist/{chunk-gmee4mdc.js → chunk-naqcqj8n.js} +92 -106
- package/dist/chunk-q5sb5dcr.js +15 -0
- package/dist/{chunk-d1asgtke.js → chunk-qhdsjek6.js} +90 -121
- package/dist/{chunk-0gtxnxmd.js → chunk-qsh2nqz3.js} +85 -105
- package/dist/chunk-r0ms5tk1.js +76 -0
- package/dist/chunk-rwqwsanx.js +75 -0
- package/dist/chunk-sqsfk9p4.js +700 -0
- package/dist/{chunk-5gvbp2qa.js → chunk-x7bnzswh.js} +25 -18
- package/dist/{chunk-kc4jfnv7.js → chunk-z3ffn2b7.js} +851 -324
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/doctor.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts +26 -0
- package/dist/cli/commands/init.d.ts +13 -1
- package/dist/cli/commands/migrate.d.ts +33 -0
- package/dist/cli/commands/plugin.d.ts +13 -0
- package/dist/cli/commands/seed.d.ts +21 -0
- package/dist/cli/{commands/migrate-commands.d.ts → core/migrations/migrate-logic.d.ts} +2 -2
- package/dist/cli/core/migrations/schema-diff-engine.d.ts +12 -0
- package/dist/cli/core/migrations/schema-diff.d.ts +11 -0
- package/dist/cli/{seeding.d.ts → core/seeding/auto-seed.d.ts} +7 -4
- package/dist/cli/core/seeding/seed-logic.d.ts +2 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +6 -170
- package/dist/client/RichText.d.ts +5 -0
- package/dist/client/rich-text-utils.d.ts +5 -0
- package/dist/client.js +3 -2
- package/dist/config.d.ts +3 -3
- package/dist/db/adapter.d.ts +2 -2
- package/dist/db/better-sqlite.d.ts +3 -3
- package/dist/db/better-sqlite.js +6 -5
- package/dist/db/bun-sqlite.d.ts +3 -3
- package/dist/db/bun-sqlite.js +6 -5
- package/dist/db/d1.d.ts +13 -7
- package/dist/db/d1.js +6 -5
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.js +10 -12
- package/dist/db/kysely/factory.d.ts +29 -0
- package/dist/db/kysely/plugins/audit-logging.d.ts +48 -0
- package/dist/db/kysely/plugins/auto-timestamps.d.ts +38 -0
- package/dist/db/kysely/plugins/cursor-pagination.d.ts +42 -0
- package/dist/db/kysely/plugins/deadlock-handler.d.ts +47 -0
- package/dist/db/kysely/plugins/draft-swapper.d.ts +33 -0
- package/dist/db/kysely/plugins/field-masking.d.ts +45 -0
- package/dist/db/kysely/plugins/fts-normalizer.d.ts +38 -0
- package/dist/db/kysely/plugins/i18n-fallback.d.ts +48 -0
- package/dist/db/kysely/plugins/id-generation.d.ts +42 -0
- package/dist/db/kysely/plugins/index.d.ts +16 -0
- package/dist/db/kysely/plugins/json-flattener.d.ts +38 -0
- package/dist/db/kysely/plugins/relationship-preloading.d.ts +39 -0
- package/dist/db/kysely/plugins/slug-generation.d.ts +37 -0
- package/dist/db/kysely/plugins/soft-delete.d.ts +42 -0
- package/dist/db/kysely/plugins/tree-resolver.d.ts +39 -0
- package/dist/db/kysely/plugins/virtual-field-resolver.d.ts +54 -0
- package/dist/db/kysely/plugins/zod-coercion.d.ts +34 -0
- package/dist/db/kysely/snapshot/snapshot-manager.d.ts +18 -0
- package/dist/db/postgres.d.ts +4 -4
- package/dist/db/postgres.js +6 -5
- package/dist/db/sqlite.d.ts +3 -3
- package/dist/db/sqlite.js +6 -5
- package/dist/index.d.ts +3 -0
- package/dist/index.js +161 -7
- package/dist/runtimes/bun.js +9 -6
- package/dist/runtimes/cloudflare-workers.d.ts +3 -1
- package/dist/runtimes/cloudflare-workers.js +36 -7
- package/dist/runtimes/next.js +8 -5
- package/dist/runtimes/node.js +9 -6
- package/dist/schema/collection.d.ts +116 -70
- package/dist/schema/compiler.d.ts +6 -0
- package/dist/schema/global.d.ts +38 -71
- package/dist/schema/index.d.ts +5 -4
- package/dist/schema/index.js +35 -550
- package/dist/schema/zod.d.ts +564 -0
- package/dist/server/admin-router.d.ts +1 -1
- package/dist/server/collection-router.d.ts +1 -1
- package/dist/server/graphql.d.ts +6 -0
- package/dist/server/handlers.d.ts +25 -7
- package/dist/server/middlewares/auth.d.ts +1 -1
- package/dist/server/plugins-loader.d.ts +1 -1
- package/dist/server/router.d.ts +2 -2
- package/dist/server/routers/admin.d.ts +1 -1
- package/dist/server/routers/auth.d.ts +1 -1
- package/dist/server/routers/collections.d.ts +4 -1
- package/dist/server/routers/plugins.d.ts +2 -2
- package/dist/server/setup-middlewares.d.ts +1 -1
- package/dist/server/system-router.d.ts +1 -1
- package/dist/server.js +11 -6
- package/dist/storage/adapters/cloudflare-r2.d.ts +11 -2
- package/dist/storage/index.js +39 -30
- package/dist/types.d.ts +255 -44
- package/dist/utils/context.d.ts +14 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/string.d.ts +10 -0
- package/dist/utils/webhooks-engine.d.ts +24 -0
- package/dist/validation.d.ts +67 -1
- package/dist/validator.d.ts +1 -0
- package/package.json +36 -33
- package/src/cli/index.ts +117 -0
- package/dist/chunk-6qq3ne6b.js +0 -288
- package/dist/chunk-6v1fw7q7.js +0 -126
- package/dist/chunk-7a9kn0np.js +0 -116
- package/dist/chunk-bexcv7xe.js +0 -36
- package/dist/chunk-d3ffeqp9.js +0 -87
- package/dist/chunk-fj19qccp.js +0 -78
- package/dist/chunk-j53pz21t.js +0 -20
- package/dist/chunk-mkn49zmy.js +0 -102
- package/dist/chunk-qb6ztvw9.js +0 -17
- package/dist/chunk-r39em4yj.js +0 -29
- package/dist/chunk-rsf0tpy1.js +0 -8
- package/dist/chunk-srsac177.js +0 -85
- package/dist/chunk-swtcpvhf.js +0 -2442
- package/dist/chunk-twpvxfce.js +0 -64
- package/dist/chunk-ywm4t2gm.js +0 -19
- package/dist/cli/commands/plugin-sync.d.ts +0 -1
- package/dist/cli/commands/seed-command.d.ts +0 -2
- package/dist/plugins/ui-bridge.d.ts +0 -12
- package/dist/schema/fields/base.d.ts +0 -84
- package/dist/schema/fields/index.d.ts +0 -147
- package/dist/schema/infer.d.ts +0 -55
- /package/dist/admin/ui/components/{ColumnVisibilityToggle.d.ts → column-visibility-toggle.d.ts} +0 -0
- /package/dist/admin/ui/components/{DataDetailView.d.ts → data-detail-view.d.ts} +0 -0
- /package/dist/cli/{d1-mock.d.ts → core/mocks/d1-mock.d.ts} +0 -0
- /package/dist/cli/{r2-mock.d.ts → core/mocks/r2-mock.d.ts} +0 -0
- /package/dist/cli/{commands → core/plugins}/plugin-build.d.ts +0 -0
- /package/dist/cli/{commands → core/plugins}/plugin-init.d.ts +0 -0
- /package/dist/cli/{commands → core/types}/generate-types.d.ts +0 -0
- /package/dist/{schema/fields/validation.test.d.ts → cli/seeding.test.d.ts} +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_picocolors
|
|
3
|
+
} from "./chunk-rwqwsanx.js";
|
|
4
|
+
import {
|
|
5
|
+
Ct,
|
|
6
|
+
Gt,
|
|
7
|
+
Nt,
|
|
8
|
+
R,
|
|
9
|
+
Wt,
|
|
10
|
+
Zt,
|
|
11
|
+
be
|
|
12
|
+
} from "./chunk-ec4jhybj.js";
|
|
13
|
+
import {
|
|
14
|
+
defineCommand
|
|
15
|
+
} from "./chunk-1qm0m8r8.js";
|
|
16
|
+
import {
|
|
17
|
+
logger
|
|
18
|
+
} from "./chunk-jq1drsen.js";
|
|
19
|
+
import {
|
|
20
|
+
__require,
|
|
21
|
+
__toESM
|
|
22
|
+
} from "./chunk-6bywt602.js";
|
|
23
|
+
|
|
24
|
+
// src/cli/commands/plugin.ts
|
|
25
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
26
|
+
|
|
27
|
+
// src/cli/core/plugins/plugin-build.ts
|
|
28
|
+
import fs from "node:fs";
|
|
29
|
+
import path from "node:path";
|
|
30
|
+
async function pluginBuildCommand(projectRoot) {
|
|
31
|
+
const srcDir = path.resolve(projectRoot, "src");
|
|
32
|
+
const distDir = path.resolve(projectRoot, "dist");
|
|
33
|
+
if (!fs.existsSync(srcDir)) {
|
|
34
|
+
logger.error(`No 'src' directory found in ${projectRoot}.`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const entryFiles = ["index.tsx", "index.ts", "plugin.tsx", "plugin.ts"];
|
|
38
|
+
let mainEntry = "";
|
|
39
|
+
for (const file of entryFiles) {
|
|
40
|
+
const fullPath = path.join(srcDir, file);
|
|
41
|
+
if (fs.existsSync(fullPath)) {
|
|
42
|
+
mainEntry = fullPath;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!mainEntry) {
|
|
47
|
+
logger.error(`Could not find a main entry file in ${srcDir}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
logger.info(`Building plugin entry: ${path.basename(mainEntry)}...`);
|
|
51
|
+
if (!fs.existsSync(distDir)) {
|
|
52
|
+
fs.mkdirSync(distDir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
const buildResult = await Bun.build({
|
|
55
|
+
entrypoints: [mainEntry],
|
|
56
|
+
outdir: distDir,
|
|
57
|
+
target: "node",
|
|
58
|
+
format: "esm",
|
|
59
|
+
external: [
|
|
60
|
+
"opacacms",
|
|
61
|
+
"opacacms/types",
|
|
62
|
+
"opacacms/plugins",
|
|
63
|
+
"opacacms/schema",
|
|
64
|
+
"hono",
|
|
65
|
+
"zod",
|
|
66
|
+
"react",
|
|
67
|
+
"react-dom"
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
if (!buildResult.success) {
|
|
71
|
+
logger.error("Plugin build failed.");
|
|
72
|
+
for (const msg of buildResult.logs) {
|
|
73
|
+
console.error(msg);
|
|
74
|
+
}
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
logger.info("Generating type declarations...");
|
|
79
|
+
const { execSync } = await import("node:child_process");
|
|
80
|
+
execSync("bunx tsc --emitDeclarationOnly --outDir dist", {
|
|
81
|
+
cwd: projectRoot,
|
|
82
|
+
stdio: "ignore"
|
|
83
|
+
});
|
|
84
|
+
logger.success("Types generated.");
|
|
85
|
+
} catch (err) {
|
|
86
|
+
logger.warn("Failed to generate types. Make sure typescript is installed.");
|
|
87
|
+
}
|
|
88
|
+
logger.success(`Plugin built successfully in ${distDir}!`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/cli/core/plugins/plugin-init.ts
|
|
92
|
+
import fs2 from "node:fs";
|
|
93
|
+
import path2 from "node:path";
|
|
94
|
+
async function pluginInitCommand(pluginName) {
|
|
95
|
+
if (!pluginName) {
|
|
96
|
+
logger.error("Please provide a plugin name. Usage: opacacms plugin:init <plugin_name>");
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
const targetDir = path2.resolve(process.cwd(), pluginName);
|
|
100
|
+
if (fs2.existsSync(targetDir)) {
|
|
101
|
+
logger.error(`Directory ${targetDir} already exists.`);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
logger.info(`Initializing new plugin in ${targetDir}...`);
|
|
105
|
+
fs2.mkdirSync(targetDir, { recursive: true });
|
|
106
|
+
fs2.mkdirSync(path2.join(targetDir, "src"), { recursive: true });
|
|
107
|
+
const packageJson = {
|
|
108
|
+
name: pluginName,
|
|
109
|
+
version: "1.0.0",
|
|
110
|
+
description: "An OpacaCMS plugin",
|
|
111
|
+
main: "dist/index.js",
|
|
112
|
+
types: "dist/index.d.ts",
|
|
113
|
+
scripts: {
|
|
114
|
+
build: "opacacms plugin:build",
|
|
115
|
+
dev: "bun run build --watch"
|
|
116
|
+
},
|
|
117
|
+
peerDependencies: {
|
|
118
|
+
opacacms: "workspace:*"
|
|
119
|
+
},
|
|
120
|
+
devDependencies: {
|
|
121
|
+
typescript: "^5.0.0",
|
|
122
|
+
"@types/node": "^20.0.0"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
fs2.writeFileSync(path2.join(targetDir, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8");
|
|
126
|
+
const tsconfig = {
|
|
127
|
+
compilerOptions: {
|
|
128
|
+
target: "ESNext",
|
|
129
|
+
module: "ESNext",
|
|
130
|
+
moduleResolution: "bundler",
|
|
131
|
+
strict: true,
|
|
132
|
+
esModuleInterop: true,
|
|
133
|
+
skipLibCheck: true,
|
|
134
|
+
forceConsistentCasingInFileNames: true,
|
|
135
|
+
outDir: "./dist",
|
|
136
|
+
declaration: true,
|
|
137
|
+
jsx: "react"
|
|
138
|
+
},
|
|
139
|
+
include: ["src/**/*"]
|
|
140
|
+
};
|
|
141
|
+
fs2.writeFileSync(path2.join(targetDir, "tsconfig.json"), JSON.stringify(tsconfig, null, 2), "utf-8");
|
|
142
|
+
const indexTsx = `import type { OpacaPlugin, OpacaPluginContext } from 'opacacms/types';
|
|
143
|
+
import { definePlugin } from 'opacacms/plugins';
|
|
144
|
+
|
|
145
|
+
export const myPlugin = (): OpacaPlugin => definePlugin({
|
|
146
|
+
name: '${pluginName}',
|
|
147
|
+
label: 'My Custom Plugin',
|
|
148
|
+
description: 'A great new plugin for OpacaCMS.',
|
|
149
|
+
version: '1.0.0',
|
|
150
|
+
icon: 'Box',
|
|
151
|
+
|
|
152
|
+
onInit: (ctx: OpacaPluginContext) => {
|
|
153
|
+
ctx.logger.info('[${pluginName}] Plugin initialized!');
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
onRouterInit: (app) => {
|
|
157
|
+
app.get('/admin/plugins/${pluginName}/view', (c) => {
|
|
158
|
+
return c.html(\`
|
|
159
|
+
<!DOCTYPE html>
|
|
160
|
+
<html>
|
|
161
|
+
<head>
|
|
162
|
+
<meta charset="UTF-8">
|
|
163
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
164
|
+
<style>
|
|
165
|
+
body {
|
|
166
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
167
|
+
padding: 2rem;
|
|
168
|
+
line-height: 1.5;
|
|
169
|
+
color: #334155;
|
|
170
|
+
}
|
|
171
|
+
.card {
|
|
172
|
+
background: white;
|
|
173
|
+
border: 1px solid #e2e8f0;
|
|
174
|
+
border-radius: 0.5rem;
|
|
175
|
+
padding: 1.5rem;
|
|
176
|
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
|
|
177
|
+
}
|
|
178
|
+
h2 { margin-top: 0; color: #1e293b; }
|
|
179
|
+
</style>
|
|
180
|
+
</head>
|
|
181
|
+
<body>
|
|
182
|
+
<div class="card">
|
|
183
|
+
<h2>Welcome to ${pluginName} Dashboard!</h2>
|
|
184
|
+
<p>This UI is rendered directly from your plugin's backend using <strong>SSR</strong>.</p>
|
|
185
|
+
<p>You can use Hono's <code>c.html()</code> or even React SSR with <code>@hono/react-renderer</code>.</p>
|
|
186
|
+
</div>
|
|
187
|
+
</body>
|
|
188
|
+
</html>
|
|
189
|
+
\`);
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
adminUI: {
|
|
194
|
+
type: 'ssr',
|
|
195
|
+
path: '/admin/plugins/${pluginName}/view',
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
`;
|
|
199
|
+
fs2.writeFileSync(path2.join(targetDir, "src", "index.tsx"), indexTsx, "utf-8");
|
|
200
|
+
logger.success(`Plugin ${pluginName} initialized successfully!`);
|
|
201
|
+
logger.info(`Next steps:
|
|
202
|
+
cd ${pluginName}
|
|
203
|
+
bun install
|
|
204
|
+
bun run build`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/cli/commands/plugin.ts
|
|
208
|
+
var plugin_default = defineCommand({
|
|
209
|
+
meta: {
|
|
210
|
+
name: "plugin",
|
|
211
|
+
description: "Manage OpacaCMS plugins"
|
|
212
|
+
},
|
|
213
|
+
args: {
|
|
214
|
+
action: {
|
|
215
|
+
type: "positional",
|
|
216
|
+
description: "Action to perform: init, build",
|
|
217
|
+
required: true
|
|
218
|
+
},
|
|
219
|
+
name: {
|
|
220
|
+
type: "positional",
|
|
221
|
+
description: "Name of the plugin (for init)",
|
|
222
|
+
required: false
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
async run({ args }) {
|
|
226
|
+
if (args.action === "init") {
|
|
227
|
+
let name = args.name;
|
|
228
|
+
if (!name) {
|
|
229
|
+
const response = await Zt({
|
|
230
|
+
message: "What is the name of your plugin?",
|
|
231
|
+
placeholder: "my-opaca-plugin",
|
|
232
|
+
defaultValue: "my-opaca-plugin"
|
|
233
|
+
});
|
|
234
|
+
if (Ct(response)) {
|
|
235
|
+
Nt("Operation cancelled.");
|
|
236
|
+
process.exit(0);
|
|
237
|
+
}
|
|
238
|
+
name = response;
|
|
239
|
+
}
|
|
240
|
+
Wt(import_picocolors.default.bgBlue(import_picocolors.default.white(" OpacaCMS Plugin Init ")));
|
|
241
|
+
const s = be();
|
|
242
|
+
s.start(`Scaffolding plugin ${name}...`);
|
|
243
|
+
await pluginInitCommand(name);
|
|
244
|
+
s.stop(`Plugin ${name} scaffolded!`);
|
|
245
|
+
Gt(`Run cd ${name} && bun install to get started.`);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (args.action === "build") {
|
|
249
|
+
Wt(import_picocolors.default.bgMagenta(import_picocolors.default.white(" OpacaCMS Plugin Build ")));
|
|
250
|
+
const s = be();
|
|
251
|
+
s.start(`Building plugin in ${process.cwd()}...`);
|
|
252
|
+
await pluginBuildCommand(process.cwd());
|
|
253
|
+
s.stop(`Plugin built successfully!`);
|
|
254
|
+
Gt(`Ready for distribution.`);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
R.error(`Unknown plugin action: ${args.action}`);
|
|
258
|
+
process.exit(1);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
export {
|
|
262
|
+
plugin_default as default
|
|
263
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,6 +8,28 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
6
8
|
function __accessProp(key) {
|
|
7
9
|
return this[key];
|
|
8
10
|
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
9
33
|
var __toCommonJS = (from) => {
|
|
10
34
|
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
35
|
if (entry)
|
|
@@ -23,6 +47,7 @@ var __toCommonJS = (from) => {
|
|
|
23
47
|
return entry;
|
|
24
48
|
};
|
|
25
49
|
var __moduleCache;
|
|
50
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
51
|
var __returnValue = (v) => v;
|
|
27
52
|
function __exportSetter(name, newValue) {
|
|
28
53
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -39,4 +64,4 @@ var __export = (target, all) => {
|
|
|
39
64
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
40
65
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
41
66
|
|
|
42
|
-
export { __toCommonJS, __export, __esm, __require };
|
|
67
|
+
export { __toESM, __toCommonJS, __commonJS, __export, __esm, __require };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__esm,
|
|
3
3
|
__export
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6bywt602.js";
|
|
5
5
|
|
|
6
6
|
// src/db/system-schema.ts
|
|
7
7
|
var exports_system_schema = {};
|
|
@@ -10,7 +10,7 @@ __export(exports_system_schema, {
|
|
|
10
10
|
});
|
|
11
11
|
var getSystemCollections = () => [
|
|
12
12
|
{
|
|
13
|
-
slug: "
|
|
13
|
+
slug: "_assets",
|
|
14
14
|
label: "Assets",
|
|
15
15
|
apiPath: "assets",
|
|
16
16
|
fields: [
|
|
@@ -125,7 +125,7 @@ var getSystemCollections = () => [
|
|
|
125
125
|
hidden: true
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
|
-
slug: "
|
|
128
|
+
slug: "_plugin_settings",
|
|
129
129
|
label: "Plugin Settings",
|
|
130
130
|
apiPath: "plugin-settings",
|
|
131
131
|
fields: [
|
|
@@ -138,6 +138,46 @@ var getSystemCollections = () => [
|
|
|
138
138
|
hidden: true,
|
|
139
139
|
disableAdmin: true
|
|
140
140
|
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
slug: "_audit_logs",
|
|
144
|
+
label: "Audit Logs",
|
|
145
|
+
apiPath: "audit-logs",
|
|
146
|
+
fields: [
|
|
147
|
+
{ name: "id", type: "text", required: true },
|
|
148
|
+
{ name: "operation", type: "text", required: true },
|
|
149
|
+
{ name: "collection", type: "text", required: true },
|
|
150
|
+
{ name: "entity_id", type: "text", required: true },
|
|
151
|
+
{ name: "user_id", type: "text" },
|
|
152
|
+
{ name: "previous_data", type: "json" },
|
|
153
|
+
{ name: "new_data", type: "json" },
|
|
154
|
+
{ name: "timestamp", type: "date" }
|
|
155
|
+
],
|
|
156
|
+
timestamps: true,
|
|
157
|
+
admin: {
|
|
158
|
+
hidden: true,
|
|
159
|
+
disableAdmin: true
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
slug: "_doc_versions",
|
|
164
|
+
label: "Document Versions",
|
|
165
|
+
apiPath: "doc-versions",
|
|
166
|
+
fields: [
|
|
167
|
+
{ name: "id", type: "text", required: true },
|
|
168
|
+
{ name: "collection", type: "text", required: true },
|
|
169
|
+
{ name: "entity_id", type: "text", required: true },
|
|
170
|
+
{ name: "data", type: "json", required: true },
|
|
171
|
+
{ name: "status", type: "text" },
|
|
172
|
+
{ name: "autosave", type: "boolean", defaultValue: false },
|
|
173
|
+
{ name: "version_name", type: "text" },
|
|
174
|
+
{ name: "created_by", type: "text" }
|
|
175
|
+
],
|
|
176
|
+
timestamps: true,
|
|
177
|
+
admin: {
|
|
178
|
+
hidden: true,
|
|
179
|
+
disableAdmin: true
|
|
180
|
+
}
|
|
141
181
|
}
|
|
142
182
|
];
|
|
143
183
|
var init_system_schema = () => {};
|