@powfix/core-js 0.13.23 → 0.13.24

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.
Files changed (49) hide show
  1. package/dist/src/constants/index.d.ts +1 -1
  2. package/dist/src/constants/index.js +1 -1
  3. package/dist/src/interfaces/index.d.ts +1 -1
  4. package/dist/src/interfaces/index.js +1 -1
  5. package/dist/src/managers/TransactionManager.js +1 -1
  6. package/dist/src/services/SessionService.d.ts +1 -1
  7. package/dist/src/services/time/TimeService.d.ts +1 -1
  8. package/dist/src/utils/BooleanUtils.js +2 -1
  9. package/dist/src/utils/UuidUtils.d.ts +1 -0
  10. package/dist/src/utils/global/circularDistance.js +2 -1
  11. package/dist/src/utils/global/fallbackIfEqual.js +2 -1
  12. package/dist/src/utils/global/fallbackIfNull.js +2 -1
  13. package/dist/src/utils/global/fallbackIfUndefined.js +2 -1
  14. package/dist/src/utils/global/firstNonNullish.js +2 -1
  15. package/dist/src/utils/global/processFirstNonNullish.js +2 -1
  16. package/dist/src/utils/global/pureEnum.js +4 -3
  17. package/dist/src/utils/index.d.ts +1 -1
  18. package/dist/src/utils/index.js +1 -1
  19. package/dist/src/utils/{backend → nodejs}/SequelizeUtils.d.ts +4 -3
  20. package/dist/src/utils/{backend → nodejs}/SequelizeUtils.js +17 -0
  21. package/package.json +1 -1
  22. /package/dist/src/constants/{backend → nodejs}/TransactionManagerLogLevel.d.ts +0 -0
  23. /package/dist/src/constants/{backend → nodejs}/TransactionManagerLogLevel.js +0 -0
  24. /package/dist/src/constants/{backend → nodejs}/TransactionManagerTimeoutAction.d.ts +0 -0
  25. /package/dist/src/constants/{backend → nodejs}/TransactionManagerTimeoutAction.js +0 -0
  26. /package/dist/src/constants/{backend → nodejs}/index.d.ts +0 -0
  27. /package/dist/src/constants/{backend → nodejs}/index.js +0 -0
  28. /package/dist/src/interfaces/{backend → nodejs}/db/index.d.ts +0 -0
  29. /package/dist/src/interfaces/{backend → nodejs}/db/index.js +0 -0
  30. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/Hook.d.ts +0 -0
  31. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/Hook.js +0 -0
  32. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/HookFn.d.ts +0 -0
  33. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/HookFn.js +0 -0
  34. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/HookType.d.ts +0 -0
  35. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/HookType.js +0 -0
  36. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/ReloadOption.d.ts +0 -0
  37. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/ReloadOption.js +0 -0
  38. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/TransactionOption.d.ts +0 -0
  39. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/TransactionOption.js +0 -0
  40. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/UpsertOptions.d.ts +0 -0
  41. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/UpsertOptions.js +0 -0
  42. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/index.d.ts +0 -0
  43. /package/dist/src/interfaces/{backend → nodejs}/db/sequelize/index.js +0 -0
  44. /package/dist/src/interfaces/{backend → nodejs}/index.d.ts +0 -0
  45. /package/dist/src/interfaces/{backend → nodejs}/index.js +0 -0
  46. /package/dist/src/utils/{backend → nodejs}/HookUtils.d.ts +0 -0
  47. /package/dist/src/utils/{backend → nodejs}/HookUtils.js +0 -0
  48. /package/dist/src/utils/{backend → nodejs}/index.d.ts +0 -0
  49. /package/dist/src/utils/{backend → nodejs}/index.js +0 -0
@@ -1,2 +1,2 @@
1
1
  export * from './index.browser';
2
- export * from './backend';
2
+ export * from './nodejs';
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./index.browser"), exports);
18
- __exportStar(require("./backend"), exports);
18
+ __exportStar(require("./nodejs"), exports);
@@ -1,2 +1,2 @@
1
1
  export * from './index.browser';
2
- export * from './backend';
2
+ export * from './nodejs';
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./index.browser"), exports);
18
- __exportStar(require("./backend"), exports);
18
+ __exportStar(require("./nodejs"), exports);
@@ -75,7 +75,7 @@ class TransactionManager {
75
75
  }
76
76
  }
