@xyz17711/sanctions-check 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm](https://img.shields.io/npm/v/@xyz17711/sanctions-check)](https://www.npmjs.com/package/@xyz17711/sanctions-check)
5
5
  [![License](https://img.shields.io/npm/l/@xyz17711/sanctions-check)](https://github.com/17711-services/clients/blob/main/LICENSE)
6
6
 
7
- Typed TypeScript client for **🚫 sanctions-check-service**, part of the
7
+ Typed TypeScript client for **sanctions-check-service**, part of the
8
8
  [17711.xyz](https://api.17711.xyz) microservice fleet -- pay-per-call APIs settled in USDC via
9
9
  [x402](https://x402.org), listed on [x402scan](https://www.x402scan.com/server/f1c7b972-3405-4b75-8b4f-d1bfbd6305ff).
10
10
 
@@ -25,10 +25,13 @@ npm install @xyz17711/sanctions-check
25
25
  ```typescript
26
26
  import { Client } from "@xyz17711/sanctions-check";
27
27
 
28
- const client = new Client("https://api.17711.xyz/registry/🚫 sanctions-check-service");
28
+ const client = new Client(); // talks to https://api.17711.xyz/registry/sanctions-check-service by default
29
29
  // see the Methods table above for every available call and its request/response type
30
30
  ```
31
31
 
32
+ Pass another base URL (self-hosted instance, test server) as the first argument:
33
+ `new Client("https://my-host.example/registry/sanctions-check-service")`.
34
+
32
35
  ## Paying past the free quota
33
36
 
34
37
  Every gated tool allows a small number of free calls per day; beyond that it returns a 402
@@ -38,7 +41,7 @@ network, and payee address attached:
38
41
  ```typescript
39
42
  import { Client, PaymentRequiredError } from "@xyz17711/sanctions-check";
40
43
 
41
- const client = new Client("https://api.17711.xyz/registry/🚫 sanctions-check-service");
44
+ const client = new Client();
42
45
  try {
43
46
  await client.screenName(/* ... */);
44
47
  } catch (e) {
@@ -54,7 +57,7 @@ own environment/secrets manager, never a literal string in source code:
54
57
  ```typescript
55
58
  import { Client } from "@xyz17711/sanctions-check";
56
59
 
57
- const client = new Client("https://api.17711.xyz/registry/🚫 sanctions-check-service", {
60
+ const client = new Client({
58
61
  x402PrivateKey: process.env.X402_PRIVATE_KEY,
59
62
  x402ExpectedNetwork: "eip155:8453", // Base mainnet; use eip155:84532 for Base Sepolia testnet
60
63
  x402MaxPaymentUsdc: 0.01, // refuse any single call above this
@@ -73,7 +76,7 @@ with that same key in this process.
73
76
  import { Client } from "@xyz17711/sanctions-check";
74
77
  import { SanctionsCheckToolkit } from "@xyz17711/sanctions-check/langchain";
75
78
 
76
- const client = new Client("https://api.17711.xyz/registry/🚫 sanctions-check-service", { /* ...wallet options... */ });
79
+ const client = new Client({ /* ...wallet options... */ });
77
80
  const tools = new SanctionsCheckToolkit(client).getTools();
78
81
  ```
79
82
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Typed HTTP client and request/response interfaces for 🚫 sanctions-check-service.
2
+ * Typed HTTP client and request/response interfaces for sanctions-check-service.
3
3
  */
4
4
  import { Client as BaseClient, type ClientOptions } from "@xyz17711/core";
5
5
  export interface ListStatus {
@@ -63,8 +63,17 @@ export interface ScreenNameRequest {
63
63
  /** Restrict the screening to `person`, `entity`, `vessel` or `aircraft`. Omit it to screen everything. */
64
64
  type?: string | null;
65
65
  }
66
- /** Typed client for 🚫 sanctions-check-service, e.g. `client.screenName(...)`. */
66
+ /** Production base URL of this service; pass another to self-host or test. */
67
+ export declare const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/sanctions-check-service";
68
+ /** Typed client for sanctions-check-service, e.g. `client.screenName(...)`. */
67
69
  export declare class Client extends BaseClient {
70
+ /**
71
+ * `new Client()` talks to the production service. Pass a base URL to target another
72
+ * instance, and/or wallet options (`new Client({ x402PrivateKey, ... })`) to pay past the
73
+ * free quota automatically.
74
+ */
75
+ constructor(options?: ClientOptions);
76
+ constructor(baseUrl?: string, options?: ClientOptions);
68
77
  /** Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) */
69
78
  screenName(request: ScreenNameRequest): Promise<ScreenNameResponse>;
70
79
  }
package/dist/index.js CHANGED
@@ -1,9 +1,17 @@
1
1
  /**
2
- * Typed HTTP client and request/response interfaces for 🚫 sanctions-check-service.
2
+ * Typed HTTP client and request/response interfaces for sanctions-check-service.
3
3
  */
4
4
  import { Client as BaseClient } from "@xyz17711/core";
5
- /** Typed client for 🚫 sanctions-check-service, e.g. `client.screenName(...)`. */
5
+ /** Production base URL of this service; pass another to self-host or test. */
6
+ export const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/sanctions-check-service";
7
+ /** Typed client for sanctions-check-service, e.g. `client.screenName(...)`. */
6
8
  export class Client extends BaseClient {
9
+ constructor(baseUrlOrOptions, options = {}) {
10
+ const [url, opts] = typeof baseUrlOrOptions === "object"
11
+ ? [DEFAULT_BASE_URL, baseUrlOrOptions]
12
+ : [baseUrlOrOptions ?? DEFAULT_BASE_URL, options];
13
+ super(url, opts);
14
+ }
7
15
  /** Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) */
8
16
  async screenName(request) {
9
17
  return this.post("/v1/sanctions-check/screen_name", request);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * LangChain.js tools for 🚫 sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
2
+ * LangChain.js tools for sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
3
3
  */
4
4
  import { z } from "zod";
5
5
  import { Client } from "./index.js";
package/dist/langchain.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * LangChain.js tools for 🚫 sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
2
+ * LangChain.js tools for sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
3
3
  */
4
4
  import { tool } from "@langchain/core/tools";
5
5
  import { z } from "zod";
package/package.json CHANGED
@@ -1,7 +1,35 @@
1
1
  {
2
2
  "name": "@xyz17711/sanctions-check",
3
- "version": "0.1.0",
4
- "description": "Generated typed client for the 🚫 sanctions-check-service 17711.xyz microservice.",
3
+ "version": "0.1.2",
4
+ "description": "Typed TypeScript client for the 17711.xyz Sanctions Check API: pay-per-call, settled in USDC via x402.",
5
+ "license": "MIT",
6
+ "author": "17711 Services",
7
+ "homepage": "https://api.17711.xyz",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/17711-services/clients.git",
11
+ "directory": "node/packages/sanctions-check"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/17711-services/clients/issues"
15
+ },
16
+ "keywords": [
17
+ "x402",
18
+ "usdc",
19
+ "api-client",
20
+ "pay-per-call",
21
+ "ai-agents",
22
+ "mcp",
23
+ "langchain",
24
+ "sanctions-check"
25
+ ],
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
5
33
  "type": "module",
6
34
  "main": "dist/index.js",
7
35
  "types": "dist/index.d.ts",
package/src/index.ts DELETED
@@ -1,80 +0,0 @@
1
- /**
2
- * Typed HTTP client and request/response interfaces for 🚫 sanctions-check-service.
3
- */
4
-
5
- import { Client as BaseClient, type ClientOptions } from "@xyz17711/core";
6
-
7
- export interface ListStatus {
8
- entries: number;
9
- /** When this service last downloaded the list (UTC). */
10
- fetched_at: string;
11
- list: string;
12
- /** Publication date announced by the list itself, when it states one. */
13
- published?: string | null;
14
- }
15
-
16
- export interface SanctionMatch {
17
- /** Other names the entry is listed under (at most 5). */
18
- aliases: string[];
19
- /** `true`/`false` when a `birth_year` was given and the entry publishes birth years. */
20
- birth_year_consistent?: boolean | null;
21
- /** Published years of birth. */
22
- birth_years: number[];
23
- /** Nationalities or countries, when published. */
24
- countries: string[];
25
- /** The entry's identifier in that list. */
26
- entry_id: string;
27
- /** `person`, `entity`, `vessel` or `aircraft`. */
28
- kind: string;
29
- /** `OFAC SDN`, `EU consolidated` or `UN Security Council`. */
30
- list: string;
31
- /** The listed primary name. */
32
- listed_name: string;
33
- /** Date of listing, when published. */
34
- listed_on?: string | null;
35
- /** `exact`, `close` or `possible`. */
36
- match_type: string;
37
- /** The name or alias that matched, when it is not the primary name. */
38
- matched_alias?: string | null;
39
- /** Sanctions programmes or regimes. */
40
- programs: string[];
41
- /** Published remarks (truncated). */
42
- remarks?: string | null;
43
- /** 0 to 1: 1 means the same words (any order); lower means a partial or approximate match. */
44
- score: number;
45
- }
46
-
47
- export interface ScreenNameResponse {
48
- disclaimer: string;
49
- /** Lists that could not be loaded: the screening did not cover them. */
50
- lists_missing: string[];
51
- /** The lists that were screened, with their size and freshness. */
52
- lists_screened: ListStatus[];
53
- /** The best matches, highest score first (at most 10). */
54
- matches: SanctionMatch[];
55
- /** The name as screened. */
56
- name: string;
57
- /** When the screening ran (UTC). */
58
- screened_at: string;
59
- /** `match` (an exact or close match), `possible_match` (a partial match to review) or `no_match`. */
60
- verdict: string;
61
- }
62
-
63
- export interface ScreenNameRequest {
64
- /** A person's year of birth. Listed people whose published birth years do not include it are ranked lower and marked `birth_year_consistent: false`. */
65
- birth_year?: number | null;
66
- /** The name to screen: a person (`Vladimir Putin`, `Putin, Vladimir`) or a company, vessel or organisation. Word order, accents, capitalisation and small spelling variants do not matter. */
67
- name: string;
68
- /** Restrict the screening to `person`, `entity`, `vessel` or `aircraft`. Omit it to screen everything. */
69
- type?: string | null;
70
- }
71
-
72
- /** Typed client for 🚫 sanctions-check-service, e.g. `client.screenName(...)`. */
73
- export class Client extends BaseClient {
74
- /** Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402) */
75
- async screenName(request: ScreenNameRequest): Promise<ScreenNameResponse> {
76
- return this.post<ScreenNameResponse>("/v1/sanctions-check/screen_name", request);
77
- }
78
- }
79
-
80
- export { ClientOptions };
package/src/langchain.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * LangChain.js tools for 🚫 sanctions-check-service, grouped in one Toolkit -- one tool per operation, each just an async function (JS has no separate sync form to generate). Requires the `@langchain/core`+`zod` peer dependencies declared in this package's own package.json -- imported from `sanctions-check/langchain`, never from the package root, so importing the base client never requires them installed.
3
- */
4
-
5
- import { tool } from "@langchain/core/tools";
6
- import { z } from "zod";
7
- import { Client } from "./index.js";
8
-
9
- export class SanctionsCheckToolkit {
10
- private client: Client;
11
-
12
- constructor(client: Client) {
13
- this.client = client;
14
- }
15
-
16
- getTools() {
17
- return [
18
- tool(
19
- async (input) => this.client.screenName(input),
20
- {
21
- name: "screenName",
22
- description: "Sanctions check: OFAC list check and sanctions screening of a person or company name against OFAC SDN, EU and UN lists (AML KYC) ($0.01, x402)",
23
- schema: z.object({ birth_year: z.number().nullable().optional(), name: z.string(), type: z.string().nullable().optional() }),
24
- },
25
- ),
26
- ];
27
- }
28
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Verifies every sanctions-check client method sends a request to the expected path/HTTP verb and parses a well-formed response -- one test per operation, real fetch mocked via a plain reassignment of `globalThis.fetch` (no extra test/mocking dependency). Runs against the COMPILED package (`../dist/index.js`) -- build before testing.
3
- */
4
-
5
- import { test } from "node:test";
6
- import assert from "node:assert/strict";
7
- import { Client } from "../dist/index.js";
8
-
9
- test("screenName calls the expected path", async () => {
10
- const originalFetch = globalThis.fetch;
11
- globalThis.fetch = async (url, init = {}) => {
12
- const parsed = new URL(url);
13
- assert.equal((init.method ?? "GET").toUpperCase(), "POST");
14
- assert.equal(parsed.pathname, "/v1/sanctions-check/screen_name");
15
- return new Response(JSON.stringify({ disclaimer: "test", lists_missing: [], lists_screened: [], matches: [], name: "test", screened_at: "test", verdict: "test" }), { status: 200 });
16
- };
17
- try {
18
- const client = new Client("https://example.test");
19
- const result = await client.screenName({ birth_year: null, name: "test", type: null });
20
- assert.ok(result !== undefined);
21
- } finally {
22
- globalThis.fetch = originalFetch;
23
- }
24
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Verifies every sanctions-check LangChain tool through the real StructuredTool (`.invoke()`), not just the underlying client method -- catches schema-shape bugs a plain client-method test would miss. Requires the `langchain`/`zod` dev dependencies.
3
- */
4
-
5
- import { test } from "node:test";
6
- import assert from "node:assert/strict";
7
- import { Client } from "../dist/index.js";
8
- import { SanctionsCheckToolkit } from "../dist/langchain.js";
9
-
10
- test("screenName tool invoke", async () => {
11
- globalThis.fetch = async () => new Response(JSON.stringify({ disclaimer: "test", lists_missing: [], lists_screened: [], matches: [], name: "test", screened_at: "test", verdict: "test" }), { status: 200 });
12
- const toolkit = new SanctionsCheckToolkit(new Client("https://example.test"));
13
- const t = toolkit.getTools().find((x) => x.name === "screenName");
14
- const result = await t.invoke({ birth_year: 0, name: "test", type: "test" });
15
- assert.ok(result !== undefined);
16
- });
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ES2020",
5
- "moduleResolution": "bundler",
6
- "declaration": true,
7
- "outDir": "dist",
8
- "rootDir": "src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true
12
- },
13
- "include": [
14
- "src"
15
- ]
16
- }