@nocobase/plugin-collection-fdw 2.0.3

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 (155) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/07d37b2045cf49ac.js +10 -0
  6. package/dist/client/19796e1ee00c3777.js +10 -0
  7. package/dist/client/545679e3c044a8fb.js +10 -0
  8. package/dist/client/components/CreateDatabaseServerAction.d.ts +10 -0
  9. package/dist/client/components/DatabaseServerSelect.d.ts +20 -0
  10. package/dist/client/components/EditDatabaseServerAction.d.ts +10 -0
  11. package/dist/client/components/PreviewFields.d.ts +10 -0
  12. package/dist/client/components/PreviewTable.d.ts +10 -0
  13. package/dist/client/components/RemoteTableSelect.d.ts +10 -0
  14. package/dist/client/components/SyncFieldsAction.d.ts +11 -0
  15. package/dist/client/components/UnSupportFields.d.ts +12 -0
  16. package/dist/client/components/schema.d.ts +19 -0
  17. package/dist/client/dccc3127ba4bb534.js +10 -0
  18. package/dist/client/ff008086e5ac8e5e.js +10 -0
  19. package/dist/client/hooks.d.ts +20 -0
  20. package/dist/client/index.d.ts +13 -0
  21. package/dist/client/index.js +10 -0
  22. package/dist/externalVersion.js +24 -0
  23. package/dist/index.d.ts +9 -0
  24. package/dist/index.js +42 -0
  25. package/dist/locale/de-DE.json +17 -0
  26. package/dist/locale/en-US.json +17 -0
  27. package/dist/locale/es-ES.json +17 -0
  28. package/dist/locale/fr-FR.json +17 -0
  29. package/dist/locale/hu-HU.json +17 -0
  30. package/dist/locale/id-ID.json +17 -0
  31. package/dist/locale/index.d.ts +10 -0
  32. package/dist/locale/index.js +42 -0
  33. package/dist/locale/it-IT.json +17 -0
  34. package/dist/locale/ja-JP.json +17 -0
  35. package/dist/locale/ko-KR.json +17 -0
  36. package/dist/locale/nl-NL.json +17 -0
  37. package/dist/locale/pt-BR.json +17 -0
  38. package/dist/locale/ru-RU.json +18 -0
  39. package/dist/locale/tr-TR.json +17 -0
  40. package/dist/locale/uk-UA.json +17 -0
  41. package/dist/locale/vi-VN.json +17 -0
  42. package/dist/locale/zh-CN.json +17 -0
  43. package/dist/locale/zh-TW.json +17 -0
  44. package/dist/node_modules/node-sql-parser/LICENSE +201 -0
  45. package/dist/node_modules/node-sql-parser/ast/postgresql.ts +1834 -0
  46. package/dist/node_modules/node-sql-parser/build/bigquery.d.ts +1 -0
  47. package/dist/node_modules/node-sql-parser/build/bigquery.js +2 -0
  48. package/dist/node_modules/node-sql-parser/build/db2.d.ts +1 -0
  49. package/dist/node_modules/node-sql-parser/build/db2.js +2 -0
  50. package/dist/node_modules/node-sql-parser/build/flinksql.d.ts +1 -0
  51. package/dist/node_modules/node-sql-parser/build/flinksql.js +2 -0
  52. package/dist/node_modules/node-sql-parser/build/hive.d.ts +1 -0
  53. package/dist/node_modules/node-sql-parser/build/hive.js +2 -0
  54. package/dist/node_modules/node-sql-parser/build/mariadb.d.ts +1 -0
  55. package/dist/node_modules/node-sql-parser/build/mariadb.js +2 -0
  56. package/dist/node_modules/node-sql-parser/build/mysql.d.ts +1 -0
  57. package/dist/node_modules/node-sql-parser/build/mysql.js +2 -0
  58. package/dist/node_modules/node-sql-parser/build/noql.d.ts +1 -0
  59. package/dist/node_modules/node-sql-parser/build/noql.js +2 -0
  60. package/dist/node_modules/node-sql-parser/build/postgresql.d.ts +1 -0
  61. package/dist/node_modules/node-sql-parser/build/postgresql.js +2 -0
  62. package/dist/node_modules/node-sql-parser/build/snowflake.d.ts +1 -0
  63. package/dist/node_modules/node-sql-parser/build/snowflake.js +2 -0
  64. package/dist/node_modules/node-sql-parser/build/sqlite.d.ts +1 -0
  65. package/dist/node_modules/node-sql-parser/build/sqlite.js +2 -0
  66. package/dist/node_modules/node-sql-parser/build/transactsql.d.ts +1 -0
  67. package/dist/node_modules/node-sql-parser/build/transactsql.js +2 -0
  68. package/dist/node_modules/node-sql-parser/index.d.ts +1 -0
  69. package/dist/node_modules/node-sql-parser/index.js +1 -0
  70. package/dist/node_modules/node-sql-parser/lib/aggregation.js +39 -0
  71. package/dist/node_modules/node-sql-parser/lib/alter.js +174 -0
  72. package/dist/node_modules/node-sql-parser/lib/analyze.js +40 -0
  73. package/dist/node_modules/node-sql-parser/lib/array-struct.js +60 -0
  74. package/dist/node_modules/node-sql-parser/lib/assign.js +33 -0
  75. package/dist/node_modules/node-sql-parser/lib/binary.js +46 -0
  76. package/dist/node_modules/node-sql-parser/lib/case.js +39 -0
  77. package/dist/node_modules/node-sql-parser/lib/column.js +221 -0
  78. package/dist/node_modules/node-sql-parser/lib/command.js +299 -0
  79. package/dist/node_modules/node-sql-parser/lib/constrain.js +45 -0
  80. package/dist/node_modules/node-sql-parser/lib/create.js +439 -0
  81. package/dist/node_modules/node-sql-parser/lib/delete.js +42 -0
  82. package/dist/node_modules/node-sql-parser/lib/exec.js +37 -0
  83. package/dist/node_modules/node-sql-parser/lib/expr.js +123 -0
  84. package/dist/node_modules/node-sql-parser/lib/func.js +152 -0
  85. package/dist/node_modules/node-sql-parser/lib/index-definition.js +106 -0
  86. package/dist/node_modules/node-sql-parser/lib/insert.js +111 -0
  87. package/dist/node_modules/node-sql-parser/lib/interval.js +28 -0
  88. package/dist/node_modules/node-sql-parser/lib/json.js +28 -0
  89. package/dist/node_modules/node-sql-parser/lib/limit.js +45 -0
  90. package/dist/node_modules/node-sql-parser/lib/over.js +39 -0
  91. package/dist/node_modules/node-sql-parser/lib/parser.all.js +33 -0
  92. package/dist/node_modules/node-sql-parser/lib/parser.js +82 -0
  93. package/dist/node_modules/node-sql-parser/lib/parser.single.js +23 -0
  94. package/dist/node_modules/node-sql-parser/lib/proc.js +39 -0
  95. package/dist/node_modules/node-sql-parser/lib/select.js +132 -0
  96. package/dist/node_modules/node-sql-parser/lib/show.js +88 -0
  97. package/dist/node_modules/node-sql-parser/lib/sql.js +43 -0
  98. package/dist/node_modules/node-sql-parser/lib/tables.js +211 -0
  99. package/dist/node_modules/node-sql-parser/lib/transaction.js +26 -0
  100. package/dist/node_modules/node-sql-parser/lib/union.js +81 -0
  101. package/dist/node_modules/node-sql-parser/lib/update.js +59 -0
  102. package/dist/node_modules/node-sql-parser/lib/util.js +444 -0
  103. package/dist/node_modules/node-sql-parser/lib/window.js +85 -0
  104. package/dist/node_modules/node-sql-parser/lib/with.js +37 -0
  105. package/dist/node_modules/node-sql-parser/package.json +1 -0
  106. package/dist/node_modules/node-sql-parser/types.d.ts +227 -0
  107. package/dist/node_modules/node-sql-parser/umd/bigquery.umd.d.ts +1 -0
  108. package/dist/node_modules/node-sql-parser/umd/bigquery.umd.js +2 -0
  109. package/dist/node_modules/node-sql-parser/umd/db2.umd.d.ts +1 -0
  110. package/dist/node_modules/node-sql-parser/umd/db2.umd.js +2 -0
  111. package/dist/node_modules/node-sql-parser/umd/flinksql.umd.d.ts +1 -0
  112. package/dist/node_modules/node-sql-parser/umd/flinksql.umd.js +2 -0
  113. package/dist/node_modules/node-sql-parser/umd/hive.umd.d.ts +1 -0
  114. package/dist/node_modules/node-sql-parser/umd/hive.umd.js +2 -0
  115. package/dist/node_modules/node-sql-parser/umd/index.umd.d.ts +1 -0
  116. package/dist/node_modules/node-sql-parser/umd/index.umd.js +2 -0
  117. package/dist/node_modules/node-sql-parser/umd/mariadb.umd.d.ts +1 -0
  118. package/dist/node_modules/node-sql-parser/umd/mariadb.umd.js +2 -0
  119. package/dist/node_modules/node-sql-parser/umd/mysql.umd.d.ts +1 -0
  120. package/dist/node_modules/node-sql-parser/umd/mysql.umd.js +2 -0
  121. package/dist/node_modules/node-sql-parser/umd/noql.umd.d.ts +1 -0
  122. package/dist/node_modules/node-sql-parser/umd/noql.umd.js +2 -0
  123. package/dist/node_modules/node-sql-parser/umd/postgresql.umd.d.ts +1 -0
  124. package/dist/node_modules/node-sql-parser/umd/postgresql.umd.js +2 -0
  125. package/dist/node_modules/node-sql-parser/umd/snowflake.umd.d.ts +1 -0
  126. package/dist/node_modules/node-sql-parser/umd/snowflake.umd.js +2 -0
  127. package/dist/node_modules/node-sql-parser/umd/sqlite.umd.d.ts +1 -0
  128. package/dist/node_modules/node-sql-parser/umd/sqlite.umd.js +2 -0
  129. package/dist/node_modules/node-sql-parser/umd/transactsql.umd.d.ts +1 -0
  130. package/dist/node_modules/node-sql-parser/umd/transactsql.umd.js +2 -0
  131. package/dist/server/bridges/mariadb-to-mariadb.d.ts +3 -0
  132. package/dist/server/bridges/mariadb-to-mariadb.js +38 -0
  133. package/dist/server/bridges/mysql-to-mysql.d.ts +13 -0
  134. package/dist/server/bridges/mysql-to-mysql.js +117 -0
  135. package/dist/server/bridges/mysql-to-pg.d.ts +8 -0
  136. package/dist/server/bridges/mysql-to-pg.js +9 -0
  137. package/dist/server/bridges/pg-to-pg.d.ts +21 -0
  138. package/dist/server/bridges/pg-to-pg.js +137 -0
  139. package/dist/server/bridges/remote-local-bridge.d.ts +57 -0
  140. package/dist/server/bridges/remote-local-bridge.js +73 -0
  141. package/dist/server/collections/database-server-collection.d.ts +10 -0
  142. package/dist/server/collections/database-server-collection.js +54 -0
  143. package/dist/server/foreign-data-collection.d.ts +22 -0
  144. package/dist/server/foreign-data-collection.js +118 -0
  145. package/dist/server/index.d.ts +9 -0
  146. package/dist/server/index.js +42 -0
  147. package/dist/server/models/database-server.d.ts +29 -0
  148. package/dist/server/models/database-server.js +226 -0
  149. package/dist/server/plugin.d.ts +14 -0
  150. package/dist/server/plugin.js +111 -0
  151. package/dist/server/resourcers/tables.d.ts +17 -0
  152. package/dist/server/resourcers/tables.js +181 -0
  153. package/package.json +43 -0
  154. package/server.d.ts +2 -0
  155. package/server.js +1 -0
