@nangohq/types 0.42.21 → 0.43.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.
@@ -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
+ }
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ 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';
38
39
  export type * from './connect/api.js';
39
40
  export type * from './connect/session.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
+ entity?: 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
+ entity?: 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;
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.21",
3
+ "version": "0.43.0",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",