@atproto/pds 0.4.56 → 0.4.58
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/applyWrites.js +43 -7
- package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/createRecord.js +10 -2
- package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/deleteRecord.js +11 -0
- package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.js +7 -0
- package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +131 -3
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +143 -6
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +38 -4
- package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js +31 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +5 -2
- package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/defs.d.ts +12 -0
- package/dist/lexicon/types/com/atproto/repo/defs.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/repo/defs.js +16 -0
- package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -0
- package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +14 -2
- package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +5 -2
- package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts +3 -0
- package/dist/lexicon/types/tools/ozone/communication/createTemplate.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/communication/defs.d.ts +2 -0
- package/dist/lexicon/types/tools/ozone/communication/defs.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/communication/defs.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts +3 -0
- package/dist/lexicon/types/tools/ozone/communication/updateTemplate.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/emitEvent.d.ts.map +1 -1
- package/dist/repo/prepare.d.ts +4 -2
- package/dist/repo/prepare.d.ts.map +1 -1
- package/dist/repo/prepare.js +30 -14
- package/dist/repo/prepare.js.map +1 -1
- package/dist/repo/types.d.ts +3 -0
- package/dist/repo/types.d.ts.map +1 -1
- package/dist/repo/types.js.map +1 -1
- package/dist/sequencer/events.d.ts +2 -2
- package/package.json +6 -6
- package/src/api/com/atproto/repo/applyWrites.ts +41 -0
- package/src/api/com/atproto/repo/createRecord.ts +16 -7
- package/src/api/com/atproto/repo/deleteRecord.ts +11 -0
- package/src/api/com/atproto/repo/putRecord.ts +7 -0
- package/src/lexicon/lexicons.ts +143 -6
- package/src/lexicon/types/com/atproto/repo/applyWrites.ts +70 -3
- package/src/lexicon/types/com/atproto/repo/createRecord.ts +5 -2
- package/src/lexicon/types/com/atproto/repo/defs.ts +25 -0
- package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +13 -1
- package/src/lexicon/types/com/atproto/repo/putRecord.ts +5 -2
- package/src/lexicon/types/tools/ozone/communication/createTemplate.ts +3 -0
- package/src/lexicon/types/tools/ozone/communication/defs.ts +2 -0
- package/src/lexicon/types/tools/ozone/communication/updateTemplate.ts +3 -0
- package/src/lexicon/types/tools/ozone/moderation/emitEvent.ts +1 -0
- package/src/repo/prepare.ts +31 -13
- package/src/repo/types.ts +4 -0
- package/tests/crud.test.ts +131 -14
- package/tests/sync/sync.test.ts +4 -4
@@ -48,8 +48,8 @@ export declare const commitEvt: z.ZodObject<{
|
|
48
48
|
blobs: z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodAny, any, any>, CID, any>, "many">;
|
49
49
|
}, "strip", z.ZodTypeAny, {
|
50
50
|
repo: string;
|
51
|
-
blobs: CID[];
|
52
51
|
rev: string;
|
52
|
+
blobs: CID[];
|
53
53
|
rebase: boolean;
|
54
54
|
tooBig: boolean;
|
55
55
|
commit: CID;
|
@@ -63,8 +63,8 @@ export declare const commitEvt: z.ZodObject<{
|
|
63
63
|
prev: CID | null;
|
64
64
|
}, {
|
65
65
|
repo: string;
|
66
|
-
blobs: any[];
|
67
66
|
rev: string;
|
67
|
+
blobs: any[];
|
68
68
|
rebase: boolean;
|
69
69
|
tooBig: boolean;
|
70
70
|
since: string | null;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/pds",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.58",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Reference implementation of atproto Personal Data Server (PDS)",
|
6
6
|
"keywords": [
|
@@ -44,14 +44,14 @@
|
|
44
44
|
"uint8arrays": "3.0.0",
|
45
45
|
"zod": "^3.23.8",
|
46
46
|
"@atproto-labs/fetch-node": "0.1.0",
|
47
|
-
"@atproto/api": "^0.13.
|
48
|
-
"@atproto/aws": "^0.2.
|
47
|
+
"@atproto/api": "^0.13.6",
|
48
|
+
"@atproto/aws": "^0.2.4",
|
49
49
|
"@atproto/common": "^0.4.1",
|
50
50
|
"@atproto/crypto": "^0.4.1",
|
51
51
|
"@atproto/identity": "^0.4.1",
|
52
52
|
"@atproto/lexicon": "^0.4.1",
|
53
53
|
"@atproto/oauth-provider": "^0.2.1",
|
54
|
-
"@atproto/repo": "^0.
|
54
|
+
"@atproto/repo": "^0.5.0",
|
55
55
|
"@atproto/syntax": "^0.3.0",
|
56
56
|
"@atproto/xrpc": "^0.6.1",
|
57
57
|
"@atproto/xrpc-server": "^0.6.3"
|
@@ -72,8 +72,8 @@
|
|
72
72
|
"jest": "^28.1.2",
|
73
73
|
"ts-node": "^10.8.2",
|
74
74
|
"ws": "^8.12.0",
|
75
|
-
"@atproto/api": "^0.13.
|
76
|
-
"@atproto/bsky": "^0.0.
|
75
|
+
"@atproto/api": "^0.13.6",
|
76
|
+
"@atproto/bsky": "^0.0.82",
|
77
77
|
"@atproto/lex-cli": "^0.5.0"
|
78
78
|
},
|
79
79
|
"scripts": {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { CID } from 'multiformats/cid'
|
2
2
|
import { InvalidRequestError, AuthRequiredError } from '@atproto/xrpc-server'
|
3
|
+
import { WriteOpAction } from '@atproto/repo'
|
3
4
|
import { prepareCreate, prepareDelete, prepareUpdate } from '../../../../repo'
|
4
5
|
import { Server } from '../../../../lexicon'
|
5
6
|
import {
|
@@ -7,6 +8,9 @@ import {
|
|
7
8
|
isCreate,
|
8
9
|
isUpdate,
|
9
10
|
isDelete,
|
11
|
+
CreateResult,
|
12
|
+
UpdateResult,
|
13
|
+
DeleteResult,
|
10
14
|
} from '../../../../lexicon/types/com/atproto/repo/applyWrites'
|
11
15
|
import {
|
12
16
|
BadCommitSwapError,
|
@@ -69,6 +73,7 @@ export default function (server: Server, ctx: AppContext) {
|
|
69
73
|
throw new InvalidRequestError('Too many writes. Max: 200')
|
70
74
|
}
|
71
75
|
|
76
|
+
// @NOTE should preserve order of ts.writes for final use in response
|
72
77
|
let writes: PreparedWrite[]
|
73
78
|
try {
|
74
79
|
writes = await Promise.all(
|
@@ -125,6 +130,42 @@ export default function (server: Server, ctx: AppContext) {
|
|
125
130
|
|
126
131
|
await ctx.sequencer.sequenceCommit(did, commit, writes)
|
127
132
|
await ctx.accountManager.updateRepoRoot(did, commit.cid, commit.rev)
|
133
|
+
|
134
|
+
return {
|
135
|
+
encoding: 'application/json',
|
136
|
+
body: {
|
137
|
+
commit: {
|
138
|
+
cid: commit.cid.toString(),
|
139
|
+
rev: commit.rev,
|
140
|
+
},
|
141
|
+
results: writes.map(writeToOutputResult),
|
142
|
+
},
|
143
|
+
}
|
128
144
|
},
|
129
145
|
})
|
130
146
|
}
|
147
|
+
|
148
|
+
const writeToOutputResult = (write: PreparedWrite) => {
|
149
|
+
switch (write.action) {
|
150
|
+
case WriteOpAction.Create:
|
151
|
+
return {
|
152
|
+
$type: 'com.atproto.repo.applyWrites#createResult',
|
153
|
+
cid: write.cid.toString(),
|
154
|
+
uri: write.uri.toString(),
|
155
|
+
validationStatus: write.validationStatus,
|
156
|
+
} satisfies CreateResult
|
157
|
+
case WriteOpAction.Update:
|
158
|
+
return {
|
159
|
+
$type: 'com.atproto.repo.applyWrites#updateResult',
|
160
|
+
cid: write.cid.toString(),
|
161
|
+
uri: write.uri.toString(),
|
162
|
+
validationStatus: write.validationStatus,
|
163
|
+
} satisfies UpdateResult
|
164
|
+
case WriteOpAction.Delete:
|
165
|
+
return {
|
166
|
+
$type: 'com.atproto.repo.applyWrites#deleteResult',
|
167
|
+
} satisfies DeleteResult
|
168
|
+
default:
|
169
|
+
throw new Error(`Unrecognized action: ${write}`)
|
170
|
+
}
|
171
|
+
}
|
@@ -68,12 +68,13 @@ export default function (server: Server, ctx: AppContext) {
|
|
68
68
|
const { commit, writes } = await ctx.actorStore.transact(
|
69
69
|
did,
|
70
70
|
async (actorTxn) => {
|
71
|
-
const backlinkConflicts =
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
const backlinkConflicts =
|
72
|
+
validate !== false
|
73
|
+
? await actorTxn.record.getBacklinkConflicts(
|
74
|
+
write.uri,
|
75
|
+
write.record,
|
76
|
+
)
|
77
|
+
: []
|
77
78
|
const backlinkDeletions = backlinkConflicts.map((uri) =>
|
78
79
|
prepareDelete({
|
79
80
|
did: uri.hostname,
|
@@ -102,7 +103,15 @@ export default function (server: Server, ctx: AppContext) {
|
|
102
103
|
|
103
104
|
return {
|
104
105
|
encoding: 'application/json',
|
105
|
-
body: {
|
106
|
+
body: {
|
107
|
+
uri: write.uri.toString(),
|
108
|
+
cid: write.cid.toString(),
|
109
|
+
commit: {
|
110
|
+
cid: commit.cid.toString(),
|
111
|
+
rev: commit.rev,
|
112
|
+
},
|
113
|
+
validationStatus: write.validationStatus,
|
114
|
+
},
|
106
115
|
}
|
107
116
|
},
|
108
117
|
})
|
@@ -71,6 +71,17 @@ export default function (server: Server, ctx: AppContext) {
|
|
71
71
|
await ctx.sequencer.sequenceCommit(did, commit, [write])
|
72
72
|
await ctx.accountManager.updateRepoRoot(did, commit.cid, commit.rev)
|
73
73
|
}
|
74
|
+
return {
|
75
|
+
encoding: 'application/json',
|
76
|
+
body: {
|
77
|
+
commit: commit
|
78
|
+
? {
|
79
|
+
cid: commit.cid.toString(),
|
80
|
+
rev: commit.rev,
|
81
|
+
}
|
82
|
+
: undefined,
|
83
|
+
},
|
84
|
+
}
|
74
85
|
},
|
75
86
|
})
|
76
87
|
}
|
@@ -130,6 +130,13 @@ export default function (server: Server, ctx: AppContext) {
|
|
130
130
|
body: {
|
131
131
|
uri: write.uri.toString(),
|
132
132
|
cid: write.cid.toString(),
|
133
|
+
commit: commit
|
134
|
+
? {
|
135
|
+
cid: commit.cid.toString(),
|
136
|
+
rev: commit.rev,
|
137
|
+
}
|
138
|
+
: undefined,
|
139
|
+
validationStatus: write.validationStatus,
|
133
140
|
},
|
134
141
|
}
|
135
142
|
},
|
package/src/lexicon/lexicons.ts
CHANGED
@@ -1254,9 +1254,8 @@ export const schemaDict = {
|
|
1254
1254
|
},
|
1255
1255
|
validate: {
|
1256
1256
|
type: 'boolean',
|
1257
|
-
default: true,
|
1258
1257
|
description:
|
1259
|
-
"Can be set to 'false' to skip Lexicon schema validation of record data, for
|
1258
|
+
"Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons.",
|
1260
1259
|
},
|
1261
1260
|
writes: {
|
1262
1261
|
type: 'array',
|
@@ -1279,6 +1278,31 @@ export const schemaDict = {
|
|
1279
1278
|
},
|
1280
1279
|
},
|
1281
1280
|
},
|
1281
|
+
output: {
|
1282
|
+
encoding: 'application/json',
|
1283
|
+
schema: {
|
1284
|
+
type: 'object',
|
1285
|
+
required: [],
|
1286
|
+
properties: {
|
1287
|
+
commit: {
|
1288
|
+
type: 'ref',
|
1289
|
+
ref: 'lex:com.atproto.repo.defs#commitMeta',
|
1290
|
+
},
|
1291
|
+
results: {
|
1292
|
+
type: 'array',
|
1293
|
+
items: {
|
1294
|
+
type: 'union',
|
1295
|
+
refs: [
|
1296
|
+
'lex:com.atproto.repo.applyWrites#createResult',
|
1297
|
+
'lex:com.atproto.repo.applyWrites#updateResult',
|
1298
|
+
'lex:com.atproto.repo.applyWrites#deleteResult',
|
1299
|
+
],
|
1300
|
+
closed: true,
|
1301
|
+
},
|
1302
|
+
},
|
1303
|
+
},
|
1304
|
+
},
|
1305
|
+
},
|
1282
1306
|
errors: [
|
1283
1307
|
{
|
1284
1308
|
name: 'InvalidSwap',
|
@@ -1336,6 +1360,47 @@ export const schemaDict = {
|
|
1336
1360
|
},
|
1337
1361
|
},
|
1338
1362
|
},
|
1363
|
+
createResult: {
|
1364
|
+
type: 'object',
|
1365
|
+
required: ['uri', 'cid'],
|
1366
|
+
properties: {
|
1367
|
+
uri: {
|
1368
|
+
type: 'string',
|
1369
|
+
format: 'at-uri',
|
1370
|
+
},
|
1371
|
+
cid: {
|
1372
|
+
type: 'string',
|
1373
|
+
format: 'cid',
|
1374
|
+
},
|
1375
|
+
validationStatus: {
|
1376
|
+
type: 'string',
|
1377
|
+
knownValues: ['valid', 'unknown'],
|
1378
|
+
},
|
1379
|
+
},
|
1380
|
+
},
|
1381
|
+
updateResult: {
|
1382
|
+
type: 'object',
|
1383
|
+
required: ['uri', 'cid'],
|
1384
|
+
properties: {
|
1385
|
+
uri: {
|
1386
|
+
type: 'string',
|
1387
|
+
format: 'at-uri',
|
1388
|
+
},
|
1389
|
+
cid: {
|
1390
|
+
type: 'string',
|
1391
|
+
format: 'cid',
|
1392
|
+
},
|
1393
|
+
validationStatus: {
|
1394
|
+
type: 'string',
|
1395
|
+
knownValues: ['valid', 'unknown'],
|
1396
|
+
},
|
1397
|
+
},
|
1398
|
+
},
|
1399
|
+
deleteResult: {
|
1400
|
+
type: 'object',
|
1401
|
+
required: [],
|
1402
|
+
properties: {},
|
1403
|
+
},
|
1339
1404
|
},
|
1340
1405
|
},
|
1341
1406
|
ComAtprotoRepoCreateRecord: {
|
@@ -1370,9 +1435,8 @@ export const schemaDict = {
|
|
1370
1435
|
},
|
1371
1436
|
validate: {
|
1372
1437
|
type: 'boolean',
|
1373
|
-
default: true,
|
1374
1438
|
description:
|
1375
|
-
"Can be set to 'false' to skip Lexicon schema validation of record data.",
|
1439
|
+
"Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
|
1376
1440
|
},
|
1377
1441
|
record: {
|
1378
1442
|
type: 'unknown',
|
@@ -1401,6 +1465,14 @@ export const schemaDict = {
|
|
1401
1465
|
type: 'string',
|
1402
1466
|
format: 'cid',
|
1403
1467
|
},
|
1468
|
+
commit: {
|
1469
|
+
type: 'ref',
|
1470
|
+
ref: 'lex:com.atproto.repo.defs#commitMeta',
|
1471
|
+
},
|
1472
|
+
validationStatus: {
|
1473
|
+
type: 'string',
|
1474
|
+
knownValues: ['valid', 'unknown'],
|
1475
|
+
},
|
1404
1476
|
},
|
1405
1477
|
},
|
1406
1478
|
},
|
@@ -1414,6 +1486,25 @@ export const schemaDict = {
|
|
1414
1486
|
},
|
1415
1487
|
},
|
1416
1488
|
},
|
1489
|
+
ComAtprotoRepoDefs: {
|
1490
|
+
lexicon: 1,
|
1491
|
+
id: 'com.atproto.repo.defs',
|
1492
|
+
defs: {
|
1493
|
+
commitMeta: {
|
1494
|
+
type: 'object',
|
1495
|
+
required: ['cid', 'rev'],
|
1496
|
+
properties: {
|
1497
|
+
cid: {
|
1498
|
+
type: 'string',
|
1499
|
+
format: 'cid',
|
1500
|
+
},
|
1501
|
+
rev: {
|
1502
|
+
type: 'string',
|
1503
|
+
},
|
1504
|
+
},
|
1505
|
+
},
|
1506
|
+
},
|
1507
|
+
},
|
1417
1508
|
ComAtprotoRepoDeleteRecord: {
|
1418
1509
|
lexicon: 1,
|
1419
1510
|
id: 'com.atproto.repo.deleteRecord',
|
@@ -1458,6 +1549,18 @@ export const schemaDict = {
|
|
1458
1549
|
},
|
1459
1550
|
},
|
1460
1551
|
},
|
1552
|
+
output: {
|
1553
|
+
encoding: 'application/json',
|
1554
|
+
schema: {
|
1555
|
+
type: 'object',
|
1556
|
+
properties: {
|
1557
|
+
commit: {
|
1558
|
+
type: 'ref',
|
1559
|
+
ref: 'lex:com.atproto.repo.defs#commitMeta',
|
1560
|
+
},
|
1561
|
+
},
|
1562
|
+
},
|
1563
|
+
},
|
1461
1564
|
errors: [
|
1462
1565
|
{
|
1463
1566
|
name: 'InvalidSwap',
|
@@ -1778,9 +1881,8 @@ export const schemaDict = {
|
|
1778
1881
|
},
|
1779
1882
|
validate: {
|
1780
1883
|
type: 'boolean',
|
1781
|
-
default: true,
|
1782
1884
|
description:
|
1783
|
-
"Can be set to 'false' to skip Lexicon schema validation of record data.",
|
1885
|
+
"Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons.",
|
1784
1886
|
},
|
1785
1887
|
record: {
|
1786
1888
|
type: 'unknown',
|
@@ -1815,6 +1917,14 @@ export const schemaDict = {
|
|
1815
1917
|
type: 'string',
|
1816
1918
|
format: 'cid',
|
1817
1919
|
},
|
1920
|
+
commit: {
|
1921
|
+
type: 'ref',
|
1922
|
+
ref: 'lex:com.atproto.repo.defs#commitMeta',
|
1923
|
+
},
|
1924
|
+
validationStatus: {
|
1925
|
+
type: 'string',
|
1926
|
+
knownValues: ['valid', 'unknown'],
|
1927
|
+
},
|
1818
1928
|
},
|
1819
1929
|
},
|
1820
1930
|
},
|
@@ -10356,6 +10466,11 @@ export const schemaDict = {
|
|
10356
10466
|
type: 'string',
|
10357
10467
|
description: 'Subject of the message, used in emails.',
|
10358
10468
|
},
|
10469
|
+
lang: {
|
10470
|
+
type: 'string',
|
10471
|
+
format: 'language',
|
10472
|
+
description: 'Message language.',
|
10473
|
+
},
|
10359
10474
|
createdBy: {
|
10360
10475
|
type: 'string',
|
10361
10476
|
format: 'did',
|
@@ -10371,6 +10486,11 @@ export const schemaDict = {
|
|
10371
10486
|
ref: 'lex:tools.ozone.communication.defs#templateView',
|
10372
10487
|
},
|
10373
10488
|
},
|
10489
|
+
errors: [
|
10490
|
+
{
|
10491
|
+
name: 'DuplicateTemplateName',
|
10492
|
+
},
|
10493
|
+
],
|
10374
10494
|
},
|
10375
10495
|
},
|
10376
10496
|
},
|
@@ -10409,6 +10529,11 @@ export const schemaDict = {
|
|
10409
10529
|
disabled: {
|
10410
10530
|
type: 'boolean',
|
10411
10531
|
},
|
10532
|
+
lang: {
|
10533
|
+
type: 'string',
|
10534
|
+
format: 'language',
|
10535
|
+
description: 'Message language.',
|
10536
|
+
},
|
10412
10537
|
lastUpdatedBy: {
|
10413
10538
|
type: 'string',
|
10414
10539
|
format: 'did',
|
@@ -10496,6 +10621,11 @@ export const schemaDict = {
|
|
10496
10621
|
type: 'string',
|
10497
10622
|
description: 'Name of the template.',
|
10498
10623
|
},
|
10624
|
+
lang: {
|
10625
|
+
type: 'string',
|
10626
|
+
format: 'language',
|
10627
|
+
description: 'Message language.',
|
10628
|
+
},
|
10499
10629
|
contentMarkdown: {
|
10500
10630
|
type: 'string',
|
10501
10631
|
description:
|
@@ -10523,6 +10653,11 @@ export const schemaDict = {
|
|
10523
10653
|
ref: 'lex:tools.ozone.communication.defs#templateView',
|
10524
10654
|
},
|
10525
10655
|
},
|
10656
|
+
errors: [
|
10657
|
+
{
|
10658
|
+
name: 'DuplicateTemplateName',
|
10659
|
+
},
|
10660
|
+
],
|
10526
10661
|
},
|
10527
10662
|
},
|
10528
10663
|
},
|
@@ -11322,6 +11457,7 @@ export const schemaDict = {
|
|
11322
11457
|
'lex:tools.ozone.moderation.defs#modEventMuteReporter',
|
11323
11458
|
'lex:tools.ozone.moderation.defs#modEventUnmuteReporter',
|
11324
11459
|
'lex:tools.ozone.moderation.defs#modEventReverseTakedown',
|
11460
|
+
'lex:tools.ozone.moderation.defs#modEventResolveAppeal',
|
11325
11461
|
'lex:tools.ozone.moderation.defs#modEventEmail',
|
11326
11462
|
'lex:tools.ozone.moderation.defs#modEventTag',
|
11327
11463
|
],
|
@@ -12084,6 +12220,7 @@ export const ids = {
|
|
12084
12220
|
ComAtprotoModerationDefs: 'com.atproto.moderation.defs',
|
12085
12221
|
ComAtprotoRepoApplyWrites: 'com.atproto.repo.applyWrites',
|
12086
12222
|
ComAtprotoRepoCreateRecord: 'com.atproto.repo.createRecord',
|
12223
|
+
ComAtprotoRepoDefs: 'com.atproto.repo.defs',
|
12087
12224
|
ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
|
12088
12225
|
ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo',
|
12089
12226
|
ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
|
@@ -7,32 +7,45 @@ import { lexicons } from '../../../../lexicons'
|
|
7
7
|
import { isObj, hasProp } from '../../../../util'
|
8
8
|
import { CID } from 'multiformats/cid'
|
9
9
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
10
|
+
import * as ComAtprotoRepoDefs from './defs'
|
10
11
|
|
11
12
|
export interface QueryParams {}
|
12
13
|
|
13
14
|
export interface InputSchema {
|
14
15
|
/** The handle or DID of the repo (aka, current account). */
|
15
16
|
repo: string
|
16
|
-
/** Can be set to 'false' to skip Lexicon schema validation of record data, for
|
17
|
-
validate
|
17
|
+
/** Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. */
|
18
|
+
validate?: boolean
|
18
19
|
writes: (Create | Update | Delete)[]
|
19
20
|
/** If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. */
|
20
21
|
swapCommit?: string
|
21
22
|
[k: string]: unknown
|
22
23
|
}
|
23
24
|
|
25
|
+
export interface OutputSchema {
|
26
|
+
commit?: ComAtprotoRepoDefs.CommitMeta
|
27
|
+
results?: (CreateResult | UpdateResult | DeleteResult)[]
|
28
|
+
[k: string]: unknown
|
29
|
+
}
|
30
|
+
|
24
31
|
export interface HandlerInput {
|
25
32
|
encoding: 'application/json'
|
26
33
|
body: InputSchema
|
27
34
|
}
|
28
35
|
|
36
|
+
export interface HandlerSuccess {
|
37
|
+
encoding: 'application/json'
|
38
|
+
body: OutputSchema
|
39
|
+
headers?: { [key: string]: string }
|
40
|
+
}
|
41
|
+
|
29
42
|
export interface HandlerError {
|
30
43
|
status: number
|
31
44
|
message?: string
|
32
45
|
error?: 'InvalidSwap'
|
33
46
|
}
|
34
47
|
|
35
|
-
export type HandlerOutput = HandlerError |
|
48
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
36
49
|
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
37
50
|
auth: HA
|
38
51
|
params: QueryParams
|
@@ -102,3 +115,57 @@ export function isDelete(v: unknown): v is Delete {
|
|
102
115
|
export function validateDelete(v: unknown): ValidationResult {
|
103
116
|
return lexicons.validate('com.atproto.repo.applyWrites#delete', v)
|
104
117
|
}
|
118
|
+
|
119
|
+
export interface CreateResult {
|
120
|
+
uri: string
|
121
|
+
cid: string
|
122
|
+
validationStatus?: 'valid' | 'unknown' | (string & {})
|
123
|
+
[k: string]: unknown
|
124
|
+
}
|
125
|
+
|
126
|
+
export function isCreateResult(v: unknown): v is CreateResult {
|
127
|
+
return (
|
128
|
+
isObj(v) &&
|
129
|
+
hasProp(v, '$type') &&
|
130
|
+
v.$type === 'com.atproto.repo.applyWrites#createResult'
|
131
|
+
)
|
132
|
+
}
|
133
|
+
|
134
|
+
export function validateCreateResult(v: unknown): ValidationResult {
|
135
|
+
return lexicons.validate('com.atproto.repo.applyWrites#createResult', v)
|
136
|
+
}
|
137
|
+
|
138
|
+
export interface UpdateResult {
|
139
|
+
uri: string
|
140
|
+
cid: string
|
141
|
+
validationStatus?: 'valid' | 'unknown' | (string & {})
|
142
|
+
[k: string]: unknown
|
143
|
+
}
|
144
|
+
|
145
|
+
export function isUpdateResult(v: unknown): v is UpdateResult {
|
146
|
+
return (
|
147
|
+
isObj(v) &&
|
148
|
+
hasProp(v, '$type') &&
|
149
|
+
v.$type === 'com.atproto.repo.applyWrites#updateResult'
|
150
|
+
)
|
151
|
+
}
|
152
|
+
|
153
|
+
export function validateUpdateResult(v: unknown): ValidationResult {
|
154
|
+
return lexicons.validate('com.atproto.repo.applyWrites#updateResult', v)
|
155
|
+
}
|
156
|
+
|
157
|
+
export interface DeleteResult {
|
158
|
+
[k: string]: unknown
|
159
|
+
}
|
160
|
+
|
161
|
+
export function isDeleteResult(v: unknown): v is DeleteResult {
|
162
|
+
return (
|
163
|
+
isObj(v) &&
|
164
|
+
hasProp(v, '$type') &&
|
165
|
+
v.$type === 'com.atproto.repo.applyWrites#deleteResult'
|
166
|
+
)
|
167
|
+
}
|
168
|
+
|
169
|
+
export function validateDeleteResult(v: unknown): ValidationResult {
|
170
|
+
return lexicons.validate('com.atproto.repo.applyWrites#deleteResult', v)
|
171
|
+
}
|
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
|
|
7
7
|
import { isObj, hasProp } from '../../../../util'
|
8
8
|
import { CID } from 'multiformats/cid'
|
9
9
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
10
|
+
import * as ComAtprotoRepoDefs from './defs'
|
10
11
|
|
11
12
|
export interface QueryParams {}
|
12
13
|
|
@@ -17,8 +18,8 @@ export interface InputSchema {
|
|
17
18
|
collection: string
|
18
19
|
/** The Record Key. */
|
19
20
|
rkey?: string
|
20
|
-
/** Can be set to 'false' to skip Lexicon schema validation of record data. */
|
21
|
-
validate
|
21
|
+
/** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
|
22
|
+
validate?: boolean
|
22
23
|
/** The record itself. Must contain a $type field. */
|
23
24
|
record: {}
|
24
25
|
/** Compare and swap with the previous commit by CID. */
|
@@ -29,6 +30,8 @@ export interface InputSchema {
|
|
29
30
|
export interface OutputSchema {
|
30
31
|
uri: string
|
31
32
|
cid: string
|
33
|
+
commit?: ComAtprotoRepoDefs.CommitMeta
|
34
|
+
validationStatus?: 'valid' | 'unknown' | (string & {})
|
32
35
|
[k: string]: unknown
|
33
36
|
}
|
34
37
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
5
|
+
import { lexicons } from '../../../../lexicons'
|
6
|
+
import { isObj, hasProp } from '../../../../util'
|
7
|
+
import { CID } from 'multiformats/cid'
|
8
|
+
|
9
|
+
export interface CommitMeta {
|
10
|
+
cid: string
|
11
|
+
rev: string
|
12
|
+
[k: string]: unknown
|
13
|
+
}
|
14
|
+
|
15
|
+
export function isCommitMeta(v: unknown): v is CommitMeta {
|
16
|
+
return (
|
17
|
+
isObj(v) &&
|
18
|
+
hasProp(v, '$type') &&
|
19
|
+
v.$type === 'com.atproto.repo.defs#commitMeta'
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
export function validateCommitMeta(v: unknown): ValidationResult {
|
24
|
+
return lexicons.validate('com.atproto.repo.defs#commitMeta', v)
|
25
|
+
}
|
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
|
|
7
7
|
import { isObj, hasProp } from '../../../../util'
|
8
8
|
import { CID } from 'multiformats/cid'
|
9
9
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
10
|
+
import * as ComAtprotoRepoDefs from './defs'
|
10
11
|
|
11
12
|
export interface QueryParams {}
|
12
13
|
|
@@ -24,18 +25,29 @@ export interface InputSchema {
|
|
24
25
|
[k: string]: unknown
|
25
26
|
}
|
26
27
|
|
28
|
+
export interface OutputSchema {
|
29
|
+
commit?: ComAtprotoRepoDefs.CommitMeta
|
30
|
+
[k: string]: unknown
|
31
|
+
}
|
32
|
+
|
27
33
|
export interface HandlerInput {
|
28
34
|
encoding: 'application/json'
|
29
35
|
body: InputSchema
|
30
36
|
}
|
31
37
|
|
38
|
+
export interface HandlerSuccess {
|
39
|
+
encoding: 'application/json'
|
40
|
+
body: OutputSchema
|
41
|
+
headers?: { [key: string]: string }
|
42
|
+
}
|
43
|
+
|
32
44
|
export interface HandlerError {
|
33
45
|
status: number
|
34
46
|
message?: string
|
35
47
|
error?: 'InvalidSwap'
|
36
48
|
}
|
37
49
|
|
38
|
-
export type HandlerOutput = HandlerError |
|
50
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
39
51
|
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
40
52
|
auth: HA
|
41
53
|
params: QueryParams
|
@@ -7,6 +7,7 @@ import { lexicons } from '../../../../lexicons'
|
|
7
7
|
import { isObj, hasProp } from '../../../../util'
|
8
8
|
import { CID } from 'multiformats/cid'
|
9
9
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
10
|
+
import * as ComAtprotoRepoDefs from './defs'
|
10
11
|
|
11
12
|
export interface QueryParams {}
|
12
13
|
|
@@ -17,8 +18,8 @@ export interface InputSchema {
|
|
17
18
|
collection: string
|
18
19
|
/** The Record Key. */
|
19
20
|
rkey: string
|
20
|
-
/** Can be set to 'false' to skip Lexicon schema validation of record data. */
|
21
|
-
validate
|
21
|
+
/** Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. */
|
22
|
+
validate?: boolean
|
22
23
|
/** The record to write. */
|
23
24
|
record: {}
|
24
25
|
/** Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation */
|
@@ -31,6 +32,8 @@ export interface InputSchema {
|
|
31
32
|
export interface OutputSchema {
|
32
33
|
uri: string
|
33
34
|
cid: string
|
35
|
+
commit?: ComAtprotoRepoDefs.CommitMeta
|
36
|
+
validationStatus?: 'valid' | 'unknown' | (string & {})
|
34
37
|
[k: string]: unknown
|
35
38
|
}
|
36
39
|
|