@atproto/api 0.0.5 → 0.0.6
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/index.js +54 -2
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
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
|
+
};
|
|
8
11
|
var __export = (target, all) => {
|
|
9
12
|
for (var name in all)
|
|
10
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -23,6 +26,55 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
|
|
|
23
26
|
));
|
|
24
27
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
25
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
|
+
|
|
26
78
|
// src/index.ts
|
|
27
79
|
var src_exports = {};
|
|
28
80
|
__export(src_exports, {
|
|
@@ -3393,6 +3445,7 @@ var LexiconDefNotFoundError = class extends Error {
|
|
|
3393
3445
|
};
|
|
3394
3446
|
|
|
3395
3447
|
// ../lexicon/src/validators/primitives.ts
|
|
3448
|
+
var import_iso_datestring_validator = __toESM(require_dist());
|
|
3396
3449
|
function validate(lexicons2, path, def, value) {
|
|
3397
3450
|
switch (def.type) {
|
|
3398
3451
|
case "boolean":
|
|
@@ -3580,8 +3633,7 @@ function datetime(lexicons2, path, def, value) {
|
|
|
3580
3633
|
}
|
|
3581
3634
|
{
|
|
3582
3635
|
try {
|
|
3583
|
-
|
|
3584
|
-
if (value !== date.toISOString()) {
|
|
3636
|
+
if (typeof value !== "string" || !(0, import_iso_datestring_validator.isValidISODateString)(value)) {
|
|
3585
3637
|
throw new ValidationError(
|
|
3586
3638
|
`${path} must be an iso8601 formatted datetime`
|
|
3587
3639
|
);
|