@sfxcode/nuxt-mongocamp-server 2.4.0 → 2.6.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.
- package/dist/module.d.mts +10 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +36 -20
- 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/mongocampApi.d.ts +4 -0
- package/dist/runtime/composables/mongocampApi.js +10 -2
- package/dist/runtime/composables/mongocampApiAdmin.js +1 -1
- package/dist/runtime/composables/mongocampAuth.js +29 -25
- package/dist/runtime/composables/mongocampCollection.d.ts +2 -1
- package/dist/runtime/composables/mongocampCollection.js +36 -13
- package/dist/runtime/composables/mongocampLive.js +25 -3
- package/dist/runtime/composables/mongocampSearch.js +12 -3
- package/dist/runtime/plugins/bson-payload.d.ts +8 -0
- package/dist/runtime/plugins/bson-payload.js +6 -0
- package/dist/runtime/server/composables/mongocampApi.d.ts +5 -1
- package/dist/runtime/server/composables/mongocampApi.js +1 -9
- package/dist/runtime/server/composables/mongocampServerApi.d.ts +4 -0
- package/dist/runtime/server/composables/mongocampServerApi.js +5 -0
- package/dist/runtime/server/mongocamp/core.d.ts +1 -1
- package/dist/runtime/server/mongocamp/core.js +1 -1
- package/dist/runtime/server/mongocamp/embedded-api.d.ts +18 -0
- package/dist/runtime/server/mongocamp/embedded-api.js +10 -0
- package/dist/runtime/utils/appState.d.ts +21 -0
- package/dist/runtime/utils/appState.js +11 -0
- package/dist/runtime/utils/bsonPayload.d.ts +8 -0
- package/dist/runtime/utils/bsonPayload.js +10 -0
- package/dist/runtime/utils/buildFieldFilterExpression.d.ts +4 -0
- package/dist/runtime/utils/buildFieldFilterExpression.js +5 -3
- 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/dist/runtime/utils/sse.js +7 -1
- package/package.json +21 -9
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { reduceBson, reviveBson } from "../utils/bsonPayload.js";
|
|
2
|
+
import { definePayloadPlugin, definePayloadReducer, definePayloadReviver } from "#app";
|
|
3
|
+
export default definePayloadPlugin(() => {
|
|
4
|
+
definePayloadReducer("MongocampBson", reduceBson);
|
|
5
|
+
definePayloadReviver("MongocampBson", reviveBson);
|
|
6
|
+
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The generated client for the server code, against the external server at the module option `url`; `event` is kept for the signature of
|
|
4
|
+
* the earlier versions. With the embedded server the module registers `server/mongocamp/embedded-api.ts` under this name instead (2.5.0),
|
|
5
|
+
* so an application with an external server does not bundle the core and the MongoDB driver.
|
|
6
|
+
*/
|
|
3
7
|
export declare function useMongocampApi(_event: H3Event, token?: string): {
|
|
4
8
|
adminApi: import("../../api/index.js").AdminApi;
|
|
5
9
|
applicationApi: import("../../api/index.js").ApplicationApi;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
2
|
-
import { useMongocampCore } from "../mongocamp/core.js";
|
|
3
2
|
import { useMongocampServerApi } from "./mongocampServerApi.js";
|
|
4
|
-
const EmbeddedBase = "http://mongocamp.embedded";
|
|
5
3
|
export function useMongocampApi(_event, token) {
|
|
6
4
|
const config = useRuntimeConfig();
|
|
7
|
-
|
|
8
|
-
const embedded = config.mongocampServer;
|
|
9
|
-
if (embedded?.enabled) {
|
|
10
|
-
const fetchApi = async (input, init) => (await useMongocampCore(embedded)).fetch(new Request(input, init));
|
|
11
|
-
return useMongocampServerApi(EmbeddedBase, apiKey, token, fetchApi);
|
|
12
|
-
}
|
|
13
|
-
return useMongocampServerApi(config.public.mongocamp?.url, apiKey, token);
|
|
5
|
+
return useMongocampServerApi(config.public.mongocamp?.url, config.mongocampApiKey, token);
|
|
14
6
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { FetchAPI } from '../../api/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The generated client for server code. With an api key the calls run with the rights of the key's user, also when a token is given (the
|
|
4
|
+
* key wins, as since 1.x); in development a warning says so once (2.5.0).
|
|
5
|
+
*/
|
|
2
6
|
export declare function useMongocampServerApi(url: string, key?: string, token?: string, fetchApi?: FetchAPI): {
|
|
3
7
|
adminApi: import("../../api/index.js").AdminApi;
|
|
4
8
|
applicationApi: import("../../api/index.js").ApplicationApi;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Configuration } from "../../api/index.js";
|
|
2
2
|
import { createMongocampApis } from "../../utils/createMongocampApis.js";
|
|
3
|
+
let precedenceExplained = false;
|
|
3
4
|
export function useMongocampServerApi(url, key, token, fetchApi) {
|
|
5
|
+
if (import.meta.dev && key && token && !precedenceExplained) {
|
|
6
|
+
precedenceExplained = true;
|
|
7
|
+
console.warn("[mongocamp] useMongocampApi: the api key of the module options wins over the token of the user; the calls run with the rights of the key's user");
|
|
8
|
+
}
|
|
4
9
|
const credentials = key && key.length > 0 ? { apiKey: key } : token && token.length > 0 ? { accessToken: token } : {};
|
|
5
10
|
return createMongocampApis(new Configuration({ basePath: url, ...credentials, ...fetchApi ? { fetchApi } : {} }));
|
|
6
11
|
}
|
|
@@ -17,7 +17,7 @@ export interface EmbeddedServerConfig {
|
|
|
17
17
|
* The MongoCamp server of this Nitro instance, created with the first request. The env variables of the Scala server (`CONNECTION_*`,
|
|
18
18
|
* `AUTH_*`, ...) are read by the core and win over `config`.
|
|
19
19
|
*/
|
|
20
|
-
export declare function useMongocampCore(settings?: EmbeddedServerConfig): Promise<MongocampServer>;
|
|
20
|
+
export declare function useMongocampCore(settings?: EmbeddedServerConfig | undefined): Promise<MongocampServer>;
|
|
21
21
|
/** Closes the server (database, scheduler, timers) when Nitro stops. */
|
|
22
22
|
export declare function closeMongocampCore(): Promise<void>;
|
|
23
23
|
/** A request for the core: the path without the prefix, the body as a stream. */
|
|
@@ -3,7 +3,7 @@ import { useNitroApp } from "nitro/app";
|
|
|
3
3
|
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
4
4
|
let server;
|
|
5
5
|
export function useMongocampCore(settings = useRuntimeConfig().mongocampServer) {
|
|
6
|
-
if (!settings
|
|
6
|
+
if (!settings?.enabled) {
|
|
7
7
|
return Promise.reject(new Error('[mongocamp] the embedded server is not enabled (module option "server.enabled")'));
|
|
8
8
|
}
|
|
9
9
|
server ??= createMongocampServer({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
/**
|
|
3
|
+
* `useMongocampApi(event, token?)` of an application with the embedded server: the generated client, answered in-process by the core (no
|
|
4
|
+
* network hop to the own Nitro). Registered by the module instead of `server/composables/mongocampApi.ts` when `server.enabled`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMongocampApi(_event: H3Event, token?: string): {
|
|
7
|
+
adminApi: import("../../api/index.js").AdminApi;
|
|
8
|
+
applicationApi: import("../../api/index.js").ApplicationApi;
|
|
9
|
+
authApi: import("../../api/index.js").AuthApi;
|
|
10
|
+
bucketApi: import("../../api/index.js").BucketApi;
|
|
11
|
+
collectionApi: import("../../api/index.js").CollectionApi;
|
|
12
|
+
databaseApi: import("../../api/index.js").DatabaseApi;
|
|
13
|
+
documentApi: import("../../api/index.js").DocumentApi;
|
|
14
|
+
fileApi: import("../../api/index.js").FileApi;
|
|
15
|
+
indexApi: import("../../api/index.js").IndexApi;
|
|
16
|
+
systemApi: import("../../api/index.js").SystemApi;
|
|
17
|
+
jobApi: import("../../api/index.js").JobsApi;
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
2
|
+
import { useMongocampServerApi } from "../composables/mongocampServerApi.js";
|
|
3
|
+
import { useMongocampCore } from "./core.js";
|
|
4
|
+
const EmbeddedBase = "http://mongocamp.embedded";
|
|
5
|
+
export function useMongocampApi(_event, token) {
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const embedded = config.mongocampServer;
|
|
8
|
+
const fetchApi = async (input, init) => (await useMongocampCore(embedded)).fetch(new Request(input, init));
|
|
9
|
+
return useMongocampServerApi(EmbeddedBase, config.mongocampApiKey, token, fetchApi);
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EffectScope, Ref } from 'vue';
|
|
2
|
+
import type { CollectionDeclaration } from '../api/index.js';
|
|
3
|
+
import type { createMongocampApis } from './createMongocampApis.js';
|
|
4
|
+
/**
|
|
5
|
+
* The state of the module that must not outlive one Nuxt app (2.5.0): on the server a Nuxt app is one request, so nothing of a user (the
|
|
6
|
+
* declarations their grants could read, the clients with their token, timers) is shared with the request of another user; in the browser
|
|
7
|
+
* there is one app. Kept in a `WeakMap` by app: it ends with the request, nothing is serialized into the payload (unlike `useState`).
|
|
8
|
+
*/
|
|
9
|
+
export interface MongocampAppState {
|
|
10
|
+
/** The declarations of the collections by `url|name`; `null`: not declared (404). A failed lookup is not kept. */
|
|
11
|
+
declarations: Map<string, Ref<CollectionDeclaration | null | undefined>>;
|
|
12
|
+
/** The generated clients by url (the token is read per request). */
|
|
13
|
+
apis: Map<string, ReturnType<typeof createMongocampApis>>;
|
|
14
|
+
/** The token refresh of the session: one timer and one watcher per app, however many components use `useMongocampAuth()`. */
|
|
15
|
+
auth: {
|
|
16
|
+
timer?: ReturnType<typeof setInterval>;
|
|
17
|
+
scope?: EffectScope;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** The state of the current Nuxt app. */
|
|
21
|
+
export declare function mongocampAppState(): MongocampAppState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useNuxtApp } from "#app";
|
|
2
|
+
const states = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
export function mongocampAppState() {
|
|
4
|
+
const app = useNuxtApp();
|
|
5
|
+
let state = states.get(app);
|
|
6
|
+
if (state === void 0) {
|
|
7
|
+
state = { declarations: /* @__PURE__ */ new Map(), apis: /* @__PURE__ */ new Map(), auth: {} };
|
|
8
|
+
states.set(app, state);
|
|
9
|
+
}
|
|
10
|
+
return state;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A value of the BSON library (`ObjectId`, `Decimal128`, `Long`, `Binary`, ...): every one has `_bsontype`. */
|
|
2
|
+
export declare function isBsonValue(value: unknown): value is {
|
|
3
|
+
_bsontype: string;
|
|
4
|
+
};
|
|
5
|
+
/** The payload form of a BSON value (canonical Extended JSON), `false` for any other value (the reducer does not apply). */
|
|
6
|
+
export declare function reduceBson(value: unknown): unknown;
|
|
7
|
+
/** The BSON value of its payload form. */
|
|
8
|
+
export declare function reviveBson(value: unknown): unknown;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EJSON } from "bson";
|
|
2
|
+
export function isBsonValue(value) {
|
|
3
|
+
return value !== null && typeof value === "object" && "_bsontype" in value;
|
|
4
|
+
}
|
|
5
|
+
export function reduceBson(value) {
|
|
6
|
+
return isBsonValue(value) && EJSON.serialize({ value }, { relaxed: false }).value;
|
|
7
|
+
}
|
|
8
|
+
export function reviveBson(value) {
|
|
9
|
+
return EJSON.deserialize({ value }, { relaxed: false }).value;
|
|
10
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export type FilterFieldValue = string | number | boolean | Date;
|
|
2
|
+
/**
|
|
3
|
+
* A Lucene filter `field: value` for one field (`findByField`). Texts and dates are a quoted phrase in which `\\` and `"` are escaped; the
|
|
4
|
+
* field name is escaped as a whole (2.5.0: before, a `\\` in the value or a `:` / space in the field could change the query).
|
|
5
|
+
*/
|
|
2
6
|
export declare function buildFieldFilterExpression(field: string, value: FilterFieldValue): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
const fieldSpecial = /[+\-&|!(){}[\]^"~*?:\\/\s]/g;
|
|
1
2
|
export function buildFieldFilterExpression(field, value) {
|
|
3
|
+
const escapedField = field.replace(fieldSpecial, (match) => `\\${match}`);
|
|
2
4
|
if (typeof value === "number" || typeof value === "boolean")
|
|
3
|
-
return `${
|
|
5
|
+
return `${escapedField}: ${value}`;
|
|
4
6
|
const stringValue = value instanceof Date ? value.toISOString() : value;
|
|
5
|
-
const escapedValue = stringValue.replace(/"/g,
|
|
6
|
-
return `${
|
|
7
|
+
const escapedValue = stringValue.replace(/[\\"]/g, (match) => `\\${match}`);
|
|
8
|
+
return `${escapedField}: "${escapedValue}"`;
|
|
7
9
|
}
|
|
@@ -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
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export function createSseParser(onEvent) {
|
|
2
2
|
let buffer = "";
|
|
3
|
+
let carriedReturn = false;
|
|
3
4
|
return (chunk) => {
|
|
4
|
-
|
|
5
|
+
let text = (carriedReturn ? "\r" : "") + chunk;
|
|
6
|
+
carriedReturn = text.endsWith("\r");
|
|
7
|
+
if (carriedReturn) {
|
|
8
|
+
text = text.slice(0, -1);
|
|
9
|
+
}
|
|
10
|
+
buffer += text.replace(/\r\n?/g, "\n");
|
|
5
11
|
let end = buffer.indexOf("\n\n");
|
|
6
12
|
while (end >= 0) {
|
|
7
13
|
const block = buffer.slice(0, end);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-mongocamp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
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",
|
|
@@ -24,13 +28,15 @@
|
|
|
24
28
|
"files": [
|
|
25
29
|
"dist"
|
|
26
30
|
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.22.0"
|
|
33
|
+
},
|
|
27
34
|
"build": {
|
|
28
35
|
"failOnWarn": false
|
|
29
36
|
},
|
|
30
37
|
"dependencies": {
|
|
31
38
|
"@nuxt/kit": "^4.7.0",
|
|
32
|
-
"@sfxcode/mongocamp-server-core": "2.
|
|
33
|
-
"@vueuse/nuxt": "^15.1.0",
|
|
39
|
+
"@sfxcode/mongocamp-server-core": "2.6.0",
|
|
34
40
|
"bson": "^7.3.4",
|
|
35
41
|
"consola": "^3.4.2",
|
|
36
42
|
"defu": "^6.1.7"
|
|
@@ -44,6 +50,7 @@
|
|
|
44
50
|
"@openapitools/openapi-generator-cli": "^2.44.0",
|
|
45
51
|
"@types/node": "^26.6.11",
|
|
46
52
|
"@unocss/nuxt": "^66.13.0",
|
|
53
|
+
"@vitest/coverage-v8": "5.1.2",
|
|
47
54
|
"changelogen": "^0.6.2",
|
|
48
55
|
"eslint": "^10.16.0",
|
|
49
56
|
"evlog": "2.37.1",
|
|
@@ -54,6 +61,7 @@
|
|
|
54
61
|
"srvx": "1.0.8",
|
|
55
62
|
"typescript": "6.0.3",
|
|
56
63
|
"vitest": "^5.1.2",
|
|
64
|
+
"vue-tsc": "^3.3.14",
|
|
57
65
|
"zod": "^4.6.7"
|
|
58
66
|
},
|
|
59
67
|
"peerDependencies": {
|
|
@@ -63,9 +71,9 @@
|
|
|
63
71
|
"scripts": {
|
|
64
72
|
"dev": "nuxi dev playground",
|
|
65
73
|
"dev:build": "nuxi build playground",
|
|
66
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
67
|
-
"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",
|
|
68
|
-
"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",
|
|
74
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare docs/tutorial/app",
|
|
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",
|
|
69
77
|
"lint": "eslint .",
|
|
70
78
|
"lint:fix": "eslint --fix .",
|
|
71
79
|
"test": "vitest run",
|
|
@@ -73,12 +81,16 @@
|
|
|
73
81
|
"test:coverage": "vitest run --coverage",
|
|
74
82
|
"test:update": "vitest run --update",
|
|
75
83
|
"test:update:watch": "vitest run --update --watch",
|
|
76
|
-
"api-codegen": "openapi-generator-cli generate -i ./openapi/docs.yaml -g typescript-fetch -o src/runtime/api --additional-properties=typescriptThreePlus=true,supportsES6=true",
|
|
84
|
+
"api-codegen": "openapi-generator-cli generate -i ./openapi/docs.yaml -g typescript-fetch -o src/runtime/api --additional-properties=typescriptThreePlus=true,supportsES6=true && node scripts/api-codegen-post.mjs",
|
|
77
85
|
"test:contract": "vitest run --config vitest.contract.config.ts",
|
|
78
|
-
"typecheck:server": "pnpm --filter @sfxcode/mongocamp-server-core typecheck",
|
|
79
86
|
"sync-versions": "node scripts/sync-versions.mjs",
|
|
80
87
|
"docs:dev": "pnpm --filter mongocamp-docs dev",
|
|
81
88
|
"docs:build": "pnpm --filter mongocamp-docs build",
|
|
82
|
-
"docs:preview": "pnpm --filter mongocamp-docs preview"
|
|
89
|
+
"docs:preview": "pnpm --filter mongocamp-docs preview",
|
|
90
|
+
"codegen": "pnpm api-codegen && pnpm --filter @sfxcode/mongocamp-server-core api-types && pnpm --filter @sfxcode/mongocamp-server-core operations",
|
|
91
|
+
"codegen:check": "pnpm codegen && git diff --exit-code -- src/runtime/api packages/server-core/src/generated",
|
|
92
|
+
"typecheck": "vue-tsc --noEmit && vue-tsc -b playground --noEmit && vue-tsc -b docs/tutorial/app --noEmit && pnpm -r typecheck",
|
|
93
|
+
"test:contract:coverage": "vitest run --config vitest.contract.config.ts --coverage",
|
|
94
|
+
"test:e2e": "vitest run --project e2e"
|
|
83
95
|
}
|
|
84
96
|
}
|