@ductape/sdk 0.1.17 → 0.1.20

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 (52) hide show
  1. package/dist/api/services/appApi.service.d.ts +6 -0
  2. package/dist/api/services/appApi.service.js +25 -0
  3. package/dist/api/services/appApi.service.js.map +1 -1
  4. package/dist/api/services/cloudApi.service.js +8 -4
  5. package/dist/api/services/cloudApi.service.js.map +1 -1
  6. package/dist/api/services/productsApi.service.d.ts +2 -0
  7. package/dist/api/services/productsApi.service.js +14 -0
  8. package/dist/api/services/productsApi.service.js.map +1 -1
  9. package/dist/api/utils/cache.utils.d.ts +1 -0
  10. package/dist/api/utils/cache.utils.js +5 -1
  11. package/dist/api/utils/cache.utils.js.map +1 -1
  12. package/dist/apps/services/app.service.js +20 -6
  13. package/dist/apps/services/app.service.js.map +1 -1
  14. package/dist/cloud/cloud-broker-link.util.d.ts +2 -6
  15. package/dist/cloud/cloud-broker-link.util.js +21 -35
  16. package/dist/cloud/cloud-broker-link.util.js.map +1 -1
  17. package/dist/cloud/cloud-database-link.util.d.ts +2 -6
  18. package/dist/cloud/cloud-database-link.util.js +17 -12
  19. package/dist/cloud/cloud-database-link.util.js.map +1 -1
  20. package/dist/cloud/cloud-graph-link.util.d.ts +2 -6
  21. package/dist/cloud/cloud-graph-link.util.js +18 -21
  22. package/dist/cloud/cloud-graph-link.util.js.map +1 -1
  23. package/dist/cloud/cloud-materialize.util.d.ts +22 -0
  24. package/dist/cloud/cloud-materialize.util.js +82 -0
  25. package/dist/cloud/cloud-materialize.util.js.map +1 -0
  26. package/dist/cloud/cloud-resource-body.util.d.ts +6 -0
  27. package/dist/cloud/cloud-resource-body.util.js +58 -0
  28. package/dist/cloud/cloud-resource-body.util.js.map +1 -0
  29. package/dist/cloud/cloud-runtime.util.js +1 -1
  30. package/dist/cloud/cloud-runtime.util.js.map +1 -1
  31. package/dist/cloud/cloud-service-map.util.js +17 -1
  32. package/dist/cloud/cloud-service-map.util.js.map +1 -1
  33. package/dist/cloud/cloud-vector-link.util.d.ts +2 -6
  34. package/dist/cloud/cloud-vector-link.util.js +22 -20
  35. package/dist/cloud/cloud-vector-link.util.js.map +1 -1
  36. package/dist/cloud/cloud.service.js +4 -4
  37. package/dist/cloud/cloud.service.js.map +1 -1
  38. package/dist/cloud/types/cloud.types.d.ts +24 -17
  39. package/dist/cloud/types/cloud.types.js +1 -1
  40. package/dist/index.d.ts +18 -4
  41. package/dist/index.js +62 -9
  42. package/dist/index.js.map +1 -1
  43. package/dist/products/services/products.service.d.ts +2 -2
  44. package/dist/products/services/products.service.js +10 -46
  45. package/dist/products/services/products.service.js.map +1 -1
  46. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +1 -1
  47. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
  48. package/dist/storage/storage-cloud-link.util.d.ts +2 -6
  49. package/dist/storage/storage-cloud-link.util.js +23 -21
  50. package/dist/storage/storage-cloud-link.util.js.map +1 -1
  51. package/dist/types/appBuilder.types.d.ts +2 -0
  52. package/package.json +1 -1
@@ -27,6 +27,7 @@ const cloud_broker_link_util_1 = require("../../cloud/cloud-broker-link.util");
27
27
  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
+ const cloud_materialize_util_1 = require("../../cloud/cloud-materialize.util");
30
31
  const productsBuilder_types_1 = require("../../types/productsBuilder.types");
31
32
  const validators_1 = require("../validators");
32
33
  const objects_utils_1 = require("../utils/objects.utils");
@@ -352,12 +353,9 @@ class ProductsBuilderService {
352
353
  await validators_1.CreateProductBuilderSchema.validateAsync(data);
353
354
  const exists = await this.checkIfProductExists(data.name);
354
355
  if (exists && (exists === null || exists === void 0 ? void 0 : exists._id)) {
355
- // await this.initializeProduct(exists?._id);
356
- }
357
- else {
358
- const product = await this.createNewProduct(data);
359
- // await this.initializeProduct(product._id);
356
+ return exists;
360
357
  }
358
+ return await this.createNewProduct(data);
361
359
  }
