@atproto/pds 0.4.33 → 0.4.35
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +17 -0
- package/dist/account-manager/db/migrations/004-oauth.d.ts +4 -0
- package/dist/account-manager/db/migrations/004-oauth.d.ts.map +1 -0
- package/dist/account-manager/db/migrations/004-oauth.js +106 -0
- package/dist/account-manager/db/migrations/004-oauth.js.map +1 -0
- package/dist/account-manager/db/migrations/index.d.ts +2 -0
- package/dist/account-manager/db/migrations/index.d.ts.map +1 -1
- package/dist/account-manager/db/migrations/index.js +2 -0
- package/dist/account-manager/db/migrations/index.js.map +1 -1
- package/dist/account-manager/db/schema/authorization-request.d.ts +19 -0
- package/dist/account-manager/db/schema/authorization-request.d.ts.map +1 -0
- package/dist/account-manager/db/schema/authorization-request.js +5 -0
- package/dist/account-manager/db/schema/authorization-request.js.map +1 -0
- package/dist/account-manager/db/schema/device-account.d.ts +14 -0
- package/dist/account-manager/db/schema/device-account.d.ts.map +1 -0
- package/dist/account-manager/db/schema/device-account.js +5 -0
- package/dist/account-manager/db/schema/device-account.js.map +1 -0
- package/dist/account-manager/db/schema/device.d.ts +16 -0
- package/dist/account-manager/db/schema/device.d.ts.map +1 -0
- package/dist/account-manager/db/schema/device.js +5 -0
- package/dist/account-manager/db/schema/device.js.map +1 -0
- package/dist/account-manager/db/schema/index.d.ts +11 -1
- package/dist/account-manager/db/schema/index.d.ts.map +1 -1
- package/dist/account-manager/db/schema/token.d.ts +24 -0
- package/dist/account-manager/db/schema/token.d.ts.map +1 -0
- package/dist/account-manager/db/schema/token.js +5 -0
- package/dist/account-manager/db/schema/token.js.map +1 -0
- package/dist/account-manager/db/schema/used-refresh-token.d.ts +12 -0
- package/dist/account-manager/db/schema/used-refresh-token.d.ts.map +1 -0
- package/dist/account-manager/db/schema/used-refresh-token.js +5 -0
- package/dist/account-manager/db/schema/used-refresh-token.js.map +1 -0
- package/dist/account-manager/helpers/account.d.ts +27 -5
- package/dist/account-manager/helpers/account.d.ts.map +1 -1
- package/dist/account-manager/helpers/account.js +15 -14
- package/dist/account-manager/helpers/account.js.map +1 -1
- package/dist/account-manager/helpers/authorization-request.d.ts +12 -0
- package/dist/account-manager/helpers/authorization-request.d.ts.map +1 -0
- package/dist/account-manager/helpers/authorization-request.js +59 -0
- package/dist/account-manager/helpers/authorization-request.js.map +1 -0
- package/dist/account-manager/helpers/device-account.d.ts +108 -0
- package/dist/account-manager/helpers/device-account.d.ts.map +1 -0
- package/dist/account-manager/helpers/device-account.js +82 -0
- package/dist/account-manager/helpers/device-account.js.map +1 -0
- package/dist/account-manager/helpers/device.d.ts +9 -0
- package/dist/account-manager/helpers/device.d.ts.map +1 -0
- package/dist/account-manager/helpers/device.js +32 -0
- package/dist/account-manager/helpers/device.js.map +1 -0
- package/dist/account-manager/helpers/token.d.ts +485 -0
- package/dist/account-manager/helpers/token.d.ts.map +1 -0
- package/dist/account-manager/helpers/token.js +123 -0
- package/dist/account-manager/helpers/token.js.map +1 -0
- package/dist/account-manager/helpers/used-refresh-token.d.ts +10 -0
- package/dist/account-manager/helpers/used-refresh-token.d.ts.map +1 -0
- package/dist/account-manager/helpers/used-refresh-token.js +25 -0
- package/dist/account-manager/helpers/used-refresh-token.js.map +1 -0
- package/dist/account-manager/index.d.ts +36 -6
- package/dist/account-manager/index.d.ts.map +1 -1
- package/dist/account-manager/index.js +223 -22
- package/dist/account-manager/index.js.map +1 -1
- package/dist/actor-store/preference/reader.d.ts +2 -1
- package/dist/actor-store/preference/reader.d.ts.map +1 -1
- package/dist/actor-store/preference/reader.js +3 -1
- package/dist/actor-store/preference/reader.js.map +1 -1
- package/dist/actor-store/preference/transactor.d.ts +2 -1
- package/dist/actor-store/preference/transactor.d.ts.map +1 -1
- package/dist/actor-store/preference/transactor.js +7 -1
- package/dist/actor-store/preference/transactor.js.map +1 -1
- package/dist/actor-store/preference/util.d.ts +3 -0
- package/dist/actor-store/preference/util.d.ts.map +1 -0
- package/dist/actor-store/preference/util.js +12 -0
- package/dist/actor-store/preference/util.js.map +1 -0
- package/dist/actor-store/record/reader.d.ts +1 -1
- package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js +1 -6
- package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
- package/dist/api/app/bsky/util/resolver.d.ts +1 -1
- package/dist/api/com/atproto/server/createSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/createSession.js +7 -31
- package/dist/api/com/atproto/server/createSession.js.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/deleteSession.js +14 -13
- package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
- package/dist/api/com/atproto/server/getSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getSession.js +4 -2
- package/dist/api/com/atproto/server/getSession.js.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.d.ts.map +1 -1
- package/dist/api/com/atproto/server/refreshSession.js +4 -2
- package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
- package/dist/api/com/atproto/sync/getRepoStatus.d.ts.map +1 -1
- package/dist/api/com/atproto/sync/getRepoStatus.js +2 -1
- package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
- package/dist/api/com/atproto/sync/listRepos.js +2 -2
- package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
- package/dist/api/proxy.d.ts.map +1 -1
- package/dist/api/proxy.js +15 -2
- package/dist/api/proxy.js.map +1 -1
- package/dist/auth-routes.d.ts +4 -0
- package/dist/auth-routes.d.ts.map +1 -0
- package/dist/auth-routes.js +24 -0
- package/dist/auth-routes.js.map +1 -0
- package/dist/auth-verifier.d.ts +32 -11
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +238 -79
- package/dist/auth-verifier.js.map +1 -1
- package/dist/config/config.d.ts +12 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +45 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +8 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +10 -0
- package/dist/config/env.js.map +1 -1
- package/dist/config/secrets.d.ts +1 -0
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +1 -0
- package/dist/config/secrets.js.map +1 -1
- package/dist/context.d.ts +6 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +71 -13
- package/dist/context.js.map +1 -1
- package/dist/db/cast.d.ts +15 -0
- package/dist/db/cast.d.ts.map +1 -0
- package/dist/db/cast.js +66 -0
- package/dist/db/cast.js.map +1 -0
- package/dist/db/db.d.ts +2 -2
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +9 -7
- package/dist/db/db.js.map +1 -1
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/index.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -0
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +51 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +51 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/muteThread.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/graph/muteThread.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/muteThread.js +3 -0
- package/dist/lexicon/types/app/bsky/graph/muteThread.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteThread.d.ts +29 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteThread.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteThread.js +3 -0
- package/dist/lexicon/types/app/bsky/graph/unmuteThread.js.map +1 -0
- package/dist/logger.d.ts +13 -11
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +80 -64
- package/dist/logger.js.map +1 -1
- package/dist/oauth/detailed-account-store.d.ts +27 -0
- package/dist/oauth/detailed-account-store.d.ts.map +1 -0
- package/dist/oauth/detailed-account-store.js +76 -0
- package/dist/oauth/detailed-account-store.js.map +1 -0
- package/dist/oauth/provider.d.ts +16 -0
- package/dist/oauth/provider.d.ts.map +1 -0
- package/dist/oauth/provider.js +45 -0
- package/dist/oauth/provider.js.map +1 -0
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js.map +1 -1
- package/dist/sequencer/events.d.ts +2 -2
- package/example.env +21 -3
- package/package.json +9 -7
- package/src/account-manager/db/migrations/004-oauth.ts +122 -0
- package/src/account-manager/db/migrations/index.ts +2 -0
- package/src/account-manager/db/schema/authorization-request.ts +26 -0
- package/src/account-manager/db/schema/device-account.ts +15 -0
- package/src/account-manager/db/schema/device.ts +18 -0
- package/src/account-manager/db/schema/index.ts +15 -0
- package/src/account-manager/db/schema/token.ts +34 -0
- package/src/account-manager/db/schema/used-refresh-token.ts +13 -0
- package/src/account-manager/helpers/account.ts +16 -21
- package/src/account-manager/helpers/authorization-request.ts +82 -0
- package/src/account-manager/helpers/device-account.ts +135 -0
- package/src/account-manager/helpers/device.ts +45 -0
- package/src/account-manager/helpers/token.ts +185 -0
- package/src/account-manager/helpers/used-refresh-token.ts +30 -0
- package/src/account-manager/index.ts +325 -20
- package/src/actor-store/preference/reader.ts +8 -2
- package/src/actor-store/preference/transactor.ts +10 -0
- package/src/actor-store/preference/util.ts +8 -0
- package/src/api/app/bsky/actor/getPreferences.ts +2 -9
- package/src/api/app/bsky/actor/putPreferences.ts +5 -1
- package/src/api/com/atproto/server/createSession.ts +8 -44
- package/src/api/com/atproto/server/deleteSession.ts +14 -20
- package/src/api/com/atproto/server/getSession.ts +7 -2
- package/src/api/com/atproto/server/refreshSession.ts +6 -2
- package/src/api/com/atproto/sync/getRepoStatus.ts +3 -1
- package/src/api/com/atproto/sync/listRepos.ts +1 -1
- package/src/api/proxy.ts +18 -2
- package/src/auth-routes.ts +27 -0
- package/src/auth-verifier.ts +312 -92
- package/src/config/config.ts +66 -0
- package/src/config/env.ts +24 -0
- package/src/config/secrets.ts +2 -0
- package/src/context.ts +80 -14
- package/src/db/cast.ts +59 -0
- package/src/db/db.ts +15 -12
- package/src/db/index.ts +1 -0
- package/src/error.ts +7 -0
- package/src/index.ts +2 -0
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +52 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -0
- package/src/lexicon/types/app/bsky/graph/muteThread.ts +38 -0
- package/src/lexicon/types/app/bsky/graph/unmuteThread.ts +38 -0
- package/src/logger.ts +83 -38
- package/src/oauth/detailed-account-store.ts +96 -0
- package/src/oauth/provider.ts +77 -0
- package/src/pipethrough.ts +3 -2
- package/tests/preferences.test.ts +67 -1
- package/tests/proxied/__snapshots__/feedgen.test.ts.snap +4 -1
- package/tests/proxied/__snapshots__/views.test.ts.snap +116 -38
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# @atproto/pds
|
2
2
|
|
3
|
+
## 0.4.35
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2482](https://github.com/bluesky-social/atproto/pull/2482) [`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add OAuth provider capability & support for DPoP signed tokens
|
8
|
+
|
9
|
+
- Updated dependencies [[`a8d6c1123`](https://github.com/bluesky-social/atproto/commit/a8d6c112359f5c4c0cfbe2df63443ed275f2a646)]:
|
10
|
+
- @atproto/oauth-provider@0.1.0
|
11
|
+
- @atproto-labs/fetch-node@0.1.0
|
12
|
+
|
13
|
+
## 0.4.34
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- Updated dependencies [[`7c1973841`](https://github.com/bluesky-social/atproto/commit/7c1973841dab416ae19435d37853aeea1f579d39)]:
|
18
|
+
- @atproto/api@0.12.19
|
19
|
+
|
3
20
|
## 0.4.33
|
4
21
|
|
5
22
|
### Patch Changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"004-oauth.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/004-oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AAEpC,wBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+G3D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7D"}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.down = exports.up = void 0;
|
4
|
+
const kysely_1 = require("kysely");
|
5
|
+
async function up(db) {
|
6
|
+
await db.schema
|
7
|
+
.createTable('authorization_request')
|
8
|
+
.addColumn('id', 'varchar', (col) => col.primaryKey())
|
9
|
+
.addColumn('did', 'varchar')
|
10
|
+
.addColumn('deviceId', 'varchar')
|
11
|
+
.addColumn('clientId', 'varchar', (col) => col.notNull())
|
12
|
+
.addColumn('clientAuth', 'varchar', (col) => col.notNull())
|
13
|
+
.addColumn('parameters', 'varchar', (col) => col.notNull())
|
14
|
+
.addColumn('expiresAt', 'varchar', (col) => col.notNull())
|
15
|
+
.addColumn('code', 'varchar')
|
16
|
+
.execute();
|
17
|
+
await db.schema
|
18
|
+
.createIndex('authorization_request_code_idx')
|
19
|
+
.unique()
|
20
|
+
.on('authorization_request')
|
21
|
+
// https://github.com/kysely-org/kysely/issues/302
|
22
|
+
.expression((0, kysely_1.sql) `code DESC) WHERE (code IS NOT NULL`)
|
23
|
+
.execute();
|
24
|
+
await db.schema
|
25
|
+
.createIndex('authorization_request_expires_at_idx')
|
26
|
+
.on('authorization_request')
|
27
|
+
.column('expiresAt')
|
28
|
+
.execute();
|
29
|
+
await db.schema
|
30
|
+
.createTable('device')
|
31
|
+
.addColumn('id', 'varchar', (col) => col.primaryKey())
|
32
|
+
.addColumn('sessionId', 'varchar', (col) => col.notNull())
|
33
|
+
.addColumn('userAgent', 'varchar')
|
34
|
+
.addColumn('ipAddress', 'varchar', (col) => col.notNull())
|
35
|
+
.addColumn('lastSeenAt', 'varchar', (col) => col.notNull())
|
36
|
+
.addUniqueConstraint('device_session_id_idx', ['sessionId'])
|
37
|
+
.execute();
|
38
|
+
await db.schema
|
39
|
+
.createTable('device_account')
|
40
|
+
.addColumn('did', 'varchar', (col) => col.notNull())
|
41
|
+
.addColumn('deviceId', 'varchar', (col) => col.notNull())
|
42
|
+
.addColumn('authenticatedAt', 'varchar', (col) => col.notNull())
|
43
|
+
.addColumn('remember', 'boolean', (col) => col.notNull())
|
44
|
+
.addColumn('authorizedClients', 'varchar', (col) => col.notNull())
|
45
|
+
.addPrimaryKeyConstraint('device_account_pk', [
|
46
|
+
'deviceId', // first because this table will be joined from the "device" table
|
47
|
+
'did',
|
48
|
+
])
|
49
|
+
.addForeignKeyConstraint('device_account_device_id_fk', ['deviceId'], 'device', ['id'], (qb) => qb.onDelete('cascade').onUpdate('cascade'))
|
50
|
+
.execute();
|
51
|
+
await db.schema
|
52
|
+
.createTable('token')
|
53
|
+
.addColumn('id', 'integer', (col) => col.primaryKey().autoIncrement())
|
54
|
+
.addColumn('did', 'varchar', (col) => col.notNull())
|
55
|
+
.addColumn('tokenId', 'varchar', (col) => col.notNull())
|
56
|
+
.addColumn('createdAt', 'varchar', (col) => col.notNull())
|
57
|
+
.addColumn('updatedAt', 'varchar', (col) => col.notNull())
|
58
|
+
.addColumn('expiresAt', 'varchar', (col) => col.notNull())
|
59
|
+
.addColumn('clientId', 'varchar', (col) => col.notNull())
|
60
|
+
.addColumn('clientAuth', 'varchar', (col) => col.notNull())
|
61
|
+
.addColumn('deviceId', 'varchar')
|
62
|
+
.addColumn('parameters', 'varchar', (col) => col.notNull())
|
63
|
+
.addColumn('details', 'varchar')
|
64
|
+
.addColumn('code', 'varchar')
|
65
|
+
.addColumn('currentRefreshToken', 'varchar')
|
66
|
+
.addUniqueConstraint('token_current_refresh_token_unique_idx', [
|
67
|
+
'currentRefreshToken',
|
68
|
+
])
|
69
|
+
.addUniqueConstraint('token_id_unique_idx', ['tokenId'])
|
70
|
+
.execute();
|
71
|
+
await db.schema
|
72
|
+
.createIndex('token_did_idx')
|
73
|
+
.on('token')
|
74
|
+
.column('did')
|
75
|
+
.execute();
|
76
|
+
await db.schema
|
77
|
+
.createIndex('token_code_idx')
|
78
|
+
.unique()
|
79
|
+
.on('token')
|
80
|
+
// https://github.com/kysely-org/kysely/issues/302
|
81
|
+
.expression((0, kysely_1.sql) `code DESC) WHERE (code IS NOT NULL`)
|
82
|
+
.execute();
|
83
|
+
await db.schema
|
84
|
+
.createTable('used_refresh_token')
|
85
|
+
.addColumn('refreshToken', 'varchar', (col) => col.primaryKey())
|
86
|
+
.addColumn('tokenId', 'integer', (col) => col.notNull())
|
87
|
+
.addForeignKeyConstraint('used_refresh_token_fk', ['tokenId'], 'token', ['id'],
|
88
|
+
// uses "used_refresh_token_id_idx" index (when cascading)
|
89
|
+
(qb) => qb.onDelete('cascade').onUpdate('cascade'))
|
90
|
+
.execute();
|
91
|
+
await db.schema
|
92
|
+
.createIndex('used_refresh_token_id_idx')
|
93
|
+
.on('used_refresh_token')
|
94
|
+
.column('tokenId')
|
95
|
+
.execute();
|
96
|
+
}
|
97
|
+
exports.up = up;
|
98
|
+
async function down(db) {
|
99
|
+
await db.schema.dropTable('used_refresh_token').execute();
|
100
|
+
await db.schema.dropTable('token').execute();
|
101
|
+
await db.schema.dropTable('device_account').execute();
|
102
|
+
await db.schema.dropTable('device').execute();
|
103
|
+
await db.schema.dropTable('authorization_request').execute();
|
104
|
+
}
|
105
|
+
exports.down = down;
|
106
|
+
//# sourceMappingURL=004-oauth.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"004-oauth.js","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/004-oauth.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAE7B,KAAK,UAAU,EAAE,CAAC,EAAmB;IAC1C,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,uBAAuB,CAAC;SACpC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;SACrD,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;SAC3B,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;SAChC,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACxD,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACzD,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;SAC5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C;SAC/D,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;SACvD,uBAAuB,CACtB,uBAAuB,EACvB,CAAC,SAAS,CAAC,EACX,OAAO,EACP,CAAC,IAAI,CAAC;IACN,0DAA0D;IAC1D,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CACnD;SACA,OAAO,EAAE,CAAA;IAEZ,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,2BAA2B,CAAC;SACxC,EAAE,CAAC,oBAAoB,CAAC;SACxB,MAAM,CAAC,SAAS,CAAC;SACjB,OAAO,EAAE,CAAA;AACd,CAAC;AA/GD,gBA+GC;AAEM,KAAK,UAAU,IAAI,CAAC,EAAmB;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAAA;IACzD,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;IAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAA;IACrD,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAA;IAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,OAAO,EAAE,CAAA;AAC9D,CAAC;AAND,oBAMC"}
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import * as mig001 from './001-init';
|
2
2
|
import * as mig002 from './002-account-deactivation';
|
3
3
|
import * as mig003 from './003-privileged-app-passwords';
|
4
|
+
import * as mig004 from './004-oauth';
|
4
5
|
declare const _default: {
|
5
6
|
'001': typeof mig001;
|
6
7
|
'002': typeof mig002;
|
7
8
|
'003': typeof mig003;
|
9
|
+
'004': typeof mig004;
|
8
10
|
};
|
9
11
|
export default _default;
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAA;AACpD,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAA
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAA;AACpD,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAA;AACxD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;;;;;;;AAErC,wBAKC"}
|
@@ -26,9 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const mig001 = __importStar(require("./001-init"));
|
27
27
|
const mig002 = __importStar(require("./002-account-deactivation"));
|
28
28
|
const mig003 = __importStar(require("./003-privileged-app-passwords"));
|
29
|
+
const mig004 = __importStar(require("./004-oauth"));
|
29
30
|
exports.default = {
|
30
31
|
'001': mig001,
|
31
32
|
'002': mig002,
|
32
33
|
'003': mig003,
|
34
|
+
'004': mig004,
|
33
35
|
};
|
34
36
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mEAAoD;AACpD,uEAAwD;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/account-manager/db/migrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,mEAAoD;AACpD,uEAAwD;AACxD,oDAAqC;AAErC,kBAAe;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;CACd,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Code, DeviceId, OAuthClientId, RequestId } from '@atproto/oauth-provider';
|
2
|
+
import { Selectable } from 'kysely';
|
3
|
+
import { DateISO, JsonObject } from '../../../db';
|
4
|
+
export interface AuthorizationRequest {
|
5
|
+
id: RequestId;
|
6
|
+
did: string | null;
|
7
|
+
deviceId: DeviceId | null;
|
8
|
+
clientId: OAuthClientId;
|
9
|
+
clientAuth: JsonObject;
|
10
|
+
parameters: JsonObject;
|
11
|
+
expiresAt: DateISO;
|
12
|
+
code: Code | null;
|
13
|
+
}
|
14
|
+
export type AuthorizationRequestEntry = Selectable<AuthorizationRequest>;
|
15
|
+
export declare const tableName = "authorization_request";
|
16
|
+
export type PartialDB = {
|
17
|
+
[tableName]: AuthorizationRequest;
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=authorization-request.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"authorization-request.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/authorization-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,SAAS,EACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,SAAS,CAAA;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IAEzB,QAAQ,EAAE,aAAa,CAAA;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAClB;AAED,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAA;AAExE,eAAO,MAAM,SAAS,0BAA0B,CAAA;AAEhD,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAA;CAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"authorization-request.js","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/authorization-request.ts"],"names":[],"mappings":";;;AAuBa,QAAA,SAAS,GAAG,uBAAuB,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { DeviceId } from '@atproto/oauth-provider';
|
2
|
+
import { DateISO, JsonArray } from '../../../db';
|
3
|
+
export interface DeviceAccount {
|
4
|
+
did: string;
|
5
|
+
deviceId: DeviceId;
|
6
|
+
authenticatedAt: DateISO;
|
7
|
+
authorizedClients: JsonArray;
|
8
|
+
remember: 0 | 1;
|
9
|
+
}
|
10
|
+
export declare const tableName = "device_account";
|
11
|
+
export type PartialDB = {
|
12
|
+
[tableName]: DeviceAccount;
|
13
|
+
};
|
14
|
+
//# sourceMappingURL=device-account.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"device-account.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/device-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,QAAQ,CAAA;IAElB,eAAe,EAAE,OAAO,CAAA;IACxB,iBAAiB,EAAE,SAAS,CAAA;IAC5B,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAA;CAChB;AAED,eAAO,MAAM,SAAS,mBAAmB,CAAA;AAEzC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,aAAa,CAAA;CAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"device-account.js","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/device-account.ts"],"names":[],"mappings":";;;AAYa,QAAA,SAAS,GAAG,gBAAgB,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { DeviceId, SessionId } from '@atproto/oauth-provider';
|
2
|
+
import { Selectable } from 'kysely';
|
3
|
+
import { DateISO } from '../../../db';
|
4
|
+
export interface Device {
|
5
|
+
id: DeviceId;
|
6
|
+
sessionId: SessionId;
|
7
|
+
userAgent: string | null;
|
8
|
+
ipAddress: string;
|
9
|
+
lastSeenAt: DateISO;
|
10
|
+
}
|
11
|
+
export type DeviceEntry = Selectable<Device>;
|
12
|
+
export declare const tableName = "device";
|
13
|
+
export type PartialDB = {
|
14
|
+
[tableName]: Device;
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=device.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErC,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,QAAQ,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;IAEpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAE5C,eAAO,MAAM,SAAS,WAAW,CAAA;AAEjC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/device.ts"],"names":[],"mappings":";;;AAea,QAAA,SAAS,GAAG,QAAQ,CAAA"}
|
@@ -1,13 +1,23 @@
|
|
1
1
|
import * as actor from './actor';
|
2
2
|
import * as account from './account';
|
3
|
+
import * as device from './device';
|
4
|
+
import * as deviceAccount from './device-account';
|
5
|
+
import * as oauthRequest from './authorization-request';
|
6
|
+
import * as token from './token';
|
7
|
+
import * as usedRefreshToken from './used-refresh-token';
|
3
8
|
import * as repoRoot from './repo-root';
|
4
9
|
import * as refreshToken from './refresh-token';
|
5
10
|
import * as appPassword from './app-password';
|
6
11
|
import * as inviteCode from './invite-code';
|
7
12
|
import * as emailToken from './email-token';
|
8
|
-
export type DatabaseSchema = actor.PartialDB & account.PartialDB & refreshToken.PartialDB & appPassword.PartialDB & repoRoot.PartialDB & inviteCode.PartialDB & emailToken.PartialDB;
|
13
|
+
export type DatabaseSchema = actor.PartialDB & account.PartialDB & device.PartialDB & deviceAccount.PartialDB & oauthRequest.PartialDB & token.PartialDB & usedRefreshToken.PartialDB & refreshToken.PartialDB & appPassword.PartialDB & repoRoot.PartialDB & inviteCode.PartialDB & emailToken.PartialDB;
|
9
14
|
export type { Actor, ActorEntry } from './actor';
|
10
15
|
export type { Account, AccountEntry } from './account';
|
16
|
+
export type { Device } from './device';
|
17
|
+
export type { DeviceAccount } from './device-account';
|
18
|
+
export type { AuthorizationRequest } from './authorization-request';
|
19
|
+
export type { Token } from './token';
|
20
|
+
export type { UsedRefreshToken } from './used-refresh-token';
|
11
21
|
export type { RepoRoot } from './repo-root';
|
12
22
|
export type { RefreshToken } from './refresh-token';
|
13
23
|
export type { AppPassword } from './app-password';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,GAC1C,OAAO,CAAC,SAAS,GACjB,YAAY,CAAC,SAAS,GACtB,WAAW,CAAC,SAAS,GACrB,QAAQ,CAAC,SAAS,GAClB,UAAU,CAAC,SAAS,GACpB,UAAU,CAAC,SAAS,CAAA;AAEtB,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAChD,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,UAAU,C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E,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Code, DeviceId, OAuthClientId, RefreshToken, Sub, TokenId } from '@atproto/oauth-provider';
|
2
|
+
import { Generated, Selectable } from 'kysely';
|
3
|
+
import { DateISO, JsonArray, JsonObject } from '../../../db/cast';
|
4
|
+
export interface Token {
|
5
|
+
id: Generated<number>;
|
6
|
+
did: Sub;
|
7
|
+
tokenId: TokenId;
|
8
|
+
createdAt: DateISO;
|
9
|
+
updatedAt: DateISO;
|
10
|
+
expiresAt: DateISO;
|
11
|
+
clientId: OAuthClientId;
|
12
|
+
clientAuth: JsonObject;
|
13
|
+
deviceId: DeviceId | null;
|
14
|
+
parameters: JsonObject;
|
15
|
+
details: JsonArray | null;
|
16
|
+
code: Code | null;
|
17
|
+
currentRefreshToken: RefreshToken | null;
|
18
|
+
}
|
19
|
+
export type TokenEntry = Selectable<Token>;
|
20
|
+
export declare const tableName = "token";
|
21
|
+
export type PartialDB = {
|
22
|
+
[tableName]: Token;
|
23
|
+
};
|
24
|
+
//# sourceMappingURL=token.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/token.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,GAAG,EACH,OAAO,EACR,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAEjE,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;IACrB,GAAG,EAAE,GAAG,CAAA;IAER,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,aAAa,CAAA;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,SAAS,GAAG,IAAI,CAAA;IACzB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;IACjB,mBAAmB,EAAE,YAAY,GAAG,IAAI,CAAA;CACzC;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;AAE1C,eAAO,MAAM,SAAS,UAAU,CAAA;AAEhC,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/token.ts"],"names":[],"mappings":";;;AA+Ba,QAAA,SAAS,GAAG,OAAO,CAAA"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { RefreshToken } from '@atproto/oauth-provider';
|
2
|
+
import { Selectable } from 'kysely';
|
3
|
+
export interface UsedRefreshToken {
|
4
|
+
tokenId: number;
|
5
|
+
refreshToken: RefreshToken;
|
6
|
+
}
|
7
|
+
export type UsedRefreshTokenEntry = Selectable<UsedRefreshToken>;
|
8
|
+
export declare const tableName = "used_refresh_token";
|
9
|
+
export type PartialDB = {
|
10
|
+
[tableName]: UsedRefreshToken;
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=used-refresh-token.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"used-refresh-token.d.ts","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/used-refresh-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;AAEhE,eAAO,MAAM,SAAS,uBAAuB,CAAA;AAE7C,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"used-refresh-token.js","sourceRoot":"","sources":["../../../../src/account-manager/db/schema/used-refresh-token.ts"],"names":[],"mappings":";;;AAUa,QAAA,SAAS,GAAG,oBAAoB,CAAA"}
|
@@ -6,8 +6,6 @@ export type ActorAccount = ActorEntry & {
|
|
6
6
|
email: string | null;
|
7
7
|
emailConfirmedAt: string | null;
|
8
8
|
invitesDisabled: 0 | 1 | null;
|
9
|
-
active: boolean;
|
10
|
-
status?: AccountStatus;
|
11
9
|
};
|
12
10
|
export type AvailabilityFlags = {
|
13
11
|
includeTakenDown?: boolean;
|
@@ -20,6 +18,21 @@ export declare enum AccountStatus {
|
|
20
18
|
Deleted = "deleted",
|
21
19
|
Deactivated = "deactivated"
|
22
20
|
}
|
21
|
+
export declare const selectAccountQB: (db: AccountDb, flags?: AvailabilityFlags) => import("kysely/dist/cjs/parser/select-parser").QueryBuilderWithSelection<{
|
22
|
+
account: import("kysely/dist/cjs/util/type-utils").Nullable<import("../db").Account>;
|
23
|
+
token: import("../db").Token;
|
24
|
+
actor: import("../db").Actor;
|
25
|
+
device: import("../db").Device;
|
26
|
+
device_account: import("../db").DeviceAccount;
|
27
|
+
authorization_request: import("../db").AuthorizationRequest;
|
28
|
+
used_refresh_token: import("../db").UsedRefreshToken;
|
29
|
+
repo_root: import("../db").RepoRoot;
|
30
|
+
refresh_token: import("../db").RefreshToken;
|
31
|
+
app_password: import("../db").AppPassword;
|
32
|
+
invite_code: import("../db").InviteCode;
|
33
|
+
invite_code_use: import("../db").InviteCodeUse;
|
34
|
+
email_token: import("../db").EmailToken;
|
35
|
+
}, "account" | "actor", import("kysely/dist/cjs/util/type-utils").MergePartial<Partial<Omit<{}, never>>, Partial<Omit<{}, never>>>, "actor.did" | "account.email" | "account.invitesDisabled" | "account.emailConfirmedAt" | "actor.handle" | "actor.createdAt" | "actor.takedownRef" | "actor.deactivatedAt" | "actor.deleteAfter">;
|
23
36
|
export declare const getAccount: (db: AccountDb, handleOrDid: string, flags?: AvailabilityFlags) => Promise<ActorAccount | null>;
|
24
37
|
export declare const getAccountByEmail: (db: AccountDb, email: string, flags?: AvailabilityFlags) => Promise<ActorAccount | null>;
|
25
38
|
export declare const registerActor: (db: AccountDb, opts: {
|
@@ -43,11 +56,20 @@ export declare const getAccountAdminStatus: (db: AccountDb, did: string) => Prom
|
|
43
56
|
export declare const updateAccountTakedownStatus: (db: AccountDb, did: string, takedown: StatusAttr) => Promise<void>;
|
44
57
|
export declare const deactivateAccount: (db: AccountDb, did: string, deleteAfter: string | null) => Promise<void>;
|
45
58
|
export declare const activateAccount: (db: AccountDb, did: string) => Promise<void>;
|
46
|
-
export declare const formatAccountStatus: (account: {
|
59
|
+
export declare const formatAccountStatus: (account: null | {
|
47
60
|
takedownRef: string | null;
|
48
61
|
deactivatedAt: string | null;
|
49
62
|
}) => {
|
50
|
-
active:
|
51
|
-
status
|
63
|
+
readonly active: false;
|
64
|
+
readonly status: AccountStatus.Deleted;
|
65
|
+
} | {
|
66
|
+
readonly active: false;
|
67
|
+
readonly status: AccountStatus.Takendown;
|
68
|
+
} | {
|
69
|
+
readonly active: false;
|
70
|
+
readonly status: AccountStatus.Deactivated;
|
71
|
+
} | {
|
72
|
+
readonly active: true;
|
73
|
+
readonly status: undefined;
|
52
74
|
};
|
53
75
|
//# sourceMappingURL=account.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/account-manager/helpers/account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAA;AAGvE,qBAAa,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,eAAe,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/account-manager/helpers/account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAA;AAGvE,qBAAa,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,eAAe,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,eAAO,MAAM,eAAe,0BAA2B,iBAAiB;;;;;;;;;;;;;;oUAqBvE,CAAA;AAED,eAAO,MAAM,UAAU,+BAER,MAAM,UACX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";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.formatAccountStatus = exports.activateAccount = exports.deactivateAccount = exports.updateAccountTakedownStatus = exports.getAccountAdminStatus = exports.setEmailConfirmedAt = exports.updateEmail = exports.updateHandle = exports.deleteAccount = exports.registerAccount = exports.registerActor = exports.getAccountByEmail = exports.getAccount = exports.AccountStatus = exports.UserAlreadyExistsError = void 0;
|
3
|
+
exports.formatAccountStatus = exports.activateAccount = exports.deactivateAccount = exports.updateAccountTakedownStatus = exports.getAccountAdminStatus = exports.setEmailConfirmedAt = exports.updateEmail = exports.updateHandle = exports.deleteAccount = exports.registerAccount = exports.registerActor = exports.getAccountByEmail = exports.getAccount = exports.selectAccountQB = exports.AccountStatus = exports.UserAlreadyExistsError = void 0;
|
4
4
|
const db_1 = require("../../db");
|
5
5
|
const common_1 = require("@atproto/common");
|
6
6
|
class UserAlreadyExistsError extends Error {
|
@@ -34,8 +34,9 @@ const selectAccountQB = (db, flags) => {
|
|
34
34
|
'account.invitesDisabled',
|
35
35
|
]);
|
36
36
|
};
|
37
|
+
exports.selectAccountQB = selectAccountQB;
|
37
38
|
const getAccount = async (db, handleOrDid, flags) => {
|
38
|
-
const found = await selectAccountQB(db, flags)
|
39
|
+
const found = await (0, exports.selectAccountQB)(db, flags)
|
39
40
|
.where((qb) => {
|
40
41
|
if (handleOrDid.startsWith('did:')) {
|
41
42
|
return qb.where('actor.did', '=', handleOrDid);
|
@@ -45,14 +46,14 @@ const getAccount = async (db, handleOrDid, flags) => {
|
|
45
46
|
}
|
46
47
|
})
|
47
48
|
.executeTakeFirst();
|
48
|
-
return found
|
49
|
+
return found || null;
|
49
50
|
};
|
50
51
|
exports.getAccount = getAccount;
|
51
52
|
const getAccountByEmail = async (db, email, flags) => {
|
52
|
-
const found = await selectAccountQB(db, flags)
|
53
|
+
const found = await (0, exports.selectAccountQB)(db, flags)
|
53
54
|
.where('email', '=', email.toLowerCase())
|
54
55
|
.executeTakeFirst();
|
55
|
-
return found
|
56
|
+
return found || null;
|
56
57
|
};
|
57
58
|
exports.getAccountByEmail = getAccountByEmail;
|
58
59
|
const registerActor = async (db, opts) => {
|
@@ -180,18 +181,18 @@ const activateAccount = async (db, did) => {
|
|
180
181
|
};
|
181
182
|
exports.activateAccount = activateAccount;
|
182
183
|
const formatAccountStatus = (account) => {
|
183
|
-
|
184
|
-
|
185
|
-
|
184
|
+
if (!account) {
|
185
|
+
return { active: false, status: AccountStatus.Deleted };
|
186
|
+
}
|
187
|
+
else if (account.takedownRef) {
|
188
|
+
return { active: false, status: AccountStatus.Takendown };
|
186
189
|
}
|
187
190
|
else if (account.deactivatedAt) {
|
188
|
-
status
|
191
|
+
return { active: false, status: AccountStatus.Deactivated };
|
192
|
+
}
|
193
|
+
else {
|
194
|
+
return { active: true, status: undefined };
|
189
195
|
}
|
190
|
-
const active = !status;
|
191
|
-
return {
|
192
|
-
active,
|
193
|
-
status,
|
194
|
-
};
|
195
196
|
};
|
196
197
|
exports.formatAccountStatus = formatAccountStatus;
|
197
198
|
//# sourceMappingURL=account.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/account-manager/helpers/account.ts"],"names":[],"mappings":";;;AAAA,iCAAqE;AAGrE,4CAAqC;AAErC,MAAa,sBAAuB,SAAQ,KAAK;CAAG;AAApD,wDAAoD;
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/account-manager/helpers/account.ts"],"names":[],"mappings":";;;AAAA,iCAAqE;AAGrE,4CAAqC;AAErC,MAAa,sBAAuB,SAAQ,KAAK;CAAG;AAApD,wDAAoD;AAapD,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,4CAA2B,CAAA;AAC7B,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAEM,MAAM,eAAe,GAAG,CAAC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AAI;QACnB,WAAW,EAAE,IAAI;KAClB,CAAC;SACD,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAC1B,CAAA;AACH,CAAC,CAAA;AAVY,QAAA,eAAe,mBAU3B;AAEM,MAAM,mBAAmB,GAAG,CACjC,OAGC,EACD,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,OAAO,EAAW,CAAA;IAClE,CAAC;SAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,EAAW,CAAA;IACpE,CAAC;SAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,WAAW,EAAW,CAAA;IACtE,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAW,CAAA;IACrD,CAAC;AACH,CAAC,CAAA;AAfY,QAAA,mBAAmB,uBAe/B"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Code, FoundRequestResult, RequestData, RequestId, UpdateRequestData } from '@atproto/oauth-provider';
|
2
|
+
import { AccountDb, AuthorizationRequest } from '../db';
|
3
|
+
import { Selectable } from 'kysely';
|
4
|
+
export declare const rowToRequestData: (row: Selectable<AuthorizationRequest>) => RequestData;
|
5
|
+
export declare const rowToFoundRequestResult: (row: Selectable<AuthorizationRequest>) => FoundRequestResult;
|
6
|
+
export declare const createQB: (db: AccountDb, id: RequestId, data: RequestData) => import("kysely").InsertQueryBuilder<import("../db").DatabaseSchema, "authorization_request", import("kysely").InsertResult>;
|
7
|
+
export declare const readQB: (db: AccountDb, id: RequestId) => import("kysely/dist/cjs/parser/select-parser").SelectAllQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "authorization_request">, "authorization_request", {}, "authorization_request">;
|
8
|
+
export declare const updateQB: (db: AccountDb, id: RequestId, { code, sub, deviceId, expiresAt }: UpdateRequestData) => import("kysely").UpdateQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "authorization_request">, "authorization_request", "authorization_request", import("kysely").UpdateResult>;
|
9
|
+
export declare const removeOldExpiredQB: (db: AccountDb, delay?: number) => import("kysely").DeleteQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "authorization_request">, "authorization_request", import("kysely").DeleteResult>;
|
10
|
+
export declare const removeByIdQB: (db: AccountDb, id: RequestId) => import("kysely").DeleteQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "authorization_request">, "authorization_request", import("kysely").DeleteResult>;
|
11
|
+
export declare const findByCodeQB: (db: AccountDb, code: Code) => import("kysely/dist/cjs/parser/select-parser").SelectAllQueryBuilder<import("kysely/dist/cjs/parser/table-parser").From<import("../db").DatabaseSchema, "authorization_request">, "authorization_request", {}, "authorization_request">;
|
12
|
+
//# sourceMappingURL=authorization-request.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"authorization-request.d.ts","sourceRoot":"","sources":["../../../src/account-manager/helpers/authorization-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAEvD,OAAO,EAAc,UAAU,EAAE,MAAM,QAAQ,CAAA;AAE/C,eAAO,MAAM,gBAAgB,QACtB,WAAW,oBAAoB,CAAC,KACpC,WAQD,CAAA;AAEF,eAAO,MAAM,uBAAuB,QAC7B,WAAW,oBAAoB,CAAC,KACpC,kBAGD,CAAA;AAiBF,eAAO,MAAM,QAAQ,sBAAuB,SAAS,QAAQ,WAAW,gIACM,CAAA;AAE9E,eAAO,MAAM,MAAM,sBAAuB,SAAS,4OACyB,CAAA;AAE5E,eAAO,MAAM,QAAQ,sBAEf,SAAS,sCACuB,iBAAiB,sOAQ9B,CAAA;AAEzB,eAAO,MAAM,kBAAkB,6OAMsC,CAAA;AAErE,eAAO,MAAM,YAAY,sBAAuB,SAAS,6MACO,CAAA;AAEhE,eAAO,MAAM,YAAY,wBAAyB,IAAI,4OAMtC,CAAA"}
|