@player-ui/common-types-plugin 0.15.1 → 0.15.2-next.1

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.
Files changed (37) hide show
  1. package/dist/CommonTypesPlugin.native.js +2 -2
  2. package/dist/CommonTypesPlugin.native.js.map +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/xlr/DataTypes.BooleanType.json +72 -0
  6. package/dist/xlr/DataTypes.CollectionType.json +39 -0
  7. package/dist/xlr/DataTypes.DateType.json +55 -0
  8. package/dist/xlr/DataTypes.IntegerNNType.json +75 -0
  9. package/dist/xlr/DataTypes.IntegerPosType.json +75 -0
  10. package/dist/xlr/DataTypes.IntegerType.json +55 -0
  11. package/dist/xlr/DataTypes.PhoneType.json +55 -0
  12. package/dist/xlr/DataTypes.StringType.json +62 -0
  13. package/dist/xlr/Formatters.commaNumber.json +28 -0
  14. package/dist/xlr/Formatters.currency.json +44 -0
  15. package/dist/xlr/Formatters.date.json +28 -0
  16. package/dist/xlr/Formatters.integer.json +14 -0
  17. package/dist/xlr/Formatters.phone.json +11 -0
  18. package/dist/xlr/Validators.collection.json +6 -0
  19. package/dist/xlr/Validators.email.json +6 -0
  20. package/dist/xlr/Validators.expression.json +23 -0
  21. package/dist/xlr/Validators.integer.json +6 -0
  22. package/dist/xlr/Validators.length.json +49 -0
  23. package/dist/xlr/Validators.max.json +22 -0
  24. package/dist/xlr/Validators.min.json +22 -0
  25. package/dist/xlr/Validators.oneOf.json +25 -0
  26. package/dist/xlr/Validators.phone.json +6 -0
  27. package/dist/xlr/Validators.readonly.json +6 -0
  28. package/dist/xlr/Validators.regex.json +22 -0
  29. package/dist/xlr/Validators.required.json +32 -0
  30. package/dist/xlr/Validators.string.json +6 -0
  31. package/dist/xlr/Validators.zip.json +6 -0
  32. package/dist/xlr/manifest.js +42 -0
  33. package/dist/xlr/manifest.json +51 -0
  34. package/package.json +6 -4
  35. package/src/index.ts +44 -2
  36. package/src/validators/index.ts +3 -3
  37. package/types/index.d.ts +24 -1