362
360
  catch (e) {
363
361
  throw e;
@@ -519,7 +517,7 @@ class ProductsBuilderService {
519
517
  }
520
518
  async updateProduct(data) {
521
519
  try {
522
- if (!this.app_id)
520
+ if (!this.product_id)
523
521
  throw new Error('Product not initialized');
524
522
  await validators_1.CreateProductBuilderSchema.validateAsync(data);
525
523
  await this.productApi.updateProduct(this.product_id, Object.assign({}, data), this.getUserAccess());
@@ -1353,12 +1351,7 @@ class ProductsBuilderService {
1353
1351
  const auth = this.getUserAccess();
1354
1352
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
1355
1353
  const productTag = this.product.tag;
1356
- const materializedEnvs = await Promise.all((data.envs || []).map((env) => (0, cloud_broker_link_util_1.materializeCloudLinkedBrokerEnv)(env, {
1357
- cloudApi,
1358
- auth,
1359
- productTag,
1360
- brokerTag: data.tag,
1361
- })));
1354
+ const materializedEnvs = await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs || [], { cloudApi, auth, productTag }, (env, batchCtx) => (0, cloud_broker_link_util_1.materializeCloudLinkedBrokerEnv)(env, Object.assign(Object.assign({}, batchCtx), { brokerTag: data.tag })));
1362
1355
  data.envs = materializedEnvs;
1363
1356
  console.log(`${logPrefix} Validating schema...`);
1364
1357
  await validators_1.CreateMessageBrokerSchema.validateAsync(data);
@@ -1603,16 +1596,7 @@ class ProductsBuilderService {
1603
1596
  const auth = this.getUserAccess();
1604
1597
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
1605
1598
  const productTag = this.product.tag;
1606
- const materializedEnvs = [];
1607
- for (const env of data.envs || []) {
1608
- materializedEnvs.push(await (0, storage_cloud_link_util_1.materializeCloudLinkedStorageEnv)(env, {
1609
- cloudApi,
1610
- auth,
1611
- productTag,
1612
- storageTag: data.tag,
1613
- }));
1614
- }
1615
- data.envs = materializedEnvs;
1599
+ data.envs = await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs || [], { cloudApi, auth, productTag }, (env, batchCtx) => (0, storage_cloud_link_util_1.materializeCloudLinkedStorageEnv)(env, Object.assign(Object.assign({}, batchCtx), { storageTag: data.tag })));
1616
1600
  await create_productStorage_validator_1.CreateProductStorageSchema.validateAsync(data);
1617
1601
  const processedEnvs = [];
1618
1602
  for (const env of data.envs) {
@@ -1782,12 +1766,7 @@ class ProductsBuilderService {
1782
1766
  const auth = this.getUserAccess();
1783
1767
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
1784
1768
  const productTag = this.product.tag;
1785
- const materializedEnvs = await Promise.all((data.envs || []).map((env) => (0, cloud_vector_link_util_1.materializeCloudLinkedVectorEnv)(env, {
1786
- cloudApi,
1787
- auth,
1788
- productTag,
1789
- vectorTag: data.tag,
1790
- })));
1769
+ const materializedEnvs = await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs || [], { cloudApi, auth, productTag }, (env, batchCtx) => (0, cloud_vector_link_util_1.materializeCloudLinkedVectorEnv)(env, Object.assign(Object.assign({}, batchCtx), { vectorTag: data.tag })));
1791
1770
  data.envs = materializedEnvs;
1792
1771
  await validators_1.CreateProductVectorSchema.validateAsync(data);
1793
1772
  const processedEnvs = [];
@@ -4243,12 +4222,7 @@ class ProductsBuilderService {
4243
4222
  const auth = this.getUserAccess();
4244
4223
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
4245
4224
  const productTag = this.product.tag;
4246
- data.envs = (await Promise.all((data.envs || []).map(async (env) => (0, cloud_database_link_util_1.materializeCloudLinkedDatabaseEnv)(env, {
4247
- cloudApi,
4248
- auth,
4249
- productTag,
4250
- databaseTag: data.tag,
4251
- })))).map((env) => {
4225
+ data.envs = (await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs || [], { cloudApi, auth, productTag }, (env, batchCtx) => (0, cloud_database_link_util_1.materializeCloudLinkedDatabaseEnv)(env, Object.assign(Object.assign({}, batchCtx), { databaseTag: data.tag })))).map((env) => {
4252
4226
  const _a = env, { masterPassword: _mp, importExisting: _ie } = _a, rest = __rest(_a, ["masterPassword", "importExisting"]);
4253
4227
  return rest;
4254
4228
  });
@@ -4301,12 +4275,7 @@ class ProductsBuilderService {
4301
4275
  const auth = this.getUserAccess();
4302
4276
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
4303
4277
  const productTag = this.product.tag;
4304
- data.envs = await Promise.all(data.envs.map(async (env) => (0, cloud_database_link_util_1.materializeCloudLinkedDatabaseEnv)(env, {
4305
- cloudApi,
4306
- auth,
4307
- productTag,
4308
- databaseTag: data.tag || tag,
4309
- })));
4278
+ data.envs = await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs, { cloudApi, auth, productTag }, (env, batchCtx) => (0, cloud_database_link_util_1.materializeCloudLinkedDatabaseEnv)(env, Object.assign(Object.assign({}, batchCtx), { databaseTag: data.tag || tag })));
4310
4279
  }
4311
4280
  await validators_1.UpdateProductDatabaseSchema.validateAsync(data);
4312
4281
  if (data.envs && data.envs.length > 0) {
@@ -4409,12 +4378,7 @@ class ProductsBuilderService {
4409
4378
  const auth = this.getUserAccess();
4410
4379
  const cloudApi = new cloudApi_service_1.CloudApiService(this.env_type);
4411
4380
  const productTag = this.product.tag;
4412
- const materializedEnvs = await Promise.all((data.envs || []).map((env) => (0, cloud_graph_link_util_1.materializeCloudLinkedGraphEnv)(env, {
4413
- cloudApi,
4414
- auth,
4415
- productTag,
4416
- graphTag: data.tag,
4417
- })));
4381
+ const materializedEnvs = await (0, cloud_materialize_util_1.materializeCloudEnvsSequential)(data.envs || [], { cloudApi, auth, productTag }, (env, batchCtx) => (0, cloud_graph_link_util_1.materializeCloudLinkedGraphEnv)(env, Object.assign(Object.assign({}, batchCtx), { graphTag: data.tag })));
4418
4382
  data.envs = materializedEnvs;
4419
4383
  await validators_1.CreateProductGraphSchema.validateAsync(data);
4420
4384
  const processedEnvs = [];