ozmoz 0.1.14 → 0.1.16

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/index.d.ts CHANGED
@@ -62,15 +62,20 @@ interface OzTagNames {
62
62
  export interface OzClient extends OzTagNames {
63
63
  call: any;
64
64
  getUser: OzMethod;
65
- add: OzMethod;
66
- addWithId: OzMethod;
67
- addWithUserId: OzMethod;
68
- addWithMedia: OzMethod;
69
- update: OzMethod;
70
- delete: OzMethod;
71
- getDocsG: OzMethod;
72
- getDocsU: OzMethod;
73
- getDoc: OzMethod;
65
+
66
+ // Écritures : retournent un objet de statut avec success/error
67
+ add: (table: string, data: any, options?: any) => Promise<{ success: boolean; documentId?: string; error?: string }>;
68
+ addWithId: (table: string, data: any, customId: string, options?: any) => Promise<{ success: boolean; id?: string; error?: string }>;
69
+ addWithUserId: (table: string, data: any, options?: any) => Promise<{ success: boolean; documentId?: string; error?: string }>;
70
+ addWithMedia: (table: string, data: any, fileBase64: string, fileName: string, options?: any) => Promise<{ success: boolean; id?: string; mediaUrl?: string; error?: string }>;
71
+ update: (table: string, docId: string, data: any, options?: any) => Promise<{ success: boolean; documentId?: string; error?: string }>;
72
+ delete: (table: string, docId: string, options?: any) => Promise<{ success: boolean; documentId?: string; error?: string }>;
73
+
74
+ // Lectures : retournent les données directes
75
+ getDocsG: <T = any>(table: string) => Promise<T[]>;
76
+ getDocsU: <T = any>(table: string) => Promise<T[]>;
77
+ getDoc: <T = any>(table: string, docId: string) => Promise<T | null>;
78
+
74
79
  getAuthUser: OzMethod;
75
80
  join: OzMethod;
76
81
  seed: OzMethod;
@@ -94,8 +99,8 @@ export default oz;
94
99
 
95
100
  declare global {
96
101
  type OzTables = string;
97
- const oz: any;
98
- const OzUI: any;
102
+ const oz: OzClient;
103
+ const OzUI: OzTagNames;
99
104
 
100
105
  interface Window {
101
106
  oz: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ozmoz",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "SDK and CLI for the oz.* data API and the <oz-*> web components.",
5
5
  "license": "UNLICENSED",
6
6
  "keywords": [
@@ -124,7 +124,7 @@ function ensureSchemaFile(projectRoot) {
124
124
 
125
125
  function ensureEnvPrototype(projectRoot) {
126
126
  const envPath = path.join(projectRoot, ".env");
127
- const defaultVar = "\n# ozmoZ UI Sandbox Mode\n# true = Sandbox mode: simulates writes locally for fluid UI testing; no DB access and IDE alert.\n# false = Strict production mode: enforces schema contracts and persists to DB\nOZ_PROTOTYPE=true\n";
127
+ const defaultVar = "\n# OZmoz UI Sandbox Mode\n# true = Sandbox mode: simulates writes locally for fluid UI testing; no DB access and IDE alert.\n# false = Strict production mode: enforces schema contracts and persists to DB\nOZ_PROTOTYPE=true\n";
128
128
 
129
129
  if (!fs.existsSync(envPath)) {
130
130
  fs.writeFileSync(envPath, defaultVar.trimStart());
@@ -283,7 +283,7 @@ function exchangeBootstrapToken(token) {
283
283
  res.on("end", () => {
284
284
  if (res.statusCode >= 200 && res.statusCode < 300) {
285
285
  try { resolve(JSON.parse(data)); }
286
- catch (e) { reject(new Error("Invalid response received from ozmoZ server.")); }
286
+ catch (e) { reject(new Error("Invalid response received from OZmoz server.")); }
287
287
  } else {
288
288
  try {
289
289
  const parsed = JSON.parse(data);
@@ -304,7 +304,7 @@ async function handleAuthAndEnv(projectRoot, args = []) {
304
304
  const envPath = path.join(projectRoot, ".env");
305
305
 
306
306
  if (fs.existsSync(envPath) && fs.readFileSync(envPath, "utf8").includes("OZ_DB_KEY")) {
307
- log("→ ozmoZ environment variables already present in .env — skipping step.");
307
+ log("→ OZmoz environment variables already present in .env — skipping step.");
308
308
  return;
309
309
  }
310
310
 
@@ -325,12 +325,12 @@ async function handleAuthAndEnv(projectRoot, args = []) {
325
325
  keys = await exchangeBootstrapToken(bootstrapToken);
326
326
  } catch (err) {
327
327
  logError(`⚠️ Token exchange failed: ${err.message}`);
328
- logError("👉 The token may have expired (15 min limit) or was already used. Please regenerate one from the ozmoZ dashboard.");
328
+ logError("👉 The token may have expired (15 min limit) or was already used. Please regenerate one from the OZmoz dashboard.");
329
329
  process.exit(1);
330
330
  }
331
331
 
332
332
  if (!keys.enterpriseId || !keys.fleetboDBKey) {
333
- logError("⚠️ Incomplete response from ozmoZ server.");
333
+ logError("⚠️ Incomplete response from OZmoz server.");
334
334
  process.exit(1);
335
335
  }
336
336
 
@@ -428,9 +428,9 @@ function injectNextAppRouterRuntime(projectRoot) {
428
428
  const ext = isTs ? 'tsx' : 'jsx';
429
429
 
430
430
  const clientSrc = isTs
431
- ? `'use client';\nimport 'ozmoz';\n\ntype OzConfig = { prototype: boolean; dbKey?: string; enterpriseId?: string };\n\n// Fichier généré par ozmoZ : embarque le SDK dans le navigateur et lui transmet la config du .env.\nexport default function OzClient({ config }: { config: OzConfig }) {\n Object.assign(globalThis, { OZ_CONFIG: config });\n return null;\n}\n`
432
- : `'use client';\nimport 'ozmoz';\n\n// Fichier généré par ozmoZ : embarque le SDK dans le navigateur et lui transmet la config du .env.\nexport default function OzClient({ config }) {\n globalThis.OZ_CONFIG = config;\n return null;\n}\n`;
433
- const runtimeSrc = `import OzClient from './ozmoz-client';\n\n// Fichier généré par ozmoZ : lit le .env côté serveur (source de vérité) et le transmet au navigateur.\nexport default function OzRuntime() {\n const config = {\n prototype: process.env.OZ_PROTOTYPE === 'true',\n dbKey: process.env.OZ_DB_KEY,\n enterpriseId: process.env.OZ_ENTERPRISE_ID,\n };\n return <OzClient config={config} />;\n}\n`;
431
+ ? `'use client';\nimport 'ozmoz';\n\ntype OzConfig = { prototype: boolean; dbKey?: string; enterpriseId?: string };\n\n// Fichier généré par OZmoz : embarque le SDK dans le navigateur et lui transmet la config du .env.\nexport default function OzClient({ config }: { config: OzConfig }) {\n Object.assign(globalThis, { OZ_CONFIG: config });\n return null;\n}\n`
432
+ : `'use client';\nimport 'ozmoz';\n\n// Fichier généré par OZmoz : embarque le SDK dans le navigateur et lui transmet la config du .env.\nexport default function OzClient({ config }) {\n globalThis.OZ_CONFIG = config;\n return null;\n}\n`;
433
+ const runtimeSrc = `import OzClient from './ozmoz-client';\n\n// Fichier généré par OZmoz : lit le .env côté serveur (source de vérité) et le transmet au navigateur.\nexport default function OzRuntime() {\n const config = {\n prototype: process.env.OZ_PROTOTYPE === 'true',\n dbKey: process.env.OZ_DB_KEY,\n enterpriseId: process.env.OZ_ENTERPRISE_ID,\n };\n return <OzClient config={config} />;\n}\n`;
434
434
 
435
435
  const clientPath = path.join(dir, `ozmoz-client.${ext}`);
436
436
  const runtimePath = path.join(dir, `ozmoz-runtime.${ext}`);
@@ -537,7 +537,7 @@ function injectUniversalRuntime(projectRoot) {
537
537
  }
538
538
 
539
539
  const SYNC_HANDLER_V2 = ` configureServer(server) {
540
- // ozmoZ sync handler: la synchronisation ne bloque plus le dev server
540
+ // OZmoz sync handler: la synchronisation ne bloque plus le dev server
541
541
  let syncing = false;
542
542
  let pending = false;
543
543
  const runSync = async () => {
@@ -693,7 +693,7 @@ function ensureVscodeCyanHints(projectRoot) {
693
693
  settings["workbench.colorCustomizations"]["editorHint.foreground"] = "#00feae";
694
694
 
695
695
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
696
- log("→ Configured ozmoZ Cyan visual hints in .vscode/settings.json.");
696
+ log("→ Configured OZmoz Cyan visual hints in .vscode/settings.json.");
697
697
  } catch (e) {}
698
698
  }
699
699