@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,176 +1,166 @@
1
1
  export type ActionBaseRecharge = {
2
- _id: string;
3
- batchID?: string | undefined;
4
- parentActionID?: string | undefined;
5
- fingerprint?: string | undefined;
6
- benefitID: string;
7
- action: "RECHARGE";
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: 'RECHARGE';
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
- rechargeInput: {
171
- externalSheetID: string;
172
- externalEventID: string;
173
- date: string;
174
- 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;
175
152
  };
176
- };
153
+ };
154
+ eligibilityOptions: {};
155
+ ctx?: {} | undefined;
156
+ log?: {} | undefined;
157
+ origin: string;
158
+ createdAt: string;
159
+ updatedAt?: string | undefined;
160
+ rechargeInput: {
161
+ externalSheetID: string;
162
+ externalEventID: string;
163
+ date: string;
164
+ value: number;
165
+ };
166
+ };
@@ -1,44 +1,59 @@
1
1
  export type BenefitDefinition = {
2
- benefitID: string;
3
- availableActions: Array<'GRANT' | 'REVOKE' | 'RECHARGE' | 'DEDUCTION'>;
4
- stateMachine: {
5
- GRANT: {
6
- REQUESTED_GRANT: {
7
- next: string;
8
- };
9
- [key: string]: unknown;
2
+ benefitID: string;
3
+ availableActions: Array<
4
+ 'GRANT' | 'REVOKE' | 'RECHARGE' | 'DEDUCTION' | 'GRANT_DEPENDENT' | 'REVOKE_DEPENDENT'
5
+ >;
6
+ stateMachine: {
7
+ GRANT: {
8
+ REQUESTED_GRANT: {
9
+ next: string;
10
10
  };
11
- REVOKE: {
12
- REQUESTED_REVOKE: {
13
- next: string;
14
- };
15
- [key: string]: unknown;
11
+ [key: string]: unknown;
12
+ };
13
+ REVOKE: {
14
+ REQUESTED_REVOKE: {
15
+ next: string;
16
16
  };
17
- RECHARGE?: {
18
- REQUESTED_RECHARGE: {
19
- next: string;
20
- };
21
- [key: string]: unknown;
17
+ [key: string]: unknown;
18
+ };
19
+ RECHARGE?: {
20
+ REQUESTED_RECHARGE: {
21
+ next: string;
22
22
  };
23
- DEDUCTION?: {
24
- REQUESTED_DEDUCTION: {
25
- next: string;
26
- };
27
- [key: string]: unknown;
23
+ [key: string]: unknown;
24
+ };
25
+ DEDUCTION?: {
26
+ REQUESTED_DEDUCTION: {
27
+ next: string;
28
28
  };
29
+ [key: string]: unknown;
29
30
  };
30
- actions: {
31
- eligibilityOptions: {
32
- GRANT: Record<string, unknown>;
33
- RECHARGE?: Record<string, unknown>;
31
+ GRANT_DEPENDENT?: {
32
+ REQUESTED_GRANT_DEPENDENT: {
33
+ next: string;
34
34
  };
35
- ctx: Record<string, unknown>;
36
- log: {
37
- GRANT: Record<string, unknown>;
38
- REVOKE: Record<string, unknown>;
39
- RECHARGE?: Record<string, unknown>;
40
- DEDUCTION?: Record<string, unknown>;
35
+ [key: string]: unknown;
36
+ };
37
+ REVOKE_DEPENDENT?: {
38
+ REQUESTED_REVOKE_DEPENDENT: {
39
+ next: string;
41
40
  };
41
+ [key: string]: unknown;
42
+ };
43
+ };
44
+ actions: {
45
+ eligibilityOptions: {
46
+ GRANT: Record<string, unknown>;
47
+ RECHARGE?: Record<string, unknown>;
48
+ };
49
+ ctx: Record<string, unknown>;
50
+ log: {
51
+ GRANT: Record<string, unknown>;
52
+ REVOKE: Record<string, unknown>;
53
+ RECHARGE?: Record<string, unknown>;
54
+ DEDUCTION?: Record<string, unknown>;
55
+ GRANT_DEPENDENT?: Record<string, unknown>;
56
+ REVOKE_DEPENDENT?: Record<string, unknown>;
42
57
  };
43
58
  };
44
-
59
+ };