@ductape/sdk 0.0.3-beta9 → 0.0.4-v11

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 (129) hide show
  1. package/dist/api/services/appApi.service.d.ts +3 -1
  2. package/dist/api/services/appApi.service.js +41 -2
  3. package/dist/api/services/appApi.service.js.map +1 -1
  4. package/dist/api/services/processorApi.service.d.ts +15 -1
  5. package/dist/api/services/processorApi.service.js +28 -0
  6. package/dist/api/services/processorApi.service.js.map +1 -1
  7. package/dist/api/services/productsApi.service.d.ts +7 -2
  8. package/dist/api/services/productsApi.service.js +23 -1
  9. package/dist/api/services/productsApi.service.js.map +1 -1
  10. package/dist/api/services/userApi.service.d.ts +2 -1
  11. package/dist/api/services/userApi.service.js +1 -1
  12. package/dist/api/services/userApi.service.js.map +1 -1
  13. package/dist/api/services/webhooksApi.service.d.ts +4 -1
  14. package/dist/api/services/webhooksApi.service.js +6 -3
  15. package/dist/api/services/webhooksApi.service.js.map +1 -1
  16. package/dist/api/services/workspaceApi.service.d.ts +2 -1
  17. package/dist/api/services/workspaceApi.service.js +1 -1
  18. package/dist/api/services/workspaceApi.service.js.map +1 -1
  19. package/dist/api/urls.d.ts +5 -0
  20. package/dist/api/urls.js +6 -1
  21. package/dist/api/urls.js.map +1 -1
  22. package/dist/api/utils/cache.utils.d.ts +3 -0
  23. package/dist/api/utils/cache.utils.js +18 -0
  24. package/dist/api/utils/cache.utils.js.map +1 -0
  25. package/dist/apps/services/app.service.d.ts +3 -3
  26. package/dist/apps/services/app.service.js +153 -75
  27. package/dist/apps/services/app.service.js.map +1 -1
  28. package/dist/apps/utils/objects.utils.d.ts +1 -1
  29. package/dist/apps/utils/objects.utils.js +5 -3
  30. package/dist/apps/utils/objects.utils.js.map +1 -1
  31. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +1 -1
  32. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +1 -1
  33. package/dist/apps/validators/joi-validators/create.appWebhookEvent.validator.js +1 -0
  34. package/dist/apps/validators/joi-validators/create.appWebhookEvent.validator.js.map +1 -1
  35. package/dist/apps/validators/joi-validators/update.appAction.validator.d.ts +2 -2
  36. package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -11
  37. package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
  38. package/dist/apps/validators/joi-validators/update.appWebhookEvent.validator.js +2 -0
  39. package/dist/apps/validators/joi-validators/update.appWebhookEvent.validator.js.map +1 -1
  40. package/dist/clients/apps.client.js +1 -1
  41. package/dist/clients/apps.client.js.map +1 -1
  42. package/dist/clients/webhooks.client.d.ts +2 -1
  43. package/dist/clients/webhooks.client.js +2 -2
  44. package/dist/clients/webhooks.client.js.map +1 -1
  45. package/dist/imports/imports.service.d.ts +2 -3
  46. package/dist/imports/imports.service.js +4 -45
  47. package/dist/imports/imports.service.js.map +1 -1
  48. package/dist/imports/imports.types.d.ts +238 -0
  49. package/dist/imports/repos/openApi.repo.d.ts +4 -11
  50. package/dist/imports/repos/openApi.repo.js +50 -28
  51. package/dist/imports/repos/openApi.repo.js.map +1 -1
  52. package/dist/imports/repos/postmanV21.repo.js +1 -1
  53. package/dist/imports/repos/postmanV21.repo.js.map +1 -1
  54. package/dist/index.d.ts +33 -6
  55. package/dist/index.js +121 -11
  56. package/dist/index.js.map +1 -1
  57. package/dist/inputs/inputs.service.js +2 -2
  58. package/dist/inputs/inputs.service.js.map +1 -1
  59. package/dist/inputs/validators/inputs.validator.parse.js +1 -0
  60. package/dist/inputs/validators/inputs.validator.parse.js.map +1 -1
  61. package/dist/logs/logs.service.d.ts +1 -1
  62. package/dist/logs/logs.service.js +1 -0
  63. package/dist/logs/logs.service.js.map +1 -1
  64. package/dist/logs/logs.types.d.ts +4 -0
  65. package/dist/logs/logs.types.js.map +1 -1
  66. package/dist/processor/repos/sms.repo.d.ts +4 -4
  67. package/dist/processor/repos/sms.repo.js +23 -10
  68. package/dist/processor/repos/sms.repo.js.map +1 -1
  69. package/dist/processor/services/fallback.service.d.ts +0 -1
  70. package/dist/processor/services/fallback.service.js +0 -16
  71. package/dist/processor/services/fallback.service.js.map +1 -1
  72. package/dist/processor/services/processor.service.d.ts +61 -18
  73. package/dist/processor/services/processor.service.js +714 -316
  74. package/dist/processor/services/processor.service.js.map +1 -1
  75. package/dist/processor/services/quota.service.d.ts +6 -13
  76. package/dist/processor/services/quota.service.js +12 -3
  77. package/dist/processor/services/quota.service.js.map +1 -1
  78. package/dist/processor/utils/processor.utils.d.ts +6 -230
  79. package/dist/processor/utils/processor.utils.js +212 -122
  80. package/dist/processor/utils/processor.utils.js.map +1 -1
  81. package/dist/processor/utils/storage.util.js +54 -40
  82. package/dist/processor/utils/storage.util.js.map +1 -1
  83. package/dist/products/services/products.service.d.ts +26 -7
  84. package/dist/products/services/products.service.js +427 -147
  85. package/dist/products/services/products.service.js.map +1 -1
  86. package/dist/products/utils/functions.utils.d.ts +1 -0
  87. package/dist/products/utils/functions.utils.js +11 -0
  88. package/dist/products/utils/functions.utils.js.map +1 -1
  89. package/dist/products/validators/index.d.ts +3 -1
  90. package/dist/products/validators/index.js +5 -1
  91. package/dist/products/validators/index.js.map +1 -1
  92. package/dist/products/validators/joi-validators/create.productFallback.validator.js +7 -1
  93. package/dist/products/validators/joi-validators/create.productFallback.validator.js.map +1 -1
  94. package/dist/products/validators/joi-validators/create.productFeature.validator.js +2 -0
  95. package/dist/products/validators/joi-validators/create.productFeature.validator.js.map +1 -1
  96. package/dist/products/validators/joi-validators/create.productQuota.validator.js +10 -2
  97. package/dist/products/validators/joi-validators/create.productQuota.validator.js.map +1 -1
  98. package/dist/products/validators/joi-validators/create.userAuth.validator.d.ts +3 -0
  99. package/dist/products/validators/joi-validators/create.userAuth.validator.js +48 -0
  100. package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -0
  101. package/dist/products/validators/joi-validators/update.dataValue.validator.d.ts +1 -1
  102. package/dist/products/validators/joi-validators/update.dataValue.validator.js +3 -2
  103. package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
  104. package/dist/products/validators/joi-validators/update.productFallback.validator.js +7 -2
  105. package/dist/products/validators/joi-validators/update.productFallback.validator.js.map +1 -1
  106. package/dist/products/validators/joi-validators/update.productFeature.validator.js +2 -0
  107. package/dist/products/validators/joi-validators/update.productFeature.validator.js.map +1 -1
  108. package/dist/products/validators/joi-validators/update.productQuota.validator.js +12 -7
  109. package/dist/products/validators/joi-validators/update.productQuota.validator.js.map +1 -1
  110. package/dist/products/validators/joi-validators/update.userAuth.validator.d.ts +3 -0
  111. package/dist/products/validators/joi-validators/update.userAuth.validator.js +48 -0
  112. package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -0
  113. package/dist/test/test.import.openapi.d.ts +1 -0
  114. package/dist/test/test.import.openapi.js +76 -0
  115. package/dist/test/test.import.openapi.js.map +1 -0
  116. package/dist/test/test.logs.js +1 -2
  117. package/dist/test/test.logs.js.map +1 -1
  118. package/dist/types/appBuilder.types.d.ts +20 -12
  119. package/dist/types/enums.d.ts +6 -0
  120. package/dist/types/enums.js +8 -1
  121. package/dist/types/enums.js.map +1 -1
  122. package/dist/types/index.types.d.ts +5 -0
  123. package/dist/types/index.types.js.map +1 -1
  124. package/dist/types/processor.types.d.ts +89 -4
  125. package/dist/types/processor.types.js.map +1 -1
  126. package/dist/types/productsBuilder.types.d.ts +51 -8
  127. package/dist/types/productsBuilder.types.js +3 -0
  128. package/dist/types/productsBuilder.types.js.map +1 -1
  129. package/package.json +11 -2
