@fctc/interface-logic 4.4.0 → 4.4.1
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 +299 -813
- package/dist/hooks.mjs +145 -658
- package/dist/provider.d.mts +13 -6
- package/dist/provider.d.ts +13 -6
- package/dist/provider.js +215 -711
- package/dist/provider.mjs +176 -674
- package/dist/services.d.mts +8 -8
- package/dist/services.d.ts +8 -8
- package/dist/services.js +260 -766
- package/dist/services.mjs +148 -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,43 @@ 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 useSupabase = () => {
|
|
3968
|
+
const context = (0, import_react26.useContext)(SupabaseContext);
|
|
3969
|
+
if (!context) {
|
|
3970
|
+
throw new Error(
|
|
3971
|
+
"useSupabase must be used within a SupabaseProvider or check your env config"
|
|
3972
|
+
);
|
|
3973
|
+
}
|
|
3974
|
+
return context;
|
|
3975
|
+
};
|
|
3976
|
+
|
|
3977
|
+
// src/services/pos-service/load-data-pos-session.ts
|
|
3978
|
+
var MODEL_TO_TABLE = {
|
|
3979
|
+
["account.tax" /* ACCOUNT_TAX */]: "account_taxes",
|
|
3980
|
+
["res.company" /* RES_COMPANY */]: "companies",
|
|
3981
|
+
["res.partner" /* RES_PARTNER */]: "customers",
|
|
3982
|
+
["res.users" /* RES_USERS */]: "employees",
|
|
3983
|
+
["loyalty.program" /* LOYALTY_PROGRAM */]: "loyalty_programs",
|
|
3984
|
+
["loyalty.rule" /* LOYALTY_RULE */]: "loyalty_rules",
|
|
3985
|
+
["pos.order.line" /* POS_ORDER_LINE */]: "order_lines",
|
|
3986
|
+
["pos.order" /* POS_ORDER */]: "orders",
|
|
3987
|
+
["pos.payment.method" /* POS_PAYMENT_METHOD */]: "payment_methods",
|
|
3988
|
+
["pos.payment" /* POS_PAYMENT */]: "payments",
|
|
3989
|
+
["product.category" /* PRODUCT_CATEGORY */]: "product_categories",
|
|
3990
|
+
["product.product" /* PRODUCT_PRODUCT */]: "products",
|
|
3991
|
+
["restaurant.floor" /* RESTAURANT_FLOOR */]: "restaurant_floors",
|
|
3992
|
+
["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
|
|
3993
|
+
};
|
|
4486
3994
|
var loadDataPosSessionService = (env) => {
|
|
4487
|
-
const
|
|
4488
|
-
const loadDataPosSession = (0,
|
|
3995
|
+
const supabase = useSupabase();
|
|
3996
|
+
const loadDataPosSession = (0, import_react27.useCallback)(
|
|
4489
3997
|
async ({
|
|
4490
3998
|
model,
|
|
4491
3999
|
ids,
|
|
@@ -4495,10 +4003,6 @@ var loadDataPosSessionService = (env) => {
|
|
|
4495
4003
|
modelsToLoad = [],
|
|
4496
4004
|
searchParams
|
|
4497
4005
|
}) => {
|
|
4498
|
-
if (isLocalMode) {
|
|
4499
|
-
const data = await loadData();
|
|
4500
|
-
return data;
|
|
4501
|
-
}
|
|
4502
4006
|
const jsonData = {
|
|
4503
4007
|
model,
|
|
4504
4008
|
method: "load_data" /* LOAD_DATA */,
|
|
@@ -4525,17 +4029,66 @@ var loadDataPosSessionService = (env) => {
|
|
|
4525
4029
|
service
|
|
4526
4030
|
);
|
|
4527
4031
|
},
|
|
4528
|
-
[env
|
|
4032
|
+
[env]
|
|
4529
4033
|
);
|
|
4034
|
+
const loadDataPosSessionSupabase = (0, import_react27.useCallback)(async () => {
|
|
4035
|
+
try {
|
|
4036
|
+
const allModels = Object.values(LoadDataModel);
|
|
4037
|
+
const promises = allModels.map(async (modelName) => {
|
|
4038
|
+
const tableName = MODEL_TO_TABLE[modelName];
|
|
4039
|
+
if (!tableName) {
|
|
4040
|
+
return {
|
|
4041
|
+
modelName,
|
|
4042
|
+
data: [],
|
|
4043
|
+
fields: {},
|
|
4044
|
+
relations: {}
|
|
4045
|
+
};
|
|
4046
|
+
}
|
|
4047
|
+
const { data, error } = await supabase.from(tableName).select("*");
|
|
4048
|
+
if (error) {
|
|
4049
|
+
console.error(`Error loading ${modelName}:`, error);
|
|
4050
|
+
return {
|
|
4051
|
+
modelName,
|
|
4052
|
+
data: [],
|
|
4053
|
+
fields: {},
|
|
4054
|
+
relations: {}
|
|
4055
|
+
};
|
|
4056
|
+
}
|
|
4057
|
+
return {
|
|
4058
|
+
modelName,
|
|
4059
|
+
data: data || [],
|
|
4060
|
+
fields: {},
|
|
4061
|
+
relations: {}
|
|
4062
|
+
};
|
|
4063
|
+
});
|
|
4064
|
+
const results = await Promise.all(promises);
|
|
4065
|
+
const response = results.reduce(
|
|
4066
|
+
(acc, { modelName, data, fields, relations }) => {
|
|
4067
|
+
acc[modelName] = {
|
|
4068
|
+
data,
|
|
4069
|
+
fields,
|
|
4070
|
+
relations
|
|
4071
|
+
};
|
|
4072
|
+
return acc;
|
|
4073
|
+
},
|
|
4074
|
+
{}
|
|
4075
|
+
);
|
|
4076
|
+
return response;
|
|
4077
|
+
} catch (error) {
|
|
4078
|
+
console.error("Error loading data from Supabase:", error);
|
|
4079
|
+
return {};
|
|
4080
|
+
}
|
|
4081
|
+
}, [supabase]);
|
|
4530
4082
|
return {
|
|
4531
|
-
loadDataPosSession
|
|
4083
|
+
loadDataPosSession,
|
|
4084
|
+
loadDataPosSessionSupabase
|
|
4532
4085
|
};
|
|
4533
4086
|
};
|
|
4534
4087
|
|
|
4535
4088
|
// src/services/pos-service/manage-onchange.ts
|
|
4536
|
-
var
|
|
4089
|
+
var import_react28 = require("react");
|
|
4537
4090
|
var manageOnchangeService = (env) => {
|
|
4538
|
-
const manageOnChange = (0,
|
|
4091
|
+
const manageOnChange = (0, import_react28.useCallback)(
|
|
4539
4092
|
({
|
|
4540
4093
|
model,
|
|
4541
4094
|
ids,
|
|
@@ -4569,9 +4122,9 @@ var manageOnchangeService = (env) => {
|
|
|
4569
4122
|
};
|
|
4570
4123
|
|
|
4571
4124
|
// src/services/pos-service/manage-session.ts
|
|
4572
|
-
var
|
|
4125
|
+
var import_react29 = require("react");
|
|
4573
4126
|
var manageSessionService = (env) => {
|
|
4574
|
-
const manageSession = (0,
|
|
4127
|
+
const manageSession = (0, import_react29.useCallback)(
|
|
4575
4128
|
({
|
|
4576
4129
|
model,
|
|
4577
4130
|
method,
|
|
@@ -4608,9 +4161,9 @@ var manageSessionService = (env) => {
|
|
|
4608
4161
|
};
|
|
4609
4162
|
|
|
4610
4163
|
// src/services/pos-service/process-order.ts
|
|
4611
|
-
var
|
|
4164
|
+
var import_react30 = require("react");
|
|
4612
4165
|
var processOrderService = (env) => {
|
|
4613
|
-
const processOrder = (0,
|
|
4166
|
+
const processOrder = (0, import_react30.useCallback)(
|
|
4614
4167
|
({
|
|
4615
4168
|
orderId,
|
|
4616
4169
|
xNode,
|
|
@@ -4643,9 +4196,9 @@ var processOrderService = (env) => {
|
|
|
4643
4196
|
};
|
|
4644
4197
|
|
|
4645
4198
|
// src/services/pos-service/save-pin-code.ts
|
|
4646
|
-
var
|
|
4199
|
+
var import_react31 = require("react");
|
|
4647
4200
|
var savePinCodeService = (env) => {
|
|
4648
|
-
const savePinCode = (0,
|
|
4201
|
+
const savePinCode = (0, import_react31.useCallback)(
|
|
4649
4202
|
({
|
|
4650
4203
|
serialNumber,
|
|
4651
4204
|
pinCode,
|
|
@@ -4676,9 +4229,9 @@ var savePinCodeService = (env) => {
|
|
|
4676
4229
|
};
|
|
4677
4230
|
|
|
4678
4231
|
// src/services/pos-service/search-journal.ts
|
|
4679
|
-
var
|
|
4232
|
+
var import_react32 = require("react");
|
|
4680
4233
|
var searchJournalService = (env) => {
|
|
4681
|
-
const searchJournal = (0,
|
|
4234
|
+
const searchJournal = (0, import_react32.useCallback)(
|
|
4682
4235
|
({
|
|
4683
4236
|
model,
|
|
4684
4237
|
method,
|
|
@@ -4713,9 +4266,9 @@ var searchJournalService = (env) => {
|
|
|
4713
4266
|
};
|
|
4714
4267
|
|
|
4715
4268
|
// src/services/pos-service/update-closed-session.ts
|
|
4716
|
-
var
|
|
4269
|
+
var import_react33 = require("react");
|
|
4717
4270
|
var updateClosedSessionService = (env) => {
|
|
4718
|
-
const updateClosedSession = (0,
|
|
4271
|
+
const updateClosedSession = (0, import_react33.useCallback)(
|
|
4719
4272
|
({
|
|
4720
4273
|
model,
|
|
4721
4274
|
domain,
|
|
@@ -4748,11 +4301,9 @@ var updateClosedSessionService = (env) => {
|
|
|
4748
4301
|
};
|
|
4749
4302
|
|
|
4750
4303
|
// src/services/pos-service/update-entity.ts
|
|
4751
|
-
var
|
|
4304
|
+
var import_react34 = require("react");
|
|
4752
4305
|
var updateEntityService = (env) => {
|
|
4753
|
-
const
|
|
4754
|
-
const repo = new ModelRepository();
|
|
4755
|
-
const updateEntity = (0, import_react33.useCallback)(
|
|
4306
|
+
const updateEntity = (0, import_react34.useCallback)(
|
|
4756
4307
|
({
|
|
4757
4308
|
model,
|
|
4758
4309
|
domain,
|
|
@@ -4761,15 +4312,6 @@ var updateEntityService = (env) => {
|
|
|
4761
4312
|
xNode,
|
|
4762
4313
|
service
|
|
4763
4314
|
}) => {
|
|
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
4315
|
const jsonData = {
|
|
4774
4316
|
model,
|
|
4775
4317
|
domain,
|
|
@@ -4787,7 +4329,7 @@ var updateEntityService = (env) => {
|
|
|
4787
4329
|
service
|
|
4788
4330
|
);
|
|
4789
4331
|
},
|
|
4790
|
-
[env
|
|
4332
|
+
[env]
|
|
4791
4333
|
);
|
|
4792
4334
|
return {
|
|
4793
4335
|
updateEntity
|
|
@@ -4795,9 +4337,9 @@ var updateEntityService = (env) => {
|
|
|
4795
4337
|
};
|
|
4796
4338
|
|
|
4797
4339
|
// src/services/pos-service/update-order-status.ts
|
|
4798
|
-
var
|
|
4340
|
+
var import_react35 = require("react");
|
|
4799
4341
|
var updateOrderStatusService = (env) => {
|
|
4800
|
-
const updateOrderStatus = (0,
|
|
4342
|
+
const updateOrderStatus = (0, import_react35.useCallback)(
|
|
4801
4343
|
({
|
|
4802
4344
|
orderId,
|
|
4803
4345
|
state,
|
|
@@ -4828,9 +4370,9 @@ var updateOrderStatusService = (env) => {
|
|
|
4828
4370
|
};
|
|
4829
4371
|
|
|
4830
4372
|
// src/services/pos-service/complete-current-stage.ts
|
|
4831
|
-
var
|
|
4373
|
+
var import_react36 = require("react");
|
|
4832
4374
|
var completeCurrentStageService = (env) => {
|
|
4833
|
-
const completeCurrentStage = (0,
|
|
4375
|
+
const completeCurrentStage = (0, import_react36.useCallback)(
|
|
4834
4376
|
({
|
|
4835
4377
|
ids,
|
|
4836
4378
|
withContext,
|
|
@@ -4997,24 +4539,21 @@ var import_react_query111 = require("@tanstack/react-query");
|
|
|
4997
4539
|
// src/hooks/pos/use-update-order-status.ts
|
|
4998
4540
|
var import_react_query112 = require("@tanstack/react-query");
|
|
4999
4541
|
|
|
5000
|
-
// src/hooks/pos/use-init-snapshot.ts
|
|
5001
|
-
var import_react_query113 = require("@tanstack/react-query");
|
|
5002
|
-
|
|
5003
4542
|
// src/hooks/pos/use-complete-current-stage.ts
|
|
5004
|
-
var
|
|
4543
|
+
var import_react_query113 = require("@tanstack/react-query");
|
|
5005
4544
|
|
|
5006
4545
|
// src/provider/service-provider.tsx
|
|
5007
|
-
var
|
|
5008
|
-
var ServiceContext = (0,
|
|
4546
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4547
|
+
var ServiceContext = (0, import_react37.createContext)(null);
|
|
5009
4548
|
|
|
5010
4549
|
// src/provider/meta-provider.tsx
|
|
5011
|
-
var
|
|
5012
|
-
var
|
|
4550
|
+
var import_react38 = require("react");
|
|
4551
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5013
4552
|
|
|
5014
4553
|
// src/services/action-service/index.ts
|
|
5015
4554
|
function useActionService() {
|
|
5016
4555
|
const { env } = useEnv();
|
|
5017
|
-
const loadAction = (0,
|
|
4556
|
+
const loadAction = (0, import_react39.useCallback)(
|
|
5018
4557
|
async ({
|
|
5019
4558
|
idAction,
|
|
5020
4559
|
context,
|
|
@@ -5038,7 +4577,7 @@ function useActionService() {
|
|
|
5038
4577
|
},
|
|
5039
4578
|
[env]
|
|
5040
4579
|
);
|
|
5041
|
-
const callButton = (0,
|
|
4580
|
+
const callButton = (0, import_react39.useCallback)(
|
|
5042
4581
|
async ({
|
|
5043
4582
|
model,
|
|
5044
4583
|
ids = [],
|
|
@@ -5072,7 +4611,7 @@ function useActionService() {
|
|
|
5072
4611
|
},
|
|
5073
4612
|
[env]
|
|
5074
4613
|
);
|
|
5075
|
-
const removeRows = (0,
|
|
4614
|
+
const removeRows = (0, import_react39.useCallback)(
|
|
5076
4615
|
async ({
|
|
5077
4616
|
model,
|
|
5078
4617
|
ids,
|
|
@@ -5098,7 +4637,7 @@ function useActionService() {
|
|
|
5098
4637
|
},
|
|
5099
4638
|
[env]
|
|
5100
4639
|
);
|
|
5101
|
-
const duplicateRecord = (0,
|
|
4640
|
+
const duplicateRecord = (0, import_react39.useCallback)(
|
|
5102
4641
|
async ({
|
|
5103
4642
|
model,
|
|
5104
4643
|
id,
|
|
@@ -5124,7 +4663,7 @@ function useActionService() {
|
|
|
5124
4663
|
},
|
|
5125
4664
|
[env]
|
|
5126
4665
|
);
|
|
5127
|
-
const getPrintReportName = (0,
|
|
4666
|
+
const getPrintReportName = (0, import_react39.useCallback)(
|
|
5128
4667
|
async ({ id }) => {
|
|
5129
4668
|
const jsonData = {
|
|
5130
4669
|
model: "ir.actions.report",
|
|
@@ -5142,7 +4681,7 @@ function useActionService() {
|
|
|
5142
4681
|
},
|
|
5143
4682
|
[env]
|
|
5144
4683
|
);
|
|
5145
|
-
const print = (0,
|
|
4684
|
+
const print = (0, import_react39.useCallback)(
|
|
5146
4685
|
async ({ id, report, db }) => {
|
|
5147
4686
|
const jsonData = {
|
|
5148
4687
|
report,
|
|
@@ -5160,7 +4699,7 @@ function useActionService() {
|
|
|
5160
4699
|
},
|
|
5161
4700
|
[env]
|
|
5162
4701
|
);
|
|
5163
|
-
const runAction = (0,
|
|
4702
|
+
const runAction = (0, import_react39.useCallback)(
|
|
5164
4703
|
async ({
|
|
5165
4704
|
idAction,
|
|
5166
4705
|
context,
|
|
@@ -5187,7 +4726,7 @@ function useActionService() {
|
|
|
5187
4726
|
},
|
|
5188
4727
|
[env]
|
|
5189
4728
|
);
|
|
5190
|
-
const generateSerialNumber = (0,
|
|
4729
|
+
const generateSerialNumber = (0, import_react39.useCallback)(
|
|
5191
4730
|
async ({
|
|
5192
4731
|
kwargs,
|
|
5193
4732
|
context,
|
|
@@ -5225,10 +4764,10 @@ function useActionService() {
|
|
|
5225
4764
|
}
|
|
5226
4765
|
|
|
5227
4766
|
// src/services/auth-service/index.ts
|
|
5228
|
-
var
|
|
4767
|
+
var import_react40 = require("react");
|
|
5229
4768
|
function useAuthService() {
|
|
5230
4769
|
const { env } = useEnv();
|
|
5231
|
-
const login = (0,
|
|
4770
|
+
const login = (0, import_react40.useCallback)(
|
|
5232
4771
|
async (body) => {
|
|
5233
4772
|
const payload = Object.fromEntries(
|
|
5234
4773
|
Object.entries({
|
|
@@ -5253,7 +4792,7 @@ function useAuthService() {
|
|
|
5253
4792
|
},
|
|
5254
4793
|
[env]
|
|
5255
4794
|
);
|
|
5256
|
-
const forgotPassword = (0,
|
|
4795
|
+
const forgotPassword = (0, import_react40.useCallback)(
|
|
5257
4796
|
async (email) => {
|
|
5258
4797
|
const bodyData = {
|
|
5259
4798
|
login: email,
|
|
@@ -5267,7 +4806,7 @@ function useAuthService() {
|
|
|
5267
4806
|
},
|
|
5268
4807
|
[env]
|
|
5269
4808
|
);
|
|
5270
|
-
const forgotPasswordSSO = (0,
|
|
4809
|
+
const forgotPasswordSSO = (0, import_react40.useCallback)(
|
|
5271
4810
|
async ({
|
|
5272
4811
|
email,
|
|
5273
4812
|
with_context,
|
|
@@ -5290,7 +4829,7 @@ function useAuthService() {
|
|
|
5290
4829
|
},
|
|
5291
4830
|
[env]
|
|
5292
4831
|
);
|
|
5293
|
-
const resetPassword = (0,
|
|
4832
|
+
const resetPassword = (0, import_react40.useCallback)(
|
|
5294
4833
|
async (data, token) => {
|
|
5295
4834
|
const bodyData = {
|
|
5296
4835
|
token,
|
|
@@ -5305,7 +4844,7 @@ function useAuthService() {
|
|
|
5305
4844
|
},
|
|
5306
4845
|
[env]
|
|
5307
4846
|
);
|
|
5308
|
-
const resetPasswordSSO = (0,
|
|
4847
|
+
const resetPasswordSSO = (0, import_react40.useCallback)(
|
|
5309
4848
|
async ({
|
|
5310
4849
|
method,
|
|
5311
4850
|
password,
|
|
@@ -5328,7 +4867,7 @@ function useAuthService() {
|
|
|
5328
4867
|
},
|
|
5329
4868
|
[env]
|
|
5330
4869
|
);
|
|
5331
|
-
const updatePassword = (0,
|
|
4870
|
+
const updatePassword = (0, import_react40.useCallback)(
|
|
5332
4871
|
async (data, token) => {
|
|
5333
4872
|
const bodyData = {
|
|
5334
4873
|
token,
|
|
@@ -5343,7 +4882,7 @@ function useAuthService() {
|
|
|
5343
4882
|
},
|
|
5344
4883
|
[env]
|
|
5345
4884
|
);
|
|
5346
|
-
const isValidToken = (0,
|
|
4885
|
+
const isValidToken = (0, import_react40.useCallback)(
|
|
5347
4886
|
async (token) => {
|
|
5348
4887
|
const bodyData = {
|
|
5349
4888
|
token
|
|
@@ -5356,7 +4895,7 @@ function useAuthService() {
|
|
|
5356
4895
|
},
|
|
5357
4896
|
[env]
|
|
5358
4897
|
);
|
|
5359
|
-
const isValidActionToken = (0,
|
|
4898
|
+
const isValidActionToken = (0, import_react40.useCallback)(
|
|
5360
4899
|
async (actionToken) => {
|
|
5361
4900
|
const bodyData = {};
|
|
5362
4901
|
return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
|
|
@@ -5369,7 +4908,7 @@ function useAuthService() {
|
|
|
5369
4908
|
},
|
|
5370
4909
|
[env]
|
|
5371
4910
|
);
|
|
5372
|
-
const loginSocial = (0,
|
|
4911
|
+
const loginSocial = (0, import_react40.useCallback)(
|
|
5373
4912
|
async ({
|
|
5374
4913
|
db,
|
|
5375
4914
|
state,
|
|
@@ -5387,13 +4926,13 @@ function useAuthService() {
|
|
|
5387
4926
|
},
|
|
5388
4927
|
[env]
|
|
5389
4928
|
);
|
|
5390
|
-
const getProviders = (0,
|
|
4929
|
+
const getProviders = (0, import_react40.useCallback)(
|
|
5391
4930
|
async (db) => {
|
|
5392
4931
|
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
5393
4932
|
},
|
|
5394
4933
|
[env]
|
|
5395
4934
|
);
|
|
5396
|
-
const getAccessByCode = (0,
|
|
4935
|
+
const getAccessByCode = (0, import_react40.useCallback)(
|
|
5397
4936
|
async (code) => {
|
|
5398
4937
|
const data = new URLSearchParams();
|
|
5399
4938
|
data.append("code", code);
|
|
@@ -5413,7 +4952,7 @@ function useAuthService() {
|
|
|
5413
4952
|
},
|
|
5414
4953
|
[env]
|
|
5415
4954
|
);
|
|
5416
|
-
const logout = (0,
|
|
4955
|
+
const logout = (0, import_react40.useCallback)(
|
|
5417
4956
|
async (service) => {
|
|
5418
4957
|
return env?.requests?.post(
|
|
5419
4958
|
"/logout" /* LOGOUT */,
|
|
@@ -5430,7 +4969,7 @@ function useAuthService() {
|
|
|
5430
4969
|
},
|
|
5431
4970
|
[env]
|
|
5432
4971
|
);
|
|
5433
|
-
const getTenantMapping = (0,
|
|
4972
|
+
const getTenantMapping = (0, import_react40.useCallback)(
|
|
5434
4973
|
async ({ shortName, service }) => {
|
|
5435
4974
|
const bodyData = {
|
|
5436
4975
|
short_name: shortName
|
|
@@ -5448,7 +4987,7 @@ function useAuthService() {
|
|
|
5448
4987
|
},
|
|
5449
4988
|
[env]
|
|
5450
4989
|
);
|
|
5451
|
-
const getToken = (0,
|
|
4990
|
+
const getToken = (0, import_react40.useCallback)(
|
|
5452
4991
|
async ({
|
|
5453
4992
|
phone,
|
|
5454
4993
|
name,
|
|
@@ -5492,10 +5031,10 @@ function useAuthService() {
|
|
|
5492
5031
|
}
|
|
5493
5032
|
|
|
5494
5033
|
// src/services/company-service/index.ts
|
|
5495
|
-
var
|
|
5034
|
+
var import_react41 = require("react");
|
|
5496
5035
|
function useCompanyService() {
|
|
5497
5036
|
const { env } = useEnv();
|
|
5498
|
-
const getCurrentCompany = (0,
|
|
5037
|
+
const getCurrentCompany = (0, import_react41.useCallback)(
|
|
5499
5038
|
async (service, extraHeaders) => {
|
|
5500
5039
|
return await env.requests.get(
|
|
5501
5040
|
"/company" /* COMPANY_PATH */,
|
|
@@ -5512,7 +5051,7 @@ function useCompanyService() {
|
|
|
5512
5051
|
},
|
|
5513
5052
|
[env]
|
|
5514
5053
|
);
|
|
5515
|
-
const getInfoCompany = (0,
|
|
5054
|
+
const getInfoCompany = (0, import_react41.useCallback)(
|
|
5516
5055
|
async (id, service) => {
|
|
5517
5056
|
const jsonData = {
|
|
5518
5057
|
ids: [id],
|
|
@@ -5548,10 +5087,10 @@ function useCompanyService() {
|
|
|
5548
5087
|
}
|
|
5549
5088
|
|
|
5550
5089
|
// src/services/excel-service/index.ts
|
|
5551
|
-
var
|
|
5090
|
+
var import_react42 = require("react");
|
|
5552
5091
|
function useExcelService() {
|
|
5553
5092
|
const { env } = useEnv();
|
|
5554
|
-
const uploadFileExcel = (0,
|
|
5093
|
+
const uploadFileExcel = (0, import_react42.useCallback)(
|
|
5555
5094
|
async ({
|
|
5556
5095
|
formData,
|
|
5557
5096
|
service,
|
|
@@ -5568,7 +5107,7 @@ function useExcelService() {
|
|
|
5568
5107
|
},
|
|
5569
5108
|
[env]
|
|
5570
5109
|
);
|
|
5571
|
-
const uploadIdFile = (0,
|
|
5110
|
+
const uploadIdFile = (0, import_react42.useCallback)(
|
|
5572
5111
|
async ({
|
|
5573
5112
|
formData,
|
|
5574
5113
|
service,
|
|
@@ -5585,7 +5124,7 @@ function useExcelService() {
|
|
|
5585
5124
|
},
|
|
5586
5125
|
[env]
|
|
5587
5126
|
);
|
|
5588
|
-
const parsePreview = (0,
|
|
5127
|
+
const parsePreview = (0, import_react42.useCallback)(
|
|
5589
5128
|
async ({
|
|
5590
5129
|
id,
|
|
5591
5130
|
selectedSheet,
|
|
@@ -5634,7 +5173,7 @@ function useExcelService() {
|
|
|
5634
5173
|
},
|
|
5635
5174
|
[env]
|
|
5636
5175
|
);
|
|
5637
|
-
const executeImport = (0,
|
|
5176
|
+
const executeImport = (0, import_react42.useCallback)(
|
|
5638
5177
|
async ({
|
|
5639
5178
|
columns,
|
|
5640
5179
|
fields,
|
|
@@ -5668,7 +5207,7 @@ function useExcelService() {
|
|
|
5668
5207
|
},
|
|
5669
5208
|
[env]
|
|
5670
5209
|
);
|
|
5671
|
-
const getFileExcel = (0,
|
|
5210
|
+
const getFileExcel = (0, import_react42.useCallback)(
|
|
5672
5211
|
async ({
|
|
5673
5212
|
model,
|
|
5674
5213
|
service,
|
|
@@ -5692,7 +5231,7 @@ function useExcelService() {
|
|
|
5692
5231
|
},
|
|
5693
5232
|
[env]
|
|
5694
5233
|
);
|
|
5695
|
-
const getFieldExport = (0,
|
|
5234
|
+
const getFieldExport = (0, import_react42.useCallback)(
|
|
5696
5235
|
async ({
|
|
5697
5236
|
ids,
|
|
5698
5237
|
model,
|
|
@@ -5732,7 +5271,7 @@ function useExcelService() {
|
|
|
5732
5271
|
},
|
|
5733
5272
|
[env]
|
|
5734
5273
|
);
|
|
5735
|
-
const exportExcel = (0,
|
|
5274
|
+
const exportExcel = (0, import_react42.useCallback)(
|
|
5736
5275
|
async ({
|
|
5737
5276
|
model,
|
|
5738
5277
|
domain,
|
|
@@ -5780,10 +5319,10 @@ function useExcelService() {
|
|
|
5780
5319
|
}
|
|
5781
5320
|
|
|
5782
5321
|
// src/services/form-service/index.ts
|
|
5783
|
-
var
|
|
5322
|
+
var import_react43 = require("react");
|
|
5784
5323
|
function useFormService() {
|
|
5785
5324
|
const { env } = useEnv();
|
|
5786
|
-
const getComment = (0,
|
|
5325
|
+
const getComment = (0, import_react43.useCallback)(
|
|
5787
5326
|
async ({ data }) => {
|
|
5788
5327
|
const jsonData = {
|
|
5789
5328
|
thread_id: data.thread_id,
|
|
@@ -5801,7 +5340,7 @@ function useFormService() {
|
|
|
5801
5340
|
},
|
|
5802
5341
|
[env]
|
|
5803
5342
|
);
|
|
5804
|
-
const getThreadData = (0,
|
|
5343
|
+
const getThreadData = (0, import_react43.useCallback)(
|
|
5805
5344
|
async ({
|
|
5806
5345
|
data,
|
|
5807
5346
|
xNode,
|
|
@@ -5828,7 +5367,7 @@ function useFormService() {
|
|
|
5828
5367
|
},
|
|
5829
5368
|
[env]
|
|
5830
5369
|
);
|
|
5831
|
-
const getThreadMessages = (0,
|
|
5370
|
+
const getThreadMessages = (0, import_react43.useCallback)(
|
|
5832
5371
|
async ({
|
|
5833
5372
|
data,
|
|
5834
5373
|
xNode,
|
|
@@ -5854,7 +5393,7 @@ function useFormService() {
|
|
|
5854
5393
|
},
|
|
5855
5394
|
[env]
|
|
5856
5395
|
);
|
|
5857
|
-
const sentComment = (0,
|
|
5396
|
+
const sentComment = (0, import_react43.useCallback)(
|
|
5858
5397
|
async ({ data }) => {
|
|
5859
5398
|
const jsonData = {
|
|
5860
5399
|
context: {
|
|
@@ -5882,7 +5421,7 @@ function useFormService() {
|
|
|
5882
5421
|
},
|
|
5883
5422
|
[env]
|
|
5884
5423
|
);
|
|
5885
|
-
const deleteComment = (0,
|
|
5424
|
+
const deleteComment = (0, import_react43.useCallback)(
|
|
5886
5425
|
async ({ data }) => {
|
|
5887
5426
|
const jsonData = {
|
|
5888
5427
|
attachment_ids: [],
|
|
@@ -5898,7 +5437,7 @@ function useFormService() {
|
|
|
5898
5437
|
},
|
|
5899
5438
|
[env]
|
|
5900
5439
|
);
|
|
5901
|
-
const getImage = (0,
|
|
5440
|
+
const getImage = (0, import_react43.useCallback)(
|
|
5902
5441
|
async ({ data }) => {
|
|
5903
5442
|
return env.requests.get(
|
|
5904
5443
|
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
@@ -5911,7 +5450,7 @@ function useFormService() {
|
|
|
5911
5450
|
},
|
|
5912
5451
|
[env]
|
|
5913
5452
|
);
|
|
5914
|
-
const uploadImage = (0,
|
|
5453
|
+
const uploadImage = (0, import_react43.useCallback)(
|
|
5915
5454
|
async ({
|
|
5916
5455
|
formData,
|
|
5917
5456
|
service,
|
|
@@ -5930,7 +5469,7 @@ function useFormService() {
|
|
|
5930
5469
|
},
|
|
5931
5470
|
[env]
|
|
5932
5471
|
);
|
|
5933
|
-
const uploadFile = (0,
|
|
5472
|
+
const uploadFile = (0, import_react43.useCallback)(
|
|
5934
5473
|
async ({
|
|
5935
5474
|
formData,
|
|
5936
5475
|
service,
|
|
@@ -5950,7 +5489,7 @@ function useFormService() {
|
|
|
5950
5489
|
},
|
|
5951
5490
|
[env]
|
|
5952
5491
|
);
|
|
5953
|
-
const getFormView = (0,
|
|
5492
|
+
const getFormView = (0, import_react43.useCallback)(
|
|
5954
5493
|
async ({ data }) => {
|
|
5955
5494
|
const jsonData = {
|
|
5956
5495
|
model: data.model,
|
|
@@ -5966,7 +5505,7 @@ function useFormService() {
|
|
|
5966
5505
|
},
|
|
5967
5506
|
[env]
|
|
5968
5507
|
);
|
|
5969
|
-
const changeStatus = (0,
|
|
5508
|
+
const changeStatus = (0, import_react43.useCallback)(
|
|
5970
5509
|
async ({ data }) => {
|
|
5971
5510
|
const vals = {
|
|
5972
5511
|
[data.name]: data.stage_id
|
|
@@ -5995,7 +5534,7 @@ function useFormService() {
|
|
|
5995
5534
|
},
|
|
5996
5535
|
[env]
|
|
5997
5536
|
);
|
|
5998
|
-
const getExternalTab = (0,
|
|
5537
|
+
const getExternalTab = (0, import_react43.useCallback)(
|
|
5999
5538
|
async ({ method, context, service, xNode }) => {
|
|
6000
5539
|
return env?.requests?.post(
|
|
6001
5540
|
"/call" /* CALL_PATH */,
|
|
@@ -6030,10 +5569,10 @@ function useFormService() {
|
|
|
6030
5569
|
}
|
|
6031
5570
|
|
|
6032
5571
|
// src/services/kanban-service/index.ts
|
|
6033
|
-
var
|
|
5572
|
+
var import_react44 = require("react");
|
|
6034
5573
|
function useKanbanService() {
|
|
6035
5574
|
const { env } = useEnv();
|
|
6036
|
-
const getGroups = (0,
|
|
5575
|
+
const getGroups = (0, import_react44.useCallback)(
|
|
6037
5576
|
async ({ model, width_context }) => {
|
|
6038
5577
|
const jsonData = {
|
|
6039
5578
|
model,
|
|
@@ -6053,7 +5592,7 @@ function useKanbanService() {
|
|
|
6053
5592
|
},
|
|
6054
5593
|
[env]
|
|
6055
5594
|
);
|
|
6056
|
-
const getProgressBar = (0,
|
|
5595
|
+
const getProgressBar = (0, import_react44.useCallback)(
|
|
6057
5596
|
async ({ field, color, model, width_context }) => {
|
|
6058
5597
|
const jsonData = {
|
|
6059
5598
|
model,
|
|
@@ -6083,10 +5622,10 @@ function useKanbanService() {
|
|
|
6083
5622
|
}
|
|
6084
5623
|
|
|
6085
5624
|
// src/services/model-service/index.ts
|
|
6086
|
-
var
|
|
5625
|
+
var import_react45 = require("react");
|
|
6087
5626
|
function useModelService() {
|
|
6088
5627
|
const { env } = useEnv();
|
|
6089
|
-
const getListMyBankAccount = (0,
|
|
5628
|
+
const getListMyBankAccount = (0, import_react45.useCallback)(
|
|
6090
5629
|
async ({
|
|
6091
5630
|
domain,
|
|
6092
5631
|
spectification,
|
|
@@ -6110,7 +5649,7 @@ function useModelService() {
|
|
|
6110
5649
|
},
|
|
6111
5650
|
[env]
|
|
6112
5651
|
);
|
|
6113
|
-
const getCurrency = (0,
|
|
5652
|
+
const getCurrency = (0, import_react45.useCallback)(async () => {
|
|
6114
5653
|
const jsonData = {
|
|
6115
5654
|
model: "res.currency",
|
|
6116
5655
|
method: "web_search_read",
|
|
@@ -6130,7 +5669,7 @@ function useModelService() {
|
|
|
6130
5669
|
}
|
|
6131
5670
|
});
|
|
6132
5671
|
}, [env]);
|
|
6133
|
-
const getConversionRate = (0,
|
|
5672
|
+
const getConversionRate = (0, import_react45.useCallback)(async () => {
|
|
6134
5673
|
const jsonData = {
|
|
6135
5674
|
model: "res.currency",
|
|
6136
5675
|
method: "web_search_read",
|
|
@@ -6156,7 +5695,7 @@ function useModelService() {
|
|
|
6156
5695
|
}
|
|
6157
5696
|
});
|
|
6158
5697
|
}, [env]);
|
|
6159
|
-
const getAll = (0,
|
|
5698
|
+
const getAll = (0, import_react45.useCallback)(
|
|
6160
5699
|
async ({
|
|
6161
5700
|
data,
|
|
6162
5701
|
service,
|
|
@@ -6198,7 +5737,7 @@ function useModelService() {
|
|
|
6198
5737
|
},
|
|
6199
5738
|
[env]
|
|
6200
5739
|
);
|
|
6201
|
-
const getListCalendar = (0,
|
|
5740
|
+
const getListCalendar = (0, import_react45.useCallback)(
|
|
6202
5741
|
async ({ data }) => {
|
|
6203
5742
|
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
6204
5743
|
fields: data.fields,
|
|
@@ -6229,7 +5768,7 @@ function useModelService() {
|
|
|
6229
5768
|
},
|
|
6230
5769
|
[env]
|
|
6231
5770
|
);
|
|
6232
|
-
const getList = (0,
|
|
5771
|
+
const getList = (0, import_react45.useCallback)(
|
|
6233
5772
|
async ({
|
|
6234
5773
|
model,
|
|
6235
5774
|
ids = [],
|
|
@@ -6261,7 +5800,7 @@ function useModelService() {
|
|
|
6261
5800
|
},
|
|
6262
5801
|
[env]
|
|
6263
5802
|
);
|
|
6264
|
-
const getDetail = (0,
|
|
5803
|
+
const getDetail = (0, import_react45.useCallback)(
|
|
6265
5804
|
async ({
|
|
6266
5805
|
ids = [],
|
|
6267
5806
|
model,
|
|
@@ -6293,7 +5832,7 @@ function useModelService() {
|
|
|
6293
5832
|
},
|
|
6294
5833
|
[env]
|
|
6295
5834
|
);
|
|
6296
|
-
const save = (0,
|
|
5835
|
+
const save = (0, import_react45.useCallback)(
|
|
6297
5836
|
async ({
|
|
6298
5837
|
model,
|
|
6299
5838
|
ids = [],
|
|
@@ -6328,7 +5867,7 @@ function useModelService() {
|
|
|
6328
5867
|
},
|
|
6329
5868
|
[env]
|
|
6330
5869
|
);
|
|
6331
|
-
const deleteApi = (0,
|
|
5870
|
+
const deleteApi = (0, import_react45.useCallback)(
|
|
6332
5871
|
async ({ ids = [], model, service }) => {
|
|
6333
5872
|
const jsonData = {
|
|
6334
5873
|
model,
|
|
@@ -6348,7 +5887,7 @@ function useModelService() {
|
|
|
6348
5887
|
},
|
|
6349
5888
|
[env]
|
|
6350
5889
|
);
|
|
6351
|
-
const onChange = (0,
|
|
5890
|
+
const onChange = (0, import_react45.useCallback)(
|
|
6352
5891
|
async ({
|
|
6353
5892
|
ids = [],
|
|
6354
5893
|
model,
|
|
@@ -6384,7 +5923,7 @@ function useModelService() {
|
|
|
6384
5923
|
},
|
|
6385
5924
|
[env]
|
|
6386
5925
|
);
|
|
6387
|
-
const getListFieldsOnchange = (0,
|
|
5926
|
+
const getListFieldsOnchange = (0, import_react45.useCallback)(
|
|
6388
5927
|
async ({
|
|
6389
5928
|
model,
|
|
6390
5929
|
service,
|
|
@@ -6408,7 +5947,7 @@ function useModelService() {
|
|
|
6408
5947
|
},
|
|
6409
5948
|
[env]
|
|
6410
5949
|
);
|
|
6411
|
-
const parseORMOdoo = (0,
|
|
5950
|
+
const parseORMOdoo = (0, import_react45.useCallback)((data) => {
|
|
6412
5951
|
for (const key in data) {
|
|
6413
5952
|
if (key === "display_name") {
|
|
6414
5953
|
delete data[key];
|
|
@@ -6419,7 +5958,7 @@ function useModelService() {
|
|
|
6419
5958
|
}
|
|
6420
5959
|
return { ...data };
|
|
6421
5960
|
}, []);
|
|
6422
|
-
const toDataJS = (0,
|
|
5961
|
+
const toDataJS = (0, import_react45.useCallback)(
|
|
6423
5962
|
(data, viewData, model) => {
|
|
6424
5963
|
for (const key in data) {
|
|
6425
5964
|
if (data[key] === false) {
|
|
@@ -6477,10 +6016,10 @@ function useModelService() {
|
|
|
6477
6016
|
}
|
|
6478
6017
|
|
|
6479
6018
|
// src/services/user-service/index.ts
|
|
6480
|
-
var
|
|
6019
|
+
var import_react46 = require("react");
|
|
6481
6020
|
function useUserService() {
|
|
6482
6021
|
const { env } = useEnv();
|
|
6483
|
-
const getProfile = (0,
|
|
6022
|
+
const getProfile = (0, import_react46.useCallback)(
|
|
6484
6023
|
async (service, path, extraHeaders) => {
|
|
6485
6024
|
return env?.requests?.get(
|
|
6486
6025
|
path || "/userinfo" /* PROFILE_PATH */,
|
|
@@ -6497,7 +6036,7 @@ function useUserService() {
|
|
|
6497
6036
|
},
|
|
6498
6037
|
[env]
|
|
6499
6038
|
);
|
|
6500
|
-
const getUser = (0,
|
|
6039
|
+
const getUser = (0, import_react46.useCallback)(
|
|
6501
6040
|
async ({ context, id }) => {
|
|
6502
6041
|
const jsonData = {
|
|
6503
6042
|
model: "res.users",
|
|
@@ -6535,7 +6074,7 @@ function useUserService() {
|
|
|
6535
6074
|
},
|
|
6536
6075
|
[env]
|
|
6537
6076
|
);
|
|
6538
|
-
const switchUserLocale = (0,
|
|
6077
|
+
const switchUserLocale = (0, import_react46.useCallback)(
|
|
6539
6078
|
async ({ id, values, service }) => {
|
|
6540
6079
|
const jsonData = {
|
|
6541
6080
|
model: "res.users",
|
|
@@ -6563,10 +6102,10 @@ function useUserService() {
|
|
|
6563
6102
|
}
|
|
6564
6103
|
|
|
6565
6104
|
// src/services/view-service/index.ts
|
|
6566
|
-
var
|
|
6105
|
+
var import_react47 = require("react");
|
|
6567
6106
|
function useViewService() {
|
|
6568
6107
|
const { env } = useEnv();
|
|
6569
|
-
const getView = (0,
|
|
6108
|
+
const getView = (0, import_react47.useCallback)(
|
|
6570
6109
|
async ({
|
|
6571
6110
|
model,
|
|
6572
6111
|
views,
|
|
@@ -6606,7 +6145,7 @@ function useViewService() {
|
|
|
6606
6145
|
},
|
|
6607
6146
|
[env]
|
|
6608
6147
|
);
|
|
6609
|
-
const getMenu = (0,
|
|
6148
|
+
const getMenu = (0, import_react47.useCallback)(
|
|
6610
6149
|
async (context, specification, domain, service) => {
|
|
6611
6150
|
const jsonData = {
|
|
6612
6151
|
model: "ir.ui.menu" /* MENU */,
|
|
@@ -6637,7 +6176,7 @@ function useViewService() {
|
|
|
6637
6176
|
},
|
|
6638
6177
|
[env]
|
|
6639
6178
|
);
|
|
6640
|
-
const getActionDetail = (0,
|
|
6179
|
+
const getActionDetail = (0, import_react47.useCallback)(
|
|
6641
6180
|
async (aid, context) => {
|
|
6642
6181
|
const jsonData = {
|
|
6643
6182
|
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
@@ -6667,7 +6206,7 @@ function useViewService() {
|
|
|
6667
6206
|
},
|
|
6668
6207
|
[env]
|
|
6669
6208
|
);
|
|
6670
|
-
const getResequence = (0,
|
|
6209
|
+
const getResequence = (0, import_react47.useCallback)(
|
|
6671
6210
|
async ({
|
|
6672
6211
|
model,
|
|
6673
6212
|
ids,
|
|
@@ -6697,7 +6236,7 @@ function useViewService() {
|
|
|
6697
6236
|
},
|
|
6698
6237
|
[env]
|
|
6699
6238
|
);
|
|
6700
|
-
const getSelectionItem = (0,
|
|
6239
|
+
const getSelectionItem = (0, import_react47.useCallback)(
|
|
6701
6240
|
async ({
|
|
6702
6241
|
data,
|
|
6703
6242
|
service,
|
|
@@ -6734,7 +6273,7 @@ function useViewService() {
|
|
|
6734
6273
|
},
|
|
6735
6274
|
[env]
|
|
6736
6275
|
);
|
|
6737
|
-
const loadMessages = (0,
|
|
6276
|
+
const loadMessages = (0, import_react47.useCallback)(async () => {
|
|
6738
6277
|
return env.requests.post(
|
|
6739
6278
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
6740
6279
|
{},
|
|
@@ -6745,14 +6284,14 @@ function useViewService() {
|
|
|
6745
6284
|
}
|
|
6746
6285
|
);
|
|
6747
6286
|
}, [env]);
|
|
6748
|
-
const getVersion = (0,
|
|
6287
|
+
const getVersion = (0, import_react47.useCallback)(async () => {
|
|
6749
6288
|
return env?.requests?.get("", {
|
|
6750
6289
|
headers: {
|
|
6751
6290
|
"Content-Type": "application/json"
|
|
6752
6291
|
}
|
|
6753
6292
|
});
|
|
6754
6293
|
}, [env]);
|
|
6755
|
-
const grantAccess = (0,
|
|
6294
|
+
const grantAccess = (0, import_react47.useCallback)(
|
|
6756
6295
|
async ({
|
|
6757
6296
|
redirect_uri,
|
|
6758
6297
|
state,
|
|
@@ -6779,7 +6318,7 @@ function useViewService() {
|
|
|
6779
6318
|
},
|
|
6780
6319
|
[env]
|
|
6781
6320
|
);
|
|
6782
|
-
const removeTotpSetUp = (0,
|
|
6321
|
+
const removeTotpSetUp = (0, import_react47.useCallback)(
|
|
6783
6322
|
async ({ method, token }) => {
|
|
6784
6323
|
const jsonData = {
|
|
6785
6324
|
method,
|
|
@@ -6800,7 +6339,7 @@ function useViewService() {
|
|
|
6800
6339
|
},
|
|
6801
6340
|
[env]
|
|
6802
6341
|
);
|
|
6803
|
-
const requestSetupTotp = (0,
|
|
6342
|
+
const requestSetupTotp = (0, import_react47.useCallback)(
|
|
6804
6343
|
async ({ method, token }) => {
|
|
6805
6344
|
const jsonData = {
|
|
6806
6345
|
method,
|
|
@@ -6819,7 +6358,7 @@ function useViewService() {
|
|
|
6819
6358
|
},
|
|
6820
6359
|
[env]
|
|
6821
6360
|
);
|
|
6822
|
-
const settingsWebRead2fa = (0,
|
|
6361
|
+
const settingsWebRead2fa = (0, import_react47.useCallback)(
|
|
6823
6362
|
async ({
|
|
6824
6363
|
method,
|
|
6825
6364
|
model,
|
|
@@ -6847,7 +6386,7 @@ function useViewService() {
|
|
|
6847
6386
|
},
|
|
6848
6387
|
[env]
|
|
6849
6388
|
);
|
|
6850
|
-
const signInSSO = (0,
|
|
6389
|
+
const signInSSO = (0, import_react47.useCallback)(
|
|
6851
6390
|
async ({
|
|
6852
6391
|
redirect_uri,
|
|
6853
6392
|
state,
|
|
@@ -6879,7 +6418,7 @@ function useViewService() {
|
|
|
6879
6418
|
},
|
|
6880
6419
|
[env]
|
|
6881
6420
|
);
|
|
6882
|
-
const verify2FA = (0,
|
|
6421
|
+
const verify2FA = (0, import_react47.useCallback)(
|
|
6883
6422
|
({
|
|
6884
6423
|
method,
|
|
6885
6424
|
with_context,
|
|
@@ -6912,7 +6451,7 @@ function useViewService() {
|
|
|
6912
6451
|
},
|
|
6913
6452
|
[env]
|
|
6914
6453
|
);
|
|
6915
|
-
const get2FAMethods = (0,
|
|
6454
|
+
const get2FAMethods = (0, import_react47.useCallback)(
|
|
6916
6455
|
({ method, with_context }) => {
|
|
6917
6456
|
const jsonData = {
|
|
6918
6457
|
method,
|
|
@@ -6931,7 +6470,7 @@ function useViewService() {
|
|
|
6931
6470
|
},
|
|
6932
6471
|
[env]
|
|
6933
6472
|
);
|
|
6934
|
-
const verifyTotp = (0,
|
|
6473
|
+
const verifyTotp = (0, import_react47.useCallback)(
|
|
6935
6474
|
({
|
|
6936
6475
|
method,
|
|
6937
6476
|
action_token,
|
|
@@ -6956,7 +6495,7 @@ function useViewService() {
|
|
|
6956
6495
|
},
|
|
6957
6496
|
[env]
|
|
6958
6497
|
);
|
|
6959
|
-
const getNotifications = (0,
|
|
6498
|
+
const getNotifications = (0, import_react47.useCallback)(
|
|
6960
6499
|
async ({
|
|
6961
6500
|
service,
|
|
6962
6501
|
xNode,
|
|
@@ -6976,7 +6515,7 @@ function useViewService() {
|
|
|
6976
6515
|
},
|
|
6977
6516
|
[env]
|
|
6978
6517
|
);
|
|
6979
|
-
const getCountry = (0,
|
|
6518
|
+
const getCountry = (0, import_react47.useCallback)(
|
|
6980
6519
|
async ({
|
|
6981
6520
|
service,
|
|
6982
6521
|
xNode,
|
|
@@ -7003,7 +6542,7 @@ function useViewService() {
|
|
|
7003
6542
|
},
|
|
7004
6543
|
[env]
|
|
7005
6544
|
);
|
|
7006
|
-
const getCity = (0,
|
|
6545
|
+
const getCity = (0, import_react47.useCallback)(
|
|
7007
6546
|
async ({
|
|
7008
6547
|
service,
|
|
7009
6548
|
xNode,
|
|
@@ -7030,7 +6569,7 @@ function useViewService() {
|
|
|
7030
6569
|
},
|
|
7031
6570
|
[env]
|
|
7032
6571
|
);
|
|
7033
|
-
const getWard = (0,
|
|
6572
|
+
const getWard = (0, import_react47.useCallback)(
|
|
7034
6573
|
async ({
|
|
7035
6574
|
service,
|
|
7036
6575
|
xNode,
|
|
@@ -7055,7 +6594,7 @@ function useViewService() {
|
|
|
7055
6594
|
},
|
|
7056
6595
|
[env]
|
|
7057
6596
|
);
|
|
7058
|
-
const getPartnerTitle = (0,
|
|
6597
|
+
const getPartnerTitle = (0, import_react47.useCallback)(
|
|
7059
6598
|
async ({
|
|
7060
6599
|
service,
|
|
7061
6600
|
xNode,
|
|
@@ -7107,10 +6646,10 @@ function useViewService() {
|
|
|
7107
6646
|
}
|
|
7108
6647
|
|
|
7109
6648
|
// src/services/dashboard-service/index.ts
|
|
7110
|
-
var
|
|
6649
|
+
var import_react48 = require("react");
|
|
7111
6650
|
function useDashboardService() {
|
|
7112
6651
|
const { env } = useEnv();
|
|
7113
|
-
const readGroup = (0,
|
|
6652
|
+
const readGroup = (0, import_react48.useCallback)(
|
|
7114
6653
|
async ({
|
|
7115
6654
|
service,
|
|
7116
6655
|
xNode,
|
|
@@ -7127,7 +6666,7 @@ function useDashboardService() {
|
|
|
7127
6666
|
},
|
|
7128
6667
|
[env]
|
|
7129
6668
|
);
|
|
7130
|
-
const getDataChart = (0,
|
|
6669
|
+
const getDataChart = (0, import_react48.useCallback)(
|
|
7131
6670
|
async ({
|
|
7132
6671
|
service,
|
|
7133
6672
|
xNode,
|
|
@@ -7161,50 +6700,6 @@ function useDashboardService() {
|
|
|
7161
6700
|
);
|
|
7162
6701
|
return { readGroup, getDataChart };
|
|
7163
6702
|
}
|
|
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
6703
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7209
6704
|
0 && (module.exports = {
|
|
7210
6705
|
useActionService,
|
|
@@ -7212,7 +6707,6 @@ var useFileSystemService = () => {
|
|
|
7212
6707
|
useCompanyService,
|
|
7213
6708
|
useDashboardService,
|
|
7214
6709
|
useExcelService,
|
|
7215
|
-
useFileSystemService,
|
|
7216
6710
|
useFormService,
|
|
7217
6711
|
useKanbanService,
|
|
7218
6712
|
useModelService,
|