@schafevormfenster/rest-commons 0.1.10 → 0.1.11

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 (55) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-check.log +127 -125
  3. package/.turbo/turbo-lint.log +4 -0
  4. package/dist/api-schemas/health.schema.js +2 -2
  5. package/dist/api-schemas/paginated-results.schema.js +1 -1
  6. package/dist/api-schemas/partial-results.schema.js +1 -1
  7. package/dist/api-schemas/result.schema.js +1 -1
  8. package/dist/api-schemas/results.schema.js +1 -1
  9. package/dist/helpers/correlation/get-correlation-id.js +1 -1
  10. package/dist/helpers/detect-mime-type.js +4 -4
  11. package/dist/helpers/parameter-validation.js +1 -1
  12. package/dist/helpers/response-headers/build-api-unauthorized-headers.js +1 -1
  13. package/dist/helpers/response-headers/resolve-environment.d.ts +1 -1
  14. package/dist/helpers/response-headers/resolve-environment.d.ts.map +1 -1
  15. package/dist/index.d.ts +33 -33
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +33 -33
  18. package/dist/primitives/geo-point.schema.js +2 -2
  19. package/dist/primitives/latitude.schema.js +1 -1
  20. package/dist/primitives/location.schema.js +1 -1
  21. package/dist/primitives/longitude.schema.js +1 -1
  22. package/dist/primitives/slug.schema.js +2 -2
  23. package/dist/time/bounded-time.schema.d.ts.map +1 -1
  24. package/dist/time/bounded-time.schema.js +19 -15
  25. package/dist/time/flexible-time-parser.d.ts +1 -1
  26. package/dist/time/flexible-time-parser.d.ts.map +1 -1
  27. package/dist/time/flexible-time-parser.js +2 -2
  28. package/dist/time/flexible-time.schema.js +3 -3
  29. package/dist/time/relative-time.schema.js +1 -1
  30. package/dist/time/time-helpers.js +2 -2
  31. package/dist/time/time-schemas.js +1 -1
  32. package/package.json +4 -4
  33. package/src/api-schemas/health.schema.ts +2 -2
  34. package/src/api-schemas/paginated-results.schema.ts +1 -1
  35. package/src/api-schemas/partial-results.schema.ts +1 -1
  36. package/src/api-schemas/result.schema.ts +1 -1
  37. package/src/api-schemas/results.schema.ts +1 -1
  38. package/src/helpers/correlation/get-correlation-id.ts +1 -1
  39. package/src/helpers/detect-mime-type.ts +4 -4
  40. package/src/helpers/parameter-validation.ts +1 -1
  41. package/src/helpers/process-eventify-request.ts +2 -2
  42. package/src/helpers/response-headers/build-api-unauthorized-headers.ts +1 -1
  43. package/src/helpers/response-headers/resolve-environment.ts +1 -1
  44. package/src/index.ts +33 -33
  45. package/src/primitives/geo-point.schema.ts +2 -2
  46. package/src/primitives/latitude.schema.ts +1 -1
  47. package/src/primitives/location.schema.ts +1 -1
  48. package/src/primitives/longitude.schema.ts +1 -1
  49. package/src/primitives/slug.schema.ts +2 -2
  50. package/src/time/bounded-time.schema.ts +19 -15
  51. package/src/time/flexible-time-parser.ts +2 -2
  52. package/src/time/flexible-time.schema.ts +3 -3
  53. package/src/time/relative-time.schema.ts +1 -1
  54. package/src/time/time-helpers.ts +2 -2
  55. package/src/time/time-schemas.ts +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @schafevormfenster/rest-commons@0.1.4 build /Users/jan-henrik.hempel/Projects/commons/packages/rest-commons
2
+ > @schafevormfenster/rest-commons@0.1.10 build /Users/jan-henrik.hempel/Projects/commons/packages/rest-commons
3
3
  > tsc
4
4
 
@@ -19,166 +19,168 @@
19
19
   RUN  v4.0.18 /Users/jan-henrik.hempel/Projects/commons/packages/rest-commons
20
20
 
