@output.ai/core 0.4.5 → 0.4.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/core",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,7 +18,7 @@ const addEntry = async ( entry, key ) => {
18
18
  const client = await getRedisClient();
19
19
  await client.multi()
20
20
  .zAdd( key, [ { score: entry.timestamp, value: JSON.stringify( entry ) } ], { NX: true } )
21
- .expire( key, getVars().redisIncompleteWorkflowsTTL, 'GT' )
21
+ .expire( key, getVars().redisIncompleteWorkflowsTTL )
22
22
  .exec();
23
23
  };
24
24
 
@@ -88,6 +88,20 @@ describe( 'tracing/processors/s3', () => {
88
88
  );
89
89
  } );
90
90
 
91
+ it( 'exec(): sets expiry on the redis key for each entry', async () => {
92
+ const { exec } = await import( './index.js' );
93
+ const startTime = Date.parse( '2020-01-02T03:04:05.678Z' );
94
+ const ctx = { executionContext: { workflowId: 'id1', workflowName: 'WF', startTime } };
95
+
96
+ redisMulti.exec.mockResolvedValue( [] );
97
+ zRangeMock.mockResolvedValue( [ JSON.stringify( { phase: 'start', timestamp: startTime } ) ] );
98
+
99
+ await exec( { ...ctx, entry: { phase: 'start', timestamp: startTime, parentId: 'root' } } );
100
+
101
+ expect( redisMulti.expire ).toHaveBeenCalledTimes( 1 );
102
+ expect( redisMulti.expire ).toHaveBeenCalledWith( 'traces/WF/id1', 3600 );
103
+ } );
104
+
91
105
  it( 'exec(): when buildTraceTree returns null (incomplete tree), does not upload or bust cache', async () => {
92
106
  const { exec } = await import( './index.js' );
93
107
  const startTime = Date.parse( '2020-01-02T03:04:05.678Z' );