@proveanything/smartlinks 1.3.30 → 1.3.32

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,3 @@
1
- import { AppManifest, CollectionWidgetsResponse, GetCollectionWidgetsOptions } from "../types/appManifest";
2
1
  export type AppConfigOptions = {
3
2
  appId: string;
4
3
  collectionId?: string;
@@ -20,72 +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
- /**
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>;
91
22
  }
@@ -88,86 +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
- /**
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;
173
91
  })(appConfiguration || (appConfiguration = {}));
@@ -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
@@ -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)}/apps-config`;
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 = `/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
@@ -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";
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.30 | Generated: 2026-02-14T14:44:14.267Z
3
+ Version: 1.3.32 | Generated: 2026-02-15T09:31:59.881Z
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,23 +3931,6 @@ Post a chat message to the AI (admin or public)
3932
3931
 
3933
3932
  **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
3934
3933
 
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
-
3942
- ### appRecord
3943
-
3944
- **get**(collectionId: string, appId: string) → `Promise<any>`
3945
-
3946
- **create**(collectionId: string, appId: string, data: any) → `Promise<any>`
3947
-
3948
- **update**(collectionId: string, appId: string, data: any) → `Promise<any>`
3949
-
3950
- **remove**(collectionId: string, appId: string) → `Promise<void>`
3951
-
3952
3934
  ### asset
3953
3935
 
3954
3936
  **upload**(options: UploadAssetOptions) → `Promise<Asset>`
@@ -4309,6 +4291,10 @@ Retrieve a specific settings group for a collection (public endpoint).
4309
4291
  **getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
4310
4292
  Retrieve all configured app module definitions for a collection (public endpoint).
4311
4293
 
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
+
4312
4298
  **updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
4313
4299
  Update a specific settings group for a collection (admin endpoint).
4314
4300
 
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.30 | Generated: 2026-02-14T14:44:14.267Z
3
+ Version: 1.3.32 | Generated: 2026-02-15T09:31:59.881Z
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,23 +3931,6 @@ Post a chat message to the AI (admin or public)
3932
3931
 
3933
3932
  **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
3934
3933
 
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
-
3942
- ### appRecord
3943
-
3944
- **get**(collectionId: string, appId: string) → `Promise<any>`
3945
-
3946
- **create**(collectionId: string, appId: string, data: any) → `Promise<any>`
3947
-
3948
- **update**(collectionId: string, appId: string, data: any) → `Promise<any>`
3949
-
3950
- **remove**(collectionId: string, appId: string) → `Promise<void>`
3951
-
3952
3934
  ### asset
3953
3935
 
3954
3936
  **upload**(options: UploadAssetOptions) → `Promise<Asset>`
@@ -4309,6 +4291,10 @@ Retrieve a specific settings group for a collection (public endpoint).
4309
4291
  **getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
4310
4292
  Retrieve all configured app module definitions for a collection (public endpoint).
4311
4293
 
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
+
4312
4298
  **updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
4313
4299
  Update a specific settings group for a collection (admin endpoint).
4314
4300
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.3.30",
3
+ "version": "1.3.32",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",