mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-22 10:32:40 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
normalizeLocalArtifactRetentionCursor,
|
||||
type LocalArtifactRetentionCursor,
|
||||
} from './localArtifactRetention';
|
||||
|
||||
export interface LocalArtifactRetentionCheckpoint {
|
||||
version: number;
|
||||
cursor?: LocalArtifactRetentionCursor;
|
||||
}
|
||||
|
||||
export function normalizeLocalArtifactRetentionCheckpoint(
|
||||
value: LocalArtifactRetentionCheckpoint,
|
||||
): Readonly<LocalArtifactRetentionCheckpoint> {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
||||
throw new TypeError(
|
||||
'Local Artifact retention checkpoint must be an object',
|
||||
);
|
||||
}
|
||||
if (
|
||||
!Number.isSafeInteger(value.version) ||
|
||||
value.version < 0 ||
|
||||
value.version >= Number.MAX_SAFE_INTEGER
|
||||
) {
|
||||
throw new TypeError(
|
||||
'Local Artifact retention checkpoint version is invalid',
|
||||
);
|
||||
}
|
||||
const cursor = value.cursor
|
||||
? normalizeLocalArtifactRetentionCursor(value.cursor)
|
||||
: undefined;
|
||||
return Object.freeze({
|
||||
version: value.version,
|
||||
...(cursor ? { cursor } : {}),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user