@atproto/oauth-scopes 0.0.2 → 0.2.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/atproto-oauth-scope.d.ts +17 -0
  3. package/dist/atproto-oauth-scope.d.ts.map +1 -0
  4. package/dist/atproto-oauth-scope.js +67 -0
  5. package/dist/atproto-oauth-scope.js.map +1 -0
  6. package/dist/index.d.ts +9 -13
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +9 -13
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/lexicon.d.ts +2 -0
  11. package/dist/lib/lexicon.d.ts.map +1 -0
  12. package/dist/lib/lexicon.js +3 -0
  13. package/dist/lib/lexicon.js.map +1 -0
  14. package/dist/lib/mime.d.ts +1 -1
  15. package/dist/lib/mime.d.ts.map +1 -1
  16. package/dist/lib/mime.js +2 -0
  17. package/dist/lib/mime.js.map +1 -1
  18. package/dist/lib/nsid.d.ts +2 -2
  19. package/dist/lib/nsid.d.ts.map +1 -1
  20. package/dist/lib/nsid.js +4 -6
  21. package/dist/lib/nsid.js.map +1 -1
  22. package/dist/lib/parser.d.ts +29 -0
  23. package/dist/lib/parser.d.ts.map +1 -0
  24. package/dist/lib/parser.js +152 -0
  25. package/dist/lib/parser.js.map +1 -0
  26. package/dist/lib/resource-permission.d.ts +10 -0
  27. package/dist/lib/resource-permission.d.ts.map +1 -0
  28. package/dist/lib/resource-permission.js +3 -0
  29. package/dist/lib/resource-permission.js.map +1 -0
  30. package/dist/lib/syntax-lexicon.d.ts +26 -0
  31. package/dist/lib/syntax-lexicon.d.ts.map +1 -0
  32. package/dist/lib/syntax-lexicon.js +58 -0
  33. package/dist/lib/syntax-lexicon.js.map +1 -0
  34. package/dist/lib/syntax-string.d.ts +16 -0
  35. package/dist/lib/syntax-string.d.ts.map +1 -0
  36. package/dist/lib/syntax-string.js +121 -0
  37. package/dist/lib/syntax-string.js.map +1 -0
  38. package/dist/lib/syntax.d.ts +23 -0
  39. package/dist/lib/syntax.d.ts.map +1 -0
  40. package/dist/lib/syntax.js +22 -0
  41. package/dist/lib/syntax.js.map +1 -0
  42. package/dist/lib/util.d.ts +5 -1
  43. package/dist/lib/util.d.ts.map +1 -1
  44. package/dist/lib/util.js +8 -12
  45. package/dist/lib/util.js.map +1 -1
  46. package/dist/scope-permissions-transition.d.ts +15 -0
  47. package/dist/scope-permissions-transition.d.ts.map +1 -0
  48. package/dist/{permission-set-transition.js → scope-permissions-transition.js} +5 -5
  49. package/dist/scope-permissions-transition.js.map +1 -0
  50. package/dist/scope-permissions.d.ts +22 -0
  51. package/dist/scope-permissions.d.ts.map +1 -0
  52. package/dist/{permission-set.js → scope-permissions.js} +20 -16
  53. package/dist/scope-permissions.js.map +1 -0
  54. package/dist/scopes/account-permission.d.ts +35 -0
  55. package/dist/scopes/account-permission.d.ts.map +1 -0
  56. package/dist/scopes/account-permission.js +71 -0
  57. package/dist/scopes/account-permission.js.map +1 -0
  58. package/dist/scopes/blob-permission.d.ts +27 -0
  59. package/dist/scopes/blob-permission.d.ts.map +1 -0
  60. package/dist/scopes/blob-permission.js +86 -0
  61. package/dist/scopes/blob-permission.js.map +1 -0
  62. package/dist/scopes/identity-permission.d.ts +25 -0
  63. package/dist/scopes/identity-permission.d.ts.map +1 -0
  64. package/dist/scopes/identity-permission.js +53 -0
  65. package/dist/scopes/identity-permission.js.map +1 -0
  66. package/dist/scopes/include-scope.d.ts +54 -0
  67. package/dist/scopes/include-scope.d.ts.map +1 -0
  68. package/dist/scopes/include-scope.js +156 -0
  69. package/dist/scopes/include-scope.js.map +1 -0
  70. package/dist/scopes/repo-permission.d.ts +40 -0
  71. package/dist/scopes/repo-permission.d.ts.map +1 -0
  72. package/dist/scopes/repo-permission.js +101 -0
  73. package/dist/scopes/repo-permission.js.map +1 -0
  74. package/dist/scopes/rpc-permission.d.ts +38 -0
  75. package/dist/scopes/rpc-permission.d.ts.map +1 -0
  76. package/dist/scopes/rpc-permission.js +81 -0
  77. package/dist/scopes/rpc-permission.js.map +1 -0
  78. package/dist/scopes-set.d.ts +12 -1
  79. package/dist/scopes-set.d.ts.map +1 -1
  80. package/dist/scopes-set.js +49 -3
  81. package/dist/scopes-set.js.map +1 -1
  82. package/package.json +7 -3
  83. package/src/atproto-oauth-scope.ts +79 -0
  84. package/src/index.ts +10 -14
  85. package/src/lib/lexicon.ts +1 -0
  86. package/src/lib/mime.ts +2 -1
  87. package/src/lib/nsid.ts +5 -6
  88. package/src/lib/parser.ts +176 -0
  89. package/src/lib/resource-permission.ts +10 -0
  90. package/src/lib/syntax-lexicon.ts +55 -0
  91. package/src/lib/syntax-string.test.ts +130 -0
  92. package/src/lib/syntax-string.ts +132 -0
  93. package/src/lib/syntax.test.ts +43 -0
  94. package/src/lib/syntax.ts +47 -0
  95. package/src/lib/util.ts +11 -12
  96. package/src/{permission-set-transition.test.ts → scope-permissions-transition.test.ts} +33 -20
  97. package/src/{permission-set-transition.ts → scope-permissions-transition.ts} +11 -11
  98. package/src/{permission-set.test.ts → scope-permissions.test.ts} +77 -35
  99. package/src/scope-permissions.ts +91 -0
  100. package/src/{resources/account-scope.test.ts → scopes/account-permission.test.ts} +45 -33
  101. package/src/scopes/account-permission.ts +75 -0
  102. package/src/{resources/blob-scope.test.ts → scopes/blob-permission.test.ts} +31 -23
  103. package/src/scopes/blob-permission.ts +105 -0
  104. package/src/{resources/identity-scope.test.ts → scopes/identity-permission.test.ts} +13 -13
  105. package/src/scopes/identity-permission.ts +54 -0
  106. package/src/scopes/include-scope.test.ts +626 -0
  107. package/src/scopes/include-scope.ts +168 -0
  108. package/src/{resources/repo-scope.test.ts → scopes/repo-permission.test.ts} +77 -65
  109. package/src/scopes/repo-permission.ts +111 -0
  110. package/src/scopes/rpc-permission.test.ts +323 -0
  111. package/src/scopes/rpc-permission.ts +85 -0
  112. package/src/scopes-set.test.ts +5 -5
  113. package/src/scopes-set.ts +79 -5
  114. package/tsconfig.build.tsbuildinfo +1 -1
  115. package/tsconfig.tests.tsbuildinfo +1 -1
  116. package/dist/lib/did.d.ts +0 -3
  117. package/dist/lib/did.d.ts.map +0 -1
  118. package/dist/lib/did.js +0 -6
  119. package/dist/lib/did.js.map +0 -1
  120. package/dist/parser.d.ts +0 -31
  121. package/dist/parser.d.ts.map +0 -1
  122. package/dist/parser.js +0 -118
  123. package/dist/parser.js.map +0 -1
  124. package/dist/permission-set-transition.d.ts +0 -15
  125. package/dist/permission-set-transition.d.ts.map +0 -1
  126. package/dist/permission-set-transition.js.map +0 -1
  127. package/dist/permission-set.d.ts +0 -22
  128. package/dist/permission-set.d.ts.map +0 -1
  129. package/dist/permission-set.js.map +0 -1
  130. package/dist/resources/account-scope.d.ts +0 -35
  131. package/dist/resources/account-scope.d.ts.map +0 -1
  132. package/dist/resources/account-scope.js +0 -60
  133. package/dist/resources/account-scope.js.map +0 -1
  134. package/dist/resources/blob-scope.d.ts +0 -25
  135. package/dist/resources/blob-scope.d.ts.map +0 -1
  136. package/dist/resources/blob-scope.js +0 -74
  137. package/dist/resources/blob-scope.js.map +0 -1
  138. package/dist/resources/identity-scope.d.ts +0 -25
  139. package/dist/resources/identity-scope.d.ts.map +0 -1
  140. package/dist/resources/identity-scope.js +0 -46
  141. package/dist/resources/identity-scope.js.map +0 -1
  142. package/dist/resources/repo-scope.d.ts +0 -37
  143. package/dist/resources/repo-scope.d.ts.map +0 -1
  144. package/dist/resources/repo-scope.js +0 -92
  145. package/dist/resources/repo-scope.js.map +0 -1
  146. package/dist/resources/rpc-scope.d.ts +0 -31
  147. package/dist/resources/rpc-scope.d.ts.map +0 -1
  148. package/dist/resources/rpc-scope.js +0 -74
  149. package/dist/resources/rpc-scope.js.map +0 -1
  150. package/dist/syntax.d.ts +0 -76
  151. package/dist/syntax.d.ts.map +0 -1
  152. package/dist/syntax.js +0 -249
  153. package/dist/syntax.js.map +0 -1
  154. package/dist/utilities.d.ts +0 -17
  155. package/dist/utilities.d.ts.map +0 -1
  156. package/dist/utilities.js +0 -108
  157. package/dist/utilities.js.map +0 -1
  158. package/src/lib/did.ts +0 -3
  159. package/src/parser.ts +0 -150
  160. package/src/permission-set.ts +0 -78
  161. package/src/resources/account-scope.ts +0 -66
  162. package/src/resources/blob-scope.ts +0 -86
  163. package/src/resources/identity-scope.ts +0 -49
  164. package/src/resources/repo-scope.ts +0 -101
  165. package/src/resources/rpc-scope.test.ts +0 -280
  166. package/src/resources/rpc-scope.ts +0 -77
  167. package/src/syntax.test.ts +0 -203
  168. package/src/syntax.ts +0 -325
  169. package/src/utilities.ts +0 -109
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @atproto/oauth-scopes
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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`
8
+
9
+ ### Patch Changes
10
+
11
+ - [#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
12
+
13
+ - Updated dependencies []:
14
+ - @atproto/lexicon@0.5.1
15
+
16
+ ## 0.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#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
21
+
22
+ - [#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.
23
+
24
+ - [#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`
25
+
26
+ - [#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
27
+
28
+ - [#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)
29
+
30
+ ### Patch Changes
31
+
32
+ - [#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`
33
+
34
+ - [#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
35
+
36
+ - 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)]:
37
+ - @atproto/lexicon@0.5.0
38
+ - @atproto/syntax@0.4.1
39
+ - @atproto/did@0.2.0
40
+
3
41
  ## 0.0.2
4
42
 
5
43
  ### Patch Changes
@@ -0,0 +1,17 @@
1
+ import { 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'>;
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,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AASlE,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,CAAA;AAEzB;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,iBAAiB,CAU7E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,UAOvD;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,GACZ,iBAAiB,GAAG,IAAI,CAgB1B"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STATIC_SCOPE_VALUES = exports.isScopeStringFor = void 0;
4
+ exports.isStaticScopeValue = isStaticScopeValue;
5
+ exports.isAtprotoOauthScope = isAtprotoOauthScope;
6
+ exports.normalizeAtprotoOauthScope = normalizeAtprotoOauthScope;
7
+ exports.normalizeAtprotoOauthScopeValue = normalizeAtprotoOauthScopeValue;
8
+ const syntax_js_1 = require("./lib/syntax.js");
9
+ Object.defineProperty(exports, "isScopeStringFor", { enumerable: true, get: function () { return syntax_js_1.isScopeStringFor; } });
10
+ const util_js_1 = require("./lib/util.js");
11
+ const account_permission_js_1 = require("./scopes/account-permission.js");
12
+ const blob_permission_js_1 = require("./scopes/blob-permission.js");
13
+ const identity_permission_js_1 = require("./scopes/identity-permission.js");
14
+ const include_scope_js_1 = require("./scopes/include-scope.js");
15
+ const repo_permission_js_1 = require("./scopes/repo-permission.js");
16
+ const rpc_permission_js_1 = require("./scopes/rpc-permission.js");
17
+ exports.STATIC_SCOPE_VALUES = Object.freeze([
18
+ 'atproto',
19
+ 'transition:email',
20
+ 'transition:generic',
21
+ 'transition:chat.bsky',
22
+ ]);
23
+ function isStaticScopeValue(value) {
24
+ return exports.STATIC_SCOPE_VALUES.includes(value);
25
+ }
26
+ /**
27
+ * @note This function does not only verify the scope string format (with
28
+ * {@link isScopeStringFor}), but also checks if the provided parameters are
29
+ * valid according to the respective scope syntax definition. This allows
30
+ * excluding scopes that cannot be fully interpreted by the current version of
31
+ * the code.
32
+ */
33
+ function isAtprotoOauthScope(value) {
34
+ return (isStaticScopeValue(value) ||
35
+ account_permission_js_1.AccountPermission.fromString(value) != null ||
36
+ blob_permission_js_1.BlobPermission.fromString(value) != null ||
37
+ identity_permission_js_1.IdentityPermission.fromString(value) != null ||
38
+ include_scope_js_1.IncludeScope.fromString(value) != null ||
39
+ repo_permission_js_1.RepoPermission.fromString(value) != null ||
40
+ rpc_permission_js_1.RpcPermission.fromString(value) != null);
41
+ }
42
+ function normalizeAtprotoOauthScope(scope) {
43
+ return scope
44
+ .split(' ')
45
+ .map(normalizeAtprotoOauthScopeValue)
46
+ .filter(util_js_1.isNonNullable)
47
+ .sort()
48
+ .join(' ');
49
+ }
50
+ function normalizeAtprotoOauthScopeValue(value) {
51
+ if (isStaticScopeValue(value))
52
+ return value;
53
+ for (const Scope of [
54
+ account_permission_js_1.AccountPermission,
55
+ blob_permission_js_1.BlobPermission,
56
+ identity_permission_js_1.IdentityPermission,
57
+ include_scope_js_1.IncludeScope,
58
+ repo_permission_js_1.RepoPermission,
59
+ rpc_permission_js_1.RpcPermission,
60
+ ]) {
61
+ const parsed = Scope.fromString(value);
62
+ if (parsed)
63
+ return parsed.toString();
64
+ }
65
+ return null;
66
+ }
67
+ //# sourceMappingURL=atproto-oauth-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atproto-oauth-scope.js","sourceRoot":"","sources":["../src/atproto-oauth-scope.ts"],"names":[],"mappings":";;;AAmBA,gDAEC;AAkBD,kDAUC;AAED,gEAOC;AAED,0EAkBC;AA9ED,+CAAkE;AASpC,iGATL,4BAAgB,OASK;AAR9C,2CAA6C;AAC7C,0EAAkE;AAClE,oEAA4D;AAC5D,4EAAoE;AACpE,gEAAwD;AACxD,oEAA4D;AAC5D,kEAA0D;AAI7C,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,SAAS;IACT,kBAAkB;IAClB,oBAAoB;IACpB,sBAAsB;CACd,CAAC,CAAA;AAGX,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAQ,2BAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACnE,CAAC;AAWD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,CACL,kBAAkB,CAAC,KAAK,CAAC;QACzB,yCAAiB,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QAC3C,mCAAc,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QACxC,2CAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QAC5C,+BAAY,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QACtC,mCAAc,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI;QACxC,iCAAa,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,CACxC,CAAA;AACH,CAAC;AAED,SAAgB,0BAA0B,CAAC,KAAa;IACtD,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,+BAA+B,CAAC;SACpC,MAAM,CAAC,uBAAa,CAAC;SACrB,IAAI,EAAE;SACN,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAED,SAAgB,+BAA+B,CAC7C,KAAa;IAEb,IAAI,kBAAkB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAE3C,KAAK,MAAM,KAAK,IAAI;QAClB,yCAAiB;QACjB,mCAAc;QACd,2CAAkB;QAClB,+BAAY;QACZ,mCAAc;QACd,iCAAa;KACd,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"}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,12 @@
1
+ export * from './atproto-oauth-scope.js';
1
2
  export * from './scope-missing-error.js';
2
- export * from './permission-set.js';
3
- export * from './permission-set-transition.js';
3
+ export * from './scope-permissions-transition.js';
4
+ export * from './scope-permissions.js';
4
5
  export * from './scopes-set.js';
5
- export * from './parser.js';
6
- export * from './syntax.js';
7
- export * from './utilities.js';
8
- export * from './resources/account-scope.js';
9
- export * from './resources/blob-scope.js';
10
- export * from './resources/identity-scope.js';
11
- export * from './resources/repo-scope.js';
12
- export * from './resources/rpc-scope.js';
13
- export * from './lib/mime.js';
14
- export * from './lib/did.js';
15
- export * from './lib/nsid.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';
16
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AAExC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
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"}
package/dist/index.js CHANGED
@@ -14,19 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./atproto-oauth-scope.js"), exports);
17
18
  __exportStar(require("./scope-missing-error.js"), exports);
18
- __exportStar(require("./permission-set.js"), exports);
19
- __exportStar(require("./permission-set-transition.js"), exports);
19
+ __exportStar(require("./scope-permissions-transition.js"), exports);
20
+ __exportStar(require("./scope-permissions.js"), exports);
20
21
  __exportStar(require("./scopes-set.js"), exports);
21
- __exportStar(require("./parser.js"), exports);
22
- __exportStar(require("./syntax.js"), exports);
23
- __exportStar(require("./utilities.js"), exports);
24
- __exportStar(require("./resources/account-scope.js"), exports);
25
- __exportStar(require("./resources/blob-scope.js"), exports);
26
- __exportStar(require("./resources/identity-scope.js"), exports);
27
- __exportStar(require("./resources/repo-scope.js"), exports);
28
- __exportStar(require("./resources/rpc-scope.js"), exports);
29
- __exportStar(require("./lib/mime.js"), exports);
30
- __exportStar(require("./lib/did.js"), exports);
31
- __exportStar(require("./lib/nsid.js"), exports);
22
+ __exportStar(require("./scopes/account-permission.js"), exports);
23
+ __exportStar(require("./scopes/blob-permission.js"), exports);
24
+ __exportStar(require("./scopes/identity-permission.js"), exports);
25
+ __exportStar(require("./scopes/include-scope.js"), exports);
26
+ __exportStar(require("./scopes/repo-permission.js"), exports);
27
+ __exportStar(require("./scopes/rpc-permission.js"), exports);
32
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,sDAAmC;AACnC,iEAA8C;AAC9C,kDAA+B;AAC/B,8CAA2B;AAC3B,8CAA2B;AAC3B,iDAA8B;AAE9B,+DAA4C;AAC5C,4DAAyC;AACzC,gEAA6C;AAC7C,4DAAyC;AACzC,2DAAwC;AAExC,gDAA6B;AAC7B,+CAA4B;AAC5B,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AAExC,2DAAwC;AACxC,oEAAiD;AACjD,yDAAsC;AACtC,kDAA+B;AAE/B,iEAA8C;AAC9C,8DAA2C;AAC3C,kEAA+C;AAC/C,4DAAyC;AACzC,8DAA2C;AAC3C,6DAA0C"}
@@ -0,0 +1,2 @@
1
+ export type { LexPermission, LexPermissionSet } from '@atproto/lexicon';
2
+ //# sourceMappingURL=lexicon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexicon.d.ts","sourceRoot":"","sources":["../../src/lib/lexicon.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=lexicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexicon.js","sourceRoot":"","sources":["../../src/lib/lexicon.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  export type Mime = `${string}/${string}`;
2
2
  export declare function isMime(value: string): value is Mime;
3
3
  export type Accept = '*/*' | `${string}/*` | Mime;
4
- export declare function isAccept(value: string): value is Accept;
4
+ export declare function isAccept(value: unknown): value is Accept;
5
5
  export declare function matchesAccept(accept: Accept, mime: string): boolean;
6
6
  export declare function matchesAnyAccept(acceptable: Iterable<Accept>, mime: string): boolean;
7
7
  //# sourceMappingURL=mime.d.ts.map
@@ -1 +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,MAAM,GAAG,KAAK,IAAI,MAAM,CAIvD;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"}
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 CHANGED
@@ -23,6 +23,8 @@ function isMime(value) {
23
23
  return isStringSlashString(value) && !value.includes('*');
24
24
  }
25
25
  function isAccept(value) {
26
+ if (typeof value !== 'string')
27
+ return false;
26
28
  if (value === '*/*')
27
29
  return true; // Fast path for the most common case
28
30
  if (!isStringSlashString(value))
@@ -1 +1 @@
1
- {"version":3,"file":"mime.js","sourceRoot":"","sources":["../../src/lib/mime.ts"],"names":[],"mappings":";AAAA,yEAAyE;;AAgBzE,wBAEC;AAID,4BAIC;AAiBD,sCAEC;AAmBD,4CAKC;AAnED,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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
- export declare const isNSID: (value: string) => value is NSID;
1
+ export type Nsid = `${string}.${string}.${string}`;
2
+ export declare const isNsid: (v: unknown) => v is Nsid;
3
3
  //# sourceMappingURL=nsid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nsid.d.ts","sourceRoot":"","sources":["../../src/lib/nsid.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;AACxC,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,IAI1B,CAAA"}
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,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,IACA,CAAA"}
package/dist/lib/nsid.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNSID = void 0;
4
- const isNSID = (value) => value.includes('.') &&
5
- !value.includes(' ') &&
6
- !value.startsWith('.') &&
7
- !value.endsWith('.');
8
- exports.isNSID = isNSID;
3
+ exports.isNsid = void 0;
4
+ const syntax_1 = require("@atproto/syntax");
5
+ const isNsid = (v) => typeof v === 'string' && (0, syntax_1.isValidNsid)(v);
6
+ exports.isNsid = isNsid;
9
7
  //# sourceMappingURL=nsid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nsid.js","sourceRoot":"","sources":["../../src/lib/nsid.ts"],"names":[],"mappings":";;;AACO,MAAM,MAAM,GAAG,CAAC,KAAa,EAAiB,EAAE,CACrD,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;IACnB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;IACpB,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;IACtB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAJT,QAAA,MAAM,UAIG"}
1
+ {"version":3,"file":"nsid.js","sourceRoot":"","sources":["../../src/lib/nsid.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAGtC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAa,EAAE,CAC9C,OAAO,CAAC,KAAK,QAAQ,IAAI,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAA;AAD5B,QAAA,MAAM,UACsB"}
@@ -0,0 +1,29 @@
1
+ import { 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,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEhE,KAAK,mBAAmB,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,IAC/D,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,IAAI,MAAM,CAAC,SAAS,UAAU,CAAC,GAClE,CAAC,GACD,UAAU,CAAA;AAEhB,KAAK,YAAY,GAAG,MAAM,CACxB,MAAM,EACJ;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,UAAU,CAAA;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAA;CACzC,GACD;IACE,QAAQ,EAAE,IAAI,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAC/B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,UAAU,CAAC,CAAA;IACnE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAA;CACzC,CACJ,CAAA;AAED,KAAK,WAAW,CAAC,CAAC,SAAS,YAAY,IAAI;KACxC,CAAC,IAAI,MAAM,CAAC,GACT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAC1B,KAAK,GACL,SAAS,SAAS,MAAM,CAAC,CAAC,CAAC,CAAC,GAC1B,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GACf,SAAS,CAAC,GAChB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAC1B,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAChD,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CAC/C,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;AAExB,qBAAa,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,YAAY;aAIxC,MAAM,EAAE,CAAC;aACT,MAAM,EAAE,CAAC;aACT,cAAc,CAAC,GAAE,MAAM,CAAC,GAAG,MAAM;IALnD,SAAgB,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAA;gBAGvC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,cAAc,CAAC,GAAE,MAAM,CAAC,GAAG,MAAM,aAAA;IAKnD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAmD7B,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAzE3B,CAAC;CAqIH"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Parser = void 0;
4
+ const syntax_string_js_1 = require("./syntax-string.js");
5
+ class Parser {
6
+ constructor(prefix, schema, positionalName) {
7
+ Object.defineProperty(this, "prefix", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: prefix
12
+ });
13
+ Object.defineProperty(this, "schema", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: schema
18
+ });
19
+ Object.defineProperty(this, "positionalName", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: positionalName
24
+ });
25
+ Object.defineProperty(this, "schemaKeys", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ this.schemaKeys = new Set(Object.keys(schema));
32
+ }
33
+ format(values) {
34
+ const params = new URLSearchParams();
35
+ let positional = undefined;
36
+ for (const key of this.schemaKeys) {
37
+ const value = values[key];
38
+ // Ignore undefined values
39
+ if (value === undefined)
40
+ continue;
41
+ const schema = this.schema[key];
42
+ // Normalize the value if a normalization function is provided
43
+ const normalized = schema.normalize
44
+ ? schema.normalize(value)
45
+ : value;
46
+ // Ignore values that are equal to the default value
47
+ if (!schema.required) {
48
+ if (schema.default === normalized)
49
+ continue;
50
+ if (schema.multiple &&
51
+ schema.default &&
52
+ arrayParamEquals(schema.default, normalized)) {
53
+ continue;
54
+ }
55
+ }
56
+ if (Array.isArray(normalized)) {
57
+ if (key === this.positionalName && normalized.length === 1) {
58
+ positional = String(normalized[0]);
59
+ }
60
+ else {
61
+ // remove duplicates
62
+ const unique = new Set(normalized.map(String));
63
+ for (const v of unique)
64
+ params.append(key, v);
65
+ }
66
+ }
67
+ else {
68
+ if (key === this.positionalName) {
69
+ positional = String(normalized);
70
+ }
71
+ else {
72
+ params.set(key, String(normalized));
73
+ }
74
+ }
75
+ }
76
+ return new syntax_string_js_1.ScopeStringSyntax(this.prefix, positional, params).toString();
77
+ }
78
+ // @NOTE If we needed to ever have more detailed reason as to why parsing
79
+ // fails, this function could easily be updated to return a
80
+ // ValidationResult<T> type that explains the reason for failure.
81
+ parse(syntax) {
82
+ // @NOTE no need to check prefix, since the typing (P generic) already
83
+ // ensures it matches
84
+ for (const key of syntax.keys()) {
85
+ if (!this.schemaKeys.has(key))
86
+ return null;
87
+ }
88
+ const result = Object.create(null);
89
+ for (const key of this.schemaKeys) {
90
+ const definition = this.schema[key];
91
+ const param = definition.multiple
92
+ ? syntax.getMulti(key)
93
+ : syntax.getSingle(key);
94
+ if (param === null) {
95
+ return null; // Value is not valid
96
+ }
97
+ else if (param !== undefined) {
98
+ if (key === this.positionalName && syntax.positional !== undefined) {
99
+ // Positional parameter cannot be used with named parameters
100
+ return null;
101
+ }
102
+ if (definition.multiple) {
103
+ // Empty array is not valid
104
+ if (!param.length)
105
+ return null;
106
+ if (!param.every(definition.validate)) {
107
+ return null;
108
+ }
109
+ }
110
+ else {
111
+ if (!definition.validate(param)) {
112
+ return null;
113
+ }
114
+ }
115
+ result[key] = param;
116
+ }
117
+ else if (key === this.positionalName &&
118
+ syntax.positional !== undefined) {
119
+ // No named parameters found, but there is a positional parameter
120
+ const { positional } = syntax;
121
+ if (!definition.validate(positional)) {
122
+ return null;
123
+ }
124
+ result[key] = definition.multiple ? [positional] : positional;
125
+ }
126
+ else if (definition.required) {
127
+ return null;
128
+ }
129
+ else {
130
+ result[key] = definition.default;
131
+ }
132
+ }
133
+ return result;
134
+ }
135
+ }
136
+ exports.Parser = Parser;
137
+ /**
138
+ * Two param arrays are considered equal if they contain the same values,
139
+ * regardless of the order and duplicates.
140
+ * @param a - The first array to compare.
141
+ * @param b - The second array to compare.
142
+ */
143
+ function arrayParamEquals(a, b) {
144
+ for (const item of a)
145
+ if (!b.includes(item))
146
+ return false;
147
+ for (const item of b)
148
+ if (!a.includes(item))
149
+ return false;
150
+ return true;
151
+ }
152
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/lib/parser.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAsCtD,MAAa,MAAM;IAGjB,YACkB,MAAS,EACT,MAAS,EACT,cAAiC;QAFjD;;;;mBAAgB,MAAM;WAAG;QACzB;;;;mBAAgB,MAAM;WAAG;QACzB;;;;mBAAgB,cAAc;WAAmB;QALnC;;;;;WAAyC;QAOvD,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,C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gBAAgB,CACvB,CAAqB,EACrB,CAAqB;IAErB,KAAK,MAAM,IAAI,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;IACzD,KAAK,MAAM,IAAI,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;IACzD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ScopeStringFor } from './syntax.js';
2
+ import { Matchable } from './util.js';
3
+ /**
4
+ * Interface destined to provide consistency across parsed permission scopes for
5
+ * resources (blob, repo, etc.).
6
+ */
7
+ export interface ResourcePermission<R extends string, T> extends Matchable<T> {
8
+ toString(): ScopeStringFor<R>;
9
+ }
10
+ //# sourceMappingURL=resource-permission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-permission.d.ts","sourceRoot":"","sources":["../../src/lib/resource-permission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC3E,QAAQ,IAAI,cAAc,CAAC,CAAC,CAAC,CAAA;CAC9B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resource-permission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-permission.js","sourceRoot":"","sources":["../../src/lib/resource-permission.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { LexPermission } from './lexicon.js';
2
+ import { ScopeSyntax } from './syntax.js';
3
+ /**
4
+ * Translates a {@link LexPermission} into a {@link ScopeSyntax}.
5
+ */
6
+ export declare class LexPermissionSyntax<P extends string = string> implements ScopeSyntax<P> {
7
+ readonly lexPermission: Readonly<LexPermission & {
8
+ resource: P;
9
+ }>;
10
+ constructor(lexPermission: Readonly<LexPermission & {
11
+ resource: P;
12
+ }>);
13
+ get prefix(): P;
14
+ get positional(): undefined;
15
+ get(key: string): string | number | boolean | (string | number | boolean)[] | undefined;
16
+ keys(): Generator<string, void, unknown>;
17
+ getSingle(key: string): string | number | boolean | null | undefined;
18
+ getMulti(key: string): (string | number | boolean)[] | null | undefined;
19
+ toJSON(): Readonly<{
20
+ type: "permission";
21
+ resource: string;
22
+ } & Record<string, string | number | boolean | (string | number | boolean)[] | undefined> & {
23
+ resource: P;
24
+ }>;
25
+ }
26
+ //# sourceMappingURL=syntax-lexicon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax-lexicon.d.ts","sourceRoot":"","sources":["../../src/lib/syntax-lexicon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC;;GAEG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACxD,YAAW,WAAW,CAAC,CAAC,CAAC;IAGvB,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,GAAG;QAAE,QAAQ,EAAE,CAAC,CAAA;KAAE,CAAC;gBAAxD,aAAa,EAAE,QAAQ,CAAC,aAAa,GAAG;QAAE,QAAQ,EAAE,CAAC,CAAA;KAAE,CAAC;IAGnE,IAAI,MAAM,MAET;IAED,IAAI,UAAU,cAEb;IAED,GAAG,CAAC,GAAG,EAAE,MAAM;IAWd,IAAI;IAML,SAAS,CAAC,GAAG,EAAE,MAAM;IAMrB,QAAQ,CAAC,GAAG,EAAE,MAAM;IAOpB,MAAM;;;;kBAzCyD,CAAC;;CA4CjE"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LexPermissionSyntax = void 0;
4
+ /**
5
+ * Translates a {@link LexPermission} into a {@link ScopeSyntax}.
6
+ */
7
+ class LexPermissionSyntax {
8
+ constructor(lexPermission) {
9
+ Object.defineProperty(this, "lexPermission", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: lexPermission
14
+ });
15
+ }
16
+ get prefix() {
17
+ return this.lexPermission.resource;
18
+ }
19
+ get positional() {
20
+ return undefined;
21
+ }
22
+ get(key) {
23
+ // Ignore reserved keywords
24
+ if (key === 'type')
25
+ return undefined;
26
+ if (key === 'resource')
27
+ return undefined;
28
+ // Ignore inherited properties (toString(), etc.)
29
+ if (!Object.hasOwn(this.lexPermission, key))
30
+ return undefined;
31
+ return this.lexPermission[key];
32
+ }
33
+ *keys() {
34
+ for (const key of Object.keys(this.lexPermission)) {
35
+ if (this.get(key) !== undefined)
36
+ yield key;
37
+ }
38
+ }
39
+ getSingle(key) {
40
+ const value = this.get(key);
41
+ if (Array.isArray(value))
42
+ return null;
43
+ return value;
44
+ }
45
+ getMulti(key) {
46
+ const value = this.get(key);
47
+ if (value === undefined)
48
+ return undefined;
49
+ if (!Array.isArray(value))
50
+ return null;
51
+ return value;
52
+ }
53
+ toJSON() {
54
+ return this.lexPermission;
55
+ }
56
+ }
57
+ exports.LexPermissionSyntax = LexPermissionSyntax;
58
+ //# sourceMappingURL=syntax-lexicon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax-lexicon.js","sourceRoot":"","sources":["../../src/lib/syntax-lexicon.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,mBAAmB;IAG9B,YACW,aAAwD;QAAjE;;;;mBAAS,aAAa;WAA2C;IAChE,CAAC;IAEJ,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAA;IACpC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,SAAS,CAAA;IAClB,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