@benup/bensdk 1.3.1 → 1.4.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/bin/lib/lib/consumer/index.d.ts +6 -0
- package/bin/lib/schemas/action.schema.d.ts +68 -23
- package/bin/lib/types/action.types.d.ts +2 -1
- package/bin/lib/types/benefit-definition.types.d.ts +16 -1
- package/bin/lib/types/state-handler.types.d.ts +4 -0
- package/bin/src/cli/init.js +1 -10
- package/bin/src/cli/init.js.map +1 -1
- package/bin/src/cli/templates/benefit-definition.template.ts +2 -1
- package/bin/src/cli/templates/bensdk-cli/generate.ts +29 -8
- package/bin/src/cli/templates/bensdk-cli/templates/state.handler.template.ts +7 -3
- package/package.json +1 -1
- package/bin/src/cli/templates/benefit-definition.types.template.ts +0 -66
- package/bin/src/cli/templates/bensdk-lib/types/action-base.type.ts +0 -197
- package/bin/src/cli/templates/bensdk-lib/types/action.types.ts +0 -13
- package/bin/src/cli/templates/bensdk-lib/types/base-deduction.type.ts +0 -169
- package/bin/src/cli/templates/bensdk-lib/types/base-dependent.type.ts +0 -178
- package/bin/src/cli/templates/bensdk-lib/types/base-recharge.type.ts +0 -166
- package/bin/src/cli/templates/bensdk-lib/types/benefits-definition.type.ts +0 -59
- package/bin/src/cli/templates/bensdk-lib/types/grant-revoke.type.ts +0 -160
- package/bin/src/cli/templates/bensdk-lib/types/state.handler.type.ts +0 -88
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
export type ActionBaseGrantRevoke = {
|
|
2
|
-
_id: string;
|
|
3
|
-
batchID?: string | undefined;
|
|
4
|
-
parentActionID?: string | undefined;
|
|
5
|
-
fingerprint?: string | undefined;
|
|
6
|
-
benefitID: string;
|
|
7
|
-
action: 'GRANT' | 'REVOKE';
|
|
8
|
-
state: string;
|
|
9
|
-
target: {
|
|
10
|
-
employee: {
|
|
11
|
-
_id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
/** CPF in format 000.000.000-00 */
|
|
14
|
-
cpf: string;
|
|
15
|
-
birthdate: string;
|
|
16
|
-
address: {
|
|
17
|
-
street: string;
|
|
18
|
-
number: string;
|
|
19
|
-
complement?: string | undefined;
|
|
20
|
-
neighborhood: string;
|
|
21
|
-
city: string;
|
|
22
|
-
state: string;
|
|
23
|
-
zipCode: string;
|
|
24
|
-
country: string;
|
|
25
|
-
};
|
|
26
|
-
email?: string | undefined;
|
|
27
|
-
createdAt: string;
|
|
28
|
-
updatedAt?: string | undefined;
|
|
29
|
-
};
|
|
30
|
-
employmentContract: {
|
|
31
|
-
_id: string;
|
|
32
|
-
companyID: string;
|
|
33
|
-
customerID: string;
|
|
34
|
-
accountID: string;
|
|
35
|
-
admissionDate: string;
|
|
36
|
-
externalEmploymentContractID: string;
|
|
37
|
-
position: {
|
|
38
|
-
code: number;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
establishment: {
|
|
42
|
-
code: number;
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
startDateOfCurrentSituation: string;
|
|
46
|
-
situation: {
|
|
47
|
-
code: number;
|
|
48
|
-
description: string;
|
|
49
|
-
};
|
|
50
|
-
benefits: {
|
|
51
|
-
[x: string]: {
|
|
52
|
-
value: boolean;
|
|
53
|
-
options?: {} | undefined;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
status: 'ADMITTED' | 'DISMISSED' | 'SUSPENDED' | 'IGNORED';
|
|
57
|
-
fingerprint: string;
|
|
58
|
-
createdAt: string;
|
|
59
|
-
isDeleted?: boolean;
|
|
60
|
-
};
|
|
61
|
-
company: {
|
|
62
|
-
_id: string;
|
|
63
|
-
accountID: string;
|
|
64
|
-
externalCompanyID: string;
|
|
65
|
-
cnpj: string;
|
|
66
|
-
/** razao social */
|
|
67
|
-
businessName: string;
|
|
68
|
-
/** nome fantasia */
|
|
69
|
-
tradeName: string;
|
|
70
|
-
address?:
|
|
71
|
-
| {
|
|
72
|
-
street: string;
|
|
73
|
-
number: string;
|
|
74
|
-
complement?: string | undefined;
|
|
75
|
-
neighborhood: string;
|
|
76
|
-
city: string;
|
|
77
|
-
state: string;
|
|
78
|
-
zipCode: string;
|
|
79
|
-
country: string;
|
|
80
|
-
}
|
|
81
|
-
| undefined;
|
|
82
|
-
createdAt: string;
|
|
83
|
-
updatedAt?: string | undefined;
|
|
84
|
-
};
|
|
85
|
-
payrollConfiguration: {
|
|
86
|
-
_id: string;
|
|
87
|
-
accountID: string;
|
|
88
|
-
companyID: string;
|
|
89
|
-
payrollSystem: 'LG_ONPREMISE_VLI' | 'LG_CLOUD' | 'LG_ONPREMISE_AMBEV';
|
|
90
|
-
eligibilitySource: 'BENEFIT_MODULE' | 'ADDITIONAL_ATTRIBUTE';
|
|
91
|
-
productToggle?: {
|
|
92
|
-
isOcherstratorActive?: boolean;
|
|
93
|
-
isIntegratorActive?: boolean;
|
|
94
|
-
};
|
|
95
|
-
cutoffDay: number;
|
|
96
|
-
modifiedContractsWindowInDays: number;
|
|
97
|
-
dataMapping: {
|
|
98
|
-
eligibility?:
|
|
99
|
-
| {
|
|
100
|
-
benefitID: string;
|
|
101
|
-
eligibilityType: 'BENEFIT' | 'ATTRIBUTE' | 'ELIGIBLE_TO_ALL';
|
|
102
|
-
eligibilityCode?: (number | string) | undefined;
|
|
103
|
-
eligibilityMap?:
|
|
104
|
-
| {
|
|
105
|
-
eligibilityValue: (boolean | number) | string;
|
|
106
|
-
isEligible: boolean;
|
|
107
|
-
options: {};
|
|
108
|
-
}[]
|
|
109
|
-
| undefined;
|
|
110
|
-
}[]
|
|
111
|
-
| undefined;
|
|
112
|
-
deduction?:
|
|
113
|
-
| {
|
|
114
|
-
benefitID: string;
|
|
115
|
-
deduction: {
|
|
116
|
-
externalPayrollID: number;
|
|
117
|
-
externalPayrollEventID: number;
|
|
118
|
-
};
|
|
119
|
-
refund?:
|
|
120
|
-
| {
|
|
121
|
-
externalPayrollID: number;
|
|
122
|
-
externalPayrollEventID: number;
|
|
123
|
-
}
|
|
124
|
-
| undefined;
|
|
125
|
-
meta?: {} | undefined;
|
|
126
|
-
}[]
|
|
127
|
-
| undefined;
|
|
128
|
-
recharge?:
|
|
129
|
-
| {
|
|
130
|
-
rechargeID: string;
|
|
131
|
-
label?: string | undefined;
|
|
132
|
-
eventID: number;
|
|
133
|
-
sheetID: number;
|
|
134
|
-
benefitID: string;
|
|
135
|
-
productID?: string | undefined;
|
|
136
|
-
executionCron: string;
|
|
137
|
-
rechargeDate?: number | undefined;
|
|
138
|
-
}[]
|
|
139
|
-
| undefined;
|
|
140
|
-
situation?:
|
|
141
|
-
| {
|
|
142
|
-
code: number;
|
|
143
|
-
value: 'ADMITTED' | 'DISMISSED' | 'SUSPENDED' | 'IGNORED';
|
|
144
|
-
}[]
|
|
145
|
-
| undefined;
|
|
146
|
-
};
|
|
147
|
-
version: 2;
|
|
148
|
-
isDeleted?: boolean;
|
|
149
|
-
createdAt: string;
|
|
150
|
-
updatedAt?: string | undefined;
|
|
151
|
-
deletedAt?: string | undefined;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
eligibilityOptions: {};
|
|
155
|
-
ctx?: {} | undefined;
|
|
156
|
-
log?: {} | undefined;
|
|
157
|
-
origin: string;
|
|
158
|
-
createdAt: string;
|
|
159
|
-
updatedAt?: string | undefined;
|
|
160
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import pino from 'pino';
|
|
3
|
-
import { BenefitDefinition } from './benefits-definition.type';
|
|
4
|
-
|
|
5
|
-
export type HandlerMessageResponse = 'ACK' | 'UNACK' | 'DLQ';
|
|
6
|
-
|
|
7
|
-
export interface HandlerResponse {
|
|
8
|
-
response: HandlerMessageResponse;
|
|
9
|
-
options?: {
|
|
10
|
-
maxRetries?: number; // min 1
|
|
11
|
-
delayBetweenRetries?: number; // in seconds
|
|
12
|
-
delayMode?: 'fixed' | 'exponential';
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type MessageBody = {
|
|
17
|
-
version: number;
|
|
18
|
-
data: {
|
|
19
|
-
actionID: string;
|
|
20
|
-
};
|
|
21
|
-
meta?: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export interface StateHandlerResponse<TLogs, TCtx> {
|
|
25
|
-
handlerResponse?: HandlerResponse;
|
|
26
|
-
action?: {
|
|
27
|
-
state?: string;
|
|
28
|
-
logs: TLogs;
|
|
29
|
-
ctx?: TCtx;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface StateHandlerCtx {
|
|
34
|
-
/**
|
|
35
|
-
* The raw message object received from sqs
|
|
36
|
-
*/
|
|
37
|
-
rawMessage: any;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Instace of pino.Logger with the execution context
|
|
41
|
-
*/
|
|
42
|
-
logger: pino.Logger;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Correlation IDs captured in message attributes
|
|
46
|
-
*/
|
|
47
|
-
correlationIDs: Record<string, string>;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* benefitsAPI Axios instance
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
benefitsAPI: AxiosInstance;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* lgProxy Axios instance
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
lgProxyAPI: AxiosInstance;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* apiBenup Axios instance
|
|
63
|
-
*/
|
|
64
|
-
benupAPI: AxiosInstance;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* benefitDefinition
|
|
68
|
-
*/
|
|
69
|
-
benefitDefinition: BenefitDefinition;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* State Handler
|
|
74
|
-
* @param TAction - Action type
|
|
75
|
-
* @param TLogs - Logs type
|
|
76
|
-
* @param TCtx - Context type
|
|
77
|
-
*/
|
|
78
|
-
export type StateHandler<TAction, TLogs, TCtx> = (
|
|
79
|
-
message: MessageBody,
|
|
80
|
-
action: TAction,
|
|
81
|
-
ctx: StateHandlerCtx
|
|
82
|
-
) => Promise<StateHandlerResponse<TLogs, TCtx>>;
|
|
83
|
-
|
|
84
|
-
export type StateHandlerConfig = {
|
|
85
|
-
maxRetries: number;
|
|
86
|
-
delayBetweenRetries: number;
|
|
87
|
-
delayMode: 'fixed' | 'exponential';
|
|
88
|
-
};
|