@atscript/moost-mongo 0.1.20 → 0.1.22

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/index.cjs CHANGED
@@ -50,7 +50,7 @@ else obj[key] = value;
50
50
  }
51
51
  var QueryControlsDto = class {
52
52
  static toJsonSchema() {
53
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
53
+ (0, __atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
54
54
  }
55
55
  };
56
56
  _define_property$1(QueryControlsDto, "__is_atscript_annotated_type", true);
@@ -58,7 +58,7 @@ _define_property$1(QueryControlsDto, "type", {});
58
58
  _define_property$1(QueryControlsDto, "metadata", new Map());
59
59
  var PagesControlsDto = class {
60
60
  static toJsonSchema() {
61
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
61
+ (0, __atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
62
62
  }
63
63
  };
64
64
  _define_property$1(PagesControlsDto, "__is_atscript_annotated_type", true);
@@ -66,7 +66,7 @@ _define_property$1(PagesControlsDto, "type", {});
66
66
  _define_property$1(PagesControlsDto, "metadata", new Map());
67
67
  var GetOneControlsDto = class {
68
68
  static toJsonSchema() {
69
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
69
+ (0, __atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
70
70
  }
71
71
  };
72
72
  _define_property$1(GetOneControlsDto, "__is_atscript_annotated_type", true);
@@ -74,7 +74,7 @@ _define_property$1(GetOneControlsDto, "type", {});
74
74
  _define_property$1(GetOneControlsDto, "metadata", new Map());
75
75
  let SortControlDto = class SortControlDto$1 {
76
76
  static toJsonSchema() {
77
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
77
+ (0, __atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
78
78
  }
79
79
  };
80
80
  _define_property$1(SortControlDto, "__is_atscript_annotated_type", true);
@@ -82,7 +82,7 @@ _define_property$1(SortControlDto, "type", {});
82
82
  _define_property$1(SortControlDto, "metadata", new Map());
83
83
  let SelectControlDto = class SelectControlDto$1 {
84
84
  static toJsonSchema() {
85
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
85
+ (0, __atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
86
86
  }
87
87
  };
88
88
  _define_property$1(SelectControlDto, "__is_atscript_annotated_type", true);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsMongo, AsCollection } from '@atscript/mongo';
2
- import { TAtscriptAnnotatedType, Validator, ValidatorError } from '@atscript/typescript/utils';
2
+ import { TAtscriptAnnotatedType, TAtscriptDataType, Validator, ValidatorError } from '@atscript/typescript/utils';
3
3
  import { HttpError } from '@moostjs/event-http';
4
4
  import { Document, Filter, WithId, InsertOneResult, InsertManyResult, UpdateResult, DeleteResult, DeleteOptions, ObjectId, InsertOneOptions, BulkWriteOptions, ReplaceOptions, UpdateFilter, UpdateOptions } from 'mongodb';
5
5
  import { TConsoleBase, Moost } from 'moost';
@@ -23,11 +23,7 @@ import { UrlqlQuery } from 'urlql';
23
23
  * @typeParam T - The **atscript** annotated class (constructor) representing the
24
24
  * collection schema. Must be decorated with `@AsCollection`.
25
25
  */
26
- declare class AsMongoController<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType, DataType = T extends {
27
- type: {
28
- __dataType?: infer D;
29
- };
30
- } ? unknown extends D ? T extends new (...args: any[]) => infer I ? I : unknown : D : unknown> {
26
+ declare class AsMongoController<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedType, DataType = TAtscriptDataType<T>> {
31
27
  protected asMongo: AsMongo;
32
28
  protected type: T;
33
29
  /** Reference to the lazily created {@link AsCollection}. */
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidatorError, defineAnnotatedType } from "@atscript/typescript/utils";
1
+ import { ValidatorError, defineAnnotatedType, throwFeatureDisabled } from "@atscript/typescript/utils";
2
2
  import { Body, Delete, Get, HttpError, Patch, Post, Put, Url } from "@moostjs/event-http";
3
3
  import { ApplyDecorators, Controller, Inherit, Inject, Param, Provide, Resolve } from "moost";
4
4
  import { parseUrlql } from "urlql";
@@ -26,7 +26,7 @@ else obj[key] = value;
26
26
  }
27
27
  var QueryControlsDto = class {
28
28
  static toJsonSchema() {
29
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
29
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
30
30
  }
31
31
  };
32
32
  _define_property$1(QueryControlsDto, "__is_atscript_annotated_type", true);
@@ -34,7 +34,7 @@ _define_property$1(QueryControlsDto, "type", {});
34
34
  _define_property$1(QueryControlsDto, "metadata", new Map());
35
35
  var PagesControlsDto = class {
36
36
  static toJsonSchema() {
37
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
37
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
38
38
  }
39
39
  };
40
40
  _define_property$1(PagesControlsDto, "__is_atscript_annotated_type", true);
@@ -42,7 +42,7 @@ _define_property$1(PagesControlsDto, "type", {});
42
42
  _define_property$1(PagesControlsDto, "metadata", new Map());
43
43
  var GetOneControlsDto = class {
44
44
  static toJsonSchema() {
45
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
45
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
46
46
  }
47
47
  };
48
48
  _define_property$1(GetOneControlsDto, "__is_atscript_annotated_type", true);
@@ -50,7 +50,7 @@ _define_property$1(GetOneControlsDto, "type", {});
50
50
  _define_property$1(GetOneControlsDto, "metadata", new Map());
51
51
  let SortControlDto = class SortControlDto$1 {
52
52
  static toJsonSchema() {
53
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
53
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
54
54
  }
55
55
  };
56
56
  _define_property$1(SortControlDto, "__is_atscript_annotated_type", true);
@@ -58,7 +58,7 @@ _define_property$1(SortControlDto, "type", {});
58
58
  _define_property$1(SortControlDto, "metadata", new Map());
59
59
  let SelectControlDto = class SelectControlDto$1 {
60
60
  static toJsonSchema() {
61
- throw new Error("JSON Schema support is disabled. To enable, set `jsonSchema: 'lazy'` or `jsonSchema: 'bundle'` in tsPlugin options, or add @emit.jsonSchema annotation to individual interfaces.");
61
+ throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
62
62
  }
63
63
  };
64
64
  _define_property$1(SelectControlDto, "__is_atscript_annotated_type", true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/moost-mongo",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Atscript Mongo for Moost.",
5
5
  "keywords": [
6
6
  "annotations",
@@ -39,14 +39,14 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "vitest": "3.2.4",
42
- "@atscript/core": "^0.1.20"
42
+ "@atscript/core": "^0.1.22"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@moostjs/event-http": "^0.5.32",
46
46
  "mongodb": "^6.17.0",
47
47
  "moost": "^0.5.32",
48
- "@atscript/typescript": "^0.1.20",
49
- "@atscript/mongo": "^0.1.20"
48
+ "@atscript/mongo": "^0.1.22",
49
+ "@atscript/typescript": "^0.1.22"
50
50
  },
51
51
  "scripts": {
52
52
  "pub": "pnpm publish --access public",