@sfxcode/nuxt-mongocamp-server 1.0.4 → 1.0.6

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 (127) hide show
  1. package/dist/module.d.mts +9 -0
  2. package/dist/module.d.ts +9 -2
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +557 -4
  5. package/dist/runtime/api/apis/AdminApi.d.ts +181 -0
  6. package/dist/runtime/api/apis/AdminApi.mjs +509 -0
  7. package/dist/runtime/api/apis/ApplicationApi.d.ts +65 -0
  8. package/dist/runtime/api/apis/ApplicationApi.mjs +164 -0
  9. package/dist/runtime/api/apis/AuthApi.d.ts +104 -0
  10. package/dist/runtime/api/apis/AuthApi.mjs +296 -0
  11. package/dist/runtime/api/apis/BucketApi.d.ts +67 -0
  12. package/dist/runtime/api/apis/BucketApi.mjs +160 -0
  13. package/dist/runtime/api/apis/CollectionApi.d.ts +161 -0
  14. package/dist/runtime/api/apis/CollectionApi.mjs +435 -0
  15. package/dist/runtime/api/apis/DatabaseApi.d.ts +77 -0
  16. package/dist/runtime/api/apis/DatabaseApi.mjs +196 -0
  17. package/dist/runtime/api/apis/DocumentApi.d.ts +188 -0
  18. package/dist/runtime/api/apis/DocumentApi.mjs +465 -0
  19. package/dist/runtime/api/apis/FileApi.d.ts +125 -0
  20. package/dist/runtime/api/apis/FileApi.mjs +355 -0
  21. package/dist/runtime/api/apis/IndexApi.d.ts +137 -0
  22. package/dist/runtime/api/apis/IndexApi.mjs +367 -0
  23. package/dist/runtime/api/apis/InformationApi.d.ts +28 -0
  24. package/dist/runtime/api/apis/InformationApi.mjs +29 -0
  25. package/dist/runtime/api/apis/JobsApi.d.ts +94 -0
  26. package/dist/runtime/api/apis/JobsApi.mjs +252 -0
  27. package/dist/runtime/api/apis/index.d.ts +11 -0
  28. package/dist/runtime/api/apis/index.mjs +11 -0
  29. package/dist/runtime/api/index.d.ts +3 -0
  30. package/dist/runtime/api/index.mjs +3 -0
  31. package/dist/runtime/api/models/BucketInformation.d.ts +49 -0
  32. package/dist/runtime/api/models/BucketInformation.mjs +36 -0
  33. package/dist/runtime/api/models/CollectionStatus.d.ts +107 -0
  34. package/dist/runtime/api/models/CollectionStatus.mjs +63 -0
  35. package/dist/runtime/api/models/DatabaseInfo.d.ts +57 -0
  36. package/dist/runtime/api/models/DatabaseInfo.mjs +39 -0
  37. package/dist/runtime/api/models/DeleteResponse.d.ts +37 -0
  38. package/dist/runtime/api/models/DeleteResponse.mjs +30 -0
  39. package/dist/runtime/api/models/ErrorDescription.d.ts +43 -0
  40. package/dist/runtime/api/models/ErrorDescription.mjs +33 -0
  41. package/dist/runtime/api/models/FileInformation.d.ts +63 -0
  42. package/dist/runtime/api/models/FileInformation.mjs +42 -0
  43. package/dist/runtime/api/models/Grant.d.ts +55 -0
  44. package/dist/runtime/api/models/Grant.mjs +39 -0
  45. package/dist/runtime/api/models/IndexCreateRequest.d.ts +40 -0
  46. package/dist/runtime/api/models/IndexCreateRequest.mjs +34 -0
  47. package/dist/runtime/api/models/IndexCreateResponse.d.ts +31 -0
  48. package/dist/runtime/api/models/IndexCreateResponse.mjs +27 -0
  49. package/dist/runtime/api/models/IndexDropResponse.d.ts +31 -0
  50. package/dist/runtime/api/models/IndexDropResponse.mjs +27 -0
  51. package/dist/runtime/api/models/IndexOptionsRequest.d.ts +73 -0
  52. package/dist/runtime/api/models/IndexOptionsRequest.mjs +41 -0
  53. package/dist/runtime/api/models/InsertResponse.d.ts +37 -0
  54. package/dist/runtime/api/models/InsertResponse.mjs +30 -0
  55. package/dist/runtime/api/models/JobConfig.d.ts +61 -0
  56. package/dist/runtime/api/models/JobConfig.mjs +42 -0
  57. package/dist/runtime/api/models/JobInformation.d.ts +79 -0
  58. package/dist/runtime/api/models/JobInformation.mjs +49 -0
  59. package/dist/runtime/api/models/JsonSchema.d.ts +46 -0
  60. package/dist/runtime/api/models/JsonSchema.mjs +38 -0
  61. package/dist/runtime/api/models/JsonSchemaDefinition.d.ts +59 -0
  62. package/dist/runtime/api/models/JsonSchemaDefinition.mjs +39 -0
  63. package/dist/runtime/api/models/JsonValueAny.d.ts +31 -0
  64. package/dist/runtime/api/models/JsonValueAny.mjs +27 -0
  65. package/dist/runtime/api/models/JsonValueBoolean.d.ts +31 -0
  66. package/dist/runtime/api/models/JsonValueBoolean.mjs +27 -0
  67. package/dist/runtime/api/models/JsonValueString.d.ts +31 -0
  68. package/dist/runtime/api/models/JsonValueString.mjs +27 -0
  69. package/dist/runtime/api/models/Login.d.ts +37 -0
  70. package/dist/runtime/api/models/Login.mjs +30 -0
  71. package/dist/runtime/api/models/LoginResult.d.ts +44 -0
  72. package/dist/runtime/api/models/LoginResult.mjs +37 -0
  73. package/dist/runtime/api/models/MongoAggregateRequest.d.ts +38 -0
  74. package/dist/runtime/api/models/MongoAggregateRequest.mjs +34 -0
  75. package/dist/runtime/api/models/MongoCampConfiguration.d.ts +55 -0
  76. package/dist/runtime/api/models/MongoCampConfiguration.mjs +39 -0
  77. package/dist/runtime/api/models/MongoFindRequest.d.ts +49 -0
  78. package/dist/runtime/api/models/MongoFindRequest.mjs +33 -0
  79. package/dist/runtime/api/models/MongoIndex.d.ts +103 -0
  80. package/dist/runtime/api/models/MongoIndex.mjs +60 -0
  81. package/dist/runtime/api/models/PasswordUpdateRequest.d.ts +31 -0
  82. package/dist/runtime/api/models/PasswordUpdateRequest.mjs +27 -0
  83. package/dist/runtime/api/models/PipelineStage.d.ts +37 -0
  84. package/dist/runtime/api/models/PipelineStage.mjs +30 -0
  85. package/dist/runtime/api/models/Role.d.ts +44 -0
  86. package/dist/runtime/api/models/Role.mjs +37 -0
  87. package/dist/runtime/api/models/SchemaAnalysis.d.ts +50 -0
  88. package/dist/runtime/api/models/SchemaAnalysis.mjs +40 -0
  89. package/dist/runtime/api/models/SchemaAnalysisField.d.ts +62 -0
  90. package/dist/runtime/api/models/SchemaAnalysisField.mjs +45 -0
  91. package/dist/runtime/api/models/SchemaAnalysisFieldType.d.ts +43 -0
  92. package/dist/runtime/api/models/SchemaAnalysisFieldType.mjs +33 -0
  93. package/dist/runtime/api/models/SettingsResponse.d.ts +51 -0
  94. package/dist/runtime/api/models/SettingsResponse.mjs +34 -0
  95. package/dist/runtime/api/models/UpdateFileInformationRequest.d.ts +39 -0
  96. package/dist/runtime/api/models/UpdateFileInformationRequest.mjs +29 -0
  97. package/dist/runtime/api/models/UpdateRequest.d.ts +41 -0
  98. package/dist/runtime/api/models/UpdateRequest.mjs +30 -0
  99. package/dist/runtime/api/models/UpdateResponse.d.ts +49 -0
  100. package/dist/runtime/api/models/UpdateResponse.mjs +36 -0
  101. package/dist/runtime/api/models/UpdateRoleRequest.d.ts +38 -0
  102. package/dist/runtime/api/models/UpdateRoleRequest.mjs +34 -0
  103. package/dist/runtime/api/models/UserInformation.d.ts +49 -0
  104. package/dist/runtime/api/models/UserInformation.mjs +35 -0
  105. package/dist/runtime/api/models/UserProfile.d.ts +56 -0
  106. package/dist/runtime/api/models/UserProfile.mjs +41 -0
  107. package/dist/runtime/api/models/Version.d.ts +43 -0
  108. package/dist/runtime/api/models/Version.mjs +33 -0
  109. package/dist/runtime/api/models/index.d.ts +39 -0
  110. package/dist/runtime/api/models/index.mjs +39 -0
  111. package/dist/runtime/api/runtime.d.ts +182 -0
  112. package/dist/runtime/api/runtime.mjs +289 -0
  113. package/dist/runtime/composables/mongocampApi.d.ts +14 -0
  114. package/dist/runtime/composables/mongocampApi.mjs +45 -0
  115. package/dist/runtime/composables/mongocampAuth.d.ts +8 -0
  116. package/dist/runtime/composables/mongocampAuth.mjs +28 -0
  117. package/dist/runtime/composables/mongocampSearch.d.ts +11 -0
  118. package/dist/runtime/composables/mongocampSearch.mjs +20 -0
  119. package/dist/runtime/composables/mongocampStorage.d.ts +0 -0
  120. package/dist/runtime/composables/mongocampStorage.mjs +5 -0
  121. package/dist/runtime/composables/mongocampUrl.d.ts +1 -0
  122. package/dist/runtime/composables/mongocampUrl.mjs +5 -0
  123. package/dist/runtime/composables/mongocampUser.d.ts +3 -0
  124. package/dist/runtime/composables/mongocampUser.mjs +4 -0
  125. package/dist/types.d.mts +15 -0
  126. package/dist/types.d.ts +2 -8
  127. package/package.json +14 -13
