@ductape/sdk 0.2.6 → 0.2.8
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/productsApi.service.d.ts +9 -0
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.js +98 -9
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +3 -2
- package/dist/processor/services/processor.service.js +20 -8
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/secrets/secrets.service.d.ts +7 -0
- package/dist/secrets/secrets.service.js +25 -0
- package/dist/secrets/secrets.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -317,6 +317,7 @@ export default class ProcessorService implements IProcessorService {
|
|
|
317
317
|
data?: undefined;
|
|
318
318
|
}>;
|
|
319
319
|
processPricingCost(additional_logs: Partial<ILogData>): Promise<IPricingResult>;
|
|
320
|
+
private processPricingCostEventually;
|
|
320
321
|
addToSuccessOutput(event: IStepEvent, output: any, additional_logs: Partial<ILogData>): Promise<void>;
|
|
321
322
|
checkIsSuccessful(): boolean;
|
|
322
323
|
addToFailureOutput(e: any, event: IStepEvent, payload: IRetryMeta | any, additional_logs: Partial<ILogData>, policy?: Partial<IAppRetryPolicy>): Promise<IProcessingFailure>;
|
|
@@ -384,9 +385,9 @@ export default class ProcessorService implements IProcessorService {
|
|
|
384
385
|
runBrokerPublish(data: IStepEvent, additional_logs?: Partial<ILogData>): Promise<{
|
|
385
386
|
published: boolean;
|
|
386
387
|
}>;
|
|
387
|
-
processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<{
|
|
388
|
+
processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<IProcessingFailure | {
|
|
388
389
|
url: string;
|
|
389
|
-
}
|
|
390
|
+
}>;
|
|
390
391
|
writeResult(status: LogEventStatus, retryable?: boolean): Promise<void>;
|
|
391
392
|
/**
|
|
392
393
|
* Separate credentials into prefixed (e.g., 'headers:Authorization') and non-prefixed (e.g., 'api_key').
|
|
@@ -2956,13 +2956,12 @@ class ProcessorService {
|
|
|
2956
2956
|
const end = Date.now();
|
|
2957
2957
|
this.requestTime += end - start;
|
|
2958
2958
|
this.totalRequests += 1;
|
|
2959
|
-
|
|
2959
|
+
// Pricing/request accounting can touch Redis (including lock acquisition and
|
|
2960
|
+
// a 5s command timeout). It is telemetry/accounting and must not hold a
|
|
2961
|
+
// completed provider response on the business request path.
|
|
2962
|
+
void this.processPricingCostEventually(Object.assign(Object.assign({}, additional_logs), { app_id, workspace_id: this.workspace_id }), event.app).then(() => this.logService.publish()).catch(() => { });
|
|
2960
2963
|
const log = Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process http request - success', successful_execution: true, data: { response: results }, status: types_1.LogEventStatus.SUCCESS, app_id, action: event.event, start,
|
|
2961
2964
|
end });
|
|
2962
|
-
if (pricing) {
|
|
2963
|
-
const { pricing_tag, pricing_cost, is_overage, currency } = pricing;
|
|
2964
|
-
Object.assign(log, { pricing_tag, pricing_cost, is_overage, currency });
|
|
2965
|
-
}
|
|
2966
2965
|
this.logService.add(log);
|
|
2967
2966
|
await this.addToSuccessOutput(event, results, additional_logs);
|
|
2968
2967
|
if (returnValue) {
|
|
@@ -3069,6 +3068,16 @@ class ProcessorService {
|
|
|
3069
3068
|
return null;
|
|
3070
3069
|
}
|
|
3071
3070
|
}
|
|
3071
|
+
async processPricingCostEventually(additional_logs, accessTag) {
|
|
3072
|
+
try {
|
|
3073
|
+
this.pricingService.fetchPricing();
|
|
3074
|
+
this.pricingService.fetchOveragePricing();
|
|
3075
|
+
}
|
|
3076
|
+
catch (_a) {
|
|
3077
|
+
await this.initializePricing(additional_logs, accessTag);
|
|
3078
|
+
}
|
|
3079
|
+
return this.processPricingCost(additional_logs);
|
|
3080
|
+
}
|
|
3072
3081
|
async addToSuccessOutput(event, output, additional_logs) {
|
|
3073
3082
|
// Remove event from failed, skipped, and waiting arrays
|
|
3074
3083
|
this.processingOutput.failure = this.processingOutput.failure.filter((data) => !(data.event.sequence_tag === event.sequence_tag && data.event.event === event.event));
|
|
@@ -3082,7 +3091,8 @@ class ProcessorService {
|
|
|
3082
3091
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { successful_execution: true, message: 'Process event - success', data: {}, status: types_1.LogEventStatus.SUCCESS }));
|
|
3083
3092
|
void this.logService.publish().catch(() => { });
|
|
3084
3093
|
this.end = Date.now();
|
|
3085
|
-
|
|
3094
|
+
// Invocation persistence is telemetry and must not extend provider latency.
|
|
3095
|
+
void this.writeResult(types_1.LogEventStatus.SUCCESS).catch(() => { });
|
|
3086
3096
|
}
|
|
3087
3097
|
}
|
|
3088
3098
|
checkIsSuccessful() {
|
|
@@ -5031,7 +5041,8 @@ class ProcessorService {
|
|
|
5031
5041
|
}
|
|
5032
5042
|
this.end = Date.now();
|
|
5033
5043
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Execute action - success', data: { input, result }, status: types_1.LogEventStatus.SUCCESS }));
|
|
5034
|
-
|
|
5044
|
+
// Invocation persistence is telemetry and must not extend provider latency.
|
|
5045
|
+
void this.writeResult(types_1.LogEventStatus.SUCCESS).catch(() => { });
|
|
5035
5046
|
// The action result is authoritative; telemetry delivery must not add the
|
|
5036
5047
|
// Logs API timeout to caller latency.
|
|
5037
5048
|
void this.logService.publish().catch(() => { });
|
|
@@ -5042,7 +5053,8 @@ class ProcessorService {
|
|
|
5042
5053
|
this.logService.add(Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Execute action - failed', data: { e: e.toString() }, status: types_1.LogEventStatus.FAIL }));
|
|
5043
5054
|
this.end = Date.now();
|
|
5044
5055
|
if (!(e === null || e === void 0 ? void 0 : e.processorFailureRecorded)) {
|
|
5045
|
-
|
|
5056
|
+
// Preserve the caller-visible provider/input failure immediately; analytics are eventual.
|
|
5057
|
+
void this.writeResult(types_1.LogEventStatus.FAIL).catch(() => { });
|
|
5046
5058
|
}
|
|
5047
5059
|
// Preserve and return the provider error immediately. LogsService keeps
|
|
5048
5060
|
// unsent entries queued when delivery fails.
|