@nocobase/plugin-multi-app-manager 2.1.0-alpha.1 → 2.1.0-alpha.11

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 (146) hide show
  1. package/LICENSE +201 -661
  2. package/README.md +79 -10
  3. package/dist/client/Migrate.d.ts +10 -0
  4. package/dist/client/e9551d3b66931c0a.js +10 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/externalVersion.js +7 -7
  7. package/dist/locale/en-US.json +3 -2
  8. package/dist/locale/zh-CN.json +3 -2
  9. package/dist/node_modules/p-queue/dist/index.d.ts +101 -0
  10. package/dist/node_modules/p-queue/dist/index.js +1 -0
  11. package/dist/node_modules/p-queue/dist/lower-bound.d.ts +1 -0
  12. package/dist/node_modules/p-queue/dist/lower-bound.js +21 -0
  13. package/dist/node_modules/p-queue/dist/options.d.ts +64 -0
  14. package/dist/node_modules/p-queue/dist/options.js +2 -0
  15. package/dist/node_modules/p-queue/dist/priority-queue.d.ts +12 -0
  16. package/dist/node_modules/p-queue/dist/priority-queue.js +32 -0
  17. package/dist/node_modules/p-queue/dist/queue.d.ts +7 -0
  18. package/dist/node_modules/p-queue/dist/queue.js +2 -0
  19. package/dist/node_modules/p-queue/license +9 -0
  20. package/dist/node_modules/p-queue/node_modules/eventemitter3/index.d.ts +134 -0
  21. package/dist/node_modules/p-queue/node_modules/eventemitter3/index.js +336 -0
  22. package/dist/node_modules/p-queue/node_modules/eventemitter3/package.json +56 -0
  23. package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.js +340 -0
  24. package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.min.js +1 -0
  25. package/dist/node_modules/p-queue/package.json +1 -0
  26. package/dist/server/adapters/legacy-adapter.d.ts +43 -0
  27. package/dist/server/adapters/legacy-adapter.js +207 -0
  28. package/dist/server/server.d.ts +4 -6
  29. package/dist/server/server.js +38 -191
  30. package/package.json +3 -3
  31. package/dist/client/db3a142b120d6553.js +0 -10
  32. package/dist/node_modules/mariadb/LICENSE +0 -502
  33. package/dist/node_modules/mariadb/callback.js +0 -41
  34. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
  35. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  36. package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
  37. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
  38. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
  39. package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
  40. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
  41. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
  43. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
  44. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
  45. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
  46. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
  47. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
  48. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
  49. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
  50. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  51. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  52. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +0 -74
  53. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
  54. package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
  55. package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
  56. package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
  57. package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
  58. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  59. package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
  60. package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
  61. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  62. package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
  63. package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
  64. package/dist/node_modules/mariadb/lib/connection.js +0 -1460
  65. package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
  66. package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
  67. package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
  68. package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
  69. package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
  70. package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
  71. package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
  72. package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
  73. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  74. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  75. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +0 -141
  76. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
  77. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
  78. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
  79. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
  80. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
  81. package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
  82. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  83. package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
  84. package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
  85. package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
  86. package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
  87. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  88. package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
  89. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  90. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
  91. package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
  92. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
  93. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
  94. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
  95. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
  96. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
  97. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
  98. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
  99. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
  100. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
  101. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
  102. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
  103. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
  104. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
  105. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
  106. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
  107. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
  108. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
  109. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
  110. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
  111. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
  112. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
  113. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
  114. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
  115. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
  116. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
  117. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
  118. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
  119. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
  120. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
  121. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
  122. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
  123. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
  124. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
  125. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
  126. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
  127. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
  128. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
  129. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
  130. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
  131. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
  132. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
  133. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
  134. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
  135. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
  136. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
  137. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
  138. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
  139. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
  140. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
  141. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
  142. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
  143. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
  144. package/dist/node_modules/mariadb/package.json +0 -1
  145. package/dist/node_modules/mariadb/promise.js +0 -34
  146. package/dist/node_modules/mariadb/types/index.d.ts +0 -870
