@spritz-finance/service-client 0.16.0 → 0.18.0
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/index.d.ts +2 -0
- package/lib/index.js +4 -1
- package/lib/notifications/notificationsServiceClient.d.ts +9 -0
- package/lib/notifications/notificationsServiceClient.js +53 -0
- package/lib/notifications/types.d.ts +16 -0
- package/lib/notifications/types.js +2 -0
- package/lib/platform/types.d.ts +32 -3
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export { GrowthClient } from "./growth/growthServiceClient";
|
|
|
12
12
|
export * from "./growth/types";
|
|
13
13
|
export { LiabilitiesClient } from "./liabilities/liabilitiesServiceClient";
|
|
14
14
|
export * from "./liabilities/types";
|
|
15
|
+
export { NotificationsClient } from "./notifications/notificationsServiceClient";
|
|
16
|
+
export * from "./notifications/types";
|
|
15
17
|
export { OnrampClient } from "./onramp/onrampServiceClient";
|
|
16
18
|
export * from "./onramp/types";
|
|
17
19
|
export { PayableAccountsClient } from "./payableAccounts/payableAccountsServiceClient";
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Web3Client = exports.VerificationClient = exports.UsersClient = exports.UnblockClient = exports.TransactionsClient = exports.RainClient = exports.PayoutsClient = exports.PaymentsClient = exports.PlatformClient = exports.PaymentAddressClient = exports.PayableAccountsClient = exports.OnrampClient = exports.LiabilitiesClient = exports.GrowthClient = exports.FeaturesClient = exports.ExchangeRatesClient = exports.CheckbookClient = exports.BridgeClient = void 0;
|
|
17
|
+
exports.Web3Client = exports.VerificationClient = exports.UsersClient = exports.UnblockClient = exports.TransactionsClient = exports.RainClient = exports.PayoutsClient = exports.PaymentsClient = exports.PlatformClient = exports.PaymentAddressClient = exports.PayableAccountsClient = exports.OnrampClient = exports.NotificationsClient = exports.LiabilitiesClient = exports.GrowthClient = exports.FeaturesClient = exports.ExchangeRatesClient = exports.CheckbookClient = exports.BridgeClient = void 0;
|
|
18
18
|
var bridgeServiceClient_1 = require("./bridge/bridgeServiceClient");
|
|
19
19
|
Object.defineProperty(exports, "BridgeClient", { enumerable: true, get: function () { return bridgeServiceClient_1.BridgeClient; } });
|
|
20
20
|
__exportStar(require("./bridge/types"), exports);
|
|
@@ -35,6 +35,9 @@ __exportStar(require("./growth/types"), exports);
|
|
|
35
35
|
var liabilitiesServiceClient_1 = require("./liabilities/liabilitiesServiceClient");
|
|
36
36
|
Object.defineProperty(exports, "LiabilitiesClient", { enumerable: true, get: function () { return liabilitiesServiceClient_1.LiabilitiesClient; } });
|
|
37
37
|
__exportStar(require("./liabilities/types"), exports);
|
|
38
|
+
var notificationsServiceClient_1 = require("./notifications/notificationsServiceClient");
|
|
39
|
+
Object.defineProperty(exports, "NotificationsClient", { enumerable: true, get: function () { return notificationsServiceClient_1.NotificationsClient; } });
|
|
40
|
+
__exportStar(require("./notifications/types"), exports);
|
|
38
41
|
var onrampServiceClient_1 = require("./onramp/onrampServiceClient");
|
|
39
42
|
Object.defineProperty(exports, "OnrampClient", { enumerable: true, get: function () { return onrampServiceClient_1.OnrampClient; } });
|
|
40
43
|
__exportStar(require("./onramp/types"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as NotificationsClient from "./notificationsServiceClient";
|
|
2
|
+
import { EmailVerification } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Verifies deliverability through the notifications service's reputation
|
|
5
|
+
* cache (domain lists, cached verdicts, then a NeverBounce probe). An
|
|
6
|
+
* uncached probe can take several seconds; callers on a hot path should
|
|
7
|
+
* treat an ApiFailure as accept rather than block on retries.
|
|
8
|
+
*/
|
|
9
|
+
export declare function verifyEmail(email: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<EmailVerification>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.NotificationsClient = void 0;
|
|
37
|
+
exports.verifyEmail = verifyEmail;
|
|
38
|
+
exports.NotificationsClient = __importStar(require("./notificationsServiceClient"));
|
|
39
|
+
const serviceClient_1 = require("../serviceClient");
|
|
40
|
+
const NOTIFICATIONS_ENDPOINT = "/v2/notifications/api";
|
|
41
|
+
/**
|
|
42
|
+
* Verifies deliverability through the notifications service's reputation
|
|
43
|
+
* cache (domain lists, cached verdicts, then a NeverBounce probe). An
|
|
44
|
+
* uncached probe can take several seconds; callers on a hot path should
|
|
45
|
+
* treat an ApiFailure as accept rather than block on retries.
|
|
46
|
+
*/
|
|
47
|
+
async function verifyEmail(email) {
|
|
48
|
+
return serviceClient_1.baseClient
|
|
49
|
+
.post(`${NOTIFICATIONS_ENDPOINT}/email-verification`, {
|
|
50
|
+
email,
|
|
51
|
+
})
|
|
52
|
+
.then((res) => res.data);
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirrors VerificationResult in the notifications service, plus `unchecked`:
|
|
3
|
+
* no verdict exists and none could be obtained (verification disabled for the
|
|
4
|
+
* stage, an unverifiable domain, or a failed lookup).
|
|
5
|
+
*/
|
|
6
|
+
export type EmailVerificationResult = "valid" | "invalid" | "disposable" | "catchall" | "unknown" | "complained" | "unchecked";
|
|
7
|
+
export interface EmailVerification {
|
|
8
|
+
/** The normalized (trimmed, lowercased) address the verdict is about. */
|
|
9
|
+
email: string;
|
|
10
|
+
result: EmailVerificationResult;
|
|
11
|
+
/**
|
|
12
|
+
* False only on a positive `invalid` or `disposable`. Anything inconclusive
|
|
13
|
+
* accepts, so enforcing this never couples signup to NeverBounce uptime.
|
|
14
|
+
*/
|
|
15
|
+
accept: boolean;
|
|
16
|
+
}
|
package/lib/platform/types.d.ts
CHANGED
|
@@ -6,11 +6,40 @@ export interface ValidateBillData {
|
|
|
6
6
|
payable: boolean;
|
|
7
7
|
reason?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Mirrors platform's `GetTabapayBalancesResponse` (internal-api
|
|
11
|
+
* `services/billpay/tabapay/tabapay-read-handlers.ts`). Kept field-for-field:
|
|
12
|
+
* this type was hand-maintained and drifted, declaring `unwired_debt` and
|
|
13
|
+
* `reconciliation_total` — which that endpoint has never returned — while
|
|
14
|
+
* omitting most of what it does. Consumers reading the phantom fields got
|
|
15
|
+
* `undefined` at runtime with the type insisting they were `string`.
|
|
16
|
+
*
|
|
17
|
+
* `liability` and `terminal_liability` are DISJOINT components of the TabaPay
|
|
18
|
+
* payable, mirroring Modern Treasury: `liability` is payouts committed but not
|
|
19
|
+
* yet sent (still funded by the prefund), `terminal_liability` is payouts that
|
|
20
|
+
* bounced and have not been refunded (cash gone, still owed out). Total owed
|
|
21
|
+
* is the sum — reporting `liability` alone understates it.
|
|
22
|
+
*/
|
|
9
23
|
export type TabapayBalancesResponse = {
|
|
10
|
-
balance: string;
|
|
11
|
-
|
|
24
|
+
balance: string | null;
|
|
25
|
+
inferred_balance: string | null;
|
|
26
|
+
balance_as_of: string | null;
|
|
27
|
+
balance_s3_key: string | null;
|
|
28
|
+
balance_stale: boolean;
|
|
29
|
+
target_float: string;
|
|
30
|
+
surplus: string | null;
|
|
31
|
+
statement_balance: string | null;
|
|
32
|
+
statement_balance_as_of: string | null;
|
|
33
|
+
statement_balance_s3_key: string | null;
|
|
34
|
+
statement_balance_stale: boolean;
|
|
35
|
+
implied_in_flight: string | null;
|
|
36
|
+
wire_movements_total: string;
|
|
37
|
+
released_total: string;
|
|
38
|
+
excluded_after_submission: string;
|
|
39
|
+
pending_release_amount: string;
|
|
40
|
+
outstanding_payable: string;
|
|
12
41
|
liability: string;
|
|
13
|
-
|
|
42
|
+
terminal_liability: string;
|
|
14
43
|
};
|
|
15
44
|
export type TabapayFundingRequirementResponse = {
|
|
16
45
|
ready_amount: string;
|