@fctc/interface-logic 4.2.9 → 4.3.0

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.js CHANGED
@@ -6118,18 +6118,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
6122
- if (!exists) {
6123
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
6124
- return {};
6125
- }
6126
- let listResult;
6127
- try {
6128
- listResult = await fileService.list(MODELS_DIR);
6129
- } catch (e) {
6130
- console.error("[loadData] list failed:", e);
6131
- return {};
6132
- }
6121
+ const listResult = await fileService.list(MODELS_DIR);
6133
6122
  if (!listResult || !Array.isArray(listResult.files)) {
6134
6123
  return {};
6135
6124
  }
@@ -6137,8 +6126,9 @@ async function loadData(includeMeta = true) {
6137
6126
  for (const file of listResult.files) {
6138
6127
  if (file.type !== "file") continue;
6139
6128
  if (!file.name.endsWith(".json")) continue;
6140
- const modelName = file.name.replace(/\.json$/, "");
6141
- const dataPath = `${MODELS_DIR}/${file.name}`;
6129
+ const fileName = file.name;
6130
+ const modelName = fileName.replace(/\.json$/, "");
6131
+ const dataPath = `${MODELS_DIR}/${fileName}`;
6142
6132
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
6143
6133
  modelName
6144
6134
  )}.meta.json`;
@@ -6158,7 +6148,11 @@ async function loadData(includeMeta = true) {
6158
6148
  fields = parsedMeta?.fields ?? [];
6159
6149
  relations = parsedMeta?.relations ?? {};
6160
6150
  }
6161
- result[modelName] = { data, fields, relations };
6151
+ result[modelName] = {
6152
+ data,
6153
+ fields,
6154
+ relations
6155
+ };
6162
6156
  }
6163
6157
  return result;
6164
6158
  }
@@ -6178,11 +6172,7 @@ var loadDataPosSessionService = (env) => {
6178
6172
  }) => {
6179
6173
  console.log("isLocalMode", isLocalMode);
6180
6174
  if (isLocalMode) {
6181
- return loadData().then((localDb) => ({
6182
- data: {
6183
- data: localDb
6184
- }
6185
- }));
6175
+ return loadData;
6186
6176
  }
6187
6177
  const jsonData = {
6188
6178
  model,
package/dist/hooks.mjs CHANGED
@@ -5969,18 +5969,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
5973
- if (!exists) {
5974
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
5975
- return {};
5976
- }
5977
- let listResult;
5978
- try {
5979
- listResult = await fileService.list(MODELS_DIR);
5980
- } catch (e) {
5981
- console.error("[loadData] list failed:", e);
5982
- return {};
5983
- }
5972
+ const listResult = await fileService.list(MODELS_DIR);
5984
5973
  if (!listResult || !Array.isArray(listResult.files)) {
5985
5974
  return {};
5986
5975
  }
@@ -5988,8 +5977,9 @@ async function loadData(includeMeta = true) {
5988
5977
  for (const file of listResult.files) {
5989
5978
  if (file.type !== "file") continue;
5990
5979
  if (!file.name.endsWith(".json")) continue;
5991
- const modelName = file.name.replace(/\.json$/, "");
5992
- const dataPath = `${MODELS_DIR}/${file.name}`;
5980
+ const fileName = file.name;
5981
+ const modelName = fileName.replace(/\.json$/, "");
5982
+ const dataPath = `${MODELS_DIR}/${fileName}`;
5993
5983
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
5994
5984
  modelName
5995
5985
  )}.meta.json`;
@@ -6009,7 +5999,11 @@ async function loadData(includeMeta = true) {
6009
5999
  fields = parsedMeta?.fields ?? [];
6010
6000
  relations = parsedMeta?.relations ?? {};
6011
6001
  }
6012
- result[modelName] = { data, fields, relations };
6002
+ result[modelName] = {
6003
+ data,
6004
+ fields,
6005
+ relations
6006
+ };
6013
6007
  }
6014
6008
  return result;
6015
6009
  }
