@spritz-finance/service-client 0.22.0 → 0.23.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.
@@ -27,9 +27,25 @@ export type IntegratorWebhook = {
27
27
  url: string;
28
28
  createdAt: string;
29
29
  };
30
+ /**
31
+ * What a code lookup returns: enough to identify the partner behind a code, and
32
+ * deliberately no credentials — integrator codes are sequential and guessable.
33
+ */
34
+ export type IntegratorReference = {
35
+ id: string;
36
+ name: string;
37
+ code: string | null;
38
+ deletedAt: string | null;
39
+ };
30
40
  export type Integrator = {
31
41
  id: string;
32
42
  name: string;
43
+ /**
44
+ * Compliance-facing integrator code (INT-001). Permanent and never reused.
45
+ * Absent only for integrators created before codes were introduced and not
46
+ * yet backfilled.
47
+ */
48
+ code?: string;
33
49
  email: string;
34
50
  canSubsidizeUserFees: boolean;
35
51
  kycThemeSetId?: string;
@@ -1,5 +1,5 @@
1
1
  export * as UsersClient from "./usersServiceClient";
2
- import { Integrator, IntegratorWebhook, User } from "./types";
2
+ import { Integrator, IntegratorReference, IntegratorWebhook, User } from "./types";
3
3
  export declare function getActiveUsers(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<string[]>>;
4
4
  export declare function getUserById(id: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
5
5
  export declare function setMembership(userId: string, membership: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<User>>;
@@ -12,3 +12,8 @@ export declare function validateAdIdentifiers(adIdentifiers?: {
12
12
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<boolean>>;
13
13
  export declare function getIntegratorWebhooks(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IntegratorWebhook[]>>;
14
14
  export declare function getIntegrator(integratorId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Integrator | null>>;
15
+ /**
16
+ * Reverse-resolves a compliance code (INT-001) to the integrator that owns it.
17
+ * Returns identity only — use `getIntegrator` when you need the full record.
18
+ */
19
+ export declare function getIntegratorByCode(code: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<IntegratorReference>>;
@@ -42,6 +42,7 @@ exports.findByEmail = findByEmail;
42
42
  exports.validateAdIdentifiers = validateAdIdentifiers;
43
43
  exports.getIntegratorWebhooks = getIntegratorWebhooks;
44
44
  exports.getIntegrator = getIntegrator;
45
+ exports.getIntegratorByCode = getIntegratorByCode;
45
46
  exports.UsersClient = __importStar(require("./usersServiceClient"));
46
47
  const serviceClient_1 = require("../serviceClient");
47
48
  const NEW_USER_ENDPOINT = "/v2/users/api";
@@ -89,3 +90,12 @@ async function getIntegrator(integratorId) {
89
90
  .get(`${NEW_USER_ENDPOINT}/integrators/${integratorId}`)
90
91
  .then((res) => res.data);
91
92
  }
93
+ /**
94
+ * Reverse-resolves a compliance code (INT-001) to the integrator that owns it.
95
+ * Returns identity only — use `getIntegrator` when you need the full record.
96
+ */
97
+ async function getIntegratorByCode(code) {
98
+ return serviceClient_1.baseClient
99
+ .get(`${NEW_USER_ENDPOINT}/integrators/by-code?code=${encodeURIComponent(code)}`)
100
+ .then((res) => res.data);
101
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",