@nangohq/types 0.40.0 → 0.40.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.
package/dist/api.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface ValidationError {
11
11
  message: string;
12
12
  path: (string | number)[];
13
13
  }
14
- export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'invalid_uri_params', ValidationError[]> | ApiError<'feature_disabled'>;
14
+ export type ResDefaultErrors = ApiError<'not_found'> | ApiError<'invalid_query_params', ValidationError[]> | ApiError<'invalid_body', ValidationError[]> | ApiError<'invalid_uri_params', ValidationError[]> | ApiError<'feature_disabled'> | ApiError<'missing_auth_header'> | ApiError<'generic_error_support', undefined, string>;
15
15
  export type EndpointMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
16
16
  /**
17
17
  * API Request/Response type
@@ -0,0 +1,46 @@
1
+ import type { Endpoint } from '../../api.js';
2
+ export interface WebhookSettings {
3
+ alwaysSendWebhook: boolean;
4
+ sendAuthWebhook: boolean;
5
+ sendRefreshFailedWebhook: boolean;
6
+ sendSyncFailedWebhook: boolean;
7
+ }
8
+ export type UpdateWebhookSettings = Endpoint<{
9
+ Method: 'PATCH';
10
+ Querystring: {
11
+ env: string;
12
+ };
13
+ Path: '/api/v1/environment/webhook/settings';
14
+ Body: WebhookSettings;
15
+ Success: WebhookSettings;
16
+ }>;
17
+ export type UpdatePrimaryUrl = Endpoint<{
18
+ Method: 'PATCH';
19
+ Querystring: {
20
+ env: string;
21
+ };
22
+ Path: '/api/v1/environment/webhook/url/primary-url';
23
+ Body: {
24
+ url: string;
25
+ };
26
+ Success: {
27
+ data: {
28
+ url: string;
29
+ };
30
+ };
31
+ }>;
32
+ export type UpdateSecondaryUrl = Endpoint<{
33
+ Method: 'PATCH';
34
+ Querystring: {
35
+ env: string;
36
+ };
37
+ Path: '/api/v1/environment/webhook/secondary-url';
38
+ Body: {
39
+ url: string;
40
+ };
41
+ Success: {
42
+ data: {
43
+ url: string;
44
+ };
45
+ };
46
+ }>;
@@ -35,3 +35,13 @@ export interface Environment extends Timestamps {
35
35
  slack_notifications: boolean;
36
36
  webhook_receive_url?: string;
37
37
  }
38
+ export interface ExternalWebhook extends Timestamps {
39
+ id: number;
40
+ environment_id: number;
41
+ primary_url: string;
42
+ secondary_url: string;
43
+ on_sync_completion_always: boolean;
44
+ on_auth_creation: boolean;
45
+ on_auth_refresh_error: boolean;
46
+ on_sync_error: boolean;
47
+ }
package/dist/index.d.ts CHANGED
@@ -21,3 +21,6 @@ export type * from './integration/db.js';
21
21
  export type * from './integration/template.js';
22
22
  export type * from './auth/api.js';
23
23
  export type * from './auth/db.js';
24
+ export type * from './environment/db.js';
25
+ export type * from './environment/api/webhook.js';
26
+ export type * from './webhooks/api.js';
@@ -3,7 +3,7 @@ import type { EndpointMethod } from '../api.js';
3
3
  import type { BasicApiCredentials, ApiKeyCredentials, AppCredentials } from '../auth/api.js';
4
4
  import type { Connection } from '../connection/db.js';
5
5
  import type { Template as ProviderTemplate } from '../integration/template.js';
6
- interface BaseProxyConfiguration {
6
+ export interface BaseProxyConfiguration {
7
7
  providerConfigKey: string;
8
8
  connectionId: string;
9
9
  endpoint: string;
@@ -62,4 +62,3 @@ export interface LinkPagination extends Pagination {
62
62
  export interface OffsetPagination extends Pagination {
63
63
  offset_name_in_request: string;
64
64
  }
65
- export {};
@@ -0,0 +1,49 @@
1
+ import type { AuthOperationType, AuthModeType } from '../auth/api.js';
2
+ import type { SyncResult, SyncType } from '../scripts/syncs/api.js';
3
+ import type { ErrorPayload } from '../api.js';
4
+ export type WebhookTypes = 'sync' | 'auth' | 'forward';
5
+ export interface NangoSyncWebhookBody {
6
+ from: string;
7
+ type: 'sync';
8
+ connectionId: string;
9
+ providerConfigKey: string;
10
+ syncName: string;
11
+ model: string;
12
+ syncType: SyncType;
13
+ }
14
+ export interface NangoSyncWebhookBodySuccess extends NangoSyncWebhookBody {
15
+ modifiedAfter: string;
16
+ responseResults: SyncResult;
17
+ success: true;
18
+ queryTimeStamp: string | null;
19
+ }
20
+ export interface NangoSyncWebhookBodyError {
21
+ success: false;
22
+ error: ErrorPayload;
23
+ startedAt: string;
24
+ failedAt: string;
25
+ }
26
+ export interface NangoAuthWebhookBody {
27
+ from: string;
28
+ type: 'auth';
29
+ connectionId: string;
30
+ authMode: AuthModeType;
31
+ providerConfigKey: string;
32
+ provider: string;
33
+ environment: string;
34
+ operation: AuthOperationType;
35
+ }
36
+ export interface NangoAuthWebhookBodySuccess extends NangoAuthWebhookBody {
37
+ success: true;
38
+ }
39
+ export interface NangoAuthWebhookBodyError extends NangoAuthWebhookBody {
40
+ success: false;
41
+ error: ErrorPayload;
42
+ }
43
+ export interface NangoForwardWebhookBody {
44
+ from: string;
45
+ type: WebhookTypes;
46
+ connectionId?: string;
47
+ providerConfigKey: string;
48
+ payload: unknown;
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.40.0",
3
+ "version": "0.40.1",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",