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