@eudiplo/sdk-core 1.14.0-main.a35be39 → 1.14.0-main.a4bf740
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 +54 -15
- package/dist/api/client/client.gen.d.mts +1 -1
- package/dist/api/client/client.gen.d.ts +1 -1
- package/dist/api/client/client.gen.js +9 -7
- package/dist/api/client/client.gen.mjs +9 -7
- package/dist/api/client/index.d.mts +1 -1
- package/dist/api/client/index.d.ts +1 -1
- package/dist/api/client/index.js +10 -8
- package/dist/api/client/index.mjs +10 -8
- package/dist/api/client/types.gen.d.mts +1 -1
- package/dist/api/client/types.gen.d.ts +1 -1
- package/dist/api/client.gen.d.mts +2 -2
- package/dist/api/client.gen.d.ts +2 -2
- package/dist/api/client.gen.js +9 -7
- package/dist/api/client.gen.mjs +9 -7
- package/dist/api/index.d.mts +144 -154
- package/dist/api/index.d.ts +144 -154
- package/dist/api/index.js +286 -223
- package/dist/api/index.mjs +252 -184
- package/dist/index.d.mts +86 -9
- package/dist/index.d.ts +86 -9
- package/dist/index.js +402 -230
- package/dist/index.mjs +368 -191
- package/dist/types.gen-8DOlTBVq.d.mts +3816 -0
- package/dist/types.gen-8DOlTBVq.d.ts +3816 -0
- package/dist/{types.gen-DDunhhsd.d.mts → types.gen-CVkHMB8b.d.mts} +8 -7
- package/dist/{types.gen-DDunhhsd.d.ts → types.gen-CVkHMB8b.d.ts} +8 -7
- package/package.json +4 -4
- package/dist/types.gen-BLJOziWG.d.mts +0 -2798
- package/dist/types.gen-BLJOziWG.d.ts +0 -2798
package/README.md
CHANGED
|
@@ -141,14 +141,16 @@ const session = await client.submitDcApiResponse(sessionId, credential);
|
|
|
141
141
|
When deploying to production, you should **never expose your client credentials to the browser**. The SDK provides helper functions to split the DC API flow between your server (where credentials are safe) and the browser (where the DC API runs).
|
|
142
142
|
|
|
143
143
|
**Server-side Functions:**
|
|
144
|
-
|
|
145
|
-
|
|
|
144
|
+
|
|
145
|
+
| Function | Description |
|
|
146
|
+
| -------------------------------- | ------------------------------------------------------ |
|
|
146
147
|
| `createDcApiRequestForBrowser()` | Create request on server, return safe data for browser |
|
|
147
|
-
| `submitDcApiWalletResponse()`
|
|
148
|
+
| `submitDcApiWalletResponse()` | Submit wallet response to EUDIPLO from server |
|
|
148
149
|
|
|
149
150
|
**Browser-side Functions:**
|
|
150
|
-
|
|
151
|
-
|
|
|
151
|
+
|
|
152
|
+
| Function | Description |
|
|
153
|
+
| ------------- | ------------------------------------------------------ |
|
|
152
154
|
| `callDcApi()` | Call the native DC API with a request from your server |
|
|
153
155
|
|
|
154
156
|
##### Example: Express.js Backend + Browser Frontend
|
|
@@ -165,8 +167,8 @@ import {
|
|
|
165
167
|
app.post('/api/start-verification', async (req, res) => {
|
|
166
168
|
const requestData = await createDcApiRequestForBrowser({
|
|
167
169
|
baseUrl: process.env.EUDIPLO_URL,
|
|
168
|
-
clientId: process.env.EUDIPLO_CLIENT_ID,
|
|
169
|
-
clientSecret: process.env.EUDIPLO_SECRET,
|
|
170
|
+
clientId: process.env.EUDIPLO_CLIENT_ID, // ✅ Safe on server
|
|
171
|
+
clientSecret: process.env.EUDIPLO_SECRET, // ✅ Safe on server
|
|
170
172
|
configId: 'age-over-18',
|
|
171
173
|
});
|
|
172
174
|
|
|
@@ -181,7 +183,7 @@ app.post('/api/complete-verification', async (req, res) => {
|
|
|
181
183
|
const result = await submitDcApiWalletResponse({
|
|
182
184
|
responseUri,
|
|
183
185
|
walletResponse,
|
|
184
|
-
sendResponse: true,
|
|
186
|
+
sendResponse: true, // Get verified claims back
|
|
185
187
|
});
|
|
186
188
|
|
|
187
189
|
// result.credentials contains the verified data
|
|
@@ -224,13 +226,13 @@ async function verifyAge() {
|
|
|
224
226
|
|
|
225
227
|
**What stays where:**
|
|
226
228
|
|
|
227
|
-
| Data
|
|
228
|
-
|
|
229
|
-
| `clientId` / `clientSecret`
|
|
230
|
-
| `requestObject` (signed JWT)
|
|
231
|
-
| `responseUri`
|
|
232
|
-
| Wallet response (encrypted VP) | Browser → Server | ✅ Yes
|
|
233
|
-
| Verified credentials
|
|
229
|
+
| Data | Location | Safe to expose? |
|
|
230
|
+
| ------------------------------ | ---------------- | ------------------- |
|
|
231
|
+
| `clientId` / `clientSecret` | Server only | ❌ Never expose |
|
|
232
|
+
| `requestObject` (signed JWT) | Server → Browser | ✅ Yes |
|
|
233
|
+
| `responseUri` | Server → Browser | ✅ Yes |
|
|
234
|
+
| Wallet response (encrypted VP) | Browser → Server | ✅ Yes |
|
|
235
|
+
| Verified credentials | Server only | Depends on use case |
|
|
234
236
|
|
|
235
237
|
### Class-based API (More Control)
|
|
236
238
|
|
|
@@ -325,6 +327,43 @@ const session = await client.waitForSession(sessionId, {
|
|
|
325
327
|
});
|
|
326
328
|
```
|
|
327
329
|
|
|
330
|
+
### `subscribeToSession(sessionId, options)`
|
|
331
|
+
|
|
332
|
+
Subscribe to real-time session status updates via Server-Sent Events (SSE).
|
|
333
|
+
This is more efficient than polling and provides instant updates.
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
const subscription = await client.subscribeToSession(sessionId, {
|
|
337
|
+
onStatusChange: (event) => {
|
|
338
|
+
console.log(`Status: ${event.status}`);
|
|
339
|
+
if (['completed', 'expired', 'failed'].includes(event.status)) {
|
|
340
|
+
subscription.close();
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
onError: (error) => console.error('SSE error:', error),
|
|
344
|
+
onOpen: () => console.log('Connected'),
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// Later, to close the connection:
|
|
348
|
+
subscription.close();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### `waitForSessionWithSse(sessionId, options)`
|
|
352
|
+
|
|
353
|
+
Wait for session completion using SSE instead of polling. Returns a Promise
|
|
354
|
+
that resolves when the session completes.
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
try {
|
|
358
|
+
const finalStatus = await client.waitForSessionWithSse(sessionId, {
|
|
359
|
+
onStatusChange: (event) => console.log('Status:', event.status),
|
|
360
|
+
});
|
|
361
|
+
console.log('Session completed:', finalStatus);
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error('Session failed:', error);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
328
367
|
## Examples
|
|
329
368
|
|
|
330
369
|
### Age Verification in a Web Shop
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/api/core/serverSentEvents.gen.ts
|
|
4
|
-
|
|
4
|
+
function createSseClient({
|
|
5
5
|
onRequest,
|
|
6
6
|
onSseError,
|
|
7
7
|
onSseEvent,
|
|
@@ -13,7 +13,7 @@ var createSseClient = ({
|
|
|
13
13
|
sseSleepFn,
|
|
14
14
|
url,
|
|
15
15
|
...options
|
|
16
|
-
})
|
|
16
|
+
}) {
|
|
17
17
|
let lastEventId;
|
|
18
18
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
19
19
|
const createStream = async function* () {
|
|
@@ -60,7 +60,7 @@ var createSseClient = ({
|
|
|
60
60
|
const { done, value } = await reader.read();
|
|
61
61
|
if (done) break;
|
|
62
62
|
buffer += value;
|
|
63
|
-
buffer = buffer.replace(/\r\n
|
|
63
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
64
64
|
const chunks = buffer.split("\n\n");
|
|
65
65
|
buffer = chunks.pop() ?? "";
|
|
66
66
|
for (const chunk of chunks) {
|
|
@@ -134,7 +134,7 @@ var createSseClient = ({
|
|
|
134
134
|
};
|
|
135
135
|
const stream = createStream();
|
|
136
136
|
return { stream };
|
|
137
|
-
}
|
|
137
|
+
}
|
|
138
138
|
|
|
139
139
|
// src/api/core/pathSerializer.gen.ts
|
|
140
140
|
var separatorArrayExplode = (style) => {
|
|
@@ -637,8 +637,9 @@ var createClient = (config = {}) => {
|
|
|
637
637
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
638
638
|
opts.headers.delete("Content-Type");
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
640
|
+
const resolvedOpts = opts;
|
|
641
|
+
const url = buildUrl(resolvedOpts);
|
|
642
|
+
return { opts: resolvedOpts, url };
|
|
642
643
|
};
|
|
643
644
|
const request = async (options) => {
|
|
644
645
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -789,8 +790,9 @@ var createClient = (config = {}) => {
|
|
|
789
790
|
url
|
|
790
791
|
});
|
|
791
792
|
};
|
|
793
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
792
794
|
return {
|
|
793
|
-
buildUrl,
|
|
795
|
+
buildUrl: _buildUrl,
|
|
794
796
|
connect: makeMethodFn("CONNECT"),
|
|
795
797
|
delete: makeMethodFn("DELETE"),
|
|
796
798
|
get: makeMethodFn("GET"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/core/serverSentEvents.gen.ts
|
|
2
|
-
|
|
2
|
+
function createSseClient({
|
|
3
3
|
onRequest,
|
|
4
4
|
onSseError,
|
|
5
5
|
onSseEvent,
|
|
@@ -11,7 +11,7 @@ var createSseClient = ({
|
|
|
11
11
|
sseSleepFn,
|
|
12
12
|
url,
|
|
13
13
|
...options
|
|
14
|
-
})
|
|
14
|
+
}) {
|
|
15
15
|
let lastEventId;
|
|
16
16
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
17
17
|
const createStream = async function* () {
|
|
@@ -58,7 +58,7 @@ var createSseClient = ({
|
|
|
58
58
|
const { done, value } = await reader.read();
|
|
59
59
|
if (done) break;
|
|
60
60
|
buffer += value;
|
|
61
|
-
buffer = buffer.replace(/\r\n
|
|
61
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
62
62
|
const chunks = buffer.split("\n\n");
|
|
63
63
|
buffer = chunks.pop() ?? "";
|
|
64
64
|
for (const chunk of chunks) {
|
|
@@ -132,7 +132,7 @@ var createSseClient = ({
|
|
|
132
132
|
};
|
|
133
133
|
const stream = createStream();
|
|
134
134
|
return { stream };
|
|
135
|
-
}
|
|
135
|
+
}
|
|
136
136
|
|
|
137
137
|
// src/api/core/pathSerializer.gen.ts
|
|
138
138
|
var separatorArrayExplode = (style) => {
|
|
@@ -635,8 +635,9 @@ var createClient = (config = {}) => {
|
|
|
635
635
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
636
636
|
opts.headers.delete("Content-Type");
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
638
|
+
const resolvedOpts = opts;
|
|
639
|
+
const url = buildUrl(resolvedOpts);
|
|
640
|
+
return { opts: resolvedOpts, url };
|
|
640
641
|
};
|
|
641
642
|
const request = async (options) => {
|
|
642
643
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -787,8 +788,9 @@ var createClient = (config = {}) => {
|
|
|
787
788
|
url
|
|
788
789
|
});
|
|
789
790
|
};
|
|
791
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
790
792
|
return {
|
|
791
|
-
buildUrl,
|
|
793
|
+
buildUrl: _buildUrl,
|
|
792
794
|
connect: makeMethodFn("CONNECT"),
|
|
793
795
|
delete: makeMethodFn("DELETE"),
|
|
794
796
|
get: makeMethodFn("GET"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-CVkHMB8b.mjs';
|
|
2
2
|
export { createClient } from './client.gen.mjs';
|
|
3
3
|
|
|
4
4
|
type Slot = "body" | "headers" | "path" | "query";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-
|
|
1
|
+
export { A as Auth, C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, Q as QuerySerializerOptions, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape, g as createConfig, h as formDataBodySerializer, j as jsonBodySerializer, m as mergeHeaders, u as urlSearchParamsBodySerializer } from '../../types.gen-CVkHMB8b.js';
|
|
2
2
|
export { createClient } from './client.gen.js';
|
|
3
3
|
|
|
4
4
|
type Slot = "body" | "headers" | "path" | "query";
|
package/dist/api/client/index.js
CHANGED
|
@@ -88,7 +88,7 @@ var buildKeyMap = (fields, map) => {
|
|
|
88
88
|
};
|
|
89
89
|
var stripEmptySlots = (params) => {
|
|
90
90
|
for (const [slot, value] of Object.entries(params)) {
|
|
91
|
-
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
91
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
92
92
|
delete params[slot];
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -231,7 +231,7 @@ var serializeQueryKeyValue = (value) => {
|
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
// src/api/core/serverSentEvents.gen.ts
|
|
234
|
-
|
|
234
|
+
function createSseClient({
|
|
235
235
|
onRequest,
|
|
236
236
|
onSseError,
|
|
237
237
|
onSseEvent,
|
|
@@ -243,7 +243,7 @@ var createSseClient = ({
|
|
|
243
243
|
sseSleepFn,
|
|
244
244
|
url,
|
|
245
245
|
...options
|
|
246
|
-
})
|
|
246
|
+
}) {
|
|
247
247
|
let lastEventId;
|
|
248
248
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
249
249
|
const createStream = async function* () {
|
|
@@ -290,7 +290,7 @@ var createSseClient = ({
|
|
|
290
290
|
const { done, value } = await reader.read();
|
|
291
291
|
if (done) break;
|
|
292
292
|
buffer += value;
|
|
293
|
-
buffer = buffer.replace(/\r\n
|
|
293
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
294
294
|
const chunks = buffer.split("\n\n");
|
|
295
295
|
buffer = chunks.pop() ?? "";
|
|
296
296
|
for (const chunk of chunks) {
|
|
@@ -364,7 +364,7 @@ var createSseClient = ({
|
|
|
364
364
|
};
|
|
365
365
|
const stream = createStream();
|
|
366
366
|
return { stream };
|
|
367
|
-
}
|
|
367
|
+
}
|
|
368
368
|
|
|
369
369
|
// src/api/core/pathSerializer.gen.ts
|
|
370
370
|
var separatorArrayExplode = (style) => {
|
|
@@ -859,8 +859,9 @@ var createClient = (config = {}) => {
|
|
|
859
859
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
860
860
|
opts.headers.delete("Content-Type");
|
|
861
861
|
}
|
|
862
|
-
const
|
|
863
|
-
|
|
862
|
+
const resolvedOpts = opts;
|
|
863
|
+
const url = buildUrl(resolvedOpts);
|
|
864
|
+
return { opts: resolvedOpts, url };
|
|
864
865
|
};
|
|
865
866
|
const request = async (options) => {
|
|
866
867
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -1011,8 +1012,9 @@ var createClient = (config = {}) => {
|
|
|
1011
1012
|
url
|
|
1012
1013
|
});
|
|
1013
1014
|
};
|
|
1015
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
1014
1016
|
return {
|
|
1015
|
-
buildUrl,
|
|
1017
|
+
buildUrl: _buildUrl,
|
|
1016
1018
|
connect: makeMethodFn("CONNECT"),
|
|
1017
1019
|
delete: makeMethodFn("DELETE"),
|
|
1018
1020
|
get: makeMethodFn("GET"),
|
|
@@ -86,7 +86,7 @@ var buildKeyMap = (fields, map) => {
|
|
|
86
86
|
};
|
|
87
87
|
var stripEmptySlots = (params) => {
|
|
88
88
|
for (const [slot, value] of Object.entries(params)) {
|
|
89
|
-
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
89
|
+
if (value && typeof value === "object" && !Array.isArray(value) && !Object.keys(value).length) {
|
|
90
90
|
delete params[slot];
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -229,7 +229,7 @@ var serializeQueryKeyValue = (value) => {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
// src/api/core/serverSentEvents.gen.ts
|
|
232
|
-
|
|
232
|
+
function createSseClient({
|
|
233
233
|
onRequest,
|
|
234
234
|
onSseError,
|
|
235
235
|
onSseEvent,
|
|
@@ -241,7 +241,7 @@ var createSseClient = ({
|
|
|
241
241
|
sseSleepFn,
|
|
242
242
|
url,
|
|
243
243
|
...options
|
|
244
|
-
})
|
|
244
|
+
}) {
|
|
245
245
|
let lastEventId;
|
|
246
246
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
247
247
|
const createStream = async function* () {
|
|
@@ -288,7 +288,7 @@ var createSseClient = ({
|
|
|
288
288
|
const { done, value } = await reader.read();
|
|
289
289
|
if (done) break;
|
|
290
290
|
buffer += value;
|
|
291
|
-
buffer = buffer.replace(/\r\n
|
|
291
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
292
292
|
const chunks = buffer.split("\n\n");
|
|
293
293
|
buffer = chunks.pop() ?? "";
|
|
294
294
|
for (const chunk of chunks) {
|
|
@@ -362,7 +362,7 @@ var createSseClient = ({
|
|
|
362
362
|
};
|
|
363
363
|
const stream = createStream();
|
|
364
364
|
return { stream };
|
|
365
|
-
}
|
|
365
|
+
}
|
|
366
366
|
|
|
367
367
|
// src/api/core/pathSerializer.gen.ts
|
|
368
368
|
var separatorArrayExplode = (style) => {
|
|
@@ -857,8 +857,9 @@ var createClient = (config = {}) => {
|
|
|
857
857
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
858
858
|
opts.headers.delete("Content-Type");
|
|
859
859
|
}
|
|
860
|
-
const
|
|
861
|
-
|
|
860
|
+
const resolvedOpts = opts;
|
|
861
|
+
const url = buildUrl(resolvedOpts);
|
|
862
|
+
return { opts: resolvedOpts, url };
|
|
862
863
|
};
|
|
863
864
|
const request = async (options) => {
|
|
864
865
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -1009,8 +1010,9 @@ var createClient = (config = {}) => {
|
|
|
1009
1010
|
url
|
|
1010
1011
|
});
|
|
1011
1012
|
};
|
|
1013
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
1012
1014
|
return {
|
|
1013
|
-
buildUrl,
|
|
1015
|
+
buildUrl: _buildUrl,
|
|
1014
1016
|
connect: makeMethodFn("CONNECT"),
|
|
1015
1017
|
delete: makeMethodFn("DELETE"),
|
|
1016
1018
|
get: makeMethodFn("GET"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-
|
|
1
|
+
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-CVkHMB8b.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-
|
|
1
|
+
export { C as Client, a as ClientOptions, b as Config, c as CreateClientConfig, O as Options, R as RequestOptions, d as RequestResult, e as ResolvedRequestOptions, f as ResponseStyle, T as TDataShape } from '../../types.gen-CVkHMB8b.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-
|
|
2
|
-
import { ai as ClientOptions$1 } from '../types.gen-
|
|
1
|
+
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-CVkHMB8b.mjs';
|
|
2
|
+
import { ai as ClientOptions$1 } from '../types.gen-8DOlTBVq.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
package/dist/api/client.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-
|
|
2
|
-
import { ai as ClientOptions$1 } from '../types.gen-
|
|
1
|
+
import { C as Client, a as ClientOptions, b as Config } from '../types.gen-CVkHMB8b.js';
|
|
2
|
+
import { ai as ClientOptions$1 } from '../types.gen-8DOlTBVq.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `createClientConfig()` function will be called on client initialization
|
package/dist/api/client.gen.js
CHANGED
|
@@ -9,7 +9,7 @@ var jsonBodySerializer = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// src/api/core/serverSentEvents.gen.ts
|
|
12
|
-
|
|
12
|
+
function createSseClient({
|
|
13
13
|
onRequest,
|
|
14
14
|
onSseError,
|
|
15
15
|
onSseEvent,
|
|
@@ -21,7 +21,7 @@ var createSseClient = ({
|
|
|
21
21
|
sseSleepFn,
|
|
22
22
|
url,
|
|
23
23
|
...options
|
|
24
|
-
})
|
|
24
|
+
}) {
|
|
25
25
|
let lastEventId;
|
|
26
26
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
27
27
|
const createStream = async function* () {
|
|
@@ -68,7 +68,7 @@ var createSseClient = ({
|
|
|
68
68
|
const { done, value } = await reader.read();
|
|
69
69
|
if (done) break;
|
|
70
70
|
buffer += value;
|
|
71
|
-
buffer = buffer.replace(/\r\n
|
|
71
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
72
72
|
const chunks = buffer.split("\n\n");
|
|
73
73
|
buffer = chunks.pop() ?? "";
|
|
74
74
|
for (const chunk of chunks) {
|
|
@@ -142,7 +142,7 @@ var createSseClient = ({
|
|
|
142
142
|
};
|
|
143
143
|
const stream = createStream();
|
|
144
144
|
return { stream };
|
|
145
|
-
}
|
|
145
|
+
}
|
|
146
146
|
|
|
147
147
|
// src/api/core/pathSerializer.gen.ts
|
|
148
148
|
var separatorArrayExplode = (style) => {
|
|
@@ -637,8 +637,9 @@ var createClient = (config = {}) => {
|
|
|
637
637
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
638
638
|
opts.headers.delete("Content-Type");
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
640
|
+
const resolvedOpts = opts;
|
|
641
|
+
const url = buildUrl(resolvedOpts);
|
|
642
|
+
return { opts: resolvedOpts, url };
|
|
642
643
|
};
|
|
643
644
|
const request = async (options) => {
|
|
644
645
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -789,8 +790,9 @@ var createClient = (config = {}) => {
|
|
|
789
790
|
url
|
|
790
791
|
});
|
|
791
792
|
};
|
|
793
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
792
794
|
return {
|
|
793
|
-
buildUrl,
|
|
795
|
+
buildUrl: _buildUrl,
|
|
794
796
|
connect: makeMethodFn("CONNECT"),
|
|
795
797
|
delete: makeMethodFn("DELETE"),
|
|
796
798
|
get: makeMethodFn("GET"),
|
package/dist/api/client.gen.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var jsonBodySerializer = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/api/core/serverSentEvents.gen.ts
|
|
10
|
-
|
|
10
|
+
function createSseClient({
|
|
11
11
|
onRequest,
|
|
12
12
|
onSseError,
|
|
13
13
|
onSseEvent,
|
|
@@ -19,7 +19,7 @@ var createSseClient = ({
|
|
|
19
19
|
sseSleepFn,
|
|
20
20
|
url,
|
|
21
21
|
...options
|
|
22
|
-
})
|
|
22
|
+
}) {
|
|
23
23
|
let lastEventId;
|
|
24
24
|
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
25
25
|
const createStream = async function* () {
|
|
@@ -66,7 +66,7 @@ var createSseClient = ({
|
|
|
66
66
|
const { done, value } = await reader.read();
|
|
67
67
|
if (done) break;
|
|
68
68
|
buffer += value;
|
|
69
|
-
buffer = buffer.replace(/\r\n
|
|
69
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
70
70
|
const chunks = buffer.split("\n\n");
|
|
71
71
|
buffer = chunks.pop() ?? "";
|
|
72
72
|
for (const chunk of chunks) {
|
|
@@ -140,7 +140,7 @@ var createSseClient = ({
|
|
|
140
140
|
};
|
|
141
141
|
const stream = createStream();
|
|
142
142
|
return { stream };
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
|
|
145
145
|
// src/api/core/pathSerializer.gen.ts
|
|
146
146
|
var separatorArrayExplode = (style) => {
|
|
@@ -635,8 +635,9 @@ var createClient = (config = {}) => {
|
|
|
635
635
|
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
636
636
|
opts.headers.delete("Content-Type");
|
|
637
637
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
638
|
+
const resolvedOpts = opts;
|
|
639
|
+
const url = buildUrl(resolvedOpts);
|
|
640
|
+
return { opts: resolvedOpts, url };
|
|
640
641
|
};
|
|
641
642
|
const request = async (options) => {
|
|
642
643
|
const { opts, url } = await beforeRequest(options);
|
|
@@ -787,8 +788,9 @@ var createClient = (config = {}) => {
|
|
|
787
788
|
url
|
|
788
789
|
});
|
|
789
790
|
};
|
|
791
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
790
792
|
return {
|
|
791
|
-
buildUrl,
|
|
793
|
+
buildUrl: _buildUrl,
|
|
792
794
|
connect: makeMethodFn("CONNECT"),
|
|
793
795
|
delete: makeMethodFn("DELETE"),
|
|
794
796
|
get: makeMethodFn("GET"),
|