@atcute/client 2.0.6 → 2.0.7
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.
|
@@ -3,7 +3,7 @@ import { type FetchHandlerObject } from './fetch-handler.js';
|
|
|
3
3
|
/** Interface for the decoded access token, for convenience */
|
|
4
4
|
export interface AtpAccessJwt {
|
|
5
5
|
/** Access token scope, app password returns a different scope. */
|
|
6
|
-
scope: 'com.atproto.access' | 'com.atproto.appPass' | 'com.atproto.appPassPrivileged';
|
|
6
|
+
scope: 'com.atproto.access' | 'com.atproto.appPass' | 'com.atproto.appPassPrivileged' | 'com.atproto.signupQueued' | 'com.atproto.takendown';
|
|
7
7
|
/** Account DID */
|
|
8
8
|
sub: At.DID;
|
|
9
9
|
/** Expiration time */
|
|
@@ -90,4 +90,6 @@ export interface AuthLoginOptions {
|
|
|
90
90
|
password: string;
|
|
91
91
|
/** Two-factor authentication code */
|
|
92
92
|
code?: string;
|
|
93
|
+
/** Allow signing in even if the account has been taken down, */
|
|
94
|
+
allowTakendown?: boolean;
|
|
93
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../lib/credential-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAoB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../lib/credential-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAoB,MAAM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AAC;QACzD,OAAO,KAAK,KAAK,cAAc,IAAI,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC/C,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;AAC3D,CAAC,CAAC;AACF,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAE,EAAE;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
package/dist/lexicons.d.ts
CHANGED
|
@@ -441,6 +441,14 @@ export declare namespace ComAtprotoLabelSubscribeLabels {
|
|
|
441
441
|
seq: number;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
+
export declare namespace ComAtprotoLexiconSchema {
|
|
445
|
+
/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */
|
|
446
|
+
interface Record {
|
|
447
|
+
$type: 'com.atproto.lexicon.schema';
|
|
448
|
+
/** Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. */
|
|
449
|
+
lexicon: number;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
444
452
|
/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */
|
|
445
453
|
export declare namespace ComAtprotoModerationCreateReport {
|
|
446
454
|
interface Params {
|
|
@@ -896,6 +904,8 @@ export declare namespace ComAtprotoServerCreateSession {
|
|
|
896
904
|
/** Handle or other identifier supported by the server for the authenticating user. */
|
|
897
905
|
identifier: string;
|
|
898
906
|
password: string;
|
|
907
|
+
/** When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned */
|
|
908
|
+
allowTakendown?: boolean;
|
|
899
909
|
authFactorToken?: string;
|
|
900
910
|
}
|
|
901
911
|
interface Output {
|
|
@@ -1539,6 +1549,7 @@ export declare namespace ComAtprotoTempRequestPhoneVerification {
|
|
|
1539
1549
|
type Output = undefined;
|
|
1540
1550
|
}
|
|
1541
1551
|
export declare interface Records {
|
|
1552
|
+
'com.atproto.lexicon.schema': ComAtprotoLexiconSchema.Record;
|
|
1542
1553
|
}
|
|
1543
1554
|
export declare interface Queries {
|
|
1544
1555
|
'com.atproto.admin.getAccountInfo': {
|
|
@@ -9,7 +9,12 @@ import { decodeJwt } from './utils/jwt.js';
|
|
|
9
9
|
/** Interface for the decoded access token, for convenience */
|
|
10
10
|
export interface AtpAccessJwt {
|
|
11
11
|
/** Access token scope, app password returns a different scope. */
|
|
12
|
-
scope:
|
|
12
|
+
scope:
|
|
13
|
+
| 'com.atproto.access'
|
|
14
|
+
| 'com.atproto.appPass'
|
|
15
|
+
| 'com.atproto.appPassPrivileged'
|
|
16
|
+
| 'com.atproto.signupQueued'
|
|
17
|
+
| 'com.atproto.takendown';
|
|
13
18
|
/** Account DID */
|
|
14
19
|
sub: At.DID;
|
|
15
20
|
/** Expiration time */
|
|
@@ -264,6 +269,7 @@ export class CredentialManager implements FetchHandlerObject {
|
|
|
264
269
|
identifier: options.identifier,
|
|
265
270
|
password: options.password,
|
|
266
271
|
authFactorToken: options.code,
|
|
272
|
+
allowTakendown: options.allowTakendown,
|
|
267
273
|
},
|
|
268
274
|
});
|
|
269
275
|
|
|
@@ -279,6 +285,8 @@ export interface AuthLoginOptions {
|
|
|
279
285
|
password: string;
|
|
280
286
|
/** Two-factor authentication code */
|
|
281
287
|
code?: string;
|
|
288
|
+
/** Allow signing in even if the account has been taken down, */
|
|
289
|
+
allowTakendown?: boolean;
|
|
282
290
|
}
|
|
283
291
|
|
|
284
292
|
const isExpiredTokenResponse = async (response: Response): Promise<boolean> => {
|
package/lib/lexicons.ts
CHANGED
|
@@ -476,6 +476,15 @@ export declare namespace ComAtprotoLabelSubscribeLabels {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
export declare namespace ComAtprotoLexiconSchema {
|
|
480
|
+
/** Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc). */
|
|
481
|
+
interface Record {
|
|
482
|
+
$type: 'com.atproto.lexicon.schema';
|
|
483
|
+
/** Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. */
|
|
484
|
+
lexicon: number;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
479
488
|
/** Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth. */
|
|
480
489
|
export declare namespace ComAtprotoModerationCreateReport {
|
|
481
490
|
interface Params {}
|
|
@@ -945,6 +954,8 @@ export declare namespace ComAtprotoServerCreateSession {
|
|
|
945
954
|
/** Handle or other identifier supported by the server for the authenticating user. */
|
|
946
955
|
identifier: string;
|
|
947
956
|
password: string;
|
|
957
|
+
/** When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned */
|
|
958
|
+
allowTakendown?: boolean;
|
|
948
959
|
authFactorToken?: string;
|
|
949
960
|
}
|
|
950
961
|
interface Output {
|
|
@@ -1602,7 +1613,9 @@ export declare namespace ComAtprotoTempRequestPhoneVerification {
|
|
|
1602
1613
|
type Output = undefined;
|
|
1603
1614
|
}
|
|
1604
1615
|
|
|
1605
|
-
export declare interface Records {
|
|
1616
|
+
export declare interface Records {
|
|
1617
|
+
'com.atproto.lexicon.schema': ComAtprotoLexiconSchema.Record;
|
|
1618
|
+
}
|
|
1606
1619
|
|
|
1607
1620
|
export declare interface Queries {
|
|
1608
1621
|
'com.atproto.admin.getAccountInfo': {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@atcute/client",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.7",
|
|
5
5
|
"description": "lightweight and cute API client for AT Protocol",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"./utils/jwt": "./dist/utils/jwt.js"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@vitest/coverage-v8": "^2.1.
|
|
26
|
-
"vitest": "^2.1.
|
|
25
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
26
|
+
"vitest": "^2.1.8",
|
|
27
27
|
"@atcute/internal-dev-env": "^1.0.1",
|
|
28
|
-
"@atcute/lex-cli": "^1.0.
|
|
28
|
+
"@atcute/lex-cli": "^1.0.4"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc --project tsconfig.build.json",
|
|
32
|
-
"test": "vitest run",
|
|
32
|
+
"test": "vitest run --coverage",
|
|
33
33
|
"generate": "./scripts/generate-lexicons.sh",
|
|
34
34
|
"prepublish": "rm -rf dist; pnpm run build"
|
|
35
35
|
}
|