@nangohq/types 0.40.10 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,12 @@ import type { AuthOperationType, AuthModeType } from '../auth/api.js';
2
2
  import type { SyncResult, SyncType } from '../scripts/syncs/api.js';
3
3
  import type { ErrorPayload } from '../api.js';
4
4
  export type WebhookTypes = 'sync' | 'auth' | 'forward';
5
- export interface NangoSyncWebhookBodyBase {
5
+ export interface NangoWebhookBase {
6
6
  from: string;
7
+ type: WebhookTypes;
8
+ }
9
+ export type NangoWebhookBody = NangoSyncWebhookBody | NangoAuthWebhookBody;
10
+ export interface NangoSyncWebhookBodyBase extends NangoWebhookBase {
7
11
  type: 'sync';
8
12
  connectionId: string;
9
13
  providerConfigKey: string;
@@ -12,20 +16,22 @@ export interface NangoSyncWebhookBodyBase {
12
16
  syncType: SyncType;
13
17
  }
14
18
  export interface NangoSyncWebhookBodySuccess extends NangoSyncWebhookBodyBase {
19
+ success: true;
15
20
  modifiedAfter: string;
16
21
  responseResults: SyncResult;
17
- success: true;
22
+ /**
23
+ * @deprecated legacy, use modifiedAfter instead
24
+ */
18
25
  queryTimeStamp: string | null;
19
26
  }
20
- export interface NangoSyncWebhookBodyError {
27
+ export interface NangoSyncWebhookBodyError extends NangoSyncWebhookBodyBase {
21
28
  success: false;
22
29
  error: ErrorPayload;
23
30
  startedAt: string;
24
31
  failedAt: string;
25
32
  }
26
- export type NangoSyncWebhookBody = NangoSyncWebhookBodyBase | NangoSyncWebhookBodyError;
27
- export interface NangoAuthWebhookBodyBase {
28
- from: string;
33
+ export type NangoSyncWebhookBody = NangoSyncWebhookBodySuccess | NangoSyncWebhookBodyError;
34
+ export interface NangoAuthWebhookBodyBase extends NangoWebhookBase {
29
35
  type: 'auth';
30
36
  connectionId: string;
31
37
  authMode: AuthModeType;
@@ -36,17 +42,17 @@ export interface NangoAuthWebhookBodyBase {
36
42
  }
37
43
  export interface NangoAuthWebhookBodySuccess extends NangoAuthWebhookBodyBase {
38
44
  success: true;
45
+ type: 'auth';
39
46
  }
40
47
  export interface NangoAuthWebhookBodyError extends NangoAuthWebhookBodyBase {
41
48
  success: false;
42
49
  error: ErrorPayload;
50
+ type: 'auth';
43
51
  }
44
52
  export type NangoAuthWebhookBody = NangoAuthWebhookBodySuccess | NangoAuthWebhookBodyError;
45
- export interface NangoForwardWebhookBody {
46
- from: string;
47
- type: WebhookTypes;
53
+ export interface NangoForwardWebhookBody extends NangoWebhookBase {
54
+ type: 'forward';
48
55
  connectionId?: string;
49
56
  providerConfigKey: string;
50
57
  payload: unknown;
51
58
  }
52
- export type NangoWebhookBody = NangoSyncWebhookBody | NangoAuthWebhookBody;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.40.10",
3
+ "version": "0.41.0",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",