@benup/bensdk 1.0.8 → 1.2.0

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 (31) hide show
  1. package/README.md +3 -4
  2. package/bin/src/cli/app.js +7 -8
  3. package/bin/src/cli/app.js.map +1 -1
  4. package/bin/src/cli/init.js +49 -33
  5. package/bin/src/cli/init.js.map +1 -1
  6. package/bin/src/cli/templates/benefit-definition.template.ts +48 -2
  7. package/bin/src/cli/templates/benefit-definition.types.template.ts +29 -1
  8. package/bin/src/cli/templates/bensdk-cli/generate.ts +33 -29
  9. package/bin/src/cli/templates/bensdk-cli/lib/benefit-definition.schema.ts +20 -3
  10. package/bin/src/cli/templates/bensdk-cli/lib/state-machine.ts +65 -60
  11. package/bin/src/cli/templates/bensdk-cli/templates/state.handler.template.ts +6 -7
  12. package/bin/src/cli/templates/bensdk-cli/validate.ts +22 -20
  13. package/bin/src/cli/templates/bensdk-lib/types/action-base.type.ts +193 -181
  14. package/bin/src/cli/templates/bensdk-lib/types/action.types.ts +11 -9
  15. package/bin/src/cli/templates/bensdk-lib/types/base-deduction.type.ts +165 -175
  16. package/bin/src/cli/templates/bensdk-lib/types/base-dependent.type.ts +178 -0
  17. package/bin/src/cli/templates/bensdk-lib/types/base-recharge.type.ts +162 -172
  18. package/bin/src/cli/templates/bensdk-lib/types/benefits-definition.type.ts +49 -34
  19. package/bin/src/cli/templates/bensdk-lib/types/grant-revoke.type.ts +157 -167
  20. package/bin/src/cli/templates/bensdk-local-server/app.ts +43 -48
  21. package/bin/src/cli/templates/bensdk-viewer/.svelte-kit/tsconfig.json +37 -48
  22. package/bin/src/cli/templates/bensdk-viewer/src/app.d.ts +7 -7
  23. package/bin/src/cli/templates/bensdk-viewer/src/app.html +9 -9
  24. package/bin/src/cli/templates/bensdk-viewer/src/routes/+page.svelte +2 -20
  25. package/bin/src/cli/templates/bensdk-viewer/startup.ts +4 -5
  26. package/bin/src/cli/templates/bensdk-viewer/svelte.config.js +9 -9
  27. package/bin/src/cli/templates/bensdk-viewer/tsconfig.json +17 -17
  28. package/bin/src/cli/templates/bensdk-viewer/vite.config.ts +2 -4
  29. package/bin/src/cli/utils/zip.js +2 -2
  30. package/bin/src/cli/utils/zip.js.map +1 -1
  31. package/package.json +3 -1
