baja-lite 1.3.29 → 1.3.31

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/boot-remote.js CHANGED
@@ -1,6 +1,5 @@
1
- import { DBType, _Hump } from 'baja-lite-field';
2
- import { getEnums } from './enum.js';
3
- import { ColumnMode, SqlCache, SqliteRemote, _GlobalSqlOption, _dao, _defOption, _enums, _primaryDB, _sqlCache, logger } from './sql.js';
1
+ import { DBType, _Hump, getEnums } from 'baja-lite-field';
2
+ import { ColumnMode, SqlCache, SqliteRemote, _GlobalSqlOption, _dao, _defOption, _enum, _primaryDB, _sqlCache, logger } from './sql.js';
4
3
  export const BootRomote = async function (options) {
5
4
  globalThis[_GlobalSqlOption] = Object.assign({}, _defOption, options);
6
5
  globalThis[_Hump] = globalThis[_GlobalSqlOption].columnMode === ColumnMode.HUMP;
@@ -13,7 +12,7 @@ export const BootRomote = async function (options) {
13
12
  [DBType.SqliteRemote]: {},
14
13
  };
15
14
  if (options.enums) {
16
- globalThis[_enums] = getEnums(options.enums);
15
+ globalThis[_enum] = getEnums(options.enums);
17
16
  }
18
17
  if (options.SqliteRemote && options.SqliteRemote.db) {
19
18
  if (typeof options.SqliteRemote.db === 'string') {
package/boot.js CHANGED
@@ -1,6 +1,5 @@
1
- import { _Hump, DBType } from 'baja-lite-field';
2
- import { getEnums } from './enum.js';
3
- import { _dao, _defOption, _enums, _EventBus, _fs, _GlobalSqlOption, _path, _primaryDB, _sqlCache, ColumnMode, logger, Mysql, Postgresql, SqlCache, Sqlite, SqliteRemote } from './sql.js';
1
+ import { _Hump, DBType, getEnums } from 'baja-lite-field';
2
+ import { _dao, _defOption, _enum, _EventBus, _fs, _GlobalSqlOption, _path, _primaryDB, _sqlCache, ColumnMode, logger, Mysql, Postgresql, SqlCache, Sqlite, SqliteRemote } from './sql.js';
4
3
  export const Boot = async function (options) {
5
4
  globalThis[_GlobalSqlOption] = Object.assign({}, _defOption, options);
6
5
  globalThis[_Hump] = globalThis[_GlobalSqlOption].columnMode === ColumnMode.HUMP;
@@ -22,7 +21,7 @@ export const Boot = async function (options) {
22
21
  [DBType.Redis]: {}
23
22
  };
24
23
  if (options.enums) {
25
- globalThis[_enums] = getEnums(options.enums);
24
+ globalThis[_enum] = getEnums(options.enums);
26
25
  }
27
26
  if (options.Mysql) {
28
27
  const { createPool } = await import('mysql2/promise');
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import 'reflect-metadata';
2
- export * from './enum.js';
3
2
  export * from './error.js';
4
3
  export * from './fn.js';
5
4
  export * from './list.js';
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import 'reflect-metadata';
2
- export * from './enum.js';
3
2
  export * from './error.js';
4
3
  export * from './fn.js';
5
4
  export * from './list.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.29",
3
+ "version": "1.3.31",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/util-man",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "@msgpack/msgpack": "3.1.1",
39
39
  "@types/request-promise": "4.1.51",
40
40
  "axios": "1.8.4",
41
- "baja-lite-field": "1.3.28",
41
+ "baja-lite-field": "1.3.31",
42
42
  "decimal.js": "10.5.0",
43
43
  "html-parse-stringify": "3.0.1",
44
44
  "iterare": "1.2.1",
package/sql.d.ts CHANGED
@@ -20,7 +20,7 @@ declare const _inTransaction: unique symbol;
20
20
  declare const _daoDB: unique symbol;
21
21
  declare const _sqliteRemoteName: unique symbol;
22
22
  declare const _SqlOption: unique symbol;
23
- export declare const _enums: unique symbol;
23
+ export declare const _enum: unique symbol;
24
24
  export declare const _GlobalSqlOption: unique symbol;
25
25
  export declare const _EventBus: unique symbol;
26
26
  export declare const _path: unique symbol;
package/sql.js CHANGED
@@ -72,7 +72,7 @@ const _sqliteRemoteName = Symbol('sqliteRemoteName');
72
72
  const _SqlOption = Symbol('SqlOption');
73
73
  const _resultMap = Symbol('resultMap');
74
74
  const _resultMap_SQLID = Symbol('resultMap_SQLID');
75
- export const _enums = Symbol('_enums');
75
+ export const _enum = Symbol('_enum');
76
76
  export const _GlobalSqlOption = Symbol('GlobalSqlOption');
77
77
  export const _EventBus = Symbol('EventBus');
78
78
  export const _path = Symbol('path');
@@ -1462,7 +1462,7 @@ class Build {
1462
1462
  if (matchs) {
1463
1463
  const [_a, MapName, Column] = matchs;
1464
1464
  if (MapName && Column) {
1465
- const map = globalThis[_enums].GlobalMap[MapName.trim()];
1465
+ const map = globalThis[_enum].EnumMap(MapName.trim());
1466
1466
  if (map) {
1467
1467
  return ` CASE
1468
1468
  ${Object.entries(map).map(([k, v]) => `WHEN ${Column} = '${k}' THEN '${v}'`).join(' ')}
package/enum.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { EnmuJson, EnumMap } from "baja-lite-field";
2
- export declare const getEnums: (GlobalValues?: EnumMap) => EnmuJson;
package/enum.js DELETED
@@ -1,31 +0,0 @@
1
- import { _enums } from "./sql.js";
2
- let configData = null;
3
- export const getEnums = (GlobalValues) => {
4
- if (!GlobalValues) {
5
- return globalThis[_enums];
6
- }
7
- if (configData) {
8
- return configData;
9
- }
10
- const result = {
11
- GlobalArray: {},
12
- GlobalMap: {}
13
- };
14
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15
- Object.keys(GlobalValues).forEach((item) => {
16
- // const guess = /([\w\W]+)_([^_]+)$/.exec(item);
17
- const guess = item.replace(new RegExp(`_${GlobalValues[item].value()}`, 'i'), '');
18
- if (guess) {
19
- if (!result.GlobalArray[guess]) {
20
- result.GlobalArray[guess] = [];
21
- }
22
- result.GlobalArray[guess].push([GlobalValues[item].value(), GlobalValues[item].desc()]);
23
- if (!result.GlobalMap[guess]) {
24
- result.GlobalMap[guess] = {};
25
- }
26
- result.GlobalMap[guess][GlobalValues[item].value()] = GlobalValues[item].desc();
27
- }
28
- });
29
- configData = result;
30
- return result;
31
- };