@nangohq/types 0.42.5 → 0.42.6

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
@@ -1,4 +1,4 @@
1
- export interface ApiError<TCode extends string, TErrors = undefined, P = unknown> {
1
+ export interface ApiError<TCode extends string, TErrors = any, P = unknown> {
2
2
  error: {
3
3
  code: TCode;
4
4
  message?: string | undefined;
@@ -51,7 +51,9 @@ export interface Endpoint<T extends EndpointDefinition> {
51
51
  /**
52
52
  * Response body for any error
53
53
  */
54
- Errors: T['Error'] extends ApiError<any> ? ResDefaultErrors | T['Error'] : ResDefaultErrors;
54
+ Errors: T['Error'] extends {
55
+ error: any;
56
+ } ? ResDefaultErrors | T['Error'] : ResDefaultErrors;
55
57
  /**
56
58
  * Response body (success + error)
57
59
  */
@@ -32,31 +32,23 @@ interface InternalIncomingPreBuiltFlowConfig {
32
32
  model_schema: string | NangoModel[];
33
33
  input?: string | LegacySyncModelSchema | undefined;
34
34
  endpoints?: NangoSyncEndpoint[] | undefined;
35
+ track_deletes: boolean;
36
+ providerConfigKey: string;
35
37
  }
36
38
  export interface IncomingPreBuiltFlowConfig extends InternalIncomingPreBuiltFlowConfig {
37
39
  provider: string;
38
40
  is_public: boolean;
39
- public_route?: string;
41
+ public_route: string;
40
42
  name: string;
41
43
  syncName?: string;
42
44
  nango_config_id?: number;
43
- providerConfigKey?: string;
44
45
  fileBody?: IncomingScriptFiles;
45
46
  }
46
47
  export interface IncomingFlowConfig extends InternalIncomingPreBuiltFlowConfig {
47
48
  syncName: string;
48
- providerConfigKey: string;
49
49
  fileBody: IncomingScriptFiles;
50
50
  version?: string | undefined;
51
- track_deletes?: boolean;
52
51
  sync_type?: SyncTypeLiteral | undefined;
53
52
  webhookSubscriptions?: string[] | undefined;
54
53
  }
55
- export interface IncomingFlowConfigUpgrade extends IncomingFlowConfig {
56
- id: string;
57
- upgrade_version: string;
58
- last_deployed: string;
59
- is_public: true;
60
- pre_built: true;
61
- }
62
54
  export {};
@@ -1,11 +1,35 @@
1
1
  import type { ApiError, Endpoint } from '../api';
2
- import type { IncomingFlowConfigUpgrade } from '../deploy/incomingFlow';
3
- export type UpgradePreBuiltFlow = Endpoint<{
2
+ import type { ScriptTypeLiteral } from '../nangoYaml';
3
+ export type PutUpgradePreBuiltFlow = Endpoint<{
4
4
  Method: 'PUT';
5
- Path: '/api/v1/flow/upgrade/pre-built';
6
- Body: IncomingFlowConfigUpgrade;
7
- Error: ApiError<'upgrade_failed'>;
5
+ Path: '/api/v1/flow/pre-built/upgrade';
6
+ Body: {
7
+ id: number;
8
+ provider: string;
9
+ scriptName: string;
10
+ type: ScriptTypeLiteral;
11
+ upgradeVersion: string;
12
+ lastDeployed: string;
13
+ providerConfigKey: string;
14
+ };
15
+ Error: ApiError<'upgrade_failed'> | ApiError<'unknown_provider'> | ApiError<'unknown_sync_config'> | ApiError<'unknown_flow'> | ApiError<'invalid_version'>;
8
16
  Success: {
9
17
  success: true;
10
18
  };
11
19
  }>;
20
+ export type PostPreBuiltDeploy = Endpoint<{
21
+ Method: 'POST';
22
+ Path: '/api/v1/flow/pre-built/deploy';
23
+ Body: {
24
+ provider: string;
25
+ providerConfigKey: string;
26
+ scriptName: string;
27
+ type: ScriptTypeLiteral;
28
+ };
29
+ Error: ApiError<'unknown_provider'> | ApiError<'resource_capped'> | ApiError<'failed_to_deploy', Error[]> | ApiError<'unknown_flow'>;
30
+ Success: {
31
+ data: {
32
+ id: number;
33
+ };
34
+ };
35
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.42.5",
3
+ "version": "0.42.6",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "@types/json-schema": "7.0.15",
16
16
  "axios": "^1.7.4",
17
17
  "json-schema": "0.4.0",
18
- "type-fest": "4.14.0"
18
+ "type-fest": "4.25.0"
19
19
  },
20
20
  "license": "SEE LICENSE IN LICENSE FILE IN GIT REPOSITORY",
21
21
  "files": [