@spritz-finance/service-client 0.2.26 → 0.2.28
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/lib/config.d.ts +13 -13
- package/lib/config.js +50 -50
- package/lib/credentials.d.ts +1 -1
- package/lib/credentials.js +49 -49
- package/lib/graphClient.d.ts +15 -15
- package/lib/graphClient.js +24 -24
- package/lib/graphClient.test.d.ts +1 -1
- package/lib/graphClient.test.js +23 -23
- package/lib/growthServiceClient.d.ts +6 -6
- package/lib/growthServiceClient.js +18 -18
- package/lib/index.d.ts +9 -9
- package/lib/index.js +21 -21
- package/lib/liabilitiesServiceClient.d.ts +180 -160
- package/lib/liabilitiesServiceClient.js +73 -58
- package/lib/lib/graphClient/generated.d.ts +1741 -1741
- package/lib/lib/graphClient/generated.js +203 -203
- package/lib/params.d.ts +2 -2
- package/lib/params.js +22 -22
- package/lib/payableAccountsServiceClient.d.ts +72 -72
- package/lib/payableAccountsServiceClient.js +67 -67
- package/lib/serviceClient.d.ts +2 -2
- package/lib/serviceClient.js +25 -25
- package/lib/transactionsServiceClient.d.ts +25 -25
- package/lib/transactionsServiceClient.js +27 -27
- package/lib/transactionsServiceClient.test.d.ts +1 -1
- package/lib/transactionsServiceClient.test.js +10 -10
- package/lib/usersServiceClient.d.ts +18 -18
- package/lib/usersServiceClient.js +28 -28
- package/lib/verificationServiceClient.d.ts +45 -45
- package/lib/verificationServiceClient.js +19 -19
- package/lib/verificationServiceClient.test.d.ts +1 -1
- package/lib/verificationServiceClient.test.js +10 -10
- package/package.json +2 -2
package/lib/config.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
interface GraphClientConfig {
|
|
2
|
-
env: string;
|
|
3
|
-
authEndpoint: string;
|
|
4
|
-
graphEndpoint: string;
|
|
5
|
-
verificationServiceEndpoint: string;
|
|
6
|
-
transactionsServiceEndpoint: string;
|
|
7
|
-
usersServiceEndpoint: string;
|
|
8
|
-
liabilitiesServiceEndpoint: string;
|
|
9
|
-
payableAccountsServiceEndpoint: string;
|
|
10
|
-
growthServiceEndpoint: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const config: GraphClientConfig;
|
|
13
|
-
export {};
|
|
1
|
+
interface GraphClientConfig {
|
|
2
|
+
env: string;
|
|
3
|
+
authEndpoint: string;
|
|
4
|
+
graphEndpoint: string;
|
|
5
|
+
verificationServiceEndpoint: string;
|
|
6
|
+
transactionsServiceEndpoint: string;
|
|
7
|
+
usersServiceEndpoint: string;
|
|
8
|
+
liabilitiesServiceEndpoint: string;
|
|
9
|
+
payableAccountsServiceEndpoint: string;
|
|
10
|
+
growthServiceEndpoint: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const config: GraphClientConfig;
|
|
13
|
+
export {};
|
package/lib/config.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.config = void 0;
|
|
5
|
-
const config_1 = require("@spritz-finance/config");
|
|
6
|
-
const envConfigs = {
|
|
7
|
-
base: {
|
|
8
|
-
env: (_b = (_a = process.env.STAGE) !== null && _a !== void 0 ? _a : process.env.NODE_ENV) !== null && _b !== void 0 ? _b : 'dev',
|
|
9
|
-
authEndpoint: 'https://auth-dev.spritz.finance/oauth2/token',
|
|
10
|
-
graphEndpoint: 'https://api-dev.spritz.finance/graphql',
|
|
11
|
-
verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
|
|
12
|
-
transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
|
|
13
|
-
usersServiceEndpoint: 'https://api-dev.spritz.finance/users',
|
|
14
|
-
liabilitiesServiceEndpoint: 'https://api-dev.spritz.finance/liabilities',
|
|
15
|
-
payableAccountsServiceEndpoint: 'https://api-dev.spritz.finance/payable-accounts',
|
|
16
|
-
growthServiceEndpoint: 'https://api-dev.spritz.finance/growth',
|
|
17
|
-
},
|
|
18
|
-
test: {
|
|
19
|
-
env: 'staging',
|
|
20
|
-
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
21
|
-
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
22
|
-
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
23
|
-
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
24
|
-
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
25
|
-
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
26
|
-
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
27
|
-
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
28
|
-
},
|
|
29
|
-
staging: {
|
|
30
|
-
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
31
|
-
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
32
|
-
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
33
|
-
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
34
|
-
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
35
|
-
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
36
|
-
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
37
|
-
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
38
|
-
},
|
|
39
|
-
production: {
|
|
40
|
-
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
41
|
-
graphEndpoint: 'https://api.spritz.finance/graphql',
|
|
42
|
-
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
43
|
-
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
44
|
-
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
45
|
-
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
46
|
-
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
47
|
-
growthServiceEndpoint: 'https://api.spritz.finance/growth',
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.config = void 0;
|
|
5
|
+
const config_1 = require("@spritz-finance/config");
|
|
6
|
+
const envConfigs = {
|
|
7
|
+
base: {
|
|
8
|
+
env: (_b = (_a = process.env.STAGE) !== null && _a !== void 0 ? _a : process.env.NODE_ENV) !== null && _b !== void 0 ? _b : 'dev',
|
|
9
|
+
authEndpoint: 'https://auth-dev.spritz.finance/oauth2/token',
|
|
10
|
+
graphEndpoint: 'https://api-dev.spritz.finance/graphql',
|
|
11
|
+
verificationServiceEndpoint: 'https://api-dev.spritz.finance/verification',
|
|
12
|
+
transactionsServiceEndpoint: 'https://api-dev.spritz.finance/transactions',
|
|
13
|
+
usersServiceEndpoint: 'https://api-dev.spritz.finance/users',
|
|
14
|
+
liabilitiesServiceEndpoint: 'https://api-dev.spritz.finance/liabilities',
|
|
15
|
+
payableAccountsServiceEndpoint: 'https://api-dev.spritz.finance/payable-accounts',
|
|
16
|
+
growthServiceEndpoint: 'https://api-dev.spritz.finance/growth',
|
|
17
|
+
},
|
|
18
|
+
test: {
|
|
19
|
+
env: 'staging',
|
|
20
|
+
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
21
|
+
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
22
|
+
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
23
|
+
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
24
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
25
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
26
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
27
|
+
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
28
|
+
},
|
|
29
|
+
staging: {
|
|
30
|
+
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
31
|
+
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
32
|
+
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
33
|
+
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
34
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
35
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
36
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
37
|
+
growthServiceEndpoint: 'https://api-staging.spritz.finance/growth',
|
|
38
|
+
},
|
|
39
|
+
production: {
|
|
40
|
+
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
41
|
+
graphEndpoint: 'https://api.spritz.finance/graphql',
|
|
42
|
+
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
43
|
+
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
44
|
+
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
45
|
+
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
46
|
+
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
47
|
+
growthServiceEndpoint: 'https://api.spritz.finance/growth',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
exports.config = (0, config_1.setupEnvConfig)(envConfigs);
|
package/lib/credentials.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getServiceCredentials: () => Promise<any>;
|
|
1
|
+
export declare const getServiceCredentials: () => Promise<any>;
|
package/lib/credentials.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.getServiceCredentials = void 0;
|
|
26
|
-
const axios_1 = __importDefault(require("axios"));
|
|
27
|
-
const qs = __importStar(require("qs"));
|
|
28
|
-
const config_1 = require("./config");
|
|
29
|
-
const params_1 = require("./params");
|
|
30
|
-
const logger_1 = __importDefault(require("@spritz-finance/logger"));
|
|
31
|
-
const getServiceCredentials = async () => {
|
|
32
|
-
try {
|
|
33
|
-
const clientIdParam = `/${config_1.config.env}/auth/serviceClientId`;
|
|
34
|
-
const clientSecretParam = `/${config_1.config.env}/auth/serviceClientSecret`;
|
|
35
|
-
const paramsByKey = await (0, params_1.getParams)([clientIdParam, clientSecretParam]);
|
|
36
|
-
const { data } = await axios_1.default.post(config_1.config.authEndpoint, qs.stringify({
|
|
37
|
-
grant_type: 'client_credentials',
|
|
38
|
-
scope: 'spritz/service',
|
|
39
|
-
client_id: paramsByKey[clientIdParam],
|
|
40
|
-
client_secret: paramsByKey[clientSecretParam],
|
|
41
|
-
}));
|
|
42
|
-
return data;
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
logger_1.default.error(`Getting credentials failed`, e);
|
|
46
|
-
throw e;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.getServiceCredentials = getServiceCredentials;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.getServiceCredentials = void 0;
|
|
26
|
+
const axios_1 = __importDefault(require("axios"));
|
|
27
|
+
const qs = __importStar(require("qs"));
|
|
28
|
+
const config_1 = require("./config");
|
|
29
|
+
const params_1 = require("./params");
|
|
30
|
+
const logger_1 = __importDefault(require("@spritz-finance/logger"));
|
|
31
|
+
const getServiceCredentials = async () => {
|
|
32
|
+
try {
|
|
33
|
+
const clientIdParam = `/${config_1.config.env}/auth/serviceClientId`;
|
|
34
|
+
const clientSecretParam = `/${config_1.config.env}/auth/serviceClientSecret`;
|
|
35
|
+
const paramsByKey = await (0, params_1.getParams)([clientIdParam, clientSecretParam]);
|
|
36
|
+
const { data } = await axios_1.default.post(config_1.config.authEndpoint, qs.stringify({
|
|
37
|
+
grant_type: 'client_credentials',
|
|
38
|
+
scope: 'spritz/service',
|
|
39
|
+
client_id: paramsByKey[clientIdParam],
|
|
40
|
+
client_secret: paramsByKey[clientSecretParam],
|
|
41
|
+
}));
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
logger_1.default.error(`Getting credentials failed`, e);
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.getServiceCredentials = getServiceCredentials;
|
package/lib/graphClient.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { DocumentNode } from 'graphql';
|
|
3
|
-
interface QueryParams<V = any> {
|
|
4
|
-
query: DocumentNode;
|
|
5
|
-
variables?: V;
|
|
6
|
-
}
|
|
7
|
-
export declare class GraphClient {
|
|
8
|
-
client: AxiosInstance;
|
|
9
|
-
constructor();
|
|
10
|
-
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<{
|
|
11
|
-
data: Q;
|
|
12
|
-
errors?: any;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { DocumentNode } from 'graphql';
|
|
3
|
+
interface QueryParams<V = any> {
|
|
4
|
+
query: DocumentNode;
|
|
5
|
+
variables?: V;
|
|
6
|
+
}
|
|
7
|
+
export declare class GraphClient {
|
|
8
|
+
client: AxiosInstance;
|
|
9
|
+
constructor();
|
|
10
|
+
query<Q = any, V = any>({ query, variables }: QueryParams<V>): Promise<{
|
|
11
|
+
data: Q;
|
|
12
|
+
errors?: any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
package/lib/graphClient.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GraphClient = void 0;
|
|
4
|
-
const serviceClient_1 = require("./serviceClient");
|
|
5
|
-
const config_1 = require("./config");
|
|
6
|
-
const graphql_1 = require("graphql");
|
|
7
|
-
class GraphClient {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.client = (0, serviceClient_1.createServiceClient)({
|
|
10
|
-
baseURL: config_1.config.graphEndpoint,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
async query({ query, variables }) {
|
|
14
|
-
var _a, _b, _c;
|
|
15
|
-
return this.client
|
|
16
|
-
.post('', {
|
|
17
|
-
query: (0, graphql_1.print)(query),
|
|
18
|
-
variables,
|
|
19
|
-
operationName: (_c = (_b = (_a = query === null || query === void 0 ? void 0 : query.definitions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.value,
|
|
20
|
-
})
|
|
21
|
-
.then((res) => res.data);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.GraphClient = GraphClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphClient = void 0;
|
|
4
|
+
const serviceClient_1 = require("./serviceClient");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const graphql_1 = require("graphql");
|
|
7
|
+
class GraphClient {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
10
|
+
baseURL: config_1.config.graphEndpoint,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async query({ query, variables }) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
return this.client
|
|
16
|
+
.post('', {
|
|
17
|
+
query: (0, graphql_1.print)(query),
|
|
18
|
+
variables,
|
|
19
|
+
operationName: (_c = (_b = (_a = query === null || query === void 0 ? void 0 : query.definitions) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.value,
|
|
20
|
+
})
|
|
21
|
+
.then((res) => res.data);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.GraphClient = GraphClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/lib/graphClient.test.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
7
|
-
const graphClient_1 = require("./graphClient");
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
7
|
+
const graphClient_1 = require("./graphClient");
|
|
8
8
|
const query = (0, graphql_tag_1.default) `
|
|
9
9
|
query ASDF {
|
|
10
10
|
getUsers {
|
|
11
11
|
email
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`;
|
|
15
|
-
describe('graphClient', () => {
|
|
16
|
-
const client = new graphClient_1.GraphClient();
|
|
17
|
-
it('should work', async () => {
|
|
18
|
-
const { data, errors } = await client.query({
|
|
19
|
-
query,
|
|
20
|
-
});
|
|
21
|
-
expect(errors).toBeFalsy();
|
|
22
|
-
expect(data.getUsers).toEqual(expect.arrayContaining([
|
|
23
|
-
expect.objectContaining({
|
|
24
|
-
email: 'eliyahu@spritz.finance',
|
|
25
|
-
}),
|
|
26
|
-
]));
|
|
27
|
-
console.log(data === null || data === void 0 ? void 0 : data.getUsers);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
14
|
+
`;
|
|
15
|
+
describe('graphClient', () => {
|
|
16
|
+
const client = new graphClient_1.GraphClient();
|
|
17
|
+
it('should work', async () => {
|
|
18
|
+
const { data, errors } = await client.query({
|
|
19
|
+
query,
|
|
20
|
+
});
|
|
21
|
+
expect(errors).toBeFalsy();
|
|
22
|
+
expect(data.getUsers).toEqual(expect.arrayContaining([
|
|
23
|
+
expect.objectContaining({
|
|
24
|
+
email: 'eliyahu@spritz.finance',
|
|
25
|
+
}),
|
|
26
|
+
]));
|
|
27
|
+
console.log(data === null || data === void 0 ? void 0 : data.getUsers);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare class GrowthServiceClient {
|
|
3
|
-
client: AxiosInstance;
|
|
4
|
-
constructor();
|
|
5
|
-
getUserReferrer(userId: string): Promise<string>;
|
|
6
|
-
}
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export declare class GrowthServiceClient {
|
|
3
|
+
client: AxiosInstance;
|
|
4
|
+
constructor();
|
|
5
|
+
getUserReferrer(userId: string): Promise<string>;
|
|
6
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GrowthServiceClient = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
const serviceClient_1 = require("./serviceClient");
|
|
6
|
-
class GrowthServiceClient {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.client = (0, serviceClient_1.createServiceClient)({
|
|
9
|
-
baseURL: config_1.config.growthServiceEndpoint,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
async getUserReferrer(userId) {
|
|
13
|
-
return this.client
|
|
14
|
-
.get(`/referrals/referrer/${userId}`)
|
|
15
|
-
.then((res) => res.data);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.GrowthServiceClient = GrowthServiceClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GrowthServiceClient = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
class GrowthServiceClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
9
|
+
baseURL: config_1.config.growthServiceEndpoint,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async getUserReferrer(userId) {
|
|
13
|
+
return this.client
|
|
14
|
+
.get(`/referrals/referrer/${userId}`)
|
|
15
|
+
.then((res) => res.data);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GrowthServiceClient = GrowthServiceClient;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './graphClient';
|
|
2
|
-
export * from './credentials';
|
|
3
|
-
export * from './serviceClient';
|
|
4
|
-
export * from './verificationServiceClient';
|
|
5
|
-
export * from './transactionsServiceClient';
|
|
6
|
-
export * from './usersServiceClient';
|
|
7
|
-
export * from './growthServiceClient';
|
|
8
|
-
export * from './liabilitiesServiceClient';
|
|
9
|
-
export * from './payableAccountsServiceClient';
|
|
1
|
+
export * from './graphClient';
|
|
2
|
+
export * from './credentials';
|
|
3
|
+
export * from './serviceClient';
|
|
4
|
+
export * from './verificationServiceClient';
|
|
5
|
+
export * from './transactionsServiceClient';
|
|
6
|
+
export * from './usersServiceClient';
|
|
7
|
+
export * from './growthServiceClient';
|
|
8
|
+
export * from './liabilitiesServiceClient';
|
|
9
|
+
export * from './payableAccountsServiceClient';
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./graphClient"), exports);
|
|
14
|
-
__exportStar(require("./credentials"), exports);
|
|
15
|
-
__exportStar(require("./serviceClient"), exports);
|
|
16
|
-
__exportStar(require("./verificationServiceClient"), exports);
|
|
17
|
-
__exportStar(require("./transactionsServiceClient"), exports);
|
|
18
|
-
__exportStar(require("./usersServiceClient"), exports);
|
|
19
|
-
__exportStar(require("./growthServiceClient"), exports);
|
|
20
|
-
__exportStar(require("./liabilitiesServiceClient"), exports);
|
|
21
|
-
__exportStar(require("./payableAccountsServiceClient"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./graphClient"), exports);
|
|
14
|
+
__exportStar(require("./credentials"), exports);
|
|
15
|
+
__exportStar(require("./serviceClient"), exports);
|
|
16
|
+
__exportStar(require("./verificationServiceClient"), exports);
|
|
17
|
+
__exportStar(require("./transactionsServiceClient"), exports);
|
|
18
|
+
__exportStar(require("./usersServiceClient"), exports);
|
|
19
|
+
__exportStar(require("./growthServiceClient"), exports);
|
|
20
|
+
__exportStar(require("./liabilitiesServiceClient"), exports);
|
|
21
|
+
__exportStar(require("./payableAccountsServiceClient"), exports);
|