@@ -0,0 +1,299 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "./column", "./create", "./util", "./expr", "./tables", "./sql", "./union"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("./column"), require("./create"), require("./util"), require("./expr"), require("./tables"), require("./sql"), require("./union"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.column, global.create, global.util, global.expr, global.tables, global.sql, global.union);
11
+ global.command = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _column, _create, _util, _expr, _tables, _sql, _union) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.callToSQL = callToSQL;
20
+ _exports.commonCmdToSQL = commonCmdToSQL;
21
+ _exports.deallocateToSQL = deallocateToSQL;
22
+ _exports.declareToSQL = declareToSQL;
23
+ _exports.descToSQL = descToSQL;
24
+ _exports.executeToSQL = executeToSQL;
25
+ _exports.forLoopToSQL = forLoopToSQL;
26
+ _exports.grantAndRevokeToSQL = grantAndRevokeToSQL;
27
+ _exports.grantUserOrRoleToSQL = grantUserOrRoleToSQL;
28
+ _exports.ifToSQL = ifToSQL;
29
+ _exports.lockUnlockToSQL = lockUnlockToSQL;
30
+ _exports.raiseToSQL = raiseToSQL;
31
+ _exports.renameToSQL = renameToSQL;
32
+ _exports.setVarToSQL = setVarToSQL;
33
+ _exports.useToSQL = useToSQL;
34
+ _sql = _interopRequireDefault(_sql);
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
+ function callToSQL(stmt) {
37
+ const type = 'CALL';
38
+ const storeProcessCall = (0, _expr.exprToSQL)(stmt.expr);
39
+ return `${type} ${storeProcessCall}`;
40
+ }
41
+ function commonCmdToSQL(stmt) {
42
+ const {
43
+ type,
44
+ keyword,
45
+ name,
46
+ prefix
47
+ } = stmt;
48
+ const clauses = [(0, _util.toUpper)(type), (0, _util.toUpper)(keyword), (0, _util.toUpper)(prefix)];
49
+ switch (keyword) {
50
+ case 'table':
51
+ clauses.push((0, _tables.tablesToSQL)(name));
52
+ break;
53
+ case 'trigger':
54
+ clauses.push([name[0].schema ? `${(0, _util.identifierToSql)(name[0].schema)}.` : '', (0, _util.identifierToSql)(name[0].trigger)].filter(_util.hasVal).join(''));
55
+ break;
56
+ case 'database':
57
+ case 'schema':
58
+ case 'procedure':
59
+ clauses.push((0, _util.identifierToSql)(name));
60
+ break;
61
+ case 'view':
62
+ clauses.push((0, _tables.tablesToSQL)(name), stmt.options && stmt.options.map(_expr.exprToSQL).filter(_util.hasVal).join(' '));
63
+ break;
64
+ case 'index':
65
+ clauses.push((0, _column.columnRefToSQL)(name), ...(stmt.table ? ['ON', (0, _tables.tableToSQL)(stmt.table)] : []), stmt.options && stmt.options.map(_expr.exprToSQL).filter(_util.hasVal).join(' '));
66
+ break;
67
+ default:
68
+ break;
69
+ }
70
+ return clauses.filter(_util.hasVal).join(' ');
71
+ }
72
+ function descToSQL(stmt) {
73
+ const {
74
+ type,
75
+ table
76
+ } = stmt;
77
+ const action = (0, _util.toUpper)(type);
78
+ return `${action} ${(0, _util.identifierToSql)(table)}`;
79
+ }
80
+ function executeToSQL(stmt) {
81
+ const {
82
+ type,
83
+ name,
84
+ args
85
+ } = stmt;
86
+ const sql = [(0, _util.toUpper)(type)];
87
+ const nameWithArgs = [name];
88
+ if (args) nameWithArgs.push(`(${(0, _expr.exprToSQL)(args).join(', ')})`);
89
+ sql.push(nameWithArgs.join(''));
90
+ return sql.filter(_util.hasVal).join(' ');
91
+ }
92
+ function forLoopToSQL(stmt) {
93
+ const {
94
+ type,
95
+ label,
96
+ target,
97
+ query,
98
+ stmts
99
+ } = stmt;
100
+ const sql = [label, (0, _util.toUpper)(type), target, 'IN', (0, _union.multipleToSQL)([query]), 'LOOP', (0, _union.multipleToSQL)(stmts), 'END LOOP', label];
101
+ return sql.filter(_util.hasVal).join(' ');
102
+ }
103
+ function raiseToSQL(stmt) {
104
+ const {
105
+ type,
106
+ level,
107
+ raise,
108
+ using
109
+ } = stmt;
110
+ const sql = [(0, _util.toUpper)(type), (0, _util.toUpper)(level)];
111
+ if (raise) sql.push([(0, _util.literalToSQL)(raise.keyword), raise.type === 'format' && raise.expr.length > 0 && ','].filter(_util.hasVal).join(''), raise.expr.map(exprInfo => (0, _expr.exprToSQL)(exprInfo)).join(', '));
112
+ if (using) sql.push((0, _util.toUpper)(using.type), (0, _util.toUpper)(using.option), using.symbol, using.expr.map(exprInfo => (0, _expr.exprToSQL)(exprInfo)).join(', '));
113
+ return sql.filter(_util.hasVal).join(' ');
114
+ }
115
+ function renameToSQL(stmt) {
116
+ const {
117
+ type,
118
+ table
119
+ } = stmt;
120
+ const clauses = [];
121
+ const prefix = `${type && type.toUpperCase()} TABLE`;
122
+ if (table) {
123
+ for (const tables of table) {
124
+ const renameInfo = tables.map(_tables.tableToSQL);
125
+ clauses.push(renameInfo.join(' TO '));
126
+ }
127
+ }
128
+ return `${prefix} ${clauses.join(', ')}`;
129
+ }
130
+ function useToSQL(stmt) {
131
+ const {
132
+ type,
133
+ db
134
+ } = stmt;
135
+ const action = (0, _util.toUpper)(type);
136
+ const database = (0, _util.identifierToSql)(db);
137
+ return `${action} ${database}`;
138
+ }
139
+ function setVarToSQL(stmt) {
140
+ const {
141
+ expr
142
+ } = stmt;
143
+ const action = 'SET';
144
+ const val = (0, _expr.exprToSQL)(expr);
145
+ return `${action} ${val}`;
146
+ }
147
+ function pgLock(stmt) {
148
+ const {
149
+ lock_mode: lockMode,
150
+ nowait
151
+ } = stmt;
152
+ const lockInfo = [];
153
+ if (lockMode) {
154
+ const {
155
+ mode
156
+ } = lockMode;
157
+ lockInfo.push(mode.toUpperCase());
158
+ }
159
+ if (nowait) lockInfo.push(nowait.toUpperCase());
160
+ return lockInfo;
161
+ }
162
+ function lockUnlockToSQL(stmt) {
163
+ const {
164
+ type,
165
+ keyword,
166
+ tables
167
+ } = stmt;
168
+ const result = [type.toUpperCase(), (0, _util.toUpper)(keyword)];
169
+ if (type.toUpperCase() === 'UNLOCK') return result.join(' ');
170
+ const tableStmt = [];
171
+ for (const tableInfo of tables) {
172
+ const {
173
+ table,
174
+ lock_type: lockType
175
+ } = tableInfo;
176
+ const tableInfoTemp = [(0, _tables.tableToSQL)(table)];
177
+ if (lockType) {
178
+ const lockKeyList = ['prefix', 'type', 'suffix'];
179
+ tableInfoTemp.push(lockKeyList.map(key => (0, _util.toUpper)(lockType[key])).filter(_util.hasVal).join(' '));
180
+ }
181
+ tableStmt.push(tableInfoTemp.join(' '));
182
+ }
183
+ result.push(tableStmt.join(', '), ...pgLock(stmt));
184
+ return result.filter(_util.hasVal).join(' ');
185
+ }
186
+ function deallocateToSQL(stmt) {
187
+ const {
188
+ type,
189
+ keyword,
190
+ expr
191
+ } = stmt;
192
+ return [(0, _util.toUpper)(type), (0, _util.toUpper)(keyword), (0, _expr.exprToSQL)(expr)].filter(_util.hasVal).join(' ');
193
+ }
194
+ function declareToSQL(stmt) {
195
+ const {
196
+ type,
197
+ declare,
198
+ symbol
199
+ } = stmt;
200
+ const result = [(0, _util.toUpper)(type)];
201
+ const info = declare.map(dec => {
202
+ const {
203
+ at,
204
+ name,
205
+ as,
206
+ constant,
207
+ datatype,
208
+ not_null,
209
+ prefix,
210
+ definition,
211
+ keyword
212
+ } = dec;
213
+ const declareInfo = [[at, name].filter(_util.hasVal).join(''), (0, _util.toUpper)(as), (0, _util.toUpper)(constant)];
214
+ switch (keyword) {
215
+ case 'variable':
216
+ declareInfo.push((0, _column.columnDataType)(datatype), ...(0, _util.commonTypeValue)(dec.collate), (0, _util.toUpper)(not_null));
217
+ if (definition) declareInfo.push((0, _util.toUpper)(definition.keyword), (0, _expr.exprToSQL)(definition.value));
218
+ break;
219
+ case 'cursor':
220
+ declareInfo.push((0, _util.toUpper)(prefix));
221
+ break;
222
+ case 'table':
223
+ declareInfo.push((0, _util.toUpper)(prefix), `(${definition.map(_create.createDefinitionToSQL).join(', ')})`);
224
+ break;
225
+ default:
226
+ break;
227
+ }
228
+ return declareInfo.filter(_util.hasVal).join(' ');
229
+ }).join(`${symbol} `);
230
+ result.push(info);
231
+ return result.join(' ');
232
+ }
233
+ function ifToSQL(stmt) {
234
+ const {
235
+ boolean_expr: boolExpr,
236
+ else_expr: elseExpr,
237
+ elseif_expr: elseifExpr,
238
+ if_expr: ifExpr,
239
+ prefix,
240
+ go,
241
+ semicolons,
242
+ suffix,
243
+ type
244
+ } = stmt;
245
+ const result = [(0, _util.toUpper)(type), (0, _expr.exprToSQL)(boolExpr), (0, _util.literalToSQL)(prefix), `${(0, _sql.default)(ifExpr.ast || ifExpr)}${semicolons[0]}`, (0, _util.toUpper)(go)];
246
+ if (elseifExpr) {
247
+ result.push(elseifExpr.map(elseif => [(0, _util.toUpper)(elseif.type), (0, _expr.exprToSQL)(elseif.boolean_expr), 'THEN', (0, _sql.default)(elseif.then.ast || elseif.then), elseif.semicolon].filter(_util.hasVal).join(' ')).join(' '));
248
+ }
249
+ if (elseExpr) result.push('ELSE', `${(0, _sql.default)(elseExpr.ast || elseExpr)}${semicolons[1]}`);
250
+ result.push((0, _util.literalToSQL)(suffix));
251
+ return result.filter(_util.hasVal).join(' ');
252
+ }
253
+ function grantUserOrRoleToSQL(stmt) {
254
+ const {
255
+ name,
256
+ host
257
+ } = stmt;
258
+ const result = [(0, _util.literalToSQL)(name)];
259
+ if (host) result.push('@', (0, _util.literalToSQL)(host));
260
+ return result.join('');
261
+ }
262
+ function grantAndRevokeToSQL(stmt) {
263
+ const {
264
+ type,
265
+ grant_option_for,
266
+ keyword,
267
+ objects,
268
+ on,
269
+ to_from,
270
+ user_or_roles,
271
+ with: withOpt
272
+ } = stmt;
273
+ const result = [(0, _util.toUpper)(type), (0, _util.literalToSQL)(grant_option_for)];
274
+ const objStr = objects.map(obj => {
275
+ const {
276
+ priv,
277
+ columns
278
+ } = obj;
279
+ const privSQL = [(0, _expr.exprToSQL)(priv)];
280
+ if (columns) privSQL.push(`(${columns.map(_column.columnRefToSQL).join(', ')})`);
281
+ return privSQL.join(' ');
282
+ }).join(', ');
283
+ result.push(objStr);
284
+ if (on) {
285
+ result.push('ON');
286
+ switch (keyword) {
287
+ case 'priv':
288
+ result.push((0, _util.literalToSQL)(on.object_type), on.priv_level.map(privLevel => [(0, _util.identifierToSql)(privLevel.prefix), (0, _util.identifierToSql)(privLevel.name)].filter(_util.hasVal).join('.')).join(', '));
289
+ break;
290
+ case 'proxy':
291
+ result.push(grantUserOrRoleToSQL(on));
292
+ break;
293
+ }
294
+ }
295
+ result.push((0, _util.toUpper)(to_from), user_or_roles.map(grantUserOrRoleToSQL).join(', '));
296
+ result.push((0, _util.literalToSQL)(withOpt));
297
+ return result.filter(_util.hasVal).join(' ');
298
+ }
299
+ });
@@ -0,0 +1,45 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "./util", "./index-definition", "./column"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("./util"), require("./index-definition"), require("./column"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.util, global.indexDefinition, global.column);
11
+ global.constrain = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _util, _indexDefinition, _column) {
14
+ "use strict";
15
+
16
+ Object.defineProperty(_exports, "__esModule", {
17
+ value: true
18
+ });
19
+ _exports.constraintDefinitionToSQL = constraintDefinitionToSQL;
20
+ function constraintDefinitionToSQL(constraintDefinition) {
21
+ if (!constraintDefinition) return;
22
+ const {
23
+ constraint,
24
+ constraint_type: constraintType,
25
+ enforced,
26
+ index,
27
+ keyword,
28
+ reference_definition: referenceDefinition
29
+ } = constraintDefinition;
30
+ const constraintSQL = [];
31
+ const {
32
+ database
33
+ } = (0, _util.getParserOpt)();
34
+ constraintSQL.push((0, _util.toUpper)(keyword));
35
+ constraintSQL.push((0, _util.identifierToSql)(constraint));
36
+ let constraintTypeStr = (0, _util.toUpper)(constraintType);
37
+ if (database === 'sqlite' && constraintTypeStr === 'UNIQUE KEY') constraintTypeStr = 'UNIQUE';
38
+ constraintSQL.push(constraintTypeStr);
39
+ constraintSQL.push(database !== 'sqlite' && (0, _util.identifierToSql)(index));
40
+ constraintSQL.push(...(0, _indexDefinition.indexTypeAndOptionToSQL)(constraintDefinition));
41
+ constraintSQL.push(...(0, _column.columnReferenceDefinitionToSQL)(referenceDefinition));
42
+ constraintSQL.push((0, _util.toUpper)(enforced));
43
+ return constraintSQL.filter(_util.hasVal).join(' ');
44
+ }
45
+ });