MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / constructor

Method constructor

packages/trigger-sdk/src/io.ts:156–203  ·  view source on GitHub ↗
(options: IOOptions)

Source from the content-addressed store, hash-verified

154 }
155
156 constructor(options: IOOptions) {
157 this._id = options.id;
158 this._jobId = options.jobId;
159 this._apiClient = options.apiClient;
160 this._triggerClient = options.client;
161 this._logger = options.logger ?? new Logger("trigger.dev", options.logLevel);
162 this._cachedTasks = new Map();
163 this._jobLogger = options.jobLogger;
164 this._jobLogLevel = options.jobLogLevel;
165 this._timeOrigin = options.timeOrigin;
166 this._executionTimeout = options.executionTimeout;
167
168 this._envStore = new KeyValueStore(options.apiClient);
169 this._jobStore = new KeyValueStore(options.apiClient, "job", options.jobId);
170 this._runStore = new KeyValueStore(options.apiClient, "run", options.id);
171
172 this._stats = {
173 initialCachedTasks: 0,
174 lazyLoadedCachedTasks: 0,
175 executedTasks: 0,
176 cachedTaskHits: 0,
177 cachedTaskMisses: 0,
178 noopCachedTaskHits: 0,
179 noopCachedTaskMisses: 0,
180 };
181
182 if (options.cachedTasks) {
183 options.cachedTasks.forEach((task) => {
184 this._cachedTasks.set(task.idempotencyKey, task);
185 });
186
187 this._stats.initialCachedTasks = options.cachedTasks.length;
188 }
189
190 this._taskStorage = new AsyncLocalStorage();
191 this._context = options.context;
192 this._yieldedExecutions = options.yieldedExecutions ?? [];
193
194 if (options.noopTasksSet) {
195 this._noopTasksBloomFilter = BloomFilter.deserialize(
196 options.noopTasksSet,
197 BloomFilter.NOOP_TASK_SET_SIZE
198 );
199 }
200
201 this._cachedTasksCursor = options.cachedTasksCursor;
202 this._serverVersion = options.serverVersion ?? "unversioned";
203 }
204
205 /** @internal */
206 get runId() {

Callers

nothing calls this directly

Calls 2

deserializeMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected