@ductape/sdk 0.1.153 → 0.1.155
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/api/services/productsApi.service.d.ts +31 -0
- package/dist/api/services/productsApi.service.js +14 -0
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +1 -0
- package/dist/api/urls.js +5 -4
- package/dist/api/urls.js.map +1 -1
- package/dist/database/actions/output-contract.d.ts +46 -0
- package/dist/database/actions/output-contract.js +139 -0
- package/dist/database/actions/output-contract.js.map +1 -0
- package/dist/database/databases.service.d.ts +2 -2
- package/dist/database/databases.service.js.map +1 -1
- package/dist/database/index.d.ts +3 -1
- package/dist/database/index.js +5 -2
- package/dist/database/index.js.map +1 -1
- package/dist/database/types/action.interface.d.ts +26 -5
- package/dist/features/feature-executor.js +9 -0
- package/dist/features/feature-executor.js.map +1 -1
- package/dist/features/features.service.js +24 -3
- package/dist/features/features.service.js.map +1 -1
- package/dist/features/types/features.types.d.ts +29 -5
- package/dist/features/types/features.types.js.map +1 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +159 -4
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +2 -2
- package/dist/products/bootstrap-cache.d.ts +8 -0
- package/dist/products/bootstrap-cache.js +27 -0
- package/dist/products/bootstrap-cache.js.map +1 -1
- package/dist/products/services/products.service.d.ts +1 -0
- package/dist/products/services/products.service.js +58 -9
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.types.d.ts +9 -0
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +16 -0
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/package.json +1 -1
|
@@ -384,9 +384,9 @@ export default class ProcessorService implements IProcessorService {
|
|
|
384
384
|
runBrokerPublish(data: IStepEvent, additional_logs?: Partial<ILogData>): Promise<{
|
|
385
385
|
published: boolean;
|
|
386
386
|
}>;
|
|
387
|
-
processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<
|
|
387
|
+
processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<{
|
|
388
388
|
url: string;
|
|
389
|
-
}>;
|
|
389
|
+
} | IProcessingFailure>;
|
|
390
390
|
writeResult(status: LogEventStatus, retryable?: boolean): Promise<void>;
|
|
391
391
|
/**
|
|
392
392
|
* Separate credentials into prefixed (e.g., 'headers:Authorization') and non-prefixed (e.g., 'api_key').
|
|
@@ -4,8 +4,16 @@ import type { IBootstrapFeatureStep } from '../api/services/productsApi.service'
|
|
|
4
4
|
export declare const BOOTSTRAP_CACHE_TTL_MS: number;
|
|
5
5
|
export declare const BOOTSTRAP_REDIS_PREFIX = "ductape:bootstrap:";
|
|
6
6
|
export type BootstrapDomain = 'action' | 'notification' | 'storage' | 'session' | 'database' | 'broker' | 'graph' | 'vector' | 'resilience' | 'intelligence' | 'workflow';
|
|
7
|
+
export interface IRuntimeBootstrapEntry {
|
|
8
|
+
domain: BootstrapDomain;
|
|
9
|
+
parts: string[];
|
|
10
|
+
data: unknown;
|
|
11
|
+
}
|
|
7
12
|
export declare function buildBootstrapCacheKey(domain: BootstrapDomain, workspaceId: string, parts: Array<string | undefined | null>): string;
|
|
8
13
|
export declare function hashFeatureSteps(steps: IBootstrapFeatureStep[]): string;
|
|
14
|
+
/** Atomically prime all runtime entries into the process cache. */
|
|
15
|
+
export declare function primeRuntimeBootstrapCache(workspaceId: string, scope: string, entries: IRuntimeBootstrapEntry[]): void;
|
|
16
|
+
export declare function touchRuntimeBootstrapCache(scope: string): void;
|
|
9
17
|
/**
|
|
10
18
|
* Tiered bootstrap response cache: in-memory first, optional Redis (encrypted with workspace key).
|
|
11
19
|
* Keys: domain:workspaceId:product:env:tag…
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BootstrapCache = exports.BOOTSTRAP_REDIS_PREFIX = exports.BOOTSTRAP_CACHE_TTL_MS = void 0;
|
|
4
4
|
exports.buildBootstrapCacheKey = buildBootstrapCacheKey;
|
|
5
5
|
exports.hashFeatureSteps = hashFeatureSteps;
|
|
6
|
+
exports.primeRuntimeBootstrapCache = primeRuntimeBootstrapCache;
|
|
7
|
+
exports.touchRuntimeBootstrapCache = touchRuntimeBootstrapCache;
|
|
6
8
|
const crypto_1 = require("crypto");
|
|
7
9
|
const processor_utils_1 = require("../processor/utils/processor.utils");
|
|
8
10
|
/** TTL for bootstrap cache (same component version = same bootstrap). 5 minutes. */
|
|
@@ -23,6 +25,31 @@ function hashFeatureSteps(steps) {
|
|
|
23
25
|
// only caused duplicate calls when Features delegated to Database/Graph/etc.
|
|
24
26
|
const processBootstrapCache = new Map();
|
|
25
27
|
const processBootstrapInFlight = new Map();
|
|
28
|
+
const processRuntimeKeys = new Map();
|
|
29
|
+
/** Atomically prime all runtime entries into the process cache. */
|
|
30
|
+
function primeRuntimeBootstrapCache(workspaceId, scope, entries) {
|
|
31
|
+
const storedAt = Date.now();
|
|
32
|
+
const replacements = entries.map((entry) => ({
|
|
33
|
+
key: buildBootstrapCacheKey(entry.domain, workspaceId, entry.parts),
|
|
34
|
+
data: entry.data,
|
|
35
|
+
}));
|
|
36
|
+
const nextKeys = new Set(replacements.map((entry) => entry.key));
|
|
37
|
+
for (const previousKey of processRuntimeKeys.get(scope) || []) {
|
|
38
|
+
if (!nextKeys.has(previousKey))
|
|
39
|
+
processBootstrapCache.delete(previousKey);
|
|
40
|
+
}
|
|
41
|
+
for (const entry of replacements)
|
|
42
|
+
processBootstrapCache.set(entry.key, { data: entry.data, storedAt });
|
|
43
|
+
processRuntimeKeys.set(scope, nextKeys);
|
|
44
|
+
}
|
|
45
|
+
function touchRuntimeBootstrapCache(scope) {
|
|
46
|
+
const storedAt = Date.now();
|
|
47
|
+
for (const key of processRuntimeKeys.get(scope) || []) {
|
|
48
|
+
const entry = processBootstrapCache.get(key);
|
|
49
|
+
if (entry)
|
|
50
|
+
processBootstrapCache.set(key, Object.assign(Object.assign({}, entry), { storedAt }));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
26
53
|
/**
|
|
27
54
|
* Tiered bootstrap response cache: in-memory first, optional Redis (encrypted with workspace key).
|
|
28
55
|
* Keys: domain:workspaceId:product:env:tag…
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-cache.js","sourceRoot":"","sources":["../../src/products/bootstrap-cache.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bootstrap-cache.js","sourceRoot":"","sources":["../../src/products/bootstrap-cache.ts"],"names":[],"mappings":";;;AA4BA,wDASC;AAED,4CAGC;AAYD,gEAYC;AAED,gEAMC;AA1ED,mCAAoC;AAGpC,wEAAsE;AAEtE,oFAAoF;AACvE,QAAA,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,QAAA,sBAAsB,GAAG,oBAAoB,CAAC;AAqB3D,SAAgB,sBAAsB,CACpC,MAAuB,EACvB,WAAmB,EACnB,KAAuC;IAEvC,MAAM,KAAK,GAAG,KAAK;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SACxC,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,GAAG,8BAAsB,GAAG,MAAM,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;AACtE,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAA8B;IAC7D,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,a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,CAAC,KAAK,CAAC,GAAc,EAAE,CAAC,SAAS,CAAC,CAAC;QAC5E,CAAC;QAAC,WAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAI,GAAW,EAAE,MAAwB;QACtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC;QACtC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAA2B,CAAC;QAClE,IAAI,QAAQ;YAAE,OAAO,MAAM,QAAQ,CAAC;QAEpC,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,EAAE,CAAC;QACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC;QACvB,CAAC;gBAAS,CAAC;YACT,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO;gBAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF;AA/ED,wCA+EC"}
|
|
@@ -562,6 +562,7 @@ export default class ProductsBuilderService implements IProductsBuilderService {
|
|
|
562
562
|
fetchDatabaseAction(tag: string, throwErrorIfExists?: boolean): Promise<IProductDatabaseAction | null>;
|
|
563
563
|
updateDatabaseAction(data: Partial<IProductDatabaseAction>): Promise<void>;
|
|
564
564
|
fetchDatabaseActions(databaseTag: string): Promise<Array<IProductDatabaseAction>>;
|
|
565
|
+
private withDatabaseActionContracts;
|
|
565
566
|
deleteDatabaseAction(tag: string): Promise<void>;
|
|
566
567
|
createDatabaseMigration(data: Partial<IProductDatabaseMigration>, throwErrorIfExists?: boolean): Promise<void>;
|
|
567
568
|
/**
|
|
@@ -28,6 +28,7 @@ const cloud_database_link_util_1 = require("../../cloud/cloud-database-link.util
|
|
|
28
28
|
const cloud_graph_link_util_1 = require("../../cloud/cloud-graph-link.util");
|
|
29
29
|
const cloud_vector_link_util_1 = require("../../cloud/cloud-vector-link.util");
|
|
30
30
|
const cloud_materialize_util_1 = require("../../cloud/cloud-materialize.util");
|
|
31
|
+
const output_contract_1 = require("../../database/actions/output-contract");
|
|
31
32
|
const productsBuilder_types_1 = require("../../types/productsBuilder.types");
|
|
32
33
|
const validators_1 = require("../validators");
|
|
33
34
|
const objects_utils_1 = require("../utils/objects.utils");
|
|
@@ -623,17 +624,15 @@ class ProductsBuilderService {
|
|
|
623
624
|
}
|
|
624
625
|
async bootstrapNotification(params) {
|
|
625
626
|
try {
|
|
626
|
-
|
|
627
|
-
const result = await this.productApi.bootstrapNotification(params, this.getUserAccess());
|
|
628
|
-
if (result.notification && result.private_key) {
|
|
629
|
-
result.notification = this.decryptNotificationChannelConfigs(result.notification, result.private_key);
|
|
630
|
-
}
|
|
631
|
-
return result;
|
|
632
|
-
}, (result) => {
|
|
627
|
+
const result = await this.cachedBootstrap('notification', [params.product_tag, params.env_slug, params.notification_tag, params.message_tag], () => this.productApi.bootstrapNotification(params, this.getUserAccess()), (result) => {
|
|
633
628
|
if (result.product_id) {
|
|
634
629
|
this.product_id = result.product_id;
|
|
635
630
|
}
|
|
636
631
|
});
|
|
632
|
+
if (result.notification && result.private_key) {
|
|
633
|
+
result.notification = this.decryptNotificationChannelConfigs(result.notification, result.private_key);
|
|
634
|
+
}
|
|
635
|
+
return result;
|
|
637
636
|
}
|
|
638
637
|
catch (e) {
|
|
639
638
|
throw e;
|
|
@@ -712,8 +711,40 @@ class ProductsBuilderService {
|
|
|
712
711
|
* Bootstrap feature - fetch all action/notification/storage data for multiple steps in one API call
|
|
713
712
|
*/
|
|
714
713
|
async bootstrapFeature(params) {
|
|
714
|
+
var _a;
|
|
715
715
|
try {
|
|
716
716
|
const auth = this.getUserAccess();
|
|
717
|
+
const cachedSteps = {};
|
|
718
|
+
for (const step of params.steps) {
|
|
719
|
+
const domain = step.type === 'quota' || step.type === 'fallback' ? 'resilience' : step.type;
|
|
720
|
+
const parts = step.type === 'action'
|
|
721
|
+
? [params.product_tag, step.access_tag, params.env_slug, step.action_tag]
|
|
722
|
+
: step.type === 'notification'
|
|
723
|
+
? [params.product_tag, params.env_slug, step.notification_tag, step.message_tag]
|
|
724
|
+
: step.type === 'storage'
|
|
725
|
+
? [params.product_tag, params.env_slug, step.storage_tag]
|
|
726
|
+
: step.type === 'database'
|
|
727
|
+
? [params.product_tag, params.env_slug, step.database_tag]
|
|
728
|
+
: step.type === 'broker'
|
|
729
|
+
? [params.product_tag, params.env_slug, step.broker_tag, (_a = step.topic_tag) !== null && _a !== void 0 ? _a : '']
|
|
730
|
+
: step.type === 'graph'
|
|
731
|
+
? [params.product_tag, params.env_slug, step.graph_tag]
|
|
732
|
+
: step.type === 'vector'
|
|
733
|
+
? [params.product_tag, params.env_slug, step.vector_tag]
|
|
734
|
+
: [params.product_tag, params.env_slug, step.type, step.component_tag];
|
|
735
|
+
const cached = await this.bootstrapCache.get((0, bootstrap_cache_1.buildBootstrapCacheKey)(domain, this.workspace_id, parts));
|
|
736
|
+
if (cached == null)
|
|
737
|
+
break;
|
|
738
|
+
const cachedData = cached;
|
|
739
|
+
cachedSteps[step.step_tag] = step.type === 'notification' && (cachedData === null || cachedData === void 0 ? void 0 : cachedData.notification) && (cachedData === null || cachedData === void 0 ? void 0 : cachedData.private_key)
|
|
740
|
+
? Object.assign(Object.assign({}, cachedData), { notification: this.decryptNotificationChannelConfigs(cachedData.notification, cachedData.private_key) }) : cached;
|
|
741
|
+
}
|
|
742
|
+
if (Object.keys(cachedSteps).length === params.steps.length) {
|
|
743
|
+
const first = Object.values(cachedSteps)[0];
|
|
744
|
+
if (first)
|
|
745
|
+
this.applyBootstrapProductContext(params.product_tag, first);
|
|
746
|
+
return cachedSteps;
|
|
747
|
+
}
|
|
717
748
|
return await this.cachedBootstrap('workflow', [params.product_tag, params.env_slug, (0, bootstrap_cache_1.hashFeatureSteps)(params.steps)], async () => {
|
|
718
749
|
var _a;
|
|
719
750
|
const result = await this.productApi.bootstrapFeature(Object.assign(Object.assign({}, params), { workspace_id: auth.workspace_id }), auth);
|
|
@@ -4766,7 +4797,7 @@ class ProductsBuilderService {
|
|
|
4766
4797
|
//console.log(action.template)
|
|
4767
4798
|
// action.template = JSON.parse(action.template);
|
|
4768
4799
|
}
|
|
4769
|
-
return action;
|
|
4800
|
+
return action ? this.withDatabaseActionContracts(database, action) : null;
|
|
4770
4801
|
}
|
|
4771
4802
|
async updateDatabaseAction(data) {
|
|
4772
4803
|
try {
|
|
@@ -4822,7 +4853,25 @@ class ProductsBuilderService {
|
|
|
4822
4853
|
return{ ...data,template: JSON.parse(String(data.template))}
|
|
4823
4854
|
})*/
|
|
4824
4855
|
}
|
|
4825
|
-
return actions;
|
|
4856
|
+
return actions.map((action) => this.withDatabaseActionContracts(database, action));
|
|
4857
|
+
}
|
|
4858
|
+
withDatabaseActionContracts(database, action) {
|
|
4859
|
+
var _a, _b;
|
|
4860
|
+
const environments = (_a = database.envs) !== null && _a !== void 0 ? _a : [];
|
|
4861
|
+
const outputContractsByEnvironment = Object.fromEntries(environments.map((env) => {
|
|
4862
|
+
var _a, _b, _c;
|
|
4863
|
+
const tableSchema = (_a = env.table_schemas) === null || _a === void 0 ? void 0 : _a.find((schema) => schema.table === action.tableName);
|
|
4864
|
+
return [
|
|
4865
|
+
env.slug,
|
|
4866
|
+
(0, output_contract_1.deriveDatabaseActionOutputContract)(action, {
|
|
4867
|
+
adapter: database.type,
|
|
4868
|
+
adapterVersion: (_b = env.adapterVersion) !== null && _b !== void 0 ? _b : env.adapter_version,
|
|
4869
|
+
columns: (_c = tableSchema === null || tableSchema === void 0 ? void 0 : tableSchema.columns) !== null && _c !== void 0 ? _c : [],
|
|
4870
|
+
}),
|
|
4871
|
+
];
|
|
4872
|
+
}));
|
|
4873
|
+
const firstContract = (_b = Object.values(outputContractsByEnvironment)[0]) !== null && _b !== void 0 ? _b : (0, output_contract_1.deriveDatabaseActionOutputContract)(action, { adapter: database.type, columns: [] });
|
|
4874
|
+
return Object.assign(Object.assign({}, action), { outputContract: firstContract, outputContractsByEnvironment });
|
|
4826
4875
|
}
|
|
4827
4876
|
async deleteDatabaseAction(tag) {
|
|
4828
4877
|
try {
|