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

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.
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-Cw6GHVq6.cjs';
1
+ export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-Cwx7jNBm.cjs';
2
2
  import 'zod';
3
3
  import '../logger-D-p21VHo.cjs';
@@ -1,3 +1,3 @@
1
- export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-CvMgO1LN.js';
1
+ export { h as CamundaFpClient, A3 as DomainError, A4 as DomainErrorTag, E as Either, A2 as FnKeys, A1 as Fpify, A5 as HttpError, A6 as Left, A7 as Right, Ad as TaskEither, Ac as classifyDomainError, g as createCamundaFpClient, Aa as eventuallyTE, Ab as foldDomainError, i as isLeft, j as isRight, A8 as retryTE, A9 as withTimeoutTE } from '../index-Bps8dBEQ.js';
2
2
  import 'zod';
3
3
  import '../logger-D-p21VHo.js';
package/dist/fp/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  isRight,
8
8
  retryTE,
9
9
  withTimeoutTE
10
- } from "../chunk-TA4NPVIS.js";
10
+ } from "../chunk-ULXL7H75.js";
11
11
  import "../chunk-W6JB7JZH.js";
12
12
  export {
13
13
  classifyDomainError,
@@ -2401,7 +2401,7 @@ type DecisionInstanceResult = {
2401
2401
  /**
2402
2402
  * The version of the decision.
2403
2403
  */
2404
- decisionDefinitionVersion?: number;
2404
+ decisionDefinitionVersion: number;
2405
2405
  decisionEvaluationInstanceKey: DecisionEvaluationInstanceKey;
2406
2406
  /**
2407
2407
  * The key of the decision evaluation where this instance was created.
@@ -5912,6 +5912,7 @@ type ProcessDefinitionFilter = {
5912
5912
  * Whether to only return the latest version of each process definition.
5913
5913
  * When using this filter, pagination functionality is limited, you can only paginate forward using `after` and `limit`.
5914
5914
  * The response contains no `startCursor` in the `page`, and requests ignore the `from` and `before` in the `page`.
5915
+ * When using this filter, sorting is limited to `processDefinitionId` and `tenantId` fields only.
5915
5916
  *
5916
5917
  */
5917
5918
  isLatestVersion?: boolean;
@@ -6402,7 +6403,7 @@ type ProcessInstanceSearchQuerySortRequest = {
6402
6403
  /**
6403
6404
  * The field to sort by.
6404
6405
  */
6405
- field: 'processInstanceKey' | 'processDefinitionId' | 'processDefinitionName' | 'processDefinitionVersion' | 'processDefinitionVersionTag' | 'processDefinitionKey' | 'parentProcessInstanceKey' | 'parentElementInstanceKey' | 'startDate' | 'endDate' | 'state' | 'hasIncident' | 'tenantId';
6406
+ field: 'processInstanceKey' | 'processDefinitionId' | 'processDefinitionName' | 'processDefinitionVersion' | 'processDefinitionVersionTag' | 'processDefinitionKey' | 'parentProcessInstanceKey' | 'parentElementInstanceKey' | 'startDate' | 'endDate' | 'state' | 'hasIncident' | 'tenantId' | 'businessId';
6406
6407
  order?: SortOrderEnum;
6407
6408
  };
6408
6409
  /**
@@ -6487,6 +6488,10 @@ type BaseProcessInstanceFilterFields = {
6487
6488
  */
6488
6489
  incidentErrorHashCode?: IntegerFilterProperty;
6489
6490
  tags?: TagSet;
6491
+ /**
6492
+ * The business id associated with the process instance.
6493
+ */
6494
+ businessId?: StringFilterProperty;
6490
6495
  };
6491
6496
  /**
6492
6497
  * Process definition statistics search filter.
@@ -16057,7 +16062,7 @@ declare const createDeployment: <ThrowOnError extends boolean = true>(options: O
16057
16062
  *
16058
16063
  * Upload a document to the Camunda 8 cluster.
16059
16064
  *
16060
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16065
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16061
16066
  *
16062
16067
  */
16063
16068
  declare const createDocument: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentData, ThrowOnError>) => RequestResult<CreateDocumentResponses, CreateDocumentErrors, ThrowOnError, "fields">;
