@castleio/sdk 2.2.2 → 2.3.1

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 (72) hide show
  1. package/CHANGELOG.md +79 -65
  2. package/README.md +14 -15
  3. package/dist/package.json +28 -25
  4. package/dist/src/Castle.d.ts +8 -1
  5. package/dist/src/Castle.js +35 -0
  6. package/dist/src/Castle.js.map +1 -1
  7. package/dist/src/api/services/api-batch-upsert-list-items.service.d.ts +5 -0
  8. package/dist/src/api/services/api-batch-upsert-list-items.service.js +26 -0
  9. package/dist/src/api/services/api-batch-upsert-list-items.service.js.map +1 -0
  10. package/dist/src/api/services/api-count-list-items.service.d.ts +5 -0
  11. package/dist/src/api/services/api-count-list-items.service.js +26 -0
  12. package/dist/src/api/services/api-count-list-items.service.js.map +1 -0
  13. package/dist/src/api/services/api-delete-user-data.service.d.ts +5 -0
  14. package/dist/src/api/services/api-delete-user-data.service.js +26 -0
  15. package/dist/src/api/services/api-delete-user-data.service.js.map +1 -0
  16. package/dist/src/api/services/api-get-events-schema.service.d.ts +5 -0
  17. package/dist/src/api/services/api-get-events-schema.service.js +26 -0
  18. package/dist/src/api/services/api-get-events-schema.service.js.map +1 -0
  19. package/dist/src/api/services/api-group-events.service.d.ts +5 -0
  20. package/dist/src/api/services/api-group-events.service.js +26 -0
  21. package/dist/src/api/services/api-group-events.service.js.map +1 -0
  22. package/dist/src/api/services/api-request-user-data.service.d.ts +5 -0
  23. package/dist/src/api/services/api-request-user-data.service.js +26 -0
  24. package/dist/src/api/services/api-request-user-data.service.js.map +1 -0
  25. package/dist/src/api/services/api-search-events.service.d.ts +5 -0
  26. package/dist/src/api/services/api-search-events.service.js +26 -0
  27. package/dist/src/api/services/api-search-events.service.js.map +1 -0
  28. package/dist/src/api/services/index.d.ts +7 -0
  29. package/dist/src/api/services/index.js +7 -0
  30. package/dist/src/api/services/index.js.map +1 -1
  31. package/dist/src/command/services/command-batch-upsert-list-items.service.d.ts +16 -0
  32. package/dist/src/command/services/command-batch-upsert-list-items.service.js +12 -0
  33. package/dist/src/command/services/command-batch-upsert-list-items.service.js.map +1 -0
  34. package/dist/src/command/services/command-count-list-items.service.d.ts +16 -0
  35. package/dist/src/command/services/command-count-list-items.service.js +12 -0
  36. package/dist/src/command/services/command-count-list-items.service.js.map +1 -0
  37. package/dist/src/command/services/command-delete-user-data.service.d.ts +16 -0
  38. package/dist/src/command/services/command-delete-user-data.service.js +10 -0
  39. package/dist/src/command/services/command-delete-user-data.service.js.map +1 -0
  40. package/dist/src/command/services/command-generate.service.d.ts +3 -2
  41. package/dist/src/command/services/command-generate.service.js.map +1 -1
  42. package/dist/src/command/services/command-get-events-schema.service.d.ts +15 -0
  43. package/dist/src/command/services/command-get-events-schema.service.js +10 -0
  44. package/dist/src/command/services/command-get-events-schema.service.js.map +1 -0
  45. package/dist/src/command/services/command-group-events.service.d.ts +16 -0
  46. package/dist/src/command/services/command-group-events.service.js +10 -0
  47. package/dist/src/command/services/command-group-events.service.js.map +1 -0
  48. package/dist/src/command/services/command-request-user-data.service.d.ts +16 -0
  49. package/dist/src/command/services/command-request-user-data.service.js +10 -0
  50. package/dist/src/command/services/command-request-user-data.service.js.map +1 -0
  51. package/dist/src/command/services/command-search-events.service.d.ts +16 -0
  52. package/dist/src/command/services/command-search-events.service.js +10 -0
  53. package/dist/src/command/services/command-search-events.service.js.map +1 -0
  54. package/dist/src/command/services/index.d.ts +7 -0
  55. package/dist/src/command/services/index.js +7 -0
  56. package/dist/src/command/services/index.js.map +1 -1
  57. package/dist/src/payload/models/event_payload.d.ts +89 -0
  58. package/dist/src/payload/models/event_payload.js +29 -0
  59. package/dist/src/payload/models/event_payload.js.map +1 -0
  60. package/dist/src/payload/models/event_response.d.ts +346 -0
  61. package/dist/src/payload/models/event_response.js +51 -0
  62. package/dist/src/payload/models/event_response.js.map +1 -0
  63. package/dist/src/payload/models/filter_payload.d.ts +33 -10
  64. package/dist/src/payload/models/index.d.ts +3 -0
  65. package/dist/src/payload/models/index.js +3 -0
  66. package/dist/src/payload/models/index.js.map +1 -1
  67. package/dist/src/payload/models/list_item_payload.d.ts +16 -2
  68. package/dist/src/payload/models/privacy_payload.d.ts +8 -0
  69. package/dist/src/payload/models/privacy_payload.js +3 -0
  70. package/dist/src/payload/models/privacy_payload.js.map +1 -0
  71. package/dist/src/payload/models/risk_payload.d.ts +33 -8
  72. package/package.json +28 -25
