@proveanything/smartlinks 1.3.28 → 1.3.30

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 { AppManifest, CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest";
1
2
  export type AppConfigOptions = {
2
3
  appId: string;
3
4
  collectionId?: string;
@@ -19,4 +20,72 @@ 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 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
+ /**
50
+ * Fetches ALL widget data (manifests + bundle files) for a collection in one call.
51
+ * Returns everything needed to render widgets with zero additional requests.
52
+ *
53
+ * This is the recommended approach as it solves N+1 query problems and fetches
54
+ * manifests, JavaScript bundles, and CSS files in parallel on the server.
55
+ *
56
+ * @param collectionId - The collection ID
57
+ * @param options - Optional settings (force: bypass cache)
58
+ * @returns Promise resolving to collection widgets with manifests and bundle files
59
+ * @throws ErrorResponse if the request fails
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * // Fetch all widget data for a collection
64
+ * const { apps } = await Api.AppConfiguration.getCollectionWidgets(collectionId);
65
+ * // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
66
+ *
67
+ * // Convert bundle source to dynamic imports
68
+ * for (const app of apps) {
69
+ * const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
70
+ * const blobUrl = URL.createObjectURL(blob);
71
+ * const widgetModule = await import(blobUrl);
72
+ *
73
+ * // Inject CSS if present
74
+ * if (app.bundleCss) {
75
+ * const styleTag = document.createElement('style');
76
+ * styleTag.textContent = app.bundleCss;
77
+ * document.head.appendChild(styleTag);
78
+ * }
79
+ *
80
+ * // Now use widgetModule components
81
+ * }
82
+ *
83
+ * // Force refresh all widgets
84
+ * const { apps: freshApps } = await Api.AppConfiguration.getCollectionWidgets(
85
+ * collectionId,
86
+ * { force: true }
87
+ * );
88
+ * ```
89
+ */
90
+ function getCollectionWidgets(collectionId: string, options?: GetCollectionWidgetsOptions): Promise<CollectionWidgetsResponse>;
22
91
  }
@@ -88,4 +88,86 @@ 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
+ /**
125
+ * Fetches ALL widget data (manifests + bundle files) for a collection in one call.
126
+ * Returns everything needed to render widgets with zero additional requests.
127
+ *
128
+ * This is the recommended approach as it solves N+1 query problems and fetches
129
+ * manifests, JavaScript bundles, and CSS files in parallel on the server.
130
+ *
131
+ * @param collectionId - The collection ID
132
+ * @param options - Optional settings (force: bypass cache)
133
+ * @returns Promise resolving to collection widgets with manifests and bundle files
134
+ * @throws ErrorResponse if the request fails
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * // Fetch all widget data for a collection
139
+ * const { apps } = await Api.AppConfiguration.getCollectionWidgets(collectionId);
140
+ * // Returns: [{ appId, manifestUrl, manifest, bundleSource, bundleCss }, ...]
141
+ *
142
+ * // Convert bundle source to dynamic imports
143
+ * for (const app of apps) {
144
+ * const blob = new Blob([app.bundleSource], { type: 'application/javascript' });
145
+ * const blobUrl = URL.createObjectURL(blob);
146
+ * const widgetModule = await import(blobUrl);
147
+ *
148
+ * // Inject CSS if present
149
+ * if (app.bundleCss) {
150
+ * const styleTag = document.createElement('style');
151
+ * styleTag.textContent = app.bundleCss;
152
+ * document.head.appendChild(styleTag);
153
+ * }
154
+ *
155
+ * // Now use widgetModule components
156
+ * }
157
+ *
158
+ * // Force refresh all widgets
159
+ * const { apps: freshApps } = await Api.AppConfiguration.getCollectionWidgets(
160
+ * collectionId,
161
+ * { force: true }
162
+ * );
163
+ * ```
164
+ */
165
+ async function getCollectionWidgets(collectionId, options) {
166
+ let path = `/v1/public/collection/${encodeURIComponent(collectionId)}/widgets`;
167
+ if (options === null || options === void 0 ? void 0 : options.force) {
168
+ path += '?force=true';
169
+ }
170
+ return request(path);
171
+ }
172
+ appConfiguration.getCollectionWidgets = getCollectionWidgets;
91
173
  })(appConfiguration || (appConfiguration = {}));
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.28 | Generated: 2026-02-14T12:11:55.083Z
3
+ Version: 1.3.30 | Generated: 2026-02-14T14:44:14.267Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -791,6 +791,113 @@ interface AppConfigurationResponse {
791
791
  }