@@ -1,179 +1,169 @@
1
1
  export type ActionBaseDeduction = {
2
- _id: string;
3
- batchID?: string | undefined;
4
- parentActionID?: string | undefined;
5
- fingerprint?: string | undefined;
6
- benefitID: string;
7
- action: "DEDUCTION";
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
- establishmentID: string;
36
- admissionDate: string;
37
- externalEmploymentContractID: string;
38
- position: {
39
- code: number;
40
- description: string;
41
- };
42
- establishment: {
43
- code: number;
44
- description: string;
45
- };
46
- startDateOfCurrentSituation: string;
47
- situation: {
48
- code: number;
49
- description: string;
50
- };
51
- benefits: {
52
- [x: string]: {
53
- value: boolean;
54
- options?: {} | undefined;
55
- };
56
- };
57
- status: "ADMITTED" | "DISMISSED" | "SUSPENDED" | "IGNORED";
58
- fingerprint: string;
59
- createdAt: string;
60
- isDeleted?: boolean;
61
- };
62
- company: {
63
- _id: string;
64
- accountID: string;
65
- cnpj: string;
66
- /** razao social */
67
- businessName: string;
68
- /** nome fantasia */
69
- tradeName: string;
70
- address?: {
71
- street: string;
72
- number: string;
73
- complement?: string | undefined;
74
- neighborhood: string;
75
- city: string;
76
- state: string;
77
- zipCode: string;
78
- country: string;
79
- } | undefined;
80
- createdAt: string;
81
- updatedAt?: string | undefined;
82
- };
83
- payrollConfiguration: {
84
- _id: string;
85
- accountID: string;
86
- companyID: string;
87
- payrollSystem: "LG_ONPREMISE_VLI" | "LG_CLOUD" | "LG_ONPREMISE_AMBEV";
88
- eligibilitySource: "BENEFIT_MODULE" | "ADDITIONAL_ATTRIBUTE";
89
- productToggle?: {
90
- isOcherstratorActive?: boolean;
91
- isIntegratorActive?: boolean;
92
- };
93
- cutoffDay: number;
94
- modifiedContractsWindowInDays: number;
95
- dataMapping: {
96
- eligibility?: {
97
- benefitID: string;
98
- eligibilityType: "BENEFIT" | "ATTRIBUTE" | "ELIGIBLE_TO_ALL";
99
- eligibilityCode?: (number | string) | undefined;
100
- eligibilityMap?: {
101
- eligibilityValue: (boolean | number) | string;
102
- isEligible: boolean;
103
- options: {};
104
- }[] | undefined;
105
- }[] | undefined;
106
- deduction?: {
107
- benefitID: string;
108
- deduction: {
109
- externalPayrollID: number;
110
- externalPayrollEventID: number;
111
- };
112
- refund?: {
113
- externalPayrollID: number;
114
- externalPayrollEventID: number;
115
- } | undefined;
116
- meta?: {} | undefined;
117
- }[] | undefined;
118
- recharge?: {
119
- rechargeID: string;
120
- label?: string | undefined;
121
- eventID: number;
122
- sheetID: number;
123
- benefitID: string;
124
- productID?: string | undefined;
125
- executionCron: string;
126
- rechargeDate?: number | undefined;
127
- }[] | undefined;
128
- situation?: {
129
- code: number;
130
- value: "ADMITTED" | "DISMISSED" | "SUSPENDED" | "IGNORED";
131
- }[] | undefined;
132
- };
133
- version: 2;
134
- isDeleted?: boolean;
135
- createdAt: string;
136
- updatedAt?: string | undefined;
137
- deletedAt?: string | undefined;
138
- };
139
- establishment: {
140
- _id: string;
141
- accountID: string;
142
- companyID: string;
143
- cnpj: string;
144
- /** razao social */
145
- businessName: string;
146
- /** nome fantasia */
147
- tradeName: string;
148
- /** código da empresa no sistema de folha */
149
- externalEstablishmentID: string;
150
- address?: {
151
- street: string;
152
- number: string;
153
- complement?: string | undefined;
154
- neighborhood: string;
155
- city: string;
156
- state: string;
157
- zipCode: string;
158
- country: string;
159
- } | undefined;
160
- createdAt: string;
161
- updatedAt?: string | undefined;
2
+ _id: string;
3
+ batchID?: string | undefined;
4
+ parentActionID?: string | undefined;
5
+ fingerprint?: string | undefined;
6
+ benefitID: string;
7
+ action: 'DEDUCTION';
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;
162
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;
163
84
  };
164
- eligibilityOptions: {};
165
- ctx?: {} | undefined;
166
- log?: {} | undefined;
167
- origin: string;
168
- createdAt: string;
169
- updatedAt?: string | undefined;
170
- deductionInput: {
171
- payrollSystem: string;
172
- externalSheetID: string;
173
- externalEventID: string;
174
- externalSituationID: number;
175
- isAccumulative: boolean;
176
- date: string;
177
- value: number;
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;
178
152
  };
