@highstate/library 0.19.1 → 0.21.1
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/highstate.library.msgpack +0 -0
- package/dist/index.js +2836 -3440
- package/package.json +12 -12
- package/src/abbreviations.ts +3 -0
- package/src/common/access-point.ts +19 -4
- package/src/common/files.ts +24 -17
- package/src/common/server.ts +19 -6
- package/src/databases/etcd.ts +141 -39
- package/src/databases/index.ts +8 -7
- package/src/databases/influxdb3.ts +103 -0
- package/src/databases/minio.ts +157 -0
- package/src/databases/mongodb.ts +122 -41
- package/src/databases/mysql.ts +172 -0
- package/src/databases/postgresql.ts +133 -40
- package/src/databases/redis.ts +118 -44
- package/src/databases/s3.ts +48 -127
- package/src/dns.ts +11 -7
- package/src/index.ts +3 -1
- package/src/k3s.ts +7 -0
- package/src/k8s/apps/etcd.ts +3 -3
- package/src/k8s/apps/gitea.ts +1 -1
- package/src/k8s/apps/grafana.ts +48 -0
- package/src/k8s/apps/index.ts +4 -2
- package/src/k8s/apps/mariadb.ts +7 -38
- package/src/k8s/apps/matrix-stack.ts +62 -0
- package/src/k8s/apps/minio.ts +38 -45
- package/src/k8s/apps/mongodb.ts +6 -38
- package/src/k8s/apps/portal.ts +27 -0
- package/src/k8s/apps/postgresql.ts +7 -41
- package/src/k8s/apps/refluxdb.ts +49 -0
- package/src/k8s/apps/remnawave.ts +15 -2
- package/src/k8s/apps/shared.ts +16 -15
- package/src/k8s/apps/traefik.ts +5 -0
- package/src/k8s/apps/valkey.ts +5 -5
- package/src/k8s/apps/vaultwarden.ts +2 -6
- package/src/k8s/apps/workload.ts +14 -11
- package/src/k8s/cert-manager.ts +22 -0
- package/src/k8s/cilium.ts +17 -2
- package/src/k8s/resources.ts +41 -9
- package/src/k8s/service.ts +6 -2
- package/src/k8s/shared.ts +49 -18
- package/src/k8s/workload.ts +59 -43
- package/src/network/address-space.ts +30 -7
- package/src/network/address.ts +13 -2
- package/src/network/endpoint-container.ts +235 -0
- package/src/network/endpoint-schema.ts +8 -0
- package/src/network/endpoint.ts +20 -39
- package/src/network/index.ts +1 -1
- package/src/network/subnet.ts +4 -2
- package/src/proxmox.ts +24 -7
- package/src/restic.ts +8 -2
- package/src/ssh.ts +52 -30
- package/src/talos.ts +8 -2
- package/src/third-party/cloudflare.ts +4 -4
- package/src/third-party/timeweb.ts +17 -3
- package/src/third-party/yandex.ts +198 -88
- package/src/tls.ts +22 -0
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +362 -120
- package/LICENSE +0 -21
- package/dist/index.js.map +0 -1
- package/src/databases/mariadb.ts +0 -91
- package/src/databases/shared.ts +0 -67
- package/src/k8s/apps/kubernetes-dashboard.ts +0 -28
- package/src/k8s/apps/maybe.ts +0 -39
- package/src/network/dynamic-endpoint.ts +0 -43
|
@@ -1,22 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
9
|
+
import { l4EndpointContainer, l4EndpointEntity } from "../network"
|
|
10
|
+
import { certificateEntity } from "../tls"
|
|
11
|
+
|
|
12
|
+
export const credentialsSchema = z.discriminatedUnion("type", [
|
|
13
|
+
z.object({
|
|
14
|
+
type: z.literal("password"),
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The username used to authenticate against the database.
|
|
18
|
+
*/
|
|
19
|
+
username: z.string(),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The password used to authenticate against the database.
|
|
23
|
+
*/
|
|
24
|
+
password: secretSchema(z.string()),
|
|
25
|
+
}),
|
|
26
|
+
])
|
|
5
27
|
|
|
6
28
|
/**
|
|
7
|
-
* Represents
|
|
29
|
+
* Represents a connection to a PostgreSQL instance, including the endpoints and credentials.
|
|
8
30
|
*/
|
|
9
|
-
export const
|
|
10
|
-
type: "
|
|
31
|
+
export const connectionEntity = defineEntity({
|
|
32
|
+
type: "postgresql.connection.v1",
|
|
33
|
+
|
|
34
|
+
extends: { l4EndpointContainer },
|
|
11
35
|
|
|
12
36
|
includes: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The TLS certificate of the server if any.
|
|
39
|
+
*/
|
|
40
|
+
certificate: {
|
|
41
|
+
entity: certificateEntity,
|
|
42
|
+
required: false,
|
|
16
43
|
},
|
|
17
44
|
},
|
|
18
45
|
|
|
19
|
-
schema:
|
|
46
|
+
schema: z.object({
|
|
47
|
+
/**
|
|
48
|
+
* Whether SSL is not required to connect to the database.
|
|
49
|
+
*/
|
|
50
|
+
insecure: z.boolean().default(false),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The credentials for authenticating to the PostgreSQL instance.
|
|
54
|
+
*/
|
|
55
|
+
credentials: credentialsSchema,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The name of the database to operate on.
|
|
59
|
+
*/
|
|
60
|
+
database: z.string().optional(),
|
|
61
|
+
}),
|
|
20
62
|
|
|
21
63
|
meta: {
|
|
22
64
|
color: "#336791",
|
|
@@ -24,26 +66,52 @@ export const postgresqlEntity = defineEntity({
|
|
|
24
66
|
})
|
|
25
67
|
|
|
26
68
|
/**
|
|
27
|
-
* The existing PostgreSQL
|
|
69
|
+
* The existing PostgreSQL connection hosted on a server or a managed service.
|
|
28
70
|
*/
|
|
29
|
-
export const
|
|
30
|
-
type: "
|
|
71
|
+
export const connection = defineUnit({
|
|
72
|
+
type: "postgresql.connection.v1",
|
|
73
|
+
|
|
74
|
+
args: {
|
|
75
|
+
/**
|
|
76
|
+
* The username to authenticate with.
|
|
77
|
+
*/
|
|
78
|
+
username: z.string(),
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The endpoints to connect to the PostgreSQL instance in form of `host:port`.
|
|
82
|
+
*/
|
|
83
|
+
endpoints: z.string().array().default([]),
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
inputs: {
|
|
87
|
+
/**
|
|
88
|
+
* The endpoints to connect to the PostgreSQL instance.
|
|
89
|
+
*/
|
|
90
|
+
endpoints: {
|
|
91
|
+
entity: l4EndpointEntity,
|
|
92
|
+
multiple: true,
|
|
93
|
+
required: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
31
96
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
97
|
+
secrets: {
|
|
98
|
+
/**
|
|
99
|
+
* The password to authenticate with.
|
|
100
|
+
*/
|
|
101
|
+
password: z.string(),
|
|
102
|
+
},
|
|
35
103
|
|
|
36
104
|
outputs: {
|
|
37
|
-
|
|
105
|
+
connection: connectionEntity,
|
|
38
106
|
},
|
|
39
107
|
|
|
40
108
|
source: {
|
|
41
|
-
package: "@highstate/
|
|
42
|
-
path: "units/
|
|
109
|
+
package: "@highstate/postgresql",
|
|
110
|
+
path: "units/connection",
|
|
43
111
|
},
|
|
44
112
|
|
|
45
113
|
meta: {
|
|
46
|
-
title: "
|
|
114
|
+
title: "PostgreSQL Connection",
|
|
47
115
|
icon: "simple-icons:postgresql",
|
|
48
116
|
secondaryIcon: "mdi:database",
|
|
49
117
|
category: "Databases",
|
|
@@ -51,44 +119,69 @@ export const existingPostgresql = defineUnit({
|
|
|
51
119
|
})
|
|
52
120
|
|
|
53
121
|
/**
|
|
54
|
-
*
|
|
122
|
+
* Creates a database in a PostgreSQL instance.
|
|
55
123
|
*/
|
|
56
|
-
export const
|
|
57
|
-
type: "
|
|
124
|
+
export const database = defineUnit({
|
|
125
|
+
type: "postgresql.database.v1",
|
|
58
126
|
|
|
59
127
|
args: {
|
|
60
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The name of the database.
|
|
130
|
+
*
|
|
131
|
+
* If not provided, it will be set to the unit name.
|
|
132
|
+
*/
|
|
133
|
+
databaseName: z.string().optional(),
|
|
61
134
|
|
|
62
135
|
/**
|
|
63
|
-
* The
|
|
136
|
+
* The username to create.
|
|
64
137
|
*
|
|
65
|
-
* If
|
|
66
|
-
* will be replaced completely.
|
|
138
|
+
* If not provided, it will be set to the database name.
|
|
67
139
|
*/
|
|
68
|
-
|
|
140
|
+
username: z.string().optional(),
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The LC_COLLATE setting for the database, which determines the collation order (i.e., how string comparison is performed).
|
|
144
|
+
*/
|
|
145
|
+
lcCollate: z.string().optional(),
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The LC_CTYPE setting for the database, which determines the character classification (i.e., how characters are categorized and compared).
|
|
149
|
+
*/
|
|
150
|
+
lcCtype: z.string().optional(),
|
|
69
151
|
},
|
|
70
152
|
|
|
71
153
|
inputs: {
|
|
72
|
-
|
|
73
|
-
|
|
154
|
+
/**
|
|
155
|
+
* The connection to the PostgreSQL instance where the database should be created.
|
|
156
|
+
*/
|
|
157
|
+
connection: connectionEntity,
|
|
74
158
|
},
|
|
75
159
|
|
|
76
|
-
|
|
77
|
-
|
|
160
|
+
secrets: {
|
|
161
|
+
/**
|
|
162
|
+
* The password of the created user.
|
|
163
|
+
*
|
|
164
|
+
* If not provided, a random password will be generated.
|
|
165
|
+
*/
|
|
166
|
+
password: z.string().optional(),
|
|
78
167
|
},
|
|
79
168
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
path: "units/databases/postgresql-patch",
|
|
169
|
+
outputs: {
|
|
170
|
+
connection: connectionEntity,
|
|
83
171
|
},
|
|
84
172
|
|
|
85
173
|
meta: {
|
|
86
|
-
title: "PostgreSQL
|
|
174
|
+
title: "PostgreSQL Database",
|
|
87
175
|
icon: "simple-icons:postgresql",
|
|
88
|
-
secondaryIcon: "
|
|
176
|
+
secondaryIcon: "mdi:database-plus",
|
|
89
177
|
category: "Databases",
|
|
90
178
|
},
|
|
179
|
+
|
|
180
|
+
source: {
|
|
181
|
+
package: "@highstate/postgresql",
|
|
182
|
+
path: "units/database",
|
|
183
|
+
},
|
|
91
184
|
})
|
|
92
185
|
|
|
93
|
-
export type
|
|
94
|
-
export type
|
|
186
|
+
export type Connection = EntityValue<typeof connectionEntity>
|
|
187
|
+
export type ConnectionInput = EntityInput<typeof connectionEntity>
|
package/src/databases/redis.ts
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineEntity,
|
|
3
|
+
defineUnit,
|
|
4
|
+
type EntityInput,
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
7
|
+
z,
|
|
8
|
+
} from "@highstate/contract"
|
|
9
|
+
import { l4EndpointContainer, l4EndpointEntity } from "../network"
|
|
10
|
+
|
|
11
|
+
export const credentialsSchema = z.object({
|
|
12
|
+
/**
|
|
13
|
+
* The username used to authenticate against the database.
|
|
14
|
+
*/
|
|
15
|
+
username: z.string().optional(),
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The password used to authenticate against the database.
|
|
19
|
+
*/
|
|
20
|
+
password: secretSchema(z.string()).optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const databaseNumberSchema = z.number().nonnegative().max(15)
|
|
5
24
|
|
|
6
25
|
/**
|
|
7
|
-
* Represents
|
|
26
|
+
* Represents a connection to a Redis instance, including the endpoints and credentials.
|
|
8
27
|
*/
|
|
9
|
-
export const
|
|
10
|
-
type: "
|
|
28
|
+
export const connectionEntity = defineEntity({
|
|
29
|
+
type: "redis.connection.v1",
|
|
11
30
|
|
|
12
|
-
|
|
13
|
-
endpoints: {
|
|
14
|
-
entity: l4EndpointEntity,
|
|
15
|
-
multiple: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
31
|
+
extends: { l4EndpointContainer },
|
|
18
32
|
|
|
19
33
|
schema: z.object({
|
|
20
34
|
/**
|
|
21
|
-
* The
|
|
35
|
+
* The credentials for authenticating to the Redis instance.
|
|
22
36
|
*/
|
|
23
|
-
|
|
37
|
+
credentials: credentialsSchema.optional(),
|
|
24
38
|
}),
|
|
25
39
|
|
|
26
40
|
meta: {
|
|
@@ -29,25 +43,52 @@ export const redisEntity = defineEntity({
|
|
|
29
43
|
})
|
|
30
44
|
|
|
31
45
|
/**
|
|
32
|
-
* The existing Redis
|
|
46
|
+
* The existing Redis connection hosted on a server or a managed service.
|
|
33
47
|
*/
|
|
34
|
-
export const
|
|
35
|
-
type: "
|
|
48
|
+
export const connection = defineUnit({
|
|
49
|
+
type: "redis.connection.existing.v1",
|
|
36
50
|
|
|
37
|
-
args:
|
|
38
|
-
|
|
51
|
+
args: {
|
|
52
|
+
/**
|
|
53
|
+
* The username to authenticate with.
|
|
54
|
+
*/
|
|
55
|
+
username: z.string().optional(),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The endpoints to connect to the database in form of `host:port`.
|
|
59
|
+
*/
|
|
60
|
+
endpoints: z.string().array().default([]),
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
inputs: {
|
|
64
|
+
/**
|
|
65
|
+
* The endpoints to connect to the database.
|
|
66
|
+
*/
|
|
67
|
+
endpoints: {
|
|
68
|
+
entity: l4EndpointEntity,
|
|
69
|
+
multiple: true,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
secrets: {
|
|
75
|
+
/**
|
|
76
|
+
* The password to authenticate with.
|
|
77
|
+
*/
|
|
78
|
+
password: z.string().optional(),
|
|
79
|
+
},
|
|
39
80
|
|
|
40
81
|
outputs: {
|
|
41
|
-
|
|
82
|
+
connection: connectionEntity,
|
|
42
83
|
},
|
|
43
84
|
|
|
44
85
|
source: {
|
|
45
|
-
package: "@highstate/
|
|
46
|
-
path: "units/
|
|
86
|
+
package: "@highstate/redis",
|
|
87
|
+
path: "units/connection",
|
|
47
88
|
},
|
|
48
89
|
|
|
49
90
|
meta: {
|
|
50
|
-
title: "
|
|
91
|
+
title: "Redis Connection",
|
|
51
92
|
icon: "simple-icons:redis",
|
|
52
93
|
secondaryIcon: "mdi:database",
|
|
53
94
|
category: "Databases",
|
|
@@ -55,41 +96,74 @@ export const existingRedis = defineUnit({
|
|
|
55
96
|
})
|
|
56
97
|
|
|
57
98
|
/**
|
|
58
|
-
*
|
|
99
|
+
* Represents a Redis namespace within a database.
|
|
100
|
+
*/
|
|
101
|
+
export const namespaceEntity = defineEntity({
|
|
102
|
+
type: "redis.namespace.v1",
|
|
103
|
+
|
|
104
|
+
extends: { connectionEntity },
|
|
105
|
+
|
|
106
|
+
schema: z.object({
|
|
107
|
+
/**
|
|
108
|
+
* The number of the database to use.
|
|
109
|
+
*/
|
|
110
|
+
database: databaseNumberSchema.default(0),
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The prefix of the namespace in the Redis database.
|
|
114
|
+
*/
|
|
115
|
+
prefix: z.string().optional(),
|
|
116
|
+
}),
|
|
117
|
+
|
|
118
|
+
meta: {
|
|
119
|
+
color: "#0064bf",
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Creates a Redis namespace within an existing Redis connection.
|
|
59
125
|
*/
|
|
60
|
-
export const
|
|
61
|
-
type: "
|
|
126
|
+
export const namespace = defineUnit({
|
|
127
|
+
type: "redis.database.v1",
|
|
62
128
|
|
|
63
129
|
args: {
|
|
64
|
-
|
|
130
|
+
/**
|
|
131
|
+
* The number of the database to use.
|
|
132
|
+
*/
|
|
133
|
+
database: databaseNumberSchema.default(0),
|
|
65
134
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
135
|
+
/**
|
|
136
|
+
* The prefix of the namespace in the Redis database.
|
|
137
|
+
*/
|
|
138
|
+
prefix: z.string().optional(),
|
|
70
139
|
},
|
|
71
140
|
|
|
72
141
|
inputs: {
|
|
73
|
-
|
|
74
|
-
|
|
142
|
+
/**
|
|
143
|
+
* The connection to the Redis instance.
|
|
144
|
+
*/
|
|
145
|
+
connection: connectionEntity,
|
|
75
146
|
},
|
|
76
147
|
|
|
77
148
|
outputs: {
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
source: {
|
|
82
|
-
package: "@highstate/common",
|
|
83
|
-
path: "units/databases/redis-patch",
|
|
149
|
+
namespace: namespaceEntity,
|
|
84
150
|
},
|
|
85
151
|
|
|
86
152
|
meta: {
|
|
87
|
-
title: "Redis
|
|
153
|
+
title: "Redis Database",
|
|
88
154
|
icon: "simple-icons:redis",
|
|
89
|
-
secondaryIcon: "
|
|
155
|
+
secondaryIcon: "mdi:database",
|
|
90
156
|
category: "Databases",
|
|
91
157
|
},
|
|
158
|
+
|
|
159
|
+
source: {
|
|
160
|
+
package: "@highstate/redis",
|
|
161
|
+
path: "units/database",
|
|
162
|
+
},
|
|
92
163
|
})
|
|
93
164
|
|
|
94
|
-
export type
|
|
95
|
-
export type
|
|
165
|
+
export type Connection = EntityValue<typeof connectionEntity>
|
|
166
|
+
export type ConnectionInput = EntityInput<typeof connectionEntity>
|
|
167
|
+
|
|
168
|
+
export type Namespace = EntityValue<typeof namespaceEntity>
|
|
169
|
+
export type NamespaceInput = EntityInput<typeof namespaceEntity>
|
package/src/databases/s3.ts
CHANGED
|
@@ -1,114 +1,48 @@
|
|
|
1
|
-
import type { Simplify } from "type-fest"
|
|
2
1
|
import {
|
|
3
|
-
$args,
|
|
4
|
-
$inputs,
|
|
5
|
-
$secrets,
|
|
6
2
|
defineEntity,
|
|
7
3
|
defineUnit,
|
|
8
4
|
type EntityInput,
|
|
9
|
-
type
|
|
5
|
+
type EntityValue,
|
|
6
|
+
secretSchema,
|
|
10
7
|
z,
|
|
11
8
|
} from "@highstate/contract"
|
|
12
|
-
import {
|
|
13
|
-
import { l4EndpointEntity } from "../network"
|
|
14
|
-
import { toPatchArgs } from "../utils"
|
|
9
|
+
import { l4EndpointEntity, l7EndpointContainer } from "../network"
|
|
15
10
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
export const s3BucketSchema = z.object({
|
|
19
|
-
/**
|
|
20
|
-
* The name of the bucket.
|
|
21
|
-
*/
|
|
22
|
-
name: z.string(),
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The optional policy applied to the bucket.
|
|
26
|
-
*/
|
|
27
|
-
policy: s3BucketPolicySchema.optional(),
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const s3Args = $args({
|
|
11
|
+
export const credentialsSchema = z.object({
|
|
31
12
|
/**
|
|
32
|
-
* The
|
|
13
|
+
* The access key used to authenticate against the API.
|
|
33
14
|
*/
|
|
34
|
-
|
|
15
|
+
accessKey: secretSchema(z.string()),
|
|
35
16
|
|
|
36
17
|
/**
|
|
37
|
-
* The
|
|
18
|
+
* The secret key used to authenticate against the API.
|
|
38
19
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The region associated with the S3-compatible deployment.
|
|
43
|
-
*/
|
|
44
|
-
region: z.string().optional(),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The buckets that must exist on the instance.
|
|
48
|
-
*/
|
|
49
|
-
buckets: s3BucketSchema.array().default([]),
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
type ToOptionalArgs<T extends Record<string, FullComponentArgumentOptions>> = Simplify<{
|
|
53
|
-
[K in keyof T]: Simplify<Omit<T[K], "schema"> & { schema: z.ZodOptional<T[K]["schema"]> }>
|
|
54
|
-
}>
|
|
55
|
-
|
|
56
|
-
const optionalS3Args = mapValues(s3Args, arg => ({
|
|
57
|
-
...arg,
|
|
58
|
-
schema: arg.schema.optional(),
|
|
59
|
-
})) as ToOptionalArgs<typeof s3Args>
|
|
60
|
-
|
|
61
|
-
const s3Secrets = $secrets({
|
|
62
|
-
/**
|
|
63
|
-
* The secret key used to authenticate against the S3-compatible API.
|
|
64
|
-
*/
|
|
65
|
-
secretKey: z.string(),
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const s3Inputs = $inputs({
|
|
69
|
-
/**
|
|
70
|
-
* The endpoints to connect to the S3-compatible API.
|
|
71
|
-
*/
|
|
72
|
-
endpoints: {
|
|
73
|
-
entity: l4EndpointEntity,
|
|
74
|
-
multiple: true,
|
|
75
|
-
required: false,
|
|
76
|
-
},
|
|
20
|
+
secretKey: secretSchema(z.string()),
|
|
77
21
|
})
|
|
78
22
|
|
|
79
23
|
/**
|
|
80
|
-
* Represents an S3
|
|
24
|
+
* Represents an S3 bucket with credentials and endpoints to access it.
|
|
81
25
|
*/
|
|
82
|
-
export const
|
|
83
|
-
type: "
|
|
26
|
+
export const bucketEntity = defineEntity({
|
|
27
|
+
type: "s3.bucket.v1",
|
|
84
28
|
|
|
85
|
-
|
|
86
|
-
endpoints: {
|
|
87
|
-
entity: l4EndpointEntity,
|
|
88
|
-
multiple: true,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
29
|
+
extends: { l7EndpointContainer },
|
|
91
30
|
|
|
92
31
|
schema: z.object({
|
|
93
32
|
/**
|
|
94
|
-
* The
|
|
95
|
-
*/
|
|
96
|
-
region: z.string().optional(),
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* The access key used to authenticate against the API.
|
|
33
|
+
* The name of the S3 bucket.
|
|
100
34
|
*/
|
|
101
|
-
|
|
35
|
+
name: z.string(),
|
|
102
36
|
|
|
103
37
|
/**
|
|
104
|
-
* The
|
|
38
|
+
* The region where the S3 bucket is located.
|
|
105
39
|
*/
|
|
106
|
-
|
|
40
|
+
region: z.string(),
|
|
107
41
|
|
|
108
42
|
/**
|
|
109
|
-
* The
|
|
43
|
+
* The credentials that can be used to access the S3 bucket.
|
|
110
44
|
*/
|
|
111
|
-
|
|
45
|
+
credentials: credentialsSchema,
|
|
112
46
|
}),
|
|
113
47
|
|
|
114
48
|
meta: {
|
|
@@ -117,68 +51,55 @@ export const s3Entity = defineEntity({
|
|
|
117
51
|
})
|
|
118
52
|
|
|
119
53
|
/**
|
|
120
|
-
* The existing S3-compatible
|
|
54
|
+
* The existing S3 bucket hosted on AWS or another S3-compatible service.
|
|
121
55
|
*/
|
|
122
|
-
export const
|
|
123
|
-
type: "
|
|
56
|
+
export const existingBucket = defineUnit({
|
|
57
|
+
type: "s3.existing-bucket.v1",
|
|
124
58
|
|
|
125
|
-
args:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
s3: s3Entity,
|
|
131
|
-
},
|
|
59
|
+
args: {
|
|
60
|
+
/**
|
|
61
|
+
* The name of the existing S3 bucket.
|
|
62
|
+
*/
|
|
63
|
+
bucketName: z.string(),
|
|
132
64
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The region where the existing S3 bucket is located.
|
|
67
|
+
*/
|
|
68
|
+
region: z.string(),
|
|
137
69
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
category: "Databases",
|
|
70
|
+
/**
|
|
71
|
+
* The endpoints to connect to the S3 bucket.
|
|
72
|
+
*/
|
|
73
|
+
endpoints: z.string().array().default([]),
|
|
143
74
|
},
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Patches some properties of the S3-compatible object storage and outputs the updated storage.
|
|
148
|
-
*/
|
|
149
|
-
export const s3Patch = defineUnit({
|
|
150
|
-
type: "databases.s3-patch.v1",
|
|
151
|
-
|
|
152
|
-
args: {
|
|
153
|
-
...toPatchArgs(optionalS3Args),
|
|
154
75
|
|
|
76
|
+
inputs: {
|
|
77
|
+
/**
|
|
78
|
+
* The endpoints to connect to the S3 bucket.
|
|
79
|
+
*/
|
|
155
80
|
endpoints: {
|
|
156
|
-
|
|
157
|
-
|
|
81
|
+
entity: l4EndpointEntity,
|
|
82
|
+
multiple: true,
|
|
83
|
+
required: false,
|
|
158
84
|
},
|
|
159
85
|
},
|
|
160
86
|
|
|
161
|
-
inputs: {
|
|
162
|
-
s3: s3Entity,
|
|
163
|
-
...s3Inputs,
|
|
164
|
-
},
|
|
165
|
-
|
|
166
87
|
outputs: {
|
|
167
|
-
|
|
88
|
+
bucket: bucketEntity,
|
|
168
89
|
},
|
|
169
90
|
|
|
170
91
|
source: {
|
|
171
92
|
package: "@highstate/common",
|
|
172
|
-
path: "units/databases/s3-
|
|
93
|
+
path: "units/databases/existing-s3-bucket",
|
|
173
94
|
},
|
|
174
95
|
|
|
175
96
|
meta: {
|
|
176
|
-
title: "S3
|
|
177
|
-
icon: "simple-icons:
|
|
178
|
-
secondaryIcon: "
|
|
97
|
+
title: "Existing S3 Bucket",
|
|
98
|
+
icon: "simple-icons:amazonaws",
|
|
99
|
+
secondaryIcon: "mdi:database",
|
|
179
100
|
category: "Databases",
|
|
180
101
|
},
|
|
181
102
|
})
|
|
182
103
|
|
|
183
|
-
export type
|
|
184
|
-
export type
|
|
104
|
+
export type Bucket = EntityValue<typeof bucketEntity>
|
|
105
|
+
export type BucketInput = EntityInput<typeof bucketEntity>
|