@sfxcode/nuxt-mongocamp-server 2.5.0 → 2.6.1
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.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/api/.openapi-generator/FILES +2 -0
- package/dist/runtime/api/apis/AdminApi.d.ts +28 -20
- package/dist/runtime/api/apis/AdminApi.js +49 -47
- package/dist/runtime/api/apis/ApplicationApi.d.ts +20 -0
- package/dist/runtime/api/apis/ApplicationApi.js +51 -0
- package/dist/runtime/api/apis/FileApi.d.ts +53 -0
- package/dist/runtime/api/apis/FileApi.js +81 -0
- package/dist/runtime/api/docs/AdminApi.md +33 -33
- package/dist/runtime/api/docs/ApplicationApi.md +79 -0
- package/dist/runtime/api/docs/CapabilityLimits.md +8 -0
- package/dist/runtime/api/docs/CollectionDeclaration.md +2 -0
- package/dist/runtime/api/docs/CollectionDeclarationIndexesInner.md +10 -0
- package/dist/runtime/api/docs/CollectionDeclarationReferencedByInner.md +40 -0
- package/dist/runtime/api/docs/FileApi.md +97 -0
- package/dist/runtime/api/models/CapabilityLimits.d.ts +16 -0
- package/dist/runtime/api/models/CapabilityLimits.js +12 -0
- package/dist/runtime/api/models/CollectionDeclaration.d.ts +5 -0
- package/dist/runtime/api/models/CollectionDeclaration.js +7 -0
- package/dist/runtime/api/models/CollectionDeclarationIndexesInner.d.ts +37 -0
- package/dist/runtime/api/models/CollectionDeclarationIndexesInner.js +21 -2
- package/dist/runtime/api/models/CollectionDeclarationReferencedByInner.d.ts +42 -0
- package/dist/runtime/api/models/CollectionDeclarationReferencedByInner.js +35 -0
- package/dist/runtime/api/models/CollectionDeclarationRefsInner.d.ts +2 -2
- package/dist/runtime/api/models/CollectionDeclarationRefsInner.js +2 -1
- package/dist/runtime/api/models/index.d.ts +1 -0
- package/dist/runtime/api/models/index.js +1 -0
- package/dist/runtime/client.d.ts +8 -0
- package/dist/runtime/client.js +3 -0
- package/dist/runtime/composables/mongocampApiAdmin.js +1 -1
- package/dist/runtime/utils/createMongocampApis.d.ts +9 -1
- package/dist/runtime/utils/createMongocampApis.js +9 -2
- package/dist/runtime/utils/keepLongs.d.ts +14 -0
- package/dist/runtime/utils/keepLongs.js +45 -0
- package/package.json +8 -4
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
export const CollectionDeclarationIndexesInnerOriginEnum = {
|
|
2
|
+
Declaration: "declaration",
|
|
3
|
+
Owner: "owner"
|
|
4
|
+
};
|
|
5
|
+
export const CollectionDeclarationIndexesInnerPartialFilterFromEnum = {
|
|
6
|
+
SoftDelete: "softDelete"
|
|
7
|
+
};
|
|
1
8
|
export function instanceOfCollectionDeclarationIndexesInner(value) {
|
|
2
9
|
if (!("name" in value) || value["name"] === void 0) return false;
|
|
3
10
|
if (!("key" in value) || value["key"] === void 0) return false;
|
|
4
11
|
if (!("unique" in value) || value["unique"] === void 0) return false;
|
|
12
|
+
if (!("sparse" in value) || value["sparse"] === void 0) return false;
|
|
13
|
+
if (!("origin" in value) || value["origin"] === void 0) return false;
|
|
5
14
|
return true;
|
|
6
15
|
}
|
|
7
16
|
export function CollectionDeclarationIndexesInnerFromJSON(json) {
|
|
@@ -14,7 +23,12 @@ export function CollectionDeclarationIndexesInnerFromJSONTyped(json, ignoreDiscr
|
|
|
14
23
|
return {
|
|
15
24
|
"name": json["name"],
|
|
16
25
|
"key": json["key"],
|
|
17
|
-
"unique": json["unique"]
|
|
26
|
+
"unique": json["unique"],
|
|
27
|
+
"sparse": json["sparse"],
|
|
28
|
+
"origin": json["origin"],
|
|
29
|
+
"partialFilterExpression": json["partialFilterExpression"] == null ? void 0 : json["partialFilterExpression"],
|
|
30
|
+
"partialFilterFrom": json["partialFilterFrom"] == null ? void 0 : json["partialFilterFrom"],
|
|
31
|
+
"expireAfterSeconds": json["expireAfterSeconds"] == null ? void 0 : json["expireAfterSeconds"]
|
|
18
32
|
};
|
|
19
33
|
}
|
|
20
34
|
export function CollectionDeclarationIndexesInnerToJSON(json) {
|
|
@@ -27,6 +41,11 @@ export function CollectionDeclarationIndexesInnerToJSONTyped(value, ignoreDiscri
|
|
|
27
41
|
return {
|
|
28
42
|
"name": value["name"],
|
|
29
43
|
"key": value["key"],
|
|
30
|
-
"unique": value["unique"]
|
|
44
|
+
"unique": value["unique"],
|
|
45
|
+
"sparse": value["sparse"],
|
|
46
|
+
"origin": value["origin"],
|
|
47
|
+
"partialFilterExpression": value["partialFilterExpression"],
|
|
48
|
+
"partialFilterFrom": value["partialFilterFrom"],
|
|
49
|
+
"expireAfterSeconds": value["expireAfterSeconds"]
|
|
31
50
|
};
|
|
32
51
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mongocamp-library
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 2.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface CollectionDeclarationReferencedByInner
|
|
16
|
+
*/
|
|
17
|
+
export interface CollectionDeclarationReferencedByInner {
|
|
18
|
+
/**
|
|
19
|
+
* The referencing collection as the routes name it (name or database:name).
|
|
20
|
+
*/
|
|
21
|
+
collection: string;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
database: string;
|
|
26
|
+
/**
|
|
27
|
+
* The field of the referencing collection that holds the id.
|
|
28
|
+
*/
|
|
29
|
+
field: string;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
many: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a given object implements the CollectionDeclarationReferencedByInner interface.
|
|
37
|
+
*/
|
|
38
|
+
export declare function instanceOfCollectionDeclarationReferencedByInner(value: object): value is CollectionDeclarationReferencedByInner;
|
|
39
|
+
export declare function CollectionDeclarationReferencedByInnerFromJSON(json: any): CollectionDeclarationReferencedByInner;
|
|
40
|
+
export declare function CollectionDeclarationReferencedByInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): CollectionDeclarationReferencedByInner;
|
|
41
|
+
export declare function CollectionDeclarationReferencedByInnerToJSON(json: any): CollectionDeclarationReferencedByInner;
|
|
42
|
+
export declare function CollectionDeclarationReferencedByInnerToJSONTyped(value?: CollectionDeclarationReferencedByInner | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function instanceOfCollectionDeclarationReferencedByInner(value) {
|
|
2
|
+
if (!("collection" in value) || value["collection"] === void 0) return false;
|
|
3
|
+
if (!("database" in value) || value["database"] === void 0) return false;
|
|
4
|
+
if (!("field" in value) || value["field"] === void 0) return false;
|
|
5
|
+
if (!("many" in value) || value["many"] === void 0) return false;
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
export function CollectionDeclarationReferencedByInnerFromJSON(json) {
|
|
9
|
+
return CollectionDeclarationReferencedByInnerFromJSONTyped(json, false);
|
|
10
|
+
}
|
|
11
|
+
export function CollectionDeclarationReferencedByInnerFromJSONTyped(json, ignoreDiscriminator) {
|
|
12
|
+
if (json == null) {
|
|
13
|
+
return json;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
"collection": json["collection"],
|
|
17
|
+
"database": json["database"],
|
|
18
|
+
"field": json["field"],
|
|
19
|
+
"many": json["many"]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function CollectionDeclarationReferencedByInnerToJSON(json) {
|
|
23
|
+
return CollectionDeclarationReferencedByInnerToJSONTyped(json, false);
|
|
24
|
+
}
|
|
25
|
+
export function CollectionDeclarationReferencedByInnerToJSONTyped(value, ignoreDiscriminator = false) {
|
|
26
|
+
if (value == null) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
"collection": value["collection"],
|
|
31
|
+
"database": value["database"],
|
|
32
|
+
"field": value["field"],
|
|
33
|
+
"many": value["many"]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -24,9 +24,9 @@ export interface CollectionDeclarationRefsInner {
|
|
|
24
24
|
*/
|
|
25
25
|
collection: string;
|
|
26
26
|
/**
|
|
27
|
-
* Whether the field holds an array of ids (from the schema);
|
|
27
|
+
* Whether the field holds an array of ids (from the schema or the declaration); false when neither tells (2.6.0, before it was missing then).
|
|
28
28
|
*/
|
|
29
|
-
many
|
|
29
|
+
many: boolean;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Check if a given object implements the CollectionDeclarationRefsInner interface.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function instanceOfCollectionDeclarationRefsInner(value) {
|
|
2
2
|
if (!("field" in value) || value["field"] === void 0) return false;
|
|
3
3
|
if (!("collection" in value) || value["collection"] === void 0) return false;
|
|
4
|
+
if (!("many" in value) || value["many"] === void 0) return false;
|
|
4
5
|
return true;
|
|
5
6
|
}
|
|
6
7
|
export function CollectionDeclarationRefsInnerFromJSON(json) {
|
|
@@ -13,7 +14,7 @@ export function CollectionDeclarationRefsInnerFromJSONTyped(json, ignoreDiscrimi
|
|
|
13
14
|
return {
|
|
14
15
|
"field": json["field"],
|
|
15
16
|
"collection": json["collection"],
|
|
16
|
-
"many": json["many"]
|
|
17
|
+
"many": json["many"]
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
export function CollectionDeclarationRefsInnerToJSON(json) {
|
|
@@ -9,6 +9,7 @@ export * from './CollectionDeclaration.js';
|
|
|
9
9
|
export * from './CollectionDeclarationAudit.js';
|
|
10
10
|
export * from './CollectionDeclarationIndexesInner.js';
|
|
11
11
|
export * from './CollectionDeclarationOwner.js';
|
|
12
|
+
export * from './CollectionDeclarationReferencedByInner.js';
|
|
12
13
|
export * from './CollectionDeclarationRefsInner.js';
|
|
13
14
|
export * from './CollectionDeclarationSoftDelete.js';
|
|
14
15
|
export * from './CollectionDeclarationTimestamps.js';
|
|
@@ -9,6 +9,7 @@ export * from "./CollectionDeclaration.js";
|
|
|
9
9
|
export * from "./CollectionDeclarationAudit.js";
|
|
10
10
|
export * from "./CollectionDeclarationIndexesInner.js";
|
|
11
11
|
export * from "./CollectionDeclarationOwner.js";
|
|
12
|
+
export * from "./CollectionDeclarationReferencedByInner.js";
|
|
12
13
|
export * from "./CollectionDeclarationRefsInner.js";
|
|
13
14
|
export * from "./CollectionDeclarationSoftDelete.js";
|
|
14
15
|
export * from "./CollectionDeclarationTimestamps.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated client with the helpers of the module (2.6.0, `@sfxcode/nuxt-mongocamp-server/client`): every API class and model of
|
|
3
|
+
* `/api`, `createMongocampApis` to build the 11 APIs on one configuration, and Long-safe JSON.
|
|
4
|
+
*/
|
|
5
|
+
export * from './api/index.js';
|
|
6
|
+
export type { MongocampApisOptions } from './utils/createMongocampApis.js';
|
|
7
|
+
export { createMongocampApis } from './utils/createMongocampApis.js';
|
|
8
|
+
export { keepLongsInJson, keepLongsMiddleware, parseJsonKeepingLongs } from './utils/keepLongs.js';
|
|
@@ -20,7 +20,7 @@ export function useMongocampApiAdmin() {
|
|
|
20
20
|
return adminApi.updateRolesForUser({ userId, requestBody: roles });
|
|
21
21
|
}
|
|
22
22
|
function generateNewApiKeyForUser(userId) {
|
|
23
|
-
return adminApi.
|
|
23
|
+
return adminApi.generateNewApiKeyForUser({ userId });
|
|
24
24
|
}
|
|
25
25
|
function listRoles(filter, rowsPerPage, page) {
|
|
26
26
|
return adminApi.listRoles({ filter, rowsPerPage, page });
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { Configuration } from '../api/index.js';
|
|
2
2
|
import { AdminApi, ApplicationApi, AuthApi, BucketApi, CollectionApi, DatabaseApi, DocumentApi, FileApi, IndexApi, SystemApi, JobsApi } from '../api/index.js';
|
|
3
|
-
export
|
|
3
|
+
export interface MongocampApisOptions {
|
|
4
|
+
/** JSON answers keep integers beyond 2^53 exact as `{ $numberLong }` (2.6.0, `keepLongsMiddleware`). */
|
|
5
|
+
keepLongs?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The 11 API classes of the generated client on one configuration (base path, credentials, middleware, fetch); public since 2.6.0
|
|
9
|
+
* (`@sfxcode/nuxt-mongocamp-server/client`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function createMongocampApis(configuration: Configuration, options?: MongocampApisOptions): {
|
|
4
12
|
adminApi: AdminApi;
|
|
5
13
|
applicationApi: ApplicationApi;
|
|
6
14
|
authApi: AuthApi;
|
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
SystemApi,
|
|
12
12
|
JobsApi
|
|
13
13
|
} from "../api/index.js";
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import { keepLongsMiddleware } from "./keepLongs.js";
|
|
15
|
+
export function createMongocampApis(configuration, options = {}) {
|
|
16
|
+
const apis = {
|
|
16
17
|
adminApi: new AdminApi(configuration),
|
|
17
18
|
applicationApi: new ApplicationApi(configuration),
|
|
18
19
|
authApi: new AuthApi(configuration),
|
|
@@ -25,4 +26,10 @@ export function createMongocampApis(configuration) {
|
|
|
25
26
|
systemApi: new SystemApi(configuration),
|
|
26
27
|
jobApi: new JobsApi(configuration)
|
|
27
28
|
};
|
|
29
|
+
if (options.keepLongs) {
|
|
30
|
+
for (const key of Object.keys(apis)) {
|
|
31
|
+
apis[key] = apis[key].withMiddleware(keepLongsMiddleware);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return apis;
|
|
28
35
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Middleware } from '../api/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* JSON with integers beyond 2^53 kept exact (2.6.0). The API writes a Long as a plain number in relaxed Extended JSON; `JSON.parse` (and
|
|
4
|
+
* so the generated client) rounds one beyond `Number.MAX_SAFE_INTEGER`. Here such an integer becomes `{ "$numberLong": "<digits>" }`
|
|
5
|
+
* (canonical Extended JSON, `EJSON.deserialize` makes a `Long` of it); every other value is parsed as `JSON.parse` does.
|
|
6
|
+
*/
|
|
7
|
+
export declare function keepLongsInJson(text: string): string;
|
|
8
|
+
/** `JSON.parse` that keeps integers beyond 2^53 exact as `{ $numberLong }` (see `keepLongsInJson`). */
|
|
9
|
+
export declare function parseJsonKeepingLongs<T = unknown>(text: string): T;
|
|
10
|
+
/**
|
|
11
|
+
* A middleware of the generated client (`new Configuration({ middleware: [keepLongsMiddleware] })`, or `createMongocampApis(configuration,
|
|
12
|
+
* { keepLongs: true })`): JSON answers with integers beyond 2^53 reach the client with them as `{ $numberLong }` instead of rounded.
|
|
13
|
+
*/
|
|
14
|
+
export declare const keepLongsMiddleware: Middleware;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function keepLongsInJson(text) {
|
|
2
|
+
let result = "";
|
|
3
|
+
let copied = 0;
|
|
4
|
+
let position = 0;
|
|
5
|
+
while (position < text.length) {
|
|
6
|
+
const char = text[position];
|
|
7
|
+
if (char === '"') {
|
|
8
|
+
position++;
|
|
9
|
+
while (position < text.length && text[position] !== '"') {
|
|
10
|
+
position += text[position] === "\\" ? 2 : 1;
|
|
11
|
+
}
|
|
12
|
+
position++;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (char === "-" || char >= "0" && char <= "9") {
|
|
16
|
+
const match = /^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?/i.exec(text.slice(position, position + 400));
|
|
17
|
+
const token = match?.[0] ?? char;
|
|
18
|
+
if (/^-?\d+$/.test(token) && !Number.isSafeInteger(Number(token))) {
|
|
19
|
+
result += `${text.slice(copied, position)}{"$numberLong":"${token}"}`;
|
|
20
|
+
copied = position + token.length;
|
|
21
|
+
}
|
|
22
|
+
position += token.length;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
position++;
|
|
26
|
+
}
|
|
27
|
+
return copied === 0 ? text : result + text.slice(copied);
|
|
28
|
+
}
|
|
29
|
+
export function parseJsonKeepingLongs(text) {
|
|
30
|
+
return JSON.parse(keepLongsInJson(text));
|
|
31
|
+
}
|
|
32
|
+
export const keepLongsMiddleware = {
|
|
33
|
+
async post(context) {
|
|
34
|
+
const { response } = context;
|
|
35
|
+
if (!(response.headers.get("content-type") ?? "").includes("json") || response.body === null) {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
const text = await response.clone().text();
|
|
39
|
+
const kept = keepLongsInJson(text);
|
|
40
|
+
if (kept === text) {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
return new Response(kept, { status: response.status, statusText: response.statusText, headers: response.headers });
|
|
44
|
+
}
|
|
45
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-mongocamp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"./api": {
|
|
12
12
|
"types": "./dist/runtime/api/index.d.ts",
|
|
13
13
|
"import": "./dist/runtime/api/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./dist/runtime/client.d.ts",
|
|
17
|
+
"import": "./dist/runtime/client.js"
|
|
14
18
|
}
|
|
15
19
|
},
|
|
16
20
|
"main": "./dist/module.mjs",
|
|
@@ -32,7 +36,7 @@
|
|
|
32
36
|
},
|
|
33
37
|
"dependencies": {
|
|
34
38
|
"@nuxt/kit": "^4.7.0",
|
|
35
|
-
"@sfxcode/mongocamp-server-core": "2.
|
|
39
|
+
"@sfxcode/mongocamp-server-core": "2.6.1",
|
|
36
40
|
"bson": "^7.3.4",
|
|
37
41
|
"consola": "^3.4.2",
|
|
38
42
|
"defu": "^6.1.7"
|
|
@@ -68,8 +72,8 @@
|
|
|
68
72
|
"dev": "nuxi dev playground",
|
|
69
73
|
"dev:build": "nuxi build playground",
|
|
70
74
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare docs/tutorial/app",
|
|
71
|
-
"release": "npm run lint && npm run test && npm run prepack && changelogen --minor --release --no-commit --no-tag && node scripts/sync-versions.mjs --commit && pnpm -r --include-workspace-root --filter @sfxcode/mongocamp-server-core --filter @sfxcode/nuxt-mongocamp-server publish --access public && git push --follow-tags",
|
|
72
|
-
"release:next": "npm run lint && npm run test && npm run prepack && changelogen --prerelease=alpha --release --no-commit --no-tag && node scripts/sync-versions.mjs --commit && pnpm -r --include-workspace-root --filter @sfxcode/mongocamp-server-core --filter @sfxcode/nuxt-mongocamp-server publish --access public --tag next && git push --follow-tags",
|
|
75
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --minor --release --no-commit --no-tag --no-github && node scripts/sync-versions.mjs --commit && pnpm -r --include-workspace-root --filter @sfxcode/mongocamp-server-core --filter @sfxcode/nuxt-mongocamp-server publish --access public && git push --follow-tags && changelogen gh release",
|
|
76
|
+
"release:next": "npm run lint && npm run test && npm run prepack && changelogen --prerelease=alpha --release --no-commit --no-tag --no-github && node scripts/sync-versions.mjs --commit && pnpm -r --include-workspace-root --filter @sfxcode/mongocamp-server-core --filter @sfxcode/nuxt-mongocamp-server publish --access public --tag next && git push --follow-tags && changelogen gh release",
|
|
73
77
|
"lint": "eslint .",
|
|
74
78
|
"lint:fix": "eslint --fix .",
|
|
75
79
|
"test": "vitest run",
|