@bedrockio/model 0.14.4 → 0.16.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.16.0
2
+
3
+ - Added `upsert` method.
4
+
5
+ ## 0.15.0
6
+
7
+ - Tagged outer includes schema.
8
+ - `allowInclude` -> `allowIncludes`.
9
+ - Inclues not allowed on `getUpdateValidation` by default (revert of `0.14.1`).
10
+
1
11
  ## 0.14.4
2
12
 
3
13
  - Fixed bug with nested includes in update validation.
package/README.md CHANGED
@@ -931,6 +931,20 @@ caller does not need to know whether the path contains subdocuments or foreign
931
931
  references. As Bedrock has knowledge of the schemas, it is able to build the
932
932
  appropriate call to `populate` for you.
933
933
 
934
+ #### Include Syntax
935
+
936
+ | Example | Type | Populated | Description |
937
+ | ----------------- | --------- | --------- | ---------------------------------------------------- |
938
+ | `shop` | Inclusive | shop | Populates top level document. |
939
+ | `shop.user` | Inclusive | shop/user | Populates two levels deep. |
940
+ | `^name` | Exclusive | | Selects only `name`. |
941
+ | `^shop.name` | Exclusive | shop | Selects only `shop.name`. |
942
+ | `^shop.user.name` | Exclusive | shop/user | Selects only `shop.user.name`. |
943
+ | `shop.^user.name` | Exclusive | shop/user | Selects root fields and `shop.user.name`. |
944
+ | `shop.user.^name` | Exclusive | shop/user | Selects root and `shop` fields and `shop.user.name`. |
945
+ | `*Name` | Wildcard | | Matches any root field ending with `Name`. |
946
+ | `**Name` | Wildcard | | Matches any root or nested field ending with `Name`. |
947
+
934
948
  #### Exclusive Fields
935
949
 
936
950
  By default, arguments to `include` are for population. However often field
@@ -1650,35 +1664,52 @@ string, both of which would be stored in the database if naively assigned with
1650
1664
 
1651
1665
  ### Upsert
1652
1666
 
1653
- This module adds a single `findOrCreate` convenience method that is easy to
1654
- understand and avoids some of the gotchas that come with upserting documents in
1655
- Mongoose:
1667
+ This module adds two similar methods:
1668
+
1669
+ - `upsert`
1670
+ - `findOrCreate`
1671
+
1672
+ The `upsert` method is used when documents must always be overwritten with the
1673
+ latest data.
1656
1674
 
1657
1675
  ```js
1658
- const shop = await Shop.findOrCreate({
1659
- name: 'My Shop',
1660
- });
1676
+ const shop = await Shop.upsert(
1677
+ {
1678
+ name: 'My Shop',
1679
+ },
1680
+ {
1681
+ name: 'My Shop',
1682
+ slug: 'my-shop',
1683
+ },
1684
+ );
1685
+
1686
+ // This is equivalent to:
1661
1687
 
1662
- // This is equivalent to running:
1663
1688
  let shop = await Shop.findOne({
1664
1689
  name: 'My Shop',
1665
1690
  });
1666
1691
 
1667
- if (!shop) {
1692
+ if (shop) {
1693
+ shop.assign({
1694
+ name: 'My Shop',
1695
+ slug: 'my-shop',
1696
+ });
1697
+ await shop.save();
1698
+ } else {
1668
1699
  shop = await Shop.create({
1669
1700
  name: 'My Shop',
1701
+ slug: 'my-shop',
1670
1702
  });
1671
1703
  }
1672
1704
  ```
1673
1705
 
1674
- In most cases not all of the fields should be queried on to determine if an
1675
- existing document exists. In this case two arguments should be passed the first
1676
- of which is the query:
1706
+ The `findOrCreate` method does just whan the name implies and will return the
1707
+ document it finds without modifying it.
1677
1708
 
