@atproto/syntax 0.4.2 → 0.5.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.
- package/CHANGELOG.md +32 -0
- package/LICENSE.txt +1 -1
- package/dist/at-identifier.d.ts +1 -0
- package/dist/at-identifier.d.ts.map +1 -1
- package/dist/at-identifier.js +9 -0
- package/dist/at-identifier.js.map +1 -1
- package/dist/aturi.d.ts +8 -0
- package/dist/aturi.d.ts.map +1 -1
- package/dist/aturi.js +31 -40
- package/dist/aturi.js.map +1 -1
- package/dist/aturi_validation.d.ts +3 -2
- package/dist/aturi_validation.d.ts.map +1 -1
- package/dist/aturi_validation.js +13 -3
- package/dist/aturi_validation.js.map +1 -1
- package/dist/datetime.d.ts +128 -11
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +205 -79
- package/dist/datetime.js.map +1 -1
- package/dist/did.d.ts +3 -2
- package/dist/did.d.ts.map +1 -1
- package/dist/did.js +18 -13
- package/dist/did.js.map +1 -1
- package/dist/handle.d.ts +4 -3
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +9 -9
- package/dist/handle.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/dist/language.d.ts +18 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +30 -0
- package/dist/language.js.map +1 -0
- package/dist/nsid.d.ts +4 -4
- package/dist/nsid.d.ts.map +1 -1
- package/dist/nsid.js +9 -11
- package/dist/nsid.js.map +1 -1
- package/dist/recordkey.d.ts +2 -2
- package/dist/recordkey.d.ts.map +1 -1
- package/dist/recordkey.js +10 -10
- package/dist/recordkey.js.map +1 -1
- package/dist/tid.d.ts +2 -2
- package/dist/tid.d.ts.map +1 -1
- package/dist/tid.js +5 -5
- package/dist/tid.js.map +1 -1
- package/dist/uri.d.ts +3 -0
- package/dist/uri.d.ts.map +1 -0
- package/dist/uri.js +7 -0
- package/dist/uri.js.map +1 -0
- package/package.json +7 -4
- package/src/at-identifier.ts +12 -1
- package/src/aturi.ts +30 -1
- package/src/aturi_validation.ts +20 -4
- package/src/datetime.ts +271 -92
- package/src/did.ts +25 -15
- package/src/handle.ts +17 -13
- package/src/index.ts +7 -5
- package/src/language.ts +39 -0
- package/src/nsid.ts +13 -7
- package/src/recordkey.ts +14 -12
- package/src/tid.ts +7 -5
- package/src/uri.ts +5 -0
- package/tests/aturi.test.ts +50 -2
- package/tests/datetime.test.ts +148 -61
- package/tests/did.test.ts +1 -0
- package/tests/handle.test.ts +1 -0
- package/tests/language.test.ts +88 -0
- package/tests/nsid.test.ts +1 -0
- package/tests/recordkey.test.ts +1 -0
- package/tests/tid.test.ts +1 -0
- package/tsconfig.build.json +5 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.json +6 -4
- package/vitest.config.ts +5 -0
- package/jest.config.js +0 -7
- package/tsconfig.tests.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atproto/syntax
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove global `Date.toISOString()` overload and replace with more accurate, less permissive, `AtprotoDate` interface. This change prevent using any `Date` instance to generate a `DatetimeString`, since some JS dates can actually not be safely stringified to a `DatetimeString`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add type safe accessors to read and write `AtUri`'s `did`, `collection` and `rkey` properties
|
|
12
|
+
|
|
13
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Test `ensureValidDatetime`, `isValidDatetime` and `normalizeDatetime` individually, for expected failures.
|
|
14
|
+
|
|
15
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow calling `DatetimeString` validation utilities with `unknown` values (instead of only `string`)
|
|
16
|
+
|
|
17
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Preserve input type when normalizing a valid `HandleString`
|
|
18
|
+
|
|
19
|
+
- [#4688](https://github.com/bluesky-social/atproto/pull/4688) [`52834ab`](https://github.com/bluesky-social/atproto/commit/52834aba182da8df3611fd9dff924e6c6a3973a7) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Minor optimization in regex based NSID string validation
|
|
20
|
+
|
|
21
|
+
- [#4689](https://github.com/bluesky-social/atproto/pull/4689) [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Improve type strictness of `NSID`'s `authority` and `toString()` properties
|
|
22
|
+
|
|
23
|
+
## 0.4.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [#4571](https://github.com/bluesky-social/atproto/pull/4571) [`99963d0`](https://github.com/bluesky-social/atproto/commit/99963d002a9e030e79aed5fba700e0a68f31e101) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add new `isValidAtUri` utility
|
|
28
|
+
|
|
29
|
+
- [#4571](https://github.com/bluesky-social/atproto/pull/4571) [`99963d0`](https://github.com/bluesky-social/atproto/commit/99963d002a9e030e79aed5fba700e0a68f31e101) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `isValidUri` utility
|
|
30
|
+
|
|
31
|
+
- [#4571](https://github.com/bluesky-social/atproto/pull/4571) [`99963d0`](https://github.com/bluesky-social/atproto/commit/99963d002a9e030e79aed5fba700e0a68f31e101) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Improve typing of type assertion utilities
|
|
32
|
+
|
|
33
|
+
- [#4571](https://github.com/bluesky-social/atproto/pull/4571) [`99963d0`](https://github.com/bluesky-social/atproto/commit/99963d002a9e030e79aed5fba700e0a68f31e101) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add BCP47 language validation and parsing utilities
|
|
34
|
+
|
|
3
35
|
## 0.4.2
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Dual MIT/Apache-2.0 License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022-
|
|
3
|
+
Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
|
|
4
4
|
|
|
5
5
|
Except as otherwise noted in individual files, this software is licensed under the MIT license (<http://opensource.org/licenses/MIT>), or the Apache License, Version 2.0 (<http://www.apache.org/licenses/LICENSE-2.0>).
|
|
6
6
|
|
package/dist/at-identifier.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import { DidString } from './did.js';
|
|
|
2
2
|
import { HandleString } from './handle.js';
|
|
3
3
|
export type AtIdentifierString = DidString | HandleString;
|
|
4
4
|
export declare function ensureValidAtIdentifier(input: string): asserts input is AtIdentifierString;
|
|
5
|
+
export declare function isValidAtIdentifier<I extends string>(input: I): input is I & AtIdentifierString;
|
|
5
6
|
//# sourceMappingURL=at-identifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"at-identifier.d.ts","sourceRoot":"","sources":["../src/at-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"at-identifier.d.ts","sourceRoot":"","sources":["../src/at-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmC,MAAM,UAAU,CAAA;AACrE,OAAO,EACL,YAAY,EAIb,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAA;AAEzD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,kBAAkB,CAUrC;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,KAAK,EAAE,CAAC,GACP,KAAK,IAAI,CAAC,GAAG,kBAAkB,CAMjC"}
|
package/dist/at-identifier.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureValidAtIdentifier = ensureValidAtIdentifier;
|
|
4
|
+
exports.isValidAtIdentifier = isValidAtIdentifier;
|
|
4
5
|
const did_js_1 = require("./did.js");
|
|
5
6
|
const handle_js_1 = require("./handle.js");
|
|
6
7
|
function ensureValidAtIdentifier(input) {
|
|
@@ -16,4 +17,12 @@ function ensureValidAtIdentifier(input) {
|
|
|
16
17
|
throw new handle_js_1.InvalidHandleError('Invalid DID or handle', { cause });
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
function isValidAtIdentifier(input) {
|
|
21
|
+
if (input.startsWith('did:')) {
|
|
22
|
+
return (0, did_js_1.isValidDid)(input);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return (0, handle_js_1.isValidHandle)(input);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
19
28
|
//# sourceMappingURL=at-identifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"at-identifier.js","sourceRoot":"","sources":["../src/at-identifier.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"at-identifier.js","sourceRoot":"","sources":["../src/at-identifier.ts"],"names":[],"mappings":";;AAUA,0DAYC;AAED,kDAQC;AAhCD,qCAAqE;AACrE,2CAKoB;AAIpB,SAAgB,uBAAuB,CACrC,KAAa;IAEb,IAAI,CAAC;QACH,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,IAAA,4BAAmB,EAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,IAAA,kCAAsB,EAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,8BAAkB,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAClE,CAAC;AACH,CAAC;AAED,SAAgB,mBAAmB,CACjC,KAAQ;IAER,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAA,mBAAU,EAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,yBAAa,EAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC","sourcesContent":["import { DidString, ensureValidDidRegex, isValidDid } from './did.js'\nimport {\n HandleString,\n InvalidHandleError,\n ensureValidHandleRegex,\n isValidHandle,\n} from './handle.js'\n\nexport type AtIdentifierString = DidString | HandleString\n\nexport function ensureValidAtIdentifier(\n input: string,\n): asserts input is AtIdentifierString {\n try {\n if (input.startsWith('did:')) {\n ensureValidDidRegex(input)\n } else {\n ensureValidHandleRegex(input)\n }\n } catch (cause) {\n throw new InvalidHandleError('Invalid DID or handle', { cause })\n }\n}\n\nexport function isValidAtIdentifier<I extends string>(\n input: I,\n): input is I & AtIdentifierString {\n if (input.startsWith('did:')) {\n return isValidDid(input)\n } else {\n return isValidHandle(input)\n }\n}\n"]}
|
package/dist/aturi.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AtIdentifierString } from './at-identifier.js';
|
|
2
2
|
import { AtUriString } from './aturi_validation.js';
|
|
3
|
+
import { DidString } from './did.js';
|
|
4
|
+
import { NsidString } from './nsid.js';
|
|
5
|
+
import { RecordKeyString } from './recordkey.js';
|
|
3
6
|
export * from './aturi_validation.js';
|
|
4
7
|
export declare const ATP_URI_REGEX: RegExp;
|
|
5
8
|
export declare class AtUri {
|
|
@@ -11,14 +14,19 @@ export declare class AtUri {
|
|
|
11
14
|
static make(handleOrDid: string, collection?: string, rkey?: string): AtUri;
|
|
12
15
|
get protocol(): string;
|
|
13
16
|
get origin(): `at://did:${string}:${string}` | `at://${string}.${string}`;
|
|
17
|
+
get did(): DidString;
|
|
14
18
|
get hostname(): string;
|
|
15
19
|
set hostname(v: string);
|
|
16
20
|
get search(): string;
|
|
17
21
|
set search(v: string);
|
|
18
22
|
get collection(): string;
|
|
23
|
+
get collectionSafe(): NsidString;
|
|
19
24
|
set collection(v: string);
|
|
25
|
+
unsafelySetCollection(v: string): void;
|
|
20
26
|
get rkey(): string;
|
|
27
|
+
get rkeySafe(): RecordKeyString;
|
|
21
28
|
set rkey(v: string);
|
|
29
|
+
unsafelySetRkey(v: string): void;
|
|
22
30
|
get href(): AtUriString;
|
|
23
31
|
toString(): AtUriString;
|
|
24
32
|
}
|
package/dist/aturi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aturi.d.ts","sourceRoot":"","sources":["../src/aturi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"aturi.d.ts","sourceRoot":"","sources":["../src/aturi.ts"],"names":[],"m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,gBAEP;IAED,QAAQ,IAAI,WAAW;CAexB"}
|
package/dist/aturi.js
CHANGED
|
@@ -1,54 +1,23 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.AtUri = exports.ATP_URI_REGEX = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
18
5
|
const at_identifier_js_1 = require("./at-identifier.js");
|
|
6
|
+
const did_js_1 = require("./did.js");
|
|
19
7
|
const nsid_js_1 = require("./nsid.js");
|
|
20
|
-
|
|
8
|
+
const recordkey_js_1 = require("./recordkey.js");
|
|
9
|
+
tslib_1.__exportStar(require("./aturi_validation.js"), exports);
|
|
21
10
|
exports.ATP_URI_REGEX =
|
|
22
11
|
// proto- --did-------------- --name---------------- --path---- --query-- --hash--
|
|
23
12
|
/^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
|
|
24
13
|
// --path----- --query-- --hash--
|
|
25
14
|
const RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
|
|
26
15
|
class AtUri {
|
|
16
|
+
hash;
|
|
17
|
+
host;
|
|
18
|
+
pathname;
|
|
19
|
+
searchParams;
|
|
27
20
|
constructor(uri, base) {
|
|
28
|
-
Object.defineProperty(this, "hash", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: void 0
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(this, "host", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: void 0
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(this, "pathname", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: void 0
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(this, "searchParams", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true,
|
|
50
|
-
value: void 0
|
|
51
|
-
});
|
|
52
21
|
const parsed = base !== undefined
|
|
53
22
|
? typeof base === 'string'
|
|
54
23
|
? Object.assign(parse(base), parseRelative(uri))
|
|
@@ -74,6 +43,11 @@ class AtUri {
|
|
|
74
43
|
get origin() {
|
|
75
44
|
return `at://${this.host}`;
|
|
76
45
|
}
|
|
46
|
+
get did() {
|
|
47
|
+
const { hostname } = this;
|
|
48
|
+
(0, did_js_1.ensureValidDid)(hostname);
|
|
49
|
+
return hostname;
|
|
50
|
+
}
|
|
77
51
|
get hostname() {
|
|
78
52
|
return this.host;
|
|
79
53
|
}
|
|
@@ -90,8 +64,16 @@ class AtUri {
|
|
|
90
64
|
get collection() {
|
|
91
65
|
return this.pathname.split('/').filter(Boolean)[0] || '';
|
|
92
66
|
}
|
|
67
|
+
get collectionSafe() {
|
|
68
|
+
const { collection } = this;
|
|
69
|
+
(0, nsid_js_1.ensureValidNsid)(collection);
|
|
70
|
+
return collection;
|
|
71
|
+
}
|
|
93
72
|
set collection(v) {
|
|
94
73
|
(0, nsid_js_1.ensureValidNsid)(v);
|
|
74
|
+
this.unsafelySetCollection(v);
|
|
75
|
+
}
|
|
76
|
+
unsafelySetCollection(v) {
|
|
95
77
|
const parts = this.pathname.split('/').filter(Boolean);
|
|
96
78
|
parts[0] = v;
|
|
97
79
|
this.pathname = parts.join('/');
|
|
@@ -99,9 +81,18 @@ class AtUri {
|
|
|
99
81
|
get rkey() {
|
|
100
82
|
return this.pathname.split('/').filter(Boolean)[1] || '';
|
|
101
83
|
}
|
|
84
|
+
get rkeySafe() {
|
|
85
|
+
const { rkey } = this;
|
|
86
|
+
(0, recordkey_js_1.ensureValidRecordKey)(rkey);
|
|
87
|
+
return rkey;
|
|
88
|
+
}
|
|
102
89
|
set rkey(v) {
|
|
90
|
+
(0, recordkey_js_1.ensureValidRecordKey)(v);
|
|
91
|
+
this.unsafelySetRkey(v);
|
|
92
|
+
}
|
|
93
|
+
unsafelySetRkey(v) {
|
|
103
94
|
const parts = this.pathname.split('/').filter(Boolean);
|
|
104
|
-
parts[0]
|
|
95
|
+
parts[0] ||= 'undefined';
|
|
105
96
|
parts[1] = v;
|
|
106
97
|
this.pathname = parts.join('/');
|
|
107
98
|
}
|
package/dist/aturi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aturi.js","sourceRoot":"","sources":["../src/aturi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aturi.js","sourceRoot":"","sources":["../src/aturi.ts"],"names":[],"mappings":";;;;AAAA,yDAAgF;AAEhF,qCAAoD;AACpD,uCAAuD;AACvD,iDAAsE;AAEtE,gEAAqC;AAExB,QAAA,aAAa;AACxB,6FAA6F;AAC7F,iGAAiG,CAAA;AACnG,0DAA0D;AAC1D,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAa,KAAK;IAChB,IAAI,CAAQ;IACZ,IAAI,CAAoB;IACxB,QAA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CAAC;YAClC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;QACnB,CAAC;QACD,OAAO,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,IAAI,EAAiB,CAAA;IAC9D,CAAC;CACF;AA1HD,sBA0HC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,qBAAa,CAOpC,CAAA;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAClB,YAAY,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC5C,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,cAAc,CAKrC,CAAA;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAClB,YAAY,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC5C,CAAA;AACH,CAAC","sourcesContent":["import { AtIdentifierString, ensureValidAtIdentifier } from './at-identifier.js'\nimport { AtUriString } from './aturi_validation.js'\nimport { DidString, ensureValidDid } from './did.js'\nimport { NsidString, ensureValidNsid } from './nsid.js'\nimport { RecordKeyString, ensureValidRecordKey } from './recordkey.js'\n\nexport * from './aturi_validation.js'\n\nexport const ATP_URI_REGEX =\n // proto- --did-------------- --name---------------- --path---- --query-- --hash--\n /^(at:\\/\\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n// --path----- --query-- --hash--\nconst RELATIVE_REGEX = /^(\\/[^?#\\s]*)?(\\?[^#\\s]+)?(#[^\\s]+)?$/i\n\nexport class AtUri {\n hash: string\n host: AtIdentifierString\n pathname: string\n searchParams: URLSearchParams\n\n constructor(uri: string, base?: string | AtUri) {\n const parsed =\n base !== undefined\n ? typeof base === 'string'\n ? Object.assign(parse(base), parseRelative(uri))\n : Object.assign({ host: base.host }, parseRelative(uri))\n : parse(uri)\n\n ensureValidAtIdentifier(parsed.host)\n\n this.hash = parsed.hash ?? ''\n this.host = parsed.host\n this.pathname = parsed.pathname ?? ''\n this.searchParams = parsed.searchParams\n }\n\n static make(handleOrDid: string, collection?: string, rkey?: string) {\n let str = handleOrDid\n if (collection) str += '/' + collection\n if (rkey) str += '/' + rkey\n return new AtUri(str)\n }\n\n get protocol() {\n return 'at:'\n }\n\n get origin() {\n return `at://${this.host}` as const\n }\n\n get did(): DidString {\n const { hostname } = this\n ensureValidDid(hostname)\n return hostname\n }\n\n get hostname() {\n return this.host\n }\n\n set hostname(v: string) {\n ensureValidAtIdentifier(v)\n this.host = v\n }\n\n get search() {\n return this.searchParams.toString()\n }\n\n set search(v: string) {\n this.searchParams = new URLSearchParams(v)\n }\n\n get collection() {\n return this.pathname.split('/').filter(Boolean)[0] || ''\n }\n\n get collectionSafe(): NsidString {\n const { collection } = this\n ensureValidNsid(collection)\n return collection\n }\n\n set collection(v: string) {\n ensureValidNsid(v)\n this.unsafelySetCollection(v)\n }\n\n unsafelySetCollection(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n parts[0] = v\n this.pathname = parts.join('/')\n }\n\n get rkey() {\n return this.pathname.split('/').filter(Boolean)[1] || ''\n }\n\n get rkeySafe(): RecordKeyString {\n const { rkey } = this\n ensureValidRecordKey(rkey)\n return rkey\n }\n\n set rkey(v: string) {\n ensureValidRecordKey(v)\n this.unsafelySetRkey(v)\n }\n\n unsafelySetRkey(v: string) {\n const parts = this.pathname.split('/').filter(Boolean)\n parts[0] ||= 'undefined'\n parts[1] = v\n this.pathname = parts.join('/')\n }\n\n get href() {\n return this.toString()\n }\n\n toString(): AtUriString {\n let path = this.pathname || '/'\n if (!path.startsWith('/')) {\n path = `/${path}`\n }\n let qs = ''\n if (this.searchParams.size) {\n qs = `?${this.searchParams.toString()}`\n }\n let hash = this.hash\n if (hash && !hash.startsWith('#')) {\n hash = `#${hash}`\n }\n return `at://${this.host}${path}${qs}${hash}` as AtUriString\n }\n}\n\nfunction parse(str: string) {\n const match = str.match(ATP_URI_REGEX) as null | {\n 0: string\n 1: string | undefined // proto\n 2: string // host\n 3: string | undefined // path\n 4: string | undefined // query\n 5: string | undefined // hash\n }\n\n if (!match) {\n throw new Error(`Invalid AT uri: ${str}`)\n }\n\n return {\n host: match[2],\n hash: match[5],\n pathname: match[3],\n searchParams: new URLSearchParams(match[4]),\n }\n}\n\nfunction parseRelative(str: string) {\n const match = str.match(RELATIVE_REGEX) as null | {\n 0: string\n 1: string | undefined // path\n 2: string | undefined // query\n 3: string | undefined // hash\n }\n\n if (!match) {\n throw new Error(`Invalid path: ${str}`)\n }\n\n return {\n hash: match[3],\n pathname: match[1],\n searchParams: new URLSearchParams(match[2]),\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AtIdentifierString } from './at-identifier.js';
|
|
2
2
|
import { NsidString } from './nsid.js';
|
|
3
3
|
export type AtUriString = `at://${AtIdentifierString}` | `at://${AtIdentifierString}/${NsidString}` | `at://${AtIdentifierString}/${NsidString}/${string}`;
|
|
4
|
-
export declare function ensureValidAtUri(input:
|
|
5
|
-
export declare function ensureValidAtUriRegex(
|
|
4
|
+
export declare function ensureValidAtUri<I extends string>(input: I): asserts input is I & AtUriString;
|
|
5
|
+
export declare function ensureValidAtUriRegex<I extends string>(input: I): asserts input is I & AtUriString;
|
|
6
|
+
export declare function isValidAtUri<I extends string>(input: I): input is I & AtUriString;
|
|
6
7
|
//# sourceMappingURL=aturi_validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aturi_validation.d.ts","sourceRoot":"","sources":["../src/aturi_validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAA;AAGhF,OAAO,EAAE,UAAU,EAAe,MAAM,WAAW,CAAA;AAEnD,MAAM,MAAM,WAAW,GACnB,QAAQ,kBAAkB,EAAE,GAC5B,QAAQ,kBAAkB,IAAI,UAAU,EAAE,GAC1C,QAAQ,kBAAkB,IAAI,UAAU,IAAI,MAAM,EAAE,CAAA;AAgBxD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"aturi_validation.d.ts","sourceRoot":"","sources":["../src/aturi_validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAA;AAGhF,OAAO,EAAE,UAAU,EAAe,MAAM,WAAW,CAAA;AAEnD,MAAM,MAAM,WAAW,GACnB,QAAQ,kBAAkB,EAAE,GAC5B,QAAQ,kBAAkB,IAAI,UAAU,EAAE,GAC1C,QAAQ,kBAAkB,IAAI,UAAU,IAAI,MAAM,EAAE,CAAA;AAgBxD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,KAAK,EAAE,CAAC,GACP,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,WAAW,CAiFlC;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,CAAC,GACP,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,WAAW,CA4BlC;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,KAAK,EAAE,CAAC,GACP,KAAK,IAAI,CAAC,GAAG,WAAW,CAQ1B"}
|
package/dist/aturi_validation.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureValidAtUri = ensureValidAtUri;
|
|
4
4
|
exports.ensureValidAtUriRegex = ensureValidAtUriRegex;
|
|
5
|
+
exports.isValidAtUri = isValidAtUri;
|
|
5
6
|
const at_identifier_js_1 = require("./at-identifier.js");
|
|
6
7
|
const did_js_1 = require("./did.js");
|
|
7
8
|
const handle_js_1 = require("./handle.js");
|
|
@@ -78,11 +79,11 @@ function ensureValidAtUri(input) {
|
|
|
78
79
|
throw new Error('ATURI path can have at most two parts, and no trailing slash');
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
function ensureValidAtUriRegex(
|
|
82
|
+
function ensureValidAtUriRegex(input) {
|
|
82
83
|
// simple regex to enforce most constraints via just regex and length.
|
|
83
84
|
// hand wrote this regex based on above constraints. whew!
|
|
84
85
|
const aturiRegex = /^at:\/\/(?<authority>[a-zA-Z0-9._:%-]+)(\/(?<collection>[a-zA-Z0-9-.]+)(\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/;
|
|
85
|
-
const rm =
|
|
86
|
+
const rm = input.match(aturiRegex);
|
|
86
87
|
if (!rm || !rm.groups) {
|
|
87
88
|
throw new Error("ATURI didn't validate via regex");
|
|
88
89
|
}
|
|
@@ -101,8 +102,17 @@ function ensureValidAtUriRegex(uri) {
|
|
|
101
102
|
if (groups.collection && !(0, nsid_js_1.isValidNsid)(groups.collection)) {
|
|
102
103
|
throw new Error('ATURI collection path segment must be a valid NSID');
|
|
103
104
|
}
|
|
104
|
-
if (
|
|
105
|
+
if (input.length > 8 * 1024) {
|
|
105
106
|
throw new Error('ATURI is far too long');
|
|
106
107
|
}
|
|
107
108
|
}
|
|
109
|
+
function isValidAtUri(input) {
|
|
110
|
+
try {
|
|
111
|
+
ensureValidAtUriRegex(input);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
108
118
|
//# sourceMappingURL=aturi_validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aturi_validation.js","sourceRoot":"","sources":["../src/aturi_validation.ts"],"names":[],"mappings":";;AAwBA,
|
|
1
|
+
{"version":3,"file":"aturi_validation.js","sourceRoot":"","sources":["../src/aturi_validation.ts"],"names":[],"mappings":";;AAwBA,4CAmFC;AAED,sDA8BC;AAED,oCAUC;AAvJD,yDAAgF;AAChF,qCAA8C;AAC9C,2CAAoD;AACpD,uCAAmD;AAOnD,uCAAuC;AACvC,+DAA+D;AAC/D,oCAAoC;AACpC,6EAA6E;AAC7E,wBAAwB;AACxB,sDAAsD;AACtD,iFAAiF;AACjF,kEAAkE;AAClE,8EAA8E;AAC9E,+HAA+H;AAC/H,0CAA0C;AAC1C,0CAA0C;AAC1C,wGAAwG;AAExG,SAAgB,gBAAgB,CAC9B,KAAQ;IAER,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACxC,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,UAAU,CAAC,aAAa,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;QAC1E,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;QAC5E,CAAC;QAED,4EAA4E;QAC5E,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAA;QAC/C,IAAI,CA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ACnC,KAAQ;IAER,sEAAsE;IACtE,0DAA0D;IAC1D,MAAM,UAAU,GACd,gLAAgL,CAAA;IAClL,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAClC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;IACD,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAA;IAExB,IAAI,CAAC;QACH,IAAA,kCAAsB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,IAAA,4BAAmB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,IAAA,qBAAW,EAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC;AAED,SAAgB,YAAY,CAC1B,KAAQ;IAER,IAAI,CAAC;QACH,qBAAqB,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { AtIdentifierString, ensureValidAtIdentifier } from './at-identifier.js'\nimport { ensureValidDidRegex } from './did.js'\nimport { ensureValidHandleRegex } from './handle.js'\nimport { NsidString, isValidNsid } from './nsid.js'\n\nexport type AtUriString =\n | `at://${AtIdentifierString}`\n | `at://${AtIdentifierString}/${NsidString}`\n | `at://${AtIdentifierString}/${NsidString}/${string}`\n\n// Human-readable constraints on ATURI:\n// - following regular URLs, a 8KByte hard total length limit\n// - follows ATURI docs on website\n// - all ASCII characters, no whitespace. non-ASCII could be URL-encoded\n// - starts \"at://\"\n// - \"authority\" is a valid DID or a valid handle\n// - optionally, follow \"authority\" with \"/\" and valid NSID as start of path\n// - optionally, if NSID given, follow that with \"/\" and rkey\n// - rkey path component can include URL-encoded (\"percent encoded\"), or:\n// ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\" / \":\" / \"@\" / \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\" / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n// [a-zA-Z0-9._~:@!$&'\\(\\)*+,;=-]\n// - rkey must have at least one char\n// - regardless of path component, a fragment can follow as \"#\" and then a JSON pointer (RFC-6901)\n\nexport function ensureValidAtUri<I extends string>(\n input: I,\n): asserts input is I & AtUriString {\n const fragmentIndex = input.indexOf('#')\n if (fragmentIndex !== -1) {\n if (input.charCodeAt(fragmentIndex + 1) !== 47) {\n throw new Error('ATURI fragment must be non-empty and start with slash')\n }\n if (input.includes('#', fragmentIndex + 1)) {\n throw new Error('ATURI can have at most one \"#\", separating fragment out')\n }\n\n // NOTE: enforcing *some* checks here for sanity. Eg, at least no whitespace\n const fragment = input.slice(fragmentIndex + 1)\n if (!/^\\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\\]/-]*$/.test(fragment)) {\n throw new Error('Disallowed characters in ATURI fragment (ASCII)')\n }\n }\n\n const uri = fragmentIndex === -1 ? input : input.slice(0, fragmentIndex)\n\n if (uri.length > 8 * 1024) {\n throw new Error('ATURI is far too long')\n }\n\n if (!uri.startsWith('at://')) {\n throw new Error('ATURI must start with \"at://\"')\n }\n\n // check that all chars are boring ASCII\n if (!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(uri)) {\n throw new Error('Disallowed characters in ATURI (ASCII)')\n }\n\n const authorityEnd = uri.indexOf('/', 5)\n const authority =\n authorityEnd === -1 ? uri.slice(5) : uri.slice(5, authorityEnd)\n try {\n ensureValidAtIdentifier(authority)\n } catch (cause) {\n throw new Error('ATURI authority must be a valid handle or DID', { cause })\n }\n\n const collectionStart = authorityEnd === -1 ? -1 : authorityEnd + 1\n const collectionEnd =\n collectionStart === -1 ? -1 : uri.indexOf('/', collectionStart)\n\n if (collectionStart !== -1) {\n const collection =\n collectionEnd === -1\n ? uri.slice(collectionStart)\n : uri.slice(collectionStart, collectionEnd)\n\n if (collection.length === 0) {\n throw new Error(\n 'ATURI can not have a slash after authority without a path segment',\n )\n }\n if (!isValidNsid(collection)) {\n throw new Error(\n 'ATURI requires first path segment (if supplied) to be valid NSID',\n )\n }\n }\n\n const recordKeyStart = collectionEnd === -1 ? -1 : collectionEnd + 1\n const recordKeyEnd =\n recordKeyStart === -1 ? -1 : uri.indexOf('/', recordKeyStart)\n\n if (recordKeyStart !== -1) {\n if (recordKeyStart === uri.length) {\n throw new Error(\n 'ATURI can not have a slash after collection, unless record key is provided',\n )\n }\n // would validate rkey here, but there are basically no constraints!\n }\n\n if (recordKeyEnd !== -1) {\n throw new Error(\n 'ATURI path can have at most two parts, and no trailing slash',\n )\n }\n}\n\nexport function ensureValidAtUriRegex<I extends string>(\n input: I,\n): asserts input is I & AtUriString {\n // simple regex to enforce most constraints via just regex and length.\n // hand wrote this regex based on above constraints. whew!\n const aturiRegex =\n /^at:\\/\\/(?<authority>[a-zA-Z0-9._:%-]+)(\\/(?<collection>[a-zA-Z0-9-.]+)(\\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\\/[a-zA-Z0-9._~:@!$&%')(*+,;=\\-[\\]/\\\\]*))?$/\n const rm = input.match(aturiRegex)\n if (!rm || !rm.groups) {\n throw new Error(\"ATURI didn't validate via regex\")\n }\n const groups = rm.groups\n\n try {\n ensureValidHandleRegex(groups.authority)\n } catch {\n try {\n ensureValidDidRegex(groups.authority)\n } catch {\n throw new Error('ATURI authority must be a valid handle or DID')\n }\n }\n\n if (groups.collection && !isValidNsid(groups.collection)) {\n throw new Error('ATURI collection path segment must be a valid NSID')\n }\n\n if (input.length > 8 * 1024) {\n throw new Error('ATURI is far too long')\n }\n}\n\nexport function isValidAtUri<I extends string>(\n input: I,\n): input is I & AtUriString {\n try {\n ensureValidAtUriRegex(input)\n } catch {\n return false\n }\n\n return true\n}\n"]}
|
package/dist/datetime.d.ts
CHANGED
|
@@ -1,14 +1,131 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function ensureValidDatetime(dtStr: string): asserts dtStr is DatetimeString;
|
|
9
|
-
export declare function isValidDatetime(dtStr: string): dtStr is DatetimeString;
|
|
10
|
-
export declare function normalizeDatetime(dtStr: string): DatetimeString;
|
|
11
|
-
export declare const normalizeDatetimeAlways: (dtStr: string) => DatetimeString;
|
|
1
|
+
/**
|
|
2
|
+
* Indicates a date or string is not a valid representation of a datetime
|
|
3
|
+
* according to the atproto
|
|
4
|
+
* {@link https://atproto.com/specs/lexicon#datetime specification}.
|
|
5
|
+
*/
|
|
12
6
|
export declare class InvalidDatetimeError extends Error {
|
|
13
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* A subset of {@link DatetimeString} that represent valid datetime strings with
|
|
10
|
+
* the format: `YYYY-MM-DDTHH:mm:ss.sssZ`, as returned by `Date.toISOString()
|
|
11
|
+
* for dates between the years 0000 and 9999.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString}
|
|
14
|
+
*/
|
|
15
|
+
export type ISODatetimeString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}Z`;
|
|
16
|
+
/**
|
|
17
|
+
* Represents a {@link Date} that can be safely stringified into a valid atproto
|
|
18
|
+
* {@link DatetimeString} using the {@link Date.toISOString toISOString()}
|
|
19
|
+
* method.
|
|
20
|
+
*/
|
|
21
|
+
export interface AtprotoDate extends Date {
|
|
22
|
+
toISOString(): ISODatetimeString;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @see {@link AtprotoDate}
|
|
26
|
+
*/
|
|
27
|
+
export declare function assertAtprotoDate(date: Date): asserts date is AtprotoDate;
|
|
28
|
+
/**
|
|
29
|
+
* @see {@link AtprotoDate}
|
|
30
|
+
*/
|
|
31
|
+
export declare function asAtprotoDate(date: Date): AtprotoDate;
|
|
32
|
+
/**
|
|
33
|
+
* @see {@link AtprotoDate}
|
|
34
|
+
*/
|
|
35
|
+
export declare function isAtprotoDate(date: Date): date is AtprotoDate;
|
|
36
|
+
/**
|
|
37
|
+
* @see {@link AtprotoDate}
|
|
38
|
+
*/
|
|
39
|
+
export declare function ifAtprotoDate(date: Date): AtprotoDate | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Datetime strings in atproto data structures and API calls should meet the
|
|
42
|
+
* {@link https://ijmacd.github.io/rfc3339-iso8601/ intersecting} requirements
|
|
43
|
+
* of the RFC 3339, ISO 8601, and WHATWG HTML datetime standards.
|
|
44
|
+
*
|
|
45
|
+
* @note This literal template type is not accurate enough to ensure that a
|
|
46
|
+
* string is a valid atproto datetime. The {@link DatetimeString} validation
|
|
47
|
+
* functions ({@link assertDatetimeString}, {@link isDatetimeString}, etc)
|
|
48
|
+
* should be used to validate that a string meets the atproto datetime
|
|
49
|
+
* requirements, and the {@link toDatetimeString} function should be used to
|
|
50
|
+
* convert a {@link Date} object into a valid {@link DatetimeString} string.
|
|
51
|
+
*
|
|
52
|
+
* @example "2024-01-15T12:30:00Z"
|
|
53
|
+
* @example "2024-01-15T12:30:00.000Z"
|
|
54
|
+
* @example "2024-01-15T12:30:00+00:00"
|
|
55
|
+
* @example "2024-01-15T11:30:00-01:00"
|
|
56
|
+
* @see {@link https://atproto.com/specs/lexicon#datetime atproto Lexicon datetime format}
|
|
57
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc3339 RFC 3339}
|
|
58
|
+
* @see {@link https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601}
|
|
59
|
+
*/
|
|
60
|
+
export type DatetimeString = `${string}-${string}-${string}T${string}:${string}:${string}Z` | `${string}-${string}-${string}T${string}:${string}:${string}${'+' | '-'}${string}:${string}`;
|
|
61
|
+
/**
|
|
62
|
+
* Validates that a string is a valid {@link DatetimeString} format string,
|
|
63
|
+
* throwing an error if it is not.
|
|
64
|
+
*
|
|
65
|
+
* @throws InvalidDatetimeError if the input string does not meet the atproto 'datetime' format requirements.
|
|
66
|
+
* @see {@link DatetimeString}
|
|
67
|
+
*/
|
|
68
|
+
export declare function assertDatetimeString<I>(input: I): asserts input is I & DatetimeString;
|
|
69
|
+
/**
|
|
70
|
+
* Casts a string to a {@link DatetimeString} if it is a valid datetime format
|
|
71
|
+
* string, throwing an error if it is not.
|
|
72
|
+
*
|
|
73
|
+
* @throws InvalidDatetimeError if the input string does not meet the atproto 'datetime' format requirements.
|
|
74
|
+
* @see {@link DatetimeString}
|
|
75
|
+
*/
|
|
76
|
+
export declare function asDatetimeString<I>(input: I): I & DatetimeString;
|
|
77
|
+
/**
|
|
78
|
+
* Checks if a string is a valid {@link DatetimeString} format string.
|
|
79
|
+
*
|
|
80
|
+
* @see {@link DatetimeString}
|
|
81
|
+
*/
|
|
82
|
+
export declare function isDatetimeString<I>(input: I): input is I & DatetimeString;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the input if it is a valid {@link DatetimeString} format string, or
|
|
85
|
+
* `undefined` if it is not.
|
|
86
|
+
*
|
|
87
|
+
* @see {@link DatetimeString}
|
|
88
|
+
*/
|
|
89
|
+
export declare function ifDatetimeString<I>(input: I): undefined | (I & DatetimeString);
|
|
90
|
+
/**
|
|
91
|
+
* Returns the current date and time as a {@link DatetimeString}.
|
|
92
|
+
*
|
|
93
|
+
* @see {@link DatetimeString}
|
|
94
|
+
*/
|
|
95
|
+
export declare function currentDatetimeString(): DatetimeString;
|
|
96
|
+
/**
|
|
97
|
+
* Converts any {@link Date} into a {@link DatetimeString} if possible, throwing
|
|
98
|
+
* an error if the date is not a valid atproto datetime.
|
|
99
|
+
*
|
|
100
|
+
* This is short-hand for `asAtprotoDate(date).toISOString()`.
|
|
101
|
+
*
|
|
102
|
+
* @throws InvalidDatetimeError if the input date is not a valid atproto datetime (eg, it is too far in the future or past, or it normalizes to a negative year).
|
|
103
|
+
* @see {@link DatetimeString}
|
|
104
|
+
*/
|
|
105
|
+
export declare function toDatetimeString(date: Date): DatetimeString;
|
|
106
|
+
/**
|
|
107
|
+
* Takes a flexible datetime string and normalizes its representation.
|
|
108
|
+
*
|
|
109
|
+
* This function will work with any valid value that can be parsed as a date. It
|
|
110
|
+
* *additionally* is more flexible about accepting datetimes that are missing
|
|
111
|
+
* timezone information, and normalizing them to a valid atproto datetime.
|
|
112
|
+
*
|
|
113
|
+
* One use-case is a consistent, sortable string. Another is to work with older
|
|
114
|
+
* invalid createdAt datetimes.
|
|
115
|
+
*
|
|
116
|
+
* @returns ISODatetimeString - a valid atproto datetime with millisecond precision (3 sub-second digits) and UTC timezone with trailing 'Z' syntax.
|
|
117
|
+
* @throws InvalidDatetimeError - if the input string could not be parsed as a datetime, even with permissive parsing.
|
|
118
|
+
*/
|
|
119
|
+
export declare function normalizeDatetime(dtStr: string): ISODatetimeString;
|
|
120
|
+
/**
|
|
121
|
+
* Variant of {@link normalizeDatetime} which always returns a valid datetime
|
|
122
|
+
* string.
|
|
123
|
+
*
|
|
124
|
+
* If a {@link InvalidDatetimeError} is encountered, returns the UNIX epoch time
|
|
125
|
+
* as a UTC datetime (`1970-01-01T00:00:00.000Z`).
|
|
126
|
+
*
|
|
127
|
+
* @see {@link normalizeDatetime}
|
|
128
|
+
*/
|
|
129
|
+
export declare function normalizeDatetimeAlways(dtStr: string): ISODatetimeString;
|
|
130
|
+
export { assertDatetimeString as ensureValidDatetime, isDatetimeString as isValidDatetime, };
|
|
14
131
|
//# sourceMappingURL=datetime.d.ts.map
|
package/dist/datetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../src/datetime.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../src/datetime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;CAAG;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAE3B,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG,CAAA;AAE1E;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI;IACvC,WAAW,IAAI,iBAAiB,CAAA;CACjC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAKzE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,CAGrD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,WAAW,CAE7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,SAAS,CAEjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,cAAc,GAEtB,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG,GAC9D,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;AAEhG;;;;;;GAM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