@amerged/ohmyhost-sdk 0.1.36 → 0.1.37
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/README.md +1 -1
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/generated/sdk.gen.d.ts +184 -1
- package/dist/generated/sdk.gen.d.ts.map +1 -1
- package/dist/generated/sdk.gen.js +459 -0
- package/dist/generated/sdk.gen.js.map +1 -1
- package/dist/generated/shared-mail-response.d.ts +10 -0
- package/dist/generated/shared-mail-response.d.ts.map +1 -0
- package/dist/generated/shared-mail-response.js +220 -0
- package/dist/generated/shared-mail-response.js.map +1 -0
- package/dist/generated/types.gen.d.ts +1078 -0
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/shared-mail-response.d.ts +2 -0
- package/dist/shared-mail-response.d.ts.map +1 -0
- package/dist/shared-mail-response.js +2 -0
- package/dist/shared-mail-response.js.map +1 -0
- package/dist/shared-mail.d.ts +62 -0
- package/dist/shared-mail.d.ts.map +1 -0
- package/dist/shared-mail.js +125 -0
- package/dist/shared-mail.js.map +1 -0
- package/package.json +1 -1
- package/src/packages/sdk-ts/package.json +1 -1
- package/src/packages/sdk-ts/src/generated/index.ts +112 -0
- package/src/packages/sdk-ts/src/generated/sdk.gen.ts +870 -0
- package/src/packages/sdk-ts/src/generated/shared-mail-response.ts +238 -0
- package/src/packages/sdk-ts/src/generated/types.gen.ts +1207 -0
- package/src/packages/sdk-ts/src/index.ts +2 -0
- package/src/packages/sdk-ts/src/shared-mail-response.ts +1 -0
- package/src/packages/sdk-ts/src/shared-mail.ts +225 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { assertSharedMailResponse } from "./generated/shared-mail-response.js";
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { Client } from "./generated/client/index.js";
|
|
2
|
+
import {
|
|
3
|
+
listWorkspaceMailDomains,
|
|
4
|
+
createWorkspaceMailDomain,
|
|
5
|
+
getWorkspaceMailDomain,
|
|
6
|
+
retireWorkspaceMailDomain,
|
|
7
|
+
authorizeWorkspaceMailDomainDns,
|
|
8
|
+
getWorkspaceMailDomainDnsAuthorization,
|
|
9
|
+
getProjectMailDomainBinding,
|
|
10
|
+
putProjectMailDomainBinding,
|
|
11
|
+
detachProjectMailDomainBinding,
|
|
12
|
+
getApplicationDomainIdentity,
|
|
13
|
+
declareApplicationDomainIdentity,
|
|
14
|
+
revokeApplicationDomainIdentity,
|
|
15
|
+
verifyApplicationDomainIdentity,
|
|
16
|
+
authorizeApplicationDomainIdentityDns,
|
|
17
|
+
getApplicationDomainIdentityDnsAuthorization,
|
|
18
|
+
revokeWorkspaceMailDomainDnsAuthorization,
|
|
19
|
+
revokeApplicationDomainIdentityDnsAuthorization,
|
|
20
|
+
} from "./generated/sdk.gen.js";
|
|
21
|
+
import { assertSharedMailResponse } from "./shared-mail-response.js";
|
|
22
|
+
|
|
23
|
+
type Mutation = { idempotencyKey: string };
|
|
24
|
+
type Revision = { expectedRevision: number };
|
|
25
|
+
export type SharedMailCommand =
|
|
26
|
+
| ({ organizationId: string } & (
|
|
27
|
+
| { action: "domains_list" }
|
|
28
|
+
| ({ action: "domain_create"; domain: string; sending: true } & Mutation)
|
|
29
|
+
| { action: "domain_get"; mailDomainId: string }
|
|
30
|
+
| ({ action: "domain_retire"; mailDomainId: string } & Revision & Mutation)
|
|
31
|
+
| ({ action: "domain_dns_authorize"; mailDomainId: string; zone: string } & Revision &
|
|
32
|
+
Mutation)
|
|
33
|
+
| { action: "domain_dns_status"; mailDomainId: string }
|
|
34
|
+
| ({ action: "domain_dns_revoke"; mailDomainId: string } & Revision & Mutation)
|
|
35
|
+
))
|
|
36
|
+
| ({ projectId: string; environmentId: string } & (
|
|
37
|
+
| { action: "binding_get" }
|
|
38
|
+
| ({
|
|
39
|
+
action: "binding_set";
|
|
40
|
+
mailDomainId: string;
|
|
41
|
+
sending: boolean;
|
|
42
|
+
senderAddresses: readonly string[];
|
|
43
|
+
defaultFrom: string;
|
|
44
|
+
defaultReplyTo: string | null;
|
|
45
|
+
} & Revision &
|
|
46
|
+
Mutation)
|
|
47
|
+
| ({ action: "binding_detach" } & Revision & Mutation)
|
|
48
|
+
))
|
|
49
|
+
| ({ projectId: string } & (
|
|
50
|
+
| { action: "identity_get" | "identity_authorization_status" }
|
|
51
|
+
| ({ action: "identity_declare"; hostname: string } & Mutation)
|
|
52
|
+
| ({
|
|
53
|
+
action: "identity_verify" | "identity_revoke" | "identity_authorization_revoke";
|
|
54
|
+
} & Revision &
|
|
55
|
+
Mutation)
|
|
56
|
+
| ({ action: "identity_authorize"; zone: string } & Revision & Mutation)
|
|
57
|
+
));
|
|
58
|
+
|
|
59
|
+
/** One exact REST adapter is used by local and remote customer clients. */
|
|
60
|
+
export async function executeSharedMail(client: Client, input: SharedMailCommand) {
|
|
61
|
+
const options = { client };
|
|
62
|
+
let result: unknown;
|
|
63
|
+
switch (input.action) {
|
|
64
|
+
case "domains_list":
|
|
65
|
+
result = await listWorkspaceMailDomains({ organization_id: input.organizationId }, options);
|
|
66
|
+
break;
|
|
67
|
+
case "domain_create":
|
|
68
|
+
result = await createWorkspaceMailDomain(
|
|
69
|
+
{
|
|
70
|
+
organization_id: input.organizationId,
|
|
71
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
72
|
+
createWorkspaceMailDomainRequest: { domain: input.domain, sending: input.sending },
|
|
73
|
+
},
|
|
74
|
+
options,
|
|
75
|
+
);
|
|
76
|
+
break;
|
|
77
|
+
case "domain_get":
|
|
78
|
+
result = await getWorkspaceMailDomain(
|
|
79
|
+
{ organization_id: input.organizationId, mail_domain_id: input.mailDomainId },
|
|
80
|
+
options,
|
|
81
|
+
);
|
|
82
|
+
break;
|
|
83
|
+
case "domain_retire":
|
|
84
|
+
result = await retireWorkspaceMailDomain(
|
|
85
|
+
{
|
|
86
|
+
organization_id: input.organizationId,
|
|
87
|
+
mail_domain_id: input.mailDomainId,
|
|
88
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
89
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
90
|
+
},
|
|
91
|
+
options,
|
|
92
|
+
);
|
|
93
|
+
break;
|
|
94
|
+
case "domain_dns_authorize":
|
|
95
|
+
result = await authorizeWorkspaceMailDomainDns(
|
|
96
|
+
{
|
|
97
|
+
organization_id: input.organizationId,
|
|
98
|
+
mail_domain_id: input.mailDomainId,
|
|
99
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
100
|
+
sharedMailDnsAuthorizationRequest: {
|
|
101
|
+
expected_revision: input.expectedRevision,
|
|
102
|
+
zone: input.zone,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
options,
|
|
106
|
+
);
|
|
107
|
+
break;
|
|
108
|
+
case "domain_dns_revoke":
|
|
109
|
+
result = await revokeWorkspaceMailDomainDnsAuthorization(
|
|
110
|
+
{
|
|
111
|
+
organization_id: input.organizationId,
|
|
112
|
+
mail_domain_id: input.mailDomainId,
|
|
113
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
114
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
115
|
+
},
|
|
116
|
+
options,
|
|
117
|
+
);
|
|
118
|
+
break;
|
|
119
|
+
case "identity_authorization_revoke":
|
|
120
|
+
result = await revokeApplicationDomainIdentityDnsAuthorization(
|
|
121
|
+
{
|
|
122
|
+
project_id: input.projectId,
|
|
123
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
124
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
125
|
+
},
|
|
126
|
+
options,
|
|
127
|
+
);
|
|
128
|
+
break;
|
|
129
|
+
case "domain_dns_status":
|
|
130
|
+
result = await getWorkspaceMailDomainDnsAuthorization(
|
|
131
|
+
{ organization_id: input.organizationId, mail_domain_id: input.mailDomainId },
|
|
132
|
+
options,
|
|
133
|
+
);
|
|
134
|
+
break;
|
|
135
|
+
case "binding_get":
|
|
136
|
+
result = await getProjectMailDomainBinding(
|
|
137
|
+
{ project_id: input.projectId, environment_id: input.environmentId },
|
|
138
|
+
options,
|
|
139
|
+
);
|
|
140
|
+
break;
|
|
141
|
+
case "binding_set":
|
|
142
|
+
result = await putProjectMailDomainBinding(
|
|
143
|
+
{
|
|
144
|
+
project_id: input.projectId,
|
|
145
|
+
environment_id: input.environmentId,
|
|
146
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
147
|
+
projectMailDomainBindingRequest: {
|
|
148
|
+
mail_domain_id: input.mailDomainId,
|
|
149
|
+
sending: input.sending,
|
|
150
|
+
sender_addresses: [...input.senderAddresses],
|
|
151
|
+
default_from: input.defaultFrom,
|
|
152
|
+
default_reply_to: input.defaultReplyTo,
|
|
153
|
+
expected_revision: input.expectedRevision,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
options,
|
|
157
|
+
);
|
|
158
|
+
break;
|
|
159
|
+
case "binding_detach":
|
|
160
|
+
result = await detachProjectMailDomainBinding(
|
|
161
|
+
{
|
|
162
|
+
project_id: input.projectId,
|
|
163
|
+
environment_id: input.environmentId,
|
|
164
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
165
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
166
|
+
},
|
|
167
|
+
options,
|
|
168
|
+
);
|
|
169
|
+
break;
|
|
170
|
+
case "identity_get":
|
|
171
|
+
result = await getApplicationDomainIdentity({ project_id: input.projectId }, options);
|
|
172
|
+
break;
|
|
173
|
+
case "identity_declare":
|
|
174
|
+
result = await declareApplicationDomainIdentity(
|
|
175
|
+
{
|
|
176
|
+
project_id: input.projectId,
|
|
177
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
178
|
+
applicationDomainIdentityRequest: { hostname: input.hostname },
|
|
179
|
+
},
|
|
180
|
+
options,
|
|
181
|
+
);
|
|
182
|
+
break;
|
|
183
|
+
case "identity_verify":
|
|
184
|
+
result = await verifyApplicationDomainIdentity(
|
|
185
|
+
{
|
|
186
|
+
project_id: input.projectId,
|
|
187
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
188
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
189
|
+
},
|
|
190
|
+
options,
|
|
191
|
+
);
|
|
192
|
+
break;
|
|
193
|
+
case "identity_revoke":
|
|
194
|
+
result = await revokeApplicationDomainIdentity(
|
|
195
|
+
{
|
|
196
|
+
project_id: input.projectId,
|
|
197
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
198
|
+
mailRevisionRequest: { expected_revision: input.expectedRevision },
|
|
199
|
+
},
|
|
200
|
+
options,
|
|
201
|
+
);
|
|
202
|
+
break;
|
|
203
|
+
case "identity_authorize":
|
|
204
|
+
result = await authorizeApplicationDomainIdentityDns(
|
|
205
|
+
{
|
|
206
|
+
project_id: input.projectId,
|
|
207
|
+
"Idempotency-Key": input.idempotencyKey,
|
|
208
|
+
sharedMailDnsAuthorizationRequest: {
|
|
209
|
+
expected_revision: input.expectedRevision,
|
|
210
|
+
zone: input.zone,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
options,
|
|
214
|
+
);
|
|
215
|
+
break;
|
|
216
|
+
case "identity_authorization_status":
|
|
217
|
+
result = await getApplicationDomainIdentityDnsAuthorization(
|
|
218
|
+
{ project_id: input.projectId },
|
|
219
|
+
options,
|
|
220
|
+
);
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
assertSharedMailResponse(result, input);
|
|
224
|
+
return result;
|
|
225
|
+
}
|