@spritz-finance/service-client 0.2.9 → 0.2.10
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 +12 -12
- package/lib/config.js +46 -46
- 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/index.d.ts +8 -8
- package/lib/index.js +20 -20
- package/lib/liabilitiesServiceClient.d.ts +43 -43
- package/lib/liabilitiesServiceClient.js +38 -38
- package/lib/params.d.ts +2 -2
- package/lib/params.js +22 -22
- package/lib/payableAccountsServiceClient.d.ts +51 -51
- package/lib/payableAccountsServiceClient.js +49 -49
- 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 +15 -12
- package/lib/usersServiceClient.js +23 -25
- package/lib/verificationServiceClient.d.ts +39 -39
- package/lib/verificationServiceClient.js +16 -16
- 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,12 +1,12 @@
|
|
|
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
|
-
}
|
|
11
|
-
export declare const config: GraphClientConfig;
|
|
12
|
-
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
|
+
}
|
|
11
|
+
export declare const config: GraphClientConfig;
|
|
12
|
+
export {};
|
package/lib/config.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
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
|
-
},
|
|
17
|
-
test: {
|
|
18
|
-
env: 'staging',
|
|
19
|
-
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
20
|
-
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
21
|
-
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
22
|
-
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
23
|
-
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
24
|
-
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
25
|
-
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
26
|
-
},
|
|
27
|
-
staging: {
|
|
28
|
-
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
29
|
-
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
30
|
-
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
31
|
-
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
32
|
-
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
33
|
-
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
34
|
-
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
35
|
-
},
|
|
36
|
-
production: {
|
|
37
|
-
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
38
|
-
graphEndpoint: 'https://api.spritz.finance/graphql',
|
|
39
|
-
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
40
|
-
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
41
|
-
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
42
|
-
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
43
|
-
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
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
|
+
},
|
|
17
|
+
test: {
|
|
18
|
+
env: 'staging',
|
|
19
|
+
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
20
|
+
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
21
|
+
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
22
|
+
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
23
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
24
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
25
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
26
|
+
},
|
|
27
|
+
staging: {
|
|
28
|
+
authEndpoint: 'https://auth-staging.spritz.finance/oauth2/token',
|
|
29
|
+
graphEndpoint: 'https://api-staging.spritz.finance/graphql',
|
|
30
|
+
verificationServiceEndpoint: 'https://api-staging.spritz.finance/verification',
|
|
31
|
+
transactionsServiceEndpoint: 'https://api-staging.spritz.finance/transactions',
|
|
32
|
+
usersServiceEndpoint: 'https://api-staging.spritz.finance/users',
|
|
33
|
+
liabilitiesServiceEndpoint: 'https://api-staging.spritz.finance/liabilities',
|
|
34
|
+
payableAccountsServiceEndpoint: 'https://api-staging.spritz.finance/payable-accounts',
|
|
35
|
+
},
|
|
36
|
+
production: {
|
|
37
|
+
authEndpoint: 'https://auth.spritz.finance/oauth2/token',
|
|
38
|
+
graphEndpoint: 'https://api.spritz.finance/graphql',
|
|
39
|
+
verificationServiceEndpoint: 'https://api.spritz.finance/verification',
|
|
40
|
+
transactionsServiceEndpoint: 'https://api.spritz.finance/transactions',
|
|
41
|
+
usersServiceEndpoint: 'https://api.spritz.finance/users',
|
|
42
|
+
liabilitiesServiceEndpoint: 'https://api.spritz.finance/liabilities',
|
|
43
|
+
payableAccountsServiceEndpoint: 'https://api.spritz.finance/payable-accounts',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
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
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 './liabilitiesServiceClient';
|
|
8
|
-
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 './liabilitiesServiceClient';
|
|
8
|
+
export * from './payableAccountsServiceClient';
|
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
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("./liabilitiesServiceClient"), exports);
|
|
20
|
-
__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("./liabilitiesServiceClient"), exports);
|
|
20
|
+
__exportStar(require("./payableAccountsServiceClient"), exports);
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare enum RewardProvider {
|
|
3
|
-
INTERNAL = "INTERNAL",
|
|
4
|
-
REFERRAL_ROCK = "REFERRAL_ROCK",
|
|
5
|
-
GROWSURF = "GROWSURF"
|
|
6
|
-
}
|
|
7
|
-
export declare enum RewardTransactionType {
|
|
8
|
-
CREDIT = "CREDIT",
|
|
9
|
-
DEBIT = "DEBIT"
|
|
10
|
-
}
|
|
11
|
-
export declare enum RewardCreditSource {
|
|
12
|
-
REFERRER_REWARD = "REFERRER_REWARD",
|
|
13
|
-
REFERRAL_REWARD = "REFERRAL_REWARD",
|
|
14
|
-
CONTEST = "CONTEST",
|
|
15
|
-
REFUND = "REFUND",
|
|
16
|
-
OTHER = "OTHER",
|
|
17
|
-
REVENUE_SHARE = "REVENUE_SHARE"
|
|
18
|
-
}
|
|
19
|
-
export interface RelatedCredit {
|
|
20
|
-
creditId: string;
|
|
21
|
-
amountSpent: number;
|
|
22
|
-
order: number;
|
|
23
|
-
}
|
|
24
|
-
export interface RewardTransaction {
|
|
25
|
-
_id: string;
|
|
26
|
-
amount: number;
|
|
27
|
-
remainingSpend: number;
|
|
28
|
-
createdAt: string;
|
|
29
|
-
id: string;
|
|
30
|
-
nonce: number;
|
|
31
|
-
type: RewardTransactionType;
|
|
32
|
-
source?: RewardCreditSource;
|
|
33
|
-
provider?: RewardProvider;
|
|
34
|
-
relatedCredits?: RelatedCredit[];
|
|
35
|
-
updatedAt: string;
|
|
36
|
-
userId: string;
|
|
37
|
-
context?: string;
|
|
38
|
-
}
|
|
39
|
-
export declare class LiabilitiesServiceClient {
|
|
40
|
-
client: AxiosInstance;
|
|
41
|
-
constructor();
|
|
42
|
-
getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
|
|
43
|
-
}
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export declare enum RewardProvider {
|
|
3
|
+
INTERNAL = "INTERNAL",
|
|
4
|
+
REFERRAL_ROCK = "REFERRAL_ROCK",
|
|
5
|
+
GROWSURF = "GROWSURF"
|
|
6
|
+
}
|
|
7
|
+
export declare enum RewardTransactionType {
|
|
8
|
+
CREDIT = "CREDIT",
|
|
9
|
+
DEBIT = "DEBIT"
|
|
10
|
+
}
|
|
11
|
+
export declare enum RewardCreditSource {
|
|
12
|
+
REFERRER_REWARD = "REFERRER_REWARD",
|
|
13
|
+
REFERRAL_REWARD = "REFERRAL_REWARD",
|
|
14
|
+
CONTEST = "CONTEST",
|
|
15
|
+
REFUND = "REFUND",
|
|
16
|
+
OTHER = "OTHER",
|
|
17
|
+
REVENUE_SHARE = "REVENUE_SHARE"
|
|
18
|
+
}
|
|
19
|
+
export interface RelatedCredit {
|
|
20
|
+
creditId: string;
|
|
21
|
+
amountSpent: number;
|
|
22
|
+
order: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RewardTransaction {
|
|
25
|
+
_id: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
remainingSpend: number;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
id: string;
|
|
30
|
+
nonce: number;
|
|
31
|
+
type: RewardTransactionType;
|
|
32
|
+
source?: RewardCreditSource;
|
|
33
|
+
provider?: RewardProvider;
|
|
34
|
+
relatedCredits?: RelatedCredit[];
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
userId: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class LiabilitiesServiceClient {
|
|
40
|
+
client: AxiosInstance;
|
|
41
|
+
constructor();
|
|
42
|
+
getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
|
|
43
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LiabilitiesServiceClient = exports.RewardCreditSource = exports.RewardTransactionType = exports.RewardProvider = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
const serviceClient_1 = require("./serviceClient");
|
|
6
|
-
var RewardProvider;
|
|
7
|
-
(function (RewardProvider) {
|
|
8
|
-
RewardProvider["INTERNAL"] = "INTERNAL";
|
|
9
|
-
RewardProvider["REFERRAL_ROCK"] = "REFERRAL_ROCK";
|
|
10
|
-
RewardProvider["GROWSURF"] = "GROWSURF";
|
|
11
|
-
})(RewardProvider = exports.RewardProvider || (exports.RewardProvider = {}));
|
|
12
|
-
var RewardTransactionType;
|
|
13
|
-
(function (RewardTransactionType) {
|
|
14
|
-
RewardTransactionType["CREDIT"] = "CREDIT";
|
|
15
|
-
RewardTransactionType["DEBIT"] = "DEBIT";
|
|
16
|
-
})(RewardTransactionType = exports.RewardTransactionType || (exports.RewardTransactionType = {}));
|
|
17
|
-
var RewardCreditSource;
|
|
18
|
-
(function (RewardCreditSource) {
|
|
19
|
-
RewardCreditSource["REFERRER_REWARD"] = "REFERRER_REWARD";
|
|
20
|
-
RewardCreditSource["REFERRAL_REWARD"] = "REFERRAL_REWARD";
|
|
21
|
-
RewardCreditSource["CONTEST"] = "CONTEST";
|
|
22
|
-
RewardCreditSource["REFUND"] = "REFUND";
|
|
23
|
-
RewardCreditSource["OTHER"] = "OTHER";
|
|
24
|
-
RewardCreditSource["REVENUE_SHARE"] = "REVENUE_SHARE";
|
|
25
|
-
})(RewardCreditSource = exports.RewardCreditSource || (exports.RewardCreditSource = {}));
|
|
26
|
-
class LiabilitiesServiceClient {
|
|
27
|
-
constructor() {
|
|
28
|
-
this.client = (0, serviceClient_1.createServiceClient)({
|
|
29
|
-
baseURL: config_1.config.liabilitiesServiceEndpoint,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async getRewardTransaction(transactionId) {
|
|
33
|
-
return this.client
|
|
34
|
-
.get(`/reward-transactions/${transactionId}`)
|
|
35
|
-
.then((res) => res.data);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.LiabilitiesServiceClient = LiabilitiesServiceClient;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LiabilitiesServiceClient = exports.RewardCreditSource = exports.RewardTransactionType = exports.RewardProvider = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
const serviceClient_1 = require("./serviceClient");
|
|
6
|
+
var RewardProvider;
|
|
7
|
+
(function (RewardProvider) {
|
|
8
|
+
RewardProvider["INTERNAL"] = "INTERNAL";
|
|
9
|
+
RewardProvider["REFERRAL_ROCK"] = "REFERRAL_ROCK";
|
|
10
|
+
RewardProvider["GROWSURF"] = "GROWSURF";
|
|
11
|
+
})(RewardProvider = exports.RewardProvider || (exports.RewardProvider = {}));
|
|
12
|
+
var RewardTransactionType;
|
|
13
|
+
(function (RewardTransactionType) {
|
|
14
|
+
RewardTransactionType["CREDIT"] = "CREDIT";
|
|
15
|
+
RewardTransactionType["DEBIT"] = "DEBIT";
|
|
16
|
+
})(RewardTransactionType = exports.RewardTransactionType || (exports.RewardTransactionType = {}));
|
|
17
|
+
var RewardCreditSource;
|
|
18
|
+
(function (RewardCreditSource) {
|
|
19
|
+
RewardCreditSource["REFERRER_REWARD"] = "REFERRER_REWARD";
|
|
20
|
+
RewardCreditSource["REFERRAL_REWARD"] = "REFERRAL_REWARD";
|
|
21
|
+
RewardCreditSource["CONTEST"] = "CONTEST";
|
|
22
|
+
RewardCreditSource["REFUND"] = "REFUND";
|
|
23
|
+
RewardCreditSource["OTHER"] = "OTHER";
|
|
24
|
+
RewardCreditSource["REVENUE_SHARE"] = "REVENUE_SHARE";
|
|
25
|
+
})(RewardCreditSource = exports.RewardCreditSource || (exports.RewardCreditSource = {}));
|
|
26
|
+
class LiabilitiesServiceClient {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.client = (0, serviceClient_1.createServiceClient)({
|
|
29
|
+
baseURL: config_1.config.liabilitiesServiceEndpoint,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async getRewardTransaction(transactionId) {
|
|
33
|
+
return this.client
|
|
34
|
+
.get(`/reward-transactions/${transactionId}`)
|
|
35
|
+
.then((res) => res.data);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.LiabilitiesServiceClient = LiabilitiesServiceClient;
|
package/lib/params.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SSM } from 'aws-sdk';
|
|
2
|
-
export declare const getParams: (keys: string[]) => Promise<SSM.Parameter>;
|
|
1
|
+
import { SSM } from 'aws-sdk';
|
|
2
|
+
export declare const getParams: (keys: string[]) => Promise<SSM.Parameter>;
|
package/lib/params.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getParams = void 0;
|
|
4
|
-
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
-
const ssm = new aws_sdk_1.SSM({
|
|
6
|
-
region: 'us-east-1',
|
|
7
|
-
});
|
|
8
|
-
const getParams = async (keys) => {
|
|
9
|
-
const params = await ssm
|
|
10
|
-
.getParameters({
|
|
11
|
-
Names: keys,
|
|
12
|
-
WithDecryption: true,
|
|
13
|
-
})
|
|
14
|
-
.promise();
|
|
15
|
-
return params.Parameters.reduce((acc, val) => {
|
|
16
|
-
return {
|
|
17
|
-
...acc,
|
|
18
|
-
[val.Name]: val.Value,
|
|
19
|
-
};
|
|
20
|
-
}, {});
|
|
21
|
-
};
|
|
22
|
-
exports.getParams = getParams;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParams = void 0;
|
|
4
|
+
const aws_sdk_1 = require("aws-sdk");
|
|
5
|
+
const ssm = new aws_sdk_1.SSM({
|
|
6
|
+
region: 'us-east-1',
|
|
7
|
+
});
|
|
8
|
+
const getParams = async (keys) => {
|
|
9
|
+
const params = await ssm
|
|
10
|
+
.getParameters({
|
|
11
|
+
Names: keys,
|
|
12
|
+
WithDecryption: true,
|
|
13
|
+
})
|
|
14
|
+
.promise();
|
|
15
|
+
return params.Parameters.reduce((acc, val) => {
|
|
16
|
+
return {
|
|
17
|
+
...acc,
|
|
18
|
+
[val.Name]: val.Value,
|
|
19
|
+
};
|
|
20
|
+
}, {});
|
|
21
|
+
};
|
|
22
|
+
exports.getParams = getParams;
|