Skip to content

Commit eb4f290

Browse files
committed
add users merge
1 parent a35b8c6 commit eb4f290

5 files changed

Lines changed: 35 additions & 8 deletions

File tree

COMMANDS.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Available Commands (109)
1+
# Available Commands (110)
22

33
All commands follow the pattern: `iterable <category> <command> [options]`
44

@@ -1426,7 +1426,7 @@ iterable templates upsert-sms <clientTemplateId>
14261426
| `--name` | string | no | Template name |
14271427

14281428

1429-
## users (12)
1429+
## users (13)
14301430

14311431
### bulk-update
14321432

@@ -1539,6 +1539,22 @@ iterable users get-sent-messages
15391539
| `--startDateTime` | string | no | Start date time (yyyy-MM-dd HH:mm:ss ZZ) |
15401540
| `--userId` | string | no | User ID (alternative to email) |
15411541

1542+
### merge
1543+
1544+
Merge two user profiles — all data and events from source are migrated to destination
1545+
1546+
```
1547+
iterable users merge
1548+
```
1549+
1550+
| Option | Type | Required | Description |
1551+
|--------|------|----------|-------------|
1552+
| `--arrayMerge` | json[] | no | Array fields whose contents should be merged (only custom arrays, not Iterable-managed ones like devices) |
1553+
| `--destinationEmail` | string | no | Email of the destination user profile to merge into |
1554+
| `--destinationUserId` | string | no | User ID of the destination user profile to merge into |
1555+
| `--sourceEmail` | string | no | Email of the source user profile to merge from |
1556+
| `--sourceUserId` | string | no | User ID of the source user profile to merge from |
1557+
15421558
### update
15431559

15441560
Update user profile information (accepts email OR userId)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"update-commands": "node scripts/update-commands.js"
6060
},
6161
"dependencies": {
62-
"@iterable/api": "0.10.1",
62+
"@iterable/api": "0.10.2",
6363
"@primno/dpapi": "2.0.1",
6464
"boxen": "8.0.1",
6565
"chalk": "5.6.2",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/users.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
GetSentMessagesParamsSchema,
66
GetUserByEmailParamsSchema,
77
GetUserByIdParamsSchema,
8+
MergeUsersParamsSchema,
89
UpdateEmailParamsSchema,
910
UpdateUserParamsSchema,
1011
UpdateUserSubscriptionsParamsSchema,
@@ -116,4 +117,13 @@ export const userCommands: CommandDefinition[] = [
116117
schema: z.object({}),
117118
execute: (client) => client.getUserFields(),
118119
}),
120+
defineCommand({
121+
category: "users",
122+
name: "merge",
123+
description:
124+
"Merge two user profiles — all data and events from source are migrated to destination",
125+
clientMethod: "mergeUsers",
126+
schema: MergeUsersParamsSchema,
127+
destructive: true,
128+
}),
119129
];

tests/unit/commands.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const EXPECTED_COMMANDS = [
112112
"users:get-by-userid",
113113
"users:get-fields",
114114
"users:get-sent-messages",
115+
"users:merge",
115116
"users:update",
116117
"users:update-email",
117118
"users:update-subscriptions",

0 commit comments

Comments
 (0)