@ductape/sdk 0.3.6 → 0.3.8
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/context/execution-context.d.ts +2 -0
- package/dist/context/execution-context.js +1 -1
- package/dist/context/execution-context.js.map +1 -1
- package/dist/features/features.service.d.ts +20 -2
- package/dist/features/features.service.js +63 -24
- package/dist/features/features.service.js.map +1 -1
- package/dist/features/index.d.ts +1 -0
- package/dist/features/index.js +4 -2
- package/dist/features/index.js.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +68 -10
- package/dist/index.js.map +1 -1
- package/dist/logs/logs.service.js +4 -2
- package/dist/logs/logs.service.js.map +1 -1
- package/dist/logs/logs.types.d.ts +3 -0
- package/dist/logs/logs.types.js +1 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +2 -2
- package/dist/products/services/products.service.d.ts +1 -0
- package/dist/products/services/products.service.js +31 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/resilience/healthcheck.service.js +25 -6
- package/dist/resilience/healthcheck.service.js.map +1 -1
- package/dist/resilience/rate-limit.service.d.ts +30 -3
- package/dist/resilience/rate-limit.service.js +117 -30
- package/dist/resilience/rate-limit.service.js.map +1 -1
- package/dist/storage/types/index.d.ts +4 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +255 -2
package/dist/index.js
CHANGED
|
@@ -50,9 +50,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
55
|
-
exports.getAssetSchemas = exports.buildVpcConnectorRelayWebSocketUrl = exports.parseTcpEndpointFromUrl = exports.buildVpcConnectorTunnelAdapterOptions = exports.openVpcConnectorTunnelStream = exports.resolveCloudLinkedEnvConfig = exports.resolveCloudLinkedConfig = exports.CloudError = exports.CloudService = exports.mightContainSecrets = exports.findAllSecretReferences = exports.extractSecretKeys = exports.containsSecretReferences = exports.isSecretReference = void 0;
|
|
53
|
+
exports.deriveDatabaseActionOutputContract = exports.createMemoryAdapter = exports.createWeaviateAdapter = exports.createQdrantAdapter = exports.createPineconeAdapter = exports.createVectorStoreAdapter = exports.VectorServiceAdapter = exports.OpenAIProvider = exports.AnthropicProvider = exports.createLLMProvider = exports.MemoryManager = exports.ToolRegistry = exports.AgentContext = exports.AgentExecutor = exports.agentsService = exports.AgentError = exports.AgentsService = exports.verifyInvocationSignature = exports.PORTABLE_FUNCTION_HTTP_PATH = exports.handlePortableFunctionHttpRequest = exports.PortableFunctionError = exports.PortableFunctionsRegistry = exports.portableFunctions = exports.defineFunctions = exports.defineFunction = exports.FeatureExecutor = exports.createFeature = exports.FeatureBuilder = exports.FeaturePublicationError = exports.featureService = exports.FeatureCompilationError = exports.FeatureError = exports.FeatureService = exports.GraphAdapterFactory = exports.MemgraphAdapter = exports.ArangoDBAdapter = exports.NeptuneAdapter = exports.Neo4jAdapter = exports.BaseGraphAdapter = exports.GraphError = exports.GraphSortOrder = exports.GraphFeature = exports.GraphErrorType = exports.GraphTransactionStatus = exports.GraphIsolationLevel = exports.NodeConstraintType = exports.NodeIndexType = exports.TraversalDirection = exports.GraphType = exports.GraphService = void 0;
|
|
54
|
+
exports.SecretRevokedError = exports.SecretExpiredError = exports.SecretEnvironmentError = exports.SecretScopeError = exports.SecretNotFoundError = exports.SECRET_PATTERN_GLOBAL = exports.SECRET_PATTERN = exports.SecretsService = exports.VectorFeature = exports.VectorErrorType = exports.VectorIndexType = exports.DistanceMetric = exports.VectorDBType = exports.MemoryAdapter = exports.WeaviateAdapter = exports.QdrantAdapter = exports.PineconeAdapter = exports.BaseVectorAdapter = exports.VectorError = exports.VectorDatabaseService = exports.SmsProvider = exports.PushNotificationProvider = exports.NotificationChannelType = exports.notificationsService = exports.NotificationsService = exports.getSqsQueueUrl = exports.isValidSqsUrl = exports.parseEventString = exports.loadBrokerService = exports.GooglePubSubService = exports.RedisService = exports.SQSService = exports.KafkaService = exports.RabbitMQService = exports.BrokerError = exports.BrokersService = exports.CacheLogger = exports.cacheLogger = exports.CacheError = exports.CacheService = exports.SessionError = exports.SessionsService = exports.generateSignedUrl = exports.listBlobsInCloud = exports.deleteBlobFromCloud = exports.downloadBlobFromCloud = exports.uploadBlobToCloud = exports.StorageError = exports.StorageService = exports.validateDatabaseActionOutput = void 0;
|
|
55
|
+
exports.getAssetSchemas = exports.buildVpcConnectorRelayWebSocketUrl = exports.parseTcpEndpointFromUrl = exports.buildVpcConnectorTunnelAdapterOptions = exports.openVpcConnectorTunnelStream = exports.resolveCloudLinkedEnvConfig = exports.resolveCloudLinkedConfig = exports.CloudError = exports.CloudService = exports.mightContainSecrets = exports.findAllSecretReferences = exports.extractSecretKeys = exports.containsSecretReferences = exports.isSecretReference = exports.SecretResolutionError = void 0;
|
|
56
56
|
const appApi_service_1 = require("./api/services/appApi.service");
|
|
57
57
|
const userApi_service_1 = require("./api/services/userApi.service");
|
|
58
58
|
const workspaceApi_service_1 = require("./api/services/workspaceApi.service");
|
|
@@ -60,6 +60,7 @@ const app_service_1 = __importDefault(require("./apps/services/app.service"));
|
|
|
60
60
|
const filePath = __importStar(require("path"));
|
|
61
61
|
const products_service_1 = __importDefault(require("./products/services/products.service"));
|
|
62
62
|
const fs_1 = require("fs");
|
|
63
|
+
const crypto_1 = require("crypto");
|
|
63
64
|
const types_1 = require("./types");
|
|
64
65
|
const index_types_1 = require("./types/index.types");
|
|
65
66
|
const runtime_defaults_1 = require("./runtime/runtime-defaults");
|
|
@@ -323,10 +324,12 @@ Object.defineProperty(exports, "FeatureError", { enumerable: true, get: function
|
|
|
323
324
|
Object.defineProperty(exports, "FeatureCompilationError", { enumerable: true, get: function () { return features_2.FeatureCompilationError; } });
|
|
324
325
|
Object.defineProperty(exports, "featureService", { enumerable: true, get: function () { return features_2.featureService; } });
|
|
325
326
|
var features_3 = require("./features");
|
|
326
|
-
Object.defineProperty(exports, "
|
|
327
|
-
Object.defineProperty(exports, "createFeature", { enumerable: true, get: function () { return features_3.createFeature; } });
|
|
327
|
+
Object.defineProperty(exports, "FeaturePublicationError", { enumerable: true, get: function () { return features_3.FeaturePublicationError; } });
|
|
328
328
|
var features_4 = require("./features");
|
|
329
|
-
Object.defineProperty(exports, "
|
|
329
|
+
Object.defineProperty(exports, "FeatureBuilder", { enumerable: true, get: function () { return features_4.FeatureBuilder; } });
|
|
330
|
+
Object.defineProperty(exports, "createFeature", { enumerable: true, get: function () { return features_4.createFeature; } });
|
|
331
|
+
var features_5 = require("./features");
|
|
332
|
+
Object.defineProperty(exports, "FeatureExecutor", { enumerable: true, get: function () { return features_5.FeatureExecutor; } });
|
|
330
333
|
var functions_2 = require("./functions");
|
|
331
334
|
Object.defineProperty(exports, "defineFunction", { enumerable: true, get: function () { return functions_2.defineFunction; } });
|
|
332
335
|
Object.defineProperty(exports, "defineFunctions", { enumerable: true, get: function () { return functions_2.defineFunctions; } });
|
|
@@ -539,8 +542,27 @@ class Ductape {
|
|
|
539
542
|
this.runtimeCredentialState = { status: 'idle', referenced: 0, cached: 0, missing: 0 };
|
|
540
543
|
this.runtimeClosed = false;
|
|
541
544
|
/** Register and inspect portable application functions used by Feature JSON. */
|
|
545
|
+
this.registeredFunctionContracts = new Map();
|
|
542
546
|
this.functions = {
|
|
543
|
-
register: (contract) =>
|
|
547
|
+
register: (contract) => {
|
|
548
|
+
const client = functions_1.portableFunctions.register(contract);
|
|
549
|
+
this.registeredFunctionContracts.set(`${contract.namespace}@${contract.version}`, contract);
|
|
550
|
+
return client;
|
|
551
|
+
},
|
|
552
|
+
sync: async (options = {}) => {
|
|
553
|
+
var _a;
|
|
554
|
+
const product = (_a = options.product) !== null && _a !== void 0 ? _a : this.defaultProduct;
|
|
555
|
+
if (!product)
|
|
556
|
+
throw new Error('Product is required to persist function metadata');
|
|
557
|
+
const builder = await this.getProductBuilder(product);
|
|
558
|
+
const results = [];
|
|
559
|
+
for (const contract of this.registeredFunctionContracts.values()) {
|
|
560
|
+
if (options.namespaces && !options.namespaces.includes(contract.namespace))
|
|
561
|
+
continue;
|
|
562
|
+
results.push(await builder.syncPortableFunction(contract));
|
|
563
|
+
}
|
|
564
|
+
return results;
|
|
565
|
+
},
|
|
544
566
|
use: (contract) => functions_1.portableFunctions.use(contract),
|
|
545
567
|
list: () => functions_1.portableFunctions.list(),
|
|
546
568
|
registerGrpcInvoker: (invoker) => functions_1.portableFunctions.registerGrpcInvoker(invoker),
|
|
@@ -548,15 +570,41 @@ class Ductape {
|
|
|
548
570
|
};
|
|
549
571
|
/** Atomic keyed request enforcement; distinct from weighted provider quotas. */
|
|
550
572
|
this.rateLimit = {
|
|
573
|
+
list: () => { var _a, _b; return (_b = (_a = this._rateLimitService) === null || _a === void 0 ? void 0 : _a.list()) !== null && _b !== void 0 ? _b : []; },
|
|
574
|
+
sync: async (env, product) => {
|
|
575
|
+
var _a;
|
|
576
|
+
await this.initUserAuth(false);
|
|
577
|
+
(_a = this._rateLimitService) !== null && _a !== void 0 ? _a : (this._rateLimitService = new resilience_1.RateLimitService(this.redisClient));
|
|
578
|
+
this._rateLimitService.setRedis(this.redisClient);
|
|
579
|
+
this._rateLimitService.setContext({ workspace: this.workspace_id, product: product !== null && product !== void 0 ? product : this.defaultProduct });
|
|
580
|
+
return this._rateLimitService.sync(env, product);
|
|
581
|
+
},
|
|
551
582
|
define: (definition) => {
|
|
552
583
|
var _a;
|
|
553
584
|
(_a = this._rateLimitService) !== null && _a !== void 0 ? _a : (this._rateLimitService = new resilience_1.RateLimitService(this.redisClient));
|
|
554
585
|
return this._rateLimitService.define(definition);
|
|
555
586
|
},
|
|
556
587
|
run: async (input) => {
|
|
557
|
-
var _a;
|
|
558
|
-
|
|
588
|
+
var _a, _b;
|
|
589
|
+
await this.initUserAuth(false);
|
|
590
|
+
let sessionFields = {};
|
|
591
|
+
if (input.session) {
|
|
592
|
+
const builder = await this.getProductBuilder((_a = input.product) !== null && _a !== void 0 ? _a : this.defaultProduct);
|
|
593
|
+
const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('./sessions')));
|
|
594
|
+
const resolved = await processSessionForExecution(input.session, builder.fetchPrivateKey(), input, input.env, {
|
|
595
|
+
fetchSessionSelector: async (tag) => { var _a; return (_a = (await builder.fetchSession(tag))) === null || _a === void 0 ? void 0 : _a.selector; },
|
|
596
|
+
});
|
|
597
|
+
if (resolved.error)
|
|
598
|
+
throw new Error('Invalid rate-limit session');
|
|
599
|
+
sessionFields = resolved.logFields;
|
|
600
|
+
}
|
|
601
|
+
(_b = this._rateLimitService) !== null && _b !== void 0 ? _b : (this._rateLimitService = new resilience_1.RateLimitService(this.redisClient));
|
|
559
602
|
this._rateLimitService.setRedis(this.redisClient);
|
|
603
|
+
const logger = this.createNewLogger();
|
|
604
|
+
this._rateLimitService.setContext({ workspace: this.workspace_id, product: this.defaultProduct, observe: (event) => {
|
|
605
|
+
logger.add(Object.assign({ process_id: (0, crypto_1.randomUUID)(), product_tag: event.product, env: event.env, parent_tag: event.tag, type: 'rate_limit', status: (event.outcome === 'allowed' ? 'success' : 'fail'), successful_execution: event.outcome === 'allowed', failed_execution: event.outcome !== 'allowed', name: 'Rate limit decision', action: event.outcome, data: event, latency: event.latency, parent_process_id: event.executionId, trace_id: event.correlationId }, sessionFields));
|
|
606
|
+
void logger.publish();
|
|
607
|
+
} });
|
|
560
608
|
return this._rateLimitService.run(input);
|
|
561
609
|
},
|
|
562
610
|
};
|
|
@@ -1268,12 +1316,22 @@ class Ductape {
|
|
|
1268
1316
|
return builder.fetchStorageFiles(data);
|
|
1269
1317
|
},*/
|
|
1270
1318
|
/**
|
|
1271
|
-
* Deletes
|
|
1319
|
+
* Deletes an entire storage **component** from the product's configuration.
|
|
1320
|
+
* This is an administrative operation, not a file operation — to delete a single file
|
|
1321
|
+
* from cloud storage, use `ductape.storage.remove(options)` (matches `IDeleteOptions`)
|
|
1322
|
+
* instead. Calling this with an `IDeleteOptions`-shaped object by mistake previously
|
|
1323
|
+
* stringified that object into the request URL and produced a confusing 404 rather than a
|
|
1324
|
+
* clear error (DT-087) — now rejected immediately with a descriptive TypeError.
|
|
1272
1325
|
* @param {string} product - The product tag.
|
|
1273
1326
|
* @param {string} tag - The storage tag.
|
|
1274
1327
|
* @returns {Promise<void>} Resolves when the storage is deleted. Throws on error.
|
|
1275
1328
|
*/
|
|
1276
1329
|
delete: async (product, tag) => {
|
|
1330
|
+
if (typeof product !== 'string' || typeof tag !== 'string') {
|
|
1331
|
+
throw new TypeError('storage.delete(product, tag) expects two string arguments (product tag, storage tag) — ' +
|
|
1332
|
+
'it deletes an entire storage component from the product. To delete a single file, use ' +
|
|
1333
|
+
'storage.remove({product, env, storage, fileName}) instead.');
|
|
1334
|
+
}
|
|
1277
1335
|
const builder = await this.getProductBuilder(product);
|
|
1278
1336
|
return builder.deleteStorage(tag);
|
|
1279
1337
|
},
|