@@ -16078,7 +16083,7 @@ declare const createDocument: <ThrowOnError extends boolean = true>(options: Opt
16078
16083
  * each of which contains the file name of the document that failed to upload and the reason for the failure.
16079
16084
  * The client can choose to retry the whole batch or individual documents based on the response.
16080
16085
  *
16081
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16086
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16082
16087
  *
16083
16088
  */
16084
16089
  declare const createDocuments: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentsData, ThrowOnError>) => RequestResult<CreateDocumentsResponses, CreateDocumentsErrors, ThrowOnError, "fields">;
@@ -16087,7 +16092,7 @@ declare const createDocuments: <ThrowOnError extends boolean = true>(options: Op
16087
16092
  *
16088
16093
  * Delete a document from the Camunda 8 cluster.
16089
16094
  *
16090
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16095
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16091
16096
  *
16092
16097
  */
16093
16098
  declare const deleteDocument: <ThrowOnError extends boolean = true>(options: Options<DeleteDocumentData, ThrowOnError>) => RequestResult<DeleteDocumentResponses, DeleteDocumentErrors, ThrowOnError, "fields">;
@@ -16096,7 +16101,7 @@ declare const deleteDocument: <ThrowOnError extends boolean = true>(options: Opt
16096
16101
  *
16097
16102
  * Download a document from the Camunda 8 cluster.
16098
16103
  *
16099
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16104
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16100
16105
  *
16101
16106
  */
16102
16107
  declare const getDocument: <ThrowOnError extends boolean = true>(options: Options<GetDocumentData, ThrowOnError>) => RequestResult<GetDocumentResponses, GetDocumentErrors, ThrowOnError, "fields">;
@@ -16105,7 +16110,7 @@ declare const getDocument: <ThrowOnError extends boolean = true>(options: Option
16105
16110
  *
16106
16111
  * Create a link to a document in the Camunda 8 cluster.
16107
16112
  *
16108
- * Note that this is currently supported for document stores of type: AWS, GCP
16113
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP
16109
16114
  *
16110
16115
  */
16111
16116
  declare const createDocumentLink: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentLinkData, ThrowOnError>) => RequestResult<CreateDocumentLinkResponses, CreateDocumentLinkErrors, ThrowOnError, "fields">;
@@ -19479,6 +19484,7 @@ declare class CamundaClient {
19479
19484
  permitsMax: number | null;
19480
19485
  permitsCurrent: number;
19481
19486
  waiters: number;
19487
+ backoffMs: number;
19482
19488
  } | {
19483
19489
  severity: string;
19484
19490
  permitsMax: null;
@@ -19766,7 +19772,7 @@ declare class CamundaClient {
19766
19772
  *
19767
19773
  * Upload a document to the Camunda 8 cluster.
19768
19774
  *
19769
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19775
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19770
19776
  *
19771
19777
  *
19772
19778
  * @operationId createDocument
@@ -19778,7 +19784,7 @@ declare class CamundaClient {
19778
19784
  *
19779
19785
  * Create a link to a document in the Camunda 8 cluster.
19780
19786
  *
19781
- * Note that this is currently supported for document stores of type: AWS, GCP
19787
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP
19782
19788
  *
19783
19789
  *
19784
19790
  * @operationId createDocumentLink
@@ -19802,7 +19808,7 @@ declare class CamundaClient {
19802
19808
  * each of which contains the file name of the document that failed to upload and the reason for the failure.
19803
19809
  * The client can choose to retry the whole batch or individual documents based on the response.
19804
19810
  *
19805
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19811
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19806
19812
  *
19807
19813
  *
19808
19814
  * @operationId createDocuments
@@ -19946,7 +19952,7 @@ declare class CamundaClient {
19946
19952
  *
19947
19953
  * Delete a document from the Camunda 8 cluster.
19948
19954
  *
19949
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19955
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19950
19956
  *
19951
19957
  *
19952
19958
  * @operationId deleteDocument
@@ -20216,7 +20222,7 @@ declare class CamundaClient {
20216
20222
  *
20217
20223
  * Download a document from the Camunda 8 cluster.
20218
20224
  *
20219
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
20225
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
20220
20226
  *
20221
20227
  *
20222
20228
  * @operationId getDocument
@@ -2401,7 +2401,7 @@ type DecisionInstanceResult = {
2401
2401
  /**
2402
2402
  * The version of the decision.
2403
2403
  */
2404
- decisionDefinitionVersion?: number;
2404
+ decisionDefinitionVersion: number;
2405
2405
  decisionEvaluationInstanceKey: DecisionEvaluationInstanceKey;
2406
2406
  /**
2407
2407
  * The key of the decision evaluation where this instance was created.
@@ -5912,6 +5912,7 @@ type ProcessDefinitionFilter = {
5912
5912
  * Whether to only return the latest version of each process definition.
5913
5913
  * When using this filter, pagination functionality is limited, you can only paginate forward using `after` and `limit`.
5914
5914
  * The response contains no `startCursor` in the `page`, and requests ignore the `from` and `before` in the `page`.
5915
+ * When using this filter, sorting is limited to `processDefinitionId` and `tenantId` fields only.
5915
5916
  *
5916
5917
  */
5917
5918
  isLatestVersion?: boolean;
@@ -6402,7 +6403,7 @@ type ProcessInstanceSearchQuerySortRequest = {
6402
6403
  /**
6403
6404
  * The field to sort by.
6404
6405
  */
6405
- field: 'processInstanceKey' | 'processDefinitionId' | 'processDefinitionName' | 'processDefinitionVersion' | 'processDefinitionVersionTag' | 'processDefinitionKey' | 'parentProcessInstanceKey' | 'parentElementInstanceKey' | 'startDate' | 'endDate' | 'state' | 'hasIncident' | 'tenantId';
6406
+ field: 'processInstanceKey' | 'processDefinitionId' | 'processDefinitionName' | 'processDefinitionVersion' | 'processDefinitionVersionTag' | 'processDefinitionKey' | 'parentProcessInstanceKey' | 'parentElementInstanceKey' | 'startDate' | 'endDate' | 'state' | 'hasIncident' | 'tenantId' | 'businessId';
6406
6407
  order?: SortOrderEnum;
6407
6408
  };
6408
6409
  /**
@@ -6487,6 +6488,10 @@ type BaseProcessInstanceFilterFields = {
6487
6488
  */
6488
6489
  incidentErrorHashCode?: IntegerFilterProperty;
6489
6490
  tags?: TagSet;
6491
+ /**
6492
+ * The business id associated with the process instance.
6493
+ */
6494
+ businessId?: StringFilterProperty;
6490
6495
  };
6491
6496
  /**
6492
6497
  * Process definition statistics search filter.
@@ -16057,7 +16062,7 @@ declare const createDeployment: <ThrowOnError extends boolean = true>(options: O
16057
16062
  *
16058
16063
  * Upload a document to the Camunda 8 cluster.
16059
16064
  *
16060
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16065
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16061
16066
  *
16062
16067
  */
16063
16068
  declare const createDocument: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentData, ThrowOnError>) => RequestResult<CreateDocumentResponses, CreateDocumentErrors, ThrowOnError, "fields">;
@@ -16078,7 +16083,7 @@ declare const createDocument: <ThrowOnError extends boolean = true>(options: Opt
16078
16083
  * each of which contains the file name of the document that failed to upload and the reason for the failure.
16079
16084
  * The client can choose to retry the whole batch or individual documents based on the response.
16080
16085
  *
16081
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16086
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16082
16087
  *
16083
16088
  */
16084
16089
  declare const createDocuments: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentsData, ThrowOnError>) => RequestResult<CreateDocumentsResponses, CreateDocumentsErrors, ThrowOnError, "fields">;
@@ -16087,7 +16092,7 @@ declare const createDocuments: <ThrowOnError extends boolean = true>(options: Op
16087
16092
  *
16088
16093
  * Delete a document from the Camunda 8 cluster.
16089
16094
  *
16090
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16095
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16091
16096
  *
16092
16097
  */
16093
16098
  declare const deleteDocument: <ThrowOnError extends boolean = true>(options: Options<DeleteDocumentData, ThrowOnError>) => RequestResult<DeleteDocumentResponses, DeleteDocumentErrors, ThrowOnError, "fields">;
@@ -16096,7 +16101,7 @@ declare const deleteDocument: <ThrowOnError extends boolean = true>(options: Opt
16096
16101
  *
16097
16102
  * Download a document from the Camunda 8 cluster.
16098
16103
  *
16099
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
16104
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
16100
16105
  *
16101
16106
  */
16102
16107
  declare const getDocument: <ThrowOnError extends boolean = true>(options: Options<GetDocumentData, ThrowOnError>) => RequestResult<GetDocumentResponses, GetDocumentErrors, ThrowOnError, "fields">;
@@ -16105,7 +16110,7 @@ declare const getDocument: <ThrowOnError extends boolean = true>(options: Option
16105
16110
  *
16106
16111
  * Create a link to a document in the Camunda 8 cluster.
16107
16112
  *
16108
- * Note that this is currently supported for document stores of type: AWS, GCP
16113
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP
16109
16114
  *
16110
16115
  */
16111
16116
  declare const createDocumentLink: <ThrowOnError extends boolean = true>(options: Options<CreateDocumentLinkData, ThrowOnError>) => RequestResult<CreateDocumentLinkResponses, CreateDocumentLinkErrors, ThrowOnError, "fields">;
@@ -19479,6 +19484,7 @@ declare class CamundaClient {
19479
19484
  permitsMax: number | null;
19480
19485
  permitsCurrent: number;
19481
19486
  waiters: number;
19487
+ backoffMs: number;
19482
19488
  } | {
19483
19489
  severity: string;
19484
19490
  permitsMax: null;
@@ -19766,7 +19772,7 @@ declare class CamundaClient {
19766
19772
  *
19767
19773
  * Upload a document to the Camunda 8 cluster.
19768
19774
  *
19769
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19775
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19770
19776
  *
19771
19777
  *
19772
19778
  * @operationId createDocument
@@ -19778,7 +19784,7 @@ declare class CamundaClient {
19778
19784
  *
19779
19785
  * Create a link to a document in the Camunda 8 cluster.
19780
19786
  *
19781
- * Note that this is currently supported for document stores of type: AWS, GCP
19787
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP
19782
19788
  *
19783
19789
  *
19784
19790
  * @operationId createDocumentLink
@@ -19802,7 +19808,7 @@ declare class CamundaClient {
19802
19808
  * each of which contains the file name of the document that failed to upload and the reason for the failure.
19803
19809
  * The client can choose to retry the whole batch or individual documents based on the response.
19804
19810
  *
19805
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19811
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19806
19812
  *
19807
19813
  *
19808
19814
  * @operationId createDocuments
@@ -19946,7 +19952,7 @@ declare class CamundaClient {
19946
19952
  *
19947
19953
  * Delete a document from the Camunda 8 cluster.
19948
19954
  *
19949
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
19955
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
19950
19956
  *
19951
19957
  *
19952
19958
  * @operationId deleteDocument
@@ -20216,7 +20222,7 @@ declare class CamundaClient {
20216
20222
  *
20217
20223
  * Download a document from the Camunda 8 cluster.
20218
20224
  *
20219
- * Note that this is currently supported for document stores of type: AWS, GCP, in-memory (non-production), local (non-production)
20225
+ * Note that this is currently supported for document stores of type: AWS, Azure, GCP, in-memory (non-production), local (non-production)
20220
20226
  *
20221
20227
  *
20222
20228
  * @operationId getDocument
package/dist/index.cjs CHANGED
@@ -5502,9 +5502,9 @@ var zDecisionInstanceResult = import_zod.z.object({
5502
5502
  description: "The name of the DMN decision."
5503
5503
  }),
5504
5504
  decisionDefinitionType: zDecisionDefinitionTypeEnum,
5505
- decisionDefinitionVersion: import_zod.z.optional(import_zod.z.int().register(import_zod.z.globalRegistry, {
5505
+ decisionDefinitionVersion: import_zod.z.int().register(import_zod.z.globalRegistry, {
5506
5506
  description: "The version of the decision."
5507
- })),
5507
+ }),
5508
5508
  decisionEvaluationInstanceKey: zDecisionEvaluationInstanceKey,
5509
5509
  decisionEvaluationKey: zDecisionEvaluationKey,
5510
5510
  elementInstanceKey: import_zod.z.union([
@@ -6406,7 +6406,7 @@ var zProblemDetail = import_zod.z.object({
6406
6406
  var zProcessDefinitionFilter = import_zod.z.object({
6407
6407
  name: import_zod.z.optional(zStringFilterProperty),
6408
6408
  isLatestVersion: import_zod.z.optional(import_zod.z.boolean().register(import_zod.z.globalRegistry, {
6409
- description: "Whether to only return the latest version of each process definition.\nWhen using this filter, pagination functionality is limited, you can only paginate forward using `after` and `limit`.\nThe response contains no `startCursor` in the `page`, and requests ignore the `from` and `before` in the `page`.\n"
6409
+ description: "Whether to only return the latest version of each process definition.\nWhen using this filter, pagination functionality is limited, you can only paginate forward using `after` and `limit`.\nThe response contains no `startCursor` in the `page`, and requests ignore the `from` and `before` in the `page`.\nWhen using this filter, sorting is limited to `processDefinitionId` and `tenantId` fields only.\n"
6410
6410
  })),
6411
6411
  resourceName: import_zod.z.optional(import_zod.z.string().register(import_zod.z.globalRegistry, {
6412
6412
  description: "Resource name of this process definition."
@@ -7431,7 +7431,8 @@ var zProcessInstanceSearchQuerySortRequest = import_zod.z.object({
7431
7431
  "endDate",
7432
7432
  "state",
7433
7433
  "hasIncident",
7434
- "tenantId"
7434
+ "tenantId",
7435
+ "businessId"
7435
7436
  ]).register(import_zod.z.globalRegistry, {
7436
7437
  description: "The field to sort by."
7437
7438
  }),
@@ -8874,7 +8875,8 @@ var zBaseProcessInstanceFilterFields = import_zod.z.object({
8874
8875
  description: "Whether the element instance has an incident or not."
8875
8876
  })),
8876
8877
  incidentErrorHashCode: import_zod.z.optional(zIntegerFilterProperty),
8877
- tags: import_zod.z.optional(zTagSet)
8878
+ tags: import_zod.z.optional(zTagSet),
8879
+ businessId: import_zod.z.optional(zStringFilterProperty)
8878
8880
  }).register(import_zod.z.globalRegistry, {
8879
8881
  description: "Base process instance search filter."
8880
8882
  });
@@ -12351,7 +12353,7 @@ function createLogger(opts = {}) {
12351
12353
  }
12352
12354
 
12353
12355
  // src/runtime/version.ts
12354
- var packageVersion = "8.9.0-alpha.11";
12356
+ var packageVersion = "8.9.0-alpha.13";
12355
12357
 
12356
12358
  // src/runtime/supportLogger.ts
12357
12359
  var NoopSupportLogger = class {
@@ -13151,6 +13153,7 @@ async function executeWithHttpRetry(fn, policy, logger, classify = defaultHttpCl
13151
13153
  var BackpressureManager = class {
13152
13154
  logger;
13153
13155
  now;
13156
+ sleep;
13154
13157
  cfg;
13155
13158
  severity = "healthy";
13156
13159
  consecutive = 0;
@@ -13163,9 +13166,12 @@ var BackpressureManager = class {
13163
13166
  observeOnly = false;
13164
13167
  healthySince = 0;
13165
13168
  // timestamp when severity last became healthy
13169
+ backoffMs = 0;
13170
+ // current backoff delay in ms (0 = no backoff)
13166
13171
  constructor(opts = {}) {
13167
13172
  this.logger = opts.logger;
13168
13173
  this.now = opts.now || (() => Date.now());
13174
+ this.sleep = opts.sleep || ((ms) => new Promise((r) => setTimeout(r, ms)));
13169
13175
  this.cfg = {
13170
13176
  enabled: true,
13171
13177
  initialMaxConcurrency: null,
@@ -13179,6 +13185,9 @@ var BackpressureManager = class {
13179
13185
  maxWaiters: 1e3,
13180
13186
  healthyRecoveryMultiplier: 1.5,
13181
13187
  unlimitedAfterHealthyMs: 3e4,
13188
+ backoffInitialMs: 25,
13189
+ backoffMaxMs: 2e3,
13190
+ backoffEscalate: 2,
13182
13191
  ...opts.config
13183
13192
  };
13184
13193
  this.observeOnly = !!this.cfg.observeOnly;
@@ -13194,7 +13203,8 @@ var BackpressureManager = class {
13194
13203
  // When disabled, report unlimited semantics explicitly
13195
13204
  permitsMax: this.cfg.enabled === false ? null : this.permitsMax,
13196
13205
  permitsCurrent: this.cfg.enabled === false ? 0 : this.permitsCurrent,
13197
- waiters: this.waiters.length
13206
+ waiters: this.waiters.length,
13207
+ backoffMs: this.backoffMs
13198
13208
  };
13199
13209
  }
13200
13210
  log(evt, data, prevSeverity) {
@@ -13216,6 +13226,10 @@ var BackpressureManager = class {
13216
13226
  if (this.observeOnly) return;
13217
13227
  if (!this.isEnabled()) return;
13218
13228
  if (this.permitsMax === null) return;
13229
+ if (this.backoffMs > 0) {
13230
+ await this.sleep(this.backoffMs);
13231
+ if (this.permitsMax === null) return;
13232
+ }
13219
13233
  if (this.permitsCurrent < (this.permitsMax || 0)) {
13220
13234
  this.permitsCurrent++;
13221
13235
  return;
@@ -13279,11 +13293,23 @@ var BackpressureManager = class {
13279
13293
  } else if (this.severity === "soft") {
13280
13294
  if (!this.observeOnly) this.scalePermits(this.cfg.reduceFactor);
13281
13295
  }
13296
+ if (!this.observeOnly && this.permitsMax !== null && this.permitsMax <= this.cfg.floorConcurrency && this.severity === "severe") {
13297
+ if (this.backoffMs === 0) {
13298
+ this.backoffMs = this.cfg.backoffInitialMs;
13299
+ } else {
13300
+ this.backoffMs = Math.min(this.cfg.backoffMaxMs, this.backoffMs * this.cfg.backoffEscalate);
13301
+ }
13302
+ this.log("backoff.escalate", { delayMs: this.backoffMs });
13303
+ }
13282
13304
  if (this.severity !== prevSeverity)
13283
13305
  this.log("severity", { severity: this.severity }, prevSeverity);
13284
13306
  }
13285
13307
  recordHealthyHint() {
13286
13308
  if (!this.cfg.enabled && !this.observeOnly) return;
13309
+ if (this.backoffMs > 0) {
13310
+ this.backoffMs = 0;
13311
+ this.log("backoff.clear", { reason: "healthy-hint" });
13312
+ }
13287
13313
  const now2 = this.now();
13288
13314
  this.maybeRecover(now2);
13289
13315
  }
@@ -13307,13 +13333,23 @@ var BackpressureManager = class {
13307
13333
  this.healthySince = now2;
13308
13334
  }
13309
13335
  if (this.severity === "healthy") this.consecutive = 0;
13310
- if (prev !== this.severity) this.log("severity", { severity: this.severity }, prev);
13336
+ if (prev !== this.severity) {
13337
+ if (this.backoffMs > 0) {
13338
+ this.backoffMs = 0;
13339
+ this.log("backoff.clear", { reason: "severity-decay" });
13340
+ }
13341
+ this.log("severity", { severity: this.severity }, prev);
13342
+ }
13311
13343
  }
13312
13344
  if (this.permitsMax !== null) {
13313
13345
  const bootstrapCap = this.cfg.initialMaxConcurrency ?? 16;
13314
13346
  if (this.severity !== "healthy") {
13315
13347
  if (this.permitsMax < bootstrapCap) {
13316
13348
  this.permitsMax = Math.min(bootstrapCap, this.permitsMax + this.cfg.recoveryStep);
13349
+ if (this.permitsMax > this.cfg.floorConcurrency && this.backoffMs > 0) {
13350
+ this.backoffMs = 0;
13351
+ this.log("backoff.clear", { reason: "left-floor" });
13352
+ }
13317
13353
  this.log("permits.recover", { max: this.permitsMax, phase: "additive" }, this.severity);
13318
13354
  this.release();
13319
13355
  }
@@ -13321,6 +13357,7 @@ var BackpressureManager = class {
13321
13357
  if (this.healthySince > 0 && now2 - this.healthySince >= this.cfg.unlimitedAfterHealthyMs) {
13322
13358
  this.permitsMax = null;
13323
13359
  this.permitsCurrent = 0;
13360
+ this.backoffMs = 0;
13324
13361
  while (this.waiters.length) {
13325
13362
  const w = this.waiters.shift();
13326
13363
  try {