@ductape/sdk 0.1.125 → 0.1.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +28 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +4 -0
- package/dist/processor/services/processor.service.js +100 -5
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +25 -10
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.userAuth.validator.js +5 -2
- package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.userAuth.validator.js +5 -2
- package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -1
- package/dist/resilience/healthcheck.service.d.ts +22 -0
- package/dist/resilience/healthcheck.service.js +171 -2
- package/dist/resilience/healthcheck.service.js.map +1 -1
- package/dist/resilience/index.d.ts +1 -0
- package/dist/resilience/index.js +1 -0
- package/dist/resilience/index.js.map +1 -1
- package/dist/resilience/rate-limit.service.d.ts +37 -0
- package/dist/resilience/rate-limit.service.js +55 -0
- package/dist/resilience/rate-limit.service.js.map +1 -0
- package/dist/resilience/resilience.service.js +42 -0
- package/dist/resilience/resilience.service.js.map +1 -1
- package/dist/resilience/types/index.d.ts +46 -2
- package/dist/resilience/types/index.js +3 -0
- package/dist/resilience/types/index.js.map +1 -1
- package/dist/sessions/sessions.service.js +18 -7
- package/dist/sessions/sessions.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/productsBuilder.types.d.ts +11 -1
- package/dist/types/productsBuilder.types.js +3 -0
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ import { IGraphConfig } from './graph';
|
|
|
8
8
|
import { FeatureService } from './features';
|
|
9
9
|
import { type IPortableFunctionContract } from './functions';
|
|
10
10
|
export * from './context';
|
|
11
|
+
export * from './resilience';
|
|
11
12
|
import { BrokersService } from './brokers';
|
|
12
|
-
import { IHealthcheckDefineOptions, IDefinedHealthcheck, IQuotaDefineOptions, IDefinedQuota, IFallbackDefineOptions, IDefinedFallback } from './resilience';
|
|
13
|
+
import { IHealthcheckDefineOptions, IDefinedHealthcheck, IQuotaDefineOptions, IDefinedQuota, IFallbackDefineOptions, IDefinedFallback, IRateLimitDefinition, IRateLimitConsumeInput } from './resilience';
|
|
13
14
|
import { AgentsService } from './agents';
|
|
14
15
|
import { ModelService } from './models';
|
|
15
16
|
import { ICreateVectorDbOptions, VectorDatabaseService } from './vector';
|
|
@@ -302,6 +303,7 @@ export default class Ductape implements IDuctape {
|
|
|
302
303
|
private redisClient?;
|
|
303
304
|
/** Prevent every lazy service factory from retrying a Redis URL that already failed. */
|
|
304
305
|
private redisCacheUnavailable;
|
|
306
|
+
private _rateLimitService?;
|
|
305
307
|
private jobsQueue;
|
|
306
308
|
private healthCheckQueue;
|
|
307
309
|
private healthCheckUpdaterQueue;
|
|
@@ -316,6 +318,11 @@ export default class Ductape implements IDuctape {
|
|
|
316
318
|
}[];
|
|
317
319
|
registerEventsInvoker: (invoker: import("./functions").PortableFunctionEventsInvoker) => void;
|
|
318
320
|
};
|
|
321
|
+
/** Atomic keyed request enforcement; distinct from weighted provider quotas. */
|
|
322
|
+
rateLimit: {
|
|
323
|
+
define: (definition: IRateLimitDefinition) => IRateLimitDefinition;
|
|
324
|
+
run: (input: IRateLimitConsumeInput) => Promise<import("./resilience").IRateLimitResult>;
|
|
325
|
+
};
|
|
319
326
|
jobsWorker: any;
|
|
320
327
|
healthCheckWorker: any;
|
|
321
328
|
healthCheckUpdaterWorker: any;
|
|
@@ -868,6 +875,26 @@ export default class Ductape implements IDuctape {
|
|
|
868
875
|
env: string;
|
|
869
876
|
tag: string;
|
|
870
877
|
}) => Promise<import("./resilience").IHealthcheckStatus>;
|
|
878
|
+
statusAll: (options: {
|
|
879
|
+
product: string;
|
|
880
|
+
env: string;
|
|
881
|
+
tags: string[];
|
|
882
|
+
}) => Promise<{
|
|
883
|
+
tag: string;
|
|
884
|
+
status?: import("./resilience").IHealthcheckStatus;
|
|
885
|
+
error?: {
|
|
886
|
+
code: string;
|
|
887
|
+
message: string;
|
|
888
|
+
};
|
|
889
|
+
}[]>;
|
|
890
|
+
preflight: () => Promise<{
|
|
891
|
+
operational: boolean;
|
|
892
|
+
redis: boolean;
|
|
893
|
+
scheduling: boolean;
|
|
894
|
+
workers: boolean;
|
|
895
|
+
statusStorage: boolean;
|
|
896
|
+
code?: string;
|
|
897
|
+
}>;
|
|
871
898
|
/**
|
|
872
899
|
* Manually triggers a healthcheck run.
|
|
873
900
|
* @param {Object} options - The run options.
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ const graph_1 = require("./graph");
|
|
|
75
75
|
const features_1 = require("./features");
|
|
76
76
|
const functions_1 = require("./functions");
|
|
77
77
|
__exportStar(require("./context"), exports);
|
|
78
|
+
__exportStar(require("./resilience"), exports);
|
|
78
79
|
const storage_1 = require("./storage");
|
|
79
80
|
const sessions_1 = require("./sessions");
|
|
80
81
|
const brokers_1 = require("./brokers");
|
|
@@ -524,6 +525,20 @@ class Ductape {
|
|
|
524
525
|
list: () => functions_1.portableFunctions.list(),
|
|
525
526
|
registerEventsInvoker: (invoker) => functions_1.portableFunctions.registerEventsInvoker(invoker),
|
|
526
527
|
};
|
|
528
|
+
/** Atomic keyed request enforcement; distinct from weighted provider quotas. */
|
|
529
|
+
this.rateLimit = {
|
|
530
|
+
define: (definition) => {
|
|
531
|
+
var _a;
|
|
532
|
+
(_a = this._rateLimitService) !== null && _a !== void 0 ? _a : (this._rateLimitService = new resilience_1.RateLimitService(this.redisClient));
|
|
533
|
+
return this._rateLimitService.define(definition);
|
|
534
|
+
},
|
|
535
|
+
run: async (input) => {
|
|
536
|
+
var _a;
|
|
537
|
+
(_a = this._rateLimitService) !== null && _a !== void 0 ? _a : (this._rateLimitService = new resilience_1.RateLimitService(this.redisClient));
|
|
538
|
+
this._rateLimitService.setRedis(this.redisClient);
|
|
539
|
+
return this._rateLimitService.run(input);
|
|
540
|
+
},
|
|
541
|
+
};
|
|
527
542
|
/**
|
|
528
543
|
* Product-related operations for managing products.
|
|
529
544
|
*/
|
|
@@ -1134,6 +1149,14 @@ class Ductape {
|
|
|
1134
1149
|
const healthcheckService = await this.createNewHealthcheckService();
|
|
1135
1150
|
return healthcheckService.getStatus(options);
|
|
1136
1151
|
},
|
|
1152
|
+
statusAll: async (options) => {
|
|
1153
|
+
const healthcheckService = await this.createNewHealthcheckService();
|
|
1154
|
+
return healthcheckService.statusAll(options);
|
|
1155
|
+
},
|
|
1156
|
+
preflight: async () => {
|
|
1157
|
+
const healthcheckService = await this.createNewHealthcheckService();
|
|
1158
|
+
return healthcheckService.preflight();
|
|
1159
|
+
},
|
|
1137
1160
|
/**
|
|
1138
1161
|
* Manually triggers a healthcheck run.
|
|
1139
1162
|
* @param {Object} options - The run options.
|