@bernierllc/nevarmail 0.3.0 → 0.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/README.md CHANGED
@@ -149,8 +149,9 @@ yourself can narrow a block; a default the server resolves cannot.
149
149
  | `listLists` / `createList` / `getList` | `/api/v1/lists` | `contacts:read` / `contacts:write` |
150
150
  | `addListContacts` | `POST /api/v1/lists/{id}/contacts` | `contacts:write` |
151
151
  | `listContacts` / `upsertContacts` / `updateContact` / `deleteContact` | `/api/v1/contacts` | `contacts:read` / `contacts:write` |
152
- | `listSenders` / `createSender` / `getSender` / `updateSender` / `deleteSender` | `/api/v1/senders` | `senders:read` / `senders:write` |
153
- | `listDomains` / `createDomain` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
152
+ | `listSenders` / `createSender(input)` — `input.projectId?` targets a project when the org has more than one | `/api/v1/senders` | `senders:read` / `senders:write` |
153
+ | `getSender` / `updateSender` / `deleteSender` | `/api/v1/senders/{id}` | `senders:read` / `senders:write` |
154
+ | `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
154
155
  | `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
155
156
  | `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
156
157
 
package/dist/index.d.ts CHANGED
@@ -244,8 +244,15 @@ export interface CreateSenderInput {
244
244
  providerSenderId?: string;
245
245
  priority?: number;
246
246
  isDefault?: boolean;
247
+ /**
248
+ * Target project (UUID). Omit it when the org has only one project — it goes there.
249
+ * Several projects and no `projectId`: 400 `PROJECT_REQUIRED`. No project on the org:
250
+ * 422 `NO_PROJECT`. Key's user can't open the named project: 404 `NOT_FOUND`.
251
+ */
252
+ projectId?: string;
247
253
  }
248
- export type UpdateSenderInput = Partial<CreateSenderInput>;
254
+ /** A sender stays in the project it was created in, so `projectId` is create-only. */
255
+ export type UpdateSenderInput = Partial<Omit<CreateSenderInput, "projectId">>;
249
256
  export interface DnsRecord {
250
257
  type: "TXT" | "CNAME" | "MX";
251
258
  host: string;
@@ -275,6 +282,8 @@ export interface ProviderVerification {
275
282
  export interface Domain {
276
283
  id: string;
277
284
  orgId: string;
285
+ /** Project the domain is attributed to — a domain is an org-level asset. */
286
+ projectId: string;
278
287
  domain: string;
279
288
  verificationStatus: string;
280
289
  createdAt: string;
@@ -469,8 +478,15 @@ export declare class NevarMail {
469
478
  }>;
470
479
  /** GET /api/v1/domains — paged; list rows carry extras single reads do not. */
471
480
  listDomains(options?: PageOptions): Promise<Paginated<Domain>>;
472
- /** POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it. */
473
- createDomain(domain: string): Promise<Domain>;
481
+ /**
482
+ * POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it.
483
+ * `projectId` is required when the org has more than one project
484
+ * (422 PROJECT_REQUIRED otherwise); 404 PROJECT_NOT_FOUND for a project
485
+ * outside the org.
486
+ */
487
+ createDomain(domain: string, options?: {
488
+ projectId?: string;
489
+ }): Promise<Domain>;
474
490
  /** GET /api/v1/domains/{id} — 404 DOMAIN_NOT_FOUND. */
475
491
  getDomain(id: string): Promise<Domain>;
476
492
  /**
package/dist/index.js CHANGED
@@ -330,9 +330,16 @@ export class NevarMail {
330
330
  listDomains(options = {}) {
331
331
  return this.requestPaginated("GET", "/api/v1/domains", { query: { ...options } });
332
332
  }
333
- /** POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it. */
334
- createDomain(domain) {
335
- return this.request("POST", "/api/v1/domains", { body: { domain } });
333
+ /**
334
+ * POST /api/v1/domains — 409 DUPLICATE_DOMAIN if the org already has it.
335
+ * `projectId` is required when the org has more than one project
336
+ * (422 PROJECT_REQUIRED otherwise); 404 PROJECT_NOT_FOUND for a project
337
+ * outside the org.
338
+ */
339
+ createDomain(domain, options = {}) {
340
+ return this.request("POST", "/api/v1/domains", {
341
+ body: options.projectId ? { domain, projectId: options.projectId } : { domain },
342
+ });
336
343
  }
337
344
  /** GET /api/v1/domains/{id} — 404 DOMAIN_NOT_FOUND. */
338
345
  getDomain(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Official client for the NevarMail v1 API. Typed, retries 429/5xx, throws NevarMailError on every non-2xx.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",