@atscript/moost-mongo 0.0.26 → 0.0.28

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
@@ -39,26 +39,51 @@ function _define_property$1(obj, key, value) {
39
39
  else obj[key] = value;
40
40
  return obj;
41
41
  }
42
- var QueryControlsDto = class {};
42
+ var QueryControlsDto = class {
43
+ static toJsonSchema() {
44
+ return this._jsonSchema ?? (this._jsonSchema = (0, __atscript_typescript.buildJsonSchema)(this));
45
+ }
46
+ };
43
47
  _define_property$1(QueryControlsDto, "__is_atscript_annotated_type", true);
44
48
  _define_property$1(QueryControlsDto, "type", {});
45
49
  _define_property$1(QueryControlsDto, "metadata", new Map());
46
- var PagesControlsDto = class {};
50
+ _define_property$1(QueryControlsDto, "_jsonSchema", void 0);
51
+ var PagesControlsDto = class {
52
+ static toJsonSchema() {
53
+ return this._jsonSchema ?? (this._jsonSchema = (0, __atscript_typescript.buildJsonSchema)(this));
54
+ }
55
+ };
47
56
  _define_property$1(PagesControlsDto, "__is_atscript_annotated_type", true);
48
57
  _define_property$1(PagesControlsDto, "type", {});
49
58
  _define_property$1(PagesControlsDto, "metadata", new Map());
50
- var GetOneControlsDto = class {};
59
+ _define_property$1(PagesControlsDto, "_jsonSchema", void 0);
60
+ var GetOneControlsDto = class {
61
+ static toJsonSchema() {
62
+ return this._jsonSchema ?? (this._jsonSchema = (0, __atscript_typescript.buildJsonSchema)(this));
63
+ }
64
+ };
51
65
  _define_property$1(GetOneControlsDto, "__is_atscript_annotated_type", true);
52
66
  _define_property$1(GetOneControlsDto, "type", {});
53
67
  _define_property$1(GetOneControlsDto, "metadata", new Map());
54
- let SortControlDto = class SortControlDto$1 {};
68
+ _define_property$1(GetOneControlsDto, "_jsonSchema", void 0);
69
+ let SortControlDto = class SortControlDto$1 {
70
+ static toJsonSchema() {
71
+ return this._jsonSchema ?? (this._jsonSchema = (0, __atscript_typescript.buildJsonSchema)(this));
72
+ }
73
+ };
55
74
  _define_property$1(SortControlDto, "__is_atscript_annotated_type", true);
56
75
  _define_property$1(SortControlDto, "type", {});
57
76
  _define_property$1(SortControlDto, "metadata", new Map());
58
- let SelectControlDto = class SelectControlDto$1 {};
77
+ _define_property$1(SortControlDto, "_jsonSchema", void 0);
78
+ let SelectControlDto = class SelectControlDto$1 {
79
+ static toJsonSchema() {
80
+ return this._jsonSchema ?? (this._jsonSchema = (0, __atscript_typescript.buildJsonSchema)(this));
81
+ }
82
+ };
59
83
  _define_property$1(SelectControlDto, "__is_atscript_annotated_type", true);
60
84
  _define_property$1(SelectControlDto, "type", {});
61
85
  _define_property$1(SelectControlDto, "metadata", new Map());
86
+ _define_property$1(SelectControlDto, "_jsonSchema", void 0);
62
87
  (0, __atscript_typescript.defineAnnotatedType)("object", QueryControlsDto).prop("$skip", (0, __atscript_typescript.defineAnnotatedType)().designType("number").tags("positive", "int", "number").annotate("expect.min", 0).annotate("expect.int", true).optional().$type).prop("$limit", (0, __atscript_typescript.defineAnnotatedType)().designType("number").tags("positive", "int", "number").annotate("expect.min", 0).annotate("expect.int", true).optional().$type).prop("$count", (0, __atscript_typescript.defineAnnotatedType)().designType("boolean").tags("boolean").optional().$type).prop("$sort", (0, __atscript_typescript.defineAnnotatedType)().refTo(SortControlDto).optional().$type).prop("$select", (0, __atscript_typescript.defineAnnotatedType)().refTo(SelectControlDto).optional().$type).prop("$search", (0, __atscript_typescript.defineAnnotatedType)().designType("string").tags("string").optional().$type).prop("$index", (0, __atscript_typescript.defineAnnotatedType)().designType("string").tags("string").optional().$type);
