techne-sdk 0.5.0 → 0.6.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 +36 -0
- package/README.md +12 -3
- package/dist/auth/app-key.d.ts +5 -0
- package/dist/auth/app-key.js +7 -0
- package/dist/auth/index.d.ts +19 -11
- package/dist/auth/index.js +21 -13
- package/dist/catalog/catalog.gen.js +124 -18
- package/dist/connect.d.ts +18 -3
- package/dist/connect.js +2 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +9 -0
- package/dist/generated/lexicons.d.ts +182 -20
- package/dist/generated/lexicons.js +107 -10
- package/dist/generated/nsid.d.ts +1 -0
- package/dist/generated/nsid.js +1 -0
- package/dist/generated/nsid.json +1 -0
- package/dist/generated/types/pub/techne/draft/identity/writeAsCollective.d.ts +51 -0
- package/dist/generated/types/pub/techne/draft/identity/writeAsCollective.js +55 -0
- package/dist/generated/types/pub/techne/draft/permissioned/putRecord.d.ts +1 -1
- package/dist/generated/types/pub/techne/draft/permissioned/putRecords.d.ts +1 -1
- package/dist/wasm/techne-wasm.gen.js +1 -1
- package/dist/wasm/techne-wasm2js.gen.js +16118 -16120
- package/package.json +3 -2
|
@@ -5564,6 +5564,102 @@ export const schemaDict = {
|
|
|
5564
5564
|
},
|
|
5565
5565
|
},
|
|
5566
5566
|
},
|
|
5567
|
+
PubTechneDraftIdentityWriteAsCollective: {
|
|
5568
|
+
lexicon: 1,
|
|
5569
|
+
id: 'pub.techne.draft.identity.writeAsCollective',
|
|
5570
|
+
defs: {
|
|
5571
|
+
main: {
|
|
5572
|
+
type: 'procedure',
|
|
5573
|
+
description: "Write as a collective: a batch of creates, updates and deletes applied atomically to the repo of a collective account whose credential this service holds, written with that credential. The same input and output as com.atproto.repo.applyWrites, with `repo` the collective's DID; each write is a com.atproto.repo.applyWrites#create, #update or #delete. The service checks the caller's role in the collective first: whoever manages the collective's own member space (`pub.techne.draft.space.collective.member/self`) writes as it; a member of a circle who only writes there deletes its own membership; a new collective's creator writes its first records; a collective that lets every signed-in account post a type takes one such create. A collective that keeps its memberships and descriptor in its member space (a circle) has them created and updated there with pub.techne.draft.permissioned.putRecords, never here (a delete is applied here), and a `block` is never created or updated as a collective. An app reaches it through the caller's own PDS (`atproto-proxy: <service DID>#atproto_appview`), which forwards it with the caller's service-auth token; the app's OAuth scope needs `rpc:pub.techne.draft.identity.writeAsCollective?aud=<service DID>%23atproto_appview`. An agent's token from this service, or a session with it, calls it directly. Its writes are public records in the collective's repo, and the caller's authority is its role there, so the app's `space:` scopes need not reach them (the `rpc:` scope above is enough). It places nothing in a space: a write that names a `space` is refused, and pub.techne.draft.permissioned.putRecords writes into a collective's space. Your own repo is not written here: write it at your PDS with com.atproto.repo.applyWrites. One call spends one of the caller's writes.",
|
|
5574
|
+
input: {
|
|
5575
|
+
encoding: 'application/json',
|
|
5576
|
+
schema: {
|
|
5577
|
+
type: 'object',
|
|
5578
|
+
required: ['repo', 'writes'],
|
|
5579
|
+
properties: {
|
|
5580
|
+
repo: {
|
|
5581
|
+
type: 'string',
|
|
5582
|
+
format: 'did',
|
|
5583
|
+
description: "The collective's DID. Not the caller's own.",
|
|
5584
|
+
},
|
|
5585
|
+
validate: {
|
|
5586
|
+
type: 'boolean',
|
|
5587
|
+
description: "As com.atproto.repo.applyWrites: passed to the collective's PDS.",
|
|
5588
|
+
},
|
|
5589
|
+
writes: {
|
|
5590
|
+
type: 'array',
|
|
5591
|
+
items: {
|
|
5592
|
+
type: 'union',
|
|
5593
|
+
refs: [
|
|
5594
|
+
'lex:com.atproto.repo.applyWrites#create',
|
|
5595
|
+
'lex:com.atproto.repo.applyWrites#update',
|
|
5596
|
+
'lex:com.atproto.repo.applyWrites#delete',
|
|
5597
|
+
],
|
|
5598
|
+
closed: true,
|
|
5599
|
+
},
|
|
5600
|
+
},
|
|
5601
|
+
swapCommit: {
|
|
5602
|
+
type: 'string',
|
|
5603
|
+
format: 'cid',
|
|
5604
|
+
description: "As com.atproto.repo.applyWrites: the whole batch fails unless the collective's repo is at this commit.",
|
|
5605
|
+
},
|
|
5606
|
+
},
|
|
5607
|
+
},
|
|
5608
|
+
},
|
|
5609
|
+
output: {
|
|
5610
|
+
encoding: 'application/json',
|
|
5611
|
+
schema: {
|
|
5612
|
+
type: 'object',
|
|
5613
|
+
required: [],
|
|
5614
|
+
properties: {
|
|
5615
|
+
commit: {
|
|
5616
|
+
type: 'ref',
|
|
5617
|
+
ref: 'lex:com.atproto.repo.defs#commitMeta',
|
|
5618
|
+
},
|
|
5619
|
+
results: {
|
|
5620
|
+
type: 'array',
|
|
5621
|
+
items: {
|
|
5622
|
+
type: 'union',
|
|
5623
|
+
refs: [
|
|
5624
|
+
'lex:com.atproto.repo.applyWrites#createResult',
|
|
5625
|
+
'lex:com.atproto.repo.applyWrites#updateResult',
|
|
5626
|
+
'lex:com.atproto.repo.applyWrites#deleteResult',
|
|
5627
|
+
],
|
|
5628
|
+
closed: true,
|
|
5629
|
+
},
|
|
5630
|
+
},
|
|
5631
|
+
},
|
|
5632
|
+
},
|
|
5633
|
+
},
|
|
5634
|
+
errors: [
|
|
5635
|
+
{
|
|
5636
|
+
name: 'InvalidRequest',
|
|
5637
|
+
description: "HTTP 400 (or the body extractor's 413, 415 or 422 for a body that is not JSON). Malformed input; `repo` is the caller's own DID (write your own repo at your PDS); a write names a `space` the app's `space:` scopes cover, or the token carries none (write it there with pub.techne.draft.permissioned.putRecords); or the collective's PDS refused the writes (its reason in the message, e.g. InvalidSwap when `swapCommit` did not match).",
|
|
5638
|
+
},
|
|
5639
|
+
{
|
|
5640
|
+
name: 'Forbidden',
|
|
5641
|
+
description: 'HTTP 403. The caller may not write as `repo`, or not this write: a record above its own role, a `block`, or a membership or descriptor the collective keeps in its member space.',
|
|
5642
|
+
},
|
|
5643
|
+
{
|
|
5644
|
+
name: 'NotAuthorized',
|
|
5645
|
+
description: "HTTP 403. A write names a `space` the app's `space:` scopes do not cover writing to.",
|
|
5646
|
+
},
|
|
5647
|
+
{
|
|
5648
|
+
name: 'LastManager',
|
|
5649
|
+
description: "HTTP 409. The writes would leave a circle's members with no manager.",
|
|
5650
|
+
},
|
|
5651
|
+
{
|
|
5652
|
+
name: 'PayloadTooLarge',
|
|
5653
|
+
description: "HTTP 413, from the collective's PDS.",
|
|
5654
|
+
},
|
|
5655
|
+
{
|
|
5656
|
+
name: 'RateLimitExceeded',
|
|
5657
|
+
description: "HTTP 429. Too many writes from this DID, or the collective's PDS is rate-limiting.",
|
|
5658
|
+
},
|
|
5659
|
+
],
|
|
5660
|
+
},
|
|
5661
|
+
},
|
|
5662
|
+
},
|
|
5567
5663
|
PubTechneDraftInterest: {
|
|
5568
5664
|
lexicon: 1,
|
|
5569
5665
|
id: 'pub.techne.draft.interest',
|
|
@@ -6046,11 +6142,11 @@ export const schemaDict = {
|
|
|
6046
6142
|
PubTechneDraftPermissionedDeleteRecord: {
|
|
6047
6143
|
lexicon: 1,
|
|
6048
6144
|
id: 'pub.techne.draft.permissioned.deleteRecord',
|
|
6049
|
-
description: "Delete a record from the caller's own repo (a takedown, a mistake, or a `share` the owner withdraws, which stops that reader's future reads, with a 'revoke-read' receipt once no share in its source space names it). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden; a caller whose account is being deleted, or is deleted, is refused (AccountDeleting). The body is removed; a tombstone receipt stays in listChanges, in the space the record counted in, so readers drop their copies. Deleting a record that does not exist is a no-op unless swapCid is given (then it is InvalidSwap) or the delete names an app's space the caller may not delete in (then it is Forbidden). A request body that is not this method's input is refused as InvalidRequest, with an XRPC error body ({\"error\":\"InvalidRequest\",\"message\":...}): HTTP 413 for a body over 2 MiB (2,097,152 bytes; it is not read past that); 415 for one not sent as application/json; 400 for one that is not JSON; 422 for JSON that is not the input (a field missing or of the wrong type). Such a refused write still spends one of the caller's writes (RateLimitExceeded). When the call's token carries space scopes from Techne's ePDS, the delete must name its `space`, and one the scopes do not cover is refused 403 Forbidden. A record written for an app's space (a pub.techne.draft.space.private space) is deleted only by
|
|
6145
|
+
description: "Delete a record from the caller's own repo (a takedown, a mistake, or a `share` the owner withdraws, which stops that reader's future reads, with a 'revoke-read' receipt once no share in its source space names it). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden; a caller whose account is being deleted, or is deleted, is refused (AccountDeleting). The body is removed; a tombstone receipt stays in listChanges, in the space the record counted in, so readers drop their copies. Deleting a record that does not exist is a no-op unless swapCid is given (then it is InvalidSwap) or the delete names an app's space the caller may not delete in (then it is Forbidden). A request body that is not this method's input is refused as InvalidRequest, with an XRPC error body ({\"error\":\"InvalidRequest\",\"message\":...}): HTTP 413 for a body over 2 MiB (2,097,152 bytes; it is not read past that); 415 for one not sent as application/json; 400 for one that is not JSON; 422 for JSON that is not the input (a field missing or of the wrong type). Such a refused write still spends one of the caller's writes (RateLimitExceeded). When the call's token carries space scopes from Techne's ePDS, the delete must name its `space`, and one the scopes do not cover is refused 403 Forbidden. A record written for an app's space (a pub.techne.draft.space.private space) is deleted only by a caller whose `space:` scopes cover a delete there or whose token carries no `space:` scopes; any other caller is refused 403 Forbidden and nothing is deleted, even when nothing is at the key. Draft tier.",
|
|
6050
6146
|
defs: {
|
|
6051
6147
|
main: {
|
|
6052
6148
|
type: 'procedure',
|
|
6053
|
-
description: "Delete one of your own permissioned records (or a collective's or circle's whose own member space you manage). One key holds one record per space: `space` names which goes; without it, the key's one record, Conflict when there are several. A tombstone stays in listChanges so readers drop their copies. Deleting a missing record is a no-op unless swapCid is given (InvalidSwap), or it names an app's space the caller may not delete in (Forbidden). When the call's token carries space scopes from Techne's ePDS, the delete must name its `space`, and one the scopes do not cover is refused 403 Forbidden. A record written for an app's space is deleted only
|
|
6149
|
+
description: "Delete one of your own permissioned records (or a collective's or circle's whose own member space you manage). One key holds one record per space: `space` names which goes; without it, the key's one record, Conflict when there are several. A tombstone stays in listChanges so readers drop their copies. Deleting a missing record is a no-op unless swapCid is given (InvalidSwap), or it names an app's space the caller may not delete in (Forbidden). When the call's token carries space scopes from Techne's ePDS, the delete must name its `space`, and one the scopes do not cover is refused 403 Forbidden. A record written for an app's space is deleted only under `space:` scopes covering it or with no `space:` scopes: anyone else is 403 Forbidden. Draft tier.",
|
|
6054
6150
|
input: {
|
|
6055
6151
|
encoding: 'application/json',
|
|
6056
6152
|
schema: {
|
|
@@ -6104,7 +6200,7 @@ export const schemaDict = {
|
|
|
6104
6200
|
},
|
|
6105
6201
|
{
|
|
6106
6202
|
name: 'Forbidden',
|
|
6107
|
-
description: "HTTP 403. repo is not the caller's own (or a collective's or circle's the caller may write as, see the description); or the call's `space:` scopes do not cover the delete; or the record was written for an app's space (pub.techne.draft.space.private)
|
|
6203
|
+
description: "HTTP 403. repo is not the caller's own (or a collective's or circle's the caller may write as, see the description); or the call's `space:` scopes do not cover the delete; or the record was written for an app's space (pub.techne.draft.space.private) under `space:` scopes that do not cover a delete there. Nothing is deleted.",
|
|
6108
6204
|
},
|
|
6109
6205
|
{
|
|
6110
6206
|
name: 'LastManager',
|
|
@@ -6483,11 +6579,11 @@ export const schemaDict = {
|
|
|
6483
6579
|
PubTechneDraftPermissionedPutRecord: {
|
|
6484
6580
|
lexicon: 1,
|
|
6485
6581
|
id: 'pub.techne.draft.permissioned.putRecord',
|
|
6486
|
-
description: "Write a record into the caller's own repo, as a permissioned record (the generic private write). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden: a record is only ever written into its writer's repo. There is no write gate on a first write and no collection check: any collection may be written, for any space, and a first write is never refused
|
|
6582
|
+
description: "Write a record into the caller's own repo, as a permissioned record (the generic private write). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden: a record is only ever written into its writer's repo. There is no write gate on a first write and no collection check: any collection may be written, for any space, and a first write is never refused by its space's policy (only by the token's `space:` scopes). Replacing a record already written for an app's space (a pub.techne.draft.space.private space): only a caller whose `space:` scopes cover a put there, or whose token carries no `space:` scopes, may replace it; any other caller is refused 403 Forbidden and nothing is written. One collection is refused there: one of the platform's own record types named for an app's space (pub.techne.draft.space.private) is refused as InvalidRequest, since our own types keep their declared homes (the adopted community.lexicon.calendar.event and .rsvp are not refused there: they are the app's own data, and an RSVP there projects no claim). Otherwise what it counts for is the managing app's admission of the version as it is written: the record counts in the `space` it names only when that space's write policy admits the writer and, for a collection with a published lexicon, the space type declares the collection; it is then read by whoever the space's read policy admits. A record for a pub.techne.draft.space.private space is a space like any other: a write there counts when its owner writes it under `space:` scopes covering it or with no `space:` scopes (which app is calling is not asked); a write under scopes that do not cover it is refused like any write out of scope. Otherwise it is stored in the writer's repo, counts in no space, and only its writer reads it (a record written for an app's space and not admitted there is read by no one); write it again to ask again (for an app's space only the callers that may replace a record there can). A write into a space whose authority's account is being deleted, or is deleted, is stored the same way and counts in no space (the space goes with that account). A caller whose own account is being deleted, or is deleted, is refused (AccountDeleting). The output's `space` says where it counts. A source keeps what it does not publish in its own pub.techne.draft.space.source (at://{source}/pub.techne.draft.space.source/self): its permissioned descriptions, the `share`s naming its readers (writing one admits its subject, who gets a 'granted' receipt; deleting the last one naming a reader gives a 'revoke-read'. A share keeps one space per key, so it is never moved out of the space: writing it for another space is refused as Conflict), and a scraper's raw payloads and crawl state. A body in a collection with a published lexicon must satisfy it (InvalidRequest otherwise); any other collection is stored as written. Writing the current version again for the same space records no new version: if it counts there it is a no-op; if it was not admitted, admission is asked again, and a version admitted now is placed in the space with a receipt. In an app's space this holds only for the callers that may replace a record there; anyone else's write of the same version is refused Forbidden. A request body that is not this method's input is refused as InvalidRequest, with an XRPC error body ({\"error\":\"InvalidRequest\",\"message\":...}): HTTP 413 for a body over 2 MiB (2,097,152 bytes; it is not read past that); 415 for one not sent as application/json; 400 for one that is not JSON; 422 for JSON that is not the input (a field missing or of the wrong type). Such a refused write still spends one of the caller's writes (RateLimitExceeded). When the call's token carries space scopes from Techne's ePDS, a write to a space they do not cover is refused 403 Forbidden. `space` is required: a write that names no space is refused as InvalidRequest (HTTP 400; for putRecords the whole call, and nothing is written), since public records are written with com.atproto.repo.putRecord and a record only the caller reads goes in its own pub.techne.draft.space.personal. Records written before this rule with no space stay stored and readable by their writer. Draft tier.",
|
|
6487
6583
|
defs: {
|
|
6488
6584
|
main: {
|
|
6489
6585
|
type: 'procedure',
|
|
6490
|
-
description: "Write one record into your own repo (or a collective's or circle's whose own member space you manage; a circle member holding only its write leg writes membership adds and their own claim) as a permissioned record, for the `space` it names (required: no space is InvalidRequest; public records go through com.atproto.repo.putRecord, and a record only you read goes in your space.personal). Any collection; a body of a collection with a published lexicon must satisfy it. It counts in that space only when the space's write policy admits you (and, for one of our own types, the space type declares the collection); otherwise it is stored and only you read it. A first write is never refused
|
|
6586
|
+
description: "Write one record into your own repo (or a collective's or circle's whose own member space you manage; a circle member holding only its write leg writes membership adds and their own claim) as a permissioned record, for the `space` it names (required: no space is InvalidRequest; public records go through com.atproto.repo.putRecord, and a record only you read goes in your space.personal). Any collection; a body of a collection with a published lexicon must satisfy it. It counts in that space only when the space's write policy admits you (and, for one of our own types, the space type declares the collection); otherwise it is stored and only you read it. A first write is never refused by its space's policy (only by your token's `space:` scopes). A pub.techne.draft.space.private record counts there when written under `space:` scopes covering it or with no `space:` scopes; which app is calling is not asked. Replacing a record already written there needs `space:` scopes covering it, or none; anyone else is 403 Forbidden. The output's `space` says where it counts. Writing the current version again is a no-op (in an app's space, only under covering scopes or with no `space:` scopes; else Forbidden). One write of your rate (RateLimitExceeded). A token with space scopes from Techne's ePDS: a write to a space they do not cover is 403 Forbidden. Draft tier.",
|
|
6491
6587
|
input: {
|
|
6492
6588
|
encoding: 'application/json',
|
|
6493
6589
|
schema: {
|
|
@@ -6557,7 +6653,7 @@ export const schemaDict = {
|
|
|
6557
6653
|
space: {
|
|
6558
6654
|
type: 'string',
|
|
6559
6655
|
format: 'at-uri',
|
|
6560
|
-
description: "The space the record counts in now. Absent when it counts in none (the space's write policy does not admit the writer
|
|
6656
|
+
description: "The space the record counts in now. Absent when it counts in none (the space's write policy does not admit the writer).",
|
|
6561
6657
|
},
|
|
6562
6658
|
},
|
|
6563
6659
|
},
|
|
@@ -6569,7 +6665,7 @@ export const schemaDict = {
|
|
|
6569
6665
|
},
|
|
6570
6666
|
{
|
|
6571
6667
|
name: 'Forbidden',
|
|
6572
|
-
description: "HTTP 403. repo is not the caller's own (or a collective's or circle's the caller may write as, see the description); or the call's `space:` scopes do not cover the write; or the write replaces a record already written for an app's space (pub.techne.draft.space.private)
|
|
6668
|
+
description: "HTTP 403. repo is not the caller's own (or a collective's or circle's the caller may write as, see the description); or the call's `space:` scopes do not cover the write; or the write replaces a record already written for an app's space (pub.techne.draft.space.private) under `space:` scopes that do not cover a put there. A first write is never refused by its space's policy (only by the token's `space:` scopes). Nothing is written.",
|
|
6573
6669
|
},
|
|
6574
6670
|
{
|
|
6575
6671
|
name: 'LastManager',
|
|
@@ -6610,11 +6706,11 @@ export const schemaDict = {
|
|
|
6610
6706
|
PubTechneDraftPermissionedPutRecords: {
|
|
6611
6707
|
lexicon: 1,
|
|
6612
6708
|
id: 'pub.techne.draft.permissioned.putRecords',
|
|
6613
|
-
description: "Write up to 200 records into the caller's own repo in one call: each write is applied in order, exactly as putRecord applies it (the same admission, receipts, no-op re-put and swapCid), each in its own transaction. NOT atomic: a write that is refused does not undo the writes before it or stop the ones after it, and each write's result says what happened to it. That is why this is not called applyWrites: atproto's com.atproto.repo.applyWrites commits all of its writes or none, and this does not (each write keeps putRecord's own per-record locking, so a batch never holds more than one record's locks). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden and nothing is written. A write refused for itself (a malformed or invalid record, a swapCid that does not match, a conflict) is reported in its result as the error putRecord would have answered, and the next write is applied, except in a roster batch: one with any pub.techne.draft.membership write, in whatever repo. A roster batch of more than one write is first checked whole, and a write in it that putRecord would refuse before reading anything (malformed, over 2 MiB, failing its lexicon, or naming a space it cannot be written into) refuses the call as InvalidRequest (HTTP 400) with nothing written; it then stops at its first refused write, and every write after that one is reported as Conflict and not written. Since any prefix of a roster batch may be what is left written, a batch written as a circle that has a manager must keep one after every prefix of its membership writes (see LastManager), not only after the whole batch: to make someone else manager, put their membership at role 30 or above before the caller's own lower one. A refusal that holds for the whole call stops it with that error, and no later write is applied: the caller's account is being deleted, or is deleted (AccountDeleting; what it wrote goes with the account), or a failure inside the AppView (HTTP 500; the writes applied before it stay written, so read them back or send the batch again: writing the current version again for the same space is a no-op). Callers should treat a failed batch as all-or-nothing and send it again whole: re-putting the records that landed is a no-op (in an app's space only
|
|
6709
|
+
description: "Write up to 200 records into the caller's own repo in one call: each write is applied in order, exactly as putRecord applies it (the same admission, receipts, no-op re-put and swapCid), each in its own transaction. NOT atomic: a write that is refused does not undo the writes before it or stop the ones after it, and each write's result says what happened to it. That is why this is not called applyWrites: atproto's com.atproto.repo.applyWrites commits all of its writes or none, and this does not (each write keeps putRecord's own per-record locking, so a batch never holds more than one record's locks). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands over the authority's pen; managing another of its spaces does not); in a circle (a collective whose descriptor names a circle type) a caller holding only that space's write leg (role 20-29) holds the pen for pub.techne.draft.membership writes alone: an add (a new claim at a key that holds none now, not ending, whose addedBy is the caller or absent) or the caller's own claim (its leave, or a re-put keeping its subject and addedBy); anything else as the circle is Forbidden, or a collective the caller made that has nothing placed yet (for at most a day), else Forbidden and nothing is written. A write refused for itself (a malformed or invalid record, a swapCid that does not match, a conflict) is reported in its result as the error putRecord would have answered, and the next write is applied, except in a roster batch: one with any pub.techne.draft.membership write, in whatever repo. A roster batch of more than one write is first checked whole, and a write in it that putRecord would refuse before reading anything (malformed, over 2 MiB, failing its lexicon, or naming a space it cannot be written into) refuses the call as InvalidRequest (HTTP 400) with nothing written; it then stops at its first refused write, and every write after that one is reported as Conflict and not written. Since any prefix of a roster batch may be what is left written, a batch written as a circle that has a manager must keep one after every prefix of its membership writes (see LastManager), not only after the whole batch: to make someone else manager, put their membership at role 30 or above before the caller's own lower one. A refusal that holds for the whole call stops it with that error, and no later write is applied: the caller's account is being deleted, or is deleted (AccountDeleting; what it wrote goes with the account), or a failure inside the AppView (HTTP 500; the writes applied before it stay written, so read them back or send the batch again: writing the current version again for the same space is a no-op). Callers should treat a failed batch as all-or-nothing and send it again whole: re-putting the records that landed is a no-op (in an app's space only under `space:` scopes covering it or with no `space:` scopes; anyone else's re-put there is Forbidden), and at the move to atproto's permissioned data this method becomes the owner's own PDS com.atproto.repo.applyWrites, which is atomic. One call spends one of the caller's writes (RateLimitExceeded), whatever the number of writes it carries. A request body that is not this method's input is refused as InvalidRequest, with an XRPC error body ({\"error\":\"InvalidRequest\",\"message\":...}): HTTP 413 for a body over 8 MiB (8,388,608 bytes; it is not read past that); 415 for one not sent as application/json; 400 for one that is not JSON or carries no writes or more than 200; 422 for JSON that is not the input (a field missing or of the wrong type). Such a refused call still spends one of the caller's writes. Each write is checked against the token's space scopes as putRecord checks it, and a write that replaces a record already written for an app's space (a pub.techne.draft.space.private space) under `space:` scopes that do not cover a put there is refused as putRecord refuses it; either refusal is that write's result (Forbidden), and the next write is applied (in a roster batch, the writes after it are Conflict, not written). A first write is never refused by its space's policy (only by the token's `space:` scopes). `space` is required: a write that names no space is refused as InvalidRequest (HTTP 400; for putRecords the whole call, and nothing is written), since public records are written with com.atproto.repo.putRecord and a record only the caller reads goes in its own pub.techne.draft.space.personal. Records written before this rule with no space stay stored and readable by their writer. Draft tier.",
|
|
6614
6710
|
defs: {
|
|
6615
6711
|
main: {
|
|
6616
6712
|
type: 'procedure',
|
|
6617
|
-
description: "Up to 200 putRecord writes, applied in order, each in its own transaction, for one write of your rate. Not atomic: each write's result says what happened to it, and a write refused for itself does not stop the others (AccountDeleting or an HTTP 500 stops the rest), except in a roster batch (one with any pub.techne.draft.membership write), which stops at its first refused write and reports each later one as Conflict, not written; as a circle, every prefix of its membership writes must keep the circle a manager. Send a failed batch again whole: re-putting what landed is a no-op (in an app's space, only
|
|
6713
|
+
description: "Up to 200 putRecord writes, applied in order, each in its own transaction, for one write of your rate. Not atomic: each write's result says what happened to it, and a write refused for itself does not stop the others (AccountDeleting or an HTTP 500 stops the rest), except in a roster batch (one with any pub.techne.draft.membership write), which stops at its first refused write and reports each later one as Conflict, not written; as a circle, every prefix of its membership writes must keep the circle a manager. Send a failed batch again whole: re-putting what landed is a no-op (in an app's space, only under covering scopes or with no `space:` scopes). Space scopes and space.private apply to each write as in putRecord: a first write is never refused by its space's policy (only by the token's `space:` scopes), but replacing a record already written for an app's space needs `space:` scopes covering it or no `space:` scopes, and that write's result is Forbidden. Every write names its `space` (a write with none refuses the whole call, InvalidRequest; public records go through com.atproto.repo.putRecord). Draft tier.",
|
|
6618
6714
|
input: {
|
|
6619
6715
|
encoding: 'application/json',
|
|
6620
6716
|
schema: {
|
|
@@ -6758,7 +6854,7 @@ export const schemaDict = {
|
|
|
6758
6854
|
properties: {
|
|
6759
6855
|
error: {
|
|
6760
6856
|
type: 'string',
|
|
6761
|
-
description: "InvalidRequest (malformed, a body that fails its collection's published lexicon, or a record over 2 MiB, more than a putRecord body may be), InvalidSwap (swapCid did not match the current version), Conflict (the same key holds a public record in the caller's repo, or a concurrent write replaced this version before it was recorded), IdentityConflict (the write would change a contact's identity, which writing again never fixes; see putRecord), DuplicatePhone (a contact write introduces a number another of the caller's active contacts carries; see putRecord), RateLimitExceeded (a contact write that binds a number to an account found the caller's phone lookups spent; retry it in a minute) or Forbidden (the call's `space:` scopes do not cover the write, or it replaces a record already written for an app's space
|
|
6857
|
+
description: "InvalidRequest (malformed, a body that fails its collection's published lexicon, or a record over 2 MiB, more than a putRecord body may be), InvalidSwap (swapCid did not match the current version), Conflict (the same key holds a public record in the caller's repo, or a concurrent write replaced this version before it was recorded), IdentityConflict (the write would change a contact's identity, which writing again never fixes; see putRecord), DuplicatePhone (a contact write introduces a number another of the caller's active contacts carries; see putRecord), RateLimitExceeded (a contact write that binds a number to an account found the caller's phone lookups spent; retry it in a minute) or Forbidden (the call's `space:` scopes do not cover the write, or it replaces a record already written for an app's space under `space:` scopes that do not cover it; see putRecord).",
|
|
6762
6858
|
knownValues: [
|
|
6763
6859
|
'InvalidRequest',
|
|
6764
6860
|
'InvalidSwap',
|
|
@@ -11523,6 +11619,7 @@ export const ids = {
|
|
|
11523
11619
|
PubTechneDraftIdentityRevokeLinkToken: 'pub.techne.draft.identity.revokeLinkToken',
|
|
11524
11620
|
PubTechneDraftIdentityUnlinkAccount: 'pub.techne.draft.identity.unlinkAccount',
|
|
11525
11621
|
PubTechneDraftIdentityUnlinkMethod: 'pub.techne.draft.identity.unlinkMethod',
|
|
11622
|
+
PubTechneDraftIdentityWriteAsCollective: 'pub.techne.draft.identity.writeAsCollective',
|
|
11526
11623
|
PubTechneDraftInterest: 'pub.techne.draft.interest',
|
|
11527
11624
|
PubTechneDraftIntroProposal: 'pub.techne.draft.introProposal',
|
|
11528
11625
|
PubTechneDraftInvite: 'pub.techne.draft.invite',
|
package/dist/generated/nsid.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ export declare const NSID: {
|
|
|
133
133
|
readonly IDENTITY_REVOKE_LINK_TOKEN: "pub.techne.draft.identity.revokeLinkToken";
|
|
134
134
|
readonly IDENTITY_UNLINK_ACCOUNT: "pub.techne.draft.identity.unlinkAccount";
|
|
135
135
|
readonly IDENTITY_UNLINK_METHOD: "pub.techne.draft.identity.unlinkMethod";
|
|
136
|
+
readonly IDENTITY_WRITE_AS_COLLECTIVE: "pub.techne.draft.identity.writeAsCollective";
|
|
136
137
|
readonly INTEREST: "pub.techne.draft.interest";
|
|
137
138
|
readonly INTRO_PROPOSAL: "pub.techne.draft.introProposal";
|
|
138
139
|
readonly INTRO_PROPOSAL_PARTY_CONTEXT: "pub.techne.draft.introProposal#partyContext";
|
package/dist/generated/nsid.js
CHANGED
|
@@ -137,6 +137,7 @@ export const NSID = {
|
|
|
137
137
|
IDENTITY_REVOKE_LINK_TOKEN: 'pub.techne.draft.identity.revokeLinkToken',
|
|
138
138
|
IDENTITY_UNLINK_ACCOUNT: 'pub.techne.draft.identity.unlinkAccount',
|
|
139
139
|
IDENTITY_UNLINK_METHOD: 'pub.techne.draft.identity.unlinkMethod',
|
|
140
|
+
IDENTITY_WRITE_AS_COLLECTIVE: 'pub.techne.draft.identity.writeAsCollective',
|
|
140
141
|
INTEREST: 'pub.techne.draft.interest',
|
|
141
142
|
INTRO_PROPOSAL: 'pub.techne.draft.introProposal',
|
|
142
143
|
INTRO_PROPOSAL_PARTY_CONTEXT: 'pub.techne.draft.introProposal#partyContext',
|
package/dist/generated/nsid.json
CHANGED
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
"IDENTITY_REVOKE_LINK_TOKEN": "pub.techne.draft.identity.revokeLinkToken",
|
|
134
134
|
"IDENTITY_UNLINK_ACCOUNT": "pub.techne.draft.identity.unlinkAccount",
|
|
135
135
|
"IDENTITY_UNLINK_METHOD": "pub.techne.draft.identity.unlinkMethod",
|
|
136
|
+
"IDENTITY_WRITE_AS_COLLECTIVE": "pub.techne.draft.identity.writeAsCollective",
|
|
136
137
|
"INTEREST": "pub.techne.draft.interest",
|
|
137
138
|
"INTRO_PROPOSAL": "pub.techne.draft.introProposal",
|
|
138
139
|
"INTRO_PROPOSAL_PARTY_CONTEXT": "pub.techne.draft.introProposal#partyContext",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { HeadersMap, XRPCError } from '@atproto/xrpc';
|
|
5
|
+
import { type $Typed } from '../../../../../util.js';
|
|
6
|
+
import type * as ComAtprotoRepoApplyWrites from '../../../../com/atproto/repo/applyWrites.js';
|
|
7
|
+
import type * as ComAtprotoRepoDefs from '../../../../com/atproto/repo/defs.js';
|
|
8
|
+
export type QueryParams = {};
|
|
9
|
+
export interface InputSchema {
|
|
10
|
+
/** The collective's DID. Not the caller's own. */
|
|
11
|
+
repo: string;
|
|
12
|
+
/** As com.atproto.repo.applyWrites: passed to the collective's PDS. */
|
|
13
|
+
validate?: boolean;
|
|
14
|
+
writes: ($Typed<ComAtprotoRepoApplyWrites.Create> | $Typed<ComAtprotoRepoApplyWrites.Update> | $Typed<ComAtprotoRepoApplyWrites.Delete>)[];
|
|
15
|
+
/** As com.atproto.repo.applyWrites: the whole batch fails unless the collective's repo is at this commit. */
|
|
16
|
+
swapCommit?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface OutputSchema {
|
|
19
|
+
commit?: ComAtprotoRepoDefs.CommitMeta;
|
|
20
|
+
results?: ($Typed<ComAtprotoRepoApplyWrites.CreateResult> | $Typed<ComAtprotoRepoApplyWrites.UpdateResult> | $Typed<ComAtprotoRepoApplyWrites.DeleteResult>)[];
|
|
21
|
+
}
|
|
22
|
+
export interface CallOptions {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
headers?: HeadersMap;
|
|
25
|
+
qp?: QueryParams;
|
|
26
|
+
encoding?: 'application/json';
|
|
27
|
+
}
|
|
28
|
+
export interface Response {
|
|
29
|
+
success: boolean;
|
|
30
|
+
headers: HeadersMap;
|
|
31
|
+
data: OutputSchema;
|
|
32
|
+
}
|
|
33
|
+
export declare class InvalidRequestError extends XRPCError {
|
|
34
|
+
constructor(src: XRPCError);
|
|
35
|
+
}
|
|
36
|
+
export declare class ForbiddenError extends XRPCError {
|
|
37
|
+
constructor(src: XRPCError);
|
|
38
|
+
}
|
|
39
|
+
export declare class NotAuthorizedError extends XRPCError {
|
|
40
|
+
constructor(src: XRPCError);
|
|
41
|
+
}
|
|
42
|
+
export declare class LastManagerError extends XRPCError {
|
|
43
|
+
constructor(src: XRPCError);
|
|
44
|
+
}
|
|
45
|
+
export declare class PayloadTooLargeError extends XRPCError {
|
|
46
|
+
constructor(src: XRPCError);
|
|
47
|
+
}
|
|
48
|
+
export declare class RateLimitExceededError extends XRPCError {
|
|
49
|
+
constructor(src: XRPCError);
|
|
50
|
+
}
|
|
51
|
+
export declare function toKnownErr(e: any): any;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import { XRPCError } from '@atproto/xrpc';
|
|
5
|
+
import { validate as _validate } from '../../../../../lexicons.js';
|
|
6
|
+
import { is$typed as _is$typed, } from '../../../../../util.js';
|
|
7
|
+
const is$typed = _is$typed, validate = _validate;
|
|
8
|
+
const id = 'pub.techne.draft.identity.writeAsCollective';
|
|
9
|
+
export class InvalidRequestError extends XRPCError {
|
|
10
|
+
constructor(src) {
|
|
11
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class ForbiddenError extends XRPCError {
|
|
15
|
+
constructor(src) {
|
|
16
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class NotAuthorizedError extends XRPCError {
|
|
20
|
+
constructor(src) {
|
|
21
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class LastManagerError extends XRPCError {
|
|
25
|
+
constructor(src) {
|
|
26
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class PayloadTooLargeError extends XRPCError {
|
|
30
|
+
constructor(src) {
|
|
31
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class RateLimitExceededError extends XRPCError {
|
|
35
|
+
constructor(src) {
|
|
36
|
+
super(src.status, src.error, src.message, src.headers, { cause: src });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function toKnownErr(e) {
|
|
40
|
+
if (e instanceof XRPCError) {
|
|
41
|
+
if (e.error === 'InvalidRequest')
|
|
42
|
+
return new InvalidRequestError(e);
|
|
43
|
+
if (e.error === 'Forbidden')
|
|
44
|
+
return new ForbiddenError(e);
|
|
45
|
+
if (e.error === 'NotAuthorized')
|
|
46
|
+
return new NotAuthorizedError(e);
|
|
47
|
+
if (e.error === 'LastManager')
|
|
48
|
+
return new LastManagerError(e);
|
|
49
|
+
if (e.error === 'PayloadTooLarge')
|
|
50
|
+
return new PayloadTooLargeError(e);
|
|
51
|
+
if (e.error === 'RateLimitExceeded')
|
|
52
|
+
return new RateLimitExceededError(e);
|
|
53
|
+
}
|
|
54
|
+
return e;
|
|
55
|
+
}
|
|
@@ -26,7 +26,7 @@ export interface OutputSchema {
|
|
|
26
26
|
rev: string;
|
|
27
27
|
/** The DIDs the `share`s placed in the space the record counts in name (its authority left out), when the caller may read that space; empty otherwise. For a source space this is its whole audience beside the owner (as getGrants). */
|
|
28
28
|
read: string[];
|
|
29
|
-
/** The space the record counts in now. Absent when it counts in none (the space's write policy does not admit the writer
|
|
29
|
+
/** The space the record counts in now. Absent when it counts in none (the space's write policy does not admit the writer). */
|
|
30
30
|
space?: string;
|
|
31
31
|
}
|
|
32
32
|
export interface CallOptions {
|
|
@@ -79,7 +79,7 @@ export declare function validateWriteResult<V>(v: V): ValidationResult<WriteResu
|
|
|
79
79
|
/** A write refused, and nothing of it written: the error putRecord would have answered. */
|
|
80
80
|
export interface WriteError {
|
|
81
81
|
$type?: 'pub.techne.draft.permissioned.putRecords#writeError';
|
|
82
|
-
/** InvalidRequest (malformed, a body that fails its collection's published lexicon, or a record over 2 MiB, more than a putRecord body may be), InvalidSwap (swapCid did not match the current version), Conflict (the same key holds a public record in the caller's repo, or a concurrent write replaced this version before it was recorded), IdentityConflict (the write would change a contact's identity, which writing again never fixes; see putRecord), DuplicatePhone (a contact write introduces a number another of the caller's active contacts carries; see putRecord), RateLimitExceeded (a contact write that binds a number to an account found the caller's phone lookups spent; retry it in a minute) or Forbidden (the call's `space:` scopes do not cover the write, or it replaces a record already written for an app's space
|
|
82
|
+
/** InvalidRequest (malformed, a body that fails its collection's published lexicon, or a record over 2 MiB, more than a putRecord body may be), InvalidSwap (swapCid did not match the current version), Conflict (the same key holds a public record in the caller's repo, or a concurrent write replaced this version before it was recorded), IdentityConflict (the write would change a contact's identity, which writing again never fixes; see putRecord), DuplicatePhone (a contact write introduces a number another of the caller's active contacts carries; see putRecord), RateLimitExceeded (a contact write that binds a number to an account found the caller's phone lookups spent; retry it in a minute) or Forbidden (the call's `space:` scopes do not cover the write, or it replaces a record already written for an app's space under `space:` scopes that do not cover it; see putRecord). */
|
|
83
83
|
error: 'InvalidRequest' | 'InvalidSwap' | 'Conflict' | 'IdentityConflict' | 'DuplicatePhone' | 'RateLimitExceeded' | 'Forbidden' | (string & {});
|
|
84
84
|
message: string;
|
|
85
85
|
}
|