@sfxcode/nuxt-mongocamp-server 1.8.0 → 1.9.0

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 (108) hide show
  1. package/dist/module.json +2 -2
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/api/.openapi-generator/VERSION +1 -1
  4. package/dist/runtime/api/apis/AdminApi.d.ts +65 -2
  5. package/dist/runtime/api/apis/AdminApi.js +39 -27
  6. package/dist/runtime/api/apis/ApplicationApi.d.ts +17 -2
  7. package/dist/runtime/api/apis/ApplicationApi.js +17 -11
  8. package/dist/runtime/api/apis/AuthApi.d.ts +17 -2
  9. package/dist/runtime/api/apis/AuthApi.js +27 -15
  10. package/dist/runtime/api/apis/BucketApi.d.ts +12 -2
  11. package/dist/runtime/api/apis/BucketApi.js +11 -9
  12. package/dist/runtime/api/apis/CollectionApi.d.ts +107 -4
  13. package/dist/runtime/api/apis/CollectionApi.js +58 -38
  14. package/dist/runtime/api/apis/DatabaseApi.d.ts +12 -2
  15. package/dist/runtime/api/apis/DatabaseApi.js +12 -10
  16. package/dist/runtime/api/apis/DocumentApi.d.ts +178 -15
  17. package/dist/runtime/api/apis/DocumentApi.js +54 -40
  18. package/dist/runtime/api/apis/FileApi.d.ts +78 -4
  19. package/dist/runtime/api/apis/FileApi.js +34 -24
  20. package/dist/runtime/api/apis/IndexApi.d.ts +83 -2
  21. package/dist/runtime/api/apis/IndexApi.js +46 -34
  22. package/dist/runtime/api/apis/JobsApi.d.ts +28 -2
  23. package/dist/runtime/api/apis/JobsApi.js +19 -15
  24. package/dist/runtime/api/apis/SystemApi.d.ts +3 -2
  25. package/dist/runtime/api/apis/SystemApi.js +5 -3
  26. package/dist/runtime/api/docs/CollectionApi.md +2 -2
  27. package/dist/runtime/api/docs/CollectionStatus.md +1 -1
  28. package/dist/runtime/api/docs/DatabaseInfo.md +1 -1
  29. package/dist/runtime/api/docs/DocumentApi.md +19 -19
  30. package/dist/runtime/api/docs/FileInformation.md +1 -1
  31. package/dist/runtime/api/docs/IndexInfo.md +3 -3
  32. package/dist/runtime/api/docs/IndexOptionsRequest.md +2 -2
  33. package/dist/runtime/api/docs/IndexUsage.md +1 -1
  34. package/dist/runtime/api/docs/JsonSchemaDefinition.md +1 -1
  35. package/dist/runtime/api/docs/MongoFindRequest.md +3 -3
  36. package/dist/runtime/api/docs/MongoIndex.md +3 -3
  37. package/dist/runtime/api/docs/SettingsResponse.md +1 -1
  38. package/dist/runtime/api/docs/UpdateFileInformationRequest.md +1 -1
  39. package/dist/runtime/api/docs/UpdateRequest.md +2 -2
  40. package/dist/runtime/api/models/BucketInformation.d.ts +1 -9
  41. package/dist/runtime/api/models/ClusterInformation.d.ts +1 -5
  42. package/dist/runtime/api/models/ClusterMemberInformation.d.ts +1 -11
  43. package/dist/runtime/api/models/CollectionPermission.d.ts +1 -9
  44. package/dist/runtime/api/models/CollectionStatus.d.ts +2 -28
  45. package/dist/runtime/api/models/CollectionStatus.js +3 -2
  46. package/dist/runtime/api/models/CollectionSummary.d.ts +1 -19
  47. package/dist/runtime/api/models/CopyRequest.d.ts +1 -9
  48. package/dist/runtime/api/models/CopyResponse.d.ts +1 -7
  49. package/dist/runtime/api/models/CountResponse.d.ts +1 -3
  50. package/dist/runtime/api/models/DatabaseInfo.d.ts +2 -12
  51. package/dist/runtime/api/models/DatabaseInfo.js +3 -2
  52. package/dist/runtime/api/models/DeleteResponse.d.ts +1 -5
  53. package/dist/runtime/api/models/ErrorDescription.d.ts +1 -7
  54. package/dist/runtime/api/models/FieldInfo.d.ts +1 -5
  55. package/dist/runtime/api/models/FieldTypeCount.d.ts +1 -5
  56. package/dist/runtime/api/models/FileInformation.d.ts +2 -14
  57. package/dist/runtime/api/models/FileInformation.js +4 -3
  58. package/dist/runtime/api/models/Grant.d.ts +1 -11
  59. package/dist/runtime/api/models/ImportResponse.d.ts +1 -11
  60. package/dist/runtime/api/models/IndexCreateRequest.d.ts +1 -7
  61. package/dist/runtime/api/models/IndexCreateResponse.d.ts +1 -3
  62. package/dist/runtime/api/models/IndexDropResponse.d.ts +1 -3
  63. package/dist/runtime/api/models/IndexInfo.d.ts +4 -26
  64. package/dist/runtime/api/models/IndexKey.d.ts +1 -5
  65. package/dist/runtime/api/models/IndexOptionsRequest.d.ts +3 -29
  66. package/dist/runtime/api/models/IndexUsage.d.ts +2 -10
  67. package/dist/runtime/api/models/IndexUsage.js +3 -2
  68. package/dist/runtime/api/models/InsertError.d.ts +1 -7
  69. package/dist/runtime/api/models/InsertResponse.d.ts +1 -9
  70. package/dist/runtime/api/models/JobConfig.d.ts +1 -13
  71. package/dist/runtime/api/models/JobInformation.d.ts +1 -19
  72. package/dist/runtime/api/models/JobInformation.js +5 -4
  73. package/dist/runtime/api/models/JsonSchema.d.ts +1 -7
  74. package/dist/runtime/api/models/JsonSchemaDefinition.d.ts +2 -12
  75. package/dist/runtime/api/models/JsonValueAny.d.ts +1 -3
  76. package/dist/runtime/api/models/JsonValueBoolean.d.ts +1 -3
  77. package/dist/runtime/api/models/JsonValueString.d.ts +1 -3
  78. package/dist/runtime/api/models/Login.d.ts +1 -5
  79. package/dist/runtime/api/models/LoginResult.d.ts +1 -7
  80. package/dist/runtime/api/models/LoginResult.js +3 -2
  81. package/dist/runtime/api/models/MongoAggregateRequest.d.ts +1 -5
  82. package/dist/runtime/api/models/MongoCampConfiguration.d.ts +1 -11
  83. package/dist/runtime/api/models/MongoFindRequest.d.ts +4 -10
  84. package/dist/runtime/api/models/MongoIndex.d.ts +4 -28
  85. package/dist/runtime/api/models/MongoIndex.js +3 -2
  86. package/dist/runtime/api/models/PasswordUpdateRequest.d.ts +1 -3
  87. package/dist/runtime/api/models/PipelineStage.d.ts +1 -5
  88. package/dist/runtime/api/models/RenameRequest.d.ts +1 -5
  89. package/dist/runtime/api/models/RenameResponse.d.ts +1 -3
  90. package/dist/runtime/api/models/Role.d.ts +1 -7
  91. package/dist/runtime/api/models/SchemaAnalysis.d.ts +1 -9
  92. package/dist/runtime/api/models/SchemaAnalysisField.d.ts +1 -13
  93. package/dist/runtime/api/models/SchemaAnalysisFieldType.d.ts +1 -7
  94. package/dist/runtime/api/models/SearchRequest.d.ts +1 -7
  95. package/dist/runtime/api/models/SettingsResponse.d.ts +2 -10
  96. package/dist/runtime/api/models/UpdateFileInformationRequest.d.ts +2 -6
  97. package/dist/runtime/api/models/UpdateRequest.d.ts +3 -7
  98. package/dist/runtime/api/models/UpdateResponse.d.ts +1 -9
  99. package/dist/runtime/api/models/UpdateRoleRequest.d.ts +1 -5
  100. package/dist/runtime/api/models/UserInformation.d.ts +1 -9
  101. package/dist/runtime/api/models/UserProfile.d.ts +1 -11
  102. package/dist/runtime/api/models/Version.d.ts +1 -7
  103. package/dist/runtime/api/models/Version.js +3 -2
  104. package/dist/runtime/api/runtime.d.ts +35 -2
  105. package/dist/runtime/api/runtime.js +84 -4
  106. package/dist/runtime/composables/mongocampApiFiles.d.ts +1 -1
  107. package/dist/runtime/composables/mongocampStorage.d.ts +1 -1
  108. package/package.json +3 -3
