@langchain/core 0.3.21 → 0.3.23
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/callbacks/base.cjs +9 -1
- package/dist/callbacks/base.d.ts +1 -0
- package/dist/callbacks/base.js +7 -0
- package/dist/callbacks/manager.cjs +18 -0
- package/dist/callbacks/manager.js +19 -1
- package/dist/context.cjs +13 -123
- package/dist/context.d.ts +2 -101
- package/dist/context.js +9 -119
- package/dist/messages/tool.cjs +14 -1
- package/dist/messages/tool.d.ts +13 -1
- package/dist/messages/tool.js +12 -0
- package/dist/output_parsers/transform.cjs +2 -2
- package/dist/output_parsers/transform.js +1 -1
- package/dist/runnables/base.cjs +2 -2
- package/dist/runnables/base.d.ts +1 -2
- package/dist/runnables/base.js +3 -3
- package/dist/runnables/config.cjs +17 -1
- package/dist/runnables/config.d.ts +1 -0
- package/dist/runnables/config.js +15 -0
- package/dist/runnables/index.cjs +2 -1
- package/dist/runnables/index.d.ts +1 -1
- package/dist/runnables/index.js +1 -1
- package/dist/runnables/iter.cjs +3 -2
- package/dist/runnables/iter.d.ts +1 -1
- package/dist/runnables/iter.js +3 -2
- package/dist/runnables/types.d.ts +1 -1
- package/dist/singletons/async_local_storage/context.cjs +189 -0
- package/dist/singletons/async_local_storage/context.d.ts +155 -0
- package/dist/singletons/async_local_storage/context.js +182 -0
- package/dist/singletons/async_local_storage/globals.cjs +2 -1
- package/dist/singletons/async_local_storage/globals.d.ts +2 -1
- package/dist/singletons/async_local_storage/globals.js +1 -0
- package/dist/singletons/async_local_storage/index.cjs +4 -5
- package/dist/singletons/async_local_storage/index.d.ts +0 -1
- package/dist/singletons/async_local_storage/index.js +1 -2
- package/dist/singletons/callbacks.cjs +6 -4
- package/dist/singletons/callbacks.js +6 -4
- package/dist/singletons/index.cjs +3 -3
- package/dist/singletons/index.d.ts +4 -2
- package/dist/singletons/index.js +4 -3
- package/dist/tools/index.cjs +14 -12
- package/dist/tools/index.d.ts +11 -8
- package/dist/tools/index.js +16 -14
- package/dist/types/stream.d.ts +1 -0
- package/dist/utils/json_schema.cjs +3 -3
- package/dist/utils/json_schema.d.ts +1 -1
- package/dist/utils/json_schema.js +1 -1
- package/dist/utils/stream.cjs +3 -2
- package/dist/utils/stream.d.ts +2 -1
- package/dist/utils/stream.js +3 -2
- package/package.json +2 -1
- package/dist/utils/@cfworker/json-schema/index.cjs +0 -17
- package/dist/utils/@cfworker/json-schema/index.d.ts +0 -1
- package/dist/utils/@cfworker/json-schema/index.js +0 -1
- package/dist/utils/@cfworker/json-schema/src/deep-compare-strict.cjs +0 -43
- package/dist/utils/@cfworker/json-schema/src/deep-compare-strict.d.ts +0 -1
- package/dist/utils/@cfworker/json-schema/src/deep-compare-strict.js +0 -39
- package/dist/utils/@cfworker/json-schema/src/dereference.cjs +0 -171
- package/dist/utils/@cfworker/json-schema/src/dereference.d.ts +0 -12
- package/dist/utils/@cfworker/json-schema/src/dereference.js +0 -167
- package/dist/utils/@cfworker/json-schema/src/format.cjs +0 -139
- package/dist/utils/@cfworker/json-schema/src/format.d.ts +0 -2
- package/dist/utils/@cfworker/json-schema/src/format.js +0 -136
- package/dist/utils/@cfworker/json-schema/src/index.cjs +0 -24
- package/dist/utils/@cfworker/json-schema/src/index.d.ts +0 -8
- package/dist/utils/@cfworker/json-schema/src/index.js +0 -8
- package/dist/utils/@cfworker/json-schema/src/pointer.cjs +0 -11
- package/dist/utils/@cfworker/json-schema/src/pointer.d.ts +0 -2
- package/dist/utils/@cfworker/json-schema/src/pointer.js +0 -6
- package/dist/utils/@cfworker/json-schema/src/types.d.ts +0 -72
- package/dist/utils/@cfworker/json-schema/src/ucs2-length.cjs +0 -28
- package/dist/utils/@cfworker/json-schema/src/ucs2-length.d.ts +0 -6
- package/dist/utils/@cfworker/json-schema/src/ucs2-length.js +0 -24
- package/dist/utils/@cfworker/json-schema/src/validate.cjs +0 -808
- package/dist/utils/@cfworker/json-schema/src/validate.d.ts +0 -3
- package/dist/utils/@cfworker/json-schema/src/validate.js +0 -804
- package/dist/utils/@cfworker/json-schema/src/validator.cjs +0 -44
- package/dist/utils/@cfworker/json-schema/src/validator.d.ts +0 -10
- package/dist/utils/@cfworker/json-schema/src/validator.js +0 -40
- /package/dist/{utils/@cfworker/json-schema/src/types.cjs → types/stream.cjs} +0 -0
- /package/dist/{utils/@cfworker/json-schema/src/types.js → types/stream.js} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// based on https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js
|
|
2
|
-
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
3
|
-
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4
|
-
const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
5
|
-
const HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
|
6
|
-
// const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
7
|
-
const URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
8
|
-
// uri-template: https://tools.ietf.org/html/rfc6570
|
|
9
|
-
const URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
|
10
|
-
// For the source: https://gist.github.com/dperini/729294
|
|
11
|
-
// For test cases: https://mathiasbynens.be/demo/url-regex
|
|
12
|
-
const URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
|
13
|
-
const UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
14
|
-
const JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
15
|
-
const JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
16
|
-
const RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
17
|
-
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
18
|
-
const FASTDATE = /^\d\d\d\d-[0-1]\d-[0-3]\d$/;
|
|
19
|
-
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
20
|
-
const FASTTIME = /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
21
|
-
const FASTDATETIME = /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i;
|
|
22
|
-
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
|
23
|
-
// const FASTURI = /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i;
|
|
24
|
-
const FASTURIREFERENCE = /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;
|
|
25
|
-
// https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
|
|
26
|
-
const EMAIL = (input) => {
|
|
27
|
-
if (input[0] === '"')
|
|
28
|
-
return false;
|
|
29
|
-
const [name, host, ...rest] = input.split("@");
|
|
30
|
-
if (!name ||
|
|
31
|
-
!host ||
|
|
32
|
-
rest.length !== 0 ||
|
|
33
|
-
name.length > 64 ||
|
|
34
|
-
host.length > 253)
|
|
35
|
-
return false;
|
|
36
|
-
if (name[0] === "." || name.endsWith(".") || name.includes(".."))
|
|
37
|
-
return false;
|
|
38
|
-
if (!/^[a-z0-9.-]+$/i.test(host) ||
|
|
39
|
-
!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
|
|
40
|
-
return false;
|
|
41
|
-
return host
|
|
42
|
-
.split(".")
|
|
43
|
-
.every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
44
|
-
};
|
|
45
|
-
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
|
46
|
-
const IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
47
|
-
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
|
|
48
|
-
const IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
49
|
-
// https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
|
|
50
|
-
const DURATION = (input) => input.length > 1 &&
|
|
51
|
-
input.length < 80 &&
|
|
52
|
-
(/^P\d+([.,]\d+)?W$/.test(input) ||
|
|
53
|
-
(/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) &&
|
|
54
|
-
/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input)));
|
|
55
|
-
function bind(r) {
|
|
56
|
-
return r.test.bind(r);
|
|
57
|
-
}
|
|
58
|
-
export const fullFormat = {
|
|
59
|
-
date,
|
|
60
|
-
time: /* #__PURE__ */ time.bind(undefined, false),
|
|
61
|
-
"date-time": date_time,
|
|
62
|
-
duration: DURATION,
|
|
63
|
-
uri,
|
|
64
|
-
"uri-reference": /* #__PURE__ */ bind(URIREF),
|
|
65
|
-
"uri-template": /* #__PURE__ */ bind(URITEMPLATE),
|
|
66
|
-
url: /* #__PURE__ */ bind(URL_),
|
|
67
|
-
email: EMAIL,
|
|
68
|
-
hostname: /* #__PURE__ */ bind(HOSTNAME),
|
|
69
|
-
ipv4: /* #__PURE__ */ bind(IPV4),
|
|
70
|
-
ipv6: /* #__PURE__ */ bind(IPV6),
|
|
71
|
-
regex: regex,
|
|
72
|
-
uuid: /* #__PURE__ */ bind(UUID),
|
|
73
|
-
"json-pointer": /* #__PURE__ */ bind(JSON_POINTER),
|
|
74
|
-
"json-pointer-uri-fragment": /* #__PURE__ */ bind(JSON_POINTER_URI_FRAGMENT),
|
|
75
|
-
"relative-json-pointer": /* #__PURE__ */ bind(RELATIVE_JSON_POINTER),
|
|
76
|
-
};
|
|
77
|
-
export const fastFormat = {
|
|
78
|
-
...fullFormat,
|
|
79
|
-
date: /* #__PURE__ */ bind(FASTDATE),
|
|
80
|
-
time: /* #__PURE__ */ bind(FASTTIME),
|
|
81
|
-
"date-time": /* #__PURE__ */ bind(FASTDATETIME),
|
|
82
|
-
"uri-reference": /* #__PURE__ */ bind(FASTURIREFERENCE),
|
|
83
|
-
};
|
|
84
|
-
function isLeapYear(year) {
|
|
85
|
-
// https://tools.ietf.org/html/rfc3339#appendix-C
|
|
86
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
87
|
-
}
|
|
88
|
-
function date(str) {
|
|
89
|
-
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
|
90
|
-
const matches = str.match(DATE);
|
|
91
|
-
if (!matches)
|
|
92
|
-
return false;
|
|
93
|
-
const year = +matches[1];
|
|
94
|
-
const month = +matches[2];
|
|
95
|
-
const day = +matches[3];
|
|
96
|
-
return (month >= 1 &&
|
|
97
|
-
month <= 12 &&
|
|
98
|
-
day >= 1 &&
|
|
99
|
-
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]));
|
|
100
|
-
}
|
|
101
|
-
function time(full, str) {
|
|
102
|
-
const matches = str.match(TIME);
|
|
103
|
-
if (!matches)
|
|
104
|
-
return false;
|
|
105
|
-
const hour = +matches[1];
|
|
106
|
-
const minute = +matches[2];
|
|
107
|
-
const second = +matches[3];
|
|
108
|
-
const timeZone = !!matches[5];
|
|
109
|
-
return (((hour <= 23 && minute <= 59 && second <= 59) ||
|
|
110
|
-
(hour == 23 && minute == 59 && second == 60)) &&
|
|
111
|
-
(!full || timeZone));
|
|
112
|
-
}
|
|
113
|
-
const DATE_TIME_SEPARATOR = /t|\s/i;
|
|
114
|
-
function date_time(str) {
|
|
115
|
-
// http://tools.ietf.org/html/rfc3339#section-5.6
|
|
116
|
-
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
117
|
-
return dateTime.length == 2 && date(dateTime[0]) && time(true, dateTime[1]);
|
|
118
|
-
}
|
|
119
|
-
const NOT_URI_FRAGMENT = /\/|:/;
|
|
120
|
-
const URI_PATTERN = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
121
|
-
function uri(str) {
|
|
122
|
-
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
|
123
|
-
return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
|
|
124
|
-
}
|
|
125
|
-
const Z_ANCHOR = /[^\\]\\Z/;
|
|
126
|
-
function regex(str) {
|
|
127
|
-
if (Z_ANCHOR.test(str))
|
|
128
|
-
return false;
|
|
129
|
-
try {
|
|
130
|
-
new RegExp(str);
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
catch (e) {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./deep-compare-strict.cjs"), exports);
|
|
18
|
-
__exportStar(require("./dereference.cjs"), exports);
|
|
19
|
-
__exportStar(require("./format.cjs"), exports);
|
|
20
|
-
__exportStar(require("./pointer.cjs"), exports);
|
|
21
|
-
__exportStar(require("./types.cjs"), exports);
|
|
22
|
-
__exportStar(require("./ucs2-length.cjs"), exports);
|
|
23
|
-
__exportStar(require("./validate.cjs"), exports);
|
|
24
|
-
__exportStar(require("./validator.cjs"), exports);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./deep-compare-strict.js";
|
|
2
|
-
export * from "./dereference.js";
|
|
3
|
-
export * from "./format.js";
|
|
4
|
-
export * from "./pointer.js";
|
|
5
|
-
export * from "./types.js";
|
|
6
|
-
export * from "./ucs2-length.js";
|
|
7
|
-
export * from "./validate.js";
|
|
8
|
-
export * from "./validator.js";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./deep-compare-strict.js";
|
|
2
|
-
export * from "./dereference.js";
|
|
3
|
-
export * from "./format.js";
|
|
4
|
-
export * from "./pointer.js";
|
|
5
|
-
export * from "./types.js";
|
|
6
|
-
export * from "./ucs2-length.js";
|
|
7
|
-
export * from "./validate.js";
|
|
8
|
-
export * from "./validator.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.escapePointer = exports.encodePointer = void 0;
|
|
4
|
-
function encodePointer(p) {
|
|
5
|
-
return encodeURI(escapePointer(p));
|
|
6
|
-
}
|
|
7
|
-
exports.encodePointer = encodePointer;
|
|
8
|
-
function escapePointer(p) {
|
|
9
|
-
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
10
|
-
}
|
|
11
|
-
exports.escapePointer = escapePointer;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export type SchemaDraft = "4" | "7" | "2019-09" | "2020-12";
|
|
2
|
-
export declare const enum OutputFormat {
|
|
3
|
-
Flag = 1,
|
|
4
|
-
Basic = 2,
|
|
5
|
-
Detailed = 4
|
|
6
|
-
}
|
|
7
|
-
export type InstanceType = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string";
|
|
8
|
-
export interface Schema {
|
|
9
|
-
$id?: string;
|
|
10
|
-
$anchor?: string;
|
|
11
|
-
$recursiveAnchor?: boolean;
|
|
12
|
-
$ref?: string;
|
|
13
|
-
$recursiveRef?: "#";
|
|
14
|
-
$schema?: string;
|
|
15
|
-
$comment?: string;
|
|
16
|
-
$defs?: any;
|
|
17
|
-
$vocabulary?: Record<string, boolean>;
|
|
18
|
-
type?: InstanceType | InstanceType[];
|
|
19
|
-
const?: any;
|
|
20
|
-
enum?: any[];
|
|
21
|
-
required?: string[];
|
|
22
|
-
not?: Schema;
|
|
23
|
-
anyOf?: Schema[];
|
|
24
|
-
allOf?: Schema[];
|
|
25
|
-
oneOf?: Schema[];
|
|
26
|
-
if?: Schema;
|
|
27
|
-
then?: Schema;
|
|
28
|
-
else?: Schema;
|
|
29
|
-
format?: string;
|
|
30
|
-
properties?: Record<string | number, Schema | boolean>;
|
|
31
|
-
patternProperties?: Record<string, Schema | boolean>;
|
|
32
|
-
additionalProperties?: Schema | boolean;
|
|
33
|
-
unevaluatedProperties?: Schema | boolean;
|
|
34
|
-
minProperties?: number;
|
|
35
|
-
maxProperties?: number;
|
|
36
|
-
propertyNames?: Schema;
|
|
37
|
-
dependentRequired?: Record<string, string[]>;
|
|
38
|
-
dependentSchemas?: Record<string, Schema>;
|
|
39
|
-
dependencies?: Record<string, Schema | string[]>;
|
|
40
|
-
prefixItems?: Array<Schema | boolean>[];
|
|
41
|
-
items?: Schema | boolean | Array<Schema | boolean>;
|
|
42
|
-
additionalItems?: Schema | boolean;
|
|
43
|
-
unevaluatedItems?: Schema | boolean;
|
|
44
|
-
contains?: Schema | boolean;
|
|
45
|
-
minContains?: number;
|
|
46
|
-
maxContains?: number;
|
|
47
|
-
minItems?: number;
|
|
48
|
-
maxItems?: number;
|
|
49
|
-
uniqueItems?: boolean;
|
|
50
|
-
minimum?: number;
|
|
51
|
-
maximum?: number;
|
|
52
|
-
exclusiveMinimum?: number | boolean;
|
|
53
|
-
exclusiveMaximum?: number | boolean;
|
|
54
|
-
multipleOf?: number;
|
|
55
|
-
minLength?: number;
|
|
56
|
-
maxLength?: number;
|
|
57
|
-
pattern?: string;
|
|
58
|
-
__absolute_ref__?: string;
|
|
59
|
-
__absolute_recursive_ref__?: string;
|
|
60
|
-
__absolute_uri__?: string;
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
}
|
|
63
|
-
export interface OutputUnit {
|
|
64
|
-
keyword: string;
|
|
65
|
-
keywordLocation: string;
|
|
66
|
-
instanceLocation: string;
|
|
67
|
-
error: string;
|
|
68
|
-
}
|
|
69
|
-
export interface ValidationResult {
|
|
70
|
-
valid: boolean;
|
|
71
|
-
errors: OutputUnit[];
|
|
72
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ucs2length = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Get UCS-2 length of a string
|
|
6
|
-
* https://mathiasbynens.be/notes/javascript-encoding
|
|
7
|
-
* https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
|
8
|
-
*/
|
|
9
|
-
function ucs2length(s) {
|
|
10
|
-
let result = 0;
|
|
11
|
-
let length = s.length;
|
|
12
|
-
let index = 0;
|
|
13
|
-
let charCode;
|
|
14
|
-
while (index < length) {
|
|
15
|
-
result++;
|
|
16
|
-
charCode = s.charCodeAt(index++);
|
|
17
|
-
if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {
|
|
18
|
-
// high surrogate, and there is a next character
|
|
19
|
-
charCode = s.charCodeAt(index);
|
|
20
|
-
if ((charCode & 0xfc00) == 0xdc00) {
|
|
21
|
-
// low surrogate
|
|
22
|
-
index++;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
exports.ucs2length = ucs2length;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get UCS-2 length of a string
|
|
3
|
-
* https://mathiasbynens.be/notes/javascript-encoding
|
|
4
|
-
* https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
|
5
|
-
*/
|
|
6
|
-
export function ucs2length(s) {
|
|
7
|
-
let result = 0;
|
|
8
|
-
let length = s.length;
|
|
9
|
-
let index = 0;
|
|
10
|
-
let charCode;
|
|
11
|
-
while (index < length) {
|
|
12
|
-
result++;
|
|
13
|
-
charCode = s.charCodeAt(index++);
|
|
14
|
-
if (charCode >= 0xd800 && charCode <= 0xdbff && index < length) {
|
|
15
|
-
// high surrogate, and there is a next character
|
|
16
|
-
charCode = s.charCodeAt(index);
|
|
17
|
-
if ((charCode & 0xfc00) == 0xdc00) {
|
|
18
|
-
// low surrogate
|
|
19
|
-
index++;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|