From e3f42e2beca5b64d6b6af0b451eee96313fbaf0f Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Tue, 4 Aug 2026 10:10:14 +0300 Subject: [PATCH] lexicons: `pull.getPullView`, `pull.listPullViews` Signed-off-by: Seongmin Lee --- lexicons/pulls/defs.json | 67 +++++++++++ lexicons/pulls/getPullView.json | 26 +++++ lexicons/pulls/listPullViews.json | 53 +++++++++ lexicons/pulls/pull.json | 1 + lexicons/repo/defs.json | 2 + web/src/lib/api/lexicons/index.ts | 9 ++ .../lexicons/types/sh/tangled/ci/trigger.ts | 12 ++ .../api/lexicons/types/sh/tangled/git/defs.ts | 28 +++++ .../types/sh/tangled/git/keepCommit.ts | 76 +++++++++++++ .../types/sh/tangled/git/mergeCheck.ts | 95 ++++++++++++++++ .../types/sh/tangled/git/mergeCommit.ts | 107 ++++++++++++++++++ .../types/sh/tangled/git/temp/formatPatch.ts | 32 ++++++ .../types/sh/tangled/git/temp/getMergeBase.ts | 41 +++++++ .../api/lexicons/types/sh/tangled/pipeline.ts | 12 ++ .../lexicons/types/sh/tangled/pull/defs.ts | 96 ++++++++++++++++ .../types/sh/tangled/pull/getPullView.ts | 31 +++++ .../types/sh/tangled/pull/listPullViews.ts | 55 +++++++++ .../lexicons/types/sh/tangled/repo/defs.ts | 2 + .../types/sh/tangled/repo/listSecrets.ts | 2 +- .../lexicons/types/sh/tangled/repo/pull.ts | 25 ++++ 20 files changed, 771 insertions(+), 1 deletion(-) create mode 100644 lexicons/pulls/defs.json create mode 100644 lexicons/pulls/getPullView.json create mode 100644 lexicons/pulls/listPullViews.json create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/defs.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/keepCommit.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/mergeCheck.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/mergeCommit.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/formatPatch.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/git/temp/getMergeBase.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pull/defs.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pull/getPullView.ts create mode 100644 web/src/lib/api/lexicons/types/sh/tangled/pull/listPullViews.ts diff --git a/lexicons/pulls/defs.json b/lexicons/pulls/defs.json new file mode 100644 index 000000000..bc1f42251 --- /dev/null +++ b/lexicons/pulls/defs.json @@ -0,0 +1,67 @@ +{ + "lexicon": 1, + "id": "sh.tangled.pull.defs", + "defs": { + "pullView": { + "type": "object", + "required": ["uri", "cid", "author", "repo", "title", "targetBranch", "createdAt"], + "properties": { + "uri": { "type": "string", "format": "at-uri" }, + "cid": { "type": "string", "format": "cid" }, + "repo": { "type": "ref", "ref": "sh.tangled.repo.defs#repoViewBasic" }, + "author": { "type": "ref", "ref": "sh.tangled.actor.defs#profileViewBasic" }, + "title": { "type": "string" }, + "targetBranch": { "type": "string" }, + "createdAt": { "type": "string", "format": "datetime" }, + "state": { "type": "string", "enum": [ "open", "closed", "merged" ] } + } + }, + "pullViewDetailed": { + "type": "object", + "required": ["uri", "cid", "author", "repo", "title", "targetBranch", "versions", "createdAt"], + "properties": { + "uri": { "type": "string", "format": "at-uri" }, + "cid": { "type": "string", "format": "cid" }, + "repo": { "type": "ref", "ref": "sh.tangled.repo.defs#repoViewBasic" }, + "author": { "type": "ref", "ref": "sh.tangled.actor.defs#profileViewBasic" }, + "title": { "type": "string" }, + "body": { "type": "ref", "ref": "sh.tangled.markup.markdown" }, + "targetBranch": { "type": "string" }, + "source": { + "type": "ref", + "ref": "#source" + }, + "state": { + "type": "string", + "enum": ["open", "closed", "merged"] + }, + "versions": { + "type": "array", + "description": "TODO: this should be paginated maybe even as a separate `listPatches` method", + "items": { + "type": "ref", + "ref": "#patchView" + } + }, + "createdAt": { "type": "string", "format": "datetime" } + } + }, + "source": { + "type": "object", + "required": ["branch"], + "properties": { + "repo": { "type": "ref", "ref": "sh.tangled.repo.defs#repoViewBasic" }, + "branch": { "type": "string" } + } + }, + "patchView": { + "type": "object", + "required": ["head", "base", "createdAt"], + "properties": { + "head": { "type": "string" }, + "base": { "type": "string" }, + "createdAt": { "type": "string", "format": "datetime" } + } + } + } +} diff --git a/lexicons/pulls/getPullView.json b/lexicons/pulls/getPullView.json new file mode 100644 index 000000000..9f4b859b4 --- /dev/null +++ b/lexicons/pulls/getPullView.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "sh.tangled.pull.getPullView", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["uri"], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "ref", + "ref": "sh.tangled.pull.defs#pullViewDetailed" + } + } + } + } +} diff --git a/lexicons/pulls/listPullViews.json b/lexicons/pulls/listPullViews.json new file mode 100644 index 000000000..d4d67428d --- /dev/null +++ b/lexicons/pulls/listPullViews.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "sh.tangled.pull.listPullViews", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["subject"], + "properties": { + "subject": { + "type": "string", + "format": "did", + "description": "Repo DID to list pulls for" + }, + "state": { + "type": "string", + "enum": [ "open", "closed", "merged" ] + }, + "cursor": { + "type": "string", + "description": "Pagination cursor" + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 1000, + "default": 50 + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["items"], + "properties": { + "items": { + "type": "array", + "items": { + "type": "ref", + "ref": "sh.tangled.pull.defs#pullView" + } + }, + "cursor": { + "type": "string" + } + } + } + } + } + } +} diff --git a/lexicons/pulls/pull.json b/lexicons/pulls/pull.json index e4e5640cb..9ec13a178 100644 --- a/lexicons/pulls/pull.json +++ b/lexicons/pulls/pull.json @@ -133,6 +133,7 @@ "version": { "type": "object", "required": [ + "base", "head", "createdAt" ], diff --git a/lexicons/repo/defs.json b/lexicons/repo/defs.json index 61494df58..fbf628f27 100644 --- a/lexicons/repo/defs.json +++ b/lexicons/repo/defs.json @@ -11,6 +11,7 @@ "slug": { "type": "string" }, "description": { "type": "string" }, "createdAt": { "type": "string", "format": "datetime" }, + "forkCount": { "type": "integer" }, "starCount": { "type": "integer" }, "viewer": { "type": "ref", "ref": "#viewerState" }, "isStarred": { "type": "boolean" } @@ -20,6 +21,7 @@ "type": "object", "description": "Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.", "properties": { + "fork": { "type": "string", "format": "at-uri" }, "star": { "type": "string", "format": "at-uri" } } } diff --git a/web/src/lib/api/lexicons/index.ts b/web/src/lib/api/lexicons/index.ts index cbe302ffb..4f4cdea17 100644 --- a/web/src/lib/api/lexicons/index.ts +++ b/web/src/lib/api/lexicons/index.ts @@ -28,12 +28,17 @@ export * as ShTangledFeedReaction from "./types/sh/tangled/feed/reaction.js"; export * as ShTangledFeedStar from "./types/sh/tangled/feed/star.js"; export * as ShTangledGitCountRefUpdates from "./types/sh/tangled/git/countRefUpdates.js"; export * as ShTangledGitCountRefUpdatesBy from "./types/sh/tangled/git/countRefUpdatesBy.js"; +export * as ShTangledGitDefs from "./types/sh/tangled/git/defs.js"; +export * as ShTangledGitKeepCommit from "./types/sh/tangled/git/keepCommit.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 ShTangledGitMergeCheck from "./types/sh/tangled/git/mergeCheck.js"; +export * as ShTangledGitMergeCommit from "./types/sh/tangled/git/mergeCommit.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 ShTangledGitTempFormatPatch from "./types/sh/tangled/git/temp/formatPatch.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"; @@ -41,6 +46,7 @@ export * as ShTangledGitTempGetCommit from "./types/sh/tangled/git/temp/getCommi 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 ShTangledGitTempGetMergeBase from "./types/sh/tangled/git/temp/getMergeBase.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"; @@ -96,6 +102,9 @@ export * as ShTangledPublicKey from "./types/sh/tangled/publicKey.js"; export * as ShTangledPublicKeyCountKeys from "./types/sh/tangled/publicKey/countKeys.js"; export * as ShTangledPublicKeyGetPublicKey from "./types/sh/tangled/publicKey/getPublicKey.js"; export * as ShTangledPublicKeyListKeys from "./types/sh/tangled/publicKey/listKeys.js"; +export * as ShTangledPullDefs from "./types/sh/tangled/pull/defs.js"; +export * as ShTangledPullGetPullView from "./types/sh/tangled/pull/getPullView.js"; +export * as ShTangledPullListPullViews from "./types/sh/tangled/pull/listPullViews.js"; export * as ShTangledQueryEnrichResponse from "./types/sh/tangled/query/enrichResponse.js"; export * as ShTangledRepo from "./types/sh/tangled/repo.js"; export * as ShTangledRepoAddCollaborator from "./types/sh/tangled/repo/addCollaborator.js"; 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 index 6a0134743..e92de2230 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/ci/trigger.ts @@ -36,6 +36,18 @@ const _pullRequestSchema = /*#__PURE__*/ v.object({ $type: /*#__PURE__*/ v.optional( /*#__PURE__*/ v.literal("sh.tangled.ci.trigger#pullRequest"), ), + /** + * the pull request lifecycle action that produced this trigger + */ + action: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum([ + "closed", + "merged", + "opened", + "reopened", + "synchronize", + ]), + ), /** * AT-URI of the sh.tangled.repo.pull record this run belongs to */ diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/defs.ts new file mode 100644 index 000000000..9d047f0f9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/defs.ts @@ -0,0 +1,28 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _signatureSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.defs#signature"), + ), + /** + * Person email + */ + email: /*#__PURE__*/ v.string(), + /** + * Person name + */ + name: /*#__PURE__*/ v.string(), + /** + * Timestamp of the signature + */ + when: /*#__PURE__*/ v.datetimeString(), +}); + +type signature$schematype = typeof _signatureSchema; + +export interface signatureSchema extends signature$schematype {} + +export const signatureSchema = _signatureSchema as signatureSchema; + +export interface Signature extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/keepCommit.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/keepCommit.ts new file mode 100644 index 000000000..7e9b23e5e --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/keepCommit.ts @@ -0,0 +1,76 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _commitSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.keepCommit#commit"), + ), + /** + * @minLength 40 + * @maxLength 128 + */ + oid: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), + repo: /*#__PURE__*/ v.didString(), +}); +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.git.keepCommit", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * at-uri of target record. rkey is required + */ + record: /*#__PURE__*/ v.resourceUriString(), + repo: /*#__PURE__*/ v.didString(), + get source() { + return /*#__PURE__*/ v.variant([commitSchema, patchesSchema]); + }, + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * @minLength 40 + * @maxLength 128 + */ + commit: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), + }), + }, +}); +const _patchesSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.keepCommit#patches"), + ), + patches: /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), +}); + +type commit$schematype = typeof _commitSchema; +type main$schematype = typeof _mainSchema; +type patches$schematype = typeof _patchesSchema; + +export interface commitSchema extends commit$schematype {} +export interface mainSchema extends main$schematype {} +export interface patchesSchema extends patches$schematype {} + +export const commitSchema = _commitSchema as commitSchema; +export const mainSchema = _mainSchema as mainSchema; +export const patchesSchema = _patchesSchema as patchesSchema; + +export interface Commit extends v.InferInput {} +export interface Patches 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.git.keepCommit": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCheck.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCheck.ts new file mode 100644 index 000000000..742e2f01f --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCheck.ts @@ -0,0 +1,95 @@ +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.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.git.mergeCheck", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Target branch to merge into + */ + branch: /*#__PURE__*/ v.string(), + /** + * DID of Git repository + */ + repo: /*#__PURE__*/ v.didString(), + get source() { + return sourceSchema; + }, + }), + }, + 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 + */ + isConflicted: /*#__PURE__*/ v.boolean(), + /** + * Additional message about the merge check + */ + message: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + }), + }, +}); +const _sourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.mergeCheck#source"), + ), + /** + * Head commit ID of PR to merge + */ + commit: /*#__PURE__*/ v.string(), + /** + * DID of source git repository + */ + repo: /*#__PURE__*/ v.didString(), +}); + +type conflictInfo$schematype = typeof _conflictInfoSchema; +type main$schematype = typeof _mainSchema; +type source$schematype = typeof _sourceSchema; + +export interface conflictInfoSchema extends conflictInfo$schematype {} +export interface mainSchema extends main$schematype {} +export interface sourceSchema extends source$schematype {} + +export const conflictInfoSchema = _conflictInfoSchema as conflictInfoSchema; +export const mainSchema = _mainSchema as mainSchema; +export const sourceSchema = _sourceSchema as sourceSchema; + +export interface ConflictInfo extends v.InferInput {} +export interface Source 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.git.mergeCheck": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCommit.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCommit.ts new file mode 100644 index 000000000..61ba0b0d8 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/mergeCommit.ts @@ -0,0 +1,107 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledGitDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.procedure("sh.tangled.git.mergeCommit", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + /** + * Merge commit content. Used when merge commit is created. + */ + get mergeCommit() { + return /*#__PURE__*/ v.optional(mergeCommitContentSchema); + }, + get source() { + return sourceSchema; + }, + style: /*#__PURE__*/ v.literalEnum([ + "fast-forward-only", + "merge", + "rebase", + "rebase-merge", + "squash-rebase", + "squash-rebase-merge", + ]), + get target() { + return targetSchema; + }, + }), + }, + output: null, +}); +const _mergeCommitContentSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.mergeCommit#mergeCommitContent"), + ), + get author() { + return /*#__PURE__*/ v.optional(ShTangledGitDefs.signatureSchema); + }, + /** + * @maxLength 1000000 + */ + message: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 1000000), + ]), + ), +}); +const _sourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.mergeCommit#source"), + ), + /** + * Head commit ID to merge + */ + commit: /*#__PURE__*/ v.string(), + /** + * DID of source git repository + */ + repo: /*#__PURE__*/ v.didString(), +}); +const _targetSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.git.mergeCommit#target"), + ), + /** + * Target branch to merge into + */ + branch: /*#__PURE__*/ v.string(), + /** + * DID of target git repository + */ + repo: /*#__PURE__*/ v.didString(), +}); + +type main$schematype = typeof _mainSchema; +type mergeCommitContent$schematype = typeof _mergeCommitContentSchema; +type source$schematype = typeof _sourceSchema; +type target$schematype = typeof _targetSchema; + +export interface mainSchema extends main$schematype {} +export interface mergeCommitContentSchema extends mergeCommitContent$schematype {} +export interface sourceSchema extends source$schematype {} +export interface targetSchema extends target$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const mergeCommitContentSchema = + _mergeCommitContentSchema as mergeCommitContentSchema; +export const sourceSchema = _sourceSchema as sourceSchema; +export const targetSchema = _targetSchema as targetSchema; + +export interface MergeCommitContent extends v.InferInput< + typeof mergeCommitContentSchema +> {} +export interface Source extends v.InferInput {} +export interface Target extends v.InferInput {} + +export interface $params {} +export interface $input extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "sh.tangled.git.mergeCommit": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/formatPatch.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/formatPatch.ts new file mode 100644 index 000000000..5c5137669 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/formatPatch.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.query("sh.tangled.git.temp.formatPatch", { + params: /*#__PURE__*/ v.object({ + from: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + to: /*#__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.formatPatch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getMergeBase.ts b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getMergeBase.ts new file mode 100644 index 000000000..9016e7f36 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/git/temp/getMergeBase.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.git.temp.getMergeBase", { + params: /*#__PURE__*/ v.object({ + /** + * Ref used to find the common base. + */ + base: /*#__PURE__*/ v.string(), + /** + * Ref to list history for. + */ + head: /*#__PURE__*/ v.string(), + /** + * DID of the repository + */ + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + commit: /*#__PURE__*/ v.string(), + }), + }, +}); + +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.getMergeBase": 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 index 0b4b141ef..b9c9d84db 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/pipeline.ts @@ -54,6 +54,18 @@ const _pullRequestTriggerDataSchema = /*#__PURE__*/ v.object({ $type: /*#__PURE__*/ v.optional( /*#__PURE__*/ v.literal("sh.tangled.pipeline#pullRequestTriggerData"), ), + /** + * the pull request lifecycle action that produced this trigger + */ + action: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum([ + "closed", + "merged", + "opened", + "reopened", + "synchronize", + ]), + ), /** * AT-URI of the sh.tangled.repo.pull record this run belongs to */ diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pull/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/pull/defs.ts new file mode 100644 index 000000000..f273d205a --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pull/defs.ts @@ -0,0 +1,96 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as ShTangledActorDefs from "../actor/defs.js"; +import * as ShTangledMarkupMarkdown from "../markup/markdown.js"; +import * as ShTangledRepoDefs from "../repo/defs.js"; + +const _patchViewSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pull.defs#patchView"), + ), + base: /*#__PURE__*/ v.string(), + createdAt: /*#__PURE__*/ v.datetimeString(), + head: /*#__PURE__*/ v.string(), +}); +const _pullViewSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pull.defs#pullView"), + ), + get author() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + cid: /*#__PURE__*/ v.cidString(), + createdAt: /*#__PURE__*/ v.datetimeString(), + get repo() { + return ShTangledRepoDefs.repoViewBasicSchema; + }, + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["closed", "merged", "open"]), + ), + targetBranch: /*#__PURE__*/ v.string(), + title: /*#__PURE__*/ v.string(), + uri: /*#__PURE__*/ v.resourceUriString(), +}); +const _pullViewDetailedSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pull.defs#pullViewDetailed"), + ), + get author() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + get body() { + return /*#__PURE__*/ v.optional(ShTangledMarkupMarkdown.mainSchema); + }, + cid: /*#__PURE__*/ v.cidString(), + createdAt: /*#__PURE__*/ v.datetimeString(), + get repo() { + return ShTangledRepoDefs.repoViewBasicSchema; + }, + get source() { + return /*#__PURE__*/ v.optional(sourceSchema); + }, + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["closed", "merged", "open"]), + ), + targetBranch: /*#__PURE__*/ v.string(), + title: /*#__PURE__*/ v.string(), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * TODO: this should be paginated maybe even as a separate `listPatches` method + */ + get versions() { + return /*#__PURE__*/ v.array(patchViewSchema); + }, +}); +const _sourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.pull.defs#source"), + ), + branch: /*#__PURE__*/ v.string(), + get repo() { + return /*#__PURE__*/ v.optional(ShTangledRepoDefs.repoViewBasicSchema); + }, +}); + +type patchView$schematype = typeof _patchViewSchema; +type pullView$schematype = typeof _pullViewSchema; +type pullViewDetailed$schematype = typeof _pullViewDetailedSchema; +type source$schematype = typeof _sourceSchema; + +export interface patchViewSchema extends patchView$schematype {} +export interface pullViewSchema extends pullView$schematype {} +export interface pullViewDetailedSchema extends pullViewDetailed$schematype {} +export interface sourceSchema extends source$schematype {} + +export const patchViewSchema = _patchViewSchema as patchViewSchema; +export const pullViewSchema = _pullViewSchema as pullViewSchema; +export const pullViewDetailedSchema = + _pullViewDetailedSchema as pullViewDetailedSchema; +export const sourceSchema = _sourceSchema as sourceSchema; + +export interface PatchView extends v.InferInput {} +export interface PullView extends v.InferInput {} +export interface PullViewDetailed extends v.InferInput< + typeof pullViewDetailedSchema +> {} +export interface Source extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pull/getPullView.ts b/web/src/lib/api/lexicons/types/sh/tangled/pull/getPullView.ts new file mode 100644 index 000000000..b6de25814 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pull/getPullView.ts @@ -0,0 +1,31 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledPullDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.pull.getPullView", { + params: /*#__PURE__*/ v.object({ + uri: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + get schema() { + return ShTangledPullDefs.pullViewDetailedSchema; + }, + }, +}); + +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.pull.getPullView": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/pull/listPullViews.ts b/web/src/lib/api/lexicons/types/sh/tangled/pull/listPullViews.ts new file mode 100644 index 000000000..fb83a14b9 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/pull/listPullViews.ts @@ -0,0 +1,55 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledPullDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.pull.listPullViews", { + 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, + ), + state: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literalEnum(["closed", "merged", "open"]), + ), + /** + * 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(ShTangledPullDefs.pullViewSchema); + }, + }), + }, +}); + +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.pull.listPullViews": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts index b956a7dff..321dcc73c 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts @@ -9,6 +9,7 @@ const _repoViewBasicSchema = /*#__PURE__*/ v.object({ createdAt: /*#__PURE__*/ v.datetimeString(), description: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), did: /*#__PURE__*/ v.didString(), + forkCount: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), isStarred: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), get owner() { return ShTangledActorDefs.profileViewBasicSchema; @@ -23,6 +24,7 @@ const _viewerStateSchema = /*#__PURE__*/ v.object({ $type: /*#__PURE__*/ v.optional( /*#__PURE__*/ v.literal("sh.tangled.repo.defs#viewerState"), ), + fork: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), star: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), }); 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 index c1cd48c18..70660f541 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/listSecrets.ts @@ -10,7 +10,7 @@ const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.repo.listSecrets", { type: "lex", schema: /*#__PURE__*/ v.object({ get secrets() { - return /*#__PURE__*/ v.array(secretSchema); + return /*#__PURE__*/ v.nullable(/*#__PURE__*/ v.array(secretSchema)); }, }), }, 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 index b2fbb47cd..8c1987b05 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/pull.ts @@ -23,6 +23,10 @@ const _mainSchema = /*#__PURE__*/ v.record( references: /*#__PURE__*/ v.optional( /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), ), + /** + * DEPRECATED: always empty + * @deprecated + */ get rounds() { return /*#__PURE__*/ v.array(roundSchema); }, @@ -33,6 +37,9 @@ const _mainSchema = /*#__PURE__*/ v.record( return targetSchema; }, title: /*#__PURE__*/ v.string(), + get versions() { + return /*#__PURE__*/ v.array(versionSchema); + }, }), ); const _roundSchema = /*#__PURE__*/ v.object({ @@ -61,26 +68,44 @@ const _targetSchema = /*#__PURE__*/ v.object({ branch: /*#__PURE__*/ v.string(), repo: /*#__PURE__*/ v.didString(), }); +const _versionSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.pull#version"), + ), + /** + * merge-base commit ID for combined interdiff + */ + base: /*#__PURE__*/ v.string(), + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * HEAD commit ID + */ + head: /*#__PURE__*/ v.string(), +}); type main$schematype = typeof _mainSchema; type round$schematype = typeof _roundSchema; type source$schematype = typeof _sourceSchema; type target$schematype = typeof _targetSchema; +type version$schematype = typeof _versionSchema; 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 interface versionSchema extends version$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 const versionSchema = _versionSchema as versionSchema; export interface Main extends v.InferInput {} export interface Round extends v.InferInput {} export interface Source extends v.InferInput {} export interface Target extends v.InferInput {} +export interface Version extends v.InferInput {} declare module "@atcute/lexicons/ambient" { interface Records { -- 2.51.2