@outputai/credentials 0.5.3-next.bdf47aa.0 → 0.6.1-dev.aab2335.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.
@@ -38,8 +38,8 @@ const getWorkflowContext = () => {
38
38
  return { workflowName: undefined, workflowDir: undefined };
39
39
  }
40
40
  return {
41
- workflowName: ctx.workflow.name,
42
- workflowDir: dirname(ctx.workflow.filename)
41
+ workflowName: ctx.activityInfo.workflowType,
42
+ workflowDir: dirname(ctx.workflowFilename)
43
43
  };
44
44
  };
45
45
  const load = () => {
@@ -33,6 +33,10 @@ const loadCredentials = async () => {
33
33
  const mod = await import('./index.js');
34
34
  return mod.credentials;
35
35
  };
36
+ const activityContext = (workflowType, workflowFilename) => ({
37
+ activityInfo: { workflowType },
38
+ workflowFilename
39
+ });
36
40
  describe('credentials module', () => {
37
41
  const key = generateKey();
38
42
  const ciphertext = encrypt(YAML_CONTENT, key);
@@ -242,7 +246,7 @@ describe('credentials module', () => {
242
246
  path.includes('/workflows/my_workflow/credentials.key')
243
247
  }));
244
248
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
245
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'my_workflow', filename: '/app/src/workflows/my_workflow/workflow.ts' } })
249
+ getExecutionContext: () => activityContext('my_workflow', '/app/src/workflows/my_workflow/workflow.ts')
246
250
  }));
247
251
  const credentials = await loadCredentials();
248
252
  expect(credentials.get('anthropic.api_key')).toBe('sk-ant-workflow');
@@ -256,7 +260,7 @@ describe('credentials module', () => {
256
260
  existsSync: (path) => path.endsWith('credentials.yml.enc') && !path.includes('/workflows/')
257
261
  }));
258
262
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
259
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'simple', filename: '/app/src/workflows/simple/workflow.ts' } })
263
+ getExecutionContext: () => activityContext('simple', '/app/src/workflows/simple/workflow.ts')
260
264
  }));
261
265
  const credentials = await loadCredentials();
262
266
  expect(credentials.get('anthropic.api_key')).toBe('sk-ant-test');
@@ -279,7 +283,7 @@ describe('credentials module', () => {
279
283
  }
280
284
  }));
281
285
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
282
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'my_workflow', filename: '/app/src/workflows/my_workflow/workflow.ts' } })
286
+ getExecutionContext: () => activityContext('my_workflow', '/app/src/workflows/my_workflow/workflow.ts')
283
287
  }));
284
288
  const credentials = await loadCredentials();
285
289
  expect(credentials.get('stripe.secret_key')).toBe('sk-stripe-wf');
@@ -297,7 +301,7 @@ describe('credentials module', () => {
297
301
  existsSync: (path) => path.endsWith('credentials.yml.enc')
298
302
  }));
299
303
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
300
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'my_workflow', filename: '/app/src/workflows/my_workflow/workflow.ts' } })
304
+ getExecutionContext: () => activityContext('my_workflow', '/app/src/workflows/my_workflow/workflow.ts')
301
305
  }));
302
306
  const credentials = await loadCredentials();
303
307
  expect(credentials.get('stripe.secret_key')).toBe('sk-stripe-wf');
@@ -318,16 +322,19 @@ describe('credentials module', () => {
318
322
  },
319
323
  existsSync: (path) => path.endsWith('credentials.yml.enc')
320
324
  }));
321
- const ctx = { name: undefined, filename: undefined };
325
+ const ctx = {
326
+ workflowType: undefined,
327
+ workflowFilename: undefined
328
+ };
322
329
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
323
- getExecutionContext: () => ctx.name ? { workflow: { id: 'test-id', name: ctx.name, filename: ctx.filename } } : null
330
+ getExecutionContext: () => ctx.workflowType && ctx.workflowFilename ? activityContext(ctx.workflowType, ctx.workflowFilename) : null
324
331
  }));
325
332
  const credentials = await loadCredentials();
326
- ctx.name = 'workflow_a';
327
- ctx.filename = '/app/src/workflows/workflow_a/workflow.ts';
333
+ ctx.workflowType = 'workflow_a';
334
+ ctx.workflowFilename = '/app/src/workflows/workflow_a/workflow.ts';
328
335
  expect(credentials.get('custom.value')).toBe('wf-a');
329
- ctx.name = 'workflow_b';
330
- ctx.filename = '/app/src/workflows/workflow_b/workflow.ts';
336
+ ctx.workflowType = 'workflow_b';
337
+ ctx.workflowFilename = '/app/src/workflows/workflow_b/workflow.ts';
331
338
  expect(credentials.get('custom.value')).toBe('other-wf');
332
339
  });
333
340
  it('should use global credentials when outside activity context', async () => {
@@ -350,7 +357,7 @@ describe('credentials module', () => {
350
357
  existsSync: (path) => path.endsWith('credentials.yml.enc') && !path.includes('/workflows/')
351
358
  }));
352
359
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
353
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'test_wf', filename: '/app/src/workflows/test_wf/workflow.ts' } })
360
+ getExecutionContext: () => activityContext('test_wf', '/app/src/workflows/test_wf/workflow.ts')
354
361
  }));
355
362
  const credentials = await loadCredentials();
356
363
  credentials.get('anthropic.api_key');
@@ -444,7 +451,7 @@ describe('credentials module', () => {
444
451
  encryptedYamlProvider: customProvider
445
452
  }));
446
453
  vi.doMock('@outputai/core/sdk_activity_integration', () => ({
447
- getExecutionContext: () => ({ workflow: { id: 'test-id', name: 'test', filename: '/app/workflows/test/workflow.ts' } })
454
+ getExecutionContext: () => activityContext('test', '/app/workflows/test/workflow.ts')
448
455
  }));
449
456
  const credentials = await loadCredentials();
450
457
  expect(credentials.get('shared')).toBe('global');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/credentials",
3
- "version": "0.5.3-next.bdf47aa.0",
3
+ "version": "0.6.1-dev.aab2335.0",
4
4
  "description": "Encrypted credentials management for Output.ai workflows",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@noble/ciphers": "2.2.0",
21
21
  "js-yaml": "4.1.1",
22
- "@outputai/core": "0.5.3-next.bdf47aa.0"
22
+ "@outputai/core": "0.6.1-dev.aab2335.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/js-yaml": "4.0.9"