@tryvital/vital-node 1.3.8 → 1.4.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/client/Link.ts CHANGED
@@ -19,13 +19,22 @@ export class LinkApi {
19
19
  public async create(
20
20
  userId: string,
21
21
  provider: string = null,
22
- redirect_url: string = null
22
+ redirect_url: string = null,
23
+ filter_on_providers: string[] = null
23
24
  ): Promise<LinkTokenExchangeResponse> {
24
- const resp = await this.client.post(this.baseURL.concat('/link/token/'), {
25
+ const default_params = {
25
26
  user_key: userId,
26
27
  provider,
27
28
  redirect_url,
28
- });
29
+ };
30
+ if (filter_on_providers) {
31
+ // @ts-ignore
32
+ default_params['filter_on_providers'] = filter_on_providers;
33
+ }
34
+ const resp = await this.client.post(
35
+ this.baseURL.concat('/link/token/'),
36
+ default_params
37
+ );
29
38
  return resp.data;
30
39
  }
31
40
 
@@ -50,7 +59,7 @@ export class LinkApi {
50
59
  linkToken: string,
51
60
  provider: EmailProviders,
52
61
  email: string,
53
- region?: string,
62
+ region?: string
54
63
  ): Promise<ProviderLinkResponse> {
55
64
  const payload = region ? { email, region } : { email };
56
65
  const resp = await this.client.post(
@@ -5,7 +5,7 @@ export declare class LinkApi {
5
5
  baseURL: string;
6
6
  client: AxiosInstance;
7
7
  constructor(baseURL: string, axios: AxiosInstance);
8
- create(userId: string, provider?: string, redirect_url?: string): Promise<LinkTokenExchangeResponse>;
8
+ create(userId: string, provider?: string, redirect_url?: string, filter_on_providers?: string[]): Promise<LinkTokenExchangeResponse>;
9
9
  connectProvider(linkToken: string, provider: PasswordProviders, username: string, password: string): Promise<ProviderLinkResponse>;
10
10
  connectEmailProvider(linkToken: string, provider: EmailProviders, email: string, region?: string): Promise<ProviderLinkResponse>;
11
11
  getOAuthLink(linkToken: string, provider: OAuthProviders): Promise<SourceWithLinkInfo>;
@@ -42,18 +42,25 @@ var LinkApi = /** @class */ (function () {
42
42
  this.baseURL = baseURL;
43
43
  this.client = axios;
44
44
  }
45
- LinkApi.prototype.create = function (userId, provider, redirect_url) {
45
+ LinkApi.prototype.create = function (userId, provider, redirect_url, filter_on_providers) {
46
46
  if (provider === void 0) { provider = null; }
47
47
  if (redirect_url === void 0) { redirect_url = null; }
48
+ if (filter_on_providers === void 0) { filter_on_providers = null; }
48
49
  return __awaiter(this, void 0, void 0, function () {
49
- var resp;
50
+ var default_params, resp;
50
51
  return __generator(this, function (_a) {
51
52
  switch (_a.label) {
52
- case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/link/token/'), {
53
+ case 0:
54
+ default_params = {
53
55
  user_key: userId,
54
56
  provider: provider,
55
57
  redirect_url: redirect_url,
56
- })];
58
+ };
59
+ if (filter_on_providers) {
60
+ // @ts-ignore
61
+ default_params['filter_on_providers'] = filter_on_providers;
62
+ }
63
+ return [4 /*yield*/, this.client.post(this.baseURL.concat('/link/token/'), default_params)];
57
64
  case 1:
58
65
  resp = _a.sent();
59
66
  return [2 /*return*/, resp.data];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-node",
3
- "version": "1.3.8",
3
+ "version": "1.4.1",
4
4
  "description": "Node client for Vital",
5
5
  "author": "maitham",
6
6
  "keywords": [
@@ -56,4 +56,4 @@
56
56
  "ts-node": "^10.2.0",
57
57
  "typescript": "^4.3.5"
58
58
  }
59
- }
59
+ }