@orion-js/mongodb 3.3.8 → 3.3.10

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.
@@ -55,3 +55,30 @@ it('generates a ids with a prefix', async () => {
55
55
  await Tests.updateOne({ _id: 'pref_123' }, { $set: { name: 'Nicolás' } });
56
56
  expect(userId).toMatch(/^pref_/);
57
57
  });
58
+ it('generates a ids with a distinct type', async () => {
59
+ let Schema = class Schema {
60
+ };
61
+ __decorate([
62
+ (0, typed_model_1.Prop)(),
63
+ __metadata("design:type", String)
64
+ ], Schema.prototype, "_id", void 0);
65
+ __decorate([
66
+ (0, typed_model_1.Prop)(),
67
+ __metadata("design:type", String)
68
+ ], Schema.prototype, "name", void 0);
69
+ Schema = __decorate([
70
+ (0, typed_model_1.TypedSchema)()
71
+ ], Schema);
72
+ const Tests = (0, index_1.default)({
73
+ name: (0, helpers_1.generateId)(),
74
+ schema: Schema
75
+ });
76
+ const userId = await Tests.insertOne({
77
+ name: 'Nico'
78
+ });
79
+ await Tests.findOne(userId);
80
+ // This should throw an error
81
+ // await Tests.findOne(anId)
82
+ const anId = '123';
83
+ await Tests.findOne(anId);
84
+ });
@@ -166,4 +166,7 @@ export interface Collection<ModelClass extends ModelClassBase = ModelClassBase>
166
166
  createIndexesPromise: Promise<string[]>;
167
167
  connectionPromise: Promise<MongoDB.MongoClient>;
168
168
  }
169
+ export declare type DistinctDocumentId<DistinctId extends string> = string & {
170
+ __TYPE__: `DistinctDocumentId<${DistinctId}>`;
171
+ };
169
172
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/mongodb",
3
- "version": "3.3.8",
3
+ "version": "3.3.10",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [
@@ -20,11 +20,11 @@
20
20
  "@orion-js/env": "^3.3.6",
21
21
  "@orion-js/helpers": "^3.3.6",
22
22
  "@orion-js/logger": "^3.3.6",
23
- "@orion-js/models": "^3.3.6",
24
- "@orion-js/resolvers": "^3.3.6",
25
- "@orion-js/schema": "^3.3.6",
23
+ "@orion-js/models": "^3.3.10",
24
+ "@orion-js/resolvers": "^3.3.9",
25
+ "@orion-js/schema": "^3.3.9",
26
26
  "@orion-js/services": "^3.3.6",
27
- "@orion-js/typed-model": "^3.3.6",
27
+ "@orion-js/typed-model": "^3.3.10",
28
28
  "dataloader": "2.1.0",
29
29
  "dot-object": "2.1.4",
30
30
  "mongodb": "4.5.0"
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "78e2d748683f8b4df0e78d349eb05cb6da56e910"
44
+ "gitHead": "ab22792ea37e41f4954a481c5939dc37fa2fff96"
45
45
  }