@@ -0,0 +1,9 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ url: string;
5
+ paginationSize?: number;
6
+ }
7
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
8
+
9
+ export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -1,2 +1,9 @@
1
- export * from "/Users/tom/projects/mongocamp/mongocamp-nuxt/src/module";
2
- export { default } from "/Users/tom/projects/mongocamp/mongocamp-nuxt/src/module";
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ url: string;
5
+ paginationSize?: number;
6
+ }
7
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
8
+
9
+ export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "configKey": "mongocamp",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
package/dist/module.mjs CHANGED
@@ -1,6 +1,559 @@
1
- import jiti from "file:///Users/tom/projects/mongocamp/mongocamp-nuxt/node_modules/.pnpm/jiti@1.19.1/node_modules/jiti/lib/index.js";
1
+ import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
2
2
 
3
- /** @type {import("/Users/tom/projects/mongocamp/mongocamp-nuxt/src/module")} */
4
- const _module = jiti(null, { interopDefault: true, esmResolve: true })("/Users/tom/projects/mongocamp/mongocamp-nuxt/src/module.ts");
3
+ function _defu$1(baseObject, defaults, namespace = ".", merger) {
4
+ if (!_isPlainObject(defaults)) {
5
+ return _defu$1(baseObject, {}, namespace, merger);
6
+ }
7
+ const object = Object.assign({}, defaults);
8
+ for (const key in baseObject) {
9
+ if (key === "__proto__" || key === "constructor") {
10
+ continue;
11
+ }
12
+ const value = baseObject[key];
13
+ if (value === null || value === void 0) {
14
+ continue;
15
+ }
16
+ if (merger && merger(object, key, value, namespace)) {
17
+ continue;
18
+ }
19
+ if (Array.isArray(value) && Array.isArray(object[key])) {
20
+ object[key] = [...value, ...object[key]];
21
+ } else if (_isPlainObject(value) && _isPlainObject(object[key])) {
22
+ object[key] = _defu$1(
23
+ value,
24
+ object[key],
25
+ (namespace ? `${namespace}.` : "") + key.toString(),
26
+ merger
27
+ );
28
+ } else {
29
+ object[key] = value;
30
+ }
31
+ }
32
+ return object;
33
+ }
34
+ function _isPlainObject(value) {
35
+ if (value === null || typeof value !== "object") {
36
+ return false;
37
+ }
38
+ const prototype = Object.getPrototypeOf(value);
39
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
40
+ }
41
+ function createDefu$1(merger) {
42
+ return (...arguments_) => (
43
+ // eslint-disable-next-line unicorn/no-array-reduce
44
+ arguments_.reduce((p, c) => _defu$1(p, c, "", merger), {})
45
+ );
46
+ }
47
+ const defu$1 = createDefu$1();
5
48
 
