BREAKING CHANGE(core): switch to esm and allow specification of redirect url
This commit is contained in:
		| @@ -100,10 +100,9 @@ codequality: | ||||
|   only: | ||||
|     - tags | ||||
|   script: | ||||
|     - npmci command npm install -g tslint typescript | ||||
|     - npmci command npm install -g typescript | ||||
|     - npmci npm prepare | ||||
|     - npmci npm install | ||||
|     - npmci command "tslint -c tslint.json ./ts/**/*.ts" | ||||
|   tags: | ||||
|     - lossless | ||||
|     - docker | ||||
|   | ||||
							
								
								
									
										19436
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										19436
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										13
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								package.json
									
									
									
									
									
								
							| @@ -5,6 +5,7 @@ | ||||
|   "description": "an unofficial api abstraction for tink.com", | ||||
|   "main": "dist_ts/index.js", | ||||
|   "typings": "dist_ts/index.d.ts", | ||||
|   "type": "module", | ||||
|   "author": "Lossless GmbH", | ||||
|   "license": "MIT", | ||||
|   "scripts": { | ||||
| @@ -12,12 +13,12 @@ | ||||
|     "build": "(tsbuild --web)" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@gitzone/tsbuild": "^2.1.25", | ||||
|     "@gitzone/tsbundle": "^1.0.78", | ||||
|     "@gitzone/tstest": "^1.0.64", | ||||
|     "@gitzone/tsbuild": "^2.1.61", | ||||
|     "@gitzone/tsbundle": "^1.0.102", | ||||
|     "@gitzone/tstest": "^1.0.70", | ||||
|     "@pushrocks/qenv": "^4.0.10", | ||||
|     "@pushrocks/tapbundle": "^4.0.7", | ||||
|     "@types/node": "^17.0.18", | ||||
|     "@pushrocks/tapbundle": "^5.0.3", | ||||
|     "@types/node": "^17.0.25", | ||||
|     "tslint": "^6.1.3", | ||||
|     "tslint-config-prettier": "^1.15.0" | ||||
|   }, | ||||
| @@ -39,4 +40,4 @@ | ||||
|     "npmextra.json", | ||||
|     "readme.md" | ||||
|   ] | ||||
| } | ||||
| } | ||||
| @@ -27,7 +27,6 @@ Platform support | [ { | ||||
| } | ||||
|  | ||||
| // additional stuff | ||||
| const existingTinkUser = await tinkAccount.getUser('<YourOwnUniqueUserId/externalUserId>') | ||||
| const existingTinkUser = await tinkAccount.getUser('<YourOwnUniqueUserId/externalUserId>'); | ||||
| await existingTinkuser.delete(); // delete the user on the tink platform | ||||
| ``` | ||||
|  | ||||
|  | ||||
| ## Contribution | ||||
|  | ||||
| We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import * as qenv from '@pushrocks/qenv'; | ||||
|  | ||||
| const testQenv = new qenv.Qenv('./', './.nogit/'); | ||||
|  | ||||
| import * as tink from '../ts/index'; | ||||
| import * as tink from '../ts/index.js'; | ||||
|  | ||||
| let tinkTestAccount: tink.TinkAccount; | ||||
|  | ||||
| @@ -20,18 +20,17 @@ tap.test('should report tink as healthy', async () => { | ||||
| }); | ||||
|  | ||||
| tap.test('should create a valid request', async (toolsArg) => { | ||||
|   const tinkuser: tink.TinkUser = await tinkTestAccount.getTinkUser("user_1234_abc"); | ||||
|   const tinkuser: tink.TinkUser = await tinkTestAccount.getTinkUser('user_1234_abc'); | ||||
|   console.log(tinkuser); | ||||
|   console.log(await tinkuser.getTinkLinkForMarket()); // defaults to 'DE'; | ||||
|   console.log(await tinkuser.getProviderConsents()) | ||||
|   console.log(await tinkuser.getProviderConsents()); | ||||
|   await toolsArg.delayFor(10000); | ||||
| }) | ||||
| }); | ||||
|  | ||||
| tap.test('should delete existing users', async () => { | ||||
|   process.exit(0); | ||||
|   expect(tinkTestAccount).toBeInstanceOf(tink.TinkAccount); | ||||
|   const tinkUser = new tink.TinkUser(tinkTestAccount, null, 'user_1234_abc'); | ||||
|   await tinkUser.delete(); | ||||
| }) | ||||
| }); | ||||
|  | ||||
| tap.start(); | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| export * from './tink.classes.tinkaccount'; | ||||
| export * from './tink.classes.tinkuser'; | ||||
| export * from './tink.classes.tinkproviderconsent'; | ||||
| export * from './tink.classes.tinkaccount.js'; | ||||
| export * from './tink.classes.tinkuser.js'; | ||||
| export * from './tink.classes.tinkproviderconsent.js'; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import * as plugins from './tink.plugins'; | ||||
| import * as plugins from './tink.plugins.js'; | ||||
|  | ||||
| import { TinkUser } from './tink.classes.tinkuser'; | ||||
| import { TinkUser } from './tink.classes.tinkuser.js'; | ||||
|  | ||||
| export class TinkAccount { | ||||
|   public clientId: string; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import * as plugins from './tink.plugins'; | ||||
| import * as plugins from './tink.plugins.js'; | ||||
|  | ||||
| import { TinkUser } from './tink.classes.tinkuser'; | ||||
| import { TinkUser } from './tink.classes.tinkuser.js'; | ||||
|  | ||||
| /** | ||||
|  * a provider consent maps to tinks bank consents | ||||
| @@ -19,8 +19,8 @@ export class TinkProviderConsent { | ||||
|       urlArg: '/api/v1/provider-consents', | ||||
|       accessToken, | ||||
|       methodArg: 'GET', | ||||
|       payloadArg: null | ||||
|     }) | ||||
|       payloadArg: null, | ||||
|     }); | ||||
|     console.log(responseData); | ||||
|     return returnProviderConsents; | ||||
|   } | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import * as plugins from './tink.plugins'; | ||||
| import * as plugins from './tink.plugins.js'; | ||||
|  | ||||
| import { TinkAccount } from './tink.classes.tinkaccount'; | ||||
| import { TinkProviderConsent } from './tink.classes.tinkproviderconsent'; | ||||
| import { TinkAccount } from './tink.classes.tinkaccount.js'; | ||||
| import { TinkProviderConsent } from './tink.classes.tinkproviderconsent.js'; | ||||
|  | ||||
| export class TinkUser { | ||||
|   // STATIC | ||||
| @@ -109,13 +109,13 @@ export class TinkUser { | ||||
|    * gets a tink link that can be used by a user to connect accounts | ||||
|    * @returns | ||||
|    */ | ||||
|   public async getTinkLinkForMarket(countryIdArg: string = 'DE'): Promise<string> { | ||||
|   public async getTinkLinkForMarket(countryIdArg: string = 'DE', redirectUrlArg = 'https://console.tink.com/callback'): Promise<string> { | ||||
|     const authorizationCode = await this.tinkAccountRef.getUserAuthorizationCode( | ||||
|       this.externalUserIdArg, | ||||
|       'df05e4b379934cd09963197cc855bfe9', // this is a hardcoded app id for tink link, as recommended by tink.com | ||||
|       'authorization:read,authorization:grant,credentials:refresh,credentials:read,credentials:write,providers:read,user:read' | ||||
|     ); | ||||
|     const tinkLinkUrl = `https://link.tink.com/1.0/business-transactions/connect-accounts?client_id=${'teststate'}&redirect_uri=https://console.tink.com/callback&authorization_code=${authorizationCode}&market=${countryIdArg}`; | ||||
|     const tinkLinkUrl = `https://link.tink.com/1.0/business-transactions/connect-accounts?client_id=${'teststate'}&redirect_uri=${redirectUrlArg}&authorization_code=${authorizationCode}&market=${countryIdArg}`; | ||||
|     return tinkLinkUrl; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,4 @@ | ||||
| // @pushrocks scope | ||||
| import * as smartrequest from '@pushrocks/smartrequest'; | ||||
|  | ||||
| export { | ||||
|   smartrequest | ||||
| } | ||||
| export { smartrequest }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user