@@ -0,0 +1,340 @@
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.EventEmitter3 = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
+ 'use strict';
3
+
4
+ var has = Object.prototype.hasOwnProperty
5
+ , prefix = '~';
6
+
7
+ /**
8
+ * Constructor to create a storage for our `EE` objects.
9
+ * An `Events` instance is a plain object whose properties are event names.
10
+ *
11
+ * @constructor
12
+ * @private
13
+ */
14
+ function Events() {}
15
+
16
+ //
17
+ // We try to not inherit from `Object.prototype`. In some engines creating an
18
+ // instance in this way is faster than calling `Object.create(null)` directly.
19
+ // If `Object.create(null)` is not supported we prefix the event names with a
20
+ // character to make sure that the built-in object properties are not
21
+ // overridden or used as an attack vector.
22
+ //
23
+ if (Object.create) {
24
+ Events.prototype = Object.create(null);
25
+
26
+ //
27
+ // This hack is needed because the `__proto__` property is still inherited in
28
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
29
+ //
30
+ if (!new Events().__proto__) prefix = false;
31
+ }
32
+
33
+ /**
34
+ * Representation of a single event listener.
35
+ *
36
+ * @param {Function} fn The listener function.
37
+ * @param {*} context The context to invoke the listener with.
38
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
39
+ * @constructor
40
+ * @private
41
+ */
42
+ function EE(fn, context, once) {
43
+ this.fn = fn;
44
+ this.context = context;
45
+ this.once = once || false;
46
+ }
47
+
48
+ /**
49
+ * Add a listener for a given event.
50
+ *
51
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
52
+ * @param {(String|Symbol)} event The event name.
53
+ * @param {Function} fn The listener function.
54
+ * @param {*} context The context to invoke the listener with.
55
+ * @param {Boolean} once Specify if the listener is a one-time listener.
56
+ * @returns {EventEmitter}
57
+ * @private
58
+ */
59
+ function addListener(emitter, event, fn, context, once) {
60
+ if (typeof fn !== 'function') {
61
+ throw new TypeError('The listener must be a function');
62
+ }
63
+
64
+ var listener = new EE(fn, context || emitter, once)
65
+ , evt = prefix ? prefix + event : event;
66
+
67
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
68
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
69
+ else emitter._events[evt] = [emitter._events[evt], listener];
70
+
71
+ return emitter;
72
+ }
73
+
74
+ /**
75
+ * Clear event by name.
76
+ *
77
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
78
+ * @param {(String|Symbol)} evt The Event name.
79
+ * @private
80
+ */
81
+ function clearEvent(emitter, evt) {
82
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
83
+ else delete emitter._events[evt];
84
+ }
85
+
86
+ /**
87
+ * Minimal `EventEmitter` interface that is molded against the Node.js
88
+ * `EventEmitter` interface.
89
+ *
90
+ * @constructor
91
+ * @public
92
+ */
93
+ function EventEmitter() {
94
+ this._events = new Events();
95
+ this._eventsCount = 0;
96
+ }
97
+
98
+ /**
99
+ * Return an array listing the events for which the emitter has registered
100
+ * listeners.
101
+ *
102
+ * @returns {Array}
103
+ * @public
104
+ */
105
+ EventEmitter.prototype.eventNames = function eventNames() {
106
+ var names = []
107
+ , events
108
+ , name;
109
+
110
+ if (this._eventsCount === 0) return names;
111
+
112
+ for (name in (events = this._events)) {
113
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
114
+ }
115
+
116
+ if (Object.getOwnPropertySymbols) {
117
+ return names.concat(Object.getOwnPropertySymbols(events));
118
+ }
119
+
120
+ return names;
121
+ };
122
+
123
+ /**
124
+ * Return the listeners registered for a given event.
125
+ *
126
+ * @param {(String|Symbol)} event The event name.
127
+ * @returns {Array} The registered listeners.
128
+ * @public
129
+ */
130
+ EventEmitter.prototype.listeners = function listeners(event) {
131
+ var evt = prefix ? prefix + event : event
132
+ , handlers = this._events[evt];
133
+
134
+ if (!handlers) return [];
135
+ if (handlers.fn) return [handlers.fn];
136
+
137
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
138
+ ee[i] = handlers[i].fn;
139
+ }
140
+
141
+ return ee;
142
+ };
143
+
144
+ /**
145
+ * Return the number of listeners listening to a given event.
146
+ *
147
+ * @param {(String|Symbol)} event The event name.
148
+ * @returns {Number} The number of listeners.
149
+ * @public
150
+ */
151
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
152
+ var evt = prefix ? prefix + event : event
153
+ , listeners = this._events[evt];
154
+
155
+ if (!listeners) return 0;
156
+ if (listeners.fn) return 1;
157
+ return listeners.length;
158
+ };
159
+
160
+ /**
161
+ * Calls each of the listeners registered for a given event.
162
+ *
163
+ * @param {(String|Symbol)} event The event name.
164
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
165
+ * @public
166
+ */
167
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
168
+ var evt = prefix ? prefix + event : event;
169
+
170
+ if (!this._events[evt]) return false;
171
+
172
+ var listeners = this._events[evt]
173
+ , len = arguments.length
174
+ , args
175
+ , i;
176
+
177
+ if (listeners.fn) {
178
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
179
+
180
+ switch (len) {
181
+ case 1: return listeners.fn.call(listeners.context), true;
182
+ case 2: return listeners.fn.call(listeners.context, a1), true;
183
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
184
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
185
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
186
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
187
+ }
188
+
189
+ for (i = 1, args = new Array(len -1); i < len; i++) {
190
+ args[i - 1] = arguments[i];
191
+ }
192
+
193
+ listeners.fn.apply(listeners.context, args);
194
+ } else {
195
+ var length = listeners.length
196
+ , j;
197
+
198
+ for (i = 0; i < length; i++) {
199
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
200
+
201
+ switch (len) {
202
+ case 1: listeners[i].fn.call(listeners[i].context); break;
203
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
204
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
205
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
206
+ default:
207
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
208
+ args[j - 1] = arguments[j];
209
+ }
210
+
211
+ listeners[i].fn.apply(listeners[i].context, args);
212
+ }
213
+ }
214
+ }
215
+
216
+ return true;
217
+ };
218
+
219
+ /**
220
+ * Add a listener for a given event.
221
+ *
222
+ * @param {(String|Symbol)} event The event name.
223
+ * @param {Function} fn The listener function.
224
+ * @param {*} [context=this] The context to invoke the listener with.
225
+ * @returns {EventEmitter} `this`.
226
+ * @public
227
+ */
228
+ EventEmitter.prototype.on = function on(event, fn, context) {
229
+ return addListener(this, event, fn, context, false);
230
+ };
231
+
232
+ /**
233
+ * Add a one-time listener for a given event.
234
+ *
235
+ * @param {(String|Symbol)} event The event name.
236
+ * @param {Function} fn The listener function.
237
+ * @param {*} [context=this] The context to invoke the listener with.
238
+ * @returns {EventEmitter} `this`.
239
+ * @public
240
+ */
241
+ EventEmitter.prototype.once = function once(event, fn, context) {
242
+ return addListener(this, event, fn, context, true);
243
+ };
244
+
245
+ /**
246
+ * Remove the listeners of a given event.
247
+ *
248
+ * @param {(String|Symbol)} event The event name.
249
+ * @param {Function} fn Only remove the listeners that match this function.
250
+ * @param {*} context Only remove the listeners that have this context.
251
+ * @param {Boolean} once Only remove one-time listeners.
252
+ * @returns {EventEmitter} `this`.
253
+ * @public
254
+ */
255
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
256
+ var evt = prefix ? prefix + event : event;
257
+
258
+ if (!this._events[evt]) return this;
259
+ if (!fn) {
260
+ clearEvent(this, evt);
261
+ return this;
262
+ }
263
+
264
+ var listeners = this._events[evt];
265
+
266
+ if (listeners.fn) {
267
+ if (
268
+ listeners.fn === fn &&
269
+ (!once || listeners.once) &&
270
+ (!context || listeners.context === context)
271
+ ) {
272
+ clearEvent(this, evt);
273
+ }
274
+ } else {
275
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
276
+ if (
277
+ listeners[i].fn !== fn ||
278
+ (once && !listeners[i].once) ||
279
+ (context && listeners[i].context !== context)
280
+ ) {
281
+ events.push(listeners[i]);
282
+ }
283
+ }
284
+
285
+ //
286
+ // Reset the array, or remove it completely if we have no more listeners.
287
+ //
288
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
289
+ else clearEvent(this, evt);
290
+ }
291
+
292
+ return this;
293
+ };
294
+
295
+ /**
296
+ * Remove all listeners, or those of the specified event.
297
+ *
298
+ * @param {(String|Symbol)} [event] The event name.
299
+ * @returns {EventEmitter} `this`.
300
+ * @public
301
+ */
302
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
303
+ var evt;
304
+
305
+ if (event) {
306
+ evt = prefix ? prefix + event : event;
307
+ if (this._events[evt]) clearEvent(this, evt);
308
+ } else {
309
+ this._events = new Events();
310
+ this._eventsCount = 0;
311
+ }
312
+
313
+ return this;
314
+ };
315
+
316
+ //
317
+ // Alias methods names because people roll like that.
318
+ //
319
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
320
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
321
+
322
+ //
323
+ // Expose the prefix.
324
+ //
325
+ EventEmitter.prefixed = prefix;
326
+
327
+ //
328
+ // Allow `EventEmitter` to be imported as module namespace.
329
+ //
330
+ EventEmitter.EventEmitter = EventEmitter;
331
+
332
+ //
333
+ // Expose the module.
334
+ //
335
+ if ('undefined' !== typeof module) {
336
+ module.exports = EventEmitter;
337
+ }
338
+
339
+ },{}]},{},[1])(1)
340
+ });
@@ -0,0 +1 @@
1
+ !function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).EventEmitter3=e()}(function(){return function i(s,f,c){function u(t,e){if(!f[t]){if(!s[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(a)return a(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=f[t]={exports:{}};s[t][0].call(o.exports,function(e){return u(s[t][1][e]||e)},o,o.exports,i,s,f,c)}return f[t].exports}for(var a="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,v="~";function o(){}function f(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new f(n,r||e,o),s=v?v+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function u(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function s(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(v=!1)),s.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(v?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=v?v+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,i=new Array(o);r<o;r++)i[r]=n[r].fn;return i},s.prototype.listenerCount=function(e){var t=v?v+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,r,o,i){var s=v?v+e:e;if(!this._events[s])return!1;var f,c=this._events[s],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,o),!0;case 6:return c.fn.call(c.context,t,n,r,o,i),!0}for(p=1,f=new Array(u-1);p<u;p++)f[p-1]=arguments[p];c.fn.apply(c.context,f)}else for(var a,l=c.length,p=0;p<l;p++)switch(c[p].once&&this.removeListener(e,c[p].fn,void 0,!0),u){case 1:c[p].fn.call(c[p].context);break;case 2:c[p].fn.call(c[p].context,t);break;case 3:c[p].fn.call(c[p].context,t,n);break;case 4:c[p].fn.call(c[p].context,t,n,r);break;default:if(!f)for(a=1,f=new Array(u-1);a<u;a++)f[a-1]=arguments[a];c[p].fn.apply(c[p].context,f)}return!0},s.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,n,r){var o=v?v+e:e;if(!this._events[o])return this;if(!t)return u(this,o),this;var i=this._events[o];if(i.fn)i.fn!==t||r&&!i.once||n&&i.context!==n||u(this,o);else{for(var s=0,f=[],c=i.length;s<c;s++)(i[s].fn!==t||r&&!i[s].once||n&&i[s].context!==n)&&f.push(i[s]);f.length?this._events[o]=1===f.length?f[0]:f:u(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=v?v+e:e,this._events[t]&&u(this,t)):(this._events=new o,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=v,s.EventEmitter=s,void 0!==t&&(t.exports=s)},{}]},{},[1])(1)});
@@ -0,0 +1 @@
1
+ {"name":"p-queue","version":"6.6.2","description":"Promise queue with concurrency control","license":"MIT","repository":"sindresorhus/p-queue","funding":"https://github.com/sponsors/sindresorhus","main":"dist/index.js","engines":{"node":">=8"},"scripts":{"build":"del dist && tsc","test":"xo && npm run build && nyc ava","bench":"ts-node bench.ts","prepublishOnly":"npm run build"},"files":["dist"],"types":"dist/index.d.ts","keywords":["promise","queue","enqueue","limit","limited","concurrency","throttle","throat","rate","batch","ratelimit","priority","priorityqueue","fifo","job","task","async","await","promises","bluebird"],"dependencies":{"eventemitter3":"^4.0.4","p-timeout":"^3.2.0"},"devDependencies":{"@sindresorhus/tsconfig":"^0.7.0","@types/benchmark":"^1.0.33","@types/node":"^14.6.0","ava":"^2.0.0","benchmark":"^2.1.4","codecov":"^3.7.2","del-cli":"^3.0.1","delay":"^4.4.0","in-range":"^2.0.0","nyc":"^15.1.0","random-int":"^2.0.1","time-span":"^4.0.0","ts-node":"^9.0.0","typescript":"^4.0.2","xo":"^0.33.0"},"ava":{"babel":false,"compileEnhancements":false,"extensions":["ts"],"require":["ts-node/register"],"files":["test/**"]},"xo":{"rules":{"@typescript-eslint/member-ordering":"off","node/no-unsupported-features/es-syntax":"off","@typescript-eslint/no-floating-promises":"off","import/no-named-default":"off","@typescript-eslint/no-invalid-void-type":"off"}},"nyc":{"extension":[".ts"]},"_lastModified":"2026-03-25T08:52:45.777Z"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Mutex } from 'async-mutex';
10
+ import Application, { AppSupervisor } from '@nocobase/server';
11
+ import type { AppDiscoveryAdapter, AppProcessAdapter, AppStatus, GetAppOptions } from '@nocobase/server';
12
+ export declare class LegacyAdapter implements AppDiscoveryAdapter, AppProcessAdapter {
13
+ private readonly supervisor;
14
+ readonly name = "legacy";
15
+ apps: Record<string, Application>;
16
+ lastSeenAt: Map<string, number>;
17
+ appErrors: Record<string, Error>;
18
+ appStatus: Record<string, AppStatus>;
19
+ lastMaintainingMessage: Record<string, string>;
20
+ statusBeforeCommanding: Record<string, AppStatus>;
21
+ private appMutexes;
22
+ private bootstrapQueue;
23
+ constructor(supervisor: AppSupervisor);
24
+ removeAllApps(): Promise<void>;
25
+ setAppError(appName: string, error: Error): void;
26
+ hasAppError(appName: string): boolean;
27
+ clearAppError(appName: string): void;
28
+ setAppStatus(appName: string, status: AppStatus, options?: {}): Promise<void>;
29
+ getMutexOfApp(appName: string): Mutex;
30
+ private _bootStrapApp;
31
+ bootstrapApp(appName: string, options?: {}): Promise<void>;
32
+ getApp(appName: string, options?: GetAppOptions): Promise<Application<import("@nocobase/server").DefaultState, import("@nocobase/server").DefaultContext>>;
33
+ hasApp(appName: string): boolean;
34
+ setAppLastSeenAt(appName: string): void;
35
+ getAppLastSeenAt(appName: string): number | null;
36
+ addApp(app: Application): Application<import("@nocobase/server").DefaultState, import("@nocobase/server").DefaultContext>;
37
+ getApps(): Application<import("@nocobase/server").DefaultState, import("@nocobase/server").DefaultContext>[];
38
+ startApp(appName: string): Promise<void>;
39
+ stopApp(appName: string): Promise<void>;
40
+ removeApp(appName: string): Promise<void>;
41
+ getAppStatus(appName: string, defaultStatus?: AppStatus): Promise<AppStatus>;
42
+ getAppModel(appName: string): Promise<any>;
43
+ }
@@ -0,0 +1,207 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var legacy_adapter_exports = {};
38
+ __export(legacy_adapter_exports, {
39
+ LegacyAdapter: () => LegacyAdapter
40
+ });
41
+ module.exports = __toCommonJS(legacy_adapter_exports);
42
+ var import_async_mutex = require("async-mutex");
43
+ var import_p_queue = __toESM(require("p-queue"));
44
+ class LegacyAdapter {
45
+ constructor(supervisor) {
46
+ this.supervisor = supervisor;
47
+ this.bootstrapQueue = new import_p_queue.default({
48
+ concurrency: process.env.SUBAPP_BOOTSTRAP_CONCURRENCY ? parseInt(process.env.SUBAPP_BOOTSTRAP_CONCURRENCY) : Infinity,
49
+ intervalCap: process.env.SUBAPP_BOOTSTRAP_INTERVAL_CAP ? parseInt(process.env.SUBAPP_BOOTSTRAP_INTERVAL_CAP) : Infinity,
50
+ interval: process.env.SUBAPP_BOOTSTRAP_INTERVAL ? parseInt(process.env.SUBAPP_BOOTSTRAP_INTERVAL) : 0,
51
+ timeout: 1 * 60 * 1e3
52
+ });
53
+ }
54
+ name = "legacy";
55
+ apps = {};
56
+ lastSeenAt = /* @__PURE__ */ new Map();
57
+ appErrors = {};
58
+ appStatus = {};
59
+ lastMaintainingMessage = {};
60
+ statusBeforeCommanding = {};
61
+ appMutexes = {};
62
+ bootstrapQueue;
63
+ async removeAllApps() {
64
+ const appNames = Object.keys(this.apps);
65
+ for (const appName of appNames) {
66
+ await this.removeApp(appName);
67
+ }
68
+ }
69
+ setAppError(appName, error) {
70
+ this.appErrors[appName] = error;
71
+ this.supervisor.emit("appError", { appName, error });
72
+ }
73
+ hasAppError(appName) {
74
+ return !!this.appErrors[appName];
75
+ }
76
+ clearAppError(appName) {
77
+ delete this.appErrors[appName];
78
+ }
79
+ async setAppStatus(appName, status, options = {}) {
80
+ if (this.appStatus[appName] === status) {
81
+ return;
82
+ }
83
+ this.appStatus[appName] = status;
84
+ this.supervisor.emit("appStatusChanged", { appName, status, options });
85
+ }
86
+ getMutexOfApp(appName) {
87
+ if (!this.appMutexes[appName]) {
88
+ this.appMutexes[appName] = new import_async_mutex.Mutex();
89
+ }
90
+ return this.appMutexes[appName];
91
+ }
92
+ async _bootStrapApp(appName, options = {}) {
93
+ await this.setAppStatus(appName, "initializing");
94
+ await this.supervisor.initApp({ appName, options });
95
+ if (!this.hasApp(appName)) {
96
+ await this.setAppStatus(appName, "not_found");
97
+ return;
98
+ }
99
+ const appStatus = await this.getAppStatus(appName);
100
+ if (!appStatus || appStatus === "initializing") {
101
+ await this.setAppStatus(appName, "initialized");
102
+ }
103
+ }
104
+ async bootstrapApp(appName, options = {}) {
105
+ const mutex = this.getMutexOfApp(appName);
106
+ try {
107
+ await (0, import_async_mutex.tryAcquire)(mutex).runExclusive(async () => {
108
+ const status = await this.getAppStatus(appName);
109
+ if (this.hasApp(appName) && status !== "preparing") {
110
+ return;
111
+ }
112
+ if (appName === "main") {
113
+ return this._bootStrapApp(appName, options);
114
+ }
115
+ void this.setAppStatus(appName, "preparing");
116
+ await this.bootstrapQueue.add(async () => {
117
+ await this._bootStrapApp(appName, options);
118
+ });
119
+ });
120
+ } catch (e) {
121
+ if (e !== import_async_mutex.E_ALREADY_LOCKED) {
122
+ console.error(e);
123
+ }
124
+ }
125
+ }
126
+ async getApp(appName, options = {}) {
127
+ if (!options.withOutBootStrap) {
128
+ await this.bootstrapApp(appName, options);
129
+ }
130
+ return this.apps[appName];
131
+ }
132
+ hasApp(appName) {
133
+ return !!this.apps[appName];
134
+ }
135
+ setAppLastSeenAt(appName) {
136
+ if (!this.hasApp(appName)) {
137
+ return;
138
+ }
139
+ this.lastSeenAt.set(appName, Math.floor(Date.now() / 1e3));
140
+ }
141
+ getAppLastSeenAt(appName) {
142
+ return this.lastSeenAt.get(appName);
143
+ }
144
+ addApp(app) {
145
+ if (this.apps[app.name]) {
146
+ throw new Error(`app ${app.name} already exists`);
147
+ }
148
+ this.apps[app.name] = app;
149
+ if (!this.appStatus[app.name] || this.appStatus[app.name] === "not_found") {
150
+ void this.setAppStatus(app.name, "preparing");
151
+ }
152
+ return app;
153
+ }
154
+ getApps() {
155
+ return Object.values(this.apps).filter((app) => app && app.name !== "main");
156
+ }
157
+ async startApp(appName) {
158
+ const appInstance = await this.getApp(appName);
159
+ await (appInstance == null ? void 0 : appInstance.runCommand("start", "--quickstart"));
160
+ }
161
+ async stopApp(appName) {
162
+ const app = this.apps[appName];
163
+ if (!app) {
164
+ return;
165
+ }
166
+ await app.runCommand("stop");
167
+ this.apps[appName] = null;
168
+ }
169
+ async removeApp(appName) {
170
+ const app = this.apps[appName];
171
+ if (!app) {
172
+ return;
173
+ }
174
+ await app.runCommand("destroy");
175
+ this.apps[appName] = null;
176
+ }
177
+ async getAppStatus(appName, defaultStatus) {
178
+ const status = this.appStatus[appName];
179
+ if (status === void 0 && defaultStatus !== void 0) {
180
+ return defaultStatus;
181
+ }
182
+ return status ?? null;
183
+ }
184
+ async getAppModel(appName) {
185
+ const mainApp = await this.getApp("main");
186
+ if (!mainApp) {
187
+ return null;
188
+ }
189
+ const repo = mainApp.db.getRepository("applications");
190
+ if (!repo) {
191
+ return null;
192
+ }
193
+ const applicationModel = await repo.findOne({
194
+ filter: {
195
+ name: appName
196
+ }
197
+ });
198
+ if (!applicationModel) {
199
+ return null;
200
+ }
201
+ return applicationModel;
202
+ }
203
+ }
204
+ // Annotate the CommonJS export names for ESM import in node:
205
+ 0 && (module.exports = {
206
+ LegacyAdapter
207
+ });
@@ -17,15 +17,13 @@ export type AppDbCreator = (app: Application, options?: Transactionable & {
17
17
  export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
18
18
  export type SubAppUpgradeHandler = (mainApp: Application) => Promise<void>;
19
19
  export declare class PluginMultiAppManagerServer extends Plugin {
20
- appDbCreator: AppDbCreator;
21
- appOptionsFactory: AppOptionsFactory;
22
20
  subAppUpgradeHandler: SubAppUpgradeHandler;
23
21
  meter: Meter;
24
- static getDatabaseConfig(app: Application): IDatabaseOptions;
25
- handleSyncMessage(message: any): Promise<void>;
26
22
  setSubAppUpgradeHandler(handler: SubAppUpgradeHandler): void;
27
- setAppOptionsFactory(factory: AppOptionsFactory): void;
28
- setAppDbCreator(appDbCreator: AppDbCreator): void;
23
+ protected static registerLegacyAdapter(): void;
24
+ static getDatabaseConfig(app: Application): IDatabaseOptions;
25
+ setAppOptionsFactory(appOptionsFactory: AppOptionsFactory): void;
26
+ static staticImport(): void;
29
27
  beforeLoad(): void;
30
28
  beforeEnable(): Promise<void>;
31
29
  setMetrics(): void;