@cloudparse/up-miniapps-sdk 0.9.0 → 0.10.0
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/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/style.css +3 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -157,6 +157,27 @@ interface INetworkOptions {
|
|
|
157
157
|
body?: unknown;
|
|
158
158
|
/** Custom HTTP headers. */
|
|
159
159
|
headers?: Record<string, string>;
|
|
160
|
+
/**
|
|
161
|
+
* Real production bug, found live: the shell's NETWORK_REQUEST handler
|
|
162
|
+
* (`up/shell`'s `use-miniapp-bridge.ts`) hard-caps every proxied request
|
|
163
|
+
* at a fixed 5s timeout (`fetch-with-timeout.ts`'s `DEFAULT_TIMEOUT_MS`)
|
|
164
|
+
* with no way for a mini-app to ask for more — a genuinely slow-but-legit
|
|
165
|
+
* backend call (e.g. an LLM chat turn routinely taking 3-7s+) gets
|
|
166
|
+
* silently aborted mid-flight ("context canceled" server-side) well
|
|
167
|
+
* before its own, longer server-side timeout would ever fire. Optional
|
|
168
|
+
* override, in milliseconds — omit for the shell's existing 5s default.
|
|
169
|
+
* Only meaningful for `sdk.network.request()`/host-proxied calls; has no
|
|
170
|
+
* effect on any other bridge message type. Governs TWO independent
|
|
171
|
+
* ceilings that must move together, not just the shell's own fetch: the
|
|
172
|
+
* shell's `fetchWithTimeout` call (the actual HTTP request) AND this
|
|
173
|
+
* bridge's own client-side promise wait for the native reply
|
|
174
|
+
* (`Bridge.send`'s own `timeoutMs`, default 30s — see `sdk.ts`'s
|
|
175
|
+
* `network.request`, which forwards this same value there too). Setting
|
|
176
|
+
* this only high enough for the first would still let the second time out
|
|
177
|
+
* first on anything over ~30s and silently reject with a generic "Bridge
|
|
178
|
+
* request timeout" instead of ever reaching the real HTTP response.
|
|
179
|
+
*/
|
|
180
|
+
timeoutMs?: number;
|
|
160
181
|
}
|
|
161
182
|
/**
|
|
162
183
|
* Response from a network proxy request.
|
|
@@ -1550,6 +1571,19 @@ declare class MiniAppSDK {
|
|
|
1550
1571
|
/**
|
|
1551
1572
|
* Performs a network request via the host shell.
|
|
1552
1573
|
* @param options Request method, URL, headers, and body.
|
|
1574
|
+
*
|
|
1575
|
+
* Real bug, caught by reviewer-strict: `options.timeoutMs` only ever
|
|
1576
|
+
* reached the shell's own `fetchWithTimeout` call — this `bridge.send`
|
|
1577
|
+
* has an entirely separate client-side promise timeout (its own
|
|
1578
|
+
* `timeoutMs` param, default 30000ms) waiting for the native reply,
|
|
1579
|
+
* previously left at that default regardless of what `options.timeoutMs`
|
|
1580
|
+
* said. A slow-but-legitimate call given a longer `options.timeoutMs`
|
|
1581
|
+
* (e.g. 50000ms for an LLM-backed endpoint) would still get this
|
|
1582
|
+
* bridge-level promise rejected ("Bridge request timeout") at 30s,
|
|
1583
|
+
* reintroducing the exact same "aborted before it could finish" bug
|
|
1584
|
+
* this field exists to fix, one layer up. Forwarding it here means both
|
|
1585
|
+
* ceilings move together; omitted (`undefined`, every other caller)
|
|
1586
|
+
* falls through to `send`'s own unchanged 30000ms default.
|
|
1553
1587
|
*/
|
|
1554
1588
|
request: <T = unknown>(options: INetworkOptions) => Promise<INetworkResponse<T>>;
|
|
1555
1589
|
}>;
|
|
@@ -1732,7 +1766,13 @@ interface ApiServiceClient {
|
|
|
1732
1766
|
/** Current WebSocket backend URL, same resolution order as `baseUrl` but reading the dedicated ws fields instead. `undefined` if neither the shell nor `defaultWsBackendUrl` ever supplied one. */
|
|
1733
1767
|
readonly wsUrl: string | undefined;
|
|
1734
1768
|
get<T = unknown>(path: string): Promise<INetworkResponse<T>>;
|
|
1735
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* `timeoutMs` overrides the shell's default NETWORK_REQUEST timeout (5s,
|
|
1771
|
+
* see `INetworkOptions.timeoutMs`'s own doc comment) — pass it for a call
|
|
1772
|
+
* to a backend route that's legitimately slower than a typical REST call
|
|
1773
|
+
* (e.g. an LLM-backed endpoint), never as a blanket "just in case" bump.
|
|
1774
|
+
*/
|
|
1775
|
+
post<T = unknown>(path: string, body?: unknown, timeoutMs?: number): Promise<INetworkResponse<T>>;
|
|
1736
1776
|
patch<T = unknown>(path: string, body?: unknown): Promise<INetworkResponse<T>>;
|
|
1737
1777
|
delete(path: string): Promise<INetworkResponse<void>>;
|
|
1738
1778
|
graphqlQuery<T = unknown>(query: string, variables?: Record<string, unknown>): Promise<INetworkResponse<{
|
package/dist/index.d.ts
CHANGED
|
@@ -157,6 +157,27 @@ interface INetworkOptions {
|
|
|
157
157
|
body?: unknown;
|
|
158
158
|
/** Custom HTTP headers. */
|
|
159
159
|
headers?: Record<string, string>;
|
|
160
|
+
/**
|
|
161
|
+
* Real production bug, found live: the shell's NETWORK_REQUEST handler
|
|
162
|
+
* (`up/shell`'s `use-miniapp-bridge.ts`) hard-caps every proxied request
|
|
163
|
+
* at a fixed 5s timeout (`fetch-with-timeout.ts`'s `DEFAULT_TIMEOUT_MS`)
|
|
164
|
+
* with no way for a mini-app to ask for more — a genuinely slow-but-legit
|
|
165
|
+
* backend call (e.g. an LLM chat turn routinely taking 3-7s+) gets
|
|
166
|
+
* silently aborted mid-flight ("context canceled" server-side) well
|
|
167
|
+
* before its own, longer server-side timeout would ever fire. Optional
|
|
168
|
+
* override, in milliseconds — omit for the shell's existing 5s default.
|
|
169
|
+
* Only meaningful for `sdk.network.request()`/host-proxied calls; has no
|
|
170
|
+
* effect on any other bridge message type. Governs TWO independent
|
|
171
|
+
* ceilings that must move together, not just the shell's own fetch: the
|
|
172
|
+
* shell's `fetchWithTimeout` call (the actual HTTP request) AND this
|
|
173
|
+
* bridge's own client-side promise wait for the native reply
|
|
174
|
+
* (`Bridge.send`'s own `timeoutMs`, default 30s — see `sdk.ts`'s
|
|
175
|
+
* `network.request`, which forwards this same value there too). Setting
|
|
176
|
+
* this only high enough for the first would still let the second time out
|
|
177
|
+
* first on anything over ~30s and silently reject with a generic "Bridge
|
|
178
|
+
* request timeout" instead of ever reaching the real HTTP response.
|
|
179
|
+
*/
|
|
180
|
+
timeoutMs?: number;
|
|
160
181
|
}
|
|
161
182
|
/**
|
|
162
183
|
* Response from a network proxy request.
|
|
@@ -1550,6 +1571,19 @@ declare class MiniAppSDK {
|
|
|
1550
1571
|
/**
|
|
1551
1572
|
* Performs a network request via the host shell.
|
|
1552
1573
|
* @param options Request method, URL, headers, and body.
|
|
1574
|
+
*
|
|
1575
|
+
* Real bug, caught by reviewer-strict: `options.timeoutMs` only ever
|
|
1576
|
+
* reached the shell's own `fetchWithTimeout` call — this `bridge.send`
|
|
1577
|
+
* has an entirely separate client-side promise timeout (its own
|
|
1578
|
+
* `timeoutMs` param, default 30000ms) waiting for the native reply,
|
|
1579
|
+
* previously left at that default regardless of what `options.timeoutMs`
|
|
1580
|
+
* said. A slow-but-legitimate call given a longer `options.timeoutMs`
|
|
1581
|
+
* (e.g. 50000ms for an LLM-backed endpoint) would still get this
|
|
1582
|
+
* bridge-level promise rejected ("Bridge request timeout") at 30s,
|
|
1583
|
+
* reintroducing the exact same "aborted before it could finish" bug
|
|
1584
|
+
* this field exists to fix, one layer up. Forwarding it here means both
|
|
1585
|
+
* ceilings move together; omitted (`undefined`, every other caller)
|
|
1586
|
+
* falls through to `send`'s own unchanged 30000ms default.
|
|
1553
1587
|
*/
|
|
1554
1588
|
request: <T = unknown>(options: INetworkOptions) => Promise<INetworkResponse<T>>;
|
|
1555
1589
|
}>;
|
|
@@ -1732,7 +1766,13 @@ interface ApiServiceClient {
|
|
|
1732
1766
|
/** Current WebSocket backend URL, same resolution order as `baseUrl` but reading the dedicated ws fields instead. `undefined` if neither the shell nor `defaultWsBackendUrl` ever supplied one. */
|
|
1733
1767
|
readonly wsUrl: string | undefined;
|
|
1734
1768
|
get<T = unknown>(path: string): Promise<INetworkResponse<T>>;
|
|
1735
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* `timeoutMs` overrides the shell's default NETWORK_REQUEST timeout (5s,
|
|
1771
|
+
* see `INetworkOptions.timeoutMs`'s own doc comment) — pass it for a call
|
|
1772
|
+
* to a backend route that's legitimately slower than a typical REST call
|
|
1773
|
+
* (e.g. an LLM-backed endpoint), never as a blanket "just in case" bump.
|
|
1774
|
+
*/
|
|
1775
|
+
post<T = unknown>(path: string, body?: unknown, timeoutMs?: number): Promise<INetworkResponse<T>>;
|
|
1736
1776
|
patch<T = unknown>(path: string, body?: unknown): Promise<INetworkResponse<T>>;
|
|
1737
1777
|
delete(path: string): Promise<INetworkResponse<void>>;
|
|
1738
1778
|
graphqlQuery<T = unknown>(query: string, variables?: Record<string, unknown>): Promise<INetworkResponse<{
|
package/dist/index.js
CHANGED
|
@@ -3441,7 +3441,7 @@ var loadImage2 = (src) => new Promise((resolve, reject) => {
|
|
|
3441
3441
|
});
|
|
3442
3442
|
|
|
3443
3443
|
// package.json
|
|
3444
|
-
var version = "0.
|
|
3444
|
+
var version = "0.10.0";
|
|
3445
3445
|
|
|
3446
3446
|
// src/sdk.ts
|
|
3447
3447
|
function deepFreeze(obj) {
|
|
@@ -3635,9 +3635,22 @@ var MiniAppSDK = class {
|
|
|
3635
3635
|
/**
|
|
3636
3636
|
* Performs a network request via the host shell.
|
|
3637
3637
|
* @param options Request method, URL, headers, and body.
|
|
3638
|
+
*
|
|
3639
|
+
* Real bug, caught by reviewer-strict: `options.timeoutMs` only ever
|
|
3640
|
+
* reached the shell's own `fetchWithTimeout` call — this `bridge.send`
|
|
3641
|
+
* has an entirely separate client-side promise timeout (its own
|
|
3642
|
+
* `timeoutMs` param, default 30000ms) waiting for the native reply,
|
|
3643
|
+
* previously left at that default regardless of what `options.timeoutMs`
|
|
3644
|
+
* said. A slow-but-legitimate call given a longer `options.timeoutMs`
|
|
3645
|
+
* (e.g. 50000ms for an LLM-backed endpoint) would still get this
|
|
3646
|
+
* bridge-level promise rejected ("Bridge request timeout") at 30s,
|
|
3647
|
+
* reintroducing the exact same "aborted before it could finish" bug
|
|
3648
|
+
* this field exists to fix, one layer up. Forwarding it here means both
|
|
3649
|
+
* ceilings move together; omitted (`undefined`, every other caller)
|
|
3650
|
+
* falls through to `send`'s own unchanged 30000ms default.
|
|
3638
3651
|
*/
|
|
3639
3652
|
request: async (options) => {
|
|
3640
|
-
return this.bridge.send("NETWORK_REQUEST", options);
|
|
3653
|
+
return this.bridge.send("NETWORK_REQUEST", options, options.timeoutMs);
|
|
3641
3654
|
}
|
|
3642
3655
|
});
|
|
3643
3656
|
/**
|
|
@@ -5406,10 +5419,11 @@ function createApiService(options) {
|
|
|
5406
5419
|
method: "PATCH",
|
|
5407
5420
|
url: buildUrl(getBaseUrl(), path)
|
|
5408
5421
|
}),
|
|
5409
|
-
post: (path, body) => sdk.network.request({
|
|
5422
|
+
post: (path, body, timeoutMs) => sdk.network.request({
|
|
5410
5423
|
body,
|
|
5411
5424
|
headers: { "Content-Type": "application/json" },
|
|
5412
5425
|
method: "POST",
|
|
5426
|
+
timeoutMs,
|
|
5413
5427
|
url: buildUrl(getBaseUrl(), path)
|
|
5414
5428
|
}),
|
|
5415
5429
|
get wsUrl() {
|