@atproto/oauth-scopes 0.0.2 → 0.1.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 +25 -0
- package/dist/atproto-oauth-scope.d.ts +12 -0
- package/dist/atproto-oauth-scope.d.ts.map +1 -0
- package/dist/atproto-oauth-scope.js +32 -0
- package/dist/atproto-oauth-scope.js.map +1 -0
- package/dist/index.d.ts +9 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -13
- package/dist/index.js.map +1 -1
- package/dist/lib/lexicon.d.ts +2 -0
- package/dist/lib/lexicon.d.ts.map +1 -0
- package/dist/lib/lexicon.js +3 -0
- package/dist/lib/lexicon.js.map +1 -0
- package/dist/lib/mime.d.ts +1 -1
- package/dist/lib/mime.d.ts.map +1 -1
- package/dist/lib/mime.js +2 -0
- package/dist/lib/mime.js.map +1 -1
- package/dist/lib/nsid.d.ts +2 -2
- package/dist/lib/nsid.d.ts.map +1 -1
- package/dist/lib/nsid.js +4 -6
- package/dist/lib/nsid.js.map +1 -1
- package/dist/lib/parser.d.ts +29 -0
- package/dist/lib/parser.d.ts.map +1 -0
- package/dist/lib/parser.js +152 -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 +3 -0
- package/dist/lib/resource-permission.js.map +1 -0
- package/dist/lib/syntax-lexicon.d.ts +26 -0
- package/dist/lib/syntax-lexicon.d.ts.map +1 -0
- package/dist/lib/syntax-lexicon.js +58 -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 +121 -0
- package/dist/lib/syntax-string.js.map +1 -0
- package/dist/lib/syntax.d.ts +23 -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 +4 -1
- package/dist/lib/util.d.ts.map +1 -1
- package/dist/lib/util.js +4 -12
- package/dist/lib/util.js.map +1 -1
- package/dist/scope-permissions-transition.d.ts +15 -0
- package/dist/scope-permissions-transition.d.ts.map +1 -0
- package/dist/{permission-set-transition.js → scope-permissions-transition.js} +5 -5
- package/dist/scope-permissions-transition.js.map +1 -0
- package/dist/scope-permissions.d.ts +22 -0
- package/dist/scope-permissions.d.ts.map +1 -0
- package/dist/{permission-set.js → scope-permissions.js} +20 -16
- 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 +71 -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 +86 -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 +53 -0
- package/dist/scopes/identity-permission.js.map +1 -0
- package/dist/scopes/include-scope.d.ts +54 -0
- package/dist/scopes/include-scope.d.ts.map +1 -0
- package/dist/scopes/include-scope.js +156 -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 +101 -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 +81 -0
- package/dist/scopes/rpc-permission.js.map +1 -0
- package/dist/scopes-set.d.ts +12 -1
- package/dist/scopes-set.d.ts.map +1 -1
- package/dist/scopes-set.js +49 -3
- package/dist/scopes-set.js.map +1 -1
- package/package.json +7 -3
- package/src/atproto-oauth-scope.ts +43 -0
- package/src/index.ts +10 -14
- package/src/lib/lexicon.ts +1 -0
- package/src/lib/mime.ts +2 -1
- package/src/lib/nsid.ts +5 -6
- package/src/lib/parser.ts +176 -0
- package/src/lib/resource-permission.ts +10 -0
- package/src/lib/syntax-lexicon.ts +55 -0
- package/src/lib/syntax-string.test.ts +130 -0
- package/src/lib/syntax-string.ts +132 -0
- package/src/lib/syntax.test.ts +43 -0
- package/src/lib/syntax.ts +47 -0
- package/src/lib/util.ts +7 -12
- package/src/{permission-set-transition.test.ts → scope-permissions-transition.test.ts} +33 -20
- package/src/{permission-set-transition.ts → scope-permissions-transition.ts} +11 -11
- package/src/{permission-set.test.ts → scope-permissions.test.ts} +77 -35
- package/src/scope-permissions.ts +91 -0
- package/src/{resources/account-scope.test.ts → scopes/account-permission.test.ts} +45 -33
- package/src/scopes/account-permission.ts +75 -0
- package/src/{resources/blob-scope.test.ts → scopes/blob-permission.test.ts} +31 -23
- package/src/scopes/blob-permission.ts +105 -0
- package/src/{resources/identity-scope.test.ts → scopes/identity-permission.test.ts} +13 -13
- package/src/scopes/identity-permission.ts +54 -0
- package/src/scopes/include-scope.test.ts +626 -0
- package/src/scopes/include-scope.ts +168 -0
- package/src/{resources/repo-scope.test.ts → scopes/repo-permission.test.ts} +77 -65
- package/src/scopes/repo-permission.ts +111 -0
- package/src/scopes/rpc-permission.test.ts +323 -0
- package/src/scopes/rpc-permission.ts +85 -0
- package/src/scopes-set.test.ts +5 -5
- package/src/scopes-set.ts +79 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
- package/dist/lib/did.d.ts +0 -3
- package/dist/lib/did.d.ts.map +0 -1
- package/dist/lib/did.js +0 -6
- package/dist/lib/did.js.map +0 -1
- package/dist/parser.d.ts +0 -31
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -118
- package/dist/parser.js.map +0 -1
- package/dist/permission-set-transition.d.ts +0 -15
- package/dist/permission-set-transition.d.ts.map +0 -1
- package/dist/permission-set-transition.js.map +0 -1
- package/dist/permission-set.d.ts +0 -22
- package/dist/permission-set.d.ts.map +0 -1
- package/dist/permission-set.js.map +0 -1
- package/dist/resources/account-scope.d.ts +0 -35
- package/dist/resources/account-scope.d.ts.map +0 -1
- package/dist/resources/account-scope.js +0 -60
- package/dist/resources/account-scope.js.map +0 -1
- package/dist/resources/blob-scope.d.ts +0 -25
- package/dist/resources/blob-scope.d.ts.map +0 -1
- package/dist/resources/blob-scope.js +0 -74
- package/dist/resources/blob-scope.js.map +0 -1
- package/dist/resources/identity-scope.d.ts +0 -25
- package/dist/resources/identity-scope.d.ts.map +0 -1
- package/dist/resources/identity-scope.js +0 -46
- package/dist/resources/identity-scope.js.map +0 -1
- package/dist/resources/repo-scope.d.ts +0 -37
- package/dist/resources/repo-scope.d.ts.map +0 -1
- package/dist/resources/repo-scope.js +0 -92
- package/dist/resources/repo-scope.js.map +0 -1
- package/dist/resources/rpc-scope.d.ts +0 -31
- package/dist/resources/rpc-scope.d.ts.map +0 -1
- package/dist/resources/rpc-scope.js +0 -74
- package/dist/resources/rpc-scope.js.map +0 -1
- package/dist/syntax.d.ts +0 -76
- package/dist/syntax.d.ts.map +0 -1
- package/dist/syntax.js +0 -249
- package/dist/syntax.js.map +0 -1
- package/dist/utilities.d.ts +0 -17
- package/dist/utilities.d.ts.map +0 -1
- package/dist/utilities.js +0 -108
- package/dist/utilities.js.map +0 -1
- package/src/lib/did.ts +0 -3
- package/src/parser.ts +0 -150
- package/src/permission-set.ts +0 -78
- package/src/resources/account-scope.ts +0 -66
- package/src/resources/blob-scope.ts +0 -86
- package/src/resources/identity-scope.ts +0 -49
- package/src/resources/repo-scope.ts +0 -101
- package/src/resources/rpc-scope.test.ts +0 -280
- package/src/resources/rpc-scope.ts +0 -77
- package/src/syntax.test.ts +0 -203
- package/src/syntax.ts +0 -325
- package/src/utilities.ts +0 -109
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DIDLike } from '../lib/did.js';
|
|
2
|
-
import { NSID } from '../lib/nsid.js';
|
|
3
|
-
import { Parser } from '../parser.js';
|
|
4
|
-
import { NeRoArray, ResourceSyntax } from '../syntax.js';
|
|
5
|
-
export declare const rpcParser: Parser<"rpc", {
|
|
6
|
-
lxm: {
|
|
7
|
-
multiple: true;
|
|
8
|
-
required: true;
|
|
9
|
-
validate: (value: string) => value is "*" | `${string}.${string}`;
|
|
10
|
-
};
|
|
11
|
-
aud: {
|
|
12
|
-
multiple: false;
|
|
13
|
-
required: true;
|
|
14
|
-
validate: (value: string) => value is "*" | `did:${string}`;
|
|
15
|
-
};
|
|
16
|
-
}>;
|
|
17
|
-
export type RpcScopeMatch = {
|
|
18
|
-
lxm: string;
|
|
19
|
-
aud: string;
|
|
20
|
-
};
|
|
21
|
-
export declare class RpcScope {
|
|
22
|
-
readonly aud: '*' | DIDLike;
|
|
23
|
-
readonly lxm: NeRoArray<'*' | NSID>;
|
|
24
|
-
constructor(aud: '*' | DIDLike, lxm: NeRoArray<'*' | NSID>);
|
|
25
|
-
matches(options: RpcScopeMatch): boolean;
|
|
26
|
-
toString(): string;
|
|
27
|
-
static fromString(scope: string): RpcScope | null;
|
|
28
|
-
static fromSyntax(syntax: ResourceSyntax): RpcScope | null;
|
|
29
|
-
static scopeNeededFor(options: RpcScopeMatch): string;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=rpc-scope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-scope.d.ts","sourceRoot":"","sources":["../../src/resources/rpc-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,IAAI,EAAU,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAsB,MAAM,cAAc,CAAA;AAK5E,eAAO,MAAM,SAAS;;;;0BAHW,MAAM;;;;;0BACN,MAAM;;EAiBtC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,QAAQ;aAED,GAAG,EAAE,GAAG,GAAG,OAAO;aAClB,GAAG,EAAE,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC;gBAD1B,GAAG,EAAE,GAAG,GAAG,OAAO,EAClB,GAAG,EAAE,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC;IAG5C,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;IAQxC,QAAQ,IAAI,MAAM;IAUlB,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAMjD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,GAAG,IAAI;IAU1D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;CAMtD"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RpcScope = exports.rpcParser = void 0;
|
|
4
|
-
const did_js_1 = require("../lib/did.js");
|
|
5
|
-
const nsid_js_1 = require("../lib/nsid.js");
|
|
6
|
-
const parser_js_1 = require("../parser.js");
|
|
7
|
-
const syntax_js_1 = require("../syntax.js");
|
|
8
|
-
const validateLxmParam = (value) => value === '*' || (0, nsid_js_1.isNSID)(value);
|
|
9
|
-
const validateAudParam = (value) => value === '*' || (0, did_js_1.isDIDLike)(value);
|
|
10
|
-
exports.rpcParser = new parser_js_1.Parser('rpc', {
|
|
11
|
-
lxm: {
|
|
12
|
-
multiple: true,
|
|
13
|
-
required: true,
|
|
14
|
-
validate: validateLxmParam,
|
|
15
|
-
},
|
|
16
|
-
aud: {
|
|
17
|
-
multiple: false,
|
|
18
|
-
required: true,
|
|
19
|
-
validate: validateAudParam,
|
|
20
|
-
},
|
|
21
|
-
}, 'lxm');
|
|
22
|
-
class RpcScope {
|
|
23
|
-
constructor(aud, lxm) {
|
|
24
|
-
Object.defineProperty(this, "aud", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: aud
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(this, "lxm", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: lxm
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
matches(options) {
|
|
38
|
-
const { aud, lxm } = this;
|
|
39
|
-
return ((aud === '*' || aud === options.aud) &&
|
|
40
|
-
(lxm.includes('*') || lxm.includes(options.lxm)));
|
|
41
|
-
}
|
|
42
|
-
toString() {
|
|
43
|
-
const { lxm, aud } = this;
|
|
44
|
-
return exports.rpcParser.format({
|
|
45
|
-
aud,
|
|
46
|
-
lxm: lxm.includes('*')
|
|
47
|
-
? ['*']
|
|
48
|
-
: [...new Set(lxm)].sort(),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
static fromString(scope) {
|
|
52
|
-
if (!(0, syntax_js_1.isScopeForResource)(scope, 'rpc'))
|
|
53
|
-
return null;
|
|
54
|
-
const syntax = syntax_js_1.ResourceSyntax.fromString(scope);
|
|
55
|
-
return this.fromSyntax(syntax);
|
|
56
|
-
}
|
|
57
|
-
static fromSyntax(syntax) {
|
|
58
|
-
const result = exports.rpcParser.parse(syntax);
|
|
59
|
-
if (!result)
|
|
60
|
-
return null;
|
|
61
|
-
// rpc:*?aud=* is forbidden
|
|
62
|
-
if (result.aud === '*' && result.lxm.includes('*'))
|
|
63
|
-
return null;
|
|
64
|
-
return new RpcScope(result.aud, result.lxm);
|
|
65
|
-
}
|
|
66
|
-
static scopeNeededFor(options) {
|
|
67
|
-
return exports.rpcParser.format({
|
|
68
|
-
aud: options.aud,
|
|
69
|
-
lxm: [options.lxm],
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.RpcScope = RpcScope;
|
|
74
|
-
//# sourceMappingURL=rpc-scope.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-scope.js","sourceRoot":"","sources":["../../src/resources/rpc-scope.ts"],"names":[],"mappings":";;;AAAA,0CAAkD;AAClD,4CAA6C;AAC7C,4CAAqC;AACrC,4CAA4E;AAE5E,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,IAAA,gBAAM,EAAC,KAAK,CAAC,CAAA;AAC1E,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,IAAA,kBAAS,EAAC,KAAK,CAAC,CAAA;AAEhE,QAAA,SAAS,GAAG,IAAI,kBAAM,CACjC,KAAK,EACL;IACE,GAAG,EAAE;QACH,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,gBAAgB;KAC3B;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,gBAAgB;KAC3B;CACF,EACD,KAAK,CACN,CAAA;AAOD,MAAa,QAAQ;IACnB,YACkB,GAAkB,EAClB,GAA0B;QAD1C;;;;mBAAgB,GAAG;WAAe;QAClC;;;;mBAAgB,GAAG;WAAuB;IACzC,CAAC;IAEJ,OAAO,CAAC,OAAsB;QAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QACzB,OAAO,CACL,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;YACpC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAK,GAAyB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,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ntax.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export type NeArray<T> = [T, ...T[]];
|
|
2
|
-
/**
|
|
3
|
-
* Non-empty readonly array
|
|
4
|
-
*/
|
|
5
|
-
export type NeRoArray<T> = readonly [T, ...T[]];
|
|
6
|
-
export type ScopeForResource<R extends string> = R | `${R}:${string}` | `${R}?${string}`;
|
|
7
|
-
export type ResourceSyntaxJson<R extends string = string> = {
|
|
8
|
-
resource: R;
|
|
9
|
-
positional?: string;
|
|
10
|
-
params?: Record<string, undefined | string | NeRoArray<string>>;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Allows to quickly check if a scope is for a specific resource.
|
|
14
|
-
*/
|
|
15
|
-
export declare function isScopeForResource<R extends string>(scope: string, resource: R): scope is ScopeForResource<R>;
|
|
16
|
-
/**
|
|
17
|
-
* Utility class to parse and interpret the resource scope syntax used in
|
|
18
|
-
* atproto oauth scopes.
|
|
19
|
-
* The syntax is defined as follows:
|
|
20
|
-
* ```nbf
|
|
21
|
-
* scope := resource [':' positional] ['?' params]
|
|
22
|
-
* params := param ['&' param]*
|
|
23
|
-
* param := name '=' value
|
|
24
|
-
* ```
|
|
25
|
-
* Where "positional" can be used as short-hand (i.e. not used in combination
|
|
26
|
-
* with) for a specific parameter.
|
|
27
|
-
*/
|
|
28
|
-
export declare class ResourceSyntax<R extends string = string> {
|
|
29
|
-
readonly resource: R;
|
|
30
|
-
readonly positional?: string | undefined;
|
|
31
|
-
readonly params?: Readonly<URLSearchParams> | undefined;
|
|
32
|
-
constructor(resource: R, positional?: string | undefined, params?: Readonly<URLSearchParams> | undefined);
|
|
33
|
-
is<T extends string>(resource: T): this is ResourceSyntax<T>;
|
|
34
|
-
containsParamsOtherThan(allowedParam: readonly string[]): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieve the value of a parameter that only allows a single value. If the
|
|
37
|
-
* parameter is not found, it will return `undefined`. If the syntax is
|
|
38
|
-
* incorrect (i.e. the parameter has multiple values), it will return `null`.
|
|
39
|
-
*/
|
|
40
|
-
getSingle(name: string, isPositional?: boolean): string | undefined | null;
|
|
41
|
-
/**
|
|
42
|
-
* Retrieve the values of a parameter that allows multiple values. If the
|
|
43
|
-
* parameter is not found, it will return `undefined`. If the syntax is
|
|
44
|
-
* incorrect (i.e. there is bot a positional and named parameter), it will
|
|
45
|
-
* return `null`.
|
|
46
|
-
*/
|
|
47
|
-
getMulti(name: string, isPositional?: false): NeRoArray<string> | undefined;
|
|
48
|
-
getMulti(name: string, isPositional: boolean): NeRoArray<string> | null | undefined;
|
|
49
|
-
toString(): ScopeForResource<R>;
|
|
50
|
-
toJSON(): ResourceSyntaxJson<R>;
|
|
51
|
-
static fromString<R extends string>(scope: R | `${R}:${string}` | `${R}?${string}`): ResourceSyntax<R>;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Format a scope string for a resource with parameters
|
|
55
|
-
* as a positional parameter, if possible (if it has only one value).
|
|
56
|
-
* @param resource - The resource name (e.g. `rpc`, `repo`, etc.)
|
|
57
|
-
* @param inputParams - The list of parameters.
|
|
58
|
-
* @param positionalName - The name of the parameter that should be used as
|
|
59
|
-
* positional parameter.
|
|
60
|
-
*/
|
|
61
|
-
export declare function formatScope<R extends string>(resource: R, inputParams: Iterable<[
|
|
62
|
-
name: string,
|
|
63
|
-
value: undefined | string | NeRoArray<string>
|
|
64
|
-
]>, positionalName?: string): ScopeForResource<R>;
|
|
65
|
-
export declare function encodeScope<R extends string>(resource: R, positional?: string, params?: Readonly<URLSearchParams>): ScopeForResource<R>;
|
|
66
|
-
/**
|
|
67
|
-
* Set of characters that are allowed in scope components without encoding. This
|
|
68
|
-
* is used to normalize scope components.
|
|
69
|
-
*/
|
|
70
|
-
export declare const ALLOWED_SCOPE_CHARS: Set<string>;
|
|
71
|
-
export declare function encodeScopeComponent(value: string): string;
|
|
72
|
-
/**
|
|
73
|
-
* Assumes a properly url-encoded string.
|
|
74
|
-
*/
|
|
75
|
-
export declare function normalizeScopeComponent(value: string): string;
|
|
76
|
-
//# sourceMappingURL=syntax.d.ts.map
|
package/dist/syntax.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../src/syntax.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;AAEpC;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;AAE/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IACzC,CAAC,GACD,GAAG,CAAC,IAAI,MAAM,EAAE,GAChB,GAAG,CAAC,IAAI,MAAM,EAAE,CAAA;AAEpB,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAC1D,QAAQ,EAAE,CAAC,CAAA;IACX,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;CAChE,CAAA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,GACV,KAAK,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAM9B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;aAEjC,QAAQ,EAAE,CAAC;aACX,UAAU,CAAC,EAAE,MAAM;aACnB,MAAM,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;gBAFlC,QAAQ,EAAE,CAAC,EACX,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,MAAM,CAAC,EAAE,QAAQ,CAAC,eAA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,CAAC,eAAe,CAAC,GACjC,gBAAgB,CAAC,CAAC,CAAC,CAYrB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAI/B,CAAA;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAeD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4B7D"}
|
package/dist/syntax.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALLOWED_SCOPE_CHARS = exports.ResourceSyntax = void 0;
|
|
4
|
-
exports.isScopeForResource = isScopeForResource;
|
|
5
|
-
exports.formatScope = formatScope;
|
|
6
|
-
exports.encodeScope = encodeScope;
|
|
7
|
-
exports.encodeScopeComponent = encodeScopeComponent;
|
|
8
|
-
exports.normalizeScopeComponent = normalizeScopeComponent;
|
|
9
|
-
const util_1 = require("./lib/util");
|
|
10
|
-
/**
|
|
11
|
-
* Allows to quickly check if a scope is for a specific resource.
|
|
12
|
-
*/
|
|
13
|
-
function isScopeForResource(scope, resource) {
|
|
14
|
-
if (!scope.startsWith(resource))
|
|
15
|
-
return false;
|
|
16
|
-
if (scope.length === resource.length)
|
|
17
|
-
return true;
|
|
18
|
-
const nextCharCode = scope.charCodeAt(resource.length);
|
|
19
|
-
return nextCharCode === 0x3a /* : */ || nextCharCode === 0x3f; /* ? */
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Utility class to parse and interpret the resource scope syntax used in
|
|
23
|
-
* atproto oauth scopes.
|
|
24
|
-
* The syntax is defined as follows:
|
|
25
|
-
* ```nbf
|
|
26
|
-
* scope := resource [':' positional] ['?' params]
|
|
27
|
-
* params := param ['&' param]*
|
|
28
|
-
* param := name '=' value
|
|
29
|
-
* ```
|
|
30
|
-
* Where "positional" can be used as short-hand (i.e. not used in combination
|
|
31
|
-
* with) for a specific parameter.
|
|
32
|
-
*/
|
|
33
|
-
class ResourceSyntax {
|
|
34
|
-
constructor(resource, positional, params) {
|
|
35
|
-
Object.defineProperty(this, "resource", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: resource
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, "positional", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: positional
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(this, "params", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: params
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
is(resource) {
|
|
55
|
-
return this.resource === resource;
|
|
56
|
-
}
|
|
57
|
-
containsParamsOtherThan(allowedParam) {
|
|
58
|
-
const { params } = this;
|
|
59
|
-
if (params) {
|
|
60
|
-
for (const key of params.keys()) {
|
|
61
|
-
if (!allowedParam.includes(key))
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Retrieve the value of a parameter that only allows a single value. If the
|
|
69
|
-
* parameter is not found, it will return `undefined`. If the syntax is
|
|
70
|
-
* incorrect (i.e. the parameter has multiple values), it will return `null`.
|
|
71
|
-
*/
|
|
72
|
-
getSingle(name, isPositional = false) {
|
|
73
|
-
const { params } = this;
|
|
74
|
-
const values = params != null && params.has(name)
|
|
75
|
-
? params.getAll(name)
|
|
76
|
-
: undefined;
|
|
77
|
-
if (!values) {
|
|
78
|
-
// No named parameter found, use positional parameter
|
|
79
|
-
if (isPositional)
|
|
80
|
-
return this.positional;
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
if (values.length !== 1) {
|
|
84
|
-
// Single value expected
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
if (isPositional && this.positional !== undefined) {
|
|
88
|
-
// Positional parameter cannot be used with named parameters
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return values[0];
|
|
92
|
-
}
|
|
93
|
-
getMulti(name, isPositional = false) {
|
|
94
|
-
const { params } = this;
|
|
95
|
-
const values = params != null && params.has(name)
|
|
96
|
-
? params.getAll(name)
|
|
97
|
-
: undefined;
|
|
98
|
-
if (!values) {
|
|
99
|
-
// No named parameter found, use positional parameter
|
|
100
|
-
if (isPositional && this.positional !== undefined) {
|
|
101
|
-
return [this.positional];
|
|
102
|
-
}
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
if (isPositional && this.positional !== undefined) {
|
|
106
|
-
// @NOTE we *could* return [this.positional, ...values] here but the
|
|
107
|
-
// atproto scope syntax forbids use of both positional and named
|
|
108
|
-
// parameters.
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
return values;
|
|
112
|
-
}
|
|
113
|
-
toString() {
|
|
114
|
-
return encodeScope(this.resource, this.positional, this.params);
|
|
115
|
-
}
|
|
116
|
-
toJSON() {
|
|
117
|
-
return {
|
|
118
|
-
resource: this.resource,
|
|
119
|
-
positional: this.positional,
|
|
120
|
-
params: this.params?.size ? (0, util_1.toRecord)(this.params) : undefined,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
static fromString(scope) {
|
|
124
|
-
const paramIdx = scope.indexOf('?');
|
|
125
|
-
const colonIdx = scope.indexOf(':');
|
|
126
|
-
const resourceEnd = (0, util_1.minIdx)(paramIdx, colonIdx);
|
|
127
|
-
const resource = (resourceEnd !== -1 ? scope.slice(0, resourceEnd) : scope);
|
|
128
|
-
const positional = colonIdx !== -1
|
|
129
|
-
? // There is a positional parameter, extract it
|
|
130
|
-
paramIdx === -1
|
|
131
|
-
? decodeURIComponent(scope.slice(colonIdx + 1))
|
|
132
|
-
: colonIdx < paramIdx
|
|
133
|
-
? decodeURIComponent(scope.slice(colonIdx + 1, paramIdx))
|
|
134
|
-
: undefined
|
|
135
|
-
: undefined;
|
|
136
|
-
const params = paramIdx !== -1 // There is a query string
|
|
137
|
-
? paramIdx === scope.length - 1
|
|
138
|
-
? undefined // The query string is empty
|
|
139
|
-
: new URLSearchParams(scope.slice(paramIdx + 1))
|
|
140
|
-
: undefined;
|
|
141
|
-
return new ResourceSyntax(resource, positional, params);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.ResourceSyntax = ResourceSyntax;
|
|
145
|
-
/**
|
|
146
|
-
* Format a scope string for a resource with parameters
|
|
147
|
-
* as a positional parameter, if possible (if it has only one value).
|
|
148
|
-
* @param resource - The resource name (e.g. `rpc`, `repo`, etc.)
|
|
149
|
-
* @param inputParams - The list of parameters.
|
|
150
|
-
* @param positionalName - The name of the parameter that should be used as
|
|
151
|
-
* positional parameter.
|
|
152
|
-
*/
|
|
153
|
-
function formatScope(resource, inputParams, positionalName) {
|
|
154
|
-
const queryParams = new URLSearchParams();
|
|
155
|
-
let positionalValue = undefined;
|
|
156
|
-
for (const [name, value] of inputParams) {
|
|
157
|
-
if (value === undefined)
|
|
158
|
-
continue;
|
|
159
|
-
const setPositional = name === positionalName && positionalValue === undefined;
|
|
160
|
-
if (typeof value === 'string') {
|
|
161
|
-
if (setPositional) {
|
|
162
|
-
positionalValue = value;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
queryParams.append(name, value);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// value is "readonly [string, ...string[]]"
|
|
170
|
-
if (value.length === 0) {
|
|
171
|
-
// This should never happen (because "value" is supposed to be a
|
|
172
|
-
// non-empty array). Because some scope default to "*" (allow
|
|
173
|
-
// everything) when a parameter is not specified, we'd rather be safe
|
|
174
|
-
// here.
|
|
175
|
-
throw new Error(`Invalid scope: parameter "${name}" cannot be an empty array`);
|
|
176
|
-
}
|
|
177
|
-
else if (setPositional && value.length === 1) {
|
|
178
|
-
positionalValue = value[0];
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
for (const v of value) {
|
|
182
|
-
queryParams.append(name, v);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
// Fool-proof: If the input iterable defines multiple times the same
|
|
188
|
-
// positional parameter (name), and it ended up being used as both positional
|
|
189
|
-
// and query param, move the positional value to the query params.
|
|
190
|
-
if (positionalValue !== undefined && queryParams.has(positionalName)) {
|
|
191
|
-
queryParams.append(positionalName, positionalValue);
|
|
192
|
-
positionalValue = undefined;
|
|
193
|
-
}
|
|
194
|
-
return encodeScope(resource, positionalValue, queryParams);
|
|
195
|
-
}
|
|
196
|
-
function encodeScope(resource, positional, params) {
|
|
197
|
-
let scope = resource;
|
|
198
|
-
if (positional !== undefined) {
|
|
199
|
-
scope += `:${encodeScopeComponent(positional)}`;
|
|
200
|
-
}
|
|
201
|
-
if (params?.size) {
|
|
202
|
-
scope += `?${normalizeScopeComponent(params.toString())}`;
|
|
203
|
-
}
|
|
204
|
-
return scope;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Set of characters that are allowed in scope components without encoding. This
|
|
208
|
-
* is used to normalize scope components.
|
|
209
|
-
*/
|
|
210
|
-
exports.ALLOWED_SCOPE_CHARS = new Set(
|
|
211
|
-
// @NOTE This list must not contain "?" or "&" as it would interfere with
|
|
212
|
-
// query string parsing.
|
|
213
|
-
[':', '/', '+', ',', '@', '%']);
|
|
214
|
-
function encodeScopeComponent(value) {
|
|
215
|
-
return normalizeScopeComponent(encodeURIComponent(value));
|
|
216
|
-
}
|
|
217
|
-
const NORMALIZABLE_CHARS_MAP = new Map(Array.from(exports.ALLOWED_SCOPE_CHARS, (c) => [encodeURIComponent(c), c]).filter(([encoded, c]) =>
|
|
218
|
-
// Make sure that any char added to ALLOWED_SCOPE_CHARS that is a char
|
|
219
|
-
// that indeed needs encoding. Also, the normalizeScopeComponent only
|
|
220
|
-
// supports three-character percent-encoded sequences.
|
|
221
|
-
encoded !== c && encoded.length === 3 && encoded.startsWith('%')));
|
|
222
|
-
/**
|
|
223
|
-
* Assumes a properly url-encoded string.
|
|
224
|
-
*/
|
|
225
|
-
function normalizeScopeComponent(value) {
|
|
226
|
-
// No need to read the last two characters since percent encoded characters
|
|
227
|
-
// are always three characters long.
|
|
228
|
-
let end = value.length - 2;
|
|
229
|
-
for (let i = 0; i < end; i++) {
|
|
230
|
-
// Check if the character is a percent-encoded character
|
|
231
|
-
if (value.charCodeAt(i) === 0x25 /* % */) {
|
|
232
|
-
// Read the next encoded char. Current version only supports
|
|
233
|
-
// three-character percent-encoded sequences.
|
|
234
|
-
const encodedChar = value.slice(i, i + 3);
|
|
235
|
-
// Check if the encoded character is in the normalization map
|
|
236
|
-
const normalizedChar = NORMALIZABLE_CHARS_MAP.get(encodedChar);
|
|
237
|
-
if (normalizedChar) {
|
|
238
|
-
// Replace the encoded character with its normalized version
|
|
239
|
-
value = `${value.slice(0, i)}${normalizedChar}${value.slice(i + encodedChar.length)}`;
|
|
240
|
-
// Adjust index to account for the length change
|
|
241
|
-
i += normalizedChar.length - 1;
|
|
242
|
-
// Adjust end index since we replaced encoded char with normalized char
|
|
243
|
-
end -= encodedChar.length - normalizedChar.length;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return value;
|
|
248
|
-
}
|
|
249
|
-
//# sourceMappingURL=syntax.js.map
|
package/dist/syntax.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax.js","sourceRoot":"","sources":["../src/syntax.ts"],"names":[],"mappings":";;;AAuBA,gDASC;AAkKD,kCAoDC;AAED,kCAgBC;AAYD,oDAEC;AAkBD,0DA4BC;AApUD,qCAA6C;AAoB7C;;GAEG;AACH,SAAgB,kBAAkB,CAChC,KAAa,EACb,QAAW;IAEX,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAA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M,KAAK,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CACnE,CACF,CAAA;AAED;;GAEG;AACH,SAAgB,uBAAuB,CAAC,KAAa;IACnD,2EAA2E;IAC3E,oCAAoC;IACpC,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,wDAAwD;QACxD,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,4DAA4D;YAC5D,6CAA6C;YAC7C,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;YAEzC,6DAA6D;YAC7D,MAAM,cAAc,GAAG,sBAAsB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;YAC9D,IAAI,cAAc,EAAE,CAAC;gBACnB,4DAA4D;gBAC5D,KAAK,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAA;gBAErF,gDAAgD;gBAChD,CAAC,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,CAAA;gBAE9B,uEAAuE;gBACvE,GAAG,IAAI,WAAW,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAA;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/utilities.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AccountScope, AccountScopeMatch } from './resources/account-scope.js';
|
|
2
|
-
import { BlobScope, BlobScopeMatch } from './resources/blob-scope.js';
|
|
3
|
-
import { IdentityScope, IdentityScopeMatch } from './resources/identity-scope.js';
|
|
4
|
-
import { RepoScope, RepoScopeMatch } from './resources/repo-scope.js';
|
|
5
|
-
import { RpcScope, RpcScopeMatch } from './resources/rpc-scope.js';
|
|
6
|
-
export type ScopeMatchingOptionsByResource = {
|
|
7
|
-
account: AccountScopeMatch;
|
|
8
|
-
identity: IdentityScopeMatch;
|
|
9
|
-
repo: RepoScopeMatch;
|
|
10
|
-
rpc: RpcScopeMatch;
|
|
11
|
-
blob: BlobScopeMatch;
|
|
12
|
-
};
|
|
13
|
-
export declare function isValidAtprotoOauthScope(value: string): boolean;
|
|
14
|
-
export declare function parseScope(string: string): AccountScope | BlobScope | IdentityScope | RepoScope | RpcScope | null;
|
|
15
|
-
export declare function scopeNeededFor<R extends keyof ScopeMatchingOptionsByResource>(resource: R, options: ScopeMatchingOptionsByResource[R]): string;
|
|
16
|
-
export declare function scopeMatches<R extends keyof ScopeMatchingOptionsByResource>(scope: string, resource: R, options: ScopeMatchingOptionsByResource[R]): boolean;
|
|
17
|
-
//# sourceMappingURL=utilities.d.ts.map
|
package/dist/utilities.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACL,aAAa,EACb,kBAAkB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGlE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,iBAAiB,CAAA;IAC1B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,GAAG,EAAE,aAAa,CAAA;IAClB,IAAI,EAAE,cAAc,CAAA;CACrB,CAAA;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,WAoBrD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,0EAQxC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,8BAA8B,EAC3E,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC,GACzC,MAAM,CAaR;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,8BAA8B,EACzE,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC,GACzC,OAAO,CAoCT"}
|
package/dist/utilities.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidAtprotoOauthScope = isValidAtprotoOauthScope;
|
|
4
|
-
exports.parseScope = parseScope;
|
|
5
|
-
exports.scopeNeededFor = scopeNeededFor;
|
|
6
|
-
exports.scopeMatches = scopeMatches;
|
|
7
|
-
const account_scope_js_1 = require("./resources/account-scope.js");
|
|
8
|
-
const blob_scope_js_1 = require("./resources/blob-scope.js");
|
|
9
|
-
const identity_scope_js_1 = require("./resources/identity-scope.js");
|
|
10
|
-
const repo_scope_js_1 = require("./resources/repo-scope.js");
|
|
11
|
-
const rpc_scope_js_1 = require("./resources/rpc-scope.js");
|
|
12
|
-
const syntax_js_1 = require("./syntax.js");
|
|
13
|
-
function isValidAtprotoOauthScope(value) {
|
|
14
|
-
if (value === 'atproto')
|
|
15
|
-
return true;
|
|
16
|
-
if (value === 'transition:email')
|
|
17
|
-
return true;
|
|
18
|
-
if (value === 'transition:generic')
|
|
19
|
-
return true;
|
|
20
|
-
if (value === 'transition:chat.bsky')
|
|
21
|
-
return true;
|
|
22
|
-
const syntax = syntax_js_1.ResourceSyntax.fromString(value);
|
|
23
|
-
if (syntax.resource === 'repo') {
|
|
24
|
-
return repo_scope_js_1.RepoScope.fromSyntax(syntax) != null;
|
|
25
|
-
}
|
|
26
|
-
else if (syntax.resource === 'rpc') {
|
|
27
|
-
return rpc_scope_js_1.RpcScope.fromSyntax(syntax) != null;
|
|
28
|
-
}
|
|
29
|
-
else if (syntax.resource === 'account') {
|
|
30
|
-
return account_scope_js_1.AccountScope.fromSyntax(syntax) != null;
|
|
31
|
-
}
|
|
32
|
-
else if (syntax.resource === 'identity') {
|
|
33
|
-
return identity_scope_js_1.IdentityScope.fromSyntax(syntax) != null;
|
|
34
|
-
}
|
|
35
|
-
else if (syntax.resource === 'blob') {
|
|
36
|
-
return blob_scope_js_1.BlobScope.fromSyntax(syntax) != null;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
function parseScope(string) {
|
|
41
|
-
const syntax = syntax_js_1.ResourceSyntax.fromString(string);
|
|
42
|
-
if (syntax.is('account'))
|
|
43
|
-
return account_scope_js_1.AccountScope.fromSyntax(syntax);
|
|
44
|
-
if (syntax.is('identity'))
|
|
45
|
-
return identity_scope_js_1.IdentityScope.fromSyntax(syntax);
|
|
46
|
-
if (syntax.is('repo'))
|
|
47
|
-
return repo_scope_js_1.RepoScope.fromSyntax(syntax);
|
|
48
|
-
if (syntax.is('rpc'))
|
|
49
|
-
return rpc_scope_js_1.RpcScope.fromSyntax(syntax);
|
|
50
|
-
if (syntax.is('blob'))
|
|
51
|
-
return blob_scope_js_1.BlobScope.fromSyntax(syntax);
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
function scopeNeededFor(resource, options) {
|
|
55
|
-
switch (resource) {
|
|
56
|
-
case 'account':
|
|
57
|
-
return account_scope_js_1.AccountScope.scopeNeededFor(options);
|
|
58
|
-
case 'identity':
|
|
59
|
-
return identity_scope_js_1.IdentityScope.scopeNeededFor(options);
|
|
60
|
-
case 'repo':
|
|
61
|
-
return repo_scope_js_1.RepoScope.scopeNeededFor(options);
|
|
62
|
-
case 'rpc':
|
|
63
|
-
return rpc_scope_js_1.RpcScope.scopeNeededFor(options);
|
|
64
|
-
case 'blob':
|
|
65
|
-
return blob_scope_js_1.BlobScope.scopeNeededFor(options);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function scopeMatches(scope, resource, options) {
|
|
69
|
-
// Optimization: Do not try parsing the scope if it does not match the
|
|
70
|
-
// resource prefix.
|
|
71
|
-
if (!(0, syntax_js_1.isScopeForResource)(scope, resource))
|
|
72
|
-
return false;
|
|
73
|
-
// @NOTE we might want to cache the parsed scopes though, in practice, a
|
|
74
|
-
// single scope is unlikely to be parsed multiple times during a single
|
|
75
|
-
// request.
|
|
76
|
-
if (resource === 'rpc') {
|
|
77
|
-
const rpcScope = rpc_scope_js_1.RpcScope.fromString(scope);
|
|
78
|
-
if (rpcScope?.matches(options)) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else if (resource === 'account') {
|
|
83
|
-
const accountScope = account_scope_js_1.AccountScope.fromString(scope);
|
|
84
|
-
if (accountScope?.matches(options)) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else if (resource === 'identity') {
|
|
89
|
-
const identityScope = identity_scope_js_1.IdentityScope.fromString(scope);
|
|
90
|
-
if (identityScope?.matches(options)) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else if (resource === 'repo') {
|
|
95
|
-
const repoScope = repo_scope_js_1.RepoScope.fromString(scope);
|
|
96
|
-
if (repoScope?.matches(options)) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (resource === 'blob') {
|
|
101
|
-
const blobScope = blob_scope_js_1.BlobScope.fromString(scope);
|
|
102
|
-
if (blobScope?.matches(options)) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=utilities.js.map
|
package/dist/utilities.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":";;AAkBA,4DAoBC;AAED,gCAQC;AAED,wCAgBC;AAED,oCAwCC;AA5GD,mEAA8E;AAC9E,6DAAqE;AACrE,qEAGsC;AACtC,6DAAqE;AACrE,2DAAkE;AAClE,2CAAgE;AAUhE,SAAgB,wBAAwB,CAAC,KAAa;IACpD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACpC,IAAI,KAAK,KAAK,kBAAkB;QAAE,OAAO,IAAI,CAAA;IAC7C,IAAI,KAAK,KAAK,oBAAoB;QAAE,OAAO,IAAI,CAAA;IAC/C,IAAI,KAAK,KAAK,sBAAsB;QAAE,OAAO,IAAI,CAAA;IAEjD,MAAM,MAAM,GAAG,0BAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC/C,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,yBAAS,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAC7C,CAAC;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO,uBAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAC5C,CAAC;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,+BAAY,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAChD,CAAC;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1C,OAAO,iCAAa,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IACjD,CAAC;SAAM,IAAI,MAAM,CAAC,Q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