1678
1709
  ```js
1679
1710
  const shop = await Shop.findOrCreate(
1680
1711
  {
1681
- slug: 'my-shop',
1712
+ name: 'My Shop',
1682
1713
  },
1683
1714
  {
1684
1715
  name: 'My Shop',
@@ -1686,9 +1717,10 @@ const shop = await Shop.findOrCreate(
1686
1717
  },
1687
1718
  );
1688
1719
 
1689
- // This is equivalent to running:
1720
+ // This is equivalent to:
1721
+
1690
1722
  let shop = await Shop.findOne({
1691
- slug: 'my-shop',
1723
+ name: 'My Shop',
1692
1724
  });
1693
1725
 
1694
1726
  if (!shop) {
@@ -1699,6 +1731,27 @@ if (!shop) {
1699
1731
  }
1700
1732
  ```
1701
1733
 
1734
+ Note that a single argument can also be passed as a shortcut to both the query
1735
+ and the update for simple cases:
1736
+
1737
+ ```js
1738
+ const shop = await Shop.findOrCreate({
1739
+ name: 'My Shop',
1740
+ });
1741
+
1742
+ // This is equivalent to:
1743
+
1744
+ let shop = await Shop.findOne({
1745
+ name: 'My Shop',
1746
+ });
1747
+
1748
+ if (!shop) {
1749
+ shop = await Shop.create({
1750
+ name: 'My Shop',
1751
+ });
1752
+ }
1753
+ ```
1754
+
1702
1755
  ### Clone
1703
1756
 
1704
1757
  Adds a single `clone` method on documents. This is an async method mostly for
@@ -3,12 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.INCLUDE_FIELD_SCHEMA = void 0;
7
6
  exports.applyInclude = applyInclude;
8
7
  exports.checkSelects = checkSelects;
9
8
  exports.getDocumentParams = getDocumentParams;
10
9
  exports.getParams = getParams;
11
- var _yada = _interopRequireDefault(require("@bedrockio/yada"));
12
10
  var _lodash = require("lodash");
13
11
  var _mongoose = _interopRequireDefault(require("mongoose"));
14
12
  var _const = require("./const");
@@ -24,10 +22,6 @@ _mongoose.default.Query.prototype.include = function include(arg) {
24
22
  }
25
23
  return this;
26
24
  };
