@studiometa/forge-sdk 0.4.5 → 0.4.7
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/README.md +19 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +304 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/daemons.d.ts +9 -0
- package/dist/resources/daemons.d.ts.map +1 -1
- package/dist/resources/php.d.ts +151 -0
- package/dist/resources/php.d.ts.map +1 -0
- package/dist/resources/servers.d.ts +6 -0
- package/dist/resources/servers.d.ts.map +1 -1
- package/dist/resources/services.d.ts +74 -0
- package/dist/resources/services.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { HttpClient, PhpVersionAttributes } from "@studiometa/forge-api";
|
|
2
|
+
import { BaseCollection } from "./base.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The PHP configuration files that Forge can read and write.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PHP_CONFIG_TYPES: readonly ["cli", "fpm", "pool"];
|
|
7
|
+
/**
|
|
8
|
+
* A PHP configuration file that Forge can read and write.
|
|
9
|
+
*/
|
|
10
|
+
export type PhpConfigType = (typeof PHP_CONFIG_TYPES)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Options for listing PHP versions.
|
|
13
|
+
*/
|
|
14
|
+
export interface PhpVersionListOptions {
|
|
15
|
+
/** Cursor for pagination (from previous response's next_cursor). */
|
|
16
|
+
cursor?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for reading or writing a PHP configuration file.
|
|
20
|
+
*/
|
|
21
|
+
export interface PhpConfigOptions {
|
|
22
|
+
/** Unix user of the FPM pool (pool only). */
|
|
23
|
+
user?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* PHP on a server — installed versions, configuration files, limits and OPcache.
|
|
27
|
+
*
|
|
28
|
+
* Access via `forge.server(id).php`.
|
|
29
|
+
*
|
|
30
|
+
* Version methods take the PHP version ID from `list()`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const versions = await forge.server(123).php.list();
|
|
35
|
+
* const fpm = await forge.server(123).php.config(versions[0].id, 'fpm');
|
|
36
|
+
* await forge.server(123).php.setMaxUploadSize(64);
|
|
37
|
+
* await forge.server(123).php.enableOpcache();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class PhpResource extends BaseCollection {
|
|
41
|
+
private readonly serverId;
|
|
42
|
+
/** @internal */
|
|
43
|
+
constructor(client: HttpClient, orgSlug: string, serverId: number);
|
|
44
|
+
private get basePath();
|
|
45
|
+
/**
|
|
46
|
+
* List the PHP versions installed on this server.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const versions = await forge.server(123).php.list();
|
|
51
|
+
* // → [{ id: 12, version: '8.3', binary_name: 'php8.3', status: 'installed', ... }]
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
list(options?: PhpVersionListOptions): Promise<Array<PhpVersionAttributes & {
|
|
55
|
+
id: number;
|
|
56
|
+
}>>;
|
|
57
|
+
/**
|
|
58
|
+
* Get one installed PHP version.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const version = await forge.server(123).php.get(12);
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
get(versionId: number): Promise<PhpVersionAttributes & {
|
|
66
|
+
id: number;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Get a PHP configuration file (cli, fpm or pool) of a version.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const ini = await forge.server(123).php.config(12, 'fpm');
|
|
74
|
+
* const pool = await forge.server(123).php.config(12, 'pool', { user: 'forge' });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
config(versionId: number, type: PhpConfigType, options?: PhpConfigOptions): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Replace a PHP configuration file (cli, fpm or pool) of a version.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* await forge.server(123).php.updateConfig(12, 'fpm', 'memory_limit = 512M\n...');
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
updateConfig(versionId: number, type: PhpConfigType, content: string, options?: PhpConfigOptions): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Get the PHP max upload size, in megabytes.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const size = await forge.server(123).php.maxUploadSize(); // → "64"
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
maxUploadSize(): Promise<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Set the PHP max upload size, in megabytes.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* await forge.server(123).php.setMaxUploadSize(128);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
setMaxUploadSize(size: number): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Get the PHP max execution time, in seconds.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const seconds = await forge.server(123).php.maxExecutionTime(); // → "60"
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
maxExecutionTime(): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Set the PHP max execution time, in seconds.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* await forge.server(123).php.setMaxExecutionTime(120);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
setMaxExecutionTime(seconds: number): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Get whether OPcache is enabled.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const enabled = await forge.server(123).php.opcache(); // → true
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
opcache(): Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* Enable OPcache.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* await forge.server(123).php.enableOpcache();
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
enableOpcache(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Disable OPcache.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* await forge.server(123).php.disableOpcache();
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
disableOpcache(): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=php.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/resources/php.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAOV,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,gBAAgB,YAAI,KAAK,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAkBD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,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AED;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;CACF"}
|
|
@@ -10,6 +10,8 @@ import { MonitorsCollection } from "./monitors.ts";
|
|
|
10
10
|
import { FirewallRulesCollection } from "./firewall-rules.ts";
|
|
11
11
|
import { SshKeysCollection } from "./ssh-keys.ts";
|
|
12
12
|
import { NginxTemplatesCollection } from "./nginx-templates.ts";
|
|
13
|
+
import { ServicesCollection } from "./services.ts";
|
|
14
|
+
import { PhpResource } from "./php.ts";
|
|
13
15
|
import { BaseCollection } from "./base.ts";
|
|
14
16
|
/**
|
|
15
17
|
* A matched resource item with ID and name.
|
|
@@ -200,6 +202,10 @@ export declare class ServerResource extends BaseCollection {
|
|
|
200
202
|
readonly sshKeys: SshKeysCollection;
|
|
201
203
|
/** Nginx templates on this server. */
|
|
202
204
|
readonly nginxTemplates: NginxTemplatesCollection;
|
|
205
|
+
/** Services (nginx, php, mysql, etc.) on this server. */
|
|
206
|
+
readonly services: ServicesCollection;
|
|
207
|
+
/** PHP versions, configuration files, limits and OPcache on this server. */
|
|
208
|
+
readonly php: PhpResource;
|
|
203
209
|
/** @internal */
|
|
204
210
|
constructor(client: HttpClient, orgSlug: string, serverId: number);
|
|
205
211
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../src/resources/servers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EAGV,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,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C;IAEpC,sCAAsC;IACtC,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC;IAElD,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAEtC,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,gBAAgB;IAChB,YACE,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,EACE,QAAQ,EAAE,MAAM,EAelC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAEjC;IAED;;;;;;;OAOG;IACG,GAAG,IAAI,OAAO,CAAC,gBAAgB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAKtD;IAED;;;;;;;OAOG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAED;;;;;;;OAOG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { HttpClient } from "@studiometa/forge-api";
|
|
2
|
+
import { BaseCollection } from "./base.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The six restartable services exposed by the Forge v2 API.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RESTARTABLE_SERVICES: readonly ["nginx", "php", "mysql", "postgres", "redis", "supervisor"];
|
|
7
|
+
export type RestartableService = (typeof RESTARTABLE_SERVICES)[number];
|
|
8
|
+
/**
|
|
9
|
+
* A single service availability row.
|
|
10
|
+
*
|
|
11
|
+
* `available` is a documented heuristic derived from the server object, since
|
|
12
|
+
* the API has no services GET endpoint.
|
|
13
|
+
*/
|
|
14
|
+
export interface ServiceStatus {
|
|
15
|
+
service: string;
|
|
16
|
+
available: boolean;
|
|
17
|
+
detail: string | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for restarting a service.
|
|
21
|
+
*/
|
|
22
|
+
export interface RestartServiceOptions {
|
|
23
|
+
/** PHP version (e.g. "php83") — required when restarting the php service. */
|
|
24
|
+
version?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Services on a server — list availability and restart individual services.
|
|
28
|
+
*
|
|
29
|
+
* Access via `forge.server(id).services`.
|
|
30
|
+
*
|
|
31
|
+
* The v2 API has no GET endpoint for services, so `list()` derives availability
|
|
32
|
+
* from the server object. Restarting maps to the API action `reboot`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // List services and their availability
|
|
37
|
+
* const services = await forge.server(123).services.list();
|
|
38
|
+
*
|
|
39
|
+
* // Restart nginx
|
|
40
|
+
* await forge.server(123).services.restart('nginx');
|
|
41
|
+
*
|
|
42
|
+
* // Restart php (version required)
|
|
43
|
+
* await forge.server(123).services.restart('php', { version: 'php83' });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class ServicesCollection extends BaseCollection {
|
|
47
|
+
private readonly serverId;
|
|
48
|
+
/** @internal */
|
|
49
|
+
constructor(client: HttpClient, orgSlug: string, serverId: number);
|
|
50
|
+
private get basePath();
|
|
51
|
+
/**
|
|
52
|
+
* List services on this server with a derived availability flag.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const services = await forge.server(123).services.list();
|
|
57
|
+
* // → [{ service: 'nginx', available: true, detail: null }, ...]
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
list(): Promise<ServiceStatus[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Restart a service on this server.
|
|
63
|
+
*
|
|
64
|
+
* Maps to the API action `reboot`. The php service requires a `version`.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* await forge.server(123).services.restart('nginx');
|
|
69
|
+
* await forge.server(123).services.restart('php', { version: 'php83' });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
restart(service: string, options?: RestartServiceOptions): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/resources/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAqC,MAAM,uBAAuB,CAAC;AAI3F,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,oBAAoB,YAC/B,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,EACV,OAAO,EACP,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;IAKlD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAJ3B,gBAAgB;IAChB,YACE,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,EACE,QAAQ,EAAE,MAAM,EAGlC;IAED,OAAO,KAAK,QAAQ,GAEnB;IAED;;;;;;;;OAQG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAoBrC;IAED;;;;;;;;;;OAUG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAejF;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/forge-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Laravel Forge TypeScript SDK — fluent, chainable, fully-typed API client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typecheck": "tsgo -p tsconfig.typecheck.json --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@studiometa/forge-api": "0.4.
|
|
47
|
+
"@studiometa/forge-api": "0.4.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@typescript/native-preview": "^7.0.0-dev.20260409.1",
|