@nangohq/types 0.71.1 → 0.71.2

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,4 +1,5 @@
1
1
  import type { DBConnection } from '../connection/db.js';
2
+ import type { ReplaceInObjectDeep } from '../utils.js';
2
3
  export interface AuthModes {
3
4
  OAuth1: 'OAUTH1';
4
5
  OAuth2: 'OAUTH2';
@@ -171,3 +172,4 @@ export interface AuthorizationTokenResponse extends Omit<OAuth2Credentials, 'typ
171
172
  export type TestableCredentials = ApiKeyCredentials | BasicApiCredentials | TbaCredentials | JwtCredentials | SignatureCredentials;
172
173
  export type RefreshableCredentials = OAuth2Credentials | AppCredentials | AppStoreCredentials | OAuth2ClientCredentials | JwtCredentials | TwoStepCredentials | BillCredentials | SignatureCredentials | AwsSigV4Credentials;
173
174
  export type AllAuthCredentials = OAuth1Credentials | OAuth2Credentials | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | CombinedOauth2AppCredentials | SignatureCredentials | InstallPluginCredentials | AwsSigV4Credentials;
175
+ export type ApiPublicAllAuthCredentials = ReplaceInObjectDeep<AllAuthCredentials, Date, string>;
@@ -94,19 +94,12 @@ export interface GetBillingUsageOpts {
94
94
  group_by?: 'environmentId' | 'environmentName' | 'integrationId' | 'type' | 'functionName' | 'model';
95
95
  };
96
96
  /**
97
- * Dev-only escape hatch: pins the request to Orb for parity checks.
98
- * Honoured only when `FLAG_ALLOW_OVERRIDE_GETUSAGE_SERVICE` is enabled;
99
- * ignored everywhere else. Default is ClickHouse.
100
- */
101
- source?: 'clickhouse' | 'orb';
102
- /**
103
- * Per-metric dimension breakdown spec. Honoured only on the CH path
97
+ * Per-metric dimension breakdown spec, applied to CH-backed metrics
104
98
  * (records / connections via `getDailySumAndBatches`, counters via
105
- * `getDailyCounter`); the Orb client ignores it. Each metric's
106
- * `BillingUsageMetric` gains a `breakdown` array of up to `top + 1`
107
- * series (top-N dimension values + a single 'rest' aggregating the
108
- * long tail). Top defaults to 10 and is clamped server-side to
109
- * the CH cap.
99
+ * `getDailyCounter`). Each metric's `BillingUsageMetric` gains a
100
+ * `breakdown` array of up to `top + 1` series (top-N dimension
101
+ * values + a single 'rest' aggregating the long tail). Top defaults
102
+ * to 10 and is clamped server-side to the CH cap.
110
103
  */
111
104
  breakdown?: {
112
105
  [M in UsageMetric]?: BreakdownDimensions[M] | undefined;
@@ -114,8 +107,7 @@ export interface GetBillingUsageOpts {
114
107
  top?: number;
115
108
  /**
116
109
  * Subset of metrics to populate in the response. When set, only those
117
- * metrics are fanned out (CH path) and returned. Omitted → all 7.
118
- * Ignored on the Orb path.
110
+ * metrics are fanned out and returned. Omitted → all 7.
119
111
  */
120
112
  metrics?: UsageMetric[];
121
113
  /**
@@ -123,8 +115,7 @@ export interface GetBillingUsageOpts {
123
115
  * where the given dimension equals the given value. Composes with
124
116
  * `breakdown[<metric>]` on the same metric when the dimensions differ
125
117
  * (drill-in: filter to one value, re-break-down by another); controllers
126
- * reject only the same-dimension pairing. CH path only; the Orb client
127
- * ignores it.
118
+ * reject only the same-dimension pairing.
128
119
  */
129
120
  filter?: {
130
121
  [M in UsageMetric]?: {
@@ -1,5 +1,5 @@
1
1
  import type { ApiError, ApiTimestamps, Endpoint } from '../../api.js';
2
- import type { AllAuthCredentials, ApiKeyCredentials, BasicApiCredentials, OAuth1Credentials, OAuth2ClientCredentials, OAuth2Credentials, TbaCredentials } from '../../auth/api.js';
2
+ import type { ApiKeyCredentials, ApiPublicAllAuthCredentials, BasicApiCredentials, OAuth1Credentials, OAuth2ClientCredentials, OAuth2Credentials, TbaCredentials } from '../../auth/api.js';
3
3
  import type { EndUserInput } from '../../connect/api.js';
4
4
  import type { Tags } from '../../db.js';
5
5
  import type { ApiEndUser } from '../../endUser/index.js';
@@ -135,7 +135,7 @@ export type ApiPublicConnectionFull = Pick<DBConnection, 'id' | 'connection_id'
135
135
  }[];
136
136
  end_user: ApiEndUser | null;
137
137
  tags: Tags;
138
- credentials: AllAuthCredentials;
138
+ credentials: ApiPublicAllAuthCredentials;
139
139
  };
140
140
  export type GetPublicConnection = Endpoint<{
141
141
  Method: 'GET';
@@ -164,7 +164,7 @@ export type PatchPublicConnection = Endpoint<{
164
164
  Body: {
165
165
  end_user?: EndUserInput | undefined;
166
166
  tags?: Tags | undefined;
167
- webhook_url?: string | undefined;
167
+ webhook_url_override?: string | undefined;
168
168
  };
169
169
  Success: {
170
170
  success: boolean;
@@ -184,7 +184,7 @@ export type PatchConnection = Endpoint<{
184
184
  Body: {
185
185
  end_user?: EndUserInput | undefined;
186
186
  tags?: Tags | undefined;
187
- webhook_url?: string | undefined;
187
+ webhook_url_override?: string | undefined;
188
188
  };
189
189
  Success: {
190
190
  success: boolean;
@@ -14,7 +14,6 @@ export type GetMeta = Endpoint<{
14
14
  baseUrl: string;
15
15
  debugMode: boolean;
16
16
  gettingStartedClosed: boolean;
17
- billingUsageSource: 'clickhouse' | 'orb';
18
17
  };
19
18
  };
20
19
  }>;
@@ -84,6 +84,7 @@ export interface BaseProvider {
84
84
  authorization_code_param_in_webhook?: string;
85
85
  docs: string;
86
86
  docs_connect?: string;
87
+ setup_guide_url?: string;
87
88
  token_expiration_buffer?: number;
88
89
  webhook_routing_script?: string;
89
90
  webhook_user_defined_secret?: boolean;
@@ -1,3 +1,4 @@
1
+ import type { AllAuthCredentials } from '../auth/api.js';
1
2
  import type { DBConnectionDecrypted } from '../connection/db.js';
2
3
  import type { DBIntegrationDecrypted } from '../integration/db.js';
3
4
  import type { HTTP_METHOD } from '../nangoYaml/index.js';
@@ -48,7 +49,9 @@ export interface UserProvidedProxyConfiguration extends BaseProxyConfiguration {
48
49
  method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'get' | 'post' | 'patch' | 'put' | 'delete';
49
50
  paginate?: Partial<CursorPagination> | Partial<LinkPagination> | Partial<OffsetPagination>;
50
51
  }
51
- export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'credentials' | 'metadata'>;
52
+ export type ConnectionForProxy = Pick<DBConnectionDecrypted, 'connection_id' | 'connection_config' | 'metadata'> & {
53
+ credentials: AllAuthCredentials;
54
+ };
52
55
  export type IntegrationConfigForProxy = Pick<DBIntegrationDecrypted, 'oauth_client_id' | 'oauth_client_secret' | 'custom'>;
53
56
  export interface ApplicationConstructedProxyConfiguration extends BaseProxyConfiguration {
54
57
  decompress: boolean;
package/dist/utils.d.ts CHANGED
@@ -21,4 +21,7 @@ export type Jsonable = string | number | boolean | null | undefined | readonly J
21
21
  export type ReplaceInObject<T, From, To> = {
22
22
  [K in keyof T]: T[K] extends infer U ? (U extends From ? Exclude<U, From> | To : U) : never;
23
23
  };
24
+ export type ReplaceInObjectDeep<T, From, To> = T extends From ? To : T extends object ? ReplaceInObject<{
25
+ [K in keyof T]: ReplaceInObjectDeep<T[K], From, To>;
26
+ }, From, To> : T;
24
27
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/types",
3
- "version": "0.71.1",
3
+ "version": "0.71.2",
4
4
  "description": "Types used in Nango applications",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",