@sentio/runtime 2.62.0-rc.8 → 2.62.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/lib/chunk-3A7UBKPA.js +26 -0
- package/lib/chunk-3A7UBKPA.js.map +1 -0
- package/lib/chunk-AUPVVLD3.js +3 -0
- package/lib/chunk-CJDESLYQ.js +3 -0
- package/lib/{chunk-L2A6JPIQ.js.map → chunk-CJDESLYQ.js.map} +1 -1
- package/lib/chunk-G6HW3DCN.js +3 -0
- package/lib/{chunk-W3VN25ER.js.map → chunk-G6HW3DCN.js.map} +1 -1
- package/lib/chunk-QPZM6M6S.js +117 -0
- package/lib/{chunk-YBKSM3GO.js.map → chunk-QPZM6M6S.js.map} +1 -1
- package/lib/chunk-WHWNPZZ3.js +3 -0
- package/lib/{chunk-6XHWJ2VS.js.map → chunk-WHWNPZZ3.js.map} +1 -1
- package/lib/chunk-XI22N6AJ.js +38 -0
- package/lib/{chunk-PCB4OKW7.js.map → chunk-XI22N6AJ.js.map} +1 -1
- package/lib/getMachineId-bsd-I6PJXCQT.js +3 -0
- package/lib/{getMachineId-bsd-WJ6BLVOD.js.map → getMachineId-bsd-I6PJXCQT.js.map} +1 -1
- package/lib/getMachineId-darwin-HKHV3WMW.js +4 -0
- package/lib/{getMachineId-darwin-TW74DVT5.js.map → getMachineId-darwin-HKHV3WMW.js.map} +1 -1
- package/lib/getMachineId-linux-I76A7IOE.js +3 -0
- package/lib/{getMachineId-linux-MDJOKOMI.js.map → getMachineId-linux-I76A7IOE.js.map} +1 -1
- package/lib/getMachineId-unsupported-VPOZWIZS.js +3 -0
- package/lib/{getMachineId-unsupported-X2EJZ25K.js.map → getMachineId-unsupported-VPOZWIZS.js.map} +1 -1
- package/lib/getMachineId-win-W5S4EK74.js +3 -0
- package/lib/{getMachineId-win-VE7DMTAF.js.map → getMachineId-win-W5S4EK74.js.map} +1 -1
- package/lib/index.d.ts +204 -89
- package/lib/index.js +1 -76
- package/lib/index.js.map +1 -1
- package/lib/{processor-HNY62jHs.d.ts → processor-CIR4erWa.d.ts} +0 -32
- package/lib/processor-runner.js +47 -24609
- package/lib/processor-runner.js.map +1 -1
- package/lib/service-worker.js +2 -132
- package/lib/service-worker.js.map +1 -1
- package/lib/test-processor.test.d.ts +1 -1
- package/lib/test-processor.test.js.map +1 -1
- package/package.json +3 -2
- package/src/gen/processor/protos/processor.ts +83 -1217
- package/src/gen/service/common/protos/common.ts +13 -552
- package/src/otlp.ts +9 -34
- package/src/processor-runner-program.ts +57 -0
- package/src/processor-runner.ts +11 -68
- package/src/service-manager.ts +3 -2
- package/src/service-v3.ts +6 -8
- package/src/service-worker.ts +3 -2
- package/src/service.ts +3 -2
- package/lib/chunk-6XHWJ2VS.js +0 -92
- package/lib/chunk-I5YHR3CE.js +0 -27642
- package/lib/chunk-I5YHR3CE.js.map +0 -1
- package/lib/chunk-KVSDPGUI.js +0 -50
- package/lib/chunk-L2A6JPIQ.js +0 -21
- package/lib/chunk-PCB4OKW7.js +0 -10975
- package/lib/chunk-W3VN25ER.js +0 -1703
- package/lib/chunk-YBKSM3GO.js +0 -59783
- package/lib/getMachineId-bsd-WJ6BLVOD.js +0 -41
- package/lib/getMachineId-darwin-TW74DVT5.js +0 -41
- package/lib/getMachineId-linux-MDJOKOMI.js +0 -33
- package/lib/getMachineId-unsupported-X2EJZ25K.js +0 -24
- package/lib/getMachineId-win-VE7DMTAF.js +0 -43
- /package/lib/{chunk-KVSDPGUI.js.map → chunk-AUPVVLD3.js.map} +0 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
import { Command, InvalidArgumentError } from '@commander-js/extra-typings'
|
2
|
+
|
3
|
+
let workerNum = 1
|
4
|
+
try {
|
5
|
+
workerNum = parseInt(process.env['PROCESSOR_WORKER']?.trim() ?? '1')
|
6
|
+
} catch (e) {
|
7
|
+
console.error('Failed to parse worker number', e)
|
8
|
+
}
|
9
|
+
|
10
|
+
function myParseInt(value: string, dummyPrevious: number): number {
|
11
|
+
// parseInt takes a string and a radix
|
12
|
+
const parsedValue = parseInt(value, 10)
|
13
|
+
if (isNaN(parsedValue)) {
|
14
|
+
throw new InvalidArgumentError('Not a number.')
|
15
|
+
}
|
16
|
+
return parsedValue
|
17
|
+
}
|
18
|
+
|
19
|
+
export const program = new Command('processor-runner')
|
20
|
+
.allowUnknownOption()
|
21
|
+
.allowExcessArguments()
|
22
|
+
.name('processor-runner')
|
23
|
+
.description('Sentio Processor Runtime')
|
24
|
+
.argument('<target>', 'Path to the processor module to load')
|
25
|
+
.option('-p, --port <port>', 'Port to listen on', '4000')
|
26
|
+
.option('--concurrency <number>', 'Number of concurrent workers', myParseInt, 4)
|
27
|
+
.option('--batch-count <number>', 'Batch count for processing', myParseInt, 1)
|
28
|
+
.option('-c, --chains-config <path>', 'Path to chains configuration file', 'chains-config.json')
|
29
|
+
.option('--chainquery-server <url>', 'Chain query server URL')
|
30
|
+
.option('--pricefeed-server <url>', 'Price feed server URL')
|
31
|
+
.option('--log-format <format>', 'Log format (console|json)', 'console')
|
32
|
+
.option('--debug', 'Enable debug mode')
|
33
|
+
.option('--otlp-debug', 'Enable OTLP debug mode')
|
34
|
+
.option('--start-action-server', 'Start action server instead of processor server')
|
35
|
+
.option('--worker <number>', 'Number of worker threads', myParseInt, workerNum)
|
36
|
+
.option('--process-timeout <seconds>', 'Process timeout in seconds', myParseInt, 60)
|
37
|
+
.option(
|
38
|
+
'--worker-timeout <seconds>',
|
39
|
+
'Worker timeout in seconds',
|
40
|
+
myParseInt,
|
41
|
+
parseInt(process.env['WORKER_TIMEOUT_SECONDS'] || '60')
|
42
|
+
)
|
43
|
+
.option(
|
44
|
+
'--enable-partition',
|
45
|
+
'Enable binding data partition',
|
46
|
+
process.env['SENTIO_ENABLE_BINDING_DATA_PARTITION'] === 'true'
|
47
|
+
)
|
48
|
+
|
49
|
+
export type ProcessorRuntimeOptions = ReturnType<typeof program.opts> & { target: string }
|
50
|
+
|
51
|
+
export function getTestConfig(config?: Partial<ProcessorRuntimeOptions>): ProcessorRuntimeOptions {
|
52
|
+
return {
|
53
|
+
...program.opts(),
|
54
|
+
target: './test-processor.test.js',
|
55
|
+
...config
|
56
|
+
}
|
57
|
+
}
|
package/src/processor-runner.ts
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
import fs from 'fs-extra'
|
4
4
|
|
5
|
-
import { compressionAlgorithms } from '@grpc/grpc-js'
|
6
|
-
import { Command, InvalidArgumentError } from 'commander'
|
7
5
|
import { createServer } from 'nice-grpc'
|
8
6
|
import { errorDetailsServerMiddleware } from 'nice-grpc-error-details'
|
9
7
|
// import { registry as niceGrpcRegistry } from 'nice-grpc-prometheus'
|
@@ -21,76 +19,21 @@ import { setupLogger } from './logger.js'
|
|
21
19
|
import { setupOTLP } from './otlp.js'
|
22
20
|
import { ActionServer } from './action-server.js'
|
23
21
|
import { ServiceManager } from './service-manager.js'
|
24
|
-
import path from 'path'
|
25
22
|
import { ProcessorV3Definition } from '@sentio/protos'
|
26
23
|
import { ProcessorServiceImplV3 } from './service-v3.js'
|
27
|
-
import { readFileSync } from 'fs'
|
28
|
-
import { fileURLToPath } from 'url'
|
29
24
|
import { dirname, join } from 'path'
|
25
|
+
import { program, ProcessorRuntimeOptions } from 'processor-runner-program.js'
|
30
26
|
|
31
|
-
|
32
|
-
const __dirname = dirname(__filename)
|
33
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))
|
27
|
+
program.parse()
|
34
28
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
try {
|
39
|
-
workerNum = parseInt(process.env['PROCESSOR_WORKER']?.trim() ?? '1')
|
40
|
-
} catch (e) {
|
41
|
-
console.error('Failed to parse worker number', e)
|
29
|
+
const options: ProcessorRuntimeOptions = {
|
30
|
+
...program.opts(),
|
31
|
+
target: program.args[program.args.length - 1]
|
42
32
|
}
|
43
33
|
|
44
|
-
function myParseInt(value: string, dummyPrevious: unknown): number {
|
45
|
-
// parseInt takes a string and a radix
|
46
|
-
const parsedValue = parseInt(value, 10)
|
47
|
-
if (isNaN(parsedValue)) {
|
48
|
-
throw new InvalidArgumentError('Not a number.')
|
49
|
-
}
|
50
|
-
return parsedValue
|
51
|
-
}
|
52
|
-
|
53
|
-
// Create Commander.js program
|
54
|
-
const program = new Command()
|
55
|
-
|
56
|
-
program
|
57
|
-
.allowUnknownOption()
|
58
|
-
// .allowExcessArguments()
|
59
|
-
.name('processor-runner')
|
60
|
-
.description('Sentio Processor Runtime')
|
61
|
-
.version(packageJson.version)
|
62
|
-
.argument('<target>', 'Path to the processor module to load')
|
63
|
-
.option('-p, --port <port>', 'Port to listen on', '4000')
|
64
|
-
.option('--concurrency <number>', 'Number of concurrent workers', myParseInt, 4)
|
65
|
-
.option('--batch-count <number>', 'Batch count for processing', myParseInt, 1)
|
66
|
-
.option('-c, --chains-config <path>', 'Path to chains configuration file', 'chains-config.json')
|
67
|
-
.option('--chainquery-server <url>', 'Chain query server URL', '')
|
68
|
-
.option('--pricefeed-server <url>', 'Price feed server URL', '')
|
69
|
-
.option('--log-format <format>', 'Log format (console|json)', 'console')
|
70
|
-
.option('--debug', 'Enable debug mode', false)
|
71
|
-
.option('--otlp-debug', 'Enable OTLP debug mode', false)
|
72
|
-
.option('--start-action-server', 'Start action server instead of processor server', false)
|
73
|
-
.option('--worker <number>', 'Number of worker threads', myParseInt, workerNum)
|
74
|
-
.option('--process-timeout <seconds>', 'Process timeout in seconds', myParseInt, 60)
|
75
|
-
.option(
|
76
|
-
'--worker-timeout <seconds>',
|
77
|
-
'Worker timeout in seconds',
|
78
|
-
myParseInt,
|
79
|
-
parseInt(process.env['WORKER_TIMEOUT_SECONDS'] || '60')
|
80
|
-
)
|
81
|
-
.option(
|
82
|
-
'--enable-partition',
|
83
|
-
'Enable binding data partition',
|
84
|
-
process.env['SENTIO_ENABLE_BINDING_DATA_PARTITION'] === 'true'
|
85
|
-
)
|
86
|
-
.parse()
|
87
|
-
|
88
|
-
const options = program.opts()
|
89
|
-
options.target = program.processedArgs[0]
|
90
|
-
|
91
34
|
const logLevel = process.env['LOG_LEVEL']?.toLowerCase()
|
92
35
|
|
93
|
-
setupLogger(options.logFormat === 'json', logLevel === 'debug' ? true : options.debug)
|
36
|
+
setupLogger(options.logFormat === 'json', logLevel === 'debug' ? true : options.debug!)
|
94
37
|
console.debug('Starting with', options.target)
|
95
38
|
|
96
39
|
await setupOTLP(options.otlpDebug)
|
@@ -114,8 +57,8 @@ if (options.startActionServer) {
|
|
114
57
|
} else {
|
115
58
|
server = createServer({
|
116
59
|
'grpc.max_send_message_length': 768 * 1024 * 1024,
|
117
|
-
'grpc.max_receive_message_length': 768 * 1024 * 1024
|
118
|
-
'grpc.default_compression_algorithm': compressionAlgorithms.gzip
|
60
|
+
'grpc.max_receive_message_length': 768 * 1024 * 1024
|
61
|
+
// 'grpc.default_compression_algorithm': compressionAlgorithms.gzip
|
119
62
|
})
|
120
63
|
// .use(prometheusServerMiddleware())
|
121
64
|
.use(openTelemetryServerMiddleware())
|
@@ -230,7 +173,7 @@ if (process.env['OOM_DUMP_MEMORY_SIZE_GB']) {
|
|
230
173
|
console.log('Current Memory Usage', mem)
|
231
174
|
// if memory usage is greater this size, dump heap and exit
|
232
175
|
if (mem.heapTotal > memorySize * 1024 * 1024 * 1024 && !dumping) {
|
233
|
-
const file =
|
176
|
+
const file = join(dir, `${Date.now()}.heapsnapshot`)
|
234
177
|
dumping = true
|
235
178
|
await dumpHeap(file)
|
236
179
|
// force exit and keep pod running
|
@@ -243,11 +186,11 @@ if (process.env['OOM_DUMP_MEMORY_SIZE_GB']) {
|
|
243
186
|
async function dumpHeap(file: string): Promise<void> {
|
244
187
|
console.log('Heap dumping to', file)
|
245
188
|
const session = new Session()
|
246
|
-
fs.mkdirSync(
|
189
|
+
fs.mkdirSync(dirname(file), { recursive: true })
|
247
190
|
const fd = fs.openSync(file, 'w')
|
248
191
|
try {
|
249
192
|
session.connect()
|
250
|
-
session.on('HeapProfiler.addHeapSnapshotChunk', (m) => {
|
193
|
+
session.on('HeapProfiler.addHeapSnapshotChunk', (m: any) => {
|
251
194
|
fs.writeSync(fd, m.params.chunk)
|
252
195
|
})
|
253
196
|
|
package/src/service-manager.ts
CHANGED
@@ -16,6 +16,7 @@ import { Subject } from 'rxjs'
|
|
16
16
|
import { MessageChannel } from 'node:worker_threads'
|
17
17
|
import { ProcessorServiceImpl } from './service.js'
|
18
18
|
import { TemplateInstanceState } from './state.js'
|
19
|
+
import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
|
19
20
|
;(BigInt.prototype as any).toJSON = function () {
|
20
21
|
return this.toString()
|
21
22
|
}
|
@@ -26,7 +27,7 @@ export class ServiceManager extends ProcessorServiceImpl {
|
|
26
27
|
|
27
28
|
constructor(
|
28
29
|
loader: () => Promise<any>,
|
29
|
-
readonly options:
|
30
|
+
readonly options: ProcessorRuntimeOptions,
|
30
31
|
shutdownHandler?: () => void
|
31
32
|
) {
|
32
33
|
super(loader, options, shutdownHandler)
|
@@ -123,7 +124,7 @@ export class ServiceManager extends ProcessorServiceImpl {
|
|
123
124
|
|
124
125
|
if (this.enablePartition) {
|
125
126
|
const concurrent = parseInt(process.env['PROCESS_CONCURRENCY'] || '0')
|
126
|
-
if (this.options.worker < concurrent) {
|
127
|
+
if (this.options.worker! < concurrent) {
|
127
128
|
console.warn(
|
128
129
|
`When partition is enabled, the worker count must >= 'PROCESS_CONCURRENCY', will set worker count to ${concurrent})`
|
129
130
|
)
|
package/src/service-v3.ts
CHANGED
@@ -26,6 +26,7 @@ import { recordRuntimeInfo } from './service.js'
|
|
26
26
|
import { DataBindingContext } from './db-context.js'
|
27
27
|
import { TemplateInstanceState } from './state.js'
|
28
28
|
import { freezeGlobalConfig } from './global-config.js'
|
29
|
+
import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
|
29
30
|
|
30
31
|
const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
|
31
32
|
|
@@ -35,11 +36,11 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
|
|
35
36
|
private readonly shutdownHandler?: () => void
|
36
37
|
private started = false
|
37
38
|
|
38
|
-
constructor(loader: () => Promise<any>, options?:
|
39
|
+
constructor(loader: () => Promise<any>, options?: ProcessorRuntimeOptions, shutdownHandler?: () => void) {
|
39
40
|
this.loader = loader
|
40
41
|
this.shutdownHandler = shutdownHandler
|
41
42
|
|
42
|
-
this.enablePartition = options?.
|
43
|
+
this.enablePartition = options?.enablePartition == true
|
43
44
|
}
|
44
45
|
|
45
46
|
async start(request: StartRequest, context: CallContext): Promise<Empty> {
|
@@ -170,9 +171,9 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
|
|
170
171
|
.then(async (result) => {
|
171
172
|
console.debug(`process binding ${processId} done`)
|
172
173
|
await context.awaitPendings()
|
173
|
-
|
174
|
+
const { timeseriesResult, ...otherResults } = result
|
174
175
|
console.debug('sending ts data length:', result.timeseriesResult.length)
|
175
|
-
for (const ts of
|
176
|
+
for (const ts of timeseriesResult) {
|
176
177
|
subject.next({
|
177
178
|
processId,
|
178
179
|
tsRequest: {
|
@@ -193,10 +194,7 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
|
|
193
194
|
|
194
195
|
console.debug('sending binding result', processId)
|
195
196
|
subject.next({
|
196
|
-
result:
|
197
|
-
states: result.states,
|
198
|
-
exports: result.exports
|
199
|
-
},
|
197
|
+
result: otherResults,
|
200
198
|
processId: processId
|
201
199
|
})
|
202
200
|
recordRuntimeInfo(result, binding.handlerType)
|
package/src/service-worker.ts
CHANGED
@@ -9,6 +9,7 @@ import { Piscina } from 'piscina'
|
|
9
9
|
import { configureEndpoints } from './endpoints.js'
|
10
10
|
import { setupLogger } from './logger.js'
|
11
11
|
import { Subject } from 'rxjs'
|
12
|
+
import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
|
12
13
|
|
13
14
|
let started = false
|
14
15
|
|
@@ -34,7 +35,7 @@ process
|
|
34
35
|
|
35
36
|
let service: ProcessorServiceImpl | undefined
|
36
37
|
|
37
|
-
const loader = async (options:
|
38
|
+
const loader = async (options: ProcessorRuntimeOptions) => {
|
38
39
|
if (options.target) {
|
39
40
|
const m = await import(options.target)
|
40
41
|
console.debug('Module loaded, path:', options.target, 'module:', m)
|
@@ -44,7 +45,7 @@ const loader = async (options: any) => {
|
|
44
45
|
|
45
46
|
const emptyCallContext = <CallContext>{}
|
46
47
|
|
47
|
-
async function start(request: StartRequest, options:
|
48
|
+
async function start(request: StartRequest, options: ProcessorRuntimeOptions): Promise<Empty> {
|
48
49
|
if (started) {
|
49
50
|
return {}
|
50
51
|
}
|
package/src/service.ts
CHANGED
@@ -36,6 +36,7 @@ import { Provider } from 'ethers'
|
|
36
36
|
import { decodeMulticallResult, encodeMulticallData, getMulticallAddress, Multicall3Call } from './multicall.js'
|
37
37
|
|
38
38
|
import { processMetrics } from './metrics.js'
|
39
|
+
import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
|
39
40
|
|
40
41
|
const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
|
41
42
|
|
@@ -58,7 +59,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
58
59
|
private preparedData: PreparedData | undefined
|
59
60
|
readonly enablePartition: boolean
|
60
61
|
|
61
|
-
constructor(loader: () => Promise<any>, options?:
|
62
|
+
constructor(loader: () => Promise<any>, options?: ProcessorRuntimeOptions, shutdownHandler?: () => void) {
|
62
63
|
this.loader = loader
|
63
64
|
this.shutdownHandler = shutdownHandler
|
64
65
|
|
@@ -66,7 +67,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
66
67
|
? process.env['ENABLE_PREPROCESS'].toLowerCase() == 'true'
|
67
68
|
: false
|
68
69
|
|
69
|
-
this.enablePartition = options?.
|
70
|
+
this.enablePartition = options?.enablePartition == true
|
70
71
|
}
|
71
72
|
|
72
73
|
async getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse> {
|
package/lib/chunk-6XHWJ2VS.js
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
import { createRequire as createRequireShim } from 'module'; const require = createRequireShim(import.meta.url);
|
2
|
-
|
3
|
-
// src/state.ts
|
4
|
-
import { isMainThread, parentPort, threadId } from "node:worker_threads";
|
5
|
-
var State = class _State {
|
6
|
-
stateMap = /* @__PURE__ */ new Map();
|
7
|
-
static INSTANCE = new _State();
|
8
|
-
static reset() {
|
9
|
-
_State.INSTANCE = new _State();
|
10
|
-
}
|
11
|
-
};
|
12
|
-
var StateStorage = class {
|
13
|
-
// TODO learn how to define single instance for all subclasses
|
14
|
-
constructor() {
|
15
|
-
}
|
16
|
-
key() {
|
17
|
-
return this.constructor.name;
|
18
|
-
}
|
19
|
-
getOrRegister() {
|
20
|
-
let metricState = State.INSTANCE.stateMap.get(this.key());
|
21
|
-
if (!metricState) {
|
22
|
-
metricState = this.initValue();
|
23
|
-
State.INSTANCE.stateMap.set(this.key(), metricState);
|
24
|
-
}
|
25
|
-
return metricState;
|
26
|
-
}
|
27
|
-
unregister() {
|
28
|
-
const value = State.INSTANCE.stateMap.get(this.key());
|
29
|
-
State.INSTANCE.stateMap.delete(this.key());
|
30
|
-
return value;
|
31
|
-
}
|
32
|
-
};
|
33
|
-
var MapStateStorage = class extends StateStorage {
|
34
|
-
initValue() {
|
35
|
-
return /* @__PURE__ */ new Map();
|
36
|
-
}
|
37
|
-
getValue(key) {
|
38
|
-
const m = this.getOrRegister();
|
39
|
-
return m.get(key);
|
40
|
-
}
|
41
|
-
getValues() {
|
42
|
-
const m = this.getOrRegister();
|
43
|
-
return Array.from(m.values());
|
44
|
-
}
|
45
|
-
getOrSetValue(key, value) {
|
46
|
-
const m = this.getOrRegister();
|
47
|
-
const oldValue = m.get(key);
|
48
|
-
if (oldValue) {
|
49
|
-
if (oldValue !== value) {
|
50
|
-
console.warn(key, "has been registered twice, use the previous one");
|
51
|
-
}
|
52
|
-
return oldValue;
|
53
|
-
}
|
54
|
-
m.set(key, value);
|
55
|
-
return value;
|
56
|
-
}
|
57
|
-
};
|
58
|
-
var ListStateStorage = class extends StateStorage {
|
59
|
-
initValue() {
|
60
|
-
return [];
|
61
|
-
}
|
62
|
-
getValues() {
|
63
|
-
return this.getOrRegister();
|
64
|
-
}
|
65
|
-
addValue(value) {
|
66
|
-
const m = this.getOrRegister();
|
67
|
-
m.push(value);
|
68
|
-
return value;
|
69
|
-
}
|
70
|
-
};
|
71
|
-
var TemplateInstanceState = class _TemplateInstanceState extends ListStateStorage {
|
72
|
-
static INSTANCE = new _TemplateInstanceState();
|
73
|
-
constructor() {
|
74
|
-
super();
|
75
|
-
}
|
76
|
-
addValue(value) {
|
77
|
-
if (!isMainThread) {
|
78
|
-
parentPort?.postMessage({ event: "add_template_instance", value, from: threadId });
|
79
|
-
}
|
80
|
-
return super.addValue(value);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
import("node:process").then((p) => p.stdout.write(""));
|
84
|
-
|
85
|
-
export {
|
86
|
-
State,
|
87
|
-
StateStorage,
|
88
|
-
MapStateStorage,
|
89
|
-
ListStateStorage,
|
90
|
-
TemplateInstanceState
|
91
|
-
};
|
92
|
-
//# sourceMappingURL=chunk-6XHWJ2VS.js.map
|