@amerged/ohmyhost-mcp 0.1.20 → 0.1.21

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.
@@ -14,6 +14,8 @@ export {
14
14
  parseCurrentIdentity,
15
15
  parseDevAccessTicket,
16
16
  parseDevAccessState,
17
+ parsePoweredByFlag,
18
+ parseOrganizationReferral,
17
19
  parseCloudflareDnsAuthorization,
18
20
  parseCloudflareDnsAuthorizationStatus,
19
21
  parsePaidDomain,
@@ -45,6 +45,7 @@ import {
45
45
  type BillingPortal,
46
46
  getOrganizationCredits,
47
47
  getOrganizationAccount,
48
+ getOrganizationReferral,
48
49
  type OrganizationAccount,
49
50
  getOrganizationCreditUsage,
50
51
  type OrganizationCreditUsage,
@@ -61,6 +62,8 @@ import {
61
62
  rotateProjectDevShareLink,
62
63
  revokeProjectDevShareLink,
63
64
  setProjectDevAccessMode,
65
+ getProjectPoweredByFlag,
66
+ setProjectPoweredByFlag,
64
67
  createDeployment,
65
68
  createProject,
66
69
  submitFeedback,
@@ -193,6 +196,9 @@ export interface ProductApi {
193
196
  }): Promise<import("@ohmyhost/sdk-ts").BillingRecharge>;
194
197
  createBillingPortal(organizationId: string): Promise<BillingPortal>;
195
198
  getOrganizationAccount(organizationId: string): Promise<OrganizationAccount>;
199
+ getOrganizationReferral(
200
+ organizationId: string,
201
+ ): Promise<import("@ohmyhost/sdk-ts").OrganizationReferral>;
196
202
  getOrganizationCredits(organizationId: string): Promise<OrganizationCredits>;
197
203
  getOrganizationCreditUsage(input: {
198
204
  organizationId: string;
@@ -277,6 +283,12 @@ export interface ProductApi {
277
283
  mode: "protected" | "public",
278
284
  idempotencyKey: string,
279
285
  ): Promise<import("@ohmyhost/sdk-ts").DevAccessState>;
286
+ getPoweredByFlag(projectId: string): Promise<import("@ohmyhost/sdk-ts").PoweredByFlag>;
287
+ setPoweredByFlag(
288
+ projectId: string,
289
+ enabled: boolean,
290
+ idempotencyKey: string,
291
+ ): Promise<import("@ohmyhost/sdk-ts").PoweredByFlag>;
280
292
  submitFeedback(input: {
281
293
  report: import("@ohmyhost/sdk-ts").FeedbackSubmission;
282
294
  idempotencyKey: string;
@@ -489,6 +501,9 @@ export class GeneratedSdkProductApi implements ProductApi {
489
501
  return parseAccountProfile(await getAccountProfile({ client: this.#client }));
490
502
  }
491
503
 
504
+ public getOrganizationReferral(organizationId: string) {
505
+ return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
506
+ }
492
507
  public getOrganizationAccount(organizationId: string) {
493
508
  return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
494
509
  }
@@ -790,6 +805,19 @@ export class GeneratedSdkProductApi implements ProductApi {
790
805
  { client: this.#client },
791
806
  );
792
807
  }
808
+ public async getPoweredByFlag(projectId: string) {
809
+ return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
810
+ }
811
+ public async setPoweredByFlag(projectId: string, enabled: boolean, idempotencyKey: string) {
812
+ return setProjectPoweredByFlag(
813
+ {
814
+ project_id: projectId,
815
+ "Idempotency-Key": idempotencyKey,
816
+ setPoweredByFlagRequest: { enabled },
817
+ },
818
+ { client: this.#client },
819
+ );
820
+ }
793
821
  public async createDevAccessTicket(projectId: string): Promise<DevAccessTicket> {
794
822
  return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
795
823
  }
@@ -273,6 +273,12 @@ export const PROBLEM_POLICY = {
273
273
  retryable: false,
274
274
  action: "Finish database provisioning, then request the export again. No backup was accepted.",
275
275
  },
276
+ powered_by_flag_required: {
277
+ status: 409,
278
+ retryable: false,
279
+ action:
280
+ "Keep the flag on, remove the custom domain with 'ohmyhost domain paid delete', or buy Paid, then switch the flag off.",
281
+ },
276
282
  rate_limited: { status: 429, retryable: true, action: "Retry after the server delay." },
277
283
  insufficient_organization_credits: {
278
284
  status: 402,
@@ -289,7 +295,7 @@ export const PROBLEM_POLICY = {
289
295
  status: 402,
290
296
  retryable: false,
291
297
  action:
292
- "Ask the organization Owner to activate Paid through billing checkout, then retry. Top-ups and signup credits do not activate Paid.",
298
+ "Ask the organization Owner to activate Paid through billing checkout, then retry. Top-ups and signup credits do not activate Paid. For a website domain alone, a Free workspace may instead show the powered-by flag on the project.",
293
299
  },
294
300
  interactive_login_required: {
295
301
  status: 403,
@@ -740,6 +746,39 @@ export const parseDevAccessState = (value: unknown): PublicDevAccessState => {
740
746
  return input as unknown as PublicDevAccessState;
741
747
  };
742
748
 
749
+ export interface PublicPoweredByFlag {
750
+ readonly project_id: string;
751
+ readonly enabled: boolean;
752
+ readonly enabled_at: string | null;
753
+ }
754
+
755
+ export const parsePoweredByFlag = (value: unknown): PublicPoweredByFlag => {
756
+ const input = exactRecord(value, ["project_id", "enabled", "enabled_at"]);
757
+ if (
758
+ !isUlid(input["project_id"]) ||
759
+ typeof input["enabled"] !== "boolean" ||
760
+ (input["enabled"] ? !isIsoInstant(input["enabled_at"]) : input["enabled_at"] !== null)
761
+ )
762
+ throw new ResponseContractError();
763
+ return input as unknown as PublicPoweredByFlag;
764
+ };
765
+
766
+ export interface PublicOrganizationReferral {
767
+ readonly organization_id: string;
768
+ readonly referral_url: string;
769
+ }
770
+
771
+ export const parseOrganizationReferral = (value: unknown): PublicOrganizationReferral => {
772
+ const input = exactRecord(value, ["organization_id", "referral_url"]);
773
+ if (
774
+ !isUlid(input["organization_id"]) ||
775
+ input["referral_url"] !==
776
+ `https://ohmyho.st/?r=ref-${String(input["organization_id"]).toLowerCase()}`
777
+ )
778
+ throw new ResponseContractError();
779
+ return input as unknown as PublicOrganizationReferral;
780
+ };
781
+
743
782
  export const parseDevAccessTicket = (value: unknown): PublicDevAccessTicket => {
744
783
  const input = exactRecord(value, [
745
784
  "ticket_id",
@@ -1141,6 +1180,8 @@ const parseProjectDeployment = (value: unknown): void => {
1141
1180
 
1142
1181
  export interface PublicOperation {
1143
1182
  readonly blocking_operation_id?: string;
1183
+ /** The deployment this operation created; its diagnostics explain a failure. */
1184
+ readonly deployment_id?: string;
1144
1185
  readonly progress?: OperationDeploymentProgress;
1145
1186
  readonly id: string;
1146
1187
  readonly state: "queued" | "running" | "succeeded" | "failed" | "cancelled";
@@ -1580,6 +1621,7 @@ export const parseSafeProblem = (value: unknown): SafeProblem => {
1580
1621
  export const parseOperation = (value: unknown): PublicOperation => {
1581
1622
  const input = exactRecord(value, [
1582
1623
  "blocking_operation_id",
1624
+ "deployment_id",
1583
1625
  "id",
1584
1626
  "state",
1585
1627
  "created_at",
@@ -1595,9 +1637,11 @@ export const parseOperation = (value: unknown): PublicOperation => {
1595
1637
  const updatedAt = input["updated_at"];
1596
1638
  const result = input["result"];
1597
1639
  const blockingOperationId = input["blocking_operation_id"];
1640
+ const deploymentId = input["deployment_id"];
1598
1641
  if (
1599
- blockingOperationId !== undefined &&
1600
- (state !== "queued" || !isUlid(blockingOperationId) || blockingOperationId === id)
1642
+ (blockingOperationId !== undefined &&
1643
+ (state !== "queued" || !isUlid(blockingOperationId) || blockingOperationId === id)) ||
1644
+ (deploymentId !== undefined && !isUlid(deploymentId))
1601
1645
  )
1602
1646
  throw new ResponseContractError();
1603
1647
  if (
@@ -1659,6 +1703,7 @@ export const parseOperation = (value: unknown): PublicOperation => {
1659
1703
  ...(blockingOperationId === undefined
1660
1704
  ? {}
1661
1705
  : { blocking_operation_id: blockingOperationId as string }),
1706
+ ...(deploymentId === undefined ? {} : { deployment_id: deploymentId as string }),
1662
1707
  ...(progress === undefined ? {} : { progress }),
1663
1708
  ...(result === undefined ? {} : { result }),
1664
1709
  ...(error === undefined ? {} : { error }),