@sfxcode/nuxt-mongocamp-server 1.0.4 → 1.0.5
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.
- package/dist/module.d.ts +9 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +553 -4
- package/dist/runtime/api/apis/AdminApi.d.ts +181 -0
- package/dist/runtime/api/apis/AdminApi.mjs +509 -0
- package/dist/runtime/api/apis/ApplicationApi.d.ts +65 -0
- package/dist/runtime/api/apis/ApplicationApi.mjs +164 -0
- package/dist/runtime/api/apis/AuthApi.d.ts +104 -0
- package/dist/runtime/api/apis/AuthApi.mjs +296 -0
- package/dist/runtime/api/apis/BucketApi.d.ts +67 -0
- package/dist/runtime/api/apis/BucketApi.mjs +160 -0
- package/dist/runtime/api/apis/CollectionApi.d.ts +161 -0
- package/dist/runtime/api/apis/CollectionApi.mjs +435 -0
- package/dist/runtime/api/apis/DatabaseApi.d.ts +77 -0
- package/dist/runtime/api/apis/DatabaseApi.mjs +196 -0
- package/dist/runtime/api/apis/DocumentApi.d.ts +188 -0
- package/dist/runtime/api/apis/DocumentApi.mjs +465 -0
- package/dist/runtime/api/apis/FileApi.d.ts +125 -0
- package/dist/runtime/api/apis/FileApi.mjs +355 -0
- package/dist/runtime/api/apis/IndexApi.d.ts +137 -0
- package/dist/runtime/api/apis/IndexApi.mjs +367 -0
- package/dist/runtime/api/apis/InformationApi.d.ts +28 -0
- package/dist/runtime/api/apis/InformationApi.mjs +29 -0
- package/dist/runtime/api/apis/JobsApi.d.ts +94 -0
- package/dist/runtime/api/apis/JobsApi.mjs +252 -0
- package/dist/runtime/api/apis/index.d.ts +11 -0
- package/dist/runtime/api/apis/index.mjs +11 -0
- package/dist/runtime/api/index.d.ts +3 -0
- package/dist/runtime/api/index.mjs +3 -0
- package/dist/runtime/api/models/BucketInformation.d.ts +49 -0
- package/dist/runtime/api/models/BucketInformation.mjs +36 -0
- package/dist/runtime/api/models/CollectionStatus.d.ts +107 -0
- package/dist/runtime/api/models/CollectionStatus.mjs +63 -0
- package/dist/runtime/api/models/DatabaseInfo.d.ts +57 -0
- package/dist/runtime/api/models/DatabaseInfo.mjs +39 -0
- package/dist/runtime/api/models/DeleteResponse.d.ts +37 -0
- package/dist/runtime/api/models/DeleteResponse.mjs +30 -0
- package/dist/runtime/api/models/ErrorDescription.d.ts +43 -0
- package/dist/runtime/api/models/ErrorDescription.mjs +33 -0
- package/dist/runtime/api/models/FileInformation.d.ts +63 -0
- package/dist/runtime/api/models/FileInformation.mjs +42 -0
- package/dist/runtime/api/models/Grant.d.ts +55 -0
- package/dist/runtime/api/models/Grant.mjs +39 -0
- package/dist/runtime/api/models/IndexCreateRequest.d.ts +40 -0
- package/dist/runtime/api/models/IndexCreateRequest.mjs +34 -0
- package/dist/runtime/api/models/IndexCreateResponse.d.ts +31 -0
- package/dist/runtime/api/models/IndexCreateResponse.mjs +27 -0
- package/dist/runtime/api/models/IndexDropResponse.d.ts +31 -0
- package/dist/runtime/api/models/IndexDropResponse.mjs +27 -0
- package/dist/runtime/api/models/IndexOptionsRequest.d.ts +73 -0
- package/dist/runtime/api/models/IndexOptionsRequest.mjs +41 -0
- package/dist/runtime/api/models/InsertResponse.d.ts +37 -0
- package/dist/runtime/api/models/InsertResponse.mjs +30 -0
- package/dist/runtime/api/models/JobConfig.d.ts +61 -0
- package/dist/runtime/api/models/JobConfig.mjs +42 -0
- package/dist/runtime/api/models/JobInformation.d.ts +79 -0
- package/dist/runtime/api/models/JobInformation.mjs +49 -0
- package/dist/runtime/api/models/JsonResultBoolean.d.ts +27 -0
- package/dist/runtime/api/models/JsonResultBoolean.mjs +22 -0
- package/dist/runtime/api/models/JsonResultString.d.ts +27 -0
- package/dist/runtime/api/models/JsonResultString.mjs +22 -0
- package/dist/runtime/api/models/JsonSchema.d.ts +46 -0
- package/dist/runtime/api/models/JsonSchema.mjs +38 -0
- package/dist/runtime/api/models/JsonSchemaDefinition.d.ts +59 -0
- package/dist/runtime/api/models/JsonSchemaDefinition.mjs +39 -0
- package/dist/runtime/api/models/JsonValueAny.d.ts +31 -0
- package/dist/runtime/api/models/JsonValueAny.mjs +27 -0
- package/dist/runtime/api/models/JsonValueBoolean.d.ts +31 -0
- package/dist/runtime/api/models/JsonValueBoolean.mjs +27 -0
- package/dist/runtime/api/models/JsonValueString.d.ts +31 -0
- package/dist/runtime/api/models/JsonValueString.mjs +27 -0
- package/dist/runtime/api/models/Login.d.ts +37 -0
- package/dist/runtime/api/models/Login.mjs +30 -0
- package/dist/runtime/api/models/LoginResult.d.ts +44 -0
- package/dist/runtime/api/models/LoginResult.mjs +37 -0
- package/dist/runtime/api/models/Measurement.d.ts +33 -0
- package/dist/runtime/api/models/Measurement.mjs +24 -0
- package/dist/runtime/api/models/Metric.d.ts +52 -0
- package/dist/runtime/api/models/Metric.mjs +35 -0
- package/dist/runtime/api/models/MongoAggregateRequest.d.ts +38 -0
- package/dist/runtime/api/models/MongoAggregateRequest.mjs +34 -0
- package/dist/runtime/api/models/MongoCampConfiguration.d.ts +55 -0
- package/dist/runtime/api/models/MongoCampConfiguration.mjs +39 -0
- package/dist/runtime/api/models/MongoFindRequest.d.ts +49 -0
- package/dist/runtime/api/models/MongoFindRequest.mjs +33 -0
- package/dist/runtime/api/models/MongoIndex.d.ts +103 -0
- package/dist/runtime/api/models/MongoIndex.mjs +60 -0
- package/dist/runtime/api/models/PasswordUpdateRequest.d.ts +31 -0
- package/dist/runtime/api/models/PasswordUpdateRequest.mjs +27 -0
- package/dist/runtime/api/models/PipelineStage.d.ts +37 -0
- package/dist/runtime/api/models/PipelineStage.mjs +30 -0
- package/dist/runtime/api/models/Role.d.ts +44 -0
- package/dist/runtime/api/models/Role.mjs +37 -0
- package/dist/runtime/api/models/SchemaAnalysis.d.ts +50 -0
- package/dist/runtime/api/models/SchemaAnalysis.mjs +40 -0
- package/dist/runtime/api/models/SchemaAnalysisField.d.ts +62 -0
- package/dist/runtime/api/models/SchemaAnalysisField.mjs +45 -0
- package/dist/runtime/api/models/SchemaAnalysisFieldType.d.ts +43 -0
- package/dist/runtime/api/models/SchemaAnalysisFieldType.mjs +33 -0
- package/dist/runtime/api/models/SettingsResponse.d.ts +51 -0
- package/dist/runtime/api/models/SettingsResponse.mjs +34 -0
- package/dist/runtime/api/models/UpdateFileInformationRequest.d.ts +39 -0
- package/dist/runtime/api/models/UpdateFileInformationRequest.mjs +29 -0
- package/dist/runtime/api/models/UpdateRequest.d.ts +41 -0
- package/dist/runtime/api/models/UpdateRequest.mjs +30 -0
- package/dist/runtime/api/models/UpdateResponse.d.ts +49 -0
- package/dist/runtime/api/models/UpdateResponse.mjs +36 -0
- package/dist/runtime/api/models/UpdateRoleRequest.d.ts +38 -0
- package/dist/runtime/api/models/UpdateRoleRequest.mjs +34 -0
- package/dist/runtime/api/models/UserInformation.d.ts +49 -0
- package/dist/runtime/api/models/UserInformation.mjs +35 -0
- package/dist/runtime/api/models/UserProfile.d.ts +56 -0
- package/dist/runtime/api/models/UserProfile.mjs +41 -0
- package/dist/runtime/api/models/Version.d.ts +43 -0
- package/dist/runtime/api/models/Version.mjs +33 -0
- package/dist/runtime/api/models/index.d.ts +39 -0
- package/dist/runtime/api/models/index.mjs +39 -0
- package/dist/runtime/api/runtime.d.ts +182 -0
- package/dist/runtime/api/runtime.mjs +281 -0
- package/dist/runtime/composables/mongocampApi.d.ts +14 -0
- package/dist/runtime/composables/mongocampApi.mjs +45 -0
- package/dist/runtime/composables/mongocampAuth.d.ts +8 -0
- package/dist/runtime/composables/mongocampAuth.mjs +28 -0
- package/dist/runtime/composables/mongocampSearch.d.ts +11 -0
- package/dist/runtime/composables/mongocampSearch.mjs +20 -0
- package/dist/runtime/composables/mongocampStorage.d.ts +0 -0
- package/dist/runtime/composables/mongocampStorage.mjs +5 -0
- package/dist/runtime/composables/mongocampUrl.d.ts +1 -0
- package/dist/runtime/composables/mongocampUrl.mjs +5 -0
- package/dist/runtime/composables/mongocampUser.d.ts +3 -0
- package/dist/runtime/composables/mongocampUser.mjs +4 -0
- package/dist/types.d.ts +2 -8
- package/package.json +4 -3
package/dist/module.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,6 +1,555 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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();
|
|
5
44
|
|
|
6
|
-
|
|
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.5";
|
|
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 };
|