allez-orm 1.0.9 → 1.0.10

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/allez-orm.mjs CHANGED
@@ -170,8 +170,7 @@ export class AllezORM {
170
170
  );
171
171
  },
172
172
  async deleteSoft(id, ts = new Date().toISOString()) {
173
- // keep naming consistent with your schema (deletedAt)
174
- // adjust if your table uses deleted_at instead
173
+ // keep naming consistent across projects
175
174
  try {
176
175
  await self.execute(`UPDATE ${table} SET deletedAt=? WHERE id=?`, [ts, id]);
177
176
  } catch {
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  // index.d.ts
2
-
3
2
  export interface Schema {
4
3
  table: string;
5
4
  createSQL: string;
@@ -13,7 +12,6 @@ export interface InitOptions {
13
12
  autoSaveMs?: number;
14
13
  wasmLocateFile?(file: string): string;
15
14
  schemas?: Schema[];
16
- /** Modules that default-export a Schema (useful for tree-shaking/auto-collect). */
17
15
  schemaModules?: Record<string, { default: Schema }>;
18
16
  }
19
17
 
@@ -23,7 +21,7 @@ export interface TableHelper<T extends Row = Row> {
23
21
  insert(obj: Partial<T>): Promise<void>;
24
22
  upsert(obj: Partial<T>): Promise<void>;
25
23
  update(id: any, patch: Partial<T>): Promise<void>;
26
- /** Soft delete (tries `deletedAt`; falls back to `deleted_at`) */
24
+ /** Soft delete; implementation will try `deletedAt` then `deleted_at`. */
27
25
  deleteSoft(id: any, ts?: string): Promise<void>;
28
26
  remove(id: any): Promise<void>;
29
27
  findById(id: any): Promise<T | null>;
@@ -32,52 +30,22 @@ export interface TableHelper<T extends Row = Row> {
32
30
 
33
31
  export class AllezORM {
34
32
  constructor(SQL: any, db: any, opts: InitOptions);
35
- /** Initialize an AllezORM instance (loads sql.js, restores from IndexedDB, applies schemas). */
36
33
  static init(opts?: InitOptions): Promise<AllezORM>;
37
-
38
- /** Persist DB to IndexedDB immediately. */
39
34
  saveNow(): Promise<void>;
40
-
41
- /** Execute DDL/DML; returns true on success (compat helper). */
42
35
  exec(sql: string, params?: any[]): Promise<boolean>;
43
- /** Alias of exec for ergonomics. */
44
36
  run(sql: string, params?: any[]): Promise<boolean>;
45
-
46
- /** Execute DDL/DML; resolves when finished. */
47
37
  execute(sql: string, params?: any[]): Promise<void>;
48
- /** Run a SELECT and return rows as plain objects. */
49
38
  query<T = Row>(sql: string, params?: any[]): Promise<T[]>;
50
- /** Run a SELECT and return the first row or null. */
51
39
  get<T = Row>(sql: string, params?: any[]): Promise<T | null>;
52
-
53
- /** Convenience table helper. */
54
40
  table<T extends Row = Row>(table: string): TableHelper<T>;
55
-
56
- /** Register/upgrade schemas. */
57
41
  registerSchemas(schemas: Schema[]): Promise<void>;
58
42
  }
59
43
 
60
- /* ------------------------------------------------------------------ */
61
- /* Browser-friendly convenience exports (compat with Angular consumer) */
62
- /* ------------------------------------------------------------------ */
63
-
64
- /**
65
- * Open (or reuse) a browser DB by name and return an AllezORM instance.
66
- * Equivalent to `AllezORM.init({ dbName: name, ...opts })` with caching.
67
- */
44
+ /** Browser helpers + Angular-friendly surface */
68
45
  export function openBrowserDb(name: string, opts?: InitOptions): Promise<AllezORM>;
69
-
70
- /** Alias for compatibility with consumers that call `openDb`. */
71
46
  export const openDb: typeof openBrowserDb;
72
-
73
- /** Apply an array of Schema objects on an opened AllezORM instance. */
74
- export function applySchemas(db: AllezORM, schemas: Schema[]): Promise<void>;
75
-
76
- /** Run a SELECT and return rows (compat free functions). */
77
- export function query<TRow = Row>(db: AllezORM, sql: string, params?: any[]): Promise<TRow[]>;
78
-
79
- /** Execute DDL/DML (compat free function). */
47
+ export function applySchemas(db: AllezORM, schemas?: Schema[]): Promise<void>;
48
+ export function query<T = Row>(db: AllezORM, sql: string, params?: any[]): Promise<T[]>;
80
49
  export function exec(db: AllezORM, sql: string, params?: any[]): Promise<void>;
81
50
 
82
- /** Keep a default export for ESM consumers. */
83
51
  export default AllezORM;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allez-orm",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "AllezORM: lightweight browser SQLite ORM (sql.js) + schema generator CLI",
5
5
  "type": "module",
6
6
  "main": "./allez-orm.mjs",