@atproto/xrpc 0.0.2 → 0.0.3
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/{src/client.d.ts → client.d.ts} +0 -0
- package/dist/{src/index.d.ts → index.d.ts} +0 -0
- package/dist/index.js +60 -2
- package/dist/index.js.map +4 -4
- package/dist/{src/types.d.ts → types.d.ts} +0 -0
- package/dist/{src/util.d.ts → util.d.ts} +0 -0
- package/package.json +7 -3
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +1 -0
- package/update-pkg.js +14 -0
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
File without changes
|
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod2) => function __require() {
|
|
9
|
+
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
|
|
10
|
+
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
8
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,8 +20,61 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
20
|
}
|
|
16
21
|
return to;
|
|
17
22
|
};
|
|
23
|
+
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
24
|
+
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
25
|
+
mod2
|
|
26
|
+
));
|
|
18
27
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
19
28
|
|
|
29
|
+
// ../../node_modules/iso-datestring-validator/dist/index.js
|
|
30
|
+
var require_dist = __commonJS({
|
|
31
|
+
"../../node_modules/iso-datestring-validator/dist/index.js"(exports) {
|
|
32
|
+
(() => {
|
|
33
|
+
"use strict";
|
|
34
|
+
var e = { d: (t2, r2) => {
|
|
35
|
+
for (var n2 in r2)
|
|
36
|
+
e.o(r2, n2) && !e.o(t2, n2) && Object.defineProperty(t2, n2, { enumerable: true, get: r2[n2] });
|
|
37
|
+
}, o: (e2, t2) => Object.prototype.hasOwnProperty.call(e2, t2), r: (e2) => {
|
|
38
|
+
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
|
|
39
|
+
} }, t = {};
|
|
40
|
+
function r(e2, t2) {
|
|
41
|
+
return void 0 === t2 && (t2 = "-"), new RegExp("^(?!0{4}" + t2 + "0{2}" + t2 + "0{2})((?=[0-9]{4}" + t2 + "(((0[^2])|1[0-2])|02(?=" + t2 + "(([0-1][0-9])|2[0-8])))" + t2 + "[0-9]{2})|(?=((([13579][26])|([2468][048])|(0[48]))0{2})|([0-9]{2}((((0|[2468])[48])|[2468][048])|([13579][26])))" + t2 + "02" + t2 + "29))([0-9]{4})" + t2 + "(?!((0[469])|11)" + t2 + "31)((0[1,3-9]|1[0-2])|(02(?!" + t2 + "3)))" + t2 + "(0[1-9]|[1-2][0-9]|3[0-1])$").test(e2);
|
|
42
|
+
}
|
|
43
|
+
function n(e2) {
|
|
44
|
+
var t2 = /\D/.exec(e2);
|
|
45
|
+
return t2 ? t2[0] : "";
|
|
46
|
+
}
|
|
47
|
+
function i(e2, t2, r2) {
|
|
48
|
+
void 0 === t2 && (t2 = ":"), void 0 === r2 && (r2 = false);
|
|
49
|
+
var i2 = new RegExp("^([0-1]|2(?=([0-3])|4" + t2 + "00))[0-9]" + t2 + "[0-5][0-9](" + t2 + "([0-5]|6(?=0))[0-9])?(.[0-9]{1,9})?$");
|
|
50
|
+
if (!r2 || !/[Z+\-]/.test(e2))
|
|
51
|
+
return i2.test(e2);
|
|
52
|
+
if (/Z$/.test(e2))
|
|
53
|
+
return i2.test(e2.replace("Z", ""));
|
|
54
|
+
var o2 = e2.includes("+"), a2 = e2.split(/[+-]/), u2 = a2[0], d2 = a2[1];
|
|
55
|
+
return i2.test(u2) && function(e3, t3, r3) {
|
|
56
|
+
return void 0 === r3 && (r3 = ":"), new RegExp(t3 ? "^(0(?!(2" + r3 + "4)|0" + r3 + "3)|1(?=([0-1]|2(?=" + r3 + "[04])|[34](?=" + r3 + "0))))([03469](?=" + r3 + "[03])|[17](?=" + r3 + "0)|2(?=" + r3 + "[04])|5(?=" + r3 + "[034])|8(?=" + r3 + "[04]))" + r3 + "([03](?=0)|4(?=5))[05]$" : "^(0(?=[^0])|1(?=[0-2]))([39](?=" + r3 + "[03])|[0-24-8](?=" + r3 + "00))" + r3 + "[03]0$").test(e3);
|
|
57
|
+
}(d2, o2, n(d2));
|
|
58
|
+
}
|
|
59
|
+
function o(e2) {
|
|
60
|
+
var t2 = e2.split("T"), o2 = t2[0], a2 = t2[1], u2 = r(o2, n(o2));
|
|
61
|
+
if (!a2)
|
|
62
|
+
return false;
|
|
63
|
+
var d2, s = (d2 = a2.match(/([^Z+\-\d])(?=\d+\1)/), Array.isArray(d2) ? d2[0] : "");
|
|
64
|
+
return u2 && i(a2, s, true);
|
|
65
|
+
}
|
|
66
|
+
function a(e2, t2) {
|
|
67
|
+
return void 0 === t2 && (t2 = "-"), new RegExp("^[0-9]{4}" + t2 + "(0(?=[^0])|1(?=[0-2]))[0-9]$").test(e2);
|
|
68
|
+
}
|
|
69
|
+
e.r(t), e.d(t, { isValidDate: () => r, isValidISODateString: () => o, isValidTime: () => i, isValidYearMonth: () => a });
|
|
70
|
+
var u = exports;
|
|
71
|
+
for (var d in t)
|
|
72
|
+
u[d] = t[d];
|
|
73
|
+
t.__esModule && Object.defineProperty(u, "__esModule", { value: true });
|
|
74
|
+
})();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
20
78
|
// src/index.ts
|
|
21
79
|
var src_exports = {};
|
|
22
80
|
__export(src_exports, {
|
|
@@ -3296,6 +3354,7 @@ var LexiconDefNotFoundError = class extends Error {
|
|
|
3296
3354
|
};
|
|
3297
3355
|
|
|
3298
3356
|
// ../lexicon/src/validators/primitives.ts
|
|
3357
|
+
var import_iso_datestring_validator = __toESM(require_dist());
|
|
3299
3358
|
function validate(lexicons, path, def, value) {
|
|
3300
3359
|
switch (def.type) {
|
|
3301
3360
|
case "boolean":
|
|
@@ -3483,8 +3542,7 @@ function datetime(lexicons, path, def, value) {
|
|
|
3483
3542
|
}
|
|
3484
3543
|
{
|
|
3485
3544
|
try {
|
|
3486
|
-
|
|
3487
|
-
if (value !== date.toISOString()) {
|
|
3545
|
+
if (typeof value !== "string" || !(0, import_iso_datestring_validator.isValidISODateString)(value)) {
|
|
3488
3546
|
throw new ValidationError(
|
|
3489
3547
|
`${path} must be an iso8601 formatted datetime`
|
|
3490
3548
|
);
|