792
792
  ```
793
793
 
794
+ ### appManifest
795
+
796
+ **AppManifest** (interface)
797
+ ```typescript
798
+ interface AppManifest {
799
+ $schema?: string;
800
+ meta?: {
801
+ name: string;
802
+ description?: string;
803
+ version: string;
804
+ platformRevision?: string;
805
+ appId: string;
806
+ };
807
+ widgets?: Array<{
808
+ name: string;
809
+ description?: string;
810
+ sizes?: string[];
811
+ props?: {
812
+ required?: string[];
813
+ optional?: string[];
814
+ };
815
+ }>;
816
+ setup?: {
817
+ description?: string;
818
+ questions?: Array<{
819
+ id: string;
820
+ prompt: string;
821
+ type: string;
822
+ default?: any;
823
+ required?: boolean;
824
+ }>;
825
+ configSchema?: Record<string, any>;
826
+ saveWith?: {
827
+ method: string;
828
+ scope: string;
829
+ admin?: boolean;
830
+ };
831
+ contentHints?: Record<string, {
832
+ aiGenerate?: boolean;
833
+ prompt?: string;
834
+ }>;
835
+ };
836
+ import?: {
837
+ description?: string;
838
+ scope?: string;
839
+ fields?: Array<{
840
+ name: string;
841
+ type: string;
842
+ required?: boolean;
843
+ default?: any;
844
+ description?: string;
845
+ }>;
846
+ csvExample?: string;
847
+ saveWith?: {
848
+ method: string;
849
+ scope: string;
850
+ admin?: boolean;
851
+ note?: string;
852
+ };
853
+ };
854
+ tunable?: {
855
+ description?: string;
856
+ fields?: Array<{
857
+ name: string;
858
+ description?: string;
859
+ type: string;
860
+ }>;
861
+ };
862
+ metrics?: {
863
+ interactions?: Array<{
864
+ id: string;
865
+ description?: string;
866
+ }>;
867
+ kpis?: Array<{
868
+ name: string;
869
+ compute?: string;
870
+ }>;
871
+ };
872
+ [key: string]: any; // Allow additional custom fields
873
+ }
874
+ ```
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
+
794
901
  ### asset
795
902
 
796
903
  **Asset** (interface)
@@ -1394,6 +1501,7 @@ interface AppConfig {
1394
1501
  ownersOnly?: boolean
1395
1502
  hidden?: boolean
1396
1503
  publicIframeUrl?: string
1504
+ manifestUrl?: string
1397
1505
  supportsDeepLinks?: boolean;
1398
1506
  usage: {
1399
1507
  collection: boolean; // use at the collecton level
@@ -3824,6 +3932,13 @@ Post a chat message to the AI (admin or public)
3824
3932
 
3825
3933
  **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
3826
3934
 
3935
+ **getManifest**(manifestUrl: string, force?: boolean) → `Promise<AppManifest>`
3936
+ 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); ```
3937
+
3938
+ **getCollectionWidgets**(collectionId: string,
3939
+ options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
3940
+ Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This is the recommended approach as it solves N+1 query problems and fetches manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getCollectionWidgets(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); } // Now use widgetModule components } // Force refresh all widgets const { apps: freshApps } = await Api.AppConfiguration.getCollectionWidgets( collectionId, { force: true } ); ```
3941
+
3827
3942
  ### appRecord
3828
3943
 
3829
3944
  **get**(collectionId: string, appId: string) → `Promise<any>`
