orchid-orm 1.3.16 → 1.4.16

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 (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.d.ts +39 -32
  3. package/dist/index.esm.js +102 -100
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +102 -100
  6. package/dist/index.js.map +1 -1
  7. package/jest-setup.ts +4 -0
  8. package/package.json +8 -4
  9. package/src/appCodeUpdater/appCodeUpdater.ts +19 -0
  10. package/src/appCodeUpdater/fileChanges.ts +41 -0
  11. package/src/appCodeUpdater/testUtils.ts +31 -0
  12. package/src/appCodeUpdater/tsUtils.ts +137 -0
  13. package/src/appCodeUpdater/updateMainFile.test.ts +230 -0
  14. package/src/appCodeUpdater/updateMainFile.ts +163 -0
  15. package/src/appCodeUpdater/updateTableFile.ts +19 -0
  16. package/src/index.ts +5 -1
  17. package/src/orm.test.ts +13 -13
  18. package/src/orm.ts +21 -21
  19. package/src/relations/belongsTo.test.ts +1 -1
  20. package/src/relations/belongsTo.ts +2 -2
  21. package/src/relations/hasAndBelongsToMany.test.ts +1 -1
  22. package/src/relations/hasAndBelongsToMany.ts +9 -9
  23. package/src/relations/hasMany.test.ts +16 -10
  24. package/src/relations/hasMany.ts +6 -6
  25. package/src/relations/hasOne.test.ts +10 -10
  26. package/src/relations/hasOne.ts +6 -6
  27. package/src/relations/relations.ts +73 -71
  28. package/src/relations/utils.ts +3 -3
  29. package/src/repo.test.ts +29 -29
  30. package/src/repo.ts +6 -6
  31. package/src/{model.test.ts → table.test.ts} +15 -15
  32. package/src/{model.ts → table.ts} +17 -17
  33. package/src/test-utils/test-db.ts +15 -15
  34. package/src/test-utils/{test-models.ts → test-tables.ts} +42 -42
  35. package/src/transaction.test.ts +1 -1
  36. package/src/transaction.ts +4 -4
  37. package/src/utils.ts +9 -0
  38. package/tsconfig.json +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchid-orm",
3
- "version": "1.3.16",
3
+ "version": "1.4.16",
4
4
  "description": "Postgres ORM",
5
5
  "homepage": "https://orchid-orm.netlify.app/guide/orm-setup-and-overview.html",
6
6
  "repository": {
@@ -31,14 +31,14 @@
31
31
  "author": "Roman Kushyn",
32
32
  "license": "ISC",
33
33
  "dependencies": {
34
- "pqb": "0.7.13"
34
+ "pqb": "0.8.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@swc/core": "^1.3.19",
38
38
  "rollup": "^2.79.0",
39
39
  "rollup-plugin-dts": "^4.2.2",
40
40
  "rollup-plugin-esbuild": "^4.10.1",
41
- "orchid-orm-schema-to-zod": "0.1.13",
41
+ "orchid-orm-schema-to-zod": "0.2.0",
42
42
  "@swc/jest": "^0.2.21",
43
43
  "@types/jest": "^28.1.2",
44
44
  "@types/node": "^18.0.1",
@@ -49,7 +49,11 @@
49
49
  "pg-transactional-tests": "^1.0.7",
50
50
  "rimraf": "^3.0.2",
51
51
  "tslib": "^2.4.0",
52
- "typescript": "^4.7.4"
52
+ "typescript": "^4.7.4",
53
+ "rake-db": "2.2.0"
54
+ },
55
+ "peerDependencies": {
56
+ "typescript": "*"
53
57
  },
54
58
  "scripts": {
55
59
  "test": "jest",
@@ -0,0 +1,19 @@
1
+ import { AppCodeUpdater } from 'rake-db';
2
+ // import * as path from 'path';
3
+
4
+ export class AppCodeUpdaterError extends Error {}
5
+
6
+ export type AppCodeUpdaterConfig = {
7
+ tablePath(tableName: string): string;
8
+ mainFilePath: string;
9
+ };
10
+
11
+ export const appCodeUpdater = (): // config: AppCodeUpdaterConfig,
12
+ AppCodeUpdater => {
13
+ // const tablePath = (name: string) => path.resolve(config.tablePath(name));
14
+ // const mainFilePath = path.resolve(config.mainFilePath);
15
+
16
+ return async (ast) => {
17
+ console.log(ast);
18
+ };
19
+ };
@@ -0,0 +1,41 @@
1
+ export class FileChanges {
2
+ private ranges: ([from: number, to: number] | string)[] = [];
3
+
4
+ constructor(public content: string) {}
5
+
6
+ add(at: number, text: string, end = at) {
7
+ if (this.ranges.length === 0) {
8
+ this.ranges.push([0, at], text, [end, this.content.length]);
9
+ } else {
10
+ const last = this.ranges[this.ranges.length - 1] as [number, number];
11
+ last[1] = at;
12
+ this.ranges.push(text, [end, this.content.length]);
13
+ }
14
+ }
15
+
16
+ replace(from: number, to: number, text: string) {
17
+ this.add(from, text, to);
18
+ }
19
+
20
+ remove(from: number, to: number) {
21
+ if (this.ranges.length === 0) {
22
+ this.ranges.push([0, from], [to, this.content.length]);
23
+ } else {
24
+ const last = this.ranges[this.ranges.length - 1] as [number, number];
25
+ last[1] = from;
26
+ this.ranges.push([to, this.content.length]);
27
+ }
28
+ }
29
+
30
+ apply() {
31
+ return this.ranges.length
32
+ ? this.ranges
33
+ .map((item) =>
34
+ typeof item === 'string'
35
+ ? item
36
+ : this.content.slice(item[0], item[1]),
37
+ )
38
+ .join('')
39
+ : this.content;
40
+ }
41
+ }
@@ -0,0 +1,31 @@
1
+ import { RakeDbAst } from 'rake-db';
2
+ import { columnTypes } from 'pqb';
3
+
4
+ const makeAst = () => {
5
+ const addTable: RakeDbAst.Table = {
6
+ type: 'table',
7
+ action: 'create',
8
+ name: 'table',
9
+ shape: {
10
+ id: columnTypes.serial().primaryKey(),
11
+ },
12
+ noPrimaryKey: 'ignore',
13
+ indexes: [],
14
+ foreignKeys: [],
15
+ };
16
+
17
+ const dropTable: RakeDbAst.Table = {
18
+ ...addTable,
19
+ action: 'drop',
20
+ };
21
+
22
+ const renameTable: RakeDbAst.RenameTable = {
23
+ type: 'renameTable',
24
+ from: 'table',
25
+ to: 'renamedTable',
26
+ };
27
+
28
+ return { addTable, dropTable, renameTable };
29
+ };
30
+
31
+ export const ast = makeAst();
@@ -0,0 +1,137 @@
1
+ import {
2
+ CallExpression,
3
+ Expression,
4
+ ImportDeclaration,
5
+ NamedImports,
6
+ NodeArray,
7
+ ObjectLiteralElement,
8
+ ObjectLiteralExpression,
9
+ PropertyAssignment,
10
+ ShorthandPropertyAssignment,
11
+ Statement,
12
+ SyntaxKind,
13
+ VariableStatement,
14
+ } from 'typescript';
15
+ import path from 'path';
16
+
17
+ const iterate = <T>(
18
+ kind: number,
19
+ ): ((statements: NodeArray<Statement>) => Generator<T, void, unknown>) => {
20
+ return function* (statements: NodeArray<Statement>) {
21
+ for (const node of statements) {
22
+ if (node.kind === kind) {
23
+ yield node as T;
24
+ }
25
+ }
26
+ };
27
+ };
28
+
29
+ const isNode = <T extends { kind: number }>() => {
30
+ return <U extends T>(kind: number) => {
31
+ return (node?: T): node is U => {
32
+ return node?.kind === kind;
33
+ };
34
+ };
35
+ };
36
+
37
+ const isExpression = isNode<Expression>();
38
+ const isObjectLiteral = isNode<ObjectLiteralElement>();
39
+
40
+ export const ts = {
41
+ is: {
42
+ call: isExpression<CallExpression>(SyntaxKind.CallExpression),
43
+ objectLiteral: isExpression<ObjectLiteralExpression>(
44
+ SyntaxKind.ObjectLiteralExpression,
45
+ ),
46
+ propertyAssignment: isObjectLiteral<PropertyAssignment>(
47
+ SyntaxKind.PropertyAssignment,
48
+ ),
49
+ shorthandPropertyAssignment: isObjectLiteral<ShorthandPropertyAssignment>(
50
+ SyntaxKind.ShorthandPropertyAssignment,
51
+ ),
52
+ },
53
+ import: {
54
+ iterate: iterate<ImportDeclaration>(SyntaxKind.ImportDeclaration),
55
+ *iterateWithSource(statements: NodeArray<Statement>, path: string) {
56
+ for (const node of ts.import.iterate(statements)) {
57
+ if (ts.import.getSource(node) !== path) continue;
58
+ yield node;
59
+ }
60
+ },
61
+ getSource(node: ImportDeclaration) {
62
+ return node.moduleSpecifier.getText().slice(1, -1);
63
+ },
64
+ getEndPos(statements: NodeArray<Statement>) {
65
+ let end = 0;
66
+ for (const node of ts.import.iterate(statements)) {
67
+ end = node.end;
68
+ }
69
+ return end;
70
+ },
71
+ getStatementsImportedName(
72
+ statements: NodeArray<Statement>,
73
+ path: string,
74
+ key: string,
75
+ ) {
76
+ for (const node of ts.import.iterateWithSource(statements, path)) {
77
+ const name = ts.import.getImportName(node, key);
78
+ if (name) return name;
79
+ }
80
+
81
+ return;
82
+ },
83
+ getImportName(node: ImportDeclaration, key: string) {
84
+ if (!node.importClause) return;
85
+
86
+ const elements = (node.importClause.namedBindings as NamedImports)
87
+ ?.elements;
88
+
89
+ if (!elements) return;
90
+
91
+ for (const element of elements) {
92
+ if (
93
+ element.propertyName?.escapedText === key ||
94
+ element.name.escapedText === key
95
+ ) {
96
+ return element.name.escapedText.toString();
97
+ }
98
+ }
99
+
100
+ return;
101
+ },
102
+ },
103
+ variable: {
104
+ iterate: iterate<VariableStatement>(SyntaxKind.VariableStatement),
105
+ *iterateDeclarations(statements: NodeArray<Statement>) {
106
+ for (const node of ts.variable.iterate(statements)) {
107
+ for (const dec of node.declarationList.declarations) {
108
+ yield dec;
109
+ }
110
+ }
111
+ },
112
+ },
113
+ prop: {
114
+ getValue(prop: ObjectLiteralElement) {
115
+ if (ts.is.propertyAssignment(prop)) {
116
+ return prop.initializer.getText();
117
+ } else if (ts.is.shorthandPropertyAssignment(prop)) {
118
+ return prop.name.escapedText.toString();
119
+ } else {
120
+ return;
121
+ }
122
+ },
123
+ },
124
+ path: {
125
+ getRelative(from: string, to: string) {
126
+ const rel = path.relative(path.dirname(from), to);
127
+ return rel.startsWith('./') || rel.startsWith('../') ? rel : `./${rel}`;
128
+ },
129
+ },
130
+ spaces: {
131
+ getAtLine(content: string, pos: number) {
132
+ const lines = content.slice(0, pos).split('\n');
133
+ const last = lines[lines.length - 1];
134
+ return last.match(/^\s+/)?.[0] || '';
135
+ },
136
+ },
137
+ };
@@ -0,0 +1,230 @@
1
+ import { updateMainFile } from './updateMainFile';
2
+ import * as path from 'path';
3
+ import * as fs from 'fs/promises';
4
+ import { ast } from './testUtils';
5
+
6
+ jest.mock('fs/promises', () => ({
7
+ readFile: jest.fn(),
8
+ writeFile: jest.fn(),
9
+ }));
10
+
11
+ const asMock = (fn: unknown) => fn as jest.Mock;
12
+
13
+ const mainFilePath = path.resolve('db.ts');
14
+ const tablePath = (table: string) => path.resolve(`tables/${table}`);
15
+
16
+ describe('updateMainFile', () => {
17
+ beforeEach(() => {
18
+ jest.resetAllMocks();
19
+ });
20
+
21
+ it('should throw when file is not found', async () => {
22
+ asMock(fs.readFile).mockRejectedValue(new Error());
23
+
24
+ await expect(() =>
25
+ updateMainFile(mainFilePath, tablePath, ast.addTable),
26
+ ).rejects.toThrow();
27
+ });
28
+
29
+ describe('add table', () => {
30
+ it('should add table', async () => {
31
+ asMock(fs.readFile).mockResolvedValue(`
32
+ import { orchidORM } from 'orchid-orm';
33
+
34
+ export const db = orchidORM({}, {});
35
+ `);
36
+
37
+ await updateMainFile(mainFilePath, tablePath, ast.addTable);
38
+
39
+ expect(fs.writeFile).toBeCalledWith(
40
+ mainFilePath,
41
+ `
42
+ import { orchidORM } from 'orchid-orm';
43
+ import { Table } from './tables/table';
44
+
45
+ export const db = orchidORM({}, {
46
+ table: Table,
47
+ });
48
+ `,
49
+ );
50
+ });
51
+
52
+ it('should handle import as', async () => {
53
+ asMock(fs.readFile).mockResolvedValue(`
54
+ import { orchidORM as custom } from 'orchid-orm';
55
+
56
+ export const db = custom({}, {});
57
+ `);
58
+
59
+ await updateMainFile(mainFilePath, tablePath, ast.addTable);
60
+
61
+ expect(fs.writeFile).toBeCalledWith(
62
+ mainFilePath,
63
+ `
64
+ import { orchidORM as custom } from 'orchid-orm';
65
+ import { Table } from './tables/table';
66
+
67
+ export const db = custom({}, {
68
+ table: Table,
69
+ });
70
+ `,
71
+ );
72
+ });
73
+
74
+ it('should handle object list with elements', async () => {
75
+ asMock(fs.readFile).mockResolvedValue(`
76
+ import { orchidORM } from 'orchid-orm';
77
+ import { Some } from './tables/some';
78
+
79
+ export const db = orchidORM({}, {
80
+ some: Some,
81
+ });
82
+ `);
83
+
84
+ await updateMainFile(mainFilePath, tablePath, ast.addTable);
85
+
86
+ expect(fs.writeFile).toBeCalledWith(
87
+ mainFilePath,
88
+ `
89
+ import { orchidORM } from 'orchid-orm';
90
+ import { Some } from './tables/some';
91
+ import { Table } from './tables/table';
92
+
93
+ export const db = orchidORM({}, {
94
+ some: Some,
95
+ table: Table,
96
+ });
97
+ `,
98
+ );
99
+ });
100
+
101
+ it('should handle object list without ending coma', async () => {
102
+ asMock(fs.readFile).mockResolvedValue(`
103
+ import { orchidORM } from 'orchid-orm';
104
+ import { Some } from './tables/some';
105
+
106
+ export const db = orchidORM({}, {
107
+ some: Some
108
+ });
109
+ `);
110
+
111
+ await updateMainFile(mainFilePath, tablePath, ast.addTable);
112
+
113
+ expect(fs.writeFile).toBeCalledWith(
114
+ mainFilePath,
115
+ `
116
+ import { orchidORM } from 'orchid-orm';
117
+ import { Some } from './tables/some';
118
+ import { Table } from './tables/table';
119
+
120
+ export const db = orchidORM({}, {
121
+ some: Some,
122
+ table: Table,
123
+ });
124
+ `,
125
+ );
126
+ });
127
+ });
128
+
129
+ describe('drop table', () => {
130
+ it('should remove table', async () => {
131
+ asMock(fs.readFile).mockResolvedValue(`
132
+ import { orchidORM } from 'orchid-orm';
133
+ import { Table } from './tables/table';
134
+
135
+ export const db = orchidORM({}, {
136
+ table: Table,
137
+ });
138
+ `);
139
+
140
+ await updateMainFile(mainFilePath, tablePath, ast.dropTable);
141
+
142
+ expect(fs.writeFile).toBeCalledWith(
143
+ mainFilePath,
144
+ `
145
+ import { orchidORM } from 'orchid-orm';
146
+
147
+ export const db = orchidORM({}, {
148
+ });
149
+ `,
150
+ );
151
+ });
152
+
153
+ it('should remove aliased import', async () => {
154
+ asMock(fs.readFile).mockResolvedValue(`
155
+ import { orchidORM } from 'orchid-orm';
156
+ import { Table as koko } from './tables/table';
157
+
158
+ export const db = orchidORM({}, {
159
+ koko: koko,
160
+ });
161
+ `);
162
+
163
+ await updateMainFile(mainFilePath, tablePath, ast.dropTable);
164
+
165
+ expect(fs.writeFile).toBeCalledWith(
166
+ mainFilePath,
167
+ `
168
+ import { orchidORM } from 'orchid-orm';
169
+
170
+ export const db = orchidORM({}, {
171
+ });
172
+ `,
173
+ );
174
+ });
175
+
176
+ it('should remove short form of key and value', async () => {
177
+ asMock(fs.readFile).mockResolvedValue(`
178
+ import { orchidORM } from 'orchid-orm';
179
+ import { Table as koko } from './tables/table';
180
+
181
+ export const db = orchidORM({}, {
182
+ koko,
183
+ });
184
+ `);
185
+
186
+ await updateMainFile(mainFilePath, tablePath, ast.dropTable);
187
+
188
+ expect(fs.writeFile).toBeCalledWith(
189
+ mainFilePath,
190
+ `
191
+ import { orchidORM } from 'orchid-orm';
192
+
193
+ export const db = orchidORM({}, {
194
+ });
195
+ `,
196
+ );
197
+ });
198
+
199
+ it('should not remove other tables', async () => {
200
+ asMock(fs.readFile).mockResolvedValue(`
201
+ import { orchidORM } from 'orchid-orm';
202
+ import { One } from './tables/one';
203
+ import { Table } from './tables/table';
204
+ import { Two } from './tables/two';
205
+
206
+ export const db = orchidORM({}, {
207
+ one,
208
+ table: Table,
209
+ two,
210
+ });
211
+ `);
212
+
213
+ await updateMainFile(mainFilePath, tablePath, ast.dropTable);
214
+
215
+ expect(fs.writeFile).toBeCalledWith(
216
+ mainFilePath,
217
+ `
218
+ import { orchidORM } from 'orchid-orm';
219
+ import { One } from './tables/one';
220
+ import { Two } from './tables/two';
221
+
222
+ export const db = orchidORM({}, {
223
+ one,
224
+ two,
225
+ });
226
+ `,
227
+ );
228
+ });
229
+ });
230
+ });
@@ -0,0 +1,163 @@
1
+ import { RakeDbAst } from 'rake-db';
2
+ import fs from 'fs/promises';
3
+ import {
4
+ createSourceFile,
5
+ NodeArray,
6
+ ObjectLiteralExpression,
7
+ ScriptTarget,
8
+ Statement,
9
+ } from 'typescript';
10
+ import { toCamelCase, toPascalCase } from '../utils';
11
+ import { AppCodeUpdaterError } from './appCodeUpdater';
12
+ import { FileChanges } from './fileChanges';
13
+ import { ts } from './tsUtils';
14
+
15
+ type Context = {
16
+ path: string;
17
+ tablePath: (name: string) => string;
18
+ statements: NodeArray<Statement>;
19
+ object: ObjectLiteralExpression;
20
+ content: string;
21
+ spaces: string;
22
+ };
23
+
24
+ const libraryName = 'orchid-orm';
25
+ const importKey = 'orchidORM';
26
+
27
+ export const updateMainFile = async (
28
+ path: string,
29
+ tablePath: (name: string) => string,
30
+ ast: RakeDbAst,
31
+ ) => {
32
+ const content = await fs.readFile(path, 'utf-8');
33
+
34
+ const { statements } = createSourceFile(
35
+ 'file.ts',
36
+ content,
37
+ ScriptTarget.Latest,
38
+ true,
39
+ );
40
+
41
+ const importName = ts.import.getStatementsImportedName(
42
+ statements,
43
+ libraryName,
44
+ importKey,
45
+ );
46
+ if (!importName) {
47
+ throw new AppCodeUpdaterError(
48
+ `Main file does not contain import of orchid-orm`,
49
+ );
50
+ }
51
+
52
+ const object = getTablesListObject(importName, statements);
53
+ if (!object) {
54
+ throw new Error('List of tables is not found in main file');
55
+ }
56
+
57
+ const spaces = ts.spaces.getAtLine(content, object.end);
58
+
59
+ const context: Context = {
60
+ path,
61
+ tablePath,
62
+ statements,
63
+ object,
64
+ content,
65
+ spaces,
66
+ };
67
+
68
+ if (ast.type === 'table') {
69
+ if (ast.action === 'create') {
70
+ return fs.writeFile(path, createTable(context, ast));
71
+ } else {
72
+ return fs.writeFile(path, dropTable(context, ast));
73
+ }
74
+ }
75
+
76
+ // rename table is not handled because renaming of the class and the file is better to be done by the editor,
77
+ // editor can scan all project files, rename import path and imported class name
78
+ };
79
+
80
+ const createTable = (
81
+ { path, tablePath, statements, object, content, spaces }: Context,
82
+ ast: RakeDbAst.Table,
83
+ ) => {
84
+ const key = toCamelCase(ast.name);
85
+ const value = toPascalCase(ast.name);
86
+
87
+ const changes = new FileChanges(content);
88
+
89
+ const importPath = ts.path.getRelative(path, tablePath(ast.name));
90
+ const importPos = ts.import.getEndPos(statements);
91
+ changes.add(
92
+ importPos,
93
+ `${importPos === 0 ? '' : '\n'}import { ${value} } from '${importPath}';`,
94
+ );
95
+
96
+ let insert = `\n${spaces} ${key}: ${value},`;
97
+ if (object.properties.length && !object.properties.hasTrailingComma) {
98
+ insert = `,${insert}`;
99
+ }
100
+ if (!content.slice(object.properties.end, object.end).includes('\n')) {
101
+ insert += `\n${spaces}`;
102
+ }
103
+ changes.add(object.properties.end, insert);
104
+
105
+ return changes.apply();
106
+ };
107
+
108
+ const dropTable = (
109
+ { path, tablePath, statements, object, content }: Context,
110
+ ast: RakeDbAst.Table,
111
+ ) => {
112
+ const changes = new FileChanges(content);
113
+
114
+ const importPath = ts.path.getRelative(path, tablePath(ast.name));
115
+ const tableClassName = toPascalCase(ast.name);
116
+ const importNames: string[] = [];
117
+ for (const node of ts.import.iterateWithSource(statements, importPath)) {
118
+ changes.remove(node.pos, node.end);
119
+
120
+ const name = ts.import.getImportName(node, tableClassName);
121
+ if (name && !importNames.includes(name)) {
122
+ importNames.push(name);
123
+ }
124
+ }
125
+
126
+ for (const prop of object.properties) {
127
+ const name = ts.prop.getValue(prop);
128
+ if (!name || !importNames.includes(name)) continue;
129
+
130
+ let { end } = prop;
131
+ if (content[end] === ',') end++;
132
+ changes.remove(prop.pos, end);
133
+ }
134
+
135
+ return changes.apply();
136
+ };
137
+
138
+ const getTablesListObject = (
139
+ importName: string,
140
+ statements: NodeArray<Statement>,
141
+ ): ObjectLiteralExpression | undefined => {
142
+ for (const node of ts.variable.iterateDeclarations(statements)) {
143
+ const call = node.initializer;
144
+ if (!ts.is.call(call)) continue;
145
+
146
+ if (call.expression.getText() !== importName) continue;
147
+
148
+ if (call.arguments.length !== 2) {
149
+ throw new Error(
150
+ 'Invalid number of arguments when initializing orchid orm',
151
+ );
152
+ }
153
+
154
+ const object = call.arguments[1];
155
+ if (!ts.is.objectLiteral(object)) {
156
+ throw new Error('Second argument of orchidORM must be an object literal');
157
+ }
158
+
159
+ return object;
160
+ }
161
+
162
+ return;
163
+ };
@@ -0,0 +1,19 @@
1
+ // import { RakeDbAst } from 'rake-db';
2
+ //
3
+ // export const updateTableFile = async (
4
+ // tablePath: (name: string) => string,
5
+ // ast: RakeDbAst,
6
+ // ) => {
7
+ // if (ast.type === 'table') {
8
+ // if (ast.action === 'create') {
9
+ // createTable(tablePath, ast);
10
+ // }
11
+ // }
12
+ // };
13
+ //
14
+ // const createTable = (
15
+ // tablePath: (name: string) => string,
16
+ // ast: RakeDbAst.Table,
17
+ // ) => {
18
+ //
19
+ // };
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
- export * from './model';
1
+ export * from './table';
2
2
  export * from './orm';
3
3
  export * from './repo';
4
+ export type {
5
+ appCodeUpdater,
6
+ AppCodeUpdaterConfig,
7
+ } from './appCodeUpdater/appCodeUpdater';