@fctc/interface-logic 4.4.0 → 4.4.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/environment.d.mts +1 -1
- package/dist/environment.d.ts +1 -1
- package/dist/hooks.d.mts +1 -4
- package/dist/hooks.d.ts +1 -4
- package/dist/hooks.js +301 -813
- package/dist/hooks.mjs +147 -658
- package/dist/provider.d.mts +13 -6
- package/dist/provider.d.ts +13 -6
- package/dist/provider.js +226 -711
- package/dist/provider.mjs +187 -674
- package/dist/services.d.mts +8 -8
- package/dist/services.d.ts +8 -8
- package/dist/services.js +262 -766
- package/dist/services.mjs +150 -653
- package/dist/store.js +1 -1
- package/dist/store.mjs +1 -1
- package/package.json +3 -2
- package/dist/import-snapshot-Ds0gqFFm.d.mts +0 -3
- package/dist/import-snapshot-Ds0gqFFm.d.ts +0 -3
package/dist/services.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(services_exports, {
|
|
|
35
35
|
useCompanyService: () => useCompanyService,
|
|
36
36
|
useDashboardService: () => useDashboardService,
|
|
37
37
|
useExcelService: () => useExcelService,
|
|
38
|
-
useFileSystemService: () => useFileSystemService,
|
|
39
38
|
useFormService: () => useFormService,
|
|
40
39
|
useKanbanService: () => useKanbanService,
|
|
41
40
|
useModelService: () => useModelService,
|
|
@@ -46,7 +45,7 @@ __export(services_exports, {
|
|
|
46
45
|
module.exports = __toCommonJS(services_exports);
|
|
47
46
|
|
|
48
47
|
// src/services/action-service/index.ts
|
|
49
|
-
var
|
|
48
|
+
var import_react39 = require("react");
|
|
50
49
|
|
|
51
50
|
// src/constants/api/uri-constant.ts
|
|
52
51
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
@@ -97,6 +96,58 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
97
96
|
// src/utils/format.ts
|
|
98
97
|
var import_moment = __toESM(require("moment"));
|
|
99
98
|
|
|
99
|
+
// src/constants/model/model-constant.ts
|
|
100
|
+
var LoadDataModel = /* @__PURE__ */ ((LoadDataModel2) => {
|
|
101
|
+
LoadDataModel2["ACCOUNT_CASH_ROUNDING"] = "account.cash.rounding";
|
|
102
|
+
LoadDataModel2["ACCOUNT_FISCAL_POSITION"] = "account.fiscal.position";
|
|
103
|
+
LoadDataModel2["ACCOUNT_FISCAL_POSITION_TAX"] = "account.fiscal.position.tax";
|
|
104
|
+
LoadDataModel2["ACCOUNT_TAX"] = "account.tax";
|
|
105
|
+
LoadDataModel2["ACCOUNT_TAX_GROUP"] = "account.tax.group";
|
|
106
|
+
LoadDataModel2["DECIMAL_PRECISION"] = "decimal.precision";
|
|
107
|
+
LoadDataModel2["IR_MODULE_MODULE"] = "ir.module.module";
|
|
108
|
+
LoadDataModel2["IR_UI_VIEW"] = "ir.ui.view";
|
|
109
|
+
LoadDataModel2["POS_BILL"] = "pos.bill";
|
|
110
|
+
LoadDataModel2["POS_CATEGORY"] = "pos.category";
|
|
111
|
+
LoadDataModel2["POS_CONFIG"] = "pos.config";
|
|
112
|
+
LoadDataModel2["POS_NOTE"] = "pos.note";
|
|
113
|
+
LoadDataModel2["POS_ORDER"] = "pos.order";
|
|
114
|
+
LoadDataModel2["POS_ORDER_LINE"] = "pos.order.line";
|
|
115
|
+
LoadDataModel2["POS_PACK_OPERATION_LOT"] = "pos.pack.operation.lot";
|
|
116
|
+
LoadDataModel2["POS_PAYMENT"] = "pos.payment";
|
|
117
|
+
LoadDataModel2["POS_PAYMENT_METHOD"] = "pos.payment.method";
|
|
118
|
+
LoadDataModel2["POS_PRINTER"] = "pos.printer";
|
|
119
|
+
LoadDataModel2["POS_SESSION"] = "pos.session";
|
|
120
|
+
LoadDataModel2["POS_PREPARATION_DISPLAY_DISPLAY"] = "pos_preparation_display.display";
|
|
121
|
+
LoadDataModel2["PRODUCT_ATTRIBUTE"] = "product.attribute";
|
|
122
|
+
LoadDataModel2["PRODUCT_ATTRIBUTE_CUSTOM_VALUE"] = "product.attribute.custom.value";
|
|
123
|
+
LoadDataModel2["PRODUCT_CATEGORY"] = "product.category";
|
|
124
|
+
LoadDataModel2["PRODUCT_COMBO"] = "product.combo";
|
|
125
|
+
LoadDataModel2["PRODUCT_COMBO_ITEM"] = "product.combo.item";
|
|
126
|
+
LoadDataModel2["PRODUCT_PACKAGING"] = "product.packaging";
|
|
127
|
+
LoadDataModel2["PRODUCT_PRICELIST"] = "product.pricelist";
|
|
128
|
+
LoadDataModel2["PRODUCT_PRICELIST_ITEM"] = "product.pricelist.item";
|
|
129
|
+
LoadDataModel2["PRODUCT_PRODUCT"] = "product.product";
|
|
130
|
+
LoadDataModel2["PRODUCT_TAG"] = "product.tag";
|
|
131
|
+
LoadDataModel2["PRODUCT_TEMPLATE_ATTRIBUTE_LINE"] = "product.template.attribute.line";
|
|
132
|
+
LoadDataModel2["PRODUCT_TEMPLATE_ATTRIBUTE_VALUE"] = "product.template.attribute.value";
|
|
133
|
+
LoadDataModel2["RES_COMPANY"] = "res.company";
|
|
134
|
+
LoadDataModel2["RES_COUNTRY"] = "res.country";
|
|
135
|
+
LoadDataModel2["RES_COUNTRY_STATE"] = "res.country.state";
|
|
136
|
+
LoadDataModel2["RES_CURRENCY"] = "res.currency";
|
|
137
|
+
LoadDataModel2["RES_LANG"] = "res.lang";
|
|
138
|
+
LoadDataModel2["RES_PARTNER"] = "res.partner";
|
|
139
|
+
LoadDataModel2["RES_USERS"] = "res.users";
|
|
140
|
+
LoadDataModel2["STOCK_PICKING_TYPE"] = "stock.picking.type";
|
|
141
|
+
LoadDataModel2["UOM_CATEGORY"] = "uom.category";
|
|
142
|
+
LoadDataModel2["UOM_UOM"] = "uom.uom";
|
|
143
|
+
LoadDataModel2["LOYALTY_PROGRAM"] = "loyalty.program";
|
|
144
|
+
LoadDataModel2["LOYALTY_RULE"] = "loyalty.rule";
|
|
145
|
+
LoadDataModel2["RESTAURANT_TABLE"] = "restaurant.table";
|
|
146
|
+
LoadDataModel2["RESTAURANT_FLOOR"] = "restaurant.floor";
|
|
147
|
+
LoadDataModel2["POS_MAKE_PAYMENT"] = "pos.make.payment";
|
|
148
|
+
return LoadDataModel2;
|
|
149
|
+
})(LoadDataModel || {});
|
|
150
|
+
|
|
100
151
|
// src/utils/domain/py_tokenizer.ts
|
|
101
152
|
var TokenizerError = class extends Error {
|
|
102
153
|
};
|
|
@@ -2225,13 +2276,6 @@ function cleanObject(obj) {
|
|
|
2225
2276
|
}
|
|
2226
2277
|
return result;
|
|
2227
2278
|
}
|
|
2228
|
-
var extractIdFromDomain = (domain) => {
|
|
2229
|
-
if (!domain || !Array.isArray(domain)) return null;
|
|
2230
|
-
const idCond = domain.find(
|
|
2231
|
-
([field, operator]) => field === "id" && operator === "="
|
|
2232
|
-
);
|
|
2233
|
-
return idCond ? Number(idCond[2]) : null;
|
|
2234
|
-
};
|
|
2235
2279
|
|
|
2236
2280
|
// src/provider/react-query-provider.tsx
|
|
2237
2281
|
var import_react2 = require("react");
|
|
@@ -2284,7 +2328,7 @@ var initialState2 = {
|
|
|
2284
2328
|
lang: "vi_VN",
|
|
2285
2329
|
tz: "Asia/Saigon"
|
|
2286
2330
|
},
|
|
2287
|
-
|
|
2331
|
+
isSupaMode: false
|
|
2288
2332
|
};
|
|
2289
2333
|
var envSlice = (0, import_toolkit2.createSlice)({
|
|
2290
2334
|
name: "env",
|
|
@@ -2891,7 +2935,7 @@ function useEnv() {
|
|
|
2891
2935
|
}
|
|
2892
2936
|
|
|
2893
2937
|
// src/provider/service-provider.tsx
|
|
2894
|
-
var
|
|
2938
|
+
var import_react37 = require("react");
|
|
2895
2939
|
|
|
2896
2940
|
// src/hooks/auth/use-forgot-password.ts
|
|
2897
2941
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -3195,544 +3239,7 @@ var getASessionService = (env) => {
|
|
|
3195
3239
|
|
|
3196
3240
|
// src/services/pos-service/add-entity.ts
|
|
3197
3241
|
var import_react7 = require("react");
|
|
3198
|
-
|
|
3199
|
-
// src/services/filesystem-service/file-service.ts
|
|
3200
|
-
var import_filesystem = require("@capacitor/filesystem");
|
|
3201
|
-
var fileService = {
|
|
3202
|
-
read: async (path) => {
|
|
3203
|
-
try {
|
|
3204
|
-
const res = await import_filesystem.Filesystem.readFile({
|
|
3205
|
-
path,
|
|
3206
|
-
directory: import_filesystem.Directory.Data,
|
|
3207
|
-
encoding: import_filesystem.Encoding.UTF8
|
|
3208
|
-
});
|
|
3209
|
-
if (typeof res.data === "string") return res.data;
|
|
3210
|
-
if (res.data instanceof Blob) return await res.data.text();
|
|
3211
|
-
return null;
|
|
3212
|
-
} catch {
|
|
3213
|
-
return null;
|
|
3214
|
-
}
|
|
3215
|
-
},
|
|
3216
|
-
write: async (path, data) => {
|
|
3217
|
-
await import_filesystem.Filesystem.writeFile({
|
|
3218
|
-
path,
|
|
3219
|
-
data,
|
|
3220
|
-
directory: import_filesystem.Directory.Data,
|
|
3221
|
-
encoding: import_filesystem.Encoding.UTF8,
|
|
3222
|
-
recursive: true
|
|
3223
|
-
});
|
|
3224
|
-
},
|
|
3225
|
-
writeAtomic: async (path, data) => {
|
|
3226
|
-
const tempPath = path + ".tmp";
|
|
3227
|
-
await import_filesystem.Filesystem.writeFile({
|
|
3228
|
-
path: tempPath,
|
|
3229
|
-
data,
|
|
3230
|
-
directory: import_filesystem.Directory.Data,
|
|
3231
|
-
encoding: import_filesystem.Encoding.UTF8,
|
|
3232
|
-
recursive: true
|
|
3233
|
-
});
|
|
3234
|
-
try {
|
|
3235
|
-
await import_filesystem.Filesystem.deleteFile({
|
|
3236
|
-
path,
|
|
3237
|
-
directory: import_filesystem.Directory.Data
|
|
3238
|
-
});
|
|
3239
|
-
} catch {
|
|
3240
|
-
}
|
|
3241
|
-
await import_filesystem.Filesystem.rename({
|
|
3242
|
-
from: tempPath,
|
|
3243
|
-
to: path,
|
|
3244
|
-
directory: import_filesystem.Directory.Data
|
|
3245
|
-
});
|
|
3246
|
-
},
|
|
3247
|
-
delete: async (path) => {
|
|
3248
|
-
try {
|
|
3249
|
-
await import_filesystem.Filesystem.deleteFile({
|
|
3250
|
-
path,
|
|
3251
|
-
directory: import_filesystem.Directory.Data
|
|
3252
|
-
});
|
|
3253
|
-
} catch {
|
|
3254
|
-
}
|
|
3255
|
-
},
|
|
3256
|
-
exists: async (path) => {
|
|
3257
|
-
try {
|
|
3258
|
-
await import_filesystem.Filesystem.stat({
|
|
3259
|
-
path,
|
|
3260
|
-
directory: import_filesystem.Directory.Data
|
|
3261
|
-
});
|
|
3262
|
-
return true;
|
|
3263
|
-
} catch {
|
|
3264
|
-
return false;
|
|
3265
|
-
}
|
|
3266
|
-
},
|
|
3267
|
-
mkdir: async (path) => {
|
|
3268
|
-
try {
|
|
3269
|
-
await import_filesystem.Filesystem.mkdir({
|
|
3270
|
-
path,
|
|
3271
|
-
directory: import_filesystem.Directory.Data,
|
|
3272
|
-
recursive: true
|
|
3273
|
-
});
|
|
3274
|
-
} catch (e) {
|
|
3275
|
-
if (!String(e?.message).includes("Exists")) {
|
|
3276
|
-
throw e;
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
},
|
|
3280
|
-
list: async (path) => {
|
|
3281
|
-
return import_filesystem.Filesystem.readdir({
|
|
3282
|
-
path,
|
|
3283
|
-
directory: import_filesystem.Directory.Data
|
|
3284
|
-
});
|
|
3285
|
-
},
|
|
3286
|
-
getUri: async (path) => {
|
|
3287
|
-
return import_filesystem.Filesystem.getUri({
|
|
3288
|
-
path,
|
|
3289
|
-
directory: import_filesystem.Directory.Data
|
|
3290
|
-
});
|
|
3291
|
-
}
|
|
3292
|
-
};
|
|
3293
|
-
|
|
3294
|
-
// src/services/filesystem-service/json-worker.ts
|
|
3295
|
-
function createWorkerBlob() {
|
|
3296
|
-
const workerCode = `
|
|
3297
|
-
self.addEventListener("message", async (ev) => {
|
|
3298
|
-
const { id, cmd, payload } = ev.data;
|
|
3299
|
-
try {
|
|
3300
|
-
if (cmd === "parse") {
|
|
3301
|
-
const parsed = JSON.parse(payload);
|
|
3302
|
-
self.postMessage({ id, ok: true, result: parsed });
|
|
3303
|
-
} else if (cmd === "stringify") {
|
|
3304
|
-
const str = JSON.stringify(payload);
|
|
3305
|
-
self.postMessage({ id, ok: true, result: str });
|
|
3306
|
-
}
|
|
3307
|
-
} catch (err) {
|
|
3308
|
-
self.postMessage({ id, ok: false, error: err?.message || String(err) });
|
|
3309
|
-
}
|
|
3310
|
-
});
|
|
3311
|
-
`;
|
|
3312
|
-
const blob = new Blob([workerCode], { type: "application/javascript" });
|
|
3313
|
-
return URL.createObjectURL(blob);
|
|
3314
|
-
}
|
|
3315
|
-
function spawnParseWorker(raw) {
|
|
3316
|
-
return new Promise((resolve, reject) => {
|
|
3317
|
-
const workerUrl = createWorkerBlob();
|
|
3318
|
-
const worker = new Worker(workerUrl);
|
|
3319
|
-
const id = Math.random().toString(36).slice(2);
|
|
3320
|
-
worker.onmessage = (ev) => {
|
|
3321
|
-
const { ok, result, error } = ev.data;
|
|
3322
|
-
if (ok) {
|
|
3323
|
-
resolve(result);
|
|
3324
|
-
} else {
|
|
3325
|
-
reject(new Error(error));
|
|
3326
|
-
}
|
|
3327
|
-
URL.revokeObjectURL(workerUrl);
|
|
3328
|
-
worker.terminate();
|
|
3329
|
-
};
|
|
3330
|
-
worker.onerror = (err) => {
|
|
3331
|
-
reject(err);
|
|
3332
|
-
URL.revokeObjectURL(workerUrl);
|
|
3333
|
-
worker.terminate();
|
|
3334
|
-
};
|
|
3335
|
-
worker.postMessage({ id, cmd: "parse", payload: raw });
|
|
3336
|
-
});
|
|
3337
|
-
}
|
|
3338
|
-
function spawnStringifyWorker(obj) {
|
|
3339
|
-
return new Promise((resolve, reject) => {
|
|
3340
|
-
const workerUrl = createWorkerBlob();
|
|
3341
|
-
const worker = new Worker(workerUrl);
|
|
3342
|
-
worker.onmessage = (ev) => {
|
|
3343
|
-
const { ok, result, error } = ev.data;
|
|
3344
|
-
if (ok) resolve(result);
|
|
3345
|
-
else reject(new Error(error));
|
|
3346
|
-
URL.revokeObjectURL(workerUrl);
|
|
3347
|
-
worker.terminate();
|
|
3348
|
-
};
|
|
3349
|
-
worker.onerror = (err) => {
|
|
3350
|
-
reject(err);
|
|
3351
|
-
URL.revokeObjectURL(workerUrl);
|
|
3352
|
-
worker.terminate();
|
|
3353
|
-
};
|
|
3354
|
-
worker.postMessage({ cmd: "stringify", payload: obj });
|
|
3355
|
-
});
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3358
|
-
// src/services/filesystem-service/manifest.ts
|
|
3359
|
-
var MANIFEST_PATH = "pos/manifest.json";
|
|
3360
|
-
var MANIFEST_BAK_PATH = "pos/manifest.bak.json";
|
|
3361
|
-
async function writeManifest(manifest) {
|
|
3362
|
-
const oldRaw = await fileService.read(MANIFEST_PATH);
|
|
3363
|
-
if (oldRaw !== null) {
|
|
3364
|
-
await fileService.writeAtomic(MANIFEST_BAK_PATH, oldRaw);
|
|
3365
|
-
}
|
|
3366
|
-
await fileService.writeAtomic(MANIFEST_PATH, JSON.stringify(manifest));
|
|
3367
|
-
try {
|
|
3368
|
-
await fileService.delete(MANIFEST_BAK_PATH);
|
|
3369
|
-
} catch {
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
// src/services/filesystem-service/import-snapshot.ts
|
|
3374
|
-
var DATA_DIR = "pos";
|
|
3375
|
-
var MODELS_DIR = `${DATA_DIR}/models`;
|
|
3376
|
-
var MODELS_META_DIR = `${DATA_DIR}/models_meta`;
|
|
3377
|
-
var importSnapshot = async ({ data, onProgress }) => {
|
|
3378
|
-
onProgress?.(1, "Parsing snapshot");
|
|
3379
|
-
const parsed = await spawnParseWorker(data);
|
|
3380
|
-
const modelNames = Object.keys(parsed);
|
|
3381
|
-
const total = modelNames.length;
|
|
3382
|
-
const manifest = { version: (/* @__PURE__ */ new Date()).toISOString(), models: {} };
|
|
3383
|
-
const TMP_PREFIX = `pos/data/tmp_import_${Date.now()}`;
|
|
3384
|
-
await fileService.writeAtomic(`${TMP_PREFIX}/.marker`, "1");
|
|
3385
|
-
let i = 0;
|
|
3386
|
-
for (const model of modelNames) {
|
|
3387
|
-
i++;
|
|
3388
|
-
onProgress?.(
|
|
3389
|
-
Math.round(i / total * 100),
|
|
3390
|
-
`Processing ${model} (${i}/${total})`
|
|
3391
|
-
);
|
|
3392
|
-
const block = parsed[model];
|
|
3393
|
-
const dataPart = block?.data ?? block ?? [];
|
|
3394
|
-
const fields = block?.fields ?? [];
|
|
3395
|
-
const relations = block?.relations ?? {};
|
|
3396
|
-
const serialized = await spawnStringifyWorker(dataPart);
|
|
3397
|
-
const tmpModelPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.json`;
|
|
3398
|
-
await fileService.writeAtomic(tmpModelPath, serialized);
|
|
3399
|
-
const meta = {
|
|
3400
|
-
fields,
|
|
3401
|
-
relations,
|
|
3402
|
-
count: Array.isArray(dataPart) ? dataPart.length : 0,
|
|
3403
|
-
writtenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3404
|
-
};
|
|
3405
|
-
const tmpMetaPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`;
|
|
3406
|
-
await fileService.writeAtomic(tmpMetaPath, JSON.stringify(meta));
|
|
3407
|
-
manifest.models[model] = {
|
|
3408
|
-
file: `${MODELS_DIR}/${encodeURIComponent(model)}.json`,
|
|
3409
|
-
metaFile: `${MODELS_META_DIR}/${encodeURIComponent(model)}.meta.json`,
|
|
3410
|
-
count: meta.count,
|
|
3411
|
-
updatedAt: meta.writtenAt
|
|
3412
|
-
};
|
|
3413
|
-
}
|
|
3414
|
-
onProgress?.(95, "Committing import (moving files)");
|
|
3415
|
-
for (const model of modelNames) {
|
|
3416
|
-
const tmpModelPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.json`;
|
|
3417
|
-
const finalModelPath = `${MODELS_DIR}/${encodeURIComponent(model)}.json`;
|
|
3418
|
-
const tmpMetaPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`;
|
|
3419
|
-
const finalMetaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
3420
|
-
model
|
|
3421
|
-
)}.meta.json`;
|
|
3422
|
-
const tmpRaw = await fileService.read(tmpModelPath);
|
|
3423
|
-
if (tmpRaw !== null) await fileService.writeAtomic(finalModelPath, tmpRaw);
|
|
3424
|
-
const tmpMetaRaw = await fileService.read(tmpMetaPath);
|
|
3425
|
-
if (tmpMetaRaw !== null)
|
|
3426
|
-
await fileService.writeAtomic(finalMetaPath, tmpMetaRaw);
|
|
3427
|
-
onProgress?.(
|
|
3428
|
-
95 + Math.round(
|
|
3429
|
-
(Object.keys(manifest.models).indexOf(model) + 1) / modelNames.length * 5
|
|
3430
|
-
),
|
|
3431
|
-
`Committed ${model}`
|
|
3432
|
-
);
|
|
3433
|
-
}
|
|
3434
|
-
await writeManifest(manifest);
|
|
3435
|
-
try {
|
|
3436
|
-
for (const model of modelNames) {
|
|
3437
|
-
await fileService.delete(
|
|
3438
|
-
`${TMP_PREFIX}/${encodeURIComponent(model)}.json`
|
|
3439
|
-
);
|
|
3440
|
-
await fileService.delete(
|
|
3441
|
-
`${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`
|
|
3442
|
-
);
|
|
3443
|
-
}
|
|
3444
|
-
await fileService.delete(`${TMP_PREFIX}/.marker`);
|
|
3445
|
-
} catch (e) {
|
|
3446
|
-
console.log("Failed to cleanup tmp import files:", e);
|
|
3447
|
-
}
|
|
3448
|
-
onProgress?.(100, "Import complete");
|
|
3449
|
-
return manifest;
|
|
3450
|
-
};
|
|
3451
|
-
var import_snapshot_default = importSnapshot;
|
|
3452
|
-
|
|
3453
|
-
// src/services/filesystem-service/memory-cache.ts
|
|
3454
|
-
var MemoryCache = class {
|
|
3455
|
-
map = /* @__PURE__ */ new Map();
|
|
3456
|
-
get(k) {
|
|
3457
|
-
const e = this.map.get(k);
|
|
3458
|
-
if (!e) return null;
|
|
3459
|
-
if (e.ttl && Date.now() - e.t > e.ttl) {
|
|
3460
|
-
this.map.delete(k);
|
|
3461
|
-
return null;
|
|
3462
|
-
}
|
|
3463
|
-
return e.value;
|
|
3464
|
-
}
|
|
3465
|
-
set(k, v, ttl = 5 * 60 * 1e3) {
|
|
3466
|
-
this.map.set(k, { value: v, t: Date.now(), ttl });
|
|
3467
|
-
}
|
|
3468
|
-
del(k) {
|
|
3469
|
-
this.map.delete(k);
|
|
3470
|
-
}
|
|
3471
|
-
clear() {
|
|
3472
|
-
this.map.clear();
|
|
3473
|
-
}
|
|
3474
|
-
};
|
|
3475
|
-
var memoryCache = new MemoryCache();
|
|
3476
|
-
|
|
3477
|
-
// src/services/filesystem-service/model-loader.ts
|
|
3478
|
-
var MODELS_DIR2 = "pos/models";
|
|
3479
|
-
var MODELS_META_DIR2 = "pos/models_meta";
|
|
3480
|
-
async function loadModelData(modelName, includeMeta = true) {
|
|
3481
|
-
const key = `model:${modelName}:meta:${includeMeta}`;
|
|
3482
|
-
const cached = memoryCache.get(key);
|
|
3483
|
-
if (cached) return cached;
|
|
3484
|
-
const dataPath = `${MODELS_DIR2}/${encodeURIComponent(modelName)}.json`;
|
|
3485
|
-
const metaPath = `${MODELS_META_DIR2}/${encodeURIComponent(
|
|
3486
|
-
modelName
|
|
3487
|
-
)}.meta.json`;
|
|
3488
|
-
const rawData = await fileService.read(dataPath);
|
|
3489
|
-
if (!rawData) return null;
|
|
3490
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
3491
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
3492
|
-
if (!includeMeta) {
|
|
3493
|
-
const result2 = { data };
|
|
3494
|
-
memoryCache.set(key, result2, 1e3 * 60 * 60);
|
|
3495
|
-
return result2;
|
|
3496
|
-
}
|
|
3497
|
-
const rawMeta = await fileService.read(metaPath);
|
|
3498
|
-
let fields = [];
|
|
3499
|
-
let relations = {};
|
|
3500
|
-
if (rawMeta) {
|
|
3501
|
-
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
3502
|
-
fields = parsedMeta?.fields ?? [];
|
|
3503
|
-
relations = parsedMeta?.relations ?? {};
|
|
3504
|
-
}
|
|
3505
|
-
const result = {
|
|
3506
|
-
data,
|
|
3507
|
-
fields,
|
|
3508
|
-
relations
|
|
3509
|
-
};
|
|
3510
|
-
memoryCache.set(key, result, 1e3 * 60 * 60);
|
|
3511
|
-
return result;
|
|
3512
|
-
}
|
|
3513
|
-
async function loadData(includeMeta = true) {
|
|
3514
|
-
try {
|
|
3515
|
-
const listResult = await fileService.list(MODELS_DIR2);
|
|
3516
|
-
if (!listResult || !Array.isArray(listResult.files)) {
|
|
3517
|
-
console.log("No models found");
|
|
3518
|
-
return {};
|
|
3519
|
-
}
|
|
3520
|
-
const result = {};
|
|
3521
|
-
for (const file of listResult.files) {
|
|
3522
|
-
if (file.type !== "file") continue;
|
|
3523
|
-
if (!file.name.endsWith(".json")) continue;
|
|
3524
|
-
const fileName = file.name;
|
|
3525
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
3526
|
-
const dataPath = `${MODELS_DIR2}/${fileName}`;
|
|
3527
|
-
const rawData = await fileService.read(dataPath);
|
|
3528
|
-
if (!rawData) continue;
|
|
3529
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
3530
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
3531
|
-
if (!includeMeta) {
|
|
3532
|
-
result[modelName] = { data };
|
|
3533
|
-
continue;
|
|
3534
|
-
}
|
|
3535
|
-
const metaPath = `${MODELS_META_DIR2}/${encodeURIComponent(
|
|
3536
|
-
modelName
|
|
3537
|
-
)}.meta.json`;
|
|
3538
|
-
const rawMeta = await fileService.read(metaPath);
|
|
3539
|
-
let fields = [];
|
|
3540
|
-
let relations = {};
|
|
3541
|
-
if (rawMeta) {
|
|
3542
|
-
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
3543
|
-
fields = parsedMeta?.fields ?? [];
|
|
3544
|
-
relations = parsedMeta?.relations ?? {};
|
|
3545
|
-
}
|
|
3546
|
-
result[modelName] = {
|
|
3547
|
-
data,
|
|
3548
|
-
fields,
|
|
3549
|
-
relations
|
|
3550
|
-
};
|
|
3551
|
-
}
|
|
3552
|
-
return result;
|
|
3553
|
-
} catch (error) {
|
|
3554
|
-
console.error("Error loading data:", error);
|
|
3555
|
-
throw error;
|
|
3556
|
-
}
|
|
3557
|
-
}
|
|
3558
|
-
|
|
3559
|
-
// src/services/filesystem-service/snapshot-helper.ts
|
|
3560
|
-
var createEmptySnapshot = () => {
|
|
3561
|
-
return {
|
|
3562
|
-
data: []
|
|
3563
|
-
};
|
|
3564
|
-
};
|
|
3565
|
-
var generateNextId = (existingIds, startFrom = 1) => {
|
|
3566
|
-
if (!existingIds || existingIds.length === 0) {
|
|
3567
|
-
return startFrom;
|
|
3568
|
-
}
|
|
3569
|
-
const maxId = Math.max(...existingIds, startFrom - 1);
|
|
3570
|
-
return maxId + 1;
|
|
3571
|
-
};
|
|
3572
|
-
var loadSnapshot = async ({
|
|
3573
|
-
modelName
|
|
3574
|
-
}) => {
|
|
3575
|
-
try {
|
|
3576
|
-
const snapshot = await loadModelData(modelName);
|
|
3577
|
-
if (!snapshot || typeof snapshot !== "object") {
|
|
3578
|
-
console.warn("invalid snapshot, creating new one");
|
|
3579
|
-
return createEmptySnapshot();
|
|
3580
|
-
}
|
|
3581
|
-
return {
|
|
3582
|
-
data: Array.isArray(snapshot.data) ? snapshot.data : []
|
|
3583
|
-
};
|
|
3584
|
-
} catch (error) {
|
|
3585
|
-
console.error("Failed to load snapshot:", error);
|
|
3586
|
-
return createEmptySnapshot();
|
|
3587
|
-
}
|
|
3588
|
-
};
|
|
3589
|
-
var getExistingIds = (snapshot) => {
|
|
3590
|
-
return snapshot.data.map((order) => order.id).filter((id) => typeof id === "number");
|
|
3591
|
-
};
|
|
3592
|
-
var saveSnapshot = async ({
|
|
3593
|
-
snapshot,
|
|
3594
|
-
modelName
|
|
3595
|
-
}) => {
|
|
3596
|
-
try {
|
|
3597
|
-
await import_snapshot_default({
|
|
3598
|
-
data: JSON.stringify({
|
|
3599
|
-
[modelName]: snapshot
|
|
3600
|
-
})
|
|
3601
|
-
});
|
|
3602
|
-
return true;
|
|
3603
|
-
} catch (error) {
|
|
3604
|
-
console.error("failed to save snapshot:", error);
|
|
3605
|
-
return false;
|
|
3606
|
-
}
|
|
3607
|
-
};
|
|
3608
|
-
var addRecordResponseHandler = ({
|
|
3609
|
-
modelName,
|
|
3610
|
-
id,
|
|
3611
|
-
data
|
|
3612
|
-
}) => {
|
|
3613
|
-
if (modelName === "restaurant.floor" /* RESTAURANT_FLOOR */ || modelName === "res.partner" /* RES_PARTNER */) {
|
|
3614
|
-
return [[id, ""]];
|
|
3615
|
-
}
|
|
3616
|
-
return data;
|
|
3617
|
-
};
|
|
3618
|
-
|
|
3619
|
-
// src/services/filesystem-service/model-repository.ts
|
|
3620
|
-
var ModelRepository = class {
|
|
3621
|
-
getAll = async ({ modelName }) => {
|
|
3622
|
-
try {
|
|
3623
|
-
const snapshot = await loadSnapshot({
|
|
3624
|
-
modelName
|
|
3625
|
-
});
|
|
3626
|
-
return snapshot.data;
|
|
3627
|
-
} catch (error) {
|
|
3628
|
-
console.error("failed to get all records:", error);
|
|
3629
|
-
return [];
|
|
3630
|
-
}
|
|
3631
|
-
};
|
|
3632
|
-
getRecord = async ({
|
|
3633
|
-
id,
|
|
3634
|
-
modelName
|
|
3635
|
-
}) => {
|
|
3636
|
-
try {
|
|
3637
|
-
const snapshot = await loadSnapshot({
|
|
3638
|
-
modelName
|
|
3639
|
-
});
|
|
3640
|
-
return snapshot.data.find((record) => record.id === id) || null;
|
|
3641
|
-
} catch (error) {
|
|
3642
|
-
console.error("failed to get record:", error);
|
|
3643
|
-
return null;
|
|
3644
|
-
}
|
|
3645
|
-
};
|
|
3646
|
-
addRecord = async ({
|
|
3647
|
-
newRecord,
|
|
3648
|
-
modelName
|
|
3649
|
-
}) => {
|
|
3650
|
-
try {
|
|
3651
|
-
const snapshot = await loadSnapshot({
|
|
3652
|
-
modelName
|
|
3653
|
-
});
|
|
3654
|
-
const existingIds = getExistingIds(snapshot);
|
|
3655
|
-
const newId = generateNextId(existingIds, snapshot.data.length);
|
|
3656
|
-
snapshot.data.push({
|
|
3657
|
-
...newRecord,
|
|
3658
|
-
id: newId
|
|
3659
|
-
});
|
|
3660
|
-
const saved = await saveSnapshot({
|
|
3661
|
-
snapshot,
|
|
3662
|
-
modelName
|
|
3663
|
-
});
|
|
3664
|
-
if (!saved) {
|
|
3665
|
-
console.error("failed to add new record");
|
|
3666
|
-
return [];
|
|
3667
|
-
}
|
|
3668
|
-
console.log("lib data:", snapshot.data);
|
|
3669
|
-
const response = addRecordResponseHandler({
|
|
3670
|
-
id: newId,
|
|
3671
|
-
modelName,
|
|
3672
|
-
data: snapshot.data
|
|
3673
|
-
});
|
|
3674
|
-
return response;
|
|
3675
|
-
} catch (error) {
|
|
3676
|
-
console.error("failed to add new record:", error);
|
|
3677
|
-
return [];
|
|
3678
|
-
}
|
|
3679
|
-
};
|
|
3680
|
-
updateRecord = async ({
|
|
3681
|
-
id,
|
|
3682
|
-
update,
|
|
3683
|
-
modelName
|
|
3684
|
-
}) => {
|
|
3685
|
-
try {
|
|
3686
|
-
const snapshot = await loadSnapshot({
|
|
3687
|
-
modelName
|
|
3688
|
-
});
|
|
3689
|
-
const index = snapshot.data.findIndex((record) => record.id === id);
|
|
3690
|
-
if (index === -1) {
|
|
3691
|
-
console.error(`record with id ${id} not found`);
|
|
3692
|
-
return false;
|
|
3693
|
-
}
|
|
3694
|
-
snapshot.data[index] = {
|
|
3695
|
-
...snapshot.data[index],
|
|
3696
|
-
...update
|
|
3697
|
-
};
|
|
3698
|
-
return await saveSnapshot({
|
|
3699
|
-
snapshot,
|
|
3700
|
-
modelName
|
|
3701
|
-
});
|
|
3702
|
-
} catch (error) {
|
|
3703
|
-
console.error("error updating record:", error);
|
|
3704
|
-
return false;
|
|
3705
|
-
}
|
|
3706
|
-
};
|
|
3707
|
-
deleteRecord = async ({
|
|
3708
|
-
id,
|
|
3709
|
-
modelName
|
|
3710
|
-
}) => {
|
|
3711
|
-
try {
|
|
3712
|
-
const snapshot = await loadSnapshot({
|
|
3713
|
-
modelName
|
|
3714
|
-
});
|
|
3715
|
-
const before = snapshot.data.length;
|
|
3716
|
-
snapshot.data = snapshot.data.filter((record) => record.id !== id);
|
|
3717
|
-
if (snapshot.data.length === before) {
|
|
3718
|
-
console.error(`record with id ${id} not found`);
|
|
3719
|
-
return false;
|
|
3720
|
-
}
|
|
3721
|
-
return await saveSnapshot({
|
|
3722
|
-
snapshot,
|
|
3723
|
-
modelName
|
|
3724
|
-
});
|
|
3725
|
-
} catch (error) {
|
|
3726
|
-
console.error("error deleting record:", error);
|
|
3727
|
-
return false;
|
|
3728
|
-
}
|
|
3729
|
-
};
|
|
3730
|
-
};
|
|
3731
|
-
|
|
3732
|
-
// src/services/pos-service/add-entity.ts
|
|
3733
3242
|
var addEntityService = (env) => {
|
|
3734
|
-
const isLocalMode = env?.isLocalMode;
|
|
3735
|
-
const repo = new ModelRepository();
|
|
3736
3243
|
const addEntity = (0, import_react7.useCallback)(
|
|
3737
3244
|
({
|
|
3738
3245
|
model,
|
|
@@ -3741,12 +3248,6 @@ var addEntityService = (env) => {
|
|
|
3741
3248
|
service,
|
|
3742
3249
|
isCreateEndpoint = false
|
|
3743
3250
|
}) => {
|
|
3744
|
-
if (isLocalMode) {
|
|
3745
|
-
return repo.addRecord({
|
|
3746
|
-
newRecord: values,
|
|
3747
|
-
modelName: model
|
|
3748
|
-
});
|
|
3749
|
-
}
|
|
3750
3251
|
const jsonData = {
|
|
3751
3252
|
model,
|
|
3752
3253
|
values
|
|
@@ -3763,7 +3264,7 @@ var addEntityService = (env) => {
|
|
|
3763
3264
|
service
|
|
3764
3265
|
);
|
|
3765
3266
|
},
|
|
3766
|
-
[env
|
|
3267
|
+
[env]
|
|
3767
3268
|
);
|
|
3768
3269
|
return {
|
|
3769
3270
|
addEntity
|
|
@@ -3885,8 +3386,6 @@ var createEInvoiceService = (env) => {
|
|
|
3885
3386
|
// src/services/pos-service/create-entity.ts
|
|
3886
3387
|
var import_react11 = require("react");
|
|
3887
3388
|
var createEntityService = (env) => {
|
|
3888
|
-
const isLocalMode = env?.isLocalMode;
|
|
3889
|
-
const repo = new ModelRepository();
|
|
3890
3389
|
const createEntity = (0, import_react11.useCallback)(
|
|
3891
3390
|
({
|
|
3892
3391
|
model,
|
|
@@ -3894,12 +3393,6 @@ var createEntityService = (env) => {
|
|
|
3894
3393
|
xNode,
|
|
3895
3394
|
service
|
|
3896
3395
|
}) => {
|
|
3897
|
-
if (isLocalMode) {
|
|
3898
|
-
return repo.addRecord({
|
|
3899
|
-
newRecord: args[0],
|
|
3900
|
-
modelName: model
|
|
3901
|
-
});
|
|
3902
|
-
}
|
|
3903
3396
|
const jsonData = {
|
|
3904
3397
|
model,
|
|
3905
3398
|
method: "create" /* CREATE */,
|
|
@@ -3917,7 +3410,7 @@ var createEntityService = (env) => {
|
|
|
3917
3410
|
service
|
|
3918
3411
|
);
|
|
3919
3412
|
},
|
|
3920
|
-
[env
|
|
3413
|
+
[env]
|
|
3921
3414
|
);
|
|
3922
3415
|
return {
|
|
3923
3416
|
createEntity
|
|
@@ -4002,8 +3495,6 @@ var createSessionService = (env) => {
|
|
|
4002
3495
|
// src/services/pos-service/delete-entity.ts
|
|
4003
3496
|
var import_react14 = require("react");
|
|
4004
3497
|
var deleteEntityService = (env) => {
|
|
4005
|
-
const isLocalMode = env?.isLocalMode;
|
|
4006
|
-
const repo = new ModelRepository();
|
|
4007
3498
|
const deleteEntity = (0, import_react14.useCallback)(
|
|
4008
3499
|
({
|
|
4009
3500
|
model,
|
|
@@ -4012,14 +3503,6 @@ var deleteEntityService = (env) => {
|
|
|
4012
3503
|
service,
|
|
4013
3504
|
method
|
|
4014
3505
|
}) => {
|
|
4015
|
-
if (isLocalMode) {
|
|
4016
|
-
const id = ids[0];
|
|
4017
|
-
if (!id) return;
|
|
4018
|
-
return repo.deleteRecord({
|
|
4019
|
-
modelName: model,
|
|
4020
|
-
id
|
|
4021
|
-
});
|
|
4022
|
-
}
|
|
4023
3506
|
const jsonData = {
|
|
4024
3507
|
model,
|
|
4025
3508
|
ids,
|
|
@@ -4037,7 +3520,7 @@ var deleteEntityService = (env) => {
|
|
|
4037
3520
|
service
|
|
4038
3521
|
);
|
|
4039
3522
|
},
|
|
4040
|
-
[env
|
|
3523
|
+
[env]
|
|
4041
3524
|
);
|
|
4042
3525
|
return {
|
|
4043
3526
|
deleteEntity
|
|
@@ -4114,8 +3597,6 @@ var getCurrentUserService = (env) => {
|
|
|
4114
3597
|
// src/services/pos-service/get-list.ts
|
|
4115
3598
|
var import_react17 = require("react");
|
|
4116
3599
|
var getListService = (env) => {
|
|
4117
|
-
const isLocalMode = env?.isLocalMode;
|
|
4118
|
-
const repo = new ModelRepository();
|
|
4119
3600
|
const getList = (0, import_react17.useCallback)(
|
|
4120
3601
|
async ({
|
|
4121
3602
|
model,
|
|
@@ -4126,12 +3607,6 @@ var getListService = (env) => {
|
|
|
4126
3607
|
offset,
|
|
4127
3608
|
limit
|
|
4128
3609
|
}) => {
|
|
4129
|
-
if (isLocalMode) {
|
|
4130
|
-
const data = await repo.getAll({
|
|
4131
|
-
modelName: model
|
|
4132
|
-
});
|
|
4133
|
-
return data;
|
|
4134
|
-
}
|
|
4135
3610
|
const jsonData = {
|
|
4136
3611
|
model,
|
|
4137
3612
|
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
@@ -4154,7 +3629,7 @@ var getListService = (env) => {
|
|
|
4154
3629
|
service
|
|
4155
3630
|
);
|
|
4156
3631
|
},
|
|
4157
|
-
[env
|
|
3632
|
+
[env]
|
|
4158
3633
|
);
|
|
4159
3634
|
return {
|
|
4160
3635
|
getList
|
|
@@ -4482,10 +3957,37 @@ var handleClosingSessionService = (env) => {
|
|
|
4482
3957
|
};
|
|
4483
3958
|
|
|
4484
3959
|
// src/services/pos-service/load-data-pos-session.ts
|
|
3960
|
+
var import_react27 = require("react");
|
|
3961
|
+
|
|
3962
|
+
// src/provider/supabase-provider.tsx
|
|
4485
3963
|
var import_react26 = require("react");
|
|
3964
|
+
var import_supabase_js = require("@supabase/supabase-js");
|
|
3965
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3966
|
+
var SupabaseContext = (0, import_react26.createContext)(null);
|
|
3967
|
+
var useSupabaseOptional = () => {
|
|
3968
|
+
return (0, import_react26.useContext)(SupabaseContext);
|
|
3969
|
+
};
|
|
3970
|
+
|
|
3971
|
+
// src/services/pos-service/load-data-pos-session.ts
|
|
3972
|
+
var MODEL_TO_TABLE = {
|
|
3973
|
+
["account.tax" /* ACCOUNT_TAX */]: "account_taxes",
|
|
3974
|
+
["res.company" /* RES_COMPANY */]: "companies",
|
|
3975
|
+
["res.partner" /* RES_PARTNER */]: "customers",
|
|
3976
|
+
["res.users" /* RES_USERS */]: "employees",
|
|
3977
|
+
["loyalty.program" /* LOYALTY_PROGRAM */]: "loyalty_programs",
|
|
3978
|
+
["loyalty.rule" /* LOYALTY_RULE */]: "loyalty_rules",
|
|
3979
|
+
["pos.order.line" /* POS_ORDER_LINE */]: "order_lines",
|
|
3980
|
+
["pos.order" /* POS_ORDER */]: "orders",
|
|
3981
|
+
["pos.payment.method" /* POS_PAYMENT_METHOD */]: "payment_methods",
|
|
3982
|
+
["pos.payment" /* POS_PAYMENT */]: "payments",
|
|
3983
|
+
["product.category" /* PRODUCT_CATEGORY */]: "product_categories",
|
|
3984
|
+
["product.product" /* PRODUCT_PRODUCT */]: "products",
|
|
3985
|
+
["restaurant.floor" /* RESTAURANT_FLOOR */]: "restaurant_floors",
|
|
3986
|
+
["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
|
|
3987
|
+
};
|
|
4486
3988
|
var loadDataPosSessionService = (env) => {
|
|
4487
|
-
const
|
|
4488
|
-
const loadDataPosSession = (0,
|
|
3989
|
+
const supabase = useSupabaseOptional();
|
|
3990
|
+
const loadDataPosSession = (0, import_react27.useCallback)(
|
|
4489
3991
|
async ({
|
|
4490
3992
|
model,
|
|
4491
3993
|
ids,
|
|
@@ -4495,10 +3997,6 @@ var loadDataPosSessionService = (env) => {
|
|
|
4495
3997
|
modelsToLoad = [],
|
|
4496
3998
|
searchParams
|
|
4497
3999
|
}) => {
|
|
4498
|
-
if (isLocalMode) {
|
|
4499
|
-
const data = await loadData();
|
|
4500
|
-
return data;
|
|
4501
|
-
}
|
|
4502
4000
|
const jsonData = {
|
|
4503
4001
|
model,
|
|
4504
4002
|
method: "load_data" /* LOAD_DATA */,
|
|
@@ -4525,17 +4023,74 @@ var loadDataPosSessionService = (env) => {
|
|
|
4525
4023
|
service
|
|
4526
4024
|
);
|
|
4527
4025
|
},
|
|
4528
|
-
[env
|
|
4026
|
+
[env]
|
|
4529
4027
|
);
|
|
4028
|
+
const loadDataPosSessionSupabase = (0, import_react27.useCallback)(async () => {
|
|
4029
|
+
try {
|
|
4030
|
+
const allModels = Object.values(LoadDataModel);
|
|
4031
|
+
const promises = allModels.map(async (modelName) => {
|
|
4032
|
+
const tableName = MODEL_TO_TABLE[modelName];
|
|
4033
|
+
if (!tableName) {
|
|
4034
|
+
return {
|
|
4035
|
+
modelName,
|
|
4036
|
+
data: [],
|
|
4037
|
+
fields: {},
|
|
4038
|
+
relations: {}
|
|
4039
|
+
};
|
|
4040
|
+
}
|
|
4041
|
+
if (!supabase) {
|
|
4042
|
+
return {
|
|
4043
|
+
modelName,
|
|
4044
|
+
data: [],
|
|
4045
|
+
fields: {},
|
|
4046
|
+
relations: {}
|
|
4047
|
+
};
|
|
4048
|
+
}
|
|
4049
|
+
const { data, error } = await supabase.from(tableName).select("*");
|
|
4050
|
+
if (error) {
|
|
4051
|
+
console.error(`Error loading ${modelName}:`, error);
|
|
4052
|
+
return {
|
|
4053
|
+
modelName,
|
|
4054
|
+
data: [],
|
|
4055
|
+
fields: {},
|
|
4056
|
+
relations: {}
|
|
4057
|
+
};
|
|
4058
|
+
}
|
|
4059
|
+
return {
|
|
4060
|
+
modelName,
|
|
4061
|
+
data: data || [],
|
|
4062
|
+
fields: {},
|
|
4063
|
+
relations: {}
|
|
4064
|
+
};
|
|
4065
|
+
});
|
|
4066
|
+
const results = await Promise.all(promises);
|
|
4067
|
+
const response = results.reduce(
|
|
4068
|
+
(acc, { modelName, data, fields, relations }) => {
|
|
4069
|
+
acc[modelName] = {
|
|
4070
|
+
data,
|
|
4071
|
+
fields,
|
|
4072
|
+
relations
|
|
4073
|
+
};
|
|
4074
|
+
return acc;
|
|
4075
|
+
},
|
|
4076
|
+
{}
|
|
4077
|
+
);
|
|
4078
|
+
return response;
|
|
4079
|
+
} catch (error) {
|
|
4080
|
+
console.error("Error loading data from Supabase:", error);
|
|
4081
|
+
return {};
|
|
4082
|
+
}
|
|
4083
|
+
}, [supabase]);
|
|
4530
4084
|
return {
|
|
4531
|
-
loadDataPosSession
|
|
4085
|
+
loadDataPosSession,
|
|
4086
|
+
loadDataPosSessionSupabase
|
|
4532
4087
|
};
|
|
4533
4088
|
};
|
|
4534
4089
|
|
|
4535
4090
|
// src/services/pos-service/manage-onchange.ts
|
|
4536
|
-
var
|
|
4091
|
+
var import_react28 = require("react");
|
|
4537
4092
|
var manageOnchangeService = (env) => {
|
|
4538
|
-
const manageOnChange = (0,
|
|
4093
|
+
const manageOnChange = (0, import_react28.useCallback)(
|
|
4539
4094
|
({
|
|
4540
4095
|
model,
|
|
4541
4096
|
ids,
|
|
@@ -4569,9 +4124,9 @@ var manageOnchangeService = (env) => {
|
|
|
4569
4124
|
};
|
|
4570
4125
|
|
|
4571
4126
|
// src/services/pos-service/manage-session.ts
|
|
4572
|
-
var
|
|
4127
|
+
var import_react29 = require("react");
|
|
4573
4128
|
var manageSessionService = (env) => {
|
|
4574
|
-
const manageSession = (0,
|
|
4129
|
+
const manageSession = (0, import_react29.useCallback)(
|
|
4575
4130
|
({
|
|
4576
4131
|
model,
|
|
4577
4132
|
method,
|
|
@@ -4608,9 +4163,9 @@ var manageSessionService = (env) => {
|
|
|
4608
4163
|
};
|
|
4609
4164
|
|
|
4610
4165
|
// src/services/pos-service/process-order.ts
|
|
4611
|
-
var
|
|
4166
|
+
var import_react30 = require("react");
|
|
4612
4167
|
var processOrderService = (env) => {
|
|
4613
|
-
const processOrder = (0,
|
|
4168
|
+
const processOrder = (0, import_react30.useCallback)(
|
|
4614
4169
|
({
|
|
4615
4170
|
orderId,
|
|
4616
4171
|
xNode,
|
|
@@ -4643,9 +4198,9 @@ var processOrderService = (env) => {
|
|
|
4643
4198
|
};
|
|
4644
4199
|
|
|
4645
4200
|
// src/services/pos-service/save-pin-code.ts
|
|
4646
|
-
var
|
|
4201
|
+
var import_react31 = require("react");
|
|
4647
4202
|
var savePinCodeService = (env) => {
|
|
4648
|
-
const savePinCode = (0,
|
|
4203
|
+
const savePinCode = (0, import_react31.useCallback)(
|
|
4649
4204
|
({
|
|
4650
4205
|
serialNumber,
|
|
4651
4206
|
pinCode,
|
|
@@ -4676,9 +4231,9 @@ var savePinCodeService = (env) => {
|
|
|
4676
4231
|
};
|
|
4677
4232
|
|
|
4678
4233
|
// src/services/pos-service/search-journal.ts
|
|
4679
|
-
var
|
|
4234
|
+
var import_react32 = require("react");
|
|
4680
4235
|
var searchJournalService = (env) => {
|
|
4681
|
-
const searchJournal = (0,
|
|
4236
|
+
const searchJournal = (0, import_react32.useCallback)(
|
|
4682
4237
|
({
|
|
4683
4238
|
model,
|
|
4684
4239
|
method,
|
|
@@ -4713,9 +4268,9 @@ var searchJournalService = (env) => {
|
|
|
4713
4268
|
};
|
|
4714
4269
|
|
|
4715
4270
|
// src/services/pos-service/update-closed-session.ts
|
|
4716
|
-
var
|
|
4271
|
+
var import_react33 = require("react");
|
|
4717
4272
|
var updateClosedSessionService = (env) => {
|
|
4718
|
-
const updateClosedSession = (0,
|
|
4273
|
+
const updateClosedSession = (0, import_react33.useCallback)(
|
|
4719
4274
|
({
|
|
4720
4275
|
model,
|
|
4721
4276
|
domain,
|
|
@@ -4748,11 +4303,9 @@ var updateClosedSessionService = (env) => {
|
|
|
4748
4303
|
};
|
|
4749
4304
|
|
|
4750
4305
|
// src/services/pos-service/update-entity.ts
|
|
4751
|
-
var
|
|
4306
|
+
var import_react34 = require("react");
|
|
4752
4307
|
var updateEntityService = (env) => {
|
|
4753
|
-
const
|
|
4754
|
-
const repo = new ModelRepository();
|
|
4755
|
-
const updateEntity = (0, import_react33.useCallback)(
|
|
4308
|
+
const updateEntity = (0, import_react34.useCallback)(
|
|
4756
4309
|
({
|
|
4757
4310
|
model,
|
|
4758
4311
|
domain,
|
|
@@ -4761,15 +4314,6 @@ var updateEntityService = (env) => {
|
|
|
4761
4314
|
xNode,
|
|
4762
4315
|
service
|
|
4763
4316
|
}) => {
|
|
4764
|
-
if (isLocalMode) {
|
|
4765
|
-
const id = extractIdFromDomain(domain);
|
|
4766
|
-
if (!id) return;
|
|
4767
|
-
return repo.updateRecord({
|
|
4768
|
-
update: values,
|
|
4769
|
-
modelName: model,
|
|
4770
|
-
id
|
|
4771
|
-
});
|
|
4772
|
-
}
|
|
4773
4317
|
const jsonData = {
|
|
4774
4318
|
model,
|
|
4775
4319
|
domain,
|
|
@@ -4787,7 +4331,7 @@ var updateEntityService = (env) => {
|
|
|
4787
4331
|
service
|
|
4788
4332
|
);
|
|
4789
4333
|
},
|
|
4790
|
-
[env
|
|
4334
|
+
[env]
|
|
4791
4335
|
);
|
|
4792
4336
|
return {
|
|
4793
4337
|
updateEntity
|
|
@@ -4795,9 +4339,9 @@ var updateEntityService = (env) => {
|
|
|
4795
4339
|
};
|
|
4796
4340
|
|
|
4797
4341
|
// src/services/pos-service/update-order-status.ts
|
|
4798
|
-
var
|
|
4342
|
+
var import_react35 = require("react");
|
|
4799
4343
|
var updateOrderStatusService = (env) => {
|
|
4800
|
-
const updateOrderStatus = (0,
|
|
4344
|
+
const updateOrderStatus = (0, import_react35.useCallback)(
|
|
4801
4345
|
({
|
|
4802
4346
|
orderId,
|
|
4803
4347
|
state,
|
|
@@ -4828,9 +4372,9 @@ var updateOrderStatusService = (env) => {
|
|
|
4828
4372
|
};
|
|
4829
4373
|
|
|
4830
4374
|
// src/services/pos-service/complete-current-stage.ts
|
|
4831
|
-
var
|
|
4375
|
+
var import_react36 = require("react");
|
|
4832
4376
|
var completeCurrentStageService = (env) => {
|
|
4833
|
-
const completeCurrentStage = (0,
|
|
4377
|
+
const completeCurrentStage = (0, import_react36.useCallback)(
|
|
4834
4378
|
({
|
|
4835
4379
|
ids,
|
|
4836
4380
|
withContext,
|
|
@@ -4997,24 +4541,21 @@ var import_react_query111 = require("@tanstack/react-query");
|
|
|
4997
4541
|
// src/hooks/pos/use-update-order-status.ts
|
|
4998
4542
|
var import_react_query112 = require("@tanstack/react-query");
|
|
4999
4543
|
|
|
5000
|
-
// src/hooks/pos/use-init-snapshot.ts
|
|
5001
|
-
var import_react_query113 = require("@tanstack/react-query");
|
|
5002
|
-
|
|
5003
4544
|
// src/hooks/pos/use-complete-current-stage.ts
|
|
5004
|
-
var
|
|
4545
|
+
var import_react_query113 = require("@tanstack/react-query");
|
|
5005
4546
|
|
|
5006
4547
|
// src/provider/service-provider.tsx
|
|
5007
|
-
var
|
|
5008
|
-
var ServiceContext = (0,
|
|
4548
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4549
|
+
var ServiceContext = (0, import_react37.createContext)(null);
|
|
5009
4550
|
|
|
5010
4551
|
// src/provider/meta-provider.tsx
|
|
5011
|
-
var
|
|
5012
|
-
var
|
|
4552
|
+
var import_react38 = require("react");
|
|
4553
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5013
4554
|
|
|
5014
4555
|
// src/services/action-service/index.ts
|
|
5015
4556
|
function useActionService() {
|
|
5016
4557
|
const { env } = useEnv();
|
|
5017
|
-
const loadAction = (0,
|
|
4558
|
+
const loadAction = (0, import_react39.useCallback)(
|
|
5018
4559
|
async ({
|
|
5019
4560
|
idAction,
|
|
5020
4561
|
context,
|
|
@@ -5038,7 +4579,7 @@ function useActionService() {
|
|
|
5038
4579
|
},
|
|
5039
4580
|
[env]
|
|
5040
4581
|
);
|
|
5041
|
-
const callButton = (0,
|
|
4582
|
+
const callButton = (0, import_react39.useCallback)(
|
|
5042
4583
|
async ({
|
|
5043
4584
|
model,
|
|
5044
4585
|
ids = [],
|
|
@@ -5072,7 +4613,7 @@ function useActionService() {
|
|
|
5072
4613
|
},
|
|
5073
4614
|
[env]
|
|
5074
4615
|
);
|
|
5075
|
-
const removeRows = (0,
|
|
4616
|
+
const removeRows = (0, import_react39.useCallback)(
|
|
5076
4617
|
async ({
|
|
5077
4618
|
model,
|
|
5078
4619
|
ids,
|
|
@@ -5098,7 +4639,7 @@ function useActionService() {
|
|
|
5098
4639
|
},
|
|
5099
4640
|
[env]
|
|
5100
4641
|
);
|
|
5101
|
-
const duplicateRecord = (0,
|
|
4642
|
+
const duplicateRecord = (0, import_react39.useCallback)(
|
|
5102
4643
|
async ({
|
|
5103
4644
|
model,
|
|
5104
4645
|
id,
|
|
@@ -5124,7 +4665,7 @@ function useActionService() {
|
|
|
5124
4665
|
},
|
|
5125
4666
|
[env]
|
|
5126
4667
|
);
|
|
5127
|
-
const getPrintReportName = (0,
|
|
4668
|
+
const getPrintReportName = (0, import_react39.useCallback)(
|
|
5128
4669
|
async ({ id }) => {
|
|
5129
4670
|
const jsonData = {
|
|
5130
4671
|
model: "ir.actions.report",
|
|
@@ -5142,7 +4683,7 @@ function useActionService() {
|
|
|
5142
4683
|
},
|
|
5143
4684
|
[env]
|
|
5144
4685
|
);
|
|
5145
|
-
const print = (0,
|
|
4686
|
+
const print = (0, import_react39.useCallback)(
|
|
5146
4687
|
async ({ id, report, db }) => {
|
|
5147
4688
|
const jsonData = {
|
|
5148
4689
|
report,
|
|
@@ -5160,7 +4701,7 @@ function useActionService() {
|
|
|
5160
4701
|
},
|
|
5161
4702
|
[env]
|
|
5162
4703
|
);
|
|
5163
|
-
const runAction = (0,
|
|
4704
|
+
const runAction = (0, import_react39.useCallback)(
|
|
5164
4705
|
async ({
|
|
5165
4706
|
idAction,
|
|
5166
4707
|
context,
|
|
@@ -5187,7 +4728,7 @@ function useActionService() {
|
|
|
5187
4728
|
},
|
|
5188
4729
|
[env]
|
|
5189
4730
|
);
|
|
5190
|
-
const generateSerialNumber = (0,
|
|
4731
|
+
const generateSerialNumber = (0, import_react39.useCallback)(
|
|
5191
4732
|
async ({
|
|
5192
4733
|
kwargs,
|
|
5193
4734
|
context,
|
|
@@ -5225,10 +4766,10 @@ function useActionService() {
|
|
|
5225
4766
|
}
|
|
5226
4767
|
|
|
5227
4768
|
// src/services/auth-service/index.ts
|
|
5228
|
-
var
|
|
4769
|
+
var import_react40 = require("react");
|
|
5229
4770
|
function useAuthService() {
|
|
5230
4771
|
const { env } = useEnv();
|
|
5231
|
-
const login = (0,
|
|
4772
|
+
const login = (0, import_react40.useCallback)(
|
|
5232
4773
|
async (body) => {
|
|
5233
4774
|
const payload = Object.fromEntries(
|
|
5234
4775
|
Object.entries({
|
|
@@ -5253,7 +4794,7 @@ function useAuthService() {
|
|
|
5253
4794
|
},
|
|
5254
4795
|
[env]
|
|
5255
4796
|
);
|
|
5256
|
-
const forgotPassword = (0,
|
|
4797
|
+
const forgotPassword = (0, import_react40.useCallback)(
|
|
5257
4798
|
async (email) => {
|
|
5258
4799
|
const bodyData = {
|
|
5259
4800
|
login: email,
|
|
@@ -5267,7 +4808,7 @@ function useAuthService() {
|
|
|
5267
4808
|
},
|
|
5268
4809
|
[env]
|
|
5269
4810
|
);
|
|
5270
|
-
const forgotPasswordSSO = (0,
|
|
4811
|
+
const forgotPasswordSSO = (0, import_react40.useCallback)(
|
|
5271
4812
|
async ({
|
|
5272
4813
|
email,
|
|
5273
4814
|
with_context,
|
|
@@ -5290,7 +4831,7 @@ function useAuthService() {
|
|
|
5290
4831
|
},
|
|
5291
4832
|
[env]
|
|
5292
4833
|
);
|
|
5293
|
-
const resetPassword = (0,
|
|
4834
|
+
const resetPassword = (0, import_react40.useCallback)(
|
|
5294
4835
|
async (data, token) => {
|
|
5295
4836
|
const bodyData = {
|
|
5296
4837
|
token,
|
|
@@ -5305,7 +4846,7 @@ function useAuthService() {
|
|
|
5305
4846
|
},
|
|
5306
4847
|
[env]
|
|
5307
4848
|
);
|
|
5308
|
-
const resetPasswordSSO = (0,
|
|
4849
|
+
const resetPasswordSSO = (0, import_react40.useCallback)(
|
|
5309
4850
|
async ({
|
|
5310
4851
|
method,
|
|
5311
4852
|
password,
|
|
@@ -5328,7 +4869,7 @@ function useAuthService() {
|
|
|
5328
4869
|
},
|
|
5329
4870
|
[env]
|
|
5330
4871
|
);
|
|
5331
|
-
const updatePassword = (0,
|
|
4872
|
+
const updatePassword = (0, import_react40.useCallback)(
|
|
5332
4873
|
async (data, token) => {
|
|
5333
4874
|
const bodyData = {
|
|
5334
4875
|
token,
|
|
@@ -5343,7 +4884,7 @@ function useAuthService() {
|
|
|
5343
4884
|
},
|
|
5344
4885
|
[env]
|
|
5345
4886
|
);
|
|
5346
|
-
const isValidToken = (0,
|
|
4887
|
+
const isValidToken = (0, import_react40.useCallback)(
|
|
5347
4888
|
async (token) => {
|
|
5348
4889
|
const bodyData = {
|
|
5349
4890
|
token
|
|
@@ -5356,7 +4897,7 @@ function useAuthService() {
|
|
|
5356
4897
|
},
|
|
5357
4898
|
[env]
|
|
5358
4899
|
);
|
|
5359
|
-
const isValidActionToken = (0,
|
|
4900
|
+
const isValidActionToken = (0, import_react40.useCallback)(
|
|
5360
4901
|
async (actionToken) => {
|
|
5361
4902
|
const bodyData = {};
|
|
5362
4903
|
return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
|
|
@@ -5369,7 +4910,7 @@ function useAuthService() {
|
|
|
5369
4910
|
},
|
|
5370
4911
|
[env]
|
|
5371
4912
|
);
|
|
5372
|
-
const loginSocial = (0,
|
|
4913
|
+
const loginSocial = (0, import_react40.useCallback)(
|
|
5373
4914
|
async ({
|
|
5374
4915
|
db,
|
|
5375
4916
|
state,
|
|
@@ -5387,13 +4928,13 @@ function useAuthService() {
|
|
|
5387
4928
|
},
|
|
5388
4929
|
[env]
|
|
5389
4930
|
);
|
|
5390
|
-
const getProviders = (0,
|
|
4931
|
+
const getProviders = (0, import_react40.useCallback)(
|
|
5391
4932
|
async (db) => {
|
|
5392
4933
|
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
5393
4934
|
},
|
|
5394
4935
|
[env]
|
|
5395
4936
|
);
|
|
5396
|
-
const getAccessByCode = (0,
|
|
4937
|
+
const getAccessByCode = (0, import_react40.useCallback)(
|
|
5397
4938
|
async (code) => {
|
|
5398
4939
|
const data = new URLSearchParams();
|
|
5399
4940
|
data.append("code", code);
|
|
@@ -5413,7 +4954,7 @@ function useAuthService() {
|
|
|
5413
4954
|
},
|
|
5414
4955
|
[env]
|
|
5415
4956
|
);
|
|
5416
|
-
const logout = (0,
|
|
4957
|
+
const logout = (0, import_react40.useCallback)(
|
|
5417
4958
|
async (service) => {
|
|
5418
4959
|
return env?.requests?.post(
|
|
5419
4960
|
"/logout" /* LOGOUT */,
|
|
@@ -5430,7 +4971,7 @@ function useAuthService() {
|
|
|
5430
4971
|
},
|
|
5431
4972
|
[env]
|
|
5432
4973
|
);
|
|
5433
|
-
const getTenantMapping = (0,
|
|
4974
|
+
const getTenantMapping = (0, import_react40.useCallback)(
|
|
5434
4975
|
async ({ shortName, service }) => {
|
|
5435
4976
|
const bodyData = {
|
|
5436
4977
|
short_name: shortName
|
|
@@ -5448,7 +4989,7 @@ function useAuthService() {
|
|
|
5448
4989
|
},
|
|
5449
4990
|
[env]
|
|
5450
4991
|
);
|
|
5451
|
-
const getToken = (0,
|
|
4992
|
+
const getToken = (0, import_react40.useCallback)(
|
|
5452
4993
|
async ({
|
|
5453
4994
|
phone,
|
|
5454
4995
|
name,
|
|
@@ -5492,10 +5033,10 @@ function useAuthService() {
|
|
|
5492
5033
|
}
|
|
5493
5034
|
|
|
5494
5035
|
// src/services/company-service/index.ts
|
|
5495
|
-
var
|
|
5036
|
+
var import_react41 = require("react");
|
|
5496
5037
|
function useCompanyService() {
|
|
5497
5038
|
const { env } = useEnv();
|
|
5498
|
-
const getCurrentCompany = (0,
|
|
5039
|
+
const getCurrentCompany = (0, import_react41.useCallback)(
|
|
5499
5040
|
async (service, extraHeaders) => {
|
|
5500
5041
|
return await env.requests.get(
|
|
5501
5042
|
"/company" /* COMPANY_PATH */,
|
|
@@ -5512,7 +5053,7 @@ function useCompanyService() {
|
|
|
5512
5053
|
},
|
|
5513
5054
|
[env]
|
|
5514
5055
|
);
|
|
5515
|
-
const getInfoCompany = (0,
|
|
5056
|
+
const getInfoCompany = (0, import_react41.useCallback)(
|
|
5516
5057
|
async (id, service) => {
|
|
5517
5058
|
const jsonData = {
|
|
5518
5059
|
ids: [id],
|
|
@@ -5548,10 +5089,10 @@ function useCompanyService() {
|
|
|
5548
5089
|
}
|
|
5549
5090
|
|
|
5550
5091
|
// src/services/excel-service/index.ts
|
|
5551
|
-
var
|
|
5092
|
+
var import_react42 = require("react");
|
|
5552
5093
|
function useExcelService() {
|
|
5553
5094
|
const { env } = useEnv();
|
|
5554
|
-
const uploadFileExcel = (0,
|
|
5095
|
+
const uploadFileExcel = (0, import_react42.useCallback)(
|
|
5555
5096
|
async ({
|
|
5556
5097
|
formData,
|
|
5557
5098
|
service,
|
|
@@ -5568,7 +5109,7 @@ function useExcelService() {
|
|
|
5568
5109
|
},
|
|
5569
5110
|
[env]
|
|
5570
5111
|
);
|
|
5571
|
-
const uploadIdFile = (0,
|
|
5112
|
+
const uploadIdFile = (0, import_react42.useCallback)(
|
|
5572
5113
|
async ({
|
|
5573
5114
|
formData,
|
|
5574
5115
|
service,
|
|
@@ -5585,7 +5126,7 @@ function useExcelService() {
|
|
|
5585
5126
|
},
|
|
5586
5127
|
[env]
|
|
5587
5128
|
);
|
|
5588
|
-
const parsePreview = (0,
|
|
5129
|
+
const parsePreview = (0, import_react42.useCallback)(
|
|
5589
5130
|
async ({
|
|
5590
5131
|
id,
|
|
5591
5132
|
selectedSheet,
|
|
@@ -5634,7 +5175,7 @@ function useExcelService() {
|
|
|
5634
5175
|
},
|
|
5635
5176
|
[env]
|
|
5636
5177
|
);
|
|
5637
|
-
const executeImport = (0,
|
|
5178
|
+
const executeImport = (0, import_react42.useCallback)(
|
|
5638
5179
|
async ({
|
|
5639
5180
|
columns,
|
|
5640
5181
|
fields,
|
|
@@ -5668,7 +5209,7 @@ function useExcelService() {
|
|
|
5668
5209
|
},
|
|
5669
5210
|
[env]
|
|
5670
5211
|
);
|
|
5671
|
-
const getFileExcel = (0,
|
|
5212
|
+
const getFileExcel = (0, import_react42.useCallback)(
|
|
5672
5213
|
async ({
|
|
5673
5214
|
model,
|
|
5674
5215
|
service,
|
|
@@ -5692,7 +5233,7 @@ function useExcelService() {
|
|
|
5692
5233
|
},
|
|
5693
5234
|
[env]
|
|
5694
5235
|
);
|
|
5695
|
-
const getFieldExport = (0,
|
|
5236
|
+
const getFieldExport = (0, import_react42.useCallback)(
|
|
5696
5237
|
async ({
|
|
5697
5238
|
ids,
|
|
5698
5239
|
model,
|
|
@@ -5732,7 +5273,7 @@ function useExcelService() {
|
|
|
5732
5273
|
},
|
|
5733
5274
|
[env]
|
|
5734
5275
|
);
|
|
5735
|
-
const exportExcel = (0,
|
|
5276
|
+
const exportExcel = (0, import_react42.useCallback)(
|
|
5736
5277
|
async ({
|
|
5737
5278
|
model,
|
|
5738
5279
|
domain,
|
|
@@ -5780,10 +5321,10 @@ function useExcelService() {
|
|
|
5780
5321
|
}
|
|
5781
5322
|
|
|
5782
5323
|
// src/services/form-service/index.ts
|
|
5783
|
-
var
|
|
5324
|
+
var import_react43 = require("react");
|
|
5784
5325
|
function useFormService() {
|
|
5785
5326
|
const { env } = useEnv();
|
|
5786
|
-
const getComment = (0,
|
|
5327
|
+
const getComment = (0, import_react43.useCallback)(
|
|
5787
5328
|
async ({ data }) => {
|
|
5788
5329
|
const jsonData = {
|
|
5789
5330
|
thread_id: data.thread_id,
|
|
@@ -5801,7 +5342,7 @@ function useFormService() {
|
|
|
5801
5342
|
},
|
|
5802
5343
|
[env]
|
|
5803
5344
|
);
|
|
5804
|
-
const getThreadData = (0,
|
|
5345
|
+
const getThreadData = (0, import_react43.useCallback)(
|
|
5805
5346
|
async ({
|
|
5806
5347
|
data,
|
|
5807
5348
|
xNode,
|
|
@@ -5828,7 +5369,7 @@ function useFormService() {
|
|
|
5828
5369
|
},
|
|
5829
5370
|
[env]
|
|
5830
5371
|
);
|
|
5831
|
-
const getThreadMessages = (0,
|
|
5372
|
+
const getThreadMessages = (0, import_react43.useCallback)(
|
|
5832
5373
|
async ({
|
|
5833
5374
|
data,
|
|
5834
5375
|
xNode,
|
|
@@ -5854,7 +5395,7 @@ function useFormService() {
|
|
|
5854
5395
|
},
|
|
5855
5396
|
[env]
|
|
5856
5397
|
);
|
|
5857
|
-
const sentComment = (0,
|
|
5398
|
+
const sentComment = (0, import_react43.useCallback)(
|
|
5858
5399
|
async ({ data }) => {
|
|
5859
5400
|
const jsonData = {
|
|
5860
5401
|
context: {
|
|
@@ -5882,7 +5423,7 @@ function useFormService() {
|
|
|
5882
5423
|
},
|
|
5883
5424
|
[env]
|
|
5884
5425
|
);
|
|
5885
|
-
const deleteComment = (0,
|
|
5426
|
+
const deleteComment = (0, import_react43.useCallback)(
|
|
5886
5427
|
async ({ data }) => {
|
|
5887
5428
|
const jsonData = {
|
|
5888
5429
|
attachment_ids: [],
|
|
@@ -5898,7 +5439,7 @@ function useFormService() {
|
|
|
5898
5439
|
},
|
|
5899
5440
|
[env]
|
|
5900
5441
|
);
|
|
5901
|
-
const getImage = (0,
|
|
5442
|
+
const getImage = (0, import_react43.useCallback)(
|
|
5902
5443
|
async ({ data }) => {
|
|
5903
5444
|
return env.requests.get(
|
|
5904
5445
|
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
@@ -5911,7 +5452,7 @@ function useFormService() {
|
|
|
5911
5452
|
},
|
|
5912
5453
|
[env]
|
|
5913
5454
|
);
|
|
5914
|
-
const uploadImage = (0,
|
|
5455
|
+
const uploadImage = (0, import_react43.useCallback)(
|
|
5915
5456
|
async ({
|
|
5916
5457
|
formData,
|
|
5917
5458
|
service,
|
|
@@ -5930,7 +5471,7 @@ function useFormService() {
|
|
|
5930
5471
|
},
|
|
5931
5472
|
[env]
|
|
5932
5473
|
);
|
|
5933
|
-
const uploadFile = (0,
|
|
5474
|
+
const uploadFile = (0, import_react43.useCallback)(
|
|
5934
5475
|
async ({
|
|
5935
5476
|
formData,
|
|
5936
5477
|
service,
|
|
@@ -5950,7 +5491,7 @@ function useFormService() {
|
|
|
5950
5491
|
},
|
|
5951
5492
|
[env]
|
|
5952
5493
|
);
|
|
5953
|
-
const getFormView = (0,
|
|
5494
|
+
const getFormView = (0, import_react43.useCallback)(
|
|
5954
5495
|
async ({ data }) => {
|
|
5955
5496
|
const jsonData = {
|
|
5956
5497
|
model: data.model,
|
|
@@ -5966,7 +5507,7 @@ function useFormService() {
|
|
|
5966
5507
|
},
|
|
5967
5508
|
[env]
|
|
5968
5509
|
);
|
|
5969
|
-
const changeStatus = (0,
|
|
5510
|
+
const changeStatus = (0, import_react43.useCallback)(
|
|
5970
5511
|
async ({ data }) => {
|
|
5971
5512
|
const vals = {
|
|
5972
5513
|
[data.name]: data.stage_id
|
|
@@ -5995,7 +5536,7 @@ function useFormService() {
|
|
|
5995
5536
|
},
|
|
5996
5537
|
[env]
|
|
5997
5538
|
);
|
|
5998
|
-
const getExternalTab = (0,
|
|
5539
|
+
const getExternalTab = (0, import_react43.useCallback)(
|
|
5999
5540
|
async ({ method, context, service, xNode }) => {
|
|
6000
5541
|
return env?.requests?.post(
|
|
6001
5542
|
"/call" /* CALL_PATH */,
|
|
@@ -6030,10 +5571,10 @@ function useFormService() {
|
|
|
6030
5571
|
}
|
|
6031
5572
|
|
|
6032
5573
|
// src/services/kanban-service/index.ts
|
|
6033
|
-
var
|
|
5574
|
+
var import_react44 = require("react");
|
|
6034
5575
|
function useKanbanService() {
|
|
6035
5576
|
const { env } = useEnv();
|
|
6036
|
-
const getGroups = (0,
|
|
5577
|
+
const getGroups = (0, import_react44.useCallback)(
|
|
6037
5578
|
async ({ model, width_context }) => {
|
|
6038
5579
|
const jsonData = {
|
|
6039
5580
|
model,
|
|
@@ -6053,7 +5594,7 @@ function useKanbanService() {
|
|
|
6053
5594
|
},
|
|
6054
5595
|
[env]
|
|
6055
5596
|
);
|
|
6056
|
-
const getProgressBar = (0,
|
|
5597
|
+
const getProgressBar = (0, import_react44.useCallback)(
|
|
6057
5598
|
async ({ field, color, model, width_context }) => {
|
|
6058
5599
|
const jsonData = {
|
|
6059
5600
|
model,
|
|
@@ -6083,10 +5624,10 @@ function useKanbanService() {
|
|
|
6083
5624
|
}
|
|
6084
5625
|
|
|
6085
5626
|
// src/services/model-service/index.ts
|
|
6086
|
-
var
|
|
5627
|
+
var import_react45 = require("react");
|
|
6087
5628
|
function useModelService() {
|
|
6088
5629
|
const { env } = useEnv();
|
|
6089
|
-
const getListMyBankAccount = (0,
|
|
5630
|
+
const getListMyBankAccount = (0, import_react45.useCallback)(
|
|
6090
5631
|
async ({
|
|
6091
5632
|
domain,
|
|
6092
5633
|
spectification,
|
|
@@ -6110,7 +5651,7 @@ function useModelService() {
|
|
|
6110
5651
|
},
|
|
6111
5652
|
[env]
|
|
6112
5653
|
);
|
|
6113
|
-
const getCurrency = (0,
|
|
5654
|
+
const getCurrency = (0, import_react45.useCallback)(async () => {
|
|
6114
5655
|
const jsonData = {
|
|
6115
5656
|
model: "res.currency",
|
|
6116
5657
|
method: "web_search_read",
|
|
@@ -6130,7 +5671,7 @@ function useModelService() {
|
|
|
6130
5671
|
}
|
|
6131
5672
|
});
|
|
6132
5673
|
}, [env]);
|
|
6133
|
-
const getConversionRate = (0,
|
|
5674
|
+
const getConversionRate = (0, import_react45.useCallback)(async () => {
|
|
6134
5675
|
const jsonData = {
|
|
6135
5676
|
model: "res.currency",
|
|
6136
5677
|
method: "web_search_read",
|
|
@@ -6156,7 +5697,7 @@ function useModelService() {
|
|
|
6156
5697
|
}
|
|
6157
5698
|
});
|
|
6158
5699
|
}, [env]);
|
|
6159
|
-
const getAll = (0,
|
|
5700
|
+
const getAll = (0, import_react45.useCallback)(
|
|
6160
5701
|
async ({
|
|
6161
5702
|
data,
|
|
6162
5703
|
service,
|
|
@@ -6198,7 +5739,7 @@ function useModelService() {
|
|
|
6198
5739
|
},
|
|
6199
5740
|
[env]
|
|
6200
5741
|
);
|
|
6201
|
-
const getListCalendar = (0,
|
|
5742
|
+
const getListCalendar = (0, import_react45.useCallback)(
|
|
6202
5743
|
async ({ data }) => {
|
|
6203
5744
|
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
6204
5745
|
fields: data.fields,
|
|
@@ -6229,7 +5770,7 @@ function useModelService() {
|
|
|
6229
5770
|
},
|
|
6230
5771
|
[env]
|
|
6231
5772
|
);
|
|
6232
|
-
const getList = (0,
|
|
5773
|
+
const getList = (0, import_react45.useCallback)(
|
|
6233
5774
|
async ({
|
|
6234
5775
|
model,
|
|
6235
5776
|
ids = [],
|
|
@@ -6261,7 +5802,7 @@ function useModelService() {
|
|
|
6261
5802
|
},
|
|
6262
5803
|
[env]
|
|
6263
5804
|
);
|
|
6264
|
-
const getDetail = (0,
|
|
5805
|
+
const getDetail = (0, import_react45.useCallback)(
|
|
6265
5806
|
async ({
|
|
6266
5807
|
ids = [],
|
|
6267
5808
|
model,
|
|
@@ -6293,7 +5834,7 @@ function useModelService() {
|
|
|
6293
5834
|
},
|
|
6294
5835
|
[env]
|
|
6295
5836
|
);
|
|
6296
|
-
const save = (0,
|
|
5837
|
+
const save = (0, import_react45.useCallback)(
|
|
6297
5838
|
async ({
|
|
6298
5839
|
model,
|
|
6299
5840
|
ids = [],
|
|
@@ -6328,7 +5869,7 @@ function useModelService() {
|
|
|
6328
5869
|
},
|
|
6329
5870
|
[env]
|
|
6330
5871
|
);
|
|
6331
|
-
const deleteApi = (0,
|
|
5872
|
+
const deleteApi = (0, import_react45.useCallback)(
|
|
6332
5873
|
async ({ ids = [], model, service }) => {
|
|
6333
5874
|
const jsonData = {
|
|
6334
5875
|
model,
|
|
@@ -6348,7 +5889,7 @@ function useModelService() {
|
|
|
6348
5889
|
},
|
|
6349
5890
|
[env]
|
|
6350
5891
|
);
|
|
6351
|
-
const onChange = (0,
|
|
5892
|
+
const onChange = (0, import_react45.useCallback)(
|
|
6352
5893
|
async ({
|
|
6353
5894
|
ids = [],
|
|
6354
5895
|
model,
|
|
@@ -6384,7 +5925,7 @@ function useModelService() {
|
|
|
6384
5925
|
},
|
|
6385
5926
|
[env]
|
|
6386
5927
|
);
|
|
6387
|
-
const getListFieldsOnchange = (0,
|
|
5928
|
+
const getListFieldsOnchange = (0, import_react45.useCallback)(
|
|
6388
5929
|
async ({
|
|
6389
5930
|
model,
|
|
6390
5931
|
service,
|
|
@@ -6408,7 +5949,7 @@ function useModelService() {
|
|
|
6408
5949
|
},
|
|
6409
5950
|
[env]
|
|
6410
5951
|
);
|
|
6411
|
-
const parseORMOdoo = (0,
|
|
5952
|
+
const parseORMOdoo = (0, import_react45.useCallback)((data) => {
|
|
6412
5953
|
for (const key in data) {
|
|
6413
5954
|
if (key === "display_name") {
|
|
6414
5955
|
delete data[key];
|
|
@@ -6419,7 +5960,7 @@ function useModelService() {
|
|
|
6419
5960
|
}
|
|
6420
5961
|
return { ...data };
|
|
6421
5962
|
}, []);
|
|
6422
|
-
const toDataJS = (0,
|
|
5963
|
+
const toDataJS = (0, import_react45.useCallback)(
|
|
6423
5964
|
(data, viewData, model) => {
|
|
6424
5965
|
for (const key in data) {
|
|
6425
5966
|
if (data[key] === false) {
|
|
@@ -6477,10 +6018,10 @@ function useModelService() {
|
|
|
6477
6018
|
}
|
|
6478
6019
|
|
|
6479
6020
|
// src/services/user-service/index.ts
|
|
6480
|
-
var
|
|
6021
|
+
var import_react46 = require("react");
|
|
6481
6022
|
function useUserService() {
|
|
6482
6023
|
const { env } = useEnv();
|
|
6483
|
-
const getProfile = (0,
|
|
6024
|
+
const getProfile = (0, import_react46.useCallback)(
|
|
6484
6025
|
async (service, path, extraHeaders) => {
|
|
6485
6026
|
return env?.requests?.get(
|
|
6486
6027
|
path || "/userinfo" /* PROFILE_PATH */,
|
|
@@ -6497,7 +6038,7 @@ function useUserService() {
|
|
|
6497
6038
|
},
|
|
6498
6039
|
[env]
|
|
6499
6040
|
);
|
|
6500
|
-
const getUser = (0,
|
|
6041
|
+
const getUser = (0, import_react46.useCallback)(
|
|
6501
6042
|
async ({ context, id }) => {
|
|
6502
6043
|
const jsonData = {
|
|
6503
6044
|
model: "res.users",
|
|
@@ -6535,7 +6076,7 @@ function useUserService() {
|
|
|
6535
6076
|
},
|
|
6536
6077
|
[env]
|
|
6537
6078
|
);
|
|
6538
|
-
const switchUserLocale = (0,
|
|
6079
|
+
const switchUserLocale = (0, import_react46.useCallback)(
|
|
6539
6080
|
async ({ id, values, service }) => {
|
|
6540
6081
|
const jsonData = {
|
|
6541
6082
|
model: "res.users",
|
|
@@ -6563,10 +6104,10 @@ function useUserService() {
|
|
|
6563
6104
|
}
|
|
6564
6105
|
|
|
6565
6106
|
// src/services/view-service/index.ts
|
|
6566
|
-
var
|
|
6107
|
+
var import_react47 = require("react");
|
|
6567
6108
|
function useViewService() {
|
|
6568
6109
|
const { env } = useEnv();
|
|
6569
|
-
const getView = (0,
|
|
6110
|
+
const getView = (0, import_react47.useCallback)(
|
|
6570
6111
|
async ({
|
|
6571
6112
|
model,
|
|
6572
6113
|
views,
|
|
@@ -6606,7 +6147,7 @@ function useViewService() {
|
|
|
6606
6147
|
},
|
|
6607
6148
|
[env]
|
|
6608
6149
|
);
|
|
6609
|
-
const getMenu = (0,
|
|
6150
|
+
const getMenu = (0, import_react47.useCallback)(
|
|
6610
6151
|
async (context, specification, domain, service) => {
|
|
6611
6152
|
const jsonData = {
|
|
6612
6153
|
model: "ir.ui.menu" /* MENU */,
|
|
@@ -6637,7 +6178,7 @@ function useViewService() {
|
|
|
6637
6178
|
},
|
|
6638
6179
|
[env]
|
|
6639
6180
|
);
|
|
6640
|
-
const getActionDetail = (0,
|
|
6181
|
+
const getActionDetail = (0, import_react47.useCallback)(
|
|
6641
6182
|
async (aid, context) => {
|
|
6642
6183
|
const jsonData = {
|
|
6643
6184
|
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
@@ -6667,7 +6208,7 @@ function useViewService() {
|
|
|
6667
6208
|
},
|
|
6668
6209
|
[env]
|
|
6669
6210
|
);
|
|
6670
|
-
const getResequence = (0,
|
|
6211
|
+
const getResequence = (0, import_react47.useCallback)(
|
|
6671
6212
|
async ({
|
|
6672
6213
|
model,
|
|
6673
6214
|
ids,
|
|
@@ -6697,7 +6238,7 @@ function useViewService() {
|
|
|
6697
6238
|
},
|
|
6698
6239
|
[env]
|
|
6699
6240
|
);
|
|
6700
|
-
const getSelectionItem = (0,
|
|
6241
|
+
const getSelectionItem = (0, import_react47.useCallback)(
|
|
6701
6242
|
async ({
|
|
6702
6243
|
data,
|
|
6703
6244
|
service,
|
|
@@ -6734,7 +6275,7 @@ function useViewService() {
|
|
|
6734
6275
|
},
|
|
6735
6276
|
[env]
|
|
6736
6277
|
);
|
|
6737
|
-
const loadMessages = (0,
|
|
6278
|
+
const loadMessages = (0, import_react47.useCallback)(async () => {
|
|
6738
6279
|
return env.requests.post(
|
|
6739
6280
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
6740
6281
|
{},
|
|
@@ -6745,14 +6286,14 @@ function useViewService() {
|
|
|
6745
6286
|
}
|
|
6746
6287
|
);
|
|
6747
6288
|
}, [env]);
|
|
6748
|
-
const getVersion = (0,
|
|
6289
|
+
const getVersion = (0, import_react47.useCallback)(async () => {
|
|
6749
6290
|
return env?.requests?.get("", {
|
|
6750
6291
|
headers: {
|
|
6751
6292
|
"Content-Type": "application/json"
|
|
6752
6293
|
}
|
|
6753
6294
|
});
|
|
6754
6295
|
}, [env]);
|
|
6755
|
-
const grantAccess = (0,
|
|
6296
|
+
const grantAccess = (0, import_react47.useCallback)(
|
|
6756
6297
|
async ({
|
|
6757
6298
|
redirect_uri,
|
|
6758
6299
|
state,
|
|
@@ -6779,7 +6320,7 @@ function useViewService() {
|
|
|
6779
6320
|
},
|
|
6780
6321
|
[env]
|
|
6781
6322
|
);
|
|
6782
|
-
const removeTotpSetUp = (0,
|
|
6323
|
+
const removeTotpSetUp = (0, import_react47.useCallback)(
|
|
6783
6324
|
async ({ method, token }) => {
|
|
6784
6325
|
const jsonData = {
|
|
6785
6326
|
method,
|
|
@@ -6800,7 +6341,7 @@ function useViewService() {
|
|
|
6800
6341
|
},
|
|
6801
6342
|
[env]
|
|
6802
6343
|
);
|
|
6803
|
-
const requestSetupTotp = (0,
|
|
6344
|
+
const requestSetupTotp = (0, import_react47.useCallback)(
|
|
6804
6345
|
async ({ method, token }) => {
|
|
6805
6346
|
const jsonData = {
|
|
6806
6347
|
method,
|
|
@@ -6819,7 +6360,7 @@ function useViewService() {
|
|
|
6819
6360
|
},
|
|
6820
6361
|
[env]
|
|
6821
6362
|
);
|
|
6822
|
-
const settingsWebRead2fa = (0,
|
|
6363
|
+
const settingsWebRead2fa = (0, import_react47.useCallback)(
|
|
6823
6364
|
async ({
|
|
6824
6365
|
method,
|
|
6825
6366
|
model,
|
|
@@ -6847,7 +6388,7 @@ function useViewService() {
|
|
|
6847
6388
|
},
|
|
6848
6389
|
[env]
|
|
6849
6390
|
);
|
|
6850
|
-
const signInSSO = (0,
|
|
6391
|
+
const signInSSO = (0, import_react47.useCallback)(
|
|
6851
6392
|
async ({
|
|
6852
6393
|
redirect_uri,
|
|
6853
6394
|
state,
|
|
@@ -6879,7 +6420,7 @@ function useViewService() {
|
|
|
6879
6420
|
},
|
|
6880
6421
|
[env]
|
|
6881
6422
|
);
|
|
6882
|
-
const verify2FA = (0,
|
|
6423
|
+
const verify2FA = (0, import_react47.useCallback)(
|
|
6883
6424
|
({
|
|
6884
6425
|
method,
|
|
6885
6426
|
with_context,
|
|
@@ -6912,7 +6453,7 @@ function useViewService() {
|
|
|
6912
6453
|
},
|
|
6913
6454
|
[env]
|
|
6914
6455
|
);
|
|
6915
|
-
const get2FAMethods = (0,
|
|
6456
|
+
const get2FAMethods = (0, import_react47.useCallback)(
|
|
6916
6457
|
({ method, with_context }) => {
|
|
6917
6458
|
const jsonData = {
|
|
6918
6459
|
method,
|
|
@@ -6931,7 +6472,7 @@ function useViewService() {
|
|
|
6931
6472
|
},
|
|
6932
6473
|
[env]
|
|
6933
6474
|
);
|
|
6934
|
-
const verifyTotp = (0,
|
|
6475
|
+
const verifyTotp = (0, import_react47.useCallback)(
|
|
6935
6476
|
({
|
|
6936
6477
|
method,
|
|
6937
6478
|
action_token,
|
|
@@ -6956,7 +6497,7 @@ function useViewService() {
|
|
|
6956
6497
|
},
|
|
6957
6498
|
[env]
|
|
6958
6499
|
);
|
|
6959
|
-
const getNotifications = (0,
|
|
6500
|
+
const getNotifications = (0, import_react47.useCallback)(
|
|
6960
6501
|
async ({
|
|
6961
6502
|
service,
|
|
6962
6503
|
xNode,
|
|
@@ -6976,7 +6517,7 @@ function useViewService() {
|
|
|
6976
6517
|
},
|
|
6977
6518
|
[env]
|
|
6978
6519
|
);
|
|
6979
|
-
const getCountry = (0,
|
|
6520
|
+
const getCountry = (0, import_react47.useCallback)(
|
|
6980
6521
|
async ({
|
|
6981
6522
|
service,
|
|
6982
6523
|
xNode,
|
|
@@ -7003,7 +6544,7 @@ function useViewService() {
|
|
|
7003
6544
|
},
|
|
7004
6545
|
[env]
|
|
7005
6546
|
);
|
|
7006
|
-
const getCity = (0,
|
|
6547
|
+
const getCity = (0, import_react47.useCallback)(
|
|
7007
6548
|
async ({
|
|
7008
6549
|
service,
|
|
7009
6550
|
xNode,
|
|
@@ -7030,7 +6571,7 @@ function useViewService() {
|
|
|
7030
6571
|
},
|
|
7031
6572
|
[env]
|
|
7032
6573
|
);
|
|
7033
|
-
const getWard = (0,
|
|
6574
|
+
const getWard = (0, import_react47.useCallback)(
|
|
7034
6575
|
async ({
|
|
7035
6576
|
service,
|
|
7036
6577
|
xNode,
|
|
@@ -7055,7 +6596,7 @@ function useViewService() {
|
|
|
7055
6596
|
},
|
|
7056
6597
|
[env]
|
|
7057
6598
|
);
|
|
7058
|
-
const getPartnerTitle = (0,
|
|
6599
|
+
const getPartnerTitle = (0, import_react47.useCallback)(
|
|
7059
6600
|
async ({
|
|
7060
6601
|
service,
|
|
7061
6602
|
xNode,
|
|
@@ -7107,10 +6648,10 @@ function useViewService() {
|
|
|
7107
6648
|
}
|
|
7108
6649
|
|
|
7109
6650
|
// src/services/dashboard-service/index.ts
|
|
7110
|
-
var
|
|
6651
|
+
var import_react48 = require("react");
|
|
7111
6652
|
function useDashboardService() {
|
|
7112
6653
|
const { env } = useEnv();
|
|
7113
|
-
const readGroup = (0,
|
|
6654
|
+
const readGroup = (0, import_react48.useCallback)(
|
|
7114
6655
|
async ({
|
|
7115
6656
|
service,
|
|
7116
6657
|
xNode,
|
|
@@ -7127,7 +6668,7 @@ function useDashboardService() {
|
|
|
7127
6668
|
},
|
|
7128
6669
|
[env]
|
|
7129
6670
|
);
|
|
7130
|
-
const getDataChart = (0,
|
|
6671
|
+
const getDataChart = (0, import_react48.useCallback)(
|
|
7131
6672
|
async ({
|
|
7132
6673
|
service,
|
|
7133
6674
|
xNode,
|
|
@@ -7161,50 +6702,6 @@ function useDashboardService() {
|
|
|
7161
6702
|
);
|
|
7162
6703
|
return { readGroup, getDataChart };
|
|
7163
6704
|
}
|
|
7164
|
-
|
|
7165
|
-
// src/services/filesystem-service/init-snapshot.ts
|
|
7166
|
-
var isSnapshotReady = async () => {
|
|
7167
|
-
try {
|
|
7168
|
-
const raw = await fileService.read("pos/manifest.json");
|
|
7169
|
-
if (!raw) return false;
|
|
7170
|
-
const manifest = JSON.parse(raw);
|
|
7171
|
-
if (!manifest.models || typeof manifest.models !== "object") {
|
|
7172
|
-
return false;
|
|
7173
|
-
}
|
|
7174
|
-
const modelEntries = Object.values(manifest.models);
|
|
7175
|
-
if (modelEntries.length === 0) return false;
|
|
7176
|
-
const firstModel = modelEntries[0];
|
|
7177
|
-
if (!firstModel.file) return false;
|
|
7178
|
-
const modelExists = await fileService.exists(firstModel.file);
|
|
7179
|
-
return modelExists;
|
|
7180
|
-
} catch {
|
|
7181
|
-
return false;
|
|
7182
|
-
}
|
|
7183
|
-
};
|
|
7184
|
-
async function initSnapshot(onProgress) {
|
|
7185
|
-
const ready = await isSnapshotReady();
|
|
7186
|
-
if (ready) {
|
|
7187
|
-
console.log("skip initialization.");
|
|
7188
|
-
return;
|
|
7189
|
-
}
|
|
7190
|
-
console.log("initializing from data.json...");
|
|
7191
|
-
const jsonData = await fetch("/data.json").then((r) => r.text());
|
|
7192
|
-
if (!jsonData) {
|
|
7193
|
-
console.error("cannot load data.json");
|
|
7194
|
-
return;
|
|
7195
|
-
}
|
|
7196
|
-
await import_snapshot_default({
|
|
7197
|
-
data: jsonData,
|
|
7198
|
-
onProgress
|
|
7199
|
-
});
|
|
7200
|
-
}
|
|
7201
|
-
|
|
7202
|
-
// src/services/filesystem-service/index.ts
|
|
7203
|
-
var useFileSystemService = () => {
|
|
7204
|
-
return {
|
|
7205
|
-
initSnapshot
|
|
7206
|
-
};
|
|
7207
|
-
};
|
|
7208
6705
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7209
6706
|
0 && (module.exports = {
|
|
7210
6707
|
useActionService,
|
|
@@ -7212,7 +6709,6 @@ var useFileSystemService = () => {
|
|
|
7212
6709
|
useCompanyService,
|
|
7213
6710
|
useDashboardService,
|
|
7214
6711
|
useExcelService,
|
|
7215
|
-
useFileSystemService,
|
|
7216
6712
|
useFormService,
|
|
7217
6713
|
useKanbanService,
|
|
7218
6714
|
useModelService,
|