@proveanything/smartlinks 1.9.13 → 1.9.15

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.
@@ -1,110 +1,98 @@
1
- import { UpdateClaimDataRequest, AssignClaimsRequest, CreateClaimSetTagRequest, CreateClaimSetTagResponse } from "../types";
1
+ import { UpdateClaimDataRequest, AssignClaimsRequest, CreateClaimSetTagRequest, CreateClaimSetTagResponse, CreateClaimSetRequest, ImportClaimSetTagsRequest, ImportClaimSetTagsResponse } from "../types";
2
2
  export declare namespace claimSet {
3
3
  /**
4
- * Get all claim sets for a collection.
5
- * @param collectionId The collection identifier
6
- * @returns Promise resolving to an array of claim sets
4
+ * Get all claim sets.
5
+ * When collectionId is provided, returns claim sets for that collection.
6
+ * When omitted, returns all claim sets owned by the authenticated user.
7
+ * @param collectionId – Optional collection identifier
7
8
  */
8
- function getAllForCollection(collectionId: string): Promise<any[]>;
9
+ function getAll(collectionId?: string): Promise<any[]>;
9
10
  /**
10
- * Get a specific claim set for a collection.
11
- * @param collectionId – The collection identifier
11
+ * Get a specific claim set by ID.
12
12
  * @param claimSetId – The claim set identifier
13
- * @returns Promise resolving to a claim set object
13
+ * @param collectionId Optional collection identifier; omit for user-scoped access
14
14
  */
15
- function getForCollection(collectionId: string, claimSetId: string): Promise<any>;
15
+ function get(claimSetId: string, collectionId?: string): Promise<any>;
16
16
  /**
17
- * Get all tags for a claim set.
18
- * @param collectionId The collection identifier
17
+ * Create a new claim set.
18
+ * When collectionId is provided, creates it scoped to that collection.
19
+ * When omitted, creates a global user-owned claim set.
20
+ * @param params – Claim set creation parameters
21
+ * @param collectionId – Optional collection identifier
22
+ */
23
+ function create(params: CreateClaimSetRequest, collectionId?: string): Promise<any>;
24
+ /**
25
+ * Update a claim set.
19
26
  * @param claimSetId – The claim set identifier
20
- * @returns Promise resolving to an array of tags
27
+ * @param params Fields to update
28
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
21
29
  */
22
- function getAllTags(collectionId: string, claimSetId: string): Promise<any[]>;
30
+ function update(claimSetId: string, params: any, collectionId?: string): Promise<any>;
23
31
  /**
24
- * Get a report for a claim set.
25
- * @param collectionId – The collection identifier
32
+ * Delete (soft-delete) a claim set.
26
33
  * @param claimSetId – The claim set identifier
27
- * @returns Promise resolving to a report object
34
+ * @param collectionId Optional collection identifier; omit for user-scoped access
28
35
  */
29
- function getReport(collectionId: string, claimSetId: string): Promise<any>;
36
+ function remove(claimSetId: string, collectionId?: string): Promise<any>;
37
+ /**
38
+ * Get all tags for a claim set (including data).
39
+ * @param claimSetId – The claim set identifier
40
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
41
+ */
42
+ function getAllTags(claimSetId: string, collectionId?: string): Promise<any>;
43
+ /**
44
+ * Get assigned tags for a claim set — tags soft-assigned to a collection or product.
45
+ * @param claimSetId – The claim set identifier
46
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
47
+ */
48
+ function getAssignedTags(claimSetId: string, collectionId?: string): Promise<any>;
49
+ /**
50
+ * Create a single tag inside a claim set.
51
+ * @param claimSetId – The claim set identifier
52
+ * @param data – Tag creation parameters
53
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
54
+ */
55
+ function createTag(claimSetId: string, data: CreateClaimSetTagRequest, collectionId?: string): Promise<CreateClaimSetTagResponse>;
56
+ /**
57
+ * Bulk import tags into a claim set.
58
+ * @param claimSetId – The claim set identifier
59
+ * @param data – Import parameters: tags array and optional mode ("upsert" | "replace")
60
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
61
+ */
62
+ function importTags(claimSetId: string, data: ImportClaimSetTagsRequest, collectionId?: string): Promise<ImportClaimSetTagsResponse>;
30
63
  /**
31
- * Get assigned tags for a claim set.
64
+ * Get a report for a claim set (collection-scoped).
32
65
  * @param collectionId – The collection identifier
33
66
  * @param claimSetId – The claim set identifier
34
- * @returns Promise resolving to assigned tags
35
67
  */
36
- function getAssignedTags(collectionId: string, claimSetId: string): Promise<any>;
68
+ function getReport(collectionId: string, claimSetId: string): Promise<any>;
37
69
  /**
38
70
  * Get tag summary for a collection.
39
71
  * @param collectionId – The collection identifier
40
- * @returns Promise resolving to tag summary
41
72
  */
42
73
  function getTagSummary(collectionId: string): Promise<any>;
43
74
  /**
44
75
  * Perform a tag query for a collection.
45
76
  * @param collectionId – The collection identifier
46
77
  * @param data – The query data
47
- * @returns Promise resolving to query results
48
78
  */
49
79
  function tagQuery(collectionId: string, data: any): Promise<any>;
50
80
  /**
51
- * Create a new claim set for a collection.
52
- * @param collectionId – The collection identifier
53
- * @param params – The claim set creation parameters
54
- * @returns Promise resolving to the created claim set
55
- */
56
- function createForCollection(collectionId: string, params: any): Promise<any>;
57
- /**
58
- * Update a claim set for a collection.
59
- * @param collectionId – The collection identifier
60
- * @param params – The claim set update parameters (must include id)
61
- * @returns Promise resolving to the updated claim set
62
- */
63
- function updateForCollection(collectionId: string, params: any): Promise<any>;
64
- /**
65
- * Make a claim for a claim set.
81
+ * Make a claim against a claim set (collection-scoped).
66
82
  * @param collectionId – The collection identifier
67
- * @param params – The claim parameters (must include id)
68
- * @returns Promise resolving to the claim result
83
+ * @param params – Claim parameters (must include id)
69
84
  */
70
85
  function makeClaim(collectionId: string, params: any): Promise<any>;
71
86
  /**
72
- * Assign claims to a claim set.
87
+ * Assign claims to codes or ranges within a collection.
73
88
  * @param collectionId – The collection identifier
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
- * }
89
+ * @param data – Claims assignment data
85
90
  */
86
91
  function assignClaims(collectionId: string, data: AssignClaimsRequest): Promise<any>;
87
92
  /**
88
- * Update claim data for a collection.
93
+ * Update claim data for a claim set (collection-scoped).
89
94
  * @param collectionId – The collection identifier
90
- * @param data – The claim data to update
95
+ * @param data – Claim data to update
91
96
  */
92
97
  function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
93
- /**
94
- * Create a single tag/code inside an existing claim set (collection admin).
95
- * POST /admin/collection/:collectionId/claimSet/:claimSetId/createTag
96
- * @param collectionId – The collection identifier
97
- * @param claimSetId – The claim set identifier
98
- * @param data – Tag creation parameters
99
- * @returns Promise resolving to the created tag
100
- */
101
- function createTag(collectionId: string, claimSetId: string, data: CreateClaimSetTagRequest): Promise<CreateClaimSetTagResponse>;
102
- /**
103
- * Create a single tag/code inside an existing claim set (platform; requires account.features.adminClaimSets).
104
- * POST /platform/claimSet/:claimSetId/createTag
105
- * @param claimSetId – The claim set identifier
106
- * @param data – Tag creation parameters
107
- * @returns Promise resolving to the created tag
108
- */
109
- function createTagPlatform(claimSetId: string, data: CreateClaimSetTagRequest): Promise<CreateClaimSetTagResponse>;
110
98
  }
