@naiv/codegen-axios-client 0.0.5 → 0.0.7

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.
@@ -19,6 +19,7 @@ function getTableFileName(item, extension) {
19
19
  function buildTableDependency(table, source) {
20
20
  return table.fields
21
21
  .filter((tc) => tc.type.kind === 'relation' || tc.type.kind === 'enum')
22
+ .filter((tc) => tc.type.kind == 'relation' && tc.type.type == table.name)
22
23
  .map((tc) => {
23
24
  const type = tc.type;
24
25
  switch (type.kind) {
@@ -136,7 +137,8 @@ function buildColumnRelation(type, column, table, source) {
136
137
  throw new Error(`Column "${type.subtype}" on table "${type.type}" not found on relation "${table.name}.${column.column_name}"`);
137
138
  }
138
139
  return [
139
- `${column.column_name}${is_required ? '' : '?'}: ${mapSQLTypeToJSType(foreign_column.type)};`
140
+ `${column.column_name}${is_required ? '' : '?'}: ${mapSQLTypeToJSType(foreign_column.type)};`,
141
+ `otm_${column.column_name}?: ${foreign_table.name};`
140
142
  ];
141
143
  }
142
144
  function buildColumn(column, table, source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naiv/codegen-axios-client",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "main": "dist/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"