modelence 0.12.2 → 0.12.4
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/{chunk-KDCFWLYB.js → chunk-6HH5Q47V.js} +3 -3
- package/dist/{chunk-KDCFWLYB.js.map → chunk-6HH5Q47V.js.map} +1 -1
- package/dist/{package-CQPFOFQU.js → package-6IWA7NBJ.js} +2 -2
- package/dist/{package-CQPFOFQU.js.map → package-6IWA7NBJ.js.map} +1 -1
- package/dist/server.d.ts +36 -4
- package/dist/server.js +8 -8
- package/dist/server.js.map +1 -1
- package/dist/{types-V9eDnP35.d.ts → types-1v2HAKb2.d.ts} +10 -3
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ interface EmailProvider {
|
|
|
30
30
|
sendEmail(data: EmailPayload): Promise<void>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
type RateLimitType = 'ip' | 'user';
|
|
33
|
+
type RateLimitType = 'ip' | 'user' | 'email';
|
|
34
34
|
type RateLimitRule = {
|
|
35
35
|
/** Logical action being limited, e.g. "signup" */
|
|
36
36
|
bucket: string;
|
|
@@ -146,6 +146,7 @@ type EnhancedFilterOperators<T> = Omit<FilterOperators<T>, '$in' | '$nin'> & {
|
|
|
146
146
|
$in?: ArrayLikeOfUnion<T>;
|
|
147
147
|
$nin?: ArrayLikeOfUnion<T>;
|
|
148
148
|
};
|
|
149
|
+
type IndexCreationMode = 'blocking' | 'background';
|
|
149
150
|
/**
|
|
150
151
|
* Custom filter value type that handles array fields specially:
|
|
151
152
|
* - For array fields: allows element type, full array type, or FilterOperators
|
|
@@ -249,13 +250,14 @@ declare class Store<TSchema extends ModelSchema, TMethods extends Record<string,
|
|
|
249
250
|
private readonly methods?;
|
|
250
251
|
private readonly indexes;
|
|
251
252
|
private readonly searchIndexes;
|
|
253
|
+
private readonly indexCreationMode;
|
|
252
254
|
private collection?;
|
|
253
255
|
private client?;
|
|
254
256
|
/**
|
|
255
257
|
* Creates a new Store instance
|
|
256
258
|
*
|
|
257
259
|
* @param name - The collection name in MongoDB
|
|
258
|
-
* @param options - Store configuration
|
|
260
|
+
* @param options - Store configuration (schema, indexes, methods, search indexes, and optional index creation mode)
|
|
259
261
|
*/
|
|
260
262
|
constructor(name: string, options: {
|
|
261
263
|
/** Document schema using Modelence schema types */
|
|
@@ -266,8 +268,11 @@ declare class Store<TSchema extends ModelSchema, TMethods extends Record<string,
|
|
|
266
268
|
indexes: IndexDescription[];
|
|
267
269
|
/** MongoDB Atlas Search */
|
|
268
270
|
searchIndexes?: SearchIndexDescription[];
|
|
271
|
+
/** Whether index creation should block startup or run in background (default: 'background') */
|
|
272
|
+
indexCreationMode?: IndexCreationMode;
|
|
269
273
|
});
|
|
270
274
|
getName(): string;
|
|
275
|
+
getIndexCreationMode(): IndexCreationMode;
|
|
271
276
|
/** @internal */
|
|
272
277
|
getSchema(): TSchema;
|
|
273
278
|
/** @internal */
|
|
@@ -277,7 +282,7 @@ declare class Store<TSchema extends ModelSchema, TMethods extends Record<string,
|
|
|
277
282
|
* Returns a new Store instance with the extended schema and updated types.
|
|
278
283
|
* Methods from the original store are preserved with updated type signatures.
|
|
279
284
|
*
|
|
280
|
-
* @param config - Additional schema fields, indexes, methods,
|
|
285
|
+
* @param config - Additional schema fields, indexes, methods, search indexes, and optional index creation mode to add
|
|
281
286
|
* @returns A new Store instance with the extended schema
|
|
282
287
|
*
|
|
283
288
|
* @example
|
|
@@ -310,6 +315,8 @@ declare class Store<TSchema extends ModelSchema, TMethods extends Record<string,
|
|
|
310
315
|
indexes?: IndexDescription[];
|
|
311
316
|
methods?: TExtendedMethods;
|
|
312
317
|
searchIndexes?: SearchIndexDescription[];
|
|
318
|
+
/** Whether index creation should block startup or run in background */
|
|
319
|
+
indexCreationMode?: IndexCreationMode;
|
|
313
320
|
}): Store<TSchema & TExtendedSchema, PreserveMethodsForExtendedSchema<TMethods, TSchema & TExtendedSchema> & TExtendedMethods>;
|
|
314
321
|
/** @internal */
|
|
315
322
|
init(client: MongoClient): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as AppServer, E as ExpressMiddleware, M as ModelenceConfig } from './index-CwdohC5n.js';
|
|
2
2
|
export { e as AppConfig, l as Args, d as AuthErrorProps, q as AuthProvider, A as AuthSuccessProps, j as ClientInfo, b as ConfigKey, C as ConfigSchema, o as ConfigType, p as Configs, k as ConnectionInfo, i as Context, D as DefaultRoles, H as Handler, n as Method, M as MethodDefinition, m as MethodType, P as Permission, h as Role, R as RoleDefinition, f as Session, U as User, g as UserInfo, a as WebsocketClientProvider, W as WebsocketServerProvider } from './types-BOFsm7A2.js';
|
|
3
|
-
export { B as BodyConfig, h as CronJob, C as CronJobInputParams, i as CronJobMetadata, g as EmailAttachment, c as EmailPayload, E as EmailProvider, k as ExpressHandler, H as HttpMethod, I as InferDocumentType, M as ModelSchema, a as RateLimitRule, b as RateLimitType, R as RouteDefinition, d as RouteHandler, j as RouteHandlers, e as RouteParams, f as RouteResponse, s as schema } from './types-
|
|
3
|
+
export { B as BodyConfig, h as CronJob, C as CronJobInputParams, i as CronJobMetadata, g as EmailAttachment, c as EmailPayload, E as EmailProvider, k as ExpressHandler, H as HttpMethod, I as InferDocumentType, M as ModelSchema, a as RateLimitRule, b as RateLimitType, R as RouteDefinition, d as RouteHandler, j as RouteHandlers, e as RouteParams, f as RouteResponse, s as schema } from './types-1v2HAKb2.js';
|
|
4
4
|
import 'express';
|
|
5
5
|
import 'http';
|
|
6
6
|
import 'mongodb';
|