@atscript/typescript 0.1.13 → 0.1.14

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/cli.cjs CHANGED
@@ -750,6 +750,14 @@ else {
750
750
  }
751
751
  }
752
752
  validateString(def, value) {
753
+ const filled = def.metadata.get("expect.filled");
754
+ if (filled) {
755
+ if (value.trim().length === 0) {
756
+ const message = typeof filled === "object" && filled.message ? filled.message : `Must not be empty`;
757
+ this.error(message);
758
+ return false;
759
+ }
760
+ }
753
761
  const minLength = def.metadata.get("expect.minLength");
754
762
  if (minLength) {
755
763
  const length = typeof minLength === "number" ? minLength : minLength.length;
@@ -1017,6 +1025,7 @@ function buildJsonSchema(type) {
1017
1025
  if (schema.type === "number" && meta.get("expect.int")) schema.type = "integer";
1018
1026
  }
1019
1027
  if (schema.type === "string") {
1028
+ if (meta.get("expect.filled")) schema.minLength = 1;
1020
1029
  const minLength = meta.get("expect.minLength");
1021
1030
  if (minLength) schema.minLength = typeof minLength === "number" ? minLength : minLength.length;
1022
1031
  const maxLength = meta.get("expect.maxLength");
package/dist/index.cjs CHANGED
@@ -747,6 +747,14 @@ else {
747
747
  }
748
748
  }
749
749
  validateString(def, value) {
750
+ const filled = def.metadata.get("expect.filled");
751
+ if (filled) {
752
+ if (value.trim().length === 0) {
753
+ const message = typeof filled === "object" && filled.message ? filled.message : `Must not be empty`;
754
+ this.error(message);
755
+ return false;
756
+ }
757
+ }
750
758
  const minLength = def.metadata.get("expect.minLength");
751
759
  if (minLength) {
752
760
  const length = typeof minLength === "number" ? minLength : minLength.length;
@@ -1014,6 +1022,7 @@ function buildJsonSchema(type) {
1014
1022
  if (schema.type === "number" && meta.get("expect.int")) schema.type = "integer";
1015
1023
  }
1016
1024
  if (schema.type === "string") {
1025
+ if (meta.get("expect.filled")) schema.minLength = 1;
1017
1026
  const minLength = meta.get("expect.minLength");
1018
1027
  if (minLength) schema.minLength = typeof minLength === "number" ? minLength : minLength.length;
1019
1028
  const maxLength = meta.get("expect.maxLength");
package/dist/index.mjs CHANGED
@@ -723,6 +723,14 @@ else {
723
723
  }
724
724
  }
725
725
  validateString(def, value) {
726
+ const filled = def.metadata.get("expect.filled");
727
+ if (filled) {
728
+ if (value.trim().length === 0) {
729
+ const message = typeof filled === "object" && filled.message ? filled.message : `Must not be empty`;
730
+ this.error(message);
731
+ return false;
732
+ }
733
+ }
726
734
  const minLength = def.metadata.get("expect.minLength");
727
735
  if (minLength) {
728
736
  const length = typeof minLength === "number" ? minLength : minLength.length;
@@ -990,6 +998,7 @@ function buildJsonSchema(type) {
990
998
  if (schema.type === "number" && meta.get("expect.int")) schema.type = "integer";
991
999
  }
992
1000
  if (schema.type === "string") {
1001
+ if (meta.get("expect.filled")) schema.minLength = 1;
993
1002
  const minLength = meta.get("expect.minLength");
994
1003
  if (minLength) schema.minLength = typeof minLength === "number" ? minLength : minLength.length;
995
1004
  const maxLength = meta.get("expect.maxLength");
package/dist/utils.cjs CHANGED
@@ -302,6 +302,14 @@ else {
302
302
  }
303
303
  }
304
304
  validateString(def, value) {
305
+ const filled = def.metadata.get("expect.filled");
306
+ if (filled) {
307
+ if (value.trim().length === 0) {
308
+ const message = typeof filled === "object" && filled.message ? filled.message : `Must not be empty`;
309
+ this.error(message);
310
+ return false;
311
+ }
312
+ }
305
313
  const minLength = def.metadata.get("expect.minLength");
306
314
  if (minLength) {
307
315
  const length = typeof minLength === "number" ? minLength : minLength.length;
@@ -582,6 +590,7 @@ function buildJsonSchema(type) {
582
590
  if (schema.type === "number" && meta.get("expect.int")) schema.type = "integer";
583
591
  }
584
592
  if (schema.type === "string") {
593
+ if (meta.get("expect.filled")) schema.minLength = 1;
585
594
  const minLength = meta.get("expect.minLength");
586
595
  if (minLength) schema.minLength = typeof minLength === "number" ? minLength : minLength.length;
587
596
  const maxLength = meta.get("expect.maxLength");
package/dist/utils.mjs CHANGED
@@ -301,6 +301,14 @@ else {
301
301
  }
302
302
  }
303
303
  validateString(def, value) {
304
+ const filled = def.metadata.get("expect.filled");
305
+ if (filled) {
306
+ if (value.trim().length === 0) {
307
+ const message = typeof filled === "object" && filled.message ? filled.message : `Must not be empty`;
308
+ this.error(message);
309
+ return false;
310
+ }
311
+ }
304
312
  const minLength = def.metadata.get("expect.minLength");
305
313
  if (minLength) {
306
314
  const length = typeof minLength === "number" ? minLength : minLength.length;
@@ -581,6 +589,7 @@ function buildJsonSchema(type) {
581
589
  if (schema.type === "number" && meta.get("expect.int")) schema.type = "integer";
582
590
  }
583
591
  if (schema.type === "string") {
592
+ if (meta.get("expect.filled")) schema.minLength = 1;
584
593
  const minLength = meta.get("expect.minLength");
585
594
  if (minLength) schema.minLength = typeof minLength === "number" ? minLength : minLength.length;
586
595
  const maxLength = meta.get("expect.maxLength");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/typescript",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Atscript: typescript-gen support.",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -70,7 +70,7 @@
70
70
  "homepage": "https://github.com/moostjs/atscript/tree/main/packages/typescript#readme",
71
71
  "license": "ISC",
72
72
  "peerDependencies": {
73
- "@atscript/core": "^0.1.13"
73
+ "@atscript/core": "^0.1.14"
74
74
  },
75
75
  "dependencies": {
76
76
  "@moostjs/event-cli": "^0.5.32",