@ductape/sdk 0.1.7 → 0.1.9
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/cloudApi.service.d.ts +31 -0
- package/dist/api/services/cloudApi.service.js +103 -0
- package/dist/api/services/cloudApi.service.js.map +1 -0
- package/dist/api/services/productsApi.service.d.ts +17 -0
- package/dist/api/services/productsApi.service.js +18 -4
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +9 -0
- package/dist/api/urls.js +13 -3
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/integration-api-error.d.ts +6 -0
- package/dist/api/utils/integration-api-error.js +45 -0
- package/dist/api/utils/integration-api-error.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +2 -2
- package/dist/apps/utils/credential-manager.js +2 -2
- package/dist/apps/utils/oauth-manager.d.ts +5 -5
- package/dist/apps/utils/oauth-manager.js +5 -5
- package/dist/brokers/brokers.service.js +29 -8
- package/dist/brokers/brokers.service.js.map +1 -1
- package/dist/cache/cache.service.d.ts +2 -0
- package/dist/cache/cache.service.js +9 -4
- package/dist/cache/cache.service.js.map +1 -1
- package/dist/cache/types/index.d.ts +2 -0
- package/dist/cloud/cloud-runtime.util.d.ts +22 -0
- package/dist/cloud/cloud-runtime.util.js +61 -0
- package/dist/cloud/cloud-runtime.util.js.map +1 -0
- package/dist/cloud/cloud.service.d.ts +43 -0
- package/dist/cloud/cloud.service.js +121 -0
- package/dist/cloud/cloud.service.js.map +1 -0
- package/dist/cloud/index.d.ts +5 -0
- package/dist/cloud/index.js +25 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/cloud/types/cloud.types.d.ts +140 -0
- package/dist/cloud/types/cloud.types.js +6 -0
- package/dist/cloud/types/cloud.types.js.map +1 -0
- package/dist/cloud/types/index.d.ts +1 -0
- package/dist/cloud/types/index.js +18 -0
- package/dist/cloud/types/index.js.map +1 -0
- package/dist/database/databases.service.d.ts +30 -0
- package/dist/database/databases.service.js +86 -10
- package/dist/database/databases.service.js.map +1 -1
- package/dist/database/index.d.ts +1 -1
- package/dist/database/index.js.map +1 -1
- package/dist/database/types/connection.interface.d.ts +4 -0
- package/dist/graph/graphs.service.d.ts +16 -0
- package/dist/graph/graphs.service.js +110 -20
- package/dist/graph/graphs.service.js.map +1 -1
- package/dist/graph/index.d.ts +1 -0
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/types/connection.interface.d.ts +12 -0
- package/dist/index.d.ts +225 -13
- package/dist/index.js +152 -114
- package/dist/index.js.map +1 -1
- package/dist/notifications/notifications.service.d.ts +2 -0
- package/dist/notifications/notifications.service.js +10 -5
- package/dist/notifications/notifications.service.js.map +1 -1
- package/dist/notifications/types/notifications.types.d.ts +2 -0
- package/dist/products/services/products.service.d.ts +3 -1
- package/dist/products/services/products.service.js +8 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/validators/joi-validators/update.dataValue.validator.js +2 -1
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- package/dist/resilience/fallback.service.d.ts +2 -0
- package/dist/resilience/fallback.service.js +6 -1
- package/dist/resilience/fallback.service.js.map +1 -1
- package/dist/resilience/healthcheck.service.d.ts +2 -0
- package/dist/resilience/healthcheck.service.js +21 -14
- package/dist/resilience/healthcheck.service.js.map +1 -1
- package/dist/resilience/quota.service.d.ts +2 -0
- package/dist/resilience/quota.service.js +6 -1
- package/dist/resilience/quota.service.js.map +1 -1
- package/dist/resilience/types/index.d.ts +2 -0
- package/dist/runtime/runtime-defaults.d.ts +28 -0
- package/dist/runtime/runtime-defaults.js +38 -0
- package/dist/runtime/runtime-defaults.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +2 -0
- package/dist/sessions/sessions.service.js +15 -10
- package/dist/sessions/sessions.service.js.map +1 -1
- package/dist/sessions/types/index.d.ts +3 -0
- package/dist/storage/storage.service.d.ts +2 -0
- package/dist/storage/storage.service.js +43 -10
- package/dist/storage/storage.service.js.map +1 -1
- package/dist/storage/types/index.d.ts +3 -0
- package/dist/storage/utils/storage.util.js +42 -12
- package/dist/storage/utils/storage.util.js.map +1 -1
- package/dist/types/enums.d.ts +2 -1
- package/dist/types/enums.js +1 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +8 -1
- package/dist/types/index.types.js +9 -0
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +24 -7
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/vector/index.d.ts +2 -1
- package/dist/vector/index.js +3 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/utils/index.d.ts +1 -0
- package/dist/vector/utils/index.js +3 -1
- package/dist/vector/utils/index.js.map +1 -1
- package/dist/vector/utils/metadata-schema.d.ts +14 -0
- package/dist/vector/utils/metadata-schema.js +79 -0
- package/dist/vector/utils/metadata-schema.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +27 -0
- package/dist/vector/vector-database.service.js +73 -2
- package/dist/vector/vector-database.service.js.map +1 -1
- package/package.json +6 -3
|
@@ -58,6 +58,7 @@ const logs_service_1 = __importDefault(require("../logs/logs.service"));
|
|
|
58
58
|
const logs_types_1 = require("../logs/logs.types");
|
|
59
59
|
const processor_utils_1 = require("../processor/utils/processor.utils");
|
|
60
60
|
const secrets_1 = require("../secrets");
|
|
61
|
+
const cloud_runtime_util_1 = require("../cloud/cloud-runtime.util");
|
|
61
62
|
const sharedGraphRegistry = new Map();
|
|
62
63
|
const sharedGraphConnectInFlight = new Map();
|
|
63
64
|
function getSharedGraphKey(workspaceId, product, graph, env) {
|
|
@@ -93,6 +94,7 @@ class GraphService {
|
|
|
93
94
|
this.cacheManager = null;
|
|
94
95
|
/** Private keys cache for products (keyed by product tag) */
|
|
95
96
|
this.privateKeys = new Map();
|
|
97
|
+
this.runtimeDefaults = {};
|
|
96
98
|
// ==================== GRAPH ACTIONS ====================
|
|
97
99
|
/** Local cache of graph actions */
|
|
98
100
|
this.actions = new Map();
|
|
@@ -105,6 +107,12 @@ class GraphService {
|
|
|
105
107
|
if (config) {
|
|
106
108
|
this.config = config;
|
|
107
109
|
this._privateKey = config.private_key || '';
|
|
110
|
+
if (config.default_product || config.default_env) {
|
|
111
|
+
this.runtimeDefaults = {
|
|
112
|
+
default_product: config.default_product,
|
|
113
|
+
default_env: config.default_env,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
108
116
|
// Initialize CacheManager (Redis is optional - Tier 1 internal cache and Tier 3 remote cache always work)
|
|
109
117
|
this.cacheManager = new cache_manager_1.CacheManager({
|
|
110
118
|
workspace_id: config.workspace_id,
|
|
@@ -123,6 +131,21 @@ class GraphService {
|
|
|
123
131
|
updateConfig(config) {
|
|
124
132
|
this.config = config;
|
|
125
133
|
}
|
|
134
|
+
mergeGraphConnectionConfig(config) {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
136
|
+
const product = ((_a = config.product) === null || _a === void 0 ? void 0 : _a.trim()) ||
|
|
137
|
+
((_c = (_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.product) === null || _c === void 0 ? void 0 : _c.trim()) ||
|
|
138
|
+
((_d = this.runtimeDefaults.default_product) === null || _d === void 0 ? void 0 : _d.trim()) ||
|
|
139
|
+
((_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.default_product) === null || _f === void 0 ? void 0 : _f.trim());
|
|
140
|
+
const env = ((_g = config.env) === null || _g === void 0 ? void 0 : _g.trim()) ||
|
|
141
|
+
((_j = (_h = this.currentContext) === null || _h === void 0 ? void 0 : _h.env) === null || _j === void 0 ? void 0 : _j.trim()) ||
|
|
142
|
+
((_k = this.runtimeDefaults.default_env) === null || _k === void 0 ? void 0 : _k.trim()) ||
|
|
143
|
+
((_m = (_l = this.config) === null || _l === void 0 ? void 0 : _l.default_env) === null || _m === void 0 ? void 0 : _m.trim());
|
|
144
|
+
if (!product || !env) {
|
|
145
|
+
throw new Error('product and env are required. Pass them in graph.connect() or set both on the Ductape constructor.');
|
|
146
|
+
}
|
|
147
|
+
return Object.assign(Object.assign({}, config), { product, env });
|
|
148
|
+
}
|
|
126
149
|
/**
|
|
127
150
|
* Get service configuration
|
|
128
151
|
*/
|
|
@@ -323,6 +346,10 @@ class GraphService {
|
|
|
323
346
|
graphName: envConfig.graphName,
|
|
324
347
|
username: envConfig.username,
|
|
325
348
|
password: envConfig.password,
|
|
349
|
+
region: envConfig.region,
|
|
350
|
+
iamAuth: envConfig.iamAuth,
|
|
351
|
+
authMode: envConfig.authMode,
|
|
352
|
+
cloudConnectionId: envConfig.cloudConnectionId,
|
|
326
353
|
});
|
|
327
354
|
}
|
|
328
355
|
}
|
|
@@ -563,8 +590,11 @@ class GraphService {
|
|
|
563
590
|
database: env.database,
|
|
564
591
|
graphName: env.graphName,
|
|
565
592
|
region: env.region,
|
|
593
|
+
iamAuth: env.iamAuth,
|
|
566
594
|
username: env.username,
|
|
567
595
|
password: env.password,
|
|
596
|
+
authMode: env.authMode,
|
|
597
|
+
cloudConnectionId: env.cloudConnectionId,
|
|
568
598
|
})),
|
|
569
599
|
};
|
|
570
600
|
}
|
|
@@ -584,6 +614,7 @@ class GraphService {
|
|
|
584
614
|
*/
|
|
585
615
|
async connect(config) {
|
|
586
616
|
var _a, _b, _c;
|
|
617
|
+
config = this.mergeGraphConnectionConfig(config);
|
|
587
618
|
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
588
619
|
const start = Date.now();
|
|
589
620
|
const contextKey = `${config.graph}:${config.env}`;
|
|
@@ -710,7 +741,7 @@ class GraphService {
|
|
|
710
741
|
return entry;
|
|
711
742
|
}
|
|
712
743
|
async runGraphConnect(config, contextKey, adapter, context, process_id, start) {
|
|
713
|
-
var _a, _b, _c, _d, _e;
|
|
744
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
714
745
|
this.initializeLogService();
|
|
715
746
|
const envValue = config.env || '';
|
|
716
747
|
const baseLogs = {
|
|
@@ -732,24 +763,58 @@ class GraphService {
|
|
|
732
763
|
this.logService.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph connect - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
733
764
|
}
|
|
734
765
|
try {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
766
|
+
let connectionUrl = context.connectionUrl;
|
|
767
|
+
let graphName = context.graphName;
|
|
768
|
+
let username = context.username;
|
|
769
|
+
let password = context.password;
|
|
770
|
+
if (this.config && (context.authMode === 'cloud_connection' || context.cloudConnectionId)) {
|
|
771
|
+
const resolvedEnv = await (0, cloud_runtime_util_1.resolveCloudLinkedEnvConfig)({
|
|
772
|
+
connection_url: context.connectionUrl,
|
|
773
|
+
graphName: context.graphName,
|
|
774
|
+
username: context.username,
|
|
775
|
+
password: context.password,
|
|
776
|
+
region: context.region,
|
|
777
|
+
iamAuth: context.iamAuth,
|
|
778
|
+
authMode: context.authMode,
|
|
779
|
+
cloudConnectionId: context.cloudConnectionId,
|
|
780
|
+
}, {
|
|
781
|
+
environment: this.config.env_type,
|
|
782
|
+
auth: {
|
|
783
|
+
token: this.config.token,
|
|
784
|
+
public_key: this.config.public_key,
|
|
785
|
+
user_id: this.config.user_id,
|
|
786
|
+
workspace_id: this.config.workspace_id,
|
|
787
|
+
access_key: this.config.access_key,
|
|
788
|
+
},
|
|
789
|
+
productTag: config.product || '',
|
|
790
|
+
componentTag: config.graph,
|
|
791
|
+
envSlug: config.env,
|
|
792
|
+
});
|
|
793
|
+
connectionUrl = String(resolvedEnv.connection_url || connectionUrl);
|
|
794
|
+
graphName = (_d = resolvedEnv.graphName) !== null && _d !== void 0 ? _d : graphName;
|
|
795
|
+
username = (_e = resolvedEnv.username) !== null && _e !== void 0 ? _e : username;
|
|
796
|
+
password = (_f = resolvedEnv.password) !== null && _f !== void 0 ? _f : password;
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
const secretsService = (0, secrets_1.getSecretsService)();
|
|
800
|
+
const resolveSecret = async (value, fieldName) => {
|
|
801
|
+
if (!value)
|
|
802
|
+
return undefined;
|
|
803
|
+
const secretCheck = (0, secrets_1.isSecretReference)(value);
|
|
804
|
+
if (secretCheck.isSecret) {
|
|
805
|
+
if (secretsService) {
|
|
806
|
+
const resolved = await secretsService.resolve(value, { env: config.env });
|
|
807
|
+
return resolved.value;
|
|
808
|
+
}
|
|
809
|
+
throw graph_error_1.GraphError.configurationError(`${fieldName} contains secret reference but secrets service is not initialized.`);
|
|
744
810
|
}
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const password = await resolveSecret(context.password, 'password');
|
|
811
|
+
return value;
|
|
812
|
+
};
|
|
813
|
+
connectionUrl = (await resolveSecret(context.connectionUrl, 'connectionUrl')) || connectionUrl;
|
|
814
|
+
graphName = await resolveSecret(context.graphName, 'graphName');
|
|
815
|
+
username = await resolveSecret(context.username, 'username');
|
|
816
|
+
password = await resolveSecret(context.password, 'password');
|
|
817
|
+
}
|
|
753
818
|
if (!connectionUrl)
|
|
754
819
|
throw graph_error_1.GraphError.configurationError('Connection URL is required');
|
|
755
820
|
const result = await adapter.connect({
|
|
@@ -765,7 +830,7 @@ class GraphService {
|
|
|
765
830
|
this.currentContext = context;
|
|
766
831
|
this.transactionManager = new transaction_manager_1.GraphTransactionManager(adapter);
|
|
767
832
|
const end = Date.now();
|
|
768
|
-
const lastSuccess = (
|
|
833
|
+
const lastSuccess = (_g = lastGraphConnectLogAt.get(logKey)) !== null && _g !== void 0 ? _g : {};
|
|
769
834
|
if (this.logService && (!lastSuccess.success || end - lastSuccess.success >= GRAPH_CONNECT_LOG_DEBOUNCE_MS)) {
|
|
770
835
|
lastGraphConnectLogAt.set(logKey, Object.assign(Object.assign({}, lastSuccess), { success: end }));
|
|
771
836
|
this.logService.add(Object.assign(Object.assign({}, baseLogs), { start, end, message: 'Graph connect - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
@@ -775,7 +840,7 @@ class GraphService {
|
|
|
775
840
|
}
|
|
776
841
|
catch (error) {
|
|
777
842
|
const end = Date.now();
|
|
778
|
-
const lastFail = (
|
|
843
|
+
const lastFail = (_h = lastGraphConnectLogAt.get(logKey)) !== null && _h !== void 0 ? _h : {};
|
|
779
844
|
if (this.logService && (!lastFail.failed || end - lastFail.failed >= GRAPH_CONNECT_LOG_DEBOUNCE_MS)) {
|
|
780
845
|
lastGraphConnectLogAt.set(logKey, Object.assign(Object.assign({}, lastFail), { failed: end }));
|
|
781
846
|
this.logService.add(Object.assign(Object.assign({}, baseLogs), { start,
|
|
@@ -1786,6 +1851,31 @@ class GraphService {
|
|
|
1786
1851
|
return adapter.listRelationshipTypes();
|
|
1787
1852
|
});
|
|
1788
1853
|
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Get a normalized graph schema snapshot (labels, relationship types, indexes, constraints).
|
|
1856
|
+
* Useful for generating accurate executable payload templates and metadata UIs.
|
|
1857
|
+
*/
|
|
1858
|
+
async getSchemaSnapshot() {
|
|
1859
|
+
const context = this.currentContext;
|
|
1860
|
+
if (!context) {
|
|
1861
|
+
throw graph_error_1.GraphError.configurationError('No active graph connection context. Call connect() before getSchemaSnapshot().');
|
|
1862
|
+
}
|
|
1863
|
+
const [labels, relationshipTypes, indexes, constraints] = await Promise.all([
|
|
1864
|
+
this.listLabels(),
|
|
1865
|
+
this.listRelationshipTypes(),
|
|
1866
|
+
this.listIndexes(),
|
|
1867
|
+
this.listConstraints(),
|
|
1868
|
+
]);
|
|
1869
|
+
return {
|
|
1870
|
+
graph: context.graph,
|
|
1871
|
+
env: context.env,
|
|
1872
|
+
labels: labels.labels,
|
|
1873
|
+
relationshipTypes: relationshipTypes.types,
|
|
1874
|
+
indexes: indexes.indexes,
|
|
1875
|
+
constraints: constraints.constraints,
|
|
1876
|
+
generatedAt: new Date().toISOString(),
|
|
1877
|
+
};
|
|
1878
|
+
}
|
|
1789
1879
|
/**
|
|
1790
1880
|
* Generate a URL-safe tag from a name
|
|
1791
1881
|
*/
|