pema 0.1.0

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 (155) hide show
  1. package/lib/private/AbstractConstructor.d.ts +3 -0
  2. package/lib/private/AbstractConstructor.js +2 -0
  3. package/lib/private/ArrayType.d.ts +12 -0
  4. package/lib/private/ArrayType.js +48 -0
  5. package/lib/private/BigIntType.d.ts +5 -0
  6. package/lib/private/BigIntType.js +7 -0
  7. package/lib/private/BlobType.d.ts +5 -0
  8. package/lib/private/BlobType.js +7 -0
  9. package/lib/private/BooleanType.d.ts +5 -0
  10. package/lib/private/BooleanType.js +7 -0
  11. package/lib/private/BuiltinType.d.ts +10 -0
  12. package/lib/private/BuiltinType.js +26 -0
  13. package/lib/private/ConstructorType.d.ts +12 -0
  14. package/lib/private/ConstructorType.js +28 -0
  15. package/lib/private/DateType.d.ts +5 -0
  16. package/lib/private/DateType.js +7 -0
  17. package/lib/private/DefaultType.d.ts +10 -0
  18. package/lib/private/DefaultType.js +27 -0
  19. package/lib/private/FileType.d.ts +5 -0
  20. package/lib/private/FileType.js +7 -0
  21. package/lib/private/GenericType.d.ts +7 -0
  22. package/lib/private/GenericType.js +10 -0
  23. package/lib/private/Infer.d.ts +4 -0
  24. package/lib/private/Infer.js +2 -0
  25. package/lib/private/InferSchema.d.ts +20 -0
  26. package/lib/private/InferSchema.js +2 -0
  27. package/lib/private/IntType.d.ts +7 -0
  28. package/lib/private/IntType.js +16 -0
  29. package/lib/private/LiteralType.d.ts +12 -0
  30. package/lib/private/LiteralType.js +24 -0
  31. package/lib/private/MaybeInt.d.ts +3 -0
  32. package/lib/private/MaybeInt.js +2 -0
  33. package/lib/private/NormalizeSchema.d.ts +16 -0
  34. package/lib/private/NormalizeSchema.js +2 -0
  35. package/lib/private/NullType.d.ts +7 -0
  36. package/lib/private/NullType.js +20 -0
  37. package/lib/private/NumberType.d.ts +5 -0
  38. package/lib/private/NumberType.js +7 -0
  39. package/lib/private/OptionalType.d.ts +10 -0
  40. package/lib/private/OptionalType.js +20 -0
  41. package/lib/private/PrimitiveType.d.ts +11 -0
  42. package/lib/private/PrimitiveType.js +31 -0
  43. package/lib/private/RecordType.d.ts +13 -0
  44. package/lib/private/RecordType.js +58 -0
  45. package/lib/private/RecordTypeKey.d.ts +6 -0
  46. package/lib/private/RecordTypeKey.js +2 -0
  47. package/lib/private/Schema.d.ts +7 -0
  48. package/lib/private/Schema.js +2 -0
  49. package/lib/private/SchemaType.d.ts +13 -0
  50. package/lib/private/SchemaType.js +63 -0
  51. package/lib/private/StringType.d.ts +8 -0
  52. package/lib/private/StringType.js +23 -0
  53. package/lib/private/SymbolType.d.ts +5 -0
  54. package/lib/private/SymbolType.js +7 -0
  55. package/lib/private/TupleType.d.ts +17 -0
  56. package/lib/private/TupleType.js +40 -0
  57. package/lib/private/Type.d.ts +10 -0
  58. package/lib/private/Type.js +15 -0
  59. package/lib/private/URLType.d.ts +5 -0
  60. package/lib/private/URLType.js +7 -0
  61. package/lib/private/UintType.d.ts +9 -0
  62. package/lib/private/UintType.js +16 -0
  63. package/lib/private/UndefinedType.d.ts +7 -0
  64. package/lib/private/UndefinedType.js +7 -0
  65. package/lib/private/UnionType.d.ts +18 -0
  66. package/lib/private/UnionType.js +63 -0
  67. package/lib/private/Validated.d.ts +8 -0
  68. package/lib/private/Validated.js +10 -0
  69. package/lib/private/ValidatedKey.d.ts +4 -0
  70. package/lib/private/ValidatedKey.js +3 -0
  71. package/lib/private/Validator.d.ts +3 -0
  72. package/lib/private/Validator.js +2 -0
  73. package/lib/private/array.d.ts +5 -0
  74. package/lib/private/array.js +3 -0
  75. package/lib/private/bigint.d.ts +4 -0
  76. package/lib/private/bigint.js +3 -0
  77. package/lib/private/blob.d.ts +4 -0
  78. package/lib/private/blob.js +3 -0
  79. package/lib/private/boolean.d.ts +4 -0
  80. package/lib/private/boolean.js +3 -0
  81. package/lib/private/constructor.d.ts +5 -0
  82. package/lib/private/constructor.js +3 -0
  83. package/lib/private/date.d.ts +4 -0
  84. package/lib/private/date.js +3 -0
  85. package/lib/private/error.d.ts +3 -0
  86. package/lib/private/error.js +4 -0
  87. package/lib/private/expect.d.ts +21 -0
  88. package/lib/private/expect.js +21 -0
  89. package/lib/private/expected.d.ts +3 -0
  90. package/lib/private/expected.js +2 -0
  91. package/lib/private/file.d.ts +4 -0
  92. package/lib/private/file.js +3 -0
  93. package/lib/private/index.d.ts +5 -0
  94. package/lib/private/index.js +43 -0
  95. package/lib/private/int.d.ts +4 -0
  96. package/lib/private/int.js +3 -0
  97. package/lib/private/is-int.d.ts +3 -0
  98. package/lib/private/is-int.js +5 -0
  99. package/lib/private/is_validated_type.d.ts +4 -0
  100. package/lib/private/is_validated_type.js +5 -0
  101. package/lib/private/literal.d.ts +5 -0
  102. package/lib/private/literal.js +3 -0
  103. package/lib/private/null.d.ts +4 -0
  104. package/lib/private/null.js +3 -0
  105. package/lib/private/number.d.ts +4 -0
  106. package/lib/private/number.js +3 -0
  107. package/lib/private/optional.d.ts +5 -0
  108. package/lib/private/optional.js +3 -0
  109. package/lib/private/record.d.ts +6 -0
  110. package/lib/private/record.js +3 -0
  111. package/lib/private/string.d.ts +4 -0
  112. package/lib/private/string.js +3 -0
  113. package/lib/private/symbol.d.ts +4 -0
  114. package/lib/private/symbol.js +3 -0
  115. package/lib/private/tuple.d.ts +5 -0
  116. package/lib/private/tuple.js +3 -0
  117. package/lib/private/uint.d.ts +4 -0
  118. package/lib/private/uint.js +3 -0
  119. package/lib/private/undefined.d.ts +4 -0
  120. package/lib/private/undefined.js +3 -0
  121. package/lib/private/union.d.ts +9 -0
  122. package/lib/private/union.js +3 -0
  123. package/lib/private/url.d.ts +4 -0
  124. package/lib/private/url.js +3 -0
  125. package/lib/public/Schema.d.ts +2 -0
  126. package/lib/public/Schema.js +2 -0
  127. package/lib/public/blob.d.ts +2 -0
  128. package/lib/public/blob.js +2 -0
  129. package/lib/public/boolean.d.ts +2 -0
  130. package/lib/public/boolean.js +2 -0
  131. package/lib/public/constructor.d.ts +2 -0
  132. package/lib/public/constructor.js +2 -0
  133. package/lib/public/date.d.ts +2 -0
  134. package/lib/public/date.js +2 -0
  135. package/lib/public/file.d.ts +2 -0
  136. package/lib/public/file.js +2 -0
  137. package/lib/public/index.d.ts +2 -0
  138. package/lib/public/index.js +2 -0
  139. package/lib/public/int.d.ts +2 -0
  140. package/lib/public/int.js +2 -0
  141. package/lib/public/number.d.ts +2 -0
  142. package/lib/public/number.js +2 -0
  143. package/lib/public/object.d.ts +2 -0
  144. package/lib/public/object.js +2 -0
  145. package/lib/public/optional.d.ts +2 -0
  146. package/lib/public/optional.js +2 -0
  147. package/lib/public/record.d.ts +2 -0
  148. package/lib/public/record.js +2 -0
  149. package/lib/public/string.d.ts +2 -0
  150. package/lib/public/string.js +2 -0
  151. package/lib/public/symbol.d.ts +2 -0
  152. package/lib/public/symbol.js +2 -0
  153. package/lib/public/union.d.ts +2 -0
  154. package/lib/public/union.js +2 -0
  155. package/package.json +45 -0
