@wenrwa/marketplace-cli 0.6.2 → 0.6.3
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/dist/__tests__/apps.test.js +22 -0
- package/dist/commands/apps.js +1 -1
- package/package.json +1 -1
|
@@ -158,3 +158,25 @@ describe('apps export-github', () => {
|
|
|
158
158
|
spy.mockRestore();
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
|
+
describe('apps download', () => {
|
|
162
|
+
it('authenticates with the API key header, never the retired wallet header', async () => {
|
|
163
|
+
mockClient.getApiUrl = jest.fn(() => 'https://api.example/api/v1');
|
|
164
|
+
mockClient.getApiKey = jest.fn(() => 'wm_sk_testkey');
|
|
165
|
+
const fetchSpy = jest.spyOn(global, 'fetch').mockResolvedValue({
|
|
166
|
+
ok: true,
|
|
167
|
+
arrayBuffer: async () => new ArrayBuffer(3),
|
|
168
|
+
});
|
|
169
|
+
const fs = require('fs');
|
|
170
|
+
const writeSpy = jest.spyOn(fs, 'writeFileSync').mockImplementation(() => undefined);
|
|
171
|
+
const logSpy = jest.spyOn(console, 'log').mockImplementation();
|
|
172
|
+
await runCommand('download', 'proj-1', '-o', '/tmp/out.zip');
|
|
173
|
+
const [url, init] = fetchSpy.mock.calls[0];
|
|
174
|
+
expect(url).toBe('https://api.example/api/v1/projects/proj-1/source');
|
|
175
|
+
const headers = init.headers;
|
|
176
|
+
expect(headers['X-API-Key']).toBe('wm_sk_testkey');
|
|
177
|
+
expect(Object.keys(headers).map((h) => h.toLowerCase())).not.toContain('x-wallet-pubkey');
|
|
178
|
+
fetchSpy.mockRestore();
|
|
179
|
+
writeSpy.mockRestore();
|
|
180
|
+
logSpy.mockRestore();
|
|
181
|
+
});
|
|
182
|
+
});
|
package/dist/commands/apps.js
CHANGED
|
@@ -135,7 +135,7 @@ exports.appsCommand
|
|
|
135
135
|
const client = (0, client_1.getClient)();
|
|
136
136
|
const url = `${client.getApiUrl()}/projects/${id}/source`;
|
|
137
137
|
const res = await fetch(url, {
|
|
138
|
-
headers: { 'X-
|
|
138
|
+
headers: { 'X-API-Key': client.getApiKey() },
|
|
139
139
|
});
|
|
140
140
|
if (!res.ok) {
|
|
141
141
|
const data = await res.json().catch(() => ({}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenrwa/marketplace-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "CLI tool for the Wenrwa Agent Marketplace — monitor bounties, agents, workspaces, and treasury from your terminal",
|
|
5
5
|
"author": "Wenrwa <dev@wenrwa.com>",
|
|
6
6
|
"license": "MIT",
|