@dev-crew-berlin/enter-js-utils 0.97.5 → 0.98.10
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/api-client/api-base.d.ts +24 -3
- package/dist/api-client/api-base.js +146 -15
- package/dist/api-client/api-client.test.js +748 -0
- package/dist/api-client/index.d.ts +11 -5
- package/dist/api-client/index.js +25 -5
- package/dist/generated/api-schema.d.ts +618 -267
- package/dist/models/attendee.d.ts +4 -1
- package/dist/models/attendee.js +4 -0
- package/package.json +7 -7
- package/dist/ui/button.stories.d.ts +0 -16
- package/dist/ui/checkin-count-indicator.stories.d.ts +0 -14
- package/dist/ui/checkin-progress-bar.stories.d.ts +0 -12
- package/dist/ui/companion-info.stories.d.ts +0 -7
- package/dist/ui/enter-logo.stories.d.ts +0 -7
- package/dist/ui/form-elements/input.stories.d.ts +0 -8
- package/dist/ui/form-elements/label.stories.d.ts +0 -6
- package/dist/ui/form-elements/search-input.stories.d.ts +0 -7
- package/dist/ui/form-elements/segmented-control.stories.d.ts +0 -6
- package/dist/ui/form-elements/select.stories.d.ts +0 -8
- package/dist/ui/guest-card.stories.d.ts +0 -14
- package/dist/ui/icons/add-guest-icon.stories.d.ts +0 -7
- package/dist/ui/icons/caret-icon.stories.d.ts +0 -7
- package/dist/ui/icons/filter-icon.stories.d.ts +0 -7
- package/dist/ui/icons/search-icon.stories.d.ts +0 -7
- package/dist/ui/icons/settings-icon.stories.d.ts +0 -7
- package/dist/ui/icons/sort-list-icon.stories.d.ts +0 -7
- package/dist/ui/tag.stories.d.ts +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import APIBase, { FetchOptions, RequestBody } from './api-base';
|
|
1
|
+
import APIBase, { FetchOptions, RequestBody, SubscribeOptions } from './api-base';
|
|
2
2
|
import { APIResult } from '../lib';
|
|
3
3
|
import { Attendee } from '../models/attendee';
|
|
4
4
|
import { Event, EventInput } from '../models';
|
|
@@ -9,7 +9,7 @@ import { User } from '../models/user';
|
|
|
9
9
|
import { Variable } from '../models/variable';
|
|
10
10
|
import { components } from '../generated/api-schema';
|
|
11
11
|
import { Email } from '../models/email';
|
|
12
|
-
export type { APICredentials } from './api-base';
|
|
12
|
+
export type { APICredentials, SubscribeOptions } from './api-base';
|
|
13
13
|
/**
|
|
14
14
|
* api client for the enter backend
|
|
15
15
|
*/
|
|
@@ -73,7 +73,10 @@ declare class API extends APIBase {
|
|
|
73
73
|
instanceName: string;
|
|
74
74
|
filter?: string;
|
|
75
75
|
includeDeleted?: boolean;
|
|
76
|
-
}, options?: FetchOptions): Promise<APIResult<
|
|
76
|
+
}, options?: FetchOptions): Promise<APIResult<{
|
|
77
|
+
attendees: Attendee[];
|
|
78
|
+
eventCursor: string | null;
|
|
79
|
+
}>>;
|
|
77
80
|
/**
|
|
78
81
|
* @category Attendees
|
|
79
82
|
*/
|
|
@@ -160,7 +163,10 @@ declare class API extends APIBase {
|
|
|
160
163
|
/**
|
|
161
164
|
* @category Events
|
|
162
165
|
*/
|
|
163
|
-
createEvents(args: EventInput[], options?: FetchOptions): Promise<APIResult<
|
|
166
|
+
createEvents(args: EventInput[], options?: FetchOptions): Promise<APIResult<{
|
|
167
|
+
created: number;
|
|
168
|
+
eventCursors: Record<string, string>;
|
|
169
|
+
}>>;
|
|
164
170
|
/**
|
|
165
171
|
* Subscribe to the SSE event stream. Yields events as they arrive.
|
|
166
172
|
* Use `for await` to consume events, and `break` or `return` to unsubscribe.
|
|
@@ -175,6 +181,6 @@ declare class API extends APIBase {
|
|
|
175
181
|
subscribeToEvents(args: {
|
|
176
182
|
instanceName: string;
|
|
177
183
|
eventType?: string[];
|
|
178
|
-
}, options?:
|
|
184
|
+
}, options?: SubscribeOptions): AsyncGenerator<Event>;
|
|
179
185
|
}
|
|
180
186
|
export default API;
|
package/dist/api-client/index.js
CHANGED
|
@@ -86,11 +86,20 @@ class API extends APIBase {
|
|
|
86
86
|
if (args.includeDeleted) {
|
|
87
87
|
query.append('include_deleted', 'true');
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const result = await this.
|
|
89
|
+
const qs = query.toString();
|
|
90
|
+
const endpoint = `/instances/${args.instanceName}/attendees${qs ? `?${qs}` : ''}`;
|
|
91
|
+
const result = await this.fetchResponse(endpoint, {
|
|
92
|
+
method: 'GET',
|
|
93
|
+
headers: this.buildHeaders(),
|
|
94
|
+
...options
|
|
95
|
+
});
|
|
92
96
|
if (!result.success) return result;
|
|
93
|
-
|
|
97
|
+
const data = await result.data.json();
|
|
98
|
+
const eventCursor = result.data.headers.get('X-Event-Cursor');
|
|
99
|
+
return success({
|
|
100
|
+
attendees: data.map(attendeeJSON => new Attendee(attendeeJSON)),
|
|
101
|
+
eventCursor: eventCursor ?? null
|
|
102
|
+
});
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
/**
|
|
@@ -219,7 +228,18 @@ class API extends APIBase {
|
|
|
219
228
|
* @category Events
|
|
220
229
|
*/
|
|
221
230
|
async createEvents(args, options = {}) {
|
|
222
|
-
|
|
231
|
+
const result = await this.fetchResponse(`/events`, {
|
|
232
|
+
method: 'POST',
|
|
233
|
+
headers: this.buildHeaders(),
|
|
234
|
+
body: JSON.stringify(args),
|
|
235
|
+
...options
|
|
236
|
+
});
|
|
237
|
+
if (!result.success) return result;
|
|
238
|
+
const json = await result.data.json();
|
|
239
|
+
return success({
|
|
240
|
+
created: json.created,
|
|
241
|
+
eventCursors: json.event_cursors ?? {}
|
|
242
|
+
});
|
|
223
243
|
}
|
|
224
244
|
|
|
225
245
|
/**
|