@randstad-uca/aws-sns-publisher 1.0.6 → 1.0.9

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ // Import your schemas and event types
9
+ const constants_1 = require("./constants");
10
+ const sms_schema_1 = require("./schemas/sms.schema");
11
+ const personal_data_schema_1 = require("./schemas/personal-data.schema");
12
+ const education_schema_1 = require("./schemas/education.schema");
13
+ const work_experience_schema_1 = require("./schemas/work-experience.schema");
14
+ const job_application_schema_1 = require("./schemas/job-application.schema");
15
+ const language_schema_1 = require("./schemas/language.schema");
16
+ const certification_schema_1 = require("./schemas/certification.schema");
17
+ const update_event_date_schema_1 = require("./schemas/update-event-date.schema");
18
+ const alert_schema_1 = require("./schemas/alert.schema");
19
+ const document_status_schema_1 = require("./schemas/document-status.schema");
20
+ const email_schema_1 = require("./schemas/email.schema");
21
+ const schemas = {
22
+ [constants_1.validEventTypes.sms]: { schema: sms_schema_1.SMSSchema, label: 'SMS' },
23
+ [constants_1.validEventTypes.addPersonalData]: {
24
+ schema: personal_data_schema_1.PersonalDataSchema,
25
+ label: 'Add Personal Data',
26
+ },
27
+ [constants_1.validEventTypes.updatePersonalData]: {
28
+ schema: personal_data_schema_1.PersonalDataSchema,
29
+ label: 'Update Personal Data',
30
+ },
31
+ [constants_1.validEventTypes.addEducation]: {
32
+ schema: education_schema_1.AddEducationSchema,
33
+ label: 'Add Education',
34
+ },
35
+ [constants_1.validEventTypes.updateEducation]: {
36
+ schema: education_schema_1.UpdateEducationSchema,
37
+ label: 'Update Education',
38
+ },
39
+ [constants_1.validEventTypes.deleteEducation]: {
40
+ schema: education_schema_1.DeleteEducationSchema,
41
+ label: 'Delete Education',
42
+ },
43
+ [constants_1.validEventTypes.addWorkExperience]: {
44
+ schema: work_experience_schema_1.AddWorkExperienceSchema,
45
+ label: 'Add Work Experience',
46
+ },
47
+ [constants_1.validEventTypes.updateWorkExperience]: {
48
+ schema: work_experience_schema_1.UpdateWorkExperienceSchema,
49
+ label: 'Update Work Experience',
50
+ },
51
+ [constants_1.validEventTypes.deleteWorkExperience]: {
52
+ schema: work_experience_schema_1.DeleteWorkExperienceSchema,
53
+ label: 'Delete Work Experience',
54
+ },
55
+ [constants_1.validEventTypes.addJobApplication]: {
56
+ schema: job_application_schema_1.AddJobApplicationSchema,
57
+ label: 'Add Job Application',
58
+ },
59
+ [constants_1.validEventTypes.updateJobApplication]: {
60
+ schema: job_application_schema_1.UpdateJobApplicationSchema,
61
+ label: 'Update Job Application',
62
+ },
63
+ [constants_1.validEventTypes.deleteJobApplication]: {
64
+ schema: job_application_schema_1.DeleteJobApplicationSchema,
65
+ label: 'Delete Job Application',
66
+ },
67
+ [constants_1.validEventTypes.addLanguage]: {
68
+ schema: language_schema_1.AddLanguageSchema,
69
+ label: 'Add Language',
70
+ },
71
+ [constants_1.validEventTypes.updateLanguage]: {
72
+ schema: language_schema_1.UpdateLanguageSchema,
73
+ label: 'Update Language',
74
+ },
75
+ [constants_1.validEventTypes.deleteLanguage]: {
76
+ schema: language_schema_1.DeleteLanguageSchema,
77
+ label: 'Delete Language',
78
+ },
79
+ [constants_1.validEventTypes.setCertification]: {
80
+ schema: certification_schema_1.SetCertificationSchema,
81
+ label: 'Set Certification',
82
+ },
83
+ [constants_1.validEventTypes.setProfileUpdatedDate]: {
84
+ schema: update_event_date_schema_1.SetProfileUpdatedDateSchema,
85
+ label: 'Set Profile Updated Date',
86
+ },
87
+ [constants_1.validEventTypes.setCvAdjuntoUpdatedDate]: {
88
+ schema: update_event_date_schema_1.SetCvAdjuntoUpdatedDateSchema,
89
+ label: 'Set CV Adjunto Updated Date',
90
+ },
91
+ [constants_1.validEventTypes.setCvBuilderUpdatedDate]: {
92
+ schema: update_event_date_schema_1.SetCvBuilderUpdatedDateSchema,
93
+ label: 'Set CV Builder Updated Date',
94
+ },
95
+ [constants_1.validEventTypes.setCvBuilderDownloadUpdatedDate]: {
96
+ schema: update_event_date_schema_1.SetCvBuilderDownloadUpdatedDateSchema,
97
+ label: 'Set CV Builder Download Updated Date',
98
+ },
99
+ [constants_1.validEventTypes.setAlert]: {
100
+ schema: alert_schema_1.SetAlertSchema,
101
+ label: 'Set Alert',
102
+ },
103
+ [constants_1.validEventTypes.setAdendasEstado]: {
104
+ schema: document_status_schema_1.SetAdendasEstadoSchema,
105
+ label: 'Set Adendas Estado',
106
+ },
107
+ [constants_1.validEventTypes.setAltaAfipEstado]: {
108
+ schema: document_status_schema_1.SetAltaAfipEstadoSchema,
109
+ label: 'Set Alta Afip Estado',
110
+ },
111
+ [constants_1.validEventTypes.setContratoEstado]: {
112
+ schema: document_status_schema_1.SetContratoEstadoSchema,
113
+ label: 'Set Contrato Estado',
114
+ },
115
+ [constants_1.validEventTypes.setLegajoEstado]: {
116
+ schema: document_status_schema_1.SetLegajoEstadoSchema,
117
+ label: 'Set Legajo Estado',
118
+ },
119
+ [constants_1.validEventTypes.setReciboEstado]: {
120
+ schema: document_status_schema_1.SetReciboEstadoSchema,
121
+ label: 'Set Recibo Estado',
122
+ },
123
+ [constants_1.validEventTypes.setSeguridadyhigieneEstado]: {
124
+ schema: document_status_schema_1.SetSeguridadyhigieneEstadoSchema,
125
+ label: 'Set Seguridad y Higiene Estado',
126
+ },
127
+ [constants_1.validEventTypes.setSvoEstado]: {
128
+ schema: document_status_schema_1.SetSvoEstadoSchema,
129
+ label: 'Set SVO Estado',
130
+ },
131
+ [constants_1.validEventTypes.mail]: {
132
+ schema: email_schema_1.SendEmailSchema,
133
+ label: 'Send Email',
134
+ },
135
+ };
136
+ function getFieldsFromJoi(schema) {
137
+ const description = schema.describe();
138
+ const required = [];
139
+ const optional = [];
140
+ if (description.type !== 'object' || !description.keys) {
141
+ return { required, optional };
142
+ }
143
+ for (const [key, value] of Object.entries(description.keys)) {
144
+ const field = value;
145
+ const isRequired = field.flags?.presence === 'required';
146
+ if (isRequired) {
147
+ required.push(key);
148
+ }
149
+ else {
150
+ optional.push(key);
151
+ }
152
+ }
153
+ return { required, optional };
154
+ }
155
+ function generateMarkdown() {
156
+ let markdown = `# Schema Documentation\n\nThis file describes the required and optional fields for each \`eventType\`.\n\n`;
157
+ for (const [eventType, { schema, label }] of Object.entries(schemas)) {
158
+ const { required, optional } = getFieldsFromJoi(schema);
159
+ markdown += `## Event: \`${eventType}\` (${label})\n\n`;
160
+ markdown += `**Required fields:**\n`;
161
+ markdown += required.length
162
+ ? required.map((f) => `- \`${f}\``).join('\n') + '\n'
163
+ : '- *(none)*\n';
164
+ markdown += `\n**Optional fields:**\n`;
165
+ markdown += optional.length
166
+ ? optional.map((f) => `- \`${f}\``).join('\n') + '\n'
167
+ : '- *(none)*\n';
168
+ markdown += `\n---\n\n`;
169
+ }
170
+ return markdown;
171
+ }
172
+ const outputPath = path_1.default.resolve(__dirname, '../schema-doc.md');
173
+ fs_1.default.writeFileSync(outputPath, generateMarkdown(), 'utf-8');
174
+ console.log(`✅ Schema documentation generated at: ${outputPath}`);
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "@randstad-uca/aws-sns-publisher",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "AWS SNS Publisher",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "files": [
8
- "build/**/*"
8
+ "build/**/*",
9
+ "schema-doc.md"
9
10
  ],
