@proveanything/smartlinks 1.0.28 → 1.0.30

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.
Files changed (44) hide show
  1. package/API_SUMMARY.md +672 -213
  2. package/README.md +430 -0
  3. package/dist/api/collection.js +1 -1
  4. package/dist/http.d.ts +5 -3
  5. package/dist/http.js +5 -3
  6. package/package.json +19 -3
  7. package/build-docs.ts +0 -69
  8. package/debug.log +0 -6
  9. package/examples/browser-demo.html +0 -43
  10. package/examples/node-demo.ts +0 -50
  11. package/examples/react-demo.tsx +0 -58
  12. package/generate-api-summary.js +0 -279
  13. package/generate-api-summary.ts +0 -83
  14. package/openapi.yaml +0 -130
  15. package/scripts/copy-docs.js +0 -11
  16. package/src/api/appConfiguration.ts +0 -104
  17. package/src/api/asset.ts +0 -133
  18. package/src/api/attestation.ts +0 -69
  19. package/src/api/auth.ts +0 -103
  20. package/src/api/batch.ts +0 -173
  21. package/src/api/claimSet.ts +0 -131
  22. package/src/api/collection.ts +0 -117
  23. package/src/api/crate.ts +0 -43
  24. package/src/api/form.ts +0 -57
  25. package/src/api/index.ts +0 -14
  26. package/src/api/product.ts +0 -128
  27. package/src/api/proof.ts +0 -32
  28. package/src/api/serialNumber.ts +0 -0
  29. package/src/api/variant.ts +0 -173
  30. package/src/http.ts +0 -363
  31. package/src/index.ts +0 -29
  32. package/src/types/appConfiguration.ts +0 -12
  33. package/src/types/asset.ts +0 -9
  34. package/src/types/attestation.ts +0 -19
  35. package/src/types/batch.ts +0 -15
  36. package/src/types/collection.ts +0 -68
  37. package/src/types/error.ts +0 -10
  38. package/src/types/index.ts +0 -11
  39. package/src/types/product.ts +0 -33
  40. package/src/types/proof.ts +0 -20
  41. package/src/types/serialNumber.ts +0 -0
  42. package/src/types/variant.ts +0 -15
  43. package/tsconfig.json +0 -15
  44. package/typedoc.json +0 -18
