@geekmidas/cli 1.1.0 → 1.2.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{config-ClfjsfwH.mjs → config-BQ4a36Rq.mjs} +2 -2
  3. package/dist/{config-ClfjsfwH.mjs.map → config-BQ4a36Rq.mjs.map} +1 -1
  4. package/dist/{config-CKfif10N.cjs → config-Bayob8pB.cjs} +2 -2
  5. package/dist/{config-CKfif10N.cjs.map → config-Bayob8pB.cjs.map} +1 -1
  6. package/dist/config.cjs +2 -2
  7. package/dist/config.d.cts +1 -1
  8. package/dist/config.d.mts +1 -1
  9. package/dist/config.mjs +2 -2
  10. package/dist/{index-CHQs8G3q.d.mts → index-Bi9vGQJy.d.mts} +56 -13
  11. package/dist/index-Bi9vGQJy.d.mts.map +1 -0
  12. package/dist/{index-afBljZKY.d.cts → index-CufAAnge.d.cts} +56 -13
  13. package/dist/index-CufAAnge.d.cts.map +1 -0
  14. package/dist/index.cjs +17 -10
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.mjs +17 -10
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/{openapi-D3p6s8UA.cjs → openapi-BZP8jkI4.cjs} +2 -2
  19. package/dist/{openapi-D3p6s8UA.cjs.map → openapi-BZP8jkI4.cjs.map} +1 -1
  20. package/dist/{openapi-C6sa0L8b.mjs → openapi-DrbBWq0s.mjs} +2 -2
  21. package/dist/{openapi-C6sa0L8b.mjs.map → openapi-DrbBWq0s.mjs.map} +1 -1
  22. package/dist/openapi.cjs +3 -3
  23. package/dist/openapi.mjs +3 -3
  24. package/dist/workspace/index.cjs +2 -1
  25. package/dist/workspace/index.d.cts +2 -2
  26. package/dist/workspace/index.d.mts +2 -2
  27. package/dist/workspace/index.mjs +2 -2
  28. package/dist/{workspace-CjT323qw.cjs → workspace-BMJE18LV.cjs} +44 -5
  29. package/dist/workspace-BMJE18LV.cjs.map +1 -0
  30. package/dist/{workspace-CmITpum4.mjs → workspace-CASoZOjs.mjs} +39 -6
  31. package/dist/workspace-CASoZOjs.mjs.map +1 -0
  32. package/package.json +3 -3
  33. package/src/deploy/__tests__/CachedStateProvider.spec.ts +7 -0
  34. package/src/deploy/__tests__/LocalStateProvider.spec.ts +4 -0
  35. package/src/deploy/__tests__/SSMStateProvider.spec.ts +5 -0
  36. package/src/deploy/__tests__/dns-verification.spec.ts +1 -1
  37. package/src/deploy/__tests__/env-resolver.spec.ts +9 -9
  38. package/src/deploy/__tests__/state-e2e.spec.ts +2 -0
  39. package/src/deploy/__tests__/state.spec.ts +53 -29
  40. package/src/deploy/index.ts +6 -1
  41. package/src/deploy/sniffer.ts +1 -1
  42. package/src/deploy/state.ts +4 -0
  43. package/src/dev/index.ts +2 -2
  44. package/src/init/generators/web.ts +2 -0
  45. package/src/init/versions.ts +1 -1
  46. package/src/workspace/__tests__/index.spec.ts +68 -0
  47. package/src/workspace/index.ts +43 -0
  48. package/src/workspace/schema.ts +17 -6
  49. package/src/workspace/types.ts +19 -9
  50. package/dist/index-CHQs8G3q.d.mts.map +0 -1
  51. package/dist/index-afBljZKY.d.cts.map +0 -1
  52. package/dist/workspace-CjT323qw.cjs.map +0 -1
  53. package/dist/workspace-CmITpum4.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs",
5
5
  "private": false,
6
6
  "type": "module",
@@ -54,10 +54,10 @@
54
54
  "prompts": "~2.4.2",
55
55
  "tsx": "~4.20.3",
56
56
  "@geekmidas/constructs": "~1.0.0",
57
+ "@geekmidas/errors": "~1.0.0",
57
58
  "@geekmidas/envkit": "~1.0.0",
58
- "@geekmidas/logger": "~1.0.0",
59
59
  "@geekmidas/schema": "~1.0.0",
