-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from embedded-insurance/fix-deps
fix(deps): fix package dependencies
- Loading branch information
Showing
28 changed files
with
696 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"@diachronic/activity": patch | ||
"@diachronic/ci": patch | ||
"@diachronic/effect-schema-spark": patch | ||
"@diachronic/feature-flag-client": patch | ||
"@diachronic/http": patch | ||
"@diachronic/k8s-health-check": patch | ||
"@diachronic/migrate": patch | ||
"@diachronic/signaler": patch | ||
"@diachronic/toolbox": patch | ||
"@diachronic/util": patch | ||
"@diachronic/workflow-request-response": patch | ||
"@diachronic/workflow": patch | ||
"toaster": patch | ||
--- | ||
|
||
fix(deps): fix package dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Runtime } from 'effect' | ||
import { UnknownException } from 'effect/Cause' | ||
import { hasProperty } from 'effect/Predicate' | ||
import { FiberFailureCauseId } from 'effect/Runtime' | ||
import { ApplicationFailure } from '@temporalio/activity' | ||
|
||
export interface TypedError extends Error { | ||
_tag: string | ||
toJSON: () => Record<'_tag' | string, unknown> | ||
} | ||
|
||
export const TypedError = ( | ||
data: Record<'_tag' | string, unknown> | ||
): TypedError => { | ||
const e = new Error( | ||
typeof data.message === 'string' ? data.message : JSON.stringify(data) | ||
) | ||
e.name = data._tag as string | ||
Object.keys(data).forEach((k) => { | ||
if (k !== 'message') { | ||
// @ts-expect-error | ||
e[k] = data[k] | ||
} | ||
}) | ||
|
||
// This has performance cost and doesn't seem to provide a better stack trace | ||
// Error.captureStackTrace(data) | ||
|
||
// @ts-expect-error | ||
e.toJSON = () => data | ||
return e as TypedError | ||
} | ||
|
||
export const toApplicationFailure = (e: TypedError | UnknownException) => | ||
ApplicationFailure.fromError(e, { | ||
type: e._tag, | ||
message: e.message, | ||
cause: e, | ||
// @ts-expect-error | ||
nonRetryable: e.nonRetryable || false, | ||
details: [e.toJSON()], | ||
}) | ||
|
||
/** | ||
* Used for the caught value of Effect.runPromise | ||
* @param e | ||
*/ | ||
export const getFailure = (e: unknown): TypedError | UnknownException => { | ||
if ( | ||
Runtime.isFiberFailure(e) && | ||
e[FiberFailureCauseId]._tag === 'Fail' && | ||
e[FiberFailureCauseId].error | ||
) { | ||
const v = e[FiberFailureCauseId].error | ||
if (hasProperty('_tag')(v)) { | ||
if (v instanceof Error) { | ||
// @ts-expect-error | ||
return v | ||
} | ||
return TypedError(v) | ||
} | ||
return new UnknownException(v) | ||
} | ||
return new UnknownException(e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { LogEntry } from '@effect-use/gcp-logging' | ||
import { Layer, Logger, LogLevel } from 'effect' | ||
import * as Logging from '@effect-use/gcp-logging' | ||
|
||
export const defaultLogFunction = (logEntry: LogEntry) => { | ||
if (logEntry.level === 'FATAL' || logEntry.level === 'ERROR') { | ||
console.error(JSON.stringify(logEntry)) | ||
} else { | ||
console.log(JSON.stringify(logEntry)) | ||
} | ||
} | ||
|
||
export const ActivitiesLogLayer = (level: LogLevel.Literal) => | ||
Layer.provideMerge( | ||
Logger.replace( | ||
Logger.defaultLogger, | ||
Logging.customLogger(defaultLogFunction) | ||
), | ||
Logger.minimumLogLevel(LogLevel.fromLiteral(level)) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.