opacacms 0.3.17 → 0.3.18

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.
@@ -32,7 +32,7 @@ export declare class SQLiteAdapter extends BaseDatabaseAdapter {
32
32
  findGlobal<T extends object>(slug: string): Promise<T | null>;
33
33
  updateGlobal<T extends object>(slug: string, data: Partial<T>): Promise<T>;
34
34
  runMigrations(): Promise<void>;
35
- migrate(collections: Collection[], globals?: Global[]): Promise<void>;
35
+ migrate(collections: Collection[] | readonly Collection[], globals?: Global[] | readonly Global[]): Promise<void>;
36
36
  }
37
37
  export declare function createSQLiteAdapter(path: string, options?: {
38
38
  push?: boolean;
package/dist/db/sqlite.js CHANGED
@@ -62,7 +62,11 @@ class SQLiteAdapter extends BaseDatabaseAdapter {
62
62
  if (this._db)
63
63
  return;
64
64
  const { createRequire } = await import("node:module");
65
- const require2 = createRequire(import.meta.url);
65
+ const moduleUrl = typeof import.meta !== "undefined" ? import.meta.url : undefined;
66
+ if (!moduleUrl) {
67
+ throw new Error("Cannot use SQLiteAdapter in this environment: import.meta.url is undefined. If you are using Cloudflare Workers, please use D1Adapter instead.");
68
+ }
69
+ const require2 = createRequire(moduleUrl);
66
70
  const Database = require2("better-sqlite3");
67
71
  this._rawDb = new Database(this.path);
68
72
  const { createOpacaKysely } = await import("../chunk-gzbz5jwy.js");
package/dist/types.d.ts CHANGED
@@ -524,9 +524,9 @@ export interface OpacaConfig<Resource extends string = string> {
524
524
  /** Configuration for the internal logger. */
525
525
  logger?: OpacaLoggerConfig;
526
526
  /** List of collections that define your content models. */
527
- collections: Collection[];
527
+ collections: Collection[] | readonly Collection[];
528
528
  /** List of global singletons for site-wide settings. */
529
- globals?: Global[];
529
+ globals?: Global[] | readonly Global[];
530
530
  /** Configuration for the Admin UI dashboard and layout. */
531
531
  admin?: AdminConfig;
532
532
  /** Configuration for the REST and GraphQL APIs. */
@@ -685,7 +685,7 @@ export interface DatabaseAdapter {
685
685
  deleteMany?(collection: string, query: Record<string, unknown>): Promise<number>;
686
686
  findGlobal?<T extends object>(slug: string): Promise<T | null>;
687
687
  updateGlobal?<T extends object>(slug: string, data: Partial<T>): Promise<T>;
688
- migrate(collections: Collection[], globals?: Global[]): Promise<void>;
688
+ migrate(collections: Collection[] | readonly Collection[], globals?: Global[] | readonly Global[]): Promise<void>;
689
689
  /**
690
690
  * Run file-based migrations from the migrations directory.
691
691
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opacacms",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
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": [