63
88
  (0, __atscript_typescript.defineAnnotatedType)("object", PagesControlsDto).prop("$page", (0, __atscript_typescript.defineAnnotatedType)().designType("string").tags("string").annotate("expect.pattern", {
64
89
  pattern: "^\\d+$",
@@ -296,7 +321,7 @@ else pipeline.push({ $limit: 1e3 });
296
321
  const parsed = (0, urlql.parseUrlql)(query);
297
322
  const error = await this.validateUrlql(parsed, "pages");
298
323
  if (error) return error;
299
- const search = this.prepareSearch(parsed.controls.$search, parsed.controls.$index);
324
+ const search = await this.prepareSearch(parsed.controls.$search, parsed.controls.$index);
300
325
  if (typeof search === "string") return new __moostjs_event_http.HttpError(400, search);
301
326
  const controls = parsed.controls;
302
327
  const page = Math.max(Number(controls.$page || 1), 1);
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Body, Delete, Get, HttpError, Patch, Post, Put, Url } from "@moostjs/event-http";
2
2
  import { ApplyDecorators, Controller, Inherit, Inject, Moost, Param, Provide, Resolve } from "moost";
3
3
  import { parseUrlql } from "urlql";
4
- import { ValidatorError, defineAnnotatedType } from "@atscript/typescript";
4
+ import { ValidatorError, buildJsonSchema, defineAnnotatedType } from "@atscript/typescript";
5
5
  import { AsMongo } from "@atscript/mongo";
6
6
 
7
7
  //#region packages/moost-mongo/src/dto/controls.dto.as.js
@@ -15,26 +15,51 @@ function _define_property$1(obj, key, value) {
15
15
  else obj[key] = value;
16
16
  return obj;
17
17
  }
18
- var QueryControlsDto = class {};
18
+ var QueryControlsDto = class {
19
+ static toJsonSchema() {
20
+ return this._jsonSchema ?? (this._jsonSchema = buildJsonSchema(this));
21
+ }
22
+ };
19
23
  _define_property$1(QueryControlsDto, "__is_atscript_annotated_type", true);
20
24
  _define_property$1(QueryControlsDto, "type", {});
21
25
  _define_property$1(QueryControlsDto, "metadata", new Map());
22
- var PagesControlsDto = class {};
26
+ _define_property$1(QueryControlsDto, "_jsonSchema", void 0);
27
+ var PagesControlsDto = class {
28
+ static toJsonSchema() {
29
+ return this._jsonSchema ?? (this._jsonSchema = buildJsonSchema(this));
30
+ }
31
+ };
23
32
  _define_property$1(PagesControlsDto, "__is_atscript_annotated_type", true);
24
33
  _define_property$1(PagesControlsDto, "type", {});
25
34
  _define_property$1(PagesControlsDto, "metadata", new Map());
26
- var GetOneControlsDto = class {};
35
+ _define_property$1(PagesControlsDto, "_jsonSchema", void 0);
36
+ var GetOneControlsDto = class {
37
+ static toJsonSchema() {
38
+ return this._jsonSchema ?? (this._jsonSchema = buildJsonSchema(this));
39
+ }
40
+ };
27
41
  _define_property$1(GetOneControlsDto, "__is_atscript_annotated_type", true);
28
42
  _define_property$1(GetOneControlsDto, "type", {});
29
43
  _define_property$1(GetOneControlsDto, "metadata", new Map());
30
- let SortControlDto = class SortControlDto$1 {};
44
+ _define_property$1(GetOneControlsDto, "_jsonSchema", void 0);
45
+ let SortControlDto = class SortControlDto$1 {
46
+ static toJsonSchema() {
47
+ return this._jsonSchema ?? (this._jsonSchema = buildJsonSchema(this));
48
+ }
49
+ };
31
50
  _define_property$1(SortControlDto, "__is_atscript_annotated_type", true);
32
51
  _define_property$1(SortControlDto, "type", {});
33
52
  _define_property$1(SortControlDto, "metadata", new Map());
34
- let SelectControlDto = class SelectControlDto$1 {};
53
+ _define_property$1(SortControlDto, "_jsonSchema", void 0);
54
+ let SelectControlDto = class SelectControlDto$1 {
55
+ static toJsonSchema() {
56
+ return this._jsonSchema ?? (this._jsonSchema = buildJsonSchema(this));
57
+ }
58
+ };
35
59
  _define_property$1(SelectControlDto, "__is_atscript_annotated_type", true);
36
60
  _define_property$1(SelectControlDto, "type", {});
37
61
  _define_property$1(SelectControlDto, "metadata", new Map());
62
+ _define_property$1(SelectControlDto, "_jsonSchema", void 0);
38
63
  defineAnnotatedType("object", QueryControlsDto).prop("$skip", defineAnnotatedType().designType("number").tags("positive", "int", "number").annotate("expect.min", 0).annotate("expect.int", true).optional().$type).prop("$limit", defineAnnotatedType().designType("number").tags("positive", "int", "number").annotate("expect.min", 0).annotate("expect.int", true).optional().$type).prop("$count", defineAnnotatedType().designType("boolean").tags("boolean").optional().$type).prop("$sort", defineAnnotatedType().refTo(SortControlDto).optional().$type).prop("$select", defineAnnotatedType().refTo(SelectControlDto).optional().$type).prop("$search", defineAnnotatedType().designType("string").tags("string").optional().$type).prop("$index", defineAnnotatedType().designType("string").tags("string").optional().$type);
39
64
  defineAnnotatedType("object", PagesControlsDto).prop("$page", defineAnnotatedType().designType("string").tags("string").annotate("expect.pattern", {
40
65
  pattern: "^\\d+$",
@@ -272,7 +297,7 @@ else pipeline.push({ $limit: 1e3 });
272
297
  const parsed = parseUrlql(query);
273
298
  const error = await this.validateUrlql(parsed, "pages");
274
299
  if (error) return error;
275
- const search = this.prepareSearch(parsed.controls.$search, parsed.controls.$index);
300
+ const search = await this.prepareSearch(parsed.controls.$search, parsed.controls.$index);
276
301
  if (typeof search === "string") return new HttpError(400, search);
277
302
  const controls = parsed.controls;
278
303
  const page = Math.max(Number(controls.$page || 1), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/moost-mongo",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Atscript Mongo for Moost.",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -44,8 +44,8 @@
44
44
  "@moostjs/event-http": "^0.5.32",
45
45
  "mongodb": "^6.17.0",
46
46
  "moost": "^0.5.32",
47
- "@atscript/mongo": "^0.0.26",
48
- "@atscript/typescript": "^0.0.26"
47
+ "@atscript/mongo": "^0.0.28",
48
+ "@atscript/typescript": "^0.0.28"
49
49
  },
50
50
  "scripts": {
51
51
  "pub": "pnpm publish --access public",