@ductape/sdk 0.1.134 → 0.1.135
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/processor/services/processor.service.d.ts +2 -2
- package/dist/processor/services/processor.service.js +7 -0
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/products/services/products.service.d.ts +5 -0
- package/dist/products/services/products.service.js +28 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -470,6 +470,11 @@ export default class ProductsBuilderService implements IProductsBuilderService {
|
|
|
470
470
|
private validateAppData;
|
|
471
471
|
private validateVariablesSchema;
|
|
472
472
|
private validateVariablesValues;
|
|
473
|
+
/**
|
|
474
|
+
* base_url placeholders ({{key}} / :key) are syntactically required for the URL to resolve
|
|
475
|
+
* to something requestable — unlike custom app variables, there is no "optional" case here.
|
|
476
|
+
*/
|
|
477
|
+
private validateBaseUrlVariablesRequired;
|
|
473
478
|
private validateAppEnvs;
|
|
474
479
|
private validateAppAuth;
|
|
475
480
|
createAppAccessTag(app_tag: string, known_app_id?: string): Promise<IAppAccess>;
|
|
@@ -2641,6 +2641,25 @@ class ProductsBuilderService {
|
|
|
2641
2641
|
this.inputsService.validateFeatureInputData(find, data);
|
|
2642
2642
|
});
|
|
2643
2643
|
}
|
|
2644
|
+
/**
|
|
2645
|
+
* base_url placeholders ({{key}} / :key) are syntactically required for the URL to resolve
|
|
2646
|
+
* to something requestable — unlike custom app variables, there is no "optional" case here.
|
|
2647
|
+
*/
|
|
2648
|
+
validateBaseUrlVariablesRequired(variables, baseUrlVariableKeys) {
|
|
2649
|
+
if (!(baseUrlVariableKeys === null || baseUrlVariableKeys === void 0 ? void 0 : baseUrlVariableKeys.length))
|
|
2650
|
+
return;
|
|
2651
|
+
const provided = new Map((variables !== null && variables !== void 0 ? variables : []).map((v) => [v.key, v.value]));
|
|
2652
|
+
const missing = baseUrlVariableKeys
|
|
2653
|
+
.map((v) => v.key)
|
|
2654
|
+
.filter((key) => {
|
|
2655
|
+
const value = provided.get(key);
|
|
2656
|
+
return value === undefined || value === null || String(value).trim() === '';
|
|
2657
|
+
});
|
|
2658
|
+
if (missing.length) {
|
|
2659
|
+
throw new Error(`base_url for app environment requires a value for: ${missing.join(', ')}. ` +
|
|
2660
|
+
`Provide them via envs[].variables when connecting/updating the app.`);
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2644
2663
|
validateAppEnvs(envs, version) {
|
|
2645
2664
|
const { envs: appEnvs } = version;
|
|
2646
2665
|
return envs.map((env) => {
|
|
@@ -2653,6 +2672,7 @@ class ProductsBuilderService {
|
|
|
2653
2672
|
// const updates = this.validateAppAuth(auth, version);
|
|
2654
2673
|
this.validateVariablesSchema(env.variables, version.variables, appEnv.base_url_variables);
|
|
2655
2674
|
this.validateVariablesValues(env.variables, version.variables);
|
|
2675
|
+
this.validateBaseUrlVariablesRequired(env.variables, appEnv.base_url_variables);
|
|
2656
2676
|
/*if (updates && updates.data) {
|
|
2657
2677
|
env.auth.data = updates.data;
|
|
2658
2678
|
}
|
|
@@ -2897,6 +2917,7 @@ class ProductsBuilderService {
|
|
|
2897
2917
|
}
|
|
2898
2918
|
}
|
|
2899
2919
|
async updateApp(access_tag, data) {
|
|
2920
|
+
var _a, _b, _c, _d;
|
|
2900
2921
|
try {
|
|
2901
2922
|
const app = await this.fetchApp(access_tag);
|
|
2902
2923
|
if (!app) {
|
|
@@ -2913,6 +2934,13 @@ class ProductsBuilderService {
|
|
|
2913
2934
|
/*if (data.access_tag && this.fetchApp(data.access_tag)) {
|
|
2914
2935
|
throw new Error(`access_tag ${access_tag} is in use`); // TODO: also check on the backend
|
|
2915
2936
|
}*/
|
|
2937
|
+
if ((_a = data.envs) === null || _a === void 0 ? void 0 : _a.length) {
|
|
2938
|
+
const thirdPartyApp = await this.fetchThirdPartyAppByAccessTag(access_tag);
|
|
2939
|
+
const version = (_c = (_b = thirdPartyApp === null || thirdPartyApp === void 0 ? void 0 : thirdPartyApp.versions) === null || _b === void 0 ? void 0 : _b.find((v) => v.tag === thirdPartyApp.version)) !== null && _c !== void 0 ? _c : (_d = thirdPartyApp === null || thirdPartyApp === void 0 ? void 0 : thirdPartyApp.versions) === null || _d === void 0 ? void 0 : _d[0];
|
|
2940
|
+
if (version) {
|
|
2941
|
+
data.envs = this.validateAppEnvs(data.envs, version);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2916
2944
|
await this.productApi.updateProduct(this.product_id, Object.assign(Object.assign({ _id }, data), { access_tag, component: enums_1.ProductComponents.APP, action: enums_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
2917
2945
|
}
|
|
2918
2946
|
catch (e) {
|