@workflow/utils
Advanced tools
| export type WorkflowEnvironment = Record<string, string | undefined>; | ||
| export declare function resolveWorkflowTargetWorld(env?: WorkflowEnvironment): string; | ||
| export declare function isVercelWorldTarget(targetWorld: string): boolean; | ||
| export declare function usesVercelWorld(env?: WorkflowEnvironment): boolean; | ||
| //# sourceMappingURL=world-target.d.ts.map |
| {"version":3,"file":"world-target.d.ts","sourceRoot":"","sources":["../src/world-target.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAErE,wBAAgB,0BAA0B,CACxC,GAAG,GAAE,mBAAiC,GACrC,MAAM,CAOR;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,wBAAgB,eAAe,CAC7B,GAAG,GAAE,mBAAiC,GACrC,OAAO,CAET"} |
| export function resolveWorkflowTargetWorld(env = process.env) { | ||
| const configuredWorld = env.WORKFLOW_TARGET_WORLD; | ||
| if (configuredWorld) { | ||
| return configuredWorld; | ||
| } | ||
| return env.VERCEL_DEPLOYMENT_ID ? 'vercel' : 'local'; | ||
| } | ||
| export function isVercelWorldTarget(targetWorld) { | ||
| return targetWorld === 'vercel' || targetWorld === '@workflow/world-vercel'; | ||
| } | ||
| export function usesVercelWorld(env = process.env) { | ||
| return isVercelWorldTarget(resolveWorkflowTargetWorld(env)); | ||
| } | ||
| //# sourceMappingURL=world-target.js.map |
| {"version":3,"file":"world-target.js","sourceRoot":"","sources":["../src/world-target.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,0BAA0B,CACxC,MAA2B,OAAO,CAAC,GAAG;IAEtC,MAAM,eAAe,GAAG,GAAG,CAAC,qBAAqB,CAAC;IAClD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAmB;IACrD,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,wBAAwB,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,MAA2B,OAAO,CAAC,GAAG;IAEtC,OAAO,mBAAmB,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC"} |
+1
-0
| export { pluralize } from './pluralize.js'; | ||
| export { once, type PromiseWithResolvers, withResolvers } from './promise.js'; | ||
| export { parseDurationToDate } from './time.js'; | ||
| export { isVercelWorldTarget, resolveWorkflowTargetWorld, usesVercelWorld, } from './world-target.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,mBAAmB,CAAC"} |
+1
-0
| export { pluralize } from './pluralize.js'; | ||
| export { once, withResolvers } from './promise.js'; | ||
| export { parseDurationToDate } from './time.js'; | ||
| export { isVercelWorldTarget, resolveWorkflowTargetWorld, usesVercelWorld, } from './world-target.js'; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,mBAAmB,CAAC"} |
| /** | ||
| * Parse a workflow name into its components. | ||
| * | ||
| * @param name - The workflow name to parse. | ||
| * @returns An object with `shortName`, `path`, and `functionName` properties. | ||
| * @param name - The workflow name to parse (e.g., "workflow//./src/jobs/order//processOrder" or "workflow//mypackage@1.0.0//processOrder"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -10,3 +10,3 @@ */ | ||
| shortName: string; | ||
| path: string; | ||
| moduleSpecifier: string; | ||
| functionName: string; | ||
@@ -17,4 +17,4 @@ } | null; | ||
| * | ||
| * @param name - The step name to parse. | ||
| * @returns An object with `shortName`, `path`, and `functionName` properties. | ||
| * @param name - The step name to parse (e.g., "step//./src/jobs/order//fetchData" or "step//@myorg/tasks@2.0.0//processOrder"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -24,3 +24,3 @@ */ | ||
| shortName: string; | ||
| path: string; | ||
| moduleSpecifier: string; | ||
| functionName: string; | ||
@@ -31,4 +31,4 @@ } | null; | ||
| * | ||
| * @param name - The class ID to parse (e.g., "class//path/to/file.ts//ClassName"). | ||
| * @returns An object with `shortName`, `path`, and `functionName` (className) properties. | ||
| * @param name - The class ID to parse (e.g., "class//./src/models/Point//Point" or "class//point@0.0.1//Point"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` (className) properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -38,5 +38,5 @@ */ | ||
| shortName: string; | ||
| path: string; | ||
| moduleSpecifier: string; | ||
| functionName: string; | ||
| } | null; | ||
| //# sourceMappingURL=parse-name.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"parse-name.d.ts","sourceRoot":"","sources":["../src/parse-name.ts"],"names":[],"mappings":"AA2CA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;eA1C9B,MAAM;UAAQ,MAAM;kBAAgB,MAAM;SA4CzD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM;eArD1B,MAAM;UAAQ,MAAM;kBAAgB,MAAM;SAuDzD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM;eAhE3B,MAAM;UAAQ,MAAM;kBAAgB,MAAM;SAkEzD"} | ||
| {"version":3,"file":"parse-name.d.ts","sourceRoot":"","sources":["../src/parse-name.ts"],"names":[],"mappings":"AAyDA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;eAxD9B,MAAM;qBAAmB,MAAM;kBAAgB,MAAM;SA0DpE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM;eAnE1B,MAAM;qBAAmB,MAAM;kBAAgB,MAAM;SAqEpE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM;eA9E3B,MAAM;qBAAmB,MAAM;kBAAgB,MAAM;SAgFpE"} |
+35
-20
@@ -10,24 +10,39 @@ /** | ||
| } | ||
| // Looks like {prefix}//{filepath}//{function_name}" | ||
| // Looks like {prefix}//{moduleSpecifier}//{function_name}" | ||
| // Where: | ||
| // - {prefix} is either 'workflow' or 'step' | ||
| // - {filepath} is the path to the file | ||
| // - {function_name} is the name of the function | ||
| const [prefix, path, ...functionNameParts] = name.split('//'); | ||
| if (prefix !== tag || !path || functionNameParts.length === 0) { | ||
| // - {prefix} is either 'workflow', 'step', or 'class' | ||
| // - {moduleSpecifier} is either: | ||
| // - A module specifier (e.g., `point@0.0.1`, `@myorg/shared@1.2.3`) when provided via plugin config | ||
| // - A relative path prefixed with `./` (e.g., `./src/jobs/order`) when no specifier is provided | ||
| // - {function_name} is the name of the function (with nested functions using `/` separators) | ||
| const [prefix, moduleSpecifier, ...functionNameParts] = name.split('//'); | ||
| if (prefix !== tag || !moduleSpecifier || functionNameParts.length === 0) { | ||
| return null; | ||
| } | ||
| let shortName = functionNameParts.at(-1) ?? ''; | ||
| const functionName = functionNameParts.join('//'); | ||
| const filename = path.split('/').at(-1) ?? ''; | ||
| const fileNameWithoutExtension = filename.split('.').at(0) ?? ''; | ||
| // Default exports will use the file name as the short name. "__default" was only | ||
| // For nested functions like "processOrder/innerStep", get just "innerStep" | ||
| let shortName = functionName.split('/').at(-1) ?? ''; | ||
| // Extract a reasonable name for default exports | ||
| // For module specifiers like "point@0.0.1", use the package name "point" | ||
| // For relative paths like "./src/jobs/order", use the last segment "order" | ||
| let moduleShortName = ''; | ||
| if (moduleSpecifier.startsWith('./')) { | ||
| // Relative path: use the last path segment | ||
| moduleShortName = moduleSpecifier.split('/').at(-1) ?? ''; | ||
| } | ||
| else { | ||
| // Module specifier: extract package name (strip version and scope) | ||
| // e.g., "@myorg/shared@1.2.3" -> "shared", "point@0.0.1" -> "point" | ||
| const withoutVersion = moduleSpecifier.split('@').slice(0, -1).join('@') || | ||
| moduleSpecifier.split('@')[0]; | ||
| moduleShortName = withoutVersion?.split('/').at(-1) ?? ''; | ||
| } | ||
| // Default exports will use the module short name. "__default" was only | ||
| // used for one package version, so this is a minor backwards compatibility fix. | ||
| if (['default', '__default'].includes(shortName) && | ||
| fileNameWithoutExtension) { | ||
| shortName = fileNameWithoutExtension; | ||
| if (['default', '__default'].includes(shortName) && moduleShortName) { | ||
| shortName = moduleShortName; | ||
| } | ||
| return { | ||
| shortName, | ||
| path, | ||
| moduleSpecifier, | ||
| functionName, | ||
@@ -39,4 +54,4 @@ }; | ||
| * | ||
| * @param name - The workflow name to parse. | ||
| * @returns An object with `shortName`, `path`, and `functionName` properties. | ||
| * @param name - The workflow name to parse (e.g., "workflow//./src/jobs/order//processOrder" or "workflow//mypackage@1.0.0//processOrder"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -50,4 +65,4 @@ */ | ||
| * | ||
| * @param name - The step name to parse. | ||
| * @returns An object with `shortName`, `path`, and `functionName` properties. | ||
| * @param name - The step name to parse (e.g., "step//./src/jobs/order//fetchData" or "step//@myorg/tasks@2.0.0//processOrder"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -61,4 +76,4 @@ */ | ||
| * | ||
| * @param name - The class ID to parse (e.g., "class//path/to/file.ts//ClassName"). | ||
| * @returns An object with `shortName`, `path`, and `functionName` (className) properties. | ||
| * @param name - The class ID to parse (e.g., "class//./src/models/Point//Point" or "class//point@0.0.1//Point"). | ||
| * @returns An object with `shortName`, `moduleSpecifier`, and `functionName` (className) properties. | ||
| * When the name is invalid, returns `null`. | ||
@@ -65,0 +80,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"parse-name.js","sourceRoot":"","sources":["../src/parse-name.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,SAAS,SAAS,CAChB,GAAW,EACX,IAAY;IAEZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QA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AC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACjD,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,eAAe,GAAG,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,CAAC;IAED,uEAAuE;IACvE,gFAAgF;IAChF,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,eAAe,EAAE,CAAC;QACpE,SAAS,GAAG,eAAe,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,SAAS;QACT,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC"} |
+1
-1
| { | ||
| "name": "@workflow/utils", | ||
| "description": "Utility functions for Workflow DevKit", | ||
| "version": "4.1.0-beta.11", | ||
| "version": "4.1.0-beta.12", | ||
| "type": "module", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
61176
7.18%35
12.9%766
4.64%6
50%