@@ -36,48 +36,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.uploadBlobToCloud = uploadBlobToCloud;
37
37
  const types_1 = require("../../types");
38
38
  async function uploadBlobToCloud({ data, destinationPath, config, }) {
39
- if (typeof window !== 'undefined') {
40
- return null; // We're in a browser, don't load the PostgreSQL handler
41
- }
42
- const bufferData = Buffer.from(data, "base64");
43
- switch (config.provider) {
44
- case types_1.StorageProviders.AWS: {
45
- const AWS = await Promise.resolve().then(() => __importStar(require('aws-sdk')));
46
- const { bucketName, accessKeyId, secretAccessKey, region } = config.awsConfig;
47
- const s3 = new AWS.S3({
48
- accessKeyId,
49
- secretAccessKey,
50
- region,
51
- });
52
- const params = {
53
- Bucket: bucketName,
54
- Key: destinationPath,
55
- Body: bufferData,
56
- };
57
- const result = await s3.upload(params).promise();
58
- return result.Location;
59
- }
60
- case types_1.StorageProviders.GCP: {
61
- const { Storage } = await Promise.resolve().then(() => __importStar(require('@google-cloud/storage')));
62
- const { bucketName, config: credentials } = config.gcpConfig;
63
- const storage = new Storage({ credentials });
64
- const bucket = storage.bucket(bucketName);
65
- const file = bucket.file(destinationPath);
66
- await file.save(bufferData instanceof Buffer ? data : Buffer.from(await bufferData.arrayBuffer()));
67
- return `gs://${bucketName}/${destinationPath}`;
39
+ try {
40
+ if (typeof window !== 'undefined') {
41
+ return null; // We're in a browser, don't load the PostgreSQL handler
68
42
  }
69
- case types_1.StorageProviders.AZURE: {
70
- const { BlobServiceClient } = await Promise.resolve().then(() => __importStar(require('@azure/storage-blob')));
71
- const { containerName, connectionString } = config.azureConfig;
72
- const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
73
- const containerClient = blobServiceClient.getContainerClient(containerName);
74
- const blockBlobClient = containerClient.getBlockBlobClient(destinationPath);
75
- // const bufferData = data instanceof Buffer ? data : Buffer.from(await (bufferData as Blob).arrayBuffer());
76
- await blockBlobClient.upload(bufferData, bufferData.length);
77
- return blockBlobClient.url;
43
+ const bufferData = Buffer.from(data, "base64");
44
+ switch (config.provider) {
45
+ case types_1.StorageProviders.AWS: {
46
+ const AWS = await Promise.resolve().then(() => __importStar(require('aws-sdk')));
47
+ const { bucketName, accessKeyId, secretAccessKey, region } = config.awsConfig;
48
+ const s3 = new AWS.S3({
49
+ accessKeyId,
50
+ secretAccessKey,
51
+ region,
52
+ });
53
+ const params = {
54
+ Bucket: bucketName,
55
+ Key: destinationPath,
56
+ Body: bufferData,
57
+ };
58
+ const result = await s3.upload(params).promise();
59
+ return result.Location;
60
+ }
61
+ case types_1.StorageProviders.GCP: {
62
+ const { Storage } = await Promise.resolve().then(() => __importStar(require('@google-cloud/storage')));
63
+ const { bucketName, config: credentials } = config.gcpConfig;
64
+ const normalizedCredentials = Object.assign(Object.assign({}, credentials), { private_key: credentials.private_key.replace(/\\n/g, '\n') });
65
+ const storage = new Storage({ credentials: normalizedCredentials });
66
+ const bucket = storage.bucket(bucketName);
67
+ const file = bucket.file(destinationPath);
68
+ await file.save(bufferData instanceof Buffer ? data : Buffer.from(await bufferData.arrayBuffer()));
69
+ // Option 1: Return public URL (if bucket or file is public)
70
+ return `https://storage.googleapis.com/${bucketName}/${destinationPath}`;
71
+ // Option 2: Return signed URL for private files
72
+ /*const [url] = await file.getSignedUrl({
73
+ action: 'read',
74
+ expires: Date.now() + 1000 * 60 * 60, // 1 hour
75
+ });*/
76
+ //return url;
77
+ }
78
+ case types_1.StorageProviders.AZURE: {
79
+ const { BlobServiceClient } = await Promise.resolve().then(() => __importStar(require('@azure/storage-blob')));
80
+ const { containerName, connectionString } = config.azureConfig;
81
+ const blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
82
+ const containerClient = blobServiceClient.getContainerClient(containerName);
83
+ const blockBlobClient = containerClient.getBlockBlobClient(destinationPath);
84
+ // const bufferData = data instanceof Buffer ? data : Buffer.from(await (bufferData as Blob).arrayBuffer());
85
+ await blockBlobClient.upload(bufferData, bufferData.length);
86
+ return blockBlobClient.url;
87
+ }
88
+ default:
89
+ throw new Error('Unsupported cloud provider.');
78
90
  }
79
- default:
80
- throw new Error('Unsupported cloud provider.');
91
+ }
92
+ catch (e) {
93
+ console.log(e);
94
+ throw (e);
81
95
  }
82
96
  }
83
97
  //# sourceMappingURL=storage.util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.util.js","sourceRoot":"","sources":["../../../src/processor/utils/storage.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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ook, ISample, IVersion } from '../../types/appBuilder.types';
2
2
  import { IBuilderInit } from '../../types/index.types';
3
- import { IActionDataParserInput, IActionRequest, ICreateProductsBuilder, IFeatureEvent, IFeatureInput, IFeatureSequence, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductFunction, IProductJobs, IParseActionEventInput, IParseInputStringInput, IParseInputStringMetaData, IProductStorage, IDbActionRequest, INotificationRequest, IProductQuota, IProductFallback, IProductDatabaseMigration, IQuotaOptions, IFallbackOptions } from '../../types/productsBuilder.types';
4
- import { IProductNotification, INotificationEnv, IProductNotificationTemplate, IProductMessageBroker, IProductMessageBrokerTopic } from '../../types/processor.types';
3
+ import { IActionDataParserInput, IActionRequest, ICreateProductsBuilder, IFeatureEvent, IFeatureInput, IFeatureSequence, IProduct, IProductApp, IProductCache, IProductDatabase, IProductDatabaseAction, IProductEnv, IProductFeature, IProductFunction, IProductJobs, IParseActionEventInput, IParseInputStringInput, IParseInputStringMetaData, IProductStorage, IDbActionRequest, INotificationRequest, IProductQuota, IProductFallback, IProductDatabaseMigration, IQuotaOptions, IFallbackOptions, IProductSession, IFetchFilesPayload, IFetchUsersPayload } from '../../types/productsBuilder.types';
4
+ import { KeyValuePair } from '../../imports/imports.types';
5
+ import { IProductNotification, INotificationEnv, IProductNotificationTemplate, IProductMessageBroker, IProductMessageBrokerTopic, IFileURLPayload } from '../../types/processor.types';
5
6
  import { IParsedSample } from '../../types/inputs.types';
6
7
  export interface IProductsBuilderService {
7
8
  fetchThirdPartyAppByAccessTag(access_tag: string): Promise<(IApp & IVersion) | null>;
@@ -14,6 +15,10 @@ export interface IProductsBuilderService {
14
15
  updateEnv(slug: string, data: Partial<IProductEnv>): Promise<void>;
15
16
  fetchEnv(slug: string): IProductEnv | null;
16
17
  fetchEnvs(): Array<IProductEnv>;
18
+ createSession(data: IProductSession): Promise<void>;
19
+ updateSession(tag: string, data: Partial<IProductSession>): Promise<void>;
20
+ fetchSession(tag: string): IProductSession | null;
21
+ fetchSessions(): Array<IProductSession>;
17
22
  createFunction(data: Partial<IProductFunction>): Promise<void>;
18
23
  updateFunction(tag: string, data: Partial<IProductFunction>): Promise<void>;
19
24
  fetchFunction(tag: string): IProductFunction | null;
@@ -77,6 +82,7 @@ export interface IProductsBuilderService {
77
82
  createAppAccessTag(app_tag: string): Promise<IAppAccess>;
78
83
  extractStages(input: string): Array<string>;
79
84
  updateDataValidation(tag: string, update: Partial<IParsedSample>): Promise<boolean>;
85
+ fetchStorageFiles(filter: IFetchFilesPayload): Promise<Array<IFileURLPayload>>;
80
86
  }
81
87
  export default class ProductsBuilderService implements IProductsBuilderService {
82
88
  private user_id;
@@ -91,12 +97,13 @@ export default class ProductsBuilderService implements IProductsBuilderService {
91
97
  private product;
92
98
  private userApi;
93
99
  private appApi;
100
+ private webhooksApi;
94
101
  private productApi;
95
102
  private workspaceApi;
96
103
  private inputsService;
97
104
  private thirdPartyApps;
98
105
  private isQuotaFallbackInput;
99
- constructor({ workspace_id, public_key, user_id, token, env_type }: IBuilderInit);
106
+ constructor({ workspace_id, public_key, user_id, token, env_type, redis_client }: IBuilderInit);
100
107
  updateDataValidation(selector: string, update: Partial<IParsedSample>): Promise<boolean>;
101
108
  createProduct(data: ICreateProductsBuilder): Promise<void>;
102
109
  initializeWorkspace(subCheck?: boolean): Promise<void>;
@@ -106,13 +113,23 @@ export default class ProductsBuilderService implements IProductsBuilderService {
106
113
  private createNewProduct;
107
114
  checkIfProductExists(name: string): Promise<false | IProduct>;
108
115
  fetchProduct(): IProduct;
116
+ createSession(data: Partial<IProductSession>, throwErrorIfExists?: boolean): Promise<void>;
117
+ updateSession(tag: string, data: Partial<IProductSession>): Promise<void>;
118
+ fetchSession(tag: string): IProductSession | null;
119
+ fetchSessions(): Array<IProductSession>;
109
120
  createMessageBrokerTopic(data: Partial<IProductMessageBrokerTopic>, throwErrorIfExists?: boolean): Promise<void>;
110
121
  updateMessageBrokerTopic(data: Partial<IProductMessageBrokerTopic>): Promise<void>;
111
122
  fetchMessageBrokerTopic(tag: string, throwErrorIfExists?: boolean): IProductMessageBrokerTopic | null;
112
123
  fetchMessageBrokerTopics(messageBrokerTag: string): Array<IProductMessageBrokerTopic>;
113
- validateQuotaFallbackInputAndOutput(data: Partial<IProductQuota> | Partial<IProductFallback>): Promise<void>;
114
- validateQuotaFallbackInput(option: IQuotaOptions | IFallbackOptions, input: Record<string, IFeatureInput>): Promise<void>;
115
- validateQuotaFallbackOutput(option: IQuotaOptions | IFallbackOptions, pastResponse: Record<string, unknown> | null, input: Record<string, IFeatureInput>): Promise<void>;
124
+ validateQuotaFallbackInputAndOutput(data: Partial<IProductQuota> | Partial<IProductFallback>, type: string): Promise<void>;
125
+ validateQuotaFallbackInput(option: IQuotaOptions | IFallbackOptions, input: Record<string, IFeatureInput>, type: string): Promise<void>;
126
+ checkKeyValuesInput(keyValues: Array<KeyValuePair>, input: Record<string, IFeatureInput>, type: string): void;
127
+ checkActionQuotaFallbackInput(sample: ISample, obj: any, featureInput: Record<string, IFeatureInput>, type: string): void;
128
+ checkFuncArgsForInputs(value: string, input: Record<string, IFeatureInput>, type: string): void;
129
+ checkInput(value: string, input: Record<string, IFeatureInput>, type: string): void;
130
+ validateQuotaFallbackOutput(option: IQuotaOptions | IFallbackOptions, pastResponse: Record<string, unknown> | null, input: Record<string, IFeatureInput>, type: string): Promise<void>;
131
+ checkFuncArgsForResponse(value: string, output: Record<string, unknown>, input: Record<string, IFeatureInput>, type: string): void;
132
+ checkResponse(value: string, output: Record<string, unknown>, input: Record<string, IFeatureInput>, type: string): void;
116
133
  createQuota(data: Partial<IProductQuota>): Promise<void>;
117
134
  updateQuota(tag: string, data: Partial<IProductQuota>): Promise<void>;
118
135
  fetchQuota(tag: string): IProductQuota | null;
@@ -129,6 +146,8 @@ export default class ProductsBuilderService implements IProductsBuilderService {
129
146
  updateMessageBroker(tag: string, data: Partial<IProductMessageBroker>): Promise<void>;
130
147
  fetchMessageBroker(tag: string, throwErrorIfExists?: boolean): IProductMessageBroker | null;
131
148
  fetchMessageBrokers(): Array<IProductMessageBroker>;
149
+ fetchStorageFiles(filter: IFetchFilesPayload): Promise<Array<IFileURLPayload>>;
150
+ fetchSessionUsers(filter: IFetchUsersPayload): Promise<Array<IFileURLPayload>>;
132
151
  createStorage(data: Partial<IProductStorage>, throwErrorIfExists?: boolean): Promise<void>;
133
152
  updateStorage(tag: string, data: Partial<IProductStorage>): Promise<void>;
134
153
  fetchStorage(tag: string, throwErrorIfExists?: boolean): IProductStorage | null;