179
- };
153
+ };
154
+ eligibilityOptions: {};
155
+ ctx?: {} | undefined;
156
+ log?: {} | undefined;
157
+ origin: string;
158
+ createdAt: string;
159
+ updatedAt?: string | undefined;
160
+ deductionInput: {
161
+ payrollSystem: string;
162
+ externalSheetID: string;
163
+ externalEventID: string;
164
+ externalSituationID: number;
165
+ isAccumulative: boolean;
166
+ date: string;
167
+ value: number;
168
+ };
169
+ };
@@ -0,0 +1,178 @@
1
+ export type ActionBaseDependent = {
2
+ _id: string;
3
+ batchID?: string | undefined;
4
+ parentActionID?: string | undefined;
5
+ fingerprint?: string | undefined;
6
+ benefitID: string;
7
+ action: 'GRANT_DEPENDENT' | 'REVOKE_DEPENDENT';
8
+ state: string;
9
+ target: {
10
+ dependent: {
11
+ externalDependentID: string;
12
+ externalDependentCode: string;
13
+ name: string;
14
+ /** CPF in format 000.000.000-00 */
15
+ cpf: string;
16
+ birthDate: string;
17
+ sex: 'M' | 'F';
18
+ relationshipType: string;
19
+ maritalStatus: string;
20
+ benefits: {
21
+ [x: string]: {
22
+ value: boolean;
23
+ options?: {} | undefined;
24
+ };
25
+ };
26
+ status: 'LINKED' | 'UNLINKED';
27
+ };
28
+ employee: {
29
+ _id: string;
30
+ name: string;
31
+ /** CPF in format 000.000.000-00 */
32
+ cpf: string;
33
+ birthdate: string;
34
+ address: {
35
+ street: string;
36
+ number: string;
37
+ complement?: string | undefined;
38
+ neighborhood: string;
39
+ city: string;
40
+ state: string;
41
+ zipCode: string;
42
+ country: string;
43
+ };
44
+ email?: string | undefined;
45
+ createdAt: string;
46
+ updatedAt?: string | undefined;
47
+ };
48
+ employmentContract: {
49
+ _id: string;
50
+ companyID: string;
51
+ customerID: string;
52
+ accountID: string;
53
+ admissionDate: string;
54
+ externalEmploymentContractID: string;
55
+ position: {
56
+ code: number;
57
+ description: string;
58
+ };
59
+ establishment: {
60
+ code: number;
61
+ description: string;
62
+ };
63
+ startDateOfCurrentSituation: string;
64
+ situation: {
65
+ code: number;
66
+ description: string;
67
+ };
68
+ benefits: {
69
+ [x: string]: {
70
+ value: boolean;
71
+ options?: {} | undefined;
72
+ };
73
+ };
74
+ status: 'ADMITTED' | 'DISMISSED' | 'SUSPENDED' | 'IGNORED';
75
+ fingerprint: string;
76
+ createdAt: string;
77
+ isDeleted?: boolean;
78
+ };
79
+ company: {
80
+ _id: string;
81
+ accountID: string;
82
+ externalCompanyID: string;
83
+ cnpj: string;
84
+ /** razao social */
85
+ businessName: string;
86
+ /** nome fantasia */
87
+ tradeName: string;
88
+ address?:
89
+ | {
90
+ street: string;
91
+ number: string;
92
+ complement?: string | undefined;
93
+ neighborhood: string;
94
+ city: string;
95
+ state: string;
96
+ zipCode: string;
97
+ country: string;
98
+ }
99
+ | undefined;
100
+ createdAt: string;
101
+ updatedAt?: string | undefined;
102
+ };
103
+ payrollConfiguration: {
104
+ _id: string;
105
+ accountID: string;
106
+ companyID: string;
107
+ payrollSystem: 'LG_ONPREMISE_VLI' | 'LG_CLOUD' | 'LG_ONPREMISE_AMBEV';
108
+ eligibilitySource: 'BENEFIT_MODULE' | 'ADDITIONAL_ATTRIBUTE';
109
+ productToggle?: {
110
+ isOcherstratorActive?: boolean;
111
+ isIntegratorActive?: boolean;
112
+ };
113
+ cutoffDay: number;
114
+ modifiedContractsWindowInDays: number;
115
+ dataMapping: {
116
+ eligibility?:
117
+ | {
118
+ benefitID: string;
119
+ eligibilityType: 'BENEFIT' | 'ATTRIBUTE' | 'ELIGIBLE_TO_ALL';
120
+ eligibilityCode?: (number | string) | undefined;
121
+ eligibilityMap?:
122
+ | {
123
+ eligibilityValue: (boolean | number) | string;
124
+ isEligible: boolean;
125
+ options: {};
126
+ }[]
127
+ | undefined;
128
+ }[]
129
+ | undefined;
130
+ deduction?:
131
+ | {
132
+ benefitID: string;
133
+ deduction: {
134
+ externalPayrollID: number;
135
+ externalPayrollEventID: number;
136
+ };
137
+ refund?:
138
+ | {
139
+ externalPayrollID: number;
140
+ externalPayrollEventID: number;
141
+ }
142
+ | undefined;
143
+ meta?: {} | undefined;
144
+ }[]
145
+ | undefined;
146
+ recharge?:
147
+ | {
148
+ rechargeID: string;
149
+ label?: string | undefined;
150
+ eventID: number;
151
+ sheetID: number;
152
+ benefitID: string;
153
+ productID?: string | undefined;
154
+ executionCron: string;
155
+ rechargeDate?: number | undefined;
156
+ }[]
157
+ | undefined;
158
+ situation?:
159
+ | {
160
+ code: number;
161
+ value: 'ADMITTED' | 'DISMISSED' | 'SUSPENDED' | 'IGNORED';
162
+ }[]
163
+ | undefined;
164
+ };
165
+ version: 2;
166
+ isDeleted?: boolean;
167
+ createdAt: string;
168
+ updatedAt?: string | undefined;
169
+ deletedAt?: string | undefined;
170
+ };
171
+ };
172
+ eligibilityOptions: {};
173
+ ctx?: {} | undefined;
174
+ log?: {} | undefined;
175
+ origin: string;
176
+ createdAt: string;
177
+ updatedAt?: string | undefined;
178
+ };