@myapihq/cli 1.3.4 → 1.3.5

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.
@@ -114,23 +114,44 @@ export async function importCmd(domainArg, flags) {
114
114
  }
115
115
  success(`Imported ${res.domain} (status: ${res.status})`);
116
116
  info('');
117
- info(`Nameservers (set these at your current registrar):`);
118
- for (const ns of res.nameservers)
119
- info(` ${ns}`);
120
- info('');
121
- if (res.preserved_records.length > 0) {
122
- info(`Preserved DNS records (${res.preserved_count} foundverify before the NS change):`);
123
- printTable(res.preserved_records.map(r => ({ type: r.type, name: r.name, content: r.content, ttl: r.ttl })), { flags });
117
+ // Defensive the backend has shipped this response with a non-array
118
+ // `nameservers` (the domain_id string mis-serialized into the field) and
119
+ // missing `preserved_records` in some states. JS iterating a string
120
+ // prints char-per-line and reading .length on undefined crashes; see
121
+ // docs/cross-repo-prompts/backend-domain-import-response-shape.md. Never
122
+ // trust the shape blindlydegrade to pointing at `domain status`,
123
+ // which is queryable for the real values.
124
+ if (Array.isArray(res.nameservers) && res.nameservers.length > 0) {
125
+ info(`Nameservers (set these at your current registrar):`);
126
+ for (const ns of res.nameservers)
127
+ info(` ${ns}`);
128
+ info('');
129
+ }
130
+ else {
131
+ info(`⚠ Backend returned an unexpected nameservers shape (got ${typeof res.nameservers}).`);
132
+ info(` The domain is imported — fetch the real nameservers with:`);
133
+ info(` myapi domain status ${res.domain} --json`);
134
+ info('');
135
+ }
136
+ const preserved = Array.isArray(res.preserved_records) ? res.preserved_records : [];
137
+ const preservedCount = typeof res.preserved_count === 'number' ? res.preserved_count : preserved.length;
138
+ if (preserved.length > 0) {
139
+ info(`Preserved DNS records (${preservedCount} found — verify before the NS change):`);
140
+ printTable(preserved.map(r => ({ type: r.type, name: r.name, content: r.content, ttl: r.ttl })), { flags });
124
141
  info('');
125
142
  }
126
143
  else {
127
144
  info(`No DNS records detected via public probe — verify directly with your registrar before the NS change.`);
128
145
  info('');
129
146
  }
130
- info(res.probe_warning);
131
- info('');
132
- info(res.next_step);
133
- info('');
147
+ if (res.probe_warning) {
148
+ info(res.probe_warning);
149
+ info('');
150
+ }
151
+ if (res.next_step) {
152
+ info(res.next_step);
153
+ info('');
154
+ }
134
155
  info(`After changing nameservers, watch activation with:`);
135
156
  info(` myapi domain status ${res.domain} --watch`);
136
157
  }
@@ -50,7 +50,7 @@ pixel_visit | webhook_received
50
50
 
51
51
  Agents cannot write events directly — the closed enum is intentional. If you need custom state, use **mydatabaseapi** (KV) keyed on the contact id; the curated timeline stays authoritative for engagement.
52
52
 
53
- **Engagement-event kinds bump `last_engagement_at`**: email_sent/opened/clicked/replied, pixel_visit, webhook_received. Admin kinds (created, promoted, stage_changed) don't. That's the right semantics — promoting a Goldfox lead into the CRM is not engagement.
53
+ **Engagement-event kinds bump `last_engagement_at`**: email_sent/opened/clicked/replied, pixel_visit, webhook_received. Admin kinds (created, promoted, stage_changed) don't — promoting a Goldfox lead isn't engagement.
54
54
 
55
55
  ### Auto-ingest
56
56
 
@@ -157,8 +157,7 @@ myapi crm contacts events <id> --kind webhook_received
157
157
  ## Notes
158
158
 
159
159
  - **Reserved event kinds — no custom events in v1.** If an agent needs custom state per contact, use `myapi database` keyed by contact id. The curated timeline stays the authoritative engagement record.
160
- - **Event payloads carry an `external_id`** field used by the backend's idempotency index same value as the natural id of the underlying action (`goldfox_person_id` for `promoted`, `delivery_id` for `webhook_received`, future `message_id` for `email_sent`). Read the semantic field (e.g. `goldfox_person_id`); `external_id` is a backend-internal duplicate. Old rows may still carry a legacy `message_id` field same value as `external_id`; safe to ignore.
161
- - **Goldfox enrichment field deferred** — the live join lands once the BQ get-by-id helper is wired backend-side. CLI treats it as optional today.
160
+ - **Event payloads carry an `external_id`** the backend's idempotency key, equal to the underlying action's natural id (`goldfox_person_id` for `promoted`, `delivery_id` for `webhook_received`). Read the semantic field; `external_id` is a backend-internal duplicate. A legacy `message_id` on old rows holds the same value safe to ignore.
162
161
  - **Email + Pixel auto-ingest not yet wired**. Only `webhook_received` events fire today. Email and pixel ingest are coming — the CLI surface stays unchanged when they land.
163
162
  - **Free in v1.** Metered later if usage shows a need.
164
163
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
3
  "license": "Apache-2.0",
4
- "version": "1.3.4",
4
+ "version": "1.3.5",
5
5
  "description": "MyAPI command-line interface",
6
6
  "type": "module",
7
7
  "files": [
@@ -29,7 +29,7 @@
29
29
  "lint:changelog": "node ../../scripts/lint-changelog.js"
30
30
  },
31
31
  "dependencies": {
32
- "@myapihq/sdk": "^1.3.4"
32
+ "@myapihq/sdk": "^1.3.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.6.0",