@outputai/core 0.1.7-dev.1a80bf4.0 → 0.1.7-dev.ee88974.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 +3 -3
- package/src/worker/loader.js +4 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outputai/core",
|
|
3
|
-
"version": "0.1.7-dev.
|
|
3
|
+
"version": "0.1.7-dev.ee88974.0",
|
|
4
4
|
"description": "The core module of the output framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"output-healthcheck": "./bin/healthcheck.mjs"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aws-sdk/client-s3": "3.
|
|
34
|
+
"@aws-sdk/client-s3": "3.1015.0",
|
|
35
35
|
"@babel/generator": "7.29.1",
|
|
36
36
|
"@babel/parser": "7.29.2",
|
|
37
37
|
"@babel/traverse": "7.29.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@temporalio/workflow": "1.15.0",
|
|
44
44
|
"redis": "5.11.0",
|
|
45
45
|
"stacktrace-parser": "0.1.11",
|
|
46
|
-
"undici": "7.24.
|
|
46
|
+
"undici": "7.24.5",
|
|
47
47
|
"winston": "3.19.0",
|
|
48
48
|
"zod": "4.3.6"
|
|
49
49
|
},
|
package/src/worker/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dirname, join } from 'node:path';
|
|
2
|
-
import { existsSync, mkdirSync,
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { EOL } from 'node:os';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { getTraceDestinations, sendHttpRequest } from '#internal_activities';
|
|
@@ -114,39 +114,20 @@ export async function loadWorkflows( rootDir ) {
|
|
|
114
114
|
return workflows;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
const isPackageSpecifier = specifier => !specifier.startsWith( '.' ) && !specifier.startsWith( '/' );
|
|
118
|
-
|
|
119
|
-
const readPackageJson = pkgPath => JSON.parse( readFileSync( pkgPath, 'utf8' ) );
|
|
120
|
-
|
|
121
|
-
const resolveEsmEntry = pkg => pkg.exports?.['.']?.import ?? pkg.exports?.['.']?.default ?? pkg.main ?? 'index.js';
|
|
122
|
-
|
|
123
|
-
const resolvePackagePath = ( specifier, rootDir ) => {
|
|
124
|
-
const pkgJsonPath = join( rootDir, 'node_modules', specifier, 'package.json' );
|
|
125
|
-
if ( !existsSync( pkgJsonPath ) ) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return join( rootDir, 'node_modules', specifier, resolveEsmEntry( readPackageJson( pkgJsonPath ) ) );
|
|
129
|
-
};
|
|
130
|
-
|
|
131
117
|
/**
|
|
132
118
|
* Loads the hook files from package.json's output config section.
|
|
133
119
|
*
|
|
134
120
|
* @param {string} rootDir
|
|
135
121
|
* @returns {void}
|
|
136
122
|
*/
|
|
137
|
-
const resolveHookFile = ( specifier, rootDir ) =>
|
|
138
|
-
isPackageSpecifier( specifier ) ?
|
|
139
|
-
resolvePackagePath( specifier, rootDir ) ?? join( rootDir, specifier ) :
|
|
140
|
-
join( rootDir, specifier );
|
|
141
|
-
|
|
142
123
|
export async function loadHooks( rootDir ) {
|
|
143
124
|
const packageFile = join( rootDir, 'package.json' );
|
|
144
125
|
if ( existsSync( packageFile ) ) {
|
|
145
126
|
const pkg = await import( packageFile, { with: { type: 'json' } } );
|
|
146
|
-
for ( const
|
|
147
|
-
const hookFile =
|
|
127
|
+
for ( const path of pkg.default.output?.hookFiles ?? [] ) {
|
|
128
|
+
const hookFile = join( rootDir, path );
|
|
148
129
|
await import( hookFile );
|
|
149
|
-
log.info( 'Hook file loaded', {
|
|
130
|
+
log.info( 'Hook file loaded', { path } );
|
|
150
131
|
}
|
|
151
132
|
}
|
|
152
133
|
};
|