arktype 2.2.6 → 2.2.7

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.
@@ -145,7 +145,9 @@ const epoch = Scope.module({
145
145
  root: epochRoot,
146
146
  parse: rootSchema({
147
147
  in: epochRoot,
148
- morphs: (s) => new Date(s),
148
+ // parse as a number so the string is treated as milliseconds
149
+ // rather than passed to the Date string parser
150
+ morphs: (s) => new Date(Number.parseInt(s)),
149
151
  declaredOut: intrinsic.Date
150
152
  })
151
153
  }, {
@@ -423,15 +425,15 @@ export const uuid = Scope.module({
423
425
  ],
424
426
  "#nil": "'00000000-0000-0000-0000-000000000000'",
425
427
  "#max": "'ffffffff-ffff-ffff-ffff-ffffffffffff'",
426
- "#versioned": /^[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,
427
- v1: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv1"),
428
- v2: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv2"),
429
- v3: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv3"),
430
- v4: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv4"),
431
- v5: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv5"),
432
- v6: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv6"),
433
- v7: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv7"),
434
- v8: regexStringNode(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i, "a UUIDv8")
428
+ "#versioned": /^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,
429
+ v1: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-1[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv1"),
430
+ v2: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-2[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv2"),
431
+ v3: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-3[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv3"),
432
+ v4: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-4[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv4"),
433
+ v5: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-5[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv5"),
434
+ v6: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-6[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv6"),
435
+ v7: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-7[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv7"),
436
+ v8: regexStringNode(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-8[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/, "a UUIDv8")
435
437
  }, {
436
438
  name: "string.uuid"
437
439
  });
@@ -8,7 +8,7 @@ export const parseOperator = (s) => {
8
8
  return (lookahead === "" ? s.finalize("")
9
9
  : lookahead === "[" ?
10
10
  s.scanner.shift() === "]" ?
11
- s.setRoot(s.root.array())
11
+ s.setRoot(s.root.rawArray())
12
12
  : s.error(incompleteArrayTokenMessage)
13
13
  : lookahead === "|" ?
14
14
  s.scanner.lookahead === ">" ?
@@ -9,7 +9,7 @@ export const parseString = (def, ctx) => {
9
9
  if (def.endsWith("[]")) {
10
10
  const possibleElementResolution = ctx.$.maybeResolveRoot(def.slice(0, -2));
11
11
  if (possibleElementResolution)
12
- return possibleElementResolution.array();
12
+ return possibleElementResolution.rawArray();
13
13
  }
14
14
  const s = new RuntimeState(new Scanner(def), ctx);
15
15
  const node = fullStringParse(s);
@@ -20,7 +20,7 @@ const parseBranchTuple = (def, ctx) => {
20
20
  return result.throw();
21
21
  return result;
22
22
  };
23
- const parseArrayTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).array();
23
+ const parseArrayTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).rawArray();
24
24
  export const parseMorphTuple = (def, ctx) => {
25
25
  if (typeof def[2] !== "function") {
26
26
  return throwParseError(writeMalformedFunctionalExpressionMessage("=>", def[2]));
package/out/scope.js CHANGED
@@ -98,7 +98,7 @@ export class InternalScope extends BaseScope {
98
98
  }
99
99
  type = new InternalTypeParser(this);
100
100
  static scope = ((def, config = {}) => new InternalScope(def, config));
101
- static module = ((def, config = {}) => this.scope(def, config).export());
101
+ static module = ((def, config = {}) => InternalScope.scope(def, config).export());
102
102
  }
103
103
  export const scope = Object.assign(InternalScope.scope, {
104
104
  define: (def) => def
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arktype",
3
3
  "description": "TypeScript's 1:1 validator, optimized from editor to runtime",
4
- "version": "2.2.6",
4
+ "version": "2.2.7",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -38,9 +38,9 @@
38
38
  "out"
39
39
  ],
40
40
  "dependencies": {
41
- "@ark/util": "0.56.5",
42
- "@ark/schema": "0.56.5",
43
- "arkregex": "0.0.11"
41
+ "@ark/util": "0.56.6",
42
+ "@ark/schema": "0.56.6",
43
+ "arkregex": "0.0.12"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"