Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/publish/provider-types.ts
6442 views
1
/*
2
* provider-types.ts
3
*
4
* Copyright (C) 2020-2023 Posit Software, PBC
5
*/
6
7
import { RenderFlags } from "../command/render/types.ts";
8
import { ProjectContext } from "../project/types.ts";
9
import { PublishOptions, PublishRecord } from "./types.ts";
10
11
export enum AccountTokenType {
12
Environment,
13
Authorized,
14
Anonymous,
15
}
16
17
export interface AccountToken {
18
type: AccountTokenType;
19
name: string;
20
server: string | null;
21
token: string;
22
}
23
24
export interface PublishDeployment {
25
provider: PublishProvider;
26
target: PublishRecord;
27
}
28
29
export interface PublishDeploymentWithAccount extends PublishDeployment {
30
account?: AccountToken;
31
}
32
33
export type InputMetadata = {
34
title?: string;
35
author?: string;
36
date?: string;
37
};
38
39
export type PublishFiles = {
40
baseDir: string;
41
rootFile: string;
42
files: string[];
43
metadataByInput?: Record<string, InputMetadata>;
44
};
45
46
export interface PublishProvider {
47
name: string;
48
description: string;
49
requiresServer: boolean;
50
hidden?: boolean;
51
listOriginOnly?: boolean;
52
requiresRender?: boolean;
53
accountDescriptor?: string;
54
publishRecord?: (
55
input: string | ProjectContext,
56
) => Promise<PublishRecord | undefined>;
57
accountTokens: () => Promise<AccountToken[]>;
58
removeToken: (token: AccountToken) => void;
59
authorizeToken: (
60
options: PublishOptions,
61
target?: PublishRecord,
62
) => Promise<AccountToken | undefined>;
63
resolveTarget: (
64
account: AccountToken,
65
target: PublishRecord,
66
) => Promise<PublishRecord | undefined>;
67
publish: (
68
account: AccountToken,
69
type: "document" | "site",
70
input: string,
71
title: string,
72
slug: string,
73
render: (flags?: RenderFlags) => Promise<PublishFiles>,
74
options: PublishOptions,
75
target?: PublishRecord,
76
) => Promise<[PublishRecord | undefined, URL | undefined]>;
77
isUnauthorized: (error: Error) => boolean;
78
isNotFound: (error: Error) => boolean;
79
80
// if the provider has a quarto project path that is not the top level
81
// of the overall project (currently, huggingface spaces only),
82
// this function should return the path to the quarto project root
83
resolveProjectPath?: (path: string) => string;
84
}
85
86