@0xsequence/catapult 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/lib/__tests__/network-loader.spec.js.map +1 -1
- package/dist/lib/core/__tests__/resolver.spec.js +22 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js +128 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.js +40 -0
- package/dist/lib/core/__tests__/signer.spec.js.map +1 -0
- package/dist/lib/core/context.d.ts +3 -2
- package/dist/lib/core/context.d.ts.map +1 -1
- package/dist/lib/core/context.js +3 -2
- package/dist/lib/core/context.js.map +1 -1
- package/dist/lib/core/engine.d.ts +4 -0
- package/dist/lib/core/engine.d.ts.map +1 -1
- package/dist/lib/core/engine.js +173 -0
- package/dist/lib/core/engine.js.map +1 -1
- package/dist/lib/core/signer.d.ts +7 -0
- package/dist/lib/core/signer.d.ts.map +1 -0
- package/dist/lib/core/signer.js +60 -0
- package/dist/lib/core/signer.js.map +1 -0
- package/dist/lib/parsers/__tests__/source.spec.js +37 -0
- package/dist/lib/parsers/__tests__/source.spec.js.map +1 -1
- package/dist/lib/parsers/source.js +1 -1
- package/dist/lib/parsers/source.js.map +1 -1
- package/dist/lib/provenance.js +51 -2
- package/dist/lib/provenance.js.map +1 -1
- package/dist/lib/types/actions.d.ts +26 -2
- package/dist/lib/types/actions.d.ts.map +1 -1
- package/dist/lib/types/actions.js +3 -0
- package/dist/lib/types/actions.js.map +1 -1
- package/dist/lib/types/source.d.ts +2 -0
- package/dist/lib/types/source.d.ts.map +1 -1
- package/package.json +4 -1
- package/.eslintrc.json +0 -29
- package/.github/workflows/ci.yml +0 -181
- package/CONCEPT.md +0 -24
- package/contracts/checked-call.huff +0 -65
- package/eslint.config.js +0 -48
- package/examples/jobs/guards-v1.yaml +0 -17
- package/examples/jobs/sequence-seq-0001-patch.yaml +0 -59
- package/examples/jobs/sequence-v1.yaml +0 -59
- package/examples/templates/sequence-factory-v1.yaml +0 -56
- package/jest.config.js +0 -25
- package/src/cli.ts +0 -18
- package/src/commands/common.ts +0 -61
- package/src/commands/dry.ts +0 -209
- package/src/commands/etherscan.ts +0 -360
- package/src/commands/index.ts +0 -6
- package/src/commands/list.ts +0 -262
- package/src/commands/provenance.ts +0 -120
- package/src/commands/run.ts +0 -146
- package/src/commands/utils.ts +0 -215
- package/src/index.ts +0 -67
- package/src/lib/__tests__/deployer-events.spec.ts +0 -338
- package/src/lib/__tests__/deployer.spec.ts +0 -2269
- package/src/lib/__tests__/network-loader.spec.ts +0 -150
- package/src/lib/__tests__/network-selection.spec.ts +0 -41
- package/src/lib/__tests__/network-utils.spec.ts +0 -230
- package/src/lib/__tests__/provenance.spec.ts +0 -208
- package/src/lib/artifacts/__tests__/fixtures/contract1.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/contract2.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +0 -18
- package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +0 -8
- package/src/lib/artifacts/__tests__/fixtures/readme.txt +0 -2
- package/src/lib/contracts/__tests__/repository.spec.ts +0 -612
- package/src/lib/contracts/repository.ts +0 -411
- package/src/lib/core/__tests__/assert-action.spec.ts +0 -474
- package/src/lib/core/__tests__/context.spec.ts +0 -37
- package/src/lib/core/__tests__/engine.spec.ts +0 -2005
- package/src/lib/core/__tests__/graph.spec.ts +0 -125
- package/src/lib/core/__tests__/json-integration.spec.ts +0 -425
- package/src/lib/core/__tests__/loader.spec.ts +0 -367
- package/src/lib/core/__tests__/multi-platform-verification.spec.ts +0 -406
- package/src/lib/core/__tests__/resolver.spec.ts +0 -2496
- package/src/lib/core/__tests__/static-action.spec.ts +0 -172
- package/src/lib/core/context.ts +0 -127
- package/src/lib/core/engine.ts +0 -1834
- package/src/lib/core/graph.ts +0 -252
- package/src/lib/core/loader.ts +0 -253
- package/src/lib/core/resolver.ts +0 -873
- package/src/lib/deployer.ts +0 -1005
- package/src/lib/events/__tests__/event-system.spec.ts +0 -392
- package/src/lib/events/cli-adapter.ts +0 -369
- package/src/lib/events/emitter.ts +0 -62
- package/src/lib/events/index.ts +0 -3
- package/src/lib/events/types.ts +0 -520
- package/src/lib/index.ts +0 -17
- package/src/lib/network-loader.ts +0 -90
- package/src/lib/network-selection.ts +0 -73
- package/src/lib/network-utils.ts +0 -64
- package/src/lib/parsers/__tests__/buildinfo.spec.ts +0 -122
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +0 -62
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +0 -2
- package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +0 -89
- package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +0 -17
- package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +0 -63
- package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +0 -4
- package/src/lib/parsers/__tests__/job.spec.ts +0 -439
- package/src/lib/parsers/__tests__/source.spec.ts +0 -134
- package/src/lib/parsers/__tests__/template.spec.ts +0 -111
- package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +0 -117
- package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +0 -67
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +0 -4
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +0 -40
- package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +0 -7
- package/src/lib/parsers/artifact/foundry-1.2.ts +0 -72
- package/src/lib/parsers/artifact/index.ts +0 -27
- package/src/lib/parsers/artifact/types.ts +0 -9
- package/src/lib/parsers/buildinfo.ts +0 -127
- package/src/lib/parsers/constants.ts +0 -56
- package/src/lib/parsers/index.ts +0 -6
- package/src/lib/parsers/job.ts +0 -160
- package/src/lib/parsers/source.ts +0 -129
- package/src/lib/parsers/template.ts +0 -135
- package/src/lib/provenance.ts +0 -785
- package/src/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +0 -68
- package/src/lib/std/templates/assured-deployment.yaml +0 -46
- package/src/lib/std/templates/era-evm-predeploy.yaml +0 -35
- package/src/lib/std/templates/erc-2470.yaml +0 -70
- package/src/lib/std/templates/min-balance.yaml +0 -35
- package/src/lib/std/templates/nano-universal-deployer.yaml +0 -61
- package/src/lib/std/templates/raw-erc-2470.yaml +0 -62
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +0 -54
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +0 -52
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +0 -61
- package/src/lib/types/__tests__/json-request-action.spec.ts +0 -243
- package/src/lib/types/__tests__/read-json-value.spec.ts +0 -278
- package/src/lib/types/__tests__/resolve-json-value.spec.ts +0 -769
- package/src/lib/types/actions.ts +0 -148
- package/src/lib/types/artifacts.ts +0 -21
- package/src/lib/types/buildinfo.ts +0 -116
- package/src/lib/types/conditions.ts +0 -50
- package/src/lib/types/contracts.ts +0 -26
- package/src/lib/types/definitions.ts +0 -77
- package/src/lib/types/index.ts +0 -9
- package/src/lib/types/network.ts +0 -33
- package/src/lib/types/project.ts +0 -9
- package/src/lib/types/source.ts +0 -26
- package/src/lib/types/task.ts +0 -9
- package/src/lib/types/values.ts +0 -221
- package/src/lib/utils/assertion.ts +0 -24
- package/src/lib/utils/validation.ts +0 -116
- package/src/lib/validation/contract-references.ts +0 -210
- package/src/lib/validation/index.ts +0 -1
- package/src/lib/verification/__tests__/etherscan.spec.ts +0 -710
- package/src/lib/verification/__tests__/sourcify.spec.ts +0 -288
- package/src/lib/verification/etherscan.ts +0 -547
- package/src/lib/verification/sourcify.ts +0 -248
- package/test_validation/artifacts/TestContract.json +0 -9
- package/test_validation/jobs/test-missing.yaml +0 -16
- package/test_validation/networks.yaml +0 -3
- package/tsconfig.json +0 -36
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { ExecutionEngine } from '../engine'
|
|
2
|
-
import { ExecutionContext } from '../context'
|
|
3
|
-
import { ContractRepository } from '../../contracts/repository'
|
|
4
|
-
import { Action, Network } from '../../types'
|
|
5
|
-
import { VerificationPlatformRegistry } from '../../verification/etherscan'
|
|
6
|
-
|
|
7
|
-
describe('Static Action', () => {
|
|
8
|
-
let engine: ExecutionEngine
|
|
9
|
-
let context: ExecutionContext
|
|
10
|
-
let mockNetwork: Network
|
|
11
|
-
let mockRegistry: ContractRepository
|
|
12
|
-
let templates: Map<string, any>
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
mockNetwork = { name: 'testnet', chainId: 999, rpcUrl: 'http://localhost:8545' }
|
|
16
|
-
mockRegistry = new ContractRepository()
|
|
17
|
-
|
|
18
|
-
// Create a mock context that doesn't require a real connection
|
|
19
|
-
context = {
|
|
20
|
-
getNetwork: () => mockNetwork,
|
|
21
|
-
setOutput: jest.fn(),
|
|
22
|
-
getOutput: jest.fn(),
|
|
23
|
-
setContextPath: jest.fn(),
|
|
24
|
-
getContextPath: jest.fn(),
|
|
25
|
-
dispose: jest.fn()
|
|
26
|
-
} as any
|
|
27
|
-
|
|
28
|
-
templates = new Map()
|
|
29
|
-
const verificationRegistry = new VerificationPlatformRegistry()
|
|
30
|
-
engine = new ExecutionEngine(templates, { verificationRegistry })
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
describe('static primitive action', () => {
|
|
34
|
-
it('should store the provided value unchanged', async () => {
|
|
35
|
-
const action: Action = {
|
|
36
|
-
type: 'static',
|
|
37
|
-
name: 'test-static',
|
|
38
|
-
arguments: {
|
|
39
|
-
value: 'hello world'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
44
|
-
|
|
45
|
-
expect(context.setOutput).toHaveBeenCalledWith('test-static.value', 'hello world')
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('should work with numeric values', async () => {
|
|
49
|
-
const action: Action = {
|
|
50
|
-
type: 'static',
|
|
51
|
-
name: 'numeric-static',
|
|
52
|
-
arguments: {
|
|
53
|
-
value: 42
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
58
|
-
|
|
59
|
-
expect(context.setOutput).toHaveBeenCalledWith('numeric-static.value', 42)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('should work with boolean values', async () => {
|
|
63
|
-
const action: Action = {
|
|
64
|
-
type: 'static',
|
|
65
|
-
name: 'boolean-static',
|
|
66
|
-
arguments: {
|
|
67
|
-
value: true
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
72
|
-
|
|
73
|
-
expect(context.setOutput).toHaveBeenCalledWith('boolean-static.value', true)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('should work with object values', async () => {
|
|
77
|
-
const testObject = { foo: 'bar', number: 123 }
|
|
78
|
-
|
|
79
|
-
// Mock the resolver to return the object unchanged
|
|
80
|
-
const mockResolver = {
|
|
81
|
-
resolve: jest.fn().mockResolvedValue(testObject)
|
|
82
|
-
}
|
|
83
|
-
;(engine as any).resolver = mockResolver
|
|
84
|
-
|
|
85
|
-
const action: Action = {
|
|
86
|
-
type: 'static',
|
|
87
|
-
name: 'object-static',
|
|
88
|
-
arguments: {
|
|
89
|
-
value: testObject
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
94
|
-
|
|
95
|
-
expect(mockResolver.resolve).toHaveBeenCalledWith(testObject, context, new Map())
|
|
96
|
-
expect(context.setOutput).toHaveBeenCalledWith('object-static.value', testObject)
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
it('should work with array values', async () => {
|
|
100
|
-
const testArray = [1, 2, 3, 'test']
|
|
101
|
-
const action: Action = {
|
|
102
|
-
type: 'static',
|
|
103
|
-
name: 'array-static',
|
|
104
|
-
arguments: {
|
|
105
|
-
value: testArray
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
110
|
-
|
|
111
|
-
expect(context.setOutput).toHaveBeenCalledWith('array-static.value', testArray)
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
it('should not store outputs when action has no name', async () => {
|
|
115
|
-
const action: Action = {
|
|
116
|
-
type: 'static',
|
|
117
|
-
arguments: {
|
|
118
|
-
value: 'test value'
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
123
|
-
|
|
124
|
-
expect(context.setOutput).not.toHaveBeenCalled()
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('should resolve template variables from context', async () => {
|
|
128
|
-
// Mock the resolver to simulate variable resolution
|
|
129
|
-
const mockResolver = {
|
|
130
|
-
resolve: jest.fn().mockResolvedValue('resolved value')
|
|
131
|
-
}
|
|
132
|
-
;(engine as any).resolver = mockResolver
|
|
133
|
-
|
|
134
|
-
const action: Action = {
|
|
135
|
-
type: 'static',
|
|
136
|
-
name: 'resolved-static',
|
|
137
|
-
arguments: {
|
|
138
|
-
value: '{{some_variable}}'
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
await (engine as any).executePrimitive(action, context, new Map())
|
|
143
|
-
|
|
144
|
-
expect(mockResolver.resolve).toHaveBeenCalledWith('{{some_variable}}', context, new Map())
|
|
145
|
-
expect(context.setOutput).toHaveBeenCalledWith('resolved-static.value', 'resolved value')
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
it('should resolve template variables from scope', async () => {
|
|
149
|
-
const scope = new Map()
|
|
150
|
-
scope.set('template_var', 'scope value')
|
|
151
|
-
|
|
152
|
-
// Mock the resolver to return the scope value
|
|
153
|
-
const mockResolver = {
|
|
154
|
-
resolve: jest.fn().mockResolvedValue('scope value')
|
|
155
|
-
}
|
|
156
|
-
;(engine as any).resolver = mockResolver
|
|
157
|
-
|
|
158
|
-
const action: Action = {
|
|
159
|
-
type: 'static',
|
|
160
|
-
name: 'scope-static',
|
|
161
|
-
arguments: {
|
|
162
|
-
value: '{{template_var}}'
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
await (engine as any).executePrimitive(action, context, scope)
|
|
167
|
-
|
|
168
|
-
expect(mockResolver.resolve).toHaveBeenCalledWith('{{template_var}}', context, scope)
|
|
169
|
-
expect(context.setOutput).toHaveBeenCalledWith('scope-static.value', 'scope value')
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
})
|
package/src/lib/core/context.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers'
|
|
2
|
-
import { Network } from '../types'
|
|
3
|
-
import { ContractRepository } from '../contracts/repository'
|
|
4
|
-
|
|
5
|
-
export class ExecutionContext {
|
|
6
|
-
public readonly provider: ethers.JsonRpcProvider
|
|
7
|
-
public readonly signer: ethers.Signer | Promise<ethers.Signer> // Allow Promise for implicit signer
|
|
8
|
-
public readonly contractRepository: ContractRepository
|
|
9
|
-
private outputs: Map<string, any> = new Map()
|
|
10
|
-
private network: Network
|
|
11
|
-
private etherscanApiKey?: string
|
|
12
|
-
private currentContextPath?: string
|
|
13
|
-
private resolvedSigner?: ethers.Signer // Cache for resolved signer
|
|
14
|
-
|
|
15
|
-
// Constants registries
|
|
16
|
-
private topLevelConstants: Map<string, any> = new Map()
|
|
17
|
-
private jobConstants: Map<string, any> = new Map()
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
network: Network,
|
|
21
|
-
privateKey: string | undefined, // Make privateKey optional
|
|
22
|
-
contractRepository: ContractRepository,
|
|
23
|
-
etherscanApiKey?: string,
|
|
24
|
-
topLevelConstants?: Map<string, any>
|
|
25
|
-
) {
|
|
26
|
-
this.network = network
|
|
27
|
-
this.provider = new ethers.JsonRpcProvider(network.rpcUrl)
|
|
28
|
-
this.contractRepository = contractRepository
|
|
29
|
-
this.etherscanApiKey = etherscanApiKey
|
|
30
|
-
if (topLevelConstants) {
|
|
31
|
-
this.topLevelConstants = new Map(topLevelConstants)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Determine the signer
|
|
35
|
-
if (privateKey) {
|
|
36
|
-
this.signer = new ethers.NonceManager(new ethers.Wallet(privateKey, this.provider))
|
|
37
|
-
} else if (network.rpcUrl) {
|
|
38
|
-
// If no private key, but RPC URL is provided, get a signer from the provider.
|
|
39
|
-
// This returns a Promise that we need to resolve on first use.
|
|
40
|
-
this.signer = this.provider.getSigner().then(signer => new ethers.NonceManager(signer)) // Keep as Promise
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error('A private key must be provided or an RPC URL must be configured to obtain a signer for the network.')
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Get the resolved signer, handling both direct signers and promised signers
|
|
48
|
-
*/
|
|
49
|
-
public async getResolvedSigner(): Promise<ethers.Signer> {
|
|
50
|
-
if (this.resolvedSigner) {
|
|
51
|
-
return this.resolvedSigner
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (this.signer instanceof Promise) {
|
|
55
|
-
this.resolvedSigner = await this.signer
|
|
56
|
-
return this.resolvedSigner
|
|
57
|
-
} else {
|
|
58
|
-
this.resolvedSigner = this.signer
|
|
59
|
-
return this.resolvedSigner
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public getNetwork(): Network {
|
|
64
|
-
return this.network
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public getEtherscanApiKey(): string | undefined {
|
|
68
|
-
return this.etherscanApiKey
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public getContractRepository(): ContractRepository {
|
|
72
|
-
return this.contractRepository
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// To store results like `{{sequence-v1.factory.address}}`
|
|
76
|
-
public setOutput(key: string, value: any): void {
|
|
77
|
-
this.outputs.set(key, value)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// To retrieve results
|
|
81
|
-
public getOutput(key:string): any {
|
|
82
|
-
if (!this.outputs.has(key)) {
|
|
83
|
-
throw new Error(`Output for key "${key}" not found in context. Check dependencies.`)
|
|
84
|
-
}
|
|
85
|
-
return this.outputs.get(key)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public getOutputs(): Map<string, any> {
|
|
89
|
-
return this.outputs
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Context path for relative artifact resolution
|
|
93
|
-
public setContextPath(path?: string): void {
|
|
94
|
-
this.currentContextPath = path
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public getContextPath(): string | undefined {
|
|
98
|
-
return this.currentContextPath
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Constants management
|
|
102
|
-
public setJobConstants(constants?: Record<string, any>): void {
|
|
103
|
-
this.jobConstants = new Map(Object.entries(constants || {}))
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public getConstant(name: string): any | undefined {
|
|
107
|
-
// Resolution order: job-level constants override top-level
|
|
108
|
-
if (this.jobConstants.has(name)) return this.jobConstants.get(name)
|
|
109
|
-
if (this.topLevelConstants.has(name)) return this.topLevelConstants.get(name)
|
|
110
|
-
return undefined
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Cleanup method to properly dispose of provider connections.
|
|
115
|
-
* This should be called when the context is no longer needed to prevent hanging connections.
|
|
116
|
-
*/
|
|
117
|
-
public async dispose(): Promise<void> {
|
|
118
|
-
try {
|
|
119
|
-
// Destroy the provider to close any open connections
|
|
120
|
-
if ((this.provider as any).destroy) {
|
|
121
|
-
await (this.provider as any).destroy()
|
|
122
|
-
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
// Ignore errors during cleanup
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|