@@ -6029,11 +6023,7 @@ var loadDataPosSessionService = (env) => {
6029
6023
  }) => {
6030
6024
  console.log("isLocalMode", isLocalMode);
6031
6025
  if (isLocalMode) {
6032
- return loadData().then((localDb) => ({
6033
- data: {
6034
- data: localDb
6035
- }
6036
- }));
6026
+ return loadData;
6037
6027
  }
6038
6028
  const jsonData = {
6039
6029
  model,
package/dist/provider.js CHANGED
@@ -6100,18 +6100,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
6104
- if (!exists) {
6105
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
6106
- return {};
6107
- }
6108
- let listResult;
6109
- try {
6110
- listResult = await fileService.list(MODELS_DIR);
6111
- } catch (e) {
6112
- console.error("[loadData] list failed:", e);
6113
- return {};
6114
- }
6103
+ const listResult = await fileService.list(MODELS_DIR);
6115
6104
  if (!listResult || !Array.isArray(listResult.files)) {
6116
6105
  return {};
6117
6106
  }
@@ -6119,8 +6108,9 @@ async function loadData(includeMeta = true) {
6119
6108
  for (const file of listResult.files) {
6120
6109
  if (file.type !== "file") continue;
6121
6110
  if (!file.name.endsWith(".json")) continue;
6122
- const modelName = file.name.replace(/\.json$/, "");
6123
- const dataPath = `${MODELS_DIR}/${file.name}`;
6111
+ const fileName = file.name;
6112
+ const modelName = fileName.replace(/\.json$/, "");
6113
+ const dataPath = `${MODELS_DIR}/${fileName}`;
6124
6114
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
6125
6115
  modelName
6126
6116
  )}.meta.json`;
@@ -6140,7 +6130,11 @@ async function loadData(includeMeta = true) {
6140
6130
  fields = parsedMeta?.fields ?? [];
6141
6131
  relations = parsedMeta?.relations ?? {};
6142
6132
  }
6143
- result[modelName] = { data, fields, relations };
6133
+ result[modelName] = {
6134
+ data,
6135
+ fields,
6136
+ relations
6137
+ };
6144
6138
  }
6145
6139
  return result;
6146
6140
  }
@@ -6160,11 +6154,7 @@ var loadDataPosSessionService = (env) => {
6160
6154
  }) => {
6161
6155
  console.log("isLocalMode", isLocalMode);
6162
6156
  if (isLocalMode) {
6163
- return loadData().then((localDb) => ({
6164
- data: {
6165
- data: localDb
6166
- }
6167
- }));
6157
+ return loadData;
6168
6158
  }
6169
6159
  const jsonData = {
6170
6160
  model,
package/dist/provider.mjs CHANGED
@@ -6056,18 +6056,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
6060
- if (!exists) {
6061
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
6062
- return {};
6063
- }
6064
- let listResult;
6065
- try {
6066
- listResult = await fileService.list(MODELS_DIR);
6067
- } catch (e) {
6068
- console.error("[loadData] list failed:", e);
6069
- return {};
6070
- }
6059
+ const listResult = await fileService.list(MODELS_DIR);
6071
6060
  if (!listResult || !Array.isArray(listResult.files)) {
6072
6061
  return {};
6073
6062
  }
@@ -6075,8 +6064,9 @@ async function loadData(includeMeta = true) {
6075
6064
  for (const file of listResult.files) {
6076
6065
  if (file.type !== "file") continue;
6077
6066
  if (!file.name.endsWith(".json")) continue;
6078
- const modelName = file.name.replace(/\.json$/, "");
6079
- const dataPath = `${MODELS_DIR}/${file.name}`;
6067
+ const fileName = file.name;
6068
+ const modelName = fileName.replace(/\.json$/, "");
6069
+ const dataPath = `${MODELS_DIR}/${fileName}`;
6080
6070
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
6081
6071
  modelName
6082
6072
  )}.meta.json`;
@@ -6096,7 +6086,11 @@ async function loadData(includeMeta = true) {
6096
6086
  fields = parsedMeta?.fields ?? [];
6097
6087
  relations = parsedMeta?.relations ?? {};
6098
6088
  }
6099
- result[modelName] = { data, fields, relations };
6089
+ result[modelName] = {
6090
+ data,
6091
+ fields,
6092
+ relations
6093
+ };
6100
6094
  }
6101
6095
  return result;
6102
6096
  }
