History

Add self-host custom tools source UI

Rhys Sullivan committed 4 months ago

Commit 2a35fef1 parent 9e77e3420 files · +1014 −50Browse files

Showing the changes to packages/plugins/apps/src/source/github-source.ts (1 of 20 files). Show all

Unified · Split

packages/plugins/apps/src/source/github-source.ts+7−7
@@ -2,7 +2,7 @@ import { Data, Effect, Result } from "effect"; · 1 unmodified line
22
33 import { PublishError, type FileDiagnostic } from "../pipeline/discover";
44 import { PUBLISH_LIMITS, enforcePublishLimits } from "../pipeline/publish";
5−import type { AppSourceRef } from "../pipeline/descriptor";
5+import type { AppSourceRef, SourceSkippedArtifact } from "../pipeline/descriptor";
66 import type { AppsRuntime } from "../plugin/runtime";
77 import type { FileSet, SnapshotId } from "../seams/artifact-store";
88
@@ -36,10 +36,7 @@ export interface SyncErrorData { · 27 unmodified lines
3636 readonly diagnostics?: readonly FileDiagnostic[];
3737 }
3838
39−export interface GitHubSkippedArtifact {
40− readonly path: string;
41− readonly reason: "not supported yet" | "unsupported file type" | "ignored";
42−}
39+export type GitHubSkippedArtifact = SourceSkippedArtifact;
4340
4441 export type GitHubSyncResult =
4542 | {
@@ -69,6 +66,7 @@ export interface SyncGitHubSourceInput extends GitHubSourceInput { · 23 unmodified lines
6966 readonly runtime: AppsRuntime;
7067 readonly tenant?: string;
7168 readonly scope: string;
69+ readonly connection?: string;
7270 }
7371
7472 const TOOL_RE = /^tools\/([a-z0-9][a-z0-9-]*)\.(ts|tsx|js|jsx)$/;
@@ -374,11 +372,13 @@ const sourceErrorToSyncError = (error: GitHubSourceError): SyncErrorData => ({ · 299 unmodified lines
374372 diagnostics: error.path ? [{ path: error.path, message: error.message }] : [],
375373 });
376374
377−const sourceRef = (snapshot: GitHubSourceSnapshot): AppSourceRef => ({
375+const sourceRef = (snapshot: GitHubSourceSnapshot, connection?: string): AppSourceRef => ({
378376 kind: "github",
379377 repo: snapshot.repo,
380378 ref: snapshot.ref,
381379 upstreamSha: snapshot.upstreamSha,
380+ ...(connection ? { connection } : {}),
381+ skipped: snapshot.skipped,
382382 });
383383
384384 export const syncGitHubSource = (input: SyncGitHubSourceInput): Effect.Effect<GitHubSyncResult> =>
@@ -420,7 +420,7 @@ export const syncGitHubSource = (input: SyncGitHubSourceInput): Effect.Effect<Gi · 35 unmodified lines
420420 scope: input.scope,
421421 files: snapshot.files,
422422 description: snapshot.description,
423− source: sourceRef(snapshot),
423+ source: sourceRef(snapshot, input.connection),
424424 message: `sync ${snapshot.repo}@${snapshot.upstreamSha}`,
425425 })
426426 .pipe(Effect.result);