Skip to content

Commit

Permalink
Merge pull request #23 from embedded-insurance/fix-deps
Browse files Browse the repository at this point in the history
fix(deps): fix package dependencies
  • Loading branch information
alex-dixon authored Jul 14, 2024
2 parents 907cdcf + a11a775 commit a5df3c4
Show file tree
Hide file tree
Showing 28 changed files with 696 additions and 445 deletions.
17 changes: 17 additions & 0 deletions .changeset/fuzzy-files-brush.md
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
4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules
nodeLinker: pnpm

npmRegistryServer: "https://registry.npmjs.org"

yarnPath: .yarn/releases/yarn-4.3.1.cjs

nmHoistingLimits: workspaces
33 changes: 17 additions & 16 deletions examples/toaster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.2",
"description": "",
"private": true,
"main": "index.js",
"main": "src/index.ts",
"scripts": {
"start": "ts-node src/index.ts",
"clean": "rimraf node_modules & rimraf dist & rimraf .turbo",
Expand All @@ -22,30 +22,31 @@
"url": "https://embeddedinsurance.com"
},
"license": "MIT",
"dependencies": {
"@diachronic/migrate": "workspace:^",
"@diachronic/util": "workspace:^",
"@diachronic/workflow": "workspace:^",
"@effect/schema": "0.67.14",
"effect": "3.2.5",
"ramda": "0.30.0",
"xstate": "5.0.0-beta.27"
},
"devDependencies": {
"@types/jest": "^29.5.2",
"@temporalio/testing": "1.8.6",
"@temporalio/worker": "1.8.6",
"@temporalio/workflow": "1.8.6",
"@types/jest": "29.5.3",
"@types/node": "20",
"@types/ramda": "^0.29.4",
"fast-check": "^3.8.1",
"@types/ramda": "0.30.0",
"fast-check": "^3.19",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"ts-node": "^10.9.1",
"turbo": "^1.10.6",
"typescript": "5.2.2",
"typescript": "5.4.5",
"webpack": "^5.88.2"
},
"dependencies": {
"@diachronic/migrate": "workspace:^",
"@diachronic/util": "workspace:^",
"@diachronic/workflow": "workspace:^",
"@effect/schema": "0.61.5",
"@temporalio/testing": "1.8.6",
"@temporalio/worker": "1.8.6",
"effect": "2.2.3",
"ramda": "0.29.0",
"xstate": "beta.27"
},
"engines": {
"node": ">=20"
},
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@changesets/cli": "2.26.1",
"@types/node": "20",
"@yarnpkg/types": "4.0.0",
"rimraf": "^5.0.1",
"ts-node": "10.9.1",
"turbo": "1.10.13",
Expand All @@ -44,7 +45,13 @@
"@temporalio/testing": "1.8.6",
"typescript": "5.4.5",
"fast-check": "^3.19",
"fastify": "4.23.2",
"mqtt": "5.0.5",
"ramda": "0.30.0",
"@types/ramda": "0.30.0",
"@types/jest": "29.5.3",
"ts-jest": "29.1.0",
"jest": "29.5.0",
"xstate": "5.0.0-beta.27"
},
"engines": {
Expand Down
17 changes: 14 additions & 3 deletions packages/activity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "@diachronic/activity",
"version": "0.0.2",
"description": "",
"main": "src/index.ts",
"main": "src/index",
"exports": {
".": "./src/index.ts",
"./*": "./src/*.ts"
},
"scripts": {
"clean": "rimraf node_modules & rimraf dist & rimraf .turbo",
"build": "tsc",
"test": "jest",
"format": "prettier --write .",
"typecheck": "tsc --noEmit"
Expand All @@ -20,14 +21,24 @@
"url": "https://embeddedinsurance.com"
},
"license": "MIT",
"dependencies": {
"@effect-use/gcp-logging": "5.0.0",
"@effect/schema": "0.67.14",
"@temporalio/activity": "1.8.6",
"@temporalio/workflow": "1.8.6",
"effect": "3.2.5",
"ramda": "0.30.0"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"@diachronic/workflow-request-response": "workspace:^",
"@types/jest": "29.5.3",
"@types/node": "20",
"@types/ramda": "0.30.0",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"ts-node": "^10.9.1",
"typescript": "5.2.2"
"typescript": "5.4.5"
},
"engines": {
"node": ">=20"
Expand Down
24 changes: 12 additions & 12 deletions packages/activity/src/activity.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { Effect } from 'effect'
import {
EffectDef,
EffectDefWith,
ErrorType,
InputType,
OutputType,
} from './single'
import { scheduleActivity, ActivityOptions } from '@temporalio/workflow'
import * as R from 'ramda'
import { asEffect, asEffectGroup } from './effect'
import { defSchema } from './multi'
import * as S from '@effect/schema/Schema'
import * as Runtime from 'effect/Runtime'
import { pipe } from 'effect/Function'
import * as Layer from 'effect/Layer'
import * as Scope from 'effect/Scope'
import * as Exit from 'effect/Exit'
import { getFailure, toApplicationFailure } from '@diachronic/workflow/errors'
import { ParseResult } from '@effect/schema'
import { TemporalLogLayer } from '@diachronic/workflow/workflow-logging'
import { defSchema } from './multi'
import type {
EffectDef,
EffectDefWith,
ErrorType,
InputType,
OutputType,
} from './single'
import { asEffect, asEffectGroup } from './effect'
import { ActivitiesLogLayer } from './logging'
import { getFailure, toApplicationFailure } from './errors'

const key = 'temporal.activity' as const
type Key = typeof key
Expand Down Expand Up @@ -302,7 +302,7 @@ export const makeActivitiesAsync: MakeActivitiesAsync = async (

export const makeActivitiesRuntime = <E, A>(
layer: Layer.Layer<A, E, Scope.Scope> | Layer.Layer<A, E>,
logLayer: Layer.Layer<never> = TemporalLogLayer('Info')
logLayer: Layer.Layer<never> = ActivitiesLogLayer('Info')
): Promise<{
runtime: Runtime.Runtime<A>
close: Effect.Effect<void>
Expand Down
65 changes: 65 additions & 0 deletions packages/activity/src/errors.ts
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)
}
20 changes: 20 additions & 0 deletions packages/activity/src/logging.ts
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))
)
6 changes: 3 additions & 3 deletions packages/activity/test/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import { implement } from '../src/fnobj'
import { Context, Effect } from 'effect'
import { validate, ValidateOptions } from '../src/validate'
import { makeWrapOther, wrap, wrapOther } from '../src/validation'
import { isSchemaError } from '@diachronic/http/client'
// import { isSchemaError } from '@diachronic/http/client'

