freestyle-sandboxes 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -169,6 +169,18 @@ const handleListWebDeploys = (options) => {
169
169
  class FreestyleSandboxes {
170
170
  client;
171
171
  constructor(options) {
172
+ if (typeof Deno !== "undefined") {
173
+ class FreestyleRequest extends Request {
174
+ constructor(input, init) {
175
+ if (init.client !== void 0) {
176
+ console.warn("Unsupported client detected, using default client");
177
+ delete init.client;
178
+ }
179
+ super(input, init);
180
+ }
181
+ }
182
+ Request = FreestyleRequest;
183
+ }
172
184
  this.client = clientFetch.createClient({
173
185
  baseUrl: options.baseUrl ?? "https://api.freestyle.sh",
174
186
  headers: {
package/dist/index.mjs CHANGED
@@ -167,6 +167,18 @@ const handleListWebDeploys = (options) => {
167
167
  class FreestyleSandboxes {
168
168
  client;
169
169
  constructor(options) {
170
+ if (typeof Deno !== "undefined") {
171
+ class FreestyleRequest extends Request {
172
+ constructor(input, init) {
173
+ if (init.client !== void 0) {
174
+ console.warn("Unsupported client detected, using default client");
175
+ delete init.client;
176
+ }
177
+ super(input, init);
178
+ }
179
+ }
180
+ Request = FreestyleRequest;
181
+ }
170
182
  this.client = createClient({
171
183
  baseUrl: options.baseUrl ?? "https://api.freestyle.sh",
172
184
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freestyle-sandboxes",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
package/src/index.ts CHANGED
@@ -77,6 +77,20 @@ export class FreestyleSandboxes {
77
77
  */
78
78
  headers?: Record<string, string>;
79
79
  }) {
80
+ //@ts-expect-error Deno has a weird behavior thats patched here
81
+ if (typeof Deno !== "undefined") {
82
+ class FreestyleRequest extends Request {
83
+ constructor(input, init) {
84
+ if (init.client !== undefined) {
85
+ console.warn("Unsupported client detected, using default client");
86
+ delete init.client;
87
+ }
88
+ super(input, init);
89
+ }
90
+ }
91
+
92
+ Request = FreestyleRequest;
93
+ }
80
94
  this.client = createClient({
81
95
  baseUrl: options.baseUrl ?? "https://api.freestyle.sh",
82
96
  headers: {
@@ -91,7 +105,7 @@ export class FreestyleSandboxes {
91
105
  */
92
106
  async executeScript(
93
107
  script: string,
94
- config?: FreestyleExecuteScriptParamsConfiguration,
108
+ config?: FreestyleExecuteScriptParamsConfiguration
95
109
  ): Promise<FreestyleExecuteScriptResultSuccess> {
96
110
  const response = await sandbox_openapi.handleExecuteScript({
97
111
  client: this.client,
@@ -106,8 +120,8 @@ export class FreestyleSandboxes {
106
120
  }
107
121
  throw new Error(
108
122
  `Failed to execute script: \n\n${script}\n\nError:\n\n${JSON.stringify(
109
- response,
110
- )}`,
123
+ response
124
+ )}`
111
125
  );
112
126
  }
113
127
 
@@ -122,7 +136,7 @@ export class FreestyleSandboxes {
122
136
  encoding?: string;
123
137
  }
124
138
  >,
125
- config?: FreestyleDeployWebConfiguration,
139
+ config?: FreestyleDeployWebConfiguration
126
140
  ): Promise<FreestyleDeployWebSuccessResponse> {
127
141
  const response = await sandbox_openapi.handleDeployWeb({
128
142
  client: this.client,
@@ -135,7 +149,7 @@ export class FreestyleSandboxes {
135
149
  return response.data;
136
150
  }
137
151
  throw new Error(
138
- `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`,
152
+ `Failed to deploy web project\n\nStatus: ${response.response.status}\n\nMessage: ${response.error?.message}`
139
153
  );
140
154
  }
141
155
 
@@ -143,7 +157,7 @@ export class FreestyleSandboxes {
143
157
  * Deploy a Cloudstate project to a sandbox.
144
158
  */
145
159
  async deployCloudstate(
146
- body: FreestyleCloudstateDeployRequest,
160
+ body: FreestyleCloudstateDeployRequest
147
161
  ): Promise<FreestyleCloudstateDeploySuccessResponse> {
148
162
  const response = await sandbox_openapi.handleDeployCloudstate({
149
163
  client: this.client,
@@ -206,7 +220,7 @@ export class FreestyleSandboxes {
206
220
  * @returns The domain verification token.
207
221
  */
208
222
  async createDomainVerificationRequest(
209
- domain: string,
223
+ domain: string
210
224
  ): Promise<HandleCreateDomainVerificationResponse> {
211
225
  const response = await sandbox_openapi.handleCreateDomainVerification({
212
226
  client: this.client,
@@ -227,7 +241,7 @@ export class FreestyleSandboxes {
227
241
  * @returns The domain verification request.
228
242
  */
229
243
  async verifyDomain(
230
- domain: string,
244
+ domain: string
231
245
  ): Promise<HandleVerifyDomainResponse | HandleVerifyDomainError> {
232
246
  const response = await sandbox_openapi.handleVerifyDomain({
233
247
  client: this.client,
@@ -239,7 +253,7 @@ export class FreestyleSandboxes {
239
253
  return response.data;
240
254
  }
241
255
  throw new Error(
242
- `Failed to verify domain ${domain}: ${response.error.message}`,
256
+ `Failed to verify domain ${domain}: ${response.error.message}`
243
257
  );
244
258
  }
245
259
 
@@ -258,20 +272,20 @@ export class FreestyleSandboxes {
258
272
  const response = await sandbox_openapi.handleListDomainVerificationRequests(
259
273
  {
260
274
  client: this.client,
261
- },
275
+ }
262
276
  );
263
277
  if (response.data) {
264
278
  return response.data;
265
279
  }
266
280
 
267
281
  throw new Error(
268
- `Failed to list domain verification requests\n${response.error.message}`,
282
+ `Failed to list domain verification requests\n${response.error.message}`
269
283
  );
270
284
  }
271
285
 
272
286
  async deleteDomainVerificationRequest(
273
287
  domain: string,
274
- verificationCode: string,
288
+ verificationCode: string
275
289
  ): Promise<HandleDeleteDomainVerificationResponse> {
276
290
  const response = await sandbox_openapi.handleDeleteDomainVerification({
277
291
  client: this.client,
@@ -285,13 +299,13 @@ export class FreestyleSandboxes {
285
299
  }
286
300
 
287
301
  throw new Error(
288
- `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`,
302
+ `Failed to delete domain verification request for domain ${domain}: ${response.error.message}`
289
303
  );
290
304
  }
291
305
 
292
306
  async listWebDeployments(
293
307
  limit?: number,
294
- offset?: number,
308
+ offset?: number
295
309
  ): Promise<HandleListWebDeploysResponse> {
296
310
  const response = await sandbox_openapi.handleListWebDeploys({
297
311
  client: this.client,
@@ -306,13 +320,13 @@ export class FreestyleSandboxes {
306
320
  }
307
321
 
308
322
  throw new Error(
309
- `Failed to list web deployments\n${response.error.message}`,
323
+ `Failed to list web deployments\n${response.error.message}`
310
324
  );
311
325
  }
312
326
 
313
327
  async listExecuteRuns(
314
328
  limit?: number,
315
- offset?: number,
329
+ offset?: number
316
330
  ): Promise<HandleListExecuteRunsResponse> {
317
331
  const response = await sandbox_openapi.handleListExecuteRuns({
318
332
  client: this.client,
@@ -340,7 +354,7 @@ export class FreestyleSandboxes {
340
354
  }
341
355
 
342
356
  throw new Error(
343
- `Failed to get execute run with ID ${id}: ${response.error.message}`,
357
+ `Failed to get execute run with ID ${id}: ${response.error.message}`
344
358
  );
345
359
  }
346
360
 
@@ -358,7 +372,7 @@ export class FreestyleSandboxes {
358
372
  }
359
373
 
360
374
  throw new Error(
361
- `Failed to provision wildcard for domain ${domain}: ${response.error.message}`,
375
+ `Failed to provision wildcard for domain ${domain}: ${response.error.message}`
362
376
  );
363
377
  }
364
378
 
@@ -368,7 +382,7 @@ export class FreestyleSandboxes {
368
382
  * @param name The name of the repository.
369
383
  */
370
384
  async createGitRepository(
371
- name: string,
385
+ name: string
372
386
  ): Promise<CreateRepositoryResponseSuccess> {
373
387
  const response = await sandbox_openapi.handleCreateRepo({
374
388
  client: this.client,
@@ -382,7 +396,7 @@ export class FreestyleSandboxes {
382
396
  }
383
397
 
384
398
  throw new Error(
385
- `Failed to create git repository ${name}: ${response.error}`,
399
+ `Failed to create git repository ${name}: ${response.error}`
386
400
  );
387
401
  }
388
402
 
@@ -394,7 +408,7 @@ export class FreestyleSandboxes {
394
408
  */
395
409
  async listGitRepositories(
396
410
  limit?: number,
397
- offset?: number,
411
+ offset?: number
398
412
  ): Promise<HandleListRepositoriesResponse> {
399
413
  const response = await sandbox_openapi.handleListRepositories({
400
414
  client: this.client,
@@ -417,7 +431,7 @@ export class FreestyleSandboxes {
417
431
  * @param repositoryId The ID of the repository to delete.
418
432
  */
419
433
  async deleteGitRepository(
420
- repositoryId: string,
434
+ repositoryId: string
421
435
  ): Promise<HandleDeleteRepoResponse> {
422
436
  const response = await sandbox_openapi.handleDeleteRepo({
423
437
  client: this.client,
@@ -431,7 +445,7 @@ export class FreestyleSandboxes {
431
445
  }
432
446
 
433
447
  throw new Error(
434
- `Failed to delete git repository ${repositoryId}: ${response.error}`,
448
+ `Failed to delete git repository ${repositoryId}: ${response.error}`
435
449
  );
436
450
  }
437
451
 
@@ -456,7 +470,7 @@ export class FreestyleSandboxes {
456
470
  * @param identityId The ID of the identity to delete.
457
471
  */
458
472
  async deleteGitIdentity(
459
- identityId: string,
473
+ identityId: string
460
474
  ): Promise<HandleDeleteIdentityResponse> {
461
475
  const response = await sandbox_openapi.handleDeleteIdentity({
462
476
  client: this.client,
@@ -482,7 +496,7 @@ export class FreestyleSandboxes {
482
496
  async grantGitPermission(
483
497
  repoId: string,
484
498
  identityId: string,
485
- permission: AccessLevel,
499
+ permission: AccessLevel
486
500
  ) {
487
501
  const response = await sandbox_openapi.handleGrantPermission({
488
502
  client: this.client,
@@ -500,7 +514,7 @@ export class FreestyleSandboxes {
500
514
  }
501
515
 
502
516
  throw new Error(
503
- `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
517
+ `Failed to grant access to git identity ${identityId} for repository ${repoId}: ${response.error}`
504
518
  );
505
519
  }
506
520
 
@@ -514,7 +528,7 @@ export class FreestyleSandboxes {
514
528
  async updateGitPermission(
515
529
  repoId: string,
516
530
  identityId: string,
517
- permission: AccessLevel,
531
+ permission: AccessLevel
518
532
  ): Promise<void> {
519
533
  const response = await sandbox_openapi.handleUpdatePermission({
520
534
  client: this.client,
@@ -532,7 +546,7 @@ export class FreestyleSandboxes {
532
546
  }
533
547
 
534
548
  throw new Error(
535
- `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`,
549
+ `Failed to update permission for git identity ${identityId} for repository ${repoId}: ${response.error}`
536
550
  );
537
551
  }
538
552
 
@@ -556,7 +570,7 @@ export class FreestyleSandboxes {
556
570
  }
557
571
 
558
572
  throw new Error(
559
- `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`,
573
+ `Failed to revoke access to git identity ${identityId} for repository ${repoId}: ${response.error}`
560
574
  );
561
575
  }
562
576
 
@@ -566,7 +580,7 @@ export class FreestyleSandboxes {
566
580
  * @param identityId The ID of the identity to list permissions for.
567
581
  */
568
582
  async listGitPermissions(
569
- identityId: string,
583
+ identityId: string
570
584
  ): Promise<ListPermissionResponseSuccess> {
571
585
  const response = await sandbox_openapi.handleListPermissions({
572
586
  client: this.client,
@@ -580,7 +594,7 @@ export class FreestyleSandboxes {
580
594
  }
581
595
 
582
596
  throw new Error(
583
- `Failed to list permissions for git identity ${identityId}: ${response.error}`,
597
+ `Failed to list permissions for git identity ${identityId}: ${response.error}`
584
598
  );
585
599
  }
586
600
 
@@ -592,7 +606,7 @@ export class FreestyleSandboxes {
592
606
  */
593
607
  async getGitPermission(
594
608
  repoId: string,
595
- identityId: string,
609
+ identityId: string
596
610
  ): Promise<DescribePermissionResponseSuccess> {
597
611
  const response = await sandbox_openapi.handleDescribePermission({
598
612
  client: this.client,
@@ -607,7 +621,7 @@ export class FreestyleSandboxes {
607
621
  }
608
622
 
609
623
  throw new Error(
610
- `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`,
624
+ `Failed to get permission for git identity ${identityId} on repository ${repoId}: ${response.error}`
611
625
  );
612
626
  }
613
627
 
@@ -629,7 +643,7 @@ export class FreestyleSandboxes {
629
643
  }
630
644
 
631
645
  throw new Error(
632
- `Failed to create git access token: ${response.error.message}`,
646
+ `Failed to create git access token: ${response.error.message}`
633
647
  );
634
648
  }
635
649
 
@@ -641,7 +655,7 @@ export class FreestyleSandboxes {
641
655
  */
642
656
  async revokeGitAccessToken(
643
657
  identityId: string,
644
- tokenId: string,
658
+ tokenId: string
645
659
  ): Promise<void> {
646
660
  const response = await sandbox_openapi.handleRevokeGitToken({
647
661
  client: this.client,
@@ -658,7 +672,7 @@ export class FreestyleSandboxes {
658
672
  }
659
673
 
660
674
  throw new Error(
661
- `Failed to revoke git access token ${tokenId}: ${response.error.message}`,
675
+ `Failed to revoke git access token ${tokenId}: ${response.error.message}`
662
676
  );
663
677
  }
664
678
 
@@ -668,7 +682,7 @@ export class FreestyleSandboxes {
668
682
  * @param identityId The ID of the identity to list tokens for.
669
683
  */
670
684
  async listGitAccessTokens(
671
- identityId: string,
685
+ identityId: string
672
686
  ): Promise<ListGitTokensResponseSuccess> {
673
687
  const response = await sandbox_openapi.handleListGitTokens({
674
688
  client: this.client,
@@ -682,7 +696,7 @@ export class FreestyleSandboxes {
682
696
  }
683
697
 
684
698
  throw new Error(
685
- `Failed to list git access tokens: ${response.error.message}`,
699
+ `Failed to list git access tokens: ${response.error.message}`
686
700
  );
687
701
  }
688
702
  }