everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
88 lines • 4.38 kB
text/typescript
import { BosConfig } from "../../types.mjs";
import { z } from "zod";
//#region src/services/lockfile/schema.d.ts
declare const LOCKFILE_NAME = "bos.lock.json";
/** A frozen remote coordinate. `descriptor` mirrors the release manifest's
* remote entry — `digest` (the immutable manifest pointer), a direct entry
* `integrity` (digest-less fixed-name remotes), and the `base` they resolve
* against; fields are individually optional because the freeze is faithful to
* what the config carries, not to what a producer wishes it carried.
* `pluginRef` freezes a bare plugin reference (`plugins.<id>: "<key>"`). */
declare const LockfileRemoteSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"descriptor">;
base: z.ZodOptional<z.ZodString>;
digest: z.ZodOptional<z.ZodObject<{
manifest: z.ZodString;
integrity: z.ZodString;
}, z.core.$strip>>;
integrity: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"pluginRef">;
ref: z.ZodString;
}, z.core.$strict>], "kind">;
type LockfileRemote = z.infer<typeof LockfileRemoteSchema>;
declare const CompositionLockfileSchema: z.ZodObject<{
schemaVersion: z.ZodLiteral<1>;
kind: z.ZodLiteral<"everything-dev/composition-lockfile">;
runtimeRef: z.ZodString;
release: z.ZodNullable<z.ZodString>;
remotes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"descriptor">;
base: z.ZodOptional<z.ZodString>;
digest: z.ZodOptional<z.ZodObject<{
manifest: z.ZodString;
integrity: z.ZodString;
}, z.core.$strip>>;
integrity: z.ZodOptional<z.ZodString>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"pluginRef">;
ref: z.ZodString;
}, z.core.$strict>], "kind">>;
sharedSingletons: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
contracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
fingerprint: z.ZodString;
resolvedAt: z.ZodString;
}, z.core.$strict>;
type CompositionLockfile = z.infer<typeof CompositionLockfileSchema>;
declare function lockfilePath(configDir?: string): string;
/** The load-side identity check: recompute the fingerprint from the stored
* `remotes` record (insertion order — JSON round-trips preserve it) and
* compare. A mismatch means the file was hand-edited or written by a
* different fingerprint implementation — refuse, loud. */
declare function lockfileFingerprint(lock: CompositionLockfile): string;
declare function lockfileOf(input: {
account: string;
gateway: string;
config: BosConfig;
release?: string | null;
sharedSingletons?: Record<string, string>;
contracts?: Record<string, string>;
resolvedAt?: string;
}): CompositionLockfile;
declare function serializeLockfile(lock: CompositionLockfile): string;
/** The lockfile's content digest — what a deployment record names when it
* answers "what exact composition was live". */
declare function digestOfLockfile(serialized: string): string;
declare function parseLockfile(bytes: string): CompositionLockfile;
/** The sync producer for the deploy train (its publish path is sync-fs):
* atomic temp + rename, parent dirs created. */
declare function writeLockfileSync(lock: CompositionLockfile, configDir?: string): string;
/** Absent or unparseable → null: the lockfile is an input, and a corrupt one
* degrades the explainer's provenance rather than failing a build. */
declare function readLockfileIfExists(configDir?: string): Promise<CompositionLockfile | null>;
interface LockWriteResult {
status: "written" | "unchanged" | "drift";
path: string;
fingerprint: string;
/** The `--check` refusal reasons — empty unless status is "drift". */
drift: string[];
}
/** The producer seam both writers share (`bos lock`, and the deploy train's
* post-publish leg): freeze the resolved composition, atomically, with the
* `--check` refusal the CI gate exits on. */
declare function writeLockfile(lock: CompositionLockfile, configDir?: string, opts?: {
check?: boolean;
}): Promise<LockWriteResult>;
//#endregion
export { CompositionLockfile, CompositionLockfileSchema, LOCKFILE_NAME, LockWriteResult, LockfileRemote, LockfileRemoteSchema, digestOfLockfile, lockfileFingerprint, lockfileOf, lockfilePath, parseLockfile, readLockfileIfExists, serializeLockfile, writeLockfile, writeLockfileSync };
//# sourceMappingURL=schema.d.mts.map