Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions COMMANDS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Available Commands (110)
# Available Commands (111)

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

Expand Down Expand Up @@ -197,7 +197,7 @@ iterable campaigns trigger --campaignId <campaignId> --listIds <listIds...>
| `--suppressionListIds` | number[] | no | Lists to suppress |


## catalogs (12)
## catalogs (13)

### bulk-delete-items

Expand Down Expand Up @@ -317,6 +317,19 @@ iterable catalogs partial-update-item --catalogName <catalogName> --itemId <item
| `--itemId` | string | **yes** | ID of the catalog item |
| `--update` | json | **yes** | Fields to update |

### partial-update-items

Bulk partial update catalog items (merge fields per item ID)

```
iterable catalogs partial-update-items <catalogName> --documents <json>
```

| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `catalogName` | string | **yes** | Name of the catalog |
| `--documents` | json | **yes** | Map of catalog item ID to field values |

### replace-item

Replace (PUT) a catalog item - replaces the entire item with new value
Expand All @@ -331,31 +344,31 @@ iterable catalogs replace-item --catalogName <catalogName> --itemId <itemId> --v
| `--itemId` | string | **yes** | ID of the catalog item |
| `--value` | json | **yes** | New value for the item |

### update-field-mappings
### replace-items

Update catalog field mappings (data types)
Bulk replace catalog items (each item becomes only provided fields)

```
iterable catalogs update-field-mappings <catalogName> --mappingsUpdates <mappingsUpdates...>
iterable catalogs replace-items <catalogName> --documents <json>
```

| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `catalogName` | string | **yes** | Name of the catalog |
| `--mappingsUpdates` | string[] | **yes** | Field mappings to update |
| `--documents` | json | **yes** | Map of catalog item ID to field values |

### update-items
### update-field-mappings

Update catalog items
Update catalog field mappings (data types)

```
iterable catalogs update-items <catalogName> --items <items...>
iterable catalogs update-field-mappings <catalogName> --mappingsUpdates <mappingsUpdates...>
```

| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `catalogName` | string | **yes** | Name of the catalog |
| `--items` | json[] | **yes** | Catalog items to update |
| `--mappingsUpdates` | string[] | **yes** | Field mappings to update |


## events (4)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"minimumReleaseAge": 4320,
"minimumReleaseAgeExclude": [
"@iterable/*"
]
],
"overrides": {}
},
"scripts": {
"build": "pnpm format && pnpm lint:fix && tsc --project tsconfig.build.json && pnpm update-commands && chmod +x dist/index.js",
Expand All @@ -59,7 +60,7 @@
"update-commands": "node scripts/update-commands.js"
},
"dependencies": {
"@iterable/api": "0.11.1",
"@iterable/api": "0.12.0",
"@primno/dpapi": "2.0.1",
"boxen": "8.0.1",
"chalk": "5.6.2",
Expand Down
48 changes: 24 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions src/commands/catalogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {
GetCatalogItemsParamsSchema,
GetCatalogsParamsSchema,
PartialUpdateCatalogItemParamsSchema,
PartialUpdateCatalogItemsParamsSchema,
ReplaceCatalogItemParamsSchema,
ReplaceCatalogItemsParamsSchema,
UpdateCatalogFieldMappingsParamsSchema,
UpdateCatalogItemParamsSchema,
} from "@iterable/api";

import type { CommandDefinition } from "./types.js";
Expand Down Expand Up @@ -70,10 +71,18 @@ export const catalogCommands: CommandDefinition[] = [
}),
defineCommand({
category: "catalogs",
name: "update-items",
description: "Update catalog items",
clientMethod: "updateCatalogItems",
schema: UpdateCatalogItemParamsSchema,
name: "partial-update-items",
description: "Bulk partial update catalog items (merge fields per item ID)",
clientMethod: "partialUpdateCatalogItems",
schema: PartialUpdateCatalogItemsParamsSchema,
}),
defineCommand({
category: "catalogs",
name: "replace-items",
description:
"Bulk replace catalog items (each item becomes only provided fields)",
clientMethod: "replaceCatalogItems",
schema: ReplaceCatalogItemsParamsSchema,
}),
defineCommand({
category: "catalogs",
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ const EXPECTED_COMMANDS = [
"catalogs:get-items",
"catalogs:list",
"catalogs:partial-update-item",
"catalogs:partial-update-items",
"catalogs:replace-item",
"catalogs:replace-items",
"catalogs:update-field-mappings",
"catalogs:update-items",
"events:get-by-email",
"events:get-by-userid",
"events:track",
Expand Down