@spritz-finance/service-client 0.28.0 → 0.29.1

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.
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { DocumentNode } from "graphql";
2
+ import type { DocumentNode } from "graphql";
3
3
  interface QueryParams<V = any> {
4
4
  query: DocumentNode;
5
5
  variables?: V;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GraphClient = void 0;
4
- const graphql_1 = require("graphql");
4
+ // Not the "graphql" index: that loads the whole library (schema, validation,
5
+ // execution) into every service that imports this package. Printing needs only
6
+ // the language module.
7
+ const printer_1 = require("graphql/language/printer");
5
8
  const config_1 = require("./config");
6
9
  const createGraphClient_1 = require("./createGraphClient");
7
10
  class GraphClient {
@@ -14,7 +17,7 @@ class GraphClient {
14
17
  var _a, _b, _c;
15
18
  return this.client
16
19
  .post("", {
17
- query: (0, graphql_1.print)(query),
20
+ query: (0, printer_1.print)(query),
18
21
  variables,
19
22
  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
23
  })
@@ -1,5 +1,5 @@
1
1
  export * as PlatformClient from "./platformServiceClient";
2
- import { CreateTokenizationData, CreateTokenizationRequest, IssueCardPayoutData, IssueCardPayoutRequest, IssuePayoutData, IssuePayoutRequest, IntegratorUsageKey, IntegratorUsageOperation, IntegratorUsageSummary, MTBalancesData, PlaidTreasuryBalancesData, RelayCheckbookCardData, RelayCheckbookCardRequest, ReleaseIntegratorUsageRequest, ReserveIntegratorUsageRequest, SendPaymentData, SendPaymentRequest, TabapayBalancesResponse, TabapayFundingRequirementResponse, ValidateBillData, ValidateBillRequest } from "./types";
2
+ import { CreateTokenizationData, CreateTokenizationRequest, IssueCardPayoutData, IssueCardPayoutRequest, IssuePayoutData, IssuePayoutRequest, IntegratorUsageKey, IntegratorUsageOperation, IntegratorUsageSummary, MTBalancesData, PersonByUserData, PlaidTreasuryBalancesData, RelayCheckbookCardData, RelayCheckbookCardRequest, ReleaseIntegratorUsageRequest, ReserveIntegratorUsageRequest, SendPaymentData, SendPaymentRequest, TabapayBalancesResponse, TabapayFundingRequirementResponse, ValidateBillData, ValidateBillRequest } from "./types";
3
3
  export declare function validateBill(request: ValidateBillRequest): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ValidateBillData>>;
4
4
  export declare function tabapayBalances(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<TabapayBalancesResponse>>;
5
5
  export declare function tabapayFundingRequirement(currency?: string): Promise<TabapayFundingRequirementResponse>;
@@ -37,3 +37,9 @@ export declare function reserveIntegratorUsage(request: ReserveIntegratorUsageRe
37
37
  export declare function commitIntegratorUsage(key: IntegratorUsageKey): Promise<IntegratorUsageOperation>;
38
38
  export declare function releaseIntegratorUsage(request: ReleaseIntegratorUsageRequest): Promise<IntegratorUsageOperation>;
39
39
  export declare function getIntegratorUsage(integratorId: string): Promise<IntegratorUsageSummary>;
40
+ /**
41
+ * Person membership of an account as platform holds it. An account without a
42
+ * Person answers on 2xx too (`outcome: "none"`), so a rejection here is an
43
+ * outage, never "no Person".
44
+ */
45
+ export declare function getPersonByUser(userId: string): Promise<PersonByUserData>;
@@ -51,6 +51,7 @@ exports.reserveIntegratorUsage = reserveIntegratorUsage;
51
51
  exports.commitIntegratorUsage = commitIntegratorUsage;
52
52
  exports.releaseIntegratorUsage = releaseIntegratorUsage;
53
53
  exports.getIntegratorUsage = getIntegratorUsage;
54
+ exports.getPersonByUser = getPersonByUser;
54
55
  exports.PlatformClient = __importStar(require("./platformServiceClient"));
55
56
  const axios_1 = __importDefault(require("axios"));
56
57
  // @ts-expect-error no type declarations for axios-token-interceptor
@@ -174,3 +175,14 @@ async function getIntegratorUsage(integratorId) {
174
175
  .get(`${INTEGRATOR_USAGE_ENDPOINT}/integrators/${encodeURIComponent(integratorId)}`)
175
176
  .then((res) => res.data);
176
177
  }
178
+ const PERSONS_ENDPOINT = "/v1/persons";
179
+ /**
180
+ * Person membership of an account as platform holds it. An account without a
181
+ * Person answers on 2xx too (`outcome: "none"`), so a rejection here is an
182
+ * outage, never "no Person".
183
+ */
184
+ async function getPersonByUser(userId) {
185
+ return platformClient
186
+ .get(`${PERSONS_ENDPOINT}/by-user/${encodeURIComponent(userId)}`)
187
+ .then((res) => res.data);
188
+ }
@@ -275,3 +275,26 @@ export type IntegratorUsageSummary = {
275
275
  remainingTransactionCount?: number;
276
276
  remainingVolumeUsd?: string;
277
277
  };
278
+ /**
279
+ * How an account relates to a Person: `linked` to other accounts, `distinct`
280
+ * (the only account of its Person) or `none` (no Person).
281
+ */
282
+ export type PersonOutcome = "linked" | "distinct" | "none";
283
+ /**
284
+ * How an account joined its Person: `sole` when its own verification made the
285
+ * Person, `key_match` when it joined a Person already holding one of its
286
+ * verified identifiers. A key match is not proof that the accounts are one
287
+ * human.
288
+ */
289
+ export type PersonMembership = "sole" | "key_match";
290
+ /**
291
+ * `GET /v1/persons/by-user/:userId`: the account's Person as platform holds it.
292
+ * `personId` is internal and is never shown to partners.
293
+ */
294
+ export interface PersonByUserData {
295
+ personId: string | null;
296
+ outcome: PersonOutcome;
297
+ /** Every account of the Person, this one included; empty when the account has no Person. */
298
+ memberUserIds: string[];
299
+ membership: PersonMembership | null;
300
+ }
@@ -11,6 +11,36 @@ type DebitCardPayableType = {
11
11
  type VCCPayableType = {
12
12
  type: string;
13
13
  };
14
+ /**
15
+ * Why an account was tagged as a duplicate: the stored values of verification's
16
+ * `DuplicateSignal`, as the raw document carries them.
17
+ */
18
+ export type IdentityDuplicateSignal = "persona_document" | "national_id" | "document" | "name_dob" | "phone_address" | "phone" | "manual_override" | "duplicate_failure";
19
+ /**
20
+ * Set the first time an account is found to share an identity with another one
21
+ * and never cleared: a plain "has ever been marked as a duplicate" tag that
22
+ * accumulates signals and matched accounts. A candidate signal, not proof that
23
+ * two accounts belong to one person.
24
+ */
25
+ export type IdentityDuplicateMark = {
26
+ firstMarkedAt: string;
27
+ lastMarkedAt: string;
28
+ signals: IdentityDuplicateSignal[];
29
+ matchedUserIds: string[];
30
+ };
31
+ /**
32
+ * Stored value of verification's `ManualOverrideReason`. The raw document
33
+ * carries this snake_case value, not the GraphQL enum name.
34
+ */
35
+ export type IdentityManualOverrideReason = "duplicate_identity";
36
+ /** Staff approved the account past a block; present only when they did. */
37
+ export type IdentityManualOverrideRecord = {
38
+ reason: IdentityManualOverrideReason;
39
+ approvedAt: string;
40
+ approvedByUserId: string;
41
+ approvedByEmail?: string;
42
+ note: string;
43
+ };
14
44
  export type Verification = {
15
45
  id: string;
16
46
  userId: string;
@@ -35,6 +65,8 @@ export type Verification = {
35
65
  countryCode: string;
36
66
  };
37
67
  };
68
+ duplicateMark?: IdentityDuplicateMark;
69
+ manualOverride?: IdentityManualOverrideRecord;
38
70
  };
39
71
  bankAccount: {
40
72
  status: VerificationModuleStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",