@514labs/moose-lib 0.6.349 → 0.6.351

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.
@@ -2217,6 +2217,103 @@ var Cluster = class {
2217
2217
  init_sqlHelpers();
2218
2218
  init_internal();
2219
2219
  init_compiler_config();
2220
+
2221
+ // src/utils/structured-logging.ts
2222
+ var util = __toESM(require("util"));
2223
+ var import_async_hooks = require("async_hooks");
2224
+ function setupStructuredConsole(getContextField, contextFieldName) {
2225
+ const contextStorage = new import_async_hooks.AsyncLocalStorage();
2226
+ const originalConsole = {
2227
+ log: console.log,
2228
+ info: console.info,
2229
+ warn: console.warn,
2230
+ error: console.error,
2231
+ debug: console.debug
2232
+ };
2233
+ console.log = createStructuredConsoleWrapper(
2234
+ contextStorage,
2235
+ getContextField,
2236
+ contextFieldName,
2237
+ originalConsole.log,
2238
+ "info"
2239
+ );
2240
+ console.info = createStructuredConsoleWrapper(
2241
+ contextStorage,
2242
+ getContextField,
2243
+ contextFieldName,
2244
+ originalConsole.info,
2245
+ "info"
2246
+ );
2247
+ console.warn = createStructuredConsoleWrapper(
2248
+ contextStorage,
2249
+ getContextField,
2250
+ contextFieldName,
2251
+ originalConsole.warn,
2252
+ "warn"
2253
+ );
2254
+ console.error = createStructuredConsoleWrapper(
2255
+ contextStorage,
2256
+ getContextField,
2257
+ contextFieldName,
2258
+ originalConsole.error,
2259
+ "error"
2260
+ );
2261
+ console.debug = createStructuredConsoleWrapper(
2262
+ contextStorage,
2263
+ getContextField,
2264
+ contextFieldName,
2265
+ originalConsole.debug,
2266
+ "debug"
2267
+ );
2268
+ return contextStorage;
2269
+ }
2270
+ function safeStringify(arg) {
2271
+ if (typeof arg === "object" && arg !== null) {
2272
+ if (arg instanceof Error) {
2273
+ return util.inspect(arg, { depth: 2, breakLength: Infinity });
2274
+ }
2275
+ try {
2276
+ return JSON.stringify(arg);
2277
+ } catch (e) {
2278
+ return util.inspect(arg, { depth: 2, breakLength: Infinity });
2279
+ }
2280
+ }
2281
+ if (typeof arg === "string") {
2282
+ return arg;
2283
+ }
2284
+ return util.inspect(arg);
2285
+ }
2286
+ function createStructuredConsoleWrapper(contextStorage, getContextField, contextFieldName, originalMethod, level) {
2287
+ return (...args) => {
2288
+ const context = contextStorage.getStore();
2289
+ if (!context) {
2290
+ originalMethod(...args);
2291
+ return;
2292
+ }
2293
+ let ctxValue;
2294
+ try {
2295
+ ctxValue = getContextField(context);
2296
+ } catch {
2297
+ ctxValue = "unknown";
2298
+ }
2299
+ try {
2300
+ const message = args.map((arg) => safeStringify(arg)).join(" ");
2301
+ process.stderr.write(
2302
+ JSON.stringify({
2303
+ __moose_structured_log__: true,
2304
+ level,
2305
+ message,
2306
+ [contextFieldName]: ctxValue,
2307
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2308
+ }) + "\n"
2309
+ );
2310
+ } catch {
2311
+ originalMethod(...args);
2312
+ }
2313
+ };
2314
+ }
2315
+
2316
+ // src/consumption-apis/runner.ts
2220
2317
  var toClientConfig2 = (config) => ({
2221
2318
  ...config,
2222
2319
  useSSL: config.useSSL ? "true" : "false"
@@ -2225,12 +2322,21 @@ var createPath = (apisDir, path5, useCompiled2) => {
2225
2322
  const extension = useCompiled2 ? ".js" : ".ts";
2226
2323
  return `${apisDir}${path5}${extension}`;
2227
2324
  };
2228
- var httpLogger = (req, res, startMs) => {
2229
- console.log(
2325
+ var httpLogger = (req, res, startMs, apiName) => {
2326
+ const logFn = () => console.log(
2230
2327
  `${req.method} ${req.url} ${res.statusCode} ${Date.now() - startMs}ms`
2231
2328
  );
2329
+ if (apiName) {
2330
+ apiContextStorage.run({ apiName }, logFn);
2331
+ } else {
2332
+ logFn();
2333
+ }
2232
2334
  };
2233
2335
  var modulesCache = /* @__PURE__ */ new Map();
2336
+ var apiContextStorage = setupStructuredConsole(
2337
+ (ctx) => ctx.apiName,
2338
+ "api_name"
2339
+ );
2234
2340
  var apiHandler = async (publicKey, clickhouseClient, temporalClient, enforceAuth, jwtConfig) => {
2235
2341
  const useCompiled2 = shouldUseCompiled();
2236
2342
  const sourceDir = getSourceDir();
@@ -2238,6 +2344,7 @@ var apiHandler = async (publicKey, clickhouseClient, temporalClient, enforceAuth
2238
2344
  const apis = await getApis2();
2239
2345
  return async (req, res) => {
2240
2346
  const start = Date.now();
2347
+ let matchedApiName;
2241
2348
  try {
2242
2349
  const url = new URL(req.url || "", "http://localhost");
2243
2350
  const fileName = url.pathname;
@@ -2289,43 +2396,66 @@ var apiHandler = async (publicKey, clickhouseClient, temporalClient, enforceAuth
2289
2396
  },
2290
2397
  {}
2291
2398
  );
2292
- let userFuncModule = modulesCache.get(pathName);
2293
- if (userFuncModule === void 0) {
2294
- let apiName = fileName.replace(/^\/+|\/+$/g, "");
2399
+ const versionParam = url.searchParams.get("version");
2400
+ const cacheKey = versionParam ? `${pathName}:${versionParam}` : pathName;
2401
+ let userFuncModule;
2402
+ const cachedEntry = modulesCache.get(cacheKey);
2403
+ if (cachedEntry !== void 0) {
2404
+ userFuncModule = cachedEntry.module;
2405
+ matchedApiName = cachedEntry.apiName;
2406
+ } else {
2407
+ let lookupName = fileName.replace(/^\/+|\/+$/g, "");
2295
2408
  let version = null;
2296
- userFuncModule = apis.get(apiName);
2409
+ userFuncModule = apis.get(lookupName);
2410
+ if (userFuncModule) {
2411
+ matchedApiName = lookupName;
2412
+ }
2297
2413
  if (!userFuncModule) {
2298
2414
  version = url.searchParams.get("version");
2299
- if (!version && apiName.includes("/")) {
2300
- const pathParts = apiName.split("/");
2415
+ if (!version && lookupName.includes("/")) {
2416
+ const pathParts = lookupName.split("/");
2301
2417
  if (pathParts.length >= 2) {
2302
- userFuncModule = apis.get(apiName);
2303
- if (!userFuncModule) {
2304
- apiName = pathParts[0];
2305
- version = pathParts.slice(1).join("/");
2306
- }
2418
+ lookupName = pathParts[0];
2419
+ version = pathParts.slice(1).join("/");
2307
2420
  }
2308
2421
  }
2309
2422
  if (!userFuncModule && version) {
2310
- const versionedKey = `${apiName}:${version}`;
2423
+ const versionedKey = `${lookupName}:${version}`;
2311
2424
  userFuncModule = apis.get(versionedKey);
2425
+ if (userFuncModule) {
2426
+ matchedApiName = lookupName;
2427
+ }
2428
+ }
2429
+ if (!userFuncModule) {
2430
+ userFuncModule = apis.get(lookupName);
2431
+ if (userFuncModule) {
2432
+ matchedApiName = lookupName;
2433
+ }
2312
2434
  }
2313
2435
  }
2314
- if (!userFuncModule) {
2436
+ if (!userFuncModule || matchedApiName === void 0) {
2315
2437
  const availableApis = Array.from(apis.keys()).map(
2316
2438
  (key) => key.replace(":", "/")
2317
2439
  );
2318
- const errorMessage = version ? `API ${apiName} with version ${version} not found. Available APIs: ${availableApis.join(", ")}` : `API ${apiName} not found. Available APIs: ${availableApis.join(", ")}`;
2440
+ const errorMessage = version ? `API ${lookupName} with version ${version} not found. Available APIs: ${availableApis.join(", ")}` : `API ${lookupName} not found. Available APIs: ${availableApis.join(", ")}`;
2319
2441
  throw new Error(errorMessage);
2320
2442
  }
2321
- modulesCache.set(pathName, userFuncModule);
2322
- console.log(`[API] | Executing API: ${apiName}`);
2443
+ modulesCache.set(cacheKey, {
2444
+ module: userFuncModule,
2445
+ apiName: matchedApiName
2446
+ });
2447
+ apiContextStorage.run({ apiName: matchedApiName }, () => {
2448
+ console.log(`[API] | Executing API: ${matchedApiName}`);
2449
+ });
2323
2450
  }
2324
2451
  const queryClient = new QueryClient(clickhouseClient, fileName);
2325
- let result = await userFuncModule(paramsObject, {
2326
- client: new MooseClient(queryClient, temporalClient),
2327
- sql,
2328
- jwt: jwtPayload
2452
+ const apiName = matchedApiName;
2453
+ const result = await apiContextStorage.run({ apiName }, async () => {
2454
+ return await userFuncModule(paramsObject, {
2455
+ client: new MooseClient(queryClient, temporalClient),
2456
+ sql,
2457
+ jwt: jwtPayload
2458
+ });
2329
2459
  });
2330
2460
  let body;
2331
2461
  let status;
@@ -2341,27 +2471,32 @@ var apiHandler = async (publicKey, clickhouseClient, temporalClient, enforceAuth
2341
2471
  }
2342
2472
  if (status) {
2343
2473
  res.writeHead(status, { "Content-Type": "application/json" });
2344
- httpLogger(req, res, start);
2474
+ httpLogger(req, res, start, apiName);
2345
2475
  } else {
2346
2476
  res.writeHead(200, { "Content-Type": "application/json" });
2347
- httpLogger(req, res, start);
2477
+ httpLogger(req, res, start, apiName);
2348
2478
  }
2349
2479
  res.end(body);
2350
2480
  } catch (error) {
2351
- console.log("error in path ", req.url, error);
2481
+ const logError2 = () => console.log("error in path ", req.url, error);
2482
+ if (matchedApiName) {
2483
+ apiContextStorage.run({ apiName: matchedApiName }, logError2);
2484
+ } else {
2485
+ logError2();
2486
+ }
2352
2487
  if (Object.getPrototypeOf(error).constructor.name === "TypeGuardError") {
2353
2488
  res.writeHead(400, { "Content-Type": "application/json" });
2354
2489
  res.end(JSON.stringify({ error: error.message }));
2355
- httpLogger(req, res, start);
2490
+ httpLogger(req, res, start, matchedApiName);
2356
2491
  }
2357
2492
  if (error instanceof Error) {
2358
2493
  res.writeHead(500, { "Content-Type": "application/json" });
2359
2494
  res.end(JSON.stringify({ error: error.message }));
2360
- httpLogger(req, res, start);
2495
+ httpLogger(req, res, start, matchedApiName);
2361
2496
  } else {
2362
2497
  res.writeHead(500, { "Content-Type": "application/json" });
2363
2498
  res.end();
2364
- httpLogger(req, res, start);
2499
+ httpLogger(req, res, start, matchedApiName);
2365
2500
  }
2366
2501
  }
2367
2502
  };
@@ -2533,6 +2668,10 @@ var SESSION_TIMEOUT_CONSUMER = 3e4;
2533
2668
  var HEARTBEAT_INTERVAL_CONSUMER = 3e3;
2534
2669
  var DEFAULT_MAX_STREAMING_CONCURRENCY = 100;
2535
2670
  var CONSUMER_MAX_BATCH_SIZE = 1e3;
2671
+ var functionContextStorage = setupStructuredConsole(
2672
+ (ctx) => ctx.functionName,
2673
+ "function_name"
2674
+ );
2536
2675
  var MAX_STREAMING_CONCURRENCY = process3.env.MAX_STREAMING_CONCURRENCY ? parseInt(process3.env.MAX_STREAMING_CONCURRENCY, 10) : DEFAULT_MAX_STREAMING_CONCURRENCY;
2537
2676
  var metricsLog = (log) => {
2538
2677
  const req = http3.request({
@@ -2858,56 +2997,63 @@ var startConsumer = async (args, logger2, metrics, _parallelism, consumer, produ
2858
2997
  if (!isRunning() || isStale()) {
2859
2998
  return;
2860
2999
  }
2861
- metrics.count_in += batch.messages.length;
2862
- cliLog({
2863
- action: "Received",
2864
- message: `${logger2.logPrefix} ${batch.messages.length} message(s)`
2865
- });
2866
- logger2.log(`Received ${batch.messages.length} message(s)`);
2867
- let index = 0;
2868
- const readableStream = import_node_stream2.Readable.from(batch.messages);
2869
- const processedMessages = await readableStream.map(
2870
- async (message) => {
2871
- index++;
2872
- if (batch.messages.length > DEFAULT_MAX_STREAMING_CONCURRENCY && index % DEFAULT_MAX_STREAMING_CONCURRENCY || index - 1 === batch.messages.length) {
2873
- await heartbeat();
3000
+ const functionName = logger2.logPrefix;
3001
+ await functionContextStorage.run({ functionName }, async () => {
3002
+ metrics.count_in += batch.messages.length;
3003
+ cliLog({
3004
+ action: "Received",
3005
+ message: `${logger2.logPrefix.replace("__", " -> ")} ${batch.messages.length} message(s)`
3006
+ });
3007
+ logger2.log(`Received ${batch.messages.length} message(s)`);
3008
+ let index = 0;
3009
+ const readableStream = import_node_stream2.Readable.from(batch.messages);
3010
+ const processedMessages = await readableStream.map(
3011
+ async (message) => {
3012
+ index++;
3013
+ if (batch.messages.length > DEFAULT_MAX_STREAMING_CONCURRENCY && index % DEFAULT_MAX_STREAMING_CONCURRENCY || index - 1 === batch.messages.length) {
3014
+ await heartbeat();
3015
+ }
3016
+ return handleMessage(
3017
+ logger2,
3018
+ streamingFunctions,
3019
+ message,
3020
+ producer,
3021
+ fieldMutations,
3022
+ args.logPayloads
3023
+ );
3024
+ },
3025
+ {
3026
+ concurrency: MAX_STREAMING_CONCURRENCY
2874
3027
  }
2875
- return handleMessage(
3028
+ ).toArray();
3029
+ const filteredMessages = processedMessages.flat().filter((msg) => msg !== void 0 && msg.value !== void 0);
3030
+ if (args.targetTopic === void 0 || processedMessages.length === 0) {
3031
+ return;
3032
+ }
3033
+ await heartbeat();
3034
+ if (filteredMessages.length > 0) {
3035
+ await sendMessages(
2876
3036
  logger2,
2877
- streamingFunctions,
2878
- message,
3037
+ metrics,
3038
+ args.targetTopic,
2879
3039
  producer,
2880
- fieldMutations,
2881
- args.logPayloads
3040
+ filteredMessages
2882
3041
  );
2883
- },
2884
- {
2885
- concurrency: MAX_STREAMING_CONCURRENCY
2886
3042
  }
2887
- ).toArray();
2888
- const filteredMessages = processedMessages.flat().filter((msg) => msg !== void 0 && msg.value !== void 0);
2889
- if (args.targetTopic === void 0 || processedMessages.length === 0) {
2890
- return;
2891
- }
2892
- await heartbeat();
2893
- if (filteredMessages.length > 0) {
2894
- await sendMessages(
2895
- logger2,
2896
- metrics,
2897
- args.targetTopic,
2898
- producer,
2899
- filteredMessages
2900
- );
2901
- }
3043
+ });
2902
3044
  }
2903
3045
  });
2904
3046
  logger2.log("Consumer is running...");
2905
3047
  };
2906
3048
  var buildLogger = (args, workerId) => {
2907
- const targetLabel = args.targetTopic?.name ? ` -> ${args.targetTopic.name}` : " (consumer)";
2908
- const logPrefix = `${args.sourceTopic.name}${targetLabel} (worker ${workerId})`;
3049
+ const sourceBaseName = topicNameToStreamName(args.sourceTopic);
3050
+ const targetBaseName = args.targetTopic ? topicNameToStreamName(args.targetTopic) : void 0;
3051
+ const functionName = targetBaseName ? `${sourceBaseName}__${targetBaseName}` : sourceBaseName;
3052
+ const logPrefix = `${functionName} (worker ${workerId})`;
2909
3053
  return {
2910
- logPrefix,
3054
+ // logPrefix is used for structured logging (function_name field)
3055
+ // Must match source_primitive.name format for log correlation
3056
+ logPrefix: functionName,
2911
3057
  log: (message) => {
2912
3058
  console.log(`${logPrefix}: ${message}`);
2913
3059
  },
@@ -2972,82 +3118,88 @@ var runStreamingFunctions = async (args) => {
2972
3118
  maxWorkerCount: args.maxSubscriberCount,
2973
3119
  workerStart: async (worker, parallelism) => {
2974
3120
  const logger2 = buildLogger(args, worker.id);
2975
- const metrics = {
2976
- count_in: 0,
2977
- count_out: 0,
2978
- bytes: 0
2979
- };
2980
- setTimeout(() => sendMessageMetrics(logger2, metrics), 1e3);
2981
- const clientIdPrefix = HOSTNAME ? `${HOSTNAME}-` : "";
2982
- const processId = `${clientIdPrefix}${streamingFuncId}-ts-${worker.id}`;
2983
- const kafka = await getKafkaClient(
2984
- {
2985
- clientId: processId,
2986
- broker: args.broker,
2987
- securityProtocol: args.securityProtocol,
2988
- saslUsername: args.saslUsername,
2989
- saslPassword: args.saslPassword,
2990
- saslMechanism: args.saslMechanism
2991
- },
2992
- logger2
2993
- );
2994
- const consumer = kafka.consumer({
2995
- kafkaJS: {
2996
- groupId: streamingFuncId,
2997
- sessionTimeout: SESSION_TIMEOUT_CONSUMER,
2998
- heartbeatInterval: HEARTBEAT_INTERVAL_CONSUMER,
2999
- retry: {
3000
- retries: MAX_RETRIES_CONSUMER
3121
+ const functionName = logger2.logPrefix;
3122
+ return await functionContextStorage.run({ functionName }, async () => {
3123
+ const metrics = {
3124
+ count_in: 0,
3125
+ count_out: 0,
3126
+ bytes: 0
3127
+ };
3128
+ setTimeout(() => sendMessageMetrics(logger2, metrics), 1e3);
3129
+ const clientIdPrefix = HOSTNAME ? `${HOSTNAME}-` : "";
3130
+ const processId = `${clientIdPrefix}${streamingFuncId}-ts-${worker.id}`;
3131
+ const kafka = await getKafkaClient(
3132
+ {
3133
+ clientId: processId,
3134
+ broker: args.broker,
3135
+ securityProtocol: args.securityProtocol,
3136
+ saslUsername: args.saslUsername,
3137
+ saslPassword: args.saslPassword,
3138
+ saslMechanism: args.saslMechanism
3001
3139
  },
3002
- autoCommit: true,
3003
- autoCommitInterval: AUTO_COMMIT_INTERVAL_MS,
3004
- fromBeginning: true
3005
- },
3006
- "js.consumer.max.batch.size": CONSUMER_MAX_BATCH_SIZE
3007
- });
3008
- const maxMessageBytes = args.targetTopic?.max_message_bytes || 1024 * 1024;
3009
- const producer = kafka.producer(
3010
- createProducerConfig(maxMessageBytes)
3011
- );
3012
- try {
3013
- logger2.log("Starting producer...");
3014
- await startProducer(logger2, producer);
3140
+ logger2
3141
+ );
3142
+ const consumer = kafka.consumer({
3143
+ kafkaJS: {
3144
+ groupId: streamingFuncId,
3145
+ sessionTimeout: SESSION_TIMEOUT_CONSUMER,
3146
+ heartbeatInterval: HEARTBEAT_INTERVAL_CONSUMER,
3147
+ retry: {
3148
+ retries: MAX_RETRIES_CONSUMER
3149
+ },
3150
+ autoCommit: true,
3151
+ autoCommitInterval: AUTO_COMMIT_INTERVAL_MS,
3152
+ fromBeginning: true
3153
+ },
3154
+ "js.consumer.max.batch.size": CONSUMER_MAX_BATCH_SIZE
3155
+ });
3156
+ const maxMessageBytes = args.targetTopic?.max_message_bytes || 1024 * 1024;
3157
+ const producer = kafka.producer(
3158
+ createProducerConfig(maxMessageBytes)
3159
+ );
3015
3160
  try {
3016
- logger2.log("Starting consumer...");
3017
- await startConsumer(
3018
- args,
3019
- logger2,
3020
- metrics,
3021
- parallelism,
3022
- consumer,
3023
- producer,
3024
- streamingFuncId
3025
- );
3161
+ logger2.log("Starting producer...");
3162
+ await startProducer(logger2, producer);
3163
+ try {
3164
+ logger2.log("Starting consumer...");
3165
+ await startConsumer(
3166
+ args,
3167
+ logger2,
3168
+ metrics,
3169
+ parallelism,
3170
+ consumer,
3171
+ producer,
3172
+ streamingFuncId
3173
+ );
3174
+ } catch (e) {
3175
+ logger2.error("Failed to start kafka consumer: ");
3176
+ if (e instanceof Error) {
3177
+ logError(logger2, e);
3178
+ }
3179
+ throw e;
3180
+ }
3026
3181
  } catch (e) {
3027
- logger2.error("Failed to start kafka consumer: ");
3182
+ logger2.error("Failed to start kafka producer: ");
3028
3183
  if (e instanceof Error) {
3029
3184
  logError(logger2, e);
3030
3185
  }
3031
3186
  throw e;
3032
3187
  }
3033
- } catch (e) {
3034
- logger2.error("Failed to start kafka producer: ");
3035
- if (e instanceof Error) {
3036
- logError(logger2, e);
3037
- }
3038
- throw e;
3039
- }
3040
- return [logger2, producer, consumer];
3188
+ return [logger2, producer, consumer];
3189
+ });
3041
3190
  },
3042
3191
  workerStop: async ([logger2, producer, consumer]) => {
3043
- logger2.log(`Received SIGTERM, shutting down gracefully...`);
3044
- logger2.log("Stopping consumer first...");
3045
- await stopConsumer(logger2, consumer, args.sourceTopic);
3046
- logger2.log("Waiting for in-flight messages to complete...");
3047
- await new Promise((resolve3) => setTimeout(resolve3, 2e3));
3048
- logger2.log("Stopping producer...");
3049
- await stopProducer(logger2, producer);
3050
- logger2.log("Graceful shutdown completed");
3192
+ const functionName = logger2.logPrefix;
3193
+ await functionContextStorage.run({ functionName }, async () => {
3194
+ logger2.log(`Received SIGTERM, shutting down gracefully...`);
3195
+ logger2.log("Stopping consumer first...");
3196
+ await stopConsumer(logger2, consumer, args.sourceTopic);
3197
+ logger2.log("Waiting for in-flight messages to complete...");
3198
+ await new Promise((resolve3) => setTimeout(resolve3, 2e3));
3199
+ logger2.log("Stopping producer...");
3200
+ await stopProducer(logger2, producer);
3201
+ logger2.log("Graceful shutdown completed");
3202
+ });
3051
3203
  }
3052
3204
  });
3053
3205
  cluster2.start();
@@ -3103,6 +3255,10 @@ var import_activity = require("@temporalio/activity");
3103
3255
  var import_workflow3 = require("@temporalio/workflow");
3104
3256
  init_internal();
3105
3257
  init_json();
3258
+ var taskContextStorage = setupStructuredConsole(
3259
+ (ctx) => ctx.taskName,
3260
+ "task_name"
3261
+ );
3106
3262
  var activities = {
3107
3263
  async hasWorkflow(name) {
3108
3264
  try {
@@ -3184,10 +3340,16 @@ var activities = {
3184
3340
  const revivedInputData = inputData ? JSON.parse(JSON.stringify(inputData), jsonDateReviver) : inputData;
3185
3341
  try {
3186
3342
  startPeriodicHeartbeat();
3187
- const result = await Promise.race([
3188
- fullTask.config.run({ state: taskState, input: revivedInputData }),
3189
- context.cancelled
3190
- ]);
3343
+ const taskIdentifier = workflow.name;
3344
+ const result = await taskContextStorage.run(
3345
+ { taskName: taskIdentifier },
3346
+ async () => {
3347
+ return await Promise.race([
3348
+ fullTask.config.run({ state: taskState, input: revivedInputData }),
3349
+ context.cancelled
3350
+ ]);
3351
+ }
3352
+ );
3191
3353
  return result;
3192
3354
  } catch (error) {
3193
3355
  if ((0, import_workflow3.isCancellation)(error)) {