sonamu 0.0.3 → 0.0.4

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 (73) hide show
  1. package/package.json +1 -1
  2. package/dist/database/f9-base-model.d.ts +0 -39
  3. package/dist/database/f9-base-model.d.ts.map +0 -1
  4. package/dist/database/f9-base-model.js +0 -229
  5. package/dist/database/f9-base-model.js.map +0 -1
  6. package/dist/database/f9-db.d.ts +0 -23
  7. package/dist/database/f9-db.d.ts.map +0 -1
  8. package/dist/database/f9-db.js +0 -109
  9. package/dist/database/f9-db.js.map +0 -1
  10. package/dist/exceptions/exceptions.d.ts +0 -48
  11. package/dist/exceptions/exceptions.d.ts.map +0 -1
  12. package/dist/exceptions/exceptions.js +0 -105
  13. package/dist/exceptions/exceptions.js.map +0 -1
  14. package/dist/exceptions/f9-exception.d.ts +0 -48
  15. package/dist/exceptions/f9-exception.d.ts.map +0 -1
  16. package/dist/exceptions/f9-exception.js +0 -105
  17. package/dist/exceptions/f9-exception.js.map +0 -1
  18. package/dist/exceptions/index.d.ts +0 -3
  19. package/dist/exceptions/index.d.ts.map +0 -1
  20. package/dist/exceptions/index.js +0 -19
  21. package/dist/exceptions/index.js.map +0 -1
  22. package/dist/f9-md/f9-md.d.ts +0 -29
  23. package/dist/f9-md/f9-md.d.ts.map +0 -1
  24. package/dist/f9-md/f9-md.js +0 -148
  25. package/dist/f9-md/f9-md.js.map +0 -1
  26. package/dist/f9-md/index.d.ts +0 -5
  27. package/dist/f9-md/index.d.ts.map +0 -1
  28. package/dist/f9-md/index.js +0 -21
  29. package/dist/f9-md/index.js.map +0 -1
  30. package/dist/f9-md/md-utils.d.ts +0 -55
  31. package/dist/f9-md/md-utils.d.ts.map +0 -1
  32. package/dist/f9-md/md-utils.js +0 -104
  33. package/dist/f9-md/md-utils.js.map +0 -1
  34. package/dist/f9-md/migrator.d.ts +0 -79
  35. package/dist/f9-md/migrator.d.ts.map +0 -1
  36. package/dist/f9-md/migrator.js +0 -1084
  37. package/dist/f9-md/migrator.js.map +0 -1
  38. package/dist/f9-md/model-definition.d.ts +0 -40
  39. package/dist/f9-md/model-definition.d.ts.map +0 -1
  40. package/dist/f9-md/model-definition.js +0 -409
  41. package/dist/f9-md/model-definition.js.map +0 -1
  42. package/dist/templates/bridge.template.d.ts +0 -17
  43. package/dist/templates/bridge.template.d.ts.map +0 -1
  44. package/dist/templates/bridge.template.js +0 -79
  45. package/dist/templates/bridge.template.js.map +0 -1
  46. package/dist/templates/md.template.d.ts +0 -17
  47. package/dist/templates/md.template.d.ts.map +0 -1
  48. package/dist/templates/md.template.js +0 -45
  49. package/dist/templates/md.template.js.map +0 -1
  50. package/dist/testing/f9-fixture-manager.d.ts +0 -16
  51. package/dist/testing/f9-fixture-manager.d.ts.map +0 -1
  52. package/dist/testing/f9-fixture-manager.js +0 -211
  53. package/dist/testing/f9-fixture-manager.js.map +0 -1
  54. package/dist/types/index.d.ts +0 -2
  55. package/dist/types/index.d.ts.map +0 -1
  56. package/dist/types/index.js +0 -18
  57. package/dist/types/index.js.map +0 -1
  58. package/dist/types/shared.d.ts +0 -725
  59. package/dist/types/shared.d.ts.map +0 -1
  60. package/dist/types/shared.js +0 -288
  61. package/dist/types/shared.js.map +0 -1
  62. package/dist/utils/f9-cache.d.ts +0 -1
  63. package/dist/utils/f9-cache.d.ts.map +0 -1
  64. package/dist/utils/f9-cache.js +0 -113
  65. package/dist/utils/f9-cache.js.map +0 -1
  66. package/dist/utils/index.d.ts +0 -4
  67. package/dist/utils/index.d.ts.map +0 -1
  68. package/dist/utils/index.js +0 -20
  69. package/dist/utils/index.js.map +0 -1
  70. package/dist/utils/tf-utils.d.ts +0 -6
  71. package/dist/utils/tf-utils.d.ts.map +0 -1
  72. package/dist/utils/tf-utils.js +0 -67
  73. package/dist/utils/tf-utils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"f9-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/f9-exception.ts"],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0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TargetNotFoundException = exports.DuplicateRowException = exports.AlreadyProcessedException = exports.InternalServerErrorException = exports.ServiceUnavailableException = exports.NotFoundException = exports.UnauthorizedException = exports.BadRequestException = exports.isF9Exception = exports.F9Exception = void 0;