27
- const DESCRIPTION = 'Field to be selected or populated.';
28
- const INCLUDE_FIELD_SCHEMA = exports.INCLUDE_FIELD_SCHEMA = _yada.default.object({
29
- include: _yada.default.allow(_yada.default.string().description(DESCRIPTION), _yada.default.array(_yada.default.string().description(DESCRIPTION)))
30
- });
31
25
  function applyInclude(schema) {
32
26
  // Query Includes
33
27
 
@@ -5,11 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.applyUpsert = applyUpsert;
7
7
  function applyUpsert(schema) {
8
- // Note: Intentionally avoiding the findOneAndUpdate approach here
9
- // as this will prevent hooks from being run on the document. This
10
- // means however that we cannot always return a query here as the
11
- // operations are inherently different.
8
+ // Note: Avoiding the findOneAndUpdate approach here as this
9
+ // will prevent hooks from being run on the document. This
10
+ // means however that we cannot always return a query here
11
+ // as the operations are inherently different.
12
12
 
13
+ schema.static('upsert', async function upsert(query, fields) {
14
+ fields ||= query;
15
+ let doc = await this.findOne(query);
16
+ if (doc) {
17
+ doc.assign(fields);
18
+ await doc.save();
19
+ } else {
20
+ doc = await this.create(fields);
21
+ }
22
+ return doc;
23
+ });
13
24
  schema.static('findOrCreate', async function findOrCreate(query, fields) {
14
25
  fields ||= query;
15
26
  let doc = await this.findOne(query);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.STRING_RANGE_SCHEMA = exports.REFERENCE_SCHEMA = exports.OBJECT_ID_SCHEMA = exports.NUMBER_RANGE_SCHEMA = exports.DATE_SCHEMA = exports.DATE_RANGE_SCHEMA = void 0;
6
+ exports.STRING_RANGE_SCHEMA = exports.REFERENCE_SCHEMA = exports.OBJECT_ID_SCHEMA = exports.NUMBER_RANGE_SCHEMA = exports.INCLUDE_FIELD_SCHEMA = exports.DATE_SCHEMA = exports.DATE_RANGE_SCHEMA = void 0;
7
7
  var _yada = _interopRequireDefault(require("@bedrockio/yada"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const DATE_TAGS = {
@@ -66,4 +66,10 @@ const REFERENCE_SCHEMA = exports.REFERENCE_SCHEMA = _yada.default.allow(OBJECT_I
66
66
  A 24 character hexadecimal string representing a Mongo [ObjectId](https://bit.ly/3YPtGlU).
67
67
  An object with an \`id\` field may also be passed, which will be converted into a string.
68
68
  `.trim()
69
+ });
70
+ const INCLUDE_FIELD_SCHEMA = exports.INCLUDE_FIELD_SCHEMA = _yada.default.object({
71
+ include: _yada.default.allow(_yada.default.string(), _yada.default.array(_yada.default.string())).tag({
72
+ 'x-schema': 'Includes',
73
+ 'x-description': 'A `string` or `array` of fields to be selected or populated using [includes syntax](https://bit.ly/4mZwSq4).'
74
+ })
69
75
  });
@@ -12,7 +12,6 @@ var _yada = _interopRequireDefault(require("@bedrockio/yada"));
12
12
  var _lodash = require("lodash");
13
13
  var _access = require("./access");
14
14
  var _errors = require("./errors");
15
- var _include = require("./include");
16
15
  var _search = require("./search");
17
16
  var _softDelete = require("./soft-delete");
18
17
  var _utils = require("./utils");
@@ -63,7 +62,7 @@ function applyValidation(schema, definition) {
63
62
  stripEmpty: true,
64
63
  applyUnique: true,
65
64
  stripDeleted: true,
66
- allowInclude: false,
65
+ allowIncludes: false,
67
66
  stripTimestamps: true,
68
67
  allowDefaultTags: true,
69
68
  allowExpandedRefs: true,
@@ -80,7 +79,7 @@ function applyValidation(schema, definition) {
80
79
  stripUnknown: true,
81
80
  stripDeleted: true,
82
81
  allowFlatKeys: true,
83
- allowInclude: true,
82
+ allowIncludes: false,
84
83
  stripTimestamps: true,
85
84
  allowExpandedRefs: true,
86
85
  requireWriteAccess: true,
@@ -101,9 +100,9 @@ function applyValidation(schema, definition) {
101
100
  stripEmpty: true,
102
101
  allowSearch: true,
103
102
  skipRequired: true,
104
- allowInclude: true,
105
103
  stripDeleted: true,
106
104
  allowFlatKeys: true,
105
+ allowIncludes: true,
107
106
  unwindArrayFields: true,
108
107
  requireReadAccess: true,
109
108
  ...rest
@@ -128,7 +127,7 @@ function applyValidation(schema, definition) {
128
127
  });
129
128
  });
130
129
  schema.static('getIncludeValidation', function getIncludeValidation() {
131
- return _include.INCLUDE_FIELD_SCHEMA;
130
+ return _validationSchemas.INCLUDE_FIELD_SCHEMA;
132
131
  });
133
132
  schema.static('getBaseSchema', function getBaseSchema() {
134
133
  return getSchemaForMongoose(schema, {
@@ -163,12 +162,12 @@ function getMongooseFields(schema, options) {
163
162
  // Exported for testing
164
163
  function getValidationSchema(attributes, options = {}) {
165
164
  const {
166
- allowInclude,
165
+ allowIncludes,
167
166
  updateAccess
168
167
  } = options;
169
168
  let schema = getObjectSchema(attributes, options);
170
- if (allowInclude) {
171
- schema = schema.append(_include.INCLUDE_FIELD_SCHEMA);
169
+ if (allowIncludes) {
170
+ schema = schema.append(_validationSchemas.INCLUDE_FIELD_SCHEMA);
172
171
  }
173
172
  if (updateAccess) {
174
173
  return validateAccess('update', schema, updateAccess, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/model",
3
- "version": "0.14.4",
3
+ "version": "0.16.0",
4
4
  "description": "Bedrock utilities for model creation.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/include.js CHANGED
@@ -1,4 +1,3 @@
1
- import yd from '@bedrockio/yada';
2
1
  import { escapeRegExp } from 'lodash';
3
2
  import mongoose from 'mongoose';
4
3
 
@@ -16,15 +15,6 @@ mongoose.Query.prototype.include = function include(arg) {
16
15
  return this;
17
16
  };
18
17
 
19
- const DESCRIPTION = 'Field to be selected or populated.';
20
-
21
- export const INCLUDE_FIELD_SCHEMA = yd.object({
22
- include: yd.allow(
23
- yd.string().description(DESCRIPTION),
24
- yd.array(yd.string().description(DESCRIPTION)),
25
- ),
26
- });
27
-
28
18
  export function applyInclude(schema) {
29
19
  // Query Includes
30
20
 
package/src/upsert.js CHANGED
@@ -1,8 +1,23 @@
1
1
  export function applyUpsert(schema) {
2
- // Note: Intentionally avoiding the findOneAndUpdate approach here
3
- // as this will prevent hooks from being run on the document. This
4
- // means however that we cannot always return a query here as the
5
- // operations are inherently different.
2
+ // Note: Avoiding the findOneAndUpdate approach here as this
3
+ // will prevent hooks from being run on the document. This
4
+ // means however that we cannot always return a query here
5
+ // as the operations are inherently different.
6
+
7
+ schema.static('upsert', async function upsert(query, fields) {
8
+ fields ||= query;
9
+
10
+ let doc = await this.findOne(query);
11
+
12
+ if (doc) {
13
+ doc.assign(fields);
14
+ await doc.save();
15
+ } else {
16
+ doc = await this.create(fields);
17
+ }
18
+
19
+ return doc;
20
+ });
6
21
 
7
22
  schema.static('findOrCreate', async function findOrCreate(query, fields) {
8
23
  fields ||= query;
@@ -100,3 +100,11 @@ A 24 character hexadecimal string representing a Mongo [ObjectId](https://bit.ly
100
100
  An object with an \`id\` field may also be passed, which will be converted into a string.
101
101
  `.trim(),
102
102
  });
103
+
104
+ export const INCLUDE_FIELD_SCHEMA = yd.object({
105
+ include: yd.allow(yd.string(), yd.array(yd.string())).tag({
106
+ 'x-schema': 'Includes',
107
+ 'x-description':
108
+ 'A `string` or `array` of fields to be selected or populated using [includes syntax](https://bit.ly/4mZwSq4).',
109
+ }),
110
+ });
package/src/validation.js CHANGED
@@ -3,10 +3,10 @@ import { get, lowerFirst, omit } from 'lodash';
3
3
 
4
4
  import { hasAccess } from './access';
5
5
  import { ImplementationError, PermissionsError } from './errors';
6
- import { INCLUDE_FIELD_SCHEMA } from './include';
7
6
  import { exportValidation, searchValidation } from './search';
8
7
  import { assertUnique } from './soft-delete';
9
8
  import { isMongooseSchema, isSchemaTypedef } from './utils';
9
+ import { INCLUDE_FIELD_SCHEMA } from './validation-schemas';
10
10
 
11
11
  import {
12
12
  DATE_RANGE_SCHEMA,
@@ -66,7 +66,7 @@ export function applyValidation(schema, definition) {
66
66
  stripEmpty: true,
67
67
  applyUnique: true,
68
68
  stripDeleted: true,
69
- allowInclude: false,
69
+ allowIncludes: false,
70
70
  stripTimestamps: true,
71
71
  allowDefaultTags: true,
72
72
  allowExpandedRefs: true,
@@ -84,7 +84,7 @@ export function applyValidation(schema, definition) {
84
84
  stripUnknown: true,
85
85
  stripDeleted: true,
86
86
  allowFlatKeys: true,
87
- allowInclude: true,
87
+ allowIncludes: false,
88
88
  stripTimestamps: true,
89
89
  allowExpandedRefs: true,
90
90
  requireWriteAccess: true,
@@ -104,9 +104,9 @@ export function applyValidation(schema, definition) {
104
104
  stripEmpty: true,
105
105
  allowSearch: true,
106
106
  skipRequired: true,
107
- allowInclude: true,
108
107
  stripDeleted: true,
109
108
  allowFlatKeys: true,
109
+ allowIncludes: true,
110
110
  unwindArrayFields: true,
111
111
  requireReadAccess: true,
112
112
  ...rest,
@@ -174,11 +174,11 @@ function getMongooseFields(schema, options) {
174
174
 
175
175
  // Exported for testing
176
176
  export function getValidationSchema(attributes, options = {}) {
177
- const { allowInclude, updateAccess } = options;
177
+ const { allowIncludes, updateAccess } = options;
178
178
 
179
179
  let schema = getObjectSchema(attributes, options);
180
180
 
181
- if (allowInclude) {
181
+ if (allowIncludes) {
182
182
  schema = schema.append(INCLUDE_FIELD_SCHEMA);
183
183
  }
184
184
 
@@ -2,65 +2,4 @@ export function applyInclude(schema: any): void;
2
2
  export function checkSelects(doc: any, ret: any): void;
3
3
  export function getParams(modelName: any, arg: any): any;
4
4
  export function getDocumentParams(doc: any, arg: any, options?: {}): any;
5
- export const INCLUDE_FIELD_SCHEMA: {
6
- setup(): void;
7
- get(path?: string | Array<string>): any;
8
- unwind(path?: string | Array<string>): any;
9
- pick(...names?: string[]): /*elided*/ any;
10
- omit(...names?: string[]): /*elided*/ any;
11
- require(...fields: string[]): /*elided*/ any;
12
- requireAll(): /*elided*/ any;
13
- requireAllWithin(): /*elided*/ any;
14
- export(): any;
15
- append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
16
- options(options?: {
17
- stripEmpty?: boolean;
18
- stripUnknown?: boolean;
19
- allowFlatKeys?: boolean;
20
- expandFlatKeys?: boolean;
21
- }): /*elided*/ any;
22
- format(name: any, fn: any): /*elided*/ any;
23
- toString(): any;
24
- assertions: any[];
25
- meta: {};
26
- required(): /*elided*/ any;
27
- default(arg: any): /*elided*/ any;
28
- custom(fn: Function): /*elided*/ any;
29
- missing(fn: Function): /*elided*/ any;
30
- strip(strip: any): /*elided*/ any;
31
- allow(...set: any[]): /*elided*/ any;
32
- reject(...set: any[]): /*elided*/ any;
33
- nullable(): /*elided*/ any;
34
- message(message: any): /*elided*/ any;
35
- tag(tags: any): /*elided*/ any;
36
- description(description: any): /*elided*/ any;
37
- validate(value: any, options?: {}): Promise<any>;
38
- clone(meta: any): /*elided*/ any;
39
- toJSON(extra?: any): any;
40
- toOpenApi(...extra: any[]): any;
41
- getAnyType(): {
42
- type: string[];
43
- };
44
- getFormat(): {
45
- format: any;
46
- };
47
- getDefault(): {
48
- default?: undefined;
49
- } | {
50
- default: any;
51
- };
52
- getNullable(): {
53
- nullable: boolean;
54
- };
55
- getEnum(): any;
56
- expandExtra(extra?: {}): {};
57
- inspect(): string;
58
- assertEnum(set: any, allow: any): /*elided*/ any;
59
- assert(type: any, fn: any): /*elided*/ any;
60
- pushAssertion(assertion: any): void;
61
- canSkipAssertion(value: any, assertion: any, options: any): any;
62
- transform(fn: any): /*elided*/ any;
63
- getSortIndex(type: any): number;
64
- runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
65
- };
66
5
  //# sourceMappingURL=include.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,yDAIC;AAaD,yEAUC;AA9ID;;;;;;;;;;;;kBAwGwB,CAAC;oBAEnB,CADL;qBAAgC,CAAC;sBACxB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAnCqD,CAAC;;;;;;;;;;;;;;;;;EAlE9D"}
1
+ {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AAiBA,gDAuEC;AAMD,uDA4BC;AAGD,yDAIC;AAaD,yEAUC"}
package/types/schema.d.ts CHANGED
@@ -28,7 +28,9 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
28
28
  id?: boolean;
29
29
  _id?: boolean;
30
30
  minimize?: boolean;
31
- optimisticConcurrency?: boolean;
31
+ optimisticConcurrency?: boolean | string[] | {
32
+ exclude: string[];
33
+ };
32
34
  pluginTags?: string[];
33
35
  read?: string;
34
36
  readConcern?: {
@@ -47,16 +49,16 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
47
49
  getters: boolean;
48
50
  versionKey: boolean;
49
51
  transform: (doc: any, ret: any, options: any) => void;
50
- } | mongoose.ToObjectOptions<any>;
52
+ } | mongoose.ToObjectOptions<any, any>;
51
53
  toObject: {
52
54
  getters: boolean;
53
55
  versionKey: boolean;
54
56
  transform: (doc: any, ret: any, options: any) => void;
55
- } | mongoose.ToObjectOptions<any>;
57
+ } | mongoose.ToObjectOptions<any, any>;
56
58
  typeKey?: string;
57
59
  validateBeforeSave?: boolean;
58
60
  validateModifiedOnly?: boolean;
59
- versionKey?: string | boolean;
61
+ versionKey?: string | false;
60
62
  selectPopulatedPaths?: boolean;
61
63
  skipVersioning?: {
62
64
  [key: string]: boolean;
@@ -64,12 +66,13 @@ export function createSchema(definition: object, options?: mongoose.SchemaOption
64
66
  storeSubdocValidationError?: boolean;
65
67
  timestamps: boolean | mongoose.SchemaTimestampsConfig;
66
68
  suppressReservedKeysWarning?: boolean;
67
- statics?: mongoose.AddThisParameter<any, mongoose.Model<any, {}, {}, {}, any, any>>;
69
+ statics?: mongoose.AddThisParameter<any, mongoose.Model<any, any, any, any, any, any>>;
68
70
  methods?: mongoose.AddThisParameter<any, any> & mongoose.AnyObject;
69
71
  query?: any;
70
72
  castNonArrays?: boolean;
71
73
  virtuals?: mongoose.SchemaOptionsVirtualsPropertyType<any, any, any>;
72
74
  overwriteModels?: boolean;
75
+ encryptionType?: "csfle" | "queryableEncryption";
73
76
  }, any, any>;
74
77
  export function normalizeAttributes(arg: any, path?: any[]): any;
75
78
  import mongoose from 'mongoose';
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa;;;;;;;YA6CQ,CAAA;WACvC,CAAD;mBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;SAiHX,CAAC;gBAA4B,CAAA;SAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aApHpD;AAED,iEAsBC;qBA9FoB,UAAU"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,yCAJW,MAAM,YACN,QAAQ,CAAC,aAAa;;;;;;;YAgDJ,CAAC;WAC1B,CAAF;mBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;SA2HlB,CAAC;gBACL,CAAC;SAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAlId;AAED,iEAsBC;qBA9FoB,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../src/upsert.js"],"names":[],"mappings":"AAAA,+CAiBC"}
1
+ {"version":3,"file":"upsert.d.ts","sourceRoot":"","sources":["../src/upsert.js"],"names":[],"mappings":"AAAA,+CAgCC"}
@@ -344,4 +344,65 @@ export const DATE_RANGE_SCHEMA: {
344
344
  runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
345
345
  };
346
346
  export const REFERENCE_SCHEMA: import("@bedrockio/yada/types/Schema").default;
347
+ export const INCLUDE_FIELD_SCHEMA: {
348
+ setup(): void;
349
+ get(path?: string | Array<string>): any;
350
+ unwind(path?: string | Array<string>): any;
351
+ pick(...names?: string[]): /*elided*/ any;
352
+ omit(...names?: string[]): /*elided*/ any;
353
+ require(...fields: string[]): /*elided*/ any;
354
+ requireAll(): /*elided*/ any;
355
+ requireAllWithin(): /*elided*/ any;
356
+ export(): any;
357
+ append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
358
+ options(options?: {
359
+ stripEmpty?: boolean;
360
+ stripUnknown?: boolean;
361
+ allowFlatKeys?: boolean;
362
+ expandFlatKeys?: boolean;
363
+ }): /*elided*/ any;
364
+ format(name: any, fn: any): /*elided*/ any;
365
+ toString(): any;
366
+ assertions: any[];
367
+ meta: {};
368
+ required(): /*elided*/ any;
369
+ default(arg: any): /*elided*/ any;
370
+ custom(fn: Function): /*elided*/ any;
371
+ missing(fn: Function): /*elided*/ any;
372
+ strip(strip: any): /*elided*/ any;
373
+ allow(...set: any[]): /*elided*/ any;
374
+ reject(...set: any[]): /*elided*/ any;
375
+ nullable(): /*elided*/ any;
376
+ message(message: any): /*elided*/ any;
377
+ tag(tags: any): /*elided*/ any;
378
+ description(description: any): /*elided*/ any;
379
+ validate(value: any, options?: {}): Promise<any>;
380
+ clone(meta: any): /*elided*/ any;
381
+ toJSON(extra?: any): any;
382
+ toOpenApi(...extra: any[]): any;
383
+ getAnyType(): {
384
+ type: string[];
385
+ };
386
+ getFormat(): {
387
+ format: any;
388
+ };
389
+ getDefault(): {
390
+ default?: undefined;
391
+ } | {
392
+ default: any;
393
+ };
394
+ getNullable(): {
395
+ nullable: boolean;
396
+ };
397
+ getEnum(): any;
398
+ expandExtra(extra?: {}): {};
399
+ inspect(): string;
400
+ assertEnum(set: any, allow: any): /*elided*/ any;
401
+ assert(type: any, fn: any): /*elided*/ any;
402
+ pushAssertion(assertion: any): void;
403
+ canSkipAssertion(value: any, assertion: any, options: any): any;
404
+ transform(fn: any): /*elided*/ any;
405
+ getSortIndex(type: any): number;
406
+ runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
407
+ };
347
408
  //# sourceMappingURL=validation-schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAwFsB,CAAC;;;;;;;;;;;;;;;;;;;EAxFmC;AAE1D;;;;;;;;;;;;;;;;eAyBwB,CAAC;;;;;;;;;;;;iBAuBjB,CAAA;kBAA4B,CAAC;kBAEjC,CAAF;oBAEI,CAAC;oBAEI,CAAC;;;wBA2BC,CAAC;8BAGI,CAAC;oBAA+B,CAAC;oBAE1C,CAAC;oCAEL,CAAC;uBAAkC,CAAC;8BAAyC,CAAC;uBACzD,CAAC;iBAA4B,CAAC;;;mBAG0V,CAAC;yBAAoC,CAAC;0BAAqC,CAAC;yBAAoC,CAAC;sBAAiC,CAAC;yBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eANpjB,CAAC;;;;;;;;;;;;;;;;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