UNPKG

@curvenote/cli

Version:
115 lines 5.48 kB
import type { CollectionDTO, CollectionListingDTO, SubmissionKindDTO, SubmissionsListItemDTO, WorkDTO } from '@curvenote/common'; import type { ISession } from '../session/types.js'; import type { SubmitLog, SubmitOpts } from './types.js'; export declare function kindQuestions(kinds: Omit<SubmissionKindDTO, 'date_created' | 'date_modified' | 'checks'>[]): { name: string; type: string; message: string; choices: { name: string; value: string; }[]; }; export declare function collectionMoniker(collection: CollectionDTO): string; export declare function collectionQuestions(venue: string, collections: CollectionListingDTO['items'], opts?: { allowClosedCollection?: boolean; }): { name: string; type: string; message: string; choices: { name: string; value: CollectionDTO; }[]; }; /** * Choose and return a collection and kind based on venue * * By default, this function only looks at open collections; however, if * `opts.allowClosedCollection` is `true`, the "open" requirement is removed. * * First `collection` must be determined; successful cases include: * - `collection` is provided, valid, and "open" * - `venue` has a single, "open" `collection` * - `opts.yes` is `true` and the `venue` has a default, "open" `collection` * - user interactively selects one of the available `collections` on the `venue` * * On failure, throws. Failure cases include: * - No "open" collections * - Provided `collection` is invalid or not "open" * - `opts.yes` is `true` but there is no default, "open" `collection` * * After determining `collection`, `kind` is chosen using `determineKindFromCollection`. */ export declare function determineCollectionAndKind(session: ISession, venue: string, collections: CollectionListingDTO, opts?: { kind?: string; collection?: string; yes?: boolean; allowClosedCollection?: boolean; }): Promise<{ collection: CollectionDTO; kind: SubmissionKindDTO; prompted?: boolean; }>; /** * Fetch a list of kinds from `venue` API */ export declare function listSubmissionKinds(session: ISession, venue: string): Promise<{ items: SubmissionKindDTO[]; }>; /** * Fetch a single `venue` kind from API */ export declare function getSubmissionKind(session: ISession, venue: string, kindIdOrName: string): Promise<SubmissionKindDTO>; /** * Choose and return one kind based on venue and collection * * Successful cases include: * - `kind` is provided and available on the `collection` * - `collection` with a single `kind`, which is returned * - `opts.yes` is `true` and the `collection` has a default `kind`, which is returned * - user interactively selects one of the available `kinds` on the `collection` * * On failure, throws. Failure cases include: * - Invalid `kind` is provided * - `opts.yes` is `true` but there is no default `kind` * - API fetch for selected kind fails (user is not authorized, venue does not exist, etc) */ export declare function determineKindFromCollection(session: ISession, venue: string, collection: CollectionDTO, opts?: { kind?: string; yes?: boolean; }): Promise<{ kind: SubmissionKindDTO; prompted?: boolean; }>; export declare function getSiteConfig(session: ISession): import("myst-config").SiteConfig; export declare function checkVenueSubmitAccess(session: ISession, venue: string): Promise<boolean>; /** * Fetch `venue` collections from API */ export declare function listCollections(session: ISession, venue: string): Promise<CollectionListingDTO>; /** * Get collections from `venue` and log information about open collections * * Throws if the fetch for venue collections fails. * By default, it also throws if there are no open collections. * * If `requireOpenCollections` is false, this function will not fail if there are * only closed collections or no collections at all. */ export declare function getVenueCollections(session: ISession, venue: string, requireOpenCollections?: boolean): Promise<CollectionListingDTO>; export declare function checkForSubmissionKeyInUse(session: ISession, venue: string, key: string): Promise<boolean | null>; export declare function chooseSubmission(session: ISession, submissions: SubmissionsListItemDTO[], opts?: { yes?: boolean; }): Promise<SubmissionsListItemDTO>; export declare function getAllSubmissionsThatICanSeeUsingKey(session: ISession, venue: string, key: string, opts?: { includeDrafts?: boolean; }): Promise<SubmissionsListItemDTO[] | undefined>; export declare function getSubmissionToUpdate(session: ISession, submissions: SubmissionsListItemDTO[]): Promise<SubmissionsListItemDTO | undefined>; export declare function confirmUpdateToExistingSubmission(session: ISession, venue: string, collections: CollectionListingDTO, submission: SubmissionsListItemDTO, key: string, opts?: SubmitOpts): Promise<{ kind: SubmissionKindDTO; collection: CollectionDTO; }>; export declare function createNewSubmission(session: ISession, submitLog: SubmitLog, venue: string, collection: CollectionDTO, kind: SubmissionKindDTO, cdn: string, cdnKey: string, jobId: string, key: string, opts?: SubmitOpts, existingWork?: WorkDTO): Promise<void>; export declare function updateExistingSubmission(session: ISession, submitLog: SubmitLog, venue: string, cdnKey: string, existingSubmission: SubmissionsListItemDTO, jobId: string, opts?: SubmitOpts): Promise<void>; //# sourceMappingURL=submit.utils.d.ts.map