@auto-engineer/generate-react-client 1.85.0 → 1.86.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,20 @@
1
1
  # @auto-engineer/generate-react-client
2
2
 
3
+ ## 1.86.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`d052585`](https://github.com/BeOnAuto/auto-engineer/commit/d052585817dac3e1d6cbe8e7ee78cc25aba4585e) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - **generate-react-client**: add signer mode to uploadToArtifactPath
8
+
9
+ - [`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
10
+ - **global**: version packages
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`d052585`](https://github.com/BeOnAuto/auto-engineer/commit/d052585817dac3e1d6cbe8e7ee78cc25aba4585e), [`4225014`](https://github.com/BeOnAuto/auto-engineer/commit/42250148e63ff945662f71a94f4f4a8eabad33cc)]:
15
+ - @auto-engineer/file-upload@1.86.0
16
+ - @auto-engineer/message-bus@1.86.0
17
+
3
18
  ## 1.85.0
4
19
 
5
20
  ### Minor Changes
@@ -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
  }
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.85.0",
23
- "@auto-engineer/message-bus": "1.85.0"
22
+ "@auto-engineer/file-upload": "1.86.0",
23
+ "@auto-engineer/message-bus": "1.86.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/debug": "^4.1.12"
27
27
  },
28
- "version": "1.85.0",
28
+ "version": "1.86.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",