@orion-js/typed-model 3.3.14 → 3.3.20

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.
@@ -1,3 +1,4 @@
1
+ import { Model } from '@orion-js/models';
1
2
  import { CloneOptions } from '@orion-js/models';
2
3
  import { Constructor } from '../utils/interfaces';
3
4
  export interface CloneSchemaClassOptions<TClass, TFields extends keyof TClass> {
@@ -10,9 +11,13 @@ export interface CloneSchemaClassOptions<TClass, TFields extends keyof TClass> {
10
11
  * This function returns a cloned model but the type is a subset of the original Schema.
11
12
  * It will work as a Model but the type will not be the Type of the Model.
12
13
  *
13
- * You can use the return variable as a Model and you `typeof returnType` will be the class
14
- * for type checking.
15
- *
16
- * Remember that in runtime this will be a Model and not the class.
14
+ * Example:
15
+ * ```ts
16
+ * const ClonedModel = cloneSchemaClass(Schema, {
17
+ * name: 'ClonedSchema',
18
+ * pickFields: ['name'] as const
19
+ * })
20
+ * type ClonedType = typeof ClonedModel.type
21
+ * ```
17
22
  */
18
- export declare function cloneSchemaClass<TClass, TFields extends keyof TClass>(schema: Constructor<TClass>, options: CloneSchemaClassOptions<TClass, TFields>): Pick<TClass, TFields>;
23
+ export declare function cloneSchemaClass<TClass, TFields extends keyof TClass>(schema: Constructor<TClass>, options: CloneSchemaClassOptions<TClass, TFields>): Model<Pick<TClass, TFields>>;
@@ -6,10 +6,14 @@ const getModelForClass_1 = require("./getModelForClass");
6
6
  * This function returns a cloned model but the type is a subset of the original Schema.
7
7
  * It will work as a Model but the type will not be the Type of the Model.
8
8
  *
9
- * You can use the return variable as a Model and you `typeof returnType` will be the class
10
- * for type checking.
11
- *
12
- * Remember that in runtime this will be a Model and not the class.
9
+ * Example:
10
+ * ```ts
11
+ * const ClonedModel = cloneSchemaClass(Schema, {
12
+ * name: 'ClonedSchema',
13
+ * pickFields: ['name'] as const
14
+ * })
15
+ * type ClonedType = typeof ClonedModel.type
16
+ * ```
13
17
  */
14
18
  function cloneSchemaClass(schema, options) {
15
19
  const model = (0, getModelForClass_1.getModelForClass)(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/typed-model",
3
- "version": "3.3.14",
3
+ "version": "3.3.20",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [
@@ -17,11 +17,11 @@
17
17
  "test": "jest --config jest.config.js"
18
18
  },
19
19
  "dependencies": {
20
- "@orion-js/helpers": "^3.3.6",
21
- "@orion-js/models": "^3.3.14",
22
- "@orion-js/resolvers": "^3.3.14",
23
- "@orion-js/schema": "^3.3.14",
24
- "@orion-js/services": "^3.3.6",
20
+ "@orion-js/helpers": "^3.3.20",
21
+ "@orion-js/models": "^3.3.20",
22
+ "@orion-js/resolvers": "^3.3.20",
23
+ "@orion-js/schema": "^3.3.20",
24
+ "@orion-js/services": "^3.3.20",
25
25
  "lodash": "^4.17.21",
26
26
  "reflect-metadata": "0.1.13"
27
27
  },
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "52d669169a12e27c602733c32bf19fdb390f971a"
44
+ "gitHead": "fc4d8447758abffb74834f58443e7489cee3a454"
45
45
  }