@nangohq/types 0.42.22 → 0.44.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.
@@ -13,6 +13,7 @@ export interface AuthModes {
13
13
  Jwt: 'JWT';
14
14
  Bill: 'BILL';
15
15
  TwoStep: 'TWO_STEP';
16
+ Signature: 'SIGNATURE';
16
17
  }
17
18
  export type AuthModeType = AuthModes[keyof AuthModes];
18
19
  export interface AuthOperation {
@@ -142,9 +143,16 @@ export interface TwoStepCredentials extends CredentialsCommon {
142
143
  token?: string;
143
144
  expires_at?: Date | undefined;
144
145
  }
146
+ export interface SignatureCredentials {
147
+ type: AuthModes['Signature'];
148
+ username: string;
149
+ password: string;
150
+ token?: string;
151
+ expires_at?: Date | undefined;
152
+ }
145
153
  export type UnauthCredentials = Record<string, never>;
146
154
  export type RefreshTokenResponse = AuthorizationTokenResponse;
147
155
  export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'type' | 'raw'> {
148
156
  expires_in?: number;
149
157
  }
150
- export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials | JwtCredentials | BillCredentials | TwoStepCredentials;
158
+ export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | SignatureCredentials;
@@ -126,3 +126,24 @@ export type PostPublicTwoStepAuthorization = Endpoint<{
126
126
  connectionId: string;
127
127
  };
128
128
  }>;
129
+ export type PostPublicSignatureAuthorization = Endpoint<{
130
+ Method: 'POST';
131
+ Body: {
132
+ username: string;
133
+ password: string;
134
+ };
135
+ Querystring: {
136
+ connection_id?: string | undefined;
137
+ params?: Record<string, any> | undefined;
138
+ hmac?: string | undefined;
139
+ };
140
+ Params: {
141
+ providerConfigKey: string;
142
+ };
143
+ Path: '/auth/signature-based';
144
+ Error: ApiError<'invalid_body'> | ApiError<'invalid_query_params'> | ApiError<'unknown_provider_config'> | ApiError<'unknown_provider_template'> | ApiError<'invalid_auth_mode'> | ApiError<'invalid_credentials'>;
145
+ Success: {
146
+ providerConfigKey: string;
147
+ connectionId: string;
148
+ };
149
+ }>;
@@ -1,6 +1,7 @@
1
1
  import type { JSONSchema7 } from 'json-schema';
2
2
  import type { Endpoint, ApiError } from '../api.js';
3
3
  import type { IncomingFlowConfig, PostConnectionScriptByProvider } from './incomingFlow.js';
4
+ import type { SyncDeploymentResult } from './index.js';
4
5
  export type PostDeployConfirmation = Endpoint<{
5
6
  Method: 'POST';
6
7
  Path: '/sync/deploy/confirmation';
@@ -26,7 +27,7 @@ export type PostDeploy = Endpoint<{
26
27
  singleDeployMode?: boolean;
27
28
  jsonSchema?: JSONSchema7 | undefined;
28
29
  };
29
- Success: any[];
30
+ Success: SyncDeploymentResult[];
30
31
  }>;
31
32
  export type PostDeployInternal = Endpoint<{
32
33
  Method: 'POST';
@@ -44,7 +45,7 @@ export type PostDeployInternal = Endpoint<{
44
45
  jsonSchema?: JSONSchema7 | undefined;
45
46
  };
46
47
  Error: ApiError<'forbidden'> | ApiError<'environment_creation_error'>;
47
- Success: any[];
48
+ Success: SyncDeploymentResult[];
48
49
  }>;
