@proveanything/smartlinks 1.3.29 → 1.3.31
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 +0 -27
- package/dist/api/appConfiguration.js +0 -33
- package/dist/api/collection.d.ts +38 -0
- package/dist/api/collection.js +45 -1
- package/dist/docs/API_SUMMARY.md +30 -4
- package/dist/types/appManifest.d.ts +22 -0
- package/docs/API_SUMMARY.md +30 -4
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AppManifest } from "../types/appManifest";
|
|
2
1
|
export type AppConfigOptions = {
|
|
3
2
|
appId: string;
|
|
4
3
|
collectionId?: string;
|
|
@@ -20,30 +19,4 @@ export declare namespace appConfiguration {
|
|
|
20
19
|
function getDataItem(opts: AppConfigOptions): Promise<any>;
|
|
21
20
|
function setDataItem(opts: AppConfigOptions): Promise<any>;
|
|
22
21
|
function deleteDataItem(opts: AppConfigOptions): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Fetches an app's manifest file through the proxy API.
|
|
25
|
-
* The manifest is cached on the server for 5 minutes.
|
|
26
|
-
*
|
|
27
|
-
* @param manifestUrl - The full URL to the manifest file (e.g., 'https://smartlinks.app/apps/my-app/v1.0.0/app.manifest.json')
|
|
28
|
-
* @param force - If true, bypasses cache and fetches fresh manifest
|
|
29
|
-
* @returns Promise resolving to the manifest object, or empty object if not found
|
|
30
|
-
* @throws ErrorResponse if the request fails
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* // Use with appsConfig
|
|
35
|
-
* const appsConfig = await Api.Collection.Public.getAppsConfig(collectionId);
|
|
36
|
-
* const app = appsConfig.apps[0];
|
|
37
|
-
* if (app.manifestUrl) {
|
|
38
|
-
* const manifest = await Api.AppConfiguration.getManifest(app.manifestUrl);
|
|
39
|
-
* if (manifest.widgets) {
|
|
40
|
-
* console.log('Available widgets:', manifest.widgets);
|
|
41
|
-
* }
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* // Force refresh
|
|
45
|
-
* const freshManifest = await Api.AppConfiguration.getManifest(app.manifestUrl, true);
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
function getManifest(manifestUrl: string, force?: boolean): Promise<AppManifest>;
|
|
49
22
|
}
|
|
@@ -88,37 +88,4 @@ export var appConfiguration;
|
|
|
88
88
|
return del(path);
|
|
89
89
|
}
|
|
90
90
|
appConfiguration.deleteDataItem = deleteDataItem;
|
|
91
|
-
/**
|
|
92
|
-
* Fetches an app's manifest file through the proxy API.
|
|
93
|
-
* The manifest is cached on the server for 5 minutes.
|
|
94
|
-
*
|
|
95
|
-
* @param manifestUrl - The full URL to the manifest file (e.g., 'https://smartlinks.app/apps/my-app/v1.0.0/app.manifest.json')
|
|
96
|
-
* @param force - If true, bypasses cache and fetches fresh manifest
|
|
97
|
-
* @returns Promise resolving to the manifest object, or empty object if not found
|
|
98
|
-
* @throws ErrorResponse if the request fails
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```typescript
|
|
102
|
-
* // Use with appsConfig
|
|
103
|
-
* const appsConfig = await Api.Collection.Public.getAppsConfig(collectionId);
|
|
104
|
-
* const app = appsConfig.apps[0];
|
|
105
|
-
* if (app.manifestUrl) {
|
|
106
|
-
* const manifest = await Api.AppConfiguration.getManifest(app.manifestUrl);
|
|
107
|
-
* if (manifest.widgets) {
|
|
108
|
-
* console.log('Available widgets:', manifest.widgets);
|
|
109
|
-
* }
|
|
110
|
-
* }
|
|
111
|
-
*
|
|
112
|
-
* // Force refresh
|
|
113
|
-
* const freshManifest = await Api.AppConfiguration.getManifest(app.manifestUrl, true);
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
async function getManifest(manifestUrl, force) {
|
|
117
|
-
let path = `/public/app/manifest?url=${encodeURIComponent(manifestUrl)}`;
|
|
118
|
-
if (force) {
|
|
119
|
-
path += '&force=true';
|
|
120
|
-
}
|
|
121
|
-
return request(path);
|
|
122
|
-
}
|
|
123
|
-
appConfiguration.getManifest = getManifest;
|
|
124
91
|
})(appConfiguration || (appConfiguration = {}));
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse } from "../types/collection";
|
|
2
|
+
import { CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest";
|
|
2
3
|
export declare namespace collection {
|
|
3
4
|
/**
|
|
4
5
|
* Retrieves a single Collection by its ID.
|
|
@@ -35,6 +36,43 @@ export declare namespace collection {
|
|
|
35
36
|
* @throws ErrorResponse if the request fails
|
|
36
37
|
*/
|
|
37
38
|
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>;
|
|
38
76
|
/**
|
|
39
77
|
* Update a specific settings group for a collection (admin endpoint).
|
|
40
78
|
* @param collectionId – Identifier of the collection
|
package/dist/api/collection.js
CHANGED
|
@@ -56,10 +56,54 @@ export var collection;
|
|
|
56
56
|
* @throws ErrorResponse if the request fails
|
|
57
57
|
*/
|
|
58
58
|
async function getAppsConfig(collectionId) {
|
|
59
|
-
const path = `/public/collection/${encodeURIComponent(collectionId)}/
|
|
59
|
+
const path = `/v1/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;
|
|
63
107
|
/**
|
|
64
108
|
* Update a specific settings group for a collection (admin endpoint).
|
|
65
109
|
* @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.31 | Generated: 2026-02-15T09:18:19.351Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -873,6 +873,31 @@ interface AppManifest {
|
|
|
873
873
|
}
|
|
874
874
|
```
|
|
875
875
|
|
|
876
|
+
**CollectionWidget** (interface)
|
|
877
|
+
```typescript
|
|
878
|
+
interface CollectionWidget {
|
|
879
|
+
appId: string;
|
|
880
|
+
manifestUrl: string;
|
|
881
|
+
manifest: AppManifest;
|
|
882
|
+
bundleSource: string;
|
|
883
|
+
bundleCss?: string; // Optional CSS file
|
|
884
|
+
}
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
**CollectionWidgetsResponse** (interface)
|
|
888
|
+
```typescript
|
|
889
|
+
interface CollectionWidgetsResponse {
|
|
890
|
+
apps: CollectionWidget[];
|
|
891
|
+
}
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
**GetCollectionWidgetsOptions** (interface)
|
|
895
|
+
```typescript
|
|
896
|
+
interface GetCollectionWidgetsOptions {
|
|
897
|
+
force?: boolean; // Bypass cache and fetch fresh data
|
|
898
|
+
}
|
|
899
|
+
```
|
|
900
|
+
|
|
876
901
|
### asset
|
|
877
902
|
|
|
878
903
|
**Asset** (interface)
|
|
@@ -3907,9 +3932,6 @@ Post a chat message to the AI (admin or public)
|
|
|
3907
3932
|
|
|
3908
3933
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3909
3934
|
|
|
3910
|
-
**getManifest**(manifestUrl: string, force?: boolean) → `Promise<AppManifest>`
|
|
3911
|
-
Fetches an app's manifest file through the proxy API. The manifest is cached on the server for 5 minutes. ```typescript // Use with appsConfig const appsConfig = await Api.Collection.Public.getAppsConfig(collectionId); const app = appsConfig.apps[0]; if (app.manifestUrl) { const manifest = await Api.AppConfiguration.getManifest(app.manifestUrl); if (manifest.widgets) { console.log('Available widgets:', manifest.widgets); } } // Force refresh const freshManifest = await Api.AppConfiguration.getManifest(app.manifestUrl, true); ```
|
|
3912
|
-
|
|
3913
3935
|
### appRecord
|
|
3914
3936
|
|
|
3915
3937
|
**get**(collectionId: string, appId: string) → `Promise<any>`
|
|
@@ -4280,6 +4302,10 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4280
4302
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4281
4303
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4282
4304
|
|
|
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
|
+
|
|
4283
4309
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4284
4310
|
Update a specific settings group for a collection (admin endpoint).
|
|
4285
4311
|
|
|
@@ -78,3 +78,25 @@ export interface AppManifest {
|
|
|
78
78
|
};
|
|
79
79
|
[key: string]: any;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Single app widget data with manifest and bundle files
|
|
83
|
+
*/
|
|
84
|
+
export interface CollectionWidget {
|
|
85
|
+
appId: string;
|
|
86
|
+
manifestUrl: string;
|
|
87
|
+
manifest: AppManifest;
|
|
88
|
+
bundleSource: string;
|
|
89
|
+
bundleCss?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Response from collection widgets endpoint
|
|
93
|
+
*/
|
|
94
|
+
export interface CollectionWidgetsResponse {
|
|
95
|
+
apps: CollectionWidget[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Options for fetching collection widgets
|
|
99
|
+
*/
|
|
100
|
+
export interface GetCollectionWidgetsOptions {
|
|
101
|
+
force?: boolean;
|
|
102
|
+
}
|
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.31 | Generated: 2026-02-15T09:18:19.351Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -873,6 +873,31 @@ interface AppManifest {
|
|
|
873
873
|
}
|
|
874
874
|
```
|
|
875
875
|
|
|
876
|
+
**CollectionWidget** (interface)
|
|
877
|
+
```typescript
|
|
878
|
+
interface CollectionWidget {
|
|
879
|
+
appId: string;
|
|
880
|
+
manifestUrl: string;
|
|
881
|
+
manifest: AppManifest;
|
|
882
|
+
bundleSource: string;
|
|
883
|
+
bundleCss?: string; // Optional CSS file
|
|
884
|
+
}
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
**CollectionWidgetsResponse** (interface)
|
|
888
|
+
```typescript
|
|
889
|
+
interface CollectionWidgetsResponse {
|
|
890
|
+
apps: CollectionWidget[];
|
|
891
|
+
}
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
**GetCollectionWidgetsOptions** (interface)
|
|
895
|
+
```typescript
|
|
896
|
+
interface GetCollectionWidgetsOptions {
|
|
897
|
+
force?: boolean; // Bypass cache and fetch fresh data
|
|
898
|
+
}
|
|
899
|
+
```
|
|
900
|
+
|
|
876
901
|
### asset
|
|
877
902
|
|
|
878
903
|
**Asset** (interface)
|
|
@@ -3907,9 +3932,6 @@ Post a chat message to the AI (admin or public)
|
|
|
3907
3932
|
|
|
3908
3933
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
3909
3934
|
|
|
3910
|
-
**getManifest**(manifestUrl: string, force?: boolean) → `Promise<AppManifest>`
|
|
3911
|
-
Fetches an app's manifest file through the proxy API. The manifest is cached on the server for 5 minutes. ```typescript // Use with appsConfig const appsConfig = await Api.Collection.Public.getAppsConfig(collectionId); const app = appsConfig.apps[0]; if (app.manifestUrl) { const manifest = await Api.AppConfiguration.getManifest(app.manifestUrl); if (manifest.widgets) { console.log('Available widgets:', manifest.widgets); } } // Force refresh const freshManifest = await Api.AppConfiguration.getManifest(app.manifestUrl, true); ```
|
|
3912
|
-
|
|
3913
3935
|
### appRecord
|
|
3914
3936
|
|
|
3915
3937
|
**get**(collectionId: string, appId: string) → `Promise<any>`
|
|
@@ -4280,6 +4302,10 @@ Retrieve a specific settings group for a collection (public endpoint).
|
|
|
4280
4302
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
4281
4303
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
4282
4304
|
|
|
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
|
+
|
|
4283
4309
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
4284
4310
|
Update a specific settings group for a collection (admin endpoint).
|
|
4285
4311
|
|