@trigger.dev/core 0.0.0-prerelease-20240603154820 → 0.0.0-prerelease-20240723165848

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 (187) hide show
  1. package/dist/api-Pl9fxB8v.d.mts +13879 -0
  2. package/dist/api-sNoooMbT.d.ts +13879 -0
  3. package/dist/{catalog-dRKTgwQ7.d.ts → catalog-H7yFiZ60.d.mts} +52 -52
  4. package/dist/{catalog-XTlJQaMn.d.mts → catalog-h79CG5Wy.d.ts} +52 -52
  5. package/dist/{manager-JkbddlcO.d.mts → common-CLW82lkt.d.mts} +280 -16
  6. package/dist/{manager-JkbddlcO.d.ts → common-CLW82lkt.d.ts} +280 -16
  7. package/dist/{eventFilterMatches-2kHImluE.d.mts → eventFilter-66NaBAMi.d.mts} +1 -3
  8. package/dist/{eventFilterMatches-2kHImluE.d.ts → eventFilter-66NaBAMi.d.ts} +1 -3
  9. package/dist/eventFilterMatches.d.mts +6 -0
  10. package/dist/eventFilterMatches.d.ts +6 -0
  11. package/dist/eventFilterMatches.js +165 -0
  12. package/dist/eventFilterMatches.js.map +1 -0
  13. package/dist/eventFilterMatches.mjs +163 -0
  14. package/dist/eventFilterMatches.mjs.map +1 -0
  15. package/dist/index.d.mts +14 -16716
  16. package/dist/index.d.ts +14 -16716
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +1 -1
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/json-DBPEJQRe.d.mts +16 -0
  22. package/dist/json-DBPEJQRe.d.ts +16 -0
  23. package/dist/manager-KvCabW1a.d.mts +18 -0
  24. package/dist/manager-OBA35PzR.d.ts +18 -0
  25. package/dist/{messages-6_-q72KG.d.mts → messages-JvHJ83wv.d.mts} +2978 -291
  26. package/dist/{messages-6_-q72KG.d.ts → messages-JvHJ83wv.d.ts} +2978 -291
  27. package/dist/replacements.d.mts +22 -0
  28. package/dist/replacements.d.ts +22 -0
  29. package/dist/replacements.js +33 -0
  30. package/dist/replacements.js.map +1 -0
  31. package/dist/replacements.mjs +28 -0
  32. package/dist/replacements.mjs.map +1 -0
  33. package/dist/requestFilter-HNZQEpQb.d.ts +180 -0
  34. package/dist/requestFilter-b5W2_1oP.d.mts +180 -0
  35. package/dist/requestFilterMatches.d.mts +13 -0
  36. package/dist/requestFilterMatches.d.ts +13 -0
  37. package/dist/requestFilterMatches.js +238 -0
  38. package/dist/requestFilterMatches.js.map +1 -0
  39. package/dist/requestFilterMatches.mjs +235 -0
  40. package/dist/requestFilterMatches.mjs.map +1 -0
  41. package/dist/retry.d.mts +10 -0
  42. package/dist/retry.d.ts +10 -0
  43. package/dist/retry.js +100 -0
  44. package/dist/retry.js.map +1 -0
  45. package/dist/retry.mjs +97 -0
  46. package/dist/retry.mjs.map +1 -0
  47. package/dist/schemas/index.d.mts +2611 -0
  48. package/dist/schemas/index.d.ts +2611 -0
  49. package/dist/schemas/index.js +1630 -0
  50. package/dist/schemas/index.js.map +1 -0
  51. package/dist/schemas/index.mjs +1463 -0
  52. package/dist/schemas/index.mjs.map +1 -0
  53. package/dist/{schemas-r4ZP9S-F.d.mts → schemas-C9ssfehv.d.mts} +270 -33
  54. package/dist/{schemas-r4ZP9S-F.d.ts → schemas-C9ssfehv.d.ts} +270 -33
  55. package/dist/taskLogger-CzADe4je.d.ts +33 -0
  56. package/dist/taskLogger-r_AFTX45.d.mts +33 -0
  57. package/dist/tracer-N0p2Fuuv.d.mts +23 -0
  58. package/dist/tracer-N0p2Fuuv.d.ts +23 -0
  59. package/dist/types.d.mts +11 -0
  60. package/dist/types.d.ts +11 -0
  61. package/dist/types.js +4 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/types.mjs +3 -0
  64. package/dist/types.mjs.map +1 -0
  65. package/dist/utils.d.mts +7 -0
  66. package/dist/utils.d.ts +7 -0
  67. package/dist/utils.js +33 -0
  68. package/dist/utils.js.map +1 -0
  69. package/dist/utils.mjs +30 -0
  70. package/dist/utils.mjs.map +1 -0
  71. package/dist/v3/dev/index.d.mts +2 -1
  72. package/dist/v3/dev/index.d.ts +2 -1
  73. package/dist/v3/dev/index.js.map +1 -1
  74. package/dist/v3/dev/index.mjs.map +1 -1
  75. package/dist/v3/errors.d.mts +39 -0
  76. package/dist/v3/errors.d.ts +39 -0
  77. package/dist/v3/errors.js +204 -0
  78. package/dist/v3/errors.js.map +1 -0
  79. package/dist/v3/errors.mjs +195 -0
  80. package/dist/v3/errors.mjs.map +1 -0
  81. package/dist/v3/index.d.mts +172 -4737
  82. package/dist/v3/index.d.ts +172 -4737
  83. package/dist/v3/index.js +871 -620
  84. package/dist/v3/index.js.map +1 -1
  85. package/dist/v3/index.mjs +856 -620
  86. package/dist/v3/index.mjs.map +1 -1
  87. package/dist/v3/logger-api.d.mts +24 -0
  88. package/dist/v3/logger-api.d.ts +24 -0
  89. package/dist/v3/logger-api.js +118 -0
  90. package/dist/v3/logger-api.js.map +1 -0
  91. package/dist/v3/logger-api.mjs +116 -0
  92. package/dist/v3/logger-api.mjs.map +1 -0
  93. package/dist/v3/otel/index.js +36 -12
  94. package/dist/v3/otel/index.js.map +1 -1
  95. package/dist/v3/otel/index.mjs +36 -12
  96. package/dist/v3/otel/index.mjs.map +1 -1
  97. package/dist/v3/prod/index.d.mts +4 -3
  98. package/dist/v3/prod/index.d.ts +4 -3
  99. package/dist/v3/prod/index.js +7 -131
  100. package/dist/v3/prod/index.js.map +1 -1
  101. package/dist/v3/prod/index.mjs +7 -131
  102. package/dist/v3/prod/index.mjs.map +1 -1
  103. package/dist/v3/schemas/index.d.mts +4807 -0
  104. package/dist/v3/schemas/index.d.ts +4807 -0
  105. package/dist/v3/schemas/index.js +2065 -0
  106. package/dist/v3/schemas/index.js.map +1 -0
  107. package/dist/v3/schemas/index.mjs +1924 -0
  108. package/dist/v3/schemas/index.mjs.map +1 -0
  109. package/dist/v3/semanticInternalAttributes.d.mts +56 -0
  110. package/dist/v3/semanticInternalAttributes.d.ts +56 -0
  111. package/dist/v3/semanticInternalAttributes.js +61 -0
  112. package/dist/v3/semanticInternalAttributes.js.map +1 -0
  113. package/dist/v3/semanticInternalAttributes.mjs +59 -0
  114. package/dist/v3/semanticInternalAttributes.mjs.map +1 -0
  115. package/dist/v3/utils/durations.d.mts +15 -0
  116. package/dist/v3/utils/durations.d.ts +15 -0
  117. package/dist/v3/utils/durations.js +93 -0
  118. package/dist/v3/utils/durations.js.map +1 -0
  119. package/dist/v3/utils/durations.mjs +82 -0
  120. package/dist/v3/utils/durations.mjs.map +1 -0
  121. package/dist/v3/utils/flattenAttributes.d.mts +8 -0
  122. package/dist/v3/utils/flattenAttributes.d.ts +8 -0
  123. package/dist/v3/utils/flattenAttributes.js +131 -0
  124. package/dist/v3/utils/flattenAttributes.js.map +1 -0
  125. package/dist/v3/utils/flattenAttributes.mjs +126 -0
  126. package/dist/v3/utils/flattenAttributes.mjs.map +1 -0
  127. package/dist/v3/utils/ioSerialization.d.mts +21 -0
  128. package/dist/v3/utils/ioSerialization.d.ts +21 -0
  129. package/dist/v3/utils/ioSerialization.js +2403 -0
  130. package/dist/v3/utils/ioSerialization.js.map +1 -0
  131. package/dist/v3/utils/ioSerialization.mjs +2394 -0
  132. package/dist/v3/utils/ioSerialization.mjs.map +1 -0
  133. package/dist/v3/utils/omit.d.mts +3 -0
  134. package/dist/v3/utils/omit.d.ts +3 -0
  135. package/dist/v3/utils/omit.js +20 -0
  136. package/dist/v3/utils/omit.js.map +1 -0
  137. package/dist/v3/utils/omit.mjs +18 -0
  138. package/dist/v3/utils/omit.mjs.map +1 -0
  139. package/dist/v3/utils/retries.d.mts +46 -0
  140. package/dist/v3/utils/retries.d.ts +46 -0
  141. package/dist/v3/utils/retries.js +118 -0
  142. package/dist/v3/utils/retries.js.map +1 -0
  143. package/dist/v3/utils/retries.mjs +113 -0
  144. package/dist/v3/utils/retries.mjs.map +1 -0
  145. package/dist/v3/utils/timers.d.mts +6 -0
  146. package/dist/v3/utils/timers.d.ts +6 -0
  147. package/dist/v3/utils/timers.js +31 -0
  148. package/dist/v3/utils/timers.js.map +1 -0
  149. package/dist/v3/utils/timers.mjs +28 -0
  150. package/dist/v3/utils/timers.mjs.map +1 -0
  151. package/dist/v3/workers/index.d.mts +56 -8
  152. package/dist/v3/workers/index.d.ts +56 -8
  153. package/dist/v3/workers/index.js +755 -279
  154. package/dist/v3/workers/index.js.map +1 -1
  155. package/dist/v3/workers/index.mjs +753 -280
  156. package/dist/v3/workers/index.mjs.map +1 -1
  157. package/dist/v3/zodIpc.js.map +1 -1
  158. package/dist/v3/zodIpc.mjs.map +1 -1
  159. package/dist/v3/zodMessageHandler.d.mts +16 -3
  160. package/dist/v3/zodMessageHandler.d.ts +16 -3
  161. package/dist/v3/zodMessageHandler.js +77 -23
  162. package/dist/v3/zodMessageHandler.js.map +1 -1
  163. package/dist/v3/zodMessageHandler.mjs +77 -23
  164. package/dist/v3/zodMessageHandler.mjs.map +1 -1
  165. package/dist/v3/zodNamespace.js +59 -28
  166. package/dist/v3/zodNamespace.js.map +1 -1
  167. package/dist/v3/zodNamespace.mjs +60 -29
  168. package/dist/v3/zodNamespace.mjs.map +1 -1
  169. package/dist/v3/zodSocket.d.mts +8 -3
  170. package/dist/v3/zodSocket.d.ts +8 -3
  171. package/dist/v3/zodSocket.js +56 -25
  172. package/dist/v3/zodSocket.js.map +1 -1
  173. package/dist/v3/zodSocket.mjs +57 -26
  174. package/dist/v3/zodSocket.mjs.map +1 -1
  175. package/dist/v3/zodfetch.d.mts +15 -58
  176. package/dist/v3/zodfetch.d.ts +15 -58
  177. package/dist/v3/zodfetch.js +246 -156
  178. package/dist/v3/zodfetch.js.map +1 -1
  179. package/dist/v3/zodfetch.mjs +244 -149
  180. package/dist/v3/zodfetch.mjs.map +1 -1
  181. package/dist/versions.d.mts +11 -0
  182. package/dist/versions.d.ts +11 -0
  183. package/dist/versions.js +31 -0
  184. package/dist/versions.js.map +1 -0
  185. package/dist/versions.mjs +27 -0
  186. package/dist/versions.mjs.map +1 -0
  187. package/package.json +154 -10
