@nxgt/mongo 0.1.0 → 0.3.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/README.md +149 -29
- package/dist/collection/get-collection.d.ts +26 -0
- package/dist/collection/get-collection.d.ts.map +1 -0
- package/dist/collection/types.d.ts +270 -0
- package/dist/collection/types.d.ts.map +1 -0
- package/dist/definition/define-collection.d.ts +37 -5
- package/dist/definition/define-collection.d.ts.map +1 -1
- package/dist/definition/fields.d.ts +5 -5
- package/dist/definition/fields.d.ts.map +1 -1
- package/dist/definition/object-id.d.ts +51 -0
- package/dist/definition/object-id.d.ts.map +1 -0
- package/dist/errors/data-error.d.ts +13 -1
- package/dist/errors/data-error.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +292 -188
- package/dist/index.js.map +10 -9
- package/dist/transaction/with-transaction.d.ts +4 -4
- package/package.json +1 -1
- package/dist/repository/create-repository.d.ts +0 -21
- package/dist/repository/create-repository.d.ts.map +0 -1
- package/dist/repository/types.d.ts +0 -145
- package/dist/repository/types.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-collection.d.ts","sourceRoot":"","sources":["../../src/definition/define-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"define-collection.d.ts","sourceRoot":"","sources":["../../src/definition/define-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,kEAAkE;AAClE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,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E,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACnB,CAYA"}
|
|
@@ -11,7 +11,7 @@ export declare function objectId(): z.ZodCustom<ObjectId, ObjectId>;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function id(): z.ZodDefault<z.ZodCustom<ObjectId, ObjectId>>;
|
|
13
13
|
/**
|
|
14
|
-
* `createdAt` and `updatedAt`, filled on create. A
|
|
14
|
+
* `createdAt` and `updatedAt`, filled on create. A collection sets `updatedAt`
|
|
15
15
|
* on every update.
|
|
16
16
|
*/
|
|
17
17
|
export declare function timestamps(): {
|
|
@@ -19,14 +19,14 @@ export declare function timestamps(): {
|
|
|
19
19
|
updatedAt: z.ZodDefault<z.ZodDate>;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* `deletedAt`, `null` while the document is live. A
|
|
22
|
+
* `deletedAt`, `null` while the document is live. A collection on a collection
|
|
23
23
|
* with it soft-deletes, and leaves deleted documents out of every read.
|
|
24
24
|
*/
|
|
25
25
|
export declare function softDelete(): {
|
|
26
26
|
deletedAt: z.ZodDefault<z.ZodNullable<z.ZodDate>>;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
* `version`, raised by one on every update. A
|
|
29
|
+
* `version`, raised by one on every update. A collection with it takes
|
|
30
30
|
* `expectedVersion` and throws `OptimisticLockError` when it no longer
|
|
31
31
|
* matches.
|
|
32
32
|
*/
|
|
@@ -35,7 +35,7 @@ export declare function optimisticLock(): {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* `createdBy`, `updatedBy` and `deletedBy`, stamped from the actor a
|
|
38
|
-
*
|
|
38
|
+
* collection was given with `as(actor)`. The actor's own type is the schema
|
|
39
39
|
* passed in, an `ObjectId` by default.
|
|
40
40
|
*/
|
|
41
41
|
export declare function actors<Actor extends z.ZodType = ReturnType<typeof objectId>>(actor?: Actor): {
|
|
@@ -43,7 +43,7 @@ export declare function actors<Actor extends z.ZodType = ReturnType<typeof objec
|
|
|
43
43
|
updatedBy: z.ZodDefault<z.ZodNullable<Actor>>;
|
|
44
44
|
deletedBy: z.ZodDefault<z.ZodNullable<Actor>>;
|
|
45
45
|
};
|
|
46
|
-
/** The fields the
|
|
46
|
+
/** The fields the collection gives a meaning to, by name. */
|
|
47
47
|
export declare const STAMP_FIELDS: {
|
|
48
48
|
readonly id: "_id";
|
|
49
49
|
readonly createdAt: "createdAt";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/definition/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/definition/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,wBAAgB,QAAQ,oCAIvB;AAED;;;GAGG;AACH,wBAAgB,EAAE,kDAEjB;AAED;;;GAGG;AACH,wBAAgB,UAAU;;;EAKzB;AAED;;;GAGG;AACH,wBAAgB,UAAU;;EAEzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc;;EAE7B;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,EAC3E,KAAK,GAAE,KAAsC;;;;EAO7C;AAED,6DAA6D;AAC7D,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ObjectId } from 'mongodb';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* An `ObjectId`, read by its BSON tag rather than with `instanceof`, which
|
|
5
|
+
* answers `false` across two copies of the driver in one tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isObjectId(value: unknown): value is ObjectId;
|
|
8
|
+
/** Is this the 24-character hex string an `ObjectId` is written as? */
|
|
9
|
+
export declare function isObjectIdString(value: unknown): value is string;
|
|
10
|
+
/** An `ObjectId`, or a string that stands for one. */
|
|
11
|
+
export declare function isValidObjectId(value: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The `ObjectId` this value stands for, or `undefined`. Never throws.
|
|
14
|
+
*
|
|
15
|
+
* Prefer it to `new ObjectId(value)`, which **invents a fresh id** when it is
|
|
16
|
+
* given `null` or `undefined` — a missing route parameter then reads as a
|
|
17
|
+
* perfectly valid id that matches nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function tryObjectId(value: unknown): ObjectId | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The `ObjectId` this value stands for. Throws `InvalidIdError` for anything
|
|
22
|
+
* else, `null` and `undefined` included.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const user = await users.getById(toObjectId(request.params.id));
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function toObjectId(value: unknown, field?: string): ObjectId;
|
|
29
|
+
/**
|
|
30
|
+
* The same, for a list — a `$in` filter built from query parameters.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* await users.findMany({ filter: { _id: { $in: toObjectIds(ids) } } });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function toObjectIds(values: Iterable<unknown>, field?: string): ObjectId[];
|
|
37
|
+
/**
|
|
38
|
+
* A Zod schema for an id that arrives from outside: it takes an `ObjectId` or
|
|
39
|
+
* its hex string and gives back an `ObjectId`.
|
|
40
|
+
*
|
|
41
|
+
* It belongs in the schema of a route's parameters, **not** in a collection's:
|
|
42
|
+
* a field that parses one type into another has no honest `$jsonSchema`, and
|
|
43
|
+
* what a collection stores is `objectId()`.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* const params = z.object({ id: objectIdParam() });
|
|
47
|
+
* const { id } = params.parse(request.params); // ObjectId
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function objectIdParam(): z.ZodPipe<z.ZodCustom<string | ObjectId, string | ObjectId>, z.ZodTransform<ObjectId, string | ObjectId>>;
|
|
51
|
+
//# sourceMappingURL=object-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-id.d.ts","sourceRoot":"","sources":["../../src/definition/object-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAM5D;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAIhE;AASD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAQ,GAAG,QAAQ,CAOlE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EACzB,KAAK,SAAQ,GACX,QAAQ,EAAE,CAEZ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,8GAM5B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** What went wrong, as a string a caller can switch on. */
|
|
2
|
-
export type DataErrorCode = 'DATABASE' | 'NOT_FOUND' | 'CONFLICT' | 'VALIDATION' | 'OPTIMISTIC_LOCK' | 'INVALID_CURSOR';
|
|
2
|
+
export type DataErrorCode = 'DATABASE' | 'NOT_FOUND' | 'CONFLICT' | 'VALIDATION' | 'OPTIMISTIC_LOCK' | 'INVALID_CURSOR' | 'INVALID_ID';
|
|
3
3
|
/** One reason a document failed the collection's `$jsonSchema` validator. */
|
|
4
4
|
export interface ValidationIssue {
|
|
5
5
|
/** The dotted path of the field, empty for the document itself. */
|
|
@@ -83,6 +83,18 @@ export declare class OptimisticLockError extends DataError {
|
|
|
83
83
|
readonly code: "OPTIMISTIC_LOCK";
|
|
84
84
|
constructor(message?: string, options?: DataErrorOptions);
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* A value that is not an `ObjectId` and not the string of one.
|
|
88
|
+
*
|
|
89
|
+
* It is a `DataError` rather than a `TypeError` because it is usually data,
|
|
90
|
+
* not a mistake in the code: an id off a URL or a form reaches `toObjectId`,
|
|
91
|
+
* and a handler wants to answer 400 or 404 rather than crash.
|
|
92
|
+
*/
|
|
93
|
+
export declare class InvalidIdError extends DataError {
|
|
94
|
+
name: string;
|
|
95
|
+
readonly code: "INVALID_ID";
|
|
96
|
+
constructor(message?: string, options?: DataErrorOptions);
|
|
97
|
+
}
|
|
86
98
|
/** A cursor this package did not write, or one for another ordering. */
|
|
87
99
|
export declare class InvalidCursorError extends DataError {
|
|
88
100
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-error.d.ts","sourceRoot":"","sources":["../../src/errors/data-error.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GACtB,UAAU,GACV,WAAW,GACX,UAAU,GACV,YAAY,GACZ,iBAAiB,GACjB,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"data-error.d.ts","sourceRoot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B,CAAU;gBAExC,OAAO,SAAqB,EAAE,OAAO,GAAE,gBAAqB;CAGxE;AAED;;;;;;GAMG;AACH,qBAAa,cAAe,SAAQ,SAAS;IACnC,IAAI,SAAoB;IACjC,SAAkB,IAAI,EAAG,YAAY,CAAU;gBAEnC,OAAO,SAAe,EAAE,OAAO,GAAE,gBAAqB;CAGlE;AAED,wEAAwE;AACxE,qBAAa,kBAAmB,SAAQ,SAAS;IACvC,IAAI,SAAwB;IACrC,SAAkB,IAAI,EAAG,gBAAgB,CAAU;gBAEvC,OAAO,SAAmB,EAAE,OAAO,GAAE,gBAAqB;CAGtE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type CollectionSource, getCollection, } from './collection/get-collection';
|
|
2
|
+
export type { ActorOf, CollectionApi, CollectionOptions, CursorPaginateOptions, FieldPath, FindFirstOptions, FindManyOptions, OrderDirection, PaginateOptions, Patch, ProjectionOf, ProjectionOperator, PushOf, ReadOptions, SetOf, SortOf, TypedCollection, UpdateOperators, UpdateOptions, } from './collection/types';
|
|
3
|
+
export { type AnyCollectionDefinition, type CollectionConfig, type CollectionDefinition, type CollectionIndex, type DocumentOf, defineCollection, type FieldOf, type IdOf, type IndexKey, type NewDocumentOf, type ReadDocumentOf, stampsOf, type ValidationAction, type ValidationConfig, type ValidationLevel, } from './definition/define-collection';
|
|
2
4
|
export { actors, id, objectId, optimisticLock, STAMP_FIELDS, softDelete, timestamps, } from './definition/fields';
|
|
3
5
|
export { MONGO_JSON_SCHEMA_KEYWORDS, toMongoJsonSchema, } from './definition/json-schema';
|
|
4
|
-
export {
|
|
6
|
+
export { isObjectId, isObjectIdString, isValidObjectId, objectIdParam, toObjectId, toObjectIds, tryObjectId, } from './definition/object-id';
|
|
7
|
+
export { ConflictError, DataError, type DataErrorCode, type DataErrorOptions, InvalidCursorError, InvalidIdError, NotFoundError, OptimisticLockError, ValidationError, type ValidationIssue, } from './errors/data-error';
|
|
5
8
|
export { toDataError } from './errors/to-data-error';
|
|
6
9
|
export { type CursorPayload, decodeCursor, encodeCursor, } from './pagination/cursor';
|
|
7
10
|
export { type CursorPage, cursorLimit, DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, type Page, type PageOptions, type PageWindow, pageWindow, toPage, } from './pagination/page';
|
|
8
|
-
export { createRepository } from './repository/create-repository';
|
|
9
|
-
export type { CursorPaginateOptions, FindFirstOptions, FindManyOptions, OrderDirection, PaginateOptions, Patch, ReadOptions, Repository, RepositoryOptions, UpdateOptions, } from './repository/types';
|
|
10
11
|
export { diffIndexes, type IndexDiff, indexMatches, indexNameOf, type NormalizedIndex, normalizeIndex, } from './sync/index-diff';
|
|
11
12
|
export { type SyncOptions, type SyncReport, syncCollection, syncCollections, } from './sync/sync-collection';
|
|
12
13
|
export { hasValidator, type LiveValidation, validationMatches, type WantedValidation, } from './sync/validator-diff';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,MAAM,EACN,EAAE,EACF,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,0BAA0B,EAC1B,iBAAiB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,aAAa,EACb,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,KAAK,eAAe,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACN,KAAK,aAAa,EAClB,YAAY,EACZ,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,UAAU,EACf,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,UAAU,EACV,MAAM,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,EACrB,aAAa,GACb,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACX,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,eAAe,EACf,KAAK,EACL,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,WAAW,EACX,KAAK,EACL,MAAM,EACN,eAAe,EACf,eAAe,EACf,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACN,MAAM,EACN,EAAE,EACF,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,0BAA0B,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