@theholocron/netlify-client 1.58.0-alpha.2 → 1.58.0-alpha.4
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/index.d.mts +44 -0
- package/dist/index.mjs +1 -0
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "@theholocron/http-client";
|
|
2
2
|
import { ErrorSink, Logger } from "@theholocron/observability/core";
|
|
3
|
+
/** Options for `createNetlifyClient`. */
|
|
3
4
|
interface NetlifyClientOptions {
|
|
4
5
|
/** Netlify Personal Access Token. */
|
|
5
6
|
token: string;
|
|
@@ -14,20 +15,33 @@ interface NetlifyClientOptions {
|
|
|
14
15
|
}
|
|
15
16
|
/** Netlify site — the subset of fields consumers read/write. */
|
|
16
17
|
interface NetlifySite {
|
|
18
|
+
/** The site's id. */
|
|
17
19
|
id: string;
|
|
20
|
+
/** The site's name. */
|
|
18
21
|
name: string;
|
|
22
|
+
/** The site's URL. */
|
|
19
23
|
url: string;
|
|
24
|
+
/** The site's HTTPS URL. */
|
|
20
25
|
ssl_url: string;
|
|
26
|
+
/** The URL of the site's page in the Netlify admin UI. */
|
|
21
27
|
admin_url: string;
|
|
28
|
+
/** The id of the account that owns the site. */
|
|
22
29
|
account_id: string;
|
|
30
|
+
/** The slug of the account that owns the site. */
|
|
23
31
|
account_slug?: string;
|
|
32
|
+
/** The site's custom domain, or `null` when none is set. */
|
|
24
33
|
custom_domain?: string | null;
|
|
25
34
|
}
|
|
35
|
+
/** What to send to Netlify to create a site. */
|
|
26
36
|
interface NetlifyCreateSiteInput {
|
|
37
|
+
/** The site's name. */
|
|
27
38
|
name: string;
|
|
39
|
+
/** A custom domain to set on the site. */
|
|
28
40
|
custom_domain?: string;
|
|
29
41
|
}
|
|
42
|
+
/** What to send to Netlify to update a site. */
|
|
30
43
|
interface NetlifyUpdateSiteInput {
|
|
44
|
+
/** The custom domain to set. */
|
|
31
45
|
custom_domain?: string;
|
|
32
46
|
}
|
|
33
47
|
/**
|
|
@@ -37,14 +51,23 @@ interface NetlifyUpdateSiteInput {
|
|
|
37
51
|
* `error`, `retrying`, `current`.
|
|
38
52
|
*/
|
|
39
53
|
interface NetlifyDeploy {
|
|
54
|
+
/** The deploy's id. */
|
|
40
55
|
id: string;
|
|
56
|
+
/** The id of the site the deploy belongs to. */
|
|
41
57
|
site_id: string;
|
|
58
|
+
/** The deploy's state, a free-form string. */
|
|
42
59
|
state: string;
|
|
60
|
+
/** The site's URL. */
|
|
43
61
|
url: string;
|
|
62
|
+
/** The site's HTTPS URL. */
|
|
44
63
|
ssl_url: string;
|
|
64
|
+
/** The URL of this specific deploy. */
|
|
45
65
|
deploy_url: string;
|
|
66
|
+
/** The branch the deploy was built from, or `null`. */
|
|
46
67
|
branch: string | null;
|
|
68
|
+
/** Why the deploy failed, when it did. */
|
|
47
69
|
error_message?: string | null;
|
|
70
|
+
/** When the deploy was created, as an ISO timestamp. */
|
|
48
71
|
created_at: string;
|
|
49
72
|
}
|
|
50
73
|
/**
|
|
@@ -66,8 +89,10 @@ interface NetlifyDeployFunctionSpec {
|
|
|
66
89
|
name: string;
|
|
67
90
|
/** Lambda runtime: `"js"` (Node.js, zipped) or `"go"` (zipped binary). */
|
|
68
91
|
runtime?: "js" | "go";
|
|
92
|
+
/** The function's zip archive. */
|
|
69
93
|
zip: Uint8Array;
|
|
70
94
|
}
|
|
95
|
+
/** What to deploy with `create()`: static files, functions, or both. */
|
|
71
96
|
interface NetlifyCreateDeployInput {
|
|
72
97
|
/** Static files, plain text — served as-is, no build step. */
|
|
73
98
|
files?: Record<string, string>;
|
|
@@ -78,25 +103,42 @@ interface NetlifyCreateDeployInput {
|
|
|
78
103
|
}
|
|
79
104
|
/** Raw transport details `create()` needs beyond the generic `RestClient` — file/function uploads send a binary body, which `RestClient.request()` can't carry (always JSON-encodes a given body). */
|
|
80
105
|
interface NetlifyRawTransport {
|
|
106
|
+
/** The Netlify token used for the upload requests. */
|
|
81
107
|
token: string;
|
|
108
|
+
/** Override base URL, as for the client. */
|
|
82
109
|
baseUrl?: string;
|
|
110
|
+
/** Override fetch, as for the client. */
|
|
83
111
|
fetch?: typeof fetch;
|
|
84
112
|
}
|
|
113
|
+
/** The deploy contexts an environment variable value can apply to. */
|
|
85
114
|
type NetlifyEnvContext = "all" | "dev" | "dev-server" | "branch-deploy" | "deploy-preview" | "production" | "branch";
|
|
115
|
+
/** One value of an environment variable, for one deploy context. */
|
|
86
116
|
interface NetlifyEnvVarValue {
|
|
117
|
+
/** The value's id. */
|
|
87
118
|
id?: string;
|
|
119
|
+
/** The variable's value in this context. */
|
|
88
120
|
value: string;
|
|
121
|
+
/** The deploy context the value applies to. */
|
|
89
122
|
context: NetlifyEnvContext;
|
|
123
|
+
/** The branch name, when `context` is `"branch"`. */
|
|
90
124
|
context_parameter?: string | null;
|
|
91
125
|
}
|
|
126
|
+
/** An environment variable on a site, with its values per context. */
|
|
92
127
|
interface NetlifyEnvVar {
|
|
128
|
+
/** The variable's name. */
|
|
93
129
|
key: string;
|
|
130
|
+
/** Where the variable is available. */
|
|
94
131
|
scopes?: Array<"builds" | "functions" | "runtime" | "post-processing">;
|
|
132
|
+
/** The variable's values, one per context. */
|
|
95
133
|
values: NetlifyEnvVarValue[];
|
|
96
134
|
}
|
|
135
|
+
/** The user the token belongs to. */
|
|
97
136
|
interface NetlifyUser {
|
|
137
|
+
/** The user's id. */
|
|
98
138
|
id?: string;
|
|
139
|
+
/** The user's full name. */
|
|
99
140
|
full_name?: string;
|
|
141
|
+
/** The user's email address. */
|
|
100
142
|
email?: string;
|
|
101
143
|
}
|
|
102
144
|
/**
|
|
@@ -120,6 +162,7 @@ interface NetlifyUser {
|
|
|
120
162
|
* function's own dependencies need).
|
|
121
163
|
*/
|
|
122
164
|
export declare function buildZip(files: Record<string, string | Uint8Array>): Uint8Array;
|
|
165
|
+
/** Creates a Netlify client with `sites`, `deploys`, `env` and `user` groups sharing one REST client. */
|
|
123
166
|
export declare function createNetlifyClient(opts: NetlifyClientOptions): {
|
|
124
167
|
sites: {
|
|
125
168
|
list: () => Promise<NetlifySite[]>;
|
|
@@ -142,5 +185,6 @@ export declare function createNetlifyClient(opts: NetlifyClientOptions): {
|
|
|
142
185
|
get: () => Promise<NetlifyUser>;
|
|
143
186
|
};
|
|
144
187
|
};
|
|
188
|
+
/** The client `createNetlifyClient` returns. */
|
|
145
189
|
export type NetlifyClient = ReturnType<typeof createNetlifyClient>;
|
|
146
190
|
export type { NetlifyClientOptions, NetlifyCreateDeployInput, NetlifyCreateSiteInput, NetlifyDeploy, NetlifyDeployFunctionSpec, NetlifyEnvContext, NetlifyEnvVar, NetlifyEnvVarValue, NetlifyRawTransport, NetlifySite, NetlifyUpdateSiteInput, NetlifyUser };
|
package/dist/index.mjs
CHANGED
|
@@ -275,6 +275,7 @@ function buildZip(files) {
|
|
|
275
275
|
return total;
|
|
276
276
|
}
|
|
277
277
|
// src/index.ts
|
|
278
|
+
/** Creates a Netlify client with `sites`, `deploys`, `env` and `user` groups sharing one REST client. */
|
|
278
279
|
function createNetlifyClient(opts) {
|
|
279
280
|
const rest = createNetlifyRestClient(opts);
|
|
280
281
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/netlify-client",
|
|
3
|
-
"version": "1.58.0-alpha.
|
|
3
|
+
"version": "1.58.0-alpha.4",
|
|
4
4
|
"description": "A TypeScript client for the Netlify API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"netlify",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/http-client": "^1.58.0-alpha.
|
|
35
|
+
"@theholocron/http-client": "^1.58.0-alpha.4",
|
|
36
36
|
"@theholocron/observability": "^0.6.1-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"tsdown": "^0.23.3",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^5.0.5",
|
|
48
|
-
"@theholocron/eslint-config": "^8.9.0-alpha.
|
|
49
|
-
"@theholocron/
|
|
50
|
-
"@theholocron/vitest-config": "^8.9.0-alpha.
|
|
51
|
-
"@theholocron/
|
|
48
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.5",
|
|
49
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.5",
|
|
50
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.5",
|
|
51
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.5"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22.0.0"
|