@proveanything/smartlinks 1.3.31 → 1.3.33
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/dist/api/appConfiguration.d.ts +38 -0
- package/dist/api/appConfiguration.js +44 -0
- package/dist/api/collection.d.ts +0 -38
- package/dist/api/collection.js +1 -45
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/docs/API_SUMMARY.md +4 -15
- package/docs/API_SUMMARY.md +4 -15
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest";
|
|
1
2
|
export type AppConfigOptions = {
|
|
2
3
|
appId: string;
|
|
3
4
|
collectionId?: string;
|
|
@@ -19,4 +20,41 @@ export declare namespace appConfiguration {
|
|
|
19
20
|
function getDataItem(opts: AppConfigOptions): Promise<any>;
|
|
20
21
|
function setDataItem(opts: AppConfigOptions): Promise<any>;
|
|
21
22
|
function deleteDataItem(opts: AppConfigOptions): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Fetches ALL widget data (manifests + bundle files) for a collection in one call.
|
|
25
|
+
* Returns everything needed to render widgets with zero additional requests.
|
|
26
|
+
*
|
|
27
|
+
* This solves N+1 query problems by fetching manifests, JavaScript bundles,
|
|
28
|
+
* and CSS files in parallel on the server.
|
|
29
|
+
*
|
|
30
|
+
* @param collectionId - The collection ID
|
|
31
|
+
* @param options - Optional settings (force: bypass cache)
|
|
32
|
+
* @returns Promise resolving to collection widgets with manifests and bundle files
|
|
33
|
+
* @throws ErrorResponse if the request fails
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Fetch all widget data for a collection
|
|
38
|
+
* const { apps } = await Api.AppConfiguration.getWidgets(collectionId);
|
|
39
|
+
* // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
|
|
40
|
+
*
|
|
41
|
+
* // Convert bundle source to dynamic imports
|
|
42
|
+
* for (const app of apps) {
|
|
43
|
+
* const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
|
|
44
|
+
* const blobUrl = URL.createObjectURL(blob);
|
|
45
|
+
* const widgetModule = await import(blobUrl);
|
|
46
|
+
*
|
|
47
|
+
* // Inject CSS if present
|
|
48
|
+
* if (app.bundleCss) {
|
|
49
|
+
* const styleTag = document.createElement('style');
|
|
50
|
+
* styleTag.textContent = app.bundleCss;
|
|
51
|
+
* document.head.appendChild(styleTag);
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* // Force refresh all widgets
|
|
56
|
+
* const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
function getWidgets(collectionId: string, options?: GetCollectionWidgetsOptions): Promise<CollectionWidgetsResponse>;
|
|
22
60
|
}
|
|
@@ -88,4 +88,48 @@ export var appConfiguration;
|
|
|
88
88
|
return del(path);
|
|
89
89
|
}
|
|
90
90
|
appConfiguration.deleteDataItem = deleteDataItem;
|
|
91
|
+
/**
|
|
92
|
+
* Fetches ALL widget data (manifests + bundle files) for a collection in one call.
|
|
93
|
+
* Returns everything needed to render widgets with zero additional requests.
|
|
94
|
+
*
|
|
95
|
+
* This solves N+1 query problems by fetching manifests, JavaScript bundles,
|
|
96
|
+
* and CSS files in parallel on the server.
|
|
97
|
+
*
|
|
98
|
+
* @param collectionId - The collection ID
|
|
99
|
+
* @param options - Optional settings (force: bypass cache)
|
|
100
|
+
* @returns Promise resolving to collection widgets with manifests and bundle files
|
|
101
|
+
* @throws ErrorResponse if the request fails
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Fetch all widget data for a collection
|
|
106
|
+
* const { apps } = await Api.AppConfiguration.getWidgets(collectionId);
|
|
107
|
+
* // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
|
|
108
|
+
*
|
|
109
|
+
* // Convert bundle source to dynamic imports
|
|
110
|
+
* for (const app of apps) {
|
|
111
|
+
* const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
|
|
112
|
+
* const blobUrl = URL.createObjectURL(blob);
|
|
113
|
+
* const widgetModule = await import(blobUrl);
|
|
114
|
+
*
|
|
115
|
+
* // Inject CSS if present
|
|
116
|
+
* if (app.bundleCss) {
|
|
117
|
+
* const styleTag = document.createElement('style');
|
|
118
|
+
* styleTag.textContent = app.bundleCss;
|
|
119
|
+
* document.head.appendChild(styleTag);
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
* // Force refresh all widgets
|
|
124
|
+
* const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
async function getWidgets(collectionId, options) {
|
|
128
|
+
let path = `/public/collection/${encodeURIComponent(collectionId)}/app/widgets`;
|
|
129
|
+
if (options === null || options === void 0 ? void 0 : options.force) {
|
|
130
|
+
path += '?force=true';
|
|
131
|
+
}
|
|
132
|
+
return request(path);
|
|
133
|
+
}
|
|
134
|
+
appConfiguration.getWidgets = getWidgets;
|
|
91
135
|
})(appConfiguration || (appConfiguration = {}));
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse } from "../types/collection";
|
|
2
|
-
import { CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest";
|
|
3
2
|
export declare namespace collection {
|
|
4
3
|
/**
|
|
5
4
|
* Retrieves a single Collection by its ID.
|
|
@@ -36,43 +35,6 @@ export declare namespace collection {
|
|
|
36
35
|
* @throws ErrorResponse if the request fails
|
|
37
36
|
*/
|
|
38
37
|
function getAppsConfig(collectionId: string): Promise<AppsConfigResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* Fetches ALL widget data (manifests + bundle files) for a collection in one call.
|
|
41
|
-
* Returns everything needed to render widgets with zero additional requests.
|
|
42
|
-
*
|
|
43
|
-
* This solves N+1 query problems by fetching manifests, JavaScript bundles,
|
|
44
|
-
* and CSS files in parallel on the server.
|
|
45
|
-
*
|
|
46
|
-
* @param collectionId - The collection ID
|
|
47
|
-
* @param options - Optional settings (force: bypass cache)
|
|
48
|
-
* @returns Promise resolving to collection widgets with manifests and bundle files
|
|
49
|
-
* @throws ErrorResponse if the request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* // Fetch all widget data for a collection
|
|
54
|
-
* const { apps } = await Api.Collection.getWidgets(collectionId);
|
|
55
|
-
* // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
|
|
56
|
-
*
|
|
57
|
-
* // Convert bundle source to dynamic imports
|
|
58
|
-
* for (const app of apps) {
|
|
59
|
-
* const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
|
|
60
|
-
* const blobUrl = URL.createObjectURL(blob);
|
|
61
|
-
* const widgetModule = await import(blobUrl);
|
|
62
|
-
*
|
|
63
|
-
* // Inject CSS if present
|
|
64
|
-
* if (app.bundleCss) {
|
|
65
|
-
* const styleTag = document.createElement('style');
|
|
66
|
-
* styleTag.textContent = app.bundleCss;
|
|
67
|
-
* document.head.appendChild(styleTag);
|
|
68
|
-
* }
|
|
69
|
-
* }
|
|
70
|
-
*
|
|
71
|
-
* // Force refresh all widgets
|
|
72
|
-
* const { apps } = await Api.Collection.getWidgets(collectionId, { force: true });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
function getWidgets(collectionId: string, options?: GetCollectionWidgetsOptions): Promise<CollectionWidgetsResponse>;
|
|
76
38
|
/**
|
|
77
39
|
* Update a specific settings group for a collection (admin endpoint).
|
|
78
40
|
* @param collectionId – Identifier of the collection
|
package/dist/api/collection.js
CHANGED
|
@@ -56,54 +56,10 @@ export var collection;
|
|
|
56
56
|
* @throws ErrorResponse if the request fails
|
|
57
57
|
*/
|
|
58
58
|
async function getAppsConfig(collectionId) {
|
|
59
|
-
const path = `/
|
|
59
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/app/config`;
|
|
60
60
|
return request(path);
|
|
61
61
|
}
|
|
62
62
|
collection.getAppsConfig = getAppsConfig;
|
|
63
|
-
/**
|
|
64
|
-
* Fetches ALL widget data (manifests + bundle files) for a collection in one call.
|
|
65
|
-
* Returns everything needed to render widgets with zero additional requests.
|
|
66
|
-
*
|
|
67
|
-
* This solves N+1 query problems by fetching manifests, JavaScript bundles,
|
|
68
|
-
* and CSS files in parallel on the server.
|
|
69
|
-
*
|
|
70
|
-
* @param collectionId - The collection ID
|
|
71
|
-
* @param options - Optional settings (force: bypass cache)
|
|
72
|
-
* @returns Promise resolving to collection widgets with manifests and bundle files
|
|
73
|
-
* @throws ErrorResponse if the request fails
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* // Fetch all widget data for a collection
|
|
78
|
-
* const { apps } = await Api.Collection.getWidgets(collectionId);
|
|
79
|
-
* // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
|
|
80
|
-
*
|
|
81
|
-
* // Convert bundle source to dynamic imports
|
|
82
|
-
* for (const app of apps) {
|
|
83
|
-
* const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
|
|
84
|
-
* const blobUrl = URL.createObjectURL(blob);
|
|
85
|
-
* const widgetModule = await import(blobUrl);
|
|
86
|
-
*
|
|
87
|
-
* // Inject CSS if present
|
|
88
|
-
* if (app.bundleCss) {
|
|
89
|
-
* const styleTag = document.createElement('style');
|
|
90
|
-
* styleTag.textContent = app.bundleCss;
|
|
91
|
-
* document.head.appendChild(styleTag);
|
|
92
|
-
* }
|
|
93
|
-
* }
|
|
94
|
-
*
|
|
95
|
-
* // Force refresh all widgets
|
|
96
|
-
* const { apps } = await Api.Collection.getWidgets(collectionId, { force: true });
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
async function getWidgets(collectionId, options) {
|
|
100
|
-
let path = `/v1/public/collection/${encodeURIComponent(collectionId)}/app/widgets`;
|
|
101
|
-
if (options === null || options === void 0 ? void 0 : options.force) {
|
|
102
|
-
path += '?force=true';
|
|
103
|
-
}
|
|
104
|
-
return request(path);
|
|
105
|
-
}
|
|
106
|
-
collection.getWidgets = getWidgets;
|
|
107
63
|
/**
|
|
108
64
|
* Update a specific settings group for a collection (admin endpoint).
|
|
109
65
|
* @param collectionId – Identifier of the collection
|
package/dist/api/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { collection } from "./collection";
|
|
|
2
2
|
export { product } from "./product";
|
|
3
3
|
export { proof } from "./proof";
|
|
4
4
|
export { appConfiguration } from "./appConfiguration";
|
|
5
|
-
export { appRecord } from "./appRecord";
|
|
6
5
|
export { asset } from "./asset";
|
|
7
6
|
export { attestation } from "./attestation";
|
|
8
7
|
export { auth } from "./auth";
|
package/dist/api/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export { collection } from "./collection";
|
|
|
4
4
|
export { product } from "./product";
|
|
5
5
|
export { proof } from "./proof";
|
|
6
6
|
export { appConfiguration } from "./appConfiguration";
|
|
7
|
-
export { appRecord } from "./appRecord";
|
|
8
7
|
export { asset } from "./asset";
|
|
9
8
|
export { attestation } from "./attestation";
|
|
10
9
|
export { auth } from "./auth";
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.33 | Generated: 2026-02-15T09:39:22.347Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -29,7 +29,6 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
29
29
|
- **batch** - Group products into batches; manage serial number ranges and lookups.
|
|
30
30
|
- **crate** - Organize products in containers/crates for logistics and grouping.
|
|
31
31
|
- **form** - Build and manage dynamic forms used by apps and workflows.
|
|
32
|
-
- **appRecord** - Store and retrieve application-level records tied to a collection.
|
|
33
32
|
- **appConfiguration** - Read/write app configuration and scoped data (collection/product/proof).
|
|
34
33
|
|
|
35
34
|
— Identity & Access —
|
|
@@ -3932,15 +3931,9 @@ Post a chat message to the AI (admin or public)
|
|
|
3932
3931
|
|
|
3933
3932
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3934
3933
|
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
**create**(collectionId: string, appId: string, data: any) → `Promise<any>`
|
|
3940
|
-
|
|
3941
|
-
**update**(collectionId: string, appId: string, data: any) → `Promise<any>`
|
|
3942
|
-
|
|
3943
|
-
**remove**(collectionId: string, appId: string) → `Promise<void>`
|
|
3934
|
+
**getWidgets**(collectionId: string,
|
|
3935
|
+
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
3936
|
+
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getWidgets(collectionId); // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...] // Convert bundle source to dynamic imports for (const app of apps) { const blob = new Blob([app.bundleSource], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const widgetModule = await import(blobUrl); // Inject CSS if present if (app.bundleCss) { const styleTag = document.createElement('style'); styleTag.textContent = app.bundleCss; document.head.appendChild(styleTag); } } // Force refresh all widgets const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true }); ```
|
|
3944
3937
|
|
|
3945
3938
|
### asset
|
|
3946
3939
|
|
|
@@ -4302,10 +4295,6 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4302
4295
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4303
4296
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4304
4297
|
|
|
4305
|
-
**getWidgets**(collectionId: string,
|
|
4306
|
-
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
4307
|
-
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.Collection.getWidgets(collectionId); // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...] // Convert bundle source to dynamic imports for (const app of apps) { const blob = new Blob([app.bundleSource], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const widgetModule = await import(blobUrl); // Inject CSS if present if (app.bundleCss) { const styleTag = document.createElement('style'); styleTag.textContent = app.bundleCss; document.head.appendChild(styleTag); } } // Force refresh all widgets const { apps } = await Api.Collection.getWidgets(collectionId, { force: true }); ```
|
|
4308
|
-
|
|
4309
4298
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4310
4299
|
Update a specific settings group for a collection (admin endpoint).
|
|
4311
4300
|
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.33 | Generated: 2026-02-15T09:39:22.347Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -29,7 +29,6 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
29
29
|
- **batch** - Group products into batches; manage serial number ranges and lookups.
|
|
30
30
|
- **crate** - Organize products in containers/crates for logistics and grouping.
|
|
31
31
|
- **form** - Build and manage dynamic forms used by apps and workflows.
|
|
32
|
-
- **appRecord** - Store and retrieve application-level records tied to a collection.
|
|
33
32
|
- **appConfiguration** - Read/write app configuration and scoped data (collection/product/proof).
|
|
34
33
|
|
|
35
34
|
— Identity & Access —
|
|
@@ -3932,15 +3931,9 @@ Post a chat message to the AI (admin or public)
|
|
|
3932
3931
|
|
|
3933
3932
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3934
3933
|
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
**create**(collectionId: string, appId: string, data: any) → `Promise<any>`
|
|
3940
|
-
|
|
3941
|
-
**update**(collectionId: string, appId: string, data: any) → `Promise<any>`
|
|
3942
|
-
|
|
3943
|
-
**remove**(collectionId: string, appId: string) → `Promise<void>`
|
|
3934
|
+
**getWidgets**(collectionId: string,
|
|
3935
|
+
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
3936
|
+
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getWidgets(collectionId); // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...] // Convert bundle source to dynamic imports for (const app of apps) { const blob = new Blob([app.bundleSource], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const widgetModule = await import(blobUrl); // Inject CSS if present if (app.bundleCss) { const styleTag = document.createElement('style'); styleTag.textContent = app.bundleCss; document.head.appendChild(styleTag); } } // Force refresh all widgets const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true }); ```
|
|
3944
3937
|
|
|
3945
3938
|
### asset
|
|
3946
3939
|
|
|
@@ -4302,10 +4295,6 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4302
4295
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4303
4296
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4304
4297
|
|
|
4305
|
-
**getWidgets**(collectionId: string,
|
|
4306
|
-
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
4307
|
-
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.Collection.getWidgets(collectionId); // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...] // Convert bundle source to dynamic imports for (const app of apps) { const blob = new Blob([app.bundleSource], { type: 'application/javascript' }); const blobUrl = URL.createObjectURL(blob); const widgetModule = await import(blobUrl); // Inject CSS if present if (app.bundleCss) { const styleTag = document.createElement('style'); styleTag.textContent = app.bundleCss; document.head.appendChild(styleTag); } } // Force refresh all widgets const { apps } = await Api.Collection.getWidgets(collectionId, { force: true }); ```
|
|
4308
|
-
|
|
4309
4298
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4310
4299
|
Update a specific settings group for a collection (admin endpoint).
|
|
4311
4300
|
|