dbgate-tools 6.0.0-alpha.1 → 6.0.0

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.
@@ -1,4 +1,4 @@
1
- import type { ColumnInfo, ConstraintInfo, EngineDriver, ForeignKeyInfo, FunctionInfo, NamedObjectInfo, PrimaryKeyInfo, ProcedureInfo, SqlDialect, TableInfo, TransformType, TriggerInfo, ViewInfo, IndexInfo, UniqueInfo, CheckInfo, AlterProcessor, SqlObjectInfo } from 'dbgate-types';
1
+ import type { ColumnInfo, ConstraintInfo, EngineDriver, ForeignKeyInfo, FunctionInfo, NamedObjectInfo, PrimaryKeyInfo, ProcedureInfo, SqlDialect, TableInfo, TransformType, TriggerInfo, ViewInfo, IndexInfo, UniqueInfo, CheckInfo, AlterProcessor, SqlObjectInfo, CallableObjectInfo } from 'dbgate-types';
2
2
  export declare class SqlDumper implements AlterProcessor {
3
3
  s: string;
4
4
  driver: EngineDriver;
@@ -119,4 +119,5 @@ export declare class SqlDumper implements AlterProcessor {
119
119
  setTableOptionCore(table: TableInfo, optionName: string, optionValue: string, formatString: string): void;
120
120
  fillNewNotNullDefaults(col: ColumnInfo): void;
121
121
  fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[], insertOnly: string[], autoIncrementColumn: string): void;
122
+ callableTemplate(func: CallableObjectInfo): void;
122
123
  }
package/lib/SqlDumper.js CHANGED
@@ -679,6 +679,14 @@ class SqlDumper {
679
679
  this.endCommand();
680
680
  }
681
681
  }
682
+ callableTemplate(func) {
683
+ this.put('^call %f(&>&n', func);
684
+ this.putCollection(',&n', func.parameters || [], param => {
685
+ this.putRaw(param.parameterMode == 'IN' ? ':' + param.parameterName : param.parameterName);
686
+ });
687
+ this.put('&<&n)');
688
+ this.endCommand();
689
+ }
682
690
  }
683
691
  exports.SqlDumper = SqlDumper;
684
692
  SqlDumper.keywordsCase = 'upperCase';
@@ -22,7 +22,7 @@ function extendTableInfo(table) {
22
22
  }
23
23
  exports.extendTableInfo = extendTableInfo;
24
24
  function fillDatabaseExtendedInfo(db) {
25
- return Object.assign(Object.assign({}, db), { tables: (db.tables || []).map(extendTableInfo), collections: (db.collections || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'collections' }))), views: (db.views || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'views' }))), matviews: (db.matviews || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'matviews' }))), procedures: (db.procedures || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'procedures' }))), functions: (db.functions || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'functions' }))), triggers: (db.triggers || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'triggers' }))) });
25
+ return Object.assign(Object.assign({}, db), { tables: (db.tables || []).map(extendTableInfo), collections: (db.collections || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'collections' }))), views: (db.views || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'views' }))), matviews: (db.matviews || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'matviews' }))), procedures: (db.procedures || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'procedures', parameters: (obj.parameters || []).map(param => (Object.assign(Object.assign({}, param), { pureName: obj.pureName, schemaName: obj.schemaName }))) }))), functions: (db.functions || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'functions', parameters: (obj.parameters || []).map(param => (Object.assign(Object.assign({}, param), { pureName: obj.pureName, schemaName: obj.schemaName }))) }))), triggers: (db.triggers || []).map(obj => (Object.assign(Object.assign({}, obj), { objectTypeField: 'triggers' }))) });
26
26
  }
27
27
  function extendDatabaseInfo(db) {
28
28
  return fillDatabaseExtendedInfo(addTableDependencies(db));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.0.0-alpha.1",
2
+ "version": "6.0.0",
3
3
  "name": "dbgate-tools",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -25,14 +25,14 @@
25
25
  ],
26
26
  "devDependencies": {
27
27
  "@types/node": "^13.7.0",
28
- "dbgate-types": "^6.0.0-alpha.1",
28
+ "dbgate-types": "^6.0.0",
29
29
  "jest": "^24.9.0",
30
30
  "ts-jest": "^25.2.1",
31
31
  "typescript": "^4.4.3"
32
32
  },
33
33
  "dependencies": {
34
34
  "dbgate-query-splitter": "^4.11.2",
35
- "dbgate-sqltree": "^6.0.0-alpha.1",
35
+ "dbgate-sqltree": "^6.0.0",
36
36
  "debug": "^4.3.4",
37
37
  "json-stable-stringify": "^1.0.1",
38
38
  "lodash": "^4.17.21",