baja-lite 1.3.28 → 1.3.30

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,5 +1,4 @@
1
- import { DBType, _Hump } from 'baja-lite-field';
2
- import { getEnums } from './enum.js';
1
+ import { DBType, _Hump, getEnums } from 'baja-lite-field';
3
2
  import { ColumnMode, SqlCache, SqliteRemote, _GlobalSqlOption, _dao, _defOption, _enums, _primaryDB, _sqlCache, logger } from './sql.js';
4
3
  export const BootRomote = async function (options) {
5
4
  globalThis[_GlobalSqlOption] = Object.assign({}, _defOption, options);
package/boot.js CHANGED
@@ -1,5 +1,4 @@
1
- import { _Hump, DBType } from 'baja-lite-field';
2
- import { getEnums } from './enum.js';
1
+ import { _Hump, DBType, getEnums } from 'baja-lite-field';
3
2
  import { _dao, _defOption, _enums, _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);
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.28",
3
+ "version": "1.3.30",
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.27",
41
+ "baja-lite-field": "1.3.30",
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
@@ -1,7 +1,6 @@
1
1
  import { ExtensionCodec } from "@msgpack/msgpack";
2
- import { _columns, _columnsNoId, _def, _deleteState, _fields, _ids, _index, _logicIds, _stateFileName, AField, DBType, FieldOption } from 'baja-lite-field';
2
+ import { _columns, _columnsNoId, _def, _deleteState, _fields, _ids, _index, _logicIds, _stateFileName, AField, DBType, EnumMap, FieldOption } from 'baja-lite-field';
3
3
  import { XML } from './convert-xml.js';
4
- import { EnumMap } from './enum.js';
5
4
  import { ArrayList } from './list.js';
6
5
  export declare const extensionCodec: ExtensionCodec<undefined>;
7
6
  declare const _daoDBName: unique symbol;
package/enum.d.ts DELETED
@@ -1,18 +0,0 @@
1
- export declare class Enum {
2
- private _value;
3
- private _desc;
4
- private _config;
5
- constructor(value: string, desc: string, ...config: string[]);
6
- eq(value: string | number | undefined | null): boolean;
7
- value(): string;
8
- desc(): string;
9
- config(): string[];
10
- }
11
- export type EnumMap = Record<string, Enum>;
12
- export type GlobalArray = Record<string, Array<[string, string]>>;
13
- export type GlobalMap = Record<string, Record<string, string>>;
14
- export interface EnmuJson {
15
- GlobalArray: GlobalArray;
16
- GlobalMap: GlobalMap;
17
- }
18
- export declare const getEnums: (GlobalValues?: EnumMap) => EnmuJson;
package/enum.js DELETED
@@ -1,59 +0,0 @@
1
- import { _enums } from "./sql.js";
2
- export class Enum {
3
- constructor(value, desc, ...config) {
4
- this._value = value;
5
- this._desc = desc;
6
- this._config = config;
7
- }
8
- eq(value) {
9
- if (value === undefined) {
10
- return false;
11
- }
12
- if (value === null) {
13
- return false;
14
- }
15
- if (typeof value === 'number') {
16
- return this._value === `${value}`;
17
- }
18
- return this._value === `${value}`;
19
- }
20
- value() {
21
- return this._value;
22
- }
23
- desc() {
24
- return this._desc;
25
- }
26
- config() {
27
- return this._config;
28
- }
29
- }
30
- let configData = null;
31
- export const getEnums = (GlobalValues) => {
32
- if (!GlobalValues) {
33
- return globalThis[_enums];
34
- }
35
- if (configData) {
36
- return configData;
37
- }
38
- const result = {
39
- GlobalArray: {},
40
- GlobalMap: {}
41
- };
42
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
43
- Object.keys(GlobalValues).forEach((item) => {
44
- // const guess = /([\w\W]+)_([^_]+)$/.exec(item);
45
- const guess = item.replace(new RegExp(`_${GlobalValues[item].value()}`, 'i'), '');
46
- if (guess) {
47
- if (!result.GlobalArray[guess]) {
48
- result.GlobalArray[guess] = [];
49
- }
50
- result.GlobalArray[guess].push([GlobalValues[item].value(), GlobalValues[item].desc()]);
51
- if (!result.GlobalMap[guess]) {
52
- result.GlobalMap[guess] = {};
53
- }
54
- result.GlobalMap[guess][GlobalValues[item].value()] = GlobalValues[item].desc();
55
- }
56
- });
57
- configData = result;
58
- return result;
59
- };