6
- export default _module;
49
+ const LogLevels = {
50
+ silent: Number.NEGATIVE_INFINITY,
51
+ fatal: 0,
52
+ error: 0,
53
+ warn: 1,
54
+ log: 2,
55
+ info: 3,
56
+ success: 3,
57
+ fail: 3,
58
+ ready: 3,
59
+ start: 3,
60
+ box: 3,
61
+ debug: 4,
62
+ trace: 5,
63
+ verbose: Number.POSITIVE_INFINITY
64
+ };
65
+ const LogTypes = {
66
+ // Silent
67
+ silent: {
68
+ level: -1
69
+ },
70
+ // Level 0
71
+ fatal: {
72
+ level: LogLevels.fatal
73
+ },
74
+ error: {
75
+ level: LogLevels.error
76
+ },
77
+ // Level 1
78
+ warn: {
79
+ level: LogLevels.warn
80
+ },
81
+ // Level 2
82
+ log: {
83
+ level: LogLevels.log
84
+ },
85
+ // Level 3
86
+ info: {
87
+ level: LogLevels.info
88
+ },
89
+ success: {
90
+ level: LogLevels.success
91
+ },
92
+ fail: {
93
+ level: LogLevels.fail
94
+ },
95
+ ready: {
96
+ level: LogLevels.info
97
+ },
98
+ start: {
99
+ level: LogLevels.info
100
+ },
101
+ box: {
102
+ level: LogLevels.info
103
+ },
104
+ // Level 4
105
+ debug: {
106
+ level: LogLevels.debug
107
+ },
108
+ // Level 5
109
+ trace: {
110
+ level: LogLevels.trace
111
+ },
112
+ // Verbose
113
+ verbose: {
114
+ level: LogLevels.verbose
115
+ }
116
+ };
117
+
118
+ function isObject(value) {
119
+ return value !== null && typeof value === "object";
120
+ }
121
+ function _defu(baseObject, defaults, namespace = ".", merger) {
122
+ if (!isObject(defaults)) {
123
+ return _defu(baseObject, {}, namespace, merger);
124
+ }
125
+ const object = Object.assign({}, defaults);
126
+ for (const key in baseObject) {
127
+ if (key === "__proto__" || key === "constructor") {
128
+ continue;
129
+ }
130
+ const value = baseObject[key];
131
+ if (value === null || value === void 0) {
132
+ continue;
133
+ }
134
+ if (merger && merger(object, key, value, namespace)) {
135
+ continue;
136
+ }
137
+ if (Array.isArray(value) && Array.isArray(object[key])) {
138
+ object[key] = [...value, ...object[key]];
139
+ } else if (isObject(value) && isObject(object[key])) {
140
+ object[key] = _defu(
141
+ value,
142
+ object[key],
143
+ (namespace ? `${namespace}.` : "") + key.toString(),
144
+ merger
145
+ );
146
+ } else {
147
+ object[key] = value;
148
+ }
149
+ }
150
+ return object;
151
+ }
152
+ function createDefu(merger) {
153
+ return (...arguments_) => (
154
+ // eslint-disable-next-line unicorn/no-array-reduce
155
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
156
+ );
157
+ }
158
+ const defu = createDefu();
159
+
160
+ function isPlainObject(obj) {
161
+ return Object.prototype.toString.call(obj) === "[object Object]";
162
+ }
163
+ function isLogObj(arg) {
164
+ if (!isPlainObject(arg)) {
165
+ return false;
166
+ }
167
+ if (!arg.message && !arg.args) {
168
+ return false;
169
+ }
170
+ if (arg.stack) {
171
+ return false;
172
+ }
173
+ return true;
174
+ }
175
+
176
+ let paused = false;
177
+ const queue = [];
178
+ class Consola {
179
+ constructor(options = {}) {
180
+ const types = options.types || LogTypes;
181
+ this.options = defu(
182
+ {
183
+ ...options,
184
+ defaults: { ...options.defaults },
185
+ level: _normalizeLogLevel(options.level, types),
186
+ reporters: [...options.reporters || []]
187
+ },
188
+ {
189
+ types: LogTypes,
190
+ throttle: 1e3,
191
+ throttleMin: 5,
192
+ formatOptions: {
193
+ date: true,
194
+ colors: false,
195
+ compact: true
196
+ }
197
+ }
198
+ );
199
+ for (const type in types) {
200
+ const defaults = {
201
+ type,
202
+ ...this.options.defaults,
203
+ ...types[type]
204
+ };
205
+ this[type] = this._wrapLogFn(defaults);
206
+ this[type].raw = this._wrapLogFn(
207
+ defaults,
208
+ true
209
+ );
210
+ }
211
+ if (this.options.mockFn) {
212
+ this.mockTypes();
213
+ }
214
+ this._lastLog = {};
215
+ }
216
+ get level() {
217
+ return this.options.level;
218
+ }
219
+ set level(level) {
220
+ this.options.level = _normalizeLogLevel(
221
+ level,
222
+ this.options.types,
223
+ this.options.level
224
+ );
225
+ }
226
+ prompt(message, opts) {
227
+ if (!this.options.prompt) {
228
+ throw new Error("prompt is not supported!");
229
+ }
230
+ return this.options.prompt(message, opts);
231
+ }
232
+ create(options) {
233
+ const instance = new Consola({
234
+ ...this.options,
235
+ ...options
236
+ });
237
+ if (this._mockFn) {
238
+ instance.mockTypes(this._mockFn);
239
+ }
240
+ return instance;
241
+ }
242
+ withDefaults(defaults) {
243
+ return this.create({
244
+ ...this.options,
245
+ defaults: {
246
+ ...this.options.defaults,
247
+ ...defaults
248
+ }
249
+ });
250
+ }
251
+ withTag(tag) {
252
+ return this.withDefaults({
253
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
254
+ });
255
+ }
256
+ addReporter(reporter) {
257
+ this.options.reporters.push(reporter);
258
+ return this;
259
+ }
260
+ removeReporter(reporter) {
261
+ if (reporter) {
262
+ const i = this.options.reporters.indexOf(reporter);
263
+ if (i >= 0) {
264
+ return this.options.reporters.splice(i, 1);
265
+ }
266
+ } else {
267
+ this.options.reporters.splice(0);
268
+ }
269
+ return this;
270
+ }
271
+ setReporters(reporters) {
272
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
273
+ return this;
274
+ }
275
+ wrapAll() {
276
+ this.wrapConsole();
277
+ this.wrapStd();
278
+ }
279
+ restoreAll() {
280
+ this.restoreConsole();
281
+ this.restoreStd();
282
+ }
283
+ wrapConsole() {
284
+ for (const type in this.options.types) {
285
+ if (!console["__" + type]) {
286
+ console["__" + type] = console[type];
287
+ }
288
+ console[type] = this[type].raw;
289
+ }
290
+ }
291
+ restoreConsole() {
292
+ for (const type in this.options.types) {
293
+ if (console["__" + type]) {
294
+ console[type] = console["__" + type];
295
+ delete console["__" + type];
296
+ }
297
+ }
298
+ }
299
+ wrapStd() {
300
+ this._wrapStream(this.options.stdout, "log");
301
+ this._wrapStream(this.options.stderr, "log");
302
+ }
303
+ _wrapStream(stream, type) {
304
+ if (!stream) {
305
+ return;
306
+ }
307
+ if (!stream.__write) {
308
+ stream.__write = stream.write;
309
+ }
310
+ stream.write = (data) => {
311
+ this[type].raw(String(data).trim());
312
+ };
313
+ }
314
+ restoreStd() {
315
+ this._restoreStream(this.options.stdout);
316
+ this._restoreStream(this.options.stderr);
317
+ }
318
+ _restoreStream(stream) {
319
+ if (!stream) {
320
+ return;
321
+ }
322
+ if (stream.__write) {
323
+ stream.write = stream.__write;
324
+ delete stream.__write;
325
+ }
326
+ }
327
+ pauseLogs() {
328
+ paused = true;
329
+ }
330
+ resumeLogs() {
331
+ paused = false;
332
+ const _queue = queue.splice(0);
333
+ for (const item of _queue) {
334
+ item[0]._logFn(item[1], item[2]);
335
+ }
336
+ }
337
+ mockTypes(mockFn) {
338
+ const _mockFn = mockFn || this.options.mockFn;
339
+ this._mockFn = _mockFn;
340
+ if (typeof _mockFn !== "function") {
341
+ return;
342
+ }
343
+ for (const type in this.options.types) {
344
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
345
+ this[type].raw = this[type];
346
+ }
347
+ }
348
+ _wrapLogFn(defaults, isRaw) {
349
+ return (...args) => {
350
+ if (paused) {
351
+ queue.push([this, defaults, args, isRaw]);
352
+ return;
353
+ }
354
+ return this._logFn(defaults, args, isRaw);
355
+ };
356
+ }
357
+ _logFn(defaults, args, isRaw) {
358
+ if ((defaults.level || 0) > this.level) {
359
+ return false;
360
+ }
361
+ const logObj = {
362
+ date: /* @__PURE__ */ new Date(),
363
+ args: [],
364
+ ...defaults,
365
+ level: _normalizeLogLevel(defaults.level, this.options.types)
366
+ };
367
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
368
+ Object.assign(logObj, args[0]);
369
+ } else {
370
+ logObj.args = [...args];
371
+ }
372
+ if (logObj.message) {
373
+ logObj.args.unshift(logObj.message);
374
+ delete logObj.message;
375
+ }
376
+ if (logObj.additional) {
377
+ if (!Array.isArray(logObj.additional)) {
378
+ logObj.additional = logObj.additional.split("\n");
379
+ }
380
+ logObj.args.push("\n" + logObj.additional.join("\n"));
381
+ delete logObj.additional;
382
+ }
383
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
384
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
385
+ const resolveLog = (newLog = false) => {
386
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
387
+ if (this._lastLog.object && repeated > 0) {
388
+ const args2 = [...this._lastLog.object.args];
389
+ if (repeated > 1) {
390
+ args2.push(`(repeated ${repeated} times)`);
391
+ }
392
+ this._log({ ...this._lastLog.object, args: args2 });
393
+ this._lastLog.count = 1;
394
+ }
395
+ if (newLog) {
396
+ this._lastLog.object = logObj;
397
+ this._log(logObj);
398
+ }
399
+ };
400
+ clearTimeout(this._lastLog.timeout);
401
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
402
+ this._lastLog.time = logObj.date;
403
+ if (diffTime < this.options.throttle) {
404
+ try {
405
+ const serializedLog = JSON.stringify([
406
+ logObj.type,
407
+ logObj.tag,
408
+ logObj.args
409
+ ]);
410
+ const isSameLog = this._lastLog.serialized === serializedLog;
411
+ this._lastLog.serialized = serializedLog;
412
+ if (isSameLog) {
413
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
414
+ if (this._lastLog.count > this.options.throttleMin) {
415
+ this._lastLog.timeout = setTimeout(
416
+ resolveLog,
417
+ this.options.throttle
418
+ );
419
+ return;
420
+ }
421
+ }
422
+ } catch {
423
+ }
424
+ }
425
+ resolveLog(true);
426
+ }
427
+ _log(logObj) {
428
+ for (const reporter of this.options.reporters) {
429
+ reporter.log(logObj, {
430
+ options: this.options
431
+ });
432
+ }
433
+ }
434
+ }
435
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
436
+ if (input === void 0) {
437
+ return defaultLevel;
438
+ }
439
+ if (typeof input === "number") {
440
+ return input;
441
+ }
442
+ if (types[input] && types[input].level !== void 0) {
443
+ return types[input].level;
444
+ }
445
+ return defaultLevel;
446
+ }
447
+ Consola.prototype.add = Consola.prototype.addReporter;
448
+ Consola.prototype.remove = Consola.prototype.removeReporter;
449
+ Consola.prototype.clear = Consola.prototype.removeReporter;
450
+ Consola.prototype.withScope = Consola.prototype.withTag;
451
+ Consola.prototype.mock = Consola.prototype.mockTypes;
452
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
453
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
454
+ function createConsola$1(options = {}) {
455
+ return new Consola(options);
456
+ }
457
+
458
+ class BrowserReporter {
459
+ constructor(options) {
460
+ this.options = { ...options };
461
+ this.defaultColor = "#7f8c8d";
462
+ this.levelColorMap = {
463
+ 0: "#c0392b",
464
+ // Red
465
+ 1: "#f39c12",
466
+ // Yellow
467
+ 3: "#00BCD4"
468
+ // Cyan
469
+ };
470
+ this.typeColorMap = {
471
+ success: "#2ecc71"
472
+ // Green
473
+ };
474
+ }
475
+ _getLogFn(level) {
476
+ if (level < 1) {
477
+ return console.__error || console.error;
478
+ }
479
+ if (level === 1) {
480
+ return console.__warn || console.warn;
481
+ }
482
+ return console.__log || console.log;
483
+ }
484
+ log(logObj) {
485
+ const consoleLogFn = this._getLogFn(logObj.level);
486
+ const type = logObj.type === "log" ? "" : logObj.type;
487
+ const tag = logObj.tag || "";
488
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
489
+ const style = `
490
+ background: ${color};
491
+ border-radius: 0.5em;
492
+ color: white;
493
+ font-weight: bold;
494
+ padding: 2px 0.5em;
495
+ `;
496
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
497
+ if (typeof logObj.args[0] === "string") {
498
+ consoleLogFn(
499
+ `${badge}%c ${logObj.args[0]}`,
500
+ style,
501
+ // Empty string as style resets to default console style
502
+ "",
503
+ ...logObj.args.slice(1)
504
+ );
505
+ } else {
506
+ consoleLogFn(badge, style, ...logObj.args);
507
+ }
508
+ }
509
+ }
510
+
511
+ function createConsola(options = {}) {
512
+ const consola2 = createConsola$1({
513
+ reporters: options.reporters || [new BrowserReporter({})],
514
+ prompt(message, options2 = {}) {
515
+ if (options2.type === "confirm") {
516
+ return Promise.resolve(confirm(message));
517
+ }
518
+ return Promise.resolve(prompt(message));
519
+ },
520
+ ...options
521
+ });
522
+ return consola2;
523
+ }
524
+ const consola = createConsola();
525
+
526
+ const name = "@sfxcode/nuxt-mongocamp-server";
527
+ const version = "1.0.6";
528
+
529
+ const module = defineNuxtModule({
530
+ meta: {
531
+ name,
532
+ version,
533
+ configKey: "mongocamp",
534
+ compatibility: {
535
+ nuxt: "^3.0.0"
536
+ }
537
+ },
538
+ setup(options, nuxt) {
539
+ if (!options.url || options.url.length === 0) {
540
+ consola.error("Missing Mongocamp Base Url !");
541
+ }
542
+ if (!options.paginationSize || options.paginationSize < 10) {
543
+ options.paginationSize = 500;
544
+ }
545
+ nuxt.options.runtimeConfig.public.mongocamp = defu$1(
546
+ nuxt.options.runtimeConfig.public.mongocamp,
547
+ {
548
+ url: options.url,
549
+ paginationSize: options.paginationSize
550
+ }
551
+ );
552
+ const { resolve } = createResolver(import.meta.url);
553
+ const runtimeDir = resolve("./runtime");
554
+ addImportsDir(resolve(runtimeDir, "composables"));
555
+ consola.success("mongocamp-nuxt available");
556
+ }
557
+ });
558
+
559
+ export { module as default };