@@ -0,0 +1,4 @@
1
+ import NullType from "#NullType";
2
+ declare const _default: NullType;
3
+ export default _default;
4
+ //# sourceMappingURL=null.d.ts.map
@@ -0,0 +1,3 @@
1
+ import NullType from "#NullType";
2
+ export default new NullType();
3
+ //# sourceMappingURL=null.js.map
@@ -0,0 +1,4 @@
1
+ import NumberType from "#NumberType";
2
+ declare const _default: NumberType;
3
+ export default _default;
4
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1,3 @@
1
+ import NumberType from "#NumberType";
2
+ export default new NumberType();
3
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1,5 @@
1
+ import OptionalType from "#OptionalType";
2
+ import type Validated from "#Validated";
3
+ declare const _default: <const T extends Validated<unknown>>(type: T) => OptionalType<T>;
4
+ export default _default;
5
+ //# sourceMappingURL=optional.d.ts.map
@@ -0,0 +1,3 @@
1
+ import OptionalType from "#OptionalType";
2
+ export default (type) => new OptionalType(type);
3
+ //# sourceMappingURL=optional.js.map
@@ -0,0 +1,6 @@
1
+ import RecordType from "#RecordType";
2
+ import type RecordTypeKey from "#RecordTypeKey";
3
+ import type Validated from "#Validated";
4
+ declare const _default: <const Key extends RecordTypeKey, const Value extends Validated<unknown>>(k: Key, v: Value) => RecordType<Key, Value>;
5
+ export default _default;
6
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1,3 @@
1
+ import RecordType from "#RecordType";
2
+ export default (k, v) => new RecordType(k, v);
3
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1,4 @@
1
+ import StringType from "#StringType";
2
+ declare const _default: StringType;
3
+ export default _default;
4
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1,3 @@
1
+ import StringType from "#StringType";
2
+ export default new StringType();
3
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1,4 @@
1
+ import SymbolType from "#SymbolType";
2
+ declare const _default: SymbolType;
3
+ export default _default;
4
+ //# sourceMappingURL=symbol.d.ts.map
@@ -0,0 +1,3 @@
1
+ import SymbolType from "#SymbolType";
2
+ export default new SymbolType();
3
+ //# sourceMappingURL=symbol.js.map
@@ -0,0 +1,5 @@
1
+ import type Schema from "#Schema";
2
+ import TupleType from "#TupleType";
3
+ declare const _default: <const T extends Schema[]>(...types: T) => TupleType<T>;
4
+ export default _default;
5
+ //# sourceMappingURL=tuple.d.ts.map
@@ -0,0 +1,3 @@
1
+ import TupleType from "#TupleType";
2
+ export default (...types) => new TupleType(types);
3
+ //# sourceMappingURL=tuple.js.map
@@ -0,0 +1,4 @@
1
+ import UintType from "#UintType";
2
+ declare const _default: UintType;
3
+ export default _default;
4
+ //# sourceMappingURL=uint.d.ts.map
@@ -0,0 +1,3 @@
1
+ import UintType from "#UintType";
2
+ export default new UintType();
3
+ //# sourceMappingURL=uint.js.map
@@ -0,0 +1,4 @@
1
+ import UndefinedType from "#UndefinedType";
2
+ declare const _default: UndefinedType;
3
+ export default _default;
4
+ //# sourceMappingURL=undefined.d.ts.map
@@ -0,0 +1,3 @@
1
+ import UndefinedType from "#UndefinedType";
2
+ export default new UndefinedType();
3
+ //# sourceMappingURL=undefined.js.map
@@ -0,0 +1,9 @@
1
+ import UnionType from "#UnionType";
2
+ import type Schema from "#Schema";
3
+ import type NormalizeSchema from "#NormalizeSchema";
4
+ type NormalizeSchemas<T extends Schema[]> = {
5
+ [K in keyof T]: NormalizeSchema<T[K]>;
6
+ };
7
+ declare const _default: <const T extends Schema[]>(...types: T) => UnionType<NormalizeSchemas<T>>;
8
+ export default _default;
9
+ //# sourceMappingURL=union.d.ts.map
@@ -0,0 +1,3 @@
1
+ import UnionType from "#UnionType";
2
+ export default (...types) => new UnionType(types);
3
+ //# sourceMappingURL=union.js.map
@@ -0,0 +1,4 @@
1
+ import URLType from "#URLType";
2
+ declare const _default: URLType;
3
+ export default _default;
4
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1,3 @@
1
+ import URLType from "#URLType";
2
+ export default new URLType();
3
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#Schema";
2
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Schema.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#blob";
2
+ //# sourceMappingURL=blob.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#blob";
2
+ //# sourceMappingURL=blob.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#boolean";
2
+ //# sourceMappingURL=boolean.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#boolean";
2
+ //# sourceMappingURL=boolean.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#constructor";
2
+ //# sourceMappingURL=constructor.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#constructor";
2
+ //# sourceMappingURL=constructor.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#date";
2
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#date";
2
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#file";
2
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#file";
2
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#int";
2
+ //# sourceMappingURL=int.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#int";
2
+ //# sourceMappingURL=int.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#number";
2
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#number";
2
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#index";
2
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#optional";
2
+ //# sourceMappingURL=optional.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#optional";
2
+ //# sourceMappingURL=optional.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#record";
2
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#record";
2
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#string";
2
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#string";
2
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#symbol";
2
+ //# sourceMappingURL=symbol.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#symbol";
2
+ //# sourceMappingURL=symbol.js.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#union";
2
+ //# sourceMappingURL=union.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default } from "#union";
2
+ //# sourceMappingURL=union.js.map
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "pema",
3
+ "version": "0.1.0",
4
+ "description": "Runtime validation for Primate",
5
+ "homepage": "https://primate.run/docs/validation",
6
+ "bugs": "https://github.com/primate-run/primate/issues",
7
+ "license": "MIT",
8
+ "files": [
9
+ "/lib/**/*.js",
10
+ "/lib/**/*.d.ts",
11
+ "!/**/*.spec.*"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/primate-run/primate",
16
+ "directory": "packages/pema"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run clean && tsc",
20
+ "clean": "rm -rf ./lib",
21
+ "prepublishOnly": "npm run build",
22
+ "test": "npm run build && npx proby"
23
+ },
24
+ "dependencies": {
25
+ "@rcompat/invariant": "^0.8.2",
26
+ "@rcompat/record": "^0.7.1"
27
+ },
28
+ "type": "module",
29
+ "imports": {
30
+ "#*": {
31
+ "apekit": "./src/private/*.ts",
32
+ "default": "./lib/private/*.js"
33
+ }
34
+ },
35
+ "exports": {
36
+ ".": {
37
+ "apekit": "./src/public/index.ts",
38
+ "default": "./lib/public/index.js"
39
+ },
40
+ "./*": {
41
+ "apekit": "./src/public/*.ts",
42
+ "default": "./lib/public/*.js"
43
+ }
44
+ }
45
+ }