@avenlabs/halal-trace-sdk 0.1.1 → 0.1.3
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 +8 -2
- package/dist/client.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/node.d.ts +1 -0
- package/dist/node.js +1 -0
- package/dist/utils.js +4 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +0 -1
- package/src/node.ts +1 -0
- package/src/utils.ts +4 -2
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ TypeScript SDK for Halal Trace API.
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
pnpm add @halal-trace
|
|
8
|
+
pnpm add @avenlabs/halal-trace-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
import { ApiClient } from "@halal-trace
|
|
14
|
+
import { ApiClient } from "@avenlabs/halal-trace-sdk";
|
|
15
15
|
|
|
16
16
|
const client = new ApiClient({
|
|
17
17
|
baseUrl: "http://localhost:4000",
|
|
@@ -94,6 +94,12 @@ const client = new ApiClient({
|
|
|
94
94
|
});
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Node-only helpers
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { saveToFile } from "@avenlabs/halal-trace-sdk/node";
|
|
101
|
+
```
|
|
102
|
+
|
|
97
103
|
## List all relayer jobs
|
|
98
104
|
|
|
99
105
|
```ts
|
package/dist/client.js
CHANGED
|
@@ -9,7 +9,7 @@ const withDefaults = (client, options = {}) => {
|
|
|
9
9
|
auth: options.auth ?? client.authOptions,
|
|
10
10
|
onAuthError: options.onAuthError ?? client.onAuthError,
|
|
11
11
|
sdkHeaders: {
|
|
12
|
-
"x-sdk-name": "@halal-trace
|
|
12
|
+
"x-sdk-name": "@avenlabs/halal-trace-sdk",
|
|
13
13
|
"x-sdk-version": sdkVersion,
|
|
14
14
|
...(client.clientVersion ? { "x-client-version": client.clientVersion } : {}),
|
|
15
15
|
...(client.userAgent ? { "User-Agent": client.userAgent } : {}),
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export { ApiClient } from "./client.js";
|
|
|
2
2
|
export type { Anchor, ApiErrorResponse, ApiResponse, AuthResult, AuthSession, AuditLog, AuditPack, AuditPackManifest, Batch, CertificationRecord, Device, DocumentAnchor, EventDepartment, HealthResponse, Hologram, HologramVerification, Invite, Member, Org, OrgInviteResult, OrgUserLookup, Permission, PublicAttribute, RelayerJobSummary, SignatureRecord, TraceEvent, } from "./types.js";
|
|
3
3
|
export { ApiError } from "./http.js";
|
|
4
4
|
export type { AuthOptions, ClientHooks, RetryOptions } from "./http.js";
|
|
5
|
-
export { saveToFile } from "./utils.js";
|
package/dist/index.js
CHANGED
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { saveToFile } from "./utils.js";
|
package/dist/node.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { saveToFile } from "./utils.js";
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { writeFile } from "node:fs/promises";
|
|
2
1
|
export const saveToFile = async (path, data) => {
|
|
2
|
+
if (typeof window !== "undefined") {
|
|
3
|
+
throw new Error("saveToFile is only available in Node.js");
|
|
4
|
+
}
|
|
5
|
+
const { writeFile } = await import("node:fs/promises");
|
|
3
6
|
const buffer = data instanceof Uint8Array ? data : Buffer.from(data);
|
|
4
7
|
await writeFile(path, buffer);
|
|
5
8
|
};
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -59,7 +59,7 @@ const withDefaults = (client: ApiClient, options: RequestConfig = {}): RequestOp
|
|
|
59
59
|
auth: options.auth ?? client.authOptions,
|
|
60
60
|
onAuthError: options.onAuthError ?? client.onAuthError,
|
|
61
61
|
sdkHeaders: {
|
|
62
|
-
"x-sdk-name": "@halal-trace
|
|
62
|
+
"x-sdk-name": "@avenlabs/halal-trace-sdk",
|
|
63
63
|
"x-sdk-version": sdkVersion,
|
|
64
64
|
...(client.clientVersion ? { "x-client-version": client.clientVersion } : {}),
|
|
65
65
|
...(client.userAgent ? { "User-Agent": client.userAgent } : {}),
|
package/src/index.ts
CHANGED
package/src/node.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { saveToFile } from "./utils.js";
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { writeFile } from "node:fs/promises";
|
|
2
|
-
|
|
3
1
|
export const saveToFile = async (path: string, data: ArrayBuffer | Uint8Array) => {
|
|
2
|
+
if (typeof window !== "undefined") {
|
|
3
|
+
throw new Error("saveToFile is only available in Node.js");
|
|
4
|
+
}
|
|
5
|
+
const { writeFile } = await import("node:fs/promises");
|
|
4
6
|
const buffer = data instanceof Uint8Array ? data : Buffer.from(data);
|
|
5
7
|
await writeFile(path, buffer);
|
|
6
8
|
};
|