@ductape/sdk 0.0.6 → 0.0.7

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.
Files changed (35) hide show
  1. package/dist/apps/services/app.service.js +14 -5
  2. package/dist/apps/services/app.service.js.map +1 -1
  3. package/dist/apps/utils/string.utils.d.ts +7 -0
  4. package/dist/apps/utils/string.utils.js +33 -1
  5. package/dist/apps/utils/string.utils.js.map +1 -1
  6. package/dist/apps/validators/joi-validators/create.appEnv.validator.js +1 -0
  7. package/dist/apps/validators/joi-validators/create.appEnv.validator.js.map +1 -1
  8. package/dist/apps/validators/joi-validators/update.appEnv.validator.js +1 -0
  9. package/dist/apps/validators/joi-validators/update.appEnv.validator.js.map +1 -1
  10. package/dist/brokers/brokers.service.d.ts +4 -1
  11. package/dist/brokers/brokers.service.js +104 -20
  12. package/dist/brokers/brokers.service.js.map +1 -1
  13. package/dist/database/databases.service.d.ts +15 -0
  14. package/dist/database/databases.service.js +183 -14
  15. package/dist/database/databases.service.js.map +1 -1
  16. package/dist/graph/graphs.service.d.ts +6 -0
  17. package/dist/graph/graphs.service.js +155 -35
  18. package/dist/graph/graphs.service.js.map +1 -1
  19. package/dist/index.d.ts +28 -10
  20. package/dist/index.js +88 -10
  21. package/dist/index.js.map +1 -1
  22. package/dist/processor/services/processor.service.d.ts +15 -2
  23. package/dist/processor/services/processor.service.js +246 -28
  24. package/dist/processor/services/processor.service.js.map +1 -1
  25. package/dist/products/services/products.service.js +23 -24
  26. package/dist/products/services/products.service.js.map +1 -1
  27. package/dist/types/appBuilder.types.d.ts +6 -0
  28. package/dist/vector/vector-database.service.d.ts +6 -0
  29. package/dist/vector/vector-database.service.js +138 -31
  30. package/dist/vector/vector-database.service.js.map +1 -1
  31. package/dist/workflows/workflow-executor.js +99 -44
  32. package/dist/workflows/workflow-executor.js.map +1 -1
  33. package/dist/workflows/workflows.service.js +63 -20
  34. package/dist/workflows/workflows.service.js.map +1 -1
  35. package/package.json +1 -1
@@ -2287,32 +2287,31 @@ class ProductsBuilderService {
2287
2287
  // await this.validateAppAuth(auth, appData);
2288
2288
  return app;
2289
2289
  }
2290
- validateVariablesSchema(variables, appVariables) {
2291
- if (variables && variables.length) {
2292
- variables.map((data) => {
2293
- const appVar = appVariables.find((value) => value.key === data.key);
2294
- if (!appVar) {
2295
- throw new Error(`variable key: ${data.key} not found`);
2296
- }
2297
- // if()
2298
- });
2299
- }
2290
+ validateVariablesSchema(variables, appVariables, baseUrlVariableKeys) {
2291
+ if (!(variables === null || variables === void 0 ? void 0 : variables.length))
2292
+ return;
2293
+ const baseKeys = new Set((baseUrlVariableKeys !== null && baseUrlVariableKeys !== void 0 ? baseUrlVariableKeys : []).map((v) => v.key));
2294
+ variables.forEach((data) => {
2295
+ const appVar = appVariables === null || appVariables === void 0 ? void 0 : appVariables.find((value) => value.key === data.key);
2296
+ if (appVar)
2297
+ return;
2298
+ if (baseKeys.has(data.key))
2299
+ return; // base_url variable (e.g. {{prefix}})
2300
+ throw new Error(`variable key: ${data.key} not found`);
2301
+ });
2300
2302
  }
2301
2303
  validateVariablesValues(variables, appVariables) {
2302
- if (!variables) {
2303
- variables = [];
2304
- }
2305
- if (appVariables && appVariables.length) {
2306
- appVariables.map((data) => {
2307
- const find = variables.find((value) => value.key === data.key);
2308
- if (data.required) {
2309
- if (!find) {
2310
- throw new Error(`variable key: ${data.key} is required`);
2311
- }
2312
- }
2304
+ const vars = variables !== null && variables !== void 0 ? variables : [];
2305
+ if (!(appVariables === null || appVariables === void 0 ? void 0 : appVariables.length))
2306
+ return;
2307
+ appVariables.forEach((data) => {
2308
+ const find = vars.find((value) => value.key === data.key);
2309
+ if (data.required && !find) {
2310
+ throw new Error(`variable key: ${data.key} is required`);
2311
+ }
2312
+ if (find)
2313
2313
  this.inputsService.validateFeatureInputData(find, data);
2314
- });
2315
- }
2314
+ });
2316
2315
  }
2317
2316
  validateAppEnvs(envs, version) {
2318
2317
  const { envs: appEnvs } = version;
@@ -2324,7 +2323,7 @@ class ProductsBuilderService {
2324
2323
  throw new Error(`app_slug ${env.app_env_slug} not found`);
2325
2324
  }
2326
2325
  // const updates = this.validateAppAuth(auth, version);
2327
- this.validateVariablesSchema(env.variables, version.variables);
2326
+ this.validateVariablesSchema(env.variables, version.variables, appEnv.base_url_variables);
2328
2327
  this.validateVariablesValues(env.variables, version.variables);
2329
2328
  /*if (updates && updates.data) {
2330
2329
  env.auth.data = updates.data;