@picked/admin-api-client 0.0.117-next.2 → 0.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/app-installation.d.ts +121 -0
- package/dist/cjs/app-installation.d.ts.map +1 -0
- package/dist/cjs/client.d.ts +70 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/graphql-env.d.ts +875 -0
- package/dist/cjs/graphql.d.ts +19 -0
- package/dist/cjs/graphql.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/workspace-transfer.d.ts +170 -0
- package/dist/cjs/workspace-transfer.d.ts.map +1 -0
- package/dist/types/graphql-env.d.ts +11 -2
- package/dist/types/graphql.d.ts +1 -1
- package/dist/types/index.d.ts +5 -5
- package/package.json +19 -9
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads every live label an app installation owns, secret values included.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* const data = await client.request(AppInstallationLabelsDocument, { id: installationId })
|
|
6
|
+
*/
|
|
7
|
+
export declare const AppInstallationLabelsDocument: import("gql.tada").TadaDocumentNode<{
|
|
8
|
+
appInstallation: {
|
|
9
|
+
labels: {
|
|
10
|
+
expiresAt: string | null;
|
|
11
|
+
key: string;
|
|
12
|
+
namespace: string;
|
|
13
|
+
secret: boolean;
|
|
14
|
+
type: "BOOLEAN" | "JSON" | "NUMBER" | "TEXT";
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
18
|
+
} | null;
|
|
19
|
+
}, {
|
|
20
|
+
id: string;
|
|
21
|
+
}, void>;
|
|
22
|
+
/**
|
|
23
|
+
* Creates or replaces labels on an owner, returning the labels written, the live labels an
|
|
24
|
+
* `onlyIfAbsent` label left in place, and the user errors of a refused write.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const data = await client.request(LabelsSetDocument, { input: { ownerType, ownerId, labels } })
|
|
28
|
+
*/
|
|
29
|
+
export declare const LabelsSetDocument: import("gql.tada").TadaDocumentNode<{
|
|
30
|
+
labelsSet: {
|
|
31
|
+
labels: {
|
|
32
|
+
expiresAt: string | null;
|
|
33
|
+
key: string;
|
|
34
|
+
namespace: string;
|
|
35
|
+
secret: boolean;
|
|
36
|
+
type: "BOOLEAN" | "JSON" | "NUMBER" | "TEXT";
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
value: string;
|
|
39
|
+
}[];
|
|
40
|
+
skipped: {
|
|
41
|
+
expiresAt: string | null;
|
|
42
|
+
key: string;
|
|
43
|
+
namespace: string;
|
|
44
|
+
secret: boolean;
|
|
45
|
+
type: "BOOLEAN" | "JSON" | "NUMBER" | "TEXT";
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}[];
|
|
49
|
+
userErrors: {
|
|
50
|
+
code: "KEY_INVALID" | "LABEL_WRITE_INVALID" | "NAMESPACE_INVALID" | "OWNER_NOT_FOUND" | "VALUE_INVALID_FOR_TYPE";
|
|
51
|
+
field: string[] | null;
|
|
52
|
+
message: string;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
input: {
|
|
57
|
+
atomic?: boolean | null | undefined;
|
|
58
|
+
labels: {
|
|
59
|
+
expiresIn?: number | null | undefined;
|
|
60
|
+
increment?: number | null | undefined;
|
|
61
|
+
key: string;
|
|
62
|
+
namespace: string;
|
|
63
|
+
onlyIfAbsent?: boolean | null | undefined;
|
|
64
|
+
secret?: boolean | null | undefined;
|
|
65
|
+
type: "BOOLEAN" | "JSON" | "NUMBER" | "TEXT";
|
|
66
|
+
value?: string | null | undefined;
|
|
67
|
+
}[];
|
|
68
|
+
ownerId: string;
|
|
69
|
+
ownerType: "APP_INSTALLATION" | "LEAD" | "PROJECT" | "WORKFLOW_RUN";
|
|
70
|
+
};
|
|
71
|
+
}, void>;
|
|
72
|
+
/**
|
|
73
|
+
* Removes labels from an owner, returning the ids removed and the user errors of a refused
|
|
74
|
+
* removal.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* const data = await client.request(LabelsDeleteDocument, { input: { ownerType, ownerId, labels } })
|
|
78
|
+
*/
|
|
79
|
+
export declare const LabelsDeleteDocument: import("gql.tada").TadaDocumentNode<{
|
|
80
|
+
labelsDelete: {
|
|
81
|
+
deletedLabelIds: string[];
|
|
82
|
+
userErrors: {
|
|
83
|
+
code: "KEY_INVALID" | "LABEL_WRITE_INVALID" | "NAMESPACE_INVALID" | "OWNER_NOT_FOUND" | "VALUE_INVALID_FOR_TYPE";
|
|
84
|
+
field: string[] | null;
|
|
85
|
+
message: string;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
input: {
|
|
90
|
+
labels: {
|
|
91
|
+
ifValue?: string | null | undefined;
|
|
92
|
+
key: string;
|
|
93
|
+
namespace: string;
|
|
94
|
+
}[];
|
|
95
|
+
ownerId: string;
|
|
96
|
+
ownerType: "APP_INSTALLATION" | "LEAD" | "PROJECT" | "WORKFLOW_RUN";
|
|
97
|
+
};
|
|
98
|
+
}, void>;
|
|
99
|
+
/**
|
|
100
|
+
* Mints a one-hour installation token. The request authenticates with an app assertion in the
|
|
101
|
+
* `picked-app-assertion` header, passed through the request's `headers` option.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const data = await client.request(
|
|
105
|
+
* AppInstallationTokenCreateDocument,
|
|
106
|
+
* { input: { installationId } },
|
|
107
|
+
* { headers: { 'picked-app-assertion': assertion } },
|
|
108
|
+
* )
|
|
109
|
+
*/
|
|
110
|
+
export declare const AppInstallationTokenCreateDocument: import("gql.tada").TadaDocumentNode<{
|
|
111
|
+
appInstallationTokenCreate: {
|
|
112
|
+
expiresAt: string;
|
|
113
|
+
token: string;
|
|
114
|
+
};
|
|
115
|
+
}, {
|
|
116
|
+
input: {
|
|
117
|
+
installationId: string;
|
|
118
|
+
sessionToken?: string | null | undefined;
|
|
119
|
+
};
|
|
120
|
+
}, void>;
|
|
121
|
+
//# sourceMappingURL=app-installation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-installation.d.ts","sourceRoot":"","sources":["../../src/app-installation.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;QAcxC,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4B5B,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;QAW/B,CAAA;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;QAO7C,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { TadaDocumentNode } from 'gql.tada';
|
|
2
|
+
/** Options for {@link createAdminApiClient}. */
|
|
3
|
+
export interface CreateAdminApiClientOptions {
|
|
4
|
+
/** Base API origin; requests are POSTed to `${apiUrl}/api/graphql`, trailing slashes aside. */
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
/** Bearer token, or an accessor resolved per request (supports mid-session refresh). */
|
|
7
|
+
token?: string | (() => string | Promise<string>);
|
|
8
|
+
/** API key sent as the `X-API-Key` header on every request. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** The fetch requests are sent with; the global one by default. */
|
|
11
|
+
fetch?: typeof fetch;
|
|
12
|
+
}
|
|
13
|
+
/** Per-request options for {@link AdminApiClient.request}. */
|
|
14
|
+
export interface AdminApiRequestOptions {
|
|
15
|
+
/** Milliseconds before the request is aborted; 30 000 when omitted. */
|
|
16
|
+
timeoutMs?: number;
|
|
17
|
+
/** Headers sent with this request, over the client's `token` and `apiKey` headers. */
|
|
18
|
+
headers?: Readonly<Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The error a request throws when the API answered with GraphQL errors. Network failures,
|
|
22
|
+
* timeouts, aborts, and HTTP responses without a GraphQL error list throw a plain `Error`.
|
|
23
|
+
* The code says whether the server rejected the operation before running it (such as
|
|
24
|
+
* `FORBIDDEN`) or failed while running it (such as `INFRASTRUCTURE_ERROR`).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* if (error instanceof AdminApiResponseError) console.error(error.codes, error.message)
|
|
28
|
+
*/
|
|
29
|
+
export declare class AdminApiResponseError extends Error {
|
|
30
|
+
readonly name = "AdminApiResponseError";
|
|
31
|
+
/** The `extensions.code` of each GraphQL error, in response order; `undefined` where absent. */
|
|
32
|
+
readonly codes: ReadonlyArray<string | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Creates the error from a GraphQL response's error list.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} message - The joined GraphQL error messages.
|
|
37
|
+
* @param {ReadonlyArray<string | undefined>} codes - The `extensions.code` of each GraphQL error.
|
|
38
|
+
* @param {ErrorOptions} [options] - The standard error options, such as `cause`.
|
|
39
|
+
* @example
|
|
40
|
+
* new AdminApiResponseError('Forbidden', ['FORBIDDEN'], { cause })
|
|
41
|
+
*/
|
|
42
|
+
constructor(message: string, codes: ReadonlyArray<string | undefined>, options?: ErrorOptions);
|
|
43
|
+
}
|
|
44
|
+
/** A typed admin GraphQL client. */
|
|
45
|
+
export interface AdminApiClient {
|
|
46
|
+
/**
|
|
47
|
+
* Executes a typed GraphQL document and returns its `data`.
|
|
48
|
+
*
|
|
49
|
+
* @template Result
|
|
50
|
+
* @template Variables
|
|
51
|
+
* @param {TadaDocumentNode<Result, Variables>} document - A gql.tada document.
|
|
52
|
+
* @param {Variables} variables - The document's variables (`{}` when it declares none).
|
|
53
|
+
* @param {AdminApiRequestOptions} [options] - Per-request options.
|
|
54
|
+
* @returns {Promise<Result>} The typed response data.
|
|
55
|
+
* @throws {AdminApiResponseError} When the API answers with GraphQL errors.
|
|
56
|
+
* @throws {Error} On network failure, timeout, or a non-2xx status without GraphQL errors.
|
|
57
|
+
*/
|
|
58
|
+
request: <Result, Variables extends Record<string, unknown>>(document: TadaDocumentNode<Result, Variables>, variables: Variables, options?: AdminApiRequestOptions) => Promise<Result>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a typed admin GraphQL client backed by graphql-request.
|
|
62
|
+
*
|
|
63
|
+
* @param {CreateAdminApiClientOptions} options - Client configuration.
|
|
64
|
+
* @returns {AdminApiClient} A client whose `request` infers result/variables from the document.
|
|
65
|
+
* @example
|
|
66
|
+
* const client = createAdminApiClient({ apiUrl: 'https://api.picked.app', token })
|
|
67
|
+
* const data = await client.request(MyDoc, { id: '1' })
|
|
68
|
+
*/
|
|
69
|
+
export declare function createAdminApiClient(options: CreateAdminApiClientOptions): AdminApiClient;
|
|
70
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,gDAAgD;AAChD,MAAM,WAAW,2BAA2B;IAC1C,+FAA+F;IAC/F,MAAM,EAAE,MAAM,CAAA;IACd,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACjD,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACrB;AAED,8DAA8D;AAC9D,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sFAAsF;IACtF,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC3C;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAkB,IAAI,2BAA0B;IAEhD,gGAAgG;IAChG,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAEjD;;;;;;;;OAQG;IACH,YAAY,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,EAG5F;CACF;AAED,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,EAC7C,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,MAAM,CAAC,CAAA;CACrB;AAiDD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,cAAc,CAqCzF"}
|