feat: unify installation model catalog
This commit is contained in:
@@ -44,11 +44,13 @@ export interface BeginPreprocessingJobOptions {
|
||||
catalogBlob: string;
|
||||
configDigest: string;
|
||||
bindingDigest: string;
|
||||
embeddingId: string;
|
||||
embeddingDimensions: number;
|
||||
runId?: string;
|
||||
}
|
||||
|
||||
export interface PreprocessingJobState {
|
||||
schemaVersion: 1;
|
||||
schemaVersion: 2;
|
||||
runId: string;
|
||||
operation: string;
|
||||
workspaceId: string;
|
||||
@@ -57,6 +59,8 @@ export interface PreprocessingJobState {
|
||||
catalogBlob: string;
|
||||
configDigest: string;
|
||||
bindingDigest: string;
|
||||
embeddingId: string;
|
||||
embeddingDimensions: number;
|
||||
completedStages: string[];
|
||||
childRuns: Record<string, string>;
|
||||
status: "active" | "succeeded" | "blocked" | "failed";
|
||||
@@ -146,7 +150,7 @@ function decodeJob(value: unknown): PreprocessingJobState {
|
||||
}
|
||||
const record = value as Record<string, unknown>;
|
||||
if (
|
||||
record.schemaVersion !== 1
|
||||
record.schemaVersion !== 2
|
||||
|| typeof record.runId !== "string"
|
||||
|| typeof record.operation !== "string"
|
||||
|| typeof record.workspaceId !== "string"
|
||||
@@ -155,6 +159,8 @@ function decodeJob(value: unknown): PreprocessingJobState {
|
||||
|| typeof record.catalogBlob !== "string"
|
||||
|| typeof record.configDigest !== "string"
|
||||
|| typeof record.bindingDigest !== "string"
|
||||
|| typeof record.embeddingId !== "string"
|
||||
|| typeof record.embeddingDimensions !== "number"
|
||||
|| !Array.isArray(record.completedStages)
|
||||
|| typeof record.childRuns !== "object" || record.childRuns === null || Array.isArray(record.childRuns)
|
||||
|| !["active", "succeeded", "blocked", "failed"].includes(String(record.status))
|
||||
@@ -275,6 +281,8 @@ export class PreprocessingStateStore {
|
||||
|| existing.catalogBlob !== options.catalogBlob
|
||||
|| existing.configDigest !== options.configDigest
|
||||
|| existing.bindingDigest !== options.bindingDigest
|
||||
|| existing.embeddingId !== options.embeddingId
|
||||
|| existing.embeddingDimensions !== options.embeddingDimensions
|
||||
) {
|
||||
throw new PreprocessingStateError(
|
||||
"preprocessing_resume_mismatch",
|
||||
@@ -295,7 +303,7 @@ export class PreprocessingStateStore {
|
||||
}
|
||||
}
|
||||
const job: PreprocessingJobState = {
|
||||
schemaVersion: 1,
|
||||
schemaVersion: 2,
|
||||
runId,
|
||||
operation: options.operation,
|
||||
workspaceId: this.options.workspaceId,
|
||||
@@ -304,6 +312,8 @@ export class PreprocessingStateStore {
|
||||
catalogBlob: options.catalogBlob,
|
||||
configDigest: options.configDigest,
|
||||
bindingDigest: options.bindingDigest,
|
||||
embeddingId: options.embeddingId,
|
||||
embeddingDimensions: options.embeddingDimensions,
|
||||
completedStages: [],
|
||||
childRuns: {},
|
||||
status: "active",
|
||||
|
||||
Reference in New Issue
Block a user