@proveanything/smartlinks 1.3.32 → 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.
|
@@ -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
|
@@ -60,50 +60,6 @@ export var collection;
|
|
|
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 = `/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/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
|
|
|
@@ -3931,6 +3931,10 @@ Post a chat message to the AI (admin or public)
|
|
|
3931
3931
|
|
|
3932
3932
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3933
3933
|
|
|
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 }); ```
|
|
3937
|
+
|
|
3934
3938
|
### asset
|
|
3935
3939
|
|
|
3936
3940
|
**upload**(options: UploadAssetOptions) → `Promise<Asset>`
|
|
@@ -4291,10 +4295,6 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4291
4295
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4292
4296
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4293
4297
|
|
|
4294
|
-
**getWidgets**(collectionId: string,
|
|
4295
|
-
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
4296
|
-
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 }); ```
|
|
4297
|
-
|
|
4298
4298
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4299
4299
|
Update a specific settings group for a collection (admin endpoint).
|
|
4300
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
|
|
|
@@ -3931,6 +3931,10 @@ Post a chat message to the AI (admin or public)
|
|
|
3931
3931
|
|
|
3932
3932
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3933
3933
|
|
|
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 }); ```
|
|
3937
|
+
|
|
3934
3938
|
### asset
|
|
3935
3939
|
|
|
3936
3940
|
**upload**(options: UploadAssetOptions) → `Promise<Asset>`
|
|
@@ -4291,10 +4295,6 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4291
4295
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4292
4296
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4293
4297
|
|
|
4294
|
-
**getWidgets**(collectionId: string,
|
|
4295
|
-
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
4296
|
-
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 }); ```
|
|
4297
|
-
|
|
4298
4298
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4299
4299
|
Update a specific settings group for a collection (admin endpoint).
|
|
4300
4300
|
|