@proveanything/smartlinks 1.0.6 → 1.0.8
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/debug.log +6 -0
- package/dist/api/asset.d.ts +14 -2
- package/dist/api/asset.js +65 -5
- package/dist/api/attestation.d.ts +23 -0
- package/dist/api/attestation.js +44 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/http.d.ts +30 -0
- package/dist/http.js +156 -0
- package/dist/types/attestation.d.ts +16 -0
- package/dist/types/attestation.js +1 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/documentation.json +1240 -211
- package/docs/functions/appConfiguration.get.html +1 -1
- package/docs/functions/asset.getAllForCollection.html +1 -1
- package/docs/functions/asset.getAllForProduct.html +1 -1
- package/docs/functions/asset.getAllForProof.html +1 -1
- package/docs/functions/asset.getForCollection.html +1 -1
- package/docs/functions/asset.getForProduct.html +1 -1
- package/docs/functions/asset.getForProof.html +1 -1
- package/docs/functions/asset.uploadAsset.html +10 -0
- package/docs/functions/attestation.create.html +2 -0
- package/docs/functions/attestation.get.html +2 -0
- package/docs/functions/attestation.getAll.html +2 -0
- package/docs/functions/attestation.remove.html +2 -0
- package/docs/functions/attestation.update.html +2 -0
- package/docs/functions/collection.get.html +1 -1
- package/docs/functions/initializeApi.html +1 -1
- package/docs/functions/product.get.html +1 -1
- package/docs/functions/product.getAll.html +1 -1
- package/docs/functions/proof.get.html +1 -1
- package/docs/functions/request.html +1 -1
- package/docs/interfaces/AppConfigurationResponse.html +4 -4
- package/docs/interfaces/AssetResponse.html +2 -2
- package/docs/interfaces/CollectionResponse.html +5 -5
- package/docs/interfaces/ErrorResponse.html +3 -3
- package/docs/interfaces/ProductResponse.html +5 -5
- package/docs/interfaces/ProofResponse.html +8 -8
- package/docs/modules/appConfiguration.html +1 -1
- package/docs/modules/asset.html +2 -1
- package/docs/modules/attestation.html +6 -0
- package/docs/modules/collection.html +1 -1
- package/docs/modules/product.html +1 -1
- package/docs/modules/proof.html +1 -1
- package/docs/modules.html +1 -0
- package/package.json +1 -1
- package/src/api/asset.ts +76 -3
- package/src/api/attestation.ts +69 -0
- package/src/api/index.ts +1 -0
- package/src/http.ts +190 -0
- package/src/types/attestation.ts +18 -0
package/debug.log
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
[0602/081836.172:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
|
2
|
+
[0602/081836.202:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
|
3
|
+
[0602/081836.512:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
|
4
|
+
[0602/081858.471:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
|
5
|
+
[0602/081858.497:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
|
6
|
+
[0602/081858.832:ERROR:registration_protocol_win.cc(108)] CreateFile: The system cannot find the file specified. (0x2)
|
package/dist/api/asset.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ export declare namespace asset {
|
|
|
4
4
|
function getAllForCollection(collectionId: string): Promise<AssetResponse[]>;
|
|
5
5
|
function getForProduct(collectionId: string, productId: string, assetId: string): Promise<AssetResponse>;
|
|
6
6
|
function getAllForProduct(collectionId: string, productId: string): Promise<AssetResponse[]>;
|
|
7
|
-
function getForProof(collectionId: string, proofId: string, assetId: string): Promise<AssetResponse>;
|
|
8
|
-
function getAllForProof(collectionId: string, proofId: string, appId?: string): Promise<AssetResponse[]>;
|
|
7
|
+
function getForProof(collectionId: string, productId: string, proofId: string, assetId: string): Promise<AssetResponse>;
|
|
8
|
+
function getAllForProof(collectionId: string, productId: string, proofId: string, appId?: string): Promise<AssetResponse[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Uploads an asset file to a proof, with optional extraData as JSON.
|
|
11
|
+
* Supports progress reporting via onProgress callback (browser only).
|
|
12
|
+
* @param collectionId - The collection ID
|
|
13
|
+
* @param productId - The product ID
|
|
14
|
+
* @param proofId - The proof ID
|
|
15
|
+
* @param file - The file to upload
|
|
16
|
+
* @param extraData - Arbitrary extra data to include (will be stringified as JSON)
|
|
17
|
+
* @param onProgress - Optional callback for upload progress (0-100)
|
|
18
|
+
* @returns Promise resolving to an AssetResponse object
|
|
19
|
+
*/
|
|
20
|
+
function uploadAsset(collectionId: string, productId: string, proofId: string, file: File, extraData?: Record<string, any>, onProgress?: (percent: number) => void): Promise<AssetResponse>;
|
|
9
21
|
}
|
package/dist/api/asset.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { request } from "../http";
|
|
1
|
+
import { request, getApiHeaders } from "../http";
|
|
2
2
|
export var asset;
|
|
3
3
|
(function (asset) {
|
|
4
4
|
// Collection-level
|
|
@@ -24,17 +24,77 @@ export var asset;
|
|
|
24
24
|
}
|
|
25
25
|
asset.getAllForProduct = getAllForProduct;
|
|
26
26
|
// Proof-level
|
|
27
|
-
async function getForProof(collectionId, proofId, assetId) {
|
|
28
|
-
const path = `/public/collection/${encodeURIComponent(collectionId)}/proof/${encodeURIComponent(proofId)}/asset/${encodeURIComponent(assetId)}`;
|
|
27
|
+
async function getForProof(collectionId, productId, proofId, assetId) {
|
|
28
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/asset/${encodeURIComponent(assetId)}`;
|
|
29
29
|
return request(path);
|
|
30
30
|
}
|
|
31
31
|
asset.getForProof = getForProof;
|
|
32
|
-
async function getAllForProof(collectionId, proofId, appId) {
|
|
33
|
-
let path = `/public/collection/${encodeURIComponent(collectionId)}/proof/${encodeURIComponent(proofId)}/asset`;
|
|
32
|
+
async function getAllForProof(collectionId, productId, proofId, appId) {
|
|
33
|
+
let path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/asset`;
|
|
34
34
|
if (appId) {
|
|
35
35
|
path += `?appId=${encodeURIComponent(appId)}`;
|
|
36
36
|
}
|
|
37
37
|
return request(path);
|
|
38
38
|
}
|
|
39
39
|
asset.getAllForProof = getAllForProof;
|
|
40
|
+
/**
|
|
41
|
+
* Uploads an asset file to a proof, with optional extraData as JSON.
|
|
42
|
+
* Supports progress reporting via onProgress callback (browser only).
|
|
43
|
+
* @param collectionId - The collection ID
|
|
44
|
+
* @param productId - The product ID
|
|
45
|
+
* @param proofId - The proof ID
|
|
46
|
+
* @param file - The file to upload
|
|
47
|
+
* @param extraData - Arbitrary extra data to include (will be stringified as JSON)
|
|
48
|
+
* @param onProgress - Optional callback for upload progress (0-100)
|
|
49
|
+
* @returns Promise resolving to an AssetResponse object
|
|
50
|
+
*/
|
|
51
|
+
async function uploadAsset(collectionId, productId, proofId, file, extraData, onProgress) {
|
|
52
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/asset`;
|
|
53
|
+
const url = (typeof window !== "undefined" && window.SMARTLINKS_API_BASEURL)
|
|
54
|
+
? window.SMARTLINKS_API_BASEURL + path
|
|
55
|
+
: path; // fallback for SSR or Node
|
|
56
|
+
const formData = new FormData();
|
|
57
|
+
formData.append("file", file);
|
|
58
|
+
if (extraData) {
|
|
59
|
+
formData.append("extraData", JSON.stringify(extraData));
|
|
60
|
+
}
|
|
61
|
+
// Use getApiHeaders from http module
|
|
62
|
+
const headers = getApiHeaders ? getApiHeaders() : {};
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
const xhr = new XMLHttpRequest();
|
|
65
|
+
xhr.open("POST", url);
|
|
66
|
+
// Set headers for API key and bearer token if available
|
|
67
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
68
|
+
xhr.setRequestHeader(key, value);
|
|
69
|
+
}
|
|
70
|
+
xhr.upload.onprogress = (event) => {
|
|
71
|
+
if (onProgress && event.lengthComputable) {
|
|
72
|
+
const percent = Math.round((event.loaded / event.total) * 100);
|
|
73
|
+
onProgress(percent);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
xhr.onload = () => {
|
|
77
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
78
|
+
try {
|
|
79
|
+
resolve(JSON.parse(xhr.responseText));
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
reject(new Error("Failed to parse server response"));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
try {
|
|
87
|
+
const errBody = JSON.parse(xhr.responseText);
|
|
88
|
+
reject(new Error(`Error ${errBody.code}: ${errBody.message}`));
|
|
89
|
+
}
|
|
90
|
+
catch (_a) {
|
|
91
|
+
reject(new Error(`Asset upload failed with status ${xhr.status}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
xhr.onerror = () => reject(new Error("Network error during asset upload"));
|
|
96
|
+
xhr.send(formData);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
asset.uploadAsset = uploadAsset;
|
|
40
100
|
})(asset || (asset = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRequest } from "../types/attestation";
|
|
2
|
+
export declare namespace attestation {
|
|
3
|
+
/**
|
|
4
|
+
* Get all attestations for a proof.
|
|
5
|
+
*/
|
|
6
|
+
function getAll(collectionId: string, productId: string, proofId: string): Promise<AttestationResponse[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Get a single attestation by ID.
|
|
9
|
+
*/
|
|
10
|
+
function get(collectionId: string, productId: string, proofId: string, attestationId: string): Promise<AttestationResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new attestation for a proof.
|
|
13
|
+
*/
|
|
14
|
+
function create(collectionId: string, productId: string, proofId: string, data: AttestationCreateRequest): Promise<AttestationResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Update an attestation.
|
|
17
|
+
*/
|
|
18
|
+
function update(collectionId: string, productId: string, proofId: string, attestationId: string, data: AttestationUpdateRequest): Promise<AttestationResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Delete an attestation.
|
|
21
|
+
*/
|
|
22
|
+
function remove(collectionId: string, productId: string, proofId: string, attestationId: string): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { request, post, put, del } from "../http";
|
|
2
|
+
export var attestation;
|
|
3
|
+
(function (attestation) {
|
|
4
|
+
/**
|
|
5
|
+
* Get all attestations for a proof.
|
|
6
|
+
*/
|
|
7
|
+
async function getAll(collectionId, productId, proofId) {
|
|
8
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/attestation`;
|
|
9
|
+
return request(path);
|
|
10
|
+
}
|
|
11
|
+
attestation.getAll = getAll;
|
|
12
|
+
/**
|
|
13
|
+
* Get a single attestation by ID.
|
|
14
|
+
*/
|
|
15
|
+
async function get(collectionId, productId, proofId, attestationId) {
|
|
16
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/attestation/${encodeURIComponent(attestationId)}`;
|
|
17
|
+
return request(path);
|
|
18
|
+
}
|
|
19
|
+
attestation.get = get;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new attestation for a proof.
|
|
22
|
+
*/
|
|
23
|
+
async function create(collectionId, productId, proofId, data) {
|
|
24
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/attestation`;
|
|
25
|
+
return post(path, data);
|
|
26
|
+
}
|
|
27
|
+
attestation.create = create;
|
|
28
|
+
/**
|
|
29
|
+
* Update an attestation.
|
|
30
|
+
*/
|
|
31
|
+
async function update(collectionId, productId, proofId, attestationId, data) {
|
|
32
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/attestation/${encodeURIComponent(attestationId)}`;
|
|
33
|
+
return put(path, data);
|
|
34
|
+
}
|
|
35
|
+
attestation.update = update;
|
|
36
|
+
/**
|
|
37
|
+
* Delete an attestation.
|
|
38
|
+
*/
|
|
39
|
+
async function remove(collectionId, productId, proofId, attestationId) {
|
|
40
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/attestation/${encodeURIComponent(attestationId)}`;
|
|
41
|
+
return del(path);
|
|
42
|
+
}
|
|
43
|
+
attestation.remove = remove;
|
|
44
|
+
})(attestation || (attestation = {}));
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
package/dist/http.d.ts
CHANGED
|
@@ -16,3 +16,33 @@ export declare function initializeApi(options: {
|
|
|
16
16
|
* Returns the parsed JSON as T, or throws an Error.
|
|
17
17
|
*/
|
|
18
18
|
export declare function request<T>(path: string): Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Internal helper that performs a POST request to `${baseURL}${path}`,
|
|
21
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
22
|
+
* If body is FormData, Content-Type is not set.
|
|
23
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
24
|
+
*/
|
|
25
|
+
export declare function post<T>(path: string, body: any, extraHeaders?: Record<string, string>): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Internal helper that performs a PUT request to `${baseURL}${path}`,
|
|
28
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
29
|
+
* If body is FormData, Content-Type is not set.
|
|
30
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
31
|
+
*/
|
|
32
|
+
export declare function put<T>(path: string, body: any, extraHeaders?: Record<string, string>): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Internal helper that performs a request to `${baseURL}${path}` with custom options,
|
|
35
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
36
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
37
|
+
*/
|
|
38
|
+
export declare function requestWithOptions<T>(path: string, options: RequestInit): Promise<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Internal helper that performs a DELETE request to `${baseURL}${path}`,
|
|
41
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
42
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
43
|
+
*/
|
|
44
|
+
export declare function del<T>(path: string, extraHeaders?: Record<string, string>): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the common headers used for API requests, including apiKey and bearerToken if set.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getApiHeaders(): Record<string, string>;
|
package/dist/http.js
CHANGED
|
@@ -52,3 +52,159 @@ export async function request(path) {
|
|
|
52
52
|
}
|
|
53
53
|
return (await response.json());
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Internal helper that performs a POST request to `${baseURL}${path}`,
|
|
57
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
58
|
+
* If body is FormData, Content-Type is not set.
|
|
59
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
60
|
+
*/
|
|
61
|
+
export async function post(path, body, extraHeaders) {
|
|
62
|
+
if (!baseURL) {
|
|
63
|
+
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.");
|
|
64
|
+
}
|
|
65
|
+
const url = `${baseURL}${path}`;
|
|
66
|
+
const headers = extraHeaders ? Object.assign({}, extraHeaders) : {};
|
|
67
|
+
if (apiKey)
|
|
68
|
+
headers["X-API-Key"] = apiKey;
|
|
69
|
+
if (bearerToken)
|
|
70
|
+
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`;
|
|
71
|
+
// Only set Content-Type for non-FormData bodies
|
|
72
|
+
if (!(body instanceof FormData)) {
|
|
73
|
+
headers["Content-Type"] = "application/json";
|
|
74
|
+
}
|
|
75
|
+
const response = await fetch(url, {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers,
|
|
78
|
+
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
try {
|
|
82
|
+
const errBody = (await response.json());
|
|
83
|
+
throw new Error(`Error ${errBody.code}: ${errBody.message}`);
|
|
84
|
+
}
|
|
85
|
+
catch (_a) {
|
|
86
|
+
throw new Error(`Request to ${url} failed with status ${response.status}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return (await response.json());
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Internal helper that performs a PUT request to `${baseURL}${path}`,
|
|
93
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
94
|
+
* If body is FormData, Content-Type is not set.
|
|
95
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
96
|
+
*/
|
|
97
|
+
export async function put(path, body, extraHeaders) {
|
|
98
|
+
if (!baseURL) {
|
|
99
|
+
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.");
|
|
100
|
+
}
|
|
101
|
+
const url = `${baseURL}${path}`;
|
|
102
|
+
const headers = extraHeaders ? Object.assign({}, extraHeaders) : {};
|
|
103
|
+
if (apiKey)
|
|
104
|
+
headers["X-API-Key"] = apiKey;
|
|
105
|
+
if (bearerToken)
|
|
106
|
+
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`;
|
|
107
|
+
// Only set Content-Type for non-FormData bodies
|
|
108
|
+
if (!(body instanceof FormData)) {
|
|
109
|
+
headers["Content-Type"] = "application/json";
|
|
110
|
+
}
|
|
111
|
+
const response = await fetch(url, {
|
|
112
|
+
method: "PUT",
|
|
113
|
+
headers,
|
|
114
|
+
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
115
|
+
});
|
|
116
|
+
if (!response.ok) {
|
|
117
|
+
try {
|
|
118
|
+
const errBody = (await response.json());
|
|
119
|
+
throw new Error(`Error ${errBody.code}: ${errBody.message}`);
|
|
120
|
+
}
|
|
121
|
+
catch (_a) {
|
|
122
|
+
throw new Error(`Request to ${url} failed with status ${response.status}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return (await response.json());
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Internal helper that performs a request to `${baseURL}${path}` with custom options,
|
|
129
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
130
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
131
|
+
*/
|
|
132
|
+
export async function requestWithOptions(path, options) {
|
|
133
|
+
if (!baseURL) {
|
|
134
|
+
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.");
|
|
135
|
+
}
|
|
136
|
+
const url = `${baseURL}${path}`;
|
|
137
|
+
// Safely merge headers, converting Headers/init to Record<string, string>
|
|
138
|
+
let extraHeaders = {};
|
|
139
|
+
if (options.headers) {
|
|
140
|
+
if (options.headers instanceof Headers) {
|
|
141
|
+
options.headers.forEach((value, key) => {
|
|
142
|
+
extraHeaders[key] = value;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else if (Array.isArray(options.headers)) {
|
|
146
|
+
for (const [key, value] of options.headers) {
|
|
147
|
+
extraHeaders[key] = value;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
extraHeaders = Object.assign({}, options.headers);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const headers = Object.assign(Object.assign(Object.assign({ "Content-Type": "application/json" }, (apiKey ? { "X-API-Key": apiKey } : {})), (bearerToken ? { "AUTHORIZATION": `Bearer ${bearerToken}` } : {})), extraHeaders);
|
|
155
|
+
const response = await fetch(url, Object.assign(Object.assign({}, options), { headers }));
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
try {
|
|
158
|
+
const errBody = (await response.json());
|
|
159
|
+
throw new Error(`Error ${errBody.code}: ${errBody.message}`);
|
|
160
|
+
}
|
|
161
|
+
catch (_a) {
|
|
162
|
+
throw new Error(`Request to ${url} failed with status ${response.status}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return (await response.json());
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Internal helper that performs a DELETE request to `${baseURL}${path}`,
|
|
169
|
+
* injecting headers for apiKey or bearerToken if present.
|
|
170
|
+
* Returns the parsed JSON as T, or throws an Error.
|
|
171
|
+
*/
|
|
172
|
+
export async function del(path, extraHeaders) {
|
|
173
|
+
if (!baseURL) {
|
|
174
|
+
throw new Error("HTTP client is not initialized. Call initializeApi(...) first.");
|
|
175
|
+
}
|
|
176
|
+
const url = `${baseURL}${path}`;
|
|
177
|
+
const headers = extraHeaders ? Object.assign({}, extraHeaders) : {};
|
|
178
|
+
if (apiKey)
|
|
179
|
+
headers["X-API-Key"] = apiKey;
|
|
180
|
+
if (bearerToken)
|
|
181
|
+
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`;
|
|
182
|
+
const response = await fetch(url, {
|
|
183
|
+
method: "DELETE",
|
|
184
|
+
headers,
|
|
185
|
+
});
|
|
186
|
+
if (!response.ok) {
|
|
187
|
+
try {
|
|
188
|
+
const errBody = (await response.json());
|
|
189
|
+
throw new Error(`Error ${errBody.code}: ${errBody.message}`);
|
|
190
|
+
}
|
|
191
|
+
catch (_a) {
|
|
192
|
+
throw new Error(`Request to ${url} failed with status ${response.status}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// If the response is empty, just return undefined
|
|
196
|
+
if (response.status === 204)
|
|
197
|
+
return undefined;
|
|
198
|
+
return (await response.json());
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns the common headers used for API requests, including apiKey and bearerToken if set.
|
|
202
|
+
*/
|
|
203
|
+
export function getApiHeaders() {
|
|
204
|
+
const headers = {};
|
|
205
|
+
if (apiKey)
|
|
206
|
+
headers["X-API-Key"] = apiKey;
|
|
207
|
+
if (bearerToken)
|
|
208
|
+
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`;
|
|
209
|
+
return headers;
|
|
210
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AttestationResponse {
|
|
2
|
+
id: string;
|
|
3
|
+
proofId: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
type: string;
|
|
7
|
+
data: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface AttestationCreateRequest {
|
|
10
|
+
type: string;
|
|
11
|
+
data: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface AttestationUpdateRequest {
|
|
14
|
+
type?: string;
|
|
15
|
+
data?: Record<string, any>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.navigationData = "data:application/octet-stream;base64,
|
|
1
|
+
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACp2VzW7DIBCE34Wz1UhVmoNvVtSeq16jHhBeJ6iEJYCrqlXevUrzY8BkjXu1h8877Ox688M8fHlWM27MGnUnt73lXqJmFTPc71jN9tj2CtwiVTzs/F6xin1I3bJ6WTGxk6q1oFm9uWG34AdS12txOplhbcHHvNXy+H6shvKcC0m3mk6PSwtplHpBu0alQMQWg8L+gBnxqLpqjH612PYibzjmXpSFUOzKkNjRwHL3M6wX+i41XeS4wG5vFPK2iWOTogIRnT7vwfl7czG8LEqisMA9ZIsKSGcVfVdTjNxQpQkrYDRKERgLe/yctHNWkf1qC27lrCJ7JTIJv7ZK3Mn0vOUVUKbWlkkn41qJyc3CvDKuiP92OTif63BiI5zIwEQ6g7MtYDd5iU3ys3gDZ1C7ICxSe7AdF+AW98TxFx6fVuEHTguApoYKCjVsTZI3llHQZ2vRkrxIQaEuO5iEJZoJHHZTsEFBoaSWXnIlv6ExMheWSEAupEMPLpu3y6tx2n4BFNJgvggJAAA="
|
package/docs/assets/search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACqVaTY+
|
|
1
|
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