21
21
  [?2026h
22
-  ❯ src/helpers/correlation/get-header.test.ts [queued]
22
+  ❯ src/helpers/parameter-validation.test.ts [queued]
23
23
 
24
24
   Test Files 0 passed (45)
25
25
   Tests 0 passed (0)
26
-  Start at 11:59:38
27
-  Duration 103ms
28
- [?2026l[?2026h ✓ src/helpers/correlation/get-header.test.ts (15 tests) 12ms
29
- ✓ src/time/time-schemas.test.ts (24 tests) 12ms
30
- ✓ src/helpers/correlation/get-correlation-id.test.ts (11 tests) 19ms
31
- ✓ src/time/since-parameter.schema.test.ts (6 tests) 6ms
32
- ✓ src/time/flexible-time-parser.test.ts (63 tests) 15ms
26
+  Start at 05:41:42
27
+  Duration 101ms
28
+ [?2026l[?2026h ✓ src/helpers/correlation/get-header.test.ts (15 tests) 11ms
29
+ ✓ src/helpers/correlation/get-correlation-id.test.ts (11 tests) 14ms
30
+ ✓ src/primitives/international-zip.schema.test.ts (29 tests) 5ms
31
+ {"level":50,"time":1777268502565,"pid":20367,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: html.script_tag"}
32
+ ✓ src/helpers/parameter-validation.test.ts (5 tests) 5ms
33
+ {"level":50,"time":1777268502566,"pid":20367,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"sql.drop_table\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: sql.drop_table"}
34
+ {"level":50,"time":1777268502566,"pid":20367,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"slug\",\"suspiciousPatterns\":[\"url.embedded\"],\"error\":\"Parameter 'slug' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'slug' contains suspicious patterns: url.embedded"}
35
+ {"level":50,"time":1777268502566,"pid":20367,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"id\",\"suspiciousPatterns\":[\"prompt.injection.language\"],\"error\":\"Parameter 'id' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'id' contains suspicious patterns: prompt.injection.language"}
33
36
 
34
37
   ❯ src/helpers/correlation/get-correlation-id.test.ts 11/11
35
38
   ❯ src/helpers/correlation/get-header.test.ts 15/15
39
+  ❯ src/helpers/parameter-validation.test.ts 5/5
36
40
   ❯ src/normalization/normalize-list.test.ts [queued]
37
-  ❯ src/time/bounded-time.schema.test.ts 1/33
38
-  ❯ src/time/flexible-time-parser.test.ts 63/63
39
-  ❯ src/time/since-parameter.schema.test.ts 6/6
40
-  ❯ src/time/time-schemas.test.ts 24/24
41
+  ❯ src/primitives/international-zip.schema.test.ts 29/29
42
+  ❯ src/time/bounded-time.schema.test.ts 0/33
43
+  ❯ src/time/flexible-time-parser.test.ts 1/63
41
44
   ❯ src/time/time.schema.test.ts 0/26
42
45
   ❯ src/time/timezone-independence.test.ts [queued]
43
46
 
44
-  Test Files 5 passed (45)
45
-  Tests 120 passed (178)
46
-  Start at 11:59:38
47
-  Duration 203ms
48
- [?2026l[?2026h ✓ src/time/bounded-time.schema.test.ts (33 tests) 9ms
49
- ✓ src/time/time.schema.test.ts (26 tests) 14ms
50
- ✓ src/time/timezone-independence.test.ts (13 tests) 18ms
51
- ✓ src/time/iso8601.types.test.ts (17 tests) 7ms
52
- {"level":50,"time":1722007200000,"pid":48199,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"invalid\",\"error\":\"Invalid relative time format: invalid\"}","name":"ObjectError"},"msg":"Invalid relative time format: invalid"}
53
- {"level":50,"time":1722007200000,"pid":48199,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"1x\",\"error\":\"Invalid relative time format: 1x\"}","name":"ObjectError"},"msg":"Invalid relative time format: 1x"}
54
- {"level":50,"time":1722007200000,"pid":48199,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"\",\"error\":\"Invalid relative time format: \"}","name":"ObjectError"},"msg":"Invalid relative time format: "}
55
- ✓ src/time/parse-relative-time.test.ts (6 tests) 5ms
56
- ✓ src/primitives/latitude.schema.test.ts (8 tests) 5ms
47
+  Test Files 4 passed (45)
48
+  Tests 61 passed (182)
49
+  Start at 05:41:42
50
+  Duration 200ms
51
+ [?2026l[?2026h ✓ src/time/flexible-time-parser.test.ts (63 tests) 16ms
52
+ ✓ src/time/time.schema.test.ts (26 tests) 12ms
53
+ ✓ src/time/bounded-time.schema.test.ts (33 tests) 16ms
54
+ ✓ src/time/timezone-independence.test.ts (13 tests) 9ms
55
+ ✓ src/time/time-schemas.test.ts (24 tests) 15ms
57
56
 
58
-  ❯ src/api-schemas/health.schema.test.ts 0/9
59
57
   ❯ src/normalization/normalize-list.test.ts [queued]
60
-  ❯ src/primitives/geo-point.schema.test.ts [queued]
61
-  ❯ src/primitives/latitude.schema.test.ts 8/8
62
-  ❯ src/primitives/slug.schema.test.ts [queued]
63
-  ❯ src/time/iso8601.types.test.ts 17/17
64
-  ❯ src/time/parse-relative-time.test.ts 6/6
58
+  ❯ src/time/bounded-time.schema.test.ts 33/33
59
+  ❯ src/time/flexible-time-parser.test.ts 63/63
60
+  ❯ src/time/parse-relative-time.test.ts [queued]
61
+  ❯ src/time/since-parameter.schema.test.ts 1/6
65
62
   ❯ src/time/time-helpers.test.ts [queued]
63
+  ❯ src/time/time-schemas.test.ts 24/24
64
+  ❯ src/time/time.schema.test.ts 26/26
66
65
   ❯ src/time/timezone-independence.test.ts 13/13
67
66
 
68
-  Test Files 11 passed (45)
69
-  Tests 222 passed (231)
70
-  Start at 11:59:38
71
-  Duration 303ms
72
- [?2026l[?2026h ✓ src/api-schemas/health.schema.test.ts (9 tests) 6ms
67
+  Test Files 9 passed (45)
68
+  Tests 220 passed (225)
69
+  Start at 05:41:42
70
+  Duration 300ms
71
+ [?2026l[?2026h ✓ src/time/since-parameter.schema.test.ts (6 tests) 6ms
73
72
  ✓ src/time/time-helpers.test.ts (42 tests) 6ms
74
- ✓ src/primitives/geo-point.schema.test.ts (7 tests) 5ms
75
- {"level":50,"time":1770724778401,"pid":48200,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"slug\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'slug' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'slug' contains suspicious patterns: html.script_tag"}
76
- ✓ src/api-schemas/results.schema.test.ts (3 tests) 5ms
77
- ✓ src/primitives/slug.schema.test.ts (15 tests) 9ms
78
- {"level":40,"time":1770724778409,"pid":48194,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"security.sanitizeTag","original":" banana ","sanitized":"banana","reason":"tag-sanitized","msg":"Tag input sanitized"}
79
- {"level":40,"time":1770724778416,"pid":48194,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"security.sanitizeTag","original":" apple ","sanitized":"apple","reason":"tag-sanitized","msg":"Tag input sanitized"}
80
- ✓ src/normalization/normalize-list.test.ts (4 tests) 9ms
73
+ {"level":40,"time":1777268502696,"pid":20369,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"security.sanitizeTag","original":" banana ","sanitized":"banana","reason":"tag-sanitized","msg":"Tag input sanitized"}
74
+ {"level":40,"time":1777268502708,"pid":20369,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"security.sanitizeTag","original":" apple ","sanitized":"apple","reason":"tag-sanitized","msg":"Tag input sanitized"}
75
+ ✓ src/normalization/normalize-list.test.ts (4 tests) 14ms
76
+ {"level":50,"time":1722007200000,"pid":20374,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"invalid\",\"error\":\"Invalid relative time format: invalid\"}","name":"ObjectError"},"msg":"Invalid relative time format: invalid"}
77
+ {"level":50,"time":1722007200000,"pid":20374,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"1x\",\"error\":\"Invalid relative time format: 1x\"}","name":"ObjectError"},"msg":"Invalid relative time format: 1x"}
78
+ {"level":50,"time":1722007200000,"pid":20374,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.relative-time-parser","error":{"message":"{\"relativeTime\":\"\",\"error\":\"Invalid relative time format: \"}","name":"ObjectError"},"msg":"Invalid relative time format: "}
79
+ ✓ src/time/parse-relative-time.test.ts (6 tests) 5ms
80
+ ✓ src/api-schemas/results.schema.test.ts (3 tests) 6ms
81
+ ✓ src/primitives/latitude.schema.test.ts (8 tests) 4ms
82
+ ✓ src/primitives/longitude.schema.test.ts (8 tests) 5ms
83
+ ✓ src/time/flexible-time.schema.test.ts (36 tests) 12ms
81
84
 
82
85
   ❯ src/api-schemas/results.schema.test.ts 3/3
83
86
   ❯ src/normalization/normalize-list.test.ts 4/4
84
-  ❯ src/primitives/geo-point.schema.test.ts 7/7
85
-  ❯ src/primitives/geoname-id.schema.test.ts [queued]
86
-  ❯ src/primitives/slug.schema.test.ts 15/15
87
-  ❯ src/primitives/wikidata-id.schema.test.ts [queued]
88
-  ❯ src/time/boundary-enforcement.test.ts 0/12
89
-  ❯ src/time/flexible-time.schema.test.ts [queued]
87
+  ❯ src/primitives/geoname-id.schema.test.ts 0/7
88
+  ❯ src/primitives/latitude.schema.test.ts 8/8
89
+  ❯ src/primitives/longitude.schema.test.ts 8/8
90
+  ❯ src/time/boundary-enforcement.test.ts [queued]
91
+  ❯ src/time/flexible-time.schema.test.ts 36/36
92
+  ❯ src/time/parse-relative-time.test.ts 6/6
90
93
   ❯ src/time/time-helpers.test.ts 42/42
91
94
 
92
95
   Test Files 17 passed (45)
93
-  Tests 302 passed (314)
94
-  Start at 11:59:38
95
-  Duration 403ms
96
- [?2026l[?2026h{"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2024-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
97
- {"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2020-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
98
- {"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2025-02-15T12:00:00.000Z","clampedValue":"2025-01-15T12:00:00.000Z","boundary":"maximum (+12m)","msg":"Calendar update query testField clamped to maximum boundary"}
99
- {"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2030-01-01T12:00:00.000Z","clampedValue":"2025-01-15T12:00:00.000Z","boundary":"maximum (+12m)","msg":"Calendar update query testField clamped to maximum boundary"}
100
- {"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2024-01-10T12:00:00.000Z","clampedValue":"2026-02-03T11:59:38.473Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
101
- {"level":40,"time":1770724778473,"pid":48206,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"customFieldName","originalValue":"2024-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query customFieldName clamped to minimum boundary"}
96
+  Tests 332 passed (339)
97
+  Start at 05:41:42
98
+  Duration 400ms
99
+ [?2026l[?2026h ✓ src/primitives/geoname-id.schema.test.ts (7 tests) 4ms
100
+ {"level":40,"time":1777268502824,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2024-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
101
+ {"level":40,"time":1777268502825,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2020-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
102
+ {"level":40,"time":1777268502825,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2025-02-15T12:00:00.000Z","clampedValue":"2025-01-15T12:00:00.000Z","boundary":"maximum (+12m)","msg":"Calendar update query testField clamped to maximum boundary"}
103
+ {"level":40,"time":1777268502826,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2030-01-01T12:00:00.000Z","clampedValue":"2025-01-15T12:00:00.000Z","boundary":"maximum (+12m)","msg":"Calendar update query testField clamped to maximum boundary"}
104
+ {"level":40,"time":1777268502826,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"testField","originalValue":"2024-01-10T12:00:00.000Z","clampedValue":"2026-04-20T05:41:42.826Z","boundary":"minimum (-1w)","msg":"Calendar update query testField clamped to minimum boundary"}
105
+ {"level":40,"time":1777268502827,"pid":20383,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"helpers.time.boundary-enforcement","field":"customFieldName","originalValue":"2024-01-01T12:00:00.000Z","clampedValue":"2024-01-08T12:00:00.000Z","boundary":"minimum (-1w)","msg":"Calendar update query customFieldName clamped to minimum boundary"}
102
106
  ✓ src/time/boundary-enforcement.test.ts (12 tests) 5ms
103
- ✓ src/primitives/geoname-id.schema.test.ts (7 tests) 4ms
104
- ✓ src/primitives/wikidata-id.schema.test.ts (8 tests) 3ms
105
- ✓ src/time/flexible-time.schema.test.ts (36 tests) 10ms
106
- ✓ src/helpers/mime-types/detect-ole-mime-type.test.ts (10 tests) 2ms
107
+ ✓ src/primitives/uuid.schema.test.ts (5 tests) 5ms
107
108
  ✓ src/helpers/eventify-constants.test.ts (9 tests) 4ms
108
- ✓ src/api-schemas/okay.schema.test.ts (2 tests) 4ms
109
- {"level":50,"time":1770724778538,"pid":48218,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: html.script_tag"}
110
- ✓ src/primitives/location.schema.test.ts (3 tests) 5ms
111
- ✓ src/primitives/international-zip.schema.test.ts (29 tests) 8ms
112
-
113
-  ❯ src/api-schemas/okay.schema.test.ts 2/2
114
-  ❯ src/helpers/eventify-constants.test.ts 9/9
115
-  ❯ src/helpers/mime-types/detect-ole-mime-type.test.ts 10/10
116
-  ❯ src/primitives/geoname-id.schema.test.ts 7/7
117
-  ❯ src/primitives/international-zip.schema.test.ts 29/29
118
-  ❯ src/primitives/location.schema.test.ts 3/3
119
-  ❯ src/primitives/wikidata-id.schema.test.ts 8/8
120
-  ❯ src/time/flexible-time.schema.test.ts 36/36
121
-  ❯ src/time/relative-time.schema.test.ts [queued]
122
-
123
-  Test Files 26 passed (45)
124
-  Tests 418 passed (418)
125
-  Start at 11:59:38
126
-  Duration 503ms
127
- [?2026l[?2026h ✓ src/primitives/uuid.schema.test.ts (5 tests) 2ms
128
- ✓ src/time/relative-time.schema.test.ts (2 tests) 4ms
129
- ✓ src/time/timezone.types.test.ts (4 tests) 4ms
109
+ ✓ src/primitives/wikidata-id.schema.test.ts (8 tests) 6ms
110
+ ✓ src/api-schemas/result.schema.test.ts (2 tests) 5ms
130
111
  ✓ src/helpers/hash-binary.test.ts (7 tests) 3ms
131
- ✓ src/primitives/longitude.schema.test.ts (8 tests) 6ms
132
- ✓ src/api-schemas/result.schema.test.ts (2 tests) 4ms
133
- ✓ src/helpers/eventify-constants.types.test.ts (9 tests) 2ms
134
- {"level":50,"time":1770724778675,"pid":48230,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: html.script_tag"}
135
- {"level":50,"time":1770724778676,"pid":48230,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"sql.drop_table\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: sql.drop_table"}
136
- {"level":50,"time":1770724778676,"pid":48230,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"slug\",\"suspiciousPatterns\":[\"url.embedded\"],\"error\":\"Parameter 'slug' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'slug' contains suspicious patterns: url.embedded"}
137
- {"level":50,"time":1770724778676,"pid":48230,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"id\",\"suspiciousPatterns\":[\"prompt.injection.language\"],\"error\":\"Parameter 'id' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'id' contains suspicious patterns: prompt.injection.language"}
112
+ ✓ src/api-schemas/health.schema.test.ts (9 tests) 4ms
138
113
 
114
+  ❯ src/api-schemas/error.schema.test.ts 1/3
115
+  ❯ src/api-schemas/health.schema.test.ts 9/9
139
116
   ❯ src/api-schemas/result.schema.test.ts 2/2
140
-  ❯ src/helpers/eventify-constants.types.test.ts 9/9
117
+  ❯ src/helpers/eventify-constants.test.ts 9/9
141
118
   ❯ src/helpers/hash-binary.test.ts 7/7
142
-  ❯ src/helpers/parameter-validation.test.ts 0/5
143
-  ❯ src/primitives/longitude.schema.test.ts 8/8
144
-  ❯ src/primitives/numeric-id.schema.test.ts 0/5
119
+  ❯ src/primitives/geo-point.schema.test.ts [queued]
145
120
   ❯ src/primitives/uuid.schema.test.ts 5/5
146
-  ❯ src/time/relative-time.schema.test.ts 2/2
121
+  ❯ src/primitives/wikidata-id.schema.test.ts 8/8
122
+  ❯ src/time/boundary-enforcement.test.ts 12/12
123
+
124
+  Test Files 25 passed (45)
125
+  Tests 392 passed (394)
126
+  Start at 05:41:42
127
+  Duration 501ms
128
+ [?2026l[?2026h ✓ src/api-schemas/error.schema.test.ts (3 tests) 5ms
129
+ ✓ src/primitives/geo-point.schema.test.ts (7 tests) 6ms
130
+ ✓ src/normalization/normalize-location.test.ts (13 tests) 3ms
131
+ ✓ src/time/timezone.types.test.ts (4 tests) 5ms
132
+
133
+  ❯ src/api-schemas/error.schema.test.ts 3/3
134
+  ❯ src/helpers/mime-types/detect-image-mime-type.test.ts [queued]
135
+  ❯ src/helpers/slugify.test.ts 0/13
136
+  ❯ src/normalization/normalize-location.test.ts 13/13
137
+  ❯ src/primitives/geo-point.schema.test.ts 7/7
138
+  ❯ src/primitives/numeric-id.schema.test.ts [queued]
139
+  ❯ src/primitives/slug.schema.test.ts 0/15
140
+  ❯ src/time/iso8601.types.test.ts 0/17
147
141
   ❯ src/time/timezone.types.test.ts 4/4
148
142
 
149
-  Test Files 33 passed (45)
150
-  Tests 455 passed (465)
151
-  Start at 11:59:38
152
-  Duration 603ms
153
- [?2026l[?2026h ✓ src/helpers/parameter-validation.test.ts (5 tests) 4ms
154
- ✓ src/primitives/numeric-id.schema.test.ts (5 tests) 5ms
155
- ✓ src/primitives/coordinate-precision.test.ts (6 tests) 3ms
156
- ✓ src/helpers/slugify.test.ts (13 tests) 4ms
157
- ✓ src/helpers/detect-suspicious-patterns.test.ts (6 tests) 4ms
158
- ✓ src/api-schemas/error.schema.test.ts (3 tests) 5ms
159
- ✓ src/helpers/mime-types/detect-image-mime-type.test.ts (11 tests) 1ms
160
-
161
-
162
-
163
-  ❯ src/helpers/detect-mime-type.test.ts [queued]
164
-  ❯ src/helpers/mime-types/detect-pdf-mime-type.test.ts [queued]
165
-  ❯ src/helpers/mime-types/detect-zip-mime-type.test.ts 0/9
166
-  ❯ src/normalization/normalize-location.test.ts 0/13
167
-
168
-  Test Files 40 passed (45)
169
-  Tests 504 passed (526)
170
-  Start at 11:59:38
171
-  Duration 703ms
172
- [?2026l ✓ src/helpers/mime-types/detect-pdf-mime-type.test.ts (6 tests) 1ms
173
- ✓ src/helpers/mime-types/detect-zip-mime-type.test.ts (9 tests) 1ms
174
- ✓ src/normalization/normalize-location.test.ts (13 tests) 2ms
175
- ✓ src/helpers/detect-mime-type.test.ts (12 tests) 2ms
143
+  Test Files 29 passed (45)
144
+  Tests 418 passed (463)
145
+  Start at 05:41:42
146
+  Duration 601ms
147
+ [?2026l[?2026h{"level":50,"time":1777268502996,"pid":20395,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"slug\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'slug' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'slug' contains suspicious patterns: html.script_tag"}
148
+ ✓ src/time/iso8601.types.test.ts (17 tests) 7ms
149
+ ✓ src/primitives/slug.schema.test.ts (15 tests) 4ms
150
+ ✓ src/helpers/slugify.test.ts (13 tests) 3ms
151
+ ✓ src/helpers/mime-types/detect-image-mime-type.test.ts (11 tests) 2ms
152
+ ✓ src/primitives/numeric-id.schema.test.ts (5 tests) 2ms
153
+ ✓ src/helpers/detect-suspicious-patterns.test.ts (6 tests) 3ms
154
+ ✓ src/helpers/detect-mime-type.test.ts (12 tests) 4ms
155
+
156
+  ❯ src/api-schemas/okay.schema.test.ts [queued]
157
+  ❯ src/helpers/detect-suspicious-patterns.test.ts 6/6
158
+  ❯ src/helpers/eventify-constants.types.test.ts 1/9
159
+  ❯ src/helpers/mime-types/detect-image-mime-type.test.ts 11/11
160
+  ❯ src/helpers/slugify.test.ts 13/13
161
+  ❯ src/primitives/location.schema.test.ts [queued]
162
+  src/primitives/numeric-id.schema.test.ts 5/5
163
+  src/primitives/slug.schema.test.ts 15/15
164
+
165
+  Test Files 36 passed (45)
166
+  Tests 498 passed (506)
167
+  Start at 05:41:42
168
+  Duration 701ms
169
+ [?2026l ✓ src/helpers/eventify-constants.types.test.ts (9 tests) 3ms
170
+ ✓ src/api-schemas/okay.schema.test.ts (2 tests) 2ms
171
+ ✓ src/helpers/mime-types/detect-ole-mime-type.test.ts (10 tests) 2ms
172
+ ✓ src/primitives/coordinate-precision.test.ts (6 tests) 2ms
173
+ ✓ src/helpers/mime-types/detect-pdf-mime-type.test.ts (6 tests) 1ms
174
+ ✓ src/helpers/mime-types/detect-zip-mime-type.test.ts (9 tests) 2ms
175
+ ✓ src/time/relative-time.schema.test.ts (2 tests) 2ms
176
+ {"level":50,"time":1777268503133,"pid":20406,"hostname":"Jan--Schafe-vorm-Fenster.local","name":"rest.helpers.parameter-validation","error":{"message":"{\"parameterName\":\"location\",\"suspiciousPatterns\":[\"html.script_tag\"],\"error\":\"Parameter 'location' contains suspicious patterns\"}","name":"ObjectError"},"msg":"Parameter 'location' contains suspicious patterns: html.script_tag"}
177
+ ✓ src/primitives/location.schema.test.ts (3 tests) 2ms
176
178
  ✓ src/time/is-relative-time.test.ts (2 tests) 1ms
177
179
 
178
180
   Test Files  45 passed (45)
179
181
   Tests  546 passed (546)
180
-  Start at  11:59:38
181
-  Duration  803ms (transform 1.04s, setup 0ms, import 1.87s, tests 269ms, environment 3ms)
182
+  Start at  05:41:42
183
+  Duration  807ms (transform 975ms, setup 0ms, import 1.81s, tests 258ms, environment 3ms)
182
184
 
183
185
  [?25h
184
186
  > @schafevormfenster/rest-commons@0.1.10 build /Users/jan-henrik.hempel/Projects/commons/packages/rest-commons
@@ -0,0 +1,4 @@
1
+
2
+ > @schafevormfenster/rest-commons@0.1.10 lint /Users/jan-henrik.hempel/Projects/commons/packages/rest-commons
3
+ > eslint
4
+
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { ApiErrorSchema } from "./error.schema";
3
- import { OkaySchema } from "./okay.schema";
2
+ import { ApiErrorSchema } from "./error.schema.js";
3
+ import { OkaySchema } from "./okay.schema.js";
4
4
  /**
5
5
  * Services
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ResultsSchema } from "./results.schema";
2
+ import { ResultsSchema } from "./results.schema.js";
3
3
  export const PaginationSchema = z.object({
4
4
  page: z.number().describe("Current page number"),
5
5
  limit: z.number().describe("Maximum results per page"),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ResultsSchema } from "./results.schema";
2
+ import { ResultsSchema } from "./results.schema.js";
3
3
  /**
4
4
  * Schema for partial success responses where some items succeeded and others failed.
5
5
  * Extends ResultsSchema with an errors count field.
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { OkaySchema } from "./okay.schema";
2
+ import { OkaySchema } from "./okay.schema.js";
3
3
  export const ResultSchema = OkaySchema.extend({
4
4
  timestamp: z.string().transform((value) => new Date(value).toISOString()),
5
5
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ResultSchema } from "./result.schema";
2
+ import { ResultSchema } from "./result.schema.js";
3
3
  export const ResultsSchema = ResultSchema.extend({
4
4
  results: z.number(),
5
5
  });
@@ -1,4 +1,4 @@
1
- import { getHeader } from "./get-header";
1
+ import { getHeader } from "./get-header.js";
2
2
  export function getCorrelationId(request) {
3
3
  const existingId = getHeader(request, "x-correlation-id");
4
4
  if (existingId && typeof existingId === "string" && existingId.length > 0) {
@@ -1,7 +1,7 @@
1
- import { detectImageMimeType } from "./mime-types/detect-image-mime-type";
2
- import { detectOleMimeType } from "./mime-types/detect-ole-mime-type";
3
- import { detectPdfMimeType } from "./mime-types/detect-pdf-mime-type";
4
- import { detectZipMimeType } from "./mime-types/detect-zip-mime-type";
1
+ import { detectImageMimeType } from "./mime-types/detect-image-mime-type.js";
2
+ import { detectOleMimeType } from "./mime-types/detect-ole-mime-type.js";
3
+ import { detectPdfMimeType } from "./mime-types/detect-pdf-mime-type.js";
4
+ import { detectZipMimeType } from "./mime-types/detect-zip-mime-type.js";
5
5
  /**
6
6
  * Detect MIME type from file magic bytes (file signature)
7
7
  *
@@ -1,5 +1,5 @@
1
1
  import { getLogger } from "@schafevormfenster/logging";
2
- import { detectSuspiciousPatternsFromBody } from "./detect-suspicious-patterns";
2
+ import { detectSuspiciousPatternsFromBody } from "./detect-suspicious-patterns.js";
3
3
  const log = getLogger("rest.helpers.parameter-validation");
4
4
  /**
5
5
  * Validates that a string parameter does not contain suspicious patterns
@@ -1,5 +1,5 @@
1
1
  import { getApiSecurityHeaders } from "@schafevormfenster/security";
2
- import { resolveEnvironment } from "./resolve-environment";
2
+ import { resolveEnvironment } from "./resolve-environment.js";
3
3
  /**
4
4
  * Build a consistent set of headers for unauthorized API responses, including
5
5
  * security headers and correlation id propagation.
@@ -1,4 +1,4 @@
1
- import { type Environment } from "./environment.types";
1
+ import { type Environment } from "./environment.types.js";
2
2
  /**
3
3
  * Resolve environment consistently across server/middleware contexts.
4
4
  * - VERCEL_ENV: production | preview | development
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-environment.d.ts","sourceRoot":"","sources":["../../../src/helpers/response-headers/resolve-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAShD"}
1
+ {"version":3,"file":"resolve-environment.d.ts","sourceRoot":"","sources":["../../../src/helpers/response-headers/resolve-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAShD"}
package/dist/index.d.ts CHANGED
@@ -1,34 +1,34 @@
1
- export * from "./api-schemas/error.schema";
2
- export * from "./api-schemas/health.schema";
3
- export * from "./api-schemas/okay.schema";
4
- export * from "./api-schemas/result.schema";
5
- export * from "./api-schemas/results.schema";
6
- export * from "./primitives/location.schema";
7
- export * from "./primitives/slug.schema";
8
- export * from "./primitives/numeric-id.schema";
9
- export * from "./primitives/uuid.schema";
10
- export * from "./primitives/geoname-id.schema";
11
- export * from "./primitives/wikidata-id.schema";
12
- export * from "./primitives/international-zip.schema";
13
- export * from "./time/timezone.types";
14
- export * from "./time/iso8601.schema";
15
- export * from "./time/relative-time.schema";
16
- export * from "./time/flexible-time.schema";
17
- export * from "./time/bounded-time.schema";
18
- export * from "./time/time-helpers";
19
- export * from "./time/is-relative-time";
20
- export { parseFlexibleTime as parseFlexibleTimeAdvanced } from "./time/flexible-time-parser";
21
- export * from "./time/boundary-enforcement";
22
- export * from "./helpers/correlation/get-correlation-id";
23
- export * from "./helpers/correlation/get-header";
24
- export * from "./helpers/detect-mime-type";
25
- export * from "./helpers/detect-suspicious-patterns";
26
- export * from "./helpers/hash-binary";
27
- export * from "./helpers/parameter-validation";
28
- export * from "./helpers/slugify";
29
- export * from "./helpers/response-headers/build-api-unauthorized-headers";
30
- export * from "./helpers/response-headers/environment.types";
31
- export * from "./helpers/response-headers/resolve-environment";
32
- export * from "./normalization/normalize-list";
33
- export * from "./normalization/normalize-location";
1
+ export * from "./api-schemas/error.schema.js";
2
+ export * from "./api-schemas/health.schema.js";
3
+ export * from "./api-schemas/okay.schema.js";
4
+ export * from "./api-schemas/result.schema.js";
5
+ export * from "./api-schemas/results.schema.js";
6
+ export * from "./primitives/location.schema.js";
7
+ export * from "./primitives/slug.schema.js";
8
+ export * from "./primitives/numeric-id.schema.js";
9
+ export * from "./primitives/uuid.schema.js";
10
+ export * from "./primitives/geoname-id.schema.js";
11
+ export * from "./primitives/wikidata-id.schema.js";
12
+ export * from "./primitives/international-zip.schema.js";
13
+ export * from "./time/timezone.types.js";
14
+ export * from "./time/iso8601.schema.js";
15
+ export * from "./time/relative-time.schema.js";
16
+ export * from "./time/flexible-time.schema.js";
17
+ export * from "./time/bounded-time.schema.js";
18
+ export * from "./time/time-helpers.js";
19
+ export * from "./time/is-relative-time.js";
20
+ export { parseFlexibleTime as parseFlexibleTimeAdvanced } from "./time/flexible-time-parser.js";
21
+ export * from "./time/boundary-enforcement.js";
22
+ export * from "./helpers/correlation/get-correlation-id.js";
23
+ export * from "./helpers/correlation/get-header.js";
24
+ export * from "./helpers/detect-mime-type.js";
25
+ export * from "./helpers/detect-suspicious-patterns.js";
26
+ export * from "./helpers/hash-binary.js";
27
+ export * from "./helpers/parameter-validation.js";
28
+ export * from "./helpers/slugify.js";
29
+ export * from "./helpers/response-headers/build-api-unauthorized-headers.js";
30
+ export * from "./helpers/response-headers/environment.types.js";
31
+ export * from "./helpers/response-headers/resolve-environment.js";
32
+ export * from "./normalization/normalize-list.js";
33
+ export * from "./normalization/normalize-location.js";
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,cAAc,6BAA6B,CAAC;AAG5C,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2DAA2D,CAAC;AAC1E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gDAAgD,CAAC;AAG/D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AAGzD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChG,cAAc,gCAAgC,CAAC;AAG/C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8DAA8D,CAAC;AAC7E,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAGlE,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC"}