@@ -51,7 +51,7 @@ export class BaseAPI {
51
51
  this.configuration = configuration;
52
52
  this.middleware = configuration.middleware;
53
53
  }
54
- static jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
54
+ static jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i;
55
55
  middleware;
56
56
  withMiddleware(...middlewares) {
57
57
  const next = this.clone();
@@ -241,7 +241,7 @@ function querystringSingleKey(key, value, keyPrefix = "") {
241
241
  return querystringSingleKey(key, valueAsArray, keyPrefix);
242
242
  }
243
243
  if (value instanceof Date) {
244
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
244
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(serializeDateTime(value))}`;
245
245
  }
246
246
  if (value instanceof Object) {
247
247
  return querystring(value, fullKey);
@@ -252,6 +252,40 @@ export function exists(json, key) {
252
252
  const value = json[key];
253
253
  return value !== null && value !== void 0;
254
254
  }
255
+ export function serializeDateTime(value) {
256
+ return value.toISOString();
257
+ }
258
+ export function serializeDate(value) {
259
+ if (isNaN(value.getTime())) {
260
+ throw new RangeError("Invalid time value");
261
+ }
262
+ const year = ("000" + value.getFullYear()).slice(-4);
263
+ const month = ("0" + (value.getMonth() + 1)).slice(-2);
264
+ const day = ("0" + value.getDate()).slice(-2);
265
+ return `${year}-${month}-${day}`;
266
+ }
267
+ export function parseDate(value) {
268
+ if (value instanceof Date) {
269
+ return value;
270
+ }
271
+ const fullDate = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(value));
272
+ if (fullDate) {
273
+ const year = Number(fullDate[1]);
274
+ const month = Number(fullDate[2]) - 1;
275
+ const day = Number(fullDate[3]);
276
+ const date = /* @__PURE__ */ new Date(0);
277
+ date.setFullYear(year, month, day);
278
+ date.setHours(0, 0, 0, 0);
279
+ if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
280
+ return /* @__PURE__ */ new Date(NaN);
281
+ }
282
+ return date;
283
+ }
284
+ return new Date(value);
285
+ }
286
+ export function parseDateTime(value) {
287
+ return new Date(value);
288
+ }
255
289
  export function mapValues(data, fn) {
256
290
  const result = {};
257
291
  for (const key of Object.keys(data)) {
@@ -259,9 +293,12 @@ export function mapValues(data, fn) {
259
293
  }
260
294
  return result;
261
295
  }
296
+ export function anyToJSON(value) {
297
+ return value;
298
+ }
262
299
  export function canConsumeForm(consumes) {
263
300
  for (const consume of consumes) {
264
- if ("multipart/form-data" === consume.contentType) {
301
+ if (consume.contentType?.startsWith("multipart/form-data") == true) {
265
302
  return true;
266
303
  }
267
304
  }
@@ -288,10 +325,53 @@ export class BlobApiResponse {
288
325
  constructor(raw) {
289
326
  this.raw = raw;
290
327
  }
328
+ /**
329
+ * The body named after the Content-Disposition header, so that a download keeps the name the
330
+ * server gave it. A File is built from a native Blob; the Blob itself is named where there is no
331
+ * global File (Node.js before 20), where File cannot be constructed, or where the Blob is not the
332
+ * native one, as returned by an injected fetch implementation such as node-fetch, which a File
333
+ * would stringify instead of wrapping.
334
+ */
291
335
  async value() {
292
- return await this.raw.blob();
336
+ const blob = await this.raw.blob();
337
+ const name = parseContentDispositionFilename(this.raw.headers) ?? "";
338
+ if (typeof File !== "undefined" && blob instanceof Blob) {
339
+ try {
340
+ return new File([blob], name, { type: blob.type });
341
+ } catch {
342
+ }
343
+ }
344
+ return Object.assign(blob, { name });
345
+ }
346
+ }
347
+ export function parseContentDispositionFilename(headers) {
348
+ const params = parseHeaderParameters(headers.get("Content-Disposition") ?? "");
349
+ return basename(decodeExtValue(params.get("filename*"))) ?? basename(params.get("filename"));
350
+ }
351
+ function decodeExtValue(value) {
352
+ const match = value === void 0 ? null : /^utf-8'[^']*'(.*)$/i.exec(value);
353
+ try {
354
+ return match ? decodeURIComponent(match[1]) : void 0;
355
+ } catch {
356
+ return void 0;
293
357
  }
294
358
  }
359
+ function parseHeaderParameters(value) {
360
+ const params = /* @__PURE__ */ new Map();
361
+ const parameter = /(?:^|;)\s*([^=;]+?)\s*=\s*(?:"((?:[^"\\]|\\.)*)"?|([^;]*))/g;
362
+ let match;
363
+ while ((match = parameter.exec(value)) !== null) {
364
+ const name = match[1].toLowerCase();
365
+ if (!params.has(name)) {
366
+ params.set(name, match[2] !== void 0 ? match[2].replace(/\\(.)/g, "$1") : match[3].trim());
367
+ }
368
+ }
369
+ return params;
370
+ }
371
+ function basename(name) {
372
+ const base = name?.split(/[\\/]/).pop();
373
+ return !base || base === "." || base === ".." ? void 0 : base;
374
+ }
295
375
  export class TextApiResponse {
296
376
  constructor(raw) {
297
377
  this.raw = raw;
@@ -7,7 +7,7 @@ export declare function useMongocampApiFiles(): {
7
7
  list: (bucketName: string, filter?: string, sort?: string, projection?: string, rowsPerPage?: number, page?: number) => Promise<import("../api/index.js").FileInformation[]>;
8
8
  find: (bucketName: string, mongoFindRequest: MongoFindRequest, rowsPerPage?: number, page?: number) => Promise<import("../api/index.js").FileInformation[]>;
9
9
  info: (bucketName: string, fileId: string) => Promise<import("../api/index.js").FileInformation>;
10
- download: (bucketName: string, fileId: string) => Promise<Blob>;
10
+ download: (bucketName: string, fileId: string) => Promise<import("../api/index.js").HttpFile>;
11
11
  upload: (bucketName: string, file: Blob, metaData: string, fileName?: string) => Promise<import("../api/index.js").InsertResponse>;
12
12
  update: (bucketName: string, fileId: string, updateFileInformationRequest: UpdateFileInformationRequest) => Promise<import("../api/index.js").UpdateResponse>;
13
13
  remove: (bucketName: string, fileId: string) => Promise<import("../api/index.js").DeleteResponse>;
@@ -3,4 +3,4 @@ export interface MongocampSession {
3
3
  token: string;
4
4
  profile: UserProfile;
5
5
  }
6
- export declare function useMongocampStorage(): import("#app").CookieRef<MongocampSession>;
6
+ export declare function useMongocampStorage(): import("nuxt/app").CookieRef<MongocampSession>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-mongocamp-server",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,10 +51,10 @@
51
51
  "devDependencies": {
52
52
  "@nuxt/devtools": "^4.1.0",
53
53
  "@nuxt/eslint-config": "^1.17.0",
54
- "@nuxt/module-builder": "^1.0.3",
54
+ "@nuxt/module-builder": "^1.0.4",
55
55
  "@nuxt/schema": "^4.6.4",
56
56
  "@nuxt/test-utils": "^4.4.0",
57
- "@openapitools/openapi-generator-cli": "^2.42.0",
57
+ "@openapitools/openapi-generator-cli": "^2.42.2",
58
58
  "@types/node": "^26.6.6",
59
59
  "@unocss/nuxt": "^66.12.0",
60
60
  "changelogen": "^0.6.2",