@@ -1,117 +0,0 @@
1
- // src/api/collection.ts
2
- import { request, post, put, del } from "../http"
3
- import { CollectionResponse } from "../types/collection"
4
-
5
- export namespace collection {
6
- /**
7
- * Retrieves a single Collection by its ID.
8
- * @param collectionId – Identifier of the collection
9
- * @param admin – If true, fetches from the admin endpoint
10
- * @returns Promise resolving to a CollectionResponse object
11
- * @throws ErrorResponse if the request fails
12
- */
13
- export async function get(collectionId: string, admin?: boolean): Promise<CollectionResponse> {
14
- const base = admin ? '/admin/collection' : '/public/collection';
15
- const path = `${base}/${encodeURIComponent(collectionId)}`;
16
- return request<CollectionResponse>(path);
17
- }
18
-
19
- /**
20
- * Retrieves all Collections.
21
- * @param admin – If true, fetches from the admin endpoint
22
- * @returns Promise resolving to an array of CollectionResponse objects
23
- * @throws ErrorResponse if the request fails
24
- */
25
- export async function list(admin?: boolean): Promise<CollectionResponse[]> {
26
- const base = admin ? '/admin/collection' : '/public/collection';
27
- const path = `${base}`;
28
- return request<CollectionResponse[]>(path);
29
- }
30
-
31
- /**
32
- * Create a new collection (admin only).
33
- * @param data – Collection creation data
34
- * @returns Promise resolving to a CollectionResponse object
35
- * @throws ErrorResponse if the request fails
36
- */
37
- export async function create(data: any): Promise<CollectionResponse> {
38
- const path = `/admin/collection`;
39
- return post<CollectionResponse>(path, data);
40
- }
41
-
42
- /**
43
- * Update a collection (admin only).
44
- * @param collectionId – Identifier of the collection
45
- * @param data – Collection update data
46
- * @returns Promise resolving to a CollectionResponse object
47
- * @throws ErrorResponse if the request fails
48
- */
49
- export async function update(collectionId: string, data: any): Promise<CollectionResponse> {
50
- const path = `/admin/collection/${encodeURIComponent(collectionId)}`;
51
- return put<CollectionResponse>(path, data);
52
- }
53
-
54
- /**
55
- * Delete a collection (admin only).
56
- * @param collectionId – Identifier of the collection
57
- * @returns Promise resolving to void
58
- * @throws ErrorResponse if the request fails
59
- */
60
- export async function remove(collectionId: string): Promise<void> {
61
- const path = `/admin/collection/${encodeURIComponent(collectionId)}`;
62
- return del<void>(path);
63
- }
64
-
65
- /**
66
- * Get serial numbers for a collection (admin only).
67
- * @param collectionId - Identifier of the collection
68
- * @param startIndex - Starting index for pagination (default: 0)
69
- * @param count - Number of serial numbers to retrieve (default: 10)
70
- * @returns Promise resolving to serial number data
71
- * @throws ErrorResponse if the request fails
72
- */
73
- export async function getSN(
74
- collectionId: string,
75
- startIndex: number = 0,
76
- count: number = 10
77
- ): Promise<any> {
78
- const queryParams = new URLSearchParams({
79
- startIndex: startIndex.toString(),
80
- count: count.toString()
81
- })
82
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/getSN?${queryParams}`
83
- return request<any>(path)
84
- }
85
-
86
- /**
87
- * Look up a serial number by code for a collection (admin only).
88
- * @param collectionId - Identifier of the collection
89
- * @param codeId - The serial number code to look up
90
- * @returns Promise resolving to serial number lookup data
91
- * @throws ErrorResponse if the request fails
92
- */
93
- export async function lookupSN(
94
- collectionId: string,
95
- codeId: string
96
- ): Promise<any> {
97
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/lookupSN/${encodeURIComponent(codeId)}`
98
- return request<any>(path)
99
- }
100
-
101
- /**
102
- * Assign a value to a serial number for a collection (admin only).
103
- * @param collectionId - Identifier of the collection
104
- * @param codeId - The serial number code to assign
105
- * @param value - The value to assign to the serial number
106
- * @returns Promise resolving to assignment result
107
- * @throws ErrorResponse if the request fails
108
- */
109
- export async function assignSN(
110
- collectionId: string,
111
- codeId: string,
112
- value: any
113
- ): Promise<any> {
114
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/lookupSN/${encodeURIComponent(codeId)}`
115
- return post<any>(path, { value })
116
- }
117
- }
package/src/api/crate.ts DELETED
@@ -1,43 +0,0 @@
1
- import { request, post, put, del } from "../http"
2
-
3
- export namespace crate {
4
- /**
5
- * Get a single crate by ID for a collection (admin only).
6
- */
7
- export async function get(collectionId: string, crateId: string): Promise<any> {
8
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`
9
- return request<any>(path)
10
- }
11
-
12
- /**
13
- * List all crates for a collection (admin only).
14
- */
15
- export async function list(collectionId: string): Promise<any[]> {
16
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate`
17
- return request<any[]>(path)
18
- }
19
-
20
- /**
21
- * Create a new crate for a collection (admin only).
22
- */
23
- export async function create(collectionId: string, data: any): Promise<any> {
24
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate`
25
- return post<any>(path, data)
26
- }
27
-
28
- /**
29
- * Update a crate for a collection (admin only).
30
- */
31
- export async function update(collectionId: string, crateId: string, data: any): Promise<any> {
32
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`
33
- return put<any>(path, data)
34
- }
35
-
36
- /**
37
- * Delete a crate for a collection (admin only).
38
- */
39
- export async function remove(collectionId: string, crateId: string): Promise<void> {
40
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/crate/${encodeURIComponent(crateId)}`
41
- return del<void>(path)
42
- }
43
- }
package/src/api/form.ts DELETED
@@ -1,57 +0,0 @@
1
- import { request, post, put, del } from "../http";
2
-
3
- export namespace 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
- export async function get(collectionId: string, formId: string, admin?: boolean): Promise<any> {
11
- const base = admin ? '/admin' : '/public';
12
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
13
- return request<any>(path);
14
- }
15
-
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
- export async function list(collectionId: string, admin?: boolean): Promise<any[]> {
22
- const base = admin ? '/admin' : '/public';
23
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/form`;
24
- return request<any[]>(path);
25
- }
26
-
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
- export async function create(collectionId: string, data: any): Promise<any> {
33
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/form`;
34
- return post<any>(path, data);
35
- }
36
-
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
- export async function update(collectionId: string, formId: string, data: any): Promise<any> {
44
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
45
- return put<any>(path, data);
46
- }
47
-
48
- /**
49
- * Delete a form for a collection (admin only).
50
- * @param collectionId – The collection identifier
51
- * @param formId – The form identifier
52
- */
53
- export async function remove(collectionId: string, formId: string): Promise<void> {
54
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/form/${encodeURIComponent(formId)}`;
55
- return del<void>(path);
56
- }
57
- }
package/src/api/index.ts DELETED
@@ -1,14 +0,0 @@
1
- // src/api/index.ts
2
- // Re-export all resource namespaces so the consumer can import them in one line.
3
- export { collection } from "./collection"
4
- export { product } from "./product"
5
- export { proof } from "./proof"
6
- export { appConfiguration } from "./appConfiguration"
7
- export { asset } from "./asset"
8
- export { attestation } from "./attestation"
9
- export { auth } from "./auth"
10
- export { form } from "./form"
11
- export { claimSet } from "./claimSet"
12
- export { crate } from "./crate"
13
- export { batch } from "./batch"
14
- export { variant } from "./variant"
@@ -1,128 +0,0 @@
1
- // src/api/product.ts
2
- import { request, post, put, del } from "../http"
3
- import { ProductResponse } from "../types/product"
4
-
5
- export namespace product {
6
- /**
7
- * Retrieves a single Product Item by Collection ID and Product ID.
8
- * @param collectionId – Identifier of the parent collection
9
- * @param productId – Identifier of the product item
10
- * @param admin – If true, use admin endpoint; otherwise, use public
11
- * @returns Promise resolving to a ProductResponse object
12
- * @throws ErrorResponse if the request fails
13
- */
14
- export async function get(
15
- collectionId: string,
16
- productId: string,
17
- admin?: boolean
18
- ): Promise<ProductResponse> {
19
- const base = admin ? '/admin' : '/public';
20
- const path = `${base}/collection/${encodeURIComponent(
21
- collectionId
22
- )}/product/${encodeURIComponent(productId)}`
23
- return request<ProductResponse>(path)
24
- }
25
-
26
- /**
27
- * List all Product Items for a Collection.
28
- * @param collectionId – Identifier of the parent collection
29
- * @param admin – If true, use admin endpoint; otherwise, use public
30
- * @returns Promise resolving to an array of ProductResponse objects
31
- * @throws ErrorResponse if the request fails
32
- */
33
- export async function list(
34
- collectionId: string,
35
- admin?: boolean
36
- ): Promise<ProductResponse[]> {
37
- const base = admin ? '/admin' : '/public';
38
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/product`
39
- return request<ProductResponse[]>(path)
40
- }
41
-
42
- /**
43
- * Create a new product for a collection (admin only).
44
- * @param collectionId – Identifier of the parent collection
45
- * @param data – Product creation data
46
- * @returns Promise resolving to a ProductResponse object
47
- * @throws ErrorResponse if the request fails
48
- */
49
- export async function create(
50
- collectionId: string,
51
- data: any
52
- ): Promise<ProductResponse> {
53
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product`
54
- return post<ProductResponse>(path, data)
55
- }
56
-
57
- /**
58
- * Update a product for a collection (admin only).
59
- * @param collectionId – Identifier of the parent collection
60
- * @param productId – Identifier of the product
61
- * @param data – Product update data
62
- * @returns Promise resolving to a ProductResponse object
63
- * @throws ErrorResponse if the request fails
64
- */
65
- export async function update(
66
- collectionId: string,
67
- productId: string,
68
- data: any
69
- ): Promise<ProductResponse> {
70
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}`
71
- return put<ProductResponse>(path, data)
72
- }
73
-
74
- /**
75
- * Delete a product for a collection (admin only).
76
- * @param collectionId – Identifier of the parent collection
77
- * @param productId – Identifier of the product
78
- * @returns Promise resolving to void
79
- * @throws ErrorResponse if the request fails
80
- */
81
- export async function remove(
82
- collectionId: string,
83
- productId: string
84
- ): Promise<void> {
85
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}`
86
- return del<void>(path)
87
- }
88
-
89
- /**
90
- * Get serial numbers for a product (admin only).
91
- * @param collectionId - Identifier of the parent collection
92
- * @param productId - Identifier of the product
93
- * @param startIndex - Starting index for pagination (default: 0)
94
- * @param count - Number of serial numbers to retrieve (default: 10)
95
- * @returns Promise resolving to serial number data
96
- * @throws ErrorResponse if the request fails
97
- */
98
- export async function getSN(
99
- collectionId: string,
100
- productId: string,
101
- startIndex: number = 0,
102
- count: number = 10
103
- ): Promise<any> {
104
- const queryParams = new URLSearchParams({
105
- startIndex: startIndex.toString(),
106
- count: count.toString()
107
- })
108
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/getSN?${queryParams}`
109
- return request<any>(path)
110
- }
111
-
112
- /**
113
- * Look up a serial number by code for a product (admin only).
114
- * @param collectionId - Identifier of the parent collection
115
- * @param productId - Identifier of the product
116
- * @param codeId - The serial number code to look up
117
- * @returns Promise resolving to serial number lookup data
118
- * @throws ErrorResponse if the request fails
119
- */
120
- export async function lookupSN(
121
- collectionId: string,
122
- productId: string,
123
- codeId: string
124
- ): Promise<any> {
125
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/lookupSN/${encodeURIComponent(codeId)}`
126
- return request<any>(path)
127
- }
128
- }
package/src/api/proof.ts DELETED
@@ -1,32 +0,0 @@
1
- // src/api/proof.ts
2
- import { request } from "../http"
3
- import { ProofResponse } from "../types/proof"
4
-
5
- export namespace proof {
6
- /**
7
- * Retrieves a single Proof by Collection ID and Proof ID.
8
- * @param collectionId – Identifier of the parent collection
9
- * @param proofId – Identifier of the proof
10
- * @returns Promise resolving to a ProofResponse object
11
- * @throws ErrorResponse if the request fails
12
- */
13
- export async function get(
14
- collectionId: string,
15
- proofId: string
16
- ): Promise<ProofResponse> {
17
- const path = `/public/collection/${encodeURIComponent(
18
- collectionId
19
- )}/proof/${encodeURIComponent(proofId)}`
20
- return request<ProofResponse>(path)
21
- }
22
-
23
- /**
24
- * List all Proofs for a Collection.
25
- */
26
- export async function list(
27
- collectionId: string
28
- ): Promise<ProofResponse[]> {
29
- const path = `/public/collection/${encodeURIComponent(collectionId)}/proof`
30
- return request<ProofResponse[]>(path)
31
- }
32
- }
File without changes
@@ -1,173 +0,0 @@
1
- // src/api/variant.ts
2
- import { request, post, put, del } from "../http"
3
- import { VariantResponse, VariantCreateRequest, VariantUpdateRequest } from "../types/variant"
4
-
5
- export namespace variant {
6
- // Admin CRUD operations
7
- /**
8
- * Get a single variant by ID for a collection and product (admin only).
9
- * @param collectionId - Identifier of the parent collection
10
- * @param productId - Identifier of the parent product
11
- * @param variantId - Identifier of the variant
12
- * @returns Promise resolving to a VariantResponse object
13
- * @throws ErrorResponse if the request fails
14
- */
15
- export async function get(
16
- collectionId: string,
17
- productId: string,
18
- variantId: string
19
- ): Promise<VariantResponse> {
20
- const path = `/admin/collection/${encodeURIComponent(
21
- collectionId
22
- )}/product/${encodeURIComponent(
23
- productId
24
- )}/variant/${encodeURIComponent(variantId)}`
25
- return request<VariantResponse>(path)
26
- }
27
-
28
- /**
29
- * List all variants for a collection and product (admin only).
30
- * @param collectionId - Identifier of the parent collection
31
- * @param productId - Identifier of the parent product
32
- * @returns Promise resolving to an array of VariantResponse objects
33
- * @throws ErrorResponse if the request fails
34
- */
35
- export async function list(
36
- collectionId: string,
37
- productId: string
38
- ): Promise<VariantResponse[]> {
39
- const path = `/admin/collection/${encodeURIComponent(
40
- collectionId
41
- )}/product/${encodeURIComponent(productId)}/variant`
42
- return request<VariantResponse[]>(path)
43
- }
44
-
45
- /**
46
- * Create a new variant for a collection and product (admin only).
47
- * @param collectionId - Identifier of the parent collection
48
- * @param productId - Identifier of the parent product
49
- * @param data - Variant creation data
50
- * @returns Promise resolving to a VariantResponse object
51
- * @throws ErrorResponse if the request fails
52
- */
53
- export async function create(
54
- collectionId: string,
55
- productId: string,
56
- data: VariantCreateRequest
57
- ): Promise<VariantResponse> {
58
- const path = `/admin/collection/${encodeURIComponent(
59
- collectionId
60
- )}/product/${encodeURIComponent(productId)}/variant`
61
- return post<VariantResponse>(path, data)
62
- }
63
-
64
- /**
65
- * Update a variant for a collection and product (admin only).
66
- * @param collectionId - Identifier of the parent collection
67
- * @param productId - Identifier of the parent product
68
- * @param variantId - Identifier of the variant
69
- * @param data - Variant update data
70
- * @returns Promise resolving to a VariantResponse object
71
- * @throws ErrorResponse if the request fails
72
- */
73
- export async function update(
74
- collectionId: string,
75
- productId: string,
76
- variantId: string,
77
- data: VariantUpdateRequest
78
- ): Promise<VariantResponse> {
79
- const path = `/admin/collection/${encodeURIComponent(
80
- collectionId
81
- )}/product/${encodeURIComponent(
82
- productId
83
- )}/variant/${encodeURIComponent(variantId)}`
84
- return put<VariantResponse>(path, data)
85
- }
86
-
87
- /**
88
- * Delete a variant for a collection and product (admin only).
89
- * @param collectionId - Identifier of the parent collection
90
- * @param productId - Identifier of the parent product
91
- * @param variantId - Identifier of the variant
92
- * @returns Promise resolving to void
93
- * @throws ErrorResponse if the request fails
94
- */
95
- export async function remove(
96
- collectionId: string,
97
- productId: string,
98
- variantId: string
99
- ): Promise<void> {
100
- const path = `/admin/collection/${encodeURIComponent(
101
- collectionId
102
- )}/product/${encodeURIComponent(
103
- productId
104
- )}/variant/${encodeURIComponent(variantId)}`
105
- return del<void>(path)
106
- }
107
-
108
- // Public read-only operation
109
- /**
110
- * Get a single variant by ID for a collection and product (public endpoint).
111
- * @param collectionId - Identifier of the parent collection
112
- * @param productId - Identifier of the parent product
113
- * @param variantId - Identifier of the variant
114
- * @returns Promise resolving to a VariantResponse object
115
- * @throws ErrorResponse if the request fails
116
- */
117
- export async function getPublic(
118
- collectionId: string,
119
- productId: string,
120
- variantId: string
121
- ): Promise<VariantResponse> {
122
- const path = `/public/collection/${encodeURIComponent(
123
- collectionId
124
- )}/product/${encodeURIComponent(
125
- productId
126
- )}/variant/${encodeURIComponent(variantId)}`
127
- return request<VariantResponse>(path)
128
- }
129
-
130
- /**
131
- * Get serial numbers for a variant (admin only).
132
- * @param collectionId - Identifier of the parent collection
133
- * @param productId - Identifier of the parent product
134
- * @param variantId - Identifier of the variant
135
- * @param startIndex - Starting index for pagination (default: 0)
136
- * @param count - Number of serial numbers to retrieve (default: 10)
137
- * @returns Promise resolving to serial number data
138
- * @throws ErrorResponse if the request fails
139
- */
140
- export async function getSN(
141
- collectionId: string,
142
- productId: string,
143
- variantId: string,
144
- startIndex: number = 0,
145
- count: number = 10
146
- ): Promise<any> {
147
- const queryParams = new URLSearchParams({
148
- startIndex: startIndex.toString(),
149
- count: count.toString()
150
- })
151
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/variant/${encodeURIComponent(variantId)}/getSN?${queryParams}`
152
- return request<any>(path)
153
- }
154
-
155
- /**
156
- * Look up a serial number by code for a variant (admin only).
157
- * @param collectionId - Identifier of the parent collection
158
- * @param productId - Identifier of the parent product
159
- * @param variantId - Identifier of the variant
160
- * @param codeId - The serial number code to look up
161
- * @returns Promise resolving to serial number lookup data
162
- * @throws ErrorResponse if the request fails
163
- */
164
- export async function lookupSN(
165
- collectionId: string,
166
- productId: string,
167
- variantId: string,
168
- codeId: string
169
- ): Promise<any> {
170
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/variant/${encodeURIComponent(variantId)}/lookupSN/${encodeURIComponent(codeId)}`
171
- return request<any>(path)
172
- }
173
- }