@auto-engineer/generate-react-client 1.90.0 → 1.95.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/CHANGELOG.md CHANGED
@@ -1,5 +1,142 @@
1
1
  # @auto-engineer/generate-react-client
2
2
 
3
+ ## 1.95.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d641d0e`](https://github.com/BeOnAuto/auto-engineer/commit/d641d0e6ded1c6e136a2d33e380c204b730abeb1) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: add null-document guidance to projection template
8
+ - **server-generator-apollo-emmett**: add discriminated union guidance to evolve template
9
+ - **server-generator-apollo-emmett**: fill missing inline object fields with type defaults
10
+ - **server-implementer**: add discriminated union narrowing guidance to prompts
11
+ - **server-implementer**: load full shared directory into implementer context
12
+
13
+ ### Patch Changes
14
+
15
+ - [`d49324c`](https://github.com/BeOnAuto/auto-engineer/commit/d49324cec0f25f601f8beec216898da05cce22f9) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **component-implementor-react**: add missing publishConfig for public npm access
16
+
17
+ - Updated dependencies [[`d641d0e`](https://github.com/BeOnAuto/auto-engineer/commit/d641d0e6ded1c6e136a2d33e380c204b730abeb1), [`d49324c`](https://github.com/BeOnAuto/auto-engineer/commit/d49324cec0f25f601f8beec216898da05cce22f9)]:
18
+ - @auto-engineer/file-upload@1.95.0
19
+ - @auto-engineer/message-bus@1.95.0
20
+
21
+ ## 1.94.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [`5c22022`](https://github.com/BeOnAuto/auto-engineer/commit/5c220229c406fe300930f21530bea288cfe709ee) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: add null-document guidance to projection template
26
+ - **server-generator-apollo-emmett**: add discriminated union guidance to evolve template
27
+ - **server-generator-apollo-emmett**: fill missing inline object fields with type defaults
28
+ - **server-implementer**: add discriminated union narrowing guidance to prompts
29
+ - **server-implementer**: load full shared directory into implementer context
30
+
31
+ ### Patch Changes
32
+
33
+ - [`e016efa`](https://github.com/BeOnAuto/auto-engineer/commit/e016efa10d937a630e7be631f1c11722e8aed024) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **global**: extract inline object helpers to narrative, migrate all consumers
34
+
35
+ - Updated dependencies [[`5c22022`](https://github.com/BeOnAuto/auto-engineer/commit/5c220229c406fe300930f21530bea288cfe709ee), [`e016efa`](https://github.com/BeOnAuto/auto-engineer/commit/e016efa10d937a630e7be631f1c11722e8aed024)]:
36
+ - @auto-engineer/file-upload@1.94.0
37
+ - @auto-engineer/message-bus@1.94.0
38
+
39
+ ## 1.93.0
40
+
41
+ ### Minor Changes
42
+
43
+ - [`b39bfd1`](https://github.com/BeOnAuto/auto-engineer/commit/b39bfd1b15a6ba83bf70c1045f0f99ca01af9e6d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: fill missing inline object fields with type defaults
44
+ - **server-implementer**: add discriminated union narrowing guidance to prompts
45
+ - **global**: mark all bursts done in ketchup plans
46
+
47
+ - [`0d1d200`](https://github.com/BeOnAuto/auto-engineer/commit/0d1d200744a6cbf8d1383ca3189ff3c3056d1baf) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: add null-document guidance to projection template
48
+
49
+ - [`21a0840`](https://github.com/BeOnAuto/auto-engineer/commit/21a084062e0132a146c31b5ed395051f8423dbed) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: filter event And-steps from react Then items
50
+ - **global**: update ketchup plans for Date bug + implementer context fixes
51
+ - **server-generator-apollo-emmett**: mark burst 18 done in ketchup plan
52
+ - **narrative**: mark all bursts done in ketchup plan
53
+
54
+ - [`c8b5ced`](https://github.com/BeOnAuto/auto-engineer/commit/c8b5ced06aec8f03fd81270da37b70ed0c5ee1a4) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-implementer**: load full shared directory into implementer context
55
+
56
+ - [`5779ee2`](https://github.com/BeOnAuto/auto-engineer/commit/5779ee2adec80576a3885e11268310cfaf487be3) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **root**: add .auto-configure.json to .gitignore
57
+ - **generate-react-client**: send X-Org-Id header in components upload
58
+ - **cli**: persist /configure data to .auto-configure.json
59
+ - **cli**: /configure defaults COMPONENTS_UPLOAD_URL for local dev
60
+ - **cli**: /configure sets ORG_ID and PROJECT_ID env vars
61
+
62
+ - [`ef365c4`](https://github.com/BeOnAuto/auto-engineer/commit/ef365c4f58a41736871db4c70b817375984a638e) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-implementer**: add discriminated union narrowing guidance to prompts
63
+
64
+ - [`7abc038`](https://github.com/BeOnAuto/auto-engineer/commit/7abc038ca3ddd6b71e94523b26be23ed62acc06b) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: add discriminated union guidance to evolve template
65
+
66
+ - [`8c21b52`](https://github.com/BeOnAuto/auto-engineer/commit/8c21b529e4f0a83f00bdaa0fe10562b12a19d349) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: fix formatTsValue for inline object types and Array<T>
67
+
68
+ ### Patch Changes
69
+
70
+ - [`36446e8`](https://github.com/BeOnAuto/auto-engineer/commit/36446e80626f019fef6409d3c8b2b0c0eee74b32) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: mark bursts 20-22 done in ketchup plan
71
+
72
+ - [`a306579`](https://github.com/BeOnAuto/auto-engineer/commit/a3065799dd4f2c60cacf895d4af93af456d93447) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **global**: mark all bursts done in ketchup plans
73
+
74
+ - Updated dependencies [[`b39bfd1`](https://github.com/BeOnAuto/auto-engineer/commit/b39bfd1b15a6ba83bf70c1045f0f99ca01af9e6d), [`0d1d200`](https://github.com/BeOnAuto/auto-engineer/commit/0d1d200744a6cbf8d1383ca3189ff3c3056d1baf), [`21a0840`](https://github.com/BeOnAuto/auto-engineer/commit/21a084062e0132a146c31b5ed395051f8423dbed), [`c8b5ced`](https://github.com/BeOnAuto/auto-engineer/commit/c8b5ced06aec8f03fd81270da37b70ed0c5ee1a4), [`36446e8`](https://github.com/BeOnAuto/auto-engineer/commit/36446e80626f019fef6409d3c8b2b0c0eee74b32), [`a306579`](https://github.com/BeOnAuto/auto-engineer/commit/a3065799dd4f2c60cacf895d4af93af456d93447), [`5779ee2`](https://github.com/BeOnAuto/auto-engineer/commit/5779ee2adec80576a3885e11268310cfaf487be3), [`ef365c4`](https://github.com/BeOnAuto/auto-engineer/commit/ef365c4f58a41736871db4c70b817375984a638e), [`7abc038`](https://github.com/BeOnAuto/auto-engineer/commit/7abc038ca3ddd6b71e94523b26be23ed62acc06b), [`8c21b52`](https://github.com/BeOnAuto/auto-engineer/commit/8c21b529e4f0a83f00bdaa0fe10562b12a19d349)]:
75
+ - @auto-engineer/file-upload@1.93.0
76
+ - @auto-engineer/message-bus@1.93.0
77
+
78
+ ## 1.92.0
79
+
80
+ ### Minor Changes
81
+
82
+ - [`b984faa`](https://github.com/BeOnAuto/auto-engineer/commit/b984faa03a182560b49182129bfd183768c27890) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **generate-react-client**: send X-Org-Id header in components upload
83
+
84
+ - [`b4b422c`](https://github.com/BeOnAuto/auto-engineer/commit/b4b422c00c0e2a59bf7d9bc35c5d9f29e86bea0d) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **cli**: persist /configure data to .auto-configure.json
85
+
86
+ - [`5475f60`](https://github.com/BeOnAuto/auto-engineer/commit/5475f6079c6591e8b5fa8dd22825a9d933d0aeb8) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - Added .auto-configure.json to .gitignore to prevent local configuration from being committed to version control
87
+
88
+ - [`5c5b8bc`](https://github.com/BeOnAuto/auto-engineer/commit/5c5b8bc401fdc3234ae4fdca1fdf13770eeb0935) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **component-implementor-react**: add index.ts with COMMANDS export
89
+ - **component-implementor-react**: add implement-component command handler
90
+ - **component-implementor-react**: add generate-story module
91
+ - **component-implementor-react**: add generate-component module
92
+ - **component-implementor-react**: add generate-test module
93
+
94
+ - [`17713c7`](https://github.com/BeOnAuto/auto-engineer/commit/17713c757e3f340b68709152563a3e8ac69c32a2) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **generate-react-client**: remove uploadFile from starter build-component-db
95
+
96
+ - [`bc5e46b`](https://github.com/BeOnAuto/auto-engineer/commit/bc5e46b5c5b65f488e18a87fa252ab35b20ce79b) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **cli**: /configure sets ORG_ID and PROJECT_ID env vars
97
+
98
+ - [`903f609`](https://github.com/BeOnAuto/auto-engineer/commit/903f6099b898803b6cbf42ce0c9aa59f2675da2c) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **generate-react-client**: replace signer upload with direct POST to components endpoint
99
+
100
+ - [`bd8c82c`](https://github.com/BeOnAuto/auto-engineer/commit/bd8c82cb031101598d0a85d45d0c43c2deca579e) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **cli**: /configure defaults COMPONENTS_UPLOAD_URL for local dev
101
+
102
+ ### Patch Changes
103
+
104
+ - Updated dependencies [[`b984faa`](https://github.com/BeOnAuto/auto-engineer/commit/b984faa03a182560b49182129bfd183768c27890), [`b4b422c`](https://github.com/BeOnAuto/auto-engineer/commit/b4b422c00c0e2a59bf7d9bc35c5d9f29e86bea0d), [`5475f60`](https://github.com/BeOnAuto/auto-engineer/commit/5475f6079c6591e8b5fa8dd22825a9d933d0aeb8), [`5c5b8bc`](https://github.com/BeOnAuto/auto-engineer/commit/5c5b8bc401fdc3234ae4fdca1fdf13770eeb0935), [`17713c7`](https://github.com/BeOnAuto/auto-engineer/commit/17713c757e3f340b68709152563a3e8ac69c32a2), [`bc5e46b`](https://github.com/BeOnAuto/auto-engineer/commit/bc5e46b5c5b65f488e18a87fa252ab35b20ce79b), [`903f609`](https://github.com/BeOnAuto/auto-engineer/commit/903f6099b898803b6cbf42ce0c9aa59f2675da2c), [`bd8c82c`](https://github.com/BeOnAuto/auto-engineer/commit/bd8c82cb031101598d0a85d45d0c43c2deca579e)]:
105
+ - @auto-engineer/file-upload@1.92.0
106
+ - @auto-engineer/message-bus@1.92.0
107
+
108
+ ## 1.91.0
109
+
110
+ ### Minor Changes
111
+
112
+ - [`ca28476`](https://github.com/BeOnAuto/auto-engineer/commit/ca2847643354c281b82b3427bb45be1caf023370) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add generate-test module
113
+
114
+ - [`c272077`](https://github.com/BeOnAuto/auto-engineer/commit/c272077c9934a7ed44e2a8eeec800dd7de41eb2a) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add extract-code-block utility
115
+
116
+ - [`2263623`](https://github.com/BeOnAuto/auto-engineer/commit/2263623af310170130aaa99dbd41919378c397ab) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add generate-component module
117
+
118
+ - [`ceaa70d`](https://github.com/BeOnAuto/auto-engineer/commit/ceaa70df7f8374f8426f3a876a516b2433f28da1) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add generate-story module
119
+
120
+ - [`a54bd95`](https://github.com/BeOnAuto/auto-engineer/commit/a54bd9562f9bed95bb1d78e627028d27761b1624) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add index.ts with COMMANDS export
121
+
122
+ - [`150fcb0`](https://github.com/BeOnAuto/auto-engineer/commit/150fcb020d147a5563c3b7a3712e7fcd25febd9e) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add implement-component command handler
123
+
124
+ ### Patch Changes
125
+
126
+ - [`39d380d`](https://github.com/BeOnAuto/auto-engineer/commit/39d380d87fcd9507a24e0848b1934246f7ab7ee0) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add ketchup plan
127
+
128
+ - [`8d0ef1f`](https://github.com/BeOnAuto/auto-engineer/commit/8d0ef1f12d0bccb0825c7e70e64c92c5325aaad3) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: add package infrastructure
129
+
130
+ - [`aa6f3ec`](https://github.com/BeOnAuto/auto-engineer/commit/aa6f3ec7c976b1acebaafa22f29385e0757ab807) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - Updated project dependency lockfile
131
+
132
+ - [`7a132d1`](https://github.com/BeOnAuto/auto-engineer/commit/7a132d126238ea715dcbd13ee2261ce2def70428) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **component-implementor-react**: mark all bursts done in plan
133
+
134
+ - [`f5ccb56`](https://github.com/BeOnAuto/auto-engineer/commit/f5ccb566483a3350298d92cd6ca3d3632f636bd3) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **global**: version packages
135
+ - **create-auto-app**: standardize formatting and improve code readability
136
+ - Updated dependencies [[`39d380d`](https://github.com/BeOnAuto/auto-engineer/commit/39d380d87fcd9507a24e0848b1934246f7ab7ee0), [`ca28476`](https://github.com/BeOnAuto/auto-engineer/commit/ca2847643354c281b82b3427bb45be1caf023370), [`8d0ef1f`](https://github.com/BeOnAuto/auto-engineer/commit/8d0ef1f12d0bccb0825c7e70e64c92c5325aaad3), [`aa6f3ec`](https://github.com/BeOnAuto/auto-engineer/commit/aa6f3ec7c976b1acebaafa22f29385e0757ab807), [`c272077`](https://github.com/BeOnAuto/auto-engineer/commit/c272077c9934a7ed44e2a8eeec800dd7de41eb2a), [`2263623`](https://github.com/BeOnAuto/auto-engineer/commit/2263623af310170130aaa99dbd41919378c397ab), [`7a132d1`](https://github.com/BeOnAuto/auto-engineer/commit/7a132d126238ea715dcbd13ee2261ce2def70428), [`ceaa70d`](https://github.com/BeOnAuto/auto-engineer/commit/ceaa70df7f8374f8426f3a876a516b2433f28da1), [`a54bd95`](https://github.com/BeOnAuto/auto-engineer/commit/a54bd9562f9bed95bb1d78e627028d27761b1624), [`150fcb0`](https://github.com/BeOnAuto/auto-engineer/commit/150fcb020d147a5563c3b7a3712e7fcd25febd9e), [`f5ccb56`](https://github.com/BeOnAuto/auto-engineer/commit/f5ccb566483a3350298d92cd6ca3d3632f636bd3)]:
137
+ - @auto-engineer/file-upload@1.91.0
138
+ - @auto-engineer/message-bus@1.91.0
139
+
3
140
  ## 1.90.0
4
141
 
5
142
  ### Minor Changes
@@ -1,9 +1,7 @@
1
1
  import { mkdirSync, writeFileSync } from 'node:fs';
2
- import { mkdir, writeFile } from 'node:fs/promises';
3
2
  import { dirname, resolve } from 'node:path';
4
3
  import { fileURLToPath } from 'node:url';
5
4
  import { parseArgs } from 'node:util';
6
- import { uploadFile } from '@auto-engineer/file-upload';
7
5
  import { uploadToArtifactPath } from './upload-artifact';
8
6
 
9
7
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -158,29 +156,7 @@ writeFileSync(OUTPUT_FILE, json);
158
156
 
159
157
  console.log(`Wrote ${merged.length} components to ${OUTPUT_FILE}`);
160
158
 
161
- await uploadFile('.context/components-db.json', new TextEncoder().encode(json), {
162
- uploadUrl: process.env.FILE_UPLOAD_URL,
163
- prefix: process.env.FILE_UPLOAD_PREFIX,
164
- signerUrl: process.env.UPLOAD_SIGNER_URL,
165
- signerToken: process.env.UPLOAD_SIGNER_TOKEN,
166
- fetch,
167
- writeFile: async (path, data) => {
168
- await writeFile(path, data);
169
- },
170
- mkdir: async (path) => {
171
- await mkdir(path, { recursive: true });
172
- },
173
- });
174
-
175
- const artifactUrl = await uploadToArtifactPath(json, process.env, {
176
- fetch,
177
- writeFile: async (path, data) => {
178
- await writeFile(path, data);
179
- },
180
- mkdir: async (path) => {
181
- await mkdir(path, { recursive: true });
182
- },
183
- });
159
+ const artifactUrl = await uploadToArtifactPath(json, process.env, { fetch });
184
160
  if (artifactUrl) {
185
161
  console.log(`[build-component-db] Uploaded to ${artifactUrl}`);
186
162
  console.log(`__ARTIFACT_UPLOADED__:${artifactUrl}`);
@@ -1,37 +1,32 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
-
3
- vi.mock('@auto-engineer/file-upload', () => ({
4
- uploadFile: vi.fn(),
5
- }));
6
-
7
- import { uploadFile } from '@auto-engineer/file-upload';
8
2
  import { uploadToArtifactPath } from './upload-artifact';
9
3
 
10
- const mockUploadFile = vi.mocked(uploadFile);
11
-
12
4
  describe('uploadToArtifactPath', () => {
5
+ const mockFetch = vi.fn<typeof globalThis.fetch>();
6
+ const fakeDeps = { fetch: mockFetch };
7
+
13
8
  beforeEach(() => {
14
- mockUploadFile.mockReset();
9
+ mockFetch.mockReset();
15
10
  });
16
11
 
17
- const fakeDeps = {
18
- fetch: vi.fn<typeof globalThis.fetch>(),
19
- writeFile: vi.fn().mockResolvedValue(undefined),
20
- mkdir: vi.fn().mockResolvedValue(undefined),
21
- };
22
-
23
- it('uploads to {artifactPath}/{orgId}/{projectId}/auto/components-db.json', async () => {
24
- mockUploadFile.mockResolvedValue(undefined);
12
+ it('posts json to COMPONENTS_UPLOAD_URL/{projectId}', async () => {
13
+ mockFetch.mockResolvedValue(new Response(null, { status: 200 }));
25
14
 
26
- const result = await uploadToArtifactPath('[]', { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', ARTIFACT_PATH: 'file:///tmp/artifacts' }, fakeDeps);
15
+ const result = await uploadToArtifactPath(
16
+ '[]',
17
+ { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', COMPONENTS_UPLOAD_URL: 'https://components.example.com/upload', SERVICE_TOKEN: 'tok-123' },
18
+ fakeDeps,
19
+ );
27
20
 
28
- expect(result).toEqual('file:///tmp/artifacts/org-1/proj-1/auto/components-db.json');
29
- expect(mockUploadFile).toHaveBeenCalledWith('components-db.json', new TextEncoder().encode('[]'), {
30
- uploadUrl: 'file:///tmp/artifacts',
31
- prefix: 'org-1/proj-1/auto',
32
- fetch: fakeDeps.fetch,
33
- writeFile: fakeDeps.writeFile,
34
- mkdir: fakeDeps.mkdir,
21
+ expect(result).toEqual('org-1/proj-1/components-db.json');
22
+ expect(mockFetch).toHaveBeenCalledWith('https://components.example.com/upload/proj-1', {
23
+ method: 'POST',
24
+ headers: {
25
+ 'Content-Type': 'application/json',
26
+ Authorization: 'Bearer tok-123',
27
+ 'X-Org-Id': 'org-1',
28
+ },
29
+ body: '[]',
35
30
  });
36
31
  });
37
32
 
@@ -39,65 +34,47 @@ describe('uploadToArtifactPath', () => {
39
34
  const result = await uploadToArtifactPath('[]', {}, fakeDeps);
40
35
 
41
36
  expect(result).toEqual(null);
42
- expect(mockUploadFile).not.toHaveBeenCalled();
37
+ expect(mockFetch).not.toHaveBeenCalled();
43
38
  });
44
39
 
45
40
  it('returns null when only some env vars are set', async () => {
46
41
  const result = await uploadToArtifactPath('[]', { ORG_ID: 'org-1' }, fakeDeps);
47
42
 
48
43
  expect(result).toEqual(null);
44
+ expect(mockFetch).not.toHaveBeenCalled();
49
45
  });
50
46
 
51
- it('uses signer mode when CONDUCTOR_URL and SERVICE_TOKEN are set', async () => {
52
- mockUploadFile.mockResolvedValue(undefined);
53
-
47
+ it('returns null when COMPONENTS_UPLOAD_URL is missing', async () => {
54
48
  const result = await uploadToArtifactPath(
55
49
  '[]',
56
- { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', CONDUCTOR_URL: 'https://conductor.example.com', SERVICE_TOKEN: 'tok-123' },
50
+ { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', SERVICE_TOKEN: 'tok-123' },
57
51
  fakeDeps,
58
52
  );
59
53
 
60
- expect(result).toEqual('org-1/proj-1/auto/components-db.json');
61
- expect(mockUploadFile).toHaveBeenCalledWith('components-db.json', new TextEncoder().encode('[]'), {
62
- signerUrl: 'https://conductor.example.com/projects/proj-1/artifact-upload-urls',
63
- signerToken: 'tok-123',
64
- prefix: 'org-1/proj-1/auto',
65
- fetch: fakeDeps.fetch,
66
- });
54
+ expect(result).toEqual(null);
55
+ expect(mockFetch).not.toHaveBeenCalled();
67
56
  });
68
57
 
69
- it('signer mode takes precedence over file:// mode when both are set', async () => {
70
- mockUploadFile.mockResolvedValue(undefined);
71
-
58
+ it('returns null when SERVICE_TOKEN is missing', async () => {
72
59
  const result = await uploadToArtifactPath(
73
60
  '[]',
74
- {
75
- ORG_ID: 'org-1',
76
- PROJECT_ID: 'proj-1',
77
- ARTIFACT_PATH: 'file:///tmp/artifacts',
78
- CONDUCTOR_URL: 'https://conductor.example.com',
79
- SERVICE_TOKEN: 'tok-123',
80
- },
61
+ { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', COMPONENTS_UPLOAD_URL: 'https://components.example.com/upload' },
81
62
  fakeDeps,
82
63
  );
83
64
 
84
- expect(result).toEqual('org-1/proj-1/auto/components-db.json');
85
- expect(mockUploadFile).toHaveBeenCalledWith('components-db.json', new TextEncoder().encode('[]'), {
86
- signerUrl: 'https://conductor.example.com/projects/proj-1/artifact-upload-urls',
87
- signerToken: 'tok-123',
88
- prefix: 'org-1/proj-1/auto',
89
- fetch: fakeDeps.fetch,
90
- });
65
+ expect(result).toEqual(null);
66
+ expect(mockFetch).not.toHaveBeenCalled();
91
67
  });
92
68
 
93
- it('returns null when orgId or projectId is missing even with CONDUCTOR_URL', async () => {
94
- const result = await uploadToArtifactPath(
95
- '[]',
96
- { CONDUCTOR_URL: 'https://conductor.example.com', SERVICE_TOKEN: 'tok-123' },
97
- fakeDeps,
98
- );
69
+ it('throws when the upload response is not ok', async () => {
70
+ mockFetch.mockResolvedValue(new Response(null, { status: 500 }));
99
71
 
100
- expect(result).toEqual(null);
101
- expect(mockUploadFile).not.toHaveBeenCalled();
72
+ await expect(
73
+ uploadToArtifactPath(
74
+ '[]',
75
+ { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', COMPONENTS_UPLOAD_URL: 'https://components.example.com/upload', SERVICE_TOKEN: 'tok-123' },
76
+ fakeDeps,
77
+ ),
78
+ ).rejects.toThrow('Components upload responded with 500');
102
79
  });
103
80
  });
@@ -1,38 +1,21 @@
1
- import { uploadFile } from '@auto-engineer/file-upload';
2
-
3
- interface UploadArtifactDeps {
4
- fetch: typeof globalThis.fetch;
5
- writeFile: (path: string, data: Uint8Array) => Promise<void>;
6
- mkdir: (path: string) => Promise<void>;
7
- }
8
-
9
1
  export async function uploadToArtifactPath(
10
2
  json: string,
11
- env: { ORG_ID?: string; PROJECT_ID?: string; ARTIFACT_PATH?: string; CONDUCTOR_URL?: string; SERVICE_TOKEN?: string },
12
- deps: UploadArtifactDeps,
3
+ env: { ORG_ID?: string; PROJECT_ID?: string; COMPONENTS_UPLOAD_URL?: string; SERVICE_TOKEN?: string },
4
+ deps: { fetch: typeof globalThis.fetch },
13
5
  ): Promise<string | null> {
14
6
  const { ORG_ID: orgId, PROJECT_ID: projectId } = env;
15
- if (!orgId || !projectId) return null;
7
+ if (!orgId || !projectId || !env.COMPONENTS_UPLOAD_URL || !env.SERVICE_TOKEN) return null;
16
8
 
17
- if (env.CONDUCTOR_URL && env.SERVICE_TOKEN) {
18
- const signerUrl = `${env.CONDUCTOR_URL}/projects/${projectId}/artifact-upload-urls`;
19
- await uploadFile('components-db.json', new TextEncoder().encode(json), {
20
- signerUrl,
21
- signerToken: env.SERVICE_TOKEN,
22
- prefix: `${orgId}/${projectId}/auto`,
23
- fetch: deps.fetch,
24
- });
25
- return `${orgId}/${projectId}/auto/components-db.json`;
26
- }
27
-
28
- const { ARTIFACT_PATH: artifactPath } = env;
29
- if (!artifactPath) return null;
30
- await uploadFile('components-db.json', new TextEncoder().encode(json), {
31
- uploadUrl: artifactPath,
32
- prefix: `${orgId}/${projectId}/auto`,
33
- fetch: deps.fetch,
34
- writeFile: deps.writeFile,
35
- mkdir: deps.mkdir,
9
+ const response = await deps.fetch(`${env.COMPONENTS_UPLOAD_URL}/${projectId}`, {
10
+ method: 'POST',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ Authorization: `Bearer ${env.SERVICE_TOKEN}`,
14
+ 'X-Org-Id': orgId,
15
+ },
16
+ body: json,
36
17
  });
37
- return `${artifactPath}/${orgId}/${projectId}/auto/components-db.json`;
18
+
19
+ if (!response.ok) throw new Error(`Components upload responded with ${response.status}`);
20
+ return `${orgId}/${projectId}/components-db.json`;
38
21
  }
package/package.json CHANGED
@@ -19,13 +19,13 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "debug": "^4.4.1",
22
- "@auto-engineer/file-upload": "1.90.0",
23
- "@auto-engineer/message-bus": "1.90.0"
22
+ "@auto-engineer/file-upload": "1.95.0",
23
+ "@auto-engineer/message-bus": "1.95.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/debug": "^4.1.12"
27
27
  },
28
- "version": "1.90.0",
28
+ "version": "1.95.0",
29
29
  "scripts": {
30
30
  "build": "tsc && tsx ../../scripts/fix-esm-imports.ts && cp -r starter dist/",
31
31
  "test-cli": "tsx test-cli.ts",