@q9labsai/chalk-client 4.1.14 → 4.1.16
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 +56 -2
- package/dist/access/grant.d.ts +1 -0
- package/dist/access/grant.d.ts.map +1 -1
- package/dist/access/manager.d.ts.map +1 -1
- package/dist/{chunk-JCNUF3DP.js → chunk-BD7FRQ67.js} +2082 -328
- package/dist/{chunk-2NUTY2VP.js → chunk-E4OK5K6N.js} +7 -3
- package/dist/{chunk-NKOKY2AE.js → chunk-EWTITNJ3.js} +15 -101
- package/dist/chunk-HW5TTZL2.js +99 -0
- package/dist/{chunk-HE6CLPZM.js → chunk-M3S7HNQF.js} +1663 -516
- package/dist/{chunk-S5OUHFGC.js → chunk-O7WTAXAY.js} +670 -73
- package/dist/{chunk-PWUU6T3R.js → chunk-OKIL2ELF.js} +1185 -874
- package/dist/chunk-RCDXIDCN.js +33 -0
- package/dist/client.d.ts +1420 -463
- package/dist/client.d.ts.map +1 -1
- package/dist/connection/dependencies.d.ts +10 -0
- package/dist/connection/dependencies.d.ts.map +1 -1
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/index.d.ts.map +1 -1
- package/dist/connection/lifecycle.d.ts.map +1 -1
- package/dist/connection/production.d.ts +4 -1
- package/dist/connection/production.d.ts.map +1 -1
- package/dist/connection/types.d.ts +2 -2
- package/dist/connection/types.d.ts.map +1 -1
- package/dist/effect.js +343 -130
- package/dist/feedback/collector.d.ts +14 -0
- package/dist/feedback/collector.d.ts.map +1 -0
- package/dist/feedback/context.d.ts +38 -0
- package/dist/feedback/context.d.ts.map +1 -0
- package/dist/feedback/controller.d.ts +4 -0
- package/dist/feedback/controller.d.ts.map +1 -0
- package/dist/feedback/index.d.ts +7 -0
- package/dist/feedback/index.d.ts.map +1 -0
- package/dist/feedback/transport.d.ts +29 -0
- package/dist/feedback/transport.d.ts.map +1 -0
- package/dist/feedback/types.d.ts +202 -0
- package/dist/feedback/types.d.ts.map +1 -0
- package/dist/feedback/validation.d.ts +30 -0
- package/dist/feedback/validation.d.ts.map +1 -0
- package/dist/generated/http-api.d.ts +1409 -462
- package/dist/generated/http-api.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +2613 -858
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -15
- package/dist/media/camera-uplink.d.ts +13 -0
- package/dist/media/camera-uplink.d.ts.map +1 -0
- package/dist/media/capture-error.d.ts +27 -0
- package/dist/media/capture-error.d.ts.map +1 -0
- package/dist/media/client.d.ts +4 -0
- package/dist/media/client.d.ts.map +1 -1
- package/dist/media/index.d.ts +1 -0
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +5 -1
- package/dist/media/plane.d.ts +4 -0
- package/dist/media/plane.d.ts.map +1 -1
- package/dist/media/remote-track-response.d.ts +6 -0
- package/dist/media/remote-track-response.d.ts.map +1 -0
- package/dist/media/transport.d.ts.map +1 -1
- package/dist/media/types.d.ts +20 -2
- package/dist/media/types.d.ts.map +1 -1
- package/dist/public-invites/client.d.ts.map +1 -1
- package/dist/public-invites/index.js +4 -3
- package/dist/public-invites/types.d.ts +4 -2
- package/dist/public-invites/types.d.ts.map +1 -1
- package/dist/server/access-refresh.d.cts +8 -0
- package/dist/server/access-refresh.d.ts +9 -0
- package/dist/server/access-refresh.d.ts.map +1 -0
- package/dist/server/client.d.ts.map +1 -1
- package/dist/server/index.cjs +189 -20
- package/dist/server/index.d.cts +2 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +187 -19
- package/dist/server/types.d.cts +74 -0
- package/dist/server/types.d.ts +74 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/space-client/chat-controller.d.ts +3 -0
- package/dist/space-client/chat-controller.d.ts.map +1 -1
- package/dist/space-client/controller-effects.d.ts +6 -0
- package/dist/space-client/controller-effects.d.ts.map +1 -1
- package/dist/space-client/core.d.ts +12 -1
- package/dist/space-client/core.d.ts.map +1 -1
- package/dist/space-client/core.test.helpers.d.ts +1 -0
- package/dist/space-client/core.test.helpers.d.ts.map +1 -1
- package/dist/space-client/effect.d.ts +5 -0
- package/dist/space-client/effect.d.ts.map +1 -1
- package/dist/space-client/episode-diagnostic-runtime.d.ts +3 -0
- package/dist/space-client/episode-diagnostic-runtime.d.ts.map +1 -1
- package/dist/space-client/errors.d.ts.map +1 -1
- package/dist/space-client/index.d.ts +4 -1
- package/dist/space-client/index.d.ts.map +1 -1
- package/dist/space-client/media-controller.d.ts.map +1 -1
- package/dist/space-client/offline-actions-storage.d.ts +66 -0
- package/dist/space-client/offline-actions-storage.d.ts.map +1 -0
- package/dist/space-client/offline-actions.d.ts +36 -0
- package/dist/space-client/offline-actions.d.ts.map +1 -0
- package/dist/space-client/participants-controller.d.ts +2 -1
- package/dist/space-client/participants-controller.d.ts.map +1 -1
- package/dist/space-client/recording-controller.d.ts +20 -0
- package/dist/space-client/recording-controller.d.ts.map +1 -0
- package/dist/space-client/reload-rejoin.d.ts +24 -0
- package/dist/space-client/reload-rejoin.d.ts.map +1 -0
- package/dist/space-client/space-client.d.ts.map +1 -1
- package/dist/space-client/store.d.ts +3 -1
- package/dist/space-client/store.d.ts.map +1 -1
- package/dist/space-client/types.d.ts +40 -4
- package/dist/space-client/types.d.ts.map +1 -1
- package/dist/sync/index.js +2 -1
- package/dist/sync/v1-client.d.ts +1 -5
- package/dist/sync/v1-client.d.ts.map +1 -1
- package/dist/sync/v1-collaboration-state.d.ts +65 -0
- package/dist/sync/v1-collaboration-state.d.ts.map +1 -0
- package/dist/sync/v1-command-scheduler.d.ts +54 -0
- package/dist/sync/v1-command-scheduler.d.ts.map +1 -0
- package/dist/sync/v1-deferred.d.ts +8 -0
- package/dist/sync/v1-deferred.d.ts.map +1 -0
- package/dist/sync/v1-error.d.ts +5 -0
- package/dist/sync/v1-error.d.ts.map +1 -0
- package/dist/sync/v1-frame-signature.d.ts +2 -0
- package/dist/sync/v1-frame-signature.d.ts.map +1 -0
- package/dist/sync/v1-live-target-coordinator.d.ts +32 -0
- package/dist/sync/v1-live-target-coordinator.d.ts.map +1 -0
- package/dist/sync/v1-types.d.ts +3 -0
- package/dist/sync/v1-types.d.ts.map +1 -1
- package/dist/telemetry/index.js +9 -7
- package/dist/telemetry/reconnect.d.ts +7 -0
- package/dist/telemetry/reconnect.d.ts.map +1 -0
- package/dist/telemetry/trace.d.ts +1 -1
- package/dist/telemetry/trace.d.ts.map +1 -1
- package/dist/whiteboard/v1-client.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -22,7 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ChalkAPIError: () => ChalkAPIError,
|
|
24
24
|
ChalkServerOnlyError: () => ChalkServerOnlyError,
|
|
25
|
-
createChalkServerClient: () => createChalkServerClient
|
|
25
|
+
createChalkServerClient: () => createChalkServerClient,
|
|
26
|
+
getAccessRefreshState: () => getAccessRefreshState
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(index_exports);
|
|
28
29
|
|
|
@@ -110,9 +111,11 @@ var AccessGrantError = class extends TypeError {
|
|
|
110
111
|
function parseParsedAccessGrant(value) {
|
|
111
112
|
if (!isRecord2(value)) throw new AccessGrantError();
|
|
112
113
|
const subject = parseSubject(value.subject);
|
|
114
|
+
const episodeStartedAt = parseOptionalDateTime(value.episode_started_at);
|
|
113
115
|
const diagnostics = parseEpisodeDiagnosticCredential(value.diagnostics);
|
|
114
116
|
return {
|
|
115
117
|
subject,
|
|
118
|
+
episodeStartedAt,
|
|
116
119
|
sync: parseSyncAccess(value.sync),
|
|
117
120
|
media: parseMediaAccess(value.media),
|
|
118
121
|
diagnostics: diagnostics?.generation === subject.participantGeneration ? diagnostics : null
|
|
@@ -130,6 +133,7 @@ function accessGrantFromParsed(value) {
|
|
|
130
133
|
participant_id: value.subject.participantId,
|
|
131
134
|
participant_generation: value.subject.participantGeneration
|
|
132
135
|
},
|
|
136
|
+
...value.episodeStartedAt ? { episode_started_at: value.episodeStartedAt } : {},
|
|
133
137
|
sync: { token: value.sync.token, expires_at: value.sync.expiresAt },
|
|
134
138
|
media: {
|
|
135
139
|
token: value.media.token,
|
|
@@ -226,6 +230,10 @@ function requireDateTime(value) {
|
|
|
226
230
|
if (!Number.isFinite(Date.parse(dateTime))) throw new AccessGrantError();
|
|
227
231
|
return dateTime;
|
|
228
232
|
}
|
|
233
|
+
function parseOptionalDateTime(value) {
|
|
234
|
+
if (typeof value !== "string" || value.trim() === "" || !Number.isFinite(Date.parse(value))) return null;
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
229
237
|
function requireNonEmptyString(value) {
|
|
230
238
|
if (typeof value !== "string" || value.trim().length === 0) throw new AccessGrantError();
|
|
231
239
|
return value;
|
|
@@ -234,6 +242,15 @@ function isRecord2(value) {
|
|
|
234
242
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
235
243
|
}
|
|
236
244
|
|
|
245
|
+
// src/server/access-refresh.ts
|
|
246
|
+
function getAccessRefreshState(access) {
|
|
247
|
+
const grant = parseParsedAccessGrant(access);
|
|
248
|
+
return Object.freeze({
|
|
249
|
+
participantGeneration: grant.subject.participantGeneration,
|
|
250
|
+
currentMediaToken: grant.media.token
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
237
254
|
// src/server/errors.ts
|
|
238
255
|
var safeCodePattern = /^[a-z][a-z0-9_.-]{0,63}$/u;
|
|
239
256
|
var safeRequestIdPattern = /^[A-Za-z0-9._:-]{1,128}$/u;
|
|
@@ -417,15 +434,62 @@ function createChalkServerClient(options) {
|
|
|
417
434
|
const request = createServerRequester(options, apiKey, apiBaseURL, fetchImplementation);
|
|
418
435
|
return {
|
|
419
436
|
spaces: {
|
|
420
|
-
archive: (spaceId) => request({
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
437
|
+
archive: (spaceId) => request({
|
|
438
|
+
method: "POST",
|
|
439
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/archive`,
|
|
440
|
+
expectedStatus: 200,
|
|
441
|
+
retry: "always"
|
|
442
|
+
}),
|
|
443
|
+
create: (input, idempotency) => request({
|
|
444
|
+
method: "POST",
|
|
445
|
+
path: `${tenantPath}/spaces`,
|
|
446
|
+
body: createSpaceRequest(input),
|
|
447
|
+
expectedStatus: 201,
|
|
448
|
+
idempotency,
|
|
449
|
+
retry: "caller_idempotency"
|
|
450
|
+
}),
|
|
451
|
+
get: (spaceId) => request({
|
|
452
|
+
method: "GET",
|
|
453
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}`,
|
|
454
|
+
expectedStatus: 200,
|
|
455
|
+
retry: "always"
|
|
456
|
+
}),
|
|
457
|
+
list: (input) => request({
|
|
458
|
+
method: "GET",
|
|
459
|
+
path: `${tenantPath}/spaces${spaceQuery(input)}`,
|
|
460
|
+
expectedStatus: 200,
|
|
461
|
+
retry: "always"
|
|
462
|
+
}),
|
|
463
|
+
restore: (spaceId) => request({
|
|
464
|
+
method: "POST",
|
|
465
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/restore`,
|
|
466
|
+
expectedStatus: 200,
|
|
467
|
+
retry: "always"
|
|
468
|
+
}),
|
|
469
|
+
update: (spaceId, input) => request({
|
|
470
|
+
method: "PATCH",
|
|
471
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}`,
|
|
472
|
+
body: spaceUpdateRequest(input),
|
|
473
|
+
expectedStatus: 200,
|
|
474
|
+
retry: "always"
|
|
475
|
+
})
|
|
425
476
|
},
|
|
426
477
|
episodes: {
|
|
427
|
-
create: (spaceId, input, idempotency) => request({
|
|
428
|
-
|
|
478
|
+
create: (spaceId, input, idempotency) => request({
|
|
479
|
+
method: "POST",
|
|
480
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/episodes`,
|
|
481
|
+
body: createEpisodeRequest(input),
|
|
482
|
+
expectedStatus: 201,
|
|
483
|
+
idempotency,
|
|
484
|
+
retry: "caller_idempotency"
|
|
485
|
+
}),
|
|
486
|
+
end: (spaceId, episodeId, idempotency) => request({
|
|
487
|
+
method: "POST",
|
|
488
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/episodes/${segment(episodeId)}/end`,
|
|
489
|
+
expectedStatus: 202,
|
|
490
|
+
idempotency,
|
|
491
|
+
retry: "caller_idempotency"
|
|
492
|
+
})
|
|
429
493
|
},
|
|
430
494
|
participants: {
|
|
431
495
|
admit: async (spaceId, episodeId, input, idempotency) => {
|
|
@@ -459,20 +523,107 @@ function createChalkServerClient(options) {
|
|
|
459
523
|
})
|
|
460
524
|
},
|
|
461
525
|
apiKeys: {
|
|
462
|
-
create: (input) => request({
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
526
|
+
create: (input) => request({
|
|
527
|
+
method: "POST",
|
|
528
|
+
path: `${tenantPath}/api-keys`,
|
|
529
|
+
body: apiKeyCreateRequest(input),
|
|
530
|
+
expectedStatus: 201,
|
|
531
|
+
retry: "never"
|
|
532
|
+
}),
|
|
533
|
+
list: (input) => request({
|
|
534
|
+
method: "GET",
|
|
535
|
+
path: `${tenantPath}/api-keys${apiKeyQuery(input)}`,
|
|
536
|
+
expectedStatus: 200,
|
|
537
|
+
retry: "always"
|
|
538
|
+
}),
|
|
539
|
+
rotate: (apiKeyId, input) => request({
|
|
540
|
+
method: "POST",
|
|
541
|
+
path: `${tenantPath}/api-keys/${segment(apiKeyId)}/rotate`,
|
|
542
|
+
body: { expires_at: input?.expiresAt },
|
|
543
|
+
expectedStatus: 200,
|
|
544
|
+
retry: "never"
|
|
545
|
+
}),
|
|
546
|
+
revoke: (apiKeyId) => request({
|
|
547
|
+
method: "DELETE",
|
|
548
|
+
path: `${tenantPath}/api-keys/${segment(apiKeyId)}`,
|
|
549
|
+
expectedStatus: 204,
|
|
550
|
+
retry: "always"
|
|
551
|
+
})
|
|
552
|
+
},
|
|
553
|
+
recordings: {
|
|
554
|
+
list: (input) => request({
|
|
555
|
+
method: "GET",
|
|
556
|
+
path: `${tenantPath}/recordings${recordingQuery(input)}`,
|
|
557
|
+
expectedStatus: 200,
|
|
558
|
+
retry: "always"
|
|
559
|
+
}),
|
|
560
|
+
get: (recordingId) => request({
|
|
561
|
+
method: "GET",
|
|
562
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}`,
|
|
563
|
+
expectedStatus: 200,
|
|
564
|
+
retry: "always"
|
|
565
|
+
}),
|
|
566
|
+
requestExport: (recordingId) => request({
|
|
567
|
+
method: "POST",
|
|
568
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}/export`,
|
|
569
|
+
body: {},
|
|
570
|
+
expectedStatus: 202,
|
|
571
|
+
retry: "always"
|
|
572
|
+
}),
|
|
573
|
+
createDownloadURL: (recordingId, input) => request({
|
|
574
|
+
method: "POST",
|
|
575
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}/download-url`,
|
|
576
|
+
body: {
|
|
577
|
+
expires_in_seconds: input.expiresInSeconds,
|
|
578
|
+
...input.download === void 0 ? {} : { download: input.download }
|
|
579
|
+
},
|
|
580
|
+
expectedStatus: 200,
|
|
581
|
+
retry: "always"
|
|
582
|
+
})
|
|
466
583
|
},
|
|
467
584
|
publicInvites: {
|
|
468
|
-
get: (spaceId) => request({
|
|
469
|
-
|
|
470
|
-
|
|
585
|
+
get: (spaceId) => request({
|
|
586
|
+
method: "GET",
|
|
587
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`,
|
|
588
|
+
expectedStatus: 200,
|
|
589
|
+
retry: "always"
|
|
590
|
+
}),
|
|
591
|
+
update: (spaceId, input) => request({
|
|
592
|
+
method: "PATCH",
|
|
593
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`,
|
|
594
|
+
body: publicInviteUpdateRequest(input),
|
|
595
|
+
expectedStatus: 200,
|
|
596
|
+
retry: "always"
|
|
597
|
+
}),
|
|
598
|
+
rotate: (spaceId, idempotency) => request({
|
|
599
|
+
method: "POST",
|
|
600
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite/rotations`,
|
|
601
|
+
expectedStatus: 201,
|
|
602
|
+
idempotency,
|
|
603
|
+
retry: "caller_idempotency"
|
|
604
|
+
})
|
|
471
605
|
},
|
|
472
606
|
publicAdmissionRequests: {
|
|
473
|
-
list: (spaceId, input) => request({
|
|
474
|
-
|
|
475
|
-
|
|
607
|
+
list: (spaceId, input) => request({
|
|
608
|
+
method: "GET",
|
|
609
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests${publicAdmissionRequestQuery(input)}`,
|
|
610
|
+
expectedStatus: 200,
|
|
611
|
+
retry: "always"
|
|
612
|
+
}),
|
|
613
|
+
approve: (spaceId, requestHandle, idempotency) => request({
|
|
614
|
+
method: "POST",
|
|
615
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/approval`,
|
|
616
|
+
expectedStatus: 200,
|
|
617
|
+
idempotency,
|
|
618
|
+
retry: "caller_idempotency"
|
|
619
|
+
}),
|
|
620
|
+
deny: (spaceId, requestHandle, idempotency) => request({
|
|
621
|
+
method: "POST",
|
|
622
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/denial`,
|
|
623
|
+
expectedStatus: 200,
|
|
624
|
+
idempotency,
|
|
625
|
+
retry: "caller_idempotency"
|
|
626
|
+
})
|
|
476
627
|
}
|
|
477
628
|
};
|
|
478
629
|
}
|
|
@@ -486,7 +637,15 @@ function createSpaceRequest(input) {
|
|
|
486
637
|
slug: input.slug,
|
|
487
638
|
...input.admissionPolicy === void 0 ? {} : { admission_policy: input.admissionPolicy },
|
|
488
639
|
...input.metadata === void 0 ? {} : { metadata: input.metadata },
|
|
489
|
-
...input.
|
|
640
|
+
...input.recordingPolicy === void 0 ? {} : { recording_policy: input.recordingPolicy },
|
|
641
|
+
...input.recurringPolicy === void 0 ? {} : { recurring_policy: input.recurringPolicy },
|
|
642
|
+
...input.transcriptionPolicy === void 0 ? {} : { transcription_policy: input.transcriptionPolicy }
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function spaceUpdateRequest(input) {
|
|
646
|
+
return {
|
|
647
|
+
...input.recordingPolicy === void 0 ? {} : { recording_policy: input.recordingPolicy },
|
|
648
|
+
...input.transcriptionPolicy === void 0 ? {} : { transcription_policy: input.transcriptionPolicy }
|
|
490
649
|
};
|
|
491
650
|
}
|
|
492
651
|
function createEpisodeRequest(input) {
|
|
@@ -533,6 +692,14 @@ function apiKeyQuery(input) {
|
|
|
533
692
|
setQueryValue(query, "page_size", input?.pageSize);
|
|
534
693
|
return prefixedQuery(query.toString());
|
|
535
694
|
}
|
|
695
|
+
function recordingQuery(input) {
|
|
696
|
+
const query = new URLSearchParams();
|
|
697
|
+
setQueryValue(query, "cursor", input?.cursor);
|
|
698
|
+
setQueryValue(query, "episode_id", input?.episodeId);
|
|
699
|
+
setQueryValue(query, "page_size", input?.pageSize);
|
|
700
|
+
setQueryValue(query, "space_id", input?.spaceId);
|
|
701
|
+
return prefixedQuery(query.toString());
|
|
702
|
+
}
|
|
536
703
|
function publicAdmissionRequestQuery(input) {
|
|
537
704
|
const query = new URLSearchParams();
|
|
538
705
|
setQueryValue(query, "state", input?.state);
|
|
@@ -568,6 +735,7 @@ function participantLifecycle(value) {
|
|
|
568
735
|
function accessGrant(value) {
|
|
569
736
|
const payload = mediaClientPayload2(value.media);
|
|
570
737
|
return parseAccessGrant({
|
|
738
|
+
episode_started_at: value.episode_started_at,
|
|
571
739
|
subject: {
|
|
572
740
|
tenant_id: value.subject.tenant_id,
|
|
573
741
|
space_id: requiredResponseID(value.subject.space_id),
|
|
@@ -612,5 +780,6 @@ function invalidResponse(status) {
|
|
|
612
780
|
0 && (module.exports = {
|
|
613
781
|
ChalkAPIError,
|
|
614
782
|
ChalkServerOnlyError,
|
|
615
|
-
createChalkServerClient
|
|
783
|
+
createChalkServerClient,
|
|
784
|
+
getAccessRefreshState
|
|
616
785
|
});
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { getAccessRefreshState, type AccessRefreshState } from "./access-refresh.cjs";
|
|
1
2
|
export { createChalkServerClient } from "./client.cjs";
|
|
2
3
|
export { ChalkAPIError, ChalkServerOnlyError } from "./errors.cjs";
|
|
3
|
-
export type { APIKey, APIKeyList, APIKeyWithSecret, AdmitParticipantInput, ChalkIdempotencyOptions, ChalkServerClient, ChalkServerClientOptions, ChalkServerHeaders, ChalkServerTelemetry, CreateAPIKeyInput, CreateEpisodeInput, CreateSpaceInput, Episode, EpisodeEnd, IssueAccessGrantInput, ListPublicAdmissionRequestsInput, ListAPIKeysInput, ListSpacesInput, AccessGrant, ParticipantLifecycle, ParticipantRemoval, PublicAdmissionRequest, PublicAdmissionRequestPage, RemoveParticipantInput, RotateAPIKeyInput, Space, SpacePublicInvite, SpaceList, UpdateSpacePublicInviteInput, } from "./types.cjs";
|
|
4
|
+
export type { APIKey, APIKeyList, APIKeyWithSecret, AdmitParticipantInput, ChalkIdempotencyOptions, ChalkServerClient, ChalkServerClientOptions, ChalkServerHeaders, ChalkServerTelemetry, CreateAPIKeyInput, CreateEpisodeInput, CreateRecordingDownloadURLInput, CreateSpaceInput, Episode, EpisodeEnd, IssueAccessGrantInput, ListPublicAdmissionRequestsInput, ListRecordingsInput, ListAPIKeysInput, ListSpacesInput, AccessGrant, ParticipantLifecycle, ParticipantRemoval, PublicAdmissionRequest, PublicAdmissionRequestPage, Recording, RecordingDownloadURL, RecordingExport, RecordingExportRequestAcceptedResponse, RecordingExportStatus, RecordingList, RecordingSource, RecordingSourceStatus, RecordingPolicy, RemoveParticipantInput, RotateAPIKeyInput, Space, SpacePublicInvite, SpaceList, TranscriptionPolicy, UpdateSpaceInput, UpdateSpacePublicInviteInput, } from "./types.cjs";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
export { getAccessRefreshState, type AccessRefreshState } from "./access-refresh.js";
|
|
1
2
|
export { createChalkServerClient } from "./client.js";
|
|
2
3
|
export { ChalkAPIError, ChalkServerOnlyError } from "./errors.js";
|
|
3
|
-
export type { APIKey, APIKeyList, APIKeyWithSecret, AdmitParticipantInput, ChalkIdempotencyOptions, ChalkServerClient, ChalkServerClientOptions, ChalkServerHeaders, ChalkServerTelemetry, CreateAPIKeyInput, CreateEpisodeInput, CreateSpaceInput, Episode, EpisodeEnd, IssueAccessGrantInput, ListPublicAdmissionRequestsInput, ListAPIKeysInput, ListSpacesInput, AccessGrant, ParticipantLifecycle, ParticipantRemoval, PublicAdmissionRequest, PublicAdmissionRequestPage, RemoveParticipantInput, RotateAPIKeyInput, Space, SpacePublicInvite, SpaceList, UpdateSpacePublicInviteInput, } from "./types.js";
|
|
4
|
+
export type { APIKey, APIKeyList, APIKeyWithSecret, AdmitParticipantInput, ChalkIdempotencyOptions, ChalkServerClient, ChalkServerClientOptions, ChalkServerHeaders, ChalkServerTelemetry, CreateAPIKeyInput, CreateEpisodeInput, CreateRecordingDownloadURLInput, CreateSpaceInput, Episode, EpisodeEnd, IssueAccessGrantInput, ListPublicAdmissionRequestsInput, ListRecordingsInput, ListAPIKeysInput, ListSpacesInput, AccessGrant, ParticipantLifecycle, ParticipantRemoval, PublicAdmissionRequest, PublicAdmissionRequestPage, Recording, RecordingDownloadURL, RecordingExport, RecordingExportRequestAcceptedResponse, RecordingExportStatus, RecordingList, RecordingSource, RecordingSourceStatus, RecordingPolicy, RemoveParticipantInput, RotateAPIKeyInput, Space, SpacePublicInvite, SpaceList, TranscriptionPolicy, UpdateSpaceInput, UpdateSpacePublicInviteInput, } from "./types.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,gCAAgC,EAChC,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,+BAA+B,EAC/B,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,gCAAgC,EAChC,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,sCAAsC,EACtC,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -89,9 +89,11 @@ var AccessGrantError = class extends TypeError {
|
|
|
89
89
|
function parseParsedAccessGrant(value) {
|
|
90
90
|
if (!isRecord2(value)) throw new AccessGrantError();
|
|
91
91
|
const subject = parseSubject(value.subject);
|
|
92
|
+
const episodeStartedAt = parseOptionalDateTime(value.episode_started_at);
|
|
92
93
|
const diagnostics = parseEpisodeDiagnosticCredential(value.diagnostics);
|
|
93
94
|
return {
|
|
94
95
|
subject,
|
|
96
|
+
episodeStartedAt,
|
|
95
97
|
sync: parseSyncAccess(value.sync),
|
|
96
98
|
media: parseMediaAccess(value.media),
|
|
97
99
|
diagnostics: diagnostics?.generation === subject.participantGeneration ? diagnostics : null
|
|
@@ -109,6 +111,7 @@ function accessGrantFromParsed(value) {
|
|
|
109
111
|
participant_id: value.subject.participantId,
|
|
110
112
|
participant_generation: value.subject.participantGeneration
|
|
111
113
|
},
|
|
114
|
+
...value.episodeStartedAt ? { episode_started_at: value.episodeStartedAt } : {},
|
|
112
115
|
sync: { token: value.sync.token, expires_at: value.sync.expiresAt },
|
|
113
116
|
media: {
|
|
114
117
|
token: value.media.token,
|
|
@@ -205,6 +208,10 @@ function requireDateTime(value) {
|
|
|
205
208
|
if (!Number.isFinite(Date.parse(dateTime))) throw new AccessGrantError();
|
|
206
209
|
return dateTime;
|
|
207
210
|
}
|
|
211
|
+
function parseOptionalDateTime(value) {
|
|
212
|
+
if (typeof value !== "string" || value.trim() === "" || !Number.isFinite(Date.parse(value))) return null;
|
|
213
|
+
return value;
|
|
214
|
+
}
|
|
208
215
|
function requireNonEmptyString(value) {
|
|
209
216
|
if (typeof value !== "string" || value.trim().length === 0) throw new AccessGrantError();
|
|
210
217
|
return value;
|
|
@@ -213,6 +220,15 @@ function isRecord2(value) {
|
|
|
213
220
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
214
221
|
}
|
|
215
222
|
|
|
223
|
+
// src/server/access-refresh.ts
|
|
224
|
+
function getAccessRefreshState(access) {
|
|
225
|
+
const grant = parseParsedAccessGrant(access);
|
|
226
|
+
return Object.freeze({
|
|
227
|
+
participantGeneration: grant.subject.participantGeneration,
|
|
228
|
+
currentMediaToken: grant.media.token
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
216
232
|
// src/server/transport.ts
|
|
217
233
|
var retryableStatuses = /* @__PURE__ */ new Set([429, 502, 503, 504]);
|
|
218
234
|
var maxRetries = 2;
|
|
@@ -341,15 +357,62 @@ function createChalkServerClient(options) {
|
|
|
341
357
|
const request = createServerRequester(options, apiKey, apiBaseURL, fetchImplementation);
|
|
342
358
|
return {
|
|
343
359
|
spaces: {
|
|
344
|
-
archive: (spaceId) => request({
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
360
|
+
archive: (spaceId) => request({
|
|
361
|
+
method: "POST",
|
|
362
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/archive`,
|
|
363
|
+
expectedStatus: 200,
|
|
364
|
+
retry: "always"
|
|
365
|
+
}),
|
|
366
|
+
create: (input, idempotency) => request({
|
|
367
|
+
method: "POST",
|
|
368
|
+
path: `${tenantPath}/spaces`,
|
|
369
|
+
body: createSpaceRequest(input),
|
|
370
|
+
expectedStatus: 201,
|
|
371
|
+
idempotency,
|
|
372
|
+
retry: "caller_idempotency"
|
|
373
|
+
}),
|
|
374
|
+
get: (spaceId) => request({
|
|
375
|
+
method: "GET",
|
|
376
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}`,
|
|
377
|
+
expectedStatus: 200,
|
|
378
|
+
retry: "always"
|
|
379
|
+
}),
|
|
380
|
+
list: (input) => request({
|
|
381
|
+
method: "GET",
|
|
382
|
+
path: `${tenantPath}/spaces${spaceQuery(input)}`,
|
|
383
|
+
expectedStatus: 200,
|
|
384
|
+
retry: "always"
|
|
385
|
+
}),
|
|
386
|
+
restore: (spaceId) => request({
|
|
387
|
+
method: "POST",
|
|
388
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/restore`,
|
|
389
|
+
expectedStatus: 200,
|
|
390
|
+
retry: "always"
|
|
391
|
+
}),
|
|
392
|
+
update: (spaceId, input) => request({
|
|
393
|
+
method: "PATCH",
|
|
394
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}`,
|
|
395
|
+
body: spaceUpdateRequest(input),
|
|
396
|
+
expectedStatus: 200,
|
|
397
|
+
retry: "always"
|
|
398
|
+
})
|
|
349
399
|
},
|
|
350
400
|
episodes: {
|
|
351
|
-
create: (spaceId, input, idempotency) => request({
|
|
352
|
-
|
|
401
|
+
create: (spaceId, input, idempotency) => request({
|
|
402
|
+
method: "POST",
|
|
403
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/episodes`,
|
|
404
|
+
body: createEpisodeRequest(input),
|
|
405
|
+
expectedStatus: 201,
|
|
406
|
+
idempotency,
|
|
407
|
+
retry: "caller_idempotency"
|
|
408
|
+
}),
|
|
409
|
+
end: (spaceId, episodeId, idempotency) => request({
|
|
410
|
+
method: "POST",
|
|
411
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/episodes/${segment(episodeId)}/end`,
|
|
412
|
+
expectedStatus: 202,
|
|
413
|
+
idempotency,
|
|
414
|
+
retry: "caller_idempotency"
|
|
415
|
+
})
|
|
353
416
|
},
|
|
354
417
|
participants: {
|
|
355
418
|
admit: async (spaceId, episodeId, input, idempotency) => {
|
|
@@ -383,20 +446,107 @@ function createChalkServerClient(options) {
|
|
|
383
446
|
})
|
|
384
447
|
},
|
|
385
448
|
apiKeys: {
|
|
386
|
-
create: (input) => request({
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
449
|
+
create: (input) => request({
|
|
450
|
+
method: "POST",
|
|
451
|
+
path: `${tenantPath}/api-keys`,
|
|
452
|
+
body: apiKeyCreateRequest(input),
|
|
453
|
+
expectedStatus: 201,
|
|
454
|
+
retry: "never"
|
|
455
|
+
}),
|
|
456
|
+
list: (input) => request({
|
|
457
|
+
method: "GET",
|
|
458
|
+
path: `${tenantPath}/api-keys${apiKeyQuery(input)}`,
|
|
459
|
+
expectedStatus: 200,
|
|
460
|
+
retry: "always"
|
|
461
|
+
}),
|
|
462
|
+
rotate: (apiKeyId, input) => request({
|
|
463
|
+
method: "POST",
|
|
464
|
+
path: `${tenantPath}/api-keys/${segment(apiKeyId)}/rotate`,
|
|
465
|
+
body: { expires_at: input?.expiresAt },
|
|
466
|
+
expectedStatus: 200,
|
|
467
|
+
retry: "never"
|
|
468
|
+
}),
|
|
469
|
+
revoke: (apiKeyId) => request({
|
|
470
|
+
method: "DELETE",
|
|
471
|
+
path: `${tenantPath}/api-keys/${segment(apiKeyId)}`,
|
|
472
|
+
expectedStatus: 204,
|
|
473
|
+
retry: "always"
|
|
474
|
+
})
|
|
475
|
+
},
|
|
476
|
+
recordings: {
|
|
477
|
+
list: (input) => request({
|
|
478
|
+
method: "GET",
|
|
479
|
+
path: `${tenantPath}/recordings${recordingQuery(input)}`,
|
|
480
|
+
expectedStatus: 200,
|
|
481
|
+
retry: "always"
|
|
482
|
+
}),
|
|
483
|
+
get: (recordingId) => request({
|
|
484
|
+
method: "GET",
|
|
485
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}`,
|
|
486
|
+
expectedStatus: 200,
|
|
487
|
+
retry: "always"
|
|
488
|
+
}),
|
|
489
|
+
requestExport: (recordingId) => request({
|
|
490
|
+
method: "POST",
|
|
491
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}/export`,
|
|
492
|
+
body: {},
|
|
493
|
+
expectedStatus: 202,
|
|
494
|
+
retry: "always"
|
|
495
|
+
}),
|
|
496
|
+
createDownloadURL: (recordingId, input) => request({
|
|
497
|
+
method: "POST",
|
|
498
|
+
path: `${tenantPath}/recordings/${segment(recordingId)}/download-url`,
|
|
499
|
+
body: {
|
|
500
|
+
expires_in_seconds: input.expiresInSeconds,
|
|
501
|
+
...input.download === void 0 ? {} : { download: input.download }
|
|
502
|
+
},
|
|
503
|
+
expectedStatus: 200,
|
|
504
|
+
retry: "always"
|
|
505
|
+
})
|
|
390
506
|
},
|
|
391
507
|
publicInvites: {
|
|
392
|
-
get: (spaceId) => request({
|
|
393
|
-
|
|
394
|
-
|
|
508
|
+
get: (spaceId) => request({
|
|
509
|
+
method: "GET",
|
|
510
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`,
|
|
511
|
+
expectedStatus: 200,
|
|
512
|
+
retry: "always"
|
|
513
|
+
}),
|
|
514
|
+
update: (spaceId, input) => request({
|
|
515
|
+
method: "PATCH",
|
|
516
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`,
|
|
517
|
+
body: publicInviteUpdateRequest(input),
|
|
518
|
+
expectedStatus: 200,
|
|
519
|
+
retry: "always"
|
|
520
|
+
}),
|
|
521
|
+
rotate: (spaceId, idempotency) => request({
|
|
522
|
+
method: "POST",
|
|
523
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite/rotations`,
|
|
524
|
+
expectedStatus: 201,
|
|
525
|
+
idempotency,
|
|
526
|
+
retry: "caller_idempotency"
|
|
527
|
+
})
|
|
395
528
|
},
|
|
396
529
|
publicAdmissionRequests: {
|
|
397
|
-
list: (spaceId, input) => request({
|
|
398
|
-
|
|
399
|
-
|
|
530
|
+
list: (spaceId, input) => request({
|
|
531
|
+
method: "GET",
|
|
532
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests${publicAdmissionRequestQuery(input)}`,
|
|
533
|
+
expectedStatus: 200,
|
|
534
|
+
retry: "always"
|
|
535
|
+
}),
|
|
536
|
+
approve: (spaceId, requestHandle, idempotency) => request({
|
|
537
|
+
method: "POST",
|
|
538
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/approval`,
|
|
539
|
+
expectedStatus: 200,
|
|
540
|
+
idempotency,
|
|
541
|
+
retry: "caller_idempotency"
|
|
542
|
+
}),
|
|
543
|
+
deny: (spaceId, requestHandle, idempotency) => request({
|
|
544
|
+
method: "POST",
|
|
545
|
+
path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/denial`,
|
|
546
|
+
expectedStatus: 200,
|
|
547
|
+
idempotency,
|
|
548
|
+
retry: "caller_idempotency"
|
|
549
|
+
})
|
|
400
550
|
}
|
|
401
551
|
};
|
|
402
552
|
}
|
|
@@ -410,7 +560,15 @@ function createSpaceRequest(input) {
|
|
|
410
560
|
slug: input.slug,
|
|
411
561
|
...input.admissionPolicy === void 0 ? {} : { admission_policy: input.admissionPolicy },
|
|
412
562
|
...input.metadata === void 0 ? {} : { metadata: input.metadata },
|
|
413
|
-
...input.
|
|
563
|
+
...input.recordingPolicy === void 0 ? {} : { recording_policy: input.recordingPolicy },
|
|
564
|
+
...input.recurringPolicy === void 0 ? {} : { recurring_policy: input.recurringPolicy },
|
|
565
|
+
...input.transcriptionPolicy === void 0 ? {} : { transcription_policy: input.transcriptionPolicy }
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function spaceUpdateRequest(input) {
|
|
569
|
+
return {
|
|
570
|
+
...input.recordingPolicy === void 0 ? {} : { recording_policy: input.recordingPolicy },
|
|
571
|
+
...input.transcriptionPolicy === void 0 ? {} : { transcription_policy: input.transcriptionPolicy }
|
|
414
572
|
};
|
|
415
573
|
}
|
|
416
574
|
function createEpisodeRequest(input) {
|
|
@@ -457,6 +615,14 @@ function apiKeyQuery(input) {
|
|
|
457
615
|
setQueryValue(query, "page_size", input?.pageSize);
|
|
458
616
|
return prefixedQuery(query.toString());
|
|
459
617
|
}
|
|
618
|
+
function recordingQuery(input) {
|
|
619
|
+
const query = new URLSearchParams();
|
|
620
|
+
setQueryValue(query, "cursor", input?.cursor);
|
|
621
|
+
setQueryValue(query, "episode_id", input?.episodeId);
|
|
622
|
+
setQueryValue(query, "page_size", input?.pageSize);
|
|
623
|
+
setQueryValue(query, "space_id", input?.spaceId);
|
|
624
|
+
return prefixedQuery(query.toString());
|
|
625
|
+
}
|
|
460
626
|
function publicAdmissionRequestQuery(input) {
|
|
461
627
|
const query = new URLSearchParams();
|
|
462
628
|
setQueryValue(query, "state", input?.state);
|
|
@@ -492,6 +658,7 @@ function participantLifecycle(value) {
|
|
|
492
658
|
function accessGrant(value) {
|
|
493
659
|
const payload = mediaClientPayload2(value.media);
|
|
494
660
|
return parseAccessGrant({
|
|
661
|
+
episode_started_at: value.episode_started_at,
|
|
495
662
|
subject: {
|
|
496
663
|
tenant_id: value.subject.tenant_id,
|
|
497
664
|
space_id: requiredResponseID(value.subject.space_id),
|
|
@@ -535,5 +702,6 @@ function invalidResponse(status) {
|
|
|
535
702
|
export {
|
|
536
703
|
ChalkAPIError,
|
|
537
704
|
ChalkServerOnlyError,
|
|
538
|
-
createChalkServerClient
|
|
705
|
+
createChalkServerClient,
|
|
706
|
+
getAccessRefreshState
|
|
539
707
|
};
|