72 lines
1.6 KiB
TypeScript
72 lines
1.6 KiB
TypeScript
export type GitSource = {
|
|
resolver: "git";
|
|
repository: string;
|
|
commit: string;
|
|
};
|
|
|
|
export type QuixosSourcePolicy = "pinned" | "track-release" | "track-development";
|
|
|
|
// Resource repositories only need the exact Quixos commit they were authored
|
|
// against. A workspace root additionally declares how a runtime may advance
|
|
// that exact baseline.
|
|
export type QuixosSource = GitSource & ({
|
|
policy: QuixosSourcePolicy;
|
|
ref: string;
|
|
} | {
|
|
policy?: undefined;
|
|
ref?: undefined;
|
|
});
|
|
|
|
export type LockedResourceKind = "interface" | "package";
|
|
|
|
export type LockedResource = {
|
|
kind: LockedResourceKind;
|
|
binding: string;
|
|
source: GitSource;
|
|
};
|
|
|
|
export type QuixosLockRootDocument = {
|
|
kind: "root";
|
|
formatVersion: 1;
|
|
quixos: QuixosSource;
|
|
imports: string[];
|
|
resources: LockedResource[];
|
|
};
|
|
|
|
export type QuixosLockFragmentDocument = {
|
|
kind: "fragment";
|
|
formatVersion: 1;
|
|
imports: string[];
|
|
resources: LockedResource[];
|
|
};
|
|
|
|
export type QuixosLockDocument =
|
|
| QuixosLockRootDocument
|
|
| QuixosLockFragmentDocument;
|
|
|
|
export type QuixosRepositoryLock = {
|
|
formatVersion: 1;
|
|
quixos: QuixosSource;
|
|
resources: LockedResource[];
|
|
sourceFiles?: string[];
|
|
};
|
|
|
|
export type NixGitInput = {
|
|
type: "git";
|
|
url: string;
|
|
ref: string;
|
|
rev: string;
|
|
};
|
|
|
|
export const RETENTION_TAG_PREFIX = "refs/tags/quixos-reachability/";
|
|
|
|
export const retentionTagForCommit = (commit: string): string =>
|
|
`${RETENTION_TAG_PREFIX}${commit.toLowerCase()}`;
|
|
|
|
export const nixGitInput = (source: GitSource): NixGitInput => ({
|
|
type: "git",
|
|
url: source.repository,
|
|
ref: retentionTagForCommit(source.commit),
|
|
rev: source.commit.toLowerCase(),
|
|
});
|