@output.ai/core 0.0.12 → 0.0.13
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 +1 -1
- package/src/configs.js +2 -2
- package/src/configs.spec.js +4 -4
- package/src/internal_activities/index.js +14 -2
package/package.json
CHANGED
package/src/configs.js
CHANGED
|
@@ -8,12 +8,12 @@ const envVarSchema = z.object( {
|
|
|
8
8
|
TEMPORAL_API_KEY: z.string().optional(),
|
|
9
9
|
CATALOG_ID: z.string().regex( /^[a-z0-9_.@-]+$/i ),
|
|
10
10
|
API_AUTH_KEY: z.string().optional(),
|
|
11
|
-
TRACING_ENABLED: z.
|
|
11
|
+
TRACING_ENABLED: z.stringbool().optional()
|
|
12
12
|
} );
|
|
13
13
|
|
|
14
14
|
const { data: safeEnvVar, error } = envVarSchema.safeParse( process.env );
|
|
15
15
|
if ( error ) {
|
|
16
|
-
throw new InvalidEnvVarsErrors(
|
|
16
|
+
throw new InvalidEnvVarsErrors( z.prettifyError( error ) );
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const worker = {
|
package/src/configs.spec.js
CHANGED
|
@@ -190,7 +190,7 @@ describe( 'configs', () => {
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
const { tracing } = await import( './configs.js' );
|
|
193
|
-
expect( tracing.enabled ).toBe(
|
|
193
|
+
expect( tracing.enabled ).toBe( true );
|
|
194
194
|
} );
|
|
195
195
|
|
|
196
196
|
it( 'should handle TRACING_ENABLED when false', async () => {
|
|
@@ -201,7 +201,7 @@ describe( 'configs', () => {
|
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
const { tracing } = await import( './configs.js' );
|
|
204
|
-
expect( tracing.enabled ).toBe(
|
|
204
|
+
expect( tracing.enabled ).toBe( false );
|
|
205
205
|
} );
|
|
206
206
|
|
|
207
207
|
it( 'should handle missing TRACING_ENABLED', async () => {
|
|
@@ -263,7 +263,7 @@ describe( 'configs', () => {
|
|
|
263
263
|
const { tracing } = await import( './configs.js' );
|
|
264
264
|
|
|
265
265
|
expect( tracing ).toEqual( {
|
|
266
|
-
enabled:
|
|
266
|
+
enabled: true
|
|
267
267
|
} );
|
|
268
268
|
} );
|
|
269
269
|
|
|
@@ -373,7 +373,7 @@ describe( 'configs', () => {
|
|
|
373
373
|
expect( worker.catalogId ).toBe( 'prod.catalog@v1' );
|
|
374
374
|
expect( worker.taskQueue ).toBe( 'prod.catalog@v1' );
|
|
375
375
|
expect( api.authKey ).toBe( 'secure-auth-key' );
|
|
376
|
-
expect( tracing.enabled ).toBe(
|
|
376
|
+
expect( tracing.enabled ).toBe( true );
|
|
377
377
|
} );
|
|
378
378
|
} );
|
|
379
379
|
} );
|
|
@@ -48,8 +48,20 @@ export const sendWebhookPost = async ( { url, workflowId, payload } ) => {
|
|
|
48
48
|
*/
|
|
49
49
|
export const readTraceFile = async ( { workflowType, workflowId } ) => {
|
|
50
50
|
const dir = join( callerDir, 'logs', 'runs', workflowType );
|
|
51
|
+
|
|
52
|
+
if ( !existsSync( dir ) ) {
|
|
53
|
+
console.log( '[Core.ReadTraceFile]', 'Trace folder not found', dir );
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
const suffix = `-${workflowId}.raw`;
|
|
52
|
-
const
|
|
58
|
+
const matchingFile = readdirSync( dir ).find( f => f.endsWith( suffix ) );
|
|
59
|
+
|
|
60
|
+
if ( !matchingFile ) {
|
|
61
|
+
console.log( '[Core.ReadTraceFile]', 'Trace file not found', dir, suffix );
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
const file = join( dir, matchingFile );
|
|
66
|
+
return existsSync( file ) ? readFileSync( file, 'utf-8' ).split( '\n' ) : [];
|
|
55
67
|
};
|