@@ -128,6 +128,4 @@ declare const EventRuleSchema: z.ZodObject<{
128
128
  }>;
129
129
  type EventRule = z.infer<typeof EventRuleSchema>;
130
130
 
131
- declare function eventFilterMatches(payload: any, filter: EventFilter): boolean;
132
-
133
- export { type EventFilter as E, EventFilterSchema as a, EventRuleSchema as b, type EventRule as c, eventFilterMatches as e, stringPatternMatchers as s };
131
+ export { type EventFilter as E, EventFilterSchema as a, EventRuleSchema as b, type EventRule as c, stringPatternMatchers as s };
@@ -128,6 +128,4 @@ declare const EventRuleSchema: z.ZodObject<{
128
128
  }>;
129
129
  type EventRule = z.infer<typeof EventRuleSchema>;
130
130
 
131
- declare function eventFilterMatches(payload: any, filter: EventFilter): boolean;
132
-
133
- export { type EventFilter as E, EventFilterSchema as a, EventRuleSchema as b, type EventRule as c, eventFilterMatches as e, stringPatternMatchers as s };
131
+ export { type EventFilter as E, EventFilterSchema as a, EventRuleSchema as b, type EventRule as c, stringPatternMatchers as s };
@@ -0,0 +1,6 @@
1
+ import { E as EventFilter } from './eventFilter-66NaBAMi.mjs';
2
+ import 'zod';
3
+
4
+ declare function eventFilterMatches(payload: any, filter: EventFilter): boolean;
5
+
6
+ export { eventFilterMatches };
@@ -0,0 +1,6 @@
1
+ import { E as EventFilter } from './eventFilter-66NaBAMi.js';
2
+ import 'zod';
3
+
4
+ declare function eventFilterMatches(payload: any, filter: EventFilter): boolean;
5
+
6
+ export { eventFilterMatches };
@@ -0,0 +1,165 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/eventFilterMatches.ts
7
+ function eventFilterMatches(payload, filter) {
8
+ if (payload === void 0 || payload === null) {
9
+ if (Object.entries(filter).length === 0) {
10
+ return true;
11
+ } else {
12
+ return false;
13
+ }
14
+ }
15
+ for (const [patternKey, patternValue] of Object.entries(filter)) {
16
+ const payloadValue = payload[patternKey];
17
+ if (Array.isArray(patternValue)) {
18
+ if (patternValue.length === 0) {
19
+ continue;
20
+ }
21
+ if (patternValue.every((item) => typeof item === "string")) {
22
+ if (patternValue.includes(payloadValue)) {
23
+ continue;
24
+ }
25
+ return false;
26
+ }
27
+ if (patternValue.every((item) => typeof item === "number")) {
28
+ if (patternValue.includes(payloadValue)) {
29
+ continue;
30
+ }
31
+ return false;
32
+ }
33
+ if (patternValue.every((item) => typeof item === "boolean")) {
34
+ if (patternValue.includes(payloadValue)) {
35
+ continue;
36
+ }
37
+ return false;
38
+ }
39
+ const objectArray = patternValue;
40
+ if (!contentFiltersMatches(payloadValue, objectArray)) {
41
+ return false;
42
+ }
43
+ continue;
44
+ } else if (typeof patternValue === "object") {
45
+ if (Array.isArray(payloadValue)) {
46
+ if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {
47
+ return false;
48
+ }
49
+ } else {
50
+ if (!eventFilterMatches(payloadValue, patternValue)) {
51
+ return false;
52
+ }
53
+ }
54
+ }
55
+ }
56
+ return true;
57
+ }
58
+ __name(eventFilterMatches, "eventFilterMatches");
59
+ function contentFiltersMatches(actualValue, contentFilters) {
60
+ for (const contentFilter of contentFilters) {
61
+ if (typeof contentFilter === "object") {
62
+ Object.entries(contentFilter)[0];
63
+ if (!contentFilterMatches(actualValue, contentFilter)) {
64
+ return false;
65
+ }
66
+ }
67
+ }
68
+ return true;
69
+ }
70
+ __name(contentFiltersMatches, "contentFiltersMatches");
71
+ function contentFilterMatches(actualValue, contentFilter) {
72
+ if ("$endsWith" in contentFilter) {
73
+ if (typeof actualValue !== "string") {
74
+ return false;
75
+ }
76
+ return actualValue.endsWith(contentFilter.$endsWith);
77
+ }
78
+ if ("$startsWith" in contentFilter) {
79
+ if (typeof actualValue !== "string") {
80
+ return false;
81
+ }
82
+ return actualValue.startsWith(contentFilter.$startsWith);
83
+ }
84
+ if ("$anythingBut" in contentFilter) {
85
+ if (Array.isArray(contentFilter.$anythingBut)) {
86
+ if (contentFilter.$anythingBut.includes(actualValue)) {
87
+ return false;
88
+ }
89
+ }
90
+ if (contentFilter.$anythingBut === actualValue) {
91
+ return false;
92
+ }
93
+ return true;
94
+ }
95
+ if ("$exists" in contentFilter) {
96
+ if (contentFilter.$exists) {
97
+ return actualValue !== void 0;
98
+ }
99
+ return actualValue === void 0;
100
+ }
101
+ if ("$gt" in contentFilter) {
102
+ if (typeof actualValue !== "number") {
103
+ return false;
104
+ }
105
+ return actualValue > contentFilter.$gt;
106
+ }
107
+ if ("$lt" in contentFilter) {
108
+ if (typeof actualValue !== "number") {
109
+ return false;
110
+ }
111
+ return actualValue < contentFilter.$lt;
112
+ }
113
+ if ("$gte" in contentFilter) {
114
+ if (typeof actualValue !== "number") {
115
+ return false;
116
+ }
117
+ return actualValue >= contentFilter.$gte;
118
+ }
119
+ if ("$lte" in contentFilter) {
120
+ if (typeof actualValue !== "number") {
121
+ return false;
122
+ }
123
+ return actualValue <= contentFilter.$lte;
124
+ }
125
+ if ("$between" in contentFilter) {
126
+ if (typeof actualValue !== "number") {
127
+ return false;
128
+ }
129
+ return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];
130
+ }
131
+ if ("$includes" in contentFilter) {
132
+ if (Array.isArray(actualValue)) {
133
+ return actualValue.includes(contentFilter.$includes);
134
+ }
135
+ return false;
136
+ }
137
+ if ("$ignoreCaseEquals" in contentFilter) {
138
+ if (typeof actualValue !== "string") {
139
+ return false;
140
+ }
141
+ return actualValue.localeCompare(contentFilter.$ignoreCaseEquals, void 0, {
142
+ sensitivity: "accent"
143
+ }) === 0;
144
+ }
145
+ if ("$isNull" in contentFilter) {
146
+ if (contentFilter.$isNull) {
147
+ return actualValue === null;
148
+ }
149
+ return actualValue !== null;
150
+ }
151
+ if ("$not" in contentFilter) {
152
+ if (Array.isArray(actualValue)) {
153
+ return !actualValue.includes(contentFilter.$not);
154
+ } else if (typeof actualValue === "number" || typeof actualValue === "boolean" || typeof actualValue === "string") {
155
+ return actualValue !== contentFilter.$not;
156
+ }
157
+ return false;
158
+ }
159
+ return true;
160
+ }
161
+ __name(contentFilterMatches, "contentFilterMatches");
162
+
163
+ exports.eventFilterMatches = eventFilterMatches;
164
+ //# sourceMappingURL=out.js.map
165
+ //# sourceMappingURL=eventFilterMatches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eventFilterMatches.ts"],"names":["eventFilterMatches","payload","filter","undefined","Object","entries","length","patternKey","patternValue","payloadValue","Array","isArray","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull","$not"],"mappings":";;;;AAMO,SAASA,mBAAmBC,SAAcC,QAA8B;AAC7E,MAAID,YAAYE,UAAaF,YAAY,MAAM;AAC7C,QAAIG,OAAOC,QAAQH,MAAAA,EAAQI,WAAW,GAAG;AACvC,aAAO;IACT,OAAO;AACL,aAAO;IACT;EACF;AAEA,aAAW,CAACC,YAAYC,YAAAA,KAAiBJ,OAAOC,QAAQH,MAAAA,GAAS;AAC/D,UAAMO,eAAeR,QAAQM,UAAAA;AAE7B,QAAIG,MAAMC,QAAQH,YAAAA,GAAe;AAC/B,UAAIA,aAAaF,WAAW,GAAG;AAC7B;MACF;AAGA,UAAKE,aAA2BI,MAAM,CAACC,SAAS,OAAOA,SAAS,QAAA,GAAW;AACzE,YAAKL,aAA0BM,SAASL,YAAAA,GAAe;AACrD;QACF;AAEA,eAAO;MACT;AAGA,UAAKD,aAA2BI,MAAM,CAACC,SAAS,OAAOA,SAAS,QAAA,GAAW;AACzE,YAAKL,aAA0BM,SAASL,YAAAA,GAAe;AACrD;QACF;AAEA,eAAO;MACT;AAGA,UAAKD,aAA2BI,MAAM,CAACC,SAAS,OAAOA,SAAS,SAAA,GAAY;AAC1E,YAAKL,aAA2BM,SAASL,YAAAA,GAAe;AACtD;QACF;AAEA,eAA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AgB,aAAa,OAAOA,gBAAgB,UAAU;AACjH,aAAOA,gBAAgBE,cAAcoB;IACvC;AAEA,WAAO;EACT;AAEA,SAAO;AACT;AAvHSjB","sourcesContent":["import { EventFilter } from \"./schemas/eventFilter\";\n\n// EventFilter is a recursive type, where the keys are strings and the values are an array of strings, numbers, booleans, or objects.\n// If the values of the array are strings, numbers, or booleans, than we are matching against the value of the payload.\n// If the values of the array are objects, then we are doing content filtering\n// An example would be [{ $endsWith: \".png\" }, { $startsWith: \"images/\" } ]\nexport function eventFilterMatches(payload: any, filter: EventFilter): boolean {\n if (payload === undefined || payload === null) {\n if (Object.entries(filter).length === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n for (const [patternKey, patternValue] of Object.entries(filter)) {\n const payloadValue = payload[patternKey];\n\n if (Array.isArray(patternValue)) {\n if (patternValue.length === 0) {\n continue;\n }\n\n // Check to see if all the items in the array are a string\n if ((patternValue as unknown[]).every((item) => typeof item === \"string\")) {\n if ((patternValue as string[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a number\n if ((patternValue as unknown[]).every((item) => typeof item === \"number\")) {\n if ((patternValue as number[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a boolean\n if ((patternValue as unknown[]).every((item) => typeof item === \"boolean\")) {\n if ((patternValue as boolean[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Now we know that all the items in the array are objects\n const objectArray = patternValue as Exclude<\n typeof patternValue,\n number[] | string[] | boolean[]\n >;\n\n if (!contentFiltersMatches(payloadValue, objectArray)) {\n return false;\n }\n\n continue;\n } else if (typeof patternValue === \"object\") {\n if (Array.isArray(payloadValue)) {\n if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {\n return false;\n }\n } else {\n if (!eventFilterMatches(payloadValue, patternValue)) {\n return false;\n }\n }\n }\n }\n return true;\n}\n\ntype ContentFilters = Exclude<EventFilter[string], EventFilter | string[] | number[] | boolean[]>;\n\nfunction contentFiltersMatches(actualValue: any, contentFilters: ContentFilters): boolean {\n for (const contentFilter of contentFilters) {\n if (typeof contentFilter === \"object\") {\n const [key, value] = Object.entries(contentFilter)[0];\n\n if (!contentFilterMatches(actualValue, contentFilter)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction contentFilterMatches(actualValue: any, contentFilter: ContentFilters[number]): boolean {\n if (\"$endsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.endsWith(contentFilter.$endsWith);\n }\n\n if (\"$startsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.startsWith(contentFilter.$startsWith);\n }\n\n if (\"$anythingBut\" in contentFilter) {\n if (Array.isArray(contentFilter.$anythingBut)) {\n if ((contentFilter.$anythingBut as any[]).includes(actualValue)) {\n return false;\n }\n }\n\n if (contentFilter.$anythingBut === actualValue) {\n return false;\n }\n\n return true;\n }\n\n if (\"$exists\" in contentFilter) {\n if (contentFilter.$exists) {\n return actualValue !== undefined;\n }\n\n return actualValue === undefined;\n }\n\n if (\"$gt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue > contentFilter.$gt;\n }\n\n if (\"$lt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue < contentFilter.$lt;\n }\n\n if (\"$gte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$gte;\n }\n\n if (\"$lte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue <= contentFilter.$lte;\n }\n\n if (\"$between\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];\n }\n\n if (\"$includes\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return actualValue.includes(contentFilter.$includes);\n }\n\n return false;\n }\n\n // Use localCompare\n if (\"$ignoreCaseEquals\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return (\n actualValue.localeCompare(contentFilter.$ignoreCaseEquals, undefined, {\n sensitivity: \"accent\",\n }) === 0\n );\n }\n\n if (\"$isNull\" in contentFilter) {\n if (contentFilter.$isNull) {\n return actualValue === null;\n }\n\n return actualValue !== null;\n }\n\n if (\"$not\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return !actualValue.includes(contentFilter.$not);\n } else if (typeof actualValue === 'number' || typeof actualValue === 'boolean' || typeof actualValue === 'string') {\n return actualValue !== contentFilter.$not;\n }\n\n return false;\n }\n\n return true;\n}\n"]}
@@ -0,0 +1,163 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/eventFilterMatches.ts
5
+ function eventFilterMatches(payload, filter) {
6
+ if (payload === void 0 || payload === null) {
7
+ if (Object.entries(filter).length === 0) {
8
+ return true;
9
+ } else {
10
+ return false;
11
+ }
12
+ }
13
+ for (const [patternKey, patternValue] of Object.entries(filter)) {
14
+ const payloadValue = payload[patternKey];
15
+ if (Array.isArray(patternValue)) {
16
+ if (patternValue.length === 0) {
17
+ continue;
18
+ }
19
+ if (patternValue.every((item) => typeof item === "string")) {
20
+ if (patternValue.includes(payloadValue)) {
21
+ continue;
22
+ }
23
+ return false;
24
+ }
25
+ if (patternValue.every((item) => typeof item === "number")) {
26
+ if (patternValue.includes(payloadValue)) {
27
+ continue;
28
+ }
29
+ return false;
30
+ }
31
+ if (patternValue.every((item) => typeof item === "boolean")) {
32
+ if (patternValue.includes(payloadValue)) {
33
+ continue;
34
+ }
35
+ return false;
36
+ }
37
+ const objectArray = patternValue;
38
+ if (!contentFiltersMatches(payloadValue, objectArray)) {
39
+ return false;
40
+ }
41
+ continue;
42
+ } else if (typeof patternValue === "object") {
43
+ if (Array.isArray(payloadValue)) {
44
+ if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {
45
+ return false;
46
+ }
47
+ } else {
48
+ if (!eventFilterMatches(payloadValue, patternValue)) {
49
+ return false;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ return true;
55
+ }
56
+ __name(eventFilterMatches, "eventFilterMatches");
57
+ function contentFiltersMatches(actualValue, contentFilters) {
58
+ for (const contentFilter of contentFilters) {
59
+ if (typeof contentFilter === "object") {
60
+ Object.entries(contentFilter)[0];
61
+ if (!contentFilterMatches(actualValue, contentFilter)) {
62
+ return false;
63
+ }
64
+ }
65
+ }
66
+ return true;
67
+ }
68
+ __name(contentFiltersMatches, "contentFiltersMatches");
69
+ function contentFilterMatches(actualValue, contentFilter) {
70
+ if ("$endsWith" in contentFilter) {
71
+ if (typeof actualValue !== "string") {
72
+ return false;
73
+ }
74
+ return actualValue.endsWith(contentFilter.$endsWith);
75
+ }
76
+ if ("$startsWith" in contentFilter) {
77
+ if (typeof actualValue !== "string") {
78
+ return false;
79
+ }
80
+ return actualValue.startsWith(contentFilter.$startsWith);
81
+ }
82
+ if ("$anythingBut" in contentFilter) {
83
+ if (Array.isArray(contentFilter.$anythingBut)) {
84
+ if (contentFilter.$anythingBut.includes(actualValue)) {
85
+ return false;
86
+ }
87
+ }
88
+ if (contentFilter.$anythingBut === actualValue) {
89
+ return false;
90
+ }
91
+ return true;
92
+ }
93
+ if ("$exists" in contentFilter) {
94
+ if (contentFilter.$exists) {
95
+ return actualValue !== void 0;
96
+ }
97
+ return actualValue === void 0;
98
+ }
99
+ if ("$gt" in contentFilter) {
100
+ if (typeof actualValue !== "number") {
101
+ return false;
102
+ }
103
+ return actualValue > contentFilter.$gt;
104
+ }
105
+ if ("$lt" in contentFilter) {
106
+ if (typeof actualValue !== "number") {
107
+ return false;
108
+ }
109
+ return actualValue < contentFilter.$lt;
110
+ }
111
+ if ("$gte" in contentFilter) {
112
+ if (typeof actualValue !== "number") {
113
+ return false;
114
+ }
115
+ return actualValue >= contentFilter.$gte;
116
+ }
117
+ if ("$lte" in contentFilter) {
118
+ if (typeof actualValue !== "number") {
119
+ return false;
120
+ }
121
+ return actualValue <= contentFilter.$lte;
122
+ }
123
+ if ("$between" in contentFilter) {
124
+ if (typeof actualValue !== "number") {
125
+ return false;
126
+ }
127
+ return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];
128
+ }
129
+ if ("$includes" in contentFilter) {
130
+ if (Array.isArray(actualValue)) {
131
+ return actualValue.includes(contentFilter.$includes);
132
+ }
133
+ return false;
134
+ }
135
+ if ("$ignoreCaseEquals" in contentFilter) {
136
+ if (typeof actualValue !== "string") {
137
+ return false;
138
+ }
139
+ return actualValue.localeCompare(contentFilter.$ignoreCaseEquals, void 0, {
140
+ sensitivity: "accent"
141
+ }) === 0;
142
+ }
143
+ if ("$isNull" in contentFilter) {
144
+ if (contentFilter.$isNull) {
145
+ return actualValue === null;
146
+ }
147
+ return actualValue !== null;
148
+ }
149
+ if ("$not" in contentFilter) {
150
+ if (Array.isArray(actualValue)) {
151
+ return !actualValue.includes(contentFilter.$not);
152
+ } else if (typeof actualValue === "number" || typeof actualValue === "boolean" || typeof actualValue === "string") {
153
+ return actualValue !== contentFilter.$not;
154
+ }
155
+ return false;
156
+ }
157
+ return true;
158
+ }
159
+ __name(contentFilterMatches, "contentFilterMatches");
160
+
161
+ export { eventFilterMatches };
162
+ //# sourceMappingURL=out.js.map
163
+ //# sourceMappingURL=eventFilterMatches.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eventFilterMatches.ts"],"names":["eventFilterMatches","payload","filter","undefined","Object","entries","length","patternKey","patternValue","payloadValue","Array","isArray","every","item","includes","objectArray","contentFiltersMatches","some","actualValue","contentFilters","contentFilter","key","value","contentFilterMatches","endsWith","$endsWith","startsWith","$startsWith","$anythingBut","$exists","$gt","$lt","$gte","$lte","$between","$includes","localeCompare","$ignoreCaseEquals","sensitivity","$isNull","$not"],"mappings":";;;;AAMO,SAASA,mBAAmBC,SAAcC,QAA8B;AAC7E,MAAID,YAA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b,eAAe;AAC/B,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WAAOA,eAAeE,cAAcc,SAAS,CAAA,KAAMhB,eAAeE,cAAcc,SAAS,CAAA;EAC3F;AAEA,MAAI,eAAed,eAAe;AAChC,QAAIV,MAAMC,QAAQO,WAAAA,GAAc;AAC9B,aAAOA,YAAYJ,SAASM,cAAce,SAAS;IACrD;AAEA,WAAO;EACT;AAGA,MAAI,uBAAuBf,eAAe;AACxC,QAAI,OAAOF,gBAAgB,UAAU;AACnC,aAAO;IACT;AAEA,WACEA,YAAYkB,cAAchB,cAAciB,mBAAmBlC,QAAW;MACpEmC,aAAa;IACf,CAAA,MAAO;EAEX;AAEA,MAAI,aAAalB,eAAe;AAC9B,QAAIA,cAAcmB,SAAS;AACzB,aAAOrB,gBAAgB;IACzB;AAEA,WAAOA,gBAAgB;EACzB;AAEA,MAAI,UAAUE,eAAe;AAC3B,QAAIV,MAAMC,QAAQO,WAAAA,GAAc;AAC9B,aAAO,CAACA,YAAYJ,SAASM,cAAcoB,IAAI;IACjD,WAAW,OAAOtB,gBAAgB,YAAY,OAAOA,gBAAgB,aAAa,OAAOA,gBAAgB,UAAU;AACjH,aAAOA,gBAAgBE,cAAcoB;IACvC;AAEA,WAAO;EACT;AAEA,SAAO;AACT;AAvHSjB","sourcesContent":["import { EventFilter } from \"./schemas/eventFilter\";\n\n// EventFilter is a recursive type, where the keys are strings and the values are an array of strings, numbers, booleans, or objects.\n// If the values of the array are strings, numbers, or booleans, than we are matching against the value of the payload.\n// If the values of the array are objects, then we are doing content filtering\n// An example would be [{ $endsWith: \".png\" }, { $startsWith: \"images/\" } ]\nexport function eventFilterMatches(payload: any, filter: EventFilter): boolean {\n if (payload === undefined || payload === null) {\n if (Object.entries(filter).length === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n for (const [patternKey, patternValue] of Object.entries(filter)) {\n const payloadValue = payload[patternKey];\n\n if (Array.isArray(patternValue)) {\n if (patternValue.length === 0) {\n continue;\n }\n\n // Check to see if all the items in the array are a string\n if ((patternValue as unknown[]).every((item) => typeof item === \"string\")) {\n if ((patternValue as string[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a number\n if ((patternValue as unknown[]).every((item) => typeof item === \"number\")) {\n if ((patternValue as number[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Check to see if all the items in the array are a boolean\n if ((patternValue as unknown[]).every((item) => typeof item === \"boolean\")) {\n if ((patternValue as boolean[]).includes(payloadValue)) {\n continue;\n }\n\n return false;\n }\n\n // Now we know that all the items in the array are objects\n const objectArray = patternValue as Exclude<\n typeof patternValue,\n number[] | string[] | boolean[]\n >;\n\n if (!contentFiltersMatches(payloadValue, objectArray)) {\n return false;\n }\n\n continue;\n } else if (typeof patternValue === \"object\") {\n if (Array.isArray(payloadValue)) {\n if (!payloadValue.some((item) => eventFilterMatches(item, patternValue))) {\n return false;\n }\n } else {\n if (!eventFilterMatches(payloadValue, patternValue)) {\n return false;\n }\n }\n }\n }\n return true;\n}\n\ntype ContentFilters = Exclude<EventFilter[string], EventFilter | string[] | number[] | boolean[]>;\n\nfunction contentFiltersMatches(actualValue: any, contentFilters: ContentFilters): boolean {\n for (const contentFilter of contentFilters) {\n if (typeof contentFilter === \"object\") {\n const [key, value] = Object.entries(contentFilter)[0];\n\n if (!contentFilterMatches(actualValue, contentFilter)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction contentFilterMatches(actualValue: any, contentFilter: ContentFilters[number]): boolean {\n if (\"$endsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.endsWith(contentFilter.$endsWith);\n }\n\n if (\"$startsWith\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return actualValue.startsWith(contentFilter.$startsWith);\n }\n\n if (\"$anythingBut\" in contentFilter) {\n if (Array.isArray(contentFilter.$anythingBut)) {\n if ((contentFilter.$anythingBut as any[]).includes(actualValue)) {\n return false;\n }\n }\n\n if (contentFilter.$anythingBut === actualValue) {\n return false;\n }\n\n return true;\n }\n\n if (\"$exists\" in contentFilter) {\n if (contentFilter.$exists) {\n return actualValue !== undefined;\n }\n\n return actualValue === undefined;\n }\n\n if (\"$gt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue > contentFilter.$gt;\n }\n\n if (\"$lt\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue < contentFilter.$lt;\n }\n\n if (\"$gte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$gte;\n }\n\n if (\"$lte\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue <= contentFilter.$lte;\n }\n\n if (\"$between\" in contentFilter) {\n if (typeof actualValue !== \"number\") {\n return false;\n }\n\n return actualValue >= contentFilter.$between[0] && actualValue <= contentFilter.$between[1];\n }\n\n if (\"$includes\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return actualValue.includes(contentFilter.$includes);\n }\n\n return false;\n }\n\n // Use localCompare\n if (\"$ignoreCaseEquals\" in contentFilter) {\n if (typeof actualValue !== \"string\") {\n return false;\n }\n\n return (\n actualValue.localeCompare(contentFilter.$ignoreCaseEquals, undefined, {\n sensitivity: \"accent\",\n }) === 0\n );\n }\n\n if (\"$isNull\" in contentFilter) {\n if (contentFilter.$isNull) {\n return actualValue === null;\n }\n\n return actualValue !== null;\n }\n\n if (\"$not\" in contentFilter) {\n if (Array.isArray(actualValue)) {\n return !actualValue.includes(contentFilter.$not);\n } else if (typeof actualValue === 'number' || typeof actualValue === 'boolean' || typeof actualValue === 'string') {\n return actualValue !== contentFilter.$not;\n }\n\n return false;\n }\n\n return true;\n}\n"]}