@openpeepshq/client 0.2.1 → 0.4.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/endpoints/admin.d.ts +11 -1
- package/dist/endpoints/admin.js +6 -0
- package/dist/endpoints/auth.d.ts +1 -1
- package/dist/endpoints/conversations.d.ts +7 -1
- package/dist/endpoints/conversations.js +1 -0
- package/dist/endpoints/helpers.d.ts +1 -1
- package/dist/endpoints/helpers.js +4 -4
- package/dist/endpoints/jams.d.ts +60 -11
- package/dist/endpoints/posts.d.ts +12 -1
- package/dist/endpoints/posts.js +16 -0
- package/dist/endpoints/profiles.d.ts +184 -36
- package/dist/endpoints/search.d.ts +182 -35
- package/dist/endpoints/search.js +1 -1
- package/dist/endpoints/server.d.ts +26 -16
- package/dist/endpoints/streaming.js +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +3 -3
- package/package.json +10 -11
- package/src/endpoints/admin.ts +29 -0
- package/src/endpoints/auth.ts +37 -37
- package/src/endpoints/conversations.ts +21 -5
- package/src/endpoints/groups.ts +60 -63
- package/src/endpoints/helpers.ts +78 -78
- package/src/endpoints/i18n.ts +6 -9
- package/src/endpoints/location.ts +6 -5
- package/src/endpoints/media.ts +42 -45
- package/src/endpoints/posts.ts +47 -0
- package/src/endpoints/previewLink.ts +4 -5
- package/src/endpoints/reports.ts +23 -26
- package/src/endpoints/search.ts +43 -30
- package/src/endpoints/server.ts +23 -30
- package/src/endpoints/sso.ts +18 -30
- package/src/endpoints/streaming.ts +19 -25
- package/src/webhooks/index.ts +4 -10
package/src/endpoints/i18n.ts
CHANGED
|
@@ -3,12 +3,9 @@ import type { ResourceLanguage } from 'i18next';
|
|
|
3
3
|
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
4
4
|
|
|
5
5
|
export const i18n = (rawClient: FetchClient) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'/i18n/languages',
|
|
13
|
-
),
|
|
14
|
-
});
|
|
6
|
+
translations: allpeepNoPayloadEndpoint<ResourceLanguage, { lang: string }>(
|
|
7
|
+
rawClient,
|
|
8
|
+
'/i18n/:lang',
|
|
9
|
+
),
|
|
10
|
+
languages: allpeepNoPayloadEndpoint<string[]>(rawClient, '/i18n/languages'),
|
|
11
|
+
});
|
|
@@ -3,8 +3,9 @@ import type { GeocodingResult } from '@openpeepshq/common';
|
|
|
3
3
|
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
4
4
|
|
|
5
5
|
export const location = (rawClient: FetchClient) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
geocode: allpeepNoPayloadEndpoint<
|
|
7
|
+
GeocodingResult[],
|
|
8
|
+
undefined,
|
|
9
|
+
{ query: string }
|
|
10
|
+
>(rawClient, '/location/geocode'),
|
|
11
|
+
});
|
package/src/endpoints/media.ts
CHANGED
|
@@ -1,56 +1,53 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
FetchClient,
|
|
3
|
+
noPayloadEventSource,
|
|
4
4
|
} from '@openpeepshq/fetch-client';
|
|
5
5
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
MediaAttachment,
|
|
7
|
+
MediaProgressEvent,
|
|
8
|
+
MediaStorageRequestInput,
|
|
9
|
+
SuccessResponse,
|
|
10
10
|
} from '@openpeepshq/common';
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
allpeepNoPayloadEndpoint,
|
|
13
|
+
allpeepPayloadEndpoint,
|
|
14
|
+
allpeepPayloadProgressObserverEndpoint,
|
|
15
15
|
} from './helpers';
|
|
16
16
|
|
|
17
17
|
export const media = (
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
rawClient: FetchClient,
|
|
19
|
+
eventSource: ReturnType<typeof noPayloadEventSource>,
|
|
20
20
|
) => ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
delete
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
21
|
+
list: allpeepNoPayloadEndpoint<MediaAttachment[]>(rawClient, '/media'),
|
|
22
|
+
findById: allpeepNoPayloadEndpoint<MediaAttachment, { id: string }>(
|
|
23
|
+
rawClient,
|
|
24
|
+
'/media/:id',
|
|
25
|
+
),
|
|
26
|
+
create: allpeepPayloadEndpoint<MediaAttachment, MediaStorageRequestInput>(
|
|
27
|
+
rawClient,
|
|
28
|
+
'/media',
|
|
29
|
+
'post',
|
|
30
|
+
true,
|
|
31
|
+
),
|
|
32
|
+
/**
|
|
33
|
+
* Same as `create` but routes through XHR so callers can pass
|
|
34
|
+
* `onUploadProgress` to receive byte-level upload events. Returns either a
|
|
35
|
+
* fully-processed `MediaAttachment` (small files, sync path) or a partial
|
|
36
|
+
* one with `status: 'processing'` (large files, async path) — pair with
|
|
37
|
+
* `progress.listen` to track the background processing phase.
|
|
38
|
+
*/
|
|
39
|
+
createWithProgress: allpeepPayloadProgressObserverEndpoint<
|
|
40
|
+
MediaAttachment,
|
|
41
|
+
MediaStorageRequestInput
|
|
42
|
+
>(rawClient, '/media', 'post', true),
|
|
43
|
+
delete: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
|
|
44
|
+
rawClient,
|
|
45
|
+
'/media/:id',
|
|
46
|
+
'delete',
|
|
47
|
+
),
|
|
48
|
+
progress: {
|
|
49
|
+
listen: eventSource<MediaProgressEvent, { id: string }>(
|
|
50
|
+
'/media/:id/progress',
|
|
50
51
|
),
|
|
51
|
-
|
|
52
|
-
listen: eventSource<MediaProgressEvent, { id: string }>(
|
|
53
|
-
'/media/:id/progress',
|
|
54
|
-
),
|
|
55
|
-
},
|
|
52
|
+
},
|
|
56
53
|
});
|
package/src/endpoints/posts.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type OffsetInfiniteQueryParams,
|
|
13
13
|
type PublicPost,
|
|
14
14
|
type UnseenPostCounts,
|
|
15
|
+
type EventRangeQueryParams,
|
|
15
16
|
} from '@openpeepshq/common';
|
|
16
17
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
17
18
|
import type {
|
|
@@ -35,6 +36,18 @@ type OffsetPosts = OpenpeepsNoPayloadEndpoint<
|
|
|
35
36
|
OffsetInfiniteQueryParams
|
|
36
37
|
>;
|
|
37
38
|
|
|
39
|
+
type RangePosts = OpenpeepsNoPayloadEndpoint<
|
|
40
|
+
PublicPost[],
|
|
41
|
+
undefined,
|
|
42
|
+
EventRangeQueryParams
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
type GroupRangePosts = OpenpeepsNoPayloadEndpoint<
|
|
46
|
+
PublicPost[],
|
|
47
|
+
{ groupId: string },
|
|
48
|
+
EventRangeQueryParams
|
|
49
|
+
>;
|
|
50
|
+
|
|
38
51
|
type GroupOffsetPosts = OpenpeepsNoPayloadEndpoint<
|
|
39
52
|
PublicPost[],
|
|
40
53
|
{ groupId: string },
|
|
@@ -77,6 +90,7 @@ type Finders = {
|
|
|
77
90
|
{ id: string; recordingId: string }
|
|
78
91
|
>;
|
|
79
92
|
unseenCounts: OpenpeepsNoPayloadEndpoint<UnseenPostCounts>;
|
|
93
|
+
exportRsvps: (args: { id: string; occurrence?: string }) => Promise<string>;
|
|
80
94
|
};
|
|
81
95
|
|
|
82
96
|
// Explicit return types keep `tsc` from serializing the expanded PublicPost
|
|
@@ -140,6 +154,18 @@ const finders = (rawClient: FetchClient): Finders => ({
|
|
|
140
154
|
rawClient,
|
|
141
155
|
'/posts/unseen/counts',
|
|
142
156
|
),
|
|
157
|
+
exportRsvps: async ({ id, occurrence }) => {
|
|
158
|
+
const query = occurrence
|
|
159
|
+
? `?occurrence=${encodeURIComponent(occurrence)}`
|
|
160
|
+
: '';
|
|
161
|
+
const response = await rawClient.get(`/posts/${id}/rsvp/export${query}`);
|
|
162
|
+
|
|
163
|
+
if (!response.ok) {
|
|
164
|
+
throw { ...(await response.json()), status: response.status };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return response.text();
|
|
168
|
+
},
|
|
143
169
|
});
|
|
144
170
|
|
|
145
171
|
const eventFeeds = (rawClient: FetchClient): EventFeeds => ({
|
|
@@ -160,6 +186,12 @@ const eventFeeds = (rawClient: FetchClient): EventFeeds => ({
|
|
|
160
186
|
undefined,
|
|
161
187
|
OffsetInfiniteQueryParams
|
|
162
188
|
>(rawClient, '/posts/feeds/events/my/past'),
|
|
189
|
+
/** Date-range feed for calendar views. */
|
|
190
|
+
range: allpeepNoPayloadEndpoint<
|
|
191
|
+
PublicPost[],
|
|
192
|
+
undefined,
|
|
193
|
+
EventRangeQueryParams
|
|
194
|
+
>(rawClient, '/posts/feeds/events/my/range'),
|
|
163
195
|
},
|
|
164
196
|
upcoming: allpeepNoPayloadEndpoint<
|
|
165
197
|
PublicPost[],
|
|
@@ -176,6 +208,12 @@ const eventFeeds = (rawClient: FetchClient): EventFeeds => ({
|
|
|
176
208
|
undefined,
|
|
177
209
|
OffsetInfiniteQueryParams
|
|
178
210
|
>(rawClient, '/posts/feeds/events/past'),
|
|
211
|
+
/** Date-range feed for calendar views. */
|
|
212
|
+
range: allpeepNoPayloadEndpoint<
|
|
213
|
+
PublicPost[],
|
|
214
|
+
undefined,
|
|
215
|
+
EventRangeQueryParams
|
|
216
|
+
>(rawClient, '/posts/feeds/events/range'),
|
|
179
217
|
group: {
|
|
180
218
|
upcoming: allpeepNoPayloadEndpoint<
|
|
181
219
|
PublicPost[],
|
|
@@ -187,6 +225,12 @@ const eventFeeds = (rawClient: FetchClient): EventFeeds => ({
|
|
|
187
225
|
{ groupId: string },
|
|
188
226
|
OffsetInfiniteQueryParams
|
|
189
227
|
>(rawClient, '/posts/feeds/events/by-group/:groupId/past'),
|
|
228
|
+
/** Date-range feed for calendar views. */
|
|
229
|
+
range: allpeepNoPayloadEndpoint<
|
|
230
|
+
PublicPost[],
|
|
231
|
+
{ groupId: string },
|
|
232
|
+
EventRangeQueryParams
|
|
233
|
+
>(rawClient, '/posts/feeds/events/by-group/:groupId/range'),
|
|
190
234
|
},
|
|
191
235
|
},
|
|
192
236
|
});
|
|
@@ -197,13 +241,16 @@ type EventFeeds = {
|
|
|
197
241
|
upcoming: OffsetPosts;
|
|
198
242
|
current: OffsetPosts;
|
|
199
243
|
past: OffsetPosts;
|
|
244
|
+
range: RangePosts;
|
|
200
245
|
};
|
|
201
246
|
upcoming: OffsetPosts;
|
|
202
247
|
current: OffsetPosts;
|
|
203
248
|
past: OffsetPosts;
|
|
249
|
+
range: RangePosts;
|
|
204
250
|
group: {
|
|
205
251
|
upcoming: GroupOffsetPosts;
|
|
206
252
|
past: GroupOffsetPosts;
|
|
253
|
+
range: GroupRangePosts;
|
|
207
254
|
};
|
|
208
255
|
};
|
|
209
256
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
|
-
import type {
|
|
3
|
-
FetchUrlResponse,
|
|
4
|
-
} from '@openpeepshq/common';
|
|
2
|
+
import type { FetchUrlResponse } from '@openpeepshq/common';
|
|
5
3
|
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
6
4
|
|
|
7
|
-
export const previewLink = (rawClient: FetchClient) =>
|
|
5
|
+
export const previewLink = (rawClient: FetchClient) =>
|
|
6
|
+
allpeepNoPayloadEndpoint<FetchUrlResponse, { url: string }>(
|
|
8
7
|
rawClient,
|
|
9
8
|
'/fetch-url/:url',
|
|
10
|
-
);
|
|
9
|
+
);
|
package/src/endpoints/reports.ts
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
ReportCreationData,
|
|
4
|
+
PublicReport,
|
|
5
|
+
SuccessResponse,
|
|
6
6
|
} from '@openpeepshq/common';
|
|
7
7
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
8
8
|
|
|
9
9
|
export const reports = (rawClient: FetchClient) => ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
delete
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'delete',
|
|
31
|
-
),
|
|
32
|
-
});
|
|
10
|
+
list: allpeepNoPayloadEndpoint<PublicReport[]>(rawClient, '/reports'),
|
|
11
|
+
findById: allpeepNoPayloadEndpoint<PublicReport, { reportId: string }>(
|
|
12
|
+
rawClient,
|
|
13
|
+
'/reports/:reportId',
|
|
14
|
+
),
|
|
15
|
+
create: allpeepPayloadEndpoint<PublicReport, ReportCreationData>(
|
|
16
|
+
rawClient,
|
|
17
|
+
'/reports',
|
|
18
|
+
),
|
|
19
|
+
update: allpeepPayloadEndpoint<
|
|
20
|
+
PublicReport,
|
|
21
|
+
Partial<ReportCreationData>,
|
|
22
|
+
{ id: string }
|
|
23
|
+
>(rawClient, '/reports/:id', 'patch'),
|
|
24
|
+
delete: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
|
|
25
|
+
rawClient,
|
|
26
|
+
'/reports/:id',
|
|
27
|
+
'delete',
|
|
28
|
+
),
|
|
29
|
+
});
|
package/src/endpoints/search.ts
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
|
-
import { FetchClient } from
|
|
2
|
-
import { allpeepNoPayloadEndpoint } from
|
|
3
|
-
import {
|
|
1
|
+
import { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
|
+
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
3
|
+
import {
|
|
4
|
+
GroupWithMeta,
|
|
5
|
+
PublicPost,
|
|
6
|
+
OffsetInfiniteQueryParams,
|
|
7
|
+
PublicProfile,
|
|
8
|
+
SearchResult,
|
|
9
|
+
SearchResultCounts,
|
|
10
|
+
} from '@openpeepshq/common';
|
|
4
11
|
|
|
5
12
|
type SearchQueryParams = OffsetInfiniteQueryParams & {
|
|
6
|
-
|
|
7
|
-
}
|
|
13
|
+
q: string;
|
|
14
|
+
};
|
|
8
15
|
|
|
9
16
|
export const search = (rawClient: FetchClient) => ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
posts: allpeepNoPayloadEndpoint<
|
|
18
|
+
SearchResult<PublicPost>,
|
|
19
|
+
undefined,
|
|
20
|
+
SearchQueryParams
|
|
21
|
+
>(rawClient, '/search/posts'),
|
|
22
|
+
profiles: allpeepNoPayloadEndpoint<
|
|
23
|
+
SearchResult<PublicProfile>,
|
|
24
|
+
undefined,
|
|
25
|
+
SearchQueryParams
|
|
26
|
+
>(rawClient, '/search/profiles'),
|
|
27
|
+
events: allpeepNoPayloadEndpoint<
|
|
28
|
+
SearchResult<PublicPost>,
|
|
29
|
+
undefined,
|
|
30
|
+
SearchQueryParams
|
|
31
|
+
>(rawClient, '/search/events'),
|
|
32
|
+
jams: allpeepNoPayloadEndpoint<
|
|
33
|
+
SearchResult<PublicPost>,
|
|
34
|
+
undefined,
|
|
35
|
+
SearchQueryParams
|
|
36
|
+
>(rawClient, '/search/jams'),
|
|
37
|
+
groups: allpeepNoPayloadEndpoint<
|
|
38
|
+
SearchResult<GroupWithMeta>,
|
|
39
|
+
undefined,
|
|
40
|
+
SearchQueryParams
|
|
41
|
+
>(rawClient, '/search/groups'),
|
|
42
|
+
counts: allpeepNoPayloadEndpoint<
|
|
43
|
+
SearchResultCounts,
|
|
44
|
+
undefined,
|
|
45
|
+
SearchQueryParams
|
|
46
|
+
>(rawClient, '/search/counts'),
|
|
47
|
+
});
|
package/src/endpoints/server.ts
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
CapabilitiesConfig,
|
|
4
|
+
ServerInfo,
|
|
5
|
+
WebhookKeyResponse,
|
|
6
|
+
WebhookVerifyRequest,
|
|
7
|
+
WebhookVerifyResponse,
|
|
8
8
|
} from '@openpeepshq/common';
|
|
9
9
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
10
10
|
|
|
11
11
|
export const server = (rawClient: FetchClient) => ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
info: allpeepNoPayloadEndpoint<ServerInfo>(rawClient, '/server/info'),
|
|
13
|
+
config: {
|
|
14
|
+
capabilities: allpeepNoPayloadEndpoint<CapabilitiesConfig>(
|
|
15
|
+
rawClient,
|
|
16
|
+
'/server/config/capabilities',
|
|
15
17
|
),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
verify: allpeepPayloadEndpoint<
|
|
29
|
-
WebhookVerifyResponse,
|
|
30
|
-
WebhookVerifyRequest
|
|
31
|
-
>(
|
|
32
|
-
rawClient,
|
|
33
|
-
'/server/keys/webhooks/verify',
|
|
34
|
-
'post',
|
|
35
|
-
),
|
|
36
|
-
},
|
|
18
|
+
},
|
|
19
|
+
keys: {
|
|
20
|
+
webhooks: {
|
|
21
|
+
public: allpeepNoPayloadEndpoint<WebhookKeyResponse>(
|
|
22
|
+
rawClient,
|
|
23
|
+
'/server/keys/webhooks',
|
|
24
|
+
),
|
|
25
|
+
verify: allpeepPayloadEndpoint<
|
|
26
|
+
WebhookVerifyResponse,
|
|
27
|
+
WebhookVerifyRequest
|
|
28
|
+
>(rawClient, '/server/keys/webhooks/verify', 'post'),
|
|
37
29
|
},
|
|
38
|
-
}
|
|
30
|
+
},
|
|
31
|
+
});
|
package/src/endpoints/sso.ts
CHANGED
|
@@ -3,33 +3,21 @@ import type { TokenResponse } from '@openpeepshq/common';
|
|
|
3
3
|
import { allpeepPayloadEndpoint, allpeepNoPayloadEndpoint } from './helpers';
|
|
4
4
|
|
|
5
5
|
export const sso = (rawClient: FetchClient) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
callback: allpeepNoPayloadEndpoint<
|
|
25
|
-
TokenResponse,
|
|
26
|
-
{ id: string },
|
|
27
|
-
Record<string, string>
|
|
28
|
-
>(
|
|
29
|
-
rawClient,
|
|
30
|
-
'/sso/oidc/{id}/callback',
|
|
31
|
-
'get',
|
|
32
|
-
),
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
);
|
|
6
|
+
generic: {
|
|
7
|
+
authenticate: allpeepPayloadEndpoint<
|
|
8
|
+
TokenResponse,
|
|
9
|
+
{ data: Record<string, string> }
|
|
10
|
+
>(rawClient, '/sso/generic'),
|
|
11
|
+
},
|
|
12
|
+
oidc: {
|
|
13
|
+
authorize: allpeepNoPayloadEndpoint<
|
|
14
|
+
{ data: { redirectUrl: string } },
|
|
15
|
+
{ id: string }
|
|
16
|
+
>(rawClient, '/sso/oidc/{id}/authorize', 'get'),
|
|
17
|
+
callback: allpeepNoPayloadEndpoint<
|
|
18
|
+
TokenResponse,
|
|
19
|
+
{ id: string },
|
|
20
|
+
Record<string, string>
|
|
21
|
+
>(rawClient, '/sso/oidc/{id}/callback', 'get'),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
MediaStreamRequest,
|
|
5
|
-
} from '@openpeepshq/common';
|
|
6
|
-
import {
|
|
7
|
-
allpeepNoPayloadEndpoint,
|
|
8
|
-
allpeepPayloadEndpoint,
|
|
9
|
-
} from './helpers';
|
|
2
|
+
import type { MediaStream, MediaStreamRequest } from '@openpeepshq/common';
|
|
3
|
+
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
10
4
|
|
|
11
5
|
export const streaming = (rawClient: FetchClient) => ({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
vod: {
|
|
7
|
+
/**
|
|
8
|
+
* Request that an HLS VOD stream be produced for a media URL hosted on
|
|
9
|
+
* this server. Idempotent: returns the existing stream's status when
|
|
10
|
+
* called again with the same source URL.
|
|
11
|
+
*/
|
|
12
|
+
create: allpeepPayloadEndpoint<MediaStream, MediaStreamRequest>(
|
|
13
|
+
rawClient,
|
|
14
|
+
'/streaming/vod',
|
|
15
|
+
'post',
|
|
16
|
+
),
|
|
17
|
+
/** Polls the current status of a previously-created VOD stream. */
|
|
18
|
+
status: allpeepNoPayloadEndpoint<MediaStream, { storageId: string }>(
|
|
19
|
+
rawClient,
|
|
20
|
+
'/streaming/vod/:storageId/status',
|
|
21
|
+
),
|
|
22
|
+
},
|
|
29
23
|
});
|
package/src/webhooks/index.ts
CHANGED
|
@@ -7,18 +7,14 @@ import {
|
|
|
7
7
|
import { parseJwtKeyId, verifyJwt } from '@openpeepshq/common/lib';
|
|
8
8
|
import type { OpenpeepsNoPayloadEndpoint } from '../types';
|
|
9
9
|
|
|
10
|
-
export type WebhookHandler = (
|
|
11
|
-
input: string,
|
|
12
|
-
) => Promise<WebhookData>);
|
|
10
|
+
export type WebhookHandler = (input: string) => Promise<WebhookData>;
|
|
13
11
|
|
|
14
12
|
export const webhookHandler = (
|
|
15
13
|
publicKeyEndpoint: OpenpeepsNoPayloadEndpoint<WebhookKeyResponse>,
|
|
16
14
|
): WebhookHandler => {
|
|
17
|
-
|
|
18
|
-
let publicKey: string | undefined = undefined;
|
|
15
|
+
const publicKey: string | undefined = undefined;
|
|
19
16
|
|
|
20
17
|
const getPublicKey = async (kid?: string) => {
|
|
21
|
-
|
|
22
18
|
if (!kid) {
|
|
23
19
|
throw new Error('Kid is required');
|
|
24
20
|
}
|
|
@@ -34,8 +30,7 @@ export const webhookHandler = (
|
|
|
34
30
|
return result.data.publicKey;
|
|
35
31
|
};
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
return (async (input: string | WebhookVerifyRequest) => {
|
|
33
|
+
return async (input: string | WebhookVerifyRequest) => {
|
|
39
34
|
const token = typeof input === 'string' ? input : input.token;
|
|
40
35
|
const tokenKeyId = parseJwtKeyId(token);
|
|
41
36
|
|
|
@@ -45,6 +40,5 @@ export const webhookHandler = (
|
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
return webhookDataSchema.parse(verification.payload);
|
|
48
|
-
|
|
49
|
-
});
|
|
43
|
+
};
|
|
50
44
|
};
|