interface MyDep1 {
mydep1: string
}

const MyDep1 = Context.GenericTag<MyDep1>("@services/MyDep1")
const MyDep1 = Context.GenericTag<MyDep1>('@services/MyDep1')

interface MyDep2 {
mydep2: string
}

const MyDep2 = Context.GenericTag<MyDep2>("@services/MyDep2")
const MyDep2 = Context.GenericTag<MyDep2>('@services/MyDep2')

describe('validate', () => {
test('works with inline wrap', () => {
Expand Down
23 changes: 16 additions & 7 deletions packages/ci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,31 @@
"@diachronic/activity": "workspace:^",
"@diachronic/feature-flag-client": "workspace:^",
"@diachronic/util": "workspace:^",
"@effect-use/temporal-client": "3.0.0",
"@temporalio/workflow": "^1.8.6",
"effect": "2.2.3",
"@diachronic/workflow": "workspace:^",
"@effect-use/temporal-client": "4.0.0",
"@effect/schema": "0.67.14",
"@temporalio/workflow": "1.8.6",
"effect": "3.2.5",
"eventemitter3": "^5.0.1",
"luxon": "3.4.3"
"luxon": "3.4.3",
"ramda": "0.30.0"
},
"devDependencies": {
"@types/jest": "^29.5.1",
"@diachronic/migrate": "workspace:^",
"@diachronic/signaler": "workspace:^",
"@diachronic/toolbox": "workspace:^",
"@temporalio/testing": "1.8.6",
"@temporalio/worker": "1.8.6",
"@types/jest": "29.5.3",
"@types/luxon": "^3.4.2",
"@types/node": "20",
"fast-check": "^3.8.1",
"@types/ramda": "0.30.0",
"fast-check": "^3.19",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"ts-node": "^10.9.1",
"typescript": "5.2.2"
"typescript": "5.4.5"
},
"engines": {
"node": ">=20"
Expand Down
12 changes: 1 addition & 11 deletions packages/ci/src/workflow-ci.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
Context,
Effect,
Exit,
Fiber,
Layer,
pipe,
Ref,
Runtime,
Unify,
} from 'effect'
import { Context, Effect, Exit, Layer, pipe, Ref, Runtime, Unify } from 'effect'
import * as R from 'ramda'
import * as wf from '@temporalio/workflow'
import { WorkflowDeployEventPayload } from './types'
Expand Down
Loading

0 comments on commit a5df3c4

Please sign in to comment.