@@ -6116,11 +6110,7 @@ var loadDataPosSessionService = (env) => {
6116
6110
  }) => {
6117
6111
  console.log("isLocalMode", isLocalMode);
6118
6112
  if (isLocalMode) {
6119
- return loadData().then((localDb) => ({
6120
- data: {
6121
- data: localDb
6122
- }
6123
- }));
6113
+ return loadData;
6124
6114
  }
6125
6115
  const jsonData = {
6126
6116
  model,
package/dist/services.js CHANGED
@@ -4080,18 +4080,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
4084
- if (!exists) {
4085
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
4086
- return {};
4087
- }
4088
- let listResult;
4089
- try {
4090
- listResult = await fileService.list(MODELS_DIR);
4091
- } catch (e) {
4092
- console.error("[loadData] list failed:", e);
4093
- return {};
4094
- }
4083
+ const listResult = await fileService.list(MODELS_DIR);
4095
4084
  if (!listResult || !Array.isArray(listResult.files)) {
4096
4085
  return {};
4097
4086
  }
@@ -4099,8 +4088,9 @@ async function loadData(includeMeta = true) {
4099
4088
  for (const file of listResult.files) {
4100
4089
  if (file.type !== "file") continue;
4101
4090
  if (!file.name.endsWith(".json")) continue;
4102
- const modelName = file.name.replace(/\.json$/, "");
4103
- const dataPath = `${MODELS_DIR}/${file.name}`;
4091
+ const fileName = file.name;
4092
+ const modelName = fileName.replace(/\.json$/, "");
4093
+ const dataPath = `${MODELS_DIR}/${fileName}`;
4104
4094
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
4105
4095
  modelName
4106
4096
  )}.meta.json`;
@@ -4120,7 +4110,11 @@ async function loadData(includeMeta = true) {
4120
4110
  fields = parsedMeta?.fields ?? [];
4121
4111
  relations = parsedMeta?.relations ?? {};
4122
4112
  }
4123
- result[modelName] = { data, fields, relations };
4113
+ result[modelName] = {
4114
+ data,
4115
+ fields,
4116
+ relations
4117
+ };
4124
4118
  }
4125
4119
  return result;
4126
4120
  }
@@ -4140,11 +4134,7 @@ var loadDataPosSessionService = (env) => {
4140
4134
  }) => {
4141
4135
  console.log("isLocalMode", isLocalMode);
4142
4136
  if (isLocalMode) {
4143
- return loadData().then((localDb) => ({
4144
- data: {
4145
- data: localDb
4146
- }
4147
- }));
4137
+ return loadData;
4148
4138
  }
4149
4139
  const jsonData = {
4150
4140
  model,
package/dist/services.mjs CHANGED
@@ -4032,18 +4032,7 @@ 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
- const exists = await fileService.exists(MODELS_DIR);
4036
- if (!exists) {
4037
- console.warn("[loadData] MODELS_DIR not exists:", MODELS_DIR);
4038
- return {};
4039
- }
4040
- let listResult;
4041
- try {
4042
- listResult = await fileService.list(MODELS_DIR);
4043
- } catch (e) {
4044
- console.error("[loadData] list failed:", e);
4045
- return {};
4046
- }
4035
+ const listResult = await fileService.list(MODELS_DIR);
4047
4036
  if (!listResult || !Array.isArray(listResult.files)) {
4048
4037
  return {};
4049
4038
  }
@@ -4051,8 +4040,9 @@ async function loadData(includeMeta = true) {
4051
4040
  for (const file of listResult.files) {
4052
4041
  if (file.type !== "file") continue;
4053
4042
  if (!file.name.endsWith(".json")) continue;
4054
- const modelName = file.name.replace(/\.json$/, "");
4055
- const dataPath = `${MODELS_DIR}/${file.name}`;
4043
+ const fileName = file.name;
4044
+ const modelName = fileName.replace(/\.json$/, "");
4045
+ const dataPath = `${MODELS_DIR}/${fileName}`;
4056
4046
  const metaPath = `${MODELS_META_DIR}/${encodeURIComponent(
4057
4047
  modelName
4058
4048
  )}.meta.json`;
@@ -4072,7 +4062,11 @@ async function loadData(includeMeta = true) {
4072
4062
  fields = parsedMeta?.fields ?? [];
4073
4063
  relations = parsedMeta?.relations ?? {};
4074
4064
  }
4075
- result[modelName] = { data, fields, relations };
4065
+ result[modelName] = {
4066
+ data,
4067
+ fields,
4068
+ relations
4069
+ };
4076
4070
  }
4077
4071
  return result;
4078
4072
  }
@@ -4092,11 +4086,7 @@ var loadDataPosSessionService = (env) => {
4092
4086
  }) => {
4093
4087
  console.log("isLocalMode", isLocalMode);
4094
4088
  if (isLocalMode) {
4095
- return loadData().then((localDb) => ({
4096
- data: {
4097
- data: localDb
4098
- }
4099
- }));
4089
+ return loadData;
4100
4090
  }
4101
4091
  const jsonData = {
4102
4092
  model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "4.2.9",
3
+ "version": "4.3.0",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",