10
11
  "scripts": {
11
12
  "clean": "rimraf build",
12
13
  "build": "npm run clean && npx tsc",
13
- "pub": "npm version patch && npm run build && npm publish"
14
+ "test": "echo \"No tests implemented yet\" && exit 0",
15
+ "prepublishOnly": "npm run test && npm run generate-doc && npm run build",
16
+ "pub": "npm version patch && npm publish && git push && git push --tags",
17
+ "generate-doc": "ts-node ./src/generate-schema-doc.ts"
14
18
  },
15
19
  "keywords": [
16
20
  "aws",
@@ -18,12 +22,22 @@
18
22
  "publisher"
19
23
  ],
20
24
  "author": "Facundo Brusa",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/randstad-argentina/aws-sns-publisher.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/randstad-argentina/aws-sns-publisher/issues"
31
+ },
32
+ "homepage": "https://github.com/randstad-argentina/aws-sns-publisher#readme",
21
33
  "license": "ISC",
22
34
  "publishConfig": {
23
35
  "access": "public"
24
36
  },
25
37
  "devDependencies": {
38
+ "@types/node": "^22.15.17",
26
39
  "rimraf": "^6.0.1",
40
+ "ts-node": "^10.9.2",
27
41
  "typescript": "^5.7.3"
28
42
  },
