@commercecloudintegrations/epx-cli 0.1.4-win32-x64 → 0.1.4

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
@@ -1,3 +1,232 @@
1
- # @commercecloudintegrations/epx-cli@0.1.4-win32-x64
1
+ # epx
2
2
 
3
- The `epx` binary for win32-x64. Install [@commercecloudintegrations/epx-cli](https://www.npmjs.com/package/@commercecloudintegrations/epx-cli) instead of this version.
3
+ [![Go](https://img.shields.io/badge/go-1.27.3%2B-00ADD8?logo=go&logoColor=white)](go.mod)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
5
+ [![Documentation](https://img.shields.io/badge/docs-epx-4F46E5)](https://commerce-cloud-integrations.github.io/emporix-cli/)
6
+
7
+ epx is a command-line client for the [Emporix Commerce APIs](https://developer.emporix.io/api-references).
8
+ It helps you read, script, and change the data of an Emporix tenant right from the terminal.
9
+
10
+ **Documentation:** [commerce-cloud-integrations.github.io/emporix-cli](https://commerce-cloud-integrations.github.io/emporix-cli/) covers installation, authentication, every command, and the Emporix API coverage.
11
+
12
+ **With epx, you can:**
13
+
14
+ - Read products, categories, catalogs, prices, availability, customers, orders, and nearly
15
+ every other Emporix resource as a table, CSV, JSON, YAML, or JSON Lines.
16
+ - Filter, sort, and page through any list without writing paging code.
17
+ - Change data safely: every write shows its exact request with `--dry-run` and asks before
18
+ it sends.
19
+ - Call any Emporix API endpoint with `epx api`, using only the OAuth scopes you name.
20
+ - Script reliably with stable output and exit codes that tell a missing item from a missing
21
+ scope.
22
+
23
+ [![epx demo](site/images/demo.gif)](site/images/demo.webm)
24
+
25
+ > epx is an unofficial project. It isn't affiliated with or endorsed by Emporix.
26
+
27
+ ## Installation
28
+
29
+ epx is a single binary for macOS, Linux, and Windows, on x64 (amd64) and arm64.
30
+
31
+ ### Install script
32
+
33
+ On macOS or Linux:
34
+
35
+ ```sh
36
+ curl -fsSL https://github.com/commerce-cloud-integrations/emporix-cli/releases/latest/download/install.sh | sh
37
+ ```
38
+
39
+ On Windows (PowerShell):
40
+
41
+ ```powershell
42
+ powershell -ExecutionPolicy ByPass -c "irm https://github.com/commerce-cloud-integrations/emporix-cli/releases/latest/download/install.ps1 | iex"
43
+ ```
44
+
45
+ The script downloads the latest release for your platform, checks it against the release's
46
+ checksums and installs `epx` into `~/.local/bin` (on Windows `%LOCALAPPDATA%\Programs\epx\bin`),
47
+ without sudo, adding that directory to your `PATH` if needed. Set `EPX_VERSION` (such as
48
+ `v0.1.2`) to pin a release, `EPX_INSTALL_DIR` to choose the directory, or `EPX_NO_MODIFY_PATH=1`
49
+ to leave your shell profile alone.
50
+
51
+ ### npm
52
+
53
+ With Node.js 18 or later:
54
+
55
+ ```sh
56
+ npm install --global @commercecloudintegrations/epx-cli
57
+ ```
58
+
59
+ npm installs only the binary of your platform. Nothing is compiled and no install script
60
+ runs. To run epx once without installing it:
61
+
62
+ ```sh
63
+ npx @commercecloudintegrations/epx-cli version
64
+ ```
65
+
66
+ ### Release archive
67
+
68
+ Each [release](https://github.com/commerce-cloud-integrations/emporix-cli/releases) holds an
69
+ archive per platform and a checksums file. For example, on Linux x64:
70
+
71
+ ```sh
72
+ version=v0.1.3
73
+ base=https://github.com/commerce-cloud-integrations/emporix-cli/releases/download/$version
74
+ curl -fsSLO "$base/epx_${version}_linux_amd64.tar.gz" &&
75
+ curl -fsSLO "$base/epx_${version}_checksums.txt" &&
76
+ sha256sum --check --ignore-missing "epx_${version}_checksums.txt" &&
77
+ tar -xzf "epx_${version}_linux_amd64.tar.gz" &&
78
+ sudo install "epx_${version}_linux_amd64/epx" /usr/local/bin/epx
79
+ ```
80
+
81
+ On macOS, use `shasum -a 256 --check --ignore-missing` instead of `sha256sum`.
82
+
83
+ ### Go
84
+
85
+ With Go 1.27.3 or later:
86
+
87
+ ```sh
88
+ go install github.com/commerce-cloud-integrations/emporix-cli/cmd/epx@latest
89
+ ```
90
+
91
+ ### From source
92
+
93
+ ```sh
94
+ git clone https://github.com/commerce-cloud-integrations/emporix-cli.git
95
+ cd emporix-cli
96
+ go build -o bin/epx ./cmd/epx
97
+ ```
98
+
99
+ ## Upgrading
100
+
101
+ | Installed with | Upgrade |
102
+ | --- | --- |
103
+ | npm | `npm update --global @commercecloudintegrations/epx-cli` |
104
+ | A release archive | Replace the binary with the one from the new release. |
105
+ | Go | Run `go install` again. |
106
+
107
+ ## Uninstalling
108
+
109
+ 1. If you use profiles, remove each one with `epx profile remove NAME`, which also deletes
110
+ its client secret from the OS keychain.
111
+ 2. Remove epx: `npm uninstall --global @commercecloudintegrations/epx-cli`, or delete the `epx` binary you installed.
112
+ 3. Delete the `epx` folder from your configuration directory: `~/.config` on Linux,
113
+ `~/Library/Application Support` on macOS, `%AppData%` on Windows.
114
+
115
+ ## Getting started
116
+
117
+ epx authenticates with an Emporix API key. Create a key with only the scopes of the
118
+ commands you run, then give it to epx through the environment:
119
+
120
+ ```sh
121
+ export EMPORIX_TENANT=acme1
122
+ export EMPORIX_CLIENT_ID=...
123
+ export EMPORIX_CLIENT_SECRET=...
124
+ ```
125
+
126
+ Or keep it in a profile, whose client secret goes to the OS keychain:
127
+
128
+ ```sh
129
+ epx profile add dev --tenant acme1 --client-id ... --site AcmeStore_NL # asks for the secret
130
+ ```
131
+
132
+ Then make your first reads:
133
+
134
+ ```sh
135
+ epx auth status --scope product.product_read_unpublished # check the key and its scopes
136
+ epx sites list
137
+ epx products list --query published:false --sort code:desc --limit 20
138
+ epx products get 100200 -o json
139
+ epx api get '/catalog/{tenant}/catalogs' # any endpoint
140
+ ```
141
+
142
+ And preview a write before you send it:
143
+
144
+ ```sh
145
+ epx units create --file gram.json --dry-run # print the exact request
146
+ epx units create --file gram.json # send it after you confirm
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ ```sh
152
+ epx [command]
153
+
154
+ # Run `--help` for detailed information about a command, its flags, and its scopes
155
+ epx [command] --help
156
+ ```
157
+
158
+ ## Commands
159
+
160
+ Every command's help names the OAuth scopes it requests. The
161
+ [CLI reference](https://commerce-cloud-integrations.github.io/emporix-cli/commands) documents
162
+ every command and flag.
163
+
164
+ | Area | Commands |
165
+ | --- | --- |
166
+ | Products and catalog | [`products`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/products), [`categories`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/categories), [`category-trees`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/category-trees), [`catalogs`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/catalogs), [`brands`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/brands), [`labels`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/labels), [`media`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/media), [`product-templates`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/product-templates), [`units`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/units) |
167
+ | Prices and promotions | [`prices`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/prices), [`price-lists`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/price-lists), [`price-models`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/price-models), [`fees`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/fees), [`taxes`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/taxes), [`currencies`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/currencies), [`exchange-rates`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/exchange-rates), [`coupons`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/coupons), [`reward-points`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/reward-points) |
168
+ | Stock and shipping | [`availability`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/availability), [`shipping`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/shipping), [`delivery-times`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/delivery-times) |
169
+ | Customers and B2B | [`customers`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/customers), [`segments`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/segments), [`legal-entities`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/legal-entities), [`customer-locations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/customer-locations), [`contact-assignments`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/contact-assignments), [`shopping-lists`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/shopping-lists) |
170
+ | Orders and checkout | [`carts`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/carts), [`quotes`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/quotes), [`orders`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/orders), [`returns`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/returns), [`invoice-jobs`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/invoice-jobs), [`payment-modes`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/payment-modes), [`payment-transactions`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/payment-transactions) |
171
+ | Vendors | [`vendors`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendors), [`vendor-locations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/vendor-locations) |
172
+ | Tenant setup | [`sites`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/sites), [`countries`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/countries), [`regions`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/regions), [`configurations`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/configurations), [`iam`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/iam), [`webhooks`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/webhooks), [`schemas`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/schemas), [`custom-entities`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/custom-entities), [`sequential-ids`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/sequential-ids), [`session-contexts`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/session-contexts), [`imports`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/imports), [`changelog`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/changelog) |
173
+ | Search and AI | [`search`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/search), [`indexing`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/indexing), [`ai`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/ai) |
174
+ | Any endpoint | [`api get\|post\|put\|patch\|delete`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/api) |
175
+ | epx itself | [`auth`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/auth), [`profile`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/profile), [`completion`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/completion), [`version`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/version) |
176
+
177
+ ## Safety
178
+
179
+ - **Reads change nothing**, including those that Emporix serves as POST or PUT, such as
180
+ searches and shipping quotes.
181
+ - **Writes are explicit.** Every write shows its exact request with `--dry-run`, asks before
182
+ it sends (a delete only once you type what it deletes), needs `--yes` in scripts, and is
183
+ never sent again once it may have reached Emporix.
184
+ - **Least privilege.** Every command requests a token with only the scopes it needs, and
185
+ fails with exit code 3 when your API key lacks one, instead of silently returning less
186
+ data. Reads that need a write-capable scope run only with `--allow-write-scope`.
187
+ - **Credentials stay private.** epx reads its API key from the environment or a profile,
188
+ never from flags, and never prints its token or client secret.
189
+ - **One host, HTTPS only.** Requests go only to the configured API host, over HTTPS (plain HTTP
190
+ only to a loopback address, such as a local test server), and redirects are never followed.
191
+
192
+ `-o json` and `-o yaml` print responses as Emporix sends them, secrets included. See the
193
+ [security model](https://commerce-cloud-integrations.github.io/emporix-cli/security).
194
+
195
+ ## Exit codes
196
+
197
+ | Code | Meaning |
198
+ | --- | --- |
199
+ | `0` | Success |
200
+ | `1` | Error |
201
+ | `2` | Invalid usage or configuration; nothing was sent |
202
+ | `3` | Authentication failed or scopes missing |
203
+ | `4` | Not found |
204
+ | `5` | Conflict: the item changed since you read it, or already exists |
205
+
206
+ ## Documentation
207
+
208
+ The [epx documentation](https://commerce-cloud-integrations.github.io/emporix-cli/) covers
209
+ installation, authentication, output formats, lists, writes, scripting, and the
210
+ [Emporix API coverage](https://commerce-cloud-integrations.github.io/emporix-cli/coverage) of
211
+ every command. [COMPATIBILITY.md](COMPATIBILITY.md) lists the Emporix API operations epx
212
+ sends, per reference version.
213
+
214
+ ## Development
215
+
216
+ epx is written in Go with [Cobra](https://github.com/spf13/cobra).
217
+
218
+ ```sh
219
+ go build -o bin/epx ./cmd/epx
220
+ go test ./... # API calls go to local fake servers; no credentials needed
221
+ ```
222
+
223
+ Besides Cobra, epx depends on [go-keyring](https://github.com/zalando/go-keyring) for the
224
+ client secrets of profiles in the OS keychain (no cgo), and on
225
+ [x/term](https://pkg.go.dev/golang.org/x/term) and [x/sys](https://pkg.go.dev/golang.org/x/sys)
226
+ to read a secret without showing it and to lock the configuration file on Windows.
227
+
228
+ ## License
229
+
230
+ Licensed under the [Apache License 2.0](LICENSE).
231
+
232
+ epx is maintained by [Commerce Cloud Integrations](https://www.commercecloudintegrations.com).
package/bin/epx.js ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ // Runs the epx binary of this platform, which npm installed from the matching
3
+ // optional dependency: epx-cli-<platform>-<arch>, an alias of the version
4
+ // <version>-<platform>-<arch> of this package, which holds the binary.
5
+ "use strict";
6
+
7
+ const { spawn } = require("node:child_process");
8
+ const { constants } = require("node:os");
9
+ const path = require("node:path");
10
+ const { name, optionalDependencies } = require("../package.json");
11
+
12
+ const windows = process.platform === "win32";
13
+ const prefix = "epx-cli-";
14
+ const pkg = `${prefix}${process.platform}-${process.arch}`;
15
+ const reinstall =
16
+ `Reinstall ${name} without --omit=optional or --no-optional; in a project whose ` +
17
+ "package-lock.json was made on another platform, delete node_modules and " +
18
+ "package-lock.json, then install again.";
19
+
20
+ // fail prints the message and ends the launcher; it never returns.
21
+ function fail(message) {
22
+ console.error(`epx: ${message}`);
23
+ process.exit(1);
24
+ }
25
+
26
+ // locate returns the path of the binary in the platform package that npm installed with
27
+ // this launcher, at its version: Node's lookup could otherwise reach an older one
28
+ // installed elsewhere.
29
+ function locate() {
30
+ const spec = optionalDependencies[pkg];
31
+ if (spec === undefined) {
32
+ const platforms = Object.keys(optionalDependencies).map((name) => name.slice(prefix.length));
33
+ fail(
34
+ platforms.length === 0
35
+ ? `this is the source of ${name}, not a packed release: no platform package is listed yet.`
36
+ : `no binary exists for ${process.platform}-${process.arch}; ${name} ships ${platforms.join(", ")}.`,
37
+ );
38
+ }
39
+ let manifest;
40
+ try {
41
+ manifest = require.resolve(`${pkg}/package.json`);
42
+ } catch {
43
+ fail(`the package ${pkg}, which holds the binary, is not installed. ${reinstall}`);
44
+ }
45
+ const alias = `npm:${name}@`;
46
+ const wanted = spec.startsWith(alias) ? spec.slice(alias.length) : spec;
47
+ const dir = path.dirname(manifest);
48
+ const found = require(manifest).version;
49
+ if (found !== wanted) {
50
+ fail(`${name} needs ${pkg} ${wanted}, but found ${found} in ${dir}. ${reinstall}`);
51
+ }
52
+ return path.join(dir, "bin", windows ? "epx.exe" : "epx");
53
+ }
54
+
55
+ const binary = locate();
56
+ const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
57
+
58
+ // A signal sent to this launcher reaches epx too. On Windows the console delivers
59
+ // Ctrl+C to epx itself, and kill() would end epx at once instead; the empty handler
60
+ // still keeps this launcher alive until epx exits, so its exit status is kept.
61
+ const forward = windows ? () => {} : (signal) => child.kill(signal);
62
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
63
+ process.on(signal, forward);
64
+ }
65
+
66
+ child.on("error", (err) => fail(`cannot run ${binary}: ${err.message}`));
67
+ child.on("exit", (code, signal) => {
68
+ if (signal) {
69
+ // End the same way epx ended; Node ignores some signals (SIGPIPE), so the shell's
70
+ // 128 + signal number is the fallback.
71
+ process.removeAllListeners(signal);
72
+ process.kill(process.pid, signal);
73
+ setImmediate(() => process.exit(128 + constants.signals[signal]));
74
+ return;
75
+ }
76
+ // Node always sets the code when no signal ended epx; a missing one is a failure.
77
+ process.exit(code ?? 1);
78
+ });
package/package.json CHANGED
@@ -1,21 +1,33 @@
1
1
  {
2
+ "name": "@commercecloudintegrations/epx-cli",
3
+ "version": "0.1.4",
4
+ "description": "epx, a command-line client for the Emporix Commerce APIs",
5
+ "keywords": [
6
+ "emporix",
7
+ "commerce",
8
+ "cli"
9
+ ],
2
10
  "homepage": "https://commerce-cloud-integrations.github.io/emporix-cli/",
3
11
  "repository": {
4
12
  "type": "git",
5
13
  "url": "git+https://github.com/commerce-cloud-integrations/emporix-cli.git"
6
14
  },
7
15
  "license": "Apache-2.0",
8
- "name": "@commercecloudintegrations/epx-cli",
9
- "version": "0.1.4-win32-x64",
10
- "description": "The epx binary of @commercecloudintegrations/epx-cli for win32 x64",
11
- "os": [
12
- "win32"
13
- ],
14
- "cpu": [
15
- "x64"
16
- ],
16
+ "bin": {
17
+ "epx": "bin/epx.js"
18
+ },
17
19
  "files": [
18
- "bin/epx.exe"
20
+ "bin/epx.js"
19
21
  ],
20
- "preferUnplugged": true
22
+ "engines": {
23
+ "node": ">=18"
24
+ },
25
+ "optionalDependencies": {
26
+ "epx-cli-darwin-x64": "npm:@commercecloudintegrations/epx-cli@0.1.4-darwin-x64",
27
+ "epx-cli-darwin-arm64": "npm:@commercecloudintegrations/epx-cli@0.1.4-darwin-arm64",
28
+ "epx-cli-linux-x64": "npm:@commercecloudintegrations/epx-cli@0.1.4-linux-x64",
29
+ "epx-cli-linux-arm64": "npm:@commercecloudintegrations/epx-cli@0.1.4-linux-arm64",
30
+ "epx-cli-win32-x64": "npm:@commercecloudintegrations/epx-cli@0.1.4-win32-x64",
31
+ "epx-cli-win32-arm64": "npm:@commercecloudintegrations/epx-cli@0.1.4-win32-arm64"
32
+ }
21
33
  }
package/bin/epx.exe DELETED
Binary file