Skip to content

Commit

Permalink
remove more exports
Browse files Browse the repository at this point in the history
  • Loading branch information
mccraigmccraig committed Dec 18, 2023
1 parent 9cc4c60 commit 7e7bfc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/multi_chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function addChains<Tag extends MultiChainTag,
// so a MultiChain can register Service implementations for each of its
// chains, and a Service implementation for itself

export function multiChainServiceImpl
function multiChainServiceImpl
<Tag extends MultiChainTag,
const Chains extends ObjectChainList>
(multiChain: MultiChain<Tag, Chains>) {
Expand Down
11 changes: 8 additions & 3 deletions src/object_chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export function objectChainServiceImpl

// provide an implementation of the ObjectChainService for this chain
// to an Effect
export function provideObjectChainServiceImpl
function provideObjectChainServiceImpl
<Input extends ChainTagged,
const Steps extends ObjectStepSpecList,
InR, InE, InV>
Expand All @@ -245,18 +245,23 @@ export function provideObjectChainServiceImpl

// given an ObjectChain, returns an FxFn to invoke the chain,
// which retrieves the ObjectChainService for the chain, and
// calls it's buildObject function
// calls it's buildObject function. The ObjectChainService
// implementation is provided to the FxFn
export function objectChainFxFn
<Input extends ChainTagged,
const Steps extends ObjectStepSpecList>

(chain: ObjectChain<Input, Steps>) {

return (i: Input) => {
return Effect.gen(function* (_) {
const svcEff = Effect.gen(function* (_) {
const svc = yield* _(chain.contextTag)
const obj = yield* _(svc.buildObject(i))
return obj
})

const chainEff = provideObjectChainServiceImpl(svcEff, chain)

return chainEff
}
}
5 changes: 2 additions & 3 deletions src/object_chain_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as cons from "./cons_list.ts"
import {
objectChain, addStep, makeFxStep, makePureStep,
concatSteps,
objectChainFxFn, provideObjectChainServiceImpl
objectChainFxFn
} from "./object_chain.ts"
import {
Org, getOrgByNick, User, getUserByIds, sendPush,
Expand Down Expand Up @@ -250,8 +250,7 @@ Deno.test("composition with RunObjectChainFxFn", () => {
data: { org_nick: "foo", user_id: "bar" }
}
const effect = chain.program(input)
const almostRunnable = Effect.provide(effect, testServiceContext)
const runnable = provideObjectChainServiceImpl(almostRunnable, getOrgChain)
const runnable = Effect.provide(effect, testServiceContext)

const r = Effect.runSync(runnable)

Expand Down

0 comments on commit 7e7bfc3

Please sign in to comment.