flowchart TB
%% Program: transfer
start((Start))
end_node((End))
n2["repo <- AccountRepo (environment)"]
n3["audit <- AuditLog (environment)"]
n4["balance <- repo.getBalance <number, AccountNotFoundError, never> (service-call)"]
decision_6{"balance < 100"}
n7["fail <never, InsufficientFundsError, never>"]
n8["repo.debit <void, InsufficientFundsError, never> (service-call)"]
n9["repo.credit <void, AccountNotFoundError, never> (service-call)"]
n10["audit.record <void, never, never> (service-call)"]
%% Edges
n2 --> n3
n3 --> n4
decision_6 -->|yes| n7
n4 --> decision_6
n7 --> n8
decision_6 --> n8
n8 --> n9
n9 --> n10
start --> n2
n10 --> end_node
%% Styles
classDef startStyle fill:#c8e6c9,stroke:#2e7d32
classDef endStyle fill:#ffcdd2,stroke:#c62828
classDef effectStyle fill:#90EE90,stroke:#333,stroke-width:2px
classDef decisionStyle fill:#DDA0DD,stroke:#333,stroke-width:2px
class start startStyle
class end_node endStyle
class n2 effectStyle
class n3 effectStyle
class n4 effectStyle
class decision_6 decisionStyle
class n7 effectStyle
class n8 effectStyle
class n9 effectStyle
class n10 effectStyle
Click a node in the diagram to see details.
{
"root": {
"id": "effect-11",
"type": "program",
"programName": "transfer",
"source": "generator",
"discoveryConfidence": "high",
"discoveryReason": "Effect-like .gen(...) call",
"children": [
{
"id": "effect-10",
"type": "generator",
"yields": [
{
"variableName": "repo",
"effect": {
"id": "effect-1",
"type": "effect",
"callee": "AccountRepo",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 28,
"column": 23,
"endLine": 28,
"endColumn": 34,
"offset": 872,
"endOffset": 883
},
"displayName": "repo \u003c- AccountRepo",
"semanticRole": "environment"
}
},
{
"variableName": "audit",
"effect": {
"id": "effect-2",
"type": "effect",
"callee": "AuditLog",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 29,
"column": 24,
"endLine": 29,
"endColumn": 32,
"offset": 907,
"endOffset": 915
},
"displayName": "audit \u003c- AuditLog",
"semanticRole": "environment"
}
},
{
"variableName": "balance",
"effect": {
"id": "effect-3",
"type": "effect",
"callee": "repo.getBalance",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 31,
"column": 26,
"endLine": 31,
"endColumn": 57,
"offset": 942,
"endOffset": 973
},
"typeSignature": {
"successType": "number",
"errorType": "AccountNotFoundError",
"requirementsType": "never",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003cnumber, AccountNotFoundError, never\u003e"
},
"requiredServices": [],
"serviceMethod": {
"serviceId": "AccountRepo",
"methodName": "getBalance"
},
"displayName": "balance \u003c- repo.getBalance",
"semanticRole": "service-call"
}
},
{
"effect": {
"id": "effect-5",
"type": "decision",
"decisionId": "effect-6",
"label": "balance \u003c 100",
"condition": "balance \u003c 100",
"source": "raw-if",
"onTrue": [
{
"id": "effect-4",
"type": "effect",
"callee": "Effect.fail",
"description": "constructor",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 34,
"column": 12,
"endLine": 34,
"endColumn": 65,
"offset": 1009,
"endOffset": 1062
},
"typeSignature": {
"successType": "never",
"errorType": "InsufficientFundsError",
"requirementsType": "never",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003cnever, InsufficientFundsError, never\u003e"
},
"requiredServices": [],
"constructorKind": "sync",
"displayName": "fail",
"semanticRole": "constructor"
}
]
}
},
{
"effect": {
"id": "effect-7",
"type": "effect",
"callee": "repo.debit",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 37,
"column": 10,
"endLine": 37,
"endColumn": 41,
"offset": 1077,
"endOffset": 1108
},
"typeSignature": {
"successType": "void",
"errorType": "InsufficientFundsError",
"requirementsType": "never",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003cvoid, InsufficientFundsError, never\u003e"
},
"requiredServices": [],
"serviceMethod": {
"serviceId": "AccountRepo",
"methodName": "debit"
},
"displayName": "repo.debit",
"semanticRole": "service-call"
}
},
{
"effect": {
"id": "effect-8",
"type": "effect",
"callee": "repo.credit",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 38,
"column": 10,
"endLine": 38,
"endColumn": 40,
"offset": 1118,
"endOffset": 1148
},
"typeSignature": {
"successType": "void",
"errorType": "AccountNotFoundError",
"requirementsType": "never",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003cvoid, AccountNotFoundError, never\u003e"
},
"requiredServices": [],
"serviceMethod": {
"serviceId": "AccountRepo",
"methodName": "credit"
},
"displayName": "repo.credit",
"semanticRole": "service-call"
}
},
{
"effect": {
"id": "effect-9",
"type": "effect",
"callee": "audit.record",
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 39,
"column": 10,
"endLine": 39,
"endColumn": 43,
"offset": 1158,
"endOffset": 1191
},
"typeSignature": {
"successType": "void",
"errorType": "never",
"requirementsType": "never",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003cvoid, never, never\u003e"
},
"requiredServices": [],
"serviceMethod": {
"serviceId": "AuditLog",
"methodName": "record"
},
"displayName": "audit.record",
"semanticRole": "service-call"
}
}
],
"displayName": "Generator (7 yields)",
"semanticRole": "constructor"
}
],
"dependencies": [
{
"name": "AccountRepo",
"isLayer": false
},
{
"name": "AuditLog",
"isLayer": false
}
],
"errorTypes": [
"AccountNotFoundError",
"InsufficientFundsError"
],
"typeSignature": {
"successType": "{ success: boolean; amount: number; }",
"errorType": "AccountNotFoundError | InsufficientFundsError",
"requirementsType": "AccountRepo | AuditLog",
"isInferred": true,
"typeConfidence": "declared",
"rawTypeString": "import(\"/home/runner/work/effect-analyzer/effect-analyzer/node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/dts/Effect\").Effect\u003c{ success: boolean; amount: number; }, AccountNotFoundError | InsufficientFundsError, AccountRepo | AuditLog\u003e"
},
"requiredServices": [],
"location": {
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"line": 27,
"column": 25,
"endLine": 42,
"endColumn": 3,
"offset": 824,
"endOffset": 1235
}
},
"metadata": {
"analyzedAt": 1779987199352,
"filePath": "/home/runner/work/effect-analyzer/effect-analyzer/apps/docs/samples/transfer.ts",
"tsVersion": "6.0.2",
"warnings": [],
"stats": {
"totalEffects": 7,
"parallelCount": 0,
"raceCount": 0,
"errorHandlerCount": 0,
"retryCount": 0,
"timeoutCount": 0,
"resourceCount": 0,
"loopCount": 0,
"conditionalCount": 0,
"layerCount": 0,
"interruptionCount": 0,
"unknownCount": 0,
"decisionCount": 1,
"switchCount": 0,
"tryCatchCount": 0,
"terminalCount": 0,
"opaqueCount": 0
},
"serviceDefinitions": [
{
"tagId": "AccountRepo",
"methods": [
"getBalance",
"debit",
"credit"
],
"properties": []
},
{
"tagId": "AuditLog",
"methods": [
"record"
],
"properties": []
}
]
},
"references": {}
}