@lightdash/cli 0.3396.0 → 0.3398.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.
@@ -228,7 +228,7 @@ const createDurableCredential = async (authorizationCodeCredentials, warehouseCl
228
228
  }
229
229
  }
230
230
  try {
231
- const { tokenSecret } = await warehouseClient.createProgrammaticAccessToken('LIGHTDASH_ONBOARDING', PAT_EXPIRY_DAYS, PAT_NETWORK_POLICY_BYPASS_MINUTES);
231
+ const { tokenSecret } = await warehouseClient.createProgrammaticAccessToken(`LIGHTDASH_ONBOARDING_${Date.now()}`, PAT_EXPIRY_DAYS, PAT_NETWORK_POLICY_BYPASS_MINUTES);
232
232
  const expiresAt = new Date(dependencies.now().getTime() +
233
233
  PAT_EXPIRY_DAYS * 24 * 60 * 60 * 1000);
234
234
  return {
@@ -144,7 +144,7 @@ describe('connectSnowflakeHandler', () => {
144
144
  vi.mocked(setUserPublicKey).mockResolvedValue(undefined);
145
145
  vi.mocked(unsetUserPublicKey).mockResolvedValue(undefined);
146
146
  vi.mocked(createProgrammaticAccessToken).mockResolvedValue({
147
- tokenName: 'LIGHTDASH_ONBOARDING',
147
+ tokenName: 'LIGHTDASH_ONBOARDING_1234567890',
148
148
  tokenSecret: 'pat-secret',
149
149
  });
150
150
  vi.mocked(openDiagnosticConnection).mockResolvedValue({
@@ -280,14 +280,14 @@ describe('connectSnowflakeHandler', () => {
280
280
  expect(setUserPublicKey).toHaveBeenCalledWith(discovery.user, 'RSA_PUBLIC_KEY_2', publicKey);
281
281
  expect(createProgrammaticAccessToken).not.toHaveBeenCalled();
282
282
  });
283
- it('uses the stable PAT name for collision replacement when both key slots are occupied', async () => {
283
+ it('uses a unique PAT name when both key slots are occupied', async () => {
284
284
  vi.mocked(getUserPublicKeySlots).mockResolvedValue({
285
285
  RSA_PUBLIC_KEY: 'SHA256:existing-key-1',
286
286
  RSA_PUBLIC_KEY_2: 'SHA256:existing-key-2',
287
287
  });
288
288
  await expect((0, connectSnowflake_1.connectSnowflakeHandler)(options, getDependencies())).resolves.toBeUndefined();
289
289
  expect(setUserPublicKey).not.toHaveBeenCalled();
290
- expect(createProgrammaticAccessToken).toHaveBeenCalledWith('LIGHTDASH_ONBOARDING', 365, 1440);
290
+ expect(createProgrammaticAccessToken).toHaveBeenCalledWith(expect.stringMatching(/^LIGHTDASH_ONBOARDING_\d+$/), 365, 1440);
291
291
  const request = {
292
292
  code: options.code,
293
293
  credentials: {
@@ -317,7 +317,7 @@ describe('connectSnowflakeHandler', () => {
317
317
  it('falls back to a PAT when key registration lacks privileges', async () => {
318
318
  vi.mocked(setUserPublicKey).mockRejectedValue(new Error('Insufficient privileges to operate on user'));
319
319
  await expect((0, connectSnowflake_1.connectSnowflakeHandler)(options, getDependencies())).resolves.toBeUndefined();
320
- expect(createProgrammaticAccessToken).toHaveBeenCalledWith('LIGHTDASH_ONBOARDING', 365, 1440);
320
+ expect(createProgrammaticAccessToken).toHaveBeenCalledWith(expect.stringMatching(/^LIGHTDASH_ONBOARDING_\d+$/), 365, 1440);
321
321
  expect(write).toHaveBeenCalledWith('Secured with a programmatic access token (expires 2027-07-14)');
322
322
  });
323
323
  it('prints administrator remediation when both durable paths fail', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "0.3396.0",
3
+ "version": "0.3398.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "unique-names-generator": "4.7.1",
42
42
  "uuid": "11.1.1",
43
43
  "yaml": "2.8.3",
44
- "@lightdash/warehouses": "0.3396.0",
45
- "@lightdash/common": "0.3396.0"
44
+ "@lightdash/common": "0.3398.0",
45
+ "@lightdash/warehouses": "0.3398.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/inquirer": "8.2.4",