@outputai/core 0.7.0 → 0.7.1-dev.144d64f.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.
package/package.json
CHANGED
package/src/hooks/index.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export interface WorkflowDetails {
|
|
|
85
85
|
export interface ErrorHookPayload {
|
|
86
86
|
/** UUID v4 stamped per emit. Stable per-emit idempotency key. */
|
|
87
87
|
eventId: string;
|
|
88
|
+
/** Timestamp of the event */
|
|
89
|
+
eventDate: number;
|
|
88
90
|
/** Origin of the error: workflow execution, activity execution, or runtime. */
|
|
89
91
|
source: 'workflow' | 'activity' | 'runtime';
|
|
90
92
|
/** Information about the current workflow execution */
|
|
@@ -103,6 +105,8 @@ export interface ErrorHookPayload {
|
|
|
103
105
|
export interface WorkflowStartHookPayload {
|
|
104
106
|
/** UUID v4 stamped per emit. Stable per-emit idempotency key. */
|
|
105
107
|
eventId: string;
|
|
108
|
+
/** Timestamp of the event */
|
|
109
|
+
eventDate: number;
|
|
106
110
|
/** Information about the current workflow execution */
|
|
107
111
|
workflowDetails: WorkflowDetails;
|
|
108
112
|
}
|
|
@@ -113,6 +117,8 @@ export interface WorkflowStartHookPayload {
|
|
|
113
117
|
export interface WorkflowEndHookPayload {
|
|
114
118
|
/** UUID v4 stamped per emit. Stable per-emit idempotency key. */
|
|
115
119
|
eventId: string;
|
|
120
|
+
/** Timestamp of the event */
|
|
121
|
+
eventDate: number;
|
|
116
122
|
/** Information about the current workflow execution */
|
|
117
123
|
workflowDetails: WorkflowDetails;
|
|
118
124
|
}
|
|
@@ -123,6 +129,8 @@ export interface WorkflowEndHookPayload {
|
|
|
123
129
|
export interface WorkflowErrorHookPayload {
|
|
124
130
|
/** UUID v4 stamped per emit. Stable per-emit idempotency key. */
|
|
125
131
|
eventId: string;
|
|
132
|
+
/** Timestamp of the event */
|
|
133
|
+
eventDate: number;
|
|
126
134
|
/** Information about the current workflow execution */
|
|
127
135
|
workflowDetails: WorkflowDetails;
|
|
128
136
|
/** The error thrown. */
|
|
@@ -177,6 +185,8 @@ export declare function onWorkflowError( handler: ( payload: WorkflowErrorHookPa
|
|
|
177
185
|
export interface OnHookEnvelope {
|
|
178
186
|
/** UUID v4 stamped per emit. Stable per-emit idempotency key. */
|
|
179
187
|
eventId: string;
|
|
188
|
+
/** Timestamp of the event */
|
|
189
|
+
eventDate: number;
|
|
180
190
|
/** Information about the current workflow execution */
|
|
181
191
|
workflowDetails: WorkflowDetails;
|
|
182
192
|
/** Temporal's activityInfo(). */
|
|
@@ -314,7 +314,7 @@ export const hashSourceCode = async rootDir => {
|
|
|
314
314
|
try {
|
|
315
315
|
const { hash } = await hashElement( rootDir, {
|
|
316
316
|
folders: {
|
|
317
|
-
exclude: [ '.*', 'node_modules', 'test_coverage', 'vendor', 'test' ],
|
|
317
|
+
exclude: [ '.*', 'node_modules', 'test_coverage', 'vendor', 'test', 'logs', 'dist' ],
|
|
318
318
|
ignoreRootName: true
|
|
319
319
|
},
|
|
320
320
|
files: {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
findSharedActivitiesFromWorkflows,
|
|
12
12
|
importComponents,
|
|
13
13
|
findPackageRoot,
|
|
14
|
+
hashSourceCode,
|
|
14
15
|
isPackageRoot,
|
|
15
16
|
isPathDescendentFromNodeModules,
|
|
16
17
|
resolveNodeModulesPath,
|
|
@@ -568,6 +569,41 @@ describe( 'findSharedActivitiesFromWorkflows', () => {
|
|
|
568
569
|
} );
|
|
569
570
|
} );
|
|
570
571
|
|
|
572
|
+
describe( 'hashSourceCode', () => {
|
|
573
|
+
const writeSource = root => {
|
|
574
|
+
mkdirSync( join( root, 'src' ), { recursive: true } );
|
|
575
|
+
writeFileSync( join( root, 'package.json' ), JSON.stringify( { name: 'proj' } ) );
|
|
576
|
+
writeFileSync( join( root, 'src', 'workflow.js' ), 'export default {};\n' );
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
it( 'ignores excluded folders so accumulated run logs do not change the hash', async () => {
|
|
580
|
+
const baseline = join( TEMP_BASE, `hash-baseline-${Date.now()}` );
|
|
581
|
+
const withCruft = join( TEMP_BASE, `hash-cruft-${Date.now()}` );
|
|
582
|
+
writeSource( baseline );
|
|
583
|
+
writeSource( withCruft );
|
|
584
|
+
|
|
585
|
+
// The cruft tree is identical source plus large excluded artifacts that
|
|
586
|
+
// boot must not walk: local trace dumps under logs/ and build output under dist/.
|
|
587
|
+
for ( const excluded of [ 'logs', 'logs/runs', 'dist', 'node_modules' ] ) {
|
|
588
|
+
const dir = join( withCruft, excluded );
|
|
589
|
+
mkdirSync( dir, { recursive: true } );
|
|
590
|
+
writeFileSync( join( dir, 'dump.json' ), JSON.stringify( { blob: 'x'.repeat( 50_000 ) } ) );
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
expect( await hashSourceCode( withCruft ) ).toBe( await hashSourceCode( baseline ) );
|
|
594
|
+
} );
|
|
595
|
+
|
|
596
|
+
it( 'changes the hash when actual source changes', async () => {
|
|
597
|
+
const before = join( TEMP_BASE, `hash-src-before-${Date.now()}` );
|
|
598
|
+
const after = join( TEMP_BASE, `hash-src-after-${Date.now()}` );
|
|
599
|
+
writeSource( before );
|
|
600
|
+
writeSource( after );
|
|
601
|
+
writeFileSync( join( after, 'src', 'workflow.js' ), 'export default { changed: true };\n' );
|
|
602
|
+
|
|
603
|
+
expect( await hashSourceCode( after ) ).not.toBe( await hashSourceCode( before ) );
|
|
604
|
+
} );
|
|
605
|
+
} );
|
|
606
|
+
|
|
571
607
|
describe( 'staticMatchers', () => {
|
|
572
608
|
describe( 'workflowFile', () => {
|
|
573
609
|
it( 'matches paths ending with path separator and workflow.js', () => {
|