@sfxcode/nuxt-mongocamp-server 1.2.3 → 1.2.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.mts CHANGED
@@ -8,4 +8,5 @@ interface ModuleOptions {
8
8
  }
9
9
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
10
10
 
11
- export { type ModuleOptions, _default as default };
11
+ export { _default as default };
12
+ export type { ModuleOptions };
package/dist/module.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "configKey": "mongocamp",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
7
7
  },
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "2.0.0"
9
+ "@nuxt/module-builder": "1.0.0",
10
+ "unbuild": "3.5.0"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
2
2
 
3
- function isPlainObject$1(value) {
3
+ function isPlainObject$2(value) {
4
4
  if (value === null || typeof value !== "object") {
5
5
  return false;
6
6
  }
@@ -18,7 +18,7 @@ function isPlainObject$1(value) {
18
18
  }
19
19
 
20
20
  function _defu$1(baseObject, defaults, namespace = ".", merger) {
21
- if (!isPlainObject$1(defaults)) {
21
+ if (!isPlainObject$2(defaults)) {
22
22
  return _defu$1(baseObject, {}, namespace, merger);
23
23
  }
24
24
  const object = Object.assign({}, defaults);
@@ -35,7 +35,7 @@ function _defu$1(baseObject, defaults, namespace = ".", merger) {
35
35
  }
36
36
  if (Array.isArray(value) && Array.isArray(object[key])) {
37
37
  object[key] = [...value, ...object[key]];
38
- } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
38
+ } else if (isPlainObject$2(value) && isPlainObject$2(object[key])) {
39
39
  object[key] = _defu$1(
40
40
  value,
41
41
  object[key],
@@ -57,7 +57,6 @@ function createDefu$1(merger) {
57
57
  const defu$1 = createDefu$1();
58
58
 
59
59
  const LogLevels = {
60
- silent: Number.NEGATIVE_INFINITY,
61
60
  fatal: 0,
62
61
  error: 0,
63
62
  warn: 1,
@@ -65,9 +64,6 @@ const LogLevels = {
65
64
  info: 3,
66
65
  success: 3,
67
66
  fail: 3,
68
- ready: 3,
69
- start: 3,
70
- box: 3,
71
67
  debug: 4,
72
68
  trace: 5,
73
69
  verbose: Number.POSITIVE_INFINITY
@@ -125,12 +121,26 @@ const LogTypes = {
125
121
  }
126
122
  };
127
123
 
128
- function isObject(value) {
129
- return value !== null && typeof value === "object";
124
+ function isPlainObject$1(value) {
125
+ if (value === null || typeof value !== "object") {
126
+ return false;
127
+ }
128
+ const prototype = Object.getPrototypeOf(value);
129
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
130
+ return false;
131
+ }
132
+ if (Symbol.iterator in value) {
133
+ return false;
134
+ }
135
+ if (Symbol.toStringTag in value) {
136
+ return Object.prototype.toString.call(value) === "[object Module]";
137
+ }
138
+ return true;
130
139
  }
140
+
131
141
  function _defu(baseObject, defaults, namespace = ".", merger) {
132
- if (!isObject(defaults)) {
133
- return _defu(baseObject, {}, namespace, merger);
142
+ if (!isPlainObject$1(defaults)) {
143
+ return _defu(baseObject, {}, namespace);
134
144
  }
135
145
  const object = Object.assign({}, defaults);
136
146
  for (const key in baseObject) {
@@ -141,18 +151,13 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
141
151
  if (value === null || value === void 0) {
142
152
  continue;
143
153
  }
144
- if (merger && merger(object, key, value, namespace)) {
145
- continue;
146
- }
147
154
  if (Array.isArray(value) && Array.isArray(object[key])) {
148
155
  object[key] = [...value, ...object[key]];
149
- } else if (isObject(value) && isObject(object[key])) {
156
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
150
157
  object[key] = _defu(
151
158
  value,
152
159
  object[key],
153
- (namespace ? `${namespace}.` : "") + key.toString(),
154
- merger
155
- );
160
+ (namespace ? `${namespace}.` : "") + key.toString());
156
161
  } else {
157
162
  object[key] = value;
158
163
  }
@@ -162,7 +167,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
162
167
  function createDefu(merger) {
163
168
  return (...arguments_) => (
164
169
  // eslint-disable-next-line unicorn/no-array-reduce
165
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
170
+ arguments_.reduce((p, c) => _defu(p, c, ""), {})
166
171
  );
167
172
  }
168
173
  const defu = createDefu();
@@ -186,6 +191,14 @@ function isLogObj(arg) {
186
191
  let paused = false;
187
192
  const queue = [];
188
193
  class Consola {
194
+ options;
195
+ _lastLog;
196
+ _mockFn;
197
+ /**
198
+ * Creates an instance of Consola with specified options or defaults.
199
+ *
200
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
201
+ */
189
202
  constructor(options = {}) {
190
203
  const types = options.types || LogTypes;
191
204
  this.options = defu(
@@ -223,9 +236,19 @@ class Consola {
223
236
  }
224
237
  this._lastLog = {};
225
238
  }
239
+ /**
240
+ * Gets the current log level of the Consola instance.
241
+ *
242
+ * @returns {number} The current log level.
243
+ */
226
244
  get level() {
227
245
  return this.options.level;
228
246
  }
247
+ /**
248
+ * Sets the minimum log level that will be output by the instance.
249
+ *
250
+ * @param {number} level - The new log level to set.
251
+ */
229
252
  set level(level) {
230
253
  this.options.level = _normalizeLogLevel(
231
254
  level,
@@ -233,12 +256,27 @@ class Consola {
233
256
  this.options.level
234
257
  );
235
258
  }
259
+ /**
260
+ * Displays a prompt to the user and returns the response.
261
+ * Throw an error if `prompt` is not supported by the current configuration.
262
+ *
263
+ * @template T
264
+ * @param {string} message - The message to display in the prompt.
265
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
266
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
267
+ */
236
268
  prompt(message, opts) {
237
269
  if (!this.options.prompt) {
238
270
  throw new Error("prompt is not supported!");
239
271
  }
240
272
  return this.options.prompt(message, opts);
241
273
  }
274
+ /**
275
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
276
+ *
277
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
278
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
279
+ */
242
280
  create(options) {
243
281
  const instance = new Consola({
244
282
  ...this.options,
@@ -249,6 +287,12 @@ class Consola {
249
287
  }
250
288
  return instance;
251
289
  }
290
+ /**
291
+ * Creates a new Consola instance with the specified default log object properties.
292
+ *
293
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
294
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
295
+ */
252
296
  withDefaults(defaults) {
253
297
  return this.create({
254
298
  ...this.options,
@@ -258,19 +302,39 @@ class Consola {
258
302
  }
259
303
  });
260
304
  }
305
+ /**
306
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
307
+ *
308
+ * @param {string} tag - The tag to include in each log of the new instance.
309
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
310
+ */
261
311
  withTag(tag) {
262
312
  return this.withDefaults({
263
313
  tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
264
314
  });
265
315
  }
316
+ /**
317
+ * Adds a custom reporter to the Consola instance.
318
+ * Reporters will be called for each log message, depending on their implementation and log level.
319
+ *
320
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
321
+ * @returns {Consola} The current Consola instance.
322
+ */
266
323
  addReporter(reporter) {
267
324
  this.options.reporters.push(reporter);
268
325
  return this;
269
326
  }
327
+ /**
328
+ * Removes a custom reporter from the Consola instance.
329
+ * If no reporter is specified, all reporters will be removed.
330
+ *
331
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
332
+ * @returns {Consola} The current Consola instance.
333
+ */
270
334
  removeReporter(reporter) {
271
335
  if (reporter) {
272
336
  const i = this.options.reporters.indexOf(reporter);
273
- if (i >= 0) {
337
+ if (i !== -1) {
274
338
  return this.options.reporters.splice(i, 1);
275
339
  }
276
340
  } else {
@@ -278,6 +342,12 @@ class Consola {
278
342
  }
279
343
  return this;
280
344
  }
345
+ /**
346
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
347
+ *
348
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
349
+ * @returns {Consola} The current Consola instance.
350
+ */
281
351
  setReporters(reporters) {
282
352
  this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
283
353
  return this;
@@ -290,6 +360,9 @@ class Consola {
290
360
  this.restoreConsole();
291
361
  this.restoreStd();
292
362
  }
363
+ /**
364
+ * Overrides console methods with Consola logging methods for consistent logging.
365
+ */
293
366
  wrapConsole() {
294
367
  for (const type in this.options.types) {
295
368
  if (!console["__" + type]) {
@@ -298,6 +371,9 @@ class Consola {
298
371
  console[type] = this[type].raw;
299
372
  }
300
373
  }
374
+ /**
375
+ * Restores the original console methods, removing Consola overrides.
376
+ */
301
377
  restoreConsole() {
302
378
  for (const type in this.options.types) {
303
379
  if (console["__" + type]) {
@@ -306,6 +382,9 @@ class Consola {
306
382
  }
307
383
  }
308
384
  }
385
+ /**
386
+ * Overrides standard output and error streams to redirect them through Consola.
387
+ */
309
388
  wrapStd() {
310
389
  this._wrapStream(this.options.stdout, "log");
311
390
  this._wrapStream(this.options.stderr, "log");
@@ -321,6 +400,9 @@ class Consola {
321
400
  this[type].raw(String(data).trim());
322
401
  };
323
402
  }
403
+ /**
404
+ * Restores the original standard output and error streams, removing the Consola redirection.
405
+ */
324
406
  restoreStd() {
325
407
  this._restoreStream(this.options.stdout);
326
408
  this._restoreStream(this.options.stderr);
@@ -334,9 +416,15 @@ class Consola {
334
416
  delete stream.__write;
335
417
  }
336
418
  }
419
+ /**
420
+ * Pauses logging, queues incoming logs until resumed.
421
+ */
337
422
  pauseLogs() {
338
423
  paused = true;
339
424
  }
425
+ /**
426
+ * Resumes logging, processing any queued logs.
427
+ */
340
428
  resumeLogs() {
341
429
  paused = false;
342
430
  const _queue = queue.splice(0);
@@ -344,6 +432,11 @@ class Consola {
344
432
  item[0]._logFn(item[1], item[2]);
345
433
  }
346
434
  }
435
+ /**
436
+ * Replaces logging methods with mocks if a mock function is provided.
437
+ *
438
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
439
+ */
347
440
  mockTypes(mockFn) {
348
441
  const _mockFn = mockFn || this.options.mockFn;
349
442
  this._mockFn = _mockFn;
@@ -466,6 +559,10 @@ function createConsola$1(options = {}) {
466
559
  }
467
560
 
468
561
  class BrowserReporter {
562
+ options;
563
+ defaultColor;
564
+ levelColorMap;
565
+ typeColorMap;
469
566
  constructor(options) {
470
567
  this.options = { ...options };
471
568
  this.defaultColor = "#7f8c8d";
@@ -534,7 +631,7 @@ function createConsola(options = {}) {
534
631
  const consola = createConsola();
535
632
 
536
633
  const name = "@sfxcode/nuxt-mongocamp-server";
537
- const version = "1.2.3";
634
+ const version = "1.2.5";
538
635
 
539
636
  const module = defineNuxtModule({
540
637
  meta: {
@@ -0,0 +1,54 @@
1
+ apis/AdminApi.ts
2
+ apis/ApplicationApi.ts
3
+ apis/AuthApi.ts
4
+ apis/BucketApi.ts
5
+ apis/CollectionApi.ts
6
+ apis/DatabaseApi.ts
7
+ apis/DocumentApi.ts
8
+ apis/FileApi.ts
9
+ apis/IndexApi.ts
10
+ apis/InformationApi.ts
11
+ apis/JobsApi.ts
12
+ apis/index.ts
13
+ index.ts
14
+ models/BucketInformation.ts
15
+ models/CollectionStatus.ts
16
+ models/DatabaseInfo.ts
17
+ models/DeleteResponse.ts
18
+ models/ErrorDescription.ts
19
+ models/FileInformation.ts
20
+ models/Grant.ts
21
+ models/IndexCreateRequest.ts
22
+ models/IndexCreateResponse.ts
23
+ models/IndexDropResponse.ts
24
+ models/IndexOptionsRequest.ts
25
+ models/InsertResponse.ts
26
+ models/JobConfig.ts
27
+ models/JobInformation.ts
28
+ models/JsonSchema.ts
29
+ models/JsonSchemaDefinition.ts
30
+ models/JsonValueAny.ts
31
+ models/JsonValueBoolean.ts
32
+ models/JsonValueString.ts
33
+ models/Login.ts
34
+ models/LoginResult.ts
35
+ models/MongoAggregateRequest.ts
36
+ models/MongoCampConfiguration.ts
37
+ models/MongoFindRequest.ts
38
+ models/MongoIndex.ts
39
+ models/PasswordUpdateRequest.ts
40
+ models/PipelineStage.ts
41
+ models/Role.ts
42
+ models/SchemaAnalysis.ts
43
+ models/SchemaAnalysisField.ts
44
+ models/SchemaAnalysisFieldType.ts
45
+ models/SettingsResponse.ts
46
+ models/UpdateFileInformationRequest.ts
47
+ models/UpdateRequest.ts
48
+ models/UpdateResponse.ts
49
+ models/UpdateRoleRequest.ts
50
+ models/UserInformation.ts
51
+ models/UserProfile.ts
52
+ models/Version.ts
53
+ models/index.ts
54
+ runtime.ts
@@ -0,0 +1 @@
1
+ 7.9.0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
@@ -2,8 +2,8 @@ import type { UserProfile } from '../api/index.js';
2
2
  export declare function useMongocampAuth(): {
3
3
  login: (loginId: string, loginPassword: string) => Promise<UserProfile>;
4
4
  logout: () => void;
5
- isAuthenticated: () => Promise<import("../api").JsonValueBoolean>;
6
- isLoggedIn: import("vue").ComputedRef<boolean>;
7
- userRoles: import("vue").ComputedRef<string[]>;
8
- userGrants: import("vue").ComputedRef<import("../api").Grant[]>;
5
+ isAuthenticated: () => Promise<import("../api/index.js").JsonValueBoolean>;
6
+ isLoggedIn: import("@vue/reactivity").ComputedRef<boolean>;
7
+ userRoles: import("@vue/reactivity").ComputedRef<string[]>;
8
+ userGrants: import("@vue/reactivity").ComputedRef<import("../api/index.js").Grant[]>;
9
9
  };
@@ -0,0 +1,14 @@
1
+ import { AdminApi, ApplicationApi, AuthApi, BucketApi, CollectionApi, DatabaseApi, DocumentApi, FileApi, IndexApi, InformationApi, JobsApi } from '../../api/index.js';
2
+ export declare function useMongocampServerApi(url: string, key?: string, token?: string): {
3
+ adminApi: AdminApi;
4
+ applicationApi: ApplicationApi;
5
+ authApi: AuthApi;
6
+ bucketApi: BucketApi;
7
+ collectionApi: CollectionApi;
8
+ databaseApi: DatabaseApi;
9
+ documentApi: DocumentApi;
10
+ fileApi: FileApi;
11
+ indexApi: IndexApi;
12
+ informationApi: InformationApi;
13
+ jobApi: JobsApi;
14
+ };
@@ -0,0 +1,46 @@
1
+ import {
2
+ AdminApi,
3
+ ApplicationApi,
4
+ AuthApi,
5
+ BucketApi,
6
+ CollectionApi,
7
+ Configuration,
8
+ DatabaseApi,
9
+ DocumentApi,
10
+ FileApi,
11
+ IndexApi,
12
+ InformationApi,
13
+ JobsApi
14
+ } from "../../api/index.js";
15
+ export function useMongocampServerApi(url, key, token) {
16
+ let configuration = new Configuration();
17
+ if (key && key.length > 0)
18
+ configuration = new Configuration({ basePath: url, apiKey: key });
19
+ else if (token && token.length > 0)
20
+ configuration = new Configuration({ basePath: url, accessToken: token });
21
+ console.log(configuration);
22
+ const adminApi = new AdminApi(configuration);
23
+ const applicationApi = new ApplicationApi(configuration);
24
+ const authApi = new AuthApi(configuration);
25
+ const bucketApi = new BucketApi(configuration);
26
+ const collectionApi = new CollectionApi(configuration);
27
+ const databaseApi = new DatabaseApi(configuration);
28
+ const documentApi = new DocumentApi(configuration);
29
+ const fileApi = new FileApi(configuration);
30
+ const indexApi = new IndexApi(configuration);
31
+ const informationApi = new InformationApi(configuration);
32
+ const jobApi = new JobsApi(configuration);
33
+ return {
34
+ adminApi,
35
+ applicationApi,
36
+ authApi,
37
+ bucketApi,
38
+ collectionApi,
39
+ databaseApi,
40
+ documentApi,
41
+ fileApi,
42
+ indexApi,
43
+ informationApi,
44
+ jobApi
45
+ };
46
+ }
package/dist/types.d.mts CHANGED
@@ -1 +1,3 @@
1
- export { type ModuleOptions, default } from './module.js'
1
+ export { default } from './module.mjs'
2
+
3
+ export { type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,21 +33,22 @@
33
33
  "api-codegen": "openapi-generator-cli generate -i ./openapi/docs.yaml -g typescript-fetch -o src/runtime/api --additional-properties=typescriptThreePlus=true,supportsES6=true"
34
34
  },
35
35
  "dependencies": {
36
- "@nuxt/kit": "^3.13.2",
37
- "@vueuse/nuxt": "^10.11.1"
36
+ "@nuxt/kit": "^3.16.2",
37
+ "@vueuse/nuxt": "^13.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@nuxt/devtools": "^1.5.2",
41
- "@nuxt/eslint-config": "^0.4.0",
42
- "@nuxt/module-builder": "^0.8.4",
43
- "@nuxt/schema": "^3.13.2",
44
- "@nuxt/test-utils": "^3.14.3",
45
- "@openapitools/openapi-generator-cli": "^2.14.0",
46
- "@types/node": "^22.7.5",
47
- "@unocss/nuxt": "^0.61.9",
48
- "changelogen": "^0.5.7",
49
- "eslint": "^9.12.0",
50
- "nuxt": "^3.13.2",
51
- "vitest": "^2.1.2"
52
- }
40
+ "@nuxt/devtools": "^2.3.2",
41
+ "@nuxt/eslint-config": "^1.3.0",
42
+ "@nuxt/module-builder": "^1.0.0",
43
+ "@nuxt/schema": "^3.16.2",
44
+ "@nuxt/test-utils": "^3.17.2",
45
+ "@openapitools/openapi-generator-cli": "^2.18.4",
46
+ "@types/node": "^22.14.0",
47
+ "@unocss/nuxt": "66.1.0-beta.10",
48
+ "changelogen": "^0.6.1",
49
+ "eslint": "^9.24.0",
50
+ "nuxt": "^3.16.2",
51
+ "vitest": "^3.1.1"
52
+ },
53
+ "packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af"
53
54
  }
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,11 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- interface ModuleOptions {
4
- url: string;
5
- paginationSize?: number;
6
- refreshToken: boolean;
7
- tokenRefreshIntervall: number;
8
- }
9
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
10
-
11
- export { type ModuleOptions, _default as default };
package/dist/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export { type ModuleOptions, default } from './module'