@atproto/oauth-scopes 0.0.0-spaces-alpha-20260818021221
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 +220 -0
- package/LICENSE.txt +7 -0
- package/dist/atproto-oauth-scope.d.ts +17 -0
- package/dist/atproto-oauth-scope.d.ts.map +1 -0
- package/dist/atproto-oauth-scope.js +63 -0
- package/dist/atproto-oauth-scope.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/lexicon.d.ts +26 -0
- package/dist/lib/lexicon.d.ts.map +1 -0
- package/dist/lib/lexicon.js +2 -0
- package/dist/lib/lexicon.js.map +1 -0
- package/dist/lib/mime.d.ts +7 -0
- package/dist/lib/mime.d.ts.map +1 -0
- package/dist/lib/mime.js +61 -0
- package/dist/lib/mime.js.map +1 -0
- package/dist/lib/nsid.d.ts +3 -0
- package/dist/lib/nsid.d.ts.map +1 -0
- package/dist/lib/nsid.js +3 -0
- package/dist/lib/nsid.js.map +1 -0
- package/dist/lib/parser.d.ts +29 -0
- package/dist/lib/parser.d.ts.map +1 -0
- package/dist/lib/parser.js +127 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/resource-permission.d.ts +10 -0
- package/dist/lib/resource-permission.d.ts.map +1 -0
- package/dist/lib/resource-permission.js +2 -0
- package/dist/lib/resource-permission.js.map +1 -0
- package/dist/lib/syntax-lexicon.d.ts +17 -0
- package/dist/lib/syntax-lexicon.d.ts.map +1 -0
- package/dist/lib/syntax-lexicon.js +62 -0
- package/dist/lib/syntax-lexicon.js.map +1 -0
- package/dist/lib/syntax-string.d.ts +16 -0
- package/dist/lib/syntax-string.d.ts.map +1 -0
- package/dist/lib/syntax-string.js +102 -0
- package/dist/lib/syntax-string.js.map +1 -0
- package/dist/lib/syntax.d.ts +24 -0
- package/dist/lib/syntax.d.ts.map +1 -0
- package/dist/lib/syntax.js +22 -0
- package/dist/lib/syntax.js.map +1 -0
- package/dist/lib/util.d.ts +7 -0
- package/dist/lib/util.d.ts.map +1 -0
- package/dist/lib/util.js +15 -0
- package/dist/lib/util.js.map +1 -0
- package/dist/scope-missing-error.d.ts +9 -0
- package/dist/scope-missing-error.d.ts.map +1 -0
- package/dist/scope-missing-error.js +15 -0
- package/dist/scope-missing-error.js.map +1 -0
- package/dist/scope-permissions-transition.d.ts +21 -0
- package/dist/scope-permissions-transition.d.ts.map +1 -0
- package/dist/scope-permissions-transition.js +58 -0
- package/dist/scope-permissions-transition.js.map +1 -0
- package/dist/scope-permissions.d.ts +25 -0
- package/dist/scope-permissions.d.ts.map +1 -0
- package/dist/scope-permissions.js +72 -0
- package/dist/scope-permissions.js.map +1 -0
- package/dist/scopes/account-permission.d.ts +35 -0
- package/dist/scopes/account-permission.d.ts.map +1 -0
- package/dist/scopes/account-permission.js +55 -0
- package/dist/scopes/account-permission.js.map +1 -0
- package/dist/scopes/blob-permission.d.ts +27 -0
- package/dist/scopes/blob-permission.d.ts.map +1 -0
- package/dist/scopes/blob-permission.js +73 -0
- package/dist/scopes/blob-permission.js.map +1 -0
- package/dist/scopes/identity-permission.d.ts +25 -0
- package/dist/scopes/identity-permission.d.ts.map +1 -0
- package/dist/scopes/identity-permission.js +39 -0
- package/dist/scopes/identity-permission.js.map +1 -0
- package/dist/scopes/include-scope.d.ts +55 -0
- package/dist/scopes/include-scope.d.ts.map +1 -0
- package/dist/scopes/include-scope.js +165 -0
- package/dist/scopes/include-scope.js.map +1 -0
- package/dist/scopes/repo-permission.d.ts +40 -0
- package/dist/scopes/repo-permission.d.ts.map +1 -0
- package/dist/scopes/repo-permission.js +81 -0
- package/dist/scopes/repo-permission.js.map +1 -0
- package/dist/scopes/rpc-permission.d.ts +38 -0
- package/dist/scopes/rpc-permission.d.ts.map +1 -0
- package/dist/scopes/rpc-permission.js +59 -0
- package/dist/scopes/rpc-permission.js.map +1 -0
- package/dist/scopes/space-permission.d.ts +111 -0
- package/dist/scopes/space-permission.d.ts.map +1 -0
- package/dist/scopes/space-permission.js +195 -0
- package/dist/scopes/space-permission.js.map +1 -0
- package/dist/scopes-set.d.ts +34 -0
- package/dist/scopes-set.d.ts.map +1 -0
- package/dist/scopes-set.js +102 -0
- package/dist/scopes-set.js.map +1 -0
- package/package.json +43 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# @atproto/oauth-scopes
|
|
2
|
+
|
|
3
|
+
## 0.0.0-spaces-alpha-20260818021221
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5423](https://github.com/bluesky-social/atproto/pull/5423) [`2f77206`](https://github.com/bluesky-social/atproto/commit/2f77206ff8010710db5733c454abff9eb5ebb96b) Thanks [@dholms](https://github.com/dholms)! - atproto spaces
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2f77206`](https://github.com/bluesky-social/atproto/commit/2f77206ff8010710db5733c454abff9eb5ebb96b)]:
|
|
10
|
+
- @atproto/syntax@0.0.0-spaces-alpha-20260818021221
|
|
11
|
+
|
|
12
|
+
## 0.5.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`8b55a4a`](https://github.com/bluesky-social/atproto/commit/8b55a4ab69c24e5038f67c479b3b9953666ea0c2)]:
|
|
17
|
+
- @atproto/syntax@0.7.4
|
|
18
|
+
|
|
19
|
+
## 0.5.8
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#5295](https://github.com/bluesky-social/atproto/pull/5295) [`6a3d607`](https://github.com/bluesky-social/atproto/commit/6a3d6073cb66c527b5b109242049c85c36b9658c) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update vitest dependencies
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`6a3d607`](https://github.com/bluesky-social/atproto/commit/6a3d6073cb66c527b5b109242049c85c36b9658c)]:
|
|
26
|
+
- @atproto/syntax@0.7.3
|
|
27
|
+
|
|
28
|
+
## 0.5.7
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [#5280](https://github.com/bluesky-social/atproto/pull/5280) [`9556dcb`](https://github.com/bluesky-social/atproto/commit/9556dcb5855a1a1b9a2dc119e0fd4abbb8b27198) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update test runner from `jest` to `vitest`
|
|
33
|
+
|
|
34
|
+
## 0.5.6
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`9e1da84`](https://github.com/bluesky-social/atproto/commit/9e1da84cc00a1cc5b453705539a2766403f3ee55)]:
|
|
39
|
+
- @atproto/syntax@0.7.2
|
|
40
|
+
|
|
41
|
+
## 0.5.5
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [#5197](https://github.com/bluesky-social/atproto/pull/5197) [`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rewrite import statements to be compatible with TypeScript's `verbatimModuleSyntax` config.
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [[`a0c49d9`](https://github.com/bluesky-social/atproto/commit/a0c49d9e8bc685c5a747a8d3b2775c73c63fdb6f)]:
|
|
48
|
+
- @atproto/syntax@0.7.1
|
|
49
|
+
- @atproto/did@0.5.4
|
|
50
|
+
|
|
51
|
+
## 0.5.4
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [[`d1be0ce`](https://github.com/bluesky-social/atproto/commit/d1be0cead444ef95e64cac5ea5318edbec9d8112), [`d79f6d5`](https://github.com/bluesky-social/atproto/commit/d79f6d59a073c05cc37bd0d1482beeea482b67ed)]:
|
|
56
|
+
- @atproto/syntax@0.7.0
|
|
57
|
+
|
|
58
|
+
## 0.5.3
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update TypeScript build to rely on references to composite internal projects
|
|
63
|
+
|
|
64
|
+
- [#5099](https://github.com/bluesky-social/atproto/pull/5099) [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Bundle only necessary files in the NPM tarball, including the `CHANGELOG.md` and `README.md` files (if present).
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`28a0b58`](https://github.com/bluesky-social/atproto/commit/28a0b588147863eaef948cd2bb8fc0f19d08cda9), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07), [`b43ec31`](https://github.com/bluesky-social/atproto/commit/b43ec31f247f4461725b01226885f88bd430ca07)]:
|
|
67
|
+
- @atproto/syntax@0.6.4
|
|
68
|
+
- @atproto/did@0.5.3
|
|
69
|
+
|
|
70
|
+
## 0.5.2
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- [#5151](https://github.com/bluesky-social/atproto/pull/5151) [`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Update dependencies
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [[`a51c45d`](https://github.com/bluesky-social/atproto/commit/a51c45d38f6bd7b8765f640e564cf921d52162e7)]:
|
|
77
|
+
- @atproto/did@0.5.2
|
|
78
|
+
- @atproto/syntax@0.6.3
|
|
79
|
+
|
|
80
|
+
## 0.5.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- [#4967](https://github.com/bluesky-social/atproto/pull/4967) [`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use TypeScript 7 to build package
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [[`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5)]:
|
|
87
|
+
- @atproto/syntax@0.6.2
|
|
88
|
+
- @atproto/did@0.5.1
|
|
89
|
+
|
|
90
|
+
## 0.5.0
|
|
91
|
+
|
|
92
|
+
### Minor Changes
|
|
93
|
+
|
|
94
|
+
- [#4992](https://github.com/bluesky-social/atproto/pull/4992) [`622d365`](https://github.com/bluesky-social/atproto/commit/622d365aeb240133f40763a3b1c43981112837fc) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Remove the `AtprotoAudience` and `isAtprotoAudience` re-exports. They are superseded by `AtprotoDidRefAbsolute` and `isAtprotoDidRefAbsolute`, also re-exported from this package.
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [[`622d365`](https://github.com/bluesky-social/atproto/commit/622d365aeb240133f40763a3b1c43981112837fc)]:
|
|
99
|
+
- @atproto/did@0.5.0
|
|
100
|
+
|
|
101
|
+
## 0.4.0
|
|
102
|
+
|
|
103
|
+
### Minor Changes
|
|
104
|
+
|
|
105
|
+
- [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
|
|
106
|
+
|
|
107
|
+
- [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
|
|
108
|
+
|
|
109
|
+
Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
|
|
110
|
+
|
|
111
|
+
- [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0.
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Updated dependencies [[`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
|
|
116
|
+
- @atproto/did@0.4.0
|
|
117
|
+
- @atproto/syntax@0.6.0
|
|
118
|
+
|
|
119
|
+
## 0.3.2
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd), [`52834ab`](https://github.com/bluesky-social/atproto/commit/52834aba182da8df3611fd9dff924e6c6a3973a7), [`f7c2610`](https://github.com/bluesky-social/atproto/commit/f7c26103a6d4e24e5bedbb6fd908be140420e0dd)]:
|
|
124
|
+
- @atproto/syntax@0.5.0
|
|
125
|
+
|
|
126
|
+
## 0.3.1
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [[`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e), [`d54d707`](https://github.com/bluesky-social/atproto/commit/d54d7077eb32041e1f61c312efa1dd0d768c774e)]:
|
|
131
|
+
- @atproto/did@0.3.0
|
|
132
|
+
|
|
133
|
+
## 0.3.0
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- [#4383](https://github.com/bluesky-social/atproto/pull/4383) [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace `@atproto/lexicon` with `@atproto/lex-document`
|
|
138
|
+
|
|
139
|
+
- [#4353](https://github.com/bluesky-social/atproto/pull/4353) [`0adc852`](https://github.com/bluesky-social/atproto/commit/0adc852c31ffa154c1b93e38182c35880ecdb4ba) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use arrays to represent "account" permission's `action` attribute, allowing multiple actions to be specified for that resource.
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- [#4382](https://github.com/bluesky-social/atproto/pull/4382) [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `toScopes()` utility on `IncludeScope`
|
|
144
|
+
|
|
145
|
+
- [#4382](https://github.com/bluesky-social/atproto/pull/4382) [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove ability to define `blob` permission in permission sets
|
|
146
|
+
|
|
147
|
+
- [#4383](https://github.com/bluesky-social/atproto/pull/4383) [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace `@atproto/lexicon-resolver` with `@atproto/lex-resolver`
|
|
148
|
+
|
|
149
|
+
- [#4353](https://github.com/bluesky-social/atproto/pull/4353) [`0adc852`](https://github.com/bluesky-social/atproto/commit/0adc852c31ffa154c1b93e38182c35880ecdb4ba) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow lexicon permission data to be readonly
|
|
150
|
+
|
|
151
|
+
- [#4382](https://github.com/bluesky-social/atproto/pull/4382) [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Disallow `rpc` permissions with specific `aud` in permission-sets
|
|
152
|
+
|
|
153
|
+
- Updated dependencies [[`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`bcae2b7`](https://github.com/bluesky-social/atproto/commit/bcae2b77b68da6dc2ec202651c8bf41fd5769f69), [`d396de0`](https://github.com/bluesky-social/atproto/commit/d396de016d1d55d08cfad1dabd3ffd9eaeea76ea)]:
|
|
154
|
+
- @atproto/did@0.2.3
|
|
155
|
+
- @atproto/syntax@0.4.2
|
|
156
|
+
|
|
157
|
+
## 0.2.2
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [[`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7)]:
|
|
162
|
+
- @atproto/did@0.2.2
|
|
163
|
+
- @atproto/lexicon@0.5.2
|
|
164
|
+
|
|
165
|
+
## 0.2.1
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- Updated dependencies [[`09439d7d6`](https://github.com/bluesky-social/atproto/commit/09439d7d688294ad1a0c78a74b901ba2f7c5f4c3)]:
|
|
170
|
+
- @atproto/did@0.2.1
|
|
171
|
+
|
|
172
|
+
## 0.2.0
|
|
173
|
+
|
|
174
|
+
### Minor Changes
|
|
175
|
+
|
|
176
|
+
- [#4149](https://github.com/bluesky-social/atproto/pull/4149) [`8914f9abd`](https://github.com/bluesky-social/atproto/commit/8914f9abde2059c551d7e4c8d104227986098b82) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Method `authenticateRequest` now returns `SignedTokenPayload`
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- [#4149](https://github.com/bluesky-social/atproto/pull/4149) [`8914f9abd`](https://github.com/bluesky-social/atproto/commit/8914f9abde2059c551d7e4c8d104227986098b82) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add scope normalization utility
|
|
181
|
+
|
|
182
|
+
- Updated dependencies []:
|
|
183
|
+
- @atproto/lexicon@0.5.1
|
|
184
|
+
|
|
185
|
+
## 0.1.0
|
|
186
|
+
|
|
187
|
+
### Minor Changes
|
|
188
|
+
|
|
189
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rework scope parsing utilities to work with Lexicon defined permissions
|
|
190
|
+
|
|
191
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use strict NSID validation. repo & rpc scopes with invalid NSIDs will be rejected.
|
|
192
|
+
|
|
193
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Rename `PermissionSet` to `ScopePermissions`
|
|
194
|
+
|
|
195
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Renaming of "resource" concept to better reflect the fact that not all oauth scope values are about resources
|
|
196
|
+
|
|
197
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Enforce proper formatting of audience (atproto supported did + fragment part)
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Ignore empty string when building a `ScopePermissions`
|
|
202
|
+
|
|
203
|
+
- [#4108](https://github.com/bluesky-social/atproto/pull/4108) [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Export constants and type assertion utilities
|
|
204
|
+
|
|
205
|
+
- Updated dependencies [[`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d), [`f9dc9aa4c`](https://github.com/bluesky-social/atproto/commit/f9dc9aa4c9eaf2f82d140fbf011a9015e7f1a00d)]:
|
|
206
|
+
- @atproto/lexicon@0.5.0
|
|
207
|
+
- @atproto/syntax@0.4.1
|
|
208
|
+
- @atproto/did@0.2.0
|
|
209
|
+
|
|
210
|
+
## 0.0.2
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- [#4097](https://github.com/bluesky-social/atproto/pull/4097) [`c274bd1b3`](https://github.com/bluesky-social/atproto/commit/c274bd1b38813abd5b287f1c94dca1fd62854918) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Fix permission bug with `transition:email` scope
|
|
215
|
+
|
|
216
|
+
## 0.0.1
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- [#3806](https://github.com/bluesky-social/atproto/pull/3806) [`1899b1fc1`](https://github.com/bluesky-social/atproto/commit/1899b1fc16bc5cd7bb930ec697898766c3a05add) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Initial implementation of library used to parse ATProto OAuth scopes
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Dual MIT/Apache-2.0 License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026 Bluesky Social PBC, and Contributors
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ScopeStringFor, isScopeStringFor } from './lib/syntax.js';
|
|
2
|
+
export { type ScopeStringFor, isScopeStringFor };
|
|
3
|
+
export declare const STATIC_SCOPE_VALUES: readonly ["atproto", "transition:email", "transition:generic", "transition:chat.bsky"];
|
|
4
|
+
export type StaticScopeValue = (typeof STATIC_SCOPE_VALUES)[number];
|
|
5
|
+
export declare function isStaticScopeValue(value: string): value is StaticScopeValue;
|
|
6
|
+
export type AtprotoOauthScope = StaticScopeValue | ScopeStringFor<'account'> | ScopeStringFor<'blob'> | ScopeStringFor<'identity'> | ScopeStringFor<'include'> | ScopeStringFor<'repo'> | ScopeStringFor<'rpc'> | ScopeStringFor<'space'>;
|
|
7
|
+
/**
|
|
8
|
+
* @note This function does not only verify the scope string format (with
|
|
9
|
+
* {@link isScopeStringFor}), but also checks if the provided parameters are
|
|
10
|
+
* valid according to the respective scope syntax definition. This allows
|
|
11
|
+
* excluding scopes that cannot be fully interpreted by the current version of
|
|
12
|
+
* the code.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isAtprotoOauthScope(value: string): value is AtprotoOauthScope;
|
|
15
|
+
export declare function normalizeAtprotoOauthScope(scope: string): string;
|
|
16
|
+
export declare function normalizeAtprotoOauthScopeValue(value: string): AtprotoOauthScope | null;
|
|
17
|
+
//# sourceMappingURL=atproto-oauth-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atproto-oauth-scope.d.ts","sourceRoot":"","sources":["../src/atproto-oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAUvE,OAAO,EAAE,KAAK,cAAc,EAAE,gBAAgB,EAAE,CAAA;AAEhD,eAAO,MAAM,mBAAmB,wFAKrB,CAAA;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AACnE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAE3E;AAED,MAAM,MAAM,iBAAiB,GACzB,gBAAgB,GAChB,cAAc,CAAC,SAAS,CAAC,GACzB,cAAc,CAAC,MAAM,CAAC,GACtB,cAAc,CAAC,UAAU,CAAC,GAC1B,cAAc,CAAC,SAAS,CAAC,GACzB,cAAc,CAAC,MAAM,CAAC,GACtB,cAAc,CAAC,KAAK,CAAC,GACrB,cAAc,CAAC,OAAO,CAAC,CAAA;AAE3B;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAW7E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,UAOvD;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,GACZ,iBAAiB,GAAG,IAAI,CAiB1B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isScopeStringFor } from './lib/syntax.js';
|
|
2
|
+
import { isNonNullable } from './lib/util.js';
|
|
3
|
+
import { AccountPermission } from './scopes/account-permission.js';
|
|
4
|
+
import { BlobPermission } from './scopes/blob-permission.js';
|
|
5
|
+
import { IdentityPermission } from './scopes/identity-permission.js';
|
|
6
|
+
import { IncludeScope } from './scopes/include-scope.js';
|
|
7
|
+
import { RepoPermission } from './scopes/repo-permission.js';
|
|
8
|
+
import { RpcPermission } from './scopes/rpc-permission.js';
|
|
9
|
+
import { SpacePermission } from './scopes/space-permission.js';
|
|
10
|
+
export { isScopeStringFor };
|
|
11
|
+
export const STATIC_SCOPE_VALUES = Object.freeze([
|
|
12
|
+
'atproto',
|
|
13
|
+
'transition:email',
|
|
14
|
+
'transition:generic',
|
|
15
|
+
'transition:chat.bsky',
|
|
16
|
+
]);
|
|
17
|
+
export function isStaticScopeValue(value) {
|
|
18
|
+
return STATIC_SCOPE_VALUES.includes(value);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @note This function does not only verify the scope string format (with
|
|
22
|
+
* {@link isScopeStringFor}), but also checks if the provided parameters are
|
|
23
|
+
* valid according to the respective scope syntax definition. This allows
|
|
24
|
+
* excluding scopes that cannot be fully interpreted by the current version of
|
|
25
|
+
* the code.
|
|
26
|
+
*/
|
|
27
|
+
export function isAtprotoOauthScope(value) {
|
|
28
|
+
return (isStaticScopeValue(value) ||
|
|
29
|
+
AccountPermission.fromString(value) != null ||
|
|
30
|
+
BlobPermission.fromString(value) != null ||
|
|
31
|
+
IdentityPermission.fromString(value) != null ||
|
|
32
|
+
IncludeScope.fromString(value) != null ||
|
|
33
|
+
RepoPermission.fromString(value) != null ||
|
|
34
|
+
RpcPermission.fromString(value) != null ||
|
|
35
|
+
SpacePermission.fromString(value) != null);
|
|
36
|
+
}
|
|
37
|
+
export function normalizeAtprotoOauthScope(scope) {
|
|
38
|
+
return scope
|
|
39
|
+
.split(' ')
|
|
40
|
+
.map(normalizeAtprotoOauthScopeValue)
|
|
41
|
+
.filter(isNonNullable)
|
|
42
|
+
.sort()
|
|
43
|
+
.join(' ');
|
|
44
|
+
}
|
|
45
|
+
export function normalizeAtprotoOauthScopeValue(value) {
|
|
46
|
+
if (isStaticScopeValue(value))
|
|
47
|
+
return value;
|
|
48
|
+
for (const Scope of [
|
|
49
|
+
AccountPermission,
|
|
50
|
+
BlobPermission,
|
|
51
|
+
IdentityPermission,
|
|
52
|
+
IncludeScope,
|
|
53
|
+
RepoPermission,
|
|
54
|
+
RpcPermission,
|
|
55
|
+
SpacePermission,
|
|
56
|
+
]) {
|
|
57
|
+
const parsed = Scope.fromString(value);
|
|
58
|
+
if (parsed)
|
|
59
|
+
return parsed.toString();
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=atproto-oauth-scope.js.map
|
|
@@ -0,0 +1 @@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AAa,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QACvC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CAC1C,CAAA;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACtD,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,+BAA+B,CAAC;SACpC,MAAM,CAAC,aAAa,CAAC;SACrB,IAAI,EAAE;SACN,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAa;IAEb,IAAI,kBAAkB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAE3C,KAAK,MAAM,KAAK,IAAI;QAClB,iBAAiB;QACjB,cAAc;QACd,kBAAkB;QAClB,YAAY;QACZ,cAAc;QACd,aAAa;QACb,eAAe;KAChB,EAAE,CAAC;QACF,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACtC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAA;IACtC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { type ScopeStringFor, isScopeStringFor } from './lib/syntax.js'\nimport { isNonNullable } from './lib/util.js'\nimport { AccountPermission } from './scopes/account-permission.js'\nimport { BlobPermission } from './scopes/blob-permission.js'\nimport { IdentityPermission } from './scopes/identity-permission.js'\nimport { IncludeScope } from './scopes/include-scope.js'\nimport { RepoPermission } from './scopes/repo-permission.js'\nimport { RpcPermission } from './scopes/rpc-permission.js'\nimport { SpacePermission } from './scopes/space-permission.js'\n\nexport { type ScopeStringFor, isScopeStringFor }\n\nexport const STATIC_SCOPE_VALUES = Object.freeze([\n 'atproto',\n 'transition:email',\n 'transition:generic',\n 'transition:chat.bsky',\n] as const)\n\nexport type StaticScopeValue = (typeof STATIC_SCOPE_VALUES)[number]\nexport function isStaticScopeValue(value: string): value is StaticScopeValue {\n return (STATIC_SCOPE_VALUES as readonly string[]).includes(value)\n}\n\nexport type AtprotoOauthScope =\n | StaticScopeValue\n | ScopeStringFor<'account'>\n | ScopeStringFor<'blob'>\n | ScopeStringFor<'identity'>\n | ScopeStringFor<'include'>\n | ScopeStringFor<'repo'>\n | ScopeStringFor<'rpc'>\n | ScopeStringFor<'space'>\n\n/**\n * @note This function does not only verify the scope string format (with\n * {@link isScopeStringFor}), but also checks if the provided parameters are\n * valid according to the respective scope syntax definition. This allows\n * excluding scopes that cannot be fully interpreted by the current version of\n * the code.\n */\nexport function isAtprotoOauthScope(value: string): value is AtprotoOauthScope {\n return (\n isStaticScopeValue(value) ||\n AccountPermission.fromString(value) != null ||\n BlobPermission.fromString(value) != null ||\n IdentityPermission.fromString(value) != null ||\n IncludeScope.fromString(value) != null ||\n RepoPermission.fromString(value) != null ||\n RpcPermission.fromString(value) != null ||\n SpacePermission.fromString(value) != null\n )\n}\n\nexport function normalizeAtprotoOauthScope(scope: string) {\n return scope\n .split(' ')\n .map(normalizeAtprotoOauthScopeValue)\n .filter(isNonNullable)\n .sort()\n .join(' ')\n}\n\nexport function normalizeAtprotoOauthScopeValue(\n value: string,\n): AtprotoOauthScope | null {\n if (isStaticScopeValue(value)) return value\n\n for (const Scope of [\n AccountPermission,\n BlobPermission,\n IdentityPermission,\n IncludeScope,\n RepoPermission,\n RpcPermission,\n SpacePermission,\n ]) {\n const parsed = Scope.fromString(value)\n if (parsed) return parsed.toString()\n }\n\n return null\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './atproto-oauth-scope.js';
|
|
2
|
+
export * from './scope-missing-error.js';
|
|
3
|
+
export * from './scope-permissions-transition.js';
|
|
4
|
+
export * from './scope-permissions.js';
|
|
5
|
+
export * from './scopes-set.js';
|
|
6
|
+
export * from './scopes/account-permission.js';
|
|
7
|
+
export * from './scopes/blob-permission.js';
|
|
8
|
+
export * from './scopes/identity-permission.js';
|
|
9
|
+
export * from './scopes/include-scope.js';
|
|
10
|
+
export * from './scopes/repo-permission.js';
|
|
11
|
+
export * from './scopes/rpc-permission.js';
|
|
12
|
+
export * from './scopes/space-permission.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AAExC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAE/B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './atproto-oauth-scope.js';
|
|
2
|
+
export * from './scope-missing-error.js';
|
|
3
|
+
export * from './scope-permissions-transition.js';
|
|
4
|
+
export * from './scope-permissions.js';
|
|
5
|
+
export * from './scopes-set.js';
|
|
6
|
+
export * from './scopes/account-permission.js';
|
|
7
|
+
export * from './scopes/blob-permission.js';
|
|
8
|
+
export * from './scopes/identity-permission.js';
|
|
9
|
+
export * from './scopes/include-scope.js';
|
|
10
|
+
export * from './scopes/repo-permission.js';
|
|
11
|
+
export * from './scopes/rpc-permission.js';
|
|
12
|
+
export * from './scopes/space-permission.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AAExC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAE/B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA","sourcesContent":["export * from './atproto-oauth-scope.js'\n\nexport * from './scope-missing-error.js'\nexport * from './scope-permissions-transition.js'\nexport * from './scope-permissions.js'\nexport * from './scopes-set.js'\n\nexport * from './scopes/account-permission.js'\nexport * from './scopes/blob-permission.js'\nexport * from './scopes/identity-permission.js'\nexport * from './scopes/include-scope.js'\nexport * from './scopes/repo-permission.js'\nexport * from './scopes/rpc-permission.js'\nexport * from './scopes/space-permission.js'\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ParamValue } from './syntax.js';
|
|
2
|
+
export type LexiconPermission<P extends string = string> = {
|
|
3
|
+
readonly type: 'permission';
|
|
4
|
+
readonly resource: P;
|
|
5
|
+
readonly [x: string]: undefined | ParamValue | readonly ParamValue[];
|
|
6
|
+
};
|
|
7
|
+
type LangMap = {
|
|
8
|
+
readonly [Lang in string]?: string;
|
|
9
|
+
};
|
|
10
|
+
export type LexiconPermissionSet = {
|
|
11
|
+
readonly type: 'permission-set';
|
|
12
|
+
readonly permissions: readonly LexiconPermission<string>[];
|
|
13
|
+
readonly title?: string;
|
|
14
|
+
readonly 'title:lang'?: LangMap;
|
|
15
|
+
readonly detail?: string;
|
|
16
|
+
readonly 'detail:lang'?: LangMap;
|
|
17
|
+
};
|
|
18
|
+
export type LexiconSpace = {
|
|
19
|
+
readonly type: 'space';
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly 'name:lang'?: LangMap;
|
|
22
|
+
readonly collections: readonly string[];
|
|
23
|
+
readonly description?: string;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=lexicon.d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icon.js","sourceRoot":"","sources":["../../src/lib/lexicon.ts"],"names":[],"mappings":"","sourcesContent":["import type { ParamValue } from './syntax.js'\n\n// @NOTE Not types from from '@atproto/lex-document' because we want a readonly\n// version here to prevent accidental mutation.\n\nexport type LexiconPermission<P extends string = string> = {\n readonly type: 'permission'\n readonly resource: P\n readonly [x: string]: undefined | ParamValue | readonly ParamValue[]\n}\n\ntype LangMap = { readonly [Lang in string]?: string }\n\nexport type LexiconPermissionSet = {\n readonly type: 'permission-set'\n readonly permissions: readonly LexiconPermission<string>[]\n readonly title?: string\n readonly 'title:lang'?: LangMap\n readonly detail?: string\n readonly 'detail:lang'?: LangMap\n}\n\nexport type LexiconSpace = {\n readonly type: 'space'\n readonly name: string\n readonly 'name:lang'?: LangMap\n readonly collections: readonly string[]\n readonly description?: string\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Mime = `${string}/${string}`;
|
|
2
|
+
export declare function isMime(value: string): value is Mime;
|
|
3
|
+
export type Accept = '*/*' | `${string}/*` | Mime;
|
|
4
|
+
export declare function isAccept(value: unknown): value is Accept;
|
|
5
|
+
export declare function matchesAccept(accept: Accept, mime: string): boolean;
|
|
6
|
+
export declare function matchesAnyAccept(acceptable: Iterable<Accept>, mime: string): boolean;
|
|
7
|
+
//# sourceMappingURL=mime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.d.ts","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;AAExC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,IAAI,CAEnD;AAED,MAAM,MAAM,MAAM,GAAG,KAAK,GAAG,GAAG,MAAM,IAAI,GAAG,IAAI,CAAA;AAEjD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAKxD;AAiBD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE;AAmBD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAET"}
|
package/dist/lib/mime.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @TODO Refactor in shared location for use with other @atproto packages
|
|
2
|
+
function isStringSlashString(value) {
|
|
3
|
+
const slashIndex = value.indexOf('/');
|
|
4
|
+
if (slashIndex === -1)
|
|
5
|
+
return false; // Missing slash
|
|
6
|
+
if (slashIndex === 0)
|
|
7
|
+
return false; // No leading part before the slash
|
|
8
|
+
if (slashIndex === value.length - 1)
|
|
9
|
+
return false; // No trailing part after the slash
|
|
10
|
+
if (value.includes('/', slashIndex + 1))
|
|
11
|
+
return false; // More than one slash
|
|
12
|
+
if (value.includes(' '))
|
|
13
|
+
return false; // Spaces are not allowed
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
export function isMime(value) {
|
|
17
|
+
return isStringSlashString(value) && !value.includes('*');
|
|
18
|
+
}
|
|
19
|
+
export function isAccept(value) {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return false;
|
|
22
|
+
if (value === '*/*')
|
|
23
|
+
return true; // Fast path for the most common case
|
|
24
|
+
if (!isStringSlashString(value))
|
|
25
|
+
return false;
|
|
26
|
+
return !value.includes('*') || value.endsWith('/*');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @note "unsafe" in that it does not check if either {@link accept} or
|
|
30
|
+
* {@link mime} are actually valid values (and could, therefore, lead to false
|
|
31
|
+
* positives if forged values are used).
|
|
32
|
+
*/
|
|
33
|
+
function matchesAcceptUnsafe(accept, mime) {
|
|
34
|
+
if (accept === '*/*') {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (accept.endsWith('/*')) {
|
|
38
|
+
return mime.startsWith(accept.slice(0, -1));
|
|
39
|
+
}
|
|
40
|
+
return accept === mime;
|
|
41
|
+
}
|
|
42
|
+
export function matchesAccept(accept, mime) {
|
|
43
|
+
return isMime(mime) && matchesAcceptUnsafe(accept, mime);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @note "unsafe" in that it does not check if either {@link accept} or
|
|
47
|
+
* {@link mime} are actually valid values (and could, therefore, lead to false
|
|
48
|
+
* positives if forged values are used).
|
|
49
|
+
*/
|
|
50
|
+
function matchesAnyAcceptUnsafe(acceptable, mime) {
|
|
51
|
+
for (const accept of acceptable) {
|
|
52
|
+
if (matchesAcceptUnsafe(accept, mime)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
export function matchesAnyAccept(acceptable, mime) {
|
|
59
|
+
return isMime(mime) && matchesAnyAcceptUnsafe(acceptable, mime);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=mime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,SAAS,mBAAmB,CAAC,KAAa;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAErC,IAAI,UAAU,KAAK,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA,CAAC,gBAAgB;IACpD,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA,CAAC,mCAAmC;IACtE,IAAI,UAAU,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA,CAAC,mCAAmC;IACrF,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA,CAAC,sBAAsB;IAC5E,IAAI,KAAK,CAAC,Q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AC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;YACtC,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,UAA4B,EAC5B,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACjE,CAAC","sourcesContent":["// @TODO Refactor in shared location for use with other @atproto packages\n\nfunction isStringSlashString(value: string): value is `${string}/${string}` {\n const slashIndex = value.indexOf('/')\n\n if (slashIndex === -1) return false // Missing slash\n if (slashIndex === 0) return false // No leading part before the slash\n if (slashIndex === value.length - 1) return false // No trailing part after the slash\n if (value.includes('/', slashIndex + 1)) return false // More than one slash\n if (value.includes(' ')) return false // Spaces are not allowed\n\n return true\n}\n\nexport type Mime = `${string}/${string}`\n\nexport function isMime(value: string): value is Mime {\n return isStringSlashString(value) && !value.includes('*')\n}\n\nexport type Accept = '*/*' | `${string}/*` | Mime\n\nexport function isAccept(value: unknown): value is Accept {\n if (typeof value !== 'string') return false\n if (value === '*/*') return true // Fast path for the most common case\n if (!isStringSlashString(value)) return false\n return !value.includes('*') || value.endsWith('/*')\n}\n\n/**\n * @note \"unsafe\" in that it does not check if either {@link accept} or\n * {@link mime} are actually valid values (and could, therefore, lead to false\n * positives if forged values are used).\n */\nfunction matchesAcceptUnsafe(accept: Accept, mime: Mime): boolean {\n if (accept === '*/*') {\n return true\n }\n if (accept.endsWith('/*')) {\n return mime.startsWith(accept.slice(0, -1))\n }\n return accept === mime\n}\n\nexport function matchesAccept(accept: Accept, mime: string): boolean {\n return isMime(mime) && matchesAcceptUnsafe(accept, mime)\n}\n\n/**\n * @note \"unsafe\" in that it does not check if either {@link accept} or\n * {@link mime} are actually valid values (and could, therefore, lead to false\n * positives if forged values are used).\n */\nfunction matchesAnyAcceptUnsafe(\n acceptable: Iterable<Accept>,\n mime: Mime,\n): boolean {\n for (const accept of acceptable) {\n if (matchesAcceptUnsafe(accept, mime)) {\n return true\n }\n }\n return false\n}\n\nexport function matchesAnyAccept(\n acceptable: Iterable<Accept>,\n mime: string,\n): boolean {\n return isMime(mime) && matchesAnyAcceptUnsafe(acceptable, mime)\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsid.d.ts","sourceRoot":"","sources":["../../src/lib/nsid.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAA;AAClD,eAAO,MAAM,MAAM,MAAO,OAAO,KAAG,CAAC,IAAI,IACA,CAAA"}
|
package/dist/lib/nsid.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nsid.js","sourceRoot":"","sources":["../../src/lib/nsid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAa,EAAE,CAC9C,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { isValidNsid } from '@atproto/syntax'\n\nexport type Nsid = `${string}.${string}.${string}`\nexport const isNsid = (v: unknown): v is Nsid =>\n typeof v === 'string' && isValidNsid(v)\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NeRoArray, ParamValue, ScopeSyntax } from './syntax.js';
|
|
2
|
+
type InferParamPredicate<T extends (value: ParamValue) => boolean> = T extends ((value: ParamValue) => value is infer U extends ParamValue) ? U : ParamValue;
|
|
3
|
+
type ParamsSchema = Record<string, {
|
|
4
|
+
multiple: false;
|
|
5
|
+
required: boolean;
|
|
6
|
+
default?: ParamValue;
|
|
7
|
+
normalize?: (value: ParamValue) => ParamValue;
|
|
8
|
+
validate: (value: ParamValue) => boolean;
|
|
9
|
+
} | {
|
|
10
|
+
multiple: true;
|
|
11
|
+
required: boolean;
|
|
12
|
+
default?: NeRoArray<ParamValue>;
|
|
13
|
+
normalize?: (value: NeRoArray<ParamValue>) => NeRoArray<ParamValue>;
|
|
14
|
+
validate: (value: ParamValue) => boolean;
|
|
15
|
+
}>;
|
|
16
|
+
type InferParams<S extends ParamsSchema> = {
|
|
17
|
+
[K in keyof S]: (S[K]['required'] extends true ? never : 'default' extends keyof S[K] ? S[K]['default'] : undefined) | (S[K]['multiple'] extends true ? NeRoArray<InferParamPredicate<S[K]['validate']>> : InferParamPredicate<S[K]['validate']>);
|
|
18
|
+
} & NonNullable<unknown>;
|
|
19
|
+
export declare class Parser<P extends string, S extends ParamsSchema> {
|
|
20
|
+
readonly prefix: P;
|
|
21
|
+
readonly schema: S;
|
|
22
|
+
readonly positionalName?: (keyof S & string) | undefined;
|
|
23
|
+
readonly schemaKeys: ReadonlySet<keyof S & string>;
|
|
24
|
+
constructor(prefix: P, schema: S, positionalName?: (keyof S & string) | undefined);
|
|
25
|
+
format(values: InferParams<S>): import("./syntax.js").ScopeStringFor<P>;
|
|
26
|
+
parse(syntax: ScopeSyntax<P>): { [K in keyof S]: (S[K]["required"] extends true ? never : "default" extends keyof S[K] ? S[K][keyof S[K] & "default"] : undefined) | (S[K]["multiple"] extends true ? NeRoArray<InferParamPredicate<S[K]["validate"]>> : InferParamPredicate<S[K]["validate"]>); } | null;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/lib/parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAErE,KAAK,mBAAmB,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,IAC/D,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,UAAU,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