@auto-engineer/generate-react-client 1.85.0 → 1.87.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,35 @@
1
1
  # @auto-engineer/generate-react-client
2
2
 
3
+ ## 1.87.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`abc0dfc`](https://github.com/BeOnAuto/auto-engineer/commit/abc0dfcb0c18b244add124eb35e8547e68569d85) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **generate-react-client**: add signer mode to uploadToArtifactPath
8
+ - **global**: version packages
9
+
10
+ - [`90ecc94`](https://github.com/BeOnAuto/auto-engineer/commit/90ecc941ec0a2f148e0d2672e7b2db02ba9803a1) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **dev-server**: emit ComponentDBFileUploaded event on artifact upload
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`abc0dfc`](https://github.com/BeOnAuto/auto-engineer/commit/abc0dfcb0c18b244add124eb35e8547e68569d85), [`90ecc94`](https://github.com/BeOnAuto/auto-engineer/commit/90ecc941ec0a2f148e0d2672e7b2db02ba9803a1)]:
15
+ - @auto-engineer/file-upload@1.87.0
16
+ - @auto-engineer/message-bus@1.87.0
17
+
18
+ ## 1.86.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [`d052585`](https://github.com/BeOnAuto/auto-engineer/commit/d052585817dac3e1d6cbe8e7ee78cc25aba4585e) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **generate-react-client**: add signer mode to uploadToArtifactPath
23
+
24
+ - [`4225014`](https://github.com/BeOnAuto/auto-engineer/commit/42250148e63ff945662f71a94f4f4a8eabad33cc) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **generate-react-client**: build-component-db uploads to artifact path via env vars
25
+ - **global**: version packages
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [[`d052585`](https://github.com/BeOnAuto/auto-engineer/commit/d052585817dac3e1d6cbe8e7ee78cc25aba4585e), [`4225014`](https://github.com/BeOnAuto/auto-engineer/commit/42250148e63ff945662f71a94f4f4a8eabad33cc)]:
30
+ - @auto-engineer/file-upload@1.86.0
31
+ - @auto-engineer/message-bus@1.86.0
32
+
3
33
  ## 1.85.0
4
34
 
5
35
  ### Minor Changes
@@ -183,4 +183,5 @@ const artifactUrl = await uploadToArtifactPath(json, process.env, {
183
183
  });
184
184
  if (artifactUrl) {
185
185
  console.log(`[build-component-db] Uploaded to ${artifactUrl}`);
186
+ console.log(`__ARTIFACT_UPLOADED__:${artifactUrl}`);
186
187
  }
@@ -47,4 +47,57 @@ describe('uploadToArtifactPath', () => {
47
47
 
48
48
  expect(result).toEqual(null);
49
49
  });
50
+
51
+ it('uses signer mode when CONDUCTOR_URL and SERVICE_TOKEN are set', async () => {
52
+ mockUploadFile.mockResolvedValue(undefined);
53
+
54
+ const result = await uploadToArtifactPath(
55
+ '[]',
56
+ { ORG_ID: 'org-1', PROJECT_ID: 'proj-1', CONDUCTOR_URL: 'https://conductor.example.com', SERVICE_TOKEN: 'tok-123' },
57
+ fakeDeps,
58
+ );
59
+
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
+ });
67
+ });
68
+
69
+ it('signer mode takes precedence over file:// mode when both are set', async () => {
70
+ mockUploadFile.mockResolvedValue(undefined);
71
+
72
+ const result = await uploadToArtifactPath(
73
+ '[]',
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
+ },
81
+ fakeDeps,
82
+ );
83
+
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
+ });
91
+ });
92
+
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
+ );
99
+
100
+ expect(result).toEqual(null);
101
+ expect(mockUploadFile).not.toHaveBeenCalled();
102
+ });
50
103
  });
@@ -8,12 +8,25 @@ interface UploadArtifactDeps {
8
8
 
9
9
  export async function uploadToArtifactPath(
10
10
  json: string,
11
- env: { ORG_ID?: string; PROJECT_ID?: string; ARTIFACT_PATH?: string },
11
+ env: { ORG_ID?: string; PROJECT_ID?: string; ARTIFACT_PATH?: string; CONDUCTOR_URL?: string; SERVICE_TOKEN?: string },
12
12
  deps: UploadArtifactDeps,
13
13
  ): Promise<string | null> {
14
- const { ORG_ID: orgId, PROJECT_ID: projectId, ARTIFACT_PATH: artifactPath } = env;
15
- if (!artifactPath || !orgId || !projectId) return null;
14
+ const { ORG_ID: orgId, PROJECT_ID: projectId } = env;
15
+ if (!orgId || !projectId) return null;
16
16
 
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;
17
30
  await uploadFile('components-db.json', new TextEncoder().encode(json), {
18
31
  uploadUrl: artifactPath,
19
32
  prefix: `${orgId}/${projectId}/auto`,
@@ -21,6 +34,5 @@ export async function uploadToArtifactPath(
21
34
  writeFile: deps.writeFile,
22
35
  mkdir: deps.mkdir,
23
36
  });
24
-
25
37
  return `${artifactPath}/${orgId}/${projectId}/auto/components-db.json`;
26
38
  }