@@ -0,0 +1,346 @@
1
+ export type SearchEventsResponse = {
2
+ data: Event[];
3
+ total_count: number;
4
+ };
5
+ export type Event = {
6
+ id: string;
7
+ type: string;
8
+ status: string;
9
+ risk: number | null;
10
+ signals: Array<EventSignal>;
11
+ properties: Record<string, string | number | boolean | object | Array<string> | Array<string | number | boolean>>;
12
+ product: {
13
+ id: string;
14
+ };
15
+ device: {
16
+ fingerprint: string;
17
+ user_agent?: string;
18
+ hardware?: {
19
+ type: string;
20
+ name: string | null;
21
+ brand: string | null;
22
+ display: {
23
+ width: number;
24
+ height: number;
25
+ };
26
+ model?: {
27
+ name: string | null;
28
+ code: string | null;
29
+ };
30
+ };
31
+ os?: {
32
+ name: string;
33
+ version: {
34
+ major: string;
35
+ full: string | null;
36
+ };
37
+ };
38
+ software?: {
39
+ type: string;
40
+ name: string;
41
+ languages: Array<string>;
42
+ version: {
43
+ major: string;
44
+ full: string;
45
+ };
46
+ fingerprint: string;
47
+ };
48
+ timezone?: {
49
+ offset?: number;
50
+ name?: string;
51
+ };
52
+ screen?: {
53
+ screen?: number;
54
+ orientation?: string;
55
+ };
56
+ };
57
+ ip: {
58
+ asn: number;
59
+ location: {
60
+ city: string;
61
+ continent_code: string;
62
+ country_code: string;
63
+ postal_code: string;
64
+ region_code: string;
65
+ latitude: number;
66
+ longitude: number;
67
+ };
68
+ address: string;
69
+ isp: {
70
+ name?: string;
71
+ organization?: string;
72
+ };
73
+ type: string;
74
+ privacy?: {
75
+ anonymous?: boolean;
76
+ datacenter?: boolean;
77
+ proxy?: boolean;
78
+ tor?: boolean;
79
+ };
80
+ };
81
+ policy: {
82
+ name: string;
83
+ id: string;
84
+ revision_id: string | null;
85
+ action: string | null;
86
+ response?: {
87
+ status_code: number;
88
+ body: string;
89
+ headers: Array<{
90
+ name?: string;
91
+ value?: string;
92
+ }>;
93
+ } | null;
94
+ };
95
+ user: {
96
+ id: string;
97
+ registered_at: string;
98
+ last_seen_at: string;
99
+ risk: number | null;
100
+ devices_count: number | null;
101
+ name: string | null;
102
+ email: string | null;
103
+ phone: string | null;
104
+ traits?: Record<string, string | number | boolean | object>;
105
+ address?: {
106
+ country_code: string;
107
+ line1?: string;
108
+ line2?: string;
109
+ city?: string;
110
+ region_code?: string;
111
+ postal_code?: string;
112
+ fingerprint?: string;
113
+ };
114
+ };
115
+ created_at: string;
116
+ params?: {
117
+ email?: string;
118
+ phone?: string;
119
+ username?: string;
120
+ };
121
+ transaction?: {
122
+ type: string;
123
+ id: string;
124
+ base_amount?: string;
125
+ amount?: {
126
+ type: string;
127
+ value: string;
128
+ currency: string;
129
+ };
130
+ payment_method?: {
131
+ type: string;
132
+ fingerprint?: string;
133
+ holder_name?: string;
134
+ bank_name?: string;
135
+ country_code?: string;
136
+ billing_address?: {
137
+ line1?: string;
138
+ line2?: string;
139
+ city?: string;
140
+ country_code?: string;
141
+ region_code?: string;
142
+ postal_code?: string;
143
+ fingerprint?: string;
144
+ };
145
+ card?: {
146
+ bin?: string;
147
+ last4?: string;
148
+ exp_month?: number;
149
+ exp_year?: number;
150
+ network?: string;
151
+ funding?: string;
152
+ };
153
+ };
154
+ shipping_address?: {
155
+ country_code: string;
156
+ line1?: string;
157
+ line2?: string;
158
+ city?: string;
159
+ region_code?: string;
160
+ postal_code?: string;
161
+ fingerprint?: string;
162
+ };
163
+ merchant?: {
164
+ id?: string;
165
+ name?: string;
166
+ category?: {
167
+ code?: string;
168
+ description?: string;
169
+ };
170
+ address?: {
171
+ country_code: string;
172
+ line1?: string;
173
+ line2?: string;
174
+ city?: string;
175
+ region_code?: string;
176
+ postal_code?: string;
177
+ fingerprint?: string;
178
+ };
179
+ };
180
+ };
181
+ authentication_method?: {
182
+ type: EventAuthenticationMethod;
183
+ variant?: string;
184
+ email?: string;
185
+ phone?: string;
186
+ };
187
+ page?: {
188
+ name: string;
189
+ url: string;
190
+ referrer?: string;
191
+ };
192
+ screen?: {
193
+ name: string;
194
+ };
195
+ scores?: {
196
+ account_sharing?: {
197
+ score: number;
198
+ };
199
+ account_takeover?: {
200
+ score: number;
201
+ };
202
+ bot?: {
203
+ score: number;
204
+ };
205
+ multi_accounting?: {
206
+ score: number;
207
+ };
208
+ spoofed_device?: {
209
+ score: number;
210
+ };
211
+ spoofed_location?: {
212
+ score: number;
213
+ };
214
+ unified?: {
215
+ score: number;
216
+ };
217
+ };
218
+ changeset?: {
219
+ [key: string]: {
220
+ changed: boolean;
221
+ };
222
+ } | {
223
+ from: string | null;
224
+ to: string | null;
225
+ };
226
+ };
227
+ export declare enum EventSignal {
228
+ ABUSE_IP = "abuse_ip",
229
+ BOT_BEHAVIOR = "bot_behavior",
230
+ CREDENTIAL_STUFFING = "credential_stuffing",
231
+ DISPOSABLE_EMAIL_DOMAIN = "disposable_email_domain",
232
+ GENERATED_EMAIL = "generated_email",
233
+ HEADLESS_BROWSER = "headless_browser",
234
+ HTTP_CLIENT_LIBRARY = "http_client_library",
235
+ IMPOSSIBLE_TRAVEL = "impossible_travel",
236
+ INVALID_EMAIL = "invalid_email",
237
+ INVALID_DEVICE_DATA = "invalid_device_data",
238
+ MISSING_DEVICE_DATA = "missing_device_data",
239
+ MISSING_HEADERS = "missing_headers",
240
+ MULTIPLE_ACCOUNTS_PER_DEVICE = "multiple_accounts_per_device",
241
+ MULTIPLE_ALIASES_PER_EMAIL = "multiple_aliases_per_email",
242
+ NEW_COUNTRY = "new_country",
243
+ NEW_DEVICE = "new_device",
244
+ NEW_DEVICE_TYPE = "new_device_type",
245
+ NEW_ISP = "new_isp",
246
+ NEW_LANGUAGE = "new_language",
247
+ NEW_OS = "new_os",
248
+ HIGH_ACTIVITY_DEVICE = "high_activity_device",
249
+ HIGH_ACTIVITY_IP = "high_activity_ip",
250
+ HIGH_ACTIVITY_ACCOUNT = "high_activity_account",
251
+ SPOOFED_DEVICE = "spoofed_device",
252
+ WEB_CRAWLER = "web_crawler"
253
+ }
254
+ export declare enum EventAuthenticationMethod {
255
+ AUTHENTICATOR = "$authenticator",
256
+ BIOMETRICS = "$biometrics",
257
+ EMAIL = "$email",
258
+ PASSWORD = "$password",
259
+ PHONE = "$phone",
260
+ PUSH = "$push",
261
+ SECURITY_KEY = "$security_key",
262
+ SOCIAL = "$social",
263
+ SSO = "$sso",
264
+ KBA = "$kba",
265
+ ELECTRONIC_ID = "$electronic_id",
266
+ PHYSICAL_ID = "$physical_id",
267
+ DOCUMENT = "$document",
268
+ VIDEO = "$video",
269
+ PASSKEY = "$passkey",
270
+ OTHER = "$other"
271
+ }
272
+ export type Op = '$eq' | '$neq' | '$in' | '$nin' | '$range' | '$exists' | '$nexists' | '$geo' | '$like' | '$nlike' | '$contains' | '$ncontains' | '$starts_with' | '$nstarts_with' | '$ends_with' | '$nends_with' | '$ip_range' | '$nip_range';
273
+ export type Func = '$sum' | '$last' | '$avg' | '$min' | '$max' | '$count' | '$top_k' | '$date_histogram' | '$count_unique';
274
+ export type DataType = 'array' | 'boolean' | 'datetime' | 'decimal' | 'integer' | 'ip' | 'map' | 'number' | 'string' | 'uuid';
275
+ export type Transform = '$to_end_of_interval';
276
+ export type NumberLike = number | string;
277
+ export type Source = 'ios' | 'android' | 'web';
278
+ export type SearchField = {
279
+ field: string;
280
+ op: Op[];
281
+ func: Func[];
282
+ type: DataType[];
283
+ nice_name: string;
284
+ description: string;
285
+ transform?: Transform[];
286
+ min?: NumberLike;
287
+ max?: NumberLike;
288
+ source?: Source[];
289
+ example?: string;
290
+ unit?: string;
291
+ };
292
+ export type CountBucket = {
293
+ name: string;
294
+ field: string;
295
+ type: '$count';
296
+ options?: {
297
+ size?: {
298
+ data_type: string;
299
+ };
300
+ };
301
+ };
302
+ export type DateHistogramBucket = {
303
+ name: string;
304
+ field: string;
305
+ type: '$date_histogram';
306
+ options: {
307
+ interval: {
308
+ required: boolean;
309
+ data_type: string;
310
+ enum: string;
311
+ };
312
+ time_zone: string;
313
+ min?: {
314
+ data_type: string;
315
+ format?: string[];
316
+ };
317
+ max?: {
318
+ data_type: string;
319
+ format?: string[];
320
+ };
321
+ size: {
322
+ data_type: string;
323
+ };
324
+ };
325
+ };
326
+ export type RangeBucket = {
327
+ name: string;
328
+ field: string;
329
+ type: '$range';
330
+ options: {
331
+ ranges: {
332
+ required: boolean;
333
+ data_type: 'string' | 'number';
334
+ };
335
+ };
336
+ };
337
+ export type Bucket = CountBucket | DateHistogramBucket | RangeBucket;
338
+ export type GetEventsSchemaResponse = {
339
+ fields: SearchField[];
340
+ buckets: Bucket[];
341
+ };
342
+ export type GroupEventsResponse = {
343
+ data: GroupEvent[];
344
+ total_count: number;
345
+ };
346
+ export type GroupEvent = object;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventAuthenticationMethod = exports.EventSignal = void 0;
4
+ var EventSignal;
5
+ (function (EventSignal) {
6
+ EventSignal["ABUSE_IP"] = "abuse_ip";
7
+ EventSignal["BOT_BEHAVIOR"] = "bot_behavior";
8
+ EventSignal["CREDENTIAL_STUFFING"] = "credential_stuffing";
9
+ EventSignal["DISPOSABLE_EMAIL_DOMAIN"] = "disposable_email_domain";
10
+ EventSignal["GENERATED_EMAIL"] = "generated_email";
11
+ EventSignal["HEADLESS_BROWSER"] = "headless_browser";
12
+ EventSignal["HTTP_CLIENT_LIBRARY"] = "http_client_library";
13
+ EventSignal["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
14
+ EventSignal["INVALID_EMAIL"] = "invalid_email";
15
+ EventSignal["INVALID_DEVICE_DATA"] = "invalid_device_data";
16
+ EventSignal["MISSING_DEVICE_DATA"] = "missing_device_data";
17
+ EventSignal["MISSING_HEADERS"] = "missing_headers";
18
+ EventSignal["MULTIPLE_ACCOUNTS_PER_DEVICE"] = "multiple_accounts_per_device";
19
+ EventSignal["MULTIPLE_ALIASES_PER_EMAIL"] = "multiple_aliases_per_email";
20
+ EventSignal["NEW_COUNTRY"] = "new_country";
21
+ EventSignal["NEW_DEVICE"] = "new_device";
22
+ EventSignal["NEW_DEVICE_TYPE"] = "new_device_type";
23
+ EventSignal["NEW_ISP"] = "new_isp";
24
+ EventSignal["NEW_LANGUAGE"] = "new_language";
25
+ EventSignal["NEW_OS"] = "new_os";
26
+ EventSignal["HIGH_ACTIVITY_DEVICE"] = "high_activity_device";
27
+ EventSignal["HIGH_ACTIVITY_IP"] = "high_activity_ip";
28
+ EventSignal["HIGH_ACTIVITY_ACCOUNT"] = "high_activity_account";
29
+ EventSignal["SPOOFED_DEVICE"] = "spoofed_device";
30
+ EventSignal["WEB_CRAWLER"] = "web_crawler";
31
+ })(EventSignal || (exports.EventSignal = EventSignal = {}));
32
+ var EventAuthenticationMethod;
33
+ (function (EventAuthenticationMethod) {
34
+ EventAuthenticationMethod["AUTHENTICATOR"] = "$authenticator";
35
+ EventAuthenticationMethod["BIOMETRICS"] = "$biometrics";
36
+ EventAuthenticationMethod["EMAIL"] = "$email";
37
+ EventAuthenticationMethod["PASSWORD"] = "$password";
38
+ EventAuthenticationMethod["PHONE"] = "$phone";
39
+ EventAuthenticationMethod["PUSH"] = "$push";
40
+ EventAuthenticationMethod["SECURITY_KEY"] = "$security_key";
41
+ EventAuthenticationMethod["SOCIAL"] = "$social";
42
+ EventAuthenticationMethod["SSO"] = "$sso";
43
+ EventAuthenticationMethod["KBA"] = "$kba";
44
+ EventAuthenticationMethod["ELECTRONIC_ID"] = "$electronic_id";
45
+ EventAuthenticationMethod["PHYSICAL_ID"] = "$physical_id";
46
+ EventAuthenticationMethod["DOCUMENT"] = "$document";
47
+ EventAuthenticationMethod["VIDEO"] = "$video";
48
+ EventAuthenticationMethod["PASSKEY"] = "$passkey";
49
+ EventAuthenticationMethod["OTHER"] = "$other";
50
+ })(EventAuthenticationMethod || (exports.EventAuthenticationMethod = EventAuthenticationMethod = {}));
51
+ //# sourceMappingURL=event_response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event_response.js","sourceRoot":"","sources":["../../../../src/payload/models/event_response.ts"],"names":[],"mappings":";;;AA8OA,IAAY,WA0BX;AA1BD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,4CAA6B,CAAA;IAC7B,0DAA2C,CAAA;IAC3C,kEAAmD,CAAA;IACnD,kDAAmC,CAAA;IACnC,oDAAqC,CAAA;IACrC,0DAA2C,CAAA;IAC3C,sDAAuC,CAAA;IACvC,8CAA+B,CAAA;IAC/B,0DAA2C,CAAA;IAC3C,0DAA2C,CAAA;IAC3C,kDAAmC,CAAA;IACnC,4EAA6D,CAAA;IAC7D,wEAAyD,CAAA;IACzD,0CAA2B,CAAA;IAC3B,wCAAyB,CAAA;IACzB,kDAAmC,CAAA;IACnC,kCAAmB,CAAA;IACnB,4CAA6B,CAAA;IAC7B,gCAAiB,CAAA;IACjB,4DAA6C,CAAA;IAC7C,oDAAqC,CAAA;IACrC,8DAA+C,CAAA;IAC/C,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;AAC7B,CAAC,EA1BW,WAAW,2BAAX,WAAW,QA0BtB;AAED,IAAY,yBAiBX;AAjBD,WAAY,yBAAyB;IACnC,6DAAgC,CAAA;IAChC,uDAA0B,CAAA;IAC1B,6CAAgB,CAAA;IAChB,mDAAsB,CAAA;IACtB,6CAAgB,CAAA;IAChB,2CAAc,CAAA;IACd,2DAA8B,CAAA;IAC9B,+CAAkB,CAAA;IAClB,yCAAY,CAAA;IACZ,yCAAY,CAAA;IACZ,6DAAgC,CAAA;IAChC,yDAA4B,CAAA;IAC5B,mDAAsB,CAAA;IACtB,6CAAgB,CAAA;IAChB,iDAAoB,CAAA;IACpB,6CAAgB,CAAA;AAClB,CAAC,EAjBW,yBAAyB,yCAAzB,yBAAyB,QAiBpC"}
@@ -1,6 +1,5 @@
1
1
  import type { IncomingHttpHeaders } from 'http2';
2
- export type FilterPayload = {
3
- request_token: string;
2
+ type BaseFilterPayload = {
4
3
  user?: {
5
4
  email?: string;
6
5
  phone?: string;
@@ -14,12 +13,6 @@ export type FilterPayload = {
14
13
  properties?: {
15
14
  [key: string]: any;
16
15
  };
17
- context: {
18
- ip: string;
19
- headers: IncomingHttpHeaders | {
20
- [key: string]: string | boolean;
21
- };
22
- };
23
16
  product?: {
24
17
  id: string;
25
18
  };
@@ -36,10 +29,40 @@ export type FilterPayload = {
36
29
  };
37
30
  status?: string;
38
31
  name?: string;
39
- skip_request_token_validation?: boolean;
40
- skip_context_validation?: boolean;
41
32
  } & ({
42
33
  event: string;
43
34
  } | {
44
35
  type: string;
45
36
  });
37
+ type Context = {
38
+ ip: string;
39
+ headers: IncomingHttpHeaders | {
40
+ [key: string]: string | boolean;
41
+ };
42
+ };
43
+ type RequiredContextAndToken = BaseFilterPayload & {
44
+ request_token: string;
45
+ context: Context;
46
+ skip_request_token_validation?: false;
47
+ skip_context_validation?: false;
48
+ };
49
+ type SkipRequestToken = BaseFilterPayload & {
50
+ request_token?: string;
51
+ context: Context;
52
+ skip_request_token_validation: true;
53
+ skip_context_validation?: false;
54
+ };
55
+ type SkipContext = BaseFilterPayload & {
56
+ request_token: string;
57
+ context?: Context;
58
+ skip_request_token_validation?: false;
59
+ skip_context_validation: true;
60
+ };
61
+ type SkipBoth = BaseFilterPayload & {
62
+ request_token?: string;
63
+ context?: Context;
64
+ skip_request_token_validation: true;
65
+ skip_context_validation: true;
66
+ };
67
+ export type FilterPayload = RequiredContextAndToken | SkipRequestToken | SkipContext | SkipBoth;
68
+ export {};
@@ -6,3 +6,6 @@ export * from './list_item_payload';
6
6
  export * from './list-payload';
7
7
  export * from './address_payload';
8
8
  export * from './device_payload';
9
+ export * from './event_payload';
10
+ export * from './event_response';
11
+ export * from './privacy_payload';
@@ -22,4 +22,7 @@ __exportStar(require("./list_item_payload"), exports);
22
22
  __exportStar(require("./list-payload"), exports);
23
23
  __exportStar(require("./address_payload"), exports);
24
24
  __exportStar(require("./device_payload"), exports);
25
+ __exportStar(require("./event_payload"), exports);
26
+ __exportStar(require("./event_response"), exports);
27
+ __exportStar(require("./privacy_payload"), exports);
25
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,mDAAiC;AACjC,gDAA8B;AAC9B,iDAA+B;AAC/B,sDAAoC;AACpC,iDAA+B;AAC/B,oDAAkC;AAClC,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/payload/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,mDAAiC;AACjC,gDAA8B;AAC9B,iDAA+B;AAC/B,sDAAoC;AACpC,iDAA+B;AAC/B,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC"}
@@ -4,8 +4,7 @@ export type ListItemPayload = {
4
4
  id: string;
5
5
  list_id: string;
6
6
  };
7
- export type CreateListItemPayload = {
8
- list_id: string;
7
+ export type FullListItemPayload = {
9
8
  primary_value: string;
10
9
  author: {
11
10
  type: ListItemAuthorType;
@@ -16,6 +15,9 @@ export type CreateListItemPayload = {
16
15
  auto_archives_at?: string;
17
16
  mode?: ListItemMode;
18
17
  };
18
+ export type CreateListItemPayload = {
19
+ list_id: string;
20
+ } & FullListItemPayload;
19
21
  export type UpdateListItemPayload = ListItemPayload & {
20
22
  comment: string;
21
23
  };
@@ -29,3 +31,15 @@ export type SearchListItemsPayload = {
29
31
  page?: number;
30
32
  results_size?: number;
31
33
  };
34
+ export type BatchUpsertListItemsPayload = {
35
+ list_id: string;
36
+ items: FullListItemPayload[];
37
+ };
38
+ export type CountListItemsPayload = {
39
+ list_id: string;
40
+ filters?: {
41
+ field: string;
42
+ op: string;
43
+ value: string | boolean;
44
+ }[];
45
+ };
@@ -0,0 +1,8 @@
1
+ export type RequestUserDataPayload = {
2
+ identifier: string;
3
+ identifier_type: '$id' | '$email';
4
+ };
5
+ export type DeleteUserDataPayload = {
6
+ identifier: string;
7
+ identifier_type: '$id' | '$email';
8
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=privacy_payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy_payload.js","sourceRoot":"","sources":["../../../../src/payload/models/privacy_payload.ts"],"names":[],"mappings":""}
@@ -1,7 +1,6 @@
1
1
  import type { IncomingHttpHeaders } from 'http2';
2
2
  import type { AddressPayload } from './address_payload';
3
- export type RiskPayload = {
4
- request_token: string;
3
+ type BaseRiskPayload = {
5
4
  user: {
6
5
  id: string;
7
6
  phone?: string;
@@ -18,12 +17,6 @@ export type RiskPayload = {
18
17
  properties?: {
19
18
  [key: string]: any;
20
19
  };
21
- context: {
22
- ip: string;
23
- headers: IncomingHttpHeaders | {
24
- [key: string]: string | boolean;
25
- };
26
- };
27
20
  created_at?: string;
28
21
  product?: {
29
22
  id: string;
@@ -48,3 +41,35 @@ export type RiskPayload = {
48
41
  } | {
49
42
  type: string;
50
43
  });
44
+ type Context = {
45
+ ip: string;
46
+ headers: IncomingHttpHeaders | {
47
+ [key: string]: string | boolean;
48
+ };
49
+ };
50
+ type RequiredContextAndToken = BaseRiskPayload & {
51
+ request_token: string;
52
+ context: Context;
53
+ skip_request_token_validation?: false;
54
+ skip_context_validation?: false;
55
+ };
56
+ type SkipRequestToken = BaseRiskPayload & {
57
+ request_token?: string;
58
+ context: Context;
59
+ skip_request_token_validation: true;
60
+ skip_context_validation?: false;
61
+ };
62
+ type SkipContext = BaseRiskPayload & {
63
+ request_token: string;
64
+ context?: Context;
65
+ skip_request_token_validation?: false;
66
+ skip_context_validation: true;
67
+ };
68
+ type SkipBoth = BaseRiskPayload & {
69
+ request_token?: string;
70
+ context?: Context;
71
+ skip_request_token_validation: true;
72
+ skip_context_validation: true;
73
+ };
74
+ export type RiskPayload = RequiredContextAndToken | SkipRequestToken | SkipContext | SkipBoth;
75
+ export {};
package/package.json CHANGED
@@ -2,8 +2,9 @@
2
2
  "$schema": "http://json.schemastore.org/package",
3
3
  "name": "@castleio/sdk",
4
4
  "description": "Castle SDK for Node",
5
- "version": "2.2.2",
5
+ "version": "2.3.1",
6
6
  "main": "dist/index.js",
7
+ "type": "module",
7
8
  "repository": "git@github.com:castle/castle-node.git",
8
9
  "author": {
9
10
  "name": "castle.io",
@@ -19,6 +20,8 @@
19
20
  "test": "jest",
20
21
  "lint-fix": "eslint --fix --quiet '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
21
22
  "lint-verify": "eslint '{src,test}/**/*.{js,ts,tsx}' '*.{js,ts,tsx}'",
23
+ "format": "yarn run prettier --write '{src,test}/**/*.{js,ts,tsx,yml,yaml,json,md}' '*.{js,ts,tsx,yml,yaml,json,md}'",
24
+ "format:check": "yarn run prettier --check '{src,test}/**/*.{js,ts,tsx,yml,yaml,json,md}' '*.{js,ts,tsx,yml,yaml,json,md}'",
22
25
  "prepush": "yarn build && yarn lint-fix",
23
26
  "prepublishOnly": "yarn build"
24
27
  },
@@ -31,34 +34,34 @@
31
34
  }
32
35
  },
33
36
  "devDependencies": {
34
- "@types/fetch-mock": "7.3.5",
35
- "@types/jest": "29.5.1",
36
- "@types/lodash.get": "4.4.7",
37
- "@types/lodash.isempty": "4.4.7",
38
- "@types/lodash.merge": "4.6.7",
39
- "@types/lodash.pickby": "4.6.7",
40
- "@types/lodash.reduce": "4.6.7",
41
- "@types/node": "18.16.3",
42
- "@types/node-fetch": "2.6.3",
43
- "@typescript-eslint/eslint-plugin": "5.59.2",
44
- "@typescript-eslint/parser": "5.59.2",
45
- "eslint": "8.40.0",
46
- "eslint-config-prettier": "8.8.0",
47
- "eslint-plugin-import": "2.27.5",
37
+ "@eslint/eslintrc": "3.3.1",
38
+ "@types/jest": "30.0.0",
39
+ "@types/lodash.get": "4.4.9",
40
+ "@types/lodash.isempty": "4.4.9",
41
+ "@types/lodash.merge": "4.6.9",
42
+ "@types/lodash.pickby": "4.6.9",
43
+ "@types/lodash.reduce": "4.6.9",
44
+ "@types/node": "24.0.14",
45
+ "@types/node-fetch": "2.6.12",
46
+ "@typescript-eslint/eslint-plugin": "8.37.0",
47
+ "@typescript-eslint/parser": "8.37.0",
48
+ "eslint": "9.31.0",
49
+ "eslint-config-prettier": "10.1.5",
50
+ "eslint-plugin-import": "2.32.0",
48
51
  "eslint-plugin-prefer-arrow": "1.2.3",
49
- "eslint-plugin-prettier": "4.2.1",
50
- "express": "4.19.2",
51
- "fetch-mock": "9.11.0",
52
- "husky": "8.0.3",
53
- "jest": "29.5.0",
52
+ "eslint-plugin-prettier": "5.5.1",
53
+ "express": "5.1.0",
54
+ "fetch-mock": "11.1.5",
55
+ "husky": "9.1.7",
56
+ "jest": "30.0.4",
54
57
  "mockdate": "3.0.5",
55
- "prettier": "2.8.8",
56
- "rimraf": "5.0.0",
58
+ "prettier": "3.6.2",
59
+ "rimraf": "6.0.1",
57
60
  "source-map-support": "0.5.21",
58
61
  "timeout-signal": "2.0.0",
59
- "ts-jest": "29.1.0",
60
- "ts-node": "10.9.1",
61
- "typescript": "5.0.4"
62
+ "ts-jest": "29.4.0",
63
+ "ts-node": "10.9.2",
64
+ "typescript": "5.8.3"
62
65
  },
63
66
  "dependencies": {
64
67
  "abort-controller": "^3.0.0",