@nocobase/plugin-multi-app-manager 1.2.13-alpha → 1.3.0-alpha.20240710084543

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 (175) hide show
  1. package/package.json +2 -2
  2. package/dist/client/AppManager.d.ts +0 -10
  3. package/dist/client/AppNameInput.d.ts +0 -10
  4. package/dist/client/MultiAppManagerProvider.d.ts +0 -10
  5. package/dist/client/MultiAppManagerProvider.style.d.ts +0 -13
  6. package/dist/client/Settings.d.ts +0 -10
  7. package/dist/client/index.d.ts +0 -14
  8. package/dist/client/index.js +0 -10
  9. package/dist/client/settings/schemas/applications.d.ts +0 -18
  10. package/dist/client/utils.d.ts +0 -12
  11. package/dist/externalVersion.js +0 -25
  12. package/dist/index.d.ts +0 -10
  13. package/dist/index.js +0 -48
  14. package/dist/locale/en-US.json +0 -11
  15. package/dist/locale/es-ES.json +0 -9
  16. package/dist/locale/index.d.ts +0 -9
  17. package/dist/locale/index.js +0 -36
  18. package/dist/locale/ko_KR.json +0 -11
  19. package/dist/locale/pt-BR.json +0 -9
  20. package/dist/locale/zh-CN.json +0 -14
  21. package/dist/node_modules/mariadb/LICENSE +0 -502
  22. package/dist/node_modules/mariadb/callback.js +0 -41
  23. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
  24. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  25. package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
  26. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
  27. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
  28. package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
  29. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
  30. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
  34. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
  35. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
  36. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
  37. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
  38. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
  39. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  40. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  41. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +0 -74
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
  43. package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
  44. package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
  45. package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
  46. package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
  47. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  48. package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
  49. package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
  50. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  51. package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
  52. package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
  53. package/dist/node_modules/mariadb/lib/connection.js +0 -1460
  54. package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
  55. package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
  56. package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
  57. package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
  58. package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
  59. package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
  60. package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
  61. package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
  62. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  63. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  64. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +0 -141
  65. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
  66. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
  67. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
  68. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
  69. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
  70. package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
  71. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  72. package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
  73. package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
  74. package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
  75. package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
  76. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  77. package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
  78. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  79. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
  80. package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
  81. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
  82. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
  83. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
  84. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
  85. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
  86. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
  87. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
  88. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
  89. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
  90. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
  91. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
  92. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
  93. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
  94. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
  95. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
  96. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
  97. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
  98. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
  99. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
  100. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
  101. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
  102. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
  103. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
  104. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
  105. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
  106. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
  107. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
  108. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
  109. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
  110. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
  111. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
  112. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
  113. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
  114. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
  115. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
  116. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
  117. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
  118. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
  119. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
  120. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
  121. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
  122. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
  123. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
  124. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
  125. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
  126. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
  127. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
  128. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
  129. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
  130. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
  131. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
  132. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
  133. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  134. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  135. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  136. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  137. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  138. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +0 -8
  139. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  140. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  141. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  142. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +0 -23
  143. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +0 -198
  144. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  145. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  146. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  147. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  148. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  149. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  150. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  151. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  152. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  153. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  154. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  155. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +0 -197
  156. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +0 -319
  157. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +0 -290
  158. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  159. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +0 -41
  160. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +0 -180
  161. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +0 -109
  162. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +0 -44
  163. package/dist/node_modules/mariadb/package.json +0 -1
  164. package/dist/node_modules/mariadb/promise.js +0 -34
  165. package/dist/node_modules/mariadb/types/index.d.ts +0 -870
  166. package/dist/server/collections/applications.d.ts +0 -10
  167. package/dist/server/collections/applications.js +0 -75
  168. package/dist/server/index.d.ts +0 -11
  169. package/dist/server/index.js +0 -40
  170. package/dist/server/models/application.d.ts +0 -18
  171. package/dist/server/models/application.js +0 -50
  172. package/dist/server/server.d.ts +0 -26
  173. package/dist/server/server.js +0 -310
  174. package/dist/swagger/index.d.ts +0 -195
  175. package/dist/swagger/index.js +0 -226
