@studiometa/forge-core 0.4.4 → 0.4.6
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/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/executors/daemons/get-log.d.ts +7 -0
- package/dist/executors/daemons/get-log.d.ts.map +1 -0
- package/dist/executors/daemons/index.d.ts +2 -1
- package/dist/executors/daemons/index.d.ts.map +1 -1
- package/dist/executors/daemons/types.d.ts +7 -0
- package/dist/executors/daemons/types.d.ts.map +1 -1
- package/dist/executors/services/index.d.ts +5 -0
- package/dist/executors/services/index.d.ts.map +1 -0
- package/dist/executors/services/list.d.ts +17 -0
- package/dist/executors/services/list.d.ts.map +1 -0
- package/dist/executors/services/restart.d.ts +11 -0
- package/dist/executors/services/restart.d.ts.map +1 -0
- package/dist/executors/services/types.d.ts +39 -0
- package/dist/executors/services/types.d.ts.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +300 -5
- package/dist/index.js.map +1 -1
- package/dist/routes.d.ts +6 -0
- package/dist/routes.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,12 +2,13 @@ import { createWriteStream, mkdirSync } from "node:fs";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import pino from "pino";
|
|
5
|
-
import { BackgroundProcessAttributesSchema, BackupConfigAttributesSchema, CertificateAttributesSchema, CommandAttributesSchema, DatabaseAttributesSchema, DatabaseUserAttributesSchema, DeploymentAttributesSchema, DeploymentOutputAttributesSchema, DeploymentScriptAttributesSchema, EnvironmentAttributesSchema, FirewallRuleAttributesSchema, MonitorAttributesSchema, NginxTemplateAttributesSchema, RecipeAttributesSchema, RedirectRuleAttributesSchema, ScheduledJobAttributesSchema, SecurityRuleAttributesSchema, ServerAttributesSchema, SiteAttributesSchema, SshKeyAttributesSchema, UserAttributesSchema, jsonApiDocumentSchema, jsonApiListDocumentSchema, unwrapDocument, unwrapListDocument } from "@studiometa/forge-api";
|
|
5
|
+
import { BackgroundProcessAttributesSchema, BackgroundProcessLogAttributesSchema, BackupConfigAttributesSchema, CertificateAttributesSchema, CommandAttributesSchema, DatabaseAttributesSchema, DatabaseUserAttributesSchema, DeploymentAttributesSchema, DeploymentOutputAttributesSchema, DeploymentScriptAttributesSchema, EnvironmentAttributesSchema, FirewallRuleAttributesSchema, MonitorAttributesSchema, NginxTemplateAttributesSchema, RecipeAttributesSchema, RedirectRuleAttributesSchema, ScheduledJobAttributesSchema, SecurityRuleAttributesSchema, ServerAttributesSchema, SiteAttributesSchema, SshKeyAttributesSchema, UserAttributesSchema, jsonApiDocumentSchema, jsonApiListDocumentSchema, unwrapDocument, unwrapListDocument } from "@studiometa/forge-api";
|
|
6
|
+
//#region src/constants.ts
|
|
6
7
|
/**
|
|
7
8
|
* All supported resources.
|
|
8
9
|
* Single source of truth — MCP schema and handlers derive from this.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
var RESOURCES = [
|
|
11
12
|
"servers",
|
|
12
13
|
"sites",
|
|
13
14
|
"deployments",
|
|
@@ -27,6 +28,7 @@ const RESOURCES = [
|
|
|
27
28
|
"backups",
|
|
28
29
|
"commands",
|
|
29
30
|
"scheduled-jobs",
|
|
31
|
+
"services",
|
|
30
32
|
"user",
|
|
31
33
|
"batch"
|
|
32
34
|
];
|
|
@@ -34,7 +36,7 @@ const RESOURCES = [
|
|
|
34
36
|
* All supported actions.
|
|
35
37
|
* Single source of truth — MCP schema and handlers derive from this.
|
|
36
38
|
*/
|
|
37
|
-
|
|
39
|
+
var ACTIONS = [
|
|
38
40
|
"list",
|
|
39
41
|
"get",
|
|
40
42
|
"create",
|
|
@@ -50,6 +52,8 @@ const ACTIONS = [
|
|
|
50
52
|
"schema",
|
|
51
53
|
"context"
|
|
52
54
|
];
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/utils/name-matcher.ts
|
|
53
57
|
/**
|
|
54
58
|
* Match items by name using case-insensitive exact and partial matching.
|
|
55
59
|
*
|
|
@@ -65,6 +69,8 @@ function matchByName(items, query, getName) {
|
|
|
65
69
|
partial: items.filter((item) => getName(item).toLowerCase().includes(lower))
|
|
66
70
|
};
|
|
67
71
|
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/logger.ts
|
|
68
74
|
/**
|
|
69
75
|
* Sensitive fields to strip from logged args.
|
|
70
76
|
* These are replaced with '[REDACTED]' to prevent token leakage.
|
|
@@ -124,6 +130,8 @@ function createAuditLogger(source) {
|
|
|
124
130
|
} catch {}
|
|
125
131
|
} };
|
|
126
132
|
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/context.ts
|
|
127
135
|
/**
|
|
128
136
|
* Create a test executor context with a mock HTTP client.
|
|
129
137
|
*
|
|
@@ -139,6 +147,8 @@ function createTestExecutorContext(overrides = {}) {
|
|
|
139
147
|
...overrides
|
|
140
148
|
};
|
|
141
149
|
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/test-helpers.ts
|
|
142
152
|
/**
|
|
143
153
|
* Create a mock JSON:API resource.
|
|
144
154
|
*/
|
|
@@ -173,6 +183,8 @@ function mockListDocument(type, items) {
|
|
|
173
183
|
}
|
|
174
184
|
};
|
|
175
185
|
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region ../../node_modules/valibot/dist/index.mjs
|
|
176
188
|
var store$4;
|
|
177
189
|
/**
|
|
178
190
|
* Returns the global configuration.
|
|
@@ -219,7 +231,9 @@ function parse(schema, input, config$1) {
|
|
|
219
231
|
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
220
232
|
return dataset.value;
|
|
221
233
|
}
|
|
222
|
-
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/routes.ts
|
|
236
|
+
var ROUTES = {
|
|
223
237
|
servers: {
|
|
224
238
|
list: {
|
|
225
239
|
method: "GET",
|
|
@@ -630,6 +644,10 @@ const ROUTES = {
|
|
|
630
644
|
path: "/orgs/:org/servers/:server_id/sites/:site_id/scheduled-jobs/:id/output"
|
|
631
645
|
}
|
|
632
646
|
},
|
|
647
|
+
services: { action: {
|
|
648
|
+
method: "POST",
|
|
649
|
+
path: "/orgs/:org/servers/:server_id/services/:service/actions"
|
|
650
|
+
} },
|
|
633
651
|
user: { get: {
|
|
634
652
|
method: "GET",
|
|
635
653
|
path: "/user"
|
|
@@ -687,6 +705,8 @@ async function request(route, ctx, params = {}, options) {
|
|
|
687
705
|
if (options?.schema) return parse(options.schema, response);
|
|
688
706
|
return response;
|
|
689
707
|
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/executors/servers/create.ts
|
|
690
710
|
/**
|
|
691
711
|
* Create a new server.
|
|
692
712
|
*/
|
|
@@ -696,6 +716,8 @@ async function createServer(options, ctx) {
|
|
|
696
716
|
schema: jsonApiDocumentSchema(ServerAttributesSchema)
|
|
697
717
|
})) };
|
|
698
718
|
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/executors/servers/delete.ts
|
|
699
721
|
/**
|
|
700
722
|
* Delete a server.
|
|
701
723
|
*/
|
|
@@ -703,18 +725,24 @@ async function deleteServer(options, ctx) {
|
|
|
703
725
|
await request(ROUTES.servers.delete, ctx, { server_id: options.server_id });
|
|
704
726
|
return { data: void 0 };
|
|
705
727
|
}
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/executors/servers/get.ts
|
|
706
730
|
/**
|
|
707
731
|
* Get a specific server by ID.
|
|
708
732
|
*/
|
|
709
733
|
async function getServer(options, ctx) {
|
|
710
734
|
return { data: unwrapDocument(await request(ROUTES.servers.get, ctx, { server_id: options.server_id }, { schema: jsonApiDocumentSchema(ServerAttributesSchema) })) };
|
|
711
735
|
}
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/executors/servers/list.ts
|
|
712
738
|
/**
|
|
713
739
|
* List all servers.
|
|
714
740
|
*/
|
|
715
741
|
async function listServers(_options, ctx) {
|
|
716
742
|
return { data: unwrapListDocument(await request(ROUTES.servers.list, ctx, {}, { schema: jsonApiListDocumentSchema(ServerAttributesSchema) })) };
|
|
717
743
|
}
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/executors/servers/reboot.ts
|
|
718
746
|
/**
|
|
719
747
|
* Reboot a server.
|
|
720
748
|
*/
|
|
@@ -722,6 +750,8 @@ async function rebootServer(options, ctx) {
|
|
|
722
750
|
await request(ROUTES.servers.reboot, ctx, { server_id: options.server_id }, { body: { action: "reboot" } });
|
|
723
751
|
return { data: void 0 };
|
|
724
752
|
}
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/executors/servers/resolve.ts
|
|
725
755
|
/**
|
|
726
756
|
* Resolve servers by name — partial, case-insensitive match.
|
|
727
757
|
*
|
|
@@ -740,6 +770,8 @@ async function resolveServers(options, ctx) {
|
|
|
740
770
|
total: matches.length
|
|
741
771
|
} };
|
|
742
772
|
}
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region src/executors/sites/create.ts
|
|
743
775
|
/**
|
|
744
776
|
* Create a new site on a server.
|
|
745
777
|
*/
|
|
@@ -750,6 +782,8 @@ async function createSite(options, ctx) {
|
|
|
750
782
|
schema: jsonApiDocumentSchema(SiteAttributesSchema)
|
|
751
783
|
})) };
|
|
752
784
|
}
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/executors/sites/delete.ts
|
|
753
787
|
/**
|
|
754
788
|
* Delete a site.
|
|
755
789
|
*/
|
|
@@ -760,6 +794,8 @@ async function deleteSite(options, ctx) {
|
|
|
760
794
|
});
|
|
761
795
|
return { data: void 0 };
|
|
762
796
|
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/executors/sites/get.ts
|
|
763
799
|
/**
|
|
764
800
|
* Get a specific site by ID.
|
|
765
801
|
*
|
|
@@ -769,12 +805,16 @@ async function deleteSite(options, ctx) {
|
|
|
769
805
|
async function getSite(options, ctx) {
|
|
770
806
|
return { data: unwrapDocument(await request(ROUTES.sites.get, ctx, { site_id: options.site_id }, { schema: jsonApiDocumentSchema(SiteAttributesSchema) })) };
|
|
771
807
|
}
|
|
808
|
+
//#endregion
|
|
809
|
+
//#region src/executors/sites/list.ts
|
|
772
810
|
/**
|
|
773
811
|
* List all sites on a server.
|
|
774
812
|
*/
|
|
775
813
|
async function listSites(options, ctx) {
|
|
776
814
|
return { data: unwrapListDocument(await request(ROUTES.sites.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(SiteAttributesSchema) })) };
|
|
777
815
|
}
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region src/executors/sites/resolve.ts
|
|
778
818
|
/**
|
|
779
819
|
* Resolve sites by domain name — partial, case-insensitive match.
|
|
780
820
|
*/
|
|
@@ -790,6 +830,8 @@ async function resolveSites(options, ctx) {
|
|
|
790
830
|
total: matches.length
|
|
791
831
|
} };
|
|
792
832
|
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/executors/sites/update.ts
|
|
793
835
|
/**
|
|
794
836
|
* Update an existing site on a server.
|
|
795
837
|
*/
|
|
@@ -803,6 +845,8 @@ async function updateSite(options, ctx) {
|
|
|
803
845
|
schema: jsonApiDocumentSchema(SiteAttributesSchema)
|
|
804
846
|
})) };
|
|
805
847
|
}
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/executors/deployments/deploy.ts
|
|
806
850
|
/**
|
|
807
851
|
* Trigger a deployment for a site.
|
|
808
852
|
*/
|
|
@@ -813,6 +857,8 @@ async function deploySite(options, ctx) {
|
|
|
813
857
|
}, { body: {} });
|
|
814
858
|
return { data: void 0 };
|
|
815
859
|
}
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region src/executors/deployments/deploy-and-wait.ts
|
|
816
862
|
/**
|
|
817
863
|
* Trigger a deployment and wait for it to complete, streaming logs in real time.
|
|
818
864
|
*
|
|
@@ -906,6 +952,8 @@ async function deploySiteAndWait(options, ctx) {
|
|
|
906
952
|
elapsed_ms
|
|
907
953
|
} };
|
|
908
954
|
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/executors/deployments/get-log.ts
|
|
909
957
|
/**
|
|
910
958
|
* Get the deployment log for a site.
|
|
911
959
|
*/
|
|
@@ -916,6 +964,8 @@ async function getDeploymentLog(options, ctx) {
|
|
|
916
964
|
id: options.deployment_id
|
|
917
965
|
}, { schema: jsonApiDocumentSchema(DeploymentOutputAttributesSchema) })).output };
|
|
918
966
|
}
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/executors/deployments/get-script.ts
|
|
919
969
|
/**
|
|
920
970
|
* Get the deployment script for a site.
|
|
921
971
|
*/
|
|
@@ -925,6 +975,8 @@ async function getDeploymentScript(options, ctx) {
|
|
|
925
975
|
site_id: options.site_id
|
|
926
976
|
}, { schema: jsonApiDocumentSchema(DeploymentScriptAttributesSchema) })).content };
|
|
927
977
|
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/executors/deployments/list.ts
|
|
928
980
|
/**
|
|
929
981
|
* List all deployments for a site.
|
|
930
982
|
*/
|
|
@@ -937,6 +989,8 @@ async function listDeployments(options, ctx) {
|
|
|
937
989
|
schema: jsonApiListDocumentSchema(DeploymentAttributesSchema)
|
|
938
990
|
})) };
|
|
939
991
|
}
|
|
992
|
+
//#endregion
|
|
993
|
+
//#region src/executors/deployments/update-script.ts
|
|
940
994
|
/**
|
|
941
995
|
* Update the deployment script for a site.
|
|
942
996
|
*/
|
|
@@ -947,6 +1001,8 @@ async function updateDeploymentScript(options, ctx) {
|
|
|
947
1001
|
}, { body: { content: options.content } });
|
|
948
1002
|
return { data: void 0 };
|
|
949
1003
|
}
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/executors/certificates/activate.ts
|
|
950
1006
|
/**
|
|
951
1007
|
* Activate the SSL certificate for a domain.
|
|
952
1008
|
*/
|
|
@@ -958,6 +1014,8 @@ async function activateCertificate(options, ctx) {
|
|
|
958
1014
|
}, { body: { action: "activate" } });
|
|
959
1015
|
return { data: void 0 };
|
|
960
1016
|
}
|
|
1017
|
+
//#endregion
|
|
1018
|
+
//#region src/executors/certificates/create.ts
|
|
961
1019
|
/**
|
|
962
1020
|
* Create an SSL certificate for a domain.
|
|
963
1021
|
*/
|
|
@@ -972,6 +1030,8 @@ async function createCertificate(options, ctx) {
|
|
|
972
1030
|
schema: jsonApiDocumentSchema(CertificateAttributesSchema)
|
|
973
1031
|
})) };
|
|
974
1032
|
}
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/executors/certificates/delete.ts
|
|
975
1035
|
/**
|
|
976
1036
|
* Delete the SSL certificate for a domain.
|
|
977
1037
|
*/
|
|
@@ -983,6 +1043,8 @@ async function deleteCertificate(options, ctx) {
|
|
|
983
1043
|
});
|
|
984
1044
|
return { data: void 0 };
|
|
985
1045
|
}
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/executors/certificates/get.ts
|
|
986
1048
|
/**
|
|
987
1049
|
* Get the SSL certificate for a domain.
|
|
988
1050
|
*/
|
|
@@ -993,6 +1055,8 @@ async function getCertificate(options, ctx) {
|
|
|
993
1055
|
domain_id: options.domain_id
|
|
994
1056
|
}, { schema: jsonApiDocumentSchema(CertificateAttributesSchema) })) };
|
|
995
1057
|
}
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region src/executors/databases/create.ts
|
|
996
1060
|
/**
|
|
997
1061
|
* Create a new database.
|
|
998
1062
|
*/
|
|
@@ -1003,6 +1067,8 @@ async function createDatabase(options, ctx) {
|
|
|
1003
1067
|
schema: jsonApiDocumentSchema(DatabaseAttributesSchema)
|
|
1004
1068
|
})) };
|
|
1005
1069
|
}
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region src/executors/databases/delete.ts
|
|
1006
1072
|
/**
|
|
1007
1073
|
* Delete a database.
|
|
1008
1074
|
*/
|
|
@@ -1013,6 +1079,8 @@ async function deleteDatabase(options, ctx) {
|
|
|
1013
1079
|
});
|
|
1014
1080
|
return { data: void 0 };
|
|
1015
1081
|
}
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region src/executors/databases/get.ts
|
|
1016
1084
|
/**
|
|
1017
1085
|
* Get a single database.
|
|
1018
1086
|
*/
|
|
@@ -1022,12 +1090,16 @@ async function getDatabase(options, ctx) {
|
|
|
1022
1090
|
id: options.id
|
|
1023
1091
|
}, { schema: jsonApiDocumentSchema(DatabaseAttributesSchema) })) };
|
|
1024
1092
|
}
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/executors/databases/list.ts
|
|
1025
1095
|
/**
|
|
1026
1096
|
* List databases on a server.
|
|
1027
1097
|
*/
|
|
1028
1098
|
async function listDatabases(options, ctx) {
|
|
1029
1099
|
return { data: unwrapListDocument(await request(ROUTES.databases.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(DatabaseAttributesSchema) })) };
|
|
1030
1100
|
}
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src/executors/database-users/create.ts
|
|
1031
1103
|
/**
|
|
1032
1104
|
* Create a new database user.
|
|
1033
1105
|
*/
|
|
@@ -1038,6 +1110,8 @@ async function createDatabaseUser(options, ctx) {
|
|
|
1038
1110
|
schema: jsonApiDocumentSchema(DatabaseUserAttributesSchema)
|
|
1039
1111
|
})) };
|
|
1040
1112
|
}
|
|
1113
|
+
//#endregion
|
|
1114
|
+
//#region src/executors/database-users/delete.ts
|
|
1041
1115
|
/**
|
|
1042
1116
|
* Delete a database user.
|
|
1043
1117
|
*/
|
|
@@ -1048,6 +1122,8 @@ async function deleteDatabaseUser(options, ctx) {
|
|
|
1048
1122
|
});
|
|
1049
1123
|
return { data: void 0 };
|
|
1050
1124
|
}
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region src/executors/database-users/get.ts
|
|
1051
1127
|
/**
|
|
1052
1128
|
* Get a single database user.
|
|
1053
1129
|
*/
|
|
@@ -1057,12 +1133,16 @@ async function getDatabaseUser(options, ctx) {
|
|
|
1057
1133
|
id: options.id
|
|
1058
1134
|
}, { schema: jsonApiDocumentSchema(DatabaseUserAttributesSchema) })) };
|
|
1059
1135
|
}
|
|
1136
|
+
//#endregion
|
|
1137
|
+
//#region src/executors/database-users/list.ts
|
|
1060
1138
|
/**
|
|
1061
1139
|
* List database users on a server.
|
|
1062
1140
|
*/
|
|
1063
1141
|
async function listDatabaseUsers(options, ctx) {
|
|
1064
1142
|
return { data: unwrapListDocument(await request(ROUTES.databaseUsers.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(DatabaseUserAttributesSchema) })) };
|
|
1065
1143
|
}
|
|
1144
|
+
//#endregion
|
|
1145
|
+
//#region src/executors/database-users/update.ts
|
|
1066
1146
|
/**
|
|
1067
1147
|
* Update an existing database user.
|
|
1068
1148
|
*/
|
|
@@ -1076,6 +1156,8 @@ async function updateDatabaseUser(options, ctx) {
|
|
|
1076
1156
|
schema: jsonApiDocumentSchema(DatabaseUserAttributesSchema)
|
|
1077
1157
|
})) };
|
|
1078
1158
|
}
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region src/executors/daemons/create.ts
|
|
1079
1161
|
/**
|
|
1080
1162
|
* Create a new daemon.
|
|
1081
1163
|
*/
|
|
@@ -1086,6 +1168,8 @@ async function createDaemon(options, ctx) {
|
|
|
1086
1168
|
schema: jsonApiDocumentSchema(BackgroundProcessAttributesSchema)
|
|
1087
1169
|
})) };
|
|
1088
1170
|
}
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region src/executors/daemons/delete.ts
|
|
1089
1173
|
/**
|
|
1090
1174
|
* Delete a daemon.
|
|
1091
1175
|
*/
|
|
@@ -1096,6 +1180,8 @@ async function deleteDaemon(options, ctx) {
|
|
|
1096
1180
|
});
|
|
1097
1181
|
return { data: void 0 };
|
|
1098
1182
|
}
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region src/executors/daemons/get.ts
|
|
1099
1185
|
/**
|
|
1100
1186
|
* Get a single daemon.
|
|
1101
1187
|
*/
|
|
@@ -1105,12 +1191,27 @@ async function getDaemon(options, ctx) {
|
|
|
1105
1191
|
id: options.id
|
|
1106
1192
|
}, { schema: jsonApiDocumentSchema(BackgroundProcessAttributesSchema) })) };
|
|
1107
1193
|
}
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/executors/daemons/get-log.ts
|
|
1196
|
+
/**
|
|
1197
|
+
* Get the log output for a daemon (background process).
|
|
1198
|
+
*/
|
|
1199
|
+
async function getDaemonLog(options, ctx) {
|
|
1200
|
+
return { data: unwrapDocument(await request(ROUTES.daemons.log, ctx, {
|
|
1201
|
+
server_id: options.server_id,
|
|
1202
|
+
id: options.id
|
|
1203
|
+
}, { schema: jsonApiDocumentSchema(BackgroundProcessLogAttributesSchema) })).content };
|
|
1204
|
+
}
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/executors/daemons/list.ts
|
|
1108
1207
|
/**
|
|
1109
1208
|
* List daemons on a server.
|
|
1110
1209
|
*/
|
|
1111
1210
|
async function listDaemons(options, ctx) {
|
|
1112
1211
|
return { data: unwrapListDocument(await request(ROUTES.daemons.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(BackgroundProcessAttributesSchema) })) };
|
|
1113
1212
|
}
|
|
1213
|
+
//#endregion
|
|
1214
|
+
//#region src/executors/daemons/restart.ts
|
|
1114
1215
|
/**
|
|
1115
1216
|
* Restart a daemon.
|
|
1116
1217
|
*/
|
|
@@ -1121,6 +1222,8 @@ async function restartDaemon(options, ctx) {
|
|
|
1121
1222
|
}, { body: { action: "restart" } });
|
|
1122
1223
|
return { data: void 0 };
|
|
1123
1224
|
}
|
|
1225
|
+
//#endregion
|
|
1226
|
+
//#region src/executors/daemons/update.ts
|
|
1124
1227
|
/**
|
|
1125
1228
|
* Update an existing daemon.
|
|
1126
1229
|
*/
|
|
@@ -1134,6 +1237,8 @@ async function updateDaemon(options, ctx) {
|
|
|
1134
1237
|
schema: jsonApiDocumentSchema(BackgroundProcessAttributesSchema)
|
|
1135
1238
|
})) };
|
|
1136
1239
|
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region src/executors/firewall-rules/create.ts
|
|
1137
1242
|
/**
|
|
1138
1243
|
* Create a firewall rule.
|
|
1139
1244
|
*/
|
|
@@ -1142,6 +1247,8 @@ async function createFirewallRule(options, ctx) {
|
|
|
1142
1247
|
await request(ROUTES.firewallRules.create, ctx, { server_id }, { body: data });
|
|
1143
1248
|
return { data: void 0 };
|
|
1144
1249
|
}
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region src/executors/firewall-rules/delete.ts
|
|
1145
1252
|
/**
|
|
1146
1253
|
* Delete a firewall rule.
|
|
1147
1254
|
*/
|
|
@@ -1152,6 +1259,8 @@ async function deleteFirewallRule(options, ctx) {
|
|
|
1152
1259
|
});
|
|
1153
1260
|
return { data: void 0 };
|
|
1154
1261
|
}
|
|
1262
|
+
//#endregion
|
|
1263
|
+
//#region src/executors/firewall-rules/get.ts
|
|
1155
1264
|
/**
|
|
1156
1265
|
* Get a single firewall rule.
|
|
1157
1266
|
*/
|
|
@@ -1161,12 +1270,16 @@ async function getFirewallRule(options, ctx) {
|
|
|
1161
1270
|
id: options.id
|
|
1162
1271
|
}, { schema: jsonApiDocumentSchema(FirewallRuleAttributesSchema) })) };
|
|
1163
1272
|
}
|
|
1273
|
+
//#endregion
|
|
1274
|
+
//#region src/executors/firewall-rules/list.ts
|
|
1164
1275
|
/**
|
|
1165
1276
|
* List firewall rules on a server.
|
|
1166
1277
|
*/
|
|
1167
1278
|
async function listFirewallRules(options, ctx) {
|
|
1168
1279
|
return { data: unwrapListDocument(await request(ROUTES.firewallRules.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(FirewallRuleAttributesSchema) })) };
|
|
1169
1280
|
}
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/executors/ssh-keys/create.ts
|
|
1170
1283
|
/**
|
|
1171
1284
|
* Create an SSH key.
|
|
1172
1285
|
*/
|
|
@@ -1175,6 +1288,8 @@ async function createSshKey(options, ctx) {
|
|
|
1175
1288
|
await request(ROUTES.sshKeys.create, ctx, { server_id }, { body: data });
|
|
1176
1289
|
return { data: void 0 };
|
|
1177
1290
|
}
|
|
1291
|
+
//#endregion
|
|
1292
|
+
//#region src/executors/ssh-keys/delete.ts
|
|
1178
1293
|
/**
|
|
1179
1294
|
* Delete an SSH key.
|
|
1180
1295
|
*/
|
|
@@ -1185,6 +1300,8 @@ async function deleteSshKey(options, ctx) {
|
|
|
1185
1300
|
});
|
|
1186
1301
|
return { data: void 0 };
|
|
1187
1302
|
}
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/executors/ssh-keys/get.ts
|
|
1188
1305
|
/**
|
|
1189
1306
|
* Get a single SSH key.
|
|
1190
1307
|
*/
|
|
@@ -1194,12 +1311,16 @@ async function getSshKey(options, ctx) {
|
|
|
1194
1311
|
id: options.id
|
|
1195
1312
|
}, { schema: jsonApiDocumentSchema(SshKeyAttributesSchema) })) };
|
|
1196
1313
|
}
|
|
1314
|
+
//#endregion
|
|
1315
|
+
//#region src/executors/ssh-keys/list.ts
|
|
1197
1316
|
/**
|
|
1198
1317
|
* List SSH keys on a server.
|
|
1199
1318
|
*/
|
|
1200
1319
|
async function listSshKeys(options, ctx) {
|
|
1201
1320
|
return { data: unwrapListDocument(await request(ROUTES.sshKeys.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(SshKeyAttributesSchema) })) };
|
|
1202
1321
|
}
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region src/executors/security-rules/create.ts
|
|
1203
1324
|
/**
|
|
1204
1325
|
* Create a security rule.
|
|
1205
1326
|
*/
|
|
@@ -1213,6 +1334,8 @@ async function createSecurityRule(options, ctx) {
|
|
|
1213
1334
|
schema: jsonApiDocumentSchema(SecurityRuleAttributesSchema)
|
|
1214
1335
|
})) };
|
|
1215
1336
|
}
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/executors/security-rules/delete.ts
|
|
1216
1339
|
/**
|
|
1217
1340
|
* Delete a security rule.
|
|
1218
1341
|
*/
|
|
@@ -1224,6 +1347,8 @@ async function deleteSecurityRule(options, ctx) {
|
|
|
1224
1347
|
});
|
|
1225
1348
|
return { data: void 0 };
|
|
1226
1349
|
}
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/executors/security-rules/get.ts
|
|
1227
1352
|
/**
|
|
1228
1353
|
* Get a single security rule.
|
|
1229
1354
|
*/
|
|
@@ -1234,6 +1359,8 @@ async function getSecurityRule(options, ctx) {
|
|
|
1234
1359
|
id: options.id
|
|
1235
1360
|
}, { schema: jsonApiDocumentSchema(SecurityRuleAttributesSchema) })) };
|
|
1236
1361
|
}
|
|
1362
|
+
//#endregion
|
|
1363
|
+
//#region src/executors/security-rules/list.ts
|
|
1237
1364
|
/**
|
|
1238
1365
|
* List security rules for a site.
|
|
1239
1366
|
*/
|
|
@@ -1243,6 +1370,8 @@ async function listSecurityRules(options, ctx) {
|
|
|
1243
1370
|
site_id: options.site_id
|
|
1244
1371
|
}, { schema: jsonApiListDocumentSchema(SecurityRuleAttributesSchema) })) };
|
|
1245
1372
|
}
|
|
1373
|
+
//#endregion
|
|
1374
|
+
//#region src/executors/security-rules/update.ts
|
|
1246
1375
|
/**
|
|
1247
1376
|
* Update a security rule.
|
|
1248
1377
|
*/
|
|
@@ -1257,6 +1386,8 @@ async function updateSecurityRule(options, ctx) {
|
|
|
1257
1386
|
schema: jsonApiDocumentSchema(SecurityRuleAttributesSchema)
|
|
1258
1387
|
})) };
|
|
1259
1388
|
}
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region src/executors/redirect-rules/create.ts
|
|
1260
1391
|
/**
|
|
1261
1392
|
* Create a redirect rule.
|
|
1262
1393
|
*/
|
|
@@ -1268,6 +1399,8 @@ async function createRedirectRule(options, ctx) {
|
|
|
1268
1399
|
}, { body: data });
|
|
1269
1400
|
return { data: void 0 };
|
|
1270
1401
|
}
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/executors/redirect-rules/delete.ts
|
|
1271
1404
|
/**
|
|
1272
1405
|
* Delete a redirect rule.
|
|
1273
1406
|
*/
|
|
@@ -1279,6 +1412,8 @@ async function deleteRedirectRule(options, ctx) {
|
|
|
1279
1412
|
});
|
|
1280
1413
|
return { data: void 0 };
|
|
1281
1414
|
}
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/executors/redirect-rules/get.ts
|
|
1282
1417
|
/**
|
|
1283
1418
|
* Get a single redirect rule.
|
|
1284
1419
|
*/
|
|
@@ -1289,6 +1424,8 @@ async function getRedirectRule(options, ctx) {
|
|
|
1289
1424
|
id: options.id
|
|
1290
1425
|
}, { schema: jsonApiDocumentSchema(RedirectRuleAttributesSchema) })) };
|
|
1291
1426
|
}
|
|
1427
|
+
//#endregion
|
|
1428
|
+
//#region src/executors/redirect-rules/list.ts
|
|
1292
1429
|
/**
|
|
1293
1430
|
* List redirect rules for a site.
|
|
1294
1431
|
*/
|
|
@@ -1298,6 +1435,8 @@ async function listRedirectRules(options, ctx) {
|
|
|
1298
1435
|
site_id: options.site_id
|
|
1299
1436
|
}, { schema: jsonApiListDocumentSchema(RedirectRuleAttributesSchema) })) };
|
|
1300
1437
|
}
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region src/executors/monitors/create.ts
|
|
1301
1440
|
/**
|
|
1302
1441
|
* Create a monitor.
|
|
1303
1442
|
*/
|
|
@@ -1308,6 +1447,8 @@ async function createMonitor(options, ctx) {
|
|
|
1308
1447
|
schema: jsonApiDocumentSchema(MonitorAttributesSchema)
|
|
1309
1448
|
})) };
|
|
1310
1449
|
}
|
|
1450
|
+
//#endregion
|
|
1451
|
+
//#region src/executors/monitors/delete.ts
|
|
1311
1452
|
/**
|
|
1312
1453
|
* Delete a monitor.
|
|
1313
1454
|
*/
|
|
@@ -1318,6 +1459,8 @@ async function deleteMonitor(options, ctx) {
|
|
|
1318
1459
|
});
|
|
1319
1460
|
return { data: void 0 };
|
|
1320
1461
|
}
|
|
1462
|
+
//#endregion
|
|
1463
|
+
//#region src/executors/monitors/get.ts
|
|
1321
1464
|
/**
|
|
1322
1465
|
* Get a single monitor.
|
|
1323
1466
|
*/
|
|
@@ -1327,12 +1470,16 @@ async function getMonitor(options, ctx) {
|
|
|
1327
1470
|
id: options.id
|
|
1328
1471
|
}, { schema: jsonApiDocumentSchema(MonitorAttributesSchema) })) };
|
|
1329
1472
|
}
|
|
1473
|
+
//#endregion
|
|
1474
|
+
//#region src/executors/monitors/list.ts
|
|
1330
1475
|
/**
|
|
1331
1476
|
* List monitors on a server.
|
|
1332
1477
|
*/
|
|
1333
1478
|
async function listMonitors(options, ctx) {
|
|
1334
1479
|
return { data: unwrapListDocument(await request(ROUTES.monitors.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(MonitorAttributesSchema) })) };
|
|
1335
1480
|
}
|
|
1481
|
+
//#endregion
|
|
1482
|
+
//#region src/executors/nginx-templates/create.ts
|
|
1336
1483
|
/**
|
|
1337
1484
|
* Create a Nginx template.
|
|
1338
1485
|
*/
|
|
@@ -1343,6 +1490,8 @@ async function createNginxTemplate(options, ctx) {
|
|
|
1343
1490
|
schema: jsonApiDocumentSchema(NginxTemplateAttributesSchema)
|
|
1344
1491
|
})) };
|
|
1345
1492
|
}
|
|
1493
|
+
//#endregion
|
|
1494
|
+
//#region src/executors/nginx-templates/delete.ts
|
|
1346
1495
|
/**
|
|
1347
1496
|
* Delete a Nginx template.
|
|
1348
1497
|
*/
|
|
@@ -1353,6 +1502,8 @@ async function deleteNginxTemplate(options, ctx) {
|
|
|
1353
1502
|
});
|
|
1354
1503
|
return { data: void 0 };
|
|
1355
1504
|
}
|
|
1505
|
+
//#endregion
|
|
1506
|
+
//#region src/executors/nginx-templates/get.ts
|
|
1356
1507
|
/**
|
|
1357
1508
|
* Get a single Nginx template.
|
|
1358
1509
|
*/
|
|
@@ -1362,12 +1513,16 @@ async function getNginxTemplate(options, ctx) {
|
|
|
1362
1513
|
id: options.id
|
|
1363
1514
|
}, { schema: jsonApiDocumentSchema(NginxTemplateAttributesSchema) })) };
|
|
1364
1515
|
}
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region src/executors/nginx-templates/list.ts
|
|
1365
1518
|
/**
|
|
1366
1519
|
* List Nginx templates on a server.
|
|
1367
1520
|
*/
|
|
1368
1521
|
async function listNginxTemplates(options, ctx) {
|
|
1369
1522
|
return { data: unwrapListDocument(await request(ROUTES.nginxTemplates.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(NginxTemplateAttributesSchema) })) };
|
|
1370
1523
|
}
|
|
1524
|
+
//#endregion
|
|
1525
|
+
//#region src/executors/nginx-templates/update.ts
|
|
1371
1526
|
/**
|
|
1372
1527
|
* Update a Nginx template.
|
|
1373
1528
|
*/
|
|
@@ -1381,6 +1536,8 @@ async function updateNginxTemplate(options, ctx) {
|
|
|
1381
1536
|
schema: jsonApiDocumentSchema(NginxTemplateAttributesSchema)
|
|
1382
1537
|
})) };
|
|
1383
1538
|
}
|
|
1539
|
+
//#endregion
|
|
1540
|
+
//#region src/executors/env/get.ts
|
|
1384
1541
|
/**
|
|
1385
1542
|
* Get environment variables for a site.
|
|
1386
1543
|
*/
|
|
@@ -1390,6 +1547,8 @@ async function getEnv(options, ctx) {
|
|
|
1390
1547
|
site_id: options.site_id
|
|
1391
1548
|
}, { schema: jsonApiDocumentSchema(EnvironmentAttributesSchema) })).content };
|
|
1392
1549
|
}
|
|
1550
|
+
//#endregion
|
|
1551
|
+
//#region src/executors/env/update.ts
|
|
1393
1552
|
/**
|
|
1394
1553
|
* Update environment variables for a site.
|
|
1395
1554
|
*/
|
|
@@ -1400,6 +1559,8 @@ async function updateEnv(options, ctx) {
|
|
|
1400
1559
|
}, { body: { content: options.content } });
|
|
1401
1560
|
return { data: void 0 };
|
|
1402
1561
|
}
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region src/executors/nginx/get.ts
|
|
1403
1564
|
/**
|
|
1404
1565
|
* Get Nginx configuration for a site.
|
|
1405
1566
|
*/
|
|
@@ -1409,6 +1570,8 @@ async function getNginxConfig(options, ctx) {
|
|
|
1409
1570
|
site_id: options.site_id
|
|
1410
1571
|
}, { schema: jsonApiDocumentSchema(EnvironmentAttributesSchema) })).content };
|
|
1411
1572
|
}
|
|
1573
|
+
//#endregion
|
|
1574
|
+
//#region src/executors/nginx/update.ts
|
|
1412
1575
|
/**
|
|
1413
1576
|
* Update Nginx configuration for a site.
|
|
1414
1577
|
*/
|
|
@@ -1419,6 +1582,8 @@ async function updateNginxConfig(options, ctx) {
|
|
|
1419
1582
|
}, { body: { content: options.content } });
|
|
1420
1583
|
return { data: void 0 };
|
|
1421
1584
|
}
|
|
1585
|
+
//#endregion
|
|
1586
|
+
//#region src/executors/recipes/create.ts
|
|
1422
1587
|
/**
|
|
1423
1588
|
* Create a recipe.
|
|
1424
1589
|
*/
|
|
@@ -1428,6 +1593,8 @@ async function createRecipe(options, ctx) {
|
|
|
1428
1593
|
schema: jsonApiDocumentSchema(RecipeAttributesSchema)
|
|
1429
1594
|
})) };
|
|
1430
1595
|
}
|
|
1596
|
+
//#endregion
|
|
1597
|
+
//#region src/executors/recipes/delete.ts
|
|
1431
1598
|
/**
|
|
1432
1599
|
* Delete a recipe.
|
|
1433
1600
|
*/
|
|
@@ -1435,18 +1602,24 @@ async function deleteRecipe(options, ctx) {
|
|
|
1435
1602
|
await request(ROUTES.recipes.delete, ctx, { id: options.id });
|
|
1436
1603
|
return { data: void 0 };
|
|
1437
1604
|
}
|
|
1605
|
+
//#endregion
|
|
1606
|
+
//#region src/executors/recipes/get.ts
|
|
1438
1607
|
/**
|
|
1439
1608
|
* Get a single recipe.
|
|
1440
1609
|
*/
|
|
1441
1610
|
async function getRecipe(options, ctx) {
|
|
1442
1611
|
return { data: unwrapDocument(await request(ROUTES.recipes.get, ctx, { id: options.id }, { schema: jsonApiDocumentSchema(RecipeAttributesSchema) })) };
|
|
1443
1612
|
}
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/executors/recipes/list.ts
|
|
1444
1615
|
/**
|
|
1445
1616
|
* List all recipes.
|
|
1446
1617
|
*/
|
|
1447
1618
|
async function listRecipes(_options, ctx) {
|
|
1448
1619
|
return { data: unwrapListDocument(await request(ROUTES.recipes.list, ctx, {}, { schema: jsonApiListDocumentSchema(RecipeAttributesSchema) })) };
|
|
1449
1620
|
}
|
|
1621
|
+
//#endregion
|
|
1622
|
+
//#region src/executors/recipes/run.ts
|
|
1450
1623
|
/**
|
|
1451
1624
|
* Run a recipe on specified servers.
|
|
1452
1625
|
*/
|
|
@@ -1454,6 +1627,8 @@ async function runRecipe(options, ctx) {
|
|
|
1454
1627
|
await request(ROUTES.recipes.run, ctx, { id: options.id }, { body: { servers: options.servers } });
|
|
1455
1628
|
return { data: void 0 };
|
|
1456
1629
|
}
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region src/executors/recipes/update.ts
|
|
1457
1632
|
/**
|
|
1458
1633
|
* Update a recipe.
|
|
1459
1634
|
*/
|
|
@@ -1464,6 +1639,8 @@ async function updateRecipe(options, ctx) {
|
|
|
1464
1639
|
schema: jsonApiDocumentSchema(RecipeAttributesSchema)
|
|
1465
1640
|
})) };
|
|
1466
1641
|
}
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region src/executors/backups/create.ts
|
|
1467
1644
|
/**
|
|
1468
1645
|
* Create a backup configuration.
|
|
1469
1646
|
*/
|
|
@@ -1472,6 +1649,8 @@ async function createBackupConfig(options, ctx) {
|
|
|
1472
1649
|
await request(ROUTES.backups.create, ctx, { server_id }, { body: data });
|
|
1473
1650
|
return { data: void 0 };
|
|
1474
1651
|
}
|
|
1652
|
+
//#endregion
|
|
1653
|
+
//#region src/executors/backups/delete.ts
|
|
1475
1654
|
/**
|
|
1476
1655
|
* Delete a backup configuration.
|
|
1477
1656
|
*/
|
|
@@ -1482,6 +1661,8 @@ async function deleteBackupConfig(options, ctx) {
|
|
|
1482
1661
|
});
|
|
1483
1662
|
return { data: void 0 };
|
|
1484
1663
|
}
|
|
1664
|
+
//#endregion
|
|
1665
|
+
//#region src/executors/backups/update.ts
|
|
1485
1666
|
/**
|
|
1486
1667
|
* Update a backup configuration.
|
|
1487
1668
|
*/
|
|
@@ -1493,6 +1674,8 @@ async function updateBackupConfig(options, ctx) {
|
|
|
1493
1674
|
}, { body: data });
|
|
1494
1675
|
return { data: void 0 };
|
|
1495
1676
|
}
|
|
1677
|
+
//#endregion
|
|
1678
|
+
//#region src/executors/backups/get.ts
|
|
1496
1679
|
/**
|
|
1497
1680
|
* Get a single backup configuration.
|
|
1498
1681
|
*/
|
|
@@ -1502,12 +1685,16 @@ async function getBackupConfig(options, ctx) {
|
|
|
1502
1685
|
id: options.id
|
|
1503
1686
|
}, { schema: jsonApiDocumentSchema(BackupConfigAttributesSchema) })) };
|
|
1504
1687
|
}
|
|
1688
|
+
//#endregion
|
|
1689
|
+
//#region src/executors/backups/list.ts
|
|
1505
1690
|
/**
|
|
1506
1691
|
* List backup configurations for a server.
|
|
1507
1692
|
*/
|
|
1508
1693
|
async function listBackupConfigs(options, ctx) {
|
|
1509
1694
|
return { data: unwrapListDocument(await request(ROUTES.backups.list, ctx, { server_id: options.server_id }, { schema: jsonApiListDocumentSchema(BackupConfigAttributesSchema) })) };
|
|
1510
1695
|
}
|
|
1696
|
+
//#endregion
|
|
1697
|
+
//#region src/executors/commands/create.ts
|
|
1511
1698
|
/**
|
|
1512
1699
|
* Execute a command on a site.
|
|
1513
1700
|
*/
|
|
@@ -1518,6 +1705,8 @@ async function createCommand(options, ctx) {
|
|
|
1518
1705
|
}, { body: { command: options.command } });
|
|
1519
1706
|
return { data: void 0 };
|
|
1520
1707
|
}
|
|
1708
|
+
//#endregion
|
|
1709
|
+
//#region src/executors/commands/get.ts
|
|
1521
1710
|
/**
|
|
1522
1711
|
* Get a specific command.
|
|
1523
1712
|
*/
|
|
@@ -1528,6 +1717,8 @@ async function getCommand(options, ctx) {
|
|
|
1528
1717
|
id: options.id
|
|
1529
1718
|
}, { schema: jsonApiDocumentSchema(CommandAttributesSchema) })) };
|
|
1530
1719
|
}
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/executors/commands/list.ts
|
|
1531
1722
|
/**
|
|
1532
1723
|
* List commands executed on a site.
|
|
1533
1724
|
*/
|
|
@@ -1537,6 +1728,8 @@ async function listCommands(options, ctx) {
|
|
|
1537
1728
|
site_id: options.site_id
|
|
1538
1729
|
}, { schema: jsonApiListDocumentSchema(CommandAttributesSchema) })) };
|
|
1539
1730
|
}
|
|
1731
|
+
//#endregion
|
|
1732
|
+
//#region src/executors/scheduled-jobs/create.ts
|
|
1540
1733
|
/**
|
|
1541
1734
|
* Create a scheduled job.
|
|
1542
1735
|
*/
|
|
@@ -1550,6 +1743,8 @@ async function createScheduledJob(options, ctx) {
|
|
|
1550
1743
|
schema: jsonApiDocumentSchema(ScheduledJobAttributesSchema)
|
|
1551
1744
|
})) };
|
|
1552
1745
|
}
|
|
1746
|
+
//#endregion
|
|
1747
|
+
//#region src/executors/scheduled-jobs/delete.ts
|
|
1553
1748
|
/**
|
|
1554
1749
|
* Delete a scheduled job.
|
|
1555
1750
|
*/
|
|
@@ -1563,6 +1758,8 @@ async function deleteScheduledJob(options, ctx) {
|
|
|
1563
1758
|
await request(route, ctx, params);
|
|
1564
1759
|
return { data: void 0 };
|
|
1565
1760
|
}
|
|
1761
|
+
//#endregion
|
|
1762
|
+
//#region src/executors/scheduled-jobs/get.ts
|
|
1566
1763
|
/**
|
|
1567
1764
|
* Get a specific scheduled job.
|
|
1568
1765
|
*/
|
|
@@ -1575,6 +1772,8 @@ async function getScheduledJob(options, ctx) {
|
|
|
1575
1772
|
if (options.site_id) params.site_id = options.site_id;
|
|
1576
1773
|
return { data: unwrapDocument(await request(route, ctx, params, { schema: jsonApiDocumentSchema(ScheduledJobAttributesSchema) })) };
|
|
1577
1774
|
}
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region src/executors/scheduled-jobs/list.ts
|
|
1578
1777
|
/**
|
|
1579
1778
|
* List scheduled jobs on a server.
|
|
1580
1779
|
*/
|
|
@@ -1584,12 +1783,108 @@ async function listScheduledJobs(options, ctx) {
|
|
|
1584
1783
|
if (options.site_id) params.site_id = options.site_id;
|
|
1585
1784
|
return { data: unwrapListDocument(await request(route, ctx, params, { schema: jsonApiListDocumentSchema(ScheduledJobAttributesSchema) })) };
|
|
1586
1785
|
}
|
|
1786
|
+
//#endregion
|
|
1787
|
+
//#region src/executors/services/list.ts
|
|
1788
|
+
/**
|
|
1789
|
+
* List services on a server with a derived availability flag.
|
|
1790
|
+
*
|
|
1791
|
+
* The v2 API has no GET endpoint for services, so availability is inferred from
|
|
1792
|
+
* the server object attributes. This `available` flag is a documented heuristic:
|
|
1793
|
+
*
|
|
1794
|
+
* - nginx → always available
|
|
1795
|
+
* - php → available when `php_version` is set (detail = php_version)
|
|
1796
|
+
* - mysql → available when `database_type` starts with "mysql"/"mariadb"
|
|
1797
|
+
* - postgres → available when `database_type` starts with "postgres"
|
|
1798
|
+
* - redis → available when `redis_status` is non-null
|
|
1799
|
+
* - supervisor → always available
|
|
1800
|
+
*/
|
|
1801
|
+
async function listServices(options, ctx) {
|
|
1802
|
+
const { data: server } = await getServer({ server_id: options.server_id }, ctx);
|
|
1803
|
+
const databaseType = server.database_type ?? "";
|
|
1804
|
+
const isMysql = databaseType.startsWith("mysql") || databaseType.startsWith("mariadb");
|
|
1805
|
+
const isPostgres = databaseType.startsWith("postgres");
|
|
1806
|
+
return { data: [
|
|
1807
|
+
{
|
|
1808
|
+
service: "nginx",
|
|
1809
|
+
available: true,
|
|
1810
|
+
detail: null
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
service: "php",
|
|
1814
|
+
available: server.php_version !== null,
|
|
1815
|
+
detail: server.php_version
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
service: "mysql",
|
|
1819
|
+
available: isMysql,
|
|
1820
|
+
detail: isMysql ? server.database_type : null
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
service: "postgres",
|
|
1824
|
+
available: isPostgres,
|
|
1825
|
+
detail: isPostgres ? server.database_type : null
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
service: "redis",
|
|
1829
|
+
available: server.redis_status !== null,
|
|
1830
|
+
detail: server.redis_status
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
service: "supervisor",
|
|
1834
|
+
available: true,
|
|
1835
|
+
detail: null
|
|
1836
|
+
}
|
|
1837
|
+
] };
|
|
1838
|
+
}
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region src/executors/services/types.ts
|
|
1841
|
+
/**
|
|
1842
|
+
* Option and result types for service executors.
|
|
1843
|
+
*/
|
|
1844
|
+
/**
|
|
1845
|
+
* The six restartable services exposed by the Forge v2 API.
|
|
1846
|
+
*
|
|
1847
|
+
* There is no GET endpoint for services — availability is inferred from the
|
|
1848
|
+
* server object (see `listServices`).
|
|
1849
|
+
*/
|
|
1850
|
+
var RESTARTABLE_SERVICES = [
|
|
1851
|
+
"nginx",
|
|
1852
|
+
"php",
|
|
1853
|
+
"mysql",
|
|
1854
|
+
"postgres",
|
|
1855
|
+
"redis",
|
|
1856
|
+
"supervisor"
|
|
1857
|
+
];
|
|
1858
|
+
//#endregion
|
|
1859
|
+
//#region src/executors/services/restart.ts
|
|
1860
|
+
/**
|
|
1861
|
+
* Restart a service on a server.
|
|
1862
|
+
*
|
|
1863
|
+
* Maps the user verb "restart" to the API action "reboot". The v2 API restarts
|
|
1864
|
+
* a service via POST /servers/{server}/services/{service}/actions with body
|
|
1865
|
+
* `{ action: "reboot" }`. The php service additionally requires a `version`.
|
|
1866
|
+
*/
|
|
1867
|
+
async function restartService(options, ctx) {
|
|
1868
|
+
if (!RESTARTABLE_SERVICES.includes(options.service)) throw new Error(`Invalid service "${options.service}". Valid services: ${RESTARTABLE_SERVICES.join(", ")}.`);
|
|
1869
|
+
if (options.service === "php" && !options.version) throw new Error("The \"php\" service requires a version (e.g. \"php83\") to restart.");
|
|
1870
|
+
await request(ROUTES.services.action, ctx, {
|
|
1871
|
+
server_id: options.server_id,
|
|
1872
|
+
service: options.service
|
|
1873
|
+
}, { body: {
|
|
1874
|
+
action: "reboot",
|
|
1875
|
+
...options.version ? { version: options.version } : {}
|
|
1876
|
+
} });
|
|
1877
|
+
return { data: void 0 };
|
|
1878
|
+
}
|
|
1879
|
+
//#endregion
|
|
1880
|
+
//#region src/executors/user/get.ts
|
|
1587
1881
|
/**
|
|
1588
1882
|
* Get the currently authenticated user.
|
|
1589
1883
|
*/
|
|
1590
1884
|
async function getUser(_options, ctx) {
|
|
1591
1885
|
return { data: unwrapDocument(await request(ROUTES.user.get, ctx, {}, { schema: jsonApiDocumentSchema(UserAttributesSchema) })) };
|
|
1592
1886
|
}
|
|
1593
|
-
|
|
1887
|
+
//#endregion
|
|
1888
|
+
export { ACTIONS, RESOURCES, RESTARTABLE_SERVICES, activateCertificate, createAuditLogger, createBackupConfig, createCertificate, createCommand, createDaemon, createDatabase, createDatabaseUser, createFirewallRule, createMonitor, createNginxTemplate, createRecipe, createRedirectRule, createScheduledJob, createSecurityRule, createServer, createSite, createSshKey, createTestExecutorContext, deleteBackupConfig, deleteCertificate, deleteDaemon, deleteDatabase, deleteDatabaseUser, deleteFirewallRule, deleteMonitor, deleteNginxTemplate, deleteRecipe, deleteRedirectRule, deleteScheduledJob, deleteSecurityRule, deleteServer, deleteSite, deleteSshKey, deploySite, deploySiteAndWait, getAuditLogPath, getBackupConfig, getCertificate, getCommand, getDaemon, getDaemonLog, getDatabase, getDatabaseUser, getDeploymentLog, getDeploymentScript, getEnv, getFirewallRule, getMonitor, getNginxConfig, getNginxTemplate, getRecipe, getRedirectRule, getScheduledJob, getSecurityRule, getServer, getSite, getSshKey, getUser, listBackupConfigs, listCommands, listDaemons, listDatabaseUsers, listDatabases, listDeployments, listFirewallRules, listMonitors, listNginxTemplates, listRecipes, listRedirectRules, listScheduledJobs, listSecurityRules, listServers, listServices, listSites, listSshKeys, matchByName, mockDocument, mockListDocument, mockResource, rebootServer, resolveServers, resolveSites, restartDaemon, restartService, runRecipe, sanitizeArgs, updateBackupConfig, updateDaemon, updateDatabaseUser, updateDeploymentScript, updateEnv, updateNginxConfig, updateNginxTemplate, updateRecipe, updateSecurityRule, updateSite };
|
|
1594
1889
|
|
|
1595
1890
|
//# sourceMappingURL=index.js.map
|