@@ -1,167 +1,155 @@
1
- import { request, post, put } from "../http";
1
+ import { request, post, put, del } from "../http";
2
+ /**
3
+ * Returns the base path for claim set endpoints.
4
+ * When collectionId is provided, routes to the collection-scoped admin API.
5
+ * When omitted, routes to the user-scoped admin API (global claim sets).
6
+ */
7
+ function base(collectionId) {
8
+ return collectionId
9
+ ? `/admin/collection/${encodeURIComponent(collectionId)}/claimSet`
10
+ : `/admin/claimSet`;
11
+ }
2
12
  export var claimSet;
3
13
  (function (claimSet) {
4
14
  /**
5
- * Get all claim sets for a collection.
6
- * @param collectionId The collection identifier
7
- * @returns Promise resolving to an array of claim sets
15
+ * Get all claim sets.
16
+ * When collectionId is provided, returns claim sets for that collection.
17
+ * When omitted, returns all claim sets owned by the authenticated user.
18
+ * @param collectionId – Optional collection identifier
8
19
  */
9
- async function getAllForCollection(collectionId) {
10
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet`;
11
- return request(path);
20
+ async function getAll(collectionId) {
21
+ return request(base(collectionId));
12
22
  }
13
- claimSet.getAllForCollection = getAllForCollection;
23
+ claimSet.getAll = getAll;
14
24
  /**
15
- * Get a specific claim set for a collection.
16
- * @param collectionId – The collection identifier
25
+ * Get a specific claim set by ID.
17
26
  * @param claimSetId – The claim set identifier
18
- * @returns Promise resolving to a claim set object
27
+ * @param collectionId Optional collection identifier; omit for user-scoped access
19
28
  */
20
- async function getForCollection(collectionId, claimSetId) {
21
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(claimSetId)}`;
22
- return request(path);
29
+ async function get(claimSetId, collectionId) {
30
+ return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}`);
23
31
  }
24
- claimSet.getForCollection = getForCollection;
32
+ claimSet.get = get;
25
33
  /**
26
- * Get all tags for a claim set.
27
- * @param collectionId The collection identifier
34
+ * Create a new claim set.
35
+ * When collectionId is provided, creates it scoped to that collection.
36
+ * When omitted, creates a global user-owned claim set.
37
+ * @param params – Claim set creation parameters
38
+ * @param collectionId – Optional collection identifier
39
+ */
40
+ async function create(params, collectionId) {
41
+ return post(base(collectionId), params);
42
+ }
43
+ claimSet.create = create;
44
+ /**
45
+ * Update a claim set.
46
+ * @param claimSetId – The claim set identifier
47
+ * @param params – Fields to update
48
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
49
+ */
50
+ async function update(claimSetId, params, collectionId) {
51
+ return put(`${base(collectionId)}/${encodeURIComponent(claimSetId)}`, params);
52
+ }
53
+ claimSet.update = update;
54
+ /**
55
+ * Delete (soft-delete) a claim set.
56
+ * @param claimSetId – The claim set identifier
57
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
58
+ */
59
+ async function remove(claimSetId, collectionId) {
60
+ return del(`${base(collectionId)}/${encodeURIComponent(claimSetId)}`);
61
+ }
62
+ claimSet.remove = remove;
63
+ /**
64
+ * Get all tags for a claim set (including data).
28
65
  * @param claimSetId – The claim set identifier
29
- * @returns Promise resolving to an array of tags
66
+ * @param collectionId Optional collection identifier; omit for user-scoped access
30
67
  */
31
- async function getAllTags(collectionId, claimSetId) {
32
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(claimSetId)}/tags`;
33
- return request(path);
68
+ async function getAllTags(claimSetId, collectionId) {
69
+ return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/tags`);
34
70
  }
35
71
  claimSet.getAllTags = getAllTags;
36
72
  /**
37
- * Get a report for a claim set.
38
- * @param collectionId – The collection identifier
73
+ * Get assigned tags for a claim set — tags soft-assigned to a collection or product.
39
74
  * @param claimSetId – The claim set identifier
40
- * @returns Promise resolving to a report object
75
+ * @param collectionId Optional collection identifier; omit for user-scoped access
41
76
  */
42
- async function getReport(collectionId, claimSetId) {
43
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(claimSetId)}/report`;
44
- return request(path);
77
+ async function getAssignedTags(claimSetId, collectionId) {
78
+ return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/assignedTags`);
45
79
  }
46
- claimSet.getReport = getReport;
80
+ claimSet.getAssignedTags = getAssignedTags;
47
81
  /**
48
- * Get assigned tags for a claim set.
82
+ * Create a single tag inside a claim set.
83
+ * @param claimSetId – The claim set identifier
84
+ * @param data – Tag creation parameters
85
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
86
+ */
87
+ async function createTag(claimSetId, data, collectionId) {
88
+ return post(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/createTag`, data);
89
+ }
90
+ claimSet.createTag = createTag;
91
+ /**
92
+ * Bulk import tags into a claim set.
93
+ * @param claimSetId – The claim set identifier
94
+ * @param data – Import parameters: tags array and optional mode ("upsert" | "replace")
95
+ * @param collectionId – Optional collection identifier; omit for user-scoped access
96
+ */
97
+ async function importTags(claimSetId, data, collectionId) {
98
+ return post(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/importTags`, data);
99
+ }
100
+ claimSet.importTags = importTags;
101
+ // ─── Collection-scoped-only operations ──────────────────────────────────────
102
+ /**
103
+ * Get a report for a claim set (collection-scoped).
49
104
  * @param collectionId – The collection identifier
50
105
  * @param claimSetId – The claim set identifier
51
- * @returns Promise resolving to assigned tags
52
106
  */
53
- async function getAssignedTags(collectionId, claimSetId) {
54
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(claimSetId)}/assignedTags`;
55
- return request(path);
107
+ async function getReport(collectionId, claimSetId) {
108
+ return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/report`);
56
109
  }
57
- claimSet.getAssignedTags = getAssignedTags;
110
+ claimSet.getReport = getReport;
58
111
  /**
59
112
  * Get tag summary for a collection.
60
113
  * @param collectionId – The collection identifier
61
- * @returns Promise resolving to tag summary
62
114
  */
63
115
  async function getTagSummary(collectionId) {
64
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/tagSummary`;
65
- return request(path);
116
+ return request(`${base(collectionId)}/tagSummary`);
66
117
  }
67
118
  claimSet.getTagSummary = getTagSummary;
68
119
  /**
69
120
  * Perform a tag query for a collection.
70
121
  * @param collectionId – The collection identifier
71
122
  * @param data – The query data
72
- * @returns Promise resolving to query results
73
123
  */
74
124
  async function tagQuery(collectionId, data) {
75
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/tagQuery`;
76
- return post(path, data);
125
+ return post(`${base(collectionId)}/tagQuery`, data);
77
126
  }
78
127
  claimSet.tagQuery = tagQuery;
79
128
  /**
80
- * Create a new claim set for a collection.
81
- * @param collectionId – The collection identifier
82
- * @param params – The claim set creation parameters
83
- * @returns Promise resolving to the created claim set
84
- */
85
- async function createForCollection(collectionId, params) {
86
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet`;
87
- return post(path, params);
88
- }
89
- claimSet.createForCollection = createForCollection;
90
- /**
91
- * Update a claim set for a collection.
92
- * @param collectionId – The collection identifier
93
- * @param params – The claim set update parameters (must include id)
94
- * @returns Promise resolving to the updated claim set
95
- */
96
- async function updateForCollection(collectionId, params) {
97
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(params.id)}`;
98
- return put(path, params);
99
- }
100
- claimSet.updateForCollection = updateForCollection;
101
- /**
102
- * Make a claim for a claim set.
129
+ * Make a claim against a claim set (collection-scoped).
103
130
  * @param collectionId – The collection identifier
104
- * @param params – The claim parameters (must include id)
105
- * @returns Promise resolving to the claim result
131
+ * @param params – Claim parameters (must include id)
106
132
  */
107
133
  async function makeClaim(collectionId, params) {
108
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(params.id)}/makeClaim`;
109
- return post(path, params);
134
+ return post(`${base(collectionId)}/${encodeURIComponent(params.id)}/makeClaim`, params);
110
135
  }
111
136
  claimSet.makeClaim = makeClaim;
112
137
  /**
113
- * Assign claims to a claim set.
138
+ * Assign claims to codes or ranges within a collection.
114
139
  * @param collectionId – The collection identifier
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
- * }
140
+ * @param data – Claims assignment data
126
141
  */
127
142
  async function assignClaims(collectionId, data) {
128
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(data.id)}/assignClaims`;
129
- return post(path, data);
143
+ return post(`${base(collectionId)}/${encodeURIComponent(data.id)}/assignClaims`, data);
130
144
  }
131
145
  claimSet.assignClaims = assignClaims;
132
146
  /**
133
- * Update claim data for a collection.
147
+ * Update claim data for a claim set (collection-scoped).
134
148
  * @param collectionId – The collection identifier
135
- * @param data – The claim data to update
149
+ * @param data – Claim data to update
136
150
  */
137
151
  async function updateClaimData(collectionId, data) {
138
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/updateClaimData`;
139
- return post(path, data);
152
+ return post(`${base(collectionId)}/updateClaimData`, data);
140
153
  }
141
154
  claimSet.updateClaimData = updateClaimData;
142
- /**
143
- * Create a single tag/code inside an existing claim set (collection admin).
144
- * POST /admin/collection/:collectionId/claimSet/:claimSetId/createTag
145
- * @param collectionId – The collection identifier
146
- * @param claimSetId – The claim set identifier
147
- * @param data – Tag creation parameters
148
- * @returns Promise resolving to the created tag
149
- */
150
- async function createTag(collectionId, claimSetId, data) {
151
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(claimSetId)}/createTag`;
152
- return post(path, data);
153
- }
154
- claimSet.createTag = createTag;
155
- /**
156
- * Create a single tag/code inside an existing claim set (platform; requires account.features.adminClaimSets).
157
- * POST /platform/claimSet/:claimSetId/createTag
158
- * @param claimSetId – The claim set identifier
159
- * @param data – Tag creation parameters
160
- * @returns Promise resolving to the created tag
161
- */
162
- async function createTagPlatform(claimSetId, data) {
163
- const path = `/platform/claimSet/${encodeURIComponent(claimSetId)}/createTag`;
164
- return post(path, data);
165
- }
166
- claimSet.createTagPlatform = createTagPlatform;
167
155
  })(claimSet || (claimSet = {}));
@@ -0,0 +1,19 @@
1
+ import type { FieldDefinition, ProofTypeDefinition } from "../types/config";
2
+ export declare namespace config {
3
+ /**
4
+ * Returns the full platform field catalog.
5
+ * Fields are used as building blocks for proof type templates — they define
6
+ * the input widgets shown when creating or editing products and proof items.
7
+ *
8
+ * **Endpoint:** `GET /api/v1/public/config/fields`
9
+ */
10
+ function getFields(): Promise<FieldDefinition[]>;
11
+ /**
12
+ * Returns all proof type definitions.
13
+ * Proof types are templates that specify which fields to show, which apps are
14
+ * pre-installed, and how the portal behaves for a given product category.
15
+ *
16
+ * **Endpoint:** `GET /api/v1/public/config/proofTypes`
17
+ */
18
+ function getProofTypes(): Promise<ProofTypeDefinition[]>;
19
+ }
@@ -0,0 +1,27 @@
1
+ // src/api/config.ts
2
+ import { request } from "../http";
3
+ export var config;
4
+ (function (config) {
5
+ /**
6
+ * Returns the full platform field catalog.
7
+ * Fields are used as building blocks for proof type templates — they define
8
+ * the input widgets shown when creating or editing products and proof items.
9
+ *
10
+ * **Endpoint:** `GET /api/v1/public/config/fields`
11
+ */
12
+ async function getFields() {
13
+ return request("/public/config/fields");
14
+ }
15
+ config.getFields = getFields;
16
+ /**
17
+ * Returns all proof type definitions.
18
+ * Proof types are templates that specify which fields to show, which apps are
19
+ * pre-installed, and how the portal behaves for a given product category.
20
+ *
21
+ * **Endpoint:** `GET /api/v1/public/config/proofTypes`
22
+ */
23
+ async function getProofTypes() {
24
+ return request("/public/config/proofTypes");
25
+ }
26
+ config.getProofTypes = getProofTypes;
27
+ })(config || (config = {}));
@@ -36,3 +36,4 @@ export { attestations } from "./attestations";
36
36
  export { containers } from "./containers";
37
37
  export { loyalty } from "./loyalty";
38
38
  export { translations } from "./translations";
39
+ export { config } from "./config";
package/dist/api/index.js CHANGED
@@ -39,3 +39,4 @@ export { attestations } from "./attestations";
39
39
  export { containers } from "./containers";
40
40
  export { loyalty } from "./loyalty";
41
41
  export { translations } from "./translations";
42
+ export { config } from "./config";