kcommons 18.27.0 → 18.27.1
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/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/typings/company.typings.d.ts +5 -2
- package/build/typings/company.typings.js +1 -0
- package/build/typings/entityApprovalChainEntry.typings.d.ts +5 -2
- package/build/typings/entityApprovalChainEntry.typings.js +1 -0
- package/build/typings/escalation.typings.d.ts +163 -0
- package/build/typings/escalation.typings.js +73 -0
- package/build/utils/businessTime.util.d.ts +10 -0
- package/build/utils/businessTime.util.js +48 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export * from "./typings/freightComparativeVehiclesQuantitySplit.typings";
|
|
|
106
106
|
export * from "./typings/freightComparativeEarlyAccessRequests.typings";
|
|
107
107
|
export * from "./typings/freightQuote.typings";
|
|
108
108
|
export * from "./typings/freightOrder.typings";
|
|
109
|
+
export * from "./typings/escalation.typings";
|
|
109
110
|
export * from "./typings/system/queueJob.typings";
|
|
110
111
|
export * from "./typings/system/erpPluginConfigCompany.typings";
|
|
111
112
|
export * from "./typings/system/erpPluginsMetadata.typings";
|
package/build/index.js
CHANGED
|
@@ -126,6 +126,7 @@ __exportStar(require("./typings/freightComparativeVehiclesQuantitySplit.typings"
|
|
|
126
126
|
__exportStar(require("./typings/freightComparativeEarlyAccessRequests.typings"), exports);
|
|
127
127
|
__exportStar(require("./typings/freightQuote.typings"), exports);
|
|
128
128
|
__exportStar(require("./typings/freightOrder.typings"), exports);
|
|
129
|
+
__exportStar(require("./typings/escalation.typings"), exports);
|
|
129
130
|
// System
|
|
130
131
|
__exportStar(require("./typings/system/queueJob.typings"), exports);
|
|
131
132
|
__exportStar(require("./typings/system/erpPluginConfigCompany.typings"), exports);
|
|
@@ -78,6 +78,7 @@ import { INestedTransporterGroups } from "./transporterGroup.typings";
|
|
|
78
78
|
import { INestedVehicle } from "./vehicle.typings";
|
|
79
79
|
import { INestedTransporterLogs } from "./transporterLogs.typings";
|
|
80
80
|
import { INestedReportsPluginConfigCompany } from "./system/reportsPluginConfigCompany.typings";
|
|
81
|
+
import { IEscalationConfig } from "./escalation.typings";
|
|
81
82
|
export declare enum PRICING_PLANS {
|
|
82
83
|
BASIC = "BASIC",
|
|
83
84
|
GROWTH = "GROWTH",
|
|
@@ -174,7 +175,8 @@ export declare enum COMPANY_INCLUDE {
|
|
|
174
175
|
company_freight_comparative_vehicles = "company_freight_comparative_vehicles",
|
|
175
176
|
company_fos = "company_fos",
|
|
176
177
|
company_fo_vehicles = "company_fo_vehicles",
|
|
177
|
-
transporter_logs = "transporter_logs"
|
|
178
|
+
transporter_logs = "transporter_logs",
|
|
179
|
+
escalation_configs = "escalation_configs"
|
|
178
180
|
}
|
|
179
181
|
export interface ICompany extends IAddress {
|
|
180
182
|
id: string;
|
|
@@ -290,8 +292,9 @@ export interface ICompany extends IAddress {
|
|
|
290
292
|
company_fos: INestedFO[] | null;
|
|
291
293
|
company_fo_vehicles: INestedFOVehicle[] | null;
|
|
292
294
|
transporter_logs: INestedTransporterLogs[] | null;
|
|
295
|
+
escalation_configs: IEscalationConfig[] | null;
|
|
293
296
|
}
|
|
294
|
-
export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "report_plugins" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles" | "transporter_logs" | "report_plugins"> {
|
|
297
|
+
export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "report_plugins" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles" | "transporter_logs" | "report_plugins" | "escalation_configs"> {
|
|
295
298
|
}
|
|
296
299
|
export interface ICompanyVendorAdditionalInfoMappingConfig {
|
|
297
300
|
additional_info_form_que_id: string;
|
|
@@ -98,6 +98,7 @@ var COMPANY_INCLUDE;
|
|
|
98
98
|
COMPANY_INCLUDE["company_fos"] = "company_fos";
|
|
99
99
|
COMPANY_INCLUDE["company_fo_vehicles"] = "company_fo_vehicles";
|
|
100
100
|
COMPANY_INCLUDE["transporter_logs"] = "transporter_logs";
|
|
101
|
+
COMPANY_INCLUDE["escalation_configs"] = "escalation_configs";
|
|
101
102
|
})(COMPANY_INCLUDE || (exports.COMPANY_INCLUDE = COMPANY_INCLUDE = {}));
|
|
102
103
|
// export interface IUpdateVendorOnboardingRequestCategoriesInputs
|
|
103
104
|
// extends Pick<ICompany, "vendor_onboarding_request_categories"> {}
|
|
@@ -25,6 +25,7 @@ import { INestedCompanyTransporter } from "./companyTransporter.typings";
|
|
|
25
25
|
import { INestedFreightComparative } from "./freightComparative.typings";
|
|
26
26
|
import { INestedFRR } from "./frr.typings";
|
|
27
27
|
import { INestedFO } from "./freightOrder.typings";
|
|
28
|
+
import { IEscalationRuntime } from "./escalation.typings";
|
|
28
29
|
export declare enum ENTITY_APPROVAL_CHAIN_ENTRY_PARENT_DOCS {
|
|
29
30
|
INDENT = "INDENT",
|
|
30
31
|
PR = "PR",
|
|
@@ -81,7 +82,8 @@ export declare enum ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES {
|
|
|
81
82
|
company_transporter = "company_transporter",
|
|
82
83
|
frr = "frr",
|
|
83
84
|
freight_comparative = "freight_comparative",
|
|
84
|
-
fo = "fo"
|
|
85
|
+
fo = "fo",
|
|
86
|
+
escalation_runtimes = "escalation_runtimes"
|
|
85
87
|
}
|
|
86
88
|
export interface IEntityApprovalChainEntry {
|
|
87
89
|
id: string;
|
|
@@ -154,6 +156,7 @@ export interface IEntityApprovalChainEntry {
|
|
|
154
156
|
for_accounts_approval_of_imr: INestedEntityApprovalChainEntry[] | null;
|
|
155
157
|
imr_changelogs: INestedInvoiceMatchingRecordChangelog[] | null;
|
|
156
158
|
logs: INestedEntityApprovalChainEntryLog[] | null;
|
|
159
|
+
escalation_runtimes?: IEscalationRuntime[] | null;
|
|
157
160
|
}
|
|
158
|
-
export interface INestedEntityApprovalChainEntry extends Omit<IEntityApprovalChainEntry, "company" | "user" | "role" | "indent" | "mi" | "pr" | "rfq" | "comparative" | "po" | "sub_po" | "grn" | "mrn" | "source_istd" | "dest_istd" | "vendor_onboarding_request" | "company_vendor" | "vendor_onboarding_request_scores" | "item" | "asn" | "ves" | "company_customer" | "parent_qcd" | "for_qa_approval_of_imr" | "for_audits_approval_of_imr" | "for_accounts_approval_of_imr" | "imr_changelogs" | "logs" | "company_transporter" | "frr" | "freight_comparative"> {
|
|
161
|
+
export interface INestedEntityApprovalChainEntry extends Omit<IEntityApprovalChainEntry, "company" | "user" | "role" | "indent" | "mi" | "pr" | "rfq" | "comparative" | "po" | "sub_po" | "grn" | "mrn" | "source_istd" | "dest_istd" | "vendor_onboarding_request" | "company_vendor" | "vendor_onboarding_request_scores" | "item" | "asn" | "ves" | "company_customer" | "parent_qcd" | "for_qa_approval_of_imr" | "for_audits_approval_of_imr" | "for_accounts_approval_of_imr" | "imr_changelogs" | "logs" | "company_transporter" | "frr" | "freight_comparative" | "escalation_runtimes"> {
|
|
159
162
|
}
|
|
@@ -60,4 +60,5 @@ var ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES;
|
|
|
60
60
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["frr"] = "frr";
|
|
61
61
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["freight_comparative"] = "freight_comparative";
|
|
62
62
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["fo"] = "fo";
|
|
63
|
+
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["escalation_runtimes"] = "escalation_runtimes";
|
|
63
64
|
})(ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES || (exports.ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES = ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES = {}));
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { IPaginationFilters } from "./common/paginationFilters.typings";
|
|
2
|
+
import { INestedCompany } from "./company.typings";
|
|
3
|
+
export declare enum ESCALATION_NOTIFICATION_TYPE {
|
|
4
|
+
EMAIL = "EMAIL",
|
|
5
|
+
WHATSAPP = "WHATSAPP",
|
|
6
|
+
BOTH = "BOTH"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ESCALATION_RUNTIME_STATUS {
|
|
9
|
+
ACTIVE = "ACTIVE",
|
|
10
|
+
CLOSED = "CLOSED",
|
|
11
|
+
EXCEEDED = "EXCEEDED",
|
|
12
|
+
CANCELLED = "CANCELLED"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ESCALATION_RESOURCE_TYPE {
|
|
15
|
+
VENDOR_ONBOARDING_REQUEST = "VENDOR_ONBOARDING_REQUEST",
|
|
16
|
+
WAITLISTED_VENDOR = "WAITLISTED_VENDOR"
|
|
17
|
+
}
|
|
18
|
+
export declare enum ESCALATION_EVENT_TYPE {
|
|
19
|
+
SEND_PAT = "SEND_PAT",
|
|
20
|
+
SEND_FOR_APPROVAL = "SEND_FOR_APPROVAL",
|
|
21
|
+
APPROVE = "APPROVE",
|
|
22
|
+
SYNC_TO_ERP = "SYNC_TO_ERP",
|
|
23
|
+
ONBOARD = "ONBOARD"
|
|
24
|
+
}
|
|
25
|
+
export declare const ESCALATION_RESOURCE_EVENTS: Record<ESCALATION_RESOURCE_TYPE, ESCALATION_EVENT_TYPE[]>;
|
|
26
|
+
export declare enum ESCALATION_SYNC_REASON {
|
|
27
|
+
CREATED = "CREATED",
|
|
28
|
+
UPDATED = "UPDATED",
|
|
29
|
+
PAT_SUBMITTED = "PAT_SUBMITTED",
|
|
30
|
+
PAT_ROLLED_BACK = "PAT_ROLLED_BACK",
|
|
31
|
+
CANCELLED = "CANCELLED",
|
|
32
|
+
ROLLED_BACK_TO_INITIATOR = "ROLLED_BACK_TO_INITIATOR",
|
|
33
|
+
DISABLED = "DISABLED",
|
|
34
|
+
DELETED = "DELETED",
|
|
35
|
+
DAILY_CHECK = "DAILY_CHECK"
|
|
36
|
+
}
|
|
37
|
+
export declare enum ESCALATION_CONFIG_INCLUDE {
|
|
38
|
+
company = "company",
|
|
39
|
+
levels = "levels",
|
|
40
|
+
runtimes = "runtimes"
|
|
41
|
+
}
|
|
42
|
+
export declare enum ESCALATION_CONFIG_LEVEL_INCLUDE {
|
|
43
|
+
escalation_config = "escalation_config"
|
|
44
|
+
}
|
|
45
|
+
export declare enum ESCALATION_RUNTIME_INCLUDE {
|
|
46
|
+
escalation_config = "escalation_config",
|
|
47
|
+
executions = "executions"
|
|
48
|
+
}
|
|
49
|
+
export declare enum ESCALATION_EXECUTION_LOG_INCLUDE {
|
|
50
|
+
escalation_runtime = "escalation_runtime"
|
|
51
|
+
}
|
|
52
|
+
export interface IEscalationConfigLevel {
|
|
53
|
+
id: string;
|
|
54
|
+
escalation_config_id: string;
|
|
55
|
+
level: number;
|
|
56
|
+
name: string;
|
|
57
|
+
is_enabled: boolean;
|
|
58
|
+
delay_in_working_seconds: number;
|
|
59
|
+
notification_type: ESCALATION_NOTIFICATION_TYPE;
|
|
60
|
+
extra_to_user_ids: string[];
|
|
61
|
+
cc_user_ids: string[];
|
|
62
|
+
bcc_user_ids: string[];
|
|
63
|
+
created_at: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
escalation_config: INestedEscalationConfig | null;
|
|
66
|
+
}
|
|
67
|
+
export interface INestedEscalationConfigLevel extends Omit<IEscalationConfigLevel, "escalation_config"> {
|
|
68
|
+
}
|
|
69
|
+
export interface IEscalationConfig {
|
|
70
|
+
id: string;
|
|
71
|
+
company_id: string;
|
|
72
|
+
resource_type: string;
|
|
73
|
+
event: string;
|
|
74
|
+
is_enabled: boolean;
|
|
75
|
+
created_at: string;
|
|
76
|
+
updated_at: string;
|
|
77
|
+
company: INestedCompany | null;
|
|
78
|
+
levels: INestedEscalationConfigLevel[] | null;
|
|
79
|
+
runtimes: INestedEscalationRuntime[] | null;
|
|
80
|
+
}
|
|
81
|
+
export interface INestedEscalationConfig extends Omit<IEscalationConfig, "company" | "levels" | "runtimes"> {
|
|
82
|
+
}
|
|
83
|
+
export interface IEscalationExecutionLog {
|
|
84
|
+
id: string;
|
|
85
|
+
company_id: string;
|
|
86
|
+
escalation_runtime_id: string;
|
|
87
|
+
resource_type: string;
|
|
88
|
+
resource_id: string;
|
|
89
|
+
event: string;
|
|
90
|
+
approval_order: number | null;
|
|
91
|
+
level: number;
|
|
92
|
+
name: string | null;
|
|
93
|
+
notification_type: ESCALATION_NOTIFICATION_TYPE;
|
|
94
|
+
responsible_user_ids: string[];
|
|
95
|
+
extra_to_user_ids: string[];
|
|
96
|
+
cc_user_ids: string[];
|
|
97
|
+
bcc_user_ids: string[];
|
|
98
|
+
triggered_at: string;
|
|
99
|
+
triggered_after_working_seconds: number | null;
|
|
100
|
+
is_successful: boolean;
|
|
101
|
+
error_message: string | null;
|
|
102
|
+
channel_outcomes: Record<string, unknown> | null;
|
|
103
|
+
start_event: string | null;
|
|
104
|
+
start_metadata: Record<string, unknown> | null;
|
|
105
|
+
created_at: string;
|
|
106
|
+
updated_at: string;
|
|
107
|
+
escalation_runtime: INestedEscalationRuntime | null;
|
|
108
|
+
}
|
|
109
|
+
export interface INestedEscalationExecutionLog extends Omit<IEscalationExecutionLog, "escalation_runtime"> {
|
|
110
|
+
}
|
|
111
|
+
export interface IEscalationRuntime {
|
|
112
|
+
id: string;
|
|
113
|
+
company_id: string;
|
|
114
|
+
escalation_config_id: string | null;
|
|
115
|
+
resource_type: string;
|
|
116
|
+
resource_id: string;
|
|
117
|
+
event: string;
|
|
118
|
+
approval_order: number | null;
|
|
119
|
+
current_level: number | null;
|
|
120
|
+
status: ESCALATION_RUNTIME_STATUS;
|
|
121
|
+
started_at: string;
|
|
122
|
+
last_sent_at: string | null;
|
|
123
|
+
next_due_at: string | null;
|
|
124
|
+
job_id: string | null;
|
|
125
|
+
start_event: string | null;
|
|
126
|
+
start_metadata: Record<string, unknown> | null;
|
|
127
|
+
created_at: string;
|
|
128
|
+
updated_at: string;
|
|
129
|
+
escalation_config: INestedEscalationConfig | null;
|
|
130
|
+
executions: INestedEscalationExecutionLog[] | null;
|
|
131
|
+
}
|
|
132
|
+
export interface INestedEscalationRuntime extends Omit<IEscalationRuntime, "escalation_config" | "executions"> {
|
|
133
|
+
}
|
|
134
|
+
export interface IEscalationConfigFilters {
|
|
135
|
+
resource_type?: string | null;
|
|
136
|
+
event?: string | null;
|
|
137
|
+
is_enabled?: boolean | null;
|
|
138
|
+
include?: ESCALATION_CONFIG_INCLUDE[] | null;
|
|
139
|
+
}
|
|
140
|
+
export interface IEscalationConfigFiltersWithPagination extends IPaginationFilters, IEscalationConfigFilters {
|
|
141
|
+
}
|
|
142
|
+
export interface IEscalationRuntimeFilters {
|
|
143
|
+
resource_type?: string | null;
|
|
144
|
+
resource_id?: string | null;
|
|
145
|
+
event?: string | null;
|
|
146
|
+
status?: ESCALATION_RUNTIME_STATUS | null;
|
|
147
|
+
approval_order?: number | null;
|
|
148
|
+
escalation_config_id?: string | null;
|
|
149
|
+
include?: ESCALATION_RUNTIME_INCLUDE[] | null;
|
|
150
|
+
}
|
|
151
|
+
export interface IEscalationRuntimeFiltersWithPagination extends IPaginationFilters, IEscalationRuntimeFilters {
|
|
152
|
+
}
|
|
153
|
+
export interface IEscalationExecutionLogFilters {
|
|
154
|
+
resource_type?: string | null;
|
|
155
|
+
resource_id?: string | null;
|
|
156
|
+
event?: string | null;
|
|
157
|
+
escalation_runtime_id?: string | null;
|
|
158
|
+
level?: number | null;
|
|
159
|
+
is_successful?: boolean | null;
|
|
160
|
+
include?: ESCALATION_EXECUTION_LOG_INCLUDE[] | null;
|
|
161
|
+
}
|
|
162
|
+
export interface IEscalationExecutionLogFiltersWithPagination extends IPaginationFilters, IEscalationExecutionLogFilters {
|
|
163
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ESCALATION_EXECUTION_LOG_INCLUDE = exports.ESCALATION_RUNTIME_INCLUDE = exports.ESCALATION_CONFIG_LEVEL_INCLUDE = exports.ESCALATION_CONFIG_INCLUDE = exports.ESCALATION_SYNC_REASON = exports.ESCALATION_RESOURCE_EVENTS = exports.ESCALATION_EVENT_TYPE = exports.ESCALATION_RESOURCE_TYPE = exports.ESCALATION_RUNTIME_STATUS = exports.ESCALATION_NOTIFICATION_TYPE = void 0;
|
|
4
|
+
var ESCALATION_NOTIFICATION_TYPE;
|
|
5
|
+
(function (ESCALATION_NOTIFICATION_TYPE) {
|
|
6
|
+
ESCALATION_NOTIFICATION_TYPE["EMAIL"] = "EMAIL";
|
|
7
|
+
ESCALATION_NOTIFICATION_TYPE["WHATSAPP"] = "WHATSAPP";
|
|
8
|
+
ESCALATION_NOTIFICATION_TYPE["BOTH"] = "BOTH";
|
|
9
|
+
})(ESCALATION_NOTIFICATION_TYPE || (exports.ESCALATION_NOTIFICATION_TYPE = ESCALATION_NOTIFICATION_TYPE = {}));
|
|
10
|
+
var ESCALATION_RUNTIME_STATUS;
|
|
11
|
+
(function (ESCALATION_RUNTIME_STATUS) {
|
|
12
|
+
ESCALATION_RUNTIME_STATUS["ACTIVE"] = "ACTIVE";
|
|
13
|
+
ESCALATION_RUNTIME_STATUS["CLOSED"] = "CLOSED";
|
|
14
|
+
ESCALATION_RUNTIME_STATUS["EXCEEDED"] = "EXCEEDED";
|
|
15
|
+
ESCALATION_RUNTIME_STATUS["CANCELLED"] = "CANCELLED";
|
|
16
|
+
})(ESCALATION_RUNTIME_STATUS || (exports.ESCALATION_RUNTIME_STATUS = ESCALATION_RUNTIME_STATUS = {}));
|
|
17
|
+
var ESCALATION_RESOURCE_TYPE;
|
|
18
|
+
(function (ESCALATION_RESOURCE_TYPE) {
|
|
19
|
+
ESCALATION_RESOURCE_TYPE["VENDOR_ONBOARDING_REQUEST"] = "VENDOR_ONBOARDING_REQUEST";
|
|
20
|
+
ESCALATION_RESOURCE_TYPE["WAITLISTED_VENDOR"] = "WAITLISTED_VENDOR";
|
|
21
|
+
})(ESCALATION_RESOURCE_TYPE || (exports.ESCALATION_RESOURCE_TYPE = ESCALATION_RESOURCE_TYPE = {}));
|
|
22
|
+
var ESCALATION_EVENT_TYPE;
|
|
23
|
+
(function (ESCALATION_EVENT_TYPE) {
|
|
24
|
+
ESCALATION_EVENT_TYPE["SEND_PAT"] = "SEND_PAT";
|
|
25
|
+
ESCALATION_EVENT_TYPE["SEND_FOR_APPROVAL"] = "SEND_FOR_APPROVAL";
|
|
26
|
+
ESCALATION_EVENT_TYPE["APPROVE"] = "APPROVE";
|
|
27
|
+
ESCALATION_EVENT_TYPE["SYNC_TO_ERP"] = "SYNC_TO_ERP";
|
|
28
|
+
ESCALATION_EVENT_TYPE["ONBOARD"] = "ONBOARD";
|
|
29
|
+
})(ESCALATION_EVENT_TYPE || (exports.ESCALATION_EVENT_TYPE = ESCALATION_EVENT_TYPE = {}));
|
|
30
|
+
exports.ESCALATION_RESOURCE_EVENTS = {
|
|
31
|
+
[ESCALATION_RESOURCE_TYPE.VENDOR_ONBOARDING_REQUEST]: [
|
|
32
|
+
ESCALATION_EVENT_TYPE.SEND_PAT,
|
|
33
|
+
ESCALATION_EVENT_TYPE.SEND_FOR_APPROVAL,
|
|
34
|
+
ESCALATION_EVENT_TYPE.APPROVE,
|
|
35
|
+
],
|
|
36
|
+
[ESCALATION_RESOURCE_TYPE.WAITLISTED_VENDOR]: [
|
|
37
|
+
ESCALATION_EVENT_TYPE.SEND_FOR_APPROVAL,
|
|
38
|
+
ESCALATION_EVENT_TYPE.APPROVE,
|
|
39
|
+
ESCALATION_EVENT_TYPE.SYNC_TO_ERP,
|
|
40
|
+
ESCALATION_EVENT_TYPE.ONBOARD,
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
var ESCALATION_SYNC_REASON;
|
|
44
|
+
(function (ESCALATION_SYNC_REASON) {
|
|
45
|
+
ESCALATION_SYNC_REASON["CREATED"] = "CREATED";
|
|
46
|
+
ESCALATION_SYNC_REASON["UPDATED"] = "UPDATED";
|
|
47
|
+
ESCALATION_SYNC_REASON["PAT_SUBMITTED"] = "PAT_SUBMITTED";
|
|
48
|
+
ESCALATION_SYNC_REASON["PAT_ROLLED_BACK"] = "PAT_ROLLED_BACK";
|
|
49
|
+
ESCALATION_SYNC_REASON["CANCELLED"] = "CANCELLED";
|
|
50
|
+
ESCALATION_SYNC_REASON["ROLLED_BACK_TO_INITIATOR"] = "ROLLED_BACK_TO_INITIATOR";
|
|
51
|
+
ESCALATION_SYNC_REASON["DISABLED"] = "DISABLED";
|
|
52
|
+
ESCALATION_SYNC_REASON["DELETED"] = "DELETED";
|
|
53
|
+
ESCALATION_SYNC_REASON["DAILY_CHECK"] = "DAILY_CHECK";
|
|
54
|
+
})(ESCALATION_SYNC_REASON || (exports.ESCALATION_SYNC_REASON = ESCALATION_SYNC_REASON = {}));
|
|
55
|
+
var ESCALATION_CONFIG_INCLUDE;
|
|
56
|
+
(function (ESCALATION_CONFIG_INCLUDE) {
|
|
57
|
+
ESCALATION_CONFIG_INCLUDE["company"] = "company";
|
|
58
|
+
ESCALATION_CONFIG_INCLUDE["levels"] = "levels";
|
|
59
|
+
ESCALATION_CONFIG_INCLUDE["runtimes"] = "runtimes";
|
|
60
|
+
})(ESCALATION_CONFIG_INCLUDE || (exports.ESCALATION_CONFIG_INCLUDE = ESCALATION_CONFIG_INCLUDE = {}));
|
|
61
|
+
var ESCALATION_CONFIG_LEVEL_INCLUDE;
|
|
62
|
+
(function (ESCALATION_CONFIG_LEVEL_INCLUDE) {
|
|
63
|
+
ESCALATION_CONFIG_LEVEL_INCLUDE["escalation_config"] = "escalation_config";
|
|
64
|
+
})(ESCALATION_CONFIG_LEVEL_INCLUDE || (exports.ESCALATION_CONFIG_LEVEL_INCLUDE = ESCALATION_CONFIG_LEVEL_INCLUDE = {}));
|
|
65
|
+
var ESCALATION_RUNTIME_INCLUDE;
|
|
66
|
+
(function (ESCALATION_RUNTIME_INCLUDE) {
|
|
67
|
+
ESCALATION_RUNTIME_INCLUDE["escalation_config"] = "escalation_config";
|
|
68
|
+
ESCALATION_RUNTIME_INCLUDE["executions"] = "executions";
|
|
69
|
+
})(ESCALATION_RUNTIME_INCLUDE || (exports.ESCALATION_RUNTIME_INCLUDE = ESCALATION_RUNTIME_INCLUDE = {}));
|
|
70
|
+
var ESCALATION_EXECUTION_LOG_INCLUDE;
|
|
71
|
+
(function (ESCALATION_EXECUTION_LOG_INCLUDE) {
|
|
72
|
+
ESCALATION_EXECUTION_LOG_INCLUDE["escalation_runtime"] = "escalation_runtime";
|
|
73
|
+
})(ESCALATION_EXECUTION_LOG_INCLUDE || (exports.ESCALATION_EXECUTION_LOG_INCLUDE = ESCALATION_EXECUTION_LOG_INCLUDE = {}));
|
|
@@ -54,4 +54,14 @@ export interface FormatBusinessDurationOptions {
|
|
|
54
54
|
/** Working days in a week. Derive with getWorkingDaysPerWeek() from the company's week-off rules; falls back to WORKING_DAYS_PER_WEEK. */
|
|
55
55
|
workingDaysPerWeek?: number;
|
|
56
56
|
}
|
|
57
|
+
export declare function addWorkingSeconds(start: Date, delaySeconds: number, options?: BusinessCalendarOptions): Date;
|
|
58
|
+
export declare function businessCalendarFromCompanyConfig(config: {
|
|
59
|
+
shift_start_time?: string | null;
|
|
60
|
+
shift_end_time?: string | null;
|
|
61
|
+
week_off?: unknown;
|
|
62
|
+
public_holidays?: string[];
|
|
63
|
+
}, range?: {
|
|
64
|
+
start: Date;
|
|
65
|
+
end: Date;
|
|
66
|
+
}): BusinessCalendarOptions;
|
|
57
67
|
export declare function formatBusinessDuration(seconds: number, options?: FormatBusinessDurationOptions): string;
|
|
@@ -11,6 +11,8 @@ exports.normalizeEndTime = normalizeEndTime;
|
|
|
11
11
|
exports.calculateSameDayWorkingSeconds = calculateSameDayWorkingSeconds;
|
|
12
12
|
exports.calculateMultiDayWorkingSeconds = calculateMultiDayWorkingSeconds;
|
|
13
13
|
exports.calculateWorkingSeconds = calculateWorkingSeconds;
|
|
14
|
+
exports.addWorkingSeconds = addWorkingSeconds;
|
|
15
|
+
exports.businessCalendarFromCompanyConfig = businessCalendarFromCompanyConfig;
|
|
14
16
|
exports.formatBusinessDuration = formatBusinessDuration;
|
|
15
17
|
const date_fns_1 = require("date-fns");
|
|
16
18
|
exports.SHIFT_START_HOUR = 0;
|
|
@@ -215,6 +217,52 @@ function calculateWorkingSeconds(start, end, options) {
|
|
|
215
217
|
? calculateSameDayWorkingSeconds(normalizedStart, normalizedEnd)
|
|
216
218
|
: calculateMultiDayWorkingSeconds(normalizedStart, normalizedEnd, options);
|
|
217
219
|
}
|
|
220
|
+
function addWorkingSeconds(start, delaySeconds, options) {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
if (!delaySeconds || delaySeconds <= 0) {
|
|
223
|
+
return normalizeStartTime(start, options);
|
|
224
|
+
}
|
|
225
|
+
const startHour = (_a = options === null || options === void 0 ? void 0 : options.shiftStartHour) !== null && _a !== void 0 ? _a : exports.SHIFT_START_HOUR;
|
|
226
|
+
const endHour = (_b = options === null || options === void 0 ? void 0 : options.shiftEndHour) !== null && _b !== void 0 ? _b : exports.SHIFT_END_HOUR;
|
|
227
|
+
let cursor = normalizeStartTime(start, options);
|
|
228
|
+
let remaining = delaySeconds;
|
|
229
|
+
while (remaining > 0) {
|
|
230
|
+
if (isNonWorkingDay(cursor, options)) {
|
|
231
|
+
cursor = atHour(addBusinessDays(cursor, 1), startHour);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const dayEnd = atHour(cursor, endHour);
|
|
235
|
+
const available = Math.max(0, (0, date_fns_1.differenceInSeconds)(dayEnd, cursor));
|
|
236
|
+
if (remaining <= available) {
|
|
237
|
+
return new Date(cursor.getTime() + remaining * 1000);
|
|
238
|
+
}
|
|
239
|
+
remaining -= available;
|
|
240
|
+
cursor = atHour(addBusinessDays(cursor, 1), startHour);
|
|
241
|
+
}
|
|
242
|
+
return cursor;
|
|
243
|
+
}
|
|
244
|
+
function businessCalendarFromCompanyConfig(config, range) {
|
|
245
|
+
var _a;
|
|
246
|
+
const weekOff = Array.isArray(config.week_off) ? config.week_off : [];
|
|
247
|
+
const weekOffDays = weekOff.filter((item) => typeof item === 'number' && Number.isInteger(item));
|
|
248
|
+
const weekOffRules = weekOff.filter((item) => typeof item === 'object' &&
|
|
249
|
+
item !== null &&
|
|
250
|
+
!Array.isArray(item) &&
|
|
251
|
+
Number.isInteger(item.day) &&
|
|
252
|
+
Array.isArray(item.occurrences));
|
|
253
|
+
const holidays = ((_a = config.public_holidays) !== null && _a !== void 0 ? _a : [])
|
|
254
|
+
.map((value) => new Date(value))
|
|
255
|
+
.filter((date) => !Number.isNaN(date.getTime()));
|
|
256
|
+
const occurrenceWeekOffDates = range && weekOffRules.length > 0
|
|
257
|
+
? expandWeekOffRulesToDates(weekOffRules, range.start, range.end)
|
|
258
|
+
: [];
|
|
259
|
+
return {
|
|
260
|
+
shiftStartHour: parseShiftTimeToHour(config.shift_start_time),
|
|
261
|
+
shiftEndHour: parseShiftTimeToHour(config.shift_end_time),
|
|
262
|
+
weekOffDays,
|
|
263
|
+
holidays: [...holidays, ...occurrenceWeekOffDates],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
218
266
|
function formatBusinessDuration(seconds, options) {
|
|
219
267
|
if (!seconds || seconds <= 0)
|
|
220
268
|
return "0s";
|