@@ -0,0 +1,25 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "oneOf",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction<{\n /** The enum values that are acceptable */\n options: Array<unknown>;\n}>",
6
+ "genericArguments": [
7
+ {
8
+ "type": "object",
9
+ "properties": {
10
+ "options": {
11
+ "required": true,
12
+ "node": {
13
+ "type": "array",
14
+ "elementType": {
15
+ "type": "unknown"
16
+ },
17
+ "title": "options",
18
+ "description": "The enum values that are acceptable"
19
+ }
20
+ }
21
+ },
22
+ "additionalProperties": false
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "phone",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "readonly",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction"
6
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "regex",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction<{\n /**\n * The regular expression to test: /pattern/\n * Can optionally include flags after the pattern: /pattern/flags\n */\n regex: string;\n}>",
6
+ "genericArguments": [
7
+ {
8
+ "type": "object",
9
+ "properties": {
10
+ "regex": {
11
+ "required": true,
12
+ "node": {
13
+ "type": "string",
14
+ "title": "regex",
15
+ "description": "The regular expression to test: /pattern/\nCan optionally include flags after the pattern: /pattern/flags"
16
+ }
17
+ }
18
+ },
19
+ "additionalProperties": false
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "required",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction<{\n /** An optional expression to limit the required check only if true */\n if?: Expression;\n\n /** An optional expression to limit the required check only if false */\n ifNot?: Expression;\n}>",
6
+ "genericArguments": [
7
+ {
8
+ "type": "object",
9
+ "properties": {
10
+ "if": {
11
+ "required": false,
12
+ "node": {
13
+ "type": "ref",
14
+ "ref": "Expression",
15
+ "title": "if",
16
+ "description": "An optional expression to limit the required check only if true"
17
+ }
18
+ },
19
+ "ifNot": {
20
+ "required": false,
21
+ "node": {
22
+ "type": "ref",
23
+ "ref": "Expression",
24
+ "title": "ifNot",
25
+ "description": "An optional expression to limit the required check only if false"
26
+ }
27
+ }
28
+ },
29
+ "additionalProperties": false
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "string",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2577/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/common-types/core/src/validators/index.ts",
3
+ "name": "zip",
4
+ "type": "ref",
5
+ "ref": "ValidatorFunction"
6
+ }
@@ -0,0 +1,42 @@
1
+ const DataTypes_BooleanType = require("./DataTypes.BooleanType.json")
2
+ const DataTypes_IntegerType = require("./DataTypes.IntegerType.json")
3
+ const DataTypes_IntegerPosType = require("./DataTypes.IntegerPosType.json")
4
+ const DataTypes_IntegerNNType = require("./DataTypes.IntegerNNType.json")
5
+ const DataTypes_StringType = require("./DataTypes.StringType.json")
6
+ const DataTypes_CollectionType = require("./DataTypes.CollectionType.json")
7
+ const DataTypes_DateType = require("./DataTypes.DateType.json")
8
+ const DataTypes_PhoneType = require("./DataTypes.PhoneType.json")
9
+ const Formatters_commaNumber = require("./Formatters.commaNumber.json")
10
+ const Formatters_currency = require("./Formatters.currency.json")
11
+ const Formatters_date = require("./Formatters.date.json")
12
+ const Formatters_integer = require("./Formatters.integer.json")
13
+ const Formatters_phone = require("./Formatters.phone.json")
14
+ const Validators_collection = require("./Validators.collection.json")
15
+ const Validators_email = require("./Validators.email.json")
16
+ const Validators_expression = require("./Validators.expression.json")
17
+ const Validators_integer = require("./Validators.integer.json")
18
+ const Validators_length = require("./Validators.length.json")
19
+ const Validators_max = require("./Validators.max.json")
20
+ const Validators_min = require("./Validators.min.json")
21
+ const Validators_oneOf = require("./Validators.oneOf.json")
22
+ const Validators_phone = require("./Validators.phone.json")
23
+ const Validators_readonly = require("./Validators.readonly.json")
24
+ const Validators_regex = require("./Validators.regex.json")
25
+ const Validators_required = require("./Validators.required.json")
26
+ const Validators_string = require("./Validators.string.json")
27
+ const Validators_zip = require("./Validators.zip.json")
28
+
29
+ module.exports = {
30
+ "pluginName": "CommonTypes",
31
+ "capabilities": {
32
+ "Assets":[],
33
+ "Views":[],
34
+ "Expressions":[],
35
+ "DataTypes":[DataTypes_BooleanType,DataTypes_IntegerType,DataTypes_IntegerPosType,DataTypes_IntegerNNType,DataTypes_StringType,DataTypes_CollectionType,DataTypes_DateType,DataTypes_PhoneType],
36
+ "Formatters":[Formatters_commaNumber,Formatters_currency,Formatters_date,Formatters_integer,Formatters_phone],
37
+ "Validators":[Validators_collection,Validators_email,Validators_expression,Validators_integer,Validators_length,Validators_max,Validators_min,Validators_oneOf,Validators_phone,Validators_readonly,Validators_regex,Validators_required,Validators_string,Validators_zip],
38
+ },
39
+ "customPrimitives": [
40
+ "Expression","Asset","Binding","AssetWrapper","Schema.DataType","ExpressionHandler","FormatType","ValidatorFunction"
41
+ ]
42
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "pluginName": "CommonTypes",
3
+ "capabilities": {
4
+ "Assets": [],
5
+ "Views": [],
6
+ "Expressions": [],
7
+ "DataTypes": [
8
+ "DataTypes.BooleanType",
9
+ "DataTypes.IntegerType",
10
+ "DataTypes.IntegerPosType",
11
+ "DataTypes.IntegerNNType",
12
+ "DataTypes.StringType",
13
+ "DataTypes.CollectionType",
14
+ "DataTypes.DateType",
15
+ "DataTypes.PhoneType"
16
+ ],
17
+ "Formatters": [
18
+ "Formatters.commaNumber",
19
+ "Formatters.currency",
20
+ "Formatters.date",
21
+ "Formatters.integer",
22
+ "Formatters.phone"
23
+ ],
24
+ "Validators": [
25
+ "Validators.collection",
26
+ "Validators.email",
27
+ "Validators.expression",
28
+ "Validators.integer",
29
+ "Validators.length",
30
+ "Validators.max",
31
+ "Validators.min",
32
+ "Validators.oneOf",
33
+ "Validators.phone",
34
+ "Validators.readonly",
35
+ "Validators.regex",
36
+ "Validators.required",
37
+ "Validators.string",
38
+ "Validators.zip"
39
+ ]
40
+ },
41
+ "customPrimitives": [
42
+ "Expression",
43
+ "Asset",
44
+ "Binding",
45
+ "AssetWrapper",
46
+ "Schema.DataType",
47
+ "ExpressionHandler",
48
+ "FormatType",
49
+ "ValidatorFunction"
50
+ ]
51
+ }
package/package.json CHANGED
@@ -6,14 +6,14 @@
6
6
  "types"
7
7
  ],
8
8
  "name": "@player-ui/common-types-plugin",
9
- "version": "0.15.1",
9
+ "version": "0.15.2-next.1",
10
10
  "main": "dist/cjs/index.cjs",
11
11
  "dependencies": {
12
- "@player-ui/types-provider-plugin": "0.15.1",
12
+ "@player-ui/types-provider-plugin": "0.15.2-next.1",
13
13
  "tslib": "^2.6.2"
14
14
  },
15
15
  "peerDependencies": {
16
- "@player-ui/player": "0.15.1"
16
+ "@player-ui/player": "0.15.2-next.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@player-ui/partial-match-registry": "workspace:*",
@@ -30,6 +30,8 @@
30
30
  "types": "./types/index.d.ts",
31
31
  "import": "./dist/index.mjs",
32
32
  "default": "./dist/cjs/index.cjs"
33
- }
33
+ },
34
+ "./dist/xlr/*": "./dist/xlr/*",
35
+ "./xlr": "./dist/xlr/manifest.js"
34
36
  }
35
37
  }
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ import { TypesProviderPlugin } from "@player-ui/types-provider-plugin";
4
4
  import * as validators from "./validators";
5
5
  import * as dataTypes from "./data-types/types";
6
6
  import * as formats from "./formats";
7
- import type {
7
+ import {
8
8
  BooleanType,
9
9
  IntegerType,
10
10
  IntegerPosType,
@@ -15,6 +15,25 @@ import type {
15
15
  PhoneType,
16
16
  } from "./data-types/types";
17
17
 
18
+ import { commaNumber, currency, date, integer, phone } from "./formats/index";
19
+
20
+ import {
21
+ collection,
22
+ email,
23
+ expression,
24
+ integer as vinteger,
25
+ length,
26
+ max,
27
+ min,
28
+ oneOf,
29
+ phone as vphone,
30
+ readonly,
31
+ regex,
32
+ required,
33
+ string,
34
+ zip,
35
+ } from "./validators/index";
36
+
18
37
  export { validators, dataTypes, formats };
19
38
 
20
39
  export * from "./formats/utils";
@@ -37,12 +56,35 @@ export class CommonTypesPlugin
37
56
  typeof CollectionType,
38
57
  typeof DateType,
39
58
  typeof PhoneType,
59
+ ],
60
+ [
61
+ typeof commaNumber,
62
+ typeof currency,
63
+ typeof date,
64
+ typeof integer,
65
+ typeof phone,
66
+ ],
67
+ [
68
+ typeof collection,
69
+ typeof email,
70
+ typeof expression,
71
+ typeof vinteger,
72
+ typeof length,
73
+ typeof max,
74
+ typeof min,
75
+ typeof oneOf,
76
+ typeof vphone,
77
+ typeof readonly,
78
+ typeof regex,
79
+ typeof required,
80
+ typeof string,
81
+ typeof zip,
40
82
  ]
41
83
  >
42
84
  {
43
85
  name = "CommonTypes";
44
86
 
45
- apply(player: Player) {
87
+ apply(player: Player): void {
46
88
  player.registerPlugin(
47
89
  new TypesProviderPlugin({
48
90
  types: Object.values(dataTypes),
@@ -347,21 +347,21 @@ const stringRegexValidator = (
347
347
  };
348
348
 
349
349
  /** Checks that the given value represents an email */
350
- export const email = stringRegexValidator(
350
+ export const email: ValidatorFunction = stringRegexValidator(
351
351
  EMAIL_REGEX,
352
352
  "validation.email",
353
353
  "Improper email format",
354
354
  );
355
355
 
356
356
  /** Checks that the given value represents a phone number */
357
- export const phone = stringRegexValidator(
357
+ export const phone: ValidatorFunction = stringRegexValidator(
358
358
  PHONE_REGEX,
359
359
  "validation.phone",
360
360
  "Invalid phone number",
361
361
  );
362
362
 
363
363
  /** Checks that the given value represents a phone number */
364
- export const zip = stringRegexValidator(
364
+ export const zip: ValidatorFunction = stringRegexValidator(
365
365
  ZIP_REGEX,
366
366
  "validation.regex",
367
367
  "Invalid zip code",
package/types/index.d.ts CHANGED
@@ -2,7 +2,9 @@ import type { Player, ExtendedPlayerPlugin } from "@player-ui/player";
2
2
  import * as validators from "./validators";
3
3
  import * as dataTypes from "./data-types/types";
4
4
  import * as formats from "./formats";
5
- import type { BooleanType, IntegerType, IntegerPosType, IntegerNNType, StringType, CollectionType, DateType, PhoneType } from "./data-types/types";
5
+ import { BooleanType, IntegerType, IntegerPosType, IntegerNNType, StringType, CollectionType, DateType, PhoneType } from "./data-types/types";
6
+ import { commaNumber, currency, date, integer, phone } from "./formats/index";
7
+ import { collection, email, expression, integer as vinteger, length, max, min, oneOf, phone as vphone, readonly, regex, required, string, zip } from "./validators/index";
6
8
  export { validators, dataTypes, formats };
7
9
  export * from "./formats/utils";
8
10
  /**
@@ -20,6 +22,27 @@ export declare class CommonTypesPlugin implements ExtendedPlayerPlugin<[
20
22
  typeof CollectionType,
21
23
  typeof DateType,
22
24
  typeof PhoneType
25
+ ], [
26
+ typeof commaNumber,
27
+ typeof currency,
28
+ typeof date,
29
+ typeof integer,
30
+ typeof phone
31
+ ], [
32
+ typeof collection,
33
+ typeof email,
34
+ typeof expression,
35
+ typeof vinteger,
36
+ typeof length,
37
+ typeof max,
38
+ typeof min,
39
+ typeof oneOf,
40
+ typeof vphone,
41
+ typeof readonly,
42
+ typeof regex,
43
+ typeof required,
44
+ typeof string,
45
+ typeof zip
23
46
  ]> {
24
47
  name: string;
25
48
  apply(player: Player): void;