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