@@ -1,149 +0,0 @@
1
- 'use strict';
2
-
3
- const Iconv = require('iconv-lite');
4
- const Capabilities = require('../const/capabilities');
5
- const Ed25519PasswordAuth = require('./handshake/auth/ed25519-password-auth');
6
- const NativePasswordAuth = require('./handshake/auth/native-password-auth');
7
- const Collations = require('../const/collations');
8
- const Handshake = require('./handshake/handshake');
9
-
10
- /**
11
- * send a COM_CHANGE_USER: resets the connection and re-authenticates with the given credentials
12
- * see https://mariadb.com/kb/en/library/com_change_user/
13
- */
14
- class ChangeUser extends Handshake {
15
- constructor(options, resolve, reject, addCommand) {
16
- super(resolve, reject, () => {}, addCommand);
17
- this.opts = options;
18
- }
19
-
20
- start(out, opts, info) {
21
- this.configAssign(opts, this.opts);
22
- let authToken;
23
- const pwd = Array.isArray(this.opts.password) ? this.opts.password[0] : this.opts.password;
24
- switch (info.defaultPluginName) {
25
- case 'mysql_native_password':
26
- case '':
27
- authToken = NativePasswordAuth.encryptPassword(pwd, info.seed, 'sha1');
28
- break;
29
- case 'client_ed25519':
30
- authToken = Ed25519PasswordAuth.encryptPassword(pwd, info.seed);
31
- break;
32
- default:
33
- authToken = Buffer.alloc(0);
34
- break;
35
- }
36
-
37
- out.startPacket(this);
38
- out.writeInt8(0x11);
39
- out.writeString(this.opts.user || '');
40
- out.writeInt8(0);
41
-
42
- if (info.serverCapabilities & Capabilities.SECURE_CONNECTION) {
43
- out.writeInt8(authToken.length);
44
- out.writeBuffer(authToken, 0, authToken.length);
45
- } else {
46
- out.writeBuffer(authToken, 0, authToken.length);
47
- out.writeInt8(0);
48
- }
49
-
50
- if (info.clientCapabilities & Capabilities.CONNECT_WITH_DB) {
51
- out.writeString(this.opts.database);
52
- out.writeInt8(0);
53
- info.database = this.opts.database;
54
- }
55
-
56
- out.writeInt16(this.opts.collation.index);
57
-
58
- if (info.clientCapabilities & Capabilities.PLUGIN_AUTH) {
59
- out.writeString(info.defaultPluginName);
60
- out.writeInt8(0);
61
- }
62
-
63
- if (info.clientCapabilities & Capabilities.CONNECT_ATTRS) {
64
- out.writeInt8(0xfc);
65
- let initPos = out.pos; //save position, assuming connection attributes length will be less than 2 bytes length
66
- out.writeInt16(0);
67
-
68
- const encoding = this.opts.collation.charset;
69
-
70
- writeParam(out, '_client_name', encoding);
71
- writeParam(out, 'MariaDB connector/Node', encoding);
72
-
73
- let packageJson = require('../../package.json');
74
- writeParam(out, '_client_version', encoding);
75
- writeParam(out, packageJson.version, encoding);
76
-
77
- writeParam(out, '_node_version', encoding);
78
- writeParam(out, process.versions.node, encoding);
79
-
80
- if (opts.connectAttributes !== true) {
81
- let attrNames = Object.keys(this.opts.connectAttributes);
82
- for (let k = 0; k < attrNames.length; ++k) {
83
- writeParam(out, attrNames[k], encoding);
84
- writeParam(out, this.opts.connectAttributes[attrNames[k]], encoding);
85
- }
86
- }
87
-
88
- //write end size
89
- out.writeInt16AtPos(initPos);
90
- }
91
-
92
- out.flushBuffer(true);
93
- this.onPacketReceive = this.handshakeResult;
94
- }
95
-
96
- /**
97
- * Assign global configuration option used by result-set to current query option.
98
- * a little faster than Object.assign() since doest copy all information
99
- *
100
- * @param connOpts connection global configuration
101
- * @param opt current options
102
- */
103
- configAssign(connOpts, opt) {
104
- if (!opt) {
105
- this.opts = connOpts;
106
- return;
107
- }
108
- this.opts.database = opt.database ? opt.database : connOpts.database;
109
- this.opts.connectAttributes = opt.connectAttributes
110
- ? opt.connectAttributes
111
- : connOpts.connectAttributes;
112
-
113
- if (opt.charset && typeof opt.charset === 'string') {
114
- this.opts.collation = Collations.fromCharset(opt.charset.toLowerCase());
115
- if (this.opts.collation === undefined) {
116
- this.opts.collation = Collations.fromName(opt.charset.toUpperCase());
117
- if (this.opts.collation !== undefined) {
118
- console.log(
119
- "warning: please use option 'collation' " +
120
- "in replacement of 'charset' when using a collation name ('" +
121
- opt.charset +
122
- "')\n" +
123
- "(collation looks like 'UTF8MB4_UNICODE_CI', charset like 'utf8')."
124
- );
125
- }
126
- }
127
- if (this.opts.collation === undefined)
128
- throw new RangeError("Unknown charset '" + opt.charset + "'");
129
- } else if (opt.collation && typeof opt.collation === 'string') {
130
- const initial = opt.collation;
131
- this.opts.collation = Collations.fromName(initial.toUpperCase());
132
- if (this.opts.collation === undefined)
133
- throw new RangeError("Unknown collation '" + initial + "'");
134
- } else {
135
- this.opts.collation = Collations.fromIndex(opt.charsetNumber) || connOpts.collation;
136
- }
137
- connOpts.password = opt.password;
138
- }
139
- }
140
-
141
- function writeParam(out, val, encoding) {
142
- let param = Buffer.isEncoding(encoding)
143
- ? Buffer.from(val, encoding)
144
- : Iconv.encode(val, encoding);
145
- out.writeLengthCoded(param.length);
146
- out.writeBuffer(param, 0, param.length);
147
- }
148
-
149
- module.exports = ChangeUser;
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- const Command = require('../command');
4
-
5
- /**
6
- * Ok_Packet
7
- * see https://mariadb.com/kb/en/ok_packet/
8
- */
9
- class OkPacket {
10
- constructor(affectedRows, insertId, warningStatus) {
11
- this.affectedRows = affectedRows;
12
- this.insertId = insertId;
13
- this.warningStatus = warningStatus;
14
- }
15
- }
16
-
17
- module.exports = OkPacket;
@@ -1,102 +0,0 @@
1
- 'use strict';
2
-
3
- const Collations = require('../const/collations.js');
4
- const FieldType = require('../const/field-type');
5
- const Capabilities = require('../const/capabilities');
6
-
7
- /**
8
- * Column definition
9
- * see https://mariadb.com/kb/en/library/resultset/#column-definition-packet
10
- */
11
- class ColumnDef {
12
- constructor(packet, info) {
13
- this._parse = new StringParser(packet);
14
- if (info.serverCapabilities & Capabilities.MARIADB_CLIENT_EXTENDED_TYPE_INFO) {
15
- const subPacket = packet.subPacketLengthEncoded();
16
- while (subPacket.remaining()) {
17
- switch (subPacket.readUInt8()) {
18
- case 0:
19
- this.dataTypeName = subPacket.readAsciiStringLengthEncoded();
20
- break;
21
-
22
- case 1:
23
- this.dataTypeFormat = subPacket.readAsciiStringLengthEncoded();
24
- break;
25
-
26
- default:
27
- // skip data
28
- const len = subPacket.readUnsignedLength();
29
- if (len) {
30
- subPacket.skip(len);
31
- }
32
- break;
33
- }
34
- }
35
- }
36
-
37
- packet.skip(1); // length of fixed fields
38
- this.collation = Collations.fromIndex(packet.readUInt16());
39
- this.columnLength = packet.readUInt32();
40
- this.columnType = packet.readUInt8();
41
- this.flags = packet.readUInt16();
42
- this.scale = packet.readUInt8();
43
- this.type = FieldType.TYPES[this.columnType];
44
- }
45
-
46
- db() {
47
- return this._parse.packet.readString(this._parse.dbOffset, this._parse.dbLength);
48
- }
49
-
50
- schema() {
51
- return this._parse.packet.readString(this._parse.dbOffset, this._parse.dbLength);
52
- }
53
-
54
- table() {
55
- return this._parse.packet.readString(this._parse.tableOffset, this._parse.tableLength);
56
- }
57
-
58
- orgTable() {
59
- return this._parse.packet.readString(this._parse.orgTableOffset, this._parse.orgTableLength);
60
- }
61
-
62
- name() {
63
- return this._parse.packet.readString(this._parse.nameOffset, this._parse.nameLength);
64
- }
65
-
66
- orgName() {
67
- return this._parse.packet.readString(this._parse.orgNameOffset, this._parse.orgNameLength);
68
- }
69
- }
70
-
71
- /**
72
- * String parser.
73
- * This object permits to avoid listing all private information to metadata object.
74
- */
75
- class StringParser {
76
- constructor(packet) {
77
- packet.skip(4); // skip 'def'
78
-
79
- this.dbLength = packet.readUnsignedLength();
80
- this.dbOffset = packet.pos;
81
- packet.skip(this.dbLength);
82
-
83
- this.tableLength = packet.readUnsignedLength();
84
- this.tableOffset = packet.pos;
85
- packet.skip(this.tableLength);
86
-
87
- this.orgTableLength = packet.readUnsignedLength();
88
- this.orgTableOffset = packet.pos;
89
- packet.skip(this.orgTableLength);
90
-
91
- this.nameLength = packet.readUnsignedLength();
92
- this.nameOffset = packet.pos;
93
- packet.skip(this.nameLength);
94
-
95
- this.orgNameLength = packet.readUnsignedLength();
96
- this.orgNameOffset = packet.pos;
97
- packet.skip(this.orgNameLength);
98
- this.packet = packet;
99
- }
100
- }
101
-
102
- module.exports = ColumnDef;
@@ -1,168 +0,0 @@
1
- 'use strict';
2
-
3
- const EventEmitter = require('events');
4
- const Errors = require('../misc/errors');
5
- const ServerStatus = require('../const/server-status');
6
- const StateChange = require('../const/state-change');
7
- const Collations = require('../const/collations');
8
- const OkPacket = require('./class/ok-packet');
9
-
10
- /**
11
- * Default command interface.
12
- */
13
- class Command extends EventEmitter {
14
- constructor(resolve, reject) {
15
- super();
16
- this.sequenceNo = -1;
17
- this.compressSequenceNo = -1;
18
- this.resolve = resolve;
19
- this.reject = reject;
20
- this.sending = false;
21
- }
22
-
23
- displaySql() {
24
- return null;
25
- }
26
-
27
- /**
28
- * Throw an an unexpected error.
29
- * server exchange will still be read to keep connection in a good state, but promise will be rejected.
30
- *
31
- * @param msg message
32
- * @param fatal is error fatal for connection
33
- * @param info current server state information
34
- * @param sqlState error sqlState
35
- * @param errno error number
36
- */
37
- throwUnexpectedError(msg, fatal, info, sqlState, errno) {
38
- if (this.reject) {
39
- process.nextTick(
40
- this.reject,
41
- Errors.createError(msg, this.displaySql(), fatal, info, sqlState, errno, this.stack, false)
42
- );
43
- this.resolve = null;
44
- this.reject = null;
45
- }
46
- }
47
-
48
- /**
49
- * Create and throw new Error from error information
50
- * only first called throwing an error or successfully end will be executed.
51
- *
52
- * @param msg message
53
- * @param fatal is error fatal for connection
54
- * @param info current server state information
55
- * @param sqlState error sqlState
56
- * @param errno error number
57
- */
58
- throwNewError(msg, fatal, info, sqlState, errno) {
59
- this.onPacketReceive = null;
60
- if (this.reject) {
61
- process.nextTick(
62
- this.reject,
63
- Errors.createError(msg, this.displaySql(), fatal, info, sqlState, errno, this.stack, false)
64
- );
65
- this.resolve = null;
66
- this.reject = null;
67
- }
68
- this.emit('end');
69
- }
70
-
71
- /**
72
- * Throw Error
73
- * only first called throwing an error or successfully end will be executed.
74
- *
75
- * @param err error to be thrown
76
- * @param info current server state information
77
- */
78
- throwError(err, info) {
79
- this.onPacketReceive = null;
80
- if (this.reject) {
81
- if (this.stack) {
82
- err = Errors.createError(
83
- err.message,
84
- err.sql,
85
- err.fatal,
86
- info,
87
- err.sqlState,
88
- err.errno,
89
- this.stack,
90
- false
91
- );
92
- }
93
- this.resolve = null;
94
- process.nextTick(this.reject, err);
95
- this.reject = null;
96
- }
97
- this.emit('end', err);
98
- }
99
-
100
- /**
101
- * Successfully end command.
102
- * only first called throwing an error or successfully end will be executed.
103
- *
104
- * @param val return value.
105
- */
106
- successEnd(val) {
107
- this.onPacketReceive = null;
108
- if (this.resolve) {
109
- this.reject = null;
110
- process.nextTick(this.resolve, val);
111
- this.resolve = null;
112
- }
113
- this.emit('end');
114
- }
115
-
116
- parseOkPacket(packet, out, opts, info) {
117
- packet.skip(1); //skip header
118
-
119
- const affectedRows = packet.readUnsignedLength();
120
- const insertId = opts.supportBigInt
121
- ? packet.readSignedLengthBigInt()
122
- : packet.readSignedLength();
123
-
124
- info.status = packet.readUInt16();
125
-
126
- const okPacket = new OkPacket(affectedRows, insertId, packet.readUInt16());
127
-
128
- if (info.status & ServerStatus.SESSION_STATE_CHANGED) {
129
- packet.skipLengthCodedNumber();
130
- while (packet.remaining()) {
131
- const subPacket = packet.subPacketLengthEncoded();
132
- while (subPacket.remaining()) {
133
- const type = subPacket.readUInt8();
134
- switch (type) {
135
- case StateChange.SESSION_TRACK_SYSTEM_VARIABLES:
136
- const subSubPacket = subPacket.subPacketLengthEncoded();
137
- const variable = subSubPacket.readStringLength();
138
- const value = subSubPacket.readStringLength();
139
-
140
- switch (variable) {
141
- case 'character_set_client':
142
- opts.collation = Collations.fromCharset(value);
143
- if (opts.collation === undefined) {
144
- this.throwError(new Error("unknown charset : '" + value + "'"), info);
145
- return;
146
- }
147
- opts.emit('collation', opts.collation);
148
- break;
149
-
150
- default:
151
- //variable not used by driver
152
- }
153
- break;
154
-
155
- case StateChange.SESSION_TRACK_SCHEMA:
156
- const subSubPacket2 = subPacket.subPacketLengthEncoded();
157
- info.database = subSubPacket2.readStringLength();
158
- break;
159
- }
160
- }
161
- }
162
- }
163
-
164
- return okPacket;
165
- }
166
- }
167
-
168
- module.exports = Command;