29
43
  "dependencies": {
package/readme.md CHANGED
@@ -126,6 +126,12 @@ Valida el `payload` contra el esquema correspondiente según eventType.
126
126
 
127
127
  ---
128
128
 
129
+ ## 📄 Schema Documentation
130
+
131
+ See [schema-docs.md](./schema-docs.md) for a full list of event types and their schema fields
132
+
133
+ ---
134
+
129
135
  🧩 Características
130
136
 
131
137
  - ✅ Compatible con múltiples regiones AWS.
@@ -144,4 +150,4 @@ Valida el `payload` contra el esquema correspondiente según eventType.
144
150
 
145
151
  - Esta librería no crea los topics automáticamente.
146
152
 
147
- - En caso de usar topics FIFO, es importante pasar un `apiName` ***valido*** para deduplicación.
153
+ - En caso de usar topics FIFO, es importante pasar un `apiName` **valido** para deduplicación.
package/schema-doc.md ADDED
@@ -0,0 +1,384 @@
1
+ # Schema Documentation
2
+
3
+ This file describes the required and optional fields for each `eventType`.
4
+
5
+ ## Event: `sms` (SMS)
6
+
7
+ **Required fields:**
8
+ - `celular`
9
+ - `mensaje`
10
+
11
+ **Optional fields:**
12
+ - `nom`
13
+ - `dato`
14
+
15
+ ---
16
+
17
+ ## Event: `add-personal-data` (Add Personal Data)
18
+
19
+ **Required fields:**
20
+ - `CanCod`
21
+
22
+ **Optional fields:**
23
+ - `email`
24
+ - `nombre`
25
+ - `fechaNacimiento`
26
+ - `genero`
27
+ - `provincia`
28
+ - `localidad`
29
+ - `telefono`
30
+
31
+ ---
32
+
33
+ ## Event: `update-personal-data` (Update Personal Data)
34
+
35
+ **Required fields:**
36
+ - `CanCod`
37
+
38
+ **Optional fields:**
39
+ - `email`
40
+ - `nombre`
41
+ - `fechaNacimiento`
42
+ - `genero`
43
+ - `provincia`
44
+ - `localidad`
45
+ - `telefono`
46
+
47
+ ---
48
+
49
+ ## Event: `add-education` (Add Education)
50
+
51
+ **Required fields:**
52
+ - `CanCod`
53
+ - `nivel`
54
+ - `area`
55
+ - `estado`
56
+ - `nivelMaximo`
57
+
58
+ **Optional fields:**
59
+ - *(none)*
60
+
61
+ ---
62
+
63
+ ## Event: `update-education` (Update Education)
64
+
65
+ **Required fields:**
66
+ - `CanCod`
67
+ - `nivel`
68
+ - `area`
69
+ - `estado`
70
+ - `nivelMaximo`
71
+ - `prevNivel`
72
+ - `prevArea`
73
+ - `prevEstado`
74
+
75
+ **Optional fields:**
76
+ - *(none)*
77
+
78
+ ---
79
+
80
+ ## Event: `delete-education` (Delete Education)
81
+
82
+ **Required fields:**
83
+ - `CanCod`
84
+ - `nivel`
85
+ - `area`
86
+ - `estado`
87
+ - `nivelMaximo`
88
+
89
+ **Optional fields:**
90
+ - *(none)*
91
+
92
+ ---
93
+
94
+ ## Event: `add-work-experience` (Add Work Experience)
95
+
96
+ **Required fields:**
97
+ - `CanCod`
98
+ - `puesto`
99
+ - `area`
100
+ - `rubro`
101
+ - `nivelMaximo`
102
+
103
+ **Optional fields:**
104
+ - *(none)*
105
+
106
+ ---
107
+
108
+ ## Event: `update-work-experience` (Update Work Experience)
109
+
110
+ **Required fields:**
111
+ - `CanCod`
112
+ - `puesto`
113
+ - `area`
114
+ - `rubro`
115
+ - `nivelMaximo`
116
+ - `prevPuesto`
117
+ - `prevArea`
118
+ - `prevRubro`
119
+
120
+ **Optional fields:**
121
+ - *(none)*
122
+
123
+ ---
124
+
125
+ ## Event: `delete-work-experience` (Delete Work Experience)
126
+
127
+ **Required fields:**
128
+ - `CanCod`
129
+ - `puesto`
130
+ - `area`
131
+ - `rubro`
132
+ - `nivelMaximo`
133
+
134
+ **Optional fields:**
135
+ - *(none)*
136
+
137
+ ---
138
+
139
+ ## Event: `add-job-application` (Add Job Application)
140
+
141
+ **Required fields:**
142
+ - `CanCod`
143
+ - `titulo`
144
+ - `area`
145
+ - `OPoCod`
146
+ - `provincia`
147
+ - `fecha`
148
+ - `nivelMaximo`
149
+
150
+ **Optional fields:**
151
+ - *(none)*
152
+
153
+ ---
154
+
155
+ ## Event: `update-job-application` (Update Job Application)
156
+
157
+ **Required fields:**
158
+ - `CanCod`
159
+ - `titulo`
160
+ - `area`
161
+ - `OPoCod`
162
+ - `provincia`
163
+ - `fecha`
164
+ - `nivelMaximo`
165
+ - `prevTitulo`
166
+ - `prevArea`
167
+ - `prevOPoCod`
168
+ - `prevProvincia`
169
+ - `prevFecha`
170
+
171
+ **Optional fields:**
172
+ - *(none)*
173
+
174
+ ---
175
+
176
+ ## Event: `delete-job-application` (Delete Job Application)
177
+
178
+ **Required fields:**
179
+ - `CanCod`
180
+ - `titulo`
181
+ - `area`
182
+ - `OPoCod`
183
+ - `provincia`
184
+ - `fecha`
185
+ - `nivelMaximo`
186
+
187
+ **Optional fields:**
188
+ - *(none)*
189
+
190
+ ---
191
+
192
+ ## Event: `add-language` (Add Language)
193
+
194
+ **Required fields:**
195
+ - `CanCod`
196
+ - `idioma`
197
+ - `nivelMaximo`
198
+
199
+ **Optional fields:**
200
+ - *(none)*
201
+
202
+ ---
203
+
204
+ ## Event: `update-language` (Update Language)
205
+
206
+ **Required fields:**
207
+ - `CanCod`
208
+ - `idioma`
209
+ - `nivelMaximo`
210
+ - `prevIdioma`
211
+
212
+ **Optional fields:**
213
+ - *(none)*
214
+
215
+ ---
216
+
217
+ ## Event: `delete-language` (Delete Language)
218
+
219
+ **Required fields:**
220
+ - `CanCod`
221
+ - `idioma`
222
+ - `nivelMaximo`
223
+
224
+ **Optional fields:**
225
+ - *(none)*
226
+
227
+ ---
228
+
229
+ ## Event: `set-certification` (Set Certification)
230
+
231
+ **Required fields:**
232
+ - `CanCod`
233
+ - `certificaciones`
234
+
235
+ **Optional fields:**
236
+ - *(none)*
237
+
238
+ ---
239
+
240
+ ## Event: `set-profile-updated-date` (Set Profile Updated Date)
241
+
242
+ **Required fields:**
243
+ - `CanCod`
244
+ - `fechaActualizacionPerfil`
245
+
246
+ **Optional fields:**
247
+ - *(none)*
248
+
249
+ ---
250
+
251
+ ## Event: `set-cv-adjunto-updated-date` (Set CV Adjunto Updated Date)
252
+
253
+ **Required fields:**
254
+ - `CanCod`
255
+ - `fechaActualizacionCVAdjunto`
256
+
257
+ **Optional fields:**
258
+ - *(none)*
259
+
260
+ ---
261
+
262
+ ## Event: `set-cv-builder-updated-date` (Set CV Builder Updated Date)
263
+
264
+ **Required fields:**
265
+ - `CanCod`
266
+ - `fechaActualizacionCVBuilder`
267
+
268
+ **Optional fields:**
269
+ - *(none)*
270
+
271
+ ---
272
+
273
+ ## Event: `set-cv-builder-download-updated-date` (Set CV Builder Download Updated Date)
274
+
275
+ **Required fields:**
276
+ - `CanCod`
277
+ - `fechaActualizacionDescargaCVBuilder`
278
+
279
+ **Optional fields:**
280
+ - *(none)*
281
+
282
+ ---
283
+
284
+ ## Event: `set-alert` (Set Alert)
285
+
286
+ **Required fields:**
287
+ - `CanCod`
288
+ - `alerta`
289
+
290
+ **Optional fields:**
291
+ - *(none)*
292
+
293
+ ---
294
+
295
+ ## Event: `set-adendas-estado` (Set Adendas Estado)
296
+
297
+ **Required fields:**
298
+ - `CanCod`
299
+ - `adendasEstado`
300
+
301
+ **Optional fields:**
302
+ - *(none)*
303
+
304
+ ---
305
+
306
+ ## Event: `set-alta-afip-estado` (Set Alta Afip Estado)
307
+
308
+ **Required fields:**
309
+ - `CanCod`
310
+ - `altaAfipEstado`
311
+
312
+ **Optional fields:**
313
+ - *(none)*
314
+
315
+ ---
316
+
317
+ ## Event: `set-contrato-estado` (Set Contrato Estado)
318
+
319
+ **Required fields:**
320
+ - `CanCod`
321
+ - `contratoEstado`
322
+
323
+ **Optional fields:**
324
+ - *(none)*
325
+
326
+ ---
327
+
328
+ ## Event: `set-legajo-estado` (Set Legajo Estado)
329
+
330
+ **Required fields:**
331
+ - `CanCod`
332
+ - `legajoEstado`
333
+
334
+ **Optional fields:**
335
+ - *(none)*
336
+
337
+ ---
338
+
339
+ ## Event: `set-recibo-estado` (Set Recibo Estado)
340
+
341
+ **Required fields:**
342
+ - `CanCod`
343
+ - `reciboEstado`
344
+
345
+ **Optional fields:**
346
+ - *(none)*
347
+
348
+ ---
349
+
350
+ ## Event: `set-seguridadyhigiene-estado` (Set Seguridad y Higiene Estado)
351
+
352
+ **Required fields:**
353
+ - `CanCod`
354
+ - `seguridadyhigieneEstado`
355
+
356
+ **Optional fields:**
357
+ - *(none)*
358
+
359
+ ---
360
+
361
+ ## Event: `set-svo-estado` (Set SVO Estado)
362
+
363
+ **Required fields:**
364
+ - `CanCod`
365
+ - `svoEstado`
366
+
367
+ **Optional fields:**
368
+ - *(none)*
369
+
370
+ ---
371
+
372
+ ## Event: `mail` (Send Email)
373
+
374
+ **Required fields:**
375
+ - `source`
376
+ - `addresses`
377
+ - `template`
378
+ - `templateData`
379
+
380
+ **Optional fields:**
381
+ - *(none)*
382
+
383
+ ---
384
+