@powfix/core-js 0.11.11 → 0.12.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.
@@ -0,0 +1,4 @@
1
+ export * from './Coordinate';
2
+ export * from './Point2';
3
+ export * from './Point3';
4
+ export * from './StorageProvider';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Coordinate"), exports);
18
+ __exportStar(require("./Point2"), exports);
19
+ __exportStar(require("./Point3"), exports);
20
+ __exportStar(require("./StorageProvider"), exports);
@@ -0,0 +1,8 @@
1
+ import { ModelCtor } from "sequelize-typescript";
2
+ import { HookType } from "./HookType";
3
+ import { HookFn } from "./HookFn";
4
+ export interface Hook {
5
+ model: ModelCtor;
6
+ hookType: HookType;
7
+ fn: HookFn;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { Hooks, SequelizeHooks } from "sequelize/types/hooks";
2
+ import { Attributes, CreationAttributes } from "sequelize/types/model";
3
+ import { HookType } from "./HookType";
4
+ export type HookFn = SequelizeHooks<Hooks['_model'], Attributes<Hooks>, CreationAttributes<Hooks>>[HookType];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { Hooks, SequelizeHooks } from "sequelize/types/hooks";
2
+ import { Attributes, CreationAttributes } from "sequelize/types/model";
3
+ export type HookType = keyof SequelizeHooks<Hooks['_model'], Attributes<Hooks>, CreationAttributes<Hooks>>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './Hook';
2
+ export * from './HookFn';
3
+ export * from './HookType';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Hook"), exports);
18
+ __exportStar(require("./HookFn"), exports);
19
+ __exportStar(require("./HookType"), exports);
@@ -1,4 +1,2 @@
1
- export * from './Coordinate';
2
- export * from './Point2';
3
- export * from './Point3';
4
- export * from './StorageProvider';
1
+ export * from './browser';
2
+ export * from './db';
@@ -14,7 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Coordinate"), exports);
18
- __exportStar(require("./Point2"), exports);
19
- __exportStar(require("./Point3"), exports);
20
- __exportStar(require("./StorageProvider"), exports);
17
+ __exportStar(require("./browser"), exports);
18
+ __exportStar(require("./db"), exports);
@@ -36,6 +36,11 @@ class TimeService {
36
36
  if (option.autoStart) {
37
37
  this.start();
38
38
  }
39
+ // Bind
40
+ this.sync = this.sync.bind(this);
41
+ this.start = this.start.bind(this);
42
+ this.stop = this.stop.bind(this);
43
+ this.fetchServerNTPResult = this.fetchServerNTPResult.bind(this);
39
44
  }
40
45
  getOption() {
41
46
  return this.option;
@@ -0,0 +1,13 @@
1
+ import { Hook, HookFn } from "../../interfaces";
2
+ import { ModelCtor } from "sequelize-typescript";
3
+ export declare class HookUtils {
4
+ static getFkChanges<T>(pFkValue: T | null | undefined, cFkValue: T | null | undefined): {
5
+ pFkValue: T | null;
6
+ cFkValue: T | null;
7
+ };
8
+ static makeModelHooks(model: ModelCtor, fns: {
9
+ create: HookFn;
10
+ update: HookFn;
11
+ destroy: HookFn;
12
+ }): Hook[];
13
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HookUtils = void 0;
4
+ class HookUtils {
5
+ static getFkChanges(pFkValue, cFkValue) {
6
+ const results = { pFkValue: null, cFkValue: null };
7
+ if (pFkValue !== undefined && cFkValue !== undefined) {
8
+ if (pFkValue !== cFkValue) {
9
+ if (pFkValue !== null) {
10
+ results.pFkValue = pFkValue;
11
+ }
12
+ }
13
+ }
14
+ if (cFkValue !== null && cFkValue !== undefined) {
15
+ results.cFkValue = cFkValue;
16
+ }
17
+ return results;
18
+ }
19
+ static makeModelHooks(model, fns) {
20
+ return [
21
+ { model, hookType: 'afterCreate', fn: fns.create },
22
+ { model, hookType: 'afterBulkCreate', fn: fns.create },
23
+ { model, hookType: 'afterUpdate', fn: fns.update },
24
+ { model, hookType: 'afterBulkUpdate', fn: fns.update },
25
+ { model, hookType: 'afterDestroy', fn: fns.destroy },
26
+ { model, hookType: 'afterBulkDestroy', fn: fns.destroy },
27
+ ];
28
+ }
29
+ }
30
+ exports.HookUtils = HookUtils;
@@ -0,0 +1,3 @@
1
+ export declare class SequelizeUtils {
2
+ static decimal2Number(value: any): number | null | undefined;
3
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SequelizeUtils = void 0;
4
+ class SequelizeUtils {
5
+ static decimal2Number(value) {
6
+ if (value === null || value === undefined) {
7
+ return value;
8
+ }
9
+ const parsed = Number(value);
10
+ if (isNaN(parsed)) {
11
+ throw new Error(`value(typeof=${typeof value}, value=${value}) iNaN(is not number)`);
12
+ }
13
+ return parsed;
14
+ }
15
+ }
16
+ exports.SequelizeUtils = SequelizeUtils;
@@ -0,0 +1 @@
1
+ export * from './SequelizeUtils';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SequelizeUtils"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './base';
2
+ export * from './HookUtils';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./base"), exports);
18
+ __exportStar(require("./HookUtils"), exports);
@@ -0,0 +1,15 @@
1
+ export * from './global';
2
+ export * from './ArrayUtils';
3
+ export * from './AxiosUtils';
4
+ export * from './StringUtils';
5
+ export * from './UuidUtils';
6
+ export * from './BooleanUtils';
7
+ export * from './CoordinateUtils';
8
+ export * from './DateUtils';
9
+ export * from './NumberUtils';
10
+ export * from './ObjectIdUtils';
11
+ export * from './Point3Utils';
12
+ export * from './RandomUtils';
13
+ export * from './Validator';
14
+ export * from './JuminNumberUtils';
15
+ export * from './Sequencer';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./global"), exports);
18
+ __exportStar(require("./ArrayUtils"), exports);
19
+ __exportStar(require("./AxiosUtils"), exports);
20
+ __exportStar(require("./StringUtils"), exports);
21
+ __exportStar(require("./UuidUtils"), exports);
22
+ __exportStar(require("./BooleanUtils"), exports);
23
+ __exportStar(require("./CoordinateUtils"), exports);
24
+ __exportStar(require("./DateUtils"), exports);
25
+ __exportStar(require("./NumberUtils"), exports);
26
+ __exportStar(require("./ObjectIdUtils"), exports);
27
+ __exportStar(require("./Point3Utils"), exports);
28
+ __exportStar(require("./RandomUtils"), exports);
29
+ __exportStar(require("./Validator"), exports);
30
+ __exportStar(require("./JuminNumberUtils"), exports);
31
+ __exportStar(require("./Sequencer"), exports);
@@ -1,15 +1,2 @@
1
- export * from './global';
2
- export * from './ArrayUtils';
3
- export * from './AxiosUtils';
4
- export * from './StringUtils';
5
- export * from './UuidUtils';
6
- export * from './BooleanUtils';
7
- export * from './CoordinateUtils';
8
- export * from './DateUtils';
9
- export * from './NumberUtils';
10
- export * from './ObjectIdUtils';
11
- export * from './Point3Utils';
12
- export * from './RandomUtils';
13
- export * from './Validator';
14
- export * from './JuminNumberUtils';
15
- export * from './Sequencer';
1
+ export * from './browser';
2
+ export * from './backend';
@@ -14,18 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./global"), exports);
18
- __exportStar(require("./ArrayUtils"), exports);
19
- __exportStar(require("./AxiosUtils"), exports);
20
- __exportStar(require("./StringUtils"), exports);
21
- __exportStar(require("./UuidUtils"), exports);
22
- __exportStar(require("./BooleanUtils"), exports);
23
- __exportStar(require("./CoordinateUtils"), exports);
24
- __exportStar(require("./DateUtils"), exports);
25
- __exportStar(require("./NumberUtils"), exports);
26
- __exportStar(require("./ObjectIdUtils"), exports);
27
- __exportStar(require("./Point3Utils"), exports);
28
- __exportStar(require("./RandomUtils"), exports);
29
- __exportStar(require("./Validator"), exports);
30
- __exportStar(require("./JuminNumberUtils"), exports);
31
- __exportStar(require("./Sequencer"), exports);
17
+ __exportStar(require("./browser"), exports);
18
+ __exportStar(require("./backend"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powfix/core-js",
3
- "version": "0.11.11",
3
+ "version": "0.12.1",
4
4
  "description": "core package",
5
5
  "author": "Kwon Kyung-Min <powfix@gmail.com>",
6
6
  "private": false,
@@ -37,6 +37,8 @@
37
37
  "@types/uuid": "9.0.7",
38
38
  "axios": "1.7.9",
39
39
  "moment": "^2.30.1",
40
+ "sequelize": "^6.37.6",
41
+ "sequelize-typescript": "^2.1.6",
40
42
  "ts-node": "^10.9.2",
41
43
  "typescript": "5.1.6"
42
44
  },