60
- "@geekmidas/errors": "~1.0.0"
60
+ "@geekmidas/logger": "~1.0.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/lodash.kebabcase": "^4.1.9",
@@ -36,6 +36,7 @@ describe('CachedStateProvider', () => {
36
36
  const state: DokployStageState = {
37
37
  provider: 'dokploy',
38
38
  stage: 'production',
39
+ projectId: 'proj_test',
39
40
  environmentId: 'env_123',
40
41
  applications: { api: 'local_app' },
41
42
  services: {},
@@ -58,6 +59,7 @@ describe('CachedStateProvider', () => {
58
59
  const state: DokployStageState = {
59
60
  provider: 'dokploy',
60
61
  stage: 'production',
62
+ projectId: 'proj_test',
61
63
  environmentId: 'env_123',
62
64
  applications: { api: 'remote_app' },
63
65
  services: {},
@@ -96,6 +98,7 @@ describe('CachedStateProvider', () => {
96
98
  const state: DokployStageState = {
97
99
  provider: 'dokploy',
98
100
  stage: 'production',
101
+ projectId: 'proj_test',
99
102
  environmentId: 'env_123',
100
103
  applications: { api: 'app_123' },
101
104
  services: {},
@@ -120,6 +123,7 @@ describe('CachedStateProvider', () => {
120
123
  const remoteState: DokployStageState = {
121
124
  provider: 'dokploy',
122
125
  stage: 'production',
126
+ projectId: 'proj_test',
123
127
  environmentId: 'env_123',
124
128
  applications: { api: 'remote_app' },
125
129
  services: {},
@@ -155,6 +159,7 @@ describe('CachedStateProvider', () => {
155
159
  const localState: DokployStageState = {
156
160
  provider: 'dokploy',
157
161
  stage: 'production',
162
+ projectId: 'proj_test',
158
163
  environmentId: 'env_123',
159
164
  applications: { api: 'local_app' },
160
165
  services: {},
@@ -190,6 +195,7 @@ describe('CachedStateProvider', () => {
190
195
  const localState: DokployStageState = {
191
196
  provider: 'dokploy',
192
197
  stage: 'production',
198
+ projectId: 'proj_test',
193
199
  environmentId: 'env_123',
194
200
  applications: { api: 'local_app' },
195
201
  services: {},
@@ -198,6 +204,7 @@ describe('CachedStateProvider', () => {
198
204
  const remoteState: DokployStageState = {
199
205
  provider: 'dokploy',
200
206
  stage: 'production',
207
+ projectId: 'proj_test',
201
208
  environmentId: 'env_123',
202
209
  applications: { api: 'remote_app' },
203
210
  services: {},
@@ -29,6 +29,7 @@ describe('LocalStateProvider', () => {
29
29
  const stateData: DokployStageState = {
30
30
  provider: 'dokploy',
31
31
  stage: 'production',
32
+ projectId: 'proj_test',
32
33
  environmentId: 'env_123',
33
34
  applications: { api: 'app_123' },
34
35
  services: { postgresId: 'pg_123' },
@@ -62,6 +63,7 @@ describe('LocalStateProvider', () => {
62
63
  const state: DokployStageState = {
63
64
  provider: 'dokploy',
64
65
  stage: 'staging',
66
+ projectId: 'proj_test',
65
67
  environmentId: 'env_456',
66
68
  applications: {},
67
69
  services: {},
@@ -81,6 +83,7 @@ describe('LocalStateProvider', () => {
81
83
  const state: DokployStageState = {
82
84
  provider: 'dokploy',
83
85
  stage: 'staging',
86
+ projectId: 'proj_test',
84
87
  environmentId: 'env_456',
85
88
  applications: {},
86
89
  services: {},
@@ -98,6 +101,7 @@ describe('LocalStateProvider', () => {
98
101
  const state: DokployStageState = {
99
102
  provider: 'dokploy',
100
103
  stage: 'production',
104
+ projectId: 'proj_test',
101
105
  environmentId: 'env_123',
102
106
  applications: { api: 'app_123', web: 'app_456' },
103
107
  services: { postgresId: 'pg_123', redisId: 'redis_123' },
@@ -87,6 +87,7 @@ describe('SSMStateProvider', () => {
87
87
  const stateData: DokployStageState = {
88
88
  provider: 'dokploy',
89
89
  stage: testStage,
90
+ projectId: 'proj_test',
90
91
  environmentId: 'env_123',
91
92
  applications: { api: 'app_123' },
92
93
  services: { postgresId: 'pg_123' },
@@ -112,6 +113,7 @@ describe('SSMStateProvider', () => {
112
113
  const state: DokployStageState = {
113
114
  provider: 'dokploy',
114
115
  stage: testStage,
116
+ projectId: 'proj_test',
115
117
  environmentId: 'env_123',
116
118
  applications: { api: 'app_123' },
117
119
  services: {},
@@ -135,6 +137,7 @@ describe('SSMStateProvider', () => {
135
137
  const state1: DokployStageState = {
136
138
  provider: 'dokploy',
137
139
  stage: testStage,
140
+ projectId: 'proj_test',
138
141
  environmentId: 'env_123',
139
142
  applications: { api: 'app_old' },
140
143
  services: {},
@@ -144,6 +147,7 @@ describe('SSMStateProvider', () => {
144
147
  const state2: DokployStageState = {
145
148
  provider: 'dokploy',
146
149
  stage: testStage,
150
+ projectId: 'proj_test',
147
151
  environmentId: 'env_123',
148
152
  applications: { api: 'app_new' },
149
153
  services: {},
@@ -168,6 +172,7 @@ describe('SSMStateProvider', () => {
168
172
  const state: DokployStageState = {
169
173
  provider: 'dokploy',
170
174
  stage: testStage,
175
+ projectId: 'proj_test',
171
176
  environmentId: 'env_123',
172
177
  applications: {},
173
178
  services: {},
@@ -44,7 +44,7 @@ describe('verifyDnsRecords', () => {
44
44
 
45
45
  beforeEach(() => {
46
46
  vi.clearAllMocks();
47
- state = createEmptyState('production', 'env-123');
47
+ state = createEmptyState('production', 'proj_test', 'env-123');
48
48
  console.log = vi.fn();
49
49
  });
50
50
 
@@ -53,7 +53,7 @@ describe('generateSecret', () => {
53
53
  describe('getOrGenerateSecret', () => {
54
54
  it('should return existing secret if already stored', () => {
55
55
  const state: DokployStageState = {
56
- ...createEmptyState('production', 'env-123'),
56
+ ...createEmptyState('production', 'proj_test', 'env-123'),
57
57
  generatedSecrets: {
58
58
  api: { BETTER_AUTH_SECRET: 'existing-secret-123' },
59
59
  },
@@ -64,7 +64,7 @@ describe('getOrGenerateSecret', () => {
64
64
  });
65
65
 
66
66
  it('should generate and store new secret if not exists', () => {
67
- const state = createEmptyState('production', 'env-123');
67
+ const state = createEmptyState('production', 'proj_test', 'env-123');
68
68
 
69
69
  const result = getOrGenerateSecret(state, 'api', 'BETTER_AUTH_SECRET');
70
70
 
@@ -73,7 +73,7 @@ describe('getOrGenerateSecret', () => {
73
73
  });
74
74
 
75
75
  it('should generate different secrets for different apps', () => {
76
- const state = createEmptyState('production', 'env-123');
76
+ const state = createEmptyState('production', 'proj_test', 'env-123');
77
77
 
78
78
  const apiSecret = getOrGenerateSecret(state, 'api', 'BETTER_AUTH_SECRET');
79
79
  const authSecret = getOrGenerateSecret(state, 'auth', 'BETTER_AUTH_SECRET');
@@ -84,7 +84,7 @@ describe('getOrGenerateSecret', () => {
84
84
  });
85
85
 
86
86
  it('should generate different secrets for different secret names', () => {
87
- const state = createEmptyState('production', 'env-123');
87
+ const state = createEmptyState('production', 'proj_test', 'env-123');
88
88
 
89
89
  const secret1 = getOrGenerateSecret(state, 'api', 'SECRET_ONE');
90
90
  const secret2 = getOrGenerateSecret(state, 'api', 'SECRET_TWO');
@@ -93,7 +93,7 @@ describe('getOrGenerateSecret', () => {
93
93
  });
94
94
 
95
95
  it('should return same secret on subsequent calls', () => {
96
- const state = createEmptyState('production', 'env-123');
96
+ const state = createEmptyState('production', 'proj_test', 'env-123');
97
97
 
98
98
  const first = getOrGenerateSecret(state, 'api', 'BETTER_AUTH_SECRET');
99
99
  const second = getOrGenerateSecret(state, 'api', 'BETTER_AUTH_SECRET');
@@ -181,7 +181,7 @@ describe('resolveEnvVar', () => {
181
181
  app: createApp(),
182
182
  appName: 'api',
183
183
  stage: 'production',
184
- state: createEmptyState('production', 'env-123'),
184
+ state: createEmptyState('production', 'proj_test', 'env-123'),
185
185
  appHostname: 'api.example.com',
186
186
  frontendUrls: [],
187
187
  ...overrides,
@@ -253,7 +253,7 @@ describe('resolveEnvVar', () => {
253
253
  });
254
254
 
255
255
  it('should resolve BETTER_AUTH_SECRET by generating and storing secret', () => {
256
- const state = createEmptyState('production', 'env-123');
256
+ const state = createEmptyState('production', 'proj_test', 'env-123');
257
257
  const context = createContext({ state, appName: 'auth' });
258
258
 
259
259
  const secret = resolveEnvVar('BETTER_AUTH_SECRET', context);
@@ -362,7 +362,7 @@ describe('resolveEnvVars', () => {
362
362
  },
363
363
  appName: 'api',
364
364
  stage: 'production',
365
- state: createEmptyState('production', 'env-123'),
365
+ state: createEmptyState('production', 'proj_test', 'env-123'),
366
366
  appHostname: 'api.example.com',
367
367
  frontendUrls: ['https://web.example.com'],
368
368
  ...overrides,
@@ -449,7 +449,7 @@ describe('validateEnvVars', () => {
449
449
  },
450
450
  appName: 'api',
451
451
  stage: 'production',
452
- state: createEmptyState('production', 'env-123'),
452
+ state: createEmptyState('production', 'proj_test', 'env-123'),
453
453
  appHostname: 'api.example.com',
454
454
  frontendUrls: [],
455
455
  ...overrides,
@@ -42,6 +42,7 @@ describe('State Provider E2E', () => {
42
42
  ): DokployStageState => ({
43
43
  provider: 'dokploy',
44
44
  stage: testStage,
45
+ projectId: 'proj_e2e_123',
45
46
  environmentId: 'env_e2e_123',
46
47
  applications: { api: 'app_e2e_123', web: 'app_e2e_456' },
47
48
  services: { postgresId: 'pg_e2e_123', redisId: 'redis_e2e_123' },
@@ -295,6 +296,7 @@ describe('State Provider E2E', () => {
295
296
  const preExistingState: DokployStageState = {
296
297
  provider: 'dokploy',
297
298
  stage: testStage,
299
+ projectId: 'proj_test',
298
300
  environmentId: 'env_pre_existing',
299
301
  applications: { api: 'app_pre_123' },
300
302
  services: { postgresId: 'pg_pre_123' },
@@ -39,11 +39,12 @@ describe('state management', () => {
39
39
  });
40
40
 
41
41
  describe('createEmptyState', () => {
42
- it('should create a valid empty state', () => {
43
- const state = createEmptyState('production', 'env_123');
42
+ it('should create a valid empty state with projectId', () => {
43
+ const state = createEmptyState('production', 'proj_123', 'env_123');
44
44
 
45
45
  expect(state.provider).toBe('dokploy');
46
46
  expect(state.stage).toBe('production');
47
+ expect(state.projectId).toBe('proj_123');
47
48
  expect(state.environmentId).toBe('env_123');
48
49
  expect(state.applications).toEqual({});
49
50
  expect(state.services).toEqual({});
@@ -51,7 +52,7 @@ describe('state management', () => {
51
52
  });
52
53
 
53
54
  it('should generate valid ISO timestamp', () => {
54
- const state = createEmptyState('staging', 'env_456');
55
+ const state = createEmptyState('staging', 'proj_test', 'env_456');
55
56
 
56
57
  expect(() => new Date(state.lastDeployedAt)).not.toThrow();
57
58
  });
@@ -68,6 +69,7 @@ describe('state management', () => {
68
69
  const stateData: DokployStageState = {
69
70
  provider: 'dokploy',
70
71
  stage: 'production',
72
+ projectId: 'proj_test',
71
73
  environmentId: 'env_123',
72
74
  applications: { api: 'app_123' },
73
75
  services: { postgresId: 'pg_123' },
@@ -100,7 +102,7 @@ describe('state management', () => {
100
102
 
101
103
  describe('writeStageState', () => {
102
104
  it('should create .gkm directory if not exists', async () => {
103
- const state = createEmptyState('staging', 'env_456');
105
+ const state = createEmptyState('staging', 'proj_test', 'env_456');
104
106
 
105
107
  await writeStageState(testDir, 'staging', state);
106
108
 
@@ -112,7 +114,7 @@ describe('state management', () => {
112
114
  });
113
115
 
114
116
  it('should update lastDeployedAt timestamp', async () => {
115
- const state = createEmptyState('staging', 'env_456');
117
+ const state = createEmptyState('staging', 'proj_test', 'env_456');
116
118
  const originalTimestamp = state.lastDeployedAt;
117
119
 
118
120
  // Wait a bit to ensure different timestamp
@@ -127,6 +129,7 @@ describe('state management', () => {
127
129
  const state: DokployStageState = {
128
130
  provider: 'dokploy',
129
131
  stage: 'production',
132
+ projectId: 'proj_test',
130
133
  environmentId: 'env_123',
131
134
  applications: { api: 'app_123', web: 'app_456' },
132
135
  services: { postgresId: 'pg_123', redisId: 'redis_123' },
@@ -158,6 +161,7 @@ describe('state management', () => {
158
161
  const state: DokployStageState = {
159
162
  provider: 'dokploy',
160
163
  stage: 'production',
164
+ projectId: 'proj_test',
161
165
  environmentId: 'env_123',
162
166
  applications: { api: 'app_123' },
163
167
  services: {},
@@ -171,6 +175,7 @@ describe('state management', () => {
171
175
  const state: DokployStageState = {
172
176
  provider: 'dokploy',
173
177
  stage: 'production',
178
+ projectId: 'proj_test',
174
179
  environmentId: 'env_123',
175
180
  applications: {},
176
181
  services: {},
@@ -187,7 +192,7 @@ describe('state management', () => {
187
192
 
188
193
  describe('setApplicationId', () => {
189
194
  it('should set application ID', () => {
190
- const state = createEmptyState('production', 'env_123');
195
+ const state = createEmptyState('production', 'proj_test', 'env_123');
191
196
 
192
197
  setApplicationId(state, 'api', 'app_123');
193
198
 
@@ -195,7 +200,7 @@ describe('state management', () => {
195
200
  });
196
201
 
197
202
  it('should update existing application ID', () => {
198
- const state = createEmptyState('production', 'env_123');
203
+ const state = createEmptyState('production', 'proj_test', 'env_123');
199
204
  state.applications.api = 'app_old';
200
205
 
201
206
  setApplicationId(state, 'api', 'app_new');
@@ -209,6 +214,7 @@ describe('state management', () => {
209
214
  const state: DokployStageState = {
210
215
  provider: 'dokploy',
211
216
  stage: 'production',
217
+ projectId: 'proj_test',
212
218
  environmentId: 'env_123',
213
219
  applications: {},
214
220
  services: { postgresId: 'pg_123' },
@@ -219,7 +225,7 @@ describe('state management', () => {
219
225
  });
220
226
 
221
227
  it('should return undefined when postgres not configured', () => {
222
- const state = createEmptyState('production', 'env_123');
228
+ const state = createEmptyState('production', 'proj_test', 'env_123');
223
229
 
224
230
  expect(getPostgresId(state)).toBeUndefined();
225
231
  });
@@ -231,7 +237,7 @@ describe('state management', () => {
231
237
 
232
238
  describe('setPostgresId', () => {
233
239
  it('should set postgres ID', () => {
234
- const state = createEmptyState('production', 'env_123');
240
+ const state = createEmptyState('production', 'proj_test', 'env_123');
235
241
 
236
242
  setPostgresId(state, 'pg_123');
237
243
 
@@ -244,6 +250,7 @@ describe('state management', () => {
244
250
  const state: DokployStageState = {
245
251
  provider: 'dokploy',
246
252
  stage: 'production',
253
+ projectId: 'proj_test',
247
254
  environmentId: 'env_123',
248
255
  applications: {},
249
256
  services: { redisId: 'redis_123' },
@@ -254,7 +261,7 @@ describe('state management', () => {
254
261
  });
255
262
 
256
263
  it('should return undefined when redis not configured', () => {
257
- const state = createEmptyState('production', 'env_123');
264
+ const state = createEmptyState('production', 'proj_test', 'env_123');
258
265
 
259
266
  expect(getRedisId(state)).toBeUndefined();
260
267
  });
@@ -266,7 +273,7 @@ describe('state management', () => {
266
273
 
267
274
  describe('setRedisId', () => {
268
275
  it('should set redis ID', () => {
269
- const state = createEmptyState('production', 'env_123');
276
+ const state = createEmptyState('production', 'proj_test', 'env_123');
270
277
 
271
278
  setRedisId(state, 'redis_123');
272
279
 
@@ -279,6 +286,7 @@ describe('state management', () => {
279
286
  const state: DokployStageState = {
280
287
  provider: 'dokploy',
281
288
  stage: 'production',
289
+ projectId: 'proj_test',
282
290
  environmentId: 'env_123',
283
291
  applications: {},
284
292
  services: {},
@@ -298,6 +306,7 @@ describe('state management', () => {
298
306
  const state: DokployStageState = {
299
307
  provider: 'dokploy',
300
308
  stage: 'production',
309
+ projectId: 'proj_test',
301
310
  environmentId: 'env_123',
302
311
  applications: {},
303
312
  services: {},
@@ -309,7 +318,7 @@ describe('state management', () => {
309
318
  });
310
319
 
311
320
  it('should return undefined when no appCredentials', () => {
312
- const state = createEmptyState('production', 'env_123');
321
+ const state = createEmptyState('production', 'proj_test', 'env_123');
313
322
 
314
323
  expect(getAppCredentials(state, 'api')).toBeUndefined();
315
324
  });
@@ -321,7 +330,7 @@ describe('state management', () => {
321
330
 
322
331
  describe('setAppCredentials', () => {
323
332
  it('should set credentials', () => {
324
- const state = createEmptyState('production', 'env_123');
333
+ const state = createEmptyState('production', 'proj_test', 'env_123');
325
334
 
326
335
  setAppCredentials(state, 'api', { dbUser: 'api', dbPassword: 'secret' });
327
336
 
@@ -332,7 +341,7 @@ describe('state management', () => {
332
341
  });
333
342
 
334
343
  it('should initialize appCredentials if not exists', () => {
335
- const state = createEmptyState('production', 'env_123');
344
+ const state = createEmptyState('production', 'proj_test', 'env_123');
336
345
  expect(state.appCredentials).toBeUndefined();
337
346
 
338
347
  setAppCredentials(state, 'api', { dbUser: 'api', dbPassword: 'secret' });
@@ -341,7 +350,7 @@ describe('state management', () => {
341
350
  });
342
351
 
343
352
  it('should update existing credentials', () => {
344
- const state = createEmptyState('production', 'env_123');
353
+ const state = createEmptyState('production', 'proj_test', 'env_123');
345
354
  state.appCredentials = {
346
355
  api: { dbUser: 'api', dbPassword: 'old_password' },
347
356
  };
@@ -360,6 +369,7 @@ describe('state management', () => {
360
369
  const state: DokployStageState = {
361
370
  provider: 'dokploy',
362
371
  stage: 'production',
372
+ projectId: 'proj_test',
363
373
  environmentId: 'env_123',
364
374
  applications: {},
365
375
  services: {},
@@ -377,7 +387,7 @@ describe('state management', () => {
377
387
  });
378
388
 
379
389
  it('should return empty object when no credentials', () => {
380
- const state = createEmptyState('production', 'env_123');
390
+ const state = createEmptyState('production', 'proj_test', 'env_123');
381
391
 
382
392
  expect(getAllAppCredentials(state)).toEqual({});
383
393
  });
@@ -396,6 +406,7 @@ describe('state management', () => {
396
406
  const state: DokployStageState = {
397
407
  provider: 'dokploy',
398
408
  stage: 'production',
409
+ projectId: 'proj_test',
399
410
  environmentId: 'env_123',
400
411
  applications: {},
401
412
  services: {},
@@ -414,6 +425,7 @@ describe('state management', () => {
414
425
  const state: DokployStageState = {
415
426
  provider: 'dokploy',
416
427
  stage: 'production',
428
+ projectId: 'proj_test',
417
429
  environmentId: 'env_123',
418
430
  applications: {},
419
431
  services: {},
@@ -432,6 +444,7 @@ describe('state management', () => {
432
444
  const state: DokployStageState = {
433
445
  provider: 'dokploy',
434
446
  stage: 'production',
447
+ projectId: 'proj_test',
435
448
  environmentId: 'env_123',
436
449
  applications: {},
437
450
  services: {},
@@ -445,7 +458,7 @@ describe('state management', () => {
445
458
  });
446
459
 
447
460
  it('should return undefined when no generatedSecrets', () => {
448
- const state = createEmptyState('production', 'env_123');
461
+ const state = createEmptyState('production', 'proj_test', 'env_123');
449
462
 
450
463
  expect(
451
464
  getGeneratedSecret(state, 'auth', 'BETTER_AUTH_SECRET'),
@@ -461,7 +474,7 @@ describe('state management', () => {
461
474
 
462
475
  describe('setGeneratedSecret', () => {
463
476
  it('should set secret', () => {
464
- const state = createEmptyState('production', 'env_123');
477
+ const state = createEmptyState('production', 'proj_test', 'env_123');
465
478
 
466
479
  setGeneratedSecret(state, 'auth', 'BETTER_AUTH_SECRET', 'secret123');
467
480
 
@@ -471,7 +484,7 @@ describe('state management', () => {
471
484
  });
472
485
 
473
486
  it('should initialize generatedSecrets if not exists', () => {
474
- const state = createEmptyState('production', 'env_123');
487
+ const state = createEmptyState('production', 'proj_test', 'env_123');
475
488
  expect(state.generatedSecrets).toBeUndefined();
476
489
 
477
490
  setGeneratedSecret(state, 'auth', 'BETTER_AUTH_SECRET', 'secret123');
@@ -480,7 +493,7 @@ describe('state management', () => {
480
493
  });
481
494
 
482
495
  it('should initialize app secrets if not exists', () => {
483
- const state = createEmptyState('production', 'env_123');
496
+ const state = createEmptyState('production', 'proj_test', 'env_123');
484
497
  state.generatedSecrets = {};
485
498
 
486
499
  setGeneratedSecret(state, 'auth', 'BETTER_AUTH_SECRET', 'secret123');
@@ -489,7 +502,7 @@ describe('state management', () => {
489
502
  });
490
503
 
491
504
  it('should update existing secret', () => {
492
- const state = createEmptyState('production', 'env_123');
505
+ const state = createEmptyState('production', 'proj_test', 'env_123');
493
506
  state.generatedSecrets = {
494
507
  auth: { BETTER_AUTH_SECRET: 'old_secret' },
495
508
  };
@@ -500,7 +513,7 @@ describe('state management', () => {
500
513
  });
501
514
 
502
515
  it('should add multiple secrets for same app', () => {
503
- const state = createEmptyState('production', 'env_123');
516
+ const state = createEmptyState('production', 'proj_test', 'env_123');
504
517
 
505
518
  setGeneratedSecret(state, 'auth', 'BETTER_AUTH_SECRET', 'secret1');
506
519
  setGeneratedSecret(state, 'auth', 'OTHER_SECRET', 'secret2');
@@ -517,6 +530,7 @@ describe('state management', () => {
517
530
  const state: DokployStageState = {
518
531
  provider: 'dokploy',
519
532
  stage: 'production',
533
+ projectId: 'proj_test',
520
534
  environmentId: 'env_123',
521
535
  applications: {},
522
536
  services: {},
@@ -539,6 +553,7 @@ describe('state management', () => {
539
553
  const state: DokployStageState = {
540
554
  provider: 'dokploy',
541
555
  stage: 'production',
556
+ projectId: 'proj_test',
542
557
  environmentId: 'env_123',
543
558
  applications: {},
544
559
  services: {},
@@ -561,6 +576,7 @@ describe('state management', () => {
561
576
  const state: DokployStageState = {
562
577
  provider: 'dokploy',
563
578
  stage: 'production',
579
+ projectId: 'proj_test',
564
580
  environmentId: 'env_123',
565
581
  applications: {},
566
582
  services: {},
@@ -578,7 +594,7 @@ describe('state management', () => {
578
594
  });
579
595
 
580
596
  it('should return empty object when no secrets', () => {
581
- const state = createEmptyState('production', 'env_123');
597
+ const state = createEmptyState('production', 'proj_test', 'env_123');
582
598
 
583
599
  expect(getAllGeneratedSecrets(state)).toEqual({});
584
600
  });
@@ -597,6 +613,7 @@ describe('state management', () => {
597
613
  const state: DokployStageState = {
598
614
  provider: 'dokploy',
599
615
  stage: 'production',
616
+ projectId: 'proj_test',
600
617
  environmentId: 'env_123',
601
618
  applications: {},
602
619
  services: {},
@@ -619,6 +636,7 @@ describe('state management', () => {
619
636
  const state: DokployStageState = {
620
637
  provider: 'dokploy',
621
638
  stage: 'production',
639
+ projectId: 'proj_test',
622
640
  environmentId: 'env_123',
623
641
  applications: {},
624
642
  services: {},
@@ -635,7 +653,7 @@ describe('state management', () => {
635
653
  });
636
654
 
637
655
  it('should return undefined when no dnsVerified', () => {
638
- const state = createEmptyState('production', 'env_123');
656
+ const state = createEmptyState('production', 'proj_test', 'env_123');
639
657
 
640
658
  expect(getDnsVerification(state, 'api.example.com')).toBeUndefined();
641
659
  });
@@ -647,7 +665,7 @@ describe('state management', () => {
647
665
 
648
666
  describe('setDnsVerification', () => {
649
667
  it('should set verification record', () => {
650
- const state = createEmptyState('production', 'env_123');
668
+ const state = createEmptyState('production', 'proj_test', 'env_123');
651
669
 
652
670
  setDnsVerification(state, 'api.example.com', '1.2.3.4');
653
671
 
@@ -656,7 +674,7 @@ describe('state management', () => {
656
674
  });
657
675
 
658
676
  it('should initialize dnsVerified if not exists', () => {
659
- const state = createEmptyState('production', 'env_123');
677
+ const state = createEmptyState('production', 'proj_test', 'env_123');
660
678
  expect(state.dnsVerified).toBeUndefined();
661
679
 
662
680
  setDnsVerification(state, 'api.example.com', '1.2.3.4');
@@ -665,7 +683,7 @@ describe('state management', () => {
665
683
  });
666
684
 
667
685
  it('should update existing verification', () => {
668
- const state = createEmptyState('production', 'env_123');
686
+ const state = createEmptyState('production', 'proj_test', 'env_123');
669
687
  state.dnsVerified = {
670
688
  'api.example.com': {
671
689
  serverIp: '1.1.1.1',
@@ -679,7 +697,7 @@ describe('state management', () => {
679
697
  });
680
698
 
681
699
  it('should generate valid ISO timestamp', () => {
682
- const state = createEmptyState('production', 'env_123');
700
+ const state = createEmptyState('production', 'proj_test', 'env_123');
683
701
 
684
702
  setDnsVerification(state, 'api.example.com', '1.2.3.4');
685
703
 
@@ -693,6 +711,7 @@ describe('state management', () => {
693
711
  const state: DokployStageState = {
694
712
  provider: 'dokploy',
695
713
  stage: 'production',
714
+ projectId: 'proj_test',
696
715
  environmentId: 'env_123',
697
716
  applications: {},
698
717
  services: {},
@@ -712,6 +731,7 @@ describe('state management', () => {
712
731
  const state: DokployStageState = {
713
732
  provider: 'dokploy',
714
733
  stage: 'production',
734
+ projectId: 'proj_test',
715
735
  environmentId: 'env_123',
716
736
  applications: {},
717
737
  services: {},
@@ -731,6 +751,7 @@ describe('state management', () => {
731
751
  const state: DokployStageState = {
732
752
  provider: 'dokploy',
733
753
  stage: 'production',
754
+ projectId: 'proj_test',
734
755
  environmentId: 'env_123',
735
756
  applications: {},
736
757
  services: {},
@@ -751,6 +772,7 @@ describe('state management', () => {
751
772
  const state: DokployStageState = {
752
773
  provider: 'dokploy',
753
774
  stage: 'production',
775
+ projectId: 'proj_test',
754
776
  environmentId: 'env_123',
755
777
  applications: {},
756
778
  services: {},
@@ -780,7 +802,7 @@ describe('state management', () => {
780
802
  });
781
803
 
782
804
  it('should return empty object when no verifications', () => {
783
- const state = createEmptyState('production', 'env_123');
805
+ const state = createEmptyState('production', 'proj_test', 'env_123');
784
806
 
785
807
  expect(getAllDnsVerifications(state)).toEqual({});
786
808
  });
@@ -795,6 +817,7 @@ describe('state management', () => {
795
817
  const state: DokployStageState = {
796
818
  provider: 'dokploy',
797
819
  stage: 'production',
820
+ projectId: 'proj_test',
798
821
  environmentId: 'env_123',
799
822
  applications: {},
800
823
  services: {},
@@ -821,6 +844,7 @@ describe('state management', () => {
821
844
  const state: DokployStageState = {
822
845
  provider: 'dokploy',
823
846
  stage: 'production',
847
+ projectId: 'proj_test',
824
848
  environmentId: 'env_123',
825
849
  applications: {},
826
850
  services: {},