@proveanything/smartlinks 1.0.38 → 1.0.40
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 +83 -393
- package/README.md +167 -13821
- package/dist/api/auth.d.ts +5 -0
- package/dist/api/auth.js +11 -0
- package/dist/api/claimSet.d.ts +13 -2
- package/dist/api/claimSet.js +10 -0
- package/dist/api/collection.d.ts +13 -0
- package/dist/api/collection.js +21 -0
- package/dist/api/proof.d.ts +5 -0
- package/dist/api/proof.js +9 -0
- 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/claimSet.d.ts +40 -0
- package/dist/types/claimSet.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -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/claimSet.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UpdateClaimDataRequest, AssignClaimsRequest } from "../types";
|
|
1
2
|
export declare namespace claimSet {
|
|
2
3
|
/**
|
|
3
4
|
* Get all claim sets for a collection.
|
|
@@ -71,12 +72,22 @@ export declare namespace claimSet {
|
|
|
71
72
|
* Assign claims to a claim set.
|
|
72
73
|
* @param collectionId – The collection identifier
|
|
73
74
|
* @param data – The claims data to assign
|
|
75
|
+
* {
|
|
76
|
+
* id: string, // claim set id (required)
|
|
77
|
+
* collectionId: string,// required
|
|
78
|
+
* productId: string, // required
|
|
79
|
+
* batchId?: string, // optional
|
|
80
|
+
* start?: number, // optional bulk range start
|
|
81
|
+
* end?: number, // optional bulk range end
|
|
82
|
+
* codeId?: string, // optional single code
|
|
83
|
+
* data?: { [k: string]: any } // optional claim key/values
|
|
84
|
+
* }
|
|
74
85
|
*/
|
|
75
|
-
function assignClaims(collectionId: string, data:
|
|
86
|
+
function assignClaims(collectionId: string, data: AssignClaimsRequest): Promise<any>;
|
|
76
87
|
/**
|
|
77
88
|
* Update claim data for a collection.
|
|
78
89
|
* @param collectionId – The collection identifier
|
|
79
90
|
* @param data – The claim data to update
|
|
80
91
|
*/
|
|
81
|
-
function updateClaimData(collectionId: string, data:
|
|
92
|
+
function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
|
|
82
93
|
}
|
package/dist/api/claimSet.js
CHANGED
|
@@ -113,6 +113,16 @@ export var claimSet;
|
|
|
113
113
|
* Assign claims to a claim set.
|
|
114
114
|
* @param collectionId – The collection identifier
|
|
115
115
|
* @param data – The claims data to assign
|
|
116
|
+
* {
|
|
117
|
+
* id: string, // claim set id (required)
|
|
118
|
+
* collectionId: string,// required
|
|
119
|
+
* productId: string, // required
|
|
120
|
+
* batchId?: string, // optional
|
|
121
|
+
* start?: number, // optional bulk range start
|
|
122
|
+
* end?: number, // optional bulk range end
|
|
123
|
+
* codeId?: string, // optional single code
|
|
124
|
+
* data?: { [k: string]: any } // optional claim key/values
|
|
125
|
+
* }
|
|
116
126
|
*/
|
|
117
127
|
async function assignClaims(collectionId, data) {
|
|
118
128
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(data.id)}/assignClaims`;
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -15,6 +15,19 @@ export declare namespace collection {
|
|
|
15
15
|
* @throws ErrorResponse if the request fails
|
|
16
16
|
*/
|
|
17
17
|
function list(admin?: boolean): Promise<CollectionResponse[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve a collection by its shortId (public endpoint).
|
|
20
|
+
* @param shortId – The short identifier of the collection
|
|
21
|
+
* @returns Promise resolving to a CollectionResponse object
|
|
22
|
+
*/
|
|
23
|
+
function getShortId(shortId: string): Promise<CollectionResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve a specific settings group for a collection (public endpoint).
|
|
26
|
+
* @param collectionId – Identifier of the collection
|
|
27
|
+
* @param settingGroup – The settings group name
|
|
28
|
+
* @returns Promise resolving to the settings object
|
|
29
|
+
*/
|
|
30
|
+
function getSettings(collectionId: string, settingGroup: string): Promise<any>;
|
|
18
31
|
/**
|
|
19
32
|
* Create a new collection (admin only).
|
|
20
33
|
* @param data – Collection creation data
|
package/dist/api/collection.js
CHANGED
|
@@ -27,6 +27,27 @@ export var collection;
|
|
|
27
27
|
return request(path);
|
|
28
28
|
}
|
|
29
29
|
collection.list = list;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve a collection by its shortId (public endpoint).
|
|
32
|
+
* @param shortId – The short identifier of the collection
|
|
33
|
+
* @returns Promise resolving to a CollectionResponse object
|
|
34
|
+
*/
|
|
35
|
+
async function getShortId(shortId) {
|
|
36
|
+
const path = `/public/collection/getShortId/${encodeURIComponent(shortId)}`;
|
|
37
|
+
return request(path);
|
|
38
|
+
}
|
|
39
|
+
collection.getShortId = getShortId;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve a specific settings group for a collection (public endpoint).
|
|
42
|
+
* @param collectionId – Identifier of the collection
|
|
43
|
+
* @param settingGroup – The settings group name
|
|
44
|
+
* @returns Promise resolving to the settings object
|
|
45
|
+
*/
|
|
46
|
+
async function getSettings(collectionId, settingGroup) {
|
|
47
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/settings/${encodeURIComponent(settingGroup)}`;
|
|
48
|
+
return request(path);
|
|
49
|
+
}
|
|
50
|
+
collection.getSettings = getSettings;
|
|
30
51
|
/**
|
|
31
52
|
* Create a new collection (admin only).
|
|
32
53
|
* @param data – Collection creation data
|
package/dist/api/proof.d.ts
CHANGED
|
@@ -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
|
@@ -39,6 +39,15 @@ export var proof;
|
|
|
39
39
|
return put(path, values);
|
|
40
40
|
}
|
|
41
41
|
proof.update = update;
|
|
42
|
+
/**
|
|
43
|
+
* Claim a proof for a product.
|
|
44
|
+
* PUT /public/collection/:collectionId/product/:productId/proof/:proofId
|
|
45
|
+
*/
|
|
46
|
+
async function claim(collectionId, productId, proofId, values) {
|
|
47
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}`;
|
|
48
|
+
return put(path, values);
|
|
49
|
+
}
|
|
50
|
+
proof.claim = claim;
|
|
42
51
|
/**
|
|
43
52
|
* Delete a proof for a product (admin only).
|
|
44
53
|
* 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";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference to a specific claim attached to a code/tag.
|
|
3
|
+
*/
|
|
4
|
+
export interface ClaimCodeRef {
|
|
5
|
+
/** Identifier of the code (e.g., tag or QR code) */
|
|
6
|
+
codeId: string;
|
|
7
|
+
/** Identifier of the claim within the claim set */
|
|
8
|
+
claimId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Request body for updating claim data on a claim set.
|
|
12
|
+
* Contains arbitrary key/value pairs and a list of code+claim references to update.
|
|
13
|
+
*/
|
|
14
|
+
export interface UpdateClaimDataRequest {
|
|
15
|
+
/** Arbitrary key/value pairs for the claim data update */
|
|
16
|
+
data: Record<string, any>;
|
|
17
|
+
/** Array of code+claim references affected by this update */
|
|
18
|
+
codes: ClaimCodeRef[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Request body for assigning claims to codes or ranges within a collection.
|
|
22
|
+
*/
|
|
23
|
+
export interface AssignClaimsRequest {
|
|
24
|
+
/** The claim set ID (required) */
|
|
25
|
+
id: string;
|
|
26
|
+
/** The collection ID (required) */
|
|
27
|
+
collectionId: string;
|
|
28
|
+
/** The product ID (required) */
|
|
29
|
+
productId: string;
|
|
30
|
+
/** Optional batch identifier */
|
|
31
|
+
batchId?: string;
|
|
32
|
+
/** Optional start index for bulk assignment */
|
|
33
|
+
start?: number;
|
|
34
|
+
/** Optional end index for bulk assignment */
|
|
35
|
+
end?: number;
|
|
36
|
+
/** Optional single code identifier for single assignment */
|
|
37
|
+
codeId?: string;
|
|
38
|
+
/** Optional key/value pairs to set on the claim */
|
|
39
|
+
data?: Record<string, any>;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED