@amerged/ohmyhost-cli 0.1.59 → 0.1.60

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.
@@ -196,6 +196,8 @@ import type {
196
196
  GetProjectMailDomainBindingResponses,
197
197
  GetProjectPoweredByFlagErrors,
198
198
  GetProjectPoweredByFlagResponses,
199
+ GetProjectPreviewErrors,
200
+ GetProjectPreviewResponses,
199
201
  GetProjectResponses,
200
202
  GetProjectSourceAutoDeployErrors,
201
203
  GetProjectSourceAutoDeployResponses,
@@ -264,6 +266,8 @@ import type {
264
266
  NativeAuthConfigurationUpdate,
265
267
  NativeAuthProviderUpdateWritable,
266
268
  NativeAuthUserCreate,
269
+ OpenProjectPreviewErrors,
270
+ OpenProjectPreviewResponses,
267
271
  PaidDomainRequest,
268
272
  PlanDeploymentErrors,
269
273
  PlanDeploymentPromotionErrors,
@@ -340,6 +344,8 @@ import type {
340
344
  RotateManagedMailWebhookSecretResponses,
341
345
  RotateProjectDevShareLinkErrors,
342
346
  RotateProjectDevShareLinkResponses,
347
+ RotateProjectPreviewTokenErrors,
348
+ RotateProjectPreviewTokenResponses,
343
349
  RunProjectDatabaseScheduleErrors,
344
350
  RunProjectDatabaseScheduleResponses,
345
351
  SetDevAccessModeRequest,
@@ -356,6 +362,8 @@ import type {
356
362
  SetProjectPoweredByFlagErrors,
357
363
  SetProjectPoweredByFlagResponses,
358
364
  SharedMailDnsAuthorizationRequest,
365
+ StopProjectPreviewErrors,
366
+ StopProjectPreviewResponses,
359
367
  StreamDeploymentLogsErrors,
360
368
  StreamDeploymentLogsResponse,
361
369
  StreamDeploymentLogsResponses,
@@ -404,6 +412,171 @@ export type Options<
404
412
  meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
405
413
  };
406
414
 
415
+ /**
416
+ * Stop a project environment preview
417
+ *
418
+ * Stops the runtime and removes its backups while preserving the stable URL. Repeat uncertain calls with the same idempotency key.
419
+ */
420
+ export const stopProjectPreview = <ThrowOnError extends boolean = true>(
421
+ parameters: {
422
+ "X-Request-Id"?: string;
423
+ "Idempotency-Key": string;
424
+ project_id: Ulid;
425
+ environment: "dev" | "prod";
426
+ },
427
+ options?: Options<never, ThrowOnError>,
428
+ ): RequestResult<StopProjectPreviewResponses, StopProjectPreviewErrors, ThrowOnError, "data"> => {
429
+ const params = buildClientParams(
430
+ [parameters],
431
+ [
432
+ {
433
+ args: [
434
+ { in: "headers", key: "X-Request-Id" },
435
+ { in: "headers", key: "Idempotency-Key" },
436
+ { in: "path", key: "project_id" },
437
+ { in: "query", key: "environment" },
438
+ ],
439
+ },
440
+ ],
441
+ );
442
+ return (options?.client ?? client).delete<
443
+ StopProjectPreviewResponses,
444
+ StopProjectPreviewErrors,
445
+ ThrowOnError,
446
+ "data"
447
+ >({
448
+ responseStyle: "data",
449
+ security: [{ scheme: "bearer", type: "http" }],
450
+ url: "/v1/projects/{project_id}/preview",
451
+ ...options,
452
+ ...params,
453
+ });
454
+ };
455
+
456
+ /**
457
+ * Read the preview for a project environment
458
+ *
459
+ * Requires project write permission to retrieve the private capability URL. Free projects have Prod; Paid projects can also have Dev.
460
+ */
461
+ export const getProjectPreview = <ThrowOnError extends boolean = true>(
462
+ parameters: {
463
+ "X-Request-Id"?: string;
464
+ project_id: Ulid;
465
+ environment: "dev" | "prod";
466
+ },
467
+ options?: Options<never, ThrowOnError>,
468
+ ): RequestResult<GetProjectPreviewResponses, GetProjectPreviewErrors, ThrowOnError, "data"> => {
469
+ const params = buildClientParams(
470
+ [parameters],
471
+ [
472
+ {
473
+ args: [
474
+ { in: "headers", key: "X-Request-Id" },
475
+ { in: "path", key: "project_id" },
476
+ { in: "query", key: "environment" },
477
+ ],
478
+ },
479
+ ],
480
+ );
481
+ return (options?.client ?? client).get<
482
+ GetProjectPreviewResponses,
483
+ GetProjectPreviewErrors,
484
+ ThrowOnError,
485
+ "data"
486
+ >({
487
+ responseStyle: "data",
488
+ security: [{ scheme: "bearer", type: "http" }],
489
+ url: "/v1/projects/{project_id}/preview",
490
+ ...options,
491
+ ...params,
492
+ });
493
+ };
494
+
495
+ /**
496
+ * Open or create a project environment preview
497
+ *
498
+ * Requires project write permission. Returns the existing stable URL or creates one. Opening its URL starts a sleeping preview; source saves update it independently of deployments.
499
+ */
500
+ export const openProjectPreview = <ThrowOnError extends boolean = true>(
501
+ parameters: {
502
+ "X-Request-Id"?: string;
503
+ project_id: Ulid;
504
+ environment: "dev" | "prod";
505
+ },
506
+ options?: Options<never, ThrowOnError>,
507
+ ): RequestResult<OpenProjectPreviewResponses, OpenProjectPreviewErrors, ThrowOnError, "data"> => {
508
+ const params = buildClientParams(
509
+ [parameters],
510
+ [
511
+ {
512
+ args: [
513
+ { in: "headers", key: "X-Request-Id" },
514
+ { in: "path", key: "project_id" },
515
+ { in: "query", key: "environment" },
516
+ ],
517
+ },
518
+ ],
519
+ );
520
+ return (options?.client ?? client).post<
521
+ OpenProjectPreviewResponses,
522
+ OpenProjectPreviewErrors,
523
+ ThrowOnError,
524
+ "data"
525
+ >({
526
+ responseStyle: "data",
527
+ security: [{ scheme: "bearer", type: "http" }],
528
+ url: "/v1/projects/{project_id}/preview",
529
+ ...options,
530
+ ...params,
531
+ });
532
+ };
533
+
534
+ /**
535
+ * Rotate a preview capability URL
536
+ *
537
+ * Invalidates the previous URL and closes its existing connections before returning the new URL. Repeat uncertain calls with the same idempotency key.
538
+ */
539
+ export const rotateProjectPreviewToken = <ThrowOnError extends boolean = true>(
540
+ parameters: {
541
+ "X-Request-Id"?: string;
542
+ "Idempotency-Key": string;
543
+ project_id: Ulid;
544
+ environment: "dev" | "prod";
545
+ },
546
+ options?: Options<never, ThrowOnError>,
547
+ ): RequestResult<
548
+ RotateProjectPreviewTokenResponses,
549
+ RotateProjectPreviewTokenErrors,
550
+ ThrowOnError,
551
+ "data"
552
+ > => {
553
+ const params = buildClientParams(
554
+ [parameters],
555
+ [
556
+ {
557
+ args: [
558
+ { in: "headers", key: "X-Request-Id" },
559
+ { in: "headers", key: "Idempotency-Key" },
560
+ { in: "path", key: "project_id" },
561
+ { in: "query", key: "environment" },
562
+ ],
563
+ },
564
+ ],
565
+ );
566
+ return (options?.client ?? client).post<
567
+ RotateProjectPreviewTokenResponses,
568
+ RotateProjectPreviewTokenErrors,
569
+ ThrowOnError,
570
+ "data"
571
+ >({
572
+ responseStyle: "data",
573
+ security: [{ scheme: "bearer", type: "http" }],
574
+ url: "/v1/projects/{project_id}/preview/token",
575
+ ...options,
576
+ ...params,
577
+ });
578
+ };
579
+
407
580
  /**
408
581
  * Read Native Auth configuration
409
582
  *
@@ -4,6 +4,21 @@ export type ClientOptions = {
4
4
  baseUrl: "https://app.ohmyho.st" | "https://dev.app.ohmyho.st" | (string & {});
5
5
  };
6
6
 
7
+ export type Preview = {
8
+ id: Ulid;
9
+ project_id: Ulid;
10
+ environment: "dev" | "prod";
11
+ status: "cold" | "starting" | "ready" | "sleeping";
12
+ /**
13
+ * Stable private capability URL without an expiration time.
14
+ */
15
+ url: string;
16
+ source: null | {
17
+ sequence: number;
18
+ commit_sha: string;
19
+ };
20
+ };
21
+
7
22
  export type NativeAuthConfiguration = {
8
23
  /**
9
24
  * Persistent Owner setting; source deployment cannot clear a pause.
@@ -2294,6 +2309,11 @@ export type DeploymentPlanWritable = {
2294
2309
  expires_at: string;
2295
2310
  };
2296
2311
 
2312
+ /**
2313
+ * The concrete project environment to preview.
2314
+ */
2315
+ export type PreviewEnvironment = "dev" | "prod";
2316
+
2297
2317
  /**
2298
2318
  * Opaque continuation cursor returned by the preceding page.
2299
2319
  */
@@ -2444,6 +2464,255 @@ export type ProjectFilter = Ulid;
2444
2464
  */
2445
2465
  export type OperationFilter = Ulid;
2446
2466
 
2467
+ export type StopProjectPreviewData = {
2468
+ body?: never;
2469
+ headers: {
2470
+ /**
2471
+ * Optional caller-provided correlation identifier.
2472
+ */
2473
+ "X-Request-Id"?: string;
2474
+ /**
2475
+ * Identifies one mutation and its canonical request payload.
2476
+ */
2477
+ "Idempotency-Key": string;
2478
+ };
2479
+ path: {
2480
+ /**
2481
+ * Project identifier.
2482
+ */
2483
+ project_id: Ulid;
2484
+ };
2485
+ query: {
2486
+ /**
2487
+ * The concrete project environment to preview.
2488
+ */
2489
+ environment: "dev" | "prod";
2490
+ };
2491
+ url: "/v1/projects/{project_id}/preview";
2492
+ };
2493
+
2494
+ export type StopProjectPreviewErrors = {
2495
+ /**
2496
+ * The request failed.
2497
+ */
2498
+ 400: ProblemDetails;
2499
+ /**
2500
+ * The request failed.
2501
+ */
2502
+ 401: ProblemDetails;
2503
+ /**
2504
+ * The resource does not exist or is not visible to the authenticated principal.
2505
+ */
2506
+ 404: ProblemDetails;
2507
+ /**
2508
+ * The request failed.
2509
+ */
2510
+ 409: ProblemDetails;
2511
+ /**
2512
+ * The request failed.
2513
+ */
2514
+ 429: ProblemDetails;
2515
+ /**
2516
+ * The request failed.
2517
+ */
2518
+ 503: ProblemDetails;
2519
+ };
2520
+
2521
+ export type StopProjectPreviewError = StopProjectPreviewErrors[keyof StopProjectPreviewErrors];
2522
+
2523
+ export type StopProjectPreviewResponses = {
2524
+ /**
2525
+ * The authorized preview and its private capability URL. Do not cache or publish the URL.
2526
+ */
2527
+ 200: Preview;
2528
+ };
2529
+
2530
+ export type StopProjectPreviewResponse =
2531
+ StopProjectPreviewResponses[keyof StopProjectPreviewResponses];
2532
+
2533
+ export type GetProjectPreviewData = {
2534
+ body?: never;
2535
+ headers?: {
2536
+ /**
2537
+ * Optional caller-provided correlation identifier.
2538
+ */
2539
+ "X-Request-Id"?: string;
2540
+ };
2541
+ path: {
2542
+ /**
2543
+ * Project identifier.
2544
+ */
2545
+ project_id: Ulid;
2546
+ };
2547
+ query: {
2548
+ /**
2549
+ * The concrete project environment to preview.
2550
+ */
2551
+ environment: "dev" | "prod";
2552
+ };
2553
+ url: "/v1/projects/{project_id}/preview";
2554
+ };
2555
+
2556
+ export type GetProjectPreviewErrors = {
2557
+ /**
2558
+ * The request failed.
2559
+ */
2560
+ 400: ProblemDetails;
2561
+ /**
2562
+ * The request failed.
2563
+ */
2564
+ 401: ProblemDetails;
2565
+ /**
2566
+ * The resource does not exist or is not visible to the authenticated principal.
2567
+ */
2568
+ 404: ProblemDetails;
2569
+ /**
2570
+ * The request failed.
2571
+ */
2572
+ 429: ProblemDetails;
2573
+ /**
2574
+ * The request failed.
2575
+ */
2576
+ 503: ProblemDetails;
2577
+ };
2578
+
2579
+ export type GetProjectPreviewError = GetProjectPreviewErrors[keyof GetProjectPreviewErrors];
2580
+
2581
+ export type GetProjectPreviewResponses = {
2582
+ /**
2583
+ * The authorized preview and its private capability URL. Do not cache or publish the URL.
2584
+ */
2585
+ 200: Preview;
2586
+ };
2587
+
2588
+ export type GetProjectPreviewResponse =
2589
+ GetProjectPreviewResponses[keyof GetProjectPreviewResponses];
2590
+
2591
+ export type OpenProjectPreviewData = {
2592
+ body?: never;
2593
+ headers?: {
2594
+ /**
2595
+ * Optional caller-provided correlation identifier.
2596
+ */
2597
+ "X-Request-Id"?: string;
2598
+ };
2599
+ path: {
2600
+ /**
2601
+ * Project identifier.
2602
+ */
2603
+ project_id: Ulid;
2604
+ };
2605
+ query: {
2606
+ /**
2607
+ * The concrete project environment to preview.
2608
+ */
2609
+ environment: "dev" | "prod";
2610
+ };
2611
+ url: "/v1/projects/{project_id}/preview";
2612
+ };
2613
+
2614
+ export type OpenProjectPreviewErrors = {
2615
+ /**
2616
+ * The request failed.
2617
+ */
2618
+ 400: ProblemDetails;
2619
+ /**
2620
+ * The request failed.
2621
+ */
2622
+ 401: ProblemDetails;
2623
+ /**
2624
+ * The resource does not exist or is not visible to the authenticated principal.
2625
+ */
2626
+ 404: ProblemDetails;
2627
+ /**
2628
+ * The request failed.
2629
+ */
2630
+ 429: ProblemDetails;
2631
+ /**
2632
+ * The request failed.
2633
+ */
2634
+ 503: ProblemDetails;
2635
+ };
2636
+
2637
+ export type OpenProjectPreviewError = OpenProjectPreviewErrors[keyof OpenProjectPreviewErrors];
2638
+
2639
+ export type OpenProjectPreviewResponses = {
2640
+ /**
2641
+ * The authorized preview and its private capability URL. Do not cache or publish the URL.
2642
+ */
2643
+ 200: Preview;
2644
+ };
2645
+
2646
+ export type OpenProjectPreviewResponse =
2647
+ OpenProjectPreviewResponses[keyof OpenProjectPreviewResponses];
2648
+
2649
+ export type RotateProjectPreviewTokenData = {
2650
+ body?: never;
2651
+ headers: {
2652
+ /**
2653
+ * Optional caller-provided correlation identifier.
2654
+ */
2655
+ "X-Request-Id"?: string;
2656
+ /**
2657
+ * Identifies one mutation and its canonical request payload.
2658
+ */
2659
+ "Idempotency-Key": string;
2660
+ };
2661
+ path: {
2662
+ /**
2663
+ * Project identifier.
2664
+ */
2665
+ project_id: Ulid;
2666
+ };
2667
+ query: {
2668
+ /**
2669
+ * The concrete project environment to preview.
2670
+ */
2671
+ environment: "dev" | "prod";
2672
+ };
2673
+ url: "/v1/projects/{project_id}/preview/token";
2674
+ };
2675
+
2676
+ export type RotateProjectPreviewTokenErrors = {
2677
+ /**
2678
+ * The request failed.
2679
+ */
2680
+ 400: ProblemDetails;
2681
+ /**
2682
+ * The request failed.
2683
+ */
2684
+ 401: ProblemDetails;
2685
+ /**
2686
+ * The resource does not exist or is not visible to the authenticated principal.
2687
+ */
2688
+ 404: ProblemDetails;
2689
+ /**
2690
+ * The request failed.
2691
+ */
2692
+ 409: ProblemDetails;
2693
+ /**
2694
+ * The request failed.
2695
+ */
2696
+ 429: ProblemDetails;
2697
+ /**
2698
+ * The request failed.
2699
+ */
2700
+ 503: ProblemDetails;
2701
+ };
2702
+
2703
+ export type RotateProjectPreviewTokenError =
2704
+ RotateProjectPreviewTokenErrors[keyof RotateProjectPreviewTokenErrors];
2705
+
2706
+ export type RotateProjectPreviewTokenResponses = {
2707
+ /**
2708
+ * The authorized preview and its private capability URL. Do not cache or publish the URL.
2709
+ */
2710
+ 200: Preview;
2711
+ };
2712
+
2713
+ export type RotateProjectPreviewTokenResponse =
2714
+ RotateProjectPreviewTokenResponses[keyof RotateProjectPreviewTokenResponses];
2715
+
2447
2716
  export type GetNativeAuthConfigurationData = {
2448
2717
  body?: never;
2449
2718
  headers?: {