@settlemint/dalp-sdk 2.1.7-main.22780180229

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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Optional oRPC link plugins for advanced SDK usage.
3
+ *
4
+ * These are thin re-exports with JSDoc guidance. Import from
5
+ * `@settlemint/dalp-sdk/plugins` to keep the main entry point lean.
6
+ *
7
+ * Related: kit/sdk/src/client.ts
8
+ *
9
+ * @module
10
+ */
11
+ export { RequestValidationPlugin, ResponseValidationPlugin } from "@orpc/contract/plugins";
12
+ export { BatchLinkPlugin } from "@orpc/client/plugins";
@@ -0,0 +1,8 @@
1
+ // src/plugins/index.ts
2
+ import { RequestValidationPlugin, ResponseValidationPlugin } from "@orpc/contract/plugins";
3
+ import { BatchLinkPlugin } from "@orpc/client/plugins";
4
+ export {
5
+ ResponseValidationPlugin,
6
+ RequestValidationPlugin,
7
+ BatchLinkPlugin
8
+ };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Custom JSON serializers for oRPC wire format.
3
+ *
4
+ * Vendored from @core/validation to avoid pulling in heavy transitive
5
+ * dependencies (viem, date-fns, iso-3166). Only the serializer objects
6
+ * are included — not the Zod schemas or helper functions.
7
+ *
8
+ * Related: packages/core/validation/src/bigdecimal.ts,
9
+ * packages/core/validation/src/bigint.ts,
10
+ * packages/core/validation/src/timestamp.ts
11
+ *
12
+ * @module
13
+ */
14
+ import type { StandardRPCCustomJsonSerializer } from "@orpc/client/standard";
15
+ /**
16
+ * Serializer for arbitrary-precision decimal values (dnum).
17
+ *
18
+ * Encodes `Dnum` values as JSON-safe strings on the wire and decodes
19
+ * them back into `Dnum` tuples on the receiving side.
20
+ */
21
+ export declare const bigDecimalSerializer: StandardRPCCustomJsonSerializer;
22
+ /**
23
+ * Serializer for native `bigint` values.
24
+ *
25
+ * Encodes bigints as decimal strings on the wire since JSON does not
26
+ * support the `bigint` primitive natively.
27
+ */
28
+ export declare const bigIntSerializer: StandardRPCCustomJsonSerializer;
29
+ /**
30
+ * Serializer for `Date` objects.
31
+ *
32
+ * Encodes dates as ISO-8601 strings on the wire and reconstructs
33
+ * `Date` instances on deserialization.
34
+ */
35
+ export declare const timestampSerializer: StandardRPCCustomJsonSerializer;
36
+ /**
37
+ * All DALP custom JSON serializers, pre-configured for use with
38
+ * `RPCLink` or `RPCHandler` `customJsonSerializers` option.
39
+ */
40
+ export declare const dalpSerializers: readonly StandardRPCCustomJsonSerializer[];
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Type-only exports for the DALP SDK.
3
+ *
4
+ * Import from `@settlemint/dalp-sdk/types` when you only need types
5
+ * (e.g., for function signatures) without pulling in runtime code.
6
+ *
7
+ * Related: kit/sdk/src/client.ts
8
+ *
9
+ * @module
10
+ */
11
+ import type { ContractRouterClient } from "@orpc/contract";
12
+ import type { rpcContract } from "./contract.js";
13
+ /**
14
+ * Fully typed DALP API client.
15
+ *
16
+ * Provides auto-completed access to all v2 API namespaces:
17
+ * `account`, `actions`, `addons`, `admin`, `contacts`, `exchangeRates`,
18
+ * `externalToken`, `identityRecovery`, `monitoring`, `search`,
19
+ * `settings`, `system`, `token`, `transaction`, `user`.
20
+ */
21
+ export type DalpClient = ContractRouterClient<typeof rpcContract>;
22
+ /**
23
+ * Configuration for creating a DALP API client.
24
+ */
25
+ export interface DalpClientConfig {
26
+ /** Base URL of the DALP API (e.g., `"https://dalp.example.com"`). */
27
+ url: string;
28
+ /** API key for authentication (issued via the DALP dashboard or CLI). */
29
+ apiKey: string;
30
+ /**
31
+ * Organization ID for multi-tenant setups.
32
+ * Required when the API key is scoped to multiple organizations.
33
+ */
34
+ organizationId?: string;
35
+ /**
36
+ * Additional headers merged into every request.
37
+ * Accepts a static object or a (possibly async) function for dynamic headers.
38
+ * Can override defaults like `User-Agent` but cannot override security headers (`x-api-key`, `x-organization-id`).
39
+ */
40
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
41
+ /**
42
+ * Validate outgoing requests against the contract before sending.
43
+ * Catches schema violations client-side for faster feedback.
44
+ * @defaultValue true
45
+ */
46
+ requestValidation?: boolean;
47
+ /**
48
+ * Validate incoming responses against the contract.
49
+ * Useful during development to catch API drift.
50
+ * @defaultValue false
51
+ */
52
+ responseValidation?: boolean;
53
+ /**
54
+ * Custom `fetch` implementation.
55
+ * Use this to inject logging, proxy configuration, or test doubles.
56
+ */
57
+ fetch?: typeof globalThis.fetch;
58
+ /**
59
+ * Idempotency key sent as the `Idempotency-Key` header on every request.
60
+ *
61
+ * **Warning:** This value is sent on _every_ request made by the client.
62
+ * If you reuse the same client instance for multiple mutations, the server
63
+ * will deduplicate all but the first — subsequent mutations silently return
64
+ * the first response. Only set this when the client is used for a single
65
+ * mutation (e.g., a one-shot script). For multi-mutation workflows, set the
66
+ * header per-request via the `headers` callback instead.
67
+ *
68
+ * When omitted, no idempotency key header is sent.
69
+ */
70
+ idempotencyKey?: string;
71
+ }
package/dist/types.js ADDED
File without changes
@@ -0,0 +1,4 @@
1
+ /** Semver version of the published SDK package. */
2
+ export declare const SDK_VERSION: string;
3
+ /** Default User-Agent header sent with every SDK request. */
4
+ export declare const SDK_USER_AGENT: string;
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@settlemint/dalp-sdk",
3
+ "version": "2.1.7-main.22780180229",
4
+ "private": false,
5
+ "description": "Fully typed SDK for the DALP tokenization platform API",
6
+ "homepage": "https://settlemint.com",
7
+ "bugs": {
8
+ "email": "support@settlemint.com"
9
+ },
10
+ "license": "SEE LICENSE IN LICENSE",
11
+ "author": {
12
+ "name": "SettleMint",
13
+ "email": "support@settlemint.com",
14
+ "url": "https://settlemint.com"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ "./package.json": "./package.json",
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./types": {
30
+ "types": "./dist/types.d.ts",
31
+ "import": "./dist/types.js",
32
+ "default": "./dist/types.js"
33
+ },
34
+ "./plugins": {
35
+ "types": "./dist/plugins/index.d.ts",
36
+ "import": "./dist/plugins/index.js",
37
+ "default": "./dist/plugins/index.js"
38
+ }
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "scripts": {
44
+ "build": "rm -rf dist && bun scripts/build.js && tsgo -p tsconfig.build.json && bun scripts/fix-dts-extensions.js",
45
+ "publint": "publint run --strict --pack npm",
46
+ "attw": "attw --pack . --profile esm-only",
47
+ "publish": "cp ../../LICENSE . && npm publish --ignore-scripts --tag ${TAG:-latest} --access public",
48
+ "prepack": "cp ../../LICENSE .",
49
+ "test": "vitest run --changed main --project unit",
50
+ "typecheck": "tsgo --noEmit"
51
+ },
52
+ "dependencies": {
53
+ "@orpc/client": "1.13.6",
54
+ "@orpc/contract": "1.13.5",
55
+ "currency-codes": "2.2.0",
56
+ "date-fns": "4.1.0",
57
+ "dnum": "2.17.0",
58
+ "iso-3166": "4.4.0",
59
+ "viem": "2.46.3",
60
+ "zod": "4.3.6"
61
+ },
62
+ "devDependencies": {
63
+ "@arethetypeswrong/cli": "0.18.2",
64
+ "@dalp/dapi-contract": "workspace:*",
65
+ "@tools/typescript-config": "workspace:*",
66
+ "@tools/vitest-config": "workspace:*",
67
+ "publint": "0.3.18",
68
+ "typescript": "5.9.3"
69
+ },
70
+ "engines": {
71
+ "node": ">=20"
72
+ }
73
+ }