@proveanything/smartlinks 1.3.5 → 1.3.8

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,4 +1,4 @@
1
- import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest } from "../types/collection";
1
+ import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse } from "../types/collection";
2
2
  export declare namespace collection {
3
3
  /**
4
4
  * Retrieves a single Collection by its ID.
@@ -28,6 +28,13 @@ export declare namespace collection {
28
28
  * @returns Promise resolving to the settings object
29
29
  */
30
30
  function getSettings(collectionId: string, settingGroup: string, admin?: boolean): Promise<any>;
31
+ /**
32
+ * Retrieve all configured app module definitions for a collection (public endpoint).
33
+ * @param collectionId – Identifier of the collection
34
+ * @returns Promise resolving to an AppsConfigResponse containing all app configurations
35
+ * @throws ErrorResponse if the request fails
36
+ */
37
+ function getAppsConfig(collectionId: string): Promise<AppsConfigResponse>;
31
38
  /**
32
39
  * Update a specific settings group for a collection (admin endpoint).
33
40
  * @param collectionId – Identifier of the collection
@@ -49,6 +49,17 @@ export var collection;
49
49
  return request(path);
50
50
  }
51
51
  collection.getSettings = getSettings;
52
+ /**
53
+ * Retrieve all configured app module definitions for a collection (public endpoint).
54
+ * @param collectionId – Identifier of the collection
55
+ * @returns Promise resolving to an AppsConfigResponse containing all app configurations
56
+ * @throws ErrorResponse if the request fails
57
+ */
58
+ async function getAppsConfig(collectionId) {
59
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/apps-config`;
60
+ return request(path);
61
+ }
62
+ collection.getAppsConfig = getAppsConfig;
52
63
  /**
53
64
  * Update a specific settings group for a collection (admin endpoint).
54
65
  * @param collectionId – Identifier of the collection
@@ -128,12 +128,11 @@ export declare namespace tags {
128
128
  */
129
129
  function list(collectionId: string, params?: ListTagsRequest): Promise<ListTagsResponse>;
130
130
  /**
131
- * Public lookup of a single tag by tagId within a specific collection.
131
+ * Public lookup of a single tag by tagId (global).
132
132
  * Optionally embed related collection, product, or proof data.
133
133
  * No authentication required.
134
134
  *
135
- * @param collectionId - Identifier of the collection to search within
136
- * @param tagId - Unique tag identifier
135
+ * @param tagId - Unique tag identifier (globally unique)
137
136
  * @param params - Optional parameters (embed)
138
137
  * @returns Promise resolving to a PublicGetTagResponse with optional embedded data
139
138
  * @throws ErrorResponse if the request fails
@@ -141,16 +140,21 @@ export declare namespace tags {
141
140
  * @example
142
141
  * ```typescript
143
142
  * // Simple lookup
144
- * const result = await tags.publicGet('coll_123', 'TAG001')
143
+ * const result = await tags.getTag('TAG001')
145
144
  *
146
145
  * // With embedded data
147
- * const withData = await tags.publicGet('coll_123', 'TAG001', {
146
+ * const withData = await tags.getTag('TAG001', {
148
147
  * embed: 'collection,product,proof'
149
148
  * })
150
149
  * console.log(withData.tag, withData.collection, withData.product, withData.proof)
151
150
  * ```
152
151
  */
153
- function publicGet(collectionId: string, tagId: string, params?: PublicGetTagRequest): Promise<PublicGetTagResponse>;
152
+ function getTag(tagId: string, params?: PublicGetTagRequest): Promise<PublicGetTagResponse>;
153
+ /**
154
+ * Backward-compat: Public lookup with collectionId parameter (ignored).
155
+ * Calls global route under /public/tags/:tagId.
156
+ */
157
+ function publicGet(_collectionId: string, tagId: string, params?: PublicGetTagRequest): Promise<PublicGetTagResponse>;
154
158
  /**
155
159
  * Public batch lookup of multiple tags in a single request (POST).
156
160
  * Only returns tags from the specified collection.
@@ -175,7 +179,12 @@ export declare namespace tags {
175
179
  * console.log(result.products)
176
180
  * ```
177
181
  */
178
- function publicBatchLookup(collectionId: string, data: PublicBatchLookupRequest): Promise<PublicBatchLookupResponse>;
182
+ function lookupTags(data: PublicBatchLookupRequest): Promise<PublicBatchLookupResponse>;
183
+ /**
184
+ * Backward-compat: Public batch lookup with collectionId parameter (ignored).
185
+ * Calls global route under /public/tags/lookup.
186
+ */
187
+ function publicBatchLookup(_collectionId: string, data: PublicBatchLookupRequest): Promise<PublicBatchLookupResponse>;
179
188
  /**
180
189
  * Public batch lookup of multiple tags using query parameters (GET).
181
190
  * Only returns tags from the specified collection.
@@ -195,5 +204,10 @@ export declare namespace tags {
195
204
  * })
196
205
  * ```
197
206
  */
198
- function publicBatchLookupQuery(collectionId: string, params: PublicBatchLookupQueryRequest): Promise<PublicBatchLookupQueryResponse>;
207
+ function lookupTagsQuery(params: PublicBatchLookupQueryRequest): Promise<PublicBatchLookupQueryResponse>;
208
+ /**
209
+ * Backward-compat: Public batch lookup (GET) with collectionId parameter (ignored).
210
+ * Calls global route under /public/tags/lookup.
211
+ */
212
+ function publicBatchLookupQuery(_collectionId: string, params: PublicBatchLookupQueryRequest): Promise<PublicBatchLookupQueryResponse>;
199
213
  }
package/dist/api/tags.js CHANGED
@@ -172,12 +172,11 @@ export var tags;
172
172
  // Public Endpoints
173
173
  // ============================================================================
174
174
  /**
175
- * Public lookup of a single tag by tagId within a specific collection.
175
+ * Public lookup of a single tag by tagId (global).
176
176
  * Optionally embed related collection, product, or proof data.
177
177
  * No authentication required.
178
178
  *
179
- * @param collectionId - Identifier of the collection to search within
180
- * @param tagId - Unique tag identifier
179
+ * @param tagId - Unique tag identifier (globally unique)
181
180
  * @param params - Optional parameters (embed)
182
181
  * @returns Promise resolving to a PublicGetTagResponse with optional embedded data
183
182
  * @throws ErrorResponse if the request fails
@@ -185,23 +184,31 @@ export var tags;
185
184
  * @example
186
185
  * ```typescript
187
186
  * // Simple lookup
188
- * const result = await tags.publicGet('coll_123', 'TAG001')
187
+ * const result = await tags.getTag('TAG001')
189
188
  *
190
189
  * // With embedded data
191
- * const withData = await tags.publicGet('coll_123', 'TAG001', {
190
+ * const withData = await tags.getTag('TAG001', {
192
191
  * embed: 'collection,product,proof'
193
192
  * })
194
193
  * console.log(withData.tag, withData.collection, withData.product, withData.proof)
195
194
  * ```
196
195
  */
197
- async function publicGet(collectionId, tagId, params) {
196
+ async function getTag(tagId, params) {
198
197
  const queryParams = new URLSearchParams();
199
198
  if (params === null || params === void 0 ? void 0 : params.embed)
200
199
  queryParams.append('embed', params.embed);
201
200
  const query = queryParams.toString();
202
- const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/${encodeURIComponent(tagId)}${query ? `?${query}` : ''}`;
201
+ const path = `/public/tags/${encodeURIComponent(tagId)}${query ? `?${query}` : ''}`;
203
202
  return request(path);
204
203
  }
204
+ tags.getTag = getTag;
205
+ /**
206
+ * Backward-compat: Public lookup with collectionId parameter (ignored).
207
+ * Calls global route under /public/tags/:tagId.
208
+ */
209
+ async function publicGet(_collectionId, tagId, params) {
210
+ return getTag(tagId, params);
211
+ }
205
212
  tags.publicGet = publicGet;
206
213
  /**
207
214
  * Public batch lookup of multiple tags in a single request (POST).
@@ -227,10 +234,18 @@ export var tags;
227
234
  * console.log(result.products)
228
235
  * ```
229
236
  */
230
- async function publicBatchLookup(collectionId, data) {
231
- const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/lookup`;
237
+ async function lookupTags(data) {
238
+ const path = `/public/tags/lookup`;
232
239
  return post(path, data);
233
240
  }
241
+ tags.lookupTags = lookupTags;
242
+ /**
243
+ * Backward-compat: Public batch lookup with collectionId parameter (ignored).
244
+ * Calls global route under /public/tags/lookup.
245
+ */
246
+ async function publicBatchLookup(_collectionId, data) {
247
+ return lookupTags(data);
248
+ }
234
249
  tags.publicBatchLookup = publicBatchLookup;
235
250
  /**
236
251
  * Public batch lookup of multiple tags using query parameters (GET).
@@ -251,13 +266,21 @@ export var tags;
251
266
  * })
252
267
  * ```
253
268
  */
254
- async function publicBatchLookupQuery(collectionId, params) {
269
+ async function lookupTagsQuery(params) {
255
270
  const queryParams = new URLSearchParams();
256
271
  queryParams.append('tagIds', params.tagIds);
257
272
  if (params.embed)
258
273
  queryParams.append('embed', params.embed);
259
- const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/lookup?${queryParams.toString()}`;
274
+ const path = `/public/tags/lookup?${queryParams.toString()}`;
260
275
  return request(path);
261
276
  }
277
+ tags.lookupTagsQuery = lookupTagsQuery;
278
+ /**
279
+ * Backward-compat: Public batch lookup (GET) with collectionId parameter (ignored).
280
+ * Calls global route under /public/tags/lookup.
281
+ */
282
+ async function publicBatchLookupQuery(_collectionId, params) {
283
+ return lookupTagsQuery(params);
284
+ }
262
285
  tags.publicBatchLookupQuery = publicBatchLookupQuery;
263
286
  })(tags || (tags = {}));