@temporalio/common
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -6,2 +6,23 @@ # Change Log | ||
# [0.2.0](https://github.com/temporalio/sdk-node/compare/@temporalio/common@0.1.0...@temporalio/common@0.2.0) (2021-08-31) | ||
* feat!: Revise Activity setup and registration, use single tsconfig in project skeleton ([b97dd21](https://github.com/temporalio/sdk-node/commit/b97dd21aff3f5d1e5beb1fc6f4e71a04d761ac02)) | ||
### Features | ||
* Use eval-source-map devtool for improved stack traces ([c7d2361](https://github.com/temporalio/sdk-node/commit/c7d2361efb5cfaa626b5f2cd151d6c893ee1c248)) | ||
### BREAKING CHANGES | ||
* `@activities` import does not work any more. | ||
Activities registration is either done automatically with the `workDir` | ||
option or by providing `activities` to `WorkerOptions`. | ||
# 0.1.0 (2021-08-29) | ||
@@ -8,0 +29,0 @@ |
@@ -93,1 +93,5 @@ import { coresdk } from '@temporalio/proto/lib/coresdk'; | ||
} | ||
/** | ||
* Mapping of Activity name to function | ||
*/ | ||
export declare type ActivityInterface = Record<string, ActivityFunction<any[], any>>; |
@@ -35,3 +35,3 @@ "use strict"; | ||
} | ||
const encoding = types_1.str(payload.metadata[types_1.METADATA_ENCODING_KEY]); | ||
const encoding = (0, types_1.str)(payload.metadata[types_1.METADATA_ENCODING_KEY]); | ||
const converter = this.converterByEncoding.get(encoding); | ||
@@ -47,3 +47,3 @@ if (converter === undefined) { | ||
} | ||
const encoding = types_1.str(payload.metadata[types_1.METADATA_ENCODING_KEY]); | ||
const encoding = (0, types_1.str)(payload.metadata[types_1.METADATA_ENCODING_KEY]); | ||
const converter = this.converterByEncoding.get(encoding); | ||
@@ -50,0 +50,0 @@ if (converter === undefined) { |
@@ -52,3 +52,3 @@ "use strict"; | ||
}, | ||
data: types_1.u8(JSON.stringify(value)), | ||
data: (0, types_1.u8)(JSON.stringify(value)), | ||
}; | ||
@@ -60,3 +60,3 @@ } | ||
} | ||
return JSON.parse(types_1.str(content.data)); | ||
return JSON.parse((0, types_1.str)(content.data)); | ||
} | ||
@@ -63,0 +63,0 @@ } |
@@ -13,1 +13,5 @@ export declare class ValueError extends Error { | ||
} | ||
/** | ||
* Get error message from an Error or string or return undefined | ||
*/ | ||
export declare function errorMessage(err: unknown): string | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IllegalStateError = exports.DataConverterError = exports.ValueError = void 0; | ||
exports.errorMessage = exports.IllegalStateError = exports.DataConverterError = exports.ValueError = void 0; | ||
class ValueError extends Error { | ||
@@ -28,2 +28,15 @@ constructor() { | ||
exports.IllegalStateError = IllegalStateError; | ||
/** | ||
* Get error message from an Error or string or return undefined | ||
*/ | ||
function errorMessage(err) { | ||
if (typeof err === 'string') { | ||
return err; | ||
} | ||
if (err instanceof Error) { | ||
return err.message; | ||
} | ||
return undefined; | ||
} | ||
exports.errorMessage = errorMessage; | ||
//# sourceMappingURL=errors.js.map |
@@ -175,5 +175,5 @@ "use strict"; | ||
/** Activity execution */ | ||
/\s+at Activity\.execute \(.*\/worker\/(?:src|lib)\/activity.[jt]s:\d+:\d+\)/, | ||
/\s+at Activity\.execute \(.*\/worker\/(?:src|lib)\/activity\.[jt]s:\d+:\d+\)/, | ||
/** Workflow activation */ | ||
/\s+at Activator\.\S+NextHandler \(workflow-isolate:\d+:\d+\)/, | ||
/\s+at Activator\.\S+NextHandler \(webpack-internal:\/\/\/.*\/internals\.[jt]s:\d+:\d+\)/, | ||
]; | ||
@@ -325,3 +325,3 @@ /** | ||
if (failure.applicationFailureInfo) { | ||
return new ApplicationFailure(failure.message ?? undefined, failure.applicationFailureInfo.type, Boolean(failure.applicationFailureInfo.nonRetryable), await data_converter_1.arrayFromPayloads(dataConverter, failure.applicationFailureInfo.details?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
return new ApplicationFailure(failure.message ?? undefined, failure.applicationFailureInfo.type, Boolean(failure.applicationFailureInfo.nonRetryable), await (0, data_converter_1.arrayFromPayloads)(dataConverter, failure.applicationFailureInfo.details?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
} | ||
@@ -338,6 +338,6 @@ if (failure.serverFailureInfo) { | ||
if (failure.canceledFailureInfo) { | ||
return new CancelledFailure(failure.message ?? undefined, await data_converter_1.arrayFromPayloads(dataConverter, failure.canceledFailureInfo.details?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
return new CancelledFailure(failure.message ?? undefined, await (0, data_converter_1.arrayFromPayloads)(dataConverter, failure.canceledFailureInfo.details?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
} | ||
if (failure.resetWorkflowFailureInfo) { | ||
return new ApplicationFailure(failure.message ?? undefined, 'ResetWorkflow', false, await data_converter_1.arrayFromPayloads(dataConverter, failure.resetWorkflowFailureInfo.lastHeartbeatDetails?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
return new ApplicationFailure(failure.message ?? undefined, 'ResetWorkflow', false, await (0, data_converter_1.arrayFromPayloads)(dataConverter, failure.resetWorkflowFailureInfo.lastHeartbeatDetails?.payloads), await optionalFailureToOptionalError(failure.cause, dataConverter)); | ||
} | ||
@@ -344,0 +344,0 @@ if (failure.childWorkflowExecutionFailureInfo) { |
@@ -48,3 +48,3 @@ "use strict"; | ||
} | ||
return msNumberToTs(ms_1.default(str)); | ||
return msNumberToTs((0, ms_1.default)(str)); | ||
} | ||
@@ -58,3 +58,3 @@ exports.msToTs = msToTs; | ||
} | ||
return msNumberToTs(ms_1.default(str)); | ||
return msNumberToTs((0, ms_1.default)(str)); | ||
} | ||
@@ -66,5 +66,5 @@ exports.msOptionalToTs = msOptionalToTs; | ||
} | ||
return ms_1.default(val); | ||
return (0, ms_1.default)(val); | ||
} | ||
exports.msToNumber = msToNumber; | ||
//# sourceMappingURL=time.js.map |
@@ -10,5 +10,5 @@ "use strict"; | ||
...rest, | ||
workflowExecutionTimeout: workflowExecutionTimeout ? time_1.msToTs(workflowExecutionTimeout) : undefined, | ||
workflowRunTimeout: workflowRunTimeout ? time_1.msToTs(workflowRunTimeout) : undefined, | ||
workflowTaskTimeout: workflowTaskTimeout ? time_1.msToTs(workflowTaskTimeout) : undefined, | ||
workflowExecutionTimeout: workflowExecutionTimeout ? (0, time_1.msToTs)(workflowExecutionTimeout) : undefined, | ||
workflowRunTimeout: workflowRunTimeout ? (0, time_1.msToTs)(workflowRunTimeout) : undefined, | ||
workflowTaskTimeout: workflowTaskTimeout ? (0, time_1.msToTs)(workflowTaskTimeout) : undefined, | ||
}; | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "@temporalio/common", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Temporal.io SDK common library for use in Workflow and normal code", | ||
@@ -16,3 +16,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@temporalio/proto": "^0.3.0", | ||
"@temporalio/proto": "^0.3.1", | ||
"ms": "^2.1.3" | ||
@@ -27,3 +27,3 @@ }, | ||
}, | ||
"gitHead": "cd10cb4b187a6a733770502fbca32b9dcd2d2244" | ||
"gitHead": "254e9f5793afc11cb5fb64a9829b1c55190092f0" | ||
} |
@@ -106,1 +106,6 @@ import { coresdk } from '@temporalio/proto/lib/coresdk'; | ||
} | ||
/** | ||
* Mapping of Activity name to function | ||
*/ | ||
export type ActivityInterface = Record<string, ActivityFunction<any[], any>>; |
@@ -15,1 +15,14 @@ export class ValueError extends Error { | ||
} | ||
/** | ||
* Get error message from an Error or string or return undefined | ||
*/ | ||
export function errorMessage(err: unknown): string | undefined { | ||
if (typeof err === 'string') { | ||
return err; | ||
} | ||
if (err instanceof Error) { | ||
return err.message; | ||
} | ||
return undefined; | ||
} |
@@ -201,5 +201,5 @@ import { temporal } from '@temporalio/proto'; | ||
/** Activity execution */ | ||
/\s+at Activity\.execute \(.*\/worker\/(?:src|lib)\/activity.[jt]s:\d+:\d+\)/, | ||
/\s+at Activity\.execute \(.*\/worker\/(?:src|lib)\/activity\.[jt]s:\d+:\d+\)/, | ||
/** Workflow activation */ | ||
/\s+at Activator\.\S+NextHandler \(workflow-isolate:\d+:\d+\)/, | ||
/\s+at Activator\.\S+NextHandler \(webpack-internal:\/\/\/.*\/internals\.[jt]s:\d+:\d+\)/, | ||
]; | ||
@@ -206,0 +206,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194450
3313
Updated@temporalio/proto@^0.3.1