From bea4e703d52f72f477089a50baa000f8092b9819 Mon Sep 17 00:00:00 2001 From: dawn Date: Thu, 9 Jul 2026 15:44:28 +0300 Subject: [PATCH] web/api: add bobbin / knot xrpc client Signed-off-by: dawn --- web/.prettierignore | 2 + web/eslint.config.js | 1 + web/lex.config.ts | 30 +++ web/package.json | 2 + web/pnpm-lock.yaml | 168 +++++++++++++++ web/src/lib/api/_request.ts | 60 ++++++ web/src/lib/api/client.test.ts | 109 ++++++++++ web/src/lib/api/client.ts | 31 +++ web/src/lib/api/count.ts | 57 +++++ web/src/lib/api/coverage.ts | 11 + web/src/lib/api/identity.test.ts | 100 +++++++++ web/src/lib/api/identity.ts | 60 ++++++ web/src/lib/api/index.ts | 9 + web/src/lib/api/knot.test.ts | 26 +++ web/src/lib/api/knot.ts | 94 +++++++++ web/src/lib/api/lexicons/index.ts | 131 ++++++++++++ .../types/sh/tangled/actor/profile.ts | 120 +++++++++++ .../types/sh/tangled/ci/cancelPipeline.ts | 42 ++++ .../types/sh/tangled/ci/getPipeline.ts | 34 +++ .../lexicons/types/sh/tangled/ci/pipeline.ts | 89 ++++++++ .../types/sh/tangled/ci/queryPipelines.ts | 63 ++++++ .../sh/tangled/ci/subscribePipelineLogs.ts | 95 +++++++++ .../lexicons/types/sh/tangled/ci/trigger.ts | 96 +++++++++ .../types/sh/tangled/ci/triggerPipeline.ts | 57 +++++ .../lexicons/types/sh/tangled/feed/comment.ts | 41 ++++ .../types/sh/tangled/feed/listComments.ts | 75 +++++++ .../types/sh/tangled/feed/listCommentsBy.ts | 60 ++++++ .../types/sh/tangled/feed/listReactions.ts | 75 +++++++ .../types/sh/tangled/feed/listReactionsBy.ts | 60 ++++++ .../types/sh/tangled/feed/listStars.ts | 75 +++++++ .../types/sh/tangled/feed/listStarsBy.ts | 60 ++++++ .../types/sh/tangled/feed/reaction.ts | 36 ++++ .../lexicons/types/sh/tangled/feed/star.ts | 48 +++++ .../types/sh/tangled/git/listRefUpdates.ts | 75 +++++++ .../types/sh/tangled/git/listRefUpdatesBy.ts | 60 ++++++ .../lexicons/types/sh/tangled/git/listRefs.ts | 120 +++++++++++ .../types/sh/tangled/git/refUpdate.ts | 174 ++++++++++++++++ .../types/sh/tangled/git/temp/analyzeMerge.ts | 70 +++++++ .../types/sh/tangled/git/temp/defs.ts | 113 ++++++++++ .../types/sh/tangled/git/temp/getArchive.ts | 52 +++++ .../types/sh/tangled/git/temp/getBlob.ts | 39 ++++ .../types/sh/tangled/git/temp/getBranch.ts | 56 +++++ .../types/sh/tangled/git/temp/getCommit.ts | 38 ++++ .../types/sh/tangled/git/temp/getDiff.ts | 38 ++++ .../types/sh/tangled/git/temp/getEntry.ts | 68 ++++++ .../types/sh/tangled/git/temp/getHead.ts | 34 +++ .../types/sh/tangled/git/temp/getTag.ts | 34 +++ .../types/sh/tangled/git/temp/getTree.ts | 152 ++++++++++++++ .../types/sh/tangled/git/temp/listBranches.ts | 46 +++++ .../types/sh/tangled/git/temp/listCommits.ts | 50 +++++ .../sh/tangled/git/temp/listLanguages.ts | 66 ++++++ .../types/sh/tangled/git/temp/listTags.ts | 46 +++++ .../lexicons/types/sh/tangled/graph/follow.ts | 26 +++ .../types/sh/tangled/graph/listFollows.ts | 75 +++++++ .../types/sh/tangled/graph/listFollowsBy.ts | 60 ++++++ .../types/sh/tangled/graph/listVouches.ts | 75 +++++++ .../types/sh/tangled/graph/listVouchesBy.ts | 60 ++++++ .../lexicons/types/sh/tangled/graph/vouch.ts | 54 +++++ .../lib/api/lexicons/types/sh/tangled/knot.ts | 25 +++ .../types/sh/tangled/knot/addMember.ts | 32 +++ .../types/sh/tangled/knot/listKeys.ts | 76 +++++++ .../types/sh/tangled/knot/listKnots.ts | 75 +++++++ .../types/sh/tangled/knot/listMembers.ts | 89 ++++++++ .../types/sh/tangled/knot/listMembersBy.ts | 60 ++++++ .../lexicons/types/sh/tangled/knot/member.ts | 30 +++ .../types/sh/tangled/knot/removeMember.ts | 32 +++ .../types/sh/tangled/knot/subscribeRepos.ts | 90 ++++++++ .../lexicons/types/sh/tangled/knot/version.ts | 34 +++ .../types/sh/tangled/label/definition.ts | 74 +++++++ .../types/sh/tangled/label/listDefinitions.ts | 75 +++++++ .../types/sh/tangled/label/listOps.ts | 75 +++++++ .../types/sh/tangled/label/listOpsBy.ts | 60 ++++++ .../api/lexicons/types/sh/tangled/label/op.ts | 52 +++++ .../types/sh/tangled/markup/markdown.ts | 35 ++++ .../api/lexicons/types/sh/tangled/owner.ts | 28 +++ .../api/lexicons/types/sh/tangled/pipeline.ts | 194 ++++++++++++++++++ .../sh/tangled/pipeline/cancelPipeline.ts | 43 ++++ .../sh/tangled/pipeline/listPipelines.ts | 75 +++++++ .../sh/tangled/pipeline/listPipelinesBy.ts | 65 ++++++ .../types/sh/tangled/pipeline/listStatuses.ts | 75 +++++++ .../sh/tangled/pipeline/listStatusesBy.ts | 65 ++++++ .../types/sh/tangled/pipeline/status.ts | 55 +++++ .../lexicons/types/sh/tangled/publicKey.ts | 39 ++++ .../types/sh/tangled/publicKey/listKeys.ts | 75 +++++++ .../lib/api/lexicons/types/sh/tangled/repo.ts | 78 +++++++ .../types/sh/tangled/repo/addCollaborator.ts | 39 ++++ .../types/sh/tangled/repo/addSecret.ts | 43 ++++ .../lexicons/types/sh/tangled/repo/archive.ts | 52 +++++ .../types/sh/tangled/repo/artifact.ts | 52 +++++ .../lexicons/types/sh/tangled/repo/blob.ts | 152 ++++++++++++++ .../lexicons/types/sh/tangled/repo/branch.ts | 85 ++++++++ .../types/sh/tangled/repo/branches.ts | 46 +++++ .../types/sh/tangled/repo/collaborator.ts | 30 +++ .../lexicons/types/sh/tangled/repo/compare.ts | 38 ++++ .../lexicons/types/sh/tangled/repo/create.ts | 54 +++++ .../lexicons/types/sh/tangled/repo/delete.ts | 40 ++++ .../types/sh/tangled/repo/deleteBranch.ts | 30 +++ .../types/sh/tangled/repo/describeRepo.ts | 41 ++++ .../lexicons/types/sh/tangled/repo/diff.ts | 34 +++ .../types/sh/tangled/repo/forkStatus.ts | 57 +++++ .../types/sh/tangled/repo/forkSync.ts | 44 ++++ .../types/sh/tangled/repo/getDefaultBranch.ts | 77 +++++++ .../types/sh/tangled/repo/hiddenRef.ts | 57 +++++ .../lexicons/types/sh/tangled/repo/issue.ts | 34 +++ .../types/sh/tangled/repo/issue/comment.ts | 34 +++ .../types/sh/tangled/repo/issue/listStates.ts | 75 +++++++ .../sh/tangled/repo/issue/listStatesBy.ts | 65 ++++++ .../types/sh/tangled/repo/issue/state.ts | 38 ++++ .../sh/tangled/repo/issue/state/closed.ts | 14 ++ .../types/sh/tangled/repo/issue/state/open.ts | 12 ++ .../types/sh/tangled/repo/languages.ts | 88 ++++++++ .../types/sh/tangled/repo/listArtifacts.ts | 75 +++++++ .../types/sh/tangled/repo/listArtifactsBy.ts | 60 ++++++ .../sh/tangled/repo/listCollaborators.ts | 89 ++++++++ .../sh/tangled/repo/listCollaboratorsBy.ts | 65 ++++++ .../types/sh/tangled/repo/listIssues.ts | 100 +++++++++ .../types/sh/tangled/repo/listIssuesBy.ts | 68 ++++++ .../types/sh/tangled/repo/listPulls.ts | 98 +++++++++ .../types/sh/tangled/repo/listPullsBy.ts | 66 ++++++ .../types/sh/tangled/repo/listRepos.ts | 75 +++++++ .../types/sh/tangled/repo/listSecrets.ts | 52 +++++ .../api/lexicons/types/sh/tangled/repo/log.ts | 55 +++++ .../lexicons/types/sh/tangled/repo/merge.ts | 60 ++++++ .../types/sh/tangled/repo/mergeCheck.ts | 87 ++++++++ .../lexicons/types/sh/tangled/repo/pull.ts | 81 ++++++++ .../types/sh/tangled/repo/pull/comment.ts | 33 +++ .../sh/tangled/repo/pull/listStatuses.ts | 75 +++++++ .../sh/tangled/repo/pull/listStatusesBy.ts | 65 ++++++ .../types/sh/tangled/repo/pull/status.ts | 39 ++++ .../sh/tangled/repo/pull/status/closed.ts | 14 ++ .../sh/tangled/repo/pull/status/merged.ts | 14 ++ .../types/sh/tangled/repo/pull/status/open.ts | 12 ++ .../sh/tangled/repo/removeCollaborator.ts | 39 ++++ .../types/sh/tangled/repo/removeSecret.ts | 36 ++++ .../types/sh/tangled/repo/setDefaultBranch.ts | 33 +++ .../api/lexicons/types/sh/tangled/repo/tag.ts | 34 +++ .../lexicons/types/sh/tangled/repo/tags.ts | 46 +++++ .../lexicons/types/sh/tangled/repo/tree.ts | 152 ++++++++++++++ .../api/lexicons/types/sh/tangled/spindle.ts | 25 +++ .../types/sh/tangled/spindle/listMembers.ts | 75 +++++++ .../types/sh/tangled/spindle/listMembersBy.ts | 62 ++++++ .../types/sh/tangled/spindle/listSpindles.ts | 75 +++++++ .../types/sh/tangled/spindle/member.ts | 30 +++ .../api/lexicons/types/sh/tangled/string.ts | 44 ++++ .../types/sh/tangled/string/listStrings.ts | 75 +++++++ .../types/sh/tangled/sync/listRepos.ts | 113 ++++++++++ .../types/sh/tangled/sync/requestCrawl.ts | 36 ++++ web/src/lib/api/load.test.ts | 122 +++++++++++ web/src/lib/api/load.ts | 60 ++++++ web/src/lib/api/pagination.test.ts | 106 ++++++++++ web/src/lib/api/pagination.ts | 121 +++++++++++ web/src/lib/api/records.ts | 56 +++++ web/src/lib/api/search.ts | 48 +++++ web/src/lib/server/bobbin.ts | 5 + 154 files changed, 9411 insertions(+) create mode 100644 web/lex.config.ts create mode 100644 web/src/lib/api/_request.ts create mode 100644 web/src/lib/api/client.test.ts create mode 100644 web/src/lib/api/client.ts create mode 100644 web/src/lib/api/count.ts create mode 100644 web/src/lib/api/coverage.ts create mode 100644 web/src/lib/api/identity.test.ts create mode 100644 web/src/lib/api/identity.ts create mode 100644 web/src/lib/api/index.ts create mode 100644 web/src/lib/api/knot.test.ts create mode 100644 web/src/lib/api/knot.ts create mode 100644 web/src/lib/api/lexicons/index.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/actor/profile.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/cancelPipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/getPipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/pipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/queryPipelines.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/subscribePipelineLogs.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/ci/triggerPipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/comment.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listComments.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listCommentsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listReactions.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listReactionsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listStars.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/listStarsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/reaction.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/feed/star.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdates.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdatesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/listRefs.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/refUpdate.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/analyzeMerge.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/defs.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getArchive.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBlob.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBranch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getCommit.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getDiff.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getEntry.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getHead.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTag.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTree.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/listBranches.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/listCommits.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/listLanguages.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/listTags.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/follow.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/listFollows.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/listFollowsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/listVouches.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/listVouchesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/graph/vouch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/addMember.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/listKeys.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/listKnots.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/listMembers.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/listMembersBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/member.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/removeMember.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/subscribeRepos.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/knot/version.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/label/definition.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/label/listDefinitions.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/label/listOps.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/label/listOpsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/label/op.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/markup/markdown.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/owner.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/cancelPipeline.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelines.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelinesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatuses.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatusesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pipeline/status.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/publicKey.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/addCollaborator.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/addSecret.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/archive.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/artifact.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/blob.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/branch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/branches.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/collaborator.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/compare.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/create.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/delete.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/deleteBranch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/describeRepo.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/diff.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/forkStatus.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/forkSync.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/getDefaultBranch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/hiddenRef.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/comment.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStates.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStatesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/closed.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/open.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/languages.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifacts.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifactsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaborators.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaboratorsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listIssues.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listIssuesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listPulls.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listPullsBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listRepos.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/log.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/merge.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/mergeCheck.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/comment.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatuses.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatusesBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/closed.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/merged.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/open.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/removeCollaborator.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/removeSecret.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/setDefaultBranch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/tag.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/tags.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/repo/tree.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/spindle.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembers.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembersBy.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/spindle/listSpindles.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/spindle/member.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/string.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/string/listStrings.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/sync/listRepos.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/sync/requestCrawl.ts create mode 100644 web/src/lib/api/load.test.ts create mode 100644 web/src/lib/api/load.ts create mode 100644 web/src/lib/api/pagination.test.ts create mode 100644 web/src/lib/api/pagination.ts create mode 100644 web/src/lib/api/records.ts create mode 100644 web/src/lib/api/search.ts create mode 100644 web/src/lib/server/bobbin.ts diff --git a/web/.prettierignore b/web/.prettierignore index e95131c4..a10418ad 100644 --- a/web/.prettierignore +++ b/web/.prettierignore @@ -5,3 +5,5 @@ bun.lock bun.lockb /static/ + +/src/lib/api/lexicons/ diff --git a/web/eslint.config.js b/web/eslint.config.js index 54a51d93..45a70141 100644 --- a/web/eslint.config.js +++ b/web/eslint.config.js @@ -9,6 +9,7 @@ import ts from 'typescript-eslint'; const gitignorePath = path.resolve(import.meta.dirname, '.gitignore'); export default defineConfig( + { ignores: ['src/lib/api/lexicons/'] }, includeIgnoreFile(gitignorePath), js.configs.recommended, ts.configs.recommended, diff --git a/web/lex.config.ts b/web/lex.config.ts new file mode 100644 index 00000000..9c3b31a8 --- /dev/null +++ b/web/lex.config.ts @@ -0,0 +1,30 @@ +import { defineLexiconConfig } from '@atcute/lex-cli'; + +// generate sh.tangled types; resolve com.atproto refs from @atcute/atproto. +export default defineLexiconConfig({ + formatter: { type: 'prettier' }, + generate: { + outdir: 'src/lib/api/lexicons/', + clean: true, + imports: ['@atcute/atproto'], + files: [ + '../lexicons/*.json', + '../lexicons/actor/**/*.json', + '../lexicons/ci/**/*.json', + '../lexicons/feed/**/*.json', + '../lexicons/git/**/*.json', + '../lexicons/graph/**/*.json', + '../lexicons/issue/**/*.json', + '../lexicons/knot/**/*.json', + '../lexicons/label/**/*.json', + '../lexicons/markup/**/*.json', + '../lexicons/pipeline/**/*.json', + '../lexicons/pulls/**/*.json', + '../lexicons/repo/**/*.json', + '../lexicons/spindle/**/*.json', + '../lexicons/string/**/*.json', + '../lexicons/sync/**/*.json', + '../bobbin/crates/types/lexicons/**/*.json' + ] + } +}); diff --git a/web/package.json b/web/package.json index 289096cf..27807861 100644 --- a/web/package.json +++ b/web/package.json @@ -10,6 +10,7 @@ "preview": "vite preview --host 0.0.0.0", "start": "node build", "prepare": "svelte-kit sync || echo ''", + "codegen": "lex-cli generate", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --check . && eslint .", @@ -20,6 +21,7 @@ "test:e2e": "playwright test" }, "devDependencies": { + "@atcute/lex-cli": "3.2.1", "@eslint/js": "^10.0.1", "@iconify-json/lucide": "^1.2.116", "@playwright/test": "^1.60.0", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index d3a7e468..2a386556 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -30,6 +30,9 @@ importers: specifier: ^3.2.2 version: 3.2.2(tailwind-merge@3.6.0)(tailwindcss@4.3.2) devDependencies: + '@atcute/lex-cli': + specifier: 3.2.1 + version: 3.2.1(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(prettier@3.9.4)(typescript@6.0.3) '@eslint/js': specifier: ^10.0.1 version: 10.0.1(eslint@10.6.0(jiti@2.7.0)) @@ -110,11 +113,28 @@ packages: peerDependencies: '@atcute/lexicons': ^2.0.0 + '@atcute/car@6.0.2': + resolution: {integrity: sha512-6AaLjO0zrFD8R/aK7jwrqHEmLzfVilu/5pv4LAcUjxIYfBrw+nThV2FVLPtA4Jt59tIhjp5tQDP+9sx1eqQp+A==} + peerDependencies: + '@atcute/cbor': ^2.0.0 + '@atcute/cid': ^2.0.0 + + '@atcute/cbor@2.3.5': + resolution: {integrity: sha512-NvgeibMqtfeD6/4NMTnBwhjyB/F945UdnzeZMEsGb2eXSalOBzutgNmpnBPTj5FiN6Sl9VYhE3qDQfyox+P8aw==} + peerDependencies: + '@atcute/cid': ^2.0.0 + + '@atcute/cid@2.4.2': + resolution: {integrity: sha512-Uy48yfyo/hPQXF+XMXWIGomF6v8IvX5ErjozXMV7rlfU3EV7PSVX3J7plJXV6MRC3iI1z3PgTZTS7V0drCQVVw==} + '@atcute/client@5.1.1': resolution: {integrity: sha512-cn5/Zi/qo37WtQG6gzIC7JPs0RDzX9Z4eaceX45SpKgLZoc3fCFDJcE7C8xsbxBNfjry2T6PmUxWA8obebZsEQ==} peerDependencies: '@atcute/lexicons': ^2.0.0 + '@atcute/crypto@2.4.2': + resolution: {integrity: sha512-WKVVstCsgGZaaEJFemC6UPh5MtEB2SMU0tiOi744i9T2a6oInJg3VnbTzQsGkyQqqTNC30IHF7//Dwi4hYnu1g==} + '@atcute/identity-resolver@2.0.1': resolution: {integrity: sha512-0enA9w7XnbbqsZ5Rcl6jXLf7ZZuwFQ9dBmxFq3qOxPHLaCETsqsrQflXDPqiM27TnZwYq8sqCV5D1mFOksggDQ==} peerDependencies: @@ -126,9 +146,37 @@ packages: peerDependencies: '@atcute/lexicons': ^2.0.0 + '@atcute/lex-cli@3.2.1': + resolution: {integrity: sha512-uKoQfCdrsdRJQApfe4ENpMrWlRFwd6uTmI5+iJ8cIwv4pUQU13ILwwnFqJE4FqTHzCBGk9Dey4SCiGdQSBvRaw==} + hasBin: true + peerDependencies: + prettier: ^3.8.4 + peerDependenciesMeta: + prettier: + optional: true + + '@atcute/lexicon-doc@3.0.1': + resolution: {integrity: sha512-giKTzRo9AqoX8GQMN7vvcaWSC4iHoK9CwA5TZpGD7KQXxJNBrK270QrA6+Ad53yxaqmTjay+3qm+EOux2G7m0A==} + peerDependencies: + '@atcute/lexicons': ^2.0.0 + + '@atcute/lexicon-resolver@1.0.1': + resolution: {integrity: sha512-/IXEGEMB3uyYqWSNxsH1V2QIEO/d8TdLeSbdqTv75Bqd3aZqf2Q1Fx/asOE1P9bE0Xz0twnqxW3qQvy2SHGG8Q==} + peerDependencies: + '@atcute/identity': ^2.0.0 + '@atcute/identity-resolver': ^2.0.0 + '@atcute/lexicon-doc': ^3.0.0 + '@atcute/lexicons': ^2.0.0 + '@atcute/lexicons@2.0.2': resolution: {integrity: sha512-ATBADJAy4KQ76NB86BjgYKrRdbDRUo76Cbqna4WIfQAgN105Rcy972MiNKs+BSmcOOM3WakilgTm0CXD4RC0iA==} + '@atcute/mst@1.0.2': + resolution: {integrity: sha512-fb98Ygs0PjVAOE4WmtMGqi+PS4Y0Jsip4CIkzWBxyIcbfix8kBGQUwZi54k4rKiGfT9qroCY2rlaPFzwkkAFzQ==} + peerDependencies: + '@atcute/cbor': ^2.0.0 + '@atcute/cid': ^2.0.0 + '@atcute/multibase@1.2.4': resolution: {integrity: sha512-WeX12hvFZEim6C+cyv7Eqd93w6DzubNWQGmTFBghjsEuXvMe4HbBCYvsti0OUnbA5qLBPlsTyssQUJeLlHCzIw==} @@ -147,6 +195,13 @@ packages: '@atcute/oauth-types@1.0.1': resolution: {integrity: sha512-9uFP/nK0PgPDsaNbLArzrCHvTZO1k04cSEX5jZ75W2Jh7Jxbh/CSTenSrad3CZXuX6y6hDquEtl6H/IqLtTmHw==} + '@atcute/repo@1.0.2': + resolution: {integrity: sha512-fsAuGbagOW52nSFtf/TWBx25A6xpZvzxBk0+S14Bp5sGNq7JoQ0zyu40P7b6+L8b/buB+1ACHPntYsKqCI4Awg==} + peerDependencies: + '@atcute/cbor': ^2.0.0 + '@atcute/cid': ^2.0.0 + '@atcute/lexicons': ^2.0.0 + '@atcute/uint8array@1.1.3': resolution: {integrity: sha512-2KLcMQHUFtntY3tEjdyqqq1tR9hvPFndluWFCa637QY0cMyvq0fHSnhmZeWaSRIXMCwVDY3TLLWHNOHEWFb11g==} @@ -156,6 +211,9 @@ packages: '@atcute/util-text@1.3.3': resolution: {integrity: sha512-WhedTmg/msFhrdwXw9RjnNcDl8Vmisxl4+Vzyf5k3+8Gj5TKQg72dLSDtBNmNLd61RbHjgfQRBgE0ez6q/jciw==} + '@atcute/varint@2.0.1': + resolution: {integrity: sha512-reTtgQ1VPGVRcaTohKVb1tUbpvE7MpguoNS0gjhsxDWFY3t1yqWWvwKK6cJodAmePML36JombvgFwfsblir9Jg==} + '@emnapi/core@1.11.1': resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==} @@ -255,6 +313,20 @@ packages: '@emnapi/core': ^1.7.1 '@emnapi/runtime': ^1.7.1 + '@noble/secp256k1@3.1.0': + resolution: {integrity: sha512-+F7iS7tUMaNGXcc9X3PjmjvuQnXEuSjCRNzVVA2xAcKXgCaP0dHYz4SFyt4FKNHef7sOP//xihowcySSS7PK9g==} + + '@oomfware/kempt@0.1.4': + resolution: {integrity: sha512-7ik6b58VC17dMX2SZq0LUHaOYupavbtXFA3UxIsAPV2Gc8+HXv9BLJ9Di52zn/8RkDWhoLf0TAcfGYHlnHUiuw==} + + '@optique/core@1.1.1': + resolution: {integrity: sha512-tbZLdH5wEnh8IRG8KTmWPZCKHLmD4bXigoPdzoSUVi+V46qZTNEaTdqtR7EuEwhbPI0KQjLSYRZCxFTdr9OZkA==} + engines: {bun: '>=1.2.0', deno: '>=2.3.0', node: '>=20.0.0'} + + '@optique/run@1.1.1': + resolution: {integrity: sha512-jSZeuiljDEWYkQ67bVDucRknzFVwiSH1j4ho2jFWfcdMMa+WDRSfZA3GZoHA8zKj0Bf6UbJ+FMs/2IReQ0KYNQ==} + engines: {bun: '>=1.2.0', deno: '>=2.3.0', node: '>=20.0.0'} + '@oxc-project/types@0.138.0': resolution: {integrity: sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==} @@ -1746,6 +1818,24 @@ snapshots: dependencies: '@atcute/lexicons': 2.0.2 + '@atcute/car@6.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)': + dependencies: + '@atcute/cbor': 2.3.5(@atcute/cid@2.4.2) + '@atcute/cid': 2.4.2 + '@atcute/uint8array': 1.1.3 + '@atcute/varint': 2.0.1 + + '@atcute/cbor@2.3.5(@atcute/cid@2.4.2)': + dependencies: + '@atcute/cid': 2.4.2 + '@atcute/multibase': 1.2.4 + '@atcute/uint8array': 1.1.3 + + '@atcute/cid@2.4.2': + dependencies: + '@atcute/multibase': 1.2.4 + '@atcute/uint8array': 1.1.3 + '@atcute/client@5.1.1(@atcute/lexicons@2.0.2)(typescript@6.0.3)': dependencies: '@atcute/identity': 2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) @@ -1753,6 +1843,12 @@ snapshots: transitivePeerDependencies: - typescript + '@atcute/crypto@2.4.2': + dependencies: + '@atcute/multibase': 1.2.4 + '@atcute/uint8array': 1.1.3 + '@noble/secp256k1': 3.1.0 + '@atcute/identity-resolver@2.0.1(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3)': dependencies: '@atcute/identity': 2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) @@ -1769,6 +1865,50 @@ snapshots: transitivePeerDependencies: - typescript + '@atcute/lex-cli@3.2.1(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(prettier@3.9.4)(typescript@6.0.3)': + dependencies: + '@atcute/identity': 2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/identity-resolver': 2.0.1(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicon-doc': 3.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicon-resolver': 1.0.1(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(@atcute/identity-resolver@2.0.1(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicon-doc@3.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicons': 2.0.2 + '@oomfware/kempt': 0.1.4 + '@optique/core': 1.1.1 + '@optique/run': 1.1.1 + picocolors: 1.1.1 + valibot: 1.4.2(typescript@6.0.3) + optionalDependencies: + prettier: 3.9.4 + transitivePeerDependencies: + - '@atcute/cbor' + - '@atcute/cid' + - typescript + + '@atcute/lexicon-doc@3.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3)': + dependencies: + '@atcute/identity': 2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicons': 2.0.2 + '@atcute/uint8array': 1.1.3 + '@atcute/util-text': 1.3.3 + valibot: 1.4.2(typescript@6.0.3) + transitivePeerDependencies: + - typescript + + '@atcute/lexicon-resolver@1.0.1(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(@atcute/identity-resolver@2.0.1(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicon-doc@3.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3)': + dependencies: + '@atcute/crypto': 2.4.2 + '@atcute/identity': 2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/identity-resolver': 2.0.1(@atcute/identity@2.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3))(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicon-doc': 3.0.1(@atcute/lexicons@2.0.2)(typescript@6.0.3) + '@atcute/lexicons': 2.0.2 + '@atcute/repo': 1.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(@atcute/lexicons@2.0.2) + '@atcute/util-fetch': 2.0.1(typescript@6.0.3) + valibot: 1.4.2(typescript@6.0.3) + transitivePeerDependencies: + - '@atcute/cbor' + - '@atcute/cid' + - typescript + '@atcute/lexicons@2.0.2': dependencies: '@atcute/uint8array': 1.1.3 @@ -1776,6 +1916,12 @@ snapshots: '@standard-schema/spec': 1.1.0 esm-env: 1.2.2 + '@atcute/mst@1.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)': + dependencies: + '@atcute/cbor': 2.3.5(@atcute/cid@2.4.2) + '@atcute/cid': 2.4.2 + '@atcute/uint8array': 1.1.3 + '@atcute/multibase@1.2.4': dependencies: '@atcute/uint8array': 1.1.3 @@ -1816,6 +1962,16 @@ snapshots: transitivePeerDependencies: - typescript + '@atcute/repo@1.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2)(@atcute/lexicons@2.0.2)': + dependencies: + '@atcute/car': 6.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2) + '@atcute/cbor': 2.3.5(@atcute/cid@2.4.2) + '@atcute/cid': 2.4.2 + '@atcute/crypto': 2.4.2 + '@atcute/lexicons': 2.0.2 + '@atcute/mst': 1.0.2(@atcute/cbor@2.3.5(@atcute/cid@2.4.2))(@atcute/cid@2.4.2) + '@atcute/uint8array': 1.1.3 + '@atcute/uint8array@1.1.3': {} '@atcute/util-fetch@2.0.1(typescript@6.0.3)': @@ -1828,6 +1984,8 @@ snapshots: dependencies: unicode-segmenter: 0.14.5 + '@atcute/varint@2.0.1': {} + '@emnapi/core@1.11.1': dependencies: '@emnapi/wasi-threads': 1.2.2 @@ -1932,6 +2090,16 @@ snapshots: '@tybys/wasm-util': 0.10.3 optional: true + '@noble/secp256k1@3.1.0': {} + + '@oomfware/kempt@0.1.4': {} + + '@optique/core@1.1.1': {} + + '@optique/run@1.1.1': + dependencies: + '@optique/core': 1.1.1 + '@oxc-project/types@0.138.0': {} '@playwright/test@1.61.1': diff --git a/web/src/lib/api/_request.ts b/web/src/lib/api/_request.ts new file mode 100644 index 00000000..3d51d47c --- /dev/null +++ b/web/src/lib/api/_request.ts @@ -0,0 +1,60 @@ +import { ClientResponseError, isXRPCErrorPayload, type XRPCErrorPayload } from '@atcute/client'; +import type { BobbinContext, QueryValue, XrpcRequestInit } from './client'; + +export const buildUrl = ( + origin: string, + nsid: string, + params?: Record +): URL => { + const url = new URL(`/xrpc/${nsid}`, `${origin}/`); + if (params) { + for (const [key, value] of Object.entries(params)) { + if (value === undefined) continue; + if (Array.isArray(value)) { + for (const item of value) url.searchParams.append(key, String(item)); + } else { + url.searchParams.set(key, String(value)); + } + } + } + return url; +}; + +export const toResponseError = async (response: Response): Promise => { + let data: XRPCErrorPayload = { error: 'XRPCError', message: response.statusText }; + try { + const body: unknown = await response.json(); + if (isXRPCErrorPayload(body)) data = body; + } catch { + // keep the status-line fallback for non-json bodies. + } + return new ClientResponseError({ status: response.status, headers: response.headers, data }); +}; + +export const jsonGet = async ( + ctx: BobbinContext, + nsid: string, + params?: Record, + init?: XrpcRequestInit +): Promise => { + const response = await ctx.fetch(buildUrl(ctx.serviceUrl, nsid, params), { + headers: { accept: 'application/json', ...init?.headers }, + signal: init?.signal + }); + if (!response.ok) throw await toResponseError(response); + return (await response.json()) as T; +}; + +export const rawGet = async ( + ctx: BobbinContext, + nsid: string, + params?: Record, + init?: XrpcRequestInit +): Promise => { + const response = await ctx.fetch(buildUrl(ctx.serviceUrl, nsid, params), { + headers: init?.headers, + signal: init?.signal + }); + if (!response.ok) throw await toResponseError(response); + return response; +}; diff --git a/web/src/lib/api/client.test.ts b/web/src/lib/api/client.test.ts new file mode 100644 index 00000000..bbfb605a --- /dev/null +++ b/web/src/lib/api/client.test.ts @@ -0,0 +1,109 @@ +import { describe, expect, it, vi, type Mock } from 'vitest'; +import { ClientResponseError, createBobbinClient, type BobbinContext } from './client'; +import { jsonGet, rawGet } from './_request'; + +const jsonResponse = (body: unknown, init: ResponseInit = {}): Response => + new Response(JSON.stringify(body), { + status: 200, + headers: { 'content-type': 'application/json' }, + ...init + }); + +const makeCtx = ( + fetchMock: typeof globalThis.fetch, + serviceUrl = 'https://bobbin.test' +): BobbinContext => createBobbinClient({ serviceUrl, fetch: fetchMock }); + +const fetchedUrl = (mock: Mock, n = 0): URL => + new URL(String(mock.mock.calls[n][0])); + +describe('createBobbinClient', () => { + it('normalizes trailing slashes off the service url', () => { + const ctx = makeCtx(vi.fn(), 'https://bobbin.test///'); + expect(ctx.serviceUrl).toBe('https://bobbin.test'); + }); +}); + +describe('jsonGet URL construction', () => { + it('appends an array param as repeated keys', async () => { + const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ ok: 1 })); + await jsonGet(makeCtx(fetchMock), 'sh.tangled.repo.getRepos', { repos: ['a', 'b'] }); + const url = fetchedUrl(fetchMock); + expect(url.searchParams.getAll('repos')).toEqual(['a', 'b']); + expect(url.search).toBe('?repos=a&repos=b'); + }); + + it('omits undefined params entirely', async () => { + const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ ok: 1 })); + await jsonGet(makeCtx(fetchMock), 'sh.tangled.x', { keep: 'yes', drop: undefined }); + const url = fetchedUrl(fetchMock); + expect(url.searchParams.has('drop')).toBe(false); + expect(url.searchParams.get('keep')).toBe('yes'); + }); + + it('resolves the query against the normalized origin', async () => { + const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ ok: 1 })); + await jsonGet(makeCtx(fetchMock, 'https://bobbin.test/'), 'sh.tangled.x', { a: '1' }); + expect(fetchedUrl(fetchMock).href).toBe('https://bobbin.test/xrpc/sh.tangled.x?a=1'); + }); +}); + +describe('jsonGet request headers & signal', () => { + it('sends accept: application/json and merges caller headers + signal', async () => { + const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ ok: 1 })); + const controller = new AbortController(); + await jsonGet(makeCtx(fetchMock), 'sh.tangled.x', undefined, { + headers: { 'x-custom': '1' }, + signal: controller.signal + }); + const init = fetchMock.mock.calls[0][1] as RequestInit; + expect(init.headers).toMatchObject({ accept: 'application/json', 'x-custom': '1' }); + expect(init.signal).toBe(controller.signal); + }); +}); + +describe('jsonGet responses', () => { + it('throws ClientResponseError carrying status + error/description for a JSON error body', async () => { + const fetchMock = vi + .fn() + .mockResolvedValue( + jsonResponse({ error: 'RecordNotFound', message: 'no such repo' }, { status: 404 }) + ); + const err = await jsonGet(makeCtx(fetchMock), 'sh.tangled.x').catch((e: unknown) => e); + expect(err).toBeInstanceOf(ClientResponseError); + const cre = err as ClientResponseError; + expect(cre.status).toBe(404); + expect(cre.error).toBe('RecordNotFound'); + expect(cre.description).toBe('no such repo'); + }); + + it('falls back to the status line for a non-JSON error body (does not hang)', async () => { + const fetchMock = vi.fn().mockResolvedValue( + new Response('502 Bad Gateway', { + status: 502, + statusText: 'Bad Gateway' + }) + ); + const err = await jsonGet(makeCtx(fetchMock), 'sh.tangled.x').catch((e: unknown) => e); + expect(err).toBeInstanceOf(ClientResponseError); + const cre = err as ClientResponseError; + expect(cre.status).toBe(502); + expect(cre.error).toBe('XRPCError'); + expect(cre.description).toBe('Bad Gateway'); + }); +}); + +describe('rawGet', () => { + it('throws ClientResponseError on a non-2xx status', async () => { + const fetchMock = vi + .fn() + .mockResolvedValue( + jsonResponse({ error: 'UpstreamFailed', message: 'knot down' }, { status: 502 }) + ); + const err = await rawGet(makeCtx(fetchMock), 'sh.tangled.repo.archive').catch( + (e: unknown) => e + ); + expect(err).toBeInstanceOf(ClientResponseError); + expect((err as ClientResponseError).status).toBe(502); + }); +}); diff --git a/web/src/lib/api/client.ts b/web/src/lib/api/client.ts new file mode 100644 index 00000000..2537d585 --- /dev/null +++ b/web/src/lib/api/client.ts @@ -0,0 +1,31 @@ +import { Client, simpleFetchHandler } from '@atcute/client'; + +export { ClientResponseError, isXRPCErrorPayload, ok } from '@atcute/client'; +export type { XRPCErrorPayload } from '@atcute/client'; + +// generated lexicons register ambient types; don't import the barrel at runtime. + +export interface BobbinContext { + readonly xrpc: Client; + readonly serviceUrl: string; + readonly fetch: typeof globalThis.fetch; +} + +export interface CreateBobbinOptions { + serviceUrl: string; + fetch?: typeof globalThis.fetch; +} + +export const createBobbinClient = ({ serviceUrl, fetch }: CreateBobbinOptions): BobbinContext => { + const origin = serviceUrl.replace(/\/+$/, ''); + const boundFetch = fetch ?? globalThis.fetch; + const xrpc = new Client({ handler: simpleFetchHandler({ service: origin, fetch: boundFetch }) }); + return { xrpc, serviceUrl: origin, fetch: boundFetch }; +}; + +export type QueryValue = string | number | boolean | readonly (string | number)[] | undefined; + +export interface XrpcRequestInit { + signal?: AbortSignal; + headers?: HeadersInit; +} diff --git a/web/src/lib/api/count.ts b/web/src/lib/api/count.ts new file mode 100644 index 00000000..75e665d4 --- /dev/null +++ b/web/src/lib/api/count.ts @@ -0,0 +1,57 @@ +import type { BobbinContext, XrpcRequestInit } from './client'; +import { jsonGet } from './_request'; + +// count endpoints share { subject } params and { count, distinctAuthors } output. +export type CountName = + | 'sh.tangled.feed.countStars' + | 'sh.tangled.feed.countStarsBy' + | 'sh.tangled.feed.countComments' + | 'sh.tangled.feed.countCommentsBy' + | 'sh.tangled.feed.countReactions' + | 'sh.tangled.feed.countReactionsBy' + | 'sh.tangled.graph.countFollows' + | 'sh.tangled.graph.countFollowsBy' + | 'sh.tangled.graph.countVouches' + | 'sh.tangled.graph.countVouchesBy' + | 'sh.tangled.git.countRefUpdates' + | 'sh.tangled.git.countRefUpdatesBy' + | 'sh.tangled.knot.countKnots' + | 'sh.tangled.knot.countMembers' + | 'sh.tangled.knot.countMembersBy' + | 'sh.tangled.label.countDefinitions' + | 'sh.tangled.label.countOps' + | 'sh.tangled.label.countOpsBy' + | 'sh.tangled.pipeline.countPipelines' + | 'sh.tangled.pipeline.countPipelinesBy' + | 'sh.tangled.pipeline.countStatuses' + | 'sh.tangled.pipeline.countStatusesBy' + | 'sh.tangled.publicKey.countKeys' + | 'sh.tangled.repo.countArtifacts' + | 'sh.tangled.repo.countArtifactsBy' + | 'sh.tangled.repo.countCollaborators' + | 'sh.tangled.repo.countCollaboratorsBy' + | 'sh.tangled.repo.countIssues' + | 'sh.tangled.repo.countIssuesBy' + | 'sh.tangled.repo.countPulls' + | 'sh.tangled.repo.countPullsBy' + | 'sh.tangled.repo.countRepos' + | 'sh.tangled.repo.issue.countStates' + | 'sh.tangled.repo.issue.countStatesBy' + | 'sh.tangled.repo.pull.countStatuses' + | 'sh.tangled.repo.pull.countStatusesBy' + | 'sh.tangled.spindle.countSpindles' + | 'sh.tangled.spindle.countMembers' + | 'sh.tangled.spindle.countMembersBy' + | 'sh.tangled.string.countStrings'; + +export interface CountResult { + count: number; + distinctAuthors: number; +} + +export const count = ( + ctx: BobbinContext, + name: CountName, + subject: string, + init?: XrpcRequestInit +): Promise => jsonGet(ctx, name, { subject }, init); diff --git a/web/src/lib/api/coverage.ts b/web/src/lib/api/coverage.ts new file mode 100644 index 00000000..876eca09 --- /dev/null +++ b/web/src/lib/api/coverage.ts @@ -0,0 +1,11 @@ +import type { BobbinContext, XrpcRequestInit } from './client'; +import { jsonGet } from './_request'; + +export interface Coverage { + ready: boolean; + eventsProcessed: number; + lastCursor: number; +} + +export const getCoverage = (ctx: BobbinContext, init?: XrpcRequestInit): Promise => + jsonGet(ctx, 'sh.tangled.bobbin.getCoverage', undefined, init); diff --git a/web/src/lib/api/identity.test.ts b/web/src/lib/api/identity.test.ts new file mode 100644 index 00000000..83aeb00d --- /dev/null +++ b/web/src/lib/api/identity.test.ts @@ -0,0 +1,100 @@ +import { describe, expect, it, vi } from 'vitest'; +import { createBobbinClient, type BobbinContext } from './client'; +import { IdentityCache, type MiniDoc } from './identity'; + +const DOC: MiniDoc = { did: 'did:plc:x', handle: 'alice.test' }; + +const docResponse = (doc: MiniDoc): Response => + new Response(JSON.stringify(doc), { + status: 200, + headers: { 'content-type': 'application/json' } + }); + +const makeCtx = (fetchMock: typeof globalThis.fetch): BobbinContext => + createBobbinClient({ serviceUrl: 'https://bobbin.test', fetch: fetchMock }); + +const deferred = (): { promise: Promise; resolve: (value: T) => void } => { + let resolve!: (value: T) => void; + const promise = new Promise((r) => { + resolve = r; + }); + return { promise, resolve }; +}; + +describe('IdentityCache.resolve', () => { + it('fetches on the first miss then serves the cached document', async () => { + const fetchMock = vi.fn().mockResolvedValue(docResponse(DOC)); + const cache = new IdentityCache(makeCtx(fetchMock)); + + const first = await cache.resolve('alice.test'); + const second = await cache.resolve('alice.test'); + + expect(first).toEqual(DOC); + expect(second).toEqual(DOC); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect((fetchMock.mock.calls[0][0] as URL).searchParams.get('identifier')).toBe('alice.test'); + }); + + it('coalesces concurrent misses for the same key into one in-flight fetch', async () => { + const gate = deferred(); + const fetchMock = vi.fn().mockReturnValue(gate.promise); + const cache = new IdentityCache(makeCtx(fetchMock)); + + const a = cache.resolve('alice.test'); + const b = cache.resolve('alice.test'); + expect(fetchMock).toHaveBeenCalledTimes(1); + + gate.resolve(docResponse(DOC)); + const [ra, rb] = await Promise.all([a, b]); + expect(ra).toEqual(DOC); + expect(rb).toEqual(DOC); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('re-fetches after the in-flight promise settles (no permanent stampede lock)', async () => { + const fetchMock = vi.fn().mockResolvedValue(docResponse(DOC)); + const cache = new IdentityCache(makeCtx(fetchMock)); + + await cache.resolve('bob.test'); + fetchMock.mockResolvedValueOnce(docResponse({ did: 'did:plc:y', handle: 'carol.test' })); + await cache.resolve('carol.test'); + expect(fetchMock).toHaveBeenCalledTimes(2); + }); + + it('populates both directions of the index from a resolved document', async () => { + const fetchMock = vi.fn().mockResolvedValue(docResponse(DOC)); + const cache = new IdentityCache(makeCtx(fetchMock)); + + await cache.resolve('alice.test'); + expect(cache.didFor('alice.test')).toBe('did:plc:x'); + expect(cache.handleFor('did:plc:x')).toBe('alice.test'); + }); +}); + +describe('IdentityCache.prime & map selection', () => { + it('seeds both directions without any fetch', () => { + const fetchMock = vi.fn(); + const cache = new IdentityCache(makeCtx(fetchMock)); + + cache.prime(DOC); + expect(cache.didFor('alice.test')).toBe('did:plc:x'); + expect(cache.handleFor('did:plc:x')).toBe('alice.test'); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('resolves a DID against the did map and a handle against the handle map', async () => { + const fetchMock = vi.fn(); + const cache = new IdentityCache(makeCtx(fetchMock)); + cache.prime(DOC); + + await expect(cache.resolve('did:plc:x')).resolves.toEqual(DOC); + await expect(cache.resolve('alice.test')).resolves.toEqual(DOC); + expect(fetchMock).not.toHaveBeenCalled(); + + // unknown dids miss the handle map and fetch. + fetchMock.mockResolvedValueOnce(docResponse({ did: 'did:plc:z', handle: 'dan.test' })); + await cache.resolve('did:plc:z'); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect((fetchMock.mock.calls[0][0] as URL).searchParams.get('identifier')).toBe('did:plc:z'); + }); +}); diff --git a/web/src/lib/api/identity.ts b/web/src/lib/api/identity.ts new file mode 100644 index 00000000..b94fc128 --- /dev/null +++ b/web/src/lib/api/identity.ts @@ -0,0 +1,60 @@ +import type { BobbinContext, XrpcRequestInit } from './client'; +import { jsonGet } from './_request'; + +export interface MiniDoc { + did: string; + handle: string; + pds?: string; + avatar?: string; +} + +export const resolveMiniDoc = ( + ctx: BobbinContext, + identifier: string, + init?: XrpcRequestInit +): Promise => + jsonGet(ctx, 'com.bad-example.identity.resolveMiniDoc', { identifier }, init); + +// did/handle cache with in-flight de-dupe. +export class IdentityCache { + readonly #ctx: BobbinContext; + readonly #byDid = new Map(); + readonly #byHandle = new Map(); + readonly #inflight = new Map>(); + + constructor(ctx: BobbinContext) { + this.#ctx = ctx; + } + + prime(doc: MiniDoc): void { + this.#byDid.set(doc.did, doc); + this.#byHandle.set(doc.handle, doc); + } + + didFor(handle: string): string | undefined { + return this.#byHandle.get(handle)?.did; + } + + handleFor(did: string): string | undefined { + return this.#byDid.get(did)?.handle; + } + + resolve(identifier: string, init?: XrpcRequestInit): Promise { + const cached = identifier.startsWith('did:') + ? this.#byDid.get(identifier) + : this.#byHandle.get(identifier); + if (cached) return Promise.resolve(cached); + + const existing = this.#inflight.get(identifier); + if (existing) return existing; + + const pending = resolveMiniDoc(this.#ctx, identifier, init) + .then((doc) => { + this.prime(doc); + return doc; + }) + .finally(() => this.#inflight.delete(identifier)); + this.#inflight.set(identifier, pending); + return pending; + } +} diff --git a/web/src/lib/api/index.ts b/web/src/lib/api/index.ts new file mode 100644 index 00000000..e70a3ae1 --- /dev/null +++ b/web/src/lib/api/index.ts @@ -0,0 +1,9 @@ +export * from './client'; +export * from './pagination'; +export * from './count'; +export * from './records'; +export * as knot from './knot'; +export * from './search'; +export * from './coverage'; +export * from './identity'; +export * from './load'; diff --git a/web/src/lib/api/knot.test.ts b/web/src/lib/api/knot.test.ts new file mode 100644 index 00000000..5899916c --- /dev/null +++ b/web/src/lib/api/knot.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it, vi } from 'vitest'; +import * as knot from './knot'; +import { ClientResponseError, createBobbinClient, type BobbinContext } from './client'; + +const jsonResponse = (body: unknown, init: ResponseInit = {}): Response => + new Response(JSON.stringify(body), { + status: 200, + headers: { 'content-type': 'application/json' }, + ...init + }); + +const makeCtx = (fetchMock: typeof globalThis.fetch): BobbinContext => + createBobbinClient({ serviceUrl: 'https://bobbin.test', fetch: fetchMock }); + +describe('knot.archive (binary passthrough)', () => { + it('throws ClientResponseError on a non-2xx archive response', async () => { + const fetchMock = vi + .fn() + .mockResolvedValue(jsonResponse({ error: 'UpstreamGone' }, { status: 502 })); + const err = await knot + .archive(makeCtx(fetchMock), { repo: 'did:plc:x/r', ref: 'main' }) + .catch((e: unknown) => e); + expect(err).toBeInstanceOf(ClientResponseError); + expect((err as ClientResponseError).status).toBe(502); + }); +}); diff --git a/web/src/lib/api/knot.ts b/web/src/lib/api/knot.ts new file mode 100644 index 00000000..540b5743 --- /dev/null +++ b/web/src/lib/api/knot.ts @@ -0,0 +1,94 @@ +import type { BobbinContext, QueryValue, XrpcRequestInit } from './client'; +import { jsonGet, rawGet } from './_request'; +import type * as Archive from './lexicons/types/sh/tangled/repo/archive'; +import type * as Blob_ from './lexicons/types/sh/tangled/repo/blob'; +import type * as Branch from './lexicons/types/sh/tangled/repo/branch'; +import type * as Branches from './lexicons/types/sh/tangled/repo/branches'; +import type * as Compare from './lexicons/types/sh/tangled/repo/compare'; +import type * as DescribeRepo from './lexicons/types/sh/tangled/repo/describeRepo'; +import type * as Diff from './lexicons/types/sh/tangled/repo/diff'; +import type * as GetDefaultBranch from './lexicons/types/sh/tangled/repo/getDefaultBranch'; +import type * as Languages from './lexicons/types/sh/tangled/repo/languages'; +import type * as ListSecrets from './lexicons/types/sh/tangled/repo/listSecrets'; +import type * as Log from './lexicons/types/sh/tangled/repo/log'; +import type * as Tag from './lexicons/types/sh/tangled/repo/tag'; +import type * as Tags from './lexicons/types/sh/tangled/repo/tags'; +import type * as Tree from './lexicons/types/sh/tangled/repo/tree'; + +// wrappers for bobbin's knot-proxied repo endpoints. + +const asParams = (params: object): Record => + params as unknown as Record; + +export const tree = (ctx: BobbinContext, params: Tree.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.tree', asParams(params), init); + +export const blob = (ctx: BobbinContext, params: Blob_.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.blob', asParams(params), init); + +export const branch = (ctx: BobbinContext, params: Branch.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.branch', asParams(params), init); + +export const getDefaultBranch = ( + ctx: BobbinContext, + params: GetDefaultBranch.$params, + init?: XrpcRequestInit +) => + jsonGet( + ctx, + 'sh.tangled.repo.getDefaultBranch', + asParams(params), + init + ); + +export const describeRepo = ( + ctx: BobbinContext, + params: DescribeRepo.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.describeRepo', asParams(params), init); + +export const languages = (ctx: BobbinContext, params: Languages.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.languages', asParams(params), init); + +export const listSecrets = ( + ctx: BobbinContext, + params: ListSecrets.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.listSecrets', asParams(params), init); + +// schema-less json passthroughs; callers supply the shape. + +export const log = (ctx: BobbinContext, params: Log.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.log', asParams(params), init); + +export const diff = ( + ctx: BobbinContext, + params: Diff.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.diff', asParams(params), init); + +export const compare = ( + ctx: BobbinContext, + params: Compare.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.compare', asParams(params), init); + +export const branches = ( + ctx: BobbinContext, + params: Branches.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.branches', asParams(params), init); + +export const tags = ( + ctx: BobbinContext, + params: Tags.$params, + init?: XrpcRequestInit +) => jsonGet(ctx, 'sh.tangled.repo.tags', asParams(params), init); + +export const tag = (ctx: BobbinContext, params: Tag.$params, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.repo.tag', asParams(params), init); + +// raw response for streaming/download. + +export const archive = (ctx: BobbinContext, params: Archive.$params, init?: XrpcRequestInit) => + rawGet(ctx, 'sh.tangled.repo.archive', asParams(params), init); diff --git a/web/src/lib/api/lexicons/index.ts b/web/src/lib/api/lexicons/index.ts new file mode 100644 index 00000000..2a4fab1a --- /dev/null +++ b/web/src/lib/api/lexicons/index.ts @@ -0,0 +1,131 @@ +export * as ShTangledActorProfile from "./types/sh/tangled/actor/profile.js"; +export * as ShTangledCiCancelPipeline from "./types/sh/tangled/ci/cancelPipeline.js"; +export * as ShTangledCiGetPipeline from "./types/sh/tangled/ci/getPipeline.js"; +export * as ShTangledCiPipeline from "./types/sh/tangled/ci/pipeline.js"; +export * as ShTangledCiQueryPipelines from "./types/sh/tangled/ci/queryPipelines.js"; +export * as ShTangledCiSubscribePipelineLogs from "./types/sh/tangled/ci/subscribePipelineLogs.js"; +export * as ShTangledCiTrigger from "./types/sh/tangled/ci/trigger.js"; +export * as ShTangledCiTriggerPipeline from "./types/sh/tangled/ci/triggerPipeline.js"; +export * as ShTangledFeedComment from "./types/sh/tangled/feed/comment.js"; +export * as ShTangledFeedListComments from "./types/sh/tangled/feed/listComments.js"; +export * as ShTangledFeedListCommentsBy from "./types/sh/tangled/feed/listCommentsBy.js"; +export * as ShTangledFeedListReactions from "./types/sh/tangled/feed/listReactions.js"; +export * as ShTangledFeedListReactionsBy from "./types/sh/tangled/feed/listReactionsBy.js"; +export * as ShTangledFeedListStars from "./types/sh/tangled/feed/listStars.js"; +export * as ShTangledFeedListStarsBy from "./types/sh/tangled/feed/listStarsBy.js"; +export * as ShTangledFeedReaction from "./types/sh/tangled/feed/reaction.js"; +export * as ShTangledFeedStar from "./types/sh/tangled/feed/star.js"; +export * as ShTangledGitListRefUpdates from "./types/sh/tangled/git/listRefUpdates.js"; +export * as ShTangledGitListRefUpdatesBy from "./types/sh/tangled/git/listRefUpdatesBy.js"; +export * as ShTangledGitListRefs from "./types/sh/tangled/git/listRefs.js"; +export * as ShTangledGitRefUpdate from "./types/sh/tangled/git/refUpdate.js"; +export * as ShTangledGitTempAnalyzeMerge from "./types/sh/tangled/git/temp/analyzeMerge.js"; +export * as ShTangledGitTempDefs from "./types/sh/tangled/git/temp/defs.js"; +export * as ShTangledGitTempGetArchive from "./types/sh/tangled/git/temp/getArchive.js"; +export * as ShTangledGitTempGetBlob from "./types/sh/tangled/git/temp/getBlob.js"; +export * as ShTangledGitTempGetBranch from "./types/sh/tangled/git/temp/getBranch.js"; +export * as ShTangledGitTempGetCommit from "./types/sh/tangled/git/temp/getCommit.js"; +export * as ShTangledGitTempGetDiff from "./types/sh/tangled/git/temp/getDiff.js"; +export * as ShTangledGitTempGetEntry from "./types/sh/tangled/git/temp/getEntry.js"; +export * as ShTangledGitTempGetHead from "./types/sh/tangled/git/temp/getHead.js"; +export * as ShTangledGitTempGetTag from "./types/sh/tangled/git/temp/getTag.js"; +export * as ShTangledGitTempGetTree from "./types/sh/tangled/git/temp/getTree.js"; +export * as ShTangledGitTempListBranches from "./types/sh/tangled/git/temp/listBranches.js"; +export * as ShTangledGitTempListCommits from "./types/sh/tangled/git/temp/listCommits.js"; +export * as ShTangledGitTempListLanguages from "./types/sh/tangled/git/temp/listLanguages.js"; +export * as ShTangledGitTempListTags from "./types/sh/tangled/git/temp/listTags.js"; +export * as ShTangledGraphFollow from "./types/sh/tangled/graph/follow.js"; +export * as ShTangledGraphListFollows from "./types/sh/tangled/graph/listFollows.js"; +export * as ShTangledGraphListFollowsBy from "./types/sh/tangled/graph/listFollowsBy.js"; +export * as ShTangledGraphListVouches from "./types/sh/tangled/graph/listVouches.js"; +export * as ShTangledGraphListVouchesBy from "./types/sh/tangled/graph/listVouchesBy.js"; +export * as ShTangledGraphVouch from "./types/sh/tangled/graph/vouch.js"; +export * as ShTangledKnot from "./types/sh/tangled/knot.js"; +export * as ShTangledKnotAddMember from "./types/sh/tangled/knot/addMember.js"; +export * as ShTangledKnotListKeys from "./types/sh/tangled/knot/listKeys.js"; +export * as ShTangledKnotListKnots from "./types/sh/tangled/knot/listKnots.js"; +export * as ShTangledKnotListMembers from "./types/sh/tangled/knot/listMembers.js"; +export * as ShTangledKnotListMembersBy from "./types/sh/tangled/knot/listMembersBy.js"; +export * as ShTangledKnotMember from "./types/sh/tangled/knot/member.js"; +export * as ShTangledKnotRemoveMember from "./types/sh/tangled/knot/removeMember.js"; +export * as ShTangledKnotSubscribeRepos from "./types/sh/tangled/knot/subscribeRepos.js"; +export * as ShTangledKnotVersion from "./types/sh/tangled/knot/version.js"; +export * as ShTangledLabelDefinition from "./types/sh/tangled/label/definition.js"; +export * as ShTangledLabelListDefinitions from "./types/sh/tangled/label/listDefinitions.js"; +export * as ShTangledLabelListOps from "./types/sh/tangled/label/listOps.js"; +export * as ShTangledLabelListOpsBy from "./types/sh/tangled/label/listOpsBy.js"; +export * as ShTangledLabelOp from "./types/sh/tangled/label/op.js"; +export * as ShTangledMarkupMarkdown from "./types/sh/tangled/markup/markdown.js"; +export * as ShTangledOwner from "./types/sh/tangled/owner.js"; +export * as ShTangledPipeline from "./types/sh/tangled/pipeline.js"; +export * as ShTangledPipelineCancelPipeline from "./types/sh/tangled/pipeline/cancelPipeline.js"; +export * as ShTangledPipelineListPipelines from "./types/sh/tangled/pipeline/listPipelines.js"; +export * as ShTangledPipelineListPipelinesBy from "./types/sh/tangled/pipeline/listPipelinesBy.js"; +export * as ShTangledPipelineListStatuses from "./types/sh/tangled/pipeline/listStatuses.js"; +export * as ShTangledPipelineListStatusesBy from "./types/sh/tangled/pipeline/listStatusesBy.js"; +export * as ShTangledPipelineStatus from "./types/sh/tangled/pipeline/status.js"; +export * as ShTangledPublicKey from "./types/sh/tangled/publicKey.js"; +export * as ShTangledPublicKeyListKeys from "./types/sh/tangled/publicKey/listKeys.js"; +export * as ShTangledRepo from "./types/sh/tangled/repo.js"; +export * as ShTangledRepoAddCollaborator from "./types/sh/tangled/repo/addCollaborator.js"; +export * as ShTangledRepoAddSecret from "./types/sh/tangled/repo/addSecret.js"; +export * as ShTangledRepoArchive from "./types/sh/tangled/repo/archive.js"; +export * as ShTangledRepoArtifact from "./types/sh/tangled/repo/artifact.js"; +export * as ShTangledRepoBlob from "./types/sh/tangled/repo/blob.js"; +export * as ShTangledRepoBranch from "./types/sh/tangled/repo/branch.js"; +export * as ShTangledRepoBranches from "./types/sh/tangled/repo/branches.js"; +export * as ShTangledRepoCollaborator from "./types/sh/tangled/repo/collaborator.js"; +export * as ShTangledRepoCompare from "./types/sh/tangled/repo/compare.js"; +export * as ShTangledRepoCreate from "./types/sh/tangled/repo/create.js"; +export * as ShTangledRepoDelete from "./types/sh/tangled/repo/delete.js"; +export * as ShTangledRepoDeleteBranch from "./types/sh/tangled/repo/deleteBranch.js"; +export * as ShTangledRepoDescribeRepo from "./types/sh/tangled/repo/describeRepo.js"; +export * as ShTangledRepoDiff from "./types/sh/tangled/repo/diff.js"; +export * as ShTangledRepoForkStatus from "./types/sh/tangled/repo/forkStatus.js"; +export * as ShTangledRepoForkSync from "./types/sh/tangled/repo/forkSync.js"; +export * as ShTangledRepoGetDefaultBranch from "./types/sh/tangled/repo/getDefaultBranch.js"; +export * as ShTangledRepoHiddenRef from "./types/sh/tangled/repo/hiddenRef.js"; +export * as ShTangledRepoIssue from "./types/sh/tangled/repo/issue.js"; +export * as ShTangledRepoIssueComment from "./types/sh/tangled/repo/issue/comment.js"; +export * as ShTangledRepoIssueListStates from "./types/sh/tangled/repo/issue/listStates.js"; +export * as ShTangledRepoIssueListStatesBy from "./types/sh/tangled/repo/issue/listStatesBy.js"; +export * as ShTangledRepoIssueState from "./types/sh/tangled/repo/issue/state.js"; +export * as ShTangledRepoIssueStateClosed from "./types/sh/tangled/repo/issue/state/closed.js"; +export * as ShTangledRepoIssueStateOpen from "./types/sh/tangled/repo/issue/state/open.js"; +export * as ShTangledRepoLanguages from "./types/sh/tangled/repo/languages.js"; +export * as ShTangledRepoListArtifacts from "./types/sh/tangled/repo/listArtifacts.js"; +export * as ShTangledRepoListArtifactsBy from "./types/sh/tangled/repo/listArtifactsBy.js"; +export * as ShTangledRepoListCollaborators from "./types/sh/tangled/repo/listCollaborators.js"; +export * as ShTangledRepoListCollaboratorsBy from "./types/sh/tangled/repo/listCollaboratorsBy.js"; +export * as ShTangledRepoListIssues from "./types/sh/tangled/repo/listIssues.js"; +export * as ShTangledRepoListIssuesBy from "./types/sh/tangled/repo/listIssuesBy.js"; +export * as ShTangledRepoListPulls from "./types/sh/tangled/repo/listPulls.js"; +export * as ShTangledRepoListPullsBy from "./types/sh/tangled/repo/listPullsBy.js"; +export * as ShTangledRepoListRepos from "./types/sh/tangled/repo/listRepos.js"; +export * as ShTangledRepoListSecrets from "./types/sh/tangled/repo/listSecrets.js"; +export * as ShTangledRepoLog from "./types/sh/tangled/repo/log.js"; +export * as ShTangledRepoMerge from "./types/sh/tangled/repo/merge.js"; +export * as ShTangledRepoMergeCheck from "./types/sh/tangled/repo/mergeCheck.js"; +export * as ShTangledRepoPull from "./types/sh/tangled/repo/pull.js"; +export * as ShTangledRepoPullComment from "./types/sh/tangled/repo/pull/comment.js"; +export * as ShTangledRepoPullListStatuses from "./types/sh/tangled/repo/pull/listStatuses.js"; +export * as ShTangledRepoPullListStatusesBy from "./types/sh/tangled/repo/pull/listStatusesBy.js"; +export * as ShTangledRepoPullStatus from "./types/sh/tangled/repo/pull/status.js"; +export * as ShTangledRepoPullStatusClosed from "./types/sh/tangled/repo/pull/status/closed.js"; +export * as ShTangledRepoPullStatusMerged from "./types/sh/tangled/repo/pull/status/merged.js"; +export * as ShTangledRepoPullStatusOpen from "./types/sh/tangled/repo/pull/status/open.js"; +export * as ShTangledRepoRemoveCollaborator from "./types/sh/tangled/repo/removeCollaborator.js"; +export * as ShTangledRepoRemoveSecret from "./types/sh/tangled/repo/removeSecret.js"; +export * as ShTangledRepoSetDefaultBranch from "./types/sh/tangled/repo/setDefaultBranch.js"; +export * as ShTangledRepoTag from "./types/sh/tangled/repo/tag.js"; +export * as ShTangledRepoTags from "./types/sh/tangled/repo/tags.js"; +export * as ShTangledRepoTree from "./types/sh/tangled/repo/tree.js"; +export * as ShTangledSpindle from "./types/sh/tangled/spindle.js"; +export * as ShTangledSpindleListMembers from "./types/sh/tangled/spindle/listMembers.js"; +export * as ShTangledSpindleListMembersBy from "./types/sh/tangled/spindle/listMembersBy.js"; +export * as ShTangledSpindleListSpindles from "./types/sh/tangled/spindle/listSpindles.js"; +export * as ShTangledSpindleMember from "./types/sh/tangled/spindle/member.js"; +export * as ShTangledString from "./types/sh/tangled/string.js"; +export * as ShTangledStringListStrings from "./types/sh/tangled/string/listStrings.js"; +export * as ShTangledSyncListRepos from "./types/sh/tangled/sync/listRepos.js"; +export * as ShTangledSyncRequestCrawl from "./types/sh/tangled/sync/requestCrawl.js"; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/actor/profile.ts b/web/src/lib/api/lexicons/types/sh/tangled/actor/profile.ts new file mode 100644 index 00000000..ec0c91b4 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/actor/profile.ts @@ -0,0 +1,120 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.literal("self"), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.actor.profile"), + /** + * Small image to be displayed next to posts from account. AKA, 'profile picture' + * @accept image/png, image/jpeg + * @maxSize 1000000 + */ + avatar: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobSize(1000000), + /*#__PURE__*/ v.blobAccept(["image/png", "image/jpeg"]), + ]), + ), + /** + * Include link to this account on Bluesky. + */ + bluesky: /*#__PURE__*/ v.boolean(), + /** + * Free-form profile description text. + * @maxLength 2560 + * @maxGraphemes 256 + */ + description: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), + ), + /** + * @minLength 0 + * @maxLength 5 + */ + links: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.genericUriString()), + [/*#__PURE__*/ v.arrayLength(0, 5)], + ), + ), + /** + * Free-form location text. + * @maxLength 400 + * @maxGraphemes 40 + */ + location: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 400), + /*#__PURE__*/ v.stringGraphemes(0, 40), + ]), + ), + /** + * Pinned repositories. Values are repo DIDs for repos that have them, or AT-URIs for legacy repos. + * @minLength 0 + * @maxLength 6 + */ + pinnedRepositories: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + [/*#__PURE__*/ v.arrayLength(0, 6)], + ), + ), + /** + * A handle the user prefers to be displayed as. + * @maxLength 253 + */ + preferredHandle: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.handleString(), [ + /*#__PURE__*/ v.stringLength(0, 253), + ]), + ), + /** + * Preferred gender pronouns. + * @maxLength 40 + */ + pronouns: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 40), + ]), + ), + /** + * @minLength 0 + * @maxLength 2 + */ + stats: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.literalEnum([ + "closed-issue-count", + "closed-pull-request-count", + "merged-pull-request-count", + "open-issue-count", + "open-pull-request-count", + "repository-count", + "star-count", + ]), + ), + [/*#__PURE__*/ v.arrayLength(0, 2)], + ), + ), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.actor.profile": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/cancelPipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/cancelPipeline.ts new file mode 100644 index 00000000..87018797 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/cancelPipeline.ts @@ -0,0 +1,42 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.ci.cancelPipeline", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * pipeline TID + */ + pipeline: /*#__PURE__*/ v.tidString(), + /** + * git repository DID + */ + repo: /*#__PURE__*/ v.didString(), + /** + * Workflow names to filter. When not provided, entire pipeline will be canceled. + */ + workflows: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.ci.cancelPipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/getPipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/getPipeline.ts new file mode 100644 index 00000000..a3a4da8c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/getPipeline.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledCiPipeline from "./pipeline.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.ci.getPipeline", { + params: /*#__PURE__*/ v.object({ + /** + * Spindle-local pipeline id + */ + pipeline: /*#__PURE__*/ v.tidString(), + }), + output: { + type: "lex", + get schema() { + return ShTangledCiPipeline.mainSchema; + }, + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.ci.getPipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/pipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/pipeline.ts new file mode 100644 index 00000000..1a5c6db9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/pipeline.ts @@ -0,0 +1,89 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as ShTangledCiTrigger from "./trigger.js"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.pipeline"), + ), + /** + * Commit Id this pipeline is running on + */ + commit: /*#__PURE__*/ v.string(), + createdAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Spindle-local pipeline id + */ + id: /*#__PURE__*/ v.string(), + /** + * Repository DID + */ + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request) + */ + sourceRepo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Trigger event metadata + */ + get trigger() { + return /*#__PURE__*/ v.variant([ + ShTangledCiTrigger.manualSchema, + ShTangledCiTrigger.pullRequestSchema, + ShTangledCiTrigger.pushSchema, + ]); + }, + /** + * Triggered workflows + * @minLength 1 + * @maxLength 50 + */ + get workflows() { + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(workflowSchema), [ + /*#__PURE__*/ v.arrayLength(1, 50), + ]); + }, +}); +const _workflowSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.pipeline#workflow"), + ), + error: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + finishedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Spindle-local workflow id. Unique per pipeline, usually same as name. + */ + id: /*#__PURE__*/ v.string(), + /** + * Name of the workflow + * @minGraphemes 1 + * @maxGraphemes 40 + */ + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1, 40), + ]), + startedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Workflow status + */ + status: /*#__PURE__*/ v.literalEnum([ + "cancelled", + "failed", + "pending", + "running", + "success", + "timeout", + ]), +}); + +type main$schematype = typeof _mainSchema; +type workflow$schematype = typeof _workflowSchema; + +export interface mainSchema extends main$schematype {} +export interface workflowSchema extends workflow$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const workflowSchema = _workflowSchema as workflowSchema; + +export interface Main extends v.InferInput {} +export interface Workflow extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/queryPipelines.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/queryPipelines.ts new file mode 100644 index 00000000..78e1819f --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/queryPipelines.ts @@ -0,0 +1,63 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledCiPipeline from "./pipeline.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.ci.queryPipelines", { + params: /*#__PURE__*/ v.object({ + /** + * Filter pipelines by commits. When provided, maximum one pipeline per commit id will be returned. + */ + commits: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of pipelines to return + * @minimum 1 + * @maximum 250 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 250), + ]), + 50, + ), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get pipelines() { + return /*#__PURE__*/ v.array(ShTangledCiPipeline.mainSchema); + }, + /** + * Maximum number of pipelines + */ + total: /*#__PURE__*/ v.integer(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.ci.queryPipelines": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/subscribePipelineLogs.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/subscribePipelineLogs.ts new file mode 100644 index 00000000..cef3c30e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/subscribePipelineLogs.ts @@ -0,0 +1,95 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _controlSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.subscribePipelineLogs#control"), + ), + /** + * Step command + */ + command: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + content: /*#__PURE__*/ v.string(), + /** + * Step kind + */ + kind: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["system", "user"]), + ), + /** + * Step status + */ + status: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["end", "start"]), + ), + /** + * Step ID + */ + step: /*#__PURE__*/ v.integer(), + time: /*#__PURE__*/ v.datetimeString(), + /** + * workflow name + */ + workflow: /*#__PURE__*/ v.string(), +}); +const _dataSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.subscribePipelineLogs#data"), + ), + content: /*#__PURE__*/ v.string(), + /** + * Step ID + */ + step: /*#__PURE__*/ v.integer(), + stream: /*#__PURE__*/ v.literalEnum(["stderr", "stdout"]), + time: /*#__PURE__*/ v.datetimeString(), + /** + * workflow name + */ + workflow: /*#__PURE__*/ v.string(), +}); +const _mainSchema = /*#__PURE__*/ v.subscription( + "sh.tangled.ci.subscribePipelineLogs", + { + params: /*#__PURE__*/ v.object({ + /** + * Pipeline ID + */ + pipeline: /*#__PURE__*/ v.tidString(), + /** + * filter logs by specific workflows + */ + workflows: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + }), + get message() { + return /*#__PURE__*/ v.variant([controlSchema, dataSchema]); + }, + }, +); + +type control$schematype = typeof _controlSchema; +type data$schematype = typeof _dataSchema; +type main$schematype = typeof _mainSchema; + +export interface controlSchema extends control$schematype {} +export interface dataSchema extends data$schematype {} +export interface mainSchema extends main$schematype {} + +export const controlSchema = _controlSchema as controlSchema; +export const dataSchema = _dataSchema as dataSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface Control extends v.InferInput {} +export interface Data extends v.InferInput {} + +export interface $params extends v.InferInput {} +export type $message = v.InferInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCSubscriptions { + "sh.tangled.ci.subscribePipelineLogs": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts new file mode 100644 index 00000000..6a013474 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts @@ -0,0 +1,96 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _manualSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.trigger#manual"), + ), + get inputs() { + return /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(pairSchema)); + }, + /** + * optional ref the SHA was resolved from, for display and TANGLED_REF + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * commit SHA the manual run targets + * @minLength 40 + * @maxLength 40 + */ + sha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + /** + * Repository DID to check out code and workflow definitions from, if different from the target repo. + */ + sourceRepo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), +}); +const _pairSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.trigger#pair"), + ), + key: /*#__PURE__*/ v.string(), + value: /*#__PURE__*/ v.string(), +}); +const _pullRequestSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.trigger#pullRequest"), + ), + /** + * AT-URI of the sh.tangled.repo.pull record this run belongs to + */ + pull: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + sourceBranch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Repository DID to check out code and workflow definitions from, if different from the target repo. + */ + sourceRepo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * @minLength 40 + * @maxLength 40 + */ + sourceSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + targetBranch: /*#__PURE__*/ v.string(), +}); +const _pushSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.ci.trigger#push"), + ), + /** + * @minLength 40 + * @maxLength 40 + */ + newSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + /** + * @minLength 40 + * @maxLength 40 + */ + oldSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + ref: /*#__PURE__*/ v.string(), +}); + +type manual$schematype = typeof _manualSchema; +type pair$schematype = typeof _pairSchema; +type pullRequest$schematype = typeof _pullRequestSchema; +type push$schematype = typeof _pushSchema; + +export interface manualSchema extends manual$schematype {} +export interface pairSchema extends pair$schematype {} +export interface pullRequestSchema extends pullRequest$schematype {} +export interface pushSchema extends push$schematype {} + +export const manualSchema = _manualSchema as manualSchema; +export const pairSchema = _pairSchema as pairSchema; +export const pullRequestSchema = _pullRequestSchema as pullRequestSchema; +export const pushSchema = _pushSchema as pushSchema; + +export interface Manual extends v.InferInput {} +export interface Pair extends v.InferInput {} +export interface PullRequest extends v.InferInput {} +export interface Push extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/ci/triggerPipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/ci/triggerPipeline.ts new file mode 100644 index 00000000..5e3edaf9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/triggerPipeline.ts @@ -0,0 +1,57 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledCiTrigger from "./trigger.js"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.ci.triggerPipeline", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Target repository DID. Auth is checked against this repo. + */ + repo: /*#__PURE__*/ v.didString(), + /** + * Trigger metadata for this dispatch. + */ + get trigger() { + return /*#__PURE__*/ v.variant([ + ShTangledCiTrigger.manualSchema, + ShTangledCiTrigger.pullRequestSchema, + ]); + }, + /** + * Workflow names to run. When not provided, every dispatchable workflow is run. + */ + workflows: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * AT-URI of the created pipeline + */ + pipeline: /*#__PURE__*/ v.resourceUriString(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.ci.triggerPipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/comment.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/comment.ts new file mode 100644 index 00000000..adf15ad7 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/comment.ts @@ -0,0 +1,41 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ComAtprotoRepoStrongRef from "@atcute/atproto/types/repo/strongRef"; +import * as ShTangledMarkupMarkdown from "../markup/markdown.js"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.feed.comment"), + get body() { + return /*#__PURE__*/ v.variant([ShTangledMarkupMarkdown.mainSchema]); + }, + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * optional pull submission round index. required when subject is sh.tangled.repo.pull + * @minimum 0 + */ + pullRoundIdx: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + get replyTo() { + return /*#__PURE__*/ v.optional(ComAtprotoRepoStrongRef.mainSchema); + }, + get subject() { + return ComAtprotoRepoStrongRef.mainSchema; + }, + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.feed.comment": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listComments.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listComments.ts new file mode 100644 index 00000000..739d4136 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listComments.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.listComments#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.feed.comment record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listComments", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Record AT-URI the comments are attached to. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listComments": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listCommentsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listCommentsBy.ts new file mode 100644 index 00000000..a955fbcf --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listCommentsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledFeedListComments from "./listComments.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listCommentsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose comment authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledFeedListComments.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listCommentsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactions.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactions.ts new file mode 100644 index 00000000..48da50cc --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactions.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.listReactions#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.feed.reaction record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listReactions", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Record AT-URI the reactions target. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listReactions": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactionsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactionsBy.ts new file mode 100644 index 00000000..138f8e41 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listReactionsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledFeedListReactions from "./listReactions.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listReactionsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose reaction authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledFeedListReactions.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listReactionsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listStars.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listStars.ts new file mode 100644 index 00000000..89c0539e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listStars.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.listStars#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.feed.star record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listStars", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Repo DID to list star edges for. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listStars": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/listStarsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/listStarsBy.ts new file mode 100644 index 00000000..69bfbb67 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/listStarsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledFeedListStars from "./listStars.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.listStarsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose star authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledFeedListStars.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.listStarsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/reaction.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/reaction.ts new file mode 100644 index 00000000..da06d8fc --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/reaction.ts @@ -0,0 +1,36 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.feed.reaction"), + createdAt: /*#__PURE__*/ v.datetimeString(), + reaction: /*#__PURE__*/ v.literalEnum([ + "❤️", + "🎉", + "👀", + "👍", + "👎", + "😆", + "🚀", + "🫤", + ]), + subject: /*#__PURE__*/ v.resourceUriString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.feed.reaction": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/star.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/star.ts new file mode 100644 index 00000000..c8fbd3c0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/star.ts @@ -0,0 +1,48 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.feed.star"), + createdAt: /*#__PURE__*/ v.datetimeString(), + get subject() { + return /*#__PURE__*/ v.variant([repoSchema, stringSchema], true); + }, + }), +); +const _repoSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.star#repo"), + ), + did: /*#__PURE__*/ v.didString(), +}); +const _stringSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.star#string"), + ), + uri: /*#__PURE__*/ v.resourceUriString(), +}); + +type main$schematype = typeof _mainSchema; +type repo$schematype = typeof _repoSchema; +type string$schematype = typeof _stringSchema; + +export interface mainSchema extends main$schematype {} +export interface repoSchema extends repo$schematype {} +export interface stringSchema extends string$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const repoSchema = _repoSchema as repoSchema; +export const stringSchema = _stringSchema as stringSchema; + +export interface Main extends v.InferInput {} +export interface Repo extends v.InferInput {} +export interface String extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.feed.star": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdates.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdates.ts new file mode 100644 index 00000000..44323d23 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdates.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.listRefUpdates#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.git.refUpdate record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.listRefUpdates", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Repo DID whose ref-update records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.listRefUpdates": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdatesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdatesBy.ts new file mode 100644 index 00000000..274cda6b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefUpdatesBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitListRefUpdates from "./listRefUpdates.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.listRefUpdatesBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose ref-update authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledGitListRefUpdates.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.listRefUpdatesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/listRefs.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefs.ts new file mode 100644 index 00000000..5e29c7be --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/listRefs.ts @@ -0,0 +1,120 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _defaultBranchSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.listRefs#defaultBranch"), + ), + /** + * Commit SHA at the tip of the default branch, for reconciling against a last-known state. Width depends on the repo's git object-format. + * @minLength 40 + * @maxLength 128 + */ + head: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), + ), + /** + * Default branch ref name that HEAD points at, eg. refs/heads/main. + * @maxLength 2560 + * @maxGraphemes 256 + */ + ref: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.listRefs", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of refs to return in this page + * @minimum 1 + * @maximum 1000 + * @default 100 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 100, + ), + /** + * DID of the git repo as minted by the knot + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Cursor for the next page, absent when the last page is reached + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get defaultBranch() { + return /*#__PURE__*/ v.optional(defaultBranchSchema); + }, + /** + * @maxLength 1000 + */ + get refs() { + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(refSchema), [ + /*#__PURE__*/ v.arrayLength(0, 1000), + ]); + }, + }), + }, +}); +const _refSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.listRefs#ref"), + ), + /** + * Full ref name, eg. refs/heads/main or refs/tags/v1.0 + * @maxLength 2560 + * @maxGraphemes 256 + */ + ref: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), + /** + * Object SHA the ref points at. Width depends on the repo's git object-format. + * @minLength 40 + * @maxLength 128 + */ + sha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), +}); + +type defaultBranch$schematype = typeof _defaultBranchSchema; +type main$schematype = typeof _mainSchema; +type ref$schematype = typeof _refSchema; + +export interface defaultBranchSchema extends defaultBranch$schematype {} +export interface mainSchema extends main$schematype {} +export interface refSchema extends ref$schematype {} + +export const defaultBranchSchema = _defaultBranchSchema as defaultBranchSchema; +export const mainSchema = _mainSchema as mainSchema; +export const refSchema = _refSchema as refSchema; + +export interface DefaultBranch extends v.InferInput< + typeof defaultBranchSchema +> {} +export interface Ref extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.listRefs": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/refUpdate.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/refUpdate.ts new file mode 100644 index 00000000..dabaeaaa --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/refUpdate.ts @@ -0,0 +1,174 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _commitCountBreakdownSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.refUpdate#commitCountBreakdown"), + ), + get byEmail() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(individualEmailCommitCountSchema), + ); + }, +}); +const _individualEmailCommitCountSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal( + "sh.tangled.git.refUpdate#individualEmailCommitCount", + ), + ), + count: /*#__PURE__*/ v.integer(), + email: /*#__PURE__*/ v.string(), +}); +const _individualLanguageSizeSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.refUpdate#individualLanguageSize"), + ), + lang: /*#__PURE__*/ v.string(), + size: /*#__PURE__*/ v.integer(), +}); +const _langBreakdownSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.refUpdate#langBreakdown"), + ), + get inputs() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(individualLanguageSizeSchema), + ); + }, +}); +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.git.refUpdate"), + /** + * files changed between commits + */ + changedFiles: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + /** + * did of the user that pushed this ref + */ + committerDid: /*#__PURE__*/ v.didString(), + get meta() { + return metaSchema; + }, + /** + * new SHA of this ref + * @minLength 40 + * @maxLength 40 + */ + newSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + /** + * old SHA of this ref + * @minLength 40 + * @maxLength 40 + */ + oldSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + /** + * did of the owner of the repo + */ + ownerDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * push options passed on git-push + * @maxLength 50 + */ + pushOptions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.string< + | "ci-skip" + | "ci-verbose" + | "skip-ci" + | "verbose-ci" + | (string & {}) + >(), + [/*#__PURE__*/ v.stringLength(0, 1024)], + ), + ), + [/*#__PURE__*/ v.arrayLength(0, 50)], + ), + ), + /** + * Ref being updated + * @maxLength 2560 + * @maxGraphemes 256 + */ + ref: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), + /** + * DID of the repo itself + */ + repo: /*#__PURE__*/ v.didString(), + }), +); +const _metaSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.refUpdate#meta"), + ), + get commitCount() { + return commitCountBreakdownSchema; + }, + /** + * @default false + */ + isDefaultRef: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean(), false), + get langBreakdown() { + return /*#__PURE__*/ v.optional(langBreakdownSchema); + }, +}); + +type commitCountBreakdown$schematype = typeof _commitCountBreakdownSchema; +type individualEmailCommitCount$schematype = + typeof _individualEmailCommitCountSchema; +type individualLanguageSize$schematype = typeof _individualLanguageSizeSchema; +type langBreakdown$schematype = typeof _langBreakdownSchema; +type main$schematype = typeof _mainSchema; +type meta$schematype = typeof _metaSchema; + +export interface commitCountBreakdownSchema extends commitCountBreakdown$schematype {} +export interface individualEmailCommitCountSchema extends individualEmailCommitCount$schematype {} +export interface individualLanguageSizeSchema extends individualLanguageSize$schematype {} +export interface langBreakdownSchema extends langBreakdown$schematype {} +export interface mainSchema extends main$schematype {} +export interface metaSchema extends meta$schematype {} + +export const commitCountBreakdownSchema = + _commitCountBreakdownSchema as commitCountBreakdownSchema; +export const individualEmailCommitCountSchema = + _individualEmailCommitCountSchema as individualEmailCommitCountSchema; +export const individualLanguageSizeSchema = + _individualLanguageSizeSchema as individualLanguageSizeSchema; +export const langBreakdownSchema = _langBreakdownSchema as langBreakdownSchema; +export const mainSchema = _mainSchema as mainSchema; +export const metaSchema = _metaSchema as metaSchema; + +export interface CommitCountBreakdown extends v.InferInput< + typeof commitCountBreakdownSchema +> {} +export interface IndividualEmailCommitCount extends v.InferInput< + typeof individualEmailCommitCountSchema +> {} +export interface IndividualLanguageSize extends v.InferInput< + typeof individualLanguageSizeSchema +> {} +export interface LangBreakdown extends v.InferInput< + typeof langBreakdownSchema +> {} +export interface Main extends v.InferInput {} +export interface Meta extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.git.refUpdate": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/analyzeMerge.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/analyzeMerge.ts new file mode 100644 index 00000000..641ae08d --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/analyzeMerge.ts @@ -0,0 +1,70 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _conflictInfoSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.analyzeMerge#conflictInfo"), + ), + /** + * Name of the conflicted file + */ + filename: /*#__PURE__*/ v.string(), + /** + * Reason for the conflict + */ + reason: /*#__PURE__*/ v.string(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.analyzeMerge", { + params: /*#__PURE__*/ v.object({ + /** + * Target branch to merge into + */ + branch: /*#__PURE__*/ v.string(), + /** + * Patch or pull request to check for merge conflicts + */ + patch: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * List of files with merge conflicts + */ + get conflicts() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(conflictInfoSchema), + ); + }, + /** + * Whether the merge has conflicts + */ + is_conflicted: /*#__PURE__*/ v.boolean(), + }), + }, +}); + +type conflictInfo$schematype = typeof _conflictInfoSchema; +type main$schematype = typeof _mainSchema; + +export interface conflictInfoSchema extends conflictInfo$schematype {} +export interface mainSchema extends main$schematype {} + +export const conflictInfoSchema = _conflictInfoSchema as conflictInfoSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ConflictInfo extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.analyzeMerge": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/defs.ts new file mode 100644 index 00000000..4d74aea1 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/defs.ts @@ -0,0 +1,113 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _branchSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.defs#branch"), + ), + /** + * hydrated commit object + */ + get commit() { + return commitSchema; + }, + /** + * branch name + */ + name: /*#__PURE__*/ v.string(), +}); +const _commitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.defs#commit"), + ), + get author() { + return signatureSchema; + }, + get committer() { + return signatureSchema; + }, + get hash() { + return hashSchema; + }, + message: /*#__PURE__*/ v.string(), + get tree() { + return hashSchema; + }, +}); +const _hashSchema = /*#__PURE__*/ v.string(); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.defs#signature"), + ), + /** + * Person email + */ + email: /*#__PURE__*/ v.string(), + /** + * Person name + */ + name: /*#__PURE__*/ v.string(), + /** + * Timestamp of the signature + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _submoduleSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.defs#submodule"), + ), + /** + * Branch to track in the submodule + */ + branch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Submodule name + */ + name: /*#__PURE__*/ v.string(), + /** + * Submodule repository URL + */ + url: /*#__PURE__*/ v.string(), +}); +const _tagSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.defs#tag"), + ), + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * tag name + */ + name: /*#__PURE__*/ v.string(), + get tagger() { + return signatureSchema; + }, + target: /*#__PURE__*/ v.unknown(), +}); + +type branch$schematype = typeof _branchSchema; +type commit$schematype = typeof _commitSchema; +type hash$schematype = typeof _hashSchema; +type signature$schematype = typeof _signatureSchema; +type submodule$schematype = typeof _submoduleSchema; +type tag$schematype = typeof _tagSchema; + +export interface branchSchema extends branch$schematype {} +export interface commitSchema extends commit$schematype {} +export interface hashSchema extends hash$schematype {} +export interface signatureSchema extends signature$schematype {} +export interface submoduleSchema extends submodule$schematype {} +export interface tagSchema extends tag$schematype {} + +export const branchSchema = _branchSchema as branchSchema; +export const commitSchema = _commitSchema as commitSchema; +export const hashSchema = _hashSchema as hashSchema; +export const signatureSchema = _signatureSchema as signatureSchema; +export const submoduleSchema = _submoduleSchema as submoduleSchema; +export const tagSchema = _tagSchema as tagSchema; + +export interface Branch extends v.InferInput {} +export interface Commit extends v.InferInput {} +export type Hash = v.InferInput; +export interface Signature extends v.InferInput {} +export interface Submodule extends v.InferInput {} +export interface Tag extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getArchive.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getArchive.ts new file mode 100644 index 00000000..ec9827b4 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getArchive.ts @@ -0,0 +1,52 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getArchive", { + params: /*#__PURE__*/ v.object({ + /** + * Archive format + * @default "tar.gz" + */ + format: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum([ + "tar", + "tar.bz2", + "tar.gz", + "tar.xz", + "zip", + ]), + "tar.gz", + ), + /** + * Prefix for files in the archive + */ + prefix: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getArchive": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBlob.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBlob.ts new file mode 100644 index 00000000..418e059c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBlob.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getBlob", { + params: /*#__PURE__*/ v.object({ + /** + * Path within the repository tree + */ + path: /*#__PURE__*/ v.string(), + /** + * Git reference (branch, tag, or commit SHA) + * @default "HEAD" + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), "HEAD"), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getBlob": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBranch.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBranch.ts new file mode 100644 index 00000000..e816e0af --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getBranch.ts @@ -0,0 +1,56 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitTempDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getBranch", { + params: /*#__PURE__*/ v.object({ + /** + * Branch name to get information for + */ + name: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get author() { + return /*#__PURE__*/ v.optional(ShTangledGitTempDefs.signatureSchema); + }, + /** + * Latest commit hash on this branch + */ + hash: /*#__PURE__*/ v.string(), + /** + * Latest commit message + */ + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Branch name + */ + name: /*#__PURE__*/ v.string(), + /** + * Timestamp of latest commit + */ + when: /*#__PURE__*/ v.datetimeString(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getBranch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getCommit.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getCommit.ts new file mode 100644 index 00000000..b1cc0d44 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getCommit.ts @@ -0,0 +1,38 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitTempDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getCommit", { + params: /*#__PURE__*/ v.object({ + /** + * reference name to resolve + */ + ref: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + get schema() { + return ShTangledGitTempDefs.commitSchema; + }, + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getCommit": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getDiff.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getDiff.ts new file mode 100644 index 00000000..4260bb9d --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getDiff.ts @@ -0,0 +1,38 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getDiff", { + params: /*#__PURE__*/ v.object({ + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + /** + * First revision (commit, branch, or tag) + */ + rev1: /*#__PURE__*/ v.string(), + /** + * Second revision (commit, branch, or tag) + */ + rev2: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getDiff": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getEntry.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getEntry.ts new file mode 100644 index 00000000..656c5942 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getEntry.ts @@ -0,0 +1,68 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitTempDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getEntry", { + params: /*#__PURE__*/ v.object({ + /** + * path of the entity + */ + path: /*#__PURE__*/ v.string(), + /** + * Git revision (branch, tag, or commit id) + * @default "HEAD" + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), "HEAD"), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get lastCommit() { + return /*#__PURE__*/ v.optional(ShTangledGitTempDefs.commitSchema); + }, + mode: /*#__PURE__*/ v.literalEnum([ + "0040000", + "0100644", + "0100664", + "0100755", + "0120000", + "0160000", + ]), + /** + * The file name + */ + name: /*#__PURE__*/ v.string(), + oid: /*#__PURE__*/ v.string(), + /** + * Blob size + */ + size: /*#__PURE__*/ v.integer(), + /** + * Submodule information if path is a submodule + */ + get submodule() { + return /*#__PURE__*/ v.optional(ShTangledGitTempDefs.submoduleSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getEntry": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getHead.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getHead.ts new file mode 100644 index 00000000..d1ccbdf6 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getHead.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitTempDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getHead", { + params: /*#__PURE__*/ v.object({ + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + get schema() { + return ShTangledGitTempDefs.branchSchema; + }, + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getHead": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTag.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTag.ts new file mode 100644 index 00000000..b87cc31b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTag.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getTag", { + params: /*#__PURE__*/ v.object({ + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + /** + * Name of tag, such as v1.3.0 + */ + tag: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getTag": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTree.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTree.ts new file mode 100644 index 00000000..9a52e351 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getTree.ts @@ -0,0 +1,152 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _lastCommitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.getTree#lastCommit"), + ), + get author() { + return /*#__PURE__*/ v.optional(signatureSchema); + }, + /** + * Commit hash + */ + hash: /*#__PURE__*/ v.string(), + /** + * Commit message + */ + message: /*#__PURE__*/ v.string(), + /** + * Commit timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.getTree", { + params: /*#__PURE__*/ v.object({ + /** + * Path within the repository tree + * @default "" + */ + path: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), ""), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Parent directory path + */ + dotdot: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get files() { + return /*#__PURE__*/ v.array(treeEntrySchema); + }, + get lastCommit() { + return /*#__PURE__*/ v.optional(lastCommitSchema); + }, + /** + * The parent path in the tree + */ + parent: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Readme for this file tree + */ + get readme() { + return /*#__PURE__*/ v.optional(readmeSchema); + }, + /** + * The git reference used + */ + ref: /*#__PURE__*/ v.string(), + }), + }, +}); +const _readmeSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.getTree#readme"), + ), + /** + * Contents of the readme file + */ + contents: /*#__PURE__*/ v.string(), + /** + * Name of the readme file + */ + filename: /*#__PURE__*/ v.string(), +}); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.getTree#signature"), + ), + /** + * Author email + */ + email: /*#__PURE__*/ v.string(), + /** + * Author name + */ + name: /*#__PURE__*/ v.string(), + /** + * Author timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _treeEntrySchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.getTree#treeEntry"), + ), + get last_commit() { + return /*#__PURE__*/ v.optional(lastCommitSchema); + }, + /** + * File mode + */ + mode: /*#__PURE__*/ v.string(), + /** + * Relative file or directory name + */ + name: /*#__PURE__*/ v.string(), + /** + * File size in bytes + */ + size: /*#__PURE__*/ v.integer(), +}); + +type lastCommit$schematype = typeof _lastCommitSchema; +type main$schematype = typeof _mainSchema; +type readme$schematype = typeof _readmeSchema; +type signature$schematype = typeof _signatureSchema; +type treeEntry$schematype = typeof _treeEntrySchema; + +export interface lastCommitSchema extends lastCommit$schematype {} +export interface mainSchema extends main$schematype {} +export interface readmeSchema extends readme$schematype {} +export interface signatureSchema extends signature$schematype {} +export interface treeEntrySchema extends treeEntry$schematype {} + +export const lastCommitSchema = _lastCommitSchema as lastCommitSchema; +export const mainSchema = _mainSchema as mainSchema; +export const readmeSchema = _readmeSchema as readmeSchema; +export const signatureSchema = _signatureSchema as signatureSchema; +export const treeEntrySchema = _treeEntrySchema as treeEntrySchema; + +export interface LastCommit extends v.InferInput {} +export interface Readme extends v.InferInput {} +export interface Signature extends v.InferInput {} +export interface TreeEntry extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.getTree": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listBranches.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listBranches.ts new file mode 100644 index 00000000..d37053de --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listBranches.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.listBranches", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of branches to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.listBranches": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listCommits.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listCommits.ts new file mode 100644 index 00000000..9b7a3a6a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listCommits.ts @@ -0,0 +1,50 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.listCommits", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor (commit SHA) + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of commits to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.listCommits": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listLanguages.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listLanguages.ts new file mode 100644 index 00000000..dcf812ca --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listLanguages.ts @@ -0,0 +1,66 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _languageSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.temp.listLanguages#language"), + ), + /** + * Programming language name + */ + name: /*#__PURE__*/ v.string(), + /** + * Total size of files in this language (bytes) + */ + size: /*#__PURE__*/ v.integer(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.listLanguages", { + params: /*#__PURE__*/ v.object({ + /** + * Git reference (branch, tag, or commit SHA) + * @default "HEAD" + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), "HEAD"), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get languages() { + return /*#__PURE__*/ v.array(languageSchema); + }, + /** + * The git reference used + */ + ref: /*#__PURE__*/ v.string(), + /** + * Total size of all analyzed files in bytes + */ + total: /*#__PURE__*/ v.integer(), + }), + }, +}); + +type language$schematype = typeof _languageSchema; +type main$schematype = typeof _mainSchema; + +export interface languageSchema extends language$schematype {} +export interface mainSchema extends main$schematype {} + +export const languageSchema = _languageSchema as languageSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface Language extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.listLanguages": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listTags.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listTags.ts new file mode 100644 index 00000000..8465f80c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/listTags.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.git.temp.listTags", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of tags to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.git.temp.listTags": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/follow.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/follow.ts new file mode 100644 index 00000000..4653d964 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/follow.ts @@ -0,0 +1,26 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.graph.follow"), + createdAt: /*#__PURE__*/ v.datetimeString(), + subject: /*#__PURE__*/ v.didString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.graph.follow": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollows.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollows.ts new file mode 100644 index 00000000..4399ae7f --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollows.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.graph.listFollows#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.graph.follow record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.graph.listFollows", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Followee DID whose inbound follows to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.graph.listFollows": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollowsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollowsBy.ts new file mode 100644 index 00000000..eaa43451 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/listFollowsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGraphListFollows from "./listFollows.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.graph.listFollowsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose follow authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledGraphListFollows.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.graph.listFollowsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouches.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouches.ts new file mode 100644 index 00000000..6cbbf1bc --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouches.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.graph.listVouches#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.graph.vouch record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.graph.listVouches", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Vouchee DID whose inbound vouches to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.graph.listVouches": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouchesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouchesBy.ts new file mode 100644 index 00000000..27cb5356 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/listVouchesBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGraphListVouches from "./listVouches.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.graph.listVouchesBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose vouch authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledGraphListVouches.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.graph.listVouchesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/graph/vouch.ts b/web/src/lib/api/lexicons/types/sh/tangled/graph/vouch.ts new file mode 100644 index 00000000..03d06a97 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/graph/vouch.ts @@ -0,0 +1,54 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.graph.vouch"), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * Optional list of ATURIs serving as evidence for this vouch (ex. issues, PRs) + * @maxLength 10 + */ + evidences: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + [/*#__PURE__*/ v.arrayLength(0, 10)], + ), + ), + /** + * Whether this user is being vouched for or denounced + * @default "vouch" + */ + kind: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["denounce", "vouch"]), + "vouch", + ), + /** + * The reason for this vouch/denouncement + * @maxLength 2560 + * @maxGraphemes 256 + */ + reason: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), + ), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.graph.vouch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot.ts new file mode 100644 index 00000000..5517cacb --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot.ts @@ -0,0 +1,25 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.knot"), + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.knot": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/addMember.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/addMember.ts new file mode 100644 index 00000000..d912e69b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/addMember.ts @@ -0,0 +1,32 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.knot.addMember", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the member to add + */ + subject: /*#__PURE__*/ v.didString(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.knot.addMember": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/listKeys.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/listKeys.ts new file mode 100644 index 00000000..d38c5aee --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/listKeys.ts @@ -0,0 +1,76 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.knot.listKeys", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of keys to return + * @minimum 1 + * @maximum 1000 + * @default 100 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 100, + ), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Pagination cursor for next page + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get keys() { + return /*#__PURE__*/ v.array(publicKeySchema); + }, + }), + }, +}); +const _publicKeySchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.listKeys#publicKey"), + ), + /** + * Key upload timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * DID associated with the public key + */ + did: /*#__PURE__*/ v.didString(), + /** + * Public key contents + * @maxLength 4096 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 4096), + ]), +}); + +type main$schematype = typeof _mainSchema; +type publicKey$schematype = typeof _publicKeySchema; + +export interface mainSchema extends main$schematype {} +export interface publicKeySchema extends publicKey$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const publicKeySchema = _publicKeySchema as publicKeySchema; + +export interface PublicKey extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.knot.listKeys": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/listKnots.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/listKnots.ts new file mode 100644 index 00000000..1f103aab --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/listKnots.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.listKnots#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.knot record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.knot.listKnots", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Owner DID whose knot records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.knot.listKnots": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembers.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembers.ts new file mode 100644 index 00000000..03b463fb --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembers.ts @@ -0,0 +1,89 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.listMembers#listItem"), + ), + /** + * DID that added this member + */ + addedBy: /*#__PURE__*/ v.didString(), + /** + * Optional record CID for record-backed indexers + */ + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + /** + * When the member was added + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * DID of the member + */ + subject: /*#__PURE__*/ v.didString(), + /** + * Optional record AT-URI for record-backed indexers + */ + uri: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.knot.listMembers", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Knot identifier whose member records to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.knot.listMembers": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembersBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembersBy.ts new file mode 100644 index 00000000..9ebc61a6 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/listMembersBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledKnotListMembers from "./listMembers.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.knot.listMembersBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose knot-member authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledKnotListMembers.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.knot.listMembersBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/member.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/member.ts new file mode 100644 index 00000000..5a811b11 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/member.ts @@ -0,0 +1,30 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.knot.member"), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * domain that this member now belongs to + */ + domain: /*#__PURE__*/ v.string(), + subject: /*#__PURE__*/ v.didString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.knot.member": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/removeMember.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/removeMember.ts new file mode 100644 index 00000000..1e8861d2 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/removeMember.ts @@ -0,0 +1,32 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.knot.removeMember", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the member to remove + */ + subject: /*#__PURE__*/ v.didString(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.knot.removeMember": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/subscribeRepos.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/subscribeRepos.ts new file mode 100644 index 00000000..4ad55039 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/subscribeRepos.ts @@ -0,0 +1,90 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitRefUpdate from "../git/refUpdate.js"; + +const _gitSync1Schema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.subscribeRepos#gitSync1"), + ), + /** + * Repository DID identifier + */ + did: /*#__PURE__*/ v.didString(), + /** + * The stream sequence number of this message. + */ + seq: /*#__PURE__*/ v.integer(), +}); +const _gitSync2Schema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.subscribeRepos#gitSync2"), + ), + /** + * Repository AT-URI identifier + */ + repo: /*#__PURE__*/ v.resourceUriString(), + /** + * The stream sequence number of this message. + */ + seq: /*#__PURE__*/ v.integer(), +}); +const _identitySchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.knot.subscribeRepos#identity"), + ), + /** + * Repository DID identifier + */ + did: /*#__PURE__*/ v.didString(), + /** + * The stream sequence number of this message. + */ + seq: /*#__PURE__*/ v.integer(), + time: /*#__PURE__*/ v.datetimeString(), +}); +const _mainSchema = /*#__PURE__*/ v.subscription( + "sh.tangled.knot.subscribeRepos", + { + params: /*#__PURE__*/ v.object({ + /** + * The last known event seq number to backfill from. + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + }), + get message() { + return /*#__PURE__*/ v.variant([ + ShTangledGitRefUpdate.mainSchema, + identitySchema, + ]); + }, + }, +); + +type gitSync1$schematype = typeof _gitSync1Schema; +type gitSync2$schematype = typeof _gitSync2Schema; +type identity$schematype = typeof _identitySchema; +type main$schematype = typeof _mainSchema; + +export interface gitSync1Schema extends gitSync1$schematype {} +export interface gitSync2Schema extends gitSync2$schematype {} +export interface identitySchema extends identity$schematype {} +export interface mainSchema extends main$schematype {} + +export const gitSync1Schema = _gitSync1Schema as gitSync1Schema; +export const gitSync2Schema = _gitSync2Schema as gitSync2Schema; +export const identitySchema = _identitySchema as identitySchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface GitSync1 extends v.InferInput {} +export interface GitSync2 extends v.InferInput {} +export interface Identity extends v.InferInput {} + +export interface $params extends v.InferInput {} +export type $message = v.InferInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCSubscriptions { + "sh.tangled.knot.subscribeRepos": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/knot/version.ts b/web/src/lib/api/lexicons/types/sh/tangled/knot/version.ts new file mode 100644 index 00000000..9f3a1a75 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/knot/version.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.knot.version", { + params: null, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Protocol capability tokens this knot implements, such as knot-acl. Knots that omit this field are treated as legacy. + */ + capabilities: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + version: /*#__PURE__*/ v.string(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.knot.version": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/label/definition.ts b/web/src/lib/api/lexicons/types/sh/tangled/label/definition.ts new file mode 100644 index 00000000..44c8c6f0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/label/definition.ts @@ -0,0 +1,74 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.label.definition"), + /** + * The hex value for the background color for the label. Appviews may choose to respect this. + */ + color: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * Whether this label can be repeated for a given entity, eg.: [reviewer:foo, reviewer:bar] + */ + multiple: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + /** + * The display name of this label. + * @minGraphemes 1 + * @maxGraphemes 40 + */ + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1, 40), + ]), + /** + * The areas of the repo this label may apply to, eg.: sh.tangled.repo.issue. Appviews may choose to respect this. + */ + scope: /*#__PURE__*/ v.array(/*#__PURE__*/ v.nsidString()), + /** + * The type definition of this label. Appviews may allow sorting for certain types. + */ + get valueType() { + return valueTypeSchema; + }, + }), +); +const _valueTypeSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.label.definition#valueType"), + ), + /** + * Closed set of values that this label can take. + */ + enum: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + /** + * An optional constraint that can be applied on string concrete types. + */ + format: /*#__PURE__*/ v.literalEnum(["any", "did", "nsid"]), + /** + * The concrete type of this label's value. + */ + type: /*#__PURE__*/ v.literalEnum(["boolean", "integer", "null", "string"]), +}); + +type main$schematype = typeof _mainSchema; +type valueType$schematype = typeof _valueTypeSchema; + +export interface mainSchema extends main$schematype {} +export interface valueTypeSchema extends valueType$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const valueTypeSchema = _valueTypeSchema as valueTypeSchema; + +export interface Main extends v.InferInput {} +export interface ValueType extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.label.definition": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/label/listDefinitions.ts b/web/src/lib/api/lexicons/types/sh/tangled/label/listDefinitions.ts new file mode 100644 index 00000000..c517ddcc --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/label/listDefinitions.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.label.listDefinitions#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.label.definition record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.label.listDefinitions", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Scope identifier whose label definitions to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.label.listDefinitions": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/label/listOps.ts b/web/src/lib/api/lexicons/types/sh/tangled/label/listOps.ts new file mode 100644 index 00000000..45f98934 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/label/listOps.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.label.listOps#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.label.op record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.label.listOps", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Scope identifier whose label op records to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.label.listOps": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/label/listOpsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/label/listOpsBy.ts new file mode 100644 index 00000000..c57091b8 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/label/listOpsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledLabelListOps from "./listOps.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.label.listOpsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose label-op authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledLabelListOps.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.label.listOpsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/label/op.ts b/web/src/lib/api/lexicons/types/sh/tangled/label/op.ts new file mode 100644 index 00000000..427ea153 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/label/op.ts @@ -0,0 +1,52 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.label.op"), + get add() { + return /*#__PURE__*/ v.array(operandSchema); + }, + get delete() { + return /*#__PURE__*/ v.array(operandSchema); + }, + performedAt: /*#__PURE__*/ v.datetimeString(), + /** + * The subject (task, pull or discussion) of this label. Appviews may apply a `scope` check and refuse this op. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), +); +const _operandSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.label.op#operand"), + ), + /** + * ATURI to the label definition + */ + key: /*#__PURE__*/ v.resourceUriString(), + /** + * Stringified value of the label. This is first unstringed by appviews and then interpreted as a concrete value. + */ + value: /*#__PURE__*/ v.string(), +}); + +type main$schematype = typeof _mainSchema; +type operand$schematype = typeof _operandSchema; + +export interface mainSchema extends main$schematype {} +export interface operandSchema extends operand$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const operandSchema = _operandSchema as operandSchema; + +export interface Main extends v.InferInput {} +export interface Operand extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.label.op": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/markup/markdown.ts b/web/src/lib/api/lexicons/types/sh/tangled/markup/markdown.ts new file mode 100644 index 00000000..7bc4f5d9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/markup/markdown.ts @@ -0,0 +1,35 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.markup.markdown"), + ), + /** + * list of blobs referenced in markdown + */ + blobs: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobSize(1000000), + /*#__PURE__*/ v.blobAccept(["image/*"]), + ]), + ), + ), + /** + * Original Markdown before post-processing. Used to restore original input on edit. + */ + original: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Final post-processed markdown content that will be rendered + */ + text: /*#__PURE__*/ v.string(), +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/owner.ts b/web/src/lib/api/lexicons/types/sh/tangled/owner.ts new file mode 100644 index 00000000..f23e8589 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/owner.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.owner", { + params: null, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + owner: /*#__PURE__*/ v.didString(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.owner": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts new file mode 100644 index 00000000..0b4b141e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts @@ -0,0 +1,194 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _cloneOptsSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#cloneOpts"), + ), + depth: /*#__PURE__*/ v.integer(), + skip: /*#__PURE__*/ v.boolean(), + submodules: /*#__PURE__*/ v.boolean(), + tags: /*#__PURE__*/ v.boolean(), +}); +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.pipeline"), + get triggerMetadata() { + return triggerMetadataSchema; + }, + get workflows() { + return /*#__PURE__*/ v.array(workflowSchema); + }, + }), +); +const _manualTriggerDataSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#manualTriggerData"), + ), + get inputs() { + return /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(pairSchema)); + }, + /** + * optional ref the SHA was resolved from, for display and TANGLED_REF + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * commit SHA the manual run targets + * @minLength 40 + * @maxLength 40 + */ + sha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), +}); +const _pairSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#pair"), + ), + key: /*#__PURE__*/ v.string(), + value: /*#__PURE__*/ v.string(), +}); +const _pullRequestTriggerDataSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#pullRequestTriggerData"), + ), + /** + * AT-URI of the sh.tangled.repo.pull record this run belongs to + */ + pull: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + sourceBranch: /*#__PURE__*/ v.string(), + /** + * @minLength 40 + * @maxLength 40 + */ + sourceSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + targetBranch: /*#__PURE__*/ v.string(), +}); +const _pushTriggerDataSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#pushTriggerData"), + ), + /** + * @minLength 40 + * @maxLength 40 + */ + newSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + /** + * @minLength 40 + * @maxLength 40 + */ + oldSha: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 40), + ]), + ref: /*#__PURE__*/ v.string(), +}); +const _triggerMetadataSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#triggerMetadata"), + ), + kind: /*#__PURE__*/ v.literalEnum(["manual", "pull_request", "push"]), + get manual() { + return /*#__PURE__*/ v.optional(manualTriggerDataSchema); + }, + get pullRequest() { + return /*#__PURE__*/ v.optional(pullRequestTriggerDataSchema); + }, + get push() { + return /*#__PURE__*/ v.optional(pushTriggerDataSchema); + }, + get repo() { + return triggerRepoSchema; + }, + /** + * Repository DID that code and workflow definitions are checked out from, when different from repo (e.g. a fork's commit for a fork-based manual trigger). If absent, source uses repo itself. + */ + sourceRepo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), +}); +const _triggerRepoSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#triggerRepo"), + ), + defaultBranch: /*#__PURE__*/ v.string(), + did: /*#__PURE__*/ v.didString(), + knot: /*#__PURE__*/ v.string(), + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * DID of the repo itself + */ + repoDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), +}); +const _workflowSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline#workflow"), + ), + get clone() { + return cloneOptsSchema; + }, + engine: /*#__PURE__*/ v.string(), + name: /*#__PURE__*/ v.string(), + raw: /*#__PURE__*/ v.string(), +}); + +type cloneOpts$schematype = typeof _cloneOptsSchema; +type main$schematype = typeof _mainSchema; +type manualTriggerData$schematype = typeof _manualTriggerDataSchema; +type pair$schematype = typeof _pairSchema; +type pullRequestTriggerData$schematype = typeof _pullRequestTriggerDataSchema; +type pushTriggerData$schematype = typeof _pushTriggerDataSchema; +type triggerMetadata$schematype = typeof _triggerMetadataSchema; +type triggerRepo$schematype = typeof _triggerRepoSchema; +type workflow$schematype = typeof _workflowSchema; + +export interface cloneOptsSchema extends cloneOpts$schematype {} +export interface mainSchema extends main$schematype {} +export interface manualTriggerDataSchema extends manualTriggerData$schematype {} +export interface pairSchema extends pair$schematype {} +export interface pullRequestTriggerDataSchema extends pullRequestTriggerData$schematype {} +export interface pushTriggerDataSchema extends pushTriggerData$schematype {} +export interface triggerMetadataSchema extends triggerMetadata$schematype {} +export interface triggerRepoSchema extends triggerRepo$schematype {} +export interface workflowSchema extends workflow$schematype {} + +export const cloneOptsSchema = _cloneOptsSchema as cloneOptsSchema; +export const mainSchema = _mainSchema as mainSchema; +export const manualTriggerDataSchema = + _manualTriggerDataSchema as manualTriggerDataSchema; +export const pairSchema = _pairSchema as pairSchema; +export const pullRequestTriggerDataSchema = + _pullRequestTriggerDataSchema as pullRequestTriggerDataSchema; +export const pushTriggerDataSchema = + _pushTriggerDataSchema as pushTriggerDataSchema; +export const triggerMetadataSchema = + _triggerMetadataSchema as triggerMetadataSchema; +export const triggerRepoSchema = _triggerRepoSchema as triggerRepoSchema; +export const workflowSchema = _workflowSchema as workflowSchema; + +export interface CloneOpts extends v.InferInput {} +export interface Main extends v.InferInput {} +export interface ManualTriggerData extends v.InferInput< + typeof manualTriggerDataSchema +> {} +export interface Pair extends v.InferInput {} +export interface PullRequestTriggerData extends v.InferInput< + typeof pullRequestTriggerDataSchema +> {} +export interface PushTriggerData extends v.InferInput< + typeof pushTriggerDataSchema +> {} +export interface TriggerMetadata extends v.InferInput< + typeof triggerMetadataSchema +> {} +export interface TriggerRepo extends v.InferInput {} +export interface Workflow extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.pipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/cancelPipeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/cancelPipeline.ts new file mode 100644 index 00000000..49b1bfed --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/cancelPipeline.ts @@ -0,0 +1,43 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "sh.tangled.pipeline.cancelPipeline", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * pipeline at-uri + */ + pipeline: /*#__PURE__*/ v.resourceUriString(), + /** + * repo at-uri, spindle can't resolve repo from pipeline at-uri yet + */ + repo: /*#__PURE__*/ v.resourceUriString(), + /** + * workflow name + */ + workflow: /*#__PURE__*/ v.string(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.pipeline.cancelPipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelines.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelines.ts new file mode 100644 index 00000000..4a8ea0a4 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelines.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline.listPipelines#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.pipeline record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.pipeline.listPipelines", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Repo or spindle identifier whose pipeline records to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.pipeline.listPipelines": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelinesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelinesBy.ts new file mode 100644 index 00000000..6eb88db6 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listPipelinesBy.ts @@ -0,0 +1,65 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledPipelineListPipelines from "./listPipelines.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "sh.tangled.pipeline.listPipelinesBy", + { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose pipeline authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledPipelineListPipelines.listItemSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.pipeline.listPipelinesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatuses.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatuses.ts new file mode 100644 index 00000000..e82854aa --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatuses.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pipeline.listStatuses#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.pipeline.status record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.pipeline.listStatuses", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Pipeline AT-URI whose status records to list. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.pipeline.listStatuses": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatusesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatusesBy.ts new file mode 100644 index 00000000..d878d4e0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/listStatusesBy.ts @@ -0,0 +1,65 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledPipelineListStatuses from "./listStatuses.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "sh.tangled.pipeline.listStatusesBy", + { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose pipeline-status authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledPipelineListStatuses.listItemSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.pipeline.listStatusesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pipeline/status.ts b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/status.ts new file mode 100644 index 00000000..80629c99 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline/status.ts @@ -0,0 +1,55 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.pipeline.status"), + /** + * time of creation of this status update + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * error message if failed + */ + error: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * exit code if failed + */ + exitCode: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * ATURI of the pipeline + */ + pipeline: /*#__PURE__*/ v.resourceUriString(), + /** + * status of the workflow + */ + status: /*#__PURE__*/ v.literalEnum([ + "cancelled", + "failed", + "pending", + "running", + "success", + "timeout", + ]), + /** + * name of the workflow within this pipeline + */ + workflow: /*#__PURE__*/ v.resourceUriString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.pipeline.status": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/publicKey.ts b/web/src/lib/api/lexicons/types/sh/tangled/publicKey.ts new file mode 100644 index 00000000..85e9b296 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/publicKey.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.publicKey"), + /** + * key upload timestamp + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * public key contents + * @maxLength 4096 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 4096), + ]), + /** + * human-readable name for this key + */ + name: /*#__PURE__*/ v.string(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.publicKey": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts b/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts new file mode 100644 index 00000000..88509817 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.publicKey.listKeys#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.publicKey record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.publicKey.listKeys", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Owner DID whose public-key records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.publicKey.listKeys": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo.ts new file mode 100644 index 00000000..8438ff41 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo.ts @@ -0,0 +1,78 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo"), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * @minGraphemes 1 + * @maxGraphemes 140 + */ + description: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1, 140), + ]), + ), + /** + * knot where the repo was created + */ + knot: /*#__PURE__*/ v.string(), + /** + * List of labels that this repo subscribes to + */ + labels: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + ), + /** + * Cosmetic name of the repo. + */ + name: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * DID of the repo itself, if assigned + */ + repoDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * source of the repo + */ + source: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), + /** + * CI runner to send jobs to and receive results from + */ + spindle: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Topics related to the repo + * @maxLength 50 + */ + topics: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 50), + ]), + ), + [/*#__PURE__*/ v.arrayLength(0, 50)], + ), + ), + /** + * Any URI related to the repo + */ + website: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/addCollaborator.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/addCollaborator.ts new file mode 100644 index 00000000..6bc301ed --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/addCollaborator.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "sh.tangled.repo.addCollaborator", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository to add the collaborator to + */ + repo: /*#__PURE__*/ v.didString(), + /** + * DID of the collaborator to add + */ + subject: /*#__PURE__*/ v.didString(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.addCollaborator": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/addSecret.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/addSecret.ts new file mode 100644 index 00000000..74aee757 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/addSecret.ts @@ -0,0 +1,43 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.addSecret", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * @minLength 1 + * @maxLength 50 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 50), + ]), + repo: /*#__PURE__*/ v.resourceUriString(), + /** + * @minLength 1 + * @maxLength 200 + */ + value: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 200), + ]), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.addSecret": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/archive.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/archive.ts new file mode 100644 index 00000000..40a66617 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/archive.ts @@ -0,0 +1,52 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.archive", { + params: /*#__PURE__*/ v.object({ + /** + * Archive format + * @default "tar.gz" + */ + format: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum([ + "tar", + "tar.bz2", + "tar.gz", + "tar.xz", + "zip", + ]), + "tar.gz", + ), + /** + * Prefix for files in the archive + */ + prefix: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.archive": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/artifact.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/artifact.ts new file mode 100644 index 00000000..53b37ad6 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/artifact.ts @@ -0,0 +1,52 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.artifact"), + /** + * the artifact + * @maxSize 52428800 + */ + artifact: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobSize(52428800), + ]), + /** + * time of creation of this artifact + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * name of the artifact + */ + name: /*#__PURE__*/ v.string(), + /** + * repo that this artifact is being uploaded to + */ + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + repoDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * hash of the tag object that this artifact is attached to (only annotated tags are supported) + * @minLength 20 + * @maxLength 20 + */ + tag: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.bytes(), [ + /*#__PURE__*/ v.bytesSize(20, 20), + ]), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.artifact": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/blob.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/blob.ts new file mode 100644 index 00000000..3df82db7 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/blob.ts @@ -0,0 +1,152 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _lastCommitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.blob#lastCommit"), + ), + get author() { + return /*#__PURE__*/ v.optional(signatureSchema); + }, + /** + * Commit hash + */ + hash: /*#__PURE__*/ v.string(), + /** + * Commit message + */ + message: /*#__PURE__*/ v.string(), + /** + * Commit timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.blob", { + params: /*#__PURE__*/ v.object({ + /** + * Path to the file within the repository + */ + path: /*#__PURE__*/ v.string(), + /** + * Return raw file content instead of JSON response + * @default false + */ + raw: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean(), false), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * File content (base64 encoded for binary files) + */ + content: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Content encoding + */ + encoding: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["base64", "utf-8"]), + ), + fileTooLarge: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + /** + * Whether the file is binary + */ + isBinary: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + get lastCommit() { + return /*#__PURE__*/ v.optional(lastCommitSchema); + }, + /** + * MIME type of the file + */ + mimeType: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * The file path + */ + path: /*#__PURE__*/ v.string(), + /** + * The git reference used + */ + ref: /*#__PURE__*/ v.string(), + /** + * File size in bytes + */ + size: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * Submodule information if path is a submodule + */ + get submodule() { + return /*#__PURE__*/ v.optional(submoduleSchema); + }, + }), + }, +}); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.blob#signature"), + ), + /** + * Author email + */ + email: /*#__PURE__*/ v.string(), + /** + * Author name + */ + name: /*#__PURE__*/ v.string(), + /** + * Author timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _submoduleSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.blob#submodule"), + ), + /** + * Branch to track in the submodule + */ + branch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Submodule name + */ + name: /*#__PURE__*/ v.string(), + /** + * Submodule repository URL + */ + url: /*#__PURE__*/ v.string(), +}); + +type lastCommit$schematype = typeof _lastCommitSchema; +type main$schematype = typeof _mainSchema; +type signature$schematype = typeof _signatureSchema; +type submodule$schematype = typeof _submoduleSchema; + +export interface lastCommitSchema extends lastCommit$schematype {} +export interface mainSchema extends main$schematype {} +export interface signatureSchema extends signature$schematype {} +export interface submoduleSchema extends submodule$schematype {} + +export const lastCommitSchema = _lastCommitSchema as lastCommitSchema; +export const mainSchema = _mainSchema as mainSchema; +export const signatureSchema = _signatureSchema as signatureSchema; +export const submoduleSchema = _submoduleSchema as submoduleSchema; + +export interface LastCommit extends v.InferInput {} +export interface Signature extends v.InferInput {} +export interface Submodule extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.blob": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/branch.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/branch.ts new file mode 100644 index 00000000..153b7db3 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/branch.ts @@ -0,0 +1,85 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.branch", { + params: /*#__PURE__*/ v.object({ + /** + * Branch name to get information for + */ + name: /*#__PURE__*/ v.string(), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get author() { + return /*#__PURE__*/ v.optional(signatureSchema); + }, + /** + * Latest commit hash on this branch + */ + hash: /*#__PURE__*/ v.string(), + /** + * Whether this is the default branch + */ + isDefault: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + /** + * Latest commit message + */ + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Branch name + */ + name: /*#__PURE__*/ v.string(), + /** + * Short commit hash + */ + shortHash: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Timestamp of latest commit + */ + when: /*#__PURE__*/ v.datetimeString(), + }), + }, +}); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.branch#signature"), + ), + /** + * Author email + */ + email: /*#__PURE__*/ v.string(), + /** + * Author name + */ + name: /*#__PURE__*/ v.string(), + /** + * Author timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); + +type main$schematype = typeof _mainSchema; +type signature$schematype = typeof _signatureSchema; + +export interface mainSchema extends main$schematype {} +export interface signatureSchema extends signature$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const signatureSchema = _signatureSchema as signatureSchema; + +export interface Signature extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.branch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/branches.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/branches.ts new file mode 100644 index 00000000..a0d768fd --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/branches.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.branches", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of branches to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.branches": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/collaborator.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaborator.ts new file mode 100644 index 00000000..e6095a48 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/collaborator.ts @@ -0,0 +1,30 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.collaborator"), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * repo DID to add this user to + */ + repo: /*#__PURE__*/ v.didString(), + subject: /*#__PURE__*/ v.didString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.collaborator": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/compare.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/compare.ts new file mode 100644 index 00000000..ef090a75 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/compare.ts @@ -0,0 +1,38 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.compare", { + params: /*#__PURE__*/ v.object({ + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + /** + * First revision (commit, branch, or tag) + */ + rev1: /*#__PURE__*/ v.string(), + /** + * Second revision (commit, branch, or tag) + */ + rev2: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.compare": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/create.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/create.ts new file mode 100644 index 00000000..b5973e87 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/create.ts @@ -0,0 +1,54 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.create", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Default branch to push to + */ + defaultBranch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Name of the repository + */ + name: /*#__PURE__*/ v.string(), + /** + * Optional user-provided did:web to use as the repo identity instead of minting a did:plc. + */ + repoDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Rkey of the repository record + */ + rkey: /*#__PURE__*/ v.string(), + /** + * A source URL to clone from, populate this when forking or importing a repository. + */ + source: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + repoDid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.create": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/delete.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/delete.ts new file mode 100644 index 00000000..ed9616ba --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/delete.ts @@ -0,0 +1,40 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.delete", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * Name of the repository to delete + */ + name: /*#__PURE__*/ v.string(), + /** + * Rkey of the repository record + */ + rkey: /*#__PURE__*/ v.string(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.delete": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/deleteBranch.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/deleteBranch.ts new file mode 100644 index 00000000..713ef7ac --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/deleteBranch.ts @@ -0,0 +1,30 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.deleteBranch", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + branch: /*#__PURE__*/ v.string(), + repo: /*#__PURE__*/ v.resourceUriString(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.deleteBranch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/describeRepo.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/describeRepo.ts new file mode 100644 index 00000000..2a5be2fb --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/describeRepo.ts @@ -0,0 +1,41 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.describeRepo", { + params: /*#__PURE__*/ v.object({ + /** + * DID of the git repo as minted by the knot + */ + repoDid: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the current owner according to the knot. + */ + ownerDid: /*#__PURE__*/ v.didString(), + repoDid: /*#__PURE__*/ v.didString(), + /** + * Current rkey of the sh.tangled.repo record tracked by this knot + */ + rkey: /*#__PURE__*/ v.recordKeyString(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.describeRepo": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/diff.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/diff.ts new file mode 100644 index 00000000..8b0487d1 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/diff.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.diff", { + params: /*#__PURE__*/ v.object({ + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.diff": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/forkStatus.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/forkStatus.ts new file mode 100644 index 00000000..cccdf408 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/forkStatus.ts @@ -0,0 +1,57 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.forkStatus", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Branch to check status for + */ + branch: /*#__PURE__*/ v.string(), + /** + * DID of the fork owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * Hidden ref to use for comparison + */ + hiddenRef: /*#__PURE__*/ v.string(), + /** + * Name of the forked repository + */ + name: /*#__PURE__*/ v.string(), + /** + * Source repository URL + */ + source: /*#__PURE__*/ v.string(), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Fork status: 0=UpToDate, 1=FastForwardable, 2=Conflict, 3=MissingBranch + */ + status: /*#__PURE__*/ v.integer(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.forkStatus": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/forkSync.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/forkSync.ts new file mode 100644 index 00000000..49ca762e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/forkSync.ts @@ -0,0 +1,44 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.forkSync", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Branch to sync + */ + branch: /*#__PURE__*/ v.string(), + /** + * DID of the fork owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * Name of the forked repository + */ + name: /*#__PURE__*/ v.string(), + /** + * AT-URI of the source repository + */ + source: /*#__PURE__*/ v.resourceUriString(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.forkSync": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/getDefaultBranch.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/getDefaultBranch.ts new file mode 100644 index 00000000..5115f561 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/getDefaultBranch.ts @@ -0,0 +1,77 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.getDefaultBranch", { + params: /*#__PURE__*/ v.object({ + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get author() { + return /*#__PURE__*/ v.optional(signatureSchema); + }, + /** + * Latest commit hash on default branch + */ + hash: /*#__PURE__*/ v.string(), + /** + * Latest commit message + */ + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Default branch name + */ + name: /*#__PURE__*/ v.string(), + /** + * Short commit hash + */ + shortHash: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Timestamp of latest commit + */ + when: /*#__PURE__*/ v.datetimeString(), + }), + }, +}); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.getDefaultBranch#signature"), + ), + /** + * Author email + */ + email: /*#__PURE__*/ v.string(), + /** + * Author name + */ + name: /*#__PURE__*/ v.string(), + /** + * Author timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); + +type main$schematype = typeof _mainSchema; +type signature$schematype = typeof _signatureSchema; + +export interface mainSchema extends main$schematype {} +export interface signatureSchema extends signature$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const signatureSchema = _signatureSchema as signatureSchema; + +export interface Signature extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.getDefaultBranch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/hiddenRef.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/hiddenRef.ts new file mode 100644 index 00000000..e2ba1111 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/hiddenRef.ts @@ -0,0 +1,57 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.hiddenRef", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Fork reference name + */ + forkRef: /*#__PURE__*/ v.string(), + /** + * Remote reference name + */ + remoteRef: /*#__PURE__*/ v.string(), + /** + * AT-URI of the repository + */ + repo: /*#__PURE__*/ v.resourceUriString(), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Error message if creation failed + */ + error: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * The created hidden ref name + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Whether the hidden ref was created successfully + */ + success: /*#__PURE__*/ v.boolean(), + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.hiddenRef": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue.ts new file mode 100644 index 00000000..cf3c2e9f --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.issue"), + body: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + createdAt: /*#__PURE__*/ v.datetimeString(), + mentions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), + ), + references: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + ), + repo: /*#__PURE__*/ v.didString(), + title: /*#__PURE__*/ v.string(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.issue": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/comment.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/comment.ts new file mode 100644 index 00000000..892efdd9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/comment.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.issue.comment"), + body: /*#__PURE__*/ v.string(), + createdAt: /*#__PURE__*/ v.datetimeString(), + issue: /*#__PURE__*/ v.resourceUriString(), + mentions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), + ), + references: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + ), + replyTo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.issue.comment": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStates.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStates.ts new file mode 100644 index 00000000..a9bc15e0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStates.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.issue.listStates#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo.issue.state record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.issue.listStates", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Issue AT-URI whose state records to list. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.issue.listStates": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStatesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStatesBy.ts new file mode 100644 index 00000000..7197451b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/listStatesBy.ts @@ -0,0 +1,65 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoIssueListStates from "./listStates.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "sh.tangled.repo.issue.listStatesBy", + { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose issue-state authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledRepoIssueListStates.listItemSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.issue.listStatesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state.ts new file mode 100644 index 00000000..56b00950 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state.ts @@ -0,0 +1,38 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.issue.state"), + createdAt: /*#__PURE__*/ v.datetimeString(), + issue: /*#__PURE__*/ v.resourceUriString(), + /** + * state of the issue + * @default "sh.tangled.repo.issue.state.open" + */ + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string< + | "sh.tangled.repo.issue.state.closed" + | "sh.tangled.repo.issue.state.open" + | (string & {}) + >(), + "sh.tangled.repo.issue.state.open", + ), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.issue.state": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/closed.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/closed.ts new file mode 100644 index 00000000..afbc605b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/closed.ts @@ -0,0 +1,14 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.literal( + "sh.tangled.repo.issue.state.closed", +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export type Main = v.InferInput; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/open.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/open.ts new file mode 100644 index 00000000..f9a889dd --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/issue/state/open.ts @@ -0,0 +1,12 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.literal("sh.tangled.repo.issue.state.open"); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export type Main = v.InferInput; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/languages.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/languages.ts new file mode 100644 index 00000000..9a668b2a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/languages.ts @@ -0,0 +1,88 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _languageSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.languages#language"), + ), + /** + * Hex color code for this language + */ + color: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * File extensions associated with this language + */ + extensions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), + ), + /** + * Number of files in this language + */ + fileCount: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * Programming language name + */ + name: /*#__PURE__*/ v.string(), + /** + * Percentage of total codebase (0-100) + */ + percentage: /*#__PURE__*/ v.integer(), + /** + * Total size of files in this language (bytes) + */ + size: /*#__PURE__*/ v.integer(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.languages", { + params: /*#__PURE__*/ v.object({ + /** + * Git reference (branch, tag, or commit SHA) + * @default "HEAD" + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), "HEAD"), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get languages() { + return /*#__PURE__*/ v.array(languageSchema); + }, + /** + * The git reference used + */ + ref: /*#__PURE__*/ v.string(), + /** + * Total number of files analyzed + */ + totalFiles: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * Total size of all analyzed files in bytes + */ + totalSize: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + }), + }, +}); + +type language$schematype = typeof _languageSchema; +type main$schematype = typeof _mainSchema; + +export interface languageSchema extends language$schematype {} +export interface mainSchema extends main$schematype {} + +export const languageSchema = _languageSchema as languageSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface Language extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.languages": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifacts.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifacts.ts new file mode 100644 index 00000000..a91e03c8 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifacts.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listArtifacts#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo.artifact record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listArtifacts", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Repo or release identifier whose artifacts to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listArtifacts": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifactsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifactsBy.ts new file mode 100644 index 00000000..1c5dfb00 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listArtifactsBy.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoListArtifacts from "./listArtifacts.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listArtifactsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose artifact authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledRepoListArtifacts.listItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listArtifactsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaborators.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaborators.ts new file mode 100644 index 00000000..9f222baf --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaborators.ts @@ -0,0 +1,89 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listCollaborators#listItem"), + ), + /** + * DID that added this collaborator + */ + addedBy: /*#__PURE__*/ v.didString(), + /** + * Optional record CID for record-backed indexers + */ + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + /** + * When the collaborator was added + */ + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * DID of the collaborator + */ + subject: /*#__PURE__*/ v.didString(), + /** + * Optional record AT-URI for record-backed indexers + */ + uri: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listCollaborators", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Repo DID whose collaborator records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listCollaborators": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaboratorsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaboratorsBy.ts new file mode 100644 index 00000000..ff193829 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listCollaboratorsBy.ts @@ -0,0 +1,65 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoListCollaborators from "./listCollaborators.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "sh.tangled.repo.listCollaboratorsBy", + { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose collaborator authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledRepoListCollaborators.listItemSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listCollaboratorsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssues.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssues.ts new file mode 100644 index 00000000..446ec80c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssues.ts @@ -0,0 +1,100 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _issueListItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listIssues#issueListItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + /** + * Count of sh.tangled.repo.issue.comment records targeting this issue. + * @minimum 0 + */ + commentCount: /*#__PURE__*/ v.integer(), + /** + * Latest derived state. + */ + state: /*#__PURE__*/ v.string<"closed" | "open" | (string & {})>(), + /** + * TID-derived timestamp of the latest state record. + */ + stateUpdatedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo.issue record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listIssues", { + params: /*#__PURE__*/ v.object({ + /** + * Restrict to issues authored by this user DID. + */ + author: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Restrict to issues whose latest derived state matches. + */ + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"closed" | "open" | (string & {})>(), + ), + /** + * Repo DID to list issues for + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(issueListItemSchema); + }, + }), + }, +}); + +type issueListItem$schematype = typeof _issueListItemSchema; +type main$schematype = typeof _mainSchema; + +export interface issueListItemSchema extends issueListItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const issueListItemSchema = _issueListItemSchema as issueListItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface IssueListItem extends v.InferInput< + typeof issueListItemSchema +> {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listIssues": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssuesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssuesBy.ts new file mode 100644 index 00000000..42c604eb --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listIssuesBy.ts @@ -0,0 +1,68 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoListIssues from "./listIssues.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listIssuesBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Restrict to issues whose latest derived state matches. + */ + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"closed" | "open" | (string & {})>(), + ), + /** + * Actor DID whose issue authorings to list + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledRepoListIssues.issueListItemSchema, + ); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listIssuesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listPulls.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listPulls.ts new file mode 100644 index 00000000..1de5ca28 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listPulls.ts @@ -0,0 +1,98 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listPulls", { + params: /*#__PURE__*/ v.object({ + /** + * Restrict to pulls authored by this user DID. + */ + author: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Restrict to pulls whose latest derived status matches. + */ + status: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"closed" | "merged" | "open" | (string & {})>(), + ), + /** + * Repo DID to list pulls for + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(pullListItemSchema); + }, + }), + }, +}); +const _pullListItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listPulls#pullListItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + /** + * Count of sh.tangled.repo.pull.comment records targeting this pull. + * @minimum 0 + */ + commentCount: /*#__PURE__*/ v.integer(), + /** + * Latest derived state. + */ + state: /*#__PURE__*/ v.string<"closed" | "merged" | "open" | (string & {})>(), + /** + * TID-derived timestamp of the latest pull status record. + */ + stateUpdatedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo.pull record + */ + value: /*#__PURE__*/ v.unknown(), +}); + +type main$schematype = typeof _mainSchema; +type pullListItem$schematype = typeof _pullListItemSchema; + +export interface mainSchema extends main$schematype {} +export interface pullListItemSchema extends pullListItem$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const pullListItemSchema = _pullListItemSchema as pullListItemSchema; + +export interface PullListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listPulls": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listPullsBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listPullsBy.ts new file mode 100644 index 00000000..6b5536fd --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listPullsBy.ts @@ -0,0 +1,66 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoListPulls from "./listPulls.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listPullsBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Restrict to pulls whose latest derived status matches. + */ + status: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"closed" | "merged" | "open" | (string & {})>(), + ), + /** + * Actor DID whose pull authorings to list + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(ShTangledRepoListPulls.pullListItemSchema); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listPullsBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listRepos.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listRepos.ts new file mode 100644 index 00000000..a67705ce --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listRepos.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listRepos#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listRepos", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Owner DID whose repo records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listRepos": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts new file mode 100644 index 00000000..c1cd48c1 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts @@ -0,0 +1,52 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listSecrets", { + params: /*#__PURE__*/ v.object({ + repo: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get secrets() { + return /*#__PURE__*/ v.array(secretSchema); + }, + }), + }, +}); +const _secretSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.listSecrets#secret"), + ), + createdAt: /*#__PURE__*/ v.datetimeString(), + createdBy: /*#__PURE__*/ v.didString(), + /** + * @minLength 1 + * @maxLength 50 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 50), + ]), + repo: /*#__PURE__*/ v.resourceUriString(), +}); + +type main$schematype = typeof _mainSchema; +type secret$schematype = typeof _secretSchema; + +export interface mainSchema extends main$schematype {} +export interface secretSchema extends secret$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const secretSchema = _secretSchema as secretSchema; + +export interface Secret extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.listSecrets": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/log.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/log.ts new file mode 100644 index 00000000..9a74b7cd --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/log.ts @@ -0,0 +1,55 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.log", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor (commit SHA) + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of commits to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * Path to filter commits by + * @default "" + */ + path: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), ""), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.log": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/merge.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/merge.ts new file mode 100644 index 00000000..3fc74527 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/merge.ts @@ -0,0 +1,60 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.merge", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Author email for the merge commit + */ + authorEmail: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Author name for the merge commit + */ + authorName: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Target branch to merge into + */ + branch: /*#__PURE__*/ v.string(), + /** + * Additional commit message body + */ + commitBody: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Merge commit message + */ + commitMessage: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * DID of the repository owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * Name of the repository + */ + name: /*#__PURE__*/ v.string(), + /** + * Patch content to merge + */ + patch: /*#__PURE__*/ v.string(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.merge": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/mergeCheck.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/mergeCheck.ts new file mode 100644 index 00000000..8030dd76 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/mergeCheck.ts @@ -0,0 +1,87 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _conflictInfoSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.mergeCheck#conflictInfo"), + ), + /** + * Name of the conflicted file + */ + filename: /*#__PURE__*/ v.string(), + /** + * Reason for the conflict + */ + reason: /*#__PURE__*/ v.string(), +}); +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.mergeCheck", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Target branch to merge into + */ + branch: /*#__PURE__*/ v.string(), + /** + * DID of the repository owner + */ + did: /*#__PURE__*/ v.didString(), + /** + * Name of the repository + */ + name: /*#__PURE__*/ v.string(), + /** + * Patch or pull request to check for merge conflicts + */ + patch: /*#__PURE__*/ v.string(), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * List of files with merge conflicts + */ + get conflicts() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(conflictInfoSchema), + ); + }, + /** + * Error message if check failed + */ + error: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Whether the merge has conflicts + */ + is_conflicted: /*#__PURE__*/ v.boolean(), + /** + * Additional message about the merge check + */ + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + }), + }, +}); + +type conflictInfo$schematype = typeof _conflictInfoSchema; +type main$schematype = typeof _mainSchema; + +export interface conflictInfoSchema extends conflictInfo$schematype {} +export interface mainSchema extends main$schematype {} + +export const conflictInfoSchema = _conflictInfoSchema as conflictInfoSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ConflictInfo extends v.InferInput {} + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.mergeCheck": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts new file mode 100644 index 00000000..6f8a6c7f --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts @@ -0,0 +1,81 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.pull"), + body: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + createdAt: /*#__PURE__*/ v.datetimeString(), + dependentOn: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + mentions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), + ), + references: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + ), + get rounds() { + return /*#__PURE__*/ v.array(roundSchema); + }, + get source() { + return /*#__PURE__*/ v.optional(sourceSchema); + }, + get target() { + return targetSchema; + }, + title: /*#__PURE__*/ v.string(), + }), +); +const _roundSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.pull#round"), + ), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * @accept application/gzip + */ + patchBlob: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobAccept(["application/gzip"]), + ]), +}); +const _sourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.pull#source"), + ), + branch: /*#__PURE__*/ v.string(), + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), +}); +const _targetSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.pull#target"), + ), + branch: /*#__PURE__*/ v.string(), + repo: /*#__PURE__*/ v.didString(), +}); + +type main$schematype = typeof _mainSchema; +type round$schematype = typeof _roundSchema; +type source$schematype = typeof _sourceSchema; +type target$schematype = typeof _targetSchema; + +export interface mainSchema extends main$schematype {} +export interface roundSchema extends round$schematype {} +export interface sourceSchema extends source$schematype {} +export interface targetSchema extends target$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const roundSchema = _roundSchema as roundSchema; +export const sourceSchema = _sourceSchema as sourceSchema; +export const targetSchema = _targetSchema as targetSchema; + +export interface Main extends v.InferInput {} +export interface Round extends v.InferInput {} +export interface Source extends v.InferInput {} +export interface Target extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.pull": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/comment.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/comment.ts new file mode 100644 index 00000000..6fa7ea0a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/comment.ts @@ -0,0 +1,33 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.pull.comment"), + body: /*#__PURE__*/ v.string(), + createdAt: /*#__PURE__*/ v.datetimeString(), + mentions: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), + ), + pull: /*#__PURE__*/ v.resourceUriString(), + references: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), + ), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.pull.comment": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatuses.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatuses.ts new file mode 100644 index 00000000..2baa0601 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatuses.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.pull.listStatuses#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.repo.pull.status record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.pull.listStatuses", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Pull AT-URI whose status records to list. + */ + subject: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.pull.listStatuses": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatusesBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatusesBy.ts new file mode 100644 index 00000000..5a25d34d --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/listStatusesBy.ts @@ -0,0 +1,65 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledRepoPullListStatuses from "./listStatuses.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "sh.tangled.repo.pull.listStatusesBy", + { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose pull-status authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledRepoPullListStatuses.listItemSchema, + ); + }, + }), + }, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.pull.listStatusesBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status.ts new file mode 100644 index 00000000..9e7c694c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.repo.pull.status"), + createdAt: /*#__PURE__*/ v.datetimeString(), + pull: /*#__PURE__*/ v.resourceUriString(), + /** + * status of the pull request + * @default "sh.tangled.repo.pull.status.open" + */ + status: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string< + | "sh.tangled.repo.pull.status.closed" + | "sh.tangled.repo.pull.status.merged" + | "sh.tangled.repo.pull.status.open" + | (string & {}) + >(), + "sh.tangled.repo.pull.status.open", + ), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.repo.pull.status": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/closed.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/closed.ts new file mode 100644 index 00000000..27f02adc --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/closed.ts @@ -0,0 +1,14 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.literal( + "sh.tangled.repo.pull.status.closed", +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export type Main = v.InferInput; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/merged.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/merged.ts new file mode 100644 index 00000000..284bbaa0 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/merged.ts @@ -0,0 +1,14 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.literal( + "sh.tangled.repo.pull.status.merged", +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export type Main = v.InferInput; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/open.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/open.ts new file mode 100644 index 00000000..5c94a36b --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull/status/open.ts @@ -0,0 +1,12 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.literal("sh.tangled.repo.pull.status.open"); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export type Main = v.InferInput; diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/removeCollaborator.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/removeCollaborator.ts new file mode 100644 index 00000000..ee8af303 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/removeCollaborator.ts @@ -0,0 +1,39 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "sh.tangled.repo.removeCollaborator", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * DID of the repository to remove the collaborator from + */ + repo: /*#__PURE__*/ v.didString(), + /** + * DID of the collaborator to remove + */ + subject: /*#__PURE__*/ v.didString(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.removeCollaborator": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/removeSecret.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/removeSecret.ts new file mode 100644 index 00000000..1883f530 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/removeSecret.ts @@ -0,0 +1,36 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.repo.removeSecret", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * @minLength 1 + * @maxLength 50 + */ + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 50), + ]), + repo: /*#__PURE__*/ v.resourceUriString(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.removeSecret": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/setDefaultBranch.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/setDefaultBranch.ts new file mode 100644 index 00000000..caee6521 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/setDefaultBranch.ts @@ -0,0 +1,33 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure( + "sh.tangled.repo.setDefaultBranch", + { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + defaultBranch: /*#__PURE__*/ v.string(), + repo: /*#__PURE__*/ v.resourceUriString(), + }), + }, + output: null, + }, +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.repo.setDefaultBranch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/tag.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/tag.ts new file mode 100644 index 00000000..6a529b4a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/tag.ts @@ -0,0 +1,34 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.tag", { + params: /*#__PURE__*/ v.object({ + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + /** + * Name of tag, such as v1.3.0 + */ + tag: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.tag": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/tags.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/tags.ts new file mode 100644 index 00000000..761639de --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/tags.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.tags", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Maximum number of tags to return + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "blob", + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.tags": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/tree.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/tree.ts new file mode 100644 index 00000000..f4393672 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/tree.ts @@ -0,0 +1,152 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _lastCommitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.tree#lastCommit"), + ), + get author() { + return /*#__PURE__*/ v.optional(signatureSchema); + }, + /** + * Commit hash + */ + hash: /*#__PURE__*/ v.string(), + /** + * Commit message + */ + message: /*#__PURE__*/ v.string(), + /** + * Commit timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.tree", { + params: /*#__PURE__*/ v.object({ + /** + * Path within the repository tree + * @default "" + */ + path: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string(), ""), + /** + * Git reference (branch, tag, or commit SHA) + */ + ref: /*#__PURE__*/ v.string(), + /** + * Repository identifier in format 'did:plc:.../repoName' + */ + repo: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Parent directory path + */ + dotdot: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get files() { + return /*#__PURE__*/ v.array(treeEntrySchema); + }, + get lastCommit() { + return /*#__PURE__*/ v.optional(lastCommitSchema); + }, + /** + * The parent path in the tree + */ + parent: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * Readme for this file tree + */ + get readme() { + return /*#__PURE__*/ v.optional(readmeSchema); + }, + /** + * The git reference used + */ + ref: /*#__PURE__*/ v.string(), + }), + }, +}); +const _readmeSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.tree#readme"), + ), + /** + * Contents of the readme file + */ + contents: /*#__PURE__*/ v.string(), + /** + * Name of the readme file + */ + filename: /*#__PURE__*/ v.string(), +}); +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.tree#signature"), + ), + /** + * Author email + */ + email: /*#__PURE__*/ v.string(), + /** + * Author name + */ + name: /*#__PURE__*/ v.string(), + /** + * Author timestamp + */ + when: /*#__PURE__*/ v.datetimeString(), +}); +const _treeEntrySchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.tree#treeEntry"), + ), + get last_commit() { + return /*#__PURE__*/ v.optional(lastCommitSchema); + }, + /** + * File mode + */ + mode: /*#__PURE__*/ v.string(), + /** + * Relative file or directory name + */ + name: /*#__PURE__*/ v.string(), + /** + * File size in bytes + */ + size: /*#__PURE__*/ v.integer(), +}); + +type lastCommit$schematype = typeof _lastCommitSchema; +type main$schematype = typeof _mainSchema; +type readme$schematype = typeof _readmeSchema; +type signature$schematype = typeof _signatureSchema; +type treeEntry$schematype = typeof _treeEntrySchema; + +export interface lastCommitSchema extends lastCommit$schematype {} +export interface mainSchema extends main$schematype {} +export interface readmeSchema extends readme$schematype {} +export interface signatureSchema extends signature$schematype {} +export interface treeEntrySchema extends treeEntry$schematype {} + +export const lastCommitSchema = _lastCommitSchema as lastCommitSchema; +export const mainSchema = _mainSchema as mainSchema; +export const readmeSchema = _readmeSchema as readmeSchema; +export const signatureSchema = _signatureSchema as signatureSchema; +export const treeEntrySchema = _treeEntrySchema as treeEntrySchema; + +export interface LastCommit extends v.InferInput {} +export interface Readme extends v.InferInput {} +export interface Signature extends v.InferInput {} +export interface TreeEntry extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.repo.tree": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/spindle.ts b/web/src/lib/api/lexicons/types/sh/tangled/spindle.ts new file mode 100644 index 00000000..0af68743 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/spindle.ts @@ -0,0 +1,25 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.spindle"), + createdAt: /*#__PURE__*/ v.datetimeString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.spindle": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembers.ts b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembers.ts new file mode 100644 index 00000000..5c206b2c --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembers.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.spindle.listMembers#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.spindle.member record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.spindle.listMembers", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Spindle identifier whose member records to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.spindle.listMembers": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembersBy.ts b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembersBy.ts new file mode 100644 index 00000000..3f714ead --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listMembersBy.ts @@ -0,0 +1,62 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledSpindleListMembers from "./listMembers.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.spindle.listMembersBy", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Actor DID whose spindle-member authorings to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array( + ShTangledSpindleListMembers.listItemSchema, + ); + }, + }), + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.spindle.listMembersBy": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/spindle/listSpindles.ts b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listSpindles.ts new file mode 100644 index 00000000..a8e05293 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/spindle/listSpindles.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.spindle.listSpindles#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.spindle record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.spindle.listSpindles", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Owner DID whose spindle records to list. + */ + subject: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.spindle.listSpindles": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/spindle/member.ts b/web/src/lib/api/lexicons/types/sh/tangled/spindle/member.ts new file mode 100644 index 00000000..4e99ee2a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/spindle/member.ts @@ -0,0 +1,30 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.spindle.member"), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * spindle instance that the subject is now a member of + */ + instance: /*#__PURE__*/ v.string(), + subject: /*#__PURE__*/ v.didString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.spindle.member": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/string.ts b/web/src/lib/api/lexicons/types/sh/tangled/string.ts new file mode 100644 index 00000000..027f0270 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/string.ts @@ -0,0 +1,44 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.tidString(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("sh.tangled.string"), + /** + * @minGraphemes 1 + */ + contents: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1), + ]), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * @maxGraphemes 280 + */ + description: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(0, 280), + ]), + /** + * @minGraphemes 1 + * @maxGraphemes 140 + */ + filename: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1, 140), + ]), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "sh.tangled.string": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/string/listStrings.ts b/web/src/lib/api/lexicons/types/sh/tangled/string/listStrings.ts new file mode 100644 index 00000000..25a75b66 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/string/listStrings.ts @@ -0,0 +1,75 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _listItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.string.listStrings#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded sh.tangled.string record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.string.listStrings", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * Scope identifier whose string records to list. + */ + subject: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + }), + }, +}); + +type listItem$schematype = typeof _listItemSchema; +type main$schematype = typeof _mainSchema; + +export interface listItemSchema extends listItem$schematype {} +export interface mainSchema extends main$schematype {} + +export const listItemSchema = _listItemSchema as listItemSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ListItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.string.listStrings": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/sync/listRepos.ts b/web/src/lib/api/lexicons/types/sh/tangled/sync/listRepos.ts new file mode 100644 index 00000000..16b40a8e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/sync/listRepos.ts @@ -0,0 +1,113 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _defaultBranchSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.sync.listRepos#defaultBranch"), + ), + /** + * Commit SHA at the tip of the default branch, for reconciling against a last-known state. Width depends on the repo's git object-format. + * @minLength 40 + * @maxLength 128 + */ + head: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), + ), + /** + * Default branch ref name, eg. refs/heads/main. + * @maxLength 2560 + * @maxGraphemes 256 + */ + ref: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 2560), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.sync.listRepos", { + params: /*#__PURE__*/ v.object({ + /** + * Pagination cursor + */ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minimum 1 + * @maximum 1000 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 1000), + ]), + 50, + ), + /** + * Sort direction over the service's repo listing order. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @maxLength 1000 + */ + get repos() { + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(repoSchema), [ + /*#__PURE__*/ v.arrayLength(0, 1000), + ]); + }, + }), + }, +}); +const _repoSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.sync.listRepos#repo"), + ), + get defaultBranch() { + return /*#__PURE__*/ v.optional(defaultBranchSchema); + }, + /** + * DID of the git repo as minted by the knot + */ + repo: /*#__PURE__*/ v.didString(), + /** + * Serving status of the repo according to the knot. + */ + status: /*#__PURE__*/ v.string< + "active" | "archived" | "disabled" | (string & {}) + >(), +}); + +type defaultBranch$schematype = typeof _defaultBranchSchema; +type main$schematype = typeof _mainSchema; +type repo$schematype = typeof _repoSchema; + +export interface defaultBranchSchema extends defaultBranch$schematype {} +export interface mainSchema extends main$schematype {} +export interface repoSchema extends repo$schematype {} + +export const defaultBranchSchema = _defaultBranchSchema as defaultBranchSchema; +export const mainSchema = _mainSchema as mainSchema; +export const repoSchema = _repoSchema as repoSchema; + +export interface DefaultBranch extends v.InferInput< + typeof defaultBranchSchema +> {} +export interface Repo extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.sync.listRepos": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/sync/requestCrawl.ts b/web/src/lib/api/lexicons/types/sh/tangled/sync/requestCrawl.ts new file mode 100644 index 00000000..7ad69e2a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/sync/requestCrawl.ts @@ -0,0 +1,36 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.sync.requestCrawl", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * specific repository to ensure crawling + */ + ensureRepo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + /** + * Hostname of the current service (eg, Knot) that is requesting to be crawled. + */ + hostname: /*#__PURE__*/ v.string(), + }), + }, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.sync.requestCrawl": mainSchema; + } +} diff --git a/web/src/lib/api/load.test.ts b/web/src/lib/api/load.test.ts new file mode 100644 index 00000000..d7f0ef88 --- /dev/null +++ b/web/src/lib/api/load.test.ts @@ -0,0 +1,122 @@ +import { describe, expect, it, vi } from 'vitest'; +import { ClientResponseError } from './client'; +import { createRequestCache, httpStatusFor, parallel, toHttpError } from './load'; + +const cre = (status: number, error: string, message?: string): ClientResponseError => + new ClientResponseError({ status, data: { error, message } }); + +describe('httpStatusFor', () => { + it('passes through an in-band XRPC status', () => { + expect(httpStatusFor(cre(404, 'RecordNotFound'))).toBe(404); + }); + + it('prefers an in-band status over the error-name mapping', () => { + // status 503 is in [400,599] so it wins even though the name maps to 404. + expect(httpStatusFor(cre(503, 'RecordNotFound'))).toBe(503); + }); + + it('maps the error name when the status is out of the 400-599 band', () => { + expect(httpStatusFor(cre(200, 'RecordNotFound'))).toBe(404); + expect(httpStatusFor(cre(200, 'InvalidRequest'))).toBe(400); + expect(httpStatusFor(cre(200, 'UpstreamFailed'))).toBe(502); + expect(httpStatusFor(cre(200, 'UpstreamGone'))).toBe(502); + expect(httpStatusFor(cre(200, 'InvalidRecord'))).toBe(502); + expect(httpStatusFor(cre(200, 'Overloaded'))).toBe(503); + expect(httpStatusFor(cre(200, 'SomethingElse'))).toBe(500); + }); + + it('maps any non-XRPC cause to 500', () => { + expect(httpStatusFor(new Error('boom'))).toBe(500); + expect(httpStatusFor('a string')).toBe(500); + expect(httpStatusFor(undefined)).toBe(500); + expect(httpStatusFor({ status: 404 })).toBe(500); + }); +}); + +describe('toHttpError', () => { + it('throws a SvelteKit error with the mapped status and the XRPC description', () => { + let thrown: unknown; + try { + toHttpError(cre(404, 'RecordNotFound', 'no such repo')); + } catch (e) { + thrown = e; + } + expect(thrown).toMatchObject({ status: 404, body: { message: 'no such repo' } }); + }); + + it('falls back to the error name when the description is absent', () => { + let thrown: unknown; + try { + toHttpError(cre(200, 'Overloaded')); + } catch (e) { + thrown = e; + } + expect(thrown).toMatchObject({ status: 503, body: { message: 'Overloaded' } }); + }); + + it('uses the fallback message + 500 for a non-XRPC cause', () => { + let thrown: unknown; + try { + toHttpError(new Error('boom'), 'could not load'); + } catch (e) { + thrown = e; + } + expect(thrown).toMatchObject({ status: 500, body: { message: 'could not load' } }); + }); +}); + +describe('parallel', () => { + it('preserves key/value pairing regardless of settle order', async () => { + // deferred across a few microtasks (no real timer) so it settles after `fast`. + const slow = Promise.resolve() + .then(() => Promise.resolve()) + .then(() => 'slow'); + const result = await parallel({ fast: Promise.resolve('fast'), slow }); + expect(result).toEqual({ fast: 'fast', slow: 'slow' }); + }); + + it('resolves to an empty object for no tasks', async () => { + await expect(parallel({})).resolves.toEqual({}); + }); + + it('rejects if any input promise rejects', async () => { + await expect( + parallel({ a: Promise.resolve(1), b: Promise.reject(new Error('boom')) }) + ).rejects.toThrow('boom'); + }); +}); + +describe('createRequestCache', () => { + it('invokes the loader once per key and shares the value', async () => { + const cache = createRequestCache(); + const load = vi.fn(async () => 42); + + const first = await cache.run('k', load); + const second = await cache.run('k', load); + + expect(first).toBe(42); + expect(second).toBe(42); + expect(load).toHaveBeenCalledTimes(1); + }); + + it('shares one in-flight promise for concurrent same-key calls', () => { + const cache = createRequestCache(); + const load = vi.fn(async () => 'v'); + + const a = cache.run('k', load); + const b = cache.run('k', load); + + expect(a).toBe(b); + expect(load).toHaveBeenCalledTimes(1); + }); + + it('runs distinct keys independently', async () => { + const cache = createRequestCache(); + const load = vi.fn(async (key: string) => key.toUpperCase()); + + await cache.run('a', () => load('a')); + await cache.run('b', () => load('b')); + + expect(load).toHaveBeenCalledTimes(2); + }); +}); diff --git a/web/src/lib/api/load.ts b/web/src/lib/api/load.ts new file mode 100644 index 00000000..543fb1b7 --- /dev/null +++ b/web/src/lib/api/load.ts @@ -0,0 +1,60 @@ +import { error, type NumericRange } from '@sveltejs/kit'; +import { ClientResponseError } from './client'; + +export const httpStatusFor = (cause: unknown): number => { + if (cause instanceof ClientResponseError) { + if (cause.status >= 400 && cause.status <= 599) return cause.status; + switch (cause.error) { + case 'RecordNotFound': + return 404; + case 'InvalidRequest': + return 400; + case 'UpstreamFailed': + case 'UpstreamGone': + case 'InvalidRecord': + return 502; + case 'Overloaded': + return 503; + default: + return 500; + } + } + return 500; +}; + +export const toHttpError = (cause: unknown, fallbackMessage = 'Request failed'): never => { + const status = httpStatusFor(cause) as NumericRange<400, 599>; + const message = + cause instanceof ClientResponseError ? (cause.description ?? cause.error) : fallbackMessage; + throw error(status, message); +}; + +export const parallel = async >>( + tasks: T +): Promise<{ [K in keyof T]: Awaited }> => { + const keys = Object.keys(tasks) as (keyof T)[]; + const values = await Promise.all(keys.map((key) => tasks[key])); + const out = {} as { [K in keyof T]: Awaited }; + keys.forEach((key, index) => { + out[key] = values[index] as Awaited; + }); + return out; +}; + +// per-request promise de-dupe cache. +export interface RequestCache { + run(key: string, load: () => Promise): Promise; +} + +export const createRequestCache = (): RequestCache => { + const entries = new Map>(); + return { + run(key: string, load: () => Promise): Promise { + const existing = entries.get(key) as Promise | undefined; + if (existing) return existing; + const pending = load(); + entries.set(key, pending); + return pending; + } + }; +}; diff --git a/web/src/lib/api/pagination.test.ts b/web/src/lib/api/pagination.test.ts new file mode 100644 index 00000000..5bebb92e --- /dev/null +++ b/web/src/lib/api/pagination.test.ts @@ -0,0 +1,106 @@ +import { describe, expect, it, vi, type Mock } from 'vitest'; +import { createBobbinClient, type BobbinContext } from './client'; +import { collect, pages, paginateBy } from './pagination'; + +const NAME = 'sh.tangled.feed.listStars'; +const PARAMS = { subject: 'did:plc:x' } as const; + +interface Page { + items: readonly { uri: string }[]; + cursor?: string; +} + +const pageResponse = (page: Page): Response => + new Response(JSON.stringify(page), { + status: 200, + headers: { 'content-type': 'application/json' } + }); + +const makeCtx = (fetchMock: typeof globalThis.fetch): BobbinContext => + createBobbinClient({ serviceUrl: 'https://bobbin.test', fetch: fetchMock }); + +const cursorOf = (mock: Mock, n: number): string | null => + new URL(String(mock.mock.calls[n][0])).searchParams.get('cursor'); + +const threePageFetch = (): Mock => + vi + .fn() + .mockResolvedValueOnce(pageResponse({ items: [{ uri: 'a' }, { uri: 'b' }], cursor: 'c1' })) + .mockResolvedValueOnce(pageResponse({ items: [{ uri: 'c' }], cursor: 'c2' })) + .mockResolvedValueOnce(pageResponse({ items: [{ uri: 'd' }] })); + +describe('pages / items / collect follow the cursor', () => { + it('pages() yields every page then stops when a page omits the cursor', async () => { + const fetchMock = threePageFetch(); + const seen: Page[] = []; + for await (const p of pages(makeCtx(fetchMock), NAME, PARAMS)) seen.push(p as Page); + expect(fetchMock).toHaveBeenCalledTimes(3); + expect(seen.map((p) => p.cursor)).toEqual(['c1', 'c2', undefined]); + expect(cursorOf(fetchMock, 0)).toBeNull(); + expect(cursorOf(fetchMock, 1)).toBe('c1'); + expect(cursorOf(fetchMock, 2)).toBe('c2'); + }); +}); + +describe('pagination caps', () => { + it('maxPages caps the number of network round-trips even with unbounded cursors', async () => { + const fetchMock = vi + .fn() + .mockImplementation(async () => pageResponse({ items: [{ uri: 'x' }], cursor: 'always' })); + const out = await collect(makeCtx(fetchMock), NAME, PARAMS, { maxPages: 2 }); + expect(fetchMock).toHaveBeenCalledTimes(2); + expect(out).toHaveLength(2); + }); + + it('collect({ max }) caps items mid-page without fetching the next page', async () => { + const fetchMock = vi + .fn() + .mockResolvedValueOnce( + pageResponse({ items: [{ uri: 'a' }, { uri: 'b' }, { uri: 'c' }], cursor: 'c1' }) + ); + const out = await collect(makeCtx(fetchMock), NAME, PARAMS, { max: 2 }); + expect(out).toEqual([{ uri: 'a' }, { uri: 'b' }]); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); +}); + +describe('paginateBy', () => { + it('treats cursor: null as the end of the stream', async () => { + const load = vi.fn(async () => ({ + items: [1, 2] as const, + cursor: null + })); + const out: number[] = []; + for await (const n of paginateBy(load)) out.push(n); + expect(out).toEqual([1, 2]); + expect(load).toHaveBeenCalledTimes(1); + }); + + it('follows a string cursor and forwards it to the loader', async () => { + const load = vi + .fn< + ( + cursor: string | undefined + ) => Promise<{ items: readonly number[]; cursor?: string | null }> + >() + .mockResolvedValueOnce({ items: [1], cursor: 'p2' }) + .mockResolvedValueOnce({ items: [2], cursor: undefined }); + const out: number[] = []; + for await (const n of paginateBy(load)) out.push(n); + expect(out).toEqual([1, 2]); + expect(load).toHaveBeenCalledTimes(2); + expect(load.mock.calls[0][0]).toBeUndefined(); + expect(load.mock.calls[1][0]).toBe('p2'); + }); + + it('maxPages caps loader invocations', async () => { + const load = vi.fn(async () => ({ + items: [0], + cursor: 'always' + })); + const out: number[] = []; + for await (const n of paginateBy(load, { maxPages: 3 })) out.push(n); + expect(load).toHaveBeenCalledTimes(3); + expect(out).toHaveLength(3); + }); +}); diff --git a/web/src/lib/api/pagination.ts b/web/src/lib/api/pagination.ts new file mode 100644 index 00000000..a4d6fcb3 --- /dev/null +++ b/web/src/lib/api/pagination.ts @@ -0,0 +1,121 @@ +import type { XRPCQueries } from '@atcute/lexicons/ambient'; +import type { + InferInput, + InferOutput, + ObjectSchema, + XRPCLexBodyParam +} from '@atcute/lexicons/validations'; +import { ok, type BobbinContext, type XrpcRequestInit } from './client'; + +export type QueryOutput = + XRPCQueries[TName]['output'] extends XRPCLexBodyParam + ? InferOutput + : never; + +export type QueryParams = + XRPCQueries[TName]['params'] extends ObjectSchema + ? InferInput + : Record; + +type CursorPage = { items: readonly unknown[]; cursor?: string }; + +// registered queries whose output is an { items, cursor? } page. +export type PaginatedQuery = { + [K in keyof XRPCQueries]: QueryOutput extends CursorPage ? K : never; +}[keyof XRPCQueries]; + +export type PageItem = + QueryOutput extends { items: readonly (infer I)[] } ? I : never; + +export type PageParams = Omit, 'cursor'>; + +export interface PaginateOptions extends XrpcRequestInit { + /** stop after this many network round-trips. */ + maxPages?: number; +} + +const requestPage = ( + ctx: BobbinContext, + name: TName, + params: PageParams & { cursor?: string }, + init?: XrpcRequestInit +): Promise> => + ok( + ctx.xrpc.get(name, { + params, + signal: init?.signal, + headers: init?.headers + } as never) + ) as Promise>; +export const fetchPage = ( + ctx: BobbinContext, + name: TName, + params: PageParams & { cursor?: string }, + init?: XrpcRequestInit +): Promise> => requestPage(ctx, name, params, init); + +export async function* pages( + ctx: BobbinContext, + name: TName, + params: PageParams, + options: PaginateOptions = {} +): AsyncGenerator, void, unknown> { + let cursor: string | undefined; + let seen = 0; + do { + const data = await requestPage( + ctx, + name, + { ...params, cursor } as PageParams & { cursor?: string }, + options + ); + yield data; + cursor = (data as CursorPage).cursor; + if (options.maxPages && ++seen >= options.maxPages) break; + } while (cursor); +} + +export async function* items( + ctx: BobbinContext, + name: TName, + params: PageParams, + options: PaginateOptions = {} +): AsyncGenerator, void, unknown> { + for await (const data of pages(ctx, name, params, options)) { + for (const item of (data as CursorPage).items) yield item as PageItem; + } +} + +export interface CollectOptions extends PaginateOptions { + /** stop once this many items are gathered. */ + max?: number; +} + +export const collect = async ( + ctx: BobbinContext, + name: TName, + params: PageParams, + options: CollectOptions = {} +): Promise[]> => { + const out: PageItem[] = []; + for await (const item of items(ctx, name, params, options)) { + out.push(item); + if (options.max && out.length >= options.max) break; + } + return out; +}; + +// cursor walker for schema-less list endpoints. +export async function* paginateBy( + load: (cursor: string | undefined) => Promise<{ items: readonly T[]; cursor?: string | null }>, + options: { maxPages?: number } = {} +): AsyncGenerator { + let cursor: string | undefined; + let seen = 0; + do { + const page = await load(cursor); + for (const item of page.items) yield item; + cursor = page.cursor ?? undefined; + if (options.maxPages && ++seen >= options.maxPages) break; + } while (cursor); +} diff --git a/web/src/lib/api/records.ts b/web/src/lib/api/records.ts new file mode 100644 index 00000000..db97b7c4 --- /dev/null +++ b/web/src/lib/api/records.ts @@ -0,0 +1,56 @@ +import type { BobbinContext, XrpcRequestInit } from './client'; +import { jsonGet } from './_request'; +import type * as ShTangledActorProfile from './lexicons/types/sh/tangled/actor/profile'; +import type * as ShTangledRepo from './lexicons/types/sh/tangled/repo'; +import type * as ShTangledRepoIssue from './lexicons/types/sh/tangled/repo/issue'; +import type * as ShTangledRepoPull from './lexicons/types/sh/tangled/repo/pull'; + +/** getRecord-shaped view returned by the hydrated single-record `get*` endpoints. */ +export interface RecordView { + uri: string; + cid?: string; + value: V; +} + +/** Envelope returned by the bulk `get*s` endpoints (no cursor — inputs are explicit uris). */ +export interface RecordList { + items: RecordView[]; +} + +export type RepoRecord = ShTangledRepo.Main; +export type ProfileRecord = ShTangledActorProfile.Main; +export type IssueRecord = ShTangledRepoIssue.Main; +export type PullRecord = ShTangledRepoPull.Main; + +/** Max uris accepted per bulk request (mirrors bobbin's BULK_LIMIT). */ +export const BULK_LIMIT = 50; + +export const getRepo = (ctx: BobbinContext, repo: string, init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getRepo', { repo }, init); + +export const getRepoByRepoDid = (ctx: BobbinContext, repoDid: string, init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getRepoByRepoDid', { repoDid }, init); + +export const getProfile = (ctx: BobbinContext, actor: string, init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.actor.getProfile', { actor }, init); + +export const getIssue = (ctx: BobbinContext, issue: string, init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getIssue', { issue }, init); + +export const getPull = (ctx: BobbinContext, pull: string, init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getPull', { pull }, init); + +export const getRepos = (ctx: BobbinContext, repos: readonly string[], init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getRepos', { repos }, init); + +export const getProfiles = ( + ctx: BobbinContext, + actors: readonly string[], + init?: XrpcRequestInit +) => jsonGet>(ctx, 'sh.tangled.actor.getProfiles', { actors }, init); + +export const getIssues = (ctx: BobbinContext, issues: readonly string[], init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getIssues', { issues }, init); + +export const getPulls = (ctx: BobbinContext, pulls: readonly string[], init?: XrpcRequestInit) => + jsonGet>(ctx, 'sh.tangled.repo.getPulls', { pulls }, init); diff --git a/web/src/lib/api/search.ts b/web/src/lib/api/search.ts new file mode 100644 index 00000000..3f506236 --- /dev/null +++ b/web/src/lib/api/search.ts @@ -0,0 +1,48 @@ +import type { BobbinContext, XrpcRequestInit } from './client'; +import { jsonGet } from './_request'; +import { paginateBy } from './pagination'; + +export interface SearchHit { + uri: string; + cid?: string; + nsid: string; + score: number; + /** the indexed record; shape varies by `nsid`. */ + value: unknown; +} + +export interface SearchPage { + hits: SearchHit[]; + cursor: string | null; +} + +export interface SearchParams { + q: string; + nsid?: string; + author?: string; + repo?: string; + since?: string; + until?: string; + cursor?: string; + limit?: number; +} + +/** One page of full-text search hits. */ +export const search = (ctx: BobbinContext, params: SearchParams, init?: XrpcRequestInit) => + jsonGet(ctx, 'sh.tangled.search.query', { ...params }, init); + +export interface SearchAllOptions extends XrpcRequestInit { + maxPages?: number; +} + +/** Async-iterate every search hit across cursor pages. */ +export async function* searchAll( + ctx: BobbinContext, + params: Omit, + options: SearchAllOptions = {} +): AsyncGenerator { + yield* paginateBy(async (cursor) => { + const page = await search(ctx, { ...params, cursor }, options); + return { items: page.hits, cursor: page.cursor }; + }, options); +} diff --git a/web/src/lib/server/bobbin.ts b/web/src/lib/server/bobbin.ts new file mode 100644 index 00000000..b5f504ad --- /dev/null +++ b/web/src/lib/server/bobbin.ts @@ -0,0 +1,5 @@ +import { createBobbinClient, type BobbinContext } from '$lib/api/client'; +import { getConfig } from './config'; + +export const serverBobbin = (event: { fetch: typeof globalThis.fetch }): BobbinContext => + createBobbinClient({ serviceUrl: getConfig().bobbinUrl, fetch: event.fetch }); -- 2.51.2