@metaplay/metaplay-auth 1.4.2 → 1.5.0
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/CHANGELOG.md +23 -0
- package/dist/index.cjs +292 -0
- package/dist/sshcrypto-OMBCGRSN.node +0 -0
- package/index.ts +142 -94
- package/package.json +12 -14
- package/src/auth.ts +11 -5
- package/src/deployment.ts +124 -14
- package/src/stackapi.ts +18 -363
- package/src/targetenvironment.ts +307 -0
- package/src/utils.ts +49 -9
- package/src/version.ts +1 -0
- package/dist/index.js +0 -644
- package/dist/index.js.map +0 -1
- package/dist/src/auth.js +0 -373
- package/dist/src/auth.js.map +0 -1
- package/dist/src/deployment.js +0 -250
- package/dist/src/deployment.js.map +0 -1
- package/dist/src/logging.js +0 -18
- package/dist/src/logging.js.map +0 -1
- package/dist/src/secret_store.js +0 -79
- package/dist/src/secret_store.js.map +0 -1
- package/dist/src/stackapi.js +0 -302
- package/dist/src/stackapi.js.map +0 -1
- package/dist/src/utils.js +0 -62
- package/dist/src/utils.js.map +0 -1
- package/dist/tests/utils.spec.js +0 -18
- package/dist/tests/utils.spec.js.map +0 -1
- package/tests/utils.spec.ts +0 -20
- package/vitest.config.ts +0 -7
package/dist/src/stackapi.js
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { isValidFQDN, getGameserverAdminUrl } from './utils.js';
|
|
2
|
-
import { logger } from './logging.js';
|
|
3
|
-
import { dump } from 'js-yaml';
|
|
4
|
-
import { getUserinfo } from './auth.js';
|
|
5
|
-
import { ECRClient, GetAuthorizationTokenCommand } from '@aws-sdk/client-ecr';
|
|
6
|
-
export class StackAPI {
|
|
7
|
-
accessToken;
|
|
8
|
-
_stackApiBaseUrl;
|
|
9
|
-
constructor(accessToken, stackApiBaseUrl) {
|
|
10
|
-
if (accessToken == null) {
|
|
11
|
-
throw new Error('accessToken must be provided');
|
|
12
|
-
}
|
|
13
|
-
this.accessToken = accessToken;
|
|
14
|
-
if (stackApiBaseUrl) {
|
|
15
|
-
this._stackApiBaseUrl = stackApiBaseUrl.replace(/\/$/, ''); // Remove trailing slash
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
this._stackApiBaseUrl = 'https://infra.p1.metaplay.io/stackapi';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async getAwsCredentials(gs) {
|
|
22
|
-
let url = '';
|
|
23
|
-
if (gs.gameserver != null) {
|
|
24
|
-
if (isValidFQDN(gs.gameserver)) {
|
|
25
|
-
const adminUrl = getGameserverAdminUrl(gs.gameserver);
|
|
26
|
-
url = `https://${adminUrl}/.infra/credentials/aws`;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
url = `${this._stackApiBaseUrl}/v0/credentials/${gs.gameserver}/aws`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else if (gs.organization != null && gs.project != null && gs.environment != null) {
|
|
33
|
-
url = `${this._stackApiBaseUrl}/v1/servers/${gs.organization}/${gs.project}/${gs.environment}/credentials/aws`;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
throw new Error('Invalid arguments for getAwsCredentials');
|
|
37
|
-
}
|
|
38
|
-
logger.debug(`Getting AWS credentials from ${url}...`);
|
|
39
|
-
const response = await fetch(url, {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: {
|
|
42
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
43
|
-
'Content-Type': 'application/json'
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
if (response.status !== 200) {
|
|
47
|
-
throw new Error(`Failed to fetch AWS credentials: ${response.statusText}, response code=${response.status}`);
|
|
48
|
-
}
|
|
49
|
-
return await response.json();
|
|
50
|
-
}
|
|
51
|
-
async getKubeConfig(gs) {
|
|
52
|
-
let url = '';
|
|
53
|
-
if (gs.gameserver != null) {
|
|
54
|
-
if (isValidFQDN(gs.gameserver)) {
|
|
55
|
-
const adminUrl = getGameserverAdminUrl(gs.gameserver);
|
|
56
|
-
url = `https://${adminUrl}/.infra/credentials/k8s`;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
url = `${this._stackApiBaseUrl}/v0/credentials/${gs.gameserver}/k8s`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else if (gs.organization != null && gs.project != null && gs.environment != null) {
|
|
63
|
-
url = `${this._stackApiBaseUrl}/v1/servers/${gs.organization}/${gs.project}/${gs.environment}/credentials/k8s`;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
throw new Error('Invalid arguments for getKubeConfig');
|
|
67
|
-
}
|
|
68
|
-
logger.debug(`Getting KubeConfig from ${url}...`);
|
|
69
|
-
let response;
|
|
70
|
-
try {
|
|
71
|
-
response = await fetch(url, {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
headers: {
|
|
74
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
75
|
-
'Content-Type': 'application/json'
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
logger.error(`Failed to fetch kubeconfig from ${url}`);
|
|
81
|
-
logger.error('Fetch error details:', error);
|
|
82
|
-
if (error.cause?.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE') {
|
|
83
|
-
throw new Error(`Failed to to fetch kubeconfig: SSL certificate validation failed for ${url}. Is someone trying to tamper with your internet connection?`);
|
|
84
|
-
}
|
|
85
|
-
throw new Error(`Failed to fetch kubeconfig from ${url}: ${error}`);
|
|
86
|
-
}
|
|
87
|
-
if (response.status !== 200) {
|
|
88
|
-
throw new Error(`Failed to fetch KubeConfigs: ${response.statusText}`);
|
|
89
|
-
}
|
|
90
|
-
return await response.text();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Get a `kubeconfig` payload which invokes `metaplay-auth get-kubernetes-execcredential` to get the actual
|
|
94
|
-
* access credentials each time the kubeconfig is used.
|
|
95
|
-
* @param gs Game server environment to get credentials for.
|
|
96
|
-
* @returns The kubeconfig YAML.
|
|
97
|
-
*/
|
|
98
|
-
async getKubeConfigExecCredential(gs) {
|
|
99
|
-
let url = '';
|
|
100
|
-
let gsSlug = '';
|
|
101
|
-
const execArgs = ['get-kubernetes-execcredential'];
|
|
102
|
-
if (gs.gameserver != null) {
|
|
103
|
-
const adminUrl = getGameserverAdminUrl(gs.gameserver);
|
|
104
|
-
url = `https://${adminUrl}/.infra/credentials/k8s?type=execcredential`;
|
|
105
|
-
gsSlug = gs.gameserver;
|
|
106
|
-
execArgs.push('--gameserver', gs.gameserver);
|
|
107
|
-
}
|
|
108
|
-
else if (gs.organization != null && gs.project != null && gs.environment != null) {
|
|
109
|
-
url = `${this._stackApiBaseUrl}/v1/servers/${gs.organization}/${gs.project}/${gs.environment}/credentials/k8s?type=execcredential`;
|
|
110
|
-
gsSlug = `${gs.organization}.${gs.project}.${gs.environment}`;
|
|
111
|
-
execArgs.push(`${gs.organization}-${gs.project}-${gs.environment}`);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
throw new Error('Invalid arguments for getKubeConfigExecCredential');
|
|
115
|
-
}
|
|
116
|
-
logger.debug(`Getting Kubernetes KubeConfig from ${url}...`);
|
|
117
|
-
let response;
|
|
118
|
-
try {
|
|
119
|
-
response = await fetch(url, {
|
|
120
|
-
method: 'POST',
|
|
121
|
-
headers: {
|
|
122
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
123
|
-
'Content-Type': 'application/json'
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
logger.error(`Failed to fetch kubeconfig from ${url}`);
|
|
129
|
-
logger.error('Fetch error details:', error);
|
|
130
|
-
if (error.cause?.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE') {
|
|
131
|
-
throw new Error(`Failed to to fetch kubeconfig: SSL certificate validation failed for ${url}. Is someone trying to tamper with your internet connection?`);
|
|
132
|
-
}
|
|
133
|
-
throw new Error(`Failed to fetch kubeconfig from ${url}: ${error}`);
|
|
134
|
-
}
|
|
135
|
-
if (response.status !== 200) {
|
|
136
|
-
throw new Error(`Failed to fetch Kubernetes KubeConfig: ${response.statusText}`);
|
|
137
|
-
}
|
|
138
|
-
// get the execcredential and morph it into a kubeconfig which calls metaplay-auth for the token
|
|
139
|
-
let kubeExecCredential;
|
|
140
|
-
try {
|
|
141
|
-
kubeExecCredential = await response.json();
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
throw new Error('Failed to fetch Kubernetes KubeConfig: the server response is not JSON');
|
|
145
|
-
}
|
|
146
|
-
if (!kubeExecCredential.spec.cluster) {
|
|
147
|
-
throw new Error('Received kubeExecCredential with missing spec.cluster');
|
|
148
|
-
}
|
|
149
|
-
let namespace = 'default';
|
|
150
|
-
let user = 'user';
|
|
151
|
-
try {
|
|
152
|
-
const environment = await this.getEnvironmentDetails(gs);
|
|
153
|
-
namespace = environment.deployment?.kubernetes_namespace ?? namespace;
|
|
154
|
-
}
|
|
155
|
-
catch (e) {
|
|
156
|
-
logger.debug('Failed to get environment details, using defaults', e);
|
|
157
|
-
}
|
|
158
|
-
try {
|
|
159
|
-
const userinfo = await getUserinfo(this.accessToken);
|
|
160
|
-
user = userinfo.sub ?? user;
|
|
161
|
-
}
|
|
162
|
-
catch (e) {
|
|
163
|
-
logger.debug('Failed to get userinfo, using defaults', e);
|
|
164
|
-
}
|
|
165
|
-
const kubeConfig = {
|
|
166
|
-
apiVersion: 'v1',
|
|
167
|
-
kind: 'Config',
|
|
168
|
-
'current-context': gsSlug,
|
|
169
|
-
clusters: [
|
|
170
|
-
{
|
|
171
|
-
cluster: {
|
|
172
|
-
'certificate-authority-data': kubeExecCredential.spec.cluster.certificateAuthorityData,
|
|
173
|
-
server: kubeExecCredential.spec.cluster.server
|
|
174
|
-
},
|
|
175
|
-
name: kubeExecCredential.spec.cluster.server
|
|
176
|
-
}
|
|
177
|
-
],
|
|
178
|
-
contexts: [
|
|
179
|
-
{
|
|
180
|
-
context: {
|
|
181
|
-
cluster: kubeExecCredential.spec.cluster.server,
|
|
182
|
-
namespace,
|
|
183
|
-
user
|
|
184
|
-
},
|
|
185
|
-
name: gsSlug,
|
|
186
|
-
}
|
|
187
|
-
],
|
|
188
|
-
users: [
|
|
189
|
-
{
|
|
190
|
-
name: user,
|
|
191
|
-
user: {
|
|
192
|
-
exec: {
|
|
193
|
-
apiVersion: 'client.authentication.k8s.io/v1beta1',
|
|
194
|
-
command: 'metaplay-auth',
|
|
195
|
-
args: execArgs,
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
};
|
|
201
|
-
// return as yaml for easier consumption
|
|
202
|
-
return dump(kubeConfig);
|
|
203
|
-
}
|
|
204
|
-
async getKubeExecCredential(gs) {
|
|
205
|
-
let url = '';
|
|
206
|
-
if (gs.gameserver != null) {
|
|
207
|
-
if (isValidFQDN(gs.gameserver)) {
|
|
208
|
-
const adminUrl = getGameserverAdminUrl(gs.gameserver);
|
|
209
|
-
url = `https://${adminUrl}/.infra/credentials/k8s?type=execcredential`;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
url = `${this._stackApiBaseUrl}/v0/credentials/${gs.gameserver}/k8s?type=execcredential`;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else if (gs.organization != null && gs.project != null && gs.environment != null) {
|
|
216
|
-
url = `${this._stackApiBaseUrl}/v1/servers/${gs.organization}/${gs.project}/${gs.environment}/credentials/k8s?type=execcredential`;
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
throw new Error('Invalid arguments for getKubeConfig');
|
|
220
|
-
}
|
|
221
|
-
logger.debug(`Getting Kubernetes ExecCredential from ${url}...`);
|
|
222
|
-
const response = await fetch(url, {
|
|
223
|
-
method: 'POST',
|
|
224
|
-
headers: {
|
|
225
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
226
|
-
'Content-Type': 'application/json'
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
if (response.status !== 200) {
|
|
230
|
-
throw new Error(`Failed to fetch Kubernetes ExecCredential: ${response.statusText}`);
|
|
231
|
-
}
|
|
232
|
-
return await response.text();
|
|
233
|
-
}
|
|
234
|
-
async getEnvironmentDetails(gs) {
|
|
235
|
-
let url = '';
|
|
236
|
-
if (gs.gameserver != null) {
|
|
237
|
-
if (isValidFQDN(gs.gameserver)) {
|
|
238
|
-
const adminUrl = getGameserverAdminUrl(gs.gameserver);
|
|
239
|
-
url = `https://${adminUrl}/.infra/environment`;
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
url = `${this._stackApiBaseUrl}/v0/deployments/${gs.gameserver}`;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
else if (gs.organization != null && gs.project != null && gs.environment != null) {
|
|
246
|
-
url = `${this._stackApiBaseUrl}/v1/servers/${gs.organization}/${gs.project}/${gs.environment}`;
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
throw new Error('Invalid arguments for environment details');
|
|
250
|
-
}
|
|
251
|
-
logger.debug(`Getting environment details from ${url}...`);
|
|
252
|
-
const response = await fetch(url, {
|
|
253
|
-
method: 'GET',
|
|
254
|
-
headers: {
|
|
255
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
256
|
-
'Content-Type': 'application/json'
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
if (response.status !== 200) {
|
|
260
|
-
throw new Error(`Failed to fetch environment details: ${response.statusText}`);
|
|
261
|
-
}
|
|
262
|
-
return await response.json();
|
|
263
|
-
}
|
|
264
|
-
async getDockerCredentials(gameserverId) {
|
|
265
|
-
// Get environment info (for AWS region)
|
|
266
|
-
logger.debug('Get environment info');
|
|
267
|
-
const envInfo = await this.getEnvironmentDetails(gameserverId);
|
|
268
|
-
// Fetch AWS credentials from Metaplay cloud
|
|
269
|
-
logger.debug('Get AWS credentials from Metaplay');
|
|
270
|
-
const awsCredentials = await this.getAwsCredentials(gameserverId);
|
|
271
|
-
// Create ECR client with credentials
|
|
272
|
-
logger.debug('Create ECR client');
|
|
273
|
-
const client = new ECRClient({
|
|
274
|
-
credentials: {
|
|
275
|
-
accessKeyId: awsCredentials.AccessKeyId,
|
|
276
|
-
secretAccessKey: awsCredentials.SecretAccessKey,
|
|
277
|
-
sessionToken: awsCredentials.SessionToken
|
|
278
|
-
},
|
|
279
|
-
region: envInfo.deployment.aws_region
|
|
280
|
-
});
|
|
281
|
-
// Fetch the ECR docker authentication token
|
|
282
|
-
logger.debug('Fetch ECR login credentials from AWS');
|
|
283
|
-
const command = new GetAuthorizationTokenCommand({});
|
|
284
|
-
const response = await client.send(command);
|
|
285
|
-
if (!response.authorizationData || response.authorizationData.length === 0 || !response.authorizationData[0].authorizationToken || !response.authorizationData[0].proxyEndpoint) {
|
|
286
|
-
throw new Error('Received an empty authorization token response for ECR repository');
|
|
287
|
-
}
|
|
288
|
-
// Parse username and password from the response (separated by a ':')
|
|
289
|
-
logger.debug('Parse ECR response');
|
|
290
|
-
const registryUrl = response.authorizationData[0].proxyEndpoint;
|
|
291
|
-
const authorization64 = response.authorizationData[0].authorizationToken;
|
|
292
|
-
const authorization = Buffer.from(authorization64, 'base64').toString();
|
|
293
|
-
const [username, password] = authorization.split(':');
|
|
294
|
-
logger.debug(`ECR: username=${username}, proxyEndpoint=${registryUrl}`);
|
|
295
|
-
return {
|
|
296
|
-
username,
|
|
297
|
-
password,
|
|
298
|
-
registryUrl
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
//# sourceMappingURL=stackapi.js.map
|
package/dist/src/stackapi.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stackapi.js","sourceRoot":"","sources":["../../src/stackapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CA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CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACpD,MAAM,OAAO,GAAG,IAAI,4BAA4B,CAAC,EAAE,CAAC,CAAA;QACpD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC3C,IAAI,CAAC,QAAQ,CAAC,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE;YAC/K,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAA;SACrF;QAED,qEAAqE;QACrE,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAClC,MAAM,WAAW,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;QAC/D,MAAM,eAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAA;QACxE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAA;QACvE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrD,MAAM,CAAC,KAAK,CAAC,iBAAiB,QAAQ,mBAAmB,WAAW,EAAE,CAAC,CAAA;QAEvE,OAAO;YACL,QAAQ;YACR,QAAQ;YACR,WAAW;SACgB,CAAA;IAC/B,CAAC;CACF"}
|
package/dist/src/utils.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
export function stackApiBaseFromOptions(arg, options) {
|
|
3
|
-
return '';
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the given string is a fully qualified domain name (FQDN).
|
|
7
|
-
*
|
|
8
|
-
* @param domain The domain name to check.
|
|
9
|
-
* @returns true if the domain is a valid FQDN, false otherwise.
|
|
10
|
-
*/
|
|
11
|
-
export function isValidFQDN(domain) {
|
|
12
|
-
const fqdnRegex = /^(?=.{1,253}$)(([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,})$/;
|
|
13
|
-
return fqdnRegex.test(domain);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Splits an HTTP URL into its components: scheme, hostname, port, and subpaths.
|
|
17
|
-
*
|
|
18
|
-
* @param urlString The HTTP URL string to be split.
|
|
19
|
-
* @returns An object containing the scheme, hostname, port, and subpaths.
|
|
20
|
-
*/
|
|
21
|
-
export function splitUrlComponents(urlString) {
|
|
22
|
-
try {
|
|
23
|
-
const url = new URL(urlString);
|
|
24
|
-
// Extract the scheme (protocol without the ":"), hostname, and port
|
|
25
|
-
const scheme = url.protocol.slice(0, -1); // Removes the trailing ":"
|
|
26
|
-
const hostname = url.hostname;
|
|
27
|
-
const port = url.port ?? null;
|
|
28
|
-
// Extract subpaths (pathname) and remove the leading "/"
|
|
29
|
-
const subpaths = url.pathname.slice(1) ?? null;
|
|
30
|
-
return { scheme, hostname, port, subpaths };
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
throw new Error('Invalid URL');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export function getGameserverAdminUrl(uri) {
|
|
37
|
-
const parts = uri.split('.');
|
|
38
|
-
const hostname = parts[0];
|
|
39
|
-
const domain = uri.substring(hostname.length + 1);
|
|
40
|
-
return `${hostname}-admin.${domain}`;
|
|
41
|
-
}
|
|
42
|
-
export async function executeCommand(command, args) {
|
|
43
|
-
return await new Promise((resolve, reject) => {
|
|
44
|
-
const childProcess = spawn(command, args); //, { stdio: 'inherit' }) -- this pipes stdout & stderr to our output
|
|
45
|
-
let stdout = [];
|
|
46
|
-
let stderr = [];
|
|
47
|
-
childProcess.stdout?.on('data', (data) => {
|
|
48
|
-
stdout += data;
|
|
49
|
-
});
|
|
50
|
-
childProcess.stderr?.on('data', (data) => {
|
|
51
|
-
stderr += data;
|
|
52
|
-
});
|
|
53
|
-
// If program runs to completion, resolve promise with success
|
|
54
|
-
childProcess.on('close', (code) => {
|
|
55
|
-
resolve({ code, stdout, stderr });
|
|
56
|
-
});
|
|
57
|
-
childProcess.on('error', (err) => {
|
|
58
|
-
reject(new Error(`Failed to execute command '${command} ${args.join(' ')}': ${err.message}`));
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/src/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,uBAAuB,CAAE,GAAW,EAAE,OAA4B;IAChF,OAAO,EAAE,CAAA;AACX,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAE,MAAc;IACzC,MAAM,SAAS,GAAG,+EAA+E,CAAA;IAEjG,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAE,SAAiB;IACnD,IAAI;QACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;QAE9B,oEAAoE;QACpE,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,2BAA2B;QACpE,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,CAAA;QAE7B,yDAAyD;QACzD,MA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AI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QAEF,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,CACJ,IAAI,KAAK,CACP,8BAA8B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,EAAE,CAC3E,CACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/tests/utils.spec.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { expect, test, describe } from 'vitest';
|
|
2
|
-
import { isValidFQDN } from '../src/utils.js';
|
|
3
|
-
describe('isValidFQDN', () => {
|
|
4
|
-
test('should return true for valid FQDNs', () => {
|
|
5
|
-
expect(isValidFQDN('www.example.com')).toBe(true);
|
|
6
|
-
expect(isValidFQDN('subdomain.example.com')).toBe(true);
|
|
7
|
-
expect(isValidFQDN('example.com')).toBe(true);
|
|
8
|
-
expect(isValidFQDN('example.co.uk')).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
test('should return false for invalid FQDNs', () => {
|
|
11
|
-
expect(isValidFQDN('example')).toBe(false);
|
|
12
|
-
expect(isValidFQDN('www.example..com')).toBe(false);
|
|
13
|
-
expect(isValidFQDN('www.-example.com')).toBe(false);
|
|
14
|
-
expect(isValidFQDN('www.example-.com')).toBe(false);
|
|
15
|
-
expect(isValidFQDN('www.example.com-')).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=utils.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../tests/utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjD,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvD,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7C,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnD,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/tests/utils.spec.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { expect, test, describe } from 'vitest'
|
|
2
|
-
|
|
3
|
-
import { isValidFQDN } from '../src/utils.js'
|
|
4
|
-
|
|
5
|
-
describe('isValidFQDN', () => {
|
|
6
|
-
test('should return true for valid FQDNs', () => {
|
|
7
|
-
expect(isValidFQDN('www.example.com')).toBe(true)
|
|
8
|
-
expect(isValidFQDN('subdomain.example.com')).toBe(true)
|
|
9
|
-
expect(isValidFQDN('example.com')).toBe(true)
|
|
10
|
-
expect(isValidFQDN('example.co.uk')).toBe(true)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('should return false for invalid FQDNs', () => {
|
|
14
|
-
expect(isValidFQDN('example')).toBe(false)
|
|
15
|
-
expect(isValidFQDN('www.example..com')).toBe(false)
|
|
16
|
-
expect(isValidFQDN('www.-example.com')).toBe(false)
|
|
17
|
-
expect(isValidFQDN('www.example-.com')).toBe(false)
|
|
18
|
-
expect(isValidFQDN('www.example.com-')).toBe(false)
|
|
19
|
-
})
|
|
20
|
-
})
|