@proveanything/smartlinks 1.0.39 → 1.0.41
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/API_SUMMARY.md +48 -400
- package/README.md +167 -13821
- package/dist/api/auth.d.ts +5 -0
- package/dist/api/auth.js +11 -0
- package/dist/api/proof.d.ts +7 -2
- package/dist/api/proof.js +15 -4
- package/dist/index.d.ts +1 -0
- package/dist/types/auth.d.ts +9 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
package/dist/api/auth.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UserAccountRegistrationRequest } from "../types/auth";
|
|
1
2
|
export type LoginResponse = {
|
|
2
3
|
id: string;
|
|
3
4
|
name: string;
|
|
@@ -70,6 +71,10 @@ export declare namespace auth {
|
|
|
70
71
|
* Validates if the user has access to the resource, and returns a JWT
|
|
71
72
|
*/
|
|
72
73
|
function requestPublicJWT(collectionId: string, productId: string, proofId: string): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Tries to register a new user account. Can return a bearer token, or a Firebase token
|
|
76
|
+
*/
|
|
77
|
+
function registerUser(user: UserAccountRegistrationRequest): Promise<LoginResponse>;
|
|
73
78
|
/**
|
|
74
79
|
* Admin: Get a user bearer token (impersonation/automation).
|
|
75
80
|
* POST /admin/auth/userToken
|
package/dist/api/auth.js
CHANGED
|
@@ -60,6 +60,17 @@ export var auth;
|
|
|
60
60
|
return post("/public/auth/requestJWT", { collectionId, productId, proofId });
|
|
61
61
|
}
|
|
62
62
|
auth.requestPublicJWT = requestPublicJWT;
|
|
63
|
+
/**
|
|
64
|
+
* Tries to register a new user account. Can return a bearer token, or a Firebase token
|
|
65
|
+
*/
|
|
66
|
+
async function registerUser(user) {
|
|
67
|
+
// Use the provided token, or the one from getApiHeaders
|
|
68
|
+
const res = await post("/public/auth/register", user);
|
|
69
|
+
if (res.bearerToken)
|
|
70
|
+
setBearerToken(res.bearerToken);
|
|
71
|
+
return res;
|
|
72
|
+
}
|
|
73
|
+
auth.registerUser = registerUser;
|
|
63
74
|
/**
|
|
64
75
|
* Admin: Get a user bearer token (impersonation/automation).
|
|
65
76
|
* POST /admin/auth/userToken
|
package/dist/api/proof.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export declare namespace proof {
|
|
|
4
4
|
* Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
|
|
5
5
|
* Both public and admin endpoints now include productId in the path.
|
|
6
6
|
*/
|
|
7
|
-
function get(collectionId: string, productId: string, proofId: string, admin?: boolean): Promise<ProofResponse>;
|
|
7
|
+
function get(collectionId: string, productId: string, proofId: string, admin?: boolean, include?: string[]): Promise<ProofResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* List all Proofs for a Collection.
|
|
10
10
|
*/
|
|
11
|
-
function list(collectionId: string): Promise<ProofResponse[]>;
|
|
11
|
+
function list(collectionId: string, include?: string[]): Promise<ProofResponse[]>;
|
|
12
12
|
/**
|
|
13
13
|
* Create a proof for a product (admin only).
|
|
14
14
|
* POST /admin/collection/:collectionId/product/:productId/proof
|
|
@@ -19,6 +19,11 @@ export declare namespace proof {
|
|
|
19
19
|
* PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
20
20
|
*/
|
|
21
21
|
function update(collectionId: string, productId: string, proofId: string, values: any): Promise<ProofResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Claim a proof for a product.
|
|
24
|
+
* PUT /public/collection/:collectionId/product/:productId/proof/:proofId
|
|
25
|
+
*/
|
|
26
|
+
function claim(collectionId: string, productId: string, proofId: string, values: any): Promise<ProofResponse>;
|
|
22
27
|
/**
|
|
23
28
|
* Delete a proof for a product (admin only).
|
|
24
29
|
* DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
package/dist/api/proof.js
CHANGED
|
@@ -6,17 +6,19 @@ export var proof;
|
|
|
6
6
|
* Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
|
|
7
7
|
* Both public and admin endpoints now include productId in the path.
|
|
8
8
|
*/
|
|
9
|
-
async function get(collectionId, productId, proofId, admin) {
|
|
9
|
+
async function get(collectionId, productId, proofId, admin, include) {
|
|
10
10
|
const base = admin ? '/admin' : '/public';
|
|
11
|
-
const
|
|
11
|
+
const qp = include && include.length ? `?include=${encodeURIComponent(include.join(','))}` : '';
|
|
12
|
+
const path = `${base}/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}${qp}`;
|
|
12
13
|
return request(path);
|
|
13
14
|
}
|
|
14
15
|
proof.get = get;
|
|
15
16
|
/**
|
|
16
17
|
* List all Proofs for a Collection.
|
|
17
18
|
*/
|
|
18
|
-
async function list(collectionId) {
|
|
19
|
-
const
|
|
19
|
+
async function list(collectionId, include) {
|
|
20
|
+
const qp = include && include.length ? `?include=${encodeURIComponent(include.join(','))}` : '';
|
|
21
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/proof${qp}`;
|
|
20
22
|
return request(path);
|
|
21
23
|
}
|
|
22
24
|
proof.list = list;
|
|
@@ -39,6 +41,15 @@ export var proof;
|
|
|
39
41
|
return put(path, values);
|
|
40
42
|
}
|
|
41
43
|
proof.update = update;
|
|
44
|
+
/**
|
|
45
|
+
* Claim a proof for a product.
|
|
46
|
+
* PUT /public/collection/:collectionId/product/:productId/proof/:proofId
|
|
47
|
+
*/
|
|
48
|
+
async function claim(collectionId, productId, proofId, values) {
|
|
49
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}`;
|
|
50
|
+
return put(path, values);
|
|
51
|
+
}
|
|
52
|
+
proof.claim = claim;
|
|
42
53
|
/**
|
|
43
54
|
* Delete a proof for a product (admin only).
|
|
44
55
|
* DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { initializeApi, request, sendCustomProxyMessage } from "./http";
|
|
|
2
2
|
export * from "./api";
|
|
3
3
|
export * from "./types";
|
|
4
4
|
export type { LoginResponse, VerifyTokenResponse, AccountInfoResponse, } from "./api/auth";
|
|
5
|
+
export type { UserAccountRegistrationRequest, } from "./types/auth";
|
|
5
6
|
export type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRequest, } from "./types/attestation";
|
|
6
7
|
export type { BatchResponse, BatchCreateRequest, BatchUpdateRequest, } from "./types/batch";
|
|
7
8
|
export type { VariantResponse, VariantCreateRequest, VariantUpdateRequest, } from "./types/variant";
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED