diff --git a/web/src/lib/api/lexicons/index.ts b/web/src/lib/api/lexicons/index.ts index 33897c976..c9332da98 100644 --- a/web/src/lib/api/lexicons/index.ts +++ b/web/src/lib/api/lexicons/index.ts @@ -1,15 +1,31 @@ export * as ComBadExamplePocketDefs from "./types/com/bad-example/pocket/defs.js"; export * as ComBadExamplePocketGetPreferences from "./types/com/bad-example/pocket/getPreferences.js"; export * as ComBadExamplePocketPutPreferences from "./types/com/bad-example/pocket/putPreferences.js"; +export * as OrgTangledCiGetPipeline from "./types/org/tangled/ci/getPipeline.js"; +export * as OrgTangledCiGetWorkflowDefinition from "./types/org/tangled/ci/getWorkflowDefinition.js"; +export * as OrgTangledCiListWorkflowDefinitions from "./types/org/tangled/ci/listWorkflowDefinitions.js"; +export * as OrgTangledCiPipeline from "./types/org/tangled/ci/pipeline.js"; +export * as OrgTangledCiQueryPipelines from "./types/org/tangled/ci/queryPipelines.js"; +export * as OrgTangledCiSubscribePipelineLogs from "./types/org/tangled/ci/subscribePipelineLogs.js"; +export * as OrgTangledCiTriggerManual from "./types/org/tangled/ci/trigger/manual.js"; +export * as OrgTangledCiWorkflow from "./types/org/tangled/ci/workflow.js"; +export * as OrgTangledEventPullRequest from "./types/org/tangled/event/pullRequest.js"; +export * as OrgTangledEventPush from "./types/org/tangled/event/push.js"; export * as OrgTangledFeedSubscription from "./types/org/tangled/feed/subscription.js"; export * as OrgTangledGitOid from "./types/org/tangled/git/oid.js"; +export * as OrgTangledGitPushEvent from "./types/org/tangled/git/pushEvent.js"; +export * as OrgTangledGitReceivePack from "./types/org/tangled/git/receivePack.js"; +export * as OrgTangledGitRefs from "./types/org/tangled/git/refs.js"; +export * as OrgTangledLabelDefinition from "./types/org/tangled/label/definition.js"; export * as OrgTangledLabelDefs from "./types/org/tangled/label/defs.js"; export * as OrgTangledMarkupEmbedImage from "./types/org/tangled/markup/embed/image.js"; export * as OrgTangledMarkupEmbedVideo from "./types/org/tangled/markup/embed/video.js"; export * as OrgTangledMarkupMarkdown from "./types/org/tangled/markup/markdown.js"; export * as OrgTangledMarkupPlaintext from "./types/org/tangled/markup/plaintext.js"; +export * as OrgTangledRepoCreateRepo from "./types/org/tangled/repo/createRepo.js"; export * as OrgTangledRepoDeclaration from "./types/org/tangled/repo/declaration.js"; export * as OrgTangledRepoDefs from "./types/org/tangled/repo/defs.js"; +export * as OrgTangledRepoDeleteRepo from "./types/org/tangled/repo/deleteRepo.js"; export * as OrgTangledRepoManifest from "./types/org/tangled/repo/manifest.js"; export * as OrgTangledReviewPatch from "./types/org/tangled/review/patch.js"; export * as OrgTangledSnippetString from "./types/org/tangled/snippet/string.js"; diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/getPipeline.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/getPipeline.ts new file mode 100644 index 000000000..6afd01d87 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/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 OrgTangledCiPipeline from "./pipeline.js"; + +const _mainSchema = /*#__PURE__*/ v.query("org.tangled.ci.getPipeline", { + params: /*#__PURE__*/ v.object({ + /** + * Spindle-local pipeline id + */ + pipeline: /*#__PURE__*/ v.string(), + }), + output: { + type: "lex", + get schema() { + return OrgTangledCiPipeline.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 { + "org.tangled.ci.getPipeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/getWorkflowDefinition.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/getWorkflowDefinition.ts new file mode 100644 index 000000000..a07961c89 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/getWorkflowDefinition.ts @@ -0,0 +1,43 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledCiWorkflow from "./workflow.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.ci.getWorkflowDefinition", + { + params: /*#__PURE__*/ v.object({ + repo: /*#__PURE__*/ v.didString(), + /** + * @minLength 1 + * @maxLength 128 + */ + workflow: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 128), + ]), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get workflow() { + return OrgTangledCiWorkflow.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 interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.ci.getWorkflowDefinition": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/listWorkflowDefinitions.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/listWorkflowDefinitions.ts new file mode 100644 index 000000000..06a49d488 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/listWorkflowDefinitions.ts @@ -0,0 +1,46 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledCiWorkflow from "./workflow.js"; + +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.ci.listWorkflowDefinitions", + { + params: /*#__PURE__*/ v.object({ + /** + * @maxLength 256 + * @default "HEAD" + */ + ref: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 256), + ]), + "HEAD", + ), + repo: /*#__PURE__*/ v.didString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + get workflows() { + return /*#__PURE__*/ v.array(OrgTangledCiWorkflow.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 interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.ci.listWorkflowDefinitions": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/pipeline.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/pipeline.ts new file mode 100644 index 000000000..04094ad26 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/pipeline.ts @@ -0,0 +1,104 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as OrgTangledCiTriggerManual from "./trigger/manual.js"; +import * as OrgTangledCiWorkflow from "./workflow.js"; +import * as OrgTangledEventPullRequest from "../event/pullRequest.js"; +import * as OrgTangledEventPush from "../event/push.js"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.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.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 that triggered this pipeline. + */ + get trigger() { + return /*#__PURE__*/ v.variant([ + OrgTangledCiTriggerManual.mainSchema, + OrgTangledEventPullRequest.mainSchema, + OrgTangledEventPush.mainSchema, + ]); + }, + /** + * 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("org.tangled.ci.pipeline#workflow"), + ), + /** + * Workflow definition where this workflow run is originated from. + */ + get definition() { + return OrgTangledCiWorkflow.mainSchema; + }, + error: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + finishedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Pipeline-local workflow id, usually same as name. + * @minLength 1 + * @maxLength 128 + */ + id: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 128), + ]), + /** + * Human-readable name of the workflow + * @maxLength 128 + */ + name: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 128), + ]), + ), + startedAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Workflow status + */ + status: /*#__PURE__*/ v.literalEnum([ + "cancelled", + "failed", + "pending", + "running", + "scheduled", + "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/org/tangled/ci/queryPipelines.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/queryPipelines.ts new file mode 100644 index 000000000..1ef89d59a --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/queryPipelines.ts @@ -0,0 +1,80 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledCiPipeline from "./pipeline.js"; + +const _mainSchema = /*#__PURE__*/ v.query("org.tangled.ci.queryPipelines", { + params: /*#__PURE__*/ v.object({ + /** + * Filter pipelines by commit ids. + */ + commits: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 64), + ]), + ), + ), + /** + * 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(), + /** + * Filter pipelines by trigger kind. When provided, pipelines matching any listed kind are returned; when omitted, every kind is returned. + */ + triggers: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.string< + | "org.tangled.ci.trigger.manual" + | "org.tangled.event.pullRequest" + | "org.tangled.event.push" + | (string & {}) + >(), + ), + ), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get pipelines() { + return /*#__PURE__*/ v.array(OrgTangledCiPipeline.mainSchema); + }, + /** + * Number of matching 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 { + "org.tangled.ci.queryPipelines": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/subscribePipelineLogs.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/subscribePipelineLogs.ts new file mode 100644 index 000000000..de00fb5f7 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/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("org.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("org.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( + "org.tangled.ci.subscribePipelineLogs", + { + params: /*#__PURE__*/ v.object({ + /** + * Pipeline ID + */ + pipeline: /*#__PURE__*/ v.string(), + /** + * 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 { + "org.tangled.ci.subscribePipelineLogs": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/trigger/manual.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/trigger/manual.ts new file mode 100644 index 000000000..5e5a10ba3 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/trigger/manual.ts @@ -0,0 +1,43 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.trigger.manual"), + ), + /** + * Commit id the pipeline will run on. + * @minLength 40 + * @maxLength 64 + */ + commit: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 64), + ]), + get inputs() { + return /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(pairSchema)); + }, + /** + * Optional ref the commit was resolved from. + */ + ref: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + repo: /*#__PURE__*/ v.didString(), +}); +const _pairSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.trigger.manual#pair"), + ), + key: /*#__PURE__*/ v.string(), + value: /*#__PURE__*/ v.string(), +}); + +type main$schematype = typeof _mainSchema; +type pair$schematype = typeof _pairSchema; + +export interface mainSchema extends main$schematype {} +export interface pairSchema extends pair$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const pairSchema = _pairSchema as pairSchema; + +export interface Main extends v.InferInput {} +export interface Pair extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/ci/workflow.ts b/web/src/lib/api/lexicons/types/org/tangled/ci/workflow.ts new file mode 100644 index 000000000..891a50d14 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/ci/workflow.ts @@ -0,0 +1,115 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _externalSourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.workflow#externalSource"), + ), + link: /*#__PURE__*/ v.genericUriString(), + /** + * human-readable name of external source + */ + name: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), +}); +const _fileSourceSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.workflow#fileSource"), + ), + /** + * @minLength 40 + * @maxLength 128 + */ + commit: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 128), + ]), + get lines() { + return /*#__PURE__*/ v.optional(lineRangeSchema); + }, + /** + * @minLength 1 + */ + path: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1), + ]), + repo: /*#__PURE__*/ v.didString(), +}); +const _lineRangeSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.workflow#lineRange"), + ), + /** + * @minimum 1 + */ + end: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1), + ]), + /** + * @minimum 1 + */ + start: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1), + ]), +}); +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.ci.workflow"), + ), + /** + * Fingerprint of the workflow definition as resolved by the spindle. + */ + hash: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minLength 1 + * @maxLength 128 + */ + id: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 128), + ]), + /** + * Human-readable name of the workflow + * @minLength 1 + * @maxLength 128 + */ + name: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(1, 128), + ]), + ), + get source() { + return /*#__PURE__*/ v.variant([externalSourceSchema, fileSourceSchema]); + }, + /** + * Event types that triggers this workflow. + */ + triggers: /*#__PURE__*/ v.array( + /*#__PURE__*/ v.string< + | "org.tangled.ci.trigger.manual" + | "org.tangled.event.pullRequest" + | "org.tangled.event.push" + | (string & {}) + >(), + ), +}); + +type externalSource$schematype = typeof _externalSourceSchema; +type fileSource$schematype = typeof _fileSourceSchema; +type lineRange$schematype = typeof _lineRangeSchema; +type main$schematype = typeof _mainSchema; + +export interface externalSourceSchema extends externalSource$schematype {} +export interface fileSourceSchema extends fileSource$schematype {} +export interface lineRangeSchema extends lineRange$schematype {} +export interface mainSchema extends main$schematype {} + +export const externalSourceSchema = + _externalSourceSchema as externalSourceSchema; +export const fileSourceSchema = _fileSourceSchema as fileSourceSchema; +export const lineRangeSchema = _lineRangeSchema as lineRangeSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface ExternalSource extends v.InferInput< + typeof externalSourceSchema +> {} +export interface FileSource extends v.InferInput {} +export interface LineRange extends v.InferInput {} +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/event/pullRequest.ts b/web/src/lib/api/lexicons/types/org/tangled/event/pullRequest.ts new file mode 100644 index 000000000..f4204e73e --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/event/pullRequest.ts @@ -0,0 +1,16 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.event.pullRequest"), + ), +}); + +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/org/tangled/event/push.ts b/web/src/lib/api/lexicons/types/org/tangled/event/push.ts new file mode 100644 index 000000000..d8bf8bb16 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/event/push.ts @@ -0,0 +1,16 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.event.push"), + ), +}); + +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/org/tangled/git/pushEvent.ts b/web/src/lib/api/lexicons/types/org/tangled/git/pushEvent.ts new file mode 100644 index 000000000..62fb06ade --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/git/pushEvent.ts @@ -0,0 +1,79 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.git.pushEvent"), + ), + /** + * @maxLength 200 + */ + get edits() { + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(refEditSchema), [ + /*#__PURE__*/ v.arrayLength(0, 200), + ]); + }, + /** + * Git push options. + * @maxLength 10 + */ + options: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 1024), + ]), + ), + [/*#__PURE__*/ v.arrayLength(0, 10)], + ), + ), + /** + * The account that performed this push. + */ + pusher: /*#__PURE__*/ v.didString(), + /** + * The repo this event comes from. + */ + repo: /*#__PURE__*/ v.didString(), + /** + * The stream sequence number of this message. + */ + seq: /*#__PURE__*/ v.integer(), + /** + * Signature over the DAG-CBOR of this message with the seq and sig keys absent (repo/pusher DID, edits, time, options), by the repo's atproto signing key. seq is excluded so a relay can reassign it without invalidating the signature. + */ + sig: /*#__PURE__*/ v.bytes(), + /** + * Timestamp of when this message was originally broadcast. + */ + time: /*#__PURE__*/ v.datetimeString(), +}); +const _refEditSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.git.pushEvent#refEdit"), + ), + /** + * Full git reference name, ie refs/heads/main. + */ + name: /*#__PURE__*/ v.string(), + /** + * Full hex object id the ref now points at. + */ + new: /*#__PURE__*/ v.nullable(/*#__PURE__*/ v.string()), + /** + * Full hex object id the ref pointed at before. + */ + old: /*#__PURE__*/ v.nullable(/*#__PURE__*/ v.string()), +}); + +type main$schematype = typeof _mainSchema; +type refEdit$schematype = typeof _refEditSchema; + +export interface mainSchema extends main$schematype {} +export interface refEditSchema extends refEdit$schematype {} + +export const mainSchema = _mainSchema as mainSchema; +export const refEditSchema = _refEditSchema as refEditSchema; + +export interface Main extends v.InferInput {} +export interface RefEdit extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/git/receivePack.ts b/web/src/lib/api/lexicons/types/org/tangled/git/receivePack.ts new file mode 100644 index 000000000..de78b16a2 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/git/receivePack.ts @@ -0,0 +1,23 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("org.tangled.git.receivePack", { + params: null, + input: null, + output: null, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.git.receivePack": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/git/refs.ts b/web/src/lib/api/lexicons/types/org/tangled/git/refs.ts new file mode 100644 index 000000000..6ca20a9b5 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/git/refs.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.literal("self"), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("org.tangled.git.refs"), + /** + * Default branch name without refs/heads/ prefix. + * @maxLength 244 + */ + defaultBranch: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 244), + ]), + /** + * List of git refs in `git show-ref` format. + * @maxLength 1000000 + */ + refs: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.bytes(), [ + /*#__PURE__*/ v.bytesSize(0, 1000000), + ]), + }), +); + +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 { + "org.tangled.git.refs": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/label/definition.ts b/web/src/lib/api/lexicons/types/org/tangled/label/definition.ts new file mode 100644 index 000000000..e3201e07a --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/label/definition.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.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("org.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(), + /** + * The display name of this label. + * @maxLength 640 + * @maxGraphemes 64 + */ + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 640), + /*#__PURE__*/ v.stringGraphemes(0, 64), + ]), + }), +); + +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 { + "org.tangled.label.definition": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/repo/createRepo.ts b/web/src/lib/api/lexicons/types/org/tangled/repo/createRepo.ts new file mode 100644 index 000000000..7b633f563 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/repo/createRepo.ts @@ -0,0 +1,91 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledRepoDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.procedure("org.tangled.repo.createRepo", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + createdAt: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.datetimeString()), + /** + * Default branch of the repository. + */ + defaultBranch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + /** + * @minGraphemes 1 + * @maxGraphemes 140 + */ + description: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringGraphemes(1, 140), + ]), + ), + /** + * Optional user-provided DID to use as the repo identity instead of minting one. + */ + did: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Name of the repository. + */ + slug: /*#__PURE__*/ v.recordKeyString(), + /** + * A source to clone from, populate this when forking or importing a repository. + */ + get source() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.variant([ + OrgTangledRepoDefs.sourceExternalSchema, + OrgTangledRepoDefs.sourceTangledSchema, + ]), + ); + }, + spindle: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * 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(0, 50), + ]), + ), + [/*#__PURE__*/ v.arrayLength(0, 50)], + ), + ), + /** + * Any URI related to the repo + */ + website: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), + }), + }, + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + did: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + /** + * Multibase-encoded public signing key the knot holds for this repository + */ + key: /*#__PURE__*/ v.optional(/*#__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 $input extends v.InferXRPCBodyInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCProcedures { + "org.tangled.repo.createRepo": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/repo/deleteRepo.ts b/web/src/lib/api/lexicons/types/org/tangled/repo/deleteRepo.ts new file mode 100644 index 000000000..4ab4be825 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/repo/deleteRepo.ts @@ -0,0 +1,29 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; + +const _mainSchema = /*#__PURE__*/ v.procedure("org.tangled.repo.deleteRepo", { + params: null, + input: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + repo: /*#__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 { + "org.tangled.repo.deleteRepo": mainSchema; + } +}