@ductape/sdk 0.1.133 → 0.1.134
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.js +0 -2
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/functions/functions.runtime.d.ts +6 -1
- package/dist/functions/functions.runtime.js +79 -48
- package/dist/functions/functions.runtime.js.map +1 -1
- package/dist/functions/types.d.ts +24 -1
- package/dist/functions/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +2 -2
- package/dist/products/services/products.service.js +45 -35
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +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').
|
|
@@ -144,9 +144,10 @@ class ProductsBuilderService {
|
|
|
144
144
|
}
|
|
145
145
|
const event = version.actions.find((act) => act.tag === action);
|
|
146
146
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
147
|
+
var _a, _b, _c;
|
|
147
148
|
const exists = await this.fetchEnv(env.slug);
|
|
148
149
|
if (!exists) {
|
|
149
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
150
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
150
151
|
}
|
|
151
152
|
await this.validateActionDataInput({ input: env.input }, event, env.input, 0, 0);
|
|
152
153
|
env.input = (0, processor_utils_1.encrypt)(JSON.stringify(env.input), this.product.private_key);
|
|
@@ -203,9 +204,10 @@ class ProductsBuilderService {
|
|
|
203
204
|
// 4. Validate and process envs
|
|
204
205
|
if (data.envs) {
|
|
205
206
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
207
|
+
var _a, _b, _c;
|
|
206
208
|
const exists = await this.fetchEnv(env.slug);
|
|
207
209
|
if (!exists) {
|
|
208
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
210
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
209
211
|
}
|
|
210
212
|
// Validate input if present
|
|
211
213
|
if (env.input) {
|
|
@@ -345,7 +347,7 @@ class ProductsBuilderService {
|
|
|
345
347
|
* Every environment carries an explicit payload, including `{}` for actions with no inputs.
|
|
346
348
|
*/
|
|
347
349
|
async validateAppHealthcheckSchema(schema) {
|
|
348
|
-
var _a, _b, _c, _d;
|
|
350
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
349
351
|
const probe = schema.probe;
|
|
350
352
|
const probeType = (_a = probe === null || probe === void 0 ? void 0 : probe.type) !== null && _a !== void 0 ? _a : ((probe === null || probe === void 0 ? void 0 : probe.app) || schema.app ? 'app' : undefined);
|
|
351
353
|
if (probeType !== 'app')
|
|
@@ -372,9 +374,9 @@ class ProductsBuilderService {
|
|
|
372
374
|
}
|
|
373
375
|
for (const env of schema.envs || []) {
|
|
374
376
|
if (!(await this.fetchEnv(env.slug))) {
|
|
375
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
377
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_f = (_e = (_d = this.product) === null || _d === void 0 ? void 0 : _d.tag) !== null && _e !== void 0 ? _e : this.product_id) !== null && _f !== void 0 ? _f : 'unknown'}"`);
|
|
376
378
|
}
|
|
377
|
-
const payload = (
|
|
379
|
+
const payload = (_g = env.input) !== null && _g !== void 0 ? _g : probe === null || probe === void 0 ? void 0 : probe.input;
|
|
378
380
|
if (payload == null) {
|
|
379
381
|
throw new Error(`App healthcheck "${schema.tag}" requires an input payload for env ${env.slug}; use {} when the action has no inputs`);
|
|
380
382
|
}
|
|
@@ -1489,9 +1491,7 @@ class ProductsBuilderService {
|
|
|
1489
1491
|
return components;
|
|
1490
1492
|
}
|
|
1491
1493
|
async fetchEnv(slug, refresh = false) {
|
|
1492
|
-
console.log("CHAMO!!!!", { slug, refresh });
|
|
1493
1494
|
if (!refresh && this.product_id && this.envCache.has(slug)) {
|
|
1494
|
-
console.log("CHAMO!!!!", { cached: this.envCache.get(slug) });
|
|
1495
1495
|
return this.envCache.get(slug);
|
|
1496
1496
|
}
|
|
1497
1497
|
const component = await this.productApi.fetchProductComponentByTag(this.product_id, 'env', slug, this.getUserAccess());
|
|
@@ -1521,7 +1521,7 @@ class ProductsBuilderService {
|
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
1523
|
async createMessageBroker(data, throwErrorIfExists = false) {
|
|
1524
|
-
var _a;
|
|
1524
|
+
var _a, _b, _c, _d;
|
|
1525
1525
|
const logPrefix = '[MessageBroker:Create]';
|
|
1526
1526
|
console.log(`${logPrefix} Starting creation for broker: ${data.tag}`);
|
|
1527
1527
|
console.log(`${logPrefix} Broker name: ${data.name}`);
|
|
@@ -1544,7 +1544,7 @@ class ProductsBuilderService {
|
|
|
1544
1544
|
const exists = await this.fetchEnv(env.slug);
|
|
1545
1545
|
if (!exists) {
|
|
1546
1546
|
console.error(`${logPrefix} Env ${env.slug} does not exist`);
|
|
1547
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
1547
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_d = (_c = (_b = this.product) === null || _b === void 0 ? void 0 : _b.tag) !== null && _c !== void 0 ? _c : this.product_id) !== null && _d !== void 0 ? _d : 'unknown'}"`);
|
|
1548
1548
|
}
|
|
1549
1549
|
console.log(`${logPrefix} Env ${env.slug} exists, verified`);
|
|
1550
1550
|
const isProvisioning = env.provisionStatus === 'provisioning';
|
|
@@ -1591,7 +1591,7 @@ class ProductsBuilderService {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
1593
|
async updateMessageBroker(tag, data) {
|
|
1594
|
-
var _a, _b;
|
|
1594
|
+
var _a, _b, _c, _d, _e;
|
|
1595
1595
|
const logPrefix = '[MessageBroker:Update]';
|
|
1596
1596
|
console.log(`${logPrefix} Starting update for broker: ${tag}`);
|
|
1597
1597
|
console.log(`${logPrefix} New tag (if changed): ${data.tag || 'unchanged'}`);
|
|
@@ -1631,7 +1631,7 @@ class ProductsBuilderService {
|
|
|
1631
1631
|
const exists = await this.fetchEnv(env.slug);
|
|
1632
1632
|
if (!exists) {
|
|
1633
1633
|
console.error(`${logPrefix} Env ${env.slug} does not exist`);
|
|
1634
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
1634
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_e = (_d = (_c = this.product) === null || _c === void 0 ? void 0 : _c.tag) !== null && _d !== void 0 ? _d : this.product_id) !== null && _e !== void 0 ? _e : 'unknown'}"`);
|
|
1635
1635
|
}
|
|
1636
1636
|
console.log(`${logPrefix} Env ${env.slug} exists, verified`);
|
|
1637
1637
|
if (env.config) {
|
|
@@ -1787,6 +1787,7 @@ class ProductsBuilderService {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
async createStorage(data, throwErrorIfExists = false) {
|
|
1790
|
+
var _a, _b, _c;
|
|
1790
1791
|
if (!(await this.fetchStorage(data.tag))) {
|
|
1791
1792
|
const auth = this.getUserAccess();
|
|
1792
1793
|
const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
|
|
@@ -1797,7 +1798,7 @@ class ProductsBuilderService {
|
|
|
1797
1798
|
for (const env of data.envs) {
|
|
1798
1799
|
const exists = await this.fetchEnv(env.slug);
|
|
1799
1800
|
if (!exists) {
|
|
1800
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
1801
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
1801
1802
|
}
|
|
1802
1803
|
if (env.type === productsBuilder_types_1.StorageProviders.GCP) {
|
|
1803
1804
|
// @ts-ignore
|
|
@@ -1848,9 +1849,10 @@ class ProductsBuilderService {
|
|
|
1848
1849
|
await create_productStorage_validator_1.UpdateProductStorageSchema.validateAsync(data);
|
|
1849
1850
|
if (data.envs && data.envs.length > 0) {
|
|
1850
1851
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
1852
|
+
var _a, _b, _c;
|
|
1851
1853
|
const exists = await this.fetchEnv(env.slug);
|
|
1852
1854
|
if (!exists) {
|
|
1853
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
1855
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
1854
1856
|
}
|
|
1855
1857
|
if (env.type === productsBuilder_types_1.StorageProviders.GCP) {
|
|
1856
1858
|
// @ts-ignore
|
|
@@ -1949,7 +1951,7 @@ class ProductsBuilderService {
|
|
|
1949
1951
|
* @param throwErrorIfExists Whether to throw error if vector config already exists
|
|
1950
1952
|
*/
|
|
1951
1953
|
async createVector(data, throwErrorIfExists = false) {
|
|
1952
|
-
var _a, _b, _c, _d;
|
|
1954
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1953
1955
|
console.log('[ProductsService.createVector] Starting vector creation:', {
|
|
1954
1956
|
tag: data.tag,
|
|
1955
1957
|
name: data.name,
|
|
@@ -1974,7 +1976,7 @@ class ProductsBuilderService {
|
|
|
1974
1976
|
});
|
|
1975
1977
|
const exists = await this.fetchEnv(env.slug, true);
|
|
1976
1978
|
if (!exists) {
|
|
1977
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
1979
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_e = (_d = (_c = this.product) === null || _c === void 0 ? void 0 : _c.tag) !== null && _d !== void 0 ? _d : this.product_id) !== null && _e !== void 0 ? _e : 'unknown'}"`);
|
|
1978
1980
|
}
|
|
1979
1981
|
if (env.apiKey) {
|
|
1980
1982
|
console.log('[ProductsService.createVector] Converting API key to secret for env:', env.slug);
|
|
@@ -1982,7 +1984,7 @@ class ProductsBuilderService {
|
|
|
1982
1984
|
env.apiKey = await this.storeVectorApiKeyAsSecret(env.apiKey, data.tag, env.slug);
|
|
1983
1985
|
console.log('[ProductsService.createVector] API key after secret conversion:', {
|
|
1984
1986
|
wasConverted: originalApiKey !== env.apiKey,
|
|
1985
|
-
isSecretRef: (
|
|
1987
|
+
isSecretRef: (_f = env.apiKey) === null || _f === void 0 ? void 0 : _f.startsWith('$Secret{'),
|
|
1986
1988
|
});
|
|
1987
1989
|
env.apiKey = (0, processor_utils_1.encrypt)(env.apiKey, this.product.private_key);
|
|
1988
1990
|
console.log('[ProductsService.createVector] API key encrypted');
|
|
@@ -1994,7 +1996,7 @@ class ProductsBuilderService {
|
|
|
1994
1996
|
env.endpoint = await this.storeVectorEndpointAsSecret(env.endpoint, data.tag, env.slug);
|
|
1995
1997
|
console.log('[ProductsService.createVector] Endpoint after secret conversion:', {
|
|
1996
1998
|
wasConverted: originalEndpoint !== env.endpoint,
|
|
1997
|
-
isSecretRef: (
|
|
1999
|
+
isSecretRef: (_g = env.endpoint) === null || _g === void 0 ? void 0 : _g.startsWith('$Secret{'),
|
|
1998
2000
|
});
|
|
1999
2001
|
env.endpoint = (0, processor_utils_1.encrypt)(env.endpoint, this.product.private_key);
|
|
2000
2002
|
console.log('[ProductsService.createVector] Endpoint encrypted');
|
|
@@ -2056,7 +2058,7 @@ class ProductsBuilderService {
|
|
|
2056
2058
|
const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
|
|
2057
2059
|
const productTag = this.product.tag;
|
|
2058
2060
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
2059
|
-
var _a, _b;
|
|
2061
|
+
var _a, _b, _c, _d, _e;
|
|
2060
2062
|
const materialized = await (0, cloud_vector_link_util_1.materializeCloudLinkedVectorEnv)(env, {
|
|
2061
2063
|
cloudApi,
|
|
2062
2064
|
auth,
|
|
@@ -2070,7 +2072,7 @@ class ProductsBuilderService {
|
|
|
2070
2072
|
});
|
|
2071
2073
|
const exists = await this.fetchEnv(materialized.slug);
|
|
2072
2074
|
if (!exists) {
|
|
2073
|
-
throw new Error(`Env ${materialized.slug} does not exist`);
|
|
2075
|
+
throw new Error(`Env "${materialized.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
2074
2076
|
}
|
|
2075
2077
|
// Store API key as secret and encrypt
|
|
2076
2078
|
if (materialized.apiKey) {
|
|
@@ -2079,7 +2081,7 @@ class ProductsBuilderService {
|
|
|
2079
2081
|
materialized.apiKey = await this.storeVectorApiKeyAsSecret(materialized.apiKey, data.tag || tag, materialized.slug);
|
|
2080
2082
|
console.log('[ProductsService.updateVector] API key after secret conversion:', {
|
|
2081
2083
|
wasConverted: originalApiKey !== materialized.apiKey,
|
|
2082
|
-
isSecretRef: (
|
|
2084
|
+
isSecretRef: (_d = materialized.apiKey) === null || _d === void 0 ? void 0 : _d.startsWith('$Secret{'),
|
|
2083
2085
|
});
|
|
2084
2086
|
materialized.apiKey = (0, processor_utils_1.encrypt)(materialized.apiKey, this.product.private_key);
|
|
2085
2087
|
console.log('[ProductsService.updateVector] API key encrypted');
|
|
@@ -2091,7 +2093,7 @@ class ProductsBuilderService {
|
|
|
2091
2093
|
materialized.endpoint = await this.storeVectorEndpointAsSecret(materialized.endpoint, data.tag || tag, materialized.slug);
|
|
2092
2094
|
console.log('[ProductsService.updateVector] Endpoint after secret conversion:', {
|
|
2093
2095
|
wasConverted: originalEndpoint !== materialized.endpoint,
|
|
2094
|
-
isSecretRef: (
|
|
2096
|
+
isSecretRef: (_e = materialized.endpoint) === null || _e === void 0 ? void 0 : _e.startsWith('$Secret{'),
|
|
2095
2097
|
});
|
|
2096
2098
|
materialized.endpoint = (0, processor_utils_1.encrypt)(materialized.endpoint, this.product.private_key);
|
|
2097
2099
|
console.log('[ProductsService.updateVector] Endpoint encrypted');
|
|
@@ -2343,6 +2345,7 @@ class ProductsBuilderService {
|
|
|
2343
2345
|
* @param throwErrorIfExists Whether to throw an error if agent already exists
|
|
2344
2346
|
*/
|
|
2345
2347
|
async createAgent(data, throwErrorIfExists = false) {
|
|
2348
|
+
var _a, _b, _c;
|
|
2346
2349
|
if (!(await this.fetchAgent(data.tag))) {
|
|
2347
2350
|
await validators_1.CreateProductAgentSchema.validateAsync(data);
|
|
2348
2351
|
// Validate envs if provided
|
|
@@ -2350,7 +2353,7 @@ class ProductsBuilderService {
|
|
|
2350
2353
|
for (const env of data.envs) {
|
|
2351
2354
|
const exists = await this.fetchEnv(env.slug);
|
|
2352
2355
|
if (!exists) {
|
|
2353
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
2356
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
2354
2357
|
}
|
|
2355
2358
|
}
|
|
2356
2359
|
}
|
|
@@ -2382,6 +2385,7 @@ class ProductsBuilderService {
|
|
|
2382
2385
|
* @param data Updated agent configuration
|
|
2383
2386
|
*/
|
|
2384
2387
|
async updateAgent(tag, data) {
|
|
2388
|
+
var _a, _b, _c;
|
|
2385
2389
|
try {
|
|
2386
2390
|
const agent = await this.fetchAgent(tag);
|
|
2387
2391
|
if (!agent) {
|
|
@@ -2397,7 +2401,7 @@ class ProductsBuilderService {
|
|
|
2397
2401
|
for (const env of data.envs) {
|
|
2398
2402
|
const exists = await this.fetchEnv(env.slug);
|
|
2399
2403
|
if (!exists) {
|
|
2400
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
2404
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
2401
2405
|
}
|
|
2402
2406
|
}
|
|
2403
2407
|
const overwrite = [];
|
|
@@ -2473,13 +2477,14 @@ class ProductsBuilderService {
|
|
|
2473
2477
|
* @param throwErrorIfExists Whether to throw error if model already exists
|
|
2474
2478
|
*/
|
|
2475
2479
|
async createModel(data, throwErrorIfExists = false) {
|
|
2480
|
+
var _a, _b, _c;
|
|
2476
2481
|
if (!(await this.fetchModel(data.tag))) {
|
|
2477
2482
|
await validators_1.CreateProductModelSchema.validateAsync(data);
|
|
2478
2483
|
const processedEnvs = [];
|
|
2479
2484
|
for (const env of data.envs) {
|
|
2480
2485
|
const exists = await this.fetchEnv(env.slug);
|
|
2481
2486
|
if (!exists) {
|
|
2482
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
2487
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
2483
2488
|
}
|
|
2484
2489
|
// Store API key as secret and encrypt
|
|
2485
2490
|
if (env.apiKey) {
|
|
@@ -2521,9 +2526,10 @@ class ProductsBuilderService {
|
|
|
2521
2526
|
}
|
|
2522
2527
|
if (data.envs) {
|
|
2523
2528
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
2529
|
+
var _a, _b, _c;
|
|
2524
2530
|
const exists = await this.fetchEnv(env.slug);
|
|
2525
2531
|
if (!exists) {
|
|
2526
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
2532
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
2527
2533
|
}
|
|
2528
2534
|
// Store API key as secret and encrypt
|
|
2529
2535
|
if (env.apiKey) {
|
|
@@ -4174,6 +4180,7 @@ class ProductsBuilderService {
|
|
|
4174
4180
|
return action;
|
|
4175
4181
|
}
|
|
4176
4182
|
async createDatabase(data, throwErrorIfExists = false) {
|
|
4183
|
+
var _a, _b, _c;
|
|
4177
4184
|
try {
|
|
4178
4185
|
if (!(await this.fetchDatabase(data.tag))) {
|
|
4179
4186
|
const auth = this.getUserAccess();
|
|
@@ -4188,7 +4195,7 @@ class ProductsBuilderService {
|
|
|
4188
4195
|
for (const env of data.envs) {
|
|
4189
4196
|
const exists = await this.fetchEnv(env.slug);
|
|
4190
4197
|
if (!exists) {
|
|
4191
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
4198
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
4192
4199
|
}
|
|
4193
4200
|
if (env.connection_url) {
|
|
4194
4201
|
env.connection_url = (0, processor_utils_1.encrypt)(env.connection_url, this.product.private_key);
|
|
@@ -4237,9 +4244,10 @@ class ProductsBuilderService {
|
|
|
4237
4244
|
await validators_1.UpdateProductDatabaseSchema.validateAsync(data);
|
|
4238
4245
|
if (data.envs && data.envs.length > 0) {
|
|
4239
4246
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
4247
|
+
var _a, _b, _c;
|
|
4240
4248
|
const exists = await this.fetchEnv(env.slug);
|
|
4241
4249
|
if (!exists) {
|
|
4242
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
4250
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
4243
4251
|
}
|
|
4244
4252
|
if (env.connection_url) {
|
|
4245
4253
|
env.connection_url = (0, processor_utils_1.encrypt)(env.connection_url, this.product.private_key);
|
|
@@ -4340,7 +4348,7 @@ class ProductsBuilderService {
|
|
|
4340
4348
|
}
|
|
4341
4349
|
// GRAPH CRUD METHODS
|
|
4342
4350
|
async createGraph(data, throwErrorIfExists = false) {
|
|
4343
|
-
var _a, _b, _c;
|
|
4351
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4344
4352
|
console.log('[ProductsService.createGraph] Starting graph creation:', {
|
|
4345
4353
|
tag: data.tag,
|
|
4346
4354
|
name: data.name,
|
|
@@ -4367,7 +4375,7 @@ class ProductsBuilderService {
|
|
|
4367
4375
|
});
|
|
4368
4376
|
const exists = await this.fetchEnv(env.slug);
|
|
4369
4377
|
if (!exists) {
|
|
4370
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
4378
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_e = (_d = (_c = this.product) === null || _c === void 0 ? void 0 : _c.tag) !== null && _d !== void 0 ? _d : this.product_id) !== null && _e !== void 0 ? _e : 'unknown'}"`);
|
|
4371
4379
|
}
|
|
4372
4380
|
if (env.connection_url) {
|
|
4373
4381
|
console.log('[ProductsService.createGraph] Converting connection URL to secret for env:', env.slug);
|
|
@@ -4375,7 +4383,7 @@ class ProductsBuilderService {
|
|
|
4375
4383
|
env.connection_url = await this.storeGraphConnectionUrlAsSecret(env.connection_url, data.tag, env.slug);
|
|
4376
4384
|
console.log('[ProductsService.createGraph] Connection URL after secret conversion:', {
|
|
4377
4385
|
wasConverted: originalUrl !== env.connection_url,
|
|
4378
|
-
isSecretRef: (
|
|
4386
|
+
isSecretRef: (_f = env.connection_url) === null || _f === void 0 ? void 0 : _f.startsWith('$Secret{'),
|
|
4379
4387
|
});
|
|
4380
4388
|
env.connection_url = (0, processor_utils_1.encrypt)(env.connection_url, this.product.private_key);
|
|
4381
4389
|
console.log('[ProductsService.createGraph] Connection URL encrypted');
|
|
@@ -4444,7 +4452,7 @@ class ProductsBuilderService {
|
|
|
4444
4452
|
const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
|
|
4445
4453
|
const productTag = this.product.tag;
|
|
4446
4454
|
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
4447
|
-
var _a;
|
|
4455
|
+
var _a, _b, _c, _d;
|
|
4448
4456
|
const materialized = await (0, cloud_graph_link_util_1.materializeCloudLinkedGraphEnv)(env, {
|
|
4449
4457
|
cloudApi,
|
|
4450
4458
|
auth,
|
|
@@ -4459,7 +4467,7 @@ class ProductsBuilderService {
|
|
|
4459
4467
|
});
|
|
4460
4468
|
const exists = await this.fetchEnv(materialized.slug);
|
|
4461
4469
|
if (!exists) {
|
|
4462
|
-
throw new Error(`Env ${materialized.slug} does not exist`);
|
|
4470
|
+
throw new Error(`Env "${materialized.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
4463
4471
|
}
|
|
4464
4472
|
if (materialized.connection_url) {
|
|
4465
4473
|
// Store connection URL as secret
|
|
@@ -4468,7 +4476,7 @@ class ProductsBuilderService {
|
|
|
4468
4476
|
materialized.connection_url = await this.storeGraphConnectionUrlAsSecret(materialized.connection_url, data.tag || tag, materialized.slug);
|
|
4469
4477
|
console.log('[ProductsService.updateGraph] Connection URL after secret conversion:', {
|
|
4470
4478
|
wasConverted: originalUrl !== materialized.connection_url,
|
|
4471
|
-
isSecretRef: (
|
|
4479
|
+
isSecretRef: (_d = materialized.connection_url) === null || _d === void 0 ? void 0 : _d.startsWith('$Secret{'),
|
|
4472
4480
|
});
|
|
4473
4481
|
materialized.connection_url = (0, processor_utils_1.encrypt)(materialized.connection_url, this.product.private_key);
|
|
4474
4482
|
console.log('[ProductsService.updateGraph] Connection URL encrypted');
|
|
@@ -5124,6 +5132,7 @@ class ProductsBuilderService {
|
|
|
5124
5132
|
}
|
|
5125
5133
|
// ==================== WORKFLOW CRUD METHODS ====================
|
|
5126
5134
|
async createFeature(data, throwErrorIfExists = false) {
|
|
5135
|
+
var _a, _b, _c;
|
|
5127
5136
|
try {
|
|
5128
5137
|
const productId = this.requireProductId(`createFeature("${data.tag || ''}")`);
|
|
5129
5138
|
const existing = await this.fetchFeature(data.tag);
|
|
@@ -5137,7 +5146,7 @@ class ProductsBuilderService {
|
|
|
5137
5146
|
for (const env of data.envs) {
|
|
5138
5147
|
const exists = await this.fetchEnv(env.slug);
|
|
5139
5148
|
if (!exists) {
|
|
5140
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
5149
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
5141
5150
|
}
|
|
5142
5151
|
}
|
|
5143
5152
|
}
|
|
@@ -5195,6 +5204,7 @@ class ProductsBuilderService {
|
|
|
5195
5204
|
}
|
|
5196
5205
|
}
|
|
5197
5206
|
async updateFeature(tag, data) {
|
|
5207
|
+
var _a, _b, _c;
|
|
5198
5208
|
try {
|
|
5199
5209
|
const feature = await this.fetchFeature(tag);
|
|
5200
5210
|
if (!feature) {
|
|
@@ -5209,7 +5219,7 @@ class ProductsBuilderService {
|
|
|
5209
5219
|
for (const env of data.envs) {
|
|
5210
5220
|
const exists = await this.fetchEnv(env.slug);
|
|
5211
5221
|
if (!exists) {
|
|
5212
|
-
throw new Error(`Env ${env.slug} does not exist`);
|
|
5222
|
+
throw new Error(`Env "${env.slug}" does not exist on product "${(_c = (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.tag) !== null && _b !== void 0 ? _b : this.product_id) !== null && _c !== void 0 ? _c : 'unknown'}"`);
|
|
5213
5223
|
}
|
|
5214
5224
|
}
|
|
5215
5225
|
}
|