@@ -0,0 +1,102 @@
1
+ /**
2
+ * SmartLinks App Manifest structure
3
+ * Defines the configuration, widgets, setup, import, and metrics for a microapp
4
+ */
5
+ export interface AppManifest {
6
+ $schema?: string;
7
+ meta?: {
8
+ name: string;
9
+ description?: string;
10
+ version: string;
11
+ platformRevision?: string;
12
+ appId: string;
13
+ };
14
+ widgets?: Array<{
15
+ name: string;
16
+ description?: string;
17
+ sizes?: string[];
18
+ props?: {
19
+ required?: string[];
20
+ optional?: string[];
21
+ };
22
+ }>;
23
+ setup?: {
24
+ description?: string;
25
+ questions?: Array<{
26
+ id: string;
27
+ prompt: string;
28
+ type: string;
29
+ default?: any;
30
+ required?: boolean;
31
+ }>;
32
+ configSchema?: Record<string, any>;
33
+ saveWith?: {
34
+ method: string;
35
+ scope: string;
36
+ admin?: boolean;
37
+ };
38
+ contentHints?: Record<string, {
39
+ aiGenerate?: boolean;
40
+ prompt?: string;
41
+ }>;
42
+ };
43
+ import?: {
44
+ description?: string;
45
+ scope?: string;
46
+ fields?: Array<{
47
+ name: string;
48
+ type: string;
49
+ required?: boolean;
50
+ default?: any;
51
+ description?: string;
52
+ }>;
53
+ csvExample?: string;
54
+ saveWith?: {
55
+ method: string;
56
+ scope: string;
57
+ admin?: boolean;
58
+ note?: string;
59
+ };
60
+ };
61
+ tunable?: {
62
+ description?: string;
63
+ fields?: Array<{
64
+ name: string;
65
+ description?: string;
66
+ type: string;
67
+ }>;
68
+ };
69
+ metrics?: {
70
+ interactions?: Array<{
71
+ id: string;
72
+ description?: string;
73
+ }>;
74
+ kpis?: Array<{
75
+ name: string;
76
+ compute?: string;
77
+ }>;
78
+ };
79
+ [key: string]: any;
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
+ }
@@ -0,0 +1,2 @@
1
+ // src/types/appManifest.ts
2
+ export {};
@@ -91,6 +91,8 @@ export interface AppConfig {
91
91
  hidden?: boolean;
92
92
  /** Universal iframe URL for external embedding */
93
93
  publicIframeUrl?: string;
94
+ /** Where to get the app manifest for AI and widget definitions */
95
+ manifestUrl?: string;
94
96
  /** supports multiple pages / deep links into the app */
95
97
  supportsDeepLinks?: boolean;
96
98
  /** App component configuration */
@@ -27,3 +27,4 @@ export * from "./order";
27
27
  export * from "./crate";
28
28
  export * from "./iframeResponder";
29
29
  export * from "./ai";
30
+ export * from "./appManifest";
@@ -29,3 +29,4 @@ export * from "./order";
29
29
  export * from "./crate";
30
30
  export * from "./iframeResponder";
31
31
  export * from "./ai";
32
+ export * from "./appManifest";
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.28 | Generated: 2026-02-14T12:11:55.083Z
3
+ Version: 1.3.30 | Generated: 2026-02-14T14:44:14.267Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -791,6 +791,113 @@ interface AppConfigurationResponse {
791
791
  }
792
792
  ```
793
793
 
794
+ ### appManifest
795
+
796
+ **AppManifest** (interface)
797
+ ```typescript
798
+ interface AppManifest {
799
+ $schema?: string;
800
+ meta?: {
801
+ name: string;
802
+ description?: string;
803
+ version: string;
804
+ platformRevision?: string;
805
+ appId: string;
806
+ };
807
+ widgets?: Array<{
808
+ name: string;
809
+ description?: string;
810
+ sizes?: string[];
811
+ props?: {
812
+ required?: string[];
813
+ optional?: string[];
814
+ };
815
+ }>;
816
+ setup?: {
817
+ description?: string;
818
+ questions?: Array<{
819
+ id: string;
820
+ prompt: string;
821
+ type: string;
822
+ default?: any;
823
+ required?: boolean;
824
+ }>;
825
+ configSchema?: Record<string, any>;
826
+ saveWith?: {
827
+ method: string;
828
+ scope: string;
829
+ admin?: boolean;
830
+ };
831
+ contentHints?: Record<string, {
832
+ aiGenerate?: boolean;
833
+ prompt?: string;
834
+ }>;
835
+ };
836
+ import?: {
837
+ description?: string;
838
+ scope?: string;
839
+ fields?: Array<{
840
+ name: string;
841
+ type: string;
842
+ required?: boolean;
843
+ default?: any;
844
+ description?: string;
845
+ }>;
846
+ csvExample?: string;
847
+ saveWith?: {
848
+ method: string;
849
+ scope: string;
850
+ admin?: boolean;
851
+ note?: string;
852
+ };
853
+ };
854
+ tunable?: {
855
+ description?: string;
856
+ fields?: Array<{
857
+ name: string;
858
+ description?: string;
859
+ type: string;
860
+ }>;
861
+ };
862
+ metrics?: {
863
+ interactions?: Array<{
864
+ id: string;
865
+ description?: string;
866
+ }>;
867
+ kpis?: Array<{
868
+ name: string;
869
+ compute?: string;
870
+ }>;
871
+ };
872
+ [key: string]: any; // Allow additional custom fields
873
+ }
874
+ ```
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
+
794
901
  ### asset
795
902
 
796
903
  **Asset** (interface)
@@ -1394,6 +1501,7 @@ interface AppConfig {
1394
1501
  ownersOnly?: boolean
1395
1502
  hidden?: boolean
1396
1503
  publicIframeUrl?: string
1504
+ manifestUrl?: string
1397
1505
  supportsDeepLinks?: boolean;
1398
1506
  usage: {
1399
1507
  collection: boolean; // use at the collecton level
@@ -3824,6 +3932,13 @@ Post a chat message to the AI (admin or public)
3824
3932
 
3825
3933
  **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
3826
3934
 
3935
+ **getManifest**(manifestUrl: string, force?: boolean) → `Promise<AppManifest>`
3936
+ 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); ```
3937
+
3938
+ **getCollectionWidgets**(collectionId: string,
3939
+ options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
3940
+ Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This is the recommended approach as it solves N+1 query problems and fetches manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getCollectionWidgets(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); } // Now use widgetModule components } // Force refresh all widgets const { apps: freshApps } = await Api.AppConfiguration.getCollectionWidgets( collectionId, { force: true } ); ```
3941
+
3827
3942
  ### appRecord
3828
3943
 
3829
3944
  **get**(collectionId: string, appId: string) → `Promise<any>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.3.28",
3
+ "version": "1.3.30",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",