49
50
  export interface SlimSync {
50
51
  id?: number;
@@ -0,0 +1,16 @@
1
+ import type { ScriptTypeLiteral } from '../nangoYaml';
2
+ import type { LegacySyncModelSchema } from './incomingFlow';
3
+ export interface SyncDeploymentResult {
4
+ name: string;
5
+ version?: string;
6
+ providerConfigKey: string;
7
+ type: ScriptTypeLiteral;
8
+ last_deployed?: Date;
9
+ input?: string | LegacySyncModelSchema | undefined;
10
+ models: string | string[];
11
+ id?: number | undefined;
12
+ /** @deprecated legacy **/
13
+ sync_name?: string;
14
+ /** @deprecated legacy **/
15
+ syncName?: string;
16
+ }
@@ -0,0 +1,12 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import type { Timestamps } from '../db';
3
+ import type { HTTP_METHOD } from '../nangoYaml';
4
+ export interface DBSyncEndpoint extends Timestamps {
5
+ id: number;
6
+ sync_config_id: number;
7
+ method: HTTP_METHOD;
8
+ path: string;
9
+ model: string | null;
10
+ group_name: string | null;
11
+ }
12
+ export type DBSyncEndpointCreate = SetOptional<Omit<DBSyncEndpoint, 'id'>, 'model' | 'group_name'>;
package/dist/index.d.ts CHANGED
@@ -34,7 +34,9 @@ export type * from './auth/api.js';
34
34
  export type * from './auth/db.js';
35
35
  export type * from './auth/http.api.js';
36
36
  export type * from './deploy/api.js';
37
+ export type * from './deploy/index.js';
37
38
  export type * from './deploy/incomingFlow.js';
39
+ export type * from './endpoints/db.js';
38
40
  export type * from './connect/api.js';
39
41
  export type * from './connect/session.js';
40
42
  export type * from './endUser/index.js';
@@ -1,4 +1,5 @@
1
1
  import type { Endpoint } from '../api';
2
+ import type { PickFromUnion } from '../utils';
2
3
  import type { MessageRow, MessageState, OperationList, OperationRow } from './messages';
3
4
  type Concat<T extends OperationList> = T extends {
4
5
  action: string;
@@ -101,7 +102,7 @@ export type PostInsights = Endpoint<{
101
102
  env: string;
102
103
  };
103
104
  Body: {
104
- type: 'action' | 'sync' | 'proxy' | 'webhook_external';
105
+ type: PickFromUnion<ConcatOperationListWithGroup, 'action' | 'sync' | 'proxy' | 'webhook:incoming'>;
105
106
  };
106
107
  Success: {
107
108
  data: {
@@ -47,7 +47,7 @@ export interface OperationAdmin {
47
47
  }
48
48
  export interface OperationWebhook {
49
49
  type: 'webhook';
50
- action: 'incoming' | 'outgoing';
50
+ action: 'incoming' | 'forward';
51
51
  }
52
52
  export interface OperationDeploy {
53
53
  type: 'deploy';
@@ -19,6 +19,11 @@ export interface NangoYamlV2 {
19
19
  integrations: Record<string, NangoYamlV2Integration>;
20
20
  models: NangoYamlModel;
21
21
  }
22
+ export interface NangoYamlV2Endpoint {
23
+ method?: HTTP_METHOD;
24
+ path: string;
25
+ group?: string | undefined;
26
+ }
22
27
  export interface NangoYamlV2Integration {
23
28
  provider?: string;
24
29
  syncs?: Record<string, NangoYamlV2IntegrationSync>;
@@ -26,7 +31,7 @@ export interface NangoYamlV2Integration {
26
31
  'post-connection-scripts'?: string[];
27
32
  }
28
33
  export interface NangoYamlV2IntegrationSync {
29
- endpoint: string | string[] | NangoSyncEndpointV2 | NangoSyncEndpointV2[];
34
+ endpoint: string | string[] | NangoYamlV2Endpoint | NangoYamlV2Endpoint[];
30
35
  output: string | string[];
31
36
  description?: string;
32
37
  sync_type?: SyncTypeLiteral;
@@ -39,7 +44,7 @@ export interface NangoYamlV2IntegrationSync {
39
44
  version?: string;
40
45
  }
41
46
  export interface NangoYamlV2IntegrationAction {
42
- endpoint: string;
47
+ endpoint: string | NangoYamlV2Endpoint;
43
48
  output?: string | string[];
44
49
  description?: string;
45
50
  scopes?: string | string[];
@@ -114,4 +119,5 @@ export type NangoSyncEndpointOld = {
114
119
  export interface NangoSyncEndpointV2 {
115
120
  method: HTTP_METHOD;
116
121
  path: string;
122
+ group?: string | undefined;
117
123
  }
@@ -25,12 +25,14 @@ export interface SimplifiedJSONSchema {
25
25
  example?: string;
26
26
  pattern?: string;
27
27
  optional?: boolean;
28
- format?: string;
28
+ format?: 'hostname' | 'uri' | 'uuid' | 'email';
29
29
  order: number;
30
30
  default_value?: string;
31
31
  hidden?: string;
32
+ prefix?: string;
32
33
  suffix?: string;
33
34
  doc_section?: string;
35
+ secret?: string;
34
36
  }
35
37
  export interface BaseProvider {
36
38
  display_name: string;
@@ -120,4 +122,12 @@ export interface ProviderTwoStep extends BaseProvider {
120
122
  token_expires_in_ms?: number;
121
123
  proxy_header_authorization?: string;
122
124
  }
123
- export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep;
125
+ export interface ProviderSignature extends BaseProvider {
126
+ signature: {
127
+ protocol: 'WSSE';
128
+ };
129
+ token: {
130
+ expires_in_ms: number;
131
+ };
132
+ }
133
+ export type Provider = BaseProvider | ProviderOAuth1 | ProviderOAuth2 | ProviderJwt | ProviderTwoStep | ProviderSignature;
package/dist/utils.d.ts CHANGED
@@ -8,3 +8,6 @@ export interface Logger {
8
8
  debug: LogMethod;
9
9
  child: (...message: any[]) => Logger;
10
10
  }
11
+ type ValidateSelection<T, U> = U extends T ? U : never;
12
+ export type PickFromUnion<T, U extends T> = ValidateSelection<T, U>;
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.42.22",
3
+ "version": "0.44.0",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",