@ductape/sdk 0.0.4-v20 → 0.0.4-v22
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/workspaceApi.service.js +1 -0
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/apps/services/app.service.js +6 -4
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/processor/services/processor.service.js +31 -15
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/products/services/products.service.d.ts +2 -2
- package/dist/products/services/products.service.js +31 -16
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/utils/string.utils.d.ts +1 -1
- package/dist/products/utils/string.utils.js +14 -2
- package/dist/products/utils/string.utils.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
- package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +1 -1
- package/package.json +4 -1
|
@@ -84,7 +84,7 @@ export interface IProductsBuilderService {
|
|
|
84
84
|
fetchHealthcheck(access_tag: string, tag: string): IProductAppHealth | null;
|
|
85
85
|
fetchHealthchecks(access_tag: string): Array<IProductAppHealth>;
|
|
86
86
|
createAppAccessTag(app_tag: string): Promise<IAppAccess>;
|
|
87
|
-
extractStages(input: string): Array<string>;
|
|
87
|
+
extractStages(input: string): Array<string | number>;
|
|
88
88
|
updateDataValidation(tag: string, update: Partial<IParsedSample>): Promise<boolean>;
|
|
89
89
|
fetchStorageFiles(filter: IFetchFilesPayload): Promise<Array<IFileURLPayload>>;
|
|
90
90
|
fetchSessionUser(ductape_user_id: string): Promise<any>;
|
|
@@ -224,7 +224,7 @@ export default class ProductsBuilderService implements IProductsBuilderService {
|
|
|
224
224
|
parseActionEventInput(data: IParseActionEventInput): Promise<void>;
|
|
225
225
|
parseInputString(payload: IParseInputStringInput, meta: IParseInputStringMetaData): Promise<void>;
|
|
226
226
|
compareInputWithExpectedInput(datapoint: IParsedSample, found_input: IParsedSample, value: string): void;
|
|
227
|
-
extractStages(input: string): Array<string>;
|
|
227
|
+
extractStages(input: string): Array<string | number>;
|
|
228
228
|
fetchSequenceEvent(sequence: IFeatureSequence, event: string): IFeatureEvent | null;
|
|
229
229
|
fetchPriorSequence(meta: IParseInputStringMetaData, stage: string): IFeatureSequence;
|
|
230
230
|
validateActionKeyPlacement(data: IParseActionEventInput): IParsedSample;
|
|
@@ -199,8 +199,8 @@ class ProductsBuilderService {
|
|
|
199
199
|
if (stages.length < 3) {
|
|
200
200
|
throw new Error(`Invalid selector ${selector}`);
|
|
201
201
|
}
|
|
202
|
-
const tag = stages[0];
|
|
203
|
-
const type = stages[1];
|
|
202
|
+
const tag = String(stages[0]);
|
|
203
|
+
const type = String(stages[1]);
|
|
204
204
|
let size = 2;
|
|
205
205
|
let data;
|
|
206
206
|
switch (type) {
|
|
@@ -212,13 +212,14 @@ class ProductsBuilderService {
|
|
|
212
212
|
break;
|
|
213
213
|
case productsBuilder_types_1.FeatureEventTypes.NOTIFICATION:
|
|
214
214
|
size = 3;
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
const stage3Str = String(stages[3]);
|
|
216
|
+
if (!stages[3] || (stage3Str !== 'push' && stage3Str !== 'callback' && stage3Str !== 'email')) {
|
|
217
|
+
throw new Error(`Invalid value ${stage3Str} in ${selector}, expected to be "push", "callback" or "email" in notification`);
|
|
217
218
|
}
|
|
218
219
|
const notification = this.fetchNotificationMessage(tag);
|
|
219
220
|
if (!notification)
|
|
220
221
|
throw new Error(`Notification ${tag} not found`);
|
|
221
|
-
if (
|
|
222
|
+
if (stage3Str === 'push') {
|
|
222
223
|
data = notification.push_notification_data;
|
|
223
224
|
}
|
|
224
225
|
if (stages[3] === 'callback') {
|
|
@@ -288,7 +289,9 @@ class ProductsBuilderService {
|
|
|
288
289
|
async initializeProductByTag(tag) {
|
|
289
290
|
try {
|
|
290
291
|
this.product = await this.productApi.fetchProductByTag(tag, this.getUserAccess());
|
|
291
|
-
|
|
292
|
+
if (!this.product) {
|
|
293
|
+
throw new Error(`Product with tag "${tag}" not found or failed to fetch`);
|
|
294
|
+
}
|
|
292
295
|
this.product_id = this.product._id;
|
|
293
296
|
}
|
|
294
297
|
catch (e) {
|
|
@@ -2360,7 +2363,9 @@ class ProductsBuilderService {
|
|
|
2360
2363
|
let current_input = input;
|
|
2361
2364
|
for (let i = 0; i < stages.length; i++) {
|
|
2362
2365
|
let stage = stages[i];
|
|
2363
|
-
|
|
2366
|
+
// Convert to string for .match() call
|
|
2367
|
+
const stageStr = String(stage);
|
|
2368
|
+
const matches = stageStr.match(/^\[(\d+)\]$/);
|
|
2364
2369
|
if (matches && matches.length === 2) {
|
|
2365
2370
|
const number = parseInt(matches[1], 10);
|
|
2366
2371
|
if (!isNaN(number)) {
|
|
@@ -2423,7 +2428,9 @@ class ProductsBuilderService {
|
|
|
2423
2428
|
throw new Error(`Auth ${stages[0]} does not exist on env ${env.product_env_slug} on app ${access_tag}`);
|
|
2424
2429
|
}
|
|
2425
2430
|
const decrypted = JSON.parse((0, processor_utils_1.decrypt)(env.auth.values, this.fetchProduct().private_key));
|
|
2426
|
-
|
|
2431
|
+
// Convert stages to string[] for findFaultyKeys
|
|
2432
|
+
const stringStages = stages.slice(1).map(stage => String(stage));
|
|
2433
|
+
const check = (0, objects_utils_1.findFaultyKeys)(stringStages, decrypted);
|
|
2427
2434
|
if (check.faultyKeys) {
|
|
2428
2435
|
throw new Error(`Auth Key(s) ${check.faultyKeys.join(', ')} is/are invalid, they do not exist in authorization for ${env.product_env_slug} on app ${access_tag}`);
|
|
2429
2436
|
}
|
|
@@ -2439,7 +2446,9 @@ class ProductsBuilderService {
|
|
|
2439
2446
|
let i = 1;
|
|
2440
2447
|
while (i < stages.length) {
|
|
2441
2448
|
let stage = stages[i];
|
|
2442
|
-
|
|
2449
|
+
// Convert to string for .match() call
|
|
2450
|
+
const stageStr = String(stage);
|
|
2451
|
+
const matches = stageStr.match(/^\[(\d+)\]$/);
|
|
2443
2452
|
if (matches && matches.length === 2) {
|
|
2444
2453
|
const number = parseInt(matches[1], 10);
|
|
2445
2454
|
if (!isNaN(number)) {
|
|
@@ -2513,11 +2522,15 @@ class ProductsBuilderService {
|
|
|
2513
2522
|
// let current_data;
|
|
2514
2523
|
if (i === 0) {
|
|
2515
2524
|
// find sequence by tag, see if it exists and its before current sequence
|
|
2516
|
-
|
|
2517
|
-
|
|
2525
|
+
// Convert stage to string for function calls
|
|
2526
|
+
const stageStr = String(stage);
|
|
2527
|
+
this.validateSequenceInputParents(stageStr, meta.sequence_index, meta.feature.sequence);
|
|
2528
|
+
sequence = this.fetchPriorSequence(meta, stageStr);
|
|
2518
2529
|
}
|
|
2519
2530
|
if (i === 1 && sequence) {
|
|
2520
|
-
|
|
2531
|
+
// Convert stage to string for function calls
|
|
2532
|
+
const stageStr = String(stage);
|
|
2533
|
+
event = this.fetchSequenceEvent(sequence, stageStr);
|
|
2521
2534
|
if (!event) {
|
|
2522
2535
|
throw new Error(`event ${stage} not found in sequence ${sequence.tag}`);
|
|
2523
2536
|
}
|
|
@@ -2546,7 +2559,9 @@ class ProductsBuilderService {
|
|
|
2546
2559
|
if (i > 1 && response) {
|
|
2547
2560
|
let parent_index = 0;
|
|
2548
2561
|
let increment = false;
|
|
2549
|
-
|
|
2562
|
+
// Convert to string for .match() call
|
|
2563
|
+
const stageStr = String(stage);
|
|
2564
|
+
const matches = stageStr.match(/^\[(\d+)\]$/);
|
|
2550
2565
|
if (matches && matches.length === 2) {
|
|
2551
2566
|
const number = parseInt(matches[1], 10);
|
|
2552
2567
|
if (!isNaN(number)) {
|
|
@@ -2604,7 +2619,7 @@ class ProductsBuilderService {
|
|
|
2604
2619
|
if (stages.length > 2) {
|
|
2605
2620
|
throw new Error(`sequence ${sequence.tag} event ${sequence.events[meta.event_index].event} ${meta.type}, has invalid varibale definition ${value}, only two keys is required`);
|
|
2606
2621
|
}
|
|
2607
|
-
const app = this.fetchApp(stages[0]);
|
|
2622
|
+
const app = this.fetchApp(String(stages[0]));
|
|
2608
2623
|
if (!app) {
|
|
2609
2624
|
throw new Error(`App ${stages[0]} not found in sequence ${sequence.tag} event ${sequence.events[meta.event_index].event} ${meta.type}, has invalid varibale definition ${value}. `);
|
|
2610
2625
|
}
|
|
@@ -2621,8 +2636,8 @@ class ProductsBuilderService {
|
|
|
2621
2636
|
if (stages.length !== 2) {
|
|
2622
2637
|
throw new Error(`When using constants you need to specify the constant in the format $Constant{app_tag}{key} instead of ${value}`);
|
|
2623
2638
|
}
|
|
2624
|
-
const app_tag = stages[0];
|
|
2625
|
-
const key = stages[1];
|
|
2639
|
+
const app_tag = String(stages[0]);
|
|
2640
|
+
const key = String(stages[1]);
|
|
2626
2641
|
const _c = await this.fetchThirdPartyAppByAccessTag(app_tag), { version } = _c, app = __rest(_c, ["version"]);
|
|
2627
2642
|
if (!app) {
|
|
2628
2643
|
throw new Error(`App ${app_tag} not found in constant ${value}`);
|