4
- class F9Exception extends Error {
5
- constructor(statusCode, message, payload) {
6
- super(message);
7
- this.statusCode = statusCode;
8
- this.message = message;
9
- this.payload = payload;
10
- }
11
- }
12
- exports.F9Exception = F9Exception;
13
- function isF9Exception(err) {
14
- return err.statusCode !== undefined;
15
- }
16
- exports.isF9Exception = isF9Exception;
17
- /*
18
- 잘못된 매개변수 등 요청사항에 문제가 있는 경우
19
- */
20
- class BadRequestException extends F9Exception {
21
- constructor(message = "Bad Request", payload) {
22
- super(400, message, payload);
23
- this.message = message;
24
- this.payload = payload;
25
- }
26
- }
27
- exports.BadRequestException = BadRequestException;
28
- /*
29
- 로그인이 반드시 필요한 케이스에 로그아웃 상태인 경우 / 접근 권한이 없는 요청시
30
- */
31
- class UnauthorizedException extends F9Exception {
32
- constructor(message = "Unauthorized", payload) {
33
- super(401, message, payload);
34
- this.message = message;
35
- this.payload = payload;
36
- }
37
- }
38
- exports.UnauthorizedException = UnauthorizedException;
39
- /*
40
- 존재하지 않는 레코드에 접근시
41
- */
42
- class NotFoundException extends F9Exception {
43
- constructor(message = "Not Found", payload) {
44
- super(404, message, payload);
45
- this.message = message;
46
- this.payload = payload;
47
- }
48
- }
49
- exports.NotFoundException = NotFoundException;
50
- /*
51
- 현재 상태에서 처리가 불가능한 케이스
52
- */
53
- class ServiceUnavailableException extends F9Exception {
54
- constructor(message = "Service Unavailable", payload) {
55
- super(503, message, payload);
56
- this.message = message;
57
- this.payload = payload;
58
- }
59
- }
60
- exports.ServiceUnavailableException = ServiceUnavailableException;
61
- /*
62
- 내부 처리 로직 (외부 API 콜 포함) 오류 발생시
63
- */
64
- class InternalServerErrorException extends F9Exception {
65
- constructor(message = "Internal Server Error", payload) {
66
- super(500, message, payload);
67
- this.message = message;
68
- this.payload = payload;
69
- }
70
- }
71
- exports.InternalServerErrorException = InternalServerErrorException;
72
- /*
73
- 이미 처리함
74
- */
75
- class AlreadyProcessedException extends F9Exception {
76
- constructor(message = "Already Processed", payload) {
77
- super(641, message, payload);
78
- this.message = message;
79
- this.payload = payload;
80
- }
81
- }
82
- exports.AlreadyProcessedException = AlreadyProcessedException;
83
- /*
84
- 중복 허용하지 않는 케이스에 중복 요청
85
- */
86
- class DuplicateRowException extends F9Exception {
87
- constructor(message = "Duplicate Row", payload) {
88
- super(642, message, payload);
89
- this.message = message;
90
- this.payload = payload;
91
- }
92
- }
93
- exports.DuplicateRowException = DuplicateRowException;
94
- /*
95
- 뭔가를 하려고 했으나 대상이 없음
96
- */
97
- class TargetNotFoundException extends F9Exception {
98
- constructor(message = "Target Not Found", payload) {
99
- super(620, message, payload);
100
- this.message = message;
101
- this.payload = payload;
102
- }
103
- }
104
- exports.TargetNotFoundException = TargetNotFoundException;
105
- //# sourceMappingURL=f9-exception.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"f9-exception.js","sourceRoot":"","sources":["../../src/exceptions/f9-exception.ts"],"names":[],"mappings":";;;AAAA,MAAsB,WAAY,SAAQ,KAAK;IAC7C,YACkB,UAAkB,EAC3B,OAAe,EACf,OAAiB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,eAAU,GAAV,UAAU,CAAQ;QAC3B,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAU;IAG1B,CAAC;CACF;AARD,kCAQC;AAED,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC;AACtC,CAAC;AAFD,sCAEC;AAED;;EAEE;AACF,MAAa,mBAAoB,SAAQ,WAAW;IAClD,YAAmB,UAAU,aAAa,EAAS,OAAiB;QAClE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OA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QAAS,YAAO,GAAP,OAAO,CAAU;IAE1E,CAAC;CACF;AAJD,8DAIC;AAED;;EAEE;AACF,MAAa,qBAAsB,SAAQ,WAAW;IACpD,YAAmB,UAAU,eAAe,EAAS,OAAiB;QACpE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QADZ,YAAO,GAAP,OAAO,CAAkB;QAAS,YAAO,GAAP,OAAO,CAAU;IAEtE,CAAC;CACF;AAJD,sDAIC;AAED;;EAEE;AACF,MAAa,uBAAwB,SAAQ,WAAW;IACtD,YAAmB,UAAU,kBAAkB,EAAS,OAAiB;QACvE,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QADZ,YAAO,GAAP,OAAO,CAAqB;QAAS,YAAO,GAAP,OAAO,CAAU;IAEzE,CAAC;CACF;AAJD,0DAIC"}
@@ -1,3 +0,0 @@
1
- export * from "./error-handler";
2
- export * from "./f9-exception";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -1,19 +0,0 @@
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("./error-handler"), exports);
18
- __exportStar(require("./f9-exception"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAA+B"}
@@ -1,29 +0,0 @@
1
- import { ModelDefinition } from "./model-definition";
2
- import { MDInput } from "../types/shared";
3
- export declare type MDNamesRecord = Record<"fs" | "fsPlural" | "camel" | "camelPlural" | "capital" | "capitalPlural" | "upper" | "constant", string>;
4
- declare type TableSpec = {
5
- name: string;
6
- uniqueColumns: string[];
7
- };
8
- declare class F9MDClass {
9
- private MDs;
10
- private modulePaths;
11
- private tableSpecs;
12
- isAutoloaded: boolean;
13
- autoload(doSilent?: boolean): Promise<unknown>;
14
- validateAll(): void;
15
- register(mdInput: MDInput<string>): void;
16
- get(mdId: string): ModelDefinition;
17
- exists(mdId: string): boolean;
18
- getAllIds(): string[];
19
- getAllParentIds(): string[];
20
- getChildrenIds(parentId: string): string[];
21
- setModulePath(key: string, modulePath: string): void;
22
- getModulePath(key: string): string;
23
- setTableSpec(tableSpec: TableSpec): void;
24
- getTableSpec(key: string): TableSpec;
25
- getNamesFromId(mdId: string): MDNamesRecord;
26
- }
27
- export declare const F9MD: F9MDClass;
28
- export {};
29
- //# sourceMappingURL=f9-md.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"f9-md.d.ts","sourceRoot":"","sources":["../../src/f9-md/f9-md.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,oBAAY,aAAa,GAAG,MAAM,CAC9B,IAAI,GACJ,UAAU,GACV,OAAO,GACP,aAAa,GACb,SAAS,GACT,eAAe,GACf,OAAO,GACP,UAAU,EACZ,MAAM,CACP,CAAC;AACF,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AACF,cAAM,SAAS;IACb,OAAO,CAAC,GAAG,CAA2C;IACtD,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,UAAU,CAAqC;IAChD,YAAY,EAAE,OAAO,CAAS;IAG/B,QAAQ,CAAC,QAAQ,GAAE,OAAe;IAiCxC,WAAW;IAOX,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI;IAKxC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;IASlC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK7B,SAAS,IAAI,MAAM,EAAE;IAIrB,eAAe,IAAI,MAAM,EAAE;IAO3B,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAO1C,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAKpD,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IASlC,YAAY,CAAC,SAAS,EAAE,SAAS;IAIjC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IASpC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;CAY5C;AAED,eAAO,MAAM,IAAI,WAAkB,CAAC"}
@@ -1,148 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.F9MD = void 0;
39
- const chalk_1 = __importDefault(require("chalk"));
40
- const glob_1 = require("glob");
41
- const inflection_1 = require("inflection");
42
- const path_1 = __importDefault(require("path"));
43
- const model_definition_1 = require("./model-definition");
44
- const syncer_1 = require("../syncer/syncer");
45
- class F9MDClass {
46
- constructor() {
47
- this.MDs = new Map();
48
- this.modulePaths = new Map();
49
- this.tableSpecs = new Map();
50
- this.isAutoloaded = false;
51
- }
52
- // 경로 전달받아 모든 ModelDefinition 파일 로드
53
- autoload(doSilent = false) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- if (this.isAutoloaded) {
56
- return;
57
- }
58
- const pathPattern = path_1.default.join(syncer_1.Syncer.getInstance().config.appRootPath, "/dist/application/**/*.md.js");
59
- !doSilent && console.log(chalk_1.default.yellow(`autoload ${pathPattern}`));
60
- return new Promise((resolve) => {
61
- (0, glob_1.glob)(path_1.default.resolve(pathPattern), (_err, files) => {
62
- const importPaths = files.map((filePath) => path_1.default.relative(__dirname, filePath));
63
- Promise.all(importPaths.map((importPath) => __awaiter(this, void 0, void 0, function* () {
64
- const imported = yield Promise.resolve().then(() => __importStar(require(importPath)));
65
- Object.values(imported).map((mdInput) => this.register(mdInput));
66
- return imported;
67
- }))).then(() => {
68
- this.validateAll();
69
- resolve("ok");
70
- this.isAutoloaded = true;
71
- });
72
- });
73
- });
74
- });
75
- }
76
- // props, subsets, params 검증
77
- validateAll() {
78
- // Array.from(this.MDs.keys()).map((mdId) => {
79
- // const md = this.get(mdId);
80
- // md.validateSelf();
81
- // });
82
- }
83
- register(mdInput) {
84
- const md = new model_definition_1.ModelDefinition(mdInput);
85
- this.MDs.set(mdInput.id, md);
86
- }
87
- get(mdId) {
88
- const md = this.MDs.get(mdId);
89
- if (md === undefined) {
90
- throw new Error(`존재하지 않는 MD 요청 ${mdId}`);
91
- }
92
- return md;
93
- }
94
- exists(mdId) {
95
- const md = this.MDs.get(mdId);
96
- return md !== undefined;
97
- }
98
- getAllIds() {
99
- return Array.from(exports.F9MD.MDs.keys());
100
- }
101
- getAllParentIds() {
102
- return this.getAllIds().filter((mdId) => {
103
- const md = this.get(mdId);
104
- return md.parentId === undefined;
105
- });
106
- }
107
- getChildrenIds(parentId) {
108
- return this.getAllIds().filter((mdId) => {
109
- const md = this.get(mdId);
110
- return md.parentId === parentId;
111
- });
112
- }
113
- setModulePath(key, modulePath) {
114
- // console.debug(chalk.cyan(`setModulePath :: ${key} :: ${modulePath}`));
115
- this.modulePaths.set(key, modulePath);
116
- }
117
- getModulePath(key) {
118
- const modulePath = this.modulePaths.get(key);
119
- if (modulePath === undefined) {
120
- throw new Error(`존재하지 않는 모듈 패스 요청 ${key}`);
121
- }
122
- return modulePath;
123
- }
124
- setTableSpec(tableSpec) {
125
- this.tableSpecs.set(tableSpec.name, tableSpec);
126
- }
127
- getTableSpec(key) {
128
- const tableSpec = this.tableSpecs.get(key);
129
- if (tableSpec === undefined) {
130
- throw new Error(`존재하지 않는 테이블 스펙 요청 ${key}`);
131
- }
132
- return tableSpec;
133
- }
134
- getNamesFromId(mdId) {
135
- return {
136
- fs: (0, inflection_1.dasherize)((0, inflection_1.underscore)(mdId)).toLowerCase(),
137
- fsPlural: (0, inflection_1.dasherize)((0, inflection_1.underscore)((0, inflection_1.pluralize)(mdId))).toLowerCase(),
138
- camel: (0, inflection_1.camelize)(mdId, true),
139
- camelPlural: (0, inflection_1.pluralize)((0, inflection_1.camelize)(mdId, true)),
140
- capital: mdId,
141
- capitalPlural: (0, inflection_1.pluralize)(mdId),
142
- upper: mdId.toUpperCase(),
143
- constant: (0, inflection_1.underscore)(mdId).toUpperCase(),
144
- };
145
- }
146
- }
147
- exports.F9MD = new F9MDClass();
148
- //# sourceMappingURL=f9-md.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"f9-md.js","sourceRoot":"","sources":["../../src/f9-md/f9-md.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+BAA4B;AAC5B,2CAAwE;AAExE,gDAAwB;AACxB,yDAAqD;AAErD,6CAA0C;AAiB1C,MAAM,SAAS;IAAf;QACU,QAAG,GAAiC,IAAI,GAAG,EAAE,CAAC;QAC9C,gBAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC7C,eAAU,GAA2B,IAAI,GAAG,EAAE,CAAC;QAChD,iBAAY,GAAY,KAAK,CAAC;IAuHvC,CAAC;IArHC,mCAAmC;IAC7B,QAAQ,CAAC,WAAoB,KAAK;;YACtC,IAAI,IAAI,CAAC,YAAY,EAAE;gBACrB,OAAO;aACR;YACD,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAC3B,eAAM,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,WAAW,EACvC,8BAA8B,CAC/B,CAAC;YACF,CAAC,QAAQ,IAA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
3
- export * from "./migrator";
4
- export * from "./model-definition";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/f9-md/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
@@ -1,21 +0,0 @@
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("../smd/smd-manager"), exports);
18
- __exportStar(require("./md-utils"), exports);
19
- __exportStar(require("./migrator"), exports);
20
- __exportStar(require("./model-definition"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/f9-md/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,6CAA2B;AAC3B,6CAA2B;AAC3B,qDAAmC"}
@@ -1,55 +0,0 @@
1
- import { BelongsToOneRelationProp, BigIntegerProp, BooleanProp, DateProp, DateTimeProp, DecimalProp, DistributiveOmit, DoubleProp, EnumProp, FloatProp, HasManyRelationProp, IntegerProp, JsonProp, ManyToManyRelationProp, OneToOneRelationProp, StringProp, TextProp, TimeProp, TimestampProp, UuidProp, VirtualProp } from "../types/shared";
2
- export declare const p: {
3
- integer: typeof integer;
4
- bigInteger: typeof bigInteger;
5
- text: typeof text;
6
- string: typeof string;
7
- float: typeof float;
8
- double: typeof double;
9
- decimal: typeof decimal;
10
- boolean: typeof boolean;
11
- date: typeof date;
12
- dateTime: typeof dateTime;
13
- time: typeof time;
14
- timestamp: typeof timestamp;
15
- json: typeof json;
16
- uuid: typeof uuid;
17
- enums: typeof enums;
18
- virtual: typeof virtual;
19
- relationOneToOne: typeof relationOneToOne;
20
- relationBelongsToOne: typeof relationBelongsToOne;
21
- relationHasMany: typeof relationHasMany;
22
- relationManyToMany: typeof relationManyToMany;
23
- };
24
- declare function integer(name: string, option?: Omit<IntegerProp, "name" | "type">): IntegerProp;
25
- declare function bigInteger(name: string, option?: Omit<BigIntegerProp, "name" | "type">): BigIntegerProp;
26
- declare function text(name: string, option: Omit<TextProp, "name" | "type">): TextProp;
27
- declare function string(name: string, option: Omit<StringProp, "name" | "type">): StringProp;
28
- declare function float(name: string, option?: Omit<FloatProp, "name" | "type">): FloatProp;
29
- declare function double(name: string, option?: Omit<DoubleProp, "name" | "type">): DoubleProp;
30
- declare function decimal(name: string, option?: Omit<DecimalProp, "name" | "type">): DecimalProp;
31
- declare function boolean(name: string, option?: Omit<BooleanProp, "name" | "type">): BooleanProp;
32
- declare function date(name: string, option?: Omit<DateProp, "name" | "type"> & {
33
- now?: true;
34
- }): DateProp;
35
- declare function dateTime(name: string, option?: Omit<DateTimeProp, "name" | "type"> & {
36
- now?: true;
37
- }): DateTimeProp;
38
- declare function time(name: string, option?: Omit<TimeProp, "name" | "type"> & {
39
- now?: true;
40
- }): TimeProp;
41
- declare function timestamp(name: string, option?: Omit<TimestampProp, "name" | "type"> & {
42
- now?: true;
43
- }): TimestampProp;
44
- declare function json(name: string, option: Omit<JsonProp, "name" | "type">): JsonProp;
45
- declare function uuid(name: string, option: Omit<UuidProp, "name" | "type">): UuidProp;
46
- declare function enums(name: string, option: Omit<EnumProp, "name" | "type" | "id"> & {
47
- id?: string;
48
- }): EnumProp;
49
- declare function virtual(name: string, option: Omit<VirtualProp, "name" | "type" | "index" | "unique" | "dbDefault" | "toFilter">): VirtualProp;
50
- declare function relationOneToOne(name: string, option: DistributiveOmit<OneToOneRelationProp, "name" | "type" | "relationType">): OneToOneRelationProp;
51
- declare function relationBelongsToOne(name: string, option: Omit<BelongsToOneRelationProp, "name" | "type" | "relationType">): BelongsToOneRelationProp;
52
- declare function relationHasMany(name: string, option: Omit<HasManyRelationProp, "name" | "type" | "relationType">): HasManyRelationProp;
53
- declare function relationManyToMany(name: string, option: Omit<ManyToManyRelationProp, "name" | "type" | "relationType">): ManyToManyRelationProp;
54
- export {};
55
- //# sourceMappingURL=md-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"md-utils.d.ts","sourceRoot":"","sources":["../../src/f9-md/md-utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBb,CAAC;AAEF,iBAAS,OAAO,CACd,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,GAC1C,WAAW,CAMb;AACD,iBAAS,UAAU,CACjB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,GAC7C,cAAc,CAMhB;AACD,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EA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,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC,GAClE,mBAAmB,CAOrB;AACD,iBAAS,kBAAkB,CACzB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC,GACrE,sBAAsB,CAOxB"}
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.p = void 0;
4
- const inflection_1 = require("inflection");
5
- exports.p = {
6
- integer,
7
- bigInteger,
8
- text,
9
- string,
10
- float,
11
- double,
12
- decimal,
13
- boolean,
14
- date,
15
- dateTime,
16
- time,
17
- timestamp,
18
- json,
19
- uuid,
20
- enums,
21
- virtual,
22
- relationOneToOne,
23
- relationBelongsToOne,
24
- relationHasMany,
25
- relationManyToMany,
26
- };
27
- function integer(name, option) {
28
- return Object.assign({ name, type: "integer" }, option);
29
- }
30
- function bigInteger(name, option) {
31
- return Object.assign({ name, type: "bigInteger" }, option);
32
- }
33
- function text(name, option) {
34
- return Object.assign({ name, type: "text" }, option);
35
- }
36
- function string(name, option) {
37
- return Object.assign({ name, type: "string" }, option);
38
- }
39
- function float(name, option) {
40
- return Object.assign({ name, type: "float" }, option);
41
- }
42
- function double(name, option) {
43
- return Object.assign({ name, type: "double" }, option);
44
- }
45
- function decimal(name, option) {
46
- return Object.assign({ name, type: "decimal" }, option);
47
- }
48
- function boolean(name, option) {
49
- return Object.assign({ name, type: "boolean" }, option);
50
- }
51
- function date(name, option) {
52
- if ((option === null || option === void 0 ? void 0 : option.now) === true) {
53
- delete option.now;
54
- option.dbDefault = "CURRENT_TIMESTAMP";
55
- }
56
- return Object.assign({ name, type: "date" }, option);
57
- }
58
- function dateTime(name, option) {
59
- if ((option === null || option === void 0 ? void 0 : option.now) === true) {
60
- delete option.now;
61
- option.dbDefault = "CURRENT_TIMESTAMP";
62
- }
63
- return Object.assign({ name, type: "dateTime" }, option);
64
- }
65
- function time(name, option) {
66
- if ((option === null || option === void 0 ? void 0 : option.now) === true) {
67
- delete option.now;
68
- option.dbDefault = "CURRENT_TIMESTAMP";
69
- }
70
- return Object.assign({ name, type: "time" }, option);
71
- }
72
- function timestamp(name, option) {
73
- if ((option === null || option === void 0 ? void 0 : option.now) === true) {
74
- delete option.now;
75
- option.dbDefault = "CURRENT_TIMESTAMP";
76
- }
77
- return Object.assign({ name, type: "timestamp" }, option);
78
- }
79
- function json(name, option) {
80
- return Object.assign({ name, type: "json" }, option);
81
- }
82
- function uuid(name, option) {
83
- return Object.assign({ name, type: "uuid" }, option);
84
- }
85
- function enums(name, option) {
86
- var _a;
87
- return Object.assign({ name, type: "enum", id: (_a = option.id) !== null && _a !== void 0 ? _a : `$Model${(0, inflection_1.camelize)(name)}` }, option);
88
- }
89
- function virtual(name, option) {
90
- return Object.assign({ name, type: "virtual" }, option);
91
- }
92
- function relationOneToOne(name, option) {
93
- return Object.assign({ name, type: "relation", relationType: "OneToOne" }, option);
94
- }
95
- function relationBelongsToOne(name, option) {
96
- return Object.assign({ name, type: "relation", relationType: "BelongsToOne" }, option);
97
- }
98
- function relationHasMany(name, option) {
99
- return Object.assign({ name, type: "relation", relationType: "HasMany" }, option);
100
- }
101
- function relationManyToMany(name, option) {
102
- return Object.assign({ name, type: "relation", relationType: "ManyToMany" }, option);
103
- }
104
- //# sourceMappingURL=md-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"md-utils.js","sourceRoot":"","sources":["../../src/f9-md/md-utils.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAyBzB,QAAA,CAAC,GAAG;IACf,OAAO;IACP,UAAU;IACV,IAAI;IACJ,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,SAAS;IACT,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,OAAO;IACP,gBAAgB;IAChB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;CACnB,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OAAO,CACd,IAAY,EACZ,MAGC;IAED,uBACE,IAAI,EACJ,IAAI,EAAE,SAAS,IACZ,MAAM,EACT;AACJ,CAAC;AACD,SAAS,gBAAgB,CACvB,IAAY,EACZ,MAGC;IAED,uBACE,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,UAAU,IACrB,MAAM,EACT;AACJ,CAAC;AACD,SAAS,oBAAoB,CAC3B,IAAY,EACZ,MAAwE;IAExE,uBACE,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,cAAc,IACzB,MAAM,EACT;AACJ,CAAC;AACD,SAAS,eAAe,CACtB,IAAY,EACZ,MAAmE;IAEnE,uBACE,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,SAAS,IACpB,MAAM,EACT;AACJ,CAAC;AACD,SAAS,kBAAkB,CACzB,IAAY,EACZ,MAAsE;IAEtE,uBACE,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,YAAY,IACvB,MAAM,EACT;AACJ,CAAC"}
@@ -1,79 +0,0 @@
1
- import { Knex } from "knex";
2
- import { GenMigrationCode, MigrationColumn, MigrationForeign, MigrationIndex, MigrationSet, MigrationSetAndJoinTable } from "../types/shared";
3
- import { SMD } from "../smd/smd";
4
- import { SonamuDBConfig } from "../database/db";
5
- declare type F9MigratorMode = "dev" | "deploy";
6
- export declare type F9MigratorOptions = {
7
- appRootPath: string;
8
- knexfile: SonamuDBConfig;
9
- readonly mode: F9MigratorMode;
10
- };
11
- export declare class F9Migrator {
12
- appRootPath: string;
13
- knexfile: SonamuDBConfig;
14
- readonly mode: F9MigratorMode;
15
- targets: {
16
- compare?: Knex;
17
- pending: Knex;
18
- shadow: Knex;
19
- apply: Knex[];
20
- };
21
- constructor(options: F9MigratorOptions);
22
- clearPendingList(): Promise<void>;
23
- run(): Promise<void>;
24
- rollback(): Promise<void>;
25
- cleanUpDist(force?: boolean): Promise<void>;
26
- runShadowTest(): Promise<boolean>;
27
- resetAll(): Promise<void>;
28
- compareMigrations(): Promise<GenMigrationCode[]>;
29
- getMigrationSetFromDB(table: string): Promise<MigrationSet | null>;
30
- resolveDBColType(colType: string, colField: string): Pick<MigrationColumn, "type" | "unsigned" | "length">;
31
- readTable(tableName: string): Promise<[any, any, any]>;
32
- getMigrationSetFromMD(md: SMD): MigrationSetAndJoinTable;
33
- genColumnDefinitions(columns: MigrationColumn[]): string[];
34
- genIndexDefinitions(indexes: MigrationIndex[]): string[];
35
- genForeignDefinitions(table: string, foreigns: MigrationForeign[]): {
36
- up: string[];
37
- down: string[];
38
- };
39
- generateCreateCode_ColumnAndIndexes(table: string, columns: MigrationColumn[], indexes: MigrationIndex[]): GenMigrationCode;
40
- generateCreateCode_Foreign(table: string, foreigns: MigrationForeign[]): GenMigrationCode[];
41
- showMigrationSet(which: string, migrationSet: MigrationSet): void;
42
- generateAlterCode_ColumnAndIndexes(table: string, mdColumns: MigrationColumn[], mdIndexes: MigrationIndex[], dbColumns: MigrationColumn[], dbIndexes: MigrationIndex[]): GenMigrationCode[];
43
- getAlterColumnsTo(mdColumns: MigrationColumn[], dbColumns: MigrationColumn[]): {
44
- add: MigrationColumn[];
45
- drop: MigrationColumn[];
46
- alter: MigrationColumn[];
47
- };
48
- getAlterColumnLinesTo(columnsTo: ReturnType<F9Migrator["getAlterColumnsTo"]>, mdColumns: MigrationColumn[]): {
49
- add: {
50
- up: string[];
51
- down: string[];
52
- };
53
- drop: {
54
- up: string[];
55
- down: string[];
56
- };
57
- alter: {
58
- up: string[];
59
- down: string[];
60
- };
61
- };
62
- getAlterIndexesTo(mdIndexes: MigrationIndex[], dbIndexes: MigrationIndex[]): {
63
- add: MigrationIndex[];
64
- drop: MigrationIndex[];
65
- };
66
- getAlterIndexLinesTo(indexesTo: ReturnType<F9Migrator["getAlterIndexesTo"]>, columnsTo: ReturnType<F9Migrator["getAlterColumnsTo"]>): {
67
- add: {
68
- up: string[];
69
- down: string[];
70
- };
71
- drop: {
72
- up: string[];
73
- down: string[];
74
- };
75
- };
76
- destroy(): Promise<void>;
77
- }
78
- export {};
79
- //# sourceMappingURL=migrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrator.d.ts","sourceRoot":"","sources":["../../src/f9-md/migrator.ts"],"names":[],"mappings":"AAWA,OAAa,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiBlC,OAAO,EACL,gBAAgB,EAShB,eAAe,EACf,gBAAgB,EAChB,cAAc,EAEd,YAAY,EACZ,wBAAwB,EAIzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,aAAK,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AACvC,oBAAY,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B,CAAC;AACF,qBAAa,UAAU;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAE9B,OAAO,EAAE;QACP,OAAO,CAAC,EAAE,IAAI,CAAC;QACf,OAAO,EAAE,IAAI,CAAC;QACd,MAAM,EAAE,IAAI,CAAC;QACb,KAAK,EAAE,IAAI,EAAE,CAAC;KACf,CAAC;gBAEU,OAAO,EAAE,iBAAiB;IAyChC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBjC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgFpB,QAAQ;IAYR,WAAW,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA0ElD,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IA6DjC,QAAQ;IA4BR,iBAAiB,IAAI,OAAO,CAAC,gBAA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