@camunda8/orchestration-cluster-api 8.9.0-alpha.13 → 8.9.0-alpha.14

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.
@@ -1508,7 +1508,7 @@ var deleteDecisionInstance = (options) => {
1508
1508
  return (options.client ?? client).post({
1509
1509
  requestValidator: void 0,
1510
1510
  responseValidator: void 0,
1511
- url: "/decision-instances/{decisionInstanceKey}/deletion",
1511
+ url: "/decision-instances/{decisionEvaluationKey}/deletion",
1512
1512
  ...options,
1513
1513
  headers: {
1514
1514
  "Content-Type": "application/json",
@@ -2063,6 +2063,18 @@ var getJobTimeSeriesStatistics = (options) => {
2063
2063
  }
2064
2064
  });
2065
2065
  };
2066
+ var getJobErrorStatistics = (options) => {
2067
+ return (options.client ?? client).post({
2068
+ requestValidator: void 0,
2069
+ responseValidator: void 0,
2070
+ url: "/jobs/statistics/errors",
2071
+ ...options,
2072
+ headers: {
2073
+ "Content-Type": "application/json",
2074
+ ...options.headers
2075
+ }
2076
+ });
2077
+ };
2066
2078
  var getLicense = (options) => {
2067
2079
  return (options?.client ?? client).get({
2068
2080
  requestValidator: void 0,
@@ -2659,6 +2671,14 @@ var getUsageMetrics = (options) => {
2659
2671
  ...options
2660
2672
  });
2661
2673
  };
2674
+ var getSystemConfiguration = (options) => {
2675
+ return (options?.client ?? client).get({
2676
+ requestValidator: void 0,
2677
+ responseValidator: void 0,
2678
+ url: "/system/configuration",
2679
+ ...options
2680
+ });
2681
+ };
2662
2682
  var createTenant = (options) => {
2663
2683
  return (options.client ?? client).post({
2664
2684
  requestValidator: void 0,
@@ -3356,6 +3376,7 @@ __export(zod_gen_exports, {
3356
3376
  zEvaluatedDecisionResult: () => zEvaluatedDecisionResult,
3357
3377
  zExpressionEvaluationRequest: () => zExpressionEvaluationRequest,
3358
3378
  zExpressionEvaluationResult: () => zExpressionEvaluationResult,
3379
+ zExpressionEvaluationWarningItem: () => zExpressionEvaluationWarningItem,
3359
3380
  zFailJobData: () => zFailJobData,
3360
3381
  zFailJobResponse: () => zFailJobResponse,
3361
3382
  zFormId: () => zFormId,
@@ -3395,6 +3416,8 @@ __export(zod_gen_exports, {
3395
3416
  zGetGroupResponse: () => zGetGroupResponse,
3396
3417
  zGetIncidentData: () => zGetIncidentData,
3397
3418
  zGetIncidentResponse: () => zGetIncidentResponse,
3419
+ zGetJobErrorStatisticsData: () => zGetJobErrorStatisticsData,
3420
+ zGetJobErrorStatisticsResponse: () => zGetJobErrorStatisticsResponse,
3398
3421
  zGetJobTimeSeriesStatisticsData: () => zGetJobTimeSeriesStatisticsData,
3399
3422
  zGetJobTimeSeriesStatisticsResponse: () => zGetJobTimeSeriesStatisticsResponse,
3400
3423
  zGetJobTypeStatisticsData: () => zGetJobTypeStatisticsData,
@@ -3439,6 +3462,8 @@ __export(zod_gen_exports, {
3439
3462
  zGetStartProcessFormResponse: () => zGetStartProcessFormResponse,
3440
3463
  zGetStatusData: () => zGetStatusData,
3441
3464
  zGetStatusResponse: () => zGetStatusResponse,
3465
+ zGetSystemConfigurationData: () => zGetSystemConfigurationData,
3466
+ zGetSystemConfigurationResponse: () => zGetSystemConfigurationResponse,
3442
3467
  zGetTenantClusterVariableData: () => zGetTenantClusterVariableData,
3443
3468
  zGetTenantClusterVariableResponse: () => zGetTenantClusterVariableResponse,
3444
3469
  zGetTenantData: () => zGetTenantData,
@@ -3519,6 +3544,10 @@ __export(zod_gen_exports, {
3519
3544
  zJobChangeset: () => zJobChangeset,
3520
3545
  zJobCompletionRequest: () => zJobCompletionRequest,
3521
3546
  zJobErrorRequest: () => zJobErrorRequest,
3547
+ zJobErrorStatisticsFilter: () => zJobErrorStatisticsFilter,
3548
+ zJobErrorStatisticsItem: () => zJobErrorStatisticsItem,
3549
+ zJobErrorStatisticsQuery: () => zJobErrorStatisticsQuery,
3550
+ zJobErrorStatisticsQueryResult: () => zJobErrorStatisticsQueryResult,
3522
3551
  zJobFailRequest: () => zJobFailRequest,
3523
3552
  zJobFilter: () => zJobFilter,
3524
3553
  zJobKey: () => zJobKey,
@@ -3530,6 +3559,7 @@ __export(zod_gen_exports, {
3530
3559
  zJobListenerEventTypeEnum: () => zJobListenerEventTypeEnum,
3531
3560
  zJobListenerEventTypeExactMatch: () => zJobListenerEventTypeExactMatch,
3532
3561
  zJobListenerEventTypeFilterProperty: () => zJobListenerEventTypeFilterProperty,
3562
+ zJobMetricsConfigurationResponse: () => zJobMetricsConfigurationResponse,
3533
3563
  zJobResult: () => zJobResult,
3534
3564
  zJobResultActivateElement: () => zJobResultActivateElement,
3535
3565
  zJobResultAdHocSubProcess: () => zJobResultAdHocSubProcess,
@@ -3808,6 +3838,7 @@ __export(zod_gen_exports, {
3808
3838
  zStringFilterProperty: () => zStringFilterProperty,
3809
3839
  zSuspendBatchOperationData: () => zSuspendBatchOperationData,
3810
3840
  zSuspendBatchOperationResponse: () => zSuspendBatchOperationResponse,
3841
+ zSystemConfigurationResponse: () => zSystemConfigurationResponse,
3811
3842
  zTag: () => zTag,
3812
3843
  zTagSet: () => zTagSet,
3813
3844
  zTenantClientResult: () => zTenantClientResult,
@@ -4133,18 +4164,18 @@ var zAuthorizationFilter = z.object({
4133
4164
  description: "Authorization search filter."
4134
4165
  });
4135
4166
  var zBatchOperationError = z.object({
4136
- partitionId: z.optional(z.int().register(z.globalRegistry, {
4167
+ partitionId: z.int().register(z.globalRegistry, {
4137
4168
  description: "The partition ID where the error occurred."
4138
- })),
4139
- type: z.optional(z.enum([
4169
+ }),
4170
+ type: z.enum([
4140
4171
  "QUERY_FAILED",
4141
4172
  "RESULT_BUFFER_SIZE_EXCEEDED"
4142
4173
  ]).register(z.globalRegistry, {
4143
4174
  description: "The type of the error that occurred during the batch operation."
4144
- })),
4145
- message: z.optional(z.string().register(z.globalRegistry, {
4175
+ }),
4176
+ message: z.string().register(z.globalRegistry, {
4146
4177
  description: "The error message that occurred during the batch operation."
4147
- }))
4178
+ })
4148
4179
  });
4149
4180
  var zBatchOperationItemStateEnum = z.enum([
4150
4181
  "ACTIVE",
@@ -4274,10 +4305,10 @@ var zTopologyResponse = z.object({
4274
4305
  brokers: z.array(zBrokerInfo).register(z.globalRegistry, {
4275
4306
  description: "A list of brokers that are part of this cluster."
4276
4307
  }),
4277
- clusterId: z.optional(z.union([
4308
+ clusterId: z.union([
4278
4309
  z.string(),
4279
4310
  z.null()
4280
- ])),
4311
+ ]),
4281
4312
  clusterSize: z.int().register(z.globalRegistry, {
4282
4313
  description: "The number of brokers in the cluster."
4283
4314
  }),
@@ -4303,28 +4334,28 @@ var zEndCursor = z.string().regex(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}(?
4303
4334
  description: "The end cursor in a search query result set."
4304
4335
  });
4305
4336
  var zEvaluatedDecisionInputItem = z.object({
4306
- inputId: z.optional(z.string().register(z.globalRegistry, {
4337
+ inputId: z.string().register(z.globalRegistry, {
4307
4338
  description: "The identifier of the decision input."
4308
- })),
4309
- inputName: z.optional(z.string().register(z.globalRegistry, {
4339
+ }),
4340
+ inputName: z.string().register(z.globalRegistry, {
4310
4341
  description: "The name of the decision input."
4311
- })),
4312
- inputValue: z.optional(z.string().register(z.globalRegistry, {
4313
- description: "The description of the decision input."
4314
- }))
4342
+ }),
4343
+ inputValue: z.string().register(z.globalRegistry, {
4344
+ description: "The value of the decision input."
4345
+ })
4315
4346
  }).register(z.globalRegistry, {
4316
4347
  description: "A decision input that was evaluated within this decision evaluation."
4317
4348
  });
4318
4349
  var zEvaluatedDecisionOutputItem = z.object({
4319
- outputId: z.optional(z.string().register(z.globalRegistry, {
4350
+ outputId: z.string().register(z.globalRegistry, {
4320
4351
  description: "The ID of the evaluated decison output item."
4321
- })),
4322
- outputName: z.optional(z.string().register(z.globalRegistry, {
4352
+ }),
4353
+ outputName: z.string().register(z.globalRegistry, {
4323
4354
  description: "The name of the of the evaluated decison output item."
4324
- })),
4325
- outputValue: z.optional(z.string().register(z.globalRegistry, {
4355
+ }),
4356
+ outputValue: z.string().register(z.globalRegistry, {
4326
4357
  description: "The value of the evaluated decison output item."
4327
- })),
4358
+ }),
4328
4359
  ruleId: z.union([
4329
4360
  z.string(),
4330
4361
  z.null()
@@ -4337,12 +4368,12 @@ var zEvaluatedDecisionOutputItem = z.object({
4337
4368
  description: "The evaluated decision outputs."
4338
4369
  });
4339
4370
  var zMatchedDecisionRuleItem = z.object({
4340
- ruleId: z.optional(z.string().register(z.globalRegistry, {
4371
+ ruleId: z.string().register(z.globalRegistry, {
4341
4372
  description: "The ID of the matched rule."
4342
- })),
4343
- ruleIndex: z.optional(z.int().register(z.globalRegistry, {
4373
+ }),
4374
+ ruleIndex: z.int().register(z.globalRegistry, {
4344
4375
  description: "The index of the matched rule."
4345
- })),
4376
+ }),
4346
4377
  evaluatedOutputs: z.array(zEvaluatedDecisionOutputItem).register(z.globalRegistry, {
4347
4378
  description: "The evaluated decision outputs."
4348
4379
  })
@@ -4366,18 +4397,18 @@ var zDecisionInstanceStateEnum = z.enum([
4366
4397
  description: "The state of the decision instance. UNSPECIFIED and UNKNOWN are deprecated and should not be used anymore, for removal in 8.10"
4367
4398
  });
4368
4399
  var zDocumentCreationFailureDetail = z.object({
4369
- fileName: z.optional(z.string().register(z.globalRegistry, {
4400
+ fileName: z.string().register(z.globalRegistry, {
4370
4401
  description: "The name of the file that failed to upload."
4371
- })),
4372
- status: z.optional(z.int().register(z.globalRegistry, {
4402
+ }),
4403
+ status: z.int().register(z.globalRegistry, {
4373
4404
  description: "The HTTP status code of the failure."
4374
- })),
4375
- title: z.optional(z.string().register(z.globalRegistry, {
4405
+ }),
4406
+ title: z.string().register(z.globalRegistry, {
4376
4407
  description: "A short, human-readable summary of the problem type."
4377
- })),
4378
- detail: z.optional(z.string().register(z.globalRegistry, {
4408
+ }),
4409
+ detail: z.string().register(z.globalRegistry, {
4379
4410
  description: "A human-readable explanation specific to this occurrence of the problem."
4380
- }))
4411
+ })
4381
4412
  });
4382
4413
  var zDocumentLinkRequest = z.object({
4383
4414
  timeToLive: z.optional(z.coerce.bigint().register(z.globalRegistry, {
@@ -4414,6 +4445,11 @@ var zExpressionEvaluationRequest = z.object({
4414
4445
  z.null()
4415
4446
  ]))
4416
4447
  });
4448
+ var zExpressionEvaluationWarningItem = z.object({
4449
+ message: z.string().register(z.globalRegistry, {
4450
+ description: "The warning message"
4451
+ })
4452
+ });
4417
4453
  var zExpressionEvaluationResult = z.object({
4418
4454
  expression: z.string().register(z.globalRegistry, {
4419
4455
  description: "The evaluated expression"
@@ -4421,7 +4457,7 @@ var zExpressionEvaluationResult = z.object({
4421
4457
  result: z.unknown().register(z.globalRegistry, {
4422
4458
  description: "The result value. Its type can vary."
4423
4459
  }),
4424
- warnings: z.array(z.string()).register(z.globalRegistry, {
4460
+ warnings: z.array(zExpressionEvaluationWarningItem).register(z.globalRegistry, {
4425
4461
  description: "List of warnings generated during expression evaluation"
4426
4462
  })
4427
4463
  });
@@ -4809,7 +4845,7 @@ var zGroupClientResult = z.object({
4809
4845
  description: "The ID of the client."
4810
4846
  })
4811
4847
  });
4812
- var zProcessDefinitionId = z.string().min(1).regex(/^[a-zA-Z_][a-zA-Z0-9_\-\.]*$/).register(z.globalRegistry, {
4848
+ var zProcessDefinitionId = z.string().min(1).regex(/^[\p{L}_][\p{L}\p{N}_\-\.]*$/u).register(z.globalRegistry, {
4813
4849
  description: "Id of a process definition, from the model. Only ids of process definitions that are deployed are useful."
4814
4850
  });
4815
4851
  var zElementId = z.string().register(z.globalRegistry, {
@@ -4838,7 +4874,7 @@ var zAdHocSubProcessActivateActivitiesInstruction = z.object({
4838
4874
  var zFormId = z.string().register(z.globalRegistry, {
4839
4875
  description: "The user-defined id for the form"
4840
4876
  });
4841
- var zDecisionDefinitionId = z.string().min(1).max(256).regex(/^[A-Za-z0-9_@.+-]+$/).register(z.globalRegistry, {
4877
+ var zDecisionDefinitionId = z.string().min(1).regex(/^[\p{L}_][\p{L}\p{N}_\-\.]*$/u).register(z.globalRegistry, {
4842
4878
  description: "Id of a decision definition, from the model. Only ids of decision definitions that are deployed are useful."
4843
4879
  });
4844
4880
  var zGlobalListenerId = z.string().register(z.globalRegistry, {
@@ -4940,15 +4976,15 @@ var zAdvancedIncidentStateFilter = z.object({
4940
4976
  description: "Advanced IncidentStateEnum filter"
4941
4977
  });
4942
4978
  var zIncidentProcessInstanceStatisticsByErrorResult = z.object({
4943
- errorHashCode: z.optional(z.int().register(z.globalRegistry, {
4979
+ errorHashCode: z.int().register(z.globalRegistry, {
4944
4980
  description: "The hash code identifying a specific incident error.."
4945
- })),
4946
- errorMessage: z.optional(z.string().register(z.globalRegistry, {
4981
+ }),
4982
+ errorMessage: z.string().register(z.globalRegistry, {
4947
4983
  description: "The error message associated with the incident error hash code."
4948
- })),
4949
- activeInstancesWithErrorCount: z.optional(z.coerce.bigint().register(z.globalRegistry, {
4984
+ }),
4985
+ activeInstancesWithErrorCount: z.coerce.bigint().register(z.globalRegistry, {
4950
4986
  description: "The number of active process instances that currently have an active incident with this error.\n"
4951
- }))
4987
+ })
4952
4988
  });
4953
4989
  var zIncidentProcessInstanceStatisticsByDefinitionFilter = z.object({
4954
4990
  errorHashCode: z.int().register(z.globalRegistry, {
@@ -5017,7 +5053,7 @@ var zJobWorkerStatisticsFilter = z.object({
5017
5053
  });
5018
5054
  var zJobWorkerStatisticsItem = z.object({
5019
5055
  worker: z.string().register(z.globalRegistry, {
5020
- description: "The worker identifier."
5056
+ description: "The name of the worker activating the jobs, mostly used for logging purposes."
5021
5057
  }),
5022
5058
  created: zStatusMetric,
5023
5059
  completed: zStatusMetric,
@@ -5051,6 +5087,34 @@ var zJobTimeSeriesStatisticsItem = z.object({
5051
5087
  }).register(z.globalRegistry, {
5052
5088
  description: "Aggregated job metrics for a single time bucket."
5053
5089
  });
5090
+ var zJobErrorStatisticsFilter = z.object({
5091
+ from: z.iso.datetime().register(z.globalRegistry, {
5092
+ description: "Start of the time window to filter metrics. ISO 8601 date-time format.\n"
5093
+ }),
5094
+ to: z.iso.datetime().register(z.globalRegistry, {
5095
+ description: "End of the time window to filter metrics. ISO 8601 date-time format.\n"
5096
+ }),
5097
+ jobType: z.string().register(z.globalRegistry, {
5098
+ description: "Job type to return error metrics for."
5099
+ }),
5100
+ errorCode: z.optional(zStringFilterProperty),
5101
+ errorMessage: z.optional(zStringFilterProperty)
5102
+ }).register(z.globalRegistry, {
5103
+ description: "Job error statistics search filter."
5104
+ });
5105
+ var zJobErrorStatisticsItem = z.object({
5106
+ errorCode: z.string().register(z.globalRegistry, {
5107
+ description: "The error code identifier."
5108
+ }),
5109
+ errorMessage: z.string().register(z.globalRegistry, {
5110
+ description: "The error message."
5111
+ }),
5112
+ workers: z.int().register(z.globalRegistry, {
5113
+ description: "Number of distinct workers that encountered this error."
5114
+ })
5115
+ }).register(z.globalRegistry, {
5116
+ description: "Aggregated error metrics for a single error type and message combination."
5117
+ });
5054
5118
  var zJobFailRequest = z.object({
5055
5119
  retries: z.optional(z.int().register(z.globalRegistry, {
5056
5120
  description: "The amount of retries the job should have left"
@@ -5404,8 +5468,8 @@ var zConditionalEvaluationInstruction = z.object({
5404
5468
  })
5405
5469
  });
5406
5470
  var zProcessInstanceReference = z.object({
5407
- processDefinitionKey: z.optional(zProcessDefinitionKey),
5408
- processInstanceKey: z.optional(zProcessInstanceKey)
5471
+ processDefinitionKey: zProcessDefinitionKey,
5472
+ processInstanceKey: zProcessInstanceKey
5409
5473
  });
5410
5474
  var zEvaluateConditionalResult = z.object({
5411
5475
  conditionalEvaluationKey: zConditionalEvaluationKey,
@@ -5428,32 +5492,32 @@ var zDeploymentProcessResult = z.object({
5428
5492
  description: "A deployed process."
5429
5493
  });
5430
5494
  var zIncidentProcessInstanceStatisticsByDefinitionResult = z.object({
5431
- processDefinitionId: z.optional(zProcessDefinitionId),
5432
- processDefinitionKey: z.optional(zProcessDefinitionKey),
5433
- processDefinitionName: z.optional(z.string().register(z.globalRegistry, {
5495
+ processDefinitionId: zProcessDefinitionId,
5496
+ processDefinitionKey: zProcessDefinitionKey,
5497
+ processDefinitionName: z.string().register(z.globalRegistry, {
5434
5498
  description: "The name of the process definition."
5435
- })),
5436
- processDefinitionVersion: z.optional(z.int().register(z.globalRegistry, {
5499
+ }),
5500
+ processDefinitionVersion: z.int().register(z.globalRegistry, {
5437
5501
  description: "The version of the process definition."
5438
- })),
5439
- tenantId: z.optional(zTenantId),
5440
- activeInstancesWithErrorCount: z.optional(z.coerce.bigint().register(z.globalRegistry, {
5502
+ }),
5503
+ tenantId: zTenantId,
5504
+ activeInstancesWithErrorCount: z.coerce.bigint().register(z.globalRegistry, {
5441
5505
  description: "The number of active process instances that currently have an incident\nwith the specified error hash code.\n"
5442
- }))
5506
+ })
5443
5507
  });
5444
5508
  var zElementInstanceKey = zLongKey;
5445
5509
  var zUserTaskKey = zLongKey;
5446
5510
  var zFormKey = zLongKey;
5447
5511
  var zDeploymentFormResult = z.object({
5448
- formId: z.optional(zFormId),
5449
- version: z.optional(z.int().register(z.globalRegistry, {
5512
+ formId: zFormId,
5513
+ version: z.int().register(z.globalRegistry, {
5450
5514
  description: "The version of the deployed form."
5451
- })),
5452
- resourceName: z.optional(z.string().register(z.globalRegistry, {
5515
+ }),
5516
+ resourceName: z.string().register(z.globalRegistry, {
5453
5517
  description: "The name of the resource."
5454
- })),
5455
- tenantId: z.optional(zTenantId),
5456
- formKey: z.optional(zFormKey)
5518
+ }),
5519
+ tenantId: zTenantId,
5520
+ formKey: zFormKey
5457
5521
  }).register(z.globalRegistry, {
5458
5522
  description: "A deployed form."
5459
5523
  });
@@ -5469,13 +5533,13 @@ var zFormResult = z.object({
5469
5533
  formKey: zFormKey
5470
5534
  });
5471
5535
  var zUserTaskProperties = z.object({
5472
- action: z.optional(z.string().register(z.globalRegistry, {
5536
+ action: z.string().register(z.globalRegistry, {
5473
5537
  description: "The action performed on the user task."
5474
- })),
5475
- assignee: z.optional(z.union([
5538
+ }),
5539
+ assignee: z.union([
5476
5540
  z.string(),
5477
5541
  z.null()
5478
- ])),
5542
+ ]),
5479
5543
  candidateGroups: z.array(z.string()).register(z.globalRegistry, {
5480
5544
  description: "The groups eligible to claim the task."
5481
5545
  }),
@@ -5485,23 +5549,26 @@ var zUserTaskProperties = z.object({
5485
5549
  changedAttributes: z.array(z.string()).register(z.globalRegistry, {
5486
5550
  description: "The attributes that were changed in the task."
5487
5551
  }),
5488
- dueDate: z.optional(z.union([
5552
+ dueDate: z.union([
5489
5553
  z.string(),
5490
5554
  z.null()
5491
- ])),
5492
- followUpDate: z.optional(z.union([
5555
+ ]),
5556
+ followUpDate: z.union([
5493
5557
  z.string(),
5494
5558
  z.null()
5495
- ])),
5496
- formKey: z.optional(zFormKey),
5497
- priority: z.optional(z.union([
5559
+ ]),
5560
+ formKey: z.union([
5561
+ zFormKey,
5562
+ z.null()
5563
+ ]),
5564
+ priority: z.union([
5498
5565
  z.int().gte(0).lte(100),
5499
5566
  z.null()
5500
- ])),
5501
- userTaskKey: z.optional(z.union([
5567
+ ]),
5568
+ userTaskKey: z.union([
5502
5569
  zUserTaskKey,
5503
5570
  z.null()
5504
- ]))
5571
+ ])
5505
5572
  }).register(z.globalRegistry, {
5506
5573
  description: "Contains properties of a user task."
5507
5574
  });
@@ -5513,10 +5580,10 @@ var zElementInstanceResult = z.object({
5513
5580
  startDate: z.iso.datetime().register(z.globalRegistry, {
5514
5581
  description: "Date when element instance started."
5515
5582
  }),
5516
- endDate: z.optional(z.union([
5583
+ endDate: z.union([
5517
5584
  z.iso.datetime(),
5518
5585
  z.null()
5519
- ])),
5586
+ ]),
5520
5587
  elementId: zElementId,
5521
5588
  elementName: z.string().register(z.globalRegistry, {
5522
5589
  description: "The element name for this element instance."
@@ -5564,10 +5631,10 @@ var zElementInstanceResult = z.object({
5564
5631
  z.null()
5565
5632
  ]),
5566
5633
  processDefinitionKey: zProcessDefinitionKey,
5567
- incidentKey: z.optional(z.union([
5634
+ incidentKey: z.union([
5568
5635
  zIncidentKey,
5569
5636
  z.null()
5570
- ]))
5637
+ ])
5571
5638
  });
5572
5639
  var zJobKey = zLongKey;
5573
5640
  var zIncidentResult = z.object({
@@ -5626,10 +5693,10 @@ var zActivatedJobResult = z.object({
5626
5693
  elementInstanceKey: zElementInstanceKey,
5627
5694
  kind: zJobKindEnum,
5628
5695
  listenerEventType: zJobListenerEventTypeEnum,
5629
- userTask: z.optional(z.union([
5696
+ userTask: z.union([
5630
5697
  zUserTaskProperties,
5631
5698
  z.null()
5632
- ])),
5699
+ ]),
5633
5700
  tags: zTagSet,
5634
5701
  rootProcessInstanceKey: z.union([
5635
5702
  zProcessInstanceKey,
@@ -5647,38 +5714,38 @@ var zJobSearchResult = z.object({
5647
5714
  customHeaders: z.record(z.string(), z.string()).register(z.globalRegistry, {
5648
5715
  description: "A set of custom headers defined during modelling."
5649
5716
  }),
5650
- deadline: z.optional(z.union([
5717
+ deadline: z.union([
5651
5718
  z.iso.datetime(),
5652
5719
  z.null()
5653
- ])),
5654
- deniedReason: z.optional(z.union([
5720
+ ]),
5721
+ deniedReason: z.union([
5655
5722
  z.string(),
5656
5723
  z.null()
5657
- ])),
5724
+ ]),
5658
5725
  elementId: z.union([
5659
5726
  zElementId,
5660
5727
  z.null()
5661
5728
  ]),
5662
5729
  elementInstanceKey: zElementInstanceKey,
5663
- endTime: z.optional(z.union([
5730
+ endTime: z.union([
5664
5731
  z.iso.datetime(),
5665
5732
  z.null()
5666
- ])),
5667
- errorCode: z.optional(z.union([
5733
+ ]),
5734
+ errorCode: z.union([
5668
5735
  z.string(),
5669
5736
  z.null()
5670
- ])),
5671
- errorMessage: z.optional(z.union([
5737
+ ]),
5738
+ errorMessage: z.union([
5672
5739
  z.string(),
5673
5740
  z.null()
5674
- ])),
5741
+ ]),
5675
5742
  hasFailedWithRetriesLeft: z.boolean().register(z.globalRegistry, {
5676
5743
  description: "Indicates whether the job has failed with retries left."
5677
5744
  }),
5678
- isDenied: z.optional(z.union([
5745
+ isDenied: z.union([
5679
5746
  z.boolean(),
5680
5747
  z.null()
5681
- ])),
5748
+ ]),
5682
5749
  jobKey: zJobKey,
5683
5750
  kind: zJobKindEnum,
5684
5751
  listenerEventType: zJobListenerEventTypeEnum,
@@ -5700,12 +5767,14 @@ var zJobSearchResult = z.object({
5700
5767
  worker: z.string().register(z.globalRegistry, {
5701
5768
  description: "The name of the worker of this job."
5702
5769
  }),
5703
- creationTime: z.optional(z.iso.datetime().register(z.globalRegistry, {
5704
- description: "When the job was created. Field is present for jobs created after 8.9."
5705
- })),
5706
- lastUpdateTime: z.optional(z.iso.datetime().register(z.globalRegistry, {
5707
- description: "When the job was last updated. Field is present for jobs created after 8.9."
5708
- }))
5770
+ creationTime: z.union([
5771
+ z.iso.datetime(),
5772
+ z.null()
5773
+ ]),
5774
+ lastUpdateTime: z.union([
5775
+ z.iso.datetime(),
5776
+ z.null()
5777
+ ])
5709
5778
  });
5710
5779
  var zDecisionDefinitionKey = zLongKey;
5711
5780
  var zDecisionEvaluationByKey = z.object({
@@ -5721,28 +5790,28 @@ var zDecisionEvaluationInstruction = z.union([
5721
5790
  ]);
5722
5791
  var zDecisionEvaluationInstanceKey = zLongKey;
5723
5792
  var zEvaluatedDecisionResult = z.object({
5724
- decisionDefinitionId: z.optional(zDecisionDefinitionId),
5725
- decisionDefinitionName: z.optional(z.string().register(z.globalRegistry, {
5793
+ decisionDefinitionId: zDecisionDefinitionId,
5794
+ decisionDefinitionName: z.string().register(z.globalRegistry, {
5726
5795
  description: "The name of the decision which was evaluated."
5727
- })),
5728
- decisionDefinitionVersion: z.optional(z.int().register(z.globalRegistry, {
5796
+ }),
5797
+ decisionDefinitionVersion: z.int().register(z.globalRegistry, {
5729
5798
  description: "The version of the decision which was evaluated."
5730
- })),
5799
+ }),
5731
5800
  decisionDefinitionType: z.string().register(z.globalRegistry, {
5732
5801
  description: "The type of the decision which was evaluated."
5733
5802
  }),
5734
- output: z.optional(z.string().register(z.globalRegistry, {
5803
+ output: z.string().register(z.globalRegistry, {
5735
5804
  description: "JSON document that will instantiate the result of the decision which was evaluated.\n"
5736
- })),
5737
- tenantId: z.optional(zTenantId),
5805
+ }),
5806
+ tenantId: zTenantId,
5738
5807
  matchedRules: z.array(zMatchedDecisionRuleItem).register(z.globalRegistry, {
5739
5808
  description: "The decision rules that matched within this decision evaluation."
5740
5809
  }),
5741
5810
  evaluatedInputs: z.array(zEvaluatedDecisionInputItem).register(z.globalRegistry, {
5742
5811
  description: "The decision inputs that were evaluated within this decision evaluation."
5743
5812
  }),
5744
- decisionDefinitionKey: z.optional(zDecisionDefinitionKey),
5745
- decisionEvaluationInstanceKey: z.optional(zDecisionEvaluationInstanceKey)
5813
+ decisionDefinitionKey: zDecisionDefinitionKey,
5814
+ decisionEvaluationInstanceKey: zDecisionEvaluationInstanceKey
5746
5815
  }).register(z.globalRegistry, {
5747
5816
  description: "A decision that was evaluated."
5748
5817
  });
@@ -5880,37 +5949,37 @@ var zDecisionRequirementsResult = z.object({
5880
5949
  })
5881
5950
  });
5882
5951
  var zDeploymentDecisionResult = z.object({
5883
- decisionDefinitionId: z.optional(zDecisionDefinitionId),
5884
- version: z.optional(z.int().register(z.globalRegistry, {
5952
+ decisionDefinitionId: zDecisionDefinitionId,
5953
+ version: z.int().register(z.globalRegistry, {
5885
5954
  description: "The assigned decision version."
5886
- })),
5887
- name: z.optional(z.string().register(z.globalRegistry, {
5955
+ }),
5956
+ name: z.string().register(z.globalRegistry, {
5888
5957
  description: "The DMN name of the decision, as parsed during deployment."
5889
- })),
5890
- tenantId: z.optional(zTenantId),
5891
- decisionRequirementsId: z.optional(z.string().register(z.globalRegistry, {
5958
+ }),
5959
+ tenantId: zTenantId,
5960
+ decisionRequirementsId: z.string().register(z.globalRegistry, {
5892
5961
  description: "The dmn ID of the decision requirements graph that this decision is part of, as parsed during deployment.\n"
5893
- })),
5894
- decisionDefinitionKey: z.optional(zDecisionDefinitionKey),
5895
- decisionRequirementsKey: z.optional(zDecisionRequirementsKey)
5962
+ }),
5963
+ decisionDefinitionKey: zDecisionDefinitionKey,
5964
+ decisionRequirementsKey: zDecisionRequirementsKey
5896
5965
  }).register(z.globalRegistry, {
5897
5966
  description: "A deployed decision."
5898
5967
  });
5899
5968
  var zDeploymentDecisionRequirementsResult = z.object({
5900
- decisionRequirementsId: z.optional(z.string().register(z.globalRegistry, {
5969
+ decisionRequirementsId: z.string().register(z.globalRegistry, {
5901
5970
  description: "The id of the deployed decision requirements."
5902
- })),
5903
- decisionRequirementsName: z.optional(z.string().register(z.globalRegistry, {
5971
+ }),
5972
+ decisionRequirementsName: z.string().register(z.globalRegistry, {
5904
5973
  description: "The name of the deployed decision requirements."
5905
- })),
5906
- version: z.optional(z.int().register(z.globalRegistry, {
5974
+ }),
5975
+ version: z.int().register(z.globalRegistry, {
5907
5976
  description: "The version of the deployed decision requirements."
5908
- })),
5909
- resourceName: z.optional(z.string().register(z.globalRegistry, {
5977
+ }),
5978
+ resourceName: z.string().register(z.globalRegistry, {
5910
5979
  description: "The name of the resource."
5911
- })),
5912
- tenantId: z.optional(zTenantId),
5913
- decisionRequirementsKey: z.optional(zDecisionRequirementsKey)
5980
+ }),
5981
+ tenantId: zTenantId,
5982
+ decisionRequirementsKey: zDecisionRequirementsKey
5914
5983
  }).register(z.globalRegistry, {
5915
5984
  description: "Deployed decision requirements."
5916
5985
  });
@@ -5921,17 +5990,17 @@ var zResourceKey = z.union([
5921
5990
  zDecisionDefinitionKey
5922
5991
  ]);
5923
5992
  var zDeploymentResourceResult = z.object({
5924
- resourceId: z.optional(z.string().register(z.globalRegistry, {
5993
+ resourceId: z.string().register(z.globalRegistry, {
5925
5994
  description: "The resource id of the deployed resource."
5926
- })),
5927
- resourceName: z.optional(z.string().register(z.globalRegistry, {
5995
+ }),
5996
+ resourceName: z.string().register(z.globalRegistry, {
5928
5997
  description: "The name of the deployed resource."
5929
- })),
5930
- version: z.optional(z.int().register(z.globalRegistry, {
5998
+ }),
5999
+ version: z.int().register(z.globalRegistry, {
5931
6000
  description: "The description of the deployed resource."
5932
- })),
5933
- tenantId: z.optional(zTenantId),
5934
- resourceKey: z.optional(zResourceKey)
6001
+ }),
6002
+ tenantId: zTenantId,
6003
+ resourceKey: zResourceKey
5935
6004
  }).register(z.globalRegistry, {
5936
6005
  description: "A deployed Resource."
5937
6006
  });
@@ -6041,14 +6110,14 @@ var zBatchOperationResponse = z.object({
6041
6110
  batchOperationKey: zBatchOperationKey,
6042
6111
  state: zBatchOperationStateEnum,
6043
6112
  batchOperationType: zBatchOperationTypeEnum,
6044
- startDate: z.optional(z.union([
6113
+ startDate: z.union([
6045
6114
  z.iso.datetime(),
6046
6115
  z.null()
6047
- ])),
6048
- endDate: z.optional(z.union([
6116
+ ]),
6117
+ endDate: z.union([
6049
6118
  z.iso.datetime(),
6050
6119
  z.null()
6051
- ])),
6120
+ ]),
6052
6121
  actorType: z.union([
6053
6122
  zAuditLogActorTypeEnum,
6054
6123
  z.null()
@@ -6071,17 +6140,17 @@ var zBatchOperationResponse = z.object({
6071
6140
  })
6072
6141
  });
6073
6142
  var zBatchOperationItemResponse = z.object({
6074
- operationType: z.optional(zBatchOperationTypeEnum),
6075
- batchOperationKey: z.optional(zBatchOperationKey),
6076
- itemKey: z.optional(z.string().register(z.globalRegistry, {
6143
+ operationType: zBatchOperationTypeEnum,
6144
+ batchOperationKey: zBatchOperationKey,
6145
+ itemKey: z.string().register(z.globalRegistry, {
6077
6146
  description: "Key of the item, e.g. a process instance key."
6078
- })),
6079
- processInstanceKey: z.optional(zProcessInstanceKey),
6147
+ }),
6148
+ processInstanceKey: zProcessInstanceKey,
6080
6149
  rootProcessInstanceKey: z.union([
6081
6150
  zProcessInstanceKey,
6082
6151
  z.null()
6083
6152
  ]),
6084
- state: z.optional(z.enum([
6153
+ state: z.enum([
6085
6154
  "ACTIVE",
6086
6155
  "COMPLETED",
6087
6156
  "SKIPPED",
@@ -6089,21 +6158,22 @@ var zBatchOperationItemResponse = z.object({
6089
6158
  "FAILED"
6090
6159
  ]).register(z.globalRegistry, {
6091
6160
  description: "State of the item."
6092
- })),
6093
- processedDate: z.optional(z.iso.datetime().register(z.globalRegistry, {
6094
- description: "the date this item was processed."
6095
- })),
6096
- errorMessage: z.optional(z.union([
6161
+ }),
6162
+ processedDate: z.union([
6163
+ z.iso.datetime(),
6164
+ z.null()
6165
+ ]),
6166
+ errorMessage: z.union([
6097
6167
  z.string(),
6098
6168
  z.null()
6099
- ]))
6169
+ ])
6100
6170
  });
6101
6171
  var zDeleteResourceResponse = z.object({
6102
6172
  resourceKey: zResourceKey,
6103
- batchOperation: z.optional(z.union([
6173
+ batchOperation: z.union([
6104
6174
  zBatchOperationCreatedResult,
6105
6175
  z.null()
6106
- ]))
6176
+ ])
6107
6177
  });
6108
6178
  var zOperationReference = z.coerce.bigint().gte(BigInt(1)).register(z.globalRegistry, {
6109
6179
  description: "A reference key chosen by the user that will be part of all records resulting from this operation.\nMust be > 0 if provided.\n"
@@ -6164,10 +6234,6 @@ var zAuditLogResult = z.object({
6164
6234
  z.null()
6165
6235
  ]),
6166
6236
  result: zAuditLogResultEnum,
6167
- annotation: z.union([
6168
- z.string(),
6169
- z.null()
6170
- ]),
6171
6237
  category: zAuditLogCategoryEnum,
6172
6238
  processDefinitionId: z.union([
6173
6239
  zProcessDefinitionId,
@@ -6557,27 +6623,37 @@ var zAdvancedMessageSubscriptionStateFilter = z.object({
6557
6623
  });
6558
6624
  var zMessageSubscriptionKey = zLongKey;
6559
6625
  var zMessageSubscriptionResult = z.object({
6560
- messageSubscriptionKey: z.optional(zMessageSubscriptionKey),
6561
- processDefinitionId: z.optional(zProcessDefinitionId),
6562
- processDefinitionKey: z.optional(zProcessDefinitionKey),
6563
- processInstanceKey: z.optional(zProcessInstanceKey),
6626
+ messageSubscriptionKey: zMessageSubscriptionKey,
6627
+ processDefinitionId: zProcessDefinitionId,
6628
+ processDefinitionKey: z.union([
6629
+ zProcessDefinitionKey,
6630
+ z.null()
6631
+ ]),
6632
+ processInstanceKey: z.union([
6633
+ zProcessInstanceKey,
6634
+ z.null()
6635
+ ]),
6564
6636
  rootProcessInstanceKey: z.union([
6565
6637
  zProcessInstanceKey,
6566
6638
  z.null()
6567
6639
  ]),
6568
- elementId: z.optional(zElementId),
6569
- elementInstanceKey: z.optional(zElementInstanceKey),
6570
- messageSubscriptionState: z.optional(zMessageSubscriptionStateEnum),
6571
- lastUpdatedDate: z.optional(z.iso.datetime().register(z.globalRegistry, {
6640
+ elementId: zElementId,
6641
+ elementInstanceKey: z.union([
6642
+ zElementInstanceKey,
6643
+ z.null()
6644
+ ]),
6645
+ messageSubscriptionState: zMessageSubscriptionStateEnum,
6646
+ lastUpdatedDate: z.iso.datetime().register(z.globalRegistry, {
6572
6647
  description: "The last updated date of the message subscription."
6573
- })),
6574
- messageName: z.optional(z.string().register(z.globalRegistry, {
6648
+ }),
6649
+ messageName: z.string().register(z.globalRegistry, {
6575
6650
  description: "The name of the message associated with the message subscription."
6576
- })),
6577
- correlationKey: z.optional(z.string().register(z.globalRegistry, {
6578
- description: "The correlation key of the message subscription."
6579
- })),
6580
- tenantId: z.optional(zTenantId)
6651
+ }),
6652
+ correlationKey: z.union([
6653
+ z.string(),
6654
+ z.null()
6655
+ ]),
6656
+ tenantId: zTenantId
6581
6657
  });
6582
6658
  var zAdvancedMessageSubscriptionKeyFilter = z.object({
6583
6659
  "$eq": z.optional(zMessageSubscriptionKey),
@@ -6609,16 +6685,20 @@ var zMessagePublicationResult = z.object({
6609
6685
  description: "The message key of the published message."
6610
6686
  });
6611
6687
  var zCorrelatedMessageSubscriptionResult = z.object({
6612
- correlationKey: z.string().register(z.globalRegistry, {
6613
- description: "The correlation key of the message."
6614
- }),
6688
+ correlationKey: z.union([
6689
+ z.string(),
6690
+ z.null()
6691
+ ]),
6615
6692
  correlationTime: z.iso.datetime().register(z.globalRegistry, {
6616
6693
  description: "The time when the message was correlated."
6617
6694
  }),
6618
6695
  elementId: z.string().register(z.globalRegistry, {
6619
6696
  description: "The element ID that received the message."
6620
6697
  }),
6621
- elementInstanceKey: z.optional(zElementInstanceKey),
6698
+ elementInstanceKey: z.union([
6699
+ zElementInstanceKey,
6700
+ z.null()
6701
+ ]),
6622
6702
  messageKey: zMessageKey,
6623
6703
  messageName: z.string().register(z.globalRegistry, {
6624
6704
  description: "The name of the message."
@@ -6627,7 +6707,7 @@ var zCorrelatedMessageSubscriptionResult = z.object({
6627
6707
  description: "The partition ID that correlated the message."
6628
6708
  }),
6629
6709
  processDefinitionId: zProcessDefinitionId,
6630
- processDefinitionKey: z.optional(zProcessDefinitionKey),
6710
+ processDefinitionKey: zProcessDefinitionKey,
6631
6711
  processInstanceKey: zProcessInstanceKey,
6632
6712
  rootProcessInstanceKey: z.union([
6633
6713
  zProcessInstanceKey,
@@ -6701,19 +6781,19 @@ var zProcessDefinitionResult = z.object({
6701
6781
  })
6702
6782
  });
6703
6783
  var zProcessElementStatisticsResult = z.object({
6704
- elementId: z.optional(zElementId),
6705
- active: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6784
+ elementId: zElementId,
6785
+ active: z.coerce.bigint().register(z.globalRegistry, {
6706
6786
  description: "The total number of active instances of the element."
6707
- })),
6708
- canceled: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6787
+ }),
6788
+ canceled: z.coerce.bigint().register(z.globalRegistry, {
6709
6789
  description: "The total number of canceled instances of the element."
6710
- })),
6711
- incidents: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6790
+ }),
6791
+ incidents: z.coerce.bigint().register(z.globalRegistry, {
6712
6792
  description: "The total number of incidents for the element."
6713
- })),
6714
- completed: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6793
+ }),
6794
+ completed: z.coerce.bigint().register(z.globalRegistry, {
6715
6795
  description: "The total number of completed instances of the element."
6716
- }))
6796
+ })
6717
6797
  }).register(z.globalRegistry, {
6718
6798
  description: "Process element statistics response."
6719
6799
  });
@@ -6725,32 +6805,32 @@ var zProcessDefinitionElementStatisticsQueryResult = z.object({
6725
6805
  description: "Process definition element statistics query response."
6726
6806
  });
6727
6807
  var zProcessDefinitionMessageSubscriptionStatisticsResult = z.object({
6728
- processDefinitionId: z.optional(zProcessDefinitionId),
6729
- tenantId: z.optional(zTenantId),
6730
- processDefinitionKey: z.optional(zProcessDefinitionKey),
6731
- processInstancesWithActiveSubscriptions: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6808
+ processDefinitionId: zProcessDefinitionId,
6809
+ tenantId: zTenantId,
6810
+ processDefinitionKey: zProcessDefinitionKey,
6811
+ processInstancesWithActiveSubscriptions: z.coerce.bigint().register(z.globalRegistry, {
6732
6812
  description: "The number of process instances with active message subscriptions."
6733
- })),
6734
- activeSubscriptions: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6813
+ }),
6814
+ activeSubscriptions: z.coerce.bigint().register(z.globalRegistry, {
6735
6815
  description: "The total number of active message subscriptions for this process definition key."
6736
- }))
6816
+ })
6737
6817
  });
6738
6818
  var zProcessDefinitionInstanceStatisticsResult = z.object({
6739
- processDefinitionId: z.optional(zProcessDefinitionId),
6740
- tenantId: z.optional(zTenantId),
6741
- latestProcessDefinitionName: z.optional(z.union([
6819
+ processDefinitionId: zProcessDefinitionId,
6820
+ tenantId: zTenantId,
6821
+ latestProcessDefinitionName: z.union([
6742
6822
  z.string(),
6743
6823
  z.null()
6744
- ])),
6745
- hasMultipleVersions: z.optional(z.boolean().register(z.globalRegistry, {
6824
+ ]),
6825
+ hasMultipleVersions: z.boolean().register(z.globalRegistry, {
6746
6826
  description: "Indicates whether multiple versions of this process definition instance are deployed."
6747
- })),
6748
- activeInstancesWithoutIncidentCount: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6827
+ }),
6828
+ activeInstancesWithoutIncidentCount: z.coerce.bigint().register(z.globalRegistry, {
6749
6829
  description: "Total number of currently active process instances of this definition that do not have incidents."
6750
- })),
6751
- activeInstancesWithIncidentCount: z.optional(z.coerce.bigint().register(z.globalRegistry, {
6830
+ }),
6831
+ activeInstancesWithIncidentCount: z.coerce.bigint().register(z.globalRegistry, {
6752
6832
  description: "Total number of currently active process instances of this definition that have at least one incident."
6753
- }))
6833
+ })
6754
6834
  }).register(z.globalRegistry, {
6755
6835
  description: "Process definition instance statistics response."
6756
6836
  });
@@ -6866,10 +6946,10 @@ var zCreateProcessInstanceResult = z.object({
6866
6946
  processDefinitionKey: zProcessDefinitionKey,
6867
6947
  processInstanceKey: zProcessInstanceKey,
6868
6948
  tags: zTagSet,
6869
- businessId: z.optional(z.union([
6949
+ businessId: z.union([
6870
6950
  zBusinessId,
6871
6951
  z.null()
6872
- ]))
6952
+ ])
6873
6953
  });
6874
6954
  var zCancelProcessInstanceRequest = z.union([
6875
6955
  z.object({
@@ -6891,18 +6971,18 @@ var zProcessInstanceCallHierarchyEntry = z.object({
6891
6971
  })
6892
6972
  });
6893
6973
  var zProcessInstanceSequenceFlowResult = z.object({
6894
- sequenceFlowId: z.optional(z.string().register(z.globalRegistry, {
6974
+ sequenceFlowId: z.string().register(z.globalRegistry, {
6895
6975
  description: "The sequence flow id."
6896
- })),
6897
- processInstanceKey: z.optional(zProcessInstanceKey),
6976
+ }),
6977
+ processInstanceKey: zProcessInstanceKey,
6898
6978
  rootProcessInstanceKey: z.union([
6899
6979
  zProcessInstanceKey,
6900
6980
  z.null()
6901
6981
  ]),
6902
- processDefinitionKey: z.optional(zProcessDefinitionKey),
6903
- processDefinitionId: z.optional(zProcessDefinitionId),
6904
- elementId: z.optional(zElementId),
6905
- tenantId: z.optional(zTenantId)
6982
+ processDefinitionKey: zProcessDefinitionKey,
6983
+ processDefinitionId: zProcessDefinitionId,
6984
+ elementId: zElementId,
6985
+ tenantId: zTenantId
6906
6986
  }).register(z.globalRegistry, {
6907
6987
  description: "Process instance sequence flow result."
6908
6988
  });
@@ -7239,6 +7319,12 @@ var zJobTimeSeriesStatisticsQuery = z.object({
7239
7319
  }).register(z.globalRegistry, {
7240
7320
  description: "Job time-series statistics query."
7241
7321
  });
7322
+ var zJobErrorStatisticsQuery = z.object({
7323
+ filter: zJobErrorStatisticsFilter,
7324
+ page: z.optional(zCursorForwardPagination)
7325
+ }).register(z.globalRegistry, {
7326
+ description: "Job error statistics query."
7327
+ });
7242
7328
  var zCursorBackwardPagination = z.object({
7243
7329
  before: zStartCursor,
7244
7330
  limit: z.optional(z.int().gte(1).lte(1e4).register(z.globalRegistry, {
@@ -7264,7 +7350,6 @@ var zAuditLogSearchQuerySortRequest = z.object({
7264
7350
  field: z.enum([
7265
7351
  "actorId",
7266
7352
  "actorType",
7267
- "annotation",
7268
7353
  "auditLogKey",
7269
7354
  "batchOperationKey",
7270
7355
  "batchOperationType",
@@ -7489,7 +7574,6 @@ var zIncidentSearchQuerySortRequest = z.object({
7489
7574
  "processDefinitionId",
7490
7575
  "processInstanceKey",
7491
7576
  "errorType",
7492
- "errorMessage",
7493
7577
  "elementId",
7494
7578
  "elementInstanceKey",
7495
7579
  "creationTime",
@@ -7891,6 +7975,14 @@ var zJobTimeSeriesStatisticsQueryResult = zSearchQueryResponse.and(z.object({
7891
7975
  }).register(z.globalRegistry, {
7892
7976
  description: "Job time-series statistics query result."
7893
7977
  }));
7978
+ var zJobErrorStatisticsQueryResult = zSearchQueryResponse.and(z.object({
7979
+ items: z.array(zJobErrorStatisticsItem).register(z.globalRegistry, {
7980
+ description: "The list of per-error statistics items."
7981
+ }),
7982
+ page: zSearchQueryPageResponse
7983
+ }).register(z.globalRegistry, {
7984
+ description: "Job error statistics query result."
7985
+ }));
7894
7986
  var zJobSearchQueryResult = zSearchQueryResponse.and(z.object({
7895
7987
  items: z.array(zJobSearchResult).register(z.globalRegistry, {
7896
7988
  description: "The matching jobs."
@@ -8000,6 +8092,33 @@ var zUsageMetricsResponse = zUsageMetricsResponseItem.and(z.object({
8000
8092
  description: "The usage metrics by tenants. Only available if request `withTenants` query parameter was `true`."
8001
8093
  })
8002
8094
  }));
8095
+ var zJobMetricsConfigurationResponse = z.object({
8096
+ enabled: z.boolean().register(z.globalRegistry, {
8097
+ description: "Whether job metrics export is enabled."
8098
+ }),
8099
+ exportInterval: z.string().register(z.globalRegistry, {
8100
+ description: "The interval at which job metrics are exported, as an ISO 8601 duration."
8101
+ }),
8102
+ maxWorkerNameLength: z.int().register(z.globalRegistry, {
8103
+ description: "The maximum length of the worker name used in job metrics labels."
8104
+ }),
8105
+ maxJobTypeLength: z.int().register(z.globalRegistry, {
8106
+ description: "The maximum length of the job type used in job metrics labels."
8107
+ }),
8108
+ maxTenantIdLength: z.int().register(z.globalRegistry, {
8109
+ description: "The maximum length of the tenant ID used in job metrics labels."
8110
+ }),
8111
+ maxUniqueKeys: z.int().register(z.globalRegistry, {
8112
+ description: "The maximum number of unique metric keys tracked for job metrics."
8113
+ })
8114
+ }).register(z.globalRegistry, {
8115
+ description: "Configuration for job metrics collection and export."
8116
+ });
8117
+ var zSystemConfigurationResponse = z.object({
8118
+ jobMetrics: zJobMetricsConfigurationResponse
8119
+ }).register(z.globalRegistry, {
8120
+ description: "Envelope for all system configuration sections. Each property\nrepresents a feature area.\n"
8121
+ });
8003
8122
  var zTenantCreateRequest = z.object({
8004
8123
  tenantId: z.string().min(1).max(256).regex(/^[A-Za-z0-9_@.+-]+$/).register(z.globalRegistry, {
8005
8124
  description: "The unique ID for the tenant. Must be 255 characters or less. Can contain letters, numbers, [`_`, `-`, `+`, `.`, `@`]."
@@ -8052,18 +8171,18 @@ var zTenantResult = z.object({
8052
8171
  description: "Tenant search response item."
8053
8172
  });
8054
8173
  var zCamundaUserResult = z.object({
8055
- username: z.optional(z.union([
8174
+ username: z.union([
8056
8175
  zUsername,
8057
8176
  z.null()
8058
- ])),
8059
- displayName: z.optional(z.union([
8177
+ ]),
8178
+ displayName: z.union([
8060
8179
  z.string(),
8061
8180
  z.null()
8062
- ])),
8063
- email: z.optional(z.union([
8181
+ ]),
8182
+ email: z.union([
8064
8183
  z.string(),
8065
8184
  z.null()
8066
- ])),
8185
+ ]),
8067
8186
  authorizedComponents: z.array(z.string()).register(z.globalRegistry, {
8068
8187
  description: "The web components the user is authorized to use."
8069
8188
  }),
@@ -8504,12 +8623,12 @@ var zVariableResultBase = z.object({
8504
8623
  description: "Variable response item."
8505
8624
  });
8506
8625
  var zVariableSearchResult = zVariableResultBase.and(z.object({
8507
- value: z.optional(z.string().register(z.globalRegistry, {
8626
+ value: z.string().register(z.globalRegistry, {
8508
8627
  description: "Value of this variable. Can be truncated."
8509
- })),
8510
- isTruncated: z.optional(z.boolean().register(z.globalRegistry, {
8628
+ }),
8629
+ isTruncated: z.boolean().register(z.globalRegistry, {
8511
8630
  description: "Whether the value is truncated or not."
8512
- }))
8631
+ })
8513
8632
  }).register(z.globalRegistry, {
8514
8633
  description: "Variable search response item."
8515
8634
  }));
@@ -9117,6 +9236,7 @@ var zBaseProcessInstanceFilterFields = z.object({
9117
9236
  parentProcessInstanceKey: z.optional(zProcessInstanceKeyFilterProperty),
9118
9237
  parentElementInstanceKey: z.optional(zElementInstanceKeyFilterProperty),
9119
9238
  batchOperationId: z.optional(zStringFilterProperty),
9239
+ batchOperationKey: z.optional(zStringFilterProperty),
9120
9240
  errorMessage: z.optional(zStringFilterProperty),
9121
9241
  hasRetriesLeft: z.optional(z.boolean().register(z.globalRegistry, {
9122
9242
  description: "Whether the process has failed jobs with retries left."
@@ -9518,7 +9638,7 @@ var zDeleteDecisionInstanceData = z.object({
9518
9638
  z.null()
9519
9639
  ])),
9520
9640
  path: z.object({
9521
- decisionInstanceKey: zDecisionInstanceKey
9641
+ decisionEvaluationKey: zDecisionEvaluationKey
9522
9642
  }),
9523
9643
  query: z.optional(z.never())
9524
9644
  });
@@ -10076,6 +10196,12 @@ var zGetJobTimeSeriesStatisticsData = z.object({
10076
10196
  query: z.optional(z.never())
10077
10197
  });
10078
10198
  var zGetJobTimeSeriesStatisticsResponse = zJobTimeSeriesStatisticsQueryResult;
10199
+ var zGetJobErrorStatisticsData = z.object({
10200
+ body: zJobErrorStatisticsQuery,
10201
+ path: z.optional(z.never()),
10202
+ query: z.optional(z.never())
10203
+ });
10204
+ var zGetJobErrorStatisticsResponse = zJobErrorStatisticsQueryResult;
10079
10205
  var zGetLicenseData = z.object({
10080
10206
  body: z.optional(z.never()),
10081
10207
  path: z.optional(z.never()),
@@ -10664,6 +10790,12 @@ var zGetUsageMetricsData = z.object({
10664
10790
  })
10665
10791
  });
10666
10792
  var zGetUsageMetricsResponse = zUsageMetricsResponse;
10793
+ var zGetSystemConfigurationData = z.object({
10794
+ body: z.optional(z.never()),
10795
+ path: z.optional(z.never()),
10796
+ query: z.optional(z.never())
10797
+ });
10798
+ var zGetSystemConfigurationResponse = zSystemConfigurationResponse;
10667
10799
  var zCreateTenantData = z.object({
10668
10800
  body: zTenantCreateRequest,
10669
10801
  path: z.optional(z.never()),
@@ -12426,7 +12558,7 @@ function installAuthInterceptor(client2, getStrategy, getAuthHeaders) {
12426
12558
  }
12427
12559
 
12428
12560
  // src/runtime/version.ts
12429
- var packageVersion = "8.9.0-alpha.13";
12561
+ var packageVersion = "8.9.0-alpha.14";
12430
12562
 
12431
12563
  // src/runtime/supportLogger.ts
12432
12564
  var NoopSupportLogger = class {
@@ -13372,143 +13504,576 @@ var BackpressureManager = class {
13372
13504
  } else {
13373
13505
  this.backoffMs = Math.min(this.cfg.backoffMaxMs, this.backoffMs * this.cfg.backoffEscalate);
13374
13506
  }
13375
- this.log("backoff.escalate", { delayMs: this.backoffMs });
13507
+ this.log("backoff.escalate", { delayMs: this.backoffMs });
13508
+ }
13509
+ if (this.severity !== prevSeverity)
13510
+ this.log("severity", { severity: this.severity }, prevSeverity);
13511
+ }
13512
+ recordHealthyHint() {
13513
+ if (!this.cfg.enabled && !this.observeOnly) return;
13514
+ if (this.backoffMs > 0) {
13515
+ this.backoffMs = 0;
13516
+ this.log("backoff.clear", { reason: "healthy-hint" });
13517
+ }
13518
+ const now2 = this.now();
13519
+ this.maybeRecover(now2);
13520
+ }
13521
+ scalePermits(factor) {
13522
+ if (this.permitsMax === null) return;
13523
+ const next = Math.max(this.cfg.floorConcurrency, Math.ceil(this.permitsMax * factor));
13524
+ if (next < this.permitsMax) {
13525
+ this.permitsMax = next;
13526
+ this.log("permits.scale", { max: this.permitsMax });
13527
+ }
13528
+ }
13529
+ maybeRecover(now2 = this.now()) {
13530
+ if (this.permitsMax === null || this.observeOnly) return;
13531
+ if (now2 - this.lastRecoverCheck < this.cfg.recoveryIntervalMs) return;
13532
+ this.lastRecoverCheck = now2;
13533
+ if (now2 - this.lastEventAt > this.cfg.decayQuietMs) {
13534
+ const prev = this.severity;
13535
+ if (this.severity === "severe") this.severity = "soft";
13536
+ else if (this.severity === "soft") {
13537
+ this.severity = "healthy";
13538
+ this.healthySince = now2;
13539
+ }
13540
+ if (this.severity === "healthy") this.consecutive = 0;
13541
+ if (prev !== this.severity) {
13542
+ if (this.backoffMs > 0) {
13543
+ this.backoffMs = 0;
13544
+ this.log("backoff.clear", { reason: "severity-decay" });
13545
+ }
13546
+ this.log("severity", { severity: this.severity }, prev);
13547
+ }
13548
+ }
13549
+ if (this.permitsMax !== null) {
13550
+ const bootstrapCap = this.cfg.initialMaxConcurrency ?? 16;
13551
+ if (this.severity !== "healthy") {
13552
+ if (this.permitsMax < bootstrapCap) {
13553
+ this.permitsMax = Math.min(bootstrapCap, this.permitsMax + this.cfg.recoveryStep);
13554
+ if (this.permitsMax > this.cfg.floorConcurrency && this.backoffMs > 0) {
13555
+ this.backoffMs = 0;
13556
+ this.log("backoff.clear", { reason: "left-floor" });
13557
+ }
13558
+ this.log("permits.recover", { max: this.permitsMax, phase: "additive" }, this.severity);
13559
+ this.release();
13560
+ }
13561
+ } else {
13562
+ if (this.healthySince > 0 && now2 - this.healthySince >= this.cfg.unlimitedAfterHealthyMs) {
13563
+ this.permitsMax = null;
13564
+ this.permitsCurrent = 0;
13565
+ this.backoffMs = 0;
13566
+ while (this.waiters.length) {
13567
+ const w = this.waiters.shift();
13568
+ try {
13569
+ w?.resolve();
13570
+ } catch {
13571
+ }
13572
+ }
13573
+ this.log("permits.unlimited", { reason: "sustained-healthy" }, this.severity);
13574
+ return;
13575
+ }
13576
+ const next = Math.ceil(this.permitsMax * this.cfg.healthyRecoveryMultiplier);
13577
+ if (next > this.permitsMax) {
13578
+ this.permitsMax = next;
13579
+ this.log(
13580
+ "permits.recover",
13581
+ { max: this.permitsMax, phase: "multiplicative" },
13582
+ this.severity
13583
+ );
13584
+ this.release();
13585
+ }
13586
+ }
13587
+ }
13588
+ }
13589
+ };
13590
+
13591
+ // src/runtime/jobActions.ts
13592
+ function enrichActivatedJob(raw, client2, log) {
13593
+ let acknowledged = false;
13594
+ const ack = () => {
13595
+ if (!acknowledged) {
13596
+ acknowledged = true;
13597
+ job.acknowledged = true;
13598
+ }
13599
+ };
13600
+ const job = { ...raw, log };
13601
+ job.complete = async (variables = {}) => {
13602
+ try {
13603
+ await client2.completeJob({ variables, jobKey: raw.jobKey });
13604
+ } finally {
13605
+ ack();
13606
+ }
13607
+ return JobActionReceipt;
13608
+ };
13609
+ job.fail = async (reason) => {
13610
+ try {
13611
+ await client2.failJob({ ...reason, jobKey: raw.jobKey });
13612
+ } finally {
13613
+ ack();
13614
+ }
13615
+ return JobActionReceipt;
13616
+ };
13617
+ job.error = async (error) => {
13618
+ try {
13619
+ await client2.throwJobError({ ...error, jobKey: raw.jobKey });
13620
+ } finally {
13621
+ ack();
13622
+ }
13623
+ return JobActionReceipt;
13624
+ };
13625
+ job.cancelWorkflow = async () => {
13626
+ try {
13627
+ await client2.cancelProcessInstance({
13628
+ processInstanceKey: raw.processInstanceKey
13629
+ });
13630
+ } finally {
13631
+ ack();
13632
+ }
13633
+ return JobActionReceipt;
13634
+ };
13635
+ job.ignore = async () => {
13636
+ ack();
13637
+ return JobActionReceipt;
13638
+ };
13639
+ job.modifyJobTimeout = ({ newTimeoutMs }) => client2.updateJob({ changeset: { timeout: newTimeoutMs }, jobKey: raw.jobKey });
13640
+ job.modifyRetries = ({ retries }) => client2.updateJob({ changeset: { retries }, jobKey: raw.jobKey });
13641
+ return job;
13642
+ }
13643
+
13644
+ // src/runtime/threadedJobWorker.ts
13645
+ var _workerCounter2 = 0;
13646
+ var DEFAULT_LONGPOLL_TIMEOUT2 = 0;
13647
+ var ThreadedJobWorker = class {
13648
+ _client;
13649
+ _pool;
13650
+ _cfg;
13651
+ _name;
13652
+ _activeJobs = 0;
13653
+ _stopped = false;
13654
+ _pollTimer = null;
13655
+ _inFlightActivation = null;
13656
+ _log;
13657
+ _jobQueue = [];
13658
+ constructor(client2, pool, cfg) {
13659
+ this._client = client2;
13660
+ this._pool = pool;
13661
+ this._cfg = { pollIntervalMs: 1, autoStart: true, validateSchemas: false, ...cfg };
13662
+ this._name = cfg.workerName || `threaded-worker-${cfg.jobType}-${++_workerCounter2}`;
13663
+ this._log = this._client.logger().scope(`worker:${this._name}`);
13664
+ if (this._cfg.autoStart) this.start();
13665
+ }
13666
+ get name() {
13667
+ return this._name;
13668
+ }
13669
+ get activeJobs() {
13670
+ return this._activeJobs;
13671
+ }
13672
+ get stopped() {
13673
+ return this._stopped;
13674
+ }
13675
+ /** Number of threads in the shared pool. */
13676
+ get poolSize() {
13677
+ return this._pool.size;
13678
+ }
13679
+ /** Number of threads currently processing a job (across all workers). */
13680
+ get busyThreads() {
13681
+ return this._pool.busyCount;
13682
+ }
13683
+ /** Resolves when the shared thread pool has finished initialising. */
13684
+ get ready() {
13685
+ return this._pool.ready;
13686
+ }
13687
+ start() {
13688
+ if (this._stopped) return;
13689
+ if (this._pollTimer) return;
13690
+ this._log.info("worker.start");
13691
+ const jitterMax = this._cfg.startupJitterMaxSeconds ?? 0;
13692
+ if (jitterMax > 0) {
13693
+ const jitterMs = Math.floor(Math.random() * jitterMax * 1e3);
13694
+ this._log.info(() => ["worker.start.jitter", { delayMs: jitterMs }]);
13695
+ this._scheduleNext(jitterMs);
13696
+ } else {
13697
+ this._scheduleNext(0);
13698
+ }
13699
+ }
13700
+ stop() {
13701
+ this._stopped = true;
13702
+ if (this._pollTimer) clearTimeout(this._pollTimer);
13703
+ this._pollTimer = null;
13704
+ if (this._inFlightActivation?.cancel) {
13705
+ try {
13706
+ this._inFlightActivation.cancel();
13707
+ } catch {
13708
+ }
13709
+ }
13710
+ this._log.info("worker.stop");
13711
+ }
13712
+ async stopGracefully(opts) {
13713
+ const waitUpToMs = opts?.waitUpToMs ?? 5e3;
13714
+ const checkIntervalMs = opts?.checkIntervalMs ?? 10;
13715
+ this._stopped = true;
13716
+ if (this._pollTimer) clearTimeout(this._pollTimer);
13717
+ this._pollTimer = null;
13718
+ const start = Date.now();
13719
+ if (this._inFlightActivation) {
13720
+ try {
13721
+ await Promise.race([
13722
+ this._inFlightActivation,
13723
+ new Promise(
13724
+ (_, rej) => setTimeout(() => rej(new Error("activation.wait.timeout")), waitUpToMs)
13725
+ )
13726
+ ]);
13727
+ } catch (e) {
13728
+ if (e && e.message === "activation.wait.timeout") {
13729
+ this._log.debug("worker.gracefulStop.activationTimeout");
13730
+ }
13731
+ }
13732
+ }
13733
+ while (this._activeJobs > 0 && Date.now() - start < waitUpToMs) {
13734
+ await new Promise((r) => setTimeout(r, checkIntervalMs));
13735
+ }
13736
+ const timedOut = this._activeJobs > 0;
13737
+ if (timedOut) {
13738
+ if (this._inFlightActivation?.cancel) {
13739
+ try {
13740
+ this._inFlightActivation.cancel();
13741
+ } catch {
13742
+ }
13743
+ }
13744
+ this._log.debug("worker.gracefulStop.timeout", { remaining: this._activeJobs });
13745
+ } else {
13746
+ this._log.debug("worker.gracefulStop.done");
13747
+ }
13748
+ return { remainingJobs: this._activeJobs, timedOut };
13749
+ }
13750
+ // ─── Job dispatch ───
13751
+ _drainQueue() {
13752
+ while (this._jobQueue.length > 0) {
13753
+ const idle = this._pool.getIdleWorker();
13754
+ if (!idle) break;
13755
+ const item = this._jobQueue.shift();
13756
+ this._dispatchToThread(idle, item.raw);
13757
+ }
13758
+ }
13759
+ async _dispatchToThread(pw, raw) {
13760
+ const jobData = this._serializeJob(raw);
13761
+ this._pool.dispatch(pw, jobData, this._cfg.handlerModule, {
13762
+ onComplete: () => {
13763
+ this._decrementOnce();
13764
+ this._drainQueue();
13765
+ },
13766
+ onError: (err) => {
13767
+ this._log.error("job.thread.error", { jobKey: raw.jobKey, err });
13768
+ this._client.failJob({
13769
+ jobKey: raw.jobKey,
13770
+ errorMessage: err?.message || "Thread handler error",
13771
+ retries: typeof raw.retries === "number" ? Math.max(0, raw.retries - 1) : 0
13772
+ }).catch((failErr) => {
13773
+ this._log.error("job.fail.error", failErr);
13774
+ }).finally(() => {
13775
+ this._decrementOnce();
13776
+ this._drainQueue();
13777
+ });
13778
+ }
13779
+ });
13780
+ }
13781
+ _serializeJob(raw) {
13782
+ const data = {};
13783
+ for (const [key, value] of Object.entries(raw)) {
13784
+ if (typeof value === "function") continue;
13785
+ if (key === "log") continue;
13786
+ data[key] = value;
13787
+ }
13788
+ return JSON.parse(JSON.stringify(data));
13789
+ }
13790
+ // ─── Polling (same pattern as JobWorker) ───
13791
+ _scheduleNext(delayMs) {
13792
+ if (this._stopped) return;
13793
+ this._pollTimer = setTimeout(() => this._poll(), delayMs);
13794
+ }
13795
+ async _poll() {
13796
+ this._pollTimer = null;
13797
+ if (this._stopped) return;
13798
+ await this._pool.ready;
13799
+ if (this._activeJobs >= this._cfg.maxParallelJobs) {
13800
+ this._scheduleNext(this._cfg.pollIntervalMs);
13801
+ return;
13802
+ }
13803
+ const availableThreads = this._pool.idleCount;
13804
+ const batchSize = Math.min(this._cfg.maxParallelJobs - this._activeJobs, availableThreads);
13805
+ if (batchSize <= 0) {
13806
+ this._scheduleNext(this._cfg.pollIntervalMs);
13807
+ return;
13808
+ }
13809
+ const body = {
13810
+ type: this._cfg.jobType,
13811
+ worker: this._name,
13812
+ maxJobsToActivate: batchSize,
13813
+ requestTimeout: this._cfg.pollTimeoutMs ?? DEFAULT_LONGPOLL_TIMEOUT2,
13814
+ timeout: this._cfg.jobTimeoutMs,
13815
+ ...this._cfg.fetchVariables && this._cfg.fetchVariables.length > 0 ? { fetchVariable: this._cfg.fetchVariables } : {}
13816
+ };
13817
+ this._log.debug(() => ["activation.request", { batchSize }]);
13818
+ let result = [];
13819
+ try {
13820
+ this._inFlightActivation = this._client.activateJobs(body);
13821
+ const activation = await this._inFlightActivation;
13822
+ this._inFlightActivation = null;
13823
+ result = activation?.jobs || [];
13824
+ this._log.debug(() => ["activation.response", { jobs: result.length }]);
13825
+ } catch (e) {
13826
+ this._inFlightActivation = null;
13827
+ if (this._stopped) return;
13828
+ if (e?.name === "CancelSdkError") {
13829
+ this._log.debug("activation.cancelled");
13830
+ } else {
13831
+ this._log.error("activation.error", e);
13832
+ }
13833
+ this._scheduleNext(this._cfg.pollIntervalMs);
13834
+ return;
13835
+ }
13836
+ if (!result || result.length === 0) {
13837
+ this._scheduleNext(this._cfg.pollIntervalMs);
13838
+ return;
13839
+ }
13840
+ this._activeJobs += result.length;
13841
+ this._scheduleNext(0);
13842
+ for (const raw of result) {
13843
+ this._handleJob(raw);
13844
+ }
13845
+ }
13846
+ _handleJob(raw) {
13847
+ if (this._stopped) {
13848
+ this._decrementOnce();
13849
+ return;
13850
+ }
13851
+ let variables = raw.variables;
13852
+ let headers = raw.customHeaders;
13853
+ if (this._cfg.validateSchemas) {
13854
+ if (this._cfg.inputSchema) {
13855
+ const parsed = this._cfg.inputSchema.safeParse(variables);
13856
+ if (!parsed.success) {
13857
+ this._log.warn("job.validation.variables.failed", parsed.error.flatten());
13858
+ this._failValidation(raw, "Invalid variables");
13859
+ return;
13860
+ }
13861
+ variables = parsed.data;
13862
+ }
13863
+ if (this._cfg.customHeadersSchema) {
13864
+ const parsed = this._cfg.customHeadersSchema.safeParse(headers);
13865
+ if (!parsed.success) {
13866
+ this._log.warn("job.validation.headers.failed", parsed.error.flatten());
13867
+ this._failValidation(raw, "Invalid custom headers");
13868
+ return;
13869
+ }
13870
+ headers = parsed.data;
13871
+ }
13376
13872
  }
13377
- if (this.severity !== prevSeverity)
13378
- this.log("severity", { severity: this.severity }, prevSeverity);
13379
- }
13380
- recordHealthyHint() {
13381
- if (!this.cfg.enabled && !this.observeOnly) return;
13382
- if (this.backoffMs > 0) {
13383
- this.backoffMs = 0;
13384
- this.log("backoff.clear", { reason: "healthy-hint" });
13873
+ const enriched = Object.assign(raw, { variables, customHeaders: headers });
13874
+ const idle = this._pool.getIdleWorker();
13875
+ if (idle) {
13876
+ this._dispatchToThread(idle, enriched);
13877
+ } else {
13878
+ this._jobQueue.push({ raw: enriched });
13385
13879
  }
13386
- const now2 = this.now();
13387
- this.maybeRecover(now2);
13388
13880
  }
13389
- scalePermits(factor) {
13390
- if (this.permitsMax === null) return;
13391
- const next = Math.max(this.cfg.floorConcurrency, Math.ceil(this.permitsMax * factor));
13392
- if (next < this.permitsMax) {
13393
- this.permitsMax = next;
13394
- this.log("permits.scale", { max: this.permitsMax });
13881
+ async _failValidation(raw, msg) {
13882
+ try {
13883
+ await this._client.failJob({ jobKey: raw.jobKey, errorMessage: msg });
13884
+ } catch (e) {
13885
+ this._log.error("job.fail.validation.error", e);
13886
+ } finally {
13887
+ this._decrementOnce();
13395
13888
  }
13396
13889
  }
13397
- maybeRecover(now2 = this.now()) {
13398
- if (this.permitsMax === null || this.observeOnly) return;
13399
- if (now2 - this.lastRecoverCheck < this.cfg.recoveryIntervalMs) return;
13400
- this.lastRecoverCheck = now2;
13401
- if (now2 - this.lastEventAt > this.cfg.decayQuietMs) {
13402
- const prev = this.severity;
13403
- if (this.severity === "severe") this.severity = "soft";
13404
- else if (this.severity === "soft") {
13405
- this.severity = "healthy";
13406
- this.healthySince = now2;
13890
+ _decrementOnce() {
13891
+ this._activeJobs = Math.max(0, this._activeJobs - 1);
13892
+ }
13893
+ };
13894
+
13895
+ // src/runtime/clientProxy.ts
13896
+ function installClientCallHandler(port, client2) {
13897
+ port.on("message", async (msg) => {
13898
+ if (msg.type !== "client-call") return;
13899
+ try {
13900
+ const fn = client2[msg.method];
13901
+ if (typeof fn !== "function") {
13902
+ throw new Error(`CamundaClient has no method '${msg.method}'`);
13407
13903
  }
13408
- if (this.severity === "healthy") this.consecutive = 0;
13409
- if (prev !== this.severity) {
13410
- if (this.backoffMs > 0) {
13411
- this.backoffMs = 0;
13412
- this.log("backoff.clear", { reason: "severity-decay" });
13413
- }
13414
- this.log("severity", { severity: this.severity }, prev);
13904
+ const result = await fn.apply(client2, msg.args);
13905
+ const reply = { type: "client-call-result", callId: msg.callId, result };
13906
+ port.postMessage(reply);
13907
+ } catch (err) {
13908
+ const reply = {
13909
+ type: "client-call-result",
13910
+ callId: msg.callId,
13911
+ error: err?.message || String(err)
13912
+ };
13913
+ port.postMessage(reply);
13914
+ }
13915
+ });
13916
+ }
13917
+
13918
+ // src/runtime/threadPool.ts
13919
+ var ThreadPool = class {
13920
+ _pool = [];
13921
+ _pending = /* @__PURE__ */ new Map();
13922
+ _node;
13923
+ _log;
13924
+ _client;
13925
+ _ready;
13926
+ _terminated = false;
13927
+ constructor(client2, size) {
13928
+ this._client = client2;
13929
+ this._log = client2.logger().scope("thread-pool");
13930
+ this._ready = this._init(size);
13931
+ }
13932
+ /** Resolves when all threads have been spawned and signalled ready. */
13933
+ get ready() {
13934
+ return this._ready;
13935
+ }
13936
+ /** Total number of threads in the pool. */
13937
+ get size() {
13938
+ return this._pool.length;
13939
+ }
13940
+ /** Number of threads currently processing a job. */
13941
+ get busyCount() {
13942
+ return this._pool.filter((pw) => pw.busy).length;
13943
+ }
13944
+ /** Number of threads that are ready and idle. */
13945
+ get idleCount() {
13946
+ return this._pool.filter((pw) => pw.ready && !pw.busy).length;
13947
+ }
13948
+ /** Find the first ready & idle thread. */
13949
+ getIdleWorker() {
13950
+ return this._pool.find((pw) => pw.ready && !pw.busy);
13951
+ }
13952
+ /**
13953
+ * Dispatch a serialized job to a specific idle worker.
13954
+ * The caller is responsible for checking idleness first.
13955
+ */
13956
+ async dispatch(pw, jobData, handlerModule, callbacks) {
13957
+ const { randomUUID, MessageChannel } = this._node;
13958
+ const taskId = randomUUID();
13959
+ pw.busy = true;
13960
+ pw.currentTaskId = taskId;
13961
+ const { port1: mainPort, port2: workerPort } = new MessageChannel();
13962
+ installClientCallHandler(mainPort, this._client);
13963
+ this._pending.set(taskId, {
13964
+ resolve: () => {
13965
+ this._pending.delete(taskId);
13966
+ mainPort.close();
13967
+ callbacks.onComplete();
13968
+ },
13969
+ reject: (err) => {
13970
+ this._pending.delete(taskId);
13971
+ mainPort.close();
13972
+ callbacks.onError(err);
13415
13973
  }
13974
+ });
13975
+ pw.worker.postMessage({ type: "job", taskId, jobData, handlerModule, clientPort: workerPort }, [
13976
+ workerPort
13977
+ ]);
13978
+ }
13979
+ /** Terminate all threads and reject any in-flight tasks. */
13980
+ terminate() {
13981
+ this._terminated = true;
13982
+ for (const pw of this._pool) {
13983
+ pw.worker.terminate().catch(() => {
13984
+ });
13416
13985
  }
13417
- if (this.permitsMax !== null) {
13418
- const bootstrapCap = this.cfg.initialMaxConcurrency ?? 16;
13419
- if (this.severity !== "healthy") {
13420
- if (this.permitsMax < bootstrapCap) {
13421
- this.permitsMax = Math.min(bootstrapCap, this.permitsMax + this.cfg.recoveryStep);
13422
- if (this.permitsMax > this.cfg.floorConcurrency && this.backoffMs > 0) {
13423
- this.backoffMs = 0;
13424
- this.log("backoff.clear", { reason: "left-floor" });
13425
- }
13426
- this.log("permits.recover", { max: this.permitsMax, phase: "additive" }, this.severity);
13427
- this.release();
13986
+ this._pool = [];
13987
+ for (const [, pending] of this._pending) {
13988
+ pending.reject(new Error("Thread pool terminated"));
13989
+ }
13990
+ this._pending.clear();
13991
+ }
13992
+ /** Reject the pending task for a worker that errored/exited and reset its state. */
13993
+ _rejectWorkerTask(pw, message) {
13994
+ pw.busy = false;
13995
+ if (pw.currentTaskId) {
13996
+ const pending = this._pending.get(pw.currentTaskId);
13997
+ if (pending) {
13998
+ this._pending.delete(pw.currentTaskId);
13999
+ pending.reject(new Error(message));
14000
+ }
14001
+ pw.currentTaskId = void 0;
14002
+ }
14003
+ }
14004
+ async _init(requestedSize) {
14005
+ const [workerThreads, pathMod, crypto] = await Promise.all([
14006
+ import("worker_threads"),
14007
+ import("path"),
14008
+ import("crypto")
14009
+ ]);
14010
+ const { Worker } = workerThreads;
14011
+ const { join } = pathMod;
14012
+ this._node = {
14013
+ MessageChannel: workerThreads.MessageChannel,
14014
+ randomUUID: crypto.randomUUID
14015
+ };
14016
+ const cpus = await (async () => {
14017
+ try {
14018
+ const os = await import("os");
14019
+ return os.availableParallelism?.() || os.cpus().length;
14020
+ } catch {
14021
+ return 4;
14022
+ }
14023
+ })();
14024
+ const size = requestedSize ?? cpus;
14025
+ const fs = await import("fs");
14026
+ const url = await import("url");
14027
+ const dir = typeof __dirname !== "undefined" ? __dirname : pathMod.dirname(url.fileURLToPath(import.meta.url));
14028
+ const jsPath = join(dir, "threadWorkerEntry.js");
14029
+ const tsPath = join(dir, "threadWorkerEntry.ts");
14030
+ const entryPath = fs.existsSync(jsPath) ? jsPath : tsPath;
14031
+ const nodeMajor = parseInt(process.versions.node, 10);
14032
+ const execArgv = entryPath.endsWith(".ts") || nodeMajor >= 22 ? ["--experimental-strip-types", "--experimental-transform-types"] : [];
14033
+ for (let i = 0; i < size; i++) {
14034
+ const worker = new Worker(entryPath, { execArgv });
14035
+ const pw = { worker, busy: false, ready: false };
14036
+ worker.on("message", (msg) => {
14037
+ if (msg.type === "ready") {
14038
+ pw.ready = true;
14039
+ this._log.debug(() => ["thread.ready", { index: i }]);
14040
+ return;
13428
14041
  }
13429
- } else {
13430
- if (this.healthySince > 0 && now2 - this.healthySince >= this.cfg.unlimitedAfterHealthyMs) {
13431
- this.permitsMax = null;
13432
- this.permitsCurrent = 0;
13433
- this.backoffMs = 0;
13434
- while (this.waiters.length) {
13435
- const w = this.waiters.shift();
13436
- try {
13437
- w?.resolve();
13438
- } catch {
14042
+ if (msg.type === "job-result") {
14043
+ this._log.debug(() => [
14044
+ "thread.job-result",
14045
+ { taskId: msg.taskId, ok: msg.ok, error: msg.error }
14046
+ ]);
14047
+ pw.busy = false;
14048
+ pw.currentTaskId = void 0;
14049
+ const pending = this._pending.get(msg.taskId);
14050
+ if (pending) {
14051
+ if (msg.ok) {
14052
+ pending.resolve(true);
14053
+ } else {
14054
+ pending.reject(new Error(msg.error || "Handler failed"));
13439
14055
  }
13440
14056
  }
13441
- this.log("permits.unlimited", { reason: "sustained-healthy" }, this.severity);
13442
14057
  return;
13443
14058
  }
13444
- const next = Math.ceil(this.permitsMax * this.cfg.healthyRecoveryMultiplier);
13445
- if (next > this.permitsMax) {
13446
- this.permitsMax = next;
13447
- this.log(
13448
- "permits.recover",
13449
- { max: this.permitsMax, phase: "multiplicative" },
13450
- this.severity
13451
- );
13452
- this.release();
14059
+ });
14060
+ worker.on("error", (err) => {
14061
+ this._log.error("thread.error", err);
14062
+ this._rejectWorkerTask(pw, `Worker thread error: ${err.message}`);
14063
+ pw.ready = false;
14064
+ });
14065
+ worker.on("exit", (code) => {
14066
+ if (!this._terminated) {
14067
+ this._log.warn("thread.exit", { code });
14068
+ this._rejectWorkerTask(pw, `Worker thread exited unexpectedly (code ${code})`);
13453
14069
  }
13454
- }
14070
+ });
14071
+ this._pool.push(pw);
13455
14072
  }
14073
+ this._log.info(() => ["thread-pool.init", { size, entryPath }]);
13456
14074
  }
13457
14075
  };
13458
14076
 
13459
- // src/runtime/jobActions.ts
13460
- function enrichActivatedJob(raw, client2, log) {
13461
- let acknowledged = false;
13462
- const ack = () => {
13463
- if (!acknowledged) {
13464
- acknowledged = true;
13465
- job.acknowledged = true;
13466
- }
13467
- };
13468
- const job = { ...raw, log };
13469
- job.complete = async (variables = {}) => {
13470
- try {
13471
- await client2.completeJob({ variables, jobKey: raw.jobKey });
13472
- } finally {
13473
- ack();
13474
- }
13475
- return JobActionReceipt;
13476
- };
13477
- job.fail = async (reason) => {
13478
- try {
13479
- await client2.failJob({ ...reason, jobKey: raw.jobKey });
13480
- } finally {
13481
- ack();
13482
- }
13483
- return JobActionReceipt;
13484
- };
13485
- job.error = async (error) => {
13486
- try {
13487
- await client2.throwJobError({ ...error, jobKey: raw.jobKey });
13488
- } finally {
13489
- ack();
13490
- }
13491
- return JobActionReceipt;
13492
- };
13493
- job.cancelWorkflow = async () => {
13494
- try {
13495
- await client2.cancelProcessInstance({
13496
- processInstanceKey: raw.processInstanceKey
13497
- });
13498
- } finally {
13499
- ack();
13500
- }
13501
- return JobActionReceipt;
13502
- };
13503
- job.ignore = async () => {
13504
- ack();
13505
- return JobActionReceipt;
13506
- };
13507
- job.modifyJobTimeout = ({ newTimeoutMs }) => client2.updateJob({ changeset: { timeout: newTimeoutMs }, jobKey: raw.jobKey });
13508
- job.modifyRetries = ({ retries }) => client2.updateJob({ changeset: { retries }, jobKey: raw.jobKey });
13509
- return job;
13510
- }
13511
-
13512
14077
  // src/runtime/responseEvaluation.ts
13513
14078
  function evaluateSdkResponse(raw, opts) {
13514
14079
  if (!raw || typeof raw !== "object") return raw;
@@ -13603,6 +14168,8 @@ var CamundaClient = class {
13603
14168
  _bp;
13604
14169
  /** Registered job workers created via createJobWorker (lifecycle managed by user). */
13605
14170
  _workers = [];
14171
+ /** Shared thread pool for all threaded job workers (lazy-initialised on first use). */
14172
+ _threadPool = null;
13606
14173
  /** Support logger (Node-only; no-op in browser). */
13607
14174
  _supportLogger = new class {
13608
14175
  log() {
@@ -13898,7 +14465,7 @@ var CamundaClient = class {
13898
14465
  getWorkers() {
13899
14466
  return [...this._workers];
13900
14467
  }
13901
- /** Stop all registered job workers (best-effort). */
14468
+ /** Stop all registered job workers (best-effort) and terminate the shared thread pool. */
13902
14469
  stopAllWorkers() {
13903
14470
  for (const w of this._workers) {
13904
14471
  try {
@@ -13907,6 +14474,17 @@ var CamundaClient = class {
13907
14474
  this._log.warn("worker.stop.error", e);
13908
14475
  }
13909
14476
  }
14477
+ if (this._threadPool) {
14478
+ this._threadPool.terminate();
14479
+ this._threadPool = null;
14480
+ }
14481
+ }
14482
+ /** Get or lazily create the shared thread pool for threaded job workers. */
14483
+ _getOrCreateThreadPool(threadPoolSize) {
14484
+ if (!this._threadPool) {
14485
+ this._threadPool = new ThreadPool(this, threadPoolSize);
14486
+ }
14487
+ return this._threadPool;
13910
14488
  }
13911
14489
  activateAdHocSubProcessActivities(arg, options) {
13912
14490
  return toCancelable2(async (signal) => {
@@ -15917,9 +16495,9 @@ var CamundaClient = class {
15917
16495
  }
15918
16496
  deleteDecisionInstance(arg, options) {
15919
16497
  return toCancelable2(async (signal) => {
15920
- const { decisionInstanceKey, ..._body } = arg || {};
16498
+ const { decisionEvaluationKey, ..._body } = arg || {};
15921
16499
  let envelope = {};
15922
- envelope.path = { decisionInstanceKey };
16500
+ envelope.path = { decisionEvaluationKey };
15923
16501
  envelope.body = _body;
15924
16502
  if (this._validation.settings.req !== "none") {
15925
16503
  const maybe = await this._validation.gateRequest("deleteDecisionInstance", zDeleteDecisionInstanceData, envelope);
@@ -17687,6 +18265,60 @@ var CamundaClient = class {
17687
18265
  return invoke();
17688
18266
  });
17689
18267
  }
18268
+ getJobErrorStatistics(arg, consistencyManagement, options) {
18269
+ if (!consistencyManagement) throw new Error("Missing consistencyManagement parameter for eventually consistent endpoint");
18270
+ const useConsistency = consistencyManagement.consistency;
18271
+ return toCancelable2(async (signal) => {
18272
+ const _body = arg;
18273
+ let envelope = {};
18274
+ envelope.body = _body;
18275
+ if (this._validation.settings.req !== "none") {
18276
+ const maybe = await this._validation.gateRequest("getJobErrorStatistics", zGetJobErrorStatisticsData, envelope);
18277
+ if (this._validation.settings.req === "strict") envelope = maybe;
18278
+ }
18279
+ const opts = { client: this._client, signal, throwOnError: false };
18280
+ if (envelope.body !== void 0) opts.body = envelope.body;
18281
+ const call = async () => {
18282
+ try {
18283
+ const _raw = await getJobErrorStatistics(opts);
18284
+ let data = this._evaluateResponse(_raw, "getJobErrorStatistics", (resp) => {
18285
+ const st = resp.status ?? resp.response?.status;
18286
+ if (!st) return void 0;
18287
+ const candidate = st === 429 || st === 503 || st === 500;
18288
+ if (!candidate) return void 0;
18289
+ let prob = void 0;
18290
+ if (resp.error && typeof resp.error === "object") prob = resp.error;
18291
+ const err = new Error(prob && (prob.title || prob.detail) ? prob.title || prob.detail : "HTTP " + st);
18292
+ err.status = st;
18293
+ err.name = "HttpSdkError";
18294
+ if (prob) {
18295
+ for (const k of ["type", "title", "detail", "instance"]) if (prob[k] !== void 0) err[k] = prob[k];
18296
+ }
18297
+ const isBp = st === 429 || st === 503 && err.title === "RESOURCE_EXHAUSTED" || st === 500 && (typeof err.detail === "string" && /RESOURCE_EXHAUSTED/.test(err.detail));
18298
+ if (!isBp) err.nonRetryable = true;
18299
+ return err;
18300
+ });
18301
+ const _respSchemaName = "zGetJobErrorStatisticsResponse";
18302
+ if (this._isVoidResponse(_respSchemaName)) {
18303
+ data = void 0;
18304
+ }
18305
+ if (this._validation.settings.res !== "none") {
18306
+ const _schema = zGetJobErrorStatisticsResponse;
18307
+ if (_schema) {
18308
+ const maybeR = await this._validation.gateResponse("getJobErrorStatistics", _schema, data);
18309
+ if (this._validation.settings.res === "strict") data = maybeR;
18310
+ }
18311
+ }
18312
+ return data;
18313
+ } catch (e) {
18314
+ throw e;
18315
+ }
18316
+ };
18317
+ const invoke = () => toCancelable2(() => call());
18318
+ if (useConsistency) return eventualPoll("getJobErrorStatistics", false, invoke, { ...useConsistency, logger: this._log });
18319
+ return invoke();
18320
+ });
18321
+ }
17690
18322
  getJobTimeSeriesStatistics(arg, consistencyManagement, options) {
17691
18323
  if (!consistencyManagement) throw new Error("Missing consistencyManagement parameter for eventually consistent endpoint");
17692
18324
  const useConsistency = consistencyManagement.consistency;
@@ -18845,6 +19477,48 @@ var CamundaClient = class {
18845
19477
  return this._invokeWithRetry(() => call(), { opId: "getStatus", exempt: false, retryOverride: options?.retry });
18846
19478
  });
18847
19479
  }
19480
+ getSystemConfiguration(arg, options) {
19481
+ return toCancelable2(async (signal) => {
19482
+ const opts = { client: this._client, signal, throwOnError: false };
19483
+ const call = async () => {
19484
+ try {
19485
+ const _raw = await getSystemConfiguration(opts);
19486
+ let data = this._evaluateResponse(_raw, "getSystemConfiguration", (resp) => {
19487
+ const st = resp.status ?? resp.response?.status;
19488
+ if (!st) return void 0;
19489
+ const candidate = st === 429 || st === 503 || st === 500;
19490
+ if (!candidate) return void 0;
19491
+ let prob = void 0;
19492
+ if (resp.error && typeof resp.error === "object") prob = resp.error;
19493
+ const err = new Error(prob && (prob.title || prob.detail) ? prob.title || prob.detail : "HTTP " + st);
19494
+ err.status = st;
19495
+ err.name = "HttpSdkError";
19496
+ if (prob) {
19497
+ for (const k of ["type", "title", "detail", "instance"]) if (prob[k] !== void 0) err[k] = prob[k];
19498
+ }
19499
+ const isBp = st === 429 || st === 503 && err.title === "RESOURCE_EXHAUSTED" || st === 500 && (typeof err.detail === "string" && /RESOURCE_EXHAUSTED/.test(err.detail));
19500
+ if (!isBp) err.nonRetryable = true;
19501
+ return err;
19502
+ });
19503
+ const _respSchemaName = "zGetSystemConfigurationResponse";
19504
+ if (this._isVoidResponse(_respSchemaName)) {
19505
+ data = void 0;
19506
+ }
19507
+ if (this._validation.settings.res !== "none") {
19508
+ const _schema = zGetSystemConfigurationResponse;
19509
+ if (_schema) {
19510
+ const maybeR = await this._validation.gateResponse("getSystemConfiguration", _schema, data);
19511
+ if (this._validation.settings.res === "strict") data = maybeR;
19512
+ }
19513
+ }
19514
+ return data;
19515
+ } catch (e) {
19516
+ throw e;
19517
+ }
19518
+ };
19519
+ return this._invokeWithRetry(() => call(), { opId: "getSystemConfiguration", exempt: false, retryOverride: options?.retry });
19520
+ });
19521
+ }
18848
19522
  getTenant(arg, consistencyManagement, options) {
18849
19523
  if (!consistencyManagement) throw new Error("Missing consistencyManagement parameter for eventually consistent endpoint");
18850
19524
  const useConsistency = consistencyManagement.consistency;
@@ -23359,6 +24033,31 @@ var CamundaClient = class {
23359
24033
  this._workers.push(worker);
23360
24034
  return worker;
23361
24035
  }
24036
+ /**
24037
+ * Create a threaded job worker that runs handler logic in a pool of worker threads.
24038
+ * The handler must be a separate module file that exports a default function with
24039
+ * signature `(job, client) => Promise<JobActionReceipt>`.
24040
+ *
24041
+ * This keeps the main event loop free for polling and I/O, dramatically improving
24042
+ * throughput for CPU-bound job handlers.
24043
+ *
24044
+ * @param cfg Threaded worker configuration
24045
+ * @example Create a threaded job worker
24046
+ * ```ts
24047
+ * const worker = client.createThreadedJobWorker({
24048
+ * jobType: 'cpu-heavy-task',
24049
+ * handlerModule: './my-handler.js',
24050
+ * maxParallelJobs: 32,
24051
+ * jobTimeoutMs: 30000,
24052
+ * })
24053
+ * ```
24054
+ */
24055
+ createThreadedJobWorker(cfg) {
24056
+ const pool = this._getOrCreateThreadPool(cfg.threadPoolSize);
24057
+ const worker = new ThreadedJobWorker(this, pool, cfg);
24058
+ this._workers.push(worker);
24059
+ return worker;
24060
+ }
23362
24061
  /**
23363
24062
  * Node-only convenience: deploy resources from local filesystem paths.
23364
24063
  * @param resourceFilenames Absolute or relative file paths to BPMN/DMN/form/resource files.
@@ -23550,4 +24249,4 @@ export {
23550
24249
  withTimeoutTE,
23551
24250
  eventuallyTE
23552
24251
  };
23553
- //# sourceMappingURL=chunk-ULXL7H75.js.map
24252
+ //# sourceMappingURL=chunk-G5VLLLLV.js.map