@commercecloudintegrations/epx-cli 0.2.0-win32-arm64 → 0.2.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
@@ -1,3 +1,235 @@
1
- # @commercecloudintegrations/epx-cli@0.2.0-win32-arm64
1
+ # epx
2
2
 
3
- The `epx` binary for win32-arm64. Install [@commercecloudintegrations/epx-cli](https://www.npmjs.com/package/@commercecloudintegrations/epx-cli) instead of this version.
3
+ [![Release](https://img.shields.io/github/v/release/commerce-cloud-integrations/emporix-cli?sort=semver)](https://github.com/commerce-cloud-integrations/emporix-cli/releases/latest)
4
+ [![npm](https://img.shields.io/npm/v/@commercecloudintegrations/epx-cli?logo=npm)](https://www.npmjs.com/package/@commercecloudintegrations/epx-cli)
5
+ [![Quality gate status](https://sonarcloud.io/api/project_badges/measure?project=commerce-cloud-integrations_emporix-cli&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=commerce-cloud-integrations_emporix-cli)
6
+ [![Go](https://img.shields.io/badge/go-1.27.3%2B-00ADD8?logo=go&logoColor=white)](go.mod)
7
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
8
+ [![Documentation](https://img.shields.io/badge/docs-epx-4F46E5)](https://commerce-cloud-integrations.github.io/emporix-cli/)
9
+
10
+ epx is a command-line client for the [Emporix Commerce APIs](https://developer.emporix.io/api-references).
11
+ It helps you read, script, and change the data of an Emporix tenant right from the terminal.
12
+
13
+ **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.
14
+
15
+ **With epx, you can:**
16
+
17
+ - Read products, categories, catalogs, prices, availability, customers, orders, and nearly
18
+ every other Emporix resource as a table, CSV, JSON, YAML, or JSON Lines.
19
+ - Filter, sort, and page through any list without writing paging code.
20
+ - Change data safely: every write shows its exact request with `--dry-run` and asks before
21
+ it sends.
22
+ - Call any Emporix API endpoint with `epx api`, using only the OAuth scopes you name.
23
+ - Script reliably with stable output and exit codes that tell a missing item from a missing
24
+ scope.
25
+
26
+ [![epx demo](site/images/demo.gif)](site/images/demo.webm)
27
+
28
+ > epx is an unofficial project. It isn't affiliated with or endorsed by Emporix.
29
+
30
+ ## Installation
31
+
32
+ epx is a single binary for macOS, Linux, and Windows, on x64 (amd64) and arm64.
33
+
34
+ ### Install script
35
+
36
+ On macOS or Linux:
37
+
38
+ ```sh
39
+ curl -fsSL https://github.com/commerce-cloud-integrations/emporix-cli/releases/latest/download/install.sh | sh
40
+ ```
41
+
42
+ On Windows (PowerShell):
43
+
44
+ ```powershell
45
+ powershell -ExecutionPolicy ByPass -c "irm https://github.com/commerce-cloud-integrations/emporix-cli/releases/latest/download/install.ps1 | iex"
46
+ ```
47
+
48
+ The script downloads the latest release for your platform, checks it against the release's
49
+ checksums and installs `epx` into `~/.local/bin` (on Windows `%LOCALAPPDATA%\Programs\epx\bin`),
50
+ without sudo, adding that directory to your `PATH` if needed. Set `EPX_VERSION` (such as
51
+ `v0.1.2`) to pin a release, `EPX_INSTALL_DIR` to choose the directory, or `EPX_NO_MODIFY_PATH=1`
52
+ to leave your shell profile alone.
53
+
54
+ ### npm
55
+
56
+ With Node.js 18 or later:
57
+
58
+ ```sh
59
+ npm install --global @commercecloudintegrations/epx-cli
60
+ ```
61
+
62
+ npm installs only the binary of your platform. Nothing is compiled and no install script
63
+ runs. To run epx once without installing it:
64
+
65
+ ```sh
66
+ npx @commercecloudintegrations/epx-cli version
67
+ ```
68
+
69
+ ### Release archive
70
+
71
+ Each [release](https://github.com/commerce-cloud-integrations/emporix-cli/releases) holds an
72
+ archive per platform and a checksums file. For example, on Linux x64:
73
+
74
+ ```sh
75
+ version=v0.1.3
76
+ base=https://github.com/commerce-cloud-integrations/emporix-cli/releases/download/$version
77
+ curl -fsSLO "$base/epx_${version}_linux_amd64.tar.gz" &&
78
+ curl -fsSLO "$base/epx_${version}_checksums.txt" &&
79
+ sha256sum --check --ignore-missing "epx_${version}_checksums.txt" &&
80
+ tar -xzf "epx_${version}_linux_amd64.tar.gz" &&
81
+ sudo install "epx_${version}_linux_amd64/epx" /usr/local/bin/epx
82
+ ```
83
+
84
+ On macOS, use `shasum -a 256 --check --ignore-missing` instead of `sha256sum`.
85
+
86
+ ### Go
87
+
88
+ With Go 1.27.3 or later:
89
+
90
+ ```sh
91
+ go install github.com/commerce-cloud-integrations/emporix-cli/cmd/epx@latest
92
+ ```
93
+
94
+ ### From source
95
+
96
+ ```sh
97
+ git clone https://github.com/commerce-cloud-integrations/emporix-cli.git
98
+ cd emporix-cli
99
+ go build -o bin/epx ./cmd/epx
100
+ ```
101
+
102
+ ## Upgrading
103
+
104
+ | Installed with | Upgrade |
105
+ | --- | --- |
106
+ | npm | `npm update --global @commercecloudintegrations/epx-cli` |
107
+ | A release archive | Replace the binary with the one from the new release. |
108
+ | Go | Run `go install` again. |
109
+
110
+ ## Uninstalling
111
+
112
+ 1. If you use profiles, remove each one with `epx profile remove NAME`, which also deletes
113
+ its client secret from the OS keychain.
114
+ 2. Remove epx: `npm uninstall --global @commercecloudintegrations/epx-cli`, or delete the `epx` binary you installed.
115
+ 3. Delete the `epx` folder from your configuration directory: `~/.config` on Linux,
116
+ `~/Library/Application Support` on macOS, `%AppData%` on Windows.
117
+
118
+ ## Getting started
119
+
120
+ epx authenticates with an Emporix API key. Create a key with only the scopes of the
121
+ commands you run, then give it to epx through the environment:
122
+
123
+ ```sh
124
+ export EMPORIX_TENANT=acme1
125
+ export EMPORIX_CLIENT_ID=...
126
+ export EMPORIX_CLIENT_SECRET=...
127
+ ```
128
+
129
+ Or keep it in a profile, whose client secret goes to the OS keychain:
130
+
131
+ ```sh
132
+ epx profile add dev --tenant acme1 --client-id ... --site AcmeStore_NL # asks for the secret
133
+ ```
134
+
135
+ Then make your first reads:
136
+
137
+ ```sh
138
+ epx auth status --scope product.product_read_unpublished # check the key and its scopes
139
+ epx sites list
140
+ epx products list --query published:false --sort code:desc --limit 20
141
+ epx products get 100200 -o json
142
+ epx api get '/catalog/{tenant}/catalogs' # any endpoint
143
+ ```
144
+
145
+ And preview a write before you send it:
146
+
147
+ ```sh
148
+ epx units create --file gram.json --dry-run # print the exact request
149
+ epx units create --file gram.json # send it after you confirm
150
+ ```
151
+
152
+ ## Usage
153
+
154
+ ```sh
155
+ epx [command]
156
+
157
+ # Run `--help` for detailed information about a command, its flags, and its scopes
158
+ epx [command] --help
159
+ ```
160
+
161
+ ## Commands
162
+
163
+ Every command's help names the OAuth scopes it requests. The
164
+ [CLI reference](https://commerce-cloud-integrations.github.io/emporix-cli/commands) documents
165
+ every command and flag.
166
+
167
+ | Area | Commands |
168
+ | --- | --- |
169
+ | 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) |
170
+ | 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) |
171
+ | 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) |
172
+ | 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) |
173
+ | 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) |
174
+ | 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) |
175
+ | 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) |
176
+ | 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) |
177
+ | Any endpoint | [`api get\|post\|put\|patch\|delete`](https://commerce-cloud-integrations.github.io/emporix-cli/commands/api) |
178
+ | 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) |
179
+
180
+ ## Safety
181
+
182
+ - **Reads change nothing**, including those that Emporix serves as POST or PUT, such as
183
+ searches and shipping quotes.
184
+ - **Writes are explicit.** Every write shows its exact request with `--dry-run`, asks before
185
+ it sends (a delete only once you type what it deletes), needs `--yes` in scripts, and is
186
+ never sent again once it may have reached Emporix.
187
+ - **Least privilege.** Every command requests a token with only the scopes it needs, and
188
+ fails with exit code 3 when your API key lacks one, instead of silently returning less
189
+ data. Reads that need a write-capable scope run only with `--allow-write-scope`.
190
+ - **Credentials stay private.** epx reads its API key from the environment or a profile,
191
+ never from flags, and never prints its token or client secret.
192
+ - **One host, HTTPS only.** Requests go only to the configured API host, over HTTPS (plain HTTP
193
+ only to a loopback address, such as a local test server), and redirects are never followed.
194
+
195
+ `-o json` and `-o yaml` print responses as Emporix sends them, secrets included. See the
196
+ [security model](https://commerce-cloud-integrations.github.io/emporix-cli/security).
197
+
198
+ ## Exit codes
199
+
200
+ | Code | Meaning |
201
+ | --- | --- |
202
+ | `0` | Success |
203
+ | `1` | Error |
204
+ | `2` | Invalid usage or configuration; nothing was sent |
205
+ | `3` | Authentication failed or scopes missing |
206
+ | `4` | Not found |
207
+ | `5` | Conflict: the item changed since you read it, already exists, or can't take the change in its current state; the error says what to do next |
208
+
209
+ ## Documentation
210
+
211
+ The [epx documentation](https://commerce-cloud-integrations.github.io/emporix-cli/) covers
212
+ installation, authentication, output formats, lists, writes, scripting, and the
213
+ [Emporix API coverage](https://commerce-cloud-integrations.github.io/emporix-cli/coverage) of
214
+ every command. [COMPATIBILITY.md](COMPATIBILITY.md) lists the Emporix API operations epx
215
+ sends, per reference version.
216
+
217
+ ## Development
218
+
219
+ epx is written in Go with [Cobra](https://github.com/spf13/cobra).
220
+
221
+ ```sh
222
+ go build -o bin/epx ./cmd/epx
223
+ go test ./... # API calls go to local fake servers; no credentials needed
224
+ ```
225
+
226
+ Besides Cobra, epx depends on [go-keyring](https://github.com/zalando/go-keyring) for the
227
+ client secrets of profiles in the OS keychain (no cgo), and on
228
+ [x/term](https://pkg.go.dev/golang.org/x/term) and [x/sys](https://pkg.go.dev/golang.org/x/sys)
229
+ to read a secret without showing it and to lock the configuration file on Windows.
230
+
231
+ ## License
232
+
233
+ Licensed under the [Apache License 2.0](LICENSE).
234
+
235
+ 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.2.0",
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.2.0-win32-arm64",
10
- "description": "The epx binary of @commercecloudintegrations/epx-cli for win32 arm64",
11
- "os": [
12
- "win32"
13
- ],
14
- "cpu": [
15
- "arm64"
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.2.0-darwin-x64",
27
+ "epx-cli-darwin-arm64": "npm:@commercecloudintegrations/epx-cli@0.2.0-darwin-arm64",
28
+ "epx-cli-linux-x64": "npm:@commercecloudintegrations/epx-cli@0.2.0-linux-x64",
29
+ "epx-cli-linux-arm64": "npm:@commercecloudintegrations/epx-cli@0.2.0-linux-arm64",
30
+ "epx-cli-win32-x64": "npm:@commercecloudintegrations/epx-cli@0.2.0-win32-x64",
31
+ "epx-cli-win32-arm64": "npm:@commercecloudintegrations/epx-cli@0.2.0-win32-arm64"
32
+ }
21
33
  }
package/bin/epx.exe DELETED
Binary file