techne-sdk 0.0.0-stage → 0.2.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 +54 -0
- package/LICENSE +21 -0
- package/README.md +115 -2
- package/dist/auth/index.d.ts +151 -0
- package/dist/auth/index.js +167 -0
- package/dist/auth/placement.gen.d.ts +1 -0
- package/dist/auth/placement.gen.js +49 -0
- package/dist/catalog/catalog.gen.d.ts +841 -0
- package/dist/catalog/catalog.gen.js +29696 -0
- package/dist/catalog/index.d.ts +11 -0
- package/dist/catalog/index.js +11 -0
- package/dist/connect.d.ts +38 -0
- package/dist/connect.js +19 -0
- package/dist/generated/index.d.ts +2296 -0
- package/dist/generated/index.js +3320 -0
- package/dist/generated/lexicons.d.ts +17254 -0
- package/dist/generated/lexicons.js +9225 -0
- package/dist/generated/nsid.d.ts +529 -0
- package/dist/generated/nsid.js +1094 -0
- package/dist/generated/nsid.json +1082 -0
- package/dist/generated/records.d.ts +143 -0
- package/dist/generated/records.js +1 -0
- package/dist/generated/types/app/bsky/richtext/facet.d.ts +44 -0
- package/dist/generated/types/app/bsky/richtext/facet.js +39 -0
- package/dist/generated/types/com/atproto/admin/defs.d.ts +10 -0
- package/dist/generated/types/com/atproto/admin/defs.js +11 -0
- package/dist/generated/types/com/atproto/label/defs.d.ts +73 -0
- package/dist/generated/types/com/atproto/label/defs.js +39 -0
- package/dist/generated/types/com/atproto/moderation/createReport.d.ts +39 -0
- package/dist/generated/types/com/atproto/moderation/createReport.js +7 -0
- package/dist/generated/types/com/atproto/moderation/defs.d.ts +15 -0
- package/dist/generated/types/com/atproto/moderation/defs.js +18 -0
- package/dist/generated/types/com/atproto/repo/applyWrites.d.ts +88 -0
- package/dist/generated/types/com/atproto/repo/applyWrites.js +62 -0
- package/dist/generated/types/com/atproto/repo/createRecord.d.ts +43 -0
- package/dist/generated/types/com/atproto/repo/createRecord.js +20 -0
- package/dist/generated/types/com/atproto/repo/defs.d.ts +11 -0
- package/dist/generated/types/com/atproto/repo/defs.js +11 -0
- package/dist/generated/types/com/atproto/repo/deleteRecord.d.ts +36 -0
- package/dist/generated/types/com/atproto/repo/deleteRecord.js +20 -0
- package/dist/generated/types/com/atproto/repo/getRecord.d.ts +35 -0
- package/dist/generated/types/com/atproto/repo/getRecord.js +20 -0
- package/dist/generated/types/com/atproto/repo/listRecords.d.ts +41 -0
- package/dist/generated/types/com/atproto/repo/listRecords.js +14 -0
- package/dist/generated/types/com/atproto/repo/putRecord.d.ts +45 -0
- package/dist/generated/types/com/atproto/repo/putRecord.js +20 -0
- package/dist/generated/types/com/atproto/repo/strongRef.d.ts +11 -0
- package/dist/generated/types/com/atproto/repo/strongRef.js +11 -0
- package/dist/generated/types/com/atproto/server/getServiceAuth.d.ts +29 -0
- package/dist/generated/types/com/atproto/server/getServiceAuth.js +20 -0
- package/dist/generated/types/community/lexicon/calendar/event.d.ts +65 -0
- package/dist/generated/types/community/lexicon/calendar/event.js +35 -0
- package/dist/generated/types/community/lexicon/calendar/rsvp.d.ts +20 -0
- package/dist/generated/types/community/lexicon/calendar/rsvp.js +18 -0
- package/dist/generated/types/community/lexicon/location/address.d.ts +22 -0
- package/dist/generated/types/community/lexicon/location/address.js +11 -0
- package/dist/generated/types/community/lexicon/location/fsq.d.ts +16 -0
- package/dist/generated/types/community/lexicon/location/fsq.js +11 -0
- package/dist/generated/types/community/lexicon/location/geo.d.ts +15 -0
- package/dist/generated/types/community/lexicon/location/geo.js +11 -0
- package/dist/generated/types/community/lexicon/location/hthree.d.ts +14 -0
- package/dist/generated/types/community/lexicon/location/hthree.js +11 -0
- package/dist/generated/types/pub/techne/draft/accessRule.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/accessRule.js +33 -0
- package/dist/generated/types/pub/techne/draft/accountLink.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/accountLink.js +12 -0
- package/dist/generated/types/pub/techne/draft/actor/profile.d.ts +20 -0
- package/dist/generated/types/pub/techne/draft/actor/profile.js +12 -0
- package/dist/generated/types/pub/techne/draft/appAccess.d.ts +25 -0
- package/dist/generated/types/pub/techne/draft/appAccess.js +19 -0
- package/dist/generated/types/pub/techne/draft/appAccessRequest.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/appAccessRequest.js +12 -0
- package/dist/generated/types/pub/techne/draft/appConfig.d.ts +24 -0
- package/dist/generated/types/pub/techne/draft/appConfig.js +19 -0
- package/dist/generated/types/pub/techne/draft/approval.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/approval.js +12 -0
- package/dist/generated/types/pub/techne/draft/assessment.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/assessment.js +26 -0
- package/dist/generated/types/pub/techne/draft/attentionPrefs.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/attentionPrefs.js +12 -0
- package/dist/generated/types/pub/techne/draft/beacon.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/beacon.js +12 -0
- package/dist/generated/types/pub/techne/draft/beaconLists.d.ts +13 -0
- package/dist/generated/types/pub/techne/draft/beaconLists.js +12 -0
- package/dist/generated/types/pub/techne/draft/beaconSpot.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/beaconSpot.js +12 -0
- package/dist/generated/types/pub/techne/draft/block.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/block.js +12 -0
- package/dist/generated/types/pub/techne/draft/channelVerification.d.ts +15 -0
- package/dist/generated/types/pub/techne/draft/channelVerification.js +12 -0
- package/dist/generated/types/pub/techne/draft/circleBeacon.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/circleBeacon.js +12 -0
- package/dist/generated/types/pub/techne/draft/collective.d.ts +29 -0
- package/dist/generated/types/pub/techne/draft/collective.js +12 -0
- package/dist/generated/types/pub/techne/draft/commons/createServiceAccount.d.ts +47 -0
- package/dist/generated/types/pub/techne/draft/commons/createServiceAccount.js +55 -0
- package/dist/generated/types/pub/techne/draft/commons/getVersions.d.ts +78 -0
- package/dist/generated/types/pub/techne/draft/commons/getVersions.js +41 -0
- package/dist/generated/types/pub/techne/draft/commons/moveAccountHandle.d.ts +45 -0
- package/dist/generated/types/pub/techne/draft/commons/moveAccountHandle.js +48 -0
- package/dist/generated/types/pub/techne/draft/commons/runChain.d.ts +53 -0
- package/dist/generated/types/pub/techne/draft/commons/runChain.js +34 -0
- package/dist/generated/types/pub/techne/draft/connection.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/connection.js +12 -0
- package/dist/generated/types/pub/techne/draft/contact.d.ts +20 -0
- package/dist/generated/types/pub/techne/draft/contact.js +12 -0
- package/dist/generated/types/pub/techne/draft/contactChannel.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/contactChannel.js +12 -0
- package/dist/generated/types/pub/techne/draft/contactList.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/contactList.js +12 -0
- package/dist/generated/types/pub/techne/draft/containedIn.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/containedIn.js +12 -0
- package/dist/generated/types/pub/techne/draft/credential.d.ts +39 -0
- package/dist/generated/types/pub/techne/draft/credential.js +19 -0
- package/dist/generated/types/pub/techne/draft/credentialRevocation.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/credentialRevocation.js +12 -0
- package/dist/generated/types/pub/techne/draft/derivation.d.ts +50 -0
- package/dist/generated/types/pub/techne/draft/derivation.js +26 -0
- package/dist/generated/types/pub/techne/draft/description.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/description.js +12 -0
- package/dist/generated/types/pub/techne/draft/distinctFrom.d.ts +15 -0
- package/dist/generated/types/pub/techne/draft/distinctFrom.js +12 -0
- package/dist/generated/types/pub/techne/draft/evaluation.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/evaluation.js +12 -0
- package/dist/generated/types/pub/techne/draft/event/config.d.ts +22 -0
- package/dist/generated/types/pub/techne/draft/event/config.js +12 -0
- package/dist/generated/types/pub/techne/draft/event/detail.d.ts +25 -0
- package/dist/generated/types/pub/techne/draft/event/detail.js +12 -0
- package/dist/generated/types/pub/techne/draft/event/listing.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/event/listing.js +12 -0
- package/dist/generated/types/pub/techne/draft/feed/recipe.d.ts +50 -0
- package/dist/generated/types/pub/techne/draft/feed/recipe.js +26 -0
- package/dist/generated/types/pub/techne/draft/geo.d.ts +19 -0
- package/dist/generated/types/pub/techne/draft/geo.js +12 -0
- package/dist/generated/types/pub/techne/draft/heldAt.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/heldAt.js +12 -0
- package/dist/generated/types/pub/techne/draft/identity/accountsForPhones.d.ts +43 -0
- package/dist/generated/types/pub/techne/draft/identity/accountsForPhones.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/attest.d.ts +48 -0
- package/dist/generated/types/pub/techne/draft/identity/attest.js +48 -0
- package/dist/generated/types/pub/techne/draft/identity/beginAddMethod.d.ts +35 -0
- package/dist/generated/types/pub/techne/draft/identity/beginAddMethod.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/checkLinkToken.d.ts +41 -0
- package/dist/generated/types/pub/techne/draft/identity/checkLinkToken.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/createCollective.d.ts +28 -0
- package/dist/generated/types/pub/techne/draft/identity/createCollective.js +20 -0
- package/dist/generated/types/pub/techne/draft/identity/createLinkToken.d.ts +47 -0
- package/dist/generated/types/pub/techne/draft/identity/createLinkToken.js +48 -0
- package/dist/generated/types/pub/techne/draft/identity/defs.d.ts +75 -0
- package/dist/generated/types/pub/techne/draft/identity/defs.js +53 -0
- package/dist/generated/types/pub/techne/draft/identity/finishAddMethod.d.ts +46 -0
- package/dist/generated/types/pub/techne/draft/identity/finishAddMethod.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/fold.d.ts +37 -0
- package/dist/generated/types/pub/techne/draft/identity/fold.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/holdForPhone.d.ts +54 -0
- package/dist/generated/types/pub/techne/draft/identity/holdForPhone.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/link.d.ts +35 -0
- package/dist/generated/types/pub/techne/draft/identity/link.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/linkRedeemed.d.ts +46 -0
- package/dist/generated/types/pub/techne/draft/identity/linkRedeemed.js +48 -0
- package/dist/generated/types/pub/techne/draft/identity/linkRedemption.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/identity/linkRedemption.js +12 -0
- package/dist/generated/types/pub/techne/draft/identity/listLinkRedemptions.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/identity/listLinkRedemptions.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/listLinkTokens.d.ts +39 -0
- package/dist/generated/types/pub/techne/draft/identity/listLinkTokens.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/listMethods.d.ts +24 -0
- package/dist/generated/types/pub/techne/draft/identity/listMethods.js +20 -0
- package/dist/generated/types/pub/techne/draft/identity/listPhoneHolds.d.ts +49 -0
- package/dist/generated/types/pub/techne/draft/identity/listPhoneHolds.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/redeemLinkToken.d.ts +47 -0
- package/dist/generated/types/pub/techne/draft/identity/redeemLinkToken.js +55 -0
- package/dist/generated/types/pub/techne/draft/identity/releasePhoneHold.d.ts +32 -0
- package/dist/generated/types/pub/techne/draft/identity/releasePhoneHold.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/resetLinkToken.d.ts +45 -0
- package/dist/generated/types/pub/techne/draft/identity/resetLinkToken.js +48 -0
- package/dist/generated/types/pub/techne/draft/identity/resolve.d.ts +39 -0
- package/dist/generated/types/pub/techne/draft/identity/resolve.js +34 -0
- package/dist/generated/types/pub/techne/draft/identity/revokeLinkToken.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/identity/revokeLinkToken.js +41 -0
- package/dist/generated/types/pub/techne/draft/identity/unlinkAccount.d.ts +29 -0
- package/dist/generated/types/pub/techne/draft/identity/unlinkAccount.js +27 -0
- package/dist/generated/types/pub/techne/draft/identity/unlinkMethod.d.ts +32 -0
- package/dist/generated/types/pub/techne/draft/identity/unlinkMethod.js +34 -0
- package/dist/generated/types/pub/techne/draft/interest.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/interest.js +12 -0
- package/dist/generated/types/pub/techne/draft/introProposal.d.ts +28 -0
- package/dist/generated/types/pub/techne/draft/introProposal.js +19 -0
- package/dist/generated/types/pub/techne/draft/invite.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/invite.js +12 -0
- package/dist/generated/types/pub/techne/draft/market/ask.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/market/ask.js +12 -0
- package/dist/generated/types/pub/techne/draft/market/offer.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/market/offer.js +12 -0
- package/dist/generated/types/pub/techne/draft/membership.d.ts +22 -0
- package/dist/generated/types/pub/techne/draft/membership.js +12 -0
- package/dist/generated/types/pub/techne/draft/notificationState.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/notificationState.js +12 -0
- package/dist/generated/types/pub/techne/draft/operator.d.ts +20 -0
- package/dist/generated/types/pub/techne/draft/operator.js +12 -0
- package/dist/generated/types/pub/techne/draft/org.d.ts +42 -0
- package/dist/generated/types/pub/techne/draft/org.js +19 -0
- package/dist/generated/types/pub/techne/draft/passage.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/passage.js +12 -0
- package/dist/generated/types/pub/techne/draft/pendingBeaconSpot.d.ts +19 -0
- package/dist/generated/types/pub/techne/draft/pendingBeaconSpot.js +12 -0
- package/dist/generated/types/pub/techne/draft/permissioned/deleteRecord.d.ts +47 -0
- package/dist/generated/types/pub/techne/draft/permissioned/deleteRecord.js +55 -0
- package/dist/generated/types/pub/techne/draft/permissioned/getGrants.d.ts +32 -0
- package/dist/generated/types/pub/techne/draft/permissioned/getGrants.js +34 -0
- package/dist/generated/types/pub/techne/draft/permissioned/getRecord.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/permissioned/getRecord.js +34 -0
- package/dist/generated/types/pub/techne/draft/permissioned/listChanges.d.ts +71 -0
- package/dist/generated/types/pub/techne/draft/permissioned/listChanges.js +41 -0
- package/dist/generated/types/pub/techne/draft/permissioned/listRecords.d.ts +53 -0
- package/dist/generated/types/pub/techne/draft/permissioned/listRecords.js +34 -0
- package/dist/generated/types/pub/techne/draft/permissioned/putRecord.d.ts +70 -0
- package/dist/generated/types/pub/techne/draft/permissioned/putRecord.js +76 -0
- package/dist/generated/types/pub/techne/draft/permissioned/putRecords.d.ts +84 -0
- package/dist/generated/types/pub/techne/draft/permissioned/putRecords.js +69 -0
- package/dist/generated/types/pub/techne/draft/place.d.ts +36 -0
- package/dist/generated/types/pub/techne/draft/place.js +19 -0
- package/dist/generated/types/pub/techne/draft/post.d.ts +30 -0
- package/dist/generated/types/pub/techne/draft/post.js +19 -0
- package/dist/generated/types/pub/techne/draft/presence.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/presence.js +12 -0
- package/dist/generated/types/pub/techne/draft/profile.d.ts +53 -0
- package/dist/generated/types/pub/techne/draft/profile.js +33 -0
- package/dist/generated/types/pub/techne/draft/provenance.d.ts +52 -0
- package/dist/generated/types/pub/techne/draft/provenance.js +33 -0
- package/dist/generated/types/pub/techne/draft/publisher.d.ts +43 -0
- package/dist/generated/types/pub/techne/draft/publisher.js +19 -0
- package/dist/generated/types/pub/techne/draft/query/countRecords.d.ts +47 -0
- package/dist/generated/types/pub/techne/draft/query/countRecords.js +34 -0
- package/dist/generated/types/pub/techne/draft/query/getRecords.d.ts +86 -0
- package/dist/generated/types/pub/techne/draft/query/getRecords.js +48 -0
- package/dist/generated/types/pub/techne/draft/query/listRecords.d.ts +83 -0
- package/dist/generated/types/pub/techne/draft/query/listRecords.js +34 -0
- package/dist/generated/types/pub/techne/draft/query/listRejections.d.ts +50 -0
- package/dist/generated/types/pub/techne/draft/query/listRejections.js +27 -0
- package/dist/generated/types/pub/techne/draft/questionSet.d.ts +31 -0
- package/dist/generated/types/pub/techne/draft/questionSet.js +19 -0
- package/dist/generated/types/pub/techne/draft/receipt.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/receipt.js +12 -0
- package/dist/generated/types/pub/techne/draft/reflection.d.ts +20 -0
- package/dist/generated/types/pub/techne/draft/reflection.js +12 -0
- package/dist/generated/types/pub/techne/draft/retirement.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/retirement.js +12 -0
- package/dist/generated/types/pub/techne/draft/rsvpNote.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/rsvpNote.js +12 -0
- package/dist/generated/types/pub/techne/draft/sameAs.d.ts +15 -0
- package/dist/generated/types/pub/techne/draft/sameAs.js +12 -0
- package/dist/generated/types/pub/techne/draft/scraper/cursor.d.ts +17 -0
- package/dist/generated/types/pub/techne/draft/scraper/cursor.js +12 -0
- package/dist/generated/types/pub/techne/draft/scraper/raw.d.ts +31 -0
- package/dist/generated/types/pub/techne/draft/scraper/raw.js +12 -0
- package/dist/generated/types/pub/techne/draft/share.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/share.js +12 -0
- package/dist/generated/types/pub/techne/draft/source.d.ts +23 -0
- package/dist/generated/types/pub/techne/draft/source.js +12 -0
- package/dist/generated/types/pub/techne/draft/sourceAttribution.d.ts +25 -0
- package/dist/generated/types/pub/techne/draft/sourceAttribution.js +12 -0
- package/dist/generated/types/pub/techne/draft/sourceRef.d.ts +23 -0
- package/dist/generated/types/pub/techne/draft/sourceRef.js +12 -0
- package/dist/generated/types/pub/techne/draft/subjectPrefs.d.ts +18 -0
- package/dist/generated/types/pub/techne/draft/subjectPrefs.js +12 -0
- package/dist/generated/types/pub/techne/draft/sync/indexRecord.d.ts +48 -0
- package/dist/generated/types/pub/techne/draft/sync/indexRecord.js +55 -0
- package/dist/generated/types/pub/techne/draft/verdict.d.ts +16 -0
- package/dist/generated/types/pub/techne/draft/verdict.js +12 -0
- package/dist/generated/types/pub/techne/draft/verification.d.ts +14 -0
- package/dist/generated/types/pub/techne/draft/verification.js +12 -0
- package/dist/generated/types/pub/techne/draft/weeklyCheckIn.d.ts +21 -0
- package/dist/generated/types/pub/techne/draft/weeklyCheckIn.js +12 -0
- package/dist/generated/types/social/scenius/approveAppAccess.d.ts +36 -0
- package/dist/generated/types/social/scenius/approveAppAccess.js +27 -0
- package/dist/generated/types/social/scenius/createCirclePost.d.ts +39 -0
- package/dist/generated/types/social/scenius/createCirclePost.js +41 -0
- package/dist/generated/types/social/scenius/createContactInvite.d.ts +41 -0
- package/dist/generated/types/social/scenius/createContactInvite.js +34 -0
- package/dist/generated/types/social/scenius/deleteCirclePost.d.ts +34 -0
- package/dist/generated/types/social/scenius/deleteCirclePost.js +34 -0
- package/dist/generated/types/social/scenius/deleteCircleProfile.d.ts +33 -0
- package/dist/generated/types/social/scenius/deleteCircleProfile.js +34 -0
- package/dist/generated/types/social/scenius/getAppAccess.d.ts +30 -0
- package/dist/generated/types/social/scenius/getAppAccess.js +27 -0
- package/dist/generated/types/social/scenius/getAppConfig.d.ts +26 -0
- package/dist/generated/types/social/scenius/getAppConfig.js +7 -0
- package/dist/generated/types/social/scenius/getCircleThread.d.ts +48 -0
- package/dist/generated/types/social/scenius/getCircleThread.js +41 -0
- package/dist/generated/types/social/scenius/getContactInvite.d.ts +37 -0
- package/dist/generated/types/social/scenius/getContactInvite.js +27 -0
- package/dist/generated/types/social/scenius/listAppAccess.d.ts +35 -0
- package/dist/generated/types/social/scenius/listAppAccess.js +27 -0
- package/dist/generated/types/social/scenius/listCirclePosts.d.ts +47 -0
- package/dist/generated/types/social/scenius/listCirclePosts.js +34 -0
- package/dist/generated/types/social/scenius/listCircleProfiles.d.ts +50 -0
- package/dist/generated/types/social/scenius/listCircleProfiles.js +41 -0
- package/dist/generated/types/social/scenius/previewContactInvite.d.ts +37 -0
- package/dist/generated/types/social/scenius/previewContactInvite.js +34 -0
- package/dist/generated/types/social/scenius/putCircleProfile.d.ts +39 -0
- package/dist/generated/types/social/scenius/putCircleProfile.js +41 -0
- package/dist/generated/types/social/scenius/redeemContactInvite.d.ts +43 -0
- package/dist/generated/types/social/scenius/redeemContactInvite.js +48 -0
- package/dist/generated/types/social/scenius/revokeContactInvite.d.ts +33 -0
- package/dist/generated/types/social/scenius/revokeContactInvite.js +20 -0
- package/dist/generated/util.d.ts +36 -0
- package/dist/generated/util.js +32 -0
- package/dist/links/index.d.ts +65 -0
- package/dist/links/index.js +119 -0
- package/dist/platform.d.ts +14 -0
- package/dist/platform.js +16 -0
- package/dist/put/contacts.d.ts +29 -0
- package/dist/put/contacts.js +109 -0
- package/dist/put/index.d.ts +148 -0
- package/dist/put/index.js +252 -0
- package/dist/query/hosts.d.ts +77 -0
- package/dist/query/hosts.js +227 -0
- package/dist/query/index.d.ts +201 -0
- package/dist/query/index.js +167 -0
- package/dist/versions/index.d.ts +121 -0
- package/dist/versions/index.js +90 -0
- package/dist/versions/react.d.ts +53 -0
- package/dist/versions/react.js +81 -0
- package/dist/wasm/index.d.ts +85 -0
- package/dist/wasm/index.js +51 -0
- package/dist/wasm/load.d.ts +2 -0
- package/dist/wasm/load.js +16 -0
- package/dist/wasm/load.native.d.ts +11 -0
- package/dist/wasm/load.native.js +3 -0
- package/dist/wasm/techne-wasm.gen.d.ts +2 -0
- package/dist/wasm/techne-wasm.gen.js +3 -0
- package/dist/wasm/techne-wasm2js.gen.d.ts +6 -0
- package/dist/wasm/techne-wasm2js.gen.js +90467 -0
- package/package.json +136 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* techne-sdk/versions — one commons event or place as its versions (§24 versions and trust).
|
|
3
|
+
*
|
|
4
|
+
* The commons keeps every source's copy of a thing whole (a version) and a curator publishes one
|
|
5
|
+
* default composition of them, field by field: the best-ranked version that sets a field gives it
|
|
6
|
+
* (rank 1 a source the commons root endorses, 2 a verified account or a member of an endorsed
|
|
7
|
+
* collective, 3 everyone else), ties to the newest edit. `pub.techne.draft.commons.getVersions`
|
|
8
|
+
* answers the composition (the curated record), how it was composed (byline, ranks, each field's source
|
|
9
|
+
* and conflicts) and each version with its verdict and verification records.
|
|
10
|
+
*
|
|
11
|
+
* This module turns that answer into what a screen shows: each field's value, which version it is
|
|
12
|
+
* from and how many ranked versions disagree on it (`conflicts`, only when 2 or more: a rank 3 version
|
|
13
|
+
* never raises one), the byline, and the versions grouped Sources / Verified / Others with the fields
|
|
14
|
+
* where each differs from what is shown. A person may pick another version (`pick`): the fields then
|
|
15
|
+
* show that version's own values. No view layer here: `useEvent` (`techne-sdk/react`) holds
|
|
16
|
+
* the pick, and an app draws its own pill and conflict badge from `versionPill` and `fieldConflict`.
|
|
17
|
+
*
|
|
18
|
+
* The ranking and comparison (`eventState`, `comparable`) are not written here: they are the Rust the
|
|
19
|
+
* curator composes with (`crates/techne-sdk`), run as WebAssembly (`techne-sdk/wasm`), so the screen
|
|
20
|
+
* and the curator cannot disagree. What is here is presentation over that state.
|
|
21
|
+
*/
|
|
22
|
+
import { type Claims, type Verification } from '../wasm/index.js';
|
|
23
|
+
import type { OutputSchema as GetVersionsOutput, Version } from '../generated/types/pub/techne/draft/commons/getVersions.js';
|
|
24
|
+
export type { GetVersionsOutput, Version };
|
|
25
|
+
export type { Claims, Verification };
|
|
26
|
+
/** The method this module reads. */
|
|
27
|
+
export declare const GET_VERSIONS: "pub.techne.draft.commons.getVersions";
|
|
28
|
+
/** How a version is ranked in the composition. */
|
|
29
|
+
export type VersionGroup = 'sources' | 'verified' | 'others';
|
|
30
|
+
/** Who a value or the byline is from. */
|
|
31
|
+
export interface VersionRef {
|
|
32
|
+
uri: string;
|
|
33
|
+
did: string;
|
|
34
|
+
/** Who to show it as (a mirror's source credit, a person's display name). */
|
|
35
|
+
name?: string;
|
|
36
|
+
handle?: string;
|
|
37
|
+
rank?: number;
|
|
38
|
+
mirror: boolean;
|
|
39
|
+
/** A verification record by an issuer the root endorses is about its author. */
|
|
40
|
+
verified: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** One field as shown: its value, the version it is from, and the ranked versions' conflict count. */
|
|
43
|
+
export interface FieldState {
|
|
44
|
+
value: unknown;
|
|
45
|
+
from?: VersionRef;
|
|
46
|
+
/** Distinct values among the ranked versions, when 2 or more (the field-conflict badge's count). */
|
|
47
|
+
conflicts?: number;
|
|
48
|
+
}
|
|
49
|
+
/** One version as the versions sheet lists it. */
|
|
50
|
+
export interface VersionEntry extends VersionRef {
|
|
51
|
+
group: VersionGroup;
|
|
52
|
+
record: Record<string, unknown>;
|
|
53
|
+
indexedAt?: string;
|
|
54
|
+
/** The version being shown (the byline of the composition, or the one picked). */
|
|
55
|
+
showing: boolean;
|
|
56
|
+
/** Fields this version sets to something other than what is shown, in field-name order. */
|
|
57
|
+
differs: string[];
|
|
58
|
+
/** Fields this version sets to what is shown, in field-name order. */
|
|
59
|
+
same: string[];
|
|
60
|
+
}
|
|
61
|
+
/** What a screen draws. */
|
|
62
|
+
export interface EventState {
|
|
63
|
+
uri: string;
|
|
64
|
+
/** Every field shown (the composition, or the picked version), without `$type` and `createdAt`. */
|
|
65
|
+
fields: Record<string, FieldState>;
|
|
66
|
+
/** Whose version speaks first: the composition's byline, or the version picked. */
|
|
67
|
+
byline?: VersionRef;
|
|
68
|
+
versions: VersionEntry[];
|
|
69
|
+
/** The version picked, or `null` for the default composition. */
|
|
70
|
+
picked: string | null;
|
|
71
|
+
/** Versions the server left out for a verdict (spam, obscene). */
|
|
72
|
+
leftOut: number;
|
|
73
|
+
}
|
|
74
|
+
/** A value as compared, as a string two values share exactly when they say the same thing: strings
|
|
75
|
+
* trimmed, a datetime as its instant, an event's places by what they say (never by which copy of a
|
|
76
|
+
* place they point at), recursively. The one definition is Rust's (`techne_sdk::versions::shown_as`). */
|
|
77
|
+
export declare function comparable(field: string, value: unknown): string;
|
|
78
|
+
/** The state of `data` with `picked` (a version's URI) shown, or the default composition. Computed by
|
|
79
|
+
* `crates/techne-sdk` (`versions::event_state`), the rules curator's own ranking, as WebAssembly. */
|
|
80
|
+
export declare function eventState(data: GetVersionsOutput, picked?: string | null): EventState;
|
|
81
|
+
/** What an app can check itself about one answer (P13.5): the record shown and each version. */
|
|
82
|
+
export interface AnswerVerification {
|
|
83
|
+
/** The record answered (the curated record, or the record itself). */
|
|
84
|
+
record: Verification;
|
|
85
|
+
/** Each version, by its URI. */
|
|
86
|
+
versions: Record<string, Verification>;
|
|
87
|
+
}
|
|
88
|
+
/** Run the pure check on every record of a `getVersions` answer, offline, over what the app holds
|
|
89
|
+
* (`claims`: the root, and the credentials and declarations it has read). Optional: the platform has
|
|
90
|
+
* already filtered the answer; this lets an app show "verified" from its own check. */
|
|
91
|
+
export declare function verifyAnswer(data: GetVersionsOutput, claims: Claims): AnswerVerification;
|
|
92
|
+
/** The name a version is shown by. */
|
|
93
|
+
export declare function versionName(v: Pick<VersionRef, 'name' | 'handle'>): string;
|
|
94
|
+
/** The version pill: the byline, and how many sources there are when more than one ("from the
|
|
95
|
+
* Backstreet Museum calendar · 2 sources"). A source is a version the versions sheet lists under
|
|
96
|
+
* Sources (rank 1), so the pill and the sheet count the same versions; verified accounts and others are
|
|
97
|
+
* not sources. With one source or none it is the byline alone. */
|
|
98
|
+
export declare function versionPill(state: EventState): {
|
|
99
|
+
label: string;
|
|
100
|
+
count: number;
|
|
101
|
+
accessibilityLabel: string;
|
|
102
|
+
} | null;
|
|
103
|
+
/** The field-conflict badge on one field: the count of distinct values among the ranked versions, only
|
|
104
|
+
* when 2 or more. */
|
|
105
|
+
export declare function fieldConflict(state: EventState, field: string | readonly string[]): {
|
|
106
|
+
count: number;
|
|
107
|
+
accessibilityLabel: string;
|
|
108
|
+
} | null;
|
|
109
|
+
/** One row of the versions sheet: a version, or several that agree with what is shown collapsed into one
|
|
110
|
+
* ("Backstreet Museum calendar + 2 sources agree"). */
|
|
111
|
+
export interface VersionRow {
|
|
112
|
+
lead: VersionEntry;
|
|
113
|
+
/** Versions that agree with what is shown, collapsed under `lead`. */
|
|
114
|
+
agreeing: VersionEntry[];
|
|
115
|
+
}
|
|
116
|
+
/** The versions sheet: groups Sources / Verified / Others, in that order, each row a version; versions
|
|
117
|
+
* that set nothing other than what is shown collapse into the showing (or first) row of their group. */
|
|
118
|
+
export declare function versionGroups(state: EventState): {
|
|
119
|
+
group: VersionGroup;
|
|
120
|
+
rows: VersionRow[];
|
|
121
|
+
}[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* techne-sdk/versions — one commons event or place as its versions (§24 versions and trust).
|
|
3
|
+
*
|
|
4
|
+
* The commons keeps every source's copy of a thing whole (a version) and a curator publishes one
|
|
5
|
+
* default composition of them, field by field: the best-ranked version that sets a field gives it
|
|
6
|
+
* (rank 1 a source the commons root endorses, 2 a verified account or a member of an endorsed
|
|
7
|
+
* collective, 3 everyone else), ties to the newest edit. `pub.techne.draft.commons.getVersions`
|
|
8
|
+
* answers the composition (the curated record), how it was composed (byline, ranks, each field's source
|
|
9
|
+
* and conflicts) and each version with its verdict and verification records.
|
|
10
|
+
*
|
|
11
|
+
* This module turns that answer into what a screen shows: each field's value, which version it is
|
|
12
|
+
* from and how many ranked versions disagree on it (`conflicts`, only when 2 or more: a rank 3 version
|
|
13
|
+
* never raises one), the byline, and the versions grouped Sources / Verified / Others with the fields
|
|
14
|
+
* where each differs from what is shown. A person may pick another version (`pick`): the fields then
|
|
15
|
+
* show that version's own values. No view layer here: `useEvent` (`techne-sdk/react`) holds
|
|
16
|
+
* the pick, and an app draws its own pill and conflict badge from `versionPill` and `fieldConflict`.
|
|
17
|
+
*
|
|
18
|
+
* The ranking and comparison (`eventState`, `comparable`) are not written here: they are the Rust the
|
|
19
|
+
* curator composes with (`crates/techne-sdk`), run as WebAssembly (`techne-sdk/wasm`), so the screen
|
|
20
|
+
* and the curator cannot disagree. What is here is presentation over that state.
|
|
21
|
+
*/
|
|
22
|
+
import { NSID } from '../generated/nsid.js';
|
|
23
|
+
import { call, verify } from '../wasm/index.js';
|
|
24
|
+
/** The method this module reads. */
|
|
25
|
+
export const GET_VERSIONS = NSID.COMMONS_GET_VERSIONS;
|
|
26
|
+
/** A value as compared, as a string two values share exactly when they say the same thing: strings
|
|
27
|
+
* trimmed, a datetime as its instant, an event's places by what they say (never by which copy of a
|
|
28
|
+
* place they point at), recursively. The one definition is Rust's (`techne_sdk::versions::shown_as`). */
|
|
29
|
+
export function comparable(field, value) {
|
|
30
|
+
return JSON.stringify(call('comparable', { field, value }));
|
|
31
|
+
}
|
|
32
|
+
/** The state of `data` with `picked` (a version's URI) shown, or the default composition. Computed by
|
|
33
|
+
* `crates/techne-sdk` (`versions::event_state`), the rules curator's own ranking, as WebAssembly. */
|
|
34
|
+
export function eventState(data, picked = null) {
|
|
35
|
+
return call('eventState', { data, picked });
|
|
36
|
+
}
|
|
37
|
+
/** Run the pure check on every record of a `getVersions` answer, offline, over what the app holds
|
|
38
|
+
* (`claims`: the root, and the credentials and declarations it has read). Optional: the platform has
|
|
39
|
+
* already filtered the answer; this lets an app show "verified" from its own check. */
|
|
40
|
+
export function verifyAnswer(data, claims) {
|
|
41
|
+
const versions = (data.versions ?? []).map((v) => [v.uri, verify({ uri: v.uri, cid: v.cid, value: v.record }, claims)]);
|
|
42
|
+
return { record: verify({ uri: data.uri, cid: data.cid, value: data.record }, claims), versions: Object.fromEntries(versions) };
|
|
43
|
+
}
|
|
44
|
+
/** The name a version is shown by. */
|
|
45
|
+
export function versionName(v) {
|
|
46
|
+
return v.name?.trim() || v.handle?.trim() || 'Someone';
|
|
47
|
+
}
|
|
48
|
+
/** The version pill: the byline, and how many sources there are when more than one ("from the
|
|
49
|
+
* Backstreet Museum calendar · 2 sources"). A source is a version the versions sheet lists under
|
|
50
|
+
* Sources (rank 1), so the pill and the sheet count the same versions; verified accounts and others are
|
|
51
|
+
* not sources. With one source or none it is the byline alone. */
|
|
52
|
+
export function versionPill(state) {
|
|
53
|
+
if (!state.byline)
|
|
54
|
+
return null;
|
|
55
|
+
const count = state.versions.filter((v) => v.group === 'sources').length;
|
|
56
|
+
const from = `from ${versionName(state.byline)}`;
|
|
57
|
+
const label = count > 1 ? `${from} · ${count} sources` : from;
|
|
58
|
+
const accessibilityLabel = count > 1 ? `${from}, ${count} sources. Shows the versions.` : `${from}. Shows where this is from.`;
|
|
59
|
+
return { label, count, accessibilityLabel };
|
|
60
|
+
}
|
|
61
|
+
/** The field-conflict badge on one field: the count of distinct values among the ranked versions, only
|
|
62
|
+
* when 2 or more. */
|
|
63
|
+
export function fieldConflict(state, field) {
|
|
64
|
+
const names = typeof field === 'string' ? [field] : field;
|
|
65
|
+
const count = Math.max(0, ...names.map((f) => state.fields[f]?.conflicts ?? 0));
|
|
66
|
+
if (count < 2)
|
|
67
|
+
return null;
|
|
68
|
+
return { count, accessibilityLabel: `${count} sources differ. Shows the versions.` };
|
|
69
|
+
}
|
|
70
|
+
/** The versions sheet: groups Sources / Verified / Others, in that order, each row a version; versions
|
|
71
|
+
* that set nothing other than what is shown collapse into the showing (or first) row of their group. */
|
|
72
|
+
export function versionGroups(state) {
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const group of ['sources', 'verified', 'others']) {
|
|
75
|
+
const members = state.versions.filter((v) => v.group === group);
|
|
76
|
+
if (!members.length)
|
|
77
|
+
continue;
|
|
78
|
+
const agree = members.filter((v) => v.differs.length === 0);
|
|
79
|
+
const rows = [];
|
|
80
|
+
if (agree.length) {
|
|
81
|
+
const lead = agree.find((v) => v.showing) ?? agree[0];
|
|
82
|
+
rows.push({ lead, agreeing: agree.filter((v) => v !== lead) });
|
|
83
|
+
}
|
|
84
|
+
for (const v of members)
|
|
85
|
+
if (v.differs.length > 0)
|
|
86
|
+
rows.push({ lead: v, agreeing: [] });
|
|
87
|
+
out.push({ group, rows });
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* techne-sdk/react — `useEvent(uri)` (§24 VT7): one commons event or place as its versions,
|
|
3
|
+
* with the default composition shown and a person's pick of another version.
|
|
4
|
+
*
|
|
5
|
+
* `useEvent(uri, { load })` reads `pub.techne.draft.commons.getVersions` through the caller's own
|
|
6
|
+
* client (`load`), or takes the answer the app already holds (`{ data }`: an app with its own cache,
|
|
7
|
+
* like Beacon's TanStack Query, passes it in and the hook only keeps the pick; `data: undefined` is
|
|
8
|
+
* still loading, `null` is nothing to show and not loading (no read, or the caller's read failed), and
|
|
9
|
+
* the caller owns the read's errors, so `error` stays `null`). It returns
|
|
10
|
+
* `{ fields: {value, from, conflicts}, byline, versions, pick, picked }` plus `versionPill` /
|
|
11
|
+
* `fieldConflict` props for an app's own pill and field-conflict badge, on the same state.
|
|
12
|
+
*
|
|
13
|
+
* With `{ claims }` (the commons root and the credential, revocation and `publisher/self` records the
|
|
14
|
+
* app has read), it also runs the pure check on every record of the answer (P13.5) and returns
|
|
15
|
+
* `verification`: per record `{ valid, signer, chainVerified, problems }`, so an app can show "verified".
|
|
16
|
+
* Optional; the platform already filtered what it answered.
|
|
17
|
+
*
|
|
18
|
+
* `reload()` reads it again (with `load`): call it when the app's change stream nudges, and a record
|
|
19
|
+
* `put` answered pending flips to its curated version once the platform has it (`getVersions` of a
|
|
20
|
+
* source answers the curated record that lists it).
|
|
21
|
+
*
|
|
22
|
+
* The state and the verification are computed by the SDK's WebAssembly during render; if it cannot be
|
|
23
|
+
* instantiated (a web page whose CSP lacks `wasm-unsafe-eval`), the hook throws to the nearest error
|
|
24
|
+
* boundary.
|
|
25
|
+
*/
|
|
26
|
+
import { fieldConflict, versionPill, type AnswerVerification, type Claims, type EventState, type GetVersionsOutput } from './index.js';
|
|
27
|
+
export interface UseEventOptions {
|
|
28
|
+
/** Read the versions of `uri` (the app's own XRPC client). */
|
|
29
|
+
load?: (uri: string) => Promise<GetVersionsOutput>;
|
|
30
|
+
/** The answer, when the app already holds it (then nothing is read here; `undefined` while it loads,
|
|
31
|
+
* `null` when there is none, e.g. the app's read failed, and the app reports its own read's errors). */
|
|
32
|
+
data?: GetVersionsOutput | null;
|
|
33
|
+
/** What to verify the answer against (`verification`); hold it stable (memoized), it is a dependency. */
|
|
34
|
+
claims?: Claims;
|
|
35
|
+
}
|
|
36
|
+
export interface UseEvent extends Partial<Omit<EventState, 'picked'>> {
|
|
37
|
+
/** The whole state (`null` until loaded), for an app's own views (a versions sheet). */
|
|
38
|
+
state: EventState | null;
|
|
39
|
+
/** Show the version `uri` instead of the default composition; `null` goes back to it. */
|
|
40
|
+
pick: (uri: string | null) => void;
|
|
41
|
+
picked: string | null;
|
|
42
|
+
/** The pill's props (`null` until loaded). */
|
|
43
|
+
pill: ReturnType<typeof versionPill>;
|
|
44
|
+
/** The field-conflict badge's props for one field (or several, e.g. a start and an end). */
|
|
45
|
+
conflict: (field: string | readonly string[]) => ReturnType<typeof fieldConflict>;
|
|
46
|
+
loading: boolean;
|
|
47
|
+
error: unknown;
|
|
48
|
+
/** The pure check on the answer's records (`null` without `claims`, or until loaded). */
|
|
49
|
+
verification: AnswerVerification | null;
|
|
50
|
+
/** Read it again (with `load`; nothing in data mode), keeping what is shown until the answer comes. */
|
|
51
|
+
reload: () => void;
|
|
52
|
+
}
|
|
53
|
+
export declare function useEvent(uri: string | null | undefined, options?: UseEventOptions): UseEvent;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* techne-sdk/react — `useEvent(uri)` (§24 VT7): one commons event or place as its versions,
|
|
3
|
+
* with the default composition shown and a person's pick of another version.
|
|
4
|
+
*
|
|
5
|
+
* `useEvent(uri, { load })` reads `pub.techne.draft.commons.getVersions` through the caller's own
|
|
6
|
+
* client (`load`), or takes the answer the app already holds (`{ data }`: an app with its own cache,
|
|
7
|
+
* like Beacon's TanStack Query, passes it in and the hook only keeps the pick; `data: undefined` is
|
|
8
|
+
* still loading, `null` is nothing to show and not loading (no read, or the caller's read failed), and
|
|
9
|
+
* the caller owns the read's errors, so `error` stays `null`). It returns
|
|
10
|
+
* `{ fields: {value, from, conflicts}, byline, versions, pick, picked }` plus `versionPill` /
|
|
11
|
+
* `fieldConflict` props for an app's own pill and field-conflict badge, on the same state.
|
|
12
|
+
*
|
|
13
|
+
* With `{ claims }` (the commons root and the credential, revocation and `publisher/self` records the
|
|
14
|
+
* app has read), it also runs the pure check on every record of the answer (P13.5) and returns
|
|
15
|
+
* `verification`: per record `{ valid, signer, chainVerified, problems }`, so an app can show "verified".
|
|
16
|
+
* Optional; the platform already filtered what it answered.
|
|
17
|
+
*
|
|
18
|
+
* `reload()` reads it again (with `load`): call it when the app's change stream nudges, and a record
|
|
19
|
+
* `put` answered pending flips to its curated version once the platform has it (`getVersions` of a
|
|
20
|
+
* source answers the curated record that lists it).
|
|
21
|
+
*
|
|
22
|
+
* The state and the verification are computed by the SDK's WebAssembly during render; if it cannot be
|
|
23
|
+
* instantiated (a web page whose CSP lacks `wasm-unsafe-eval`), the hook throws to the nearest error
|
|
24
|
+
* boundary.
|
|
25
|
+
*/
|
|
26
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
27
|
+
import { eventState, fieldConflict, verifyAnswer, versionPill, } from './index.js';
|
|
28
|
+
export function useEvent(uri, options = {}) {
|
|
29
|
+
const { load, data: given, claims } = options;
|
|
30
|
+
const dataMode = 'data' in options;
|
|
31
|
+
// The read's answer, error and the pick are each kept with the uri they belong to, so after the uri
|
|
32
|
+
// changes nothing of the previous thing is drawn, not even for the frame before the effects run.
|
|
33
|
+
const [loaded, setLoaded] = useState(null);
|
|
34
|
+
const [failed, setFailed] = useState(null);
|
|
35
|
+
const [pickedFor, setPickedFor] = useState({ uri, picked: null });
|
|
36
|
+
const [reads, setReads] = useState(0);
|
|
37
|
+
// `load` is often passed inline (a new function each render): held here, so it never re-runs the read.
|
|
38
|
+
// Updated in an effect (not during render); declared before the read's effect, so the read sees it.
|
|
39
|
+
const loadRef = useRef(load);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
loadRef.current = load;
|
|
42
|
+
});
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const read = loadRef.current;
|
|
45
|
+
if (!uri || !read || dataMode)
|
|
46
|
+
return;
|
|
47
|
+
let live = true;
|
|
48
|
+
read(uri).then((out) => {
|
|
49
|
+
if (!live)
|
|
50
|
+
return;
|
|
51
|
+
setLoaded({ uri, out });
|
|
52
|
+
setFailed(null);
|
|
53
|
+
}, (e) => live && setFailed({ uri, error: e }));
|
|
54
|
+
return () => {
|
|
55
|
+
live = false;
|
|
56
|
+
};
|
|
57
|
+
}, [uri, dataMode, reads]);
|
|
58
|
+
const data = dataMode ? given ?? null : loaded && loaded.uri === uri ? loaded.out : null;
|
|
59
|
+
const error = !dataMode && failed && failed.uri === uri ? failed.error : null;
|
|
60
|
+
// A pick belongs to one thing; a new answer for the same thing keeps it (`eventState` drops a pick
|
|
61
|
+
// whose version is gone).
|
|
62
|
+
const picked = pickedFor.uri === uri ? pickedFor.picked : null;
|
|
63
|
+
const state = useMemo(() => (data ? eventState(data, picked) : null), [data, picked]);
|
|
64
|
+
const verification = useMemo(() => (data && claims ? verifyAnswer(data, claims) : null), [data, claims]);
|
|
65
|
+
const pick = useCallback((next) => setPickedFor({ uri, picked: next }), [uri]);
|
|
66
|
+
const reload = useCallback(() => setReads((n) => n + 1), []);
|
|
67
|
+
const conflict = useCallback((field) => (state ? fieldConflict(state, field) : null), [state]);
|
|
68
|
+
return {
|
|
69
|
+
...(state ?? {}),
|
|
70
|
+
state,
|
|
71
|
+
picked: state?.picked ?? null,
|
|
72
|
+
pick,
|
|
73
|
+
pill: state ? versionPill(state) : null,
|
|
74
|
+
conflict,
|
|
75
|
+
// Data mode: `undefined` is still loading; `null` (no read, or the caller's read failed) is not.
|
|
76
|
+
loading: dataMode ? Boolean(uri) && given === undefined : Boolean(uri) && !data && !error,
|
|
77
|
+
error,
|
|
78
|
+
verification,
|
|
79
|
+
reload,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** What the module exports (the WebAssembly and its wasm2js translation alike). */
|
|
2
|
+
export interface Exports {
|
|
3
|
+
memory: {
|
|
4
|
+
buffer: ArrayBuffer;
|
|
5
|
+
};
|
|
6
|
+
techne_alloc(len: number): number;
|
|
7
|
+
techne_call(name: number, nameLen: number, args: number, argsLen: number): number;
|
|
8
|
+
techne_out_ptr(): number;
|
|
9
|
+
}
|
|
10
|
+
/** `call` over one instance of the module. */
|
|
11
|
+
export declare function caller(exports: Exports): (fn: string, args: Record<string, unknown>) => unknown;
|
|
12
|
+
/** Run one SDK function by name (`crates/techne-sdk`'s `call`), instantiating the module on first use. */
|
|
13
|
+
export declare function call(fn: string, args: Record<string, unknown>): unknown;
|
|
14
|
+
/** One record as read: its address, the CID it was served with, and its body. */
|
|
15
|
+
export interface ReadRecord {
|
|
16
|
+
uri: string;
|
|
17
|
+
cid: string;
|
|
18
|
+
value: unknown;
|
|
19
|
+
/**
|
|
20
|
+
* When the app first saw this version (RFC 3339). Read for a credential an operator issued: it counts
|
|
21
|
+
* only if the root names the operator for a period holding then. Without it, only an open period holds.
|
|
22
|
+
*/
|
|
23
|
+
firstSeen?: string;
|
|
24
|
+
}
|
|
25
|
+
/** What the caller holds to check records against. */
|
|
26
|
+
export interface Claims {
|
|
27
|
+
/** The commons root DID. */
|
|
28
|
+
root?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Records read: credentials and revocations (the root's and its operators'), the root's
|
|
31
|
+
* `pub.techne.draft.operator` records, and accounts' `publisher/self` declarations.
|
|
32
|
+
*/
|
|
33
|
+
records?: ReadRecord[];
|
|
34
|
+
/** Roles known: `role` absent when a membership is known but none covered the time. */
|
|
35
|
+
roles?: {
|
|
36
|
+
member: string;
|
|
37
|
+
collective: string;
|
|
38
|
+
role?: number;
|
|
39
|
+
}[];
|
|
40
|
+
admissions?: {
|
|
41
|
+
author: string;
|
|
42
|
+
space: string;
|
|
43
|
+
admitted: boolean;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
/** Lexicon validity, and whether the collection may live on the public firehose. */
|
|
47
|
+
export declare function validate(collection: string, body: unknown): {
|
|
48
|
+
valid: boolean;
|
|
49
|
+
problems: string[];
|
|
50
|
+
publicHome: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type Decision = {
|
|
53
|
+
decision: 'valid';
|
|
54
|
+
} | {
|
|
55
|
+
decision: 'pending';
|
|
56
|
+
} | {
|
|
57
|
+
decision: 'invalid';
|
|
58
|
+
reason: string;
|
|
59
|
+
};
|
|
60
|
+
/** `techne-lexicon-check`'s `decide` for one version of a record. */
|
|
61
|
+
export declare function decide(version: {
|
|
62
|
+
collection: string;
|
|
63
|
+
author: string;
|
|
64
|
+
rkey: string;
|
|
65
|
+
body: unknown;
|
|
66
|
+
space?: string;
|
|
67
|
+
firstSeen?: string;
|
|
68
|
+
}, claims?: Claims): Decision;
|
|
69
|
+
/** What an app shows for one record it read. */
|
|
70
|
+
export interface Verification {
|
|
71
|
+
/** The body hashes to its CID and `decide` calls it valid. */
|
|
72
|
+
valid: boolean;
|
|
73
|
+
/** The repo it is from (atproto signs a repo's commits, not each record). */
|
|
74
|
+
signer: string;
|
|
75
|
+
/**
|
|
76
|
+
* An admin writer (the commons root, or an operator the root names for a period holding when the
|
|
77
|
+
* credential was first seen) vouches for the signer's `publisher/self` declaration, which covers the
|
|
78
|
+
* collection.
|
|
79
|
+
*/
|
|
80
|
+
chainVerified: boolean;
|
|
81
|
+
/** Why it is not valid (empty when it is). */
|
|
82
|
+
problems: string[];
|
|
83
|
+
}
|
|
84
|
+
/** Verify one record offline against what the app holds (P13.5). */
|
|
85
|
+
export declare function verify(record: ReadRecord, claims?: Claims): Verification;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* techne-sdk/wasm — the TechneSDK logic written once in Rust (`crates/techne-sdk`) and run here as
|
|
3
|
+
* WebAssembly, so the TypeScript and the Rust answers cannot drift (P13.4):
|
|
4
|
+
*
|
|
5
|
+
* - the pure check (`techne-lexicon-check`): {@link validate} (lexicon validity and placement) and
|
|
6
|
+
* {@link decide} (one version: valid, pending or invalid, over the claims the caller holds);
|
|
7
|
+
* - {@link verify}: what an app can check offline about a record it read (P13.5);
|
|
8
|
+
* - `eventState` and `comparable` (the version ranking), wrapped by `techne-sdk/versions`;
|
|
9
|
+
* - `put`'s plan (private first, public last, deterministic rkeys and CIDs), wrapped by `techne-sdk/put`.
|
|
10
|
+
*
|
|
11
|
+
* The artifacts (`techne-wasm.gen.ts`, `techne-wasm2js.gen.js`) are committed and rebuilt by
|
|
12
|
+
* `scripts/build-wasm.sh`; `npm run codegen` rebuilds them and the gate fails when they are stale.
|
|
13
|
+
*/
|
|
14
|
+
import { load } from 'techne-sdk/wasm/load';
|
|
15
|
+
/** `call` over one instance of the module. */
|
|
16
|
+
export function caller(exports) {
|
|
17
|
+
const encoder = new TextEncoder();
|
|
18
|
+
const decoder = new TextDecoder();
|
|
19
|
+
const copyIn = (bytes) => {
|
|
20
|
+
const ptr = exports.techne_alloc(bytes.length);
|
|
21
|
+
new Uint8Array(exports.memory.buffer, ptr, bytes.length).set(bytes);
|
|
22
|
+
return ptr;
|
|
23
|
+
};
|
|
24
|
+
return (fn, args) => {
|
|
25
|
+
const name = encoder.encode(fn);
|
|
26
|
+
const json = encoder.encode(JSON.stringify(args));
|
|
27
|
+
const len = exports.techne_call(copyIn(name), name.length, copyIn(json), json.length);
|
|
28
|
+
const out = JSON.parse(decoder.decode(new Uint8Array(exports.memory.buffer, exports.techne_out_ptr(), len)));
|
|
29
|
+
if ('err' in out)
|
|
30
|
+
throw new Error(`techne-sdk ${fn}: ${out.err}`);
|
|
31
|
+
return out.ok;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let instance;
|
|
35
|
+
/** Run one SDK function by name (`crates/techne-sdk`'s `call`), instantiating the module on first use. */
|
|
36
|
+
export function call(fn, args) {
|
|
37
|
+
instance ??= caller(load());
|
|
38
|
+
return instance(fn, args);
|
|
39
|
+
}
|
|
40
|
+
/** Lexicon validity, and whether the collection may live on the public firehose. */
|
|
41
|
+
export function validate(collection, body) {
|
|
42
|
+
return call('validate', { collection, body });
|
|
43
|
+
}
|
|
44
|
+
/** `techne-lexicon-check`'s `decide` for one version of a record. */
|
|
45
|
+
export function decide(version, claims = {}) {
|
|
46
|
+
return call('decide', { ...version, claims });
|
|
47
|
+
}
|
|
48
|
+
/** Verify one record offline against what the app holds (P13.5). */
|
|
49
|
+
export function verify(record, claims = {}) {
|
|
50
|
+
return call('verify', { record, claims });
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's WebAssembly, instantiated from the committed bytes (`techne-wasm.gen.ts`). Synchronous, so
|
|
3
|
+
* the SDK's functions stay plain calls. Hosts without WebAssembly (Hermes) load `load.native.ts`
|
|
4
|
+
* instead: the package export `techne-sdk/wasm/load` names it under the `react-native` condition.
|
|
5
|
+
*/
|
|
6
|
+
import { WASM_BASE64 } from './techne-wasm.gen.js';
|
|
7
|
+
function bytes(b64) {
|
|
8
|
+
const bin = atob(b64);
|
|
9
|
+
const out = new Uint8Array(bin.length);
|
|
10
|
+
for (let i = 0; i < bin.length; i++)
|
|
11
|
+
out[i] = bin.charCodeAt(i);
|
|
12
|
+
return out;
|
|
13
|
+
}
|
|
14
|
+
export function load() {
|
|
15
|
+
return new WebAssembly.Instance(new WebAssembly.Module(bytes(WASM_BASE64)), {}).exports;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's WebAssembly as JavaScript (binaryen's wasm2js translation of the same module), for Hermes,
|
|
3
|
+
* which has no WebAssembly. The `react-native` condition of the package export `techne-sdk/wasm/load` picks
|
|
4
|
+
* this file over `load.ts` (Metro on iOS and Android).
|
|
5
|
+
*
|
|
6
|
+
* Required inside `load()`, not imported: the translation sets the whole module up when it is
|
|
7
|
+
* evaluated, and `load()` runs only on the first SDK call that needs it, so importing a module that
|
|
8
|
+
* merely re-exports one (`techne-sdk/versions`) costs nothing at startup.
|
|
9
|
+
*/
|
|
10
|
+
import type { Exports } from './index.js';
|
|
11
|
+
export declare function load(): Exports;
|