77
77
  flush(action) {
78
- return Promise.allSettled(Array.from(this.transactionTimeoutMap.entries()).map((_a) => __awaiter(this, [_a], void 0, function* ([transaction, transactionTimeout]) {
78
+ return Promise.allSettled(Array.from(this.transactionTimeoutMap.entries()).map(([transaction, transactionTimeout]) => __awaiter(this, void 0, void 0, function* () {
79
79
  const handled = yield this.execute(transaction, action !== null && action !== void 0 ? action : transactionTimeout.action, 'flush');
80
80
  this.remove(transaction);
81
81
  return {
@@ -7,7 +7,7 @@ export declare class SessionService {
7
7
  protected storageProvider: StorageProvider;
8
8
  private emitter;
9
9
  readonly on: <T extends "AUTHORIZATION_CHANGED">(event: T, fn: (...args: EventEmitter3.ArgumentMap<SessionService.Event>[Extract<T, "AUTHORIZATION_CHANGED">]) => void, context?: any) => EventEmitter3<SessionService.Event, any>;
10
- readonly off: <T extends "AUTHORIZATION_CHANGED">(event: T, fn?: ((...args: EventEmitter3.ArgumentMap<SessionService.Event>[Extract<T, "AUTHORIZATION_CHANGED">]) => void) | undefined, context?: any, once?: boolean) => EventEmitter3<SessionService.Event, any>;
10
+ readonly off: <T extends "AUTHORIZATION_CHANGED">(event: T, fn?: ((...args: EventEmitter3.ArgumentMap<SessionService.Event>[Extract<T, "AUTHORIZATION_CHANGED">]) => void) | undefined, context?: any, once?: boolean | undefined) => EventEmitter3<SessionService.Event, any>;
11
11
  protected readonly emit: <T extends "AUTHORIZATION_CHANGED">(event: T, ...args: EventEmitter3.ArgumentMap<SessionService.Event>[Extract<T, "AUTHORIZATION_CHANGED">]) => boolean;
12
12
  constructor(options: SessionService.Options);
13
13
  private get key();
@@ -11,7 +11,7 @@ export declare class TimeService {
11
11
  private syncedAt?;
12
12
  private emitter;
13
13
  readonly on: <T extends TimeService.Event>(event: T, fn: (...args: any[]) => void, context?: any) => EventEmitter3<TimeService.Event, any>;
14
- readonly off: <T extends TimeService.Event>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean) => EventEmitter3<TimeService.Event, any>;
14
+ readonly off: <T extends TimeService.Event>(event: T, fn?: ((...args: any[]) => void) | undefined, context?: any, once?: boolean | undefined) => EventEmitter3<TimeService.Event, any>;
15
15
  private readonly emit;
16
16
  static calculateNTPResultOffset(ntpResult: TimeService.NTPResult): TimeService.Offset;
17
17
  constructor(option: TimeService.Option);
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseBoolean = parseBoolean;
3
+ exports.parseBoolean = void 0;
4
4
  function parseBoolean(value, defaultValue) {
5
5
  if (value === undefined || value === null)
6
6
  return defaultValue;
7
7
  return (value === 'true' || value === true) || (value === 1 || value === '1');
8
8
  }
9
+ exports.parseBoolean = parseBoolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  export declare class UuidUtils {
2
3
  static v4(): string;
3
4
  static format(uuid: string): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.circularDistance = circularDistance;
3
+ exports.circularDistance = void 0;
4
4
  function circularDistance(value, target, min, max) {
5
5
  const range = max - min;
6
6
  const from = value - min;
@@ -12,3 +12,4 @@ function circularDistance(value, target, min, max) {
12
12
  return range - from + to;
13
13
  }
14
14
  }
15
+ exports.circularDistance = circularDistance;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fallbackIfEqual = fallbackIfEqual;
3
+ exports.fallbackIfEqual = void 0;
4
4
  function fallbackIfEqual(value, condition, fallback) {
5
5
  if (typeof value === typeof condition && value === condition) {
6
6
  return fallback;
7
7
  }
8
8
  return value;
9
9
  }
10
+ exports.fallbackIfEqual = fallbackIfEqual;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fallbackIfNull = fallbackIfNull;
3
+ exports.fallbackIfNull = void 0;
4
4
  const fallbackIfEqual_1 = require("./fallbackIfEqual");
5
5
  function fallbackIfNull(value, fallback) {
6
6
  return (0, fallbackIfEqual_1.fallbackIfEqual)(value, null, fallback);
7
7
  }
8
+ exports.fallbackIfNull = fallbackIfNull;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fallbackIfUndefined = fallbackIfUndefined;
3
+ exports.fallbackIfUndefined = void 0;
4
4
  const fallbackIfEqual_1 = require("./fallbackIfEqual");
5
5
  function fallbackIfUndefined(value, fallback) {
6
6
  return (0, fallbackIfEqual_1.fallbackIfEqual)(value, undefined, fallback);
7
7
  }
8
+ exports.fallbackIfUndefined = fallbackIfUndefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.firstNonNullish = firstNonNullish;
3
+ exports.firstNonNullish = void 0;
4
4
  function firstNonNullish(...args) {
5
5
  if (args == null || !Array.isArray(args) || args.length === 0) {
6
6
  return undefined;
@@ -11,3 +11,4 @@ function firstNonNullish(...args) {
11
11
  }
12
12
  return firstNonNullish(...args.slice(1));
13
13
  }
14
+ exports.firstNonNullish = firstNonNullish;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processFirstNonNullish = processFirstNonNullish;
3
+ exports.processFirstNonNullish = void 0;
4
4
  const firstNonNullish_1 = require("./firstNonNullish");
5
5
  function processFirstNonNullish(processor, ...args) {
6
6
  const fallback = (0, firstNonNullish_1.firstNonNullish)(...args);
@@ -9,3 +9,4 @@ function processFirstNonNullish(processor, ...args) {
9
9
  }
10
10
  return processor(fallback);
11
11
  }
12
+ exports.processFirstNonNullish = processFirstNonNullish;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pureEnum = pureEnum;
4
- exports.pureEnumKeys = pureEnumKeys;
5
- exports.pureEnumValues = pureEnumValues;
3
+ exports.pureEnumValues = exports.pureEnumKeys = exports.pureEnum = void 0;
6
4
  function pureEnum(e) {
7
5
  return Object.entries(e).filter(([key, value]) => !/^\d+$/g.test(key) && typeof value !== 'function');
8
6
  }
7
+ exports.pureEnum = pureEnum;
9
8
  function pureEnumKeys(e) {
10
9
  return pureEnum(e).map(([key]) => key);
11
10
  }
11
+ exports.pureEnumKeys = pureEnumKeys;
12
12
  function pureEnumValues(e) {
13
13
  return pureEnum(e).map(([, value]) => value);
14
14
  }
15
+ exports.pureEnumValues = pureEnumValues;
@@ -1,2 +1,2 @@
1
1
  export * from './index.browser';
2
- export * from './backend';
2
+ export * from './nodejs';
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./index.browser"), exports);
18
- __exportStar(require("./backend"), exports);
18
+ __exportStar(require("./nodejs"), exports);
@@ -1,4 +1,4 @@
1
- import { ModelAttributeColumnOptions } from "sequelize";
1
+ import { ModelAttributeColumnOptions, WhereOptions } from "sequelize";
2
2
  interface UuidColumnOptions extends Omit<ModelAttributeColumnOptions, 'type'> {
3
3
  columnName: string;
4
4
  }
@@ -28,10 +28,11 @@ export type UuidKeys<Model> = ExtractUuidKeys<Model>;
28
28
  export declare class SequelizeUtils {
29
29
  static decimal2Number(value: any): number | null | undefined;
30
30
  static getPrimaryUuidColumn: () => Partial<ModelAttributeColumnOptions>;
31
- static getForeignUuidColumn: <Model = never, AdditionalKeys extends Exclude<ExtractAdditionalKeys<Model>, UuidKeys<Model>> = never>({ columnName, allowNull }: {
32
- columnName: Model extends undefined ? string : (UuidKeys<Model> | AdditionalKeys);
31
+ static getForeignUuidColumn: <Model = never, AdditionalKeys extends Exclude<ExtractAdditionalKeys<Model>, { [Property in keyof Model]: Property extends GetIncludeKeyPatterns<Model> ? Property : never; }[keyof Model]> = never>({ columnName, allowNull }: {
32
+ columnName: Model extends undefined ? string : AdditionalKeys | { [Property in keyof Model]: Property extends GetIncludeKeyPatterns<Model> ? Property : never; }[keyof Model];
33
33
  allowNull: boolean;
34
34
  }) => Partial<ModelAttributeColumnOptions>;
35
35
  static getUuidColumn: ({ columnName, ...overrideOptions }: UuidColumnOptions) => Partial<ModelAttributeColumnOptions>;
36
+ static getNullableArrayFilter<T = undefined>(arr: (null | any)[]): WhereOptions<T>;
36
37
  }
37
38
  export {};
@@ -12,7 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.SequelizeUtils = void 0;
15
+ const sequelize_1 = require("sequelize");
15
16
  const UuidUtils_1 = require("../UuidUtils");
17
+ const constants_1 = require("../../constants");
16
18
  class SequelizeUtils {
17
19
  static decimal2Number(value) {
18
20
  if (value === null || value === undefined) {
@@ -24,6 +26,21 @@ class SequelizeUtils {
24
26
  }
25
27
  return parsed;
26
28
  }
29
+ static getNullableArrayFilter(arr) {
30
+ return {
31
+ [sequelize_1.Op.or]: arr.map(value => {
32
+ if (value === null) {
33
+ return { [sequelize_1.Op.is]: value };
34
+ }
35
+ else if (value === constants_1.NOT_NULL) {
36
+ return { [sequelize_1.Op.not]: null };
37
+ }
38
+ else {
39
+ return { [sequelize_1.Op.eq]: value };
40
+ }
41
+ })
42
+ };
43
+ }
27
44
  }
28
45
  exports.SequelizeUtils = SequelizeUtils;
29
46
  SequelizeUtils.getPrimaryUuidColumn = () => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.13.23",
3
+ "version": "0.13.24",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,
File without changes
File without changes
File without changes
File without changes