@asgardeo/auth-spa 3.3.2 → 3.5.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/README.md +8 -0
- package/dist/asgardeo-spa.production.esm.js +43 -14
- package/dist/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/asgardeo-spa.production.js +39 -10
- package/dist/asgardeo-spa.production.js.map +1 -1
- package/dist/asgardeo-spa.production.min.js +1 -1
- package/dist/asgardeo-spa.production.min.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.esm.js +70 -41
- package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.js +70 -41
- package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
- package/dist/src/client.d.ts +30 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +39 -0
- package/dist/src/client.js.map +1 -1
- package/dist/src/clients/web-worker-client.d.ts.map +1 -1
- package/dist/src/clients/web-worker-client.js +48 -1
- package/dist/src/clients/web-worker-client.js.map +1 -1
- package/dist/src/constants/messages-types.d.ts +1 -0
- package/dist/src/constants/messages-types.d.ts.map +1 -1
- package/dist/src/constants/messages-types.js +1 -0
- package/dist/src/constants/messages-types.js.map +1 -1
- package/dist/src/http-client/clients/axios-http-client.d.ts.map +1 -1
- package/dist/src/http-client/clients/axios-http-client.js +6 -0
- package/dist/src/http-client/clients/axios-http-client.js.map +1 -1
- package/dist/src/models/client.d.ts +1 -0
- package/dist/src/models/client.d.ts.map +1 -1
- package/dist/src/models/message.d.ts +2 -2
- package/dist/src/models/message.d.ts.map +1 -1
- package/dist/src/utils/message-utils.d.ts +8 -1
- package/dist/src/utils/message-utils.d.ts.map +1 -1
- package/dist/src/utils/message-utils.js +27 -5
- package/dist/src/utils/message-utils.js.map +1 -1
- package/dist/src/worker/worker-receiver.d.ts.map +1 -1
- package/dist/src/worker/worker-receiver.js +33 -1
- package/dist/src/worker/worker-receiver.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/client.ts +47 -2
- package/src/clients/web-worker-client.ts +61 -0
- package/src/constants/messages-types.ts +1 -0
- package/src/http-client/clients/axios-http-client.ts +7 -1
- package/src/models/client.ts +1 -0
- package/src/models/message.ts +2 -0
- package/src/utils/message-utils.ts +26 -5
- package/src/worker/worker-receiver.ts +36 -0
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
GET_SIGN_OUT_URL,
|
|
37
37
|
HTTP_REQUEST,
|
|
38
38
|
HTTP_REQUEST_ALL,
|
|
39
|
+
HTTP_STREAM_REQUEST,
|
|
39
40
|
INIT,
|
|
40
41
|
IS_AUTHENTICATED,
|
|
41
42
|
REFRESH_ACCESS_TOKEN,
|
|
@@ -146,6 +147,39 @@ export const workerReceiver = (
|
|
|
146
147
|
|
|
147
148
|
break;
|
|
148
149
|
}
|
|
150
|
+
case HTTP_STREAM_REQUEST: {
|
|
151
|
+
const request = data.data;
|
|
152
|
+
|
|
153
|
+
// Inject fetch adapter config for streaming
|
|
154
|
+
request.adapter = "fetch";
|
|
155
|
+
request.responseType = "stream";
|
|
156
|
+
|
|
157
|
+
webWorker
|
|
158
|
+
.httpRequest(request)
|
|
159
|
+
.then((response) => {
|
|
160
|
+
const stream = (response as any)?.data;
|
|
161
|
+
|
|
162
|
+
if (stream instanceof ReadableStream) {
|
|
163
|
+
// Post raw message — do NOT use generateSuccessMessage here.
|
|
164
|
+
// generateSuccessMessage calls JSON.stringify which turns a
|
|
165
|
+
// ReadableStream into {} and the stream reference is lost.
|
|
166
|
+
port.postMessage(
|
|
167
|
+
{
|
|
168
|
+
data: stream,
|
|
169
|
+
success: true
|
|
170
|
+
},
|
|
171
|
+
[stream as any]
|
|
172
|
+
);
|
|
173
|
+
} else {
|
|
174
|
+
port.postMessage(MessageUtils.generateSuccessMessage(response));
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
.catch((error) => {
|
|
178
|
+
port.postMessage(MessageUtils.generateFailureMessage(error));
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
149
183
|
case HTTP_REQUEST_ALL:
|
|
150
184
|
webWorker
|
|
151
185
|
.httpRequestAll(data.data)
|
|
@@ -310,6 +344,8 @@ export const workerReceiver = (
|
|
|
310
344
|
};
|
|
311
345
|
|
|
312
346
|
const onRequestSuccessCallback = (response: HttpResponse): void => {
|
|
347
|
+
// Skip stringifying if response contains a ReadableStream
|
|
348
|
+
if ((response as any)?.data instanceof ReadableStream) return;
|
|
313
349
|
ctx.postMessage({ data: JSON.stringify(response ?? ""), type: REQUEST_SUCCESS });
|
|
314
350
|
};
|
|
315
351
|
|