@proveanything/smartlinks 1.0.16 → 1.0.17
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 +7342 -93
- package/build-docs.ts +41 -0
- package/dist/api/claimSet.d.ts +14 -0
- package/dist/api/claimSet.js +24 -0
- package/dist/api/collection.d.ts +9 -1
- package/dist/api/collection.js +16 -2
- package/dist/api/form.d.ts +34 -0
- package/dist/api/form.js +58 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/build-docs.js +35 -0
- package/dist/http.d.ts +7 -0
- package/dist/http.js +24 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/docs/README.md +7276 -89
- package/docs/assets/highlight.css +12 -33
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/documentation.json +2002 -1007
- package/docs/functions/appConfiguration.deleteConfig.html +1 -1
- package/docs/functions/appConfiguration.deleteDataItem.html +1 -1
- package/docs/functions/appConfiguration.getConfig.html +1 -1
- package/docs/functions/appConfiguration.getData.html +1 -1
- package/docs/functions/appConfiguration.getDataItem.html +1 -1
- package/docs/functions/appConfiguration.setConfig.html +1 -1
- package/docs/functions/appConfiguration.setDataItem.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.listForCollection.html +1 -1
- package/docs/functions/asset.listForProduct.html +1 -1
- package/docs/functions/asset.listForProof.html +1 -1
- package/docs/functions/asset.uploadAsset.html +1 -1
- package/docs/functions/attestation.create.html +1 -1
- package/docs/functions/attestation.get.html +1 -1
- package/docs/functions/attestation.list.html +1 -1
- package/docs/functions/attestation.remove.html +1 -1
- package/docs/functions/attestation.update.html +1 -1
- package/docs/functions/auth.getAccount.html +1 -1
- package/docs/functions/auth.login.html +1 -1
- package/docs/functions/auth.logout.html +1 -1
- package/docs/functions/auth.verifyToken.html +1 -1
- package/docs/functions/claimSet.assignClaims.html +4 -0
- package/docs/functions/claimSet.updateClaimData.html +4 -0
- package/docs/functions/collection.get.html +3 -2
- package/docs/functions/collection.list.html +5 -0
- package/docs/functions/form.create.html +4 -0
- package/docs/functions/form.get.html +5 -0
- package/docs/functions/form.list.html +4 -0
- package/docs/functions/form.remove.html +4 -0
- package/docs/functions/form.update.html +5 -0
- package/docs/functions/initializeApi.html +1 -1
- package/docs/functions/product.get.html +1 -1
- package/docs/functions/product.list.html +1 -1
- package/docs/functions/proof.get.html +1 -1
- package/docs/functions/proof.list.html +1 -1
- package/docs/functions/request.html +1 -1
- package/docs/functions/sendCustomProxyMessage.html +5 -0
- package/docs/index.html +4 -112
- package/docs/interfaces/AppConfigurationResponse.html +4 -4
- package/docs/interfaces/AssetResponse.html +2 -2
- package/docs/interfaces/AttestationCreateRequest.html +2 -2
- package/docs/interfaces/AttestationResponse.html +2 -2
- package/docs/interfaces/AttestationUpdateRequest.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 +1 -1
- package/docs/modules/attestation.html +1 -1
- package/docs/modules/auth.html +1 -1
- package/docs/modules/claimSet.html +3 -0
- package/docs/modules/collection.html +2 -1
- package/docs/modules/form.html +6 -0
- package/docs/modules/product.html +1 -1
- package/docs/modules/proof.html +1 -1
- package/docs/modules.html +3 -0
- package/docs/types/AccountInfoResponse.html +1 -1
- package/docs/types/AppConfigOptions.html +1 -1
- package/docs/types/LoginResponse.html +1 -1
- package/docs/types/VerifyTokenResponse.html +1 -1
- package/package.json +1 -1
- package/src/api/claimSet.ts +23 -0
- package/src/api/collection.ts +17 -3
- package/src/api/form.ts +57 -0
- package/src/api/index.ts +2 -0
- package/src/http.ts +25 -0
- package/src/index.ts +1 -1
- package/temp-docs/README.md +7246 -93
- package/temp-docs/interfaces/AppConfigurationResponse.md +3 -3
- package/temp-docs/interfaces/AssetResponse.md +3 -3
- package/temp-docs/interfaces/AttestationCreateRequest.md +3 -3
- package/temp-docs/interfaces/AttestationResponse.md +6 -6
- package/temp-docs/interfaces/AttestationUpdateRequest.md +2 -2
- package/temp-docs/interfaces/CollectionResponse.md +4 -4
- package/temp-docs/interfaces/ErrorResponse.md +2 -2
- package/temp-docs/interfaces/ProductResponse.md +4 -4
- package/temp-docs/interfaces/ProofResponse.md +7 -7
- package/temp-docs/modules/appConfiguration.md +7 -7
- package/temp-docs/modules/asset.md +7 -7
- package/temp-docs/modules/attestation.md +5 -5
- package/temp-docs/modules/auth.md +4 -4
- package/temp-docs/modules/claimSet.md +52 -0
- package/temp-docs/modules/collection.md +32 -2
- package/temp-docs/modules/form.md +126 -0
- package/temp-docs/modules/product.md +2 -2
- package/temp-docs/modules/proof.md +2 -2
- package/temp-docs/modules.md +40 -6
package/build-docs.ts
CHANGED
|
@@ -26,3 +26,44 @@ for (const file of files) {
|
|
|
26
26
|
|
|
27
27
|
writeFileSync(outPath, content)
|
|
28
28
|
console.log("Documentation built at docs/README.md")
|
|
29
|
+
|
|
30
|
+
import * as fs from "fs";
|
|
31
|
+
import * as path from "path";
|
|
32
|
+
|
|
33
|
+
// Use process.cwd() to ensure relative to project root
|
|
34
|
+
const docsJsonPath = path.join(process.cwd(), "docs", "documentation.json");
|
|
35
|
+
const readmePath = path.join(process.cwd(), "README.md");
|
|
36
|
+
|
|
37
|
+
function extractFullApiDocs(json: any): string {
|
|
38
|
+
// This is a minimal implementation. For a full-featured generator,
|
|
39
|
+
// parse all namespaces, functions, and types from the TypeDoc JSON.
|
|
40
|
+
// Here, we just dump the JSON for demonstration.
|
|
41
|
+
// Replace this with a real markdown generator as needed.
|
|
42
|
+
return [
|
|
43
|
+
"# @proveanything/smartlinks",
|
|
44
|
+
"",
|
|
45
|
+
"This README is auto-generated from the TypeScript API documentation.",
|
|
46
|
+
"",
|
|
47
|
+
"## API Reference",
|
|
48
|
+
"",
|
|
49
|
+
"```json",
|
|
50
|
+
JSON.stringify(json, null, 2),
|
|
51
|
+
"```",
|
|
52
|
+
"",
|
|
53
|
+
"_Replace this with a full markdown generator for production use._"
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function main() {
|
|
58
|
+
console.log("Looking for docs JSON at:", docsJsonPath);
|
|
59
|
+
|
|
60
|
+
if (!fs.existsSync(docsJsonPath)) {
|
|
61
|
+
throw new Error("documentation.json not found. Run `npm run docs` first.");
|
|
62
|
+
}
|
|
63
|
+
const json = JSON.parse(fs.readFileSync(docsJsonPath, "utf-8"));
|
|
64
|
+
const markdown = extractFullApiDocs(json);
|
|
65
|
+
fs.writeFileSync(readmePath, markdown, "utf-8");
|
|
66
|
+
console.log("README.md generated from API documentation.");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare namespace claimSet {
|
|
2
|
+
/**
|
|
3
|
+
* Assign claims to a claim set.
|
|
4
|
+
* @param collectionId – The collection identifier
|
|
5
|
+
* @param data – The claims data to assign
|
|
6
|
+
*/
|
|
7
|
+
function assignClaims(collectionId: string, data: any): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Update claim data for a collection.
|
|
10
|
+
* @param collectionId – The collection identifier
|
|
11
|
+
* @param data – The claim data to update
|
|
12
|
+
*/
|
|
13
|
+
function updateClaimData(collectionId: string, data: any): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { post } from "../http";
|
|
2
|
+
export var claimSet;
|
|
3
|
+
(function (claimSet) {
|
|
4
|
+
/**
|
|
5
|
+
* Assign claims to a claim set.
|
|
6
|
+
* @param collectionId – The collection identifier
|
|
7
|
+
* @param data – The claims data to assign
|
|
8
|
+
*/
|
|
9
|
+
async function assignClaims(collectionId, data) {
|
|
10
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(data.id)}/assignClaims`;
|
|
11
|
+
return post(path, data);
|
|
12
|
+
}
|
|
13
|
+
claimSet.assignClaims = assignClaims;
|
|
14
|
+
/**
|
|
15
|
+
* Update claim data for a collection.
|
|
16
|
+
* @param collectionId – The collection identifier
|
|
17
|
+
* @param data – The claim data to update
|
|
18
|
+
*/
|
|
19
|
+
async function updateClaimData(collectionId, data) {
|
|
20
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/updateClaimData`;
|
|
21
|
+
return post(path, data);
|
|
22
|
+
}
|
|
23
|
+
claimSet.updateClaimData = updateClaimData;
|
|
24
|
+
})(claimSet || (claimSet = {}));
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -3,8 +3,16 @@ export declare namespace collection {
|
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a single Collection by its ID.
|
|
5
5
|
* @param collectionId – Identifier of the collection
|
|
6
|
+
* @param admin – If true, fetches from the admin endpoint
|
|
6
7
|
* @returns Promise resolving to a CollectionResponse object
|
|
7
8
|
* @throws ErrorResponse if the request fails
|
|
8
9
|
*/
|
|
9
|
-
function get(collectionId: string): Promise<CollectionResponse>;
|
|
10
|
+
function get(collectionId: string, admin?: boolean): Promise<CollectionResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves all Collections.
|
|
13
|
+
* @param admin – If true, fetches from the admin endpoint
|
|
14
|
+
* @returns Promise resolving to an array of CollectionResponse objects
|
|
15
|
+
* @throws ErrorResponse if the request fails
|
|
16
|
+
*/
|
|
17
|
+
function list(admin?: boolean): Promise<CollectionResponse[]>;
|
|
10
18
|
}
|
package/dist/api/collection.js
CHANGED
|
@@ -5,12 +5,26 @@ export var collection;
|
|
|
5
5
|
/**
|
|
6
6
|
* Retrieves a single Collection by its ID.
|
|
7
7
|
* @param collectionId – Identifier of the collection
|
|
8
|
+
* @param admin – If true, fetches from the admin endpoint
|
|
8
9
|
* @returns Promise resolving to a CollectionResponse object
|
|
9
10
|
* @throws ErrorResponse if the request fails
|
|
10
11
|
*/
|
|
11
|
-
async function get(collectionId) {
|
|
12
|
-
const
|
|
12
|
+
async function get(collectionId, admin) {
|
|
13
|
+
const base = admin ? '/admin/collection' : '/public/collection';
|
|
14
|
+
const path = `${base}/${encodeURIComponent(collectionId)}`;
|
|
13
15
|
return request(path);
|
|
14
16
|
}
|
|
15
17
|
collection.get = get;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves all Collections.
|
|
20
|
+
* @param admin – If true, fetches from the admin endpoint
|
|
21
|
+
* @returns Promise resolving to an array of CollectionResponse objects
|
|
22
|
+
* @throws ErrorResponse if the request fails
|
|
23
|
+
*/
|
|
24
|
+
async function list(admin) {
|
|
25
|
+
const base = admin ? '/admin/collection' : '/public/collection';
|
|
26
|
+
const path = `${base}`;
|
|
27
|
+
return request(path);
|
|
28
|
+
}
|
|
29
|
+
collection.list = list;
|
|
16
30
|
})(collection || (collection = {}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare namespace form {
|
|
2
|
+
/**
|
|
3
|
+
* Get a single form by ID for a collection.
|
|
4
|
+
* @param collectionId – The collection identifier
|
|
5
|
+
* @param formId – The form identifier
|
|
6
|
+
* @param admin – If true, use admin endpoint; otherwise, use public
|
|
7
|
+
*/
|
|
8
|
+
function get(collectionId: string, formId: string, admin?: boolean): Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* List all forms for a collection.
|
|
11
|
+
* @param collectionId – The collection identifier
|
|
12
|
+
* @param admin – If true, use admin endpoint; otherwise, use public
|
|
13
|
+
*/
|
|
14
|
+
function list(collectionId: string, admin?: boolean): Promise<any[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new form for a collection (admin only).
|
|
17
|
+
* @param collectionId – The collection identifier
|
|
18
|
+
* @param data – The form data
|
|
19
|
+
*/
|
|
20
|
+
function create(collectionId: string, data: any): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Update a form for a collection (admin only).
|
|
23
|
+
* @param collectionId – The collection identifier
|
|
24
|
+
* @param formId – The form identifier
|
|
25
|
+
* @param data – The form data
|
|
26
|
+
*/
|
|
27
|
+
function update(collectionId: string, formId: string, data: any): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete a form for a collection (admin only).
|
|
30
|
+
* @param collectionId – The collection identifier
|
|
31
|
+
* @param formId – The form identifier
|
|
32
|
+
*/
|
|
33
|
+
function remove(collectionId: string, formId: string): Promise<void>;
|
|
34
|
+
}
|
package/dist/api/form.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { request, post, put, del } from "../http";
|
|
2
|
+
export var form;
|
|
3
|
+
(function (form) {
|
|
4
|
+
/**
|
|
5
|
+
* Get a single form by ID for a collection.
|
|
6
|
+
* @param collectionId – The collection identifier
|
|
7
|
+
* @param formId – The form identifier
|
|
8
|
+
* @param admin – If true, use admin endpoint; otherwise, use public
|
|
9
|
+
*/
|
|
10
|
+
async function get(collectionId, formId, admin) {
|
|
11
|
+
const base = admin ? '/admin' : '/public';
|
|
12
|
+
const path = `${base}/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
|
|
13
|
+
return request(path);
|
|
14
|
+
}
|
|
15
|
+
form.get = get;
|
|
16
|
+
/**
|
|
17
|
+
* List all forms for a collection.
|
|
18
|
+
* @param collectionId – The collection identifier
|
|
19
|
+
* @param admin – If true, use admin endpoint; otherwise, use public
|
|
20
|
+
*/
|
|
21
|
+
async function list(collectionId, admin) {
|
|
22
|
+
const base = admin ? '/admin' : '/public';
|
|
23
|
+
const path = `${base}/${encodeURIComponent(collectionId)}/form`;
|
|
24
|
+
return request(path);
|
|
25
|
+
}
|
|
26
|
+
form.list = list;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new form for a collection (admin only).
|
|
29
|
+
* @param collectionId – The collection identifier
|
|
30
|
+
* @param data – The form data
|
|
31
|
+
*/
|
|
32
|
+
async function create(collectionId, data) {
|
|
33
|
+
const path = `/admin/${encodeURIComponent(collectionId)}/form`;
|
|
34
|
+
return post(path, data);
|
|
35
|
+
}
|
|
36
|
+
form.create = create;
|
|
37
|
+
/**
|
|
38
|
+
* Update a form for a collection (admin only).
|
|
39
|
+
* @param collectionId – The collection identifier
|
|
40
|
+
* @param formId – The form identifier
|
|
41
|
+
* @param data – The form data
|
|
42
|
+
*/
|
|
43
|
+
async function update(collectionId, formId, data) {
|
|
44
|
+
const path = `/admin/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
|
|
45
|
+
return put(path, data);
|
|
46
|
+
}
|
|
47
|
+
form.update = update;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a form for a collection (admin only).
|
|
50
|
+
* @param collectionId – The collection identifier
|
|
51
|
+
* @param formId – The form identifier
|
|
52
|
+
*/
|
|
53
|
+
async function remove(collectionId, formId) {
|
|
54
|
+
const path = `/admin/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
|
|
55
|
+
return del(path);
|
|
56
|
+
}
|
|
57
|
+
form.remove = remove;
|
|
58
|
+
})(form || (form = {}));
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
package/dist/build-docs.js
CHANGED
|
@@ -24,3 +24,38 @@ for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
|
24
24
|
}
|
|
25
25
|
(0, fs_1.writeFileSync)(outPath, content);
|
|
26
26
|
console.log("Documentation built at docs/README.md");
|
|
27
|
+
var fs = require("fs");
|
|
28
|
+
var path = require("path");
|
|
29
|
+
// Use process.cwd() to ensure relative to project root
|
|
30
|
+
var docsJsonPath = path.join(process.cwd(), "docs", "documentation.json");
|
|
31
|
+
var readmePath = path.join(process.cwd(), "README.md");
|
|
32
|
+
function extractFullApiDocs(json) {
|
|
33
|
+
// This is a minimal implementation. For a full-featured generator,
|
|
34
|
+
// parse all namespaces, functions, and types from the TypeDoc JSON.
|
|
35
|
+
// Here, we just dump the JSON for demonstration.
|
|
36
|
+
// Replace this with a real markdown generator as needed.
|
|
37
|
+
return [
|
|
38
|
+
"# @proveanything/smartlinks",
|
|
39
|
+
"",
|
|
40
|
+
"This README is auto-generated from the TypeScript API documentation.",
|
|
41
|
+
"",
|
|
42
|
+
"## API Reference",
|
|
43
|
+
"",
|
|
44
|
+
"```json",
|
|
45
|
+
JSON.stringify(json, null, 2),
|
|
46
|
+
"```",
|
|
47
|
+
"",
|
|
48
|
+
"_Replace this with a full markdown generator for production use._"
|
|
49
|
+
].join("\n");
|
|
50
|
+
}
|
|
51
|
+
function main() {
|
|
52
|
+
console.log("Looking for docs JSON at:", docsJsonPath);
|
|
53
|
+
if (!fs.existsSync(docsJsonPath)) {
|
|
54
|
+
throw new Error("documentation.json not found. Run `npm run docs` first.");
|
|
55
|
+
}
|
|
56
|
+
var json = JSON.parse(fs.readFileSync(docsJsonPath, "utf-8"));
|
|
57
|
+
var markdown = extractFullApiDocs(json);
|
|
58
|
+
fs.writeFileSync(readmePath, markdown, "utf-8");
|
|
59
|
+
console.log("README.md generated from API documentation.");
|
|
60
|
+
}
|
|
61
|
+
main();
|
package/dist/http.d.ts
CHANGED
|
@@ -53,3 +53,10 @@ export declare function del<T>(path: string, extraHeaders?: Record<string, strin
|
|
|
53
53
|
* Returns the common headers used for API requests, including apiKey and bearerToken if set.
|
|
54
54
|
*/
|
|
55
55
|
export declare function getApiHeaders(): Record<string, string>;
|
|
56
|
+
/**
|
|
57
|
+
* Sends a custom proxy message in proxyMode and waits for a matching reply.
|
|
58
|
+
* @param request - The request type string
|
|
59
|
+
* @param params - The parameters object
|
|
60
|
+
* @returns The data from the proxy response
|
|
61
|
+
*/
|
|
62
|
+
export declare function sendCustomProxyMessage<T = any>(request: string, params: any): Promise<T>;
|
package/dist/http.js
CHANGED
|
@@ -278,3 +278,27 @@ export function getApiHeaders() {
|
|
|
278
278
|
headers["AUTHORIZATION"] = `Bearer ${bearerToken}`;
|
|
279
279
|
return headers;
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Sends a custom proxy message in proxyMode and waits for a matching reply.
|
|
283
|
+
* @param request - The request type string
|
|
284
|
+
* @param params - The parameters object
|
|
285
|
+
* @returns The data from the proxy response
|
|
286
|
+
*/
|
|
287
|
+
export async function sendCustomProxyMessage(request, params) {
|
|
288
|
+
if (!proxyMode) {
|
|
289
|
+
throw new Error("sendCustomProxyMessage can only be used in proxyMode");
|
|
290
|
+
}
|
|
291
|
+
ensureProxyListener();
|
|
292
|
+
const id = generateProxyId();
|
|
293
|
+
const msg = {
|
|
294
|
+
_smartlinksCustomProxyRequest: true,
|
|
295
|
+
id,
|
|
296
|
+
request,
|
|
297
|
+
params,
|
|
298
|
+
};
|
|
299
|
+
return new Promise((resolve, reject) => {
|
|
300
|
+
proxyPending[id] = { resolve, reject };
|
|
301
|
+
window.parent.postMessage(msg, "*");
|
|
302
|
+
// Optionally: add a timeout here to reject if no response
|
|
303
|
+
});
|
|
304
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
// Top-level entrypoint of the npm package. Re-export initializeApi + all namespaces.
|
|
3
|
-
export { initializeApi, request } from "./http";
|
|
3
|
+
export { initializeApi, request, sendCustomProxyMessage } from "./http";
|
|
4
4
|
export * from "./api";
|
|
5
5
|
export * from "./types";
|