File tree Expand file tree Collapse file tree 6 files changed +36
-19
lines changed
Expand file tree Collapse file tree 6 files changed +36
-19
lines changed Original file line number Diff line number Diff line change 11node_modules
22.DS_Store
33.husky
4+ dist /*
Original file line number Diff line number Diff line change 1- # speakeasy-typescript-sdk
1+ # speakeasy-typescript-sdk
2+
3+ ## Setting up
4+
5+ Feel free to use any system to manage your Node installing, but a ` .nvmrc ` is included in the library for ` nvm ` support.
6+
7+ To setup:
8+
9+ 1 . Install ` nvm ` following instructions on (nvm repo)[ https://github.com/nvm-sh/nvm ]
10+ 2 . Install the correct node version with ` nvm install `
11+ 3 . Make sure the symlinks are correct with ` nvm use `
12+
13+ ## Formating, Linting & Testing
14+
15+ ` prettier ` is used with ` husky ` and ` lint-staged ` to lint on commit, which should be installed automatically by ` npm ` .
16+
17+ Use ` yarn test ` to run the test suite.
Original file line number Diff line number Diff line change 66 "author" : " " ,
77 "license" : " MIT" ,
88 "devDependencies" : {
9+ "@types/express" : " ^4.17.13" ,
10+ "@types/har-format" : " ^1.2.8" ,
911 "@types/jest" : " ^28.1.6" ,
12+ "@types/node" : " ^18.6.0" ,
1013 "@types/supertest" : " ^2.0.12" ,
11- "express" : " ^4.18.1" ,
1214 "husky" : " ^8.0.1" ,
1315 "jest" : " ^28.1.3" ,
1416 "lint-staged" : " ^13.0.3" ,
1820 "ts-node" : " ^10.9.1" ,
1921 "typescript" : " ^4.7.4"
2022 },
23+ "peerDepedencies" : {
24+ "express" : " ^4.18.1"
25+ },
2126 "scripts" : {
2227 "build" : " yarn tsc" ,
2328 "test" : " yarn jest" ,
2429 "prepare" : " yarn husky install"
2530 },
26- "dependencies" : {
27- "@types/express" : " ^4.17.13" ,
28- "@types/har-format" : " ^1.2.8" ,
29- "@types/node" : " ^18.6.0" ,
30- "har" : " ^1.0.0"
31- },
31+ "dependencies" : {},
3232 "engines" : {
3333 "node" : " >=16.0.0"
3434 },
Original file line number Diff line number Diff line change 1- const DEFAULT_SPEAKEASY_SERVER_URL = "grpc.speakeasyapi.dev:443"
1+ const DEFAULT_SPEAKEASY_SERVER_URL = "grpc.speakeasyapi.dev:443" ;
22
33export type Config = {
44 apiKey : string ;
55} ;
66
7- export class SpeakeasyClient {
7+ export class SpeakeasySDK {
88 apiKey : string ;
99 serverUrl : string ;
1010
@@ -17,10 +17,10 @@ export class SpeakeasyClient {
1717 this . apiKey = config . apiKey ;
1818
1919 const serverUrl = process . env . SPEAKEASY_SERVER_URL ;
20- if ( serverUrl == null ) {
21- this . serverUrl = DEFAULT_SPEAKEASY_SERVER_URL ;
22- } else {
20+ if ( serverUrl ) {
2321 this . serverUrl = serverUrl ;
22+ } else {
23+ this . serverUrl = DEFAULT_SPEAKEASY_SERVER_URL ;
2424 }
2525 }
2626}
Original file line number Diff line number Diff line change 1- export { SpeakeasyClient } from "./client" ;
1+ export { SpeakeasySDK } from "./client" ;
Original file line number Diff line number Diff line change 1- import { Config , SpeakeasyClient } from "./client" ;
1+ import { Config , SpeakeasySDK } from "./client" ;
22import { outputError } from "./error" ;
33
4- let speakeasyInstance : SpeakeasyClient | null = null ;
4+ let speakeasyInstance : SpeakeasySDK | null = null ;
55
6- export function init ( config : Config ) : SpeakeasyClient | null {
6+ export function init ( config : Config ) : SpeakeasySDK | null {
77 if ( speakeasyInstance != null ) {
88 outputError (
99 "Speakeasy has already been initialized, skipping initialization"
@@ -12,14 +12,14 @@ export function init(config: Config): SpeakeasyClient | null {
1212 }
1313
1414 try {
15- speakeasyInstance = new SpeakeasyClient ( config ) ;
15+ speakeasyInstance = new SpeakeasySDK ( config ) ;
1616 } catch ( err : any ) {
1717 outputError ( err . message ) ;
1818 return null ;
1919 }
2020 return speakeasyInstance ;
2121}
2222
23- export function getInstance ( ) : SpeakeasyClient | null {
23+ export function getInstance ( ) : SpeakeasySDK | null {
2424 return speakeasyInstance ;
2525}
You can’t perform that action at this time.
0 commit comments