@fctc/interface-logic 4.3.0 → 4.3.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/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +55 -36
- package/dist/hooks.mjs +55 -36
- package/dist/provider.js +55 -36
- package/dist/provider.mjs +55 -36
- package/dist/services.d.mts +1 -1
- package/dist/services.d.ts +1 -1
- package/dist/services.js +55 -36
- package/dist/services.mjs +55 -36
- package/package.json +1 -1
package/dist/hooks.d.mts
CHANGED
|
@@ -660,7 +660,7 @@ declare const useHandleClosingSession: () => _tanstack_react_query.UseMutationRe
|
|
|
660
660
|
xNode?: string;
|
|
661
661
|
}, unknown>;
|
|
662
662
|
|
|
663
|
-
declare const useLoadDataPosSession: () => _tanstack_react_query.UseMutationResult<
|
|
663
|
+
declare const useLoadDataPosSession: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
664
664
|
model: string;
|
|
665
665
|
ids: any;
|
|
666
666
|
service?: string;
|
package/dist/hooks.d.ts
CHANGED
|
@@ -660,7 +660,7 @@ declare const useHandleClosingSession: () => _tanstack_react_query.UseMutationRe
|
|
|
660
660
|
xNode?: string;
|
|
661
661
|
}, unknown>;
|
|
662
662
|
|
|
663
|
-
declare const useLoadDataPosSession: () => _tanstack_react_query.UseMutationResult<
|
|
663
|
+
declare const useLoadDataPosSession: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
664
664
|
model: string;
|
|
665
665
|
ids: any;
|
|
666
666
|
service?: string;
|
package/dist/hooks.js
CHANGED
|
@@ -6118,50 +6118,67 @@ var memoryCache = new MemoryCache();
|
|
|
6118
6118
|
var MODELS_DIR = "pos/models";
|
|
6119
6119
|
var MODELS_META_DIR = "pos/models_meta";
|
|
6120
6120
|
async function loadData(includeMeta = true) {
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
if (!file.name.endsWith(".json")) continue;
|
|
6129
|
-
const fileName = file.name;
|
|
6130
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
6131
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6132
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6133
|
-
modelName
|
|
6134
|
-
)}.meta.json`;
|
|
6135
|
-
const rawData = await fileService.read(dataPath);
|
|
6136
|
-
if (!rawData) continue;
|
|
6137
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
6138
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6139
|
-
if (!includeMeta) {
|
|
6140
|
-
result[modelName] = { data };
|
|
6141
|
-
continue;
|
|
6121
|
+
console.log("\u{1F50D} loadData START");
|
|
6122
|
+
try {
|
|
6123
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
6124
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
6125
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
6126
|
+
console.log("\u26A0\uFE0F No files found");
|
|
6127
|
+
return {};
|
|
6142
6128
|
}
|
|
6143
|
-
const
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6129
|
+
const result = {};
|
|
6130
|
+
for (const file of listResult.files) {
|
|
6131
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
6132
|
+
if (file.type !== "file") continue;
|
|
6133
|
+
if (!file.name.endsWith(".json")) continue;
|
|
6134
|
+
const fileName = file.name;
|
|
6135
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
6136
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6137
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
6138
|
+
const rawData = await fileService.read(dataPath);
|
|
6139
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
6140
|
+
if (!rawData) continue;
|
|
6141
|
+
console.log("\u{1F504} Parsing data...");
|
|
6142
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
6143
|
+
console.log("\u2705 Data parsed");
|
|
6144
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6145
|
+
if (!includeMeta) {
|
|
6146
|
+
result[modelName] = { data };
|
|
6147
|
+
continue;
|
|
6148
|
+
}
|
|
6149
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6150
|
+
modelName
|
|
6151
|
+
)}.meta.json`;
|
|
6152
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
6153
|
+
const rawMeta = await fileService.read(metaPath);
|
|
6154
|
+
let fields = [];
|
|
6155
|
+
let relations = {};
|
|
6156
|
+
if (rawMeta) {
|
|
6157
|
+
console.log("\u{1F504} Parsing meta...");
|
|
6158
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
6159
|
+
fields = parsedMeta?.fields ?? [];
|
|
6160
|
+
relations = parsedMeta?.relations ?? {};
|
|
6161
|
+
console.log("\u2705 Meta parsed");
|
|
6162
|
+
}
|
|
6163
|
+
result[modelName] = {
|
|
6164
|
+
data,
|
|
6165
|
+
fields,
|
|
6166
|
+
relations
|
|
6167
|
+
};
|
|
6150
6168
|
}
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6169
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
6170
|
+
return result;
|
|
6171
|
+
} catch (error) {
|
|
6172
|
+
console.error("\u274C loadData ERROR:", error);
|
|
6173
|
+
throw error;
|
|
6156
6174
|
}
|
|
6157
|
-
return result;
|
|
6158
6175
|
}
|
|
6159
6176
|
|
|
6160
6177
|
// src/services/pos-service/load-data-pos-session.ts
|
|
6161
6178
|
var loadDataPosSessionService = (env) => {
|
|
6162
6179
|
const isLocalMode = env?.isLocalMode;
|
|
6163
6180
|
const loadDataPosSession = (0, import_react37.useCallback)(
|
|
6164
|
-
({
|
|
6181
|
+
async ({
|
|
6165
6182
|
model,
|
|
6166
6183
|
ids,
|
|
6167
6184
|
xNode,
|
|
@@ -6172,7 +6189,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
6172
6189
|
}) => {
|
|
6173
6190
|
console.log("isLocalMode", isLocalMode);
|
|
6174
6191
|
if (isLocalMode) {
|
|
6175
|
-
|
|
6192
|
+
const data = await loadData();
|
|
6193
|
+
console.log("\u2705 loadData resolved:", data);
|
|
6194
|
+
return data;
|
|
6176
6195
|
}
|
|
6177
6196
|
const jsonData = {
|
|
6178
6197
|
model,
|
package/dist/hooks.mjs
CHANGED
|
@@ -5969,50 +5969,67 @@ var memoryCache = new MemoryCache();
|
|
|
5969
5969
|
var MODELS_DIR = "pos/models";
|
|
5970
5970
|
var MODELS_META_DIR = "pos/models_meta";
|
|
5971
5971
|
async function loadData(includeMeta = true) {
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
if (!file.name.endsWith(".json")) continue;
|
|
5980
|
-
const fileName = file.name;
|
|
5981
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
5982
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
5983
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
5984
|
-
modelName
|
|
5985
|
-
)}.meta.json`;
|
|
5986
|
-
const rawData = await fileService.read(dataPath);
|
|
5987
|
-
if (!rawData) continue;
|
|
5988
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
5989
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
5990
|
-
if (!includeMeta) {
|
|
5991
|
-
result[modelName] = { data };
|
|
5992
|
-
continue;
|
|
5972
|
+
console.log("\u{1F50D} loadData START");
|
|
5973
|
+
try {
|
|
5974
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
5975
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
5976
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
5977
|
+
console.log("\u26A0\uFE0F No files found");
|
|
5978
|
+
return {};
|
|
5993
5979
|
}
|
|
5994
|
-
const
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
5980
|
+
const result = {};
|
|
5981
|
+
for (const file of listResult.files) {
|
|
5982
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
5983
|
+
if (file.type !== "file") continue;
|
|
5984
|
+
if (!file.name.endsWith(".json")) continue;
|
|
5985
|
+
const fileName = file.name;
|
|
5986
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
5987
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
5988
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
5989
|
+
const rawData = await fileService.read(dataPath);
|
|
5990
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
5991
|
+
if (!rawData) continue;
|
|
5992
|
+
console.log("\u{1F504} Parsing data...");
|
|
5993
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
5994
|
+
console.log("\u2705 Data parsed");
|
|
5995
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
5996
|
+
if (!includeMeta) {
|
|
5997
|
+
result[modelName] = { data };
|
|
5998
|
+
continue;
|
|
5999
|
+
}
|
|
6000
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6001
|
+
modelName
|
|
6002
|
+
)}.meta.json`;
|
|
6003
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
6004
|
+
const rawMeta = await fileService.read(metaPath);
|
|
6005
|
+
let fields = [];
|
|
6006
|
+
let relations = {};
|
|
6007
|
+
if (rawMeta) {
|
|
6008
|
+
console.log("\u{1F504} Parsing meta...");
|
|
6009
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
6010
|
+
fields = parsedMeta?.fields ?? [];
|
|
6011
|
+
relations = parsedMeta?.relations ?? {};
|
|
6012
|
+
console.log("\u2705 Meta parsed");
|
|
6013
|
+
}
|
|
6014
|
+
result[modelName] = {
|
|
6015
|
+
data,
|
|
6016
|
+
fields,
|
|
6017
|
+
relations
|
|
6018
|
+
};
|
|
6001
6019
|
}
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6020
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
6021
|
+
return result;
|
|
6022
|
+
} catch (error) {
|
|
6023
|
+
console.error("\u274C loadData ERROR:", error);
|
|
6024
|
+
throw error;
|
|
6007
6025
|
}
|
|
6008
|
-
return result;
|
|
6009
6026
|
}
|
|
6010
6027
|
|
|
6011
6028
|
// src/services/pos-service/load-data-pos-session.ts
|
|
6012
6029
|
var loadDataPosSessionService = (env) => {
|
|
6013
6030
|
const isLocalMode = env?.isLocalMode;
|
|
6014
6031
|
const loadDataPosSession = useCallback32(
|
|
6015
|
-
({
|
|
6032
|
+
async ({
|
|
6016
6033
|
model,
|
|
6017
6034
|
ids,
|
|
6018
6035
|
xNode,
|
|
@@ -6023,7 +6040,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
6023
6040
|
}) => {
|
|
6024
6041
|
console.log("isLocalMode", isLocalMode);
|
|
6025
6042
|
if (isLocalMode) {
|
|
6026
|
-
|
|
6043
|
+
const data = await loadData();
|
|
6044
|
+
console.log("\u2705 loadData resolved:", data);
|
|
6045
|
+
return data;
|
|
6027
6046
|
}
|
|
6028
6047
|
const jsonData = {
|
|
6029
6048
|
model,
|
package/dist/provider.js
CHANGED
|
@@ -6100,50 +6100,67 @@ var memoryCache = new MemoryCache();
|
|
|
6100
6100
|
var MODELS_DIR = "pos/models";
|
|
6101
6101
|
var MODELS_META_DIR = "pos/models_meta";
|
|
6102
6102
|
async function loadData(includeMeta = true) {
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
if (!file.name.endsWith(".json")) continue;
|
|
6111
|
-
const fileName = file.name;
|
|
6112
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
6113
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6114
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6115
|
-
modelName
|
|
6116
|
-
)}.meta.json`;
|
|
6117
|
-
const rawData = await fileService.read(dataPath);
|
|
6118
|
-
if (!rawData) continue;
|
|
6119
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
6120
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6121
|
-
if (!includeMeta) {
|
|
6122
|
-
result[modelName] = { data };
|
|
6123
|
-
continue;
|
|
6103
|
+
console.log("\u{1F50D} loadData START");
|
|
6104
|
+
try {
|
|
6105
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
6106
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
6107
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
6108
|
+
console.log("\u26A0\uFE0F No files found");
|
|
6109
|
+
return {};
|
|
6124
6110
|
}
|
|
6125
|
-
const
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6111
|
+
const result = {};
|
|
6112
|
+
for (const file of listResult.files) {
|
|
6113
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
6114
|
+
if (file.type !== "file") continue;
|
|
6115
|
+
if (!file.name.endsWith(".json")) continue;
|
|
6116
|
+
const fileName = file.name;
|
|
6117
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
6118
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6119
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
6120
|
+
const rawData = await fileService.read(dataPath);
|
|
6121
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
6122
|
+
if (!rawData) continue;
|
|
6123
|
+
console.log("\u{1F504} Parsing data...");
|
|
6124
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
6125
|
+
console.log("\u2705 Data parsed");
|
|
6126
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6127
|
+
if (!includeMeta) {
|
|
6128
|
+
result[modelName] = { data };
|
|
6129
|
+
continue;
|
|
6130
|
+
}
|
|
6131
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6132
|
+
modelName
|
|
6133
|
+
)}.meta.json`;
|
|
6134
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
6135
|
+
const rawMeta = await fileService.read(metaPath);
|
|
6136
|
+
let fields = [];
|
|
6137
|
+
let relations = {};
|
|
6138
|
+
if (rawMeta) {
|
|
6139
|
+
console.log("\u{1F504} Parsing meta...");
|
|
6140
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
6141
|
+
fields = parsedMeta?.fields ?? [];
|
|
6142
|
+
relations = parsedMeta?.relations ?? {};
|
|
6143
|
+
console.log("\u2705 Meta parsed");
|
|
6144
|
+
}
|
|
6145
|
+
result[modelName] = {
|
|
6146
|
+
data,
|
|
6147
|
+
fields,
|
|
6148
|
+
relations
|
|
6149
|
+
};
|
|
6132
6150
|
}
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6151
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
6152
|
+
return result;
|
|
6153
|
+
} catch (error) {
|
|
6154
|
+
console.error("\u274C loadData ERROR:", error);
|
|
6155
|
+
throw error;
|
|
6138
6156
|
}
|
|
6139
|
-
return result;
|
|
6140
6157
|
}
|
|
6141
6158
|
|
|
6142
6159
|
// src/services/pos-service/load-data-pos-session.ts
|
|
6143
6160
|
var loadDataPosSessionService = (env) => {
|
|
6144
6161
|
const isLocalMode = env?.isLocalMode;
|
|
6145
6162
|
const loadDataPosSession = (0, import_react33.useCallback)(
|
|
6146
|
-
({
|
|
6163
|
+
async ({
|
|
6147
6164
|
model,
|
|
6148
6165
|
ids,
|
|
6149
6166
|
xNode,
|
|
@@ -6154,7 +6171,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
6154
6171
|
}) => {
|
|
6155
6172
|
console.log("isLocalMode", isLocalMode);
|
|
6156
6173
|
if (isLocalMode) {
|
|
6157
|
-
|
|
6174
|
+
const data = await loadData();
|
|
6175
|
+
console.log("\u2705 loadData resolved:", data);
|
|
6176
|
+
return data;
|
|
6158
6177
|
}
|
|
6159
6178
|
const jsonData = {
|
|
6160
6179
|
model,
|
package/dist/provider.mjs
CHANGED
|
@@ -6056,50 +6056,67 @@ var memoryCache = new MemoryCache();
|
|
|
6056
6056
|
var MODELS_DIR = "pos/models";
|
|
6057
6057
|
var MODELS_META_DIR = "pos/models_meta";
|
|
6058
6058
|
async function loadData(includeMeta = true) {
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
if (!file.name.endsWith(".json")) continue;
|
|
6067
|
-
const fileName = file.name;
|
|
6068
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
6069
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6070
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6071
|
-
modelName
|
|
6072
|
-
)}.meta.json`;
|
|
6073
|
-
const rawData = await fileService.read(dataPath);
|
|
6074
|
-
if (!rawData) continue;
|
|
6075
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
6076
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6077
|
-
if (!includeMeta) {
|
|
6078
|
-
result[modelName] = { data };
|
|
6079
|
-
continue;
|
|
6059
|
+
console.log("\u{1F50D} loadData START");
|
|
6060
|
+
try {
|
|
6061
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
6062
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
6063
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
6064
|
+
console.log("\u26A0\uFE0F No files found");
|
|
6065
|
+
return {};
|
|
6080
6066
|
}
|
|
6081
|
-
const
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6067
|
+
const result = {};
|
|
6068
|
+
for (const file of listResult.files) {
|
|
6069
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
6070
|
+
if (file.type !== "file") continue;
|
|
6071
|
+
if (!file.name.endsWith(".json")) continue;
|
|
6072
|
+
const fileName = file.name;
|
|
6073
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
6074
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
6075
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
6076
|
+
const rawData = await fileService.read(dataPath);
|
|
6077
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
6078
|
+
if (!rawData) continue;
|
|
6079
|
+
console.log("\u{1F504} Parsing data...");
|
|
6080
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
6081
|
+
console.log("\u2705 Data parsed");
|
|
6082
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
6083
|
+
if (!includeMeta) {
|
|
6084
|
+
result[modelName] = { data };
|
|
6085
|
+
continue;
|
|
6086
|
+
}
|
|
6087
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
6088
|
+
modelName
|
|
6089
|
+
)}.meta.json`;
|
|
6090
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
6091
|
+
const rawMeta = await fileService.read(metaPath);
|
|
6092
|
+
let fields = [];
|
|
6093
|
+
let relations = {};
|
|
6094
|
+
if (rawMeta) {
|
|
6095
|
+
console.log("\u{1F504} Parsing meta...");
|
|
6096
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
6097
|
+
fields = parsedMeta?.fields ?? [];
|
|
6098
|
+
relations = parsedMeta?.relations ?? {};
|
|
6099
|
+
console.log("\u2705 Meta parsed");
|
|
6100
|
+
}
|
|
6101
|
+
result[modelName] = {
|
|
6102
|
+
data,
|
|
6103
|
+
fields,
|
|
6104
|
+
relations
|
|
6105
|
+
};
|
|
6088
6106
|
}
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6107
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
6108
|
+
return result;
|
|
6109
|
+
} catch (error) {
|
|
6110
|
+
console.error("\u274C loadData ERROR:", error);
|
|
6111
|
+
throw error;
|
|
6094
6112
|
}
|
|
6095
|
-
return result;
|
|
6096
6113
|
}
|
|
6097
6114
|
|
|
6098
6115
|
// src/services/pos-service/load-data-pos-session.ts
|
|
6099
6116
|
var loadDataPosSessionService = (env) => {
|
|
6100
6117
|
const isLocalMode = env?.isLocalMode;
|
|
6101
6118
|
const loadDataPosSession = useCallback31(
|
|
6102
|
-
({
|
|
6119
|
+
async ({
|
|
6103
6120
|
model,
|
|
6104
6121
|
ids,
|
|
6105
6122
|
xNode,
|
|
@@ -6110,7 +6127,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
6110
6127
|
}) => {
|
|
6111
6128
|
console.log("isLocalMode", isLocalMode);
|
|
6112
6129
|
if (isLocalMode) {
|
|
6113
|
-
|
|
6130
|
+
const data = await loadData();
|
|
6131
|
+
console.log("\u2705 loadData resolved:", data);
|
|
6132
|
+
return data;
|
|
6114
6133
|
}
|
|
6115
6134
|
const jsonData = {
|
|
6116
6135
|
model,
|
package/dist/services.d.mts
CHANGED
|
@@ -540,7 +540,7 @@ declare const serviceFactories: readonly [(env: any) => {
|
|
|
540
540
|
withContext?: any;
|
|
541
541
|
modelsToLoad?: any;
|
|
542
542
|
searchParams?: Record<string, string | number | boolean>;
|
|
543
|
-
}) => any
|
|
543
|
+
}) => Promise<any>;
|
|
544
544
|
}, (env: any) => {
|
|
545
545
|
manageOnChange: ({ model, ids, args, xNode, service, }: {
|
|
546
546
|
model: string;
|
package/dist/services.d.ts
CHANGED
|
@@ -540,7 +540,7 @@ declare const serviceFactories: readonly [(env: any) => {
|
|
|
540
540
|
withContext?: any;
|
|
541
541
|
modelsToLoad?: any;
|
|
542
542
|
searchParams?: Record<string, string | number | boolean>;
|
|
543
|
-
}) => any
|
|
543
|
+
}) => Promise<any>;
|
|
544
544
|
}, (env: any) => {
|
|
545
545
|
manageOnChange: ({ model, ids, args, xNode, service, }: {
|
|
546
546
|
model: string;
|
package/dist/services.js
CHANGED
|
@@ -4080,50 +4080,67 @@ var memoryCache = new MemoryCache();
|
|
|
4080
4080
|
var MODELS_DIR = "pos/models";
|
|
4081
4081
|
var MODELS_META_DIR = "pos/models_meta";
|
|
4082
4082
|
async function loadData(includeMeta = true) {
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
if (!file.name.endsWith(".json")) continue;
|
|
4091
|
-
const fileName = file.name;
|
|
4092
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
4093
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
4094
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
4095
|
-
modelName
|
|
4096
|
-
)}.meta.json`;
|
|
4097
|
-
const rawData = await fileService.read(dataPath);
|
|
4098
|
-
if (!rawData) continue;
|
|
4099
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
4100
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
4101
|
-
if (!includeMeta) {
|
|
4102
|
-
result[modelName] = { data };
|
|
4103
|
-
continue;
|
|
4083
|
+
console.log("\u{1F50D} loadData START");
|
|
4084
|
+
try {
|
|
4085
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
4086
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
4087
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
4088
|
+
console.log("\u26A0\uFE0F No files found");
|
|
4089
|
+
return {};
|
|
4104
4090
|
}
|
|
4105
|
-
const
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4091
|
+
const result = {};
|
|
4092
|
+
for (const file of listResult.files) {
|
|
4093
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
4094
|
+
if (file.type !== "file") continue;
|
|
4095
|
+
if (!file.name.endsWith(".json")) continue;
|
|
4096
|
+
const fileName = file.name;
|
|
4097
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
4098
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
4099
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
4100
|
+
const rawData = await fileService.read(dataPath);
|
|
4101
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
4102
|
+
if (!rawData) continue;
|
|
4103
|
+
console.log("\u{1F504} Parsing data...");
|
|
4104
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
4105
|
+
console.log("\u2705 Data parsed");
|
|
4106
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
4107
|
+
if (!includeMeta) {
|
|
4108
|
+
result[modelName] = { data };
|
|
4109
|
+
continue;
|
|
4110
|
+
}
|
|
4111
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
4112
|
+
modelName
|
|
4113
|
+
)}.meta.json`;
|
|
4114
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
4115
|
+
const rawMeta = await fileService.read(metaPath);
|
|
4116
|
+
let fields = [];
|
|
4117
|
+
let relations = {};
|
|
4118
|
+
if (rawMeta) {
|
|
4119
|
+
console.log("\u{1F504} Parsing meta...");
|
|
4120
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
4121
|
+
fields = parsedMeta?.fields ?? [];
|
|
4122
|
+
relations = parsedMeta?.relations ?? {};
|
|
4123
|
+
console.log("\u2705 Meta parsed");
|
|
4124
|
+
}
|
|
4125
|
+
result[modelName] = {
|
|
4126
|
+
data,
|
|
4127
|
+
fields,
|
|
4128
|
+
relations
|
|
4129
|
+
};
|
|
4112
4130
|
}
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4131
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
4132
|
+
return result;
|
|
4133
|
+
} catch (error) {
|
|
4134
|
+
console.error("\u274C loadData ERROR:", error);
|
|
4135
|
+
throw error;
|
|
4118
4136
|
}
|
|
4119
|
-
return result;
|
|
4120
4137
|
}
|
|
4121
4138
|
|
|
4122
4139
|
// src/services/pos-service/load-data-pos-session.ts
|
|
4123
4140
|
var loadDataPosSessionService = (env) => {
|
|
4124
4141
|
const isLocalMode = env?.isLocalMode;
|
|
4125
4142
|
const loadDataPosSession = (0, import_react26.useCallback)(
|
|
4126
|
-
({
|
|
4143
|
+
async ({
|
|
4127
4144
|
model,
|
|
4128
4145
|
ids,
|
|
4129
4146
|
xNode,
|
|
@@ -4134,7 +4151,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
4134
4151
|
}) => {
|
|
4135
4152
|
console.log("isLocalMode", isLocalMode);
|
|
4136
4153
|
if (isLocalMode) {
|
|
4137
|
-
|
|
4154
|
+
const data = await loadData();
|
|
4155
|
+
console.log("\u2705 loadData resolved:", data);
|
|
4156
|
+
return data;
|
|
4138
4157
|
}
|
|
4139
4158
|
const jsonData = {
|
|
4140
4159
|
model,
|
package/dist/services.mjs
CHANGED
|
@@ -4032,50 +4032,67 @@ var memoryCache = new MemoryCache();
|
|
|
4032
4032
|
var MODELS_DIR = "pos/models";
|
|
4033
4033
|
var MODELS_META_DIR = "pos/models_meta";
|
|
4034
4034
|
async function loadData(includeMeta = true) {
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
if (!file.name.endsWith(".json")) continue;
|
|
4043
|
-
const fileName = file.name;
|
|
4044
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
4045
|
-
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
4046
|
-
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
4047
|
-
modelName
|
|
4048
|
-
)}.meta.json`;
|
|
4049
|
-
const rawData = await fileService.read(dataPath);
|
|
4050
|
-
if (!rawData) continue;
|
|
4051
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
4052
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
4053
|
-
if (!includeMeta) {
|
|
4054
|
-
result[modelName] = { data };
|
|
4055
|
-
continue;
|
|
4035
|
+
console.log("\u{1F50D} loadData START");
|
|
4036
|
+
try {
|
|
4037
|
+
const listResult = await fileService.list(MODELS_DIR);
|
|
4038
|
+
console.log("\u{1F4CB} listResult:", listResult);
|
|
4039
|
+
if (!listResult || !Array.isArray(listResult.files)) {
|
|
4040
|
+
console.log("\u26A0\uFE0F No files found");
|
|
4041
|
+
return {};
|
|
4056
4042
|
}
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4043
|
+
const result = {};
|
|
4044
|
+
for (const file of listResult.files) {
|
|
4045
|
+
console.log("\u{1F4C4} Processing file:", file.name);
|
|
4046
|
+
if (file.type !== "file") continue;
|
|
4047
|
+
if (!file.name.endsWith(".json")) continue;
|
|
4048
|
+
const fileName = file.name;
|
|
4049
|
+
const modelName = fileName.replace(/\.json$/, "");
|
|
4050
|
+
const dataPath = `${MODELS_DIR}/${fileName}`;
|
|
4051
|
+
console.log("\u{1F4C2} Reading data from:", dataPath);
|
|
4052
|
+
const rawData = await fileService.read(dataPath);
|
|
4053
|
+
console.log("\u2705 Data read, length:", rawData?.length);
|
|
4054
|
+
if (!rawData) continue;
|
|
4055
|
+
console.log("\u{1F504} Parsing data...");
|
|
4056
|
+
const parsedData = await spawnParseWorker(rawData);
|
|
4057
|
+
console.log("\u2705 Data parsed");
|
|
4058
|
+
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
4059
|
+
if (!includeMeta) {
|
|
4060
|
+
result[modelName] = { data };
|
|
4061
|
+
continue;
|
|
4062
|
+
}
|
|
4063
|
+
const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
4064
|
+
modelName
|
|
4065
|
+
)}.meta.json`;
|
|
4066
|
+
console.log("\u{1F4C2} Reading meta from:", metaPath);
|
|
4067
|
+
const rawMeta = await fileService.read(metaPath);
|
|
4068
|
+
let fields = [];
|
|
4069
|
+
let relations = {};
|
|
4070
|
+
if (rawMeta) {
|
|
4071
|
+
console.log("\u{1F504} Parsing meta...");
|
|
4072
|
+
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
4073
|
+
fields = parsedMeta?.fields ?? [];
|
|
4074
|
+
relations = parsedMeta?.relations ?? {};
|
|
4075
|
+
console.log("\u2705 Meta parsed");
|
|
4076
|
+
}
|
|
4077
|
+
result[modelName] = {
|
|
4078
|
+
data,
|
|
4079
|
+
fields,
|
|
4080
|
+
relations
|
|
4081
|
+
};
|
|
4064
4082
|
}
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4083
|
+
console.log("\u2705 loadData COMPLETE:", Object.keys(result));
|
|
4084
|
+
return result;
|
|
4085
|
+
} catch (error) {
|
|
4086
|
+
console.error("\u274C loadData ERROR:", error);
|
|
4087
|
+
throw error;
|
|
4070
4088
|
}
|
|
4071
|
-
return result;
|
|
4072
4089
|
}
|
|
4073
4090
|
|
|
4074
4091
|
// src/services/pos-service/load-data-pos-session.ts
|
|
4075
4092
|
var loadDataPosSessionService = (env) => {
|
|
4076
4093
|
const isLocalMode = env?.isLocalMode;
|
|
4077
4094
|
const loadDataPosSession = useCallback23(
|
|
4078
|
-
({
|
|
4095
|
+
async ({
|
|
4079
4096
|
model,
|
|
4080
4097
|
ids,
|
|
4081
4098
|
xNode,
|
|
@@ -4086,7 +4103,9 @@ var loadDataPosSessionService = (env) => {
|
|
|
4086
4103
|
}) => {
|
|
4087
4104
|
console.log("isLocalMode", isLocalMode);
|
|
4088
4105
|
if (isLocalMode) {
|
|
4089
|
-
|
|
4106
|
+
const data = await loadData();
|
|
4107
|
+
console.log("\u2705 loadData resolved:", data);
|
|
4108
|
+
return data;
|
|
4090
4109
|
}
|
|
4091
4110
|
const jsonData = {
|
|
4092
4111
|
model,
|