@q9labsai/chalk-client 4.1.15 → 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.
Files changed (130) hide show
  1. package/README.md +56 -2
  2. package/dist/access/manager.d.ts.map +1 -1
  3. package/dist/{chunk-LQSXEWLL.js → chunk-BD7FRQ67.js} +2061 -326
  4. package/dist/{chunk-6ONSFCIY.js → chunk-E4OK5K6N.js} +7 -3
  5. package/dist/{chunk-NKOKY2AE.js → chunk-EWTITNJ3.js} +15 -101
  6. package/dist/chunk-HW5TTZL2.js +99 -0
  7. package/dist/{chunk-LSDDADCN.js → chunk-M3S7HNQF.js} +1656 -517
  8. package/dist/{chunk-PQNSA7ZN.js → chunk-O7WTAXAY.js} +610 -73
  9. package/dist/{chunk-PWUU6T3R.js → chunk-OKIL2ELF.js} +1185 -874
  10. package/dist/chunk-RCDXIDCN.js +33 -0
  11. package/dist/client.d.ts +1412 -463
  12. package/dist/client.d.ts.map +1 -1
  13. package/dist/connection/dependencies.d.ts +10 -0
  14. package/dist/connection/dependencies.d.ts.map +1 -1
  15. package/dist/connection/index.d.ts +2 -0
  16. package/dist/connection/index.d.ts.map +1 -1
  17. package/dist/connection/lifecycle.d.ts.map +1 -1
  18. package/dist/connection/production.d.ts +4 -1
  19. package/dist/connection/production.d.ts.map +1 -1
  20. package/dist/connection/types.d.ts +2 -2
  21. package/dist/connection/types.d.ts.map +1 -1
  22. package/dist/effect.js +343 -130
  23. package/dist/feedback/collector.d.ts +14 -0
  24. package/dist/feedback/collector.d.ts.map +1 -0
  25. package/dist/feedback/context.d.ts +38 -0
  26. package/dist/feedback/context.d.ts.map +1 -0
  27. package/dist/feedback/controller.d.ts +4 -0
  28. package/dist/feedback/controller.d.ts.map +1 -0
  29. package/dist/feedback/index.d.ts +7 -0
  30. package/dist/feedback/index.d.ts.map +1 -0
  31. package/dist/feedback/transport.d.ts +29 -0
  32. package/dist/feedback/transport.d.ts.map +1 -0
  33. package/dist/feedback/types.d.ts +202 -0
  34. package/dist/feedback/types.d.ts.map +1 -0
  35. package/dist/feedback/validation.d.ts +30 -0
  36. package/dist/feedback/validation.d.ts.map +1 -0
  37. package/dist/generated/http-api.d.ts +1401 -462
  38. package/dist/generated/http-api.d.ts.map +1 -1
  39. package/dist/generated/schemas.d.ts +2601 -858
  40. package/dist/generated/schemas.d.ts.map +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +150 -35
  44. package/dist/media/camera-uplink.d.ts +13 -0
  45. package/dist/media/camera-uplink.d.ts.map +1 -0
  46. package/dist/media/capture-error.d.ts +27 -0
  47. package/dist/media/capture-error.d.ts.map +1 -0
  48. package/dist/media/client.d.ts +4 -0
  49. package/dist/media/client.d.ts.map +1 -1
  50. package/dist/media/index.d.ts +1 -0
  51. package/dist/media/index.d.ts.map +1 -1
  52. package/dist/media/index.js +5 -1
  53. package/dist/media/plane.d.ts +4 -0
  54. package/dist/media/plane.d.ts.map +1 -1
  55. package/dist/media/remote-track-response.d.ts +6 -0
  56. package/dist/media/remote-track-response.d.ts.map +1 -0
  57. package/dist/media/transport.d.ts.map +1 -1
  58. package/dist/media/types.d.ts +20 -2
  59. package/dist/media/types.d.ts.map +1 -1
  60. package/dist/public-invites/client.d.ts.map +1 -1
  61. package/dist/public-invites/index.js +4 -3
  62. package/dist/public-invites/types.d.ts +4 -2
  63. package/dist/public-invites/types.d.ts.map +1 -1
  64. package/dist/server/access-refresh.d.cts +8 -0
  65. package/dist/server/access-refresh.d.ts +9 -0
  66. package/dist/server/access-refresh.d.ts.map +1 -0
  67. package/dist/server/client.d.ts.map +1 -1
  68. package/dist/server/index.cjs +181 -20
  69. package/dist/server/index.d.cts +2 -1
  70. package/dist/server/index.d.ts +2 -1
  71. package/dist/server/index.d.ts.map +1 -1
  72. package/dist/server/index.js +179 -19
  73. package/dist/server/types.d.cts +74 -0
  74. package/dist/server/types.d.ts +74 -0
  75. package/dist/server/types.d.ts.map +1 -1
  76. package/dist/space-client/chat-controller.d.ts +3 -0
  77. package/dist/space-client/chat-controller.d.ts.map +1 -1
  78. package/dist/space-client/controller-effects.d.ts +6 -0
  79. package/dist/space-client/controller-effects.d.ts.map +1 -1
  80. package/dist/space-client/core.d.ts +12 -1
  81. package/dist/space-client/core.d.ts.map +1 -1
  82. package/dist/space-client/core.test.helpers.d.ts +1 -0
  83. package/dist/space-client/core.test.helpers.d.ts.map +1 -1
  84. package/dist/space-client/effect.d.ts +5 -0
  85. package/dist/space-client/effect.d.ts.map +1 -1
  86. package/dist/space-client/episode-diagnostic-runtime.d.ts +3 -0
  87. package/dist/space-client/episode-diagnostic-runtime.d.ts.map +1 -1
  88. package/dist/space-client/errors.d.ts.map +1 -1
  89. package/dist/space-client/index.d.ts +4 -1
  90. package/dist/space-client/index.d.ts.map +1 -1
  91. package/dist/space-client/media-controller.d.ts.map +1 -1
  92. package/dist/space-client/offline-actions-storage.d.ts +66 -0
  93. package/dist/space-client/offline-actions-storage.d.ts.map +1 -0
  94. package/dist/space-client/offline-actions.d.ts +36 -0
  95. package/dist/space-client/offline-actions.d.ts.map +1 -0
  96. package/dist/space-client/participants-controller.d.ts +2 -1
  97. package/dist/space-client/participants-controller.d.ts.map +1 -1
  98. package/dist/space-client/recording-controller.d.ts +20 -0
  99. package/dist/space-client/recording-controller.d.ts.map +1 -0
  100. package/dist/space-client/reload-rejoin.d.ts +24 -0
  101. package/dist/space-client/reload-rejoin.d.ts.map +1 -0
  102. package/dist/space-client/space-client.d.ts.map +1 -1
  103. package/dist/space-client/store.d.ts +3 -1
  104. package/dist/space-client/store.d.ts.map +1 -1
  105. package/dist/space-client/types.d.ts +40 -4
  106. package/dist/space-client/types.d.ts.map +1 -1
  107. package/dist/sync/index.js +2 -1
  108. package/dist/sync/v1-client.d.ts +1 -5
  109. package/dist/sync/v1-client.d.ts.map +1 -1
  110. package/dist/sync/v1-collaboration-state.d.ts +65 -0
  111. package/dist/sync/v1-collaboration-state.d.ts.map +1 -0
  112. package/dist/sync/v1-command-scheduler.d.ts +54 -0
  113. package/dist/sync/v1-command-scheduler.d.ts.map +1 -0
  114. package/dist/sync/v1-deferred.d.ts +8 -0
  115. package/dist/sync/v1-deferred.d.ts.map +1 -0
  116. package/dist/sync/v1-error.d.ts +5 -0
  117. package/dist/sync/v1-error.d.ts.map +1 -0
  118. package/dist/sync/v1-frame-signature.d.ts +2 -0
  119. package/dist/sync/v1-frame-signature.d.ts.map +1 -0
  120. package/dist/sync/v1-live-target-coordinator.d.ts +32 -0
  121. package/dist/sync/v1-live-target-coordinator.d.ts.map +1 -0
  122. package/dist/sync/v1-types.d.ts +3 -0
  123. package/dist/sync/v1-types.d.ts.map +1 -1
  124. package/dist/telemetry/index.js +9 -7
  125. package/dist/telemetry/reconnect.d.ts +7 -0
  126. package/dist/telemetry/reconnect.d.ts.map +1 -0
  127. package/dist/telemetry/trace.d.ts +1 -1
  128. package/dist/telemetry/trace.d.ts.map +1 -1
  129. package/dist/whiteboard/v1-client.d.ts.map +1 -1
  130. package/package.json +1 -1
@@ -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
 
@@ -241,6 +242,15 @@ function isRecord2(value) {
241
242
  return typeof value === "object" && value !== null && !Array.isArray(value);
242
243
  }
243
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
+
244
254
  // src/server/errors.ts
245
255
  var safeCodePattern = /^[a-z][a-z0-9_.-]{0,63}$/u;
246
256
  var safeRequestIdPattern = /^[A-Za-z0-9._:-]{1,128}$/u;
@@ -424,15 +434,62 @@ function createChalkServerClient(options) {
424
434
  const request = createServerRequester(options, apiKey, apiBaseURL, fetchImplementation);
425
435
  return {
426
436
  spaces: {
427
- archive: (spaceId) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/archive`, expectedStatus: 200, retry: "always" }),
428
- create: (input, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces`, body: createSpaceRequest(input), expectedStatus: 201, idempotency, retry: "caller_idempotency" }),
429
- get: (spaceId) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}`, expectedStatus: 200, retry: "always" }),
430
- list: (input) => request({ method: "GET", path: `${tenantPath}/spaces${spaceQuery(input)}`, expectedStatus: 200, retry: "always" }),
431
- restore: (spaceId) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/restore`, expectedStatus: 200, retry: "always" })
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
+ })
432
476
  },
433
477
  episodes: {
434
- create: (spaceId, input, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/episodes`, body: createEpisodeRequest(input), expectedStatus: 201, idempotency, retry: "caller_idempotency" }),
435
- end: (spaceId, episodeId, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/episodes/${segment(episodeId)}/end`, expectedStatus: 202, idempotency, retry: "caller_idempotency" })
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
+ })
436
493
  },
437
494
  participants: {
438
495
  admit: async (spaceId, episodeId, input, idempotency) => {
@@ -466,20 +523,107 @@ function createChalkServerClient(options) {
466
523
  })
467
524
  },
468
525
  apiKeys: {
469
- create: (input) => request({ method: "POST", path: `${tenantPath}/api-keys`, body: apiKeyCreateRequest(input), expectedStatus: 201, retry: "never" }),
470
- list: (input) => request({ method: "GET", path: `${tenantPath}/api-keys${apiKeyQuery(input)}`, expectedStatus: 200, retry: "always" }),
471
- rotate: (apiKeyId, input) => request({ method: "POST", path: `${tenantPath}/api-keys/${segment(apiKeyId)}/rotate`, body: { expires_at: input?.expiresAt }, expectedStatus: 200, retry: "never" }),
472
- revoke: (apiKeyId) => request({ method: "DELETE", path: `${tenantPath}/api-keys/${segment(apiKeyId)}`, expectedStatus: 204, retry: "always" })
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
+ })
473
583
  },
474
584
  publicInvites: {
475
- get: (spaceId) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`, expectedStatus: 200, retry: "always" }),
476
- update: (spaceId, input) => request({ method: "PATCH", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`, body: publicInviteUpdateRequest(input), expectedStatus: 200, retry: "always" }),
477
- rotate: (spaceId, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite/rotations`, expectedStatus: 201, idempotency, retry: "caller_idempotency" })
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
+ })
478
605
  },
479
606
  publicAdmissionRequests: {
480
- list: (spaceId, input) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests${publicAdmissionRequestQuery(input)}`, expectedStatus: 200, retry: "always" }),
481
- approve: (spaceId, requestHandle, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/approval`, expectedStatus: 200, idempotency, retry: "caller_idempotency" }),
482
- deny: (spaceId, requestHandle, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/denial`, expectedStatus: 200, idempotency, retry: "caller_idempotency" })
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
+ })
483
627
  }
484
628
  };
485
629
  }
@@ -493,7 +637,15 @@ function createSpaceRequest(input) {
493
637
  slug: input.slug,
494
638
  ...input.admissionPolicy === void 0 ? {} : { admission_policy: input.admissionPolicy },
495
639
  ...input.metadata === void 0 ? {} : { metadata: input.metadata },
496
- ...input.recurringPolicy === void 0 ? {} : { recurring_policy: input.recurringPolicy }
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 }
497
649
  };
498
650
  }
499
651
  function createEpisodeRequest(input) {
@@ -540,6 +692,14 @@ function apiKeyQuery(input) {
540
692
  setQueryValue(query, "page_size", input?.pageSize);
541
693
  return prefixedQuery(query.toString());
542
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
+ }
543
703
  function publicAdmissionRequestQuery(input) {
544
704
  const query = new URLSearchParams();
545
705
  setQueryValue(query, "state", input?.state);
@@ -620,5 +780,6 @@ function invalidResponse(status) {
620
780
  0 && (module.exports = {
621
781
  ChalkAPIError,
622
782
  ChalkServerOnlyError,
623
- createChalkServerClient
783
+ createChalkServerClient,
784
+ getAccessRefreshState
624
785
  });
@@ -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";
@@ -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"}
@@ -220,6 +220,15 @@ function isRecord2(value) {
220
220
  return typeof value === "object" && value !== null && !Array.isArray(value);
221
221
  }
222
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
+
223
232
  // src/server/transport.ts
224
233
  var retryableStatuses = /* @__PURE__ */ new Set([429, 502, 503, 504]);
225
234
  var maxRetries = 2;
@@ -348,15 +357,62 @@ function createChalkServerClient(options) {
348
357
  const request = createServerRequester(options, apiKey, apiBaseURL, fetchImplementation);
349
358
  return {
350
359
  spaces: {
351
- archive: (spaceId) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/archive`, expectedStatus: 200, retry: "always" }),
352
- create: (input, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces`, body: createSpaceRequest(input), expectedStatus: 201, idempotency, retry: "caller_idempotency" }),
353
- get: (spaceId) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}`, expectedStatus: 200, retry: "always" }),
354
- list: (input) => request({ method: "GET", path: `${tenantPath}/spaces${spaceQuery(input)}`, expectedStatus: 200, retry: "always" }),
355
- restore: (spaceId) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/restore`, expectedStatus: 200, retry: "always" })
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
+ })
356
399
  },
357
400
  episodes: {
358
- create: (spaceId, input, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/episodes`, body: createEpisodeRequest(input), expectedStatus: 201, idempotency, retry: "caller_idempotency" }),
359
- end: (spaceId, episodeId, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/episodes/${segment(episodeId)}/end`, expectedStatus: 202, idempotency, retry: "caller_idempotency" })
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
+ })
360
416
  },
361
417
  participants: {
362
418
  admit: async (spaceId, episodeId, input, idempotency) => {
@@ -390,20 +446,107 @@ function createChalkServerClient(options) {
390
446
  })
391
447
  },
392
448
  apiKeys: {
393
- create: (input) => request({ method: "POST", path: `${tenantPath}/api-keys`, body: apiKeyCreateRequest(input), expectedStatus: 201, retry: "never" }),
394
- list: (input) => request({ method: "GET", path: `${tenantPath}/api-keys${apiKeyQuery(input)}`, expectedStatus: 200, retry: "always" }),
395
- rotate: (apiKeyId, input) => request({ method: "POST", path: `${tenantPath}/api-keys/${segment(apiKeyId)}/rotate`, body: { expires_at: input?.expiresAt }, expectedStatus: 200, retry: "never" }),
396
- revoke: (apiKeyId) => request({ method: "DELETE", path: `${tenantPath}/api-keys/${segment(apiKeyId)}`, expectedStatus: 204, retry: "always" })
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
+ })
397
506
  },
398
507
  publicInvites: {
399
- get: (spaceId) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`, expectedStatus: 200, retry: "always" }),
400
- update: (spaceId, input) => request({ method: "PATCH", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite`, body: publicInviteUpdateRequest(input), expectedStatus: 200, retry: "always" }),
401
- rotate: (spaceId, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-invite/rotations`, expectedStatus: 201, idempotency, retry: "caller_idempotency" })
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
+ })
402
528
  },
403
529
  publicAdmissionRequests: {
404
- list: (spaceId, input) => request({ method: "GET", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests${publicAdmissionRequestQuery(input)}`, expectedStatus: 200, retry: "always" }),
405
- approve: (spaceId, requestHandle, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/approval`, expectedStatus: 200, idempotency, retry: "caller_idempotency" }),
406
- deny: (spaceId, requestHandle, idempotency) => request({ method: "POST", path: `${tenantPath}/spaces/${segment(spaceId)}/public-admission-requests/${segment(requestHandle)}/denial`, expectedStatus: 200, idempotency, retry: "caller_idempotency" })
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
+ })
407
550
  }
408
551
  };
409
552
  }
@@ -417,7 +560,15 @@ function createSpaceRequest(input) {
417
560
  slug: input.slug,
418
561
  ...input.admissionPolicy === void 0 ? {} : { admission_policy: input.admissionPolicy },
419
562
  ...input.metadata === void 0 ? {} : { metadata: input.metadata },
420
- ...input.recurringPolicy === void 0 ? {} : { recurring_policy: input.recurringPolicy }
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 }
421
572
  };
422
573
  }
423
574
  function createEpisodeRequest(input) {
@@ -464,6 +615,14 @@ function apiKeyQuery(input) {
464
615
  setQueryValue(query, "page_size", input?.pageSize);
465
616
  return prefixedQuery(query.toString());
466
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
+ }
467
626
  function publicAdmissionRequestQuery(input) {
468
627
  const query = new URLSearchParams();
469
628
  setQueryValue(query, "state", input?.state);
@@ -543,5 +702,6 @@ function invalidResponse(status) {
543
702
  export {
544
703
  ChalkAPIError,
545
704
  ChalkServerOnlyError,
546
- createChalkServerClient
705
+ createChalkServerClient,
706
+ getAccessRefreshState
547
707
  };
@@ -18,6 +18,8 @@ export type ChalkServerClientOptions = {
18
18
  export type ChalkIdempotencyOptions = {
19
19
  readonly idempotencyKey?: string;
20
20
  };
21
+ export type RecordingPolicy = "disabled" | "manual" | "automatic";
22
+ export type TranscriptionPolicy = "disabled" | "on_demand" | "automatic";
21
23
  export type CreateSpaceInput = {
22
24
  readonly admissionPolicy?: unknown;
23
25
  readonly defaultEpisodeDurationSeconds: number;
@@ -26,8 +28,14 @@ export type CreateSpaceInput = {
26
28
  readonly mediaPlane: string;
27
29
  readonly metadata?: unknown;
28
30
  readonly name: string;
31
+ readonly recordingPolicy?: RecordingPolicy;
29
32
  readonly recurringPolicy?: unknown;
30
33
  readonly slug: string;
34
+ readonly transcriptionPolicy?: TranscriptionPolicy;
35
+ };
36
+ export type UpdateSpaceInput = {
37
+ readonly recordingPolicy?: RecordingPolicy;
38
+ readonly transcriptionPolicy?: TranscriptionPolicy;
31
39
  };
32
40
  export type Space = {
33
41
  readonly admission_policy: unknown;
@@ -42,6 +50,7 @@ export type Space = {
42
50
  readonly media_plane: string;
43
51
  readonly metadata: unknown;
44
52
  readonly name: string;
53
+ readonly recording_policy: RecordingPolicy;
45
54
  readonly recurring_policy: unknown;
46
55
  readonly roles: readonly {
47
56
  readonly capabilities: readonly string[];
@@ -50,6 +59,7 @@ export type Space = {
50
59
  }[];
51
60
  readonly slug: string;
52
61
  readonly tenant_id: string;
62
+ readonly transcription_policy: TranscriptionPolicy;
53
63
  readonly updated_at: string;
54
64
  };
55
65
  export type SpaceList = {
@@ -224,6 +234,63 @@ export type UpdateSpacePublicInviteInput = {
224
234
  export type ListPublicAdmissionRequestsInput = {
225
235
  readonly state?: "pending";
226
236
  };
237
+ export type RecordingSourceStatus = "pending" | "available" | "failed" | "expired";
238
+ export type RecordingSource = {
239
+ readonly expires_at?: string | null;
240
+ readonly status: RecordingSourceStatus;
241
+ };
242
+ export type RecordingExportStatus = "none" | "pending" | "ready" | "failed" | "unavailable";
243
+ export type RecordingExport = {
244
+ readonly failure_code?: string | null;
245
+ readonly failure_message?: string | null;
246
+ readonly job_id?: string | null;
247
+ readonly retryable: boolean;
248
+ readonly source_expires_at?: string | null;
249
+ readonly status: RecordingExportStatus;
250
+ };
251
+ export type Recording = {
252
+ readonly created_at: string;
253
+ readonly episode_id: string;
254
+ readonly export: RecordingExport;
255
+ readonly id: string;
256
+ readonly metadata: unknown;
257
+ readonly source: RecordingSource;
258
+ readonly space_id: string;
259
+ readonly status: "pending" | "processing" | "completed" | "failed";
260
+ readonly storage_key: string | null;
261
+ readonly storage_provider: "r2";
262
+ readonly tenant_id: string;
263
+ readonly updated_at: string;
264
+ };
265
+ export type RecordingDownloadURL = {
266
+ readonly expires_at: string;
267
+ readonly method: string;
268
+ readonly signed_at: string;
269
+ readonly signed_headers: Readonly<Record<string, readonly string[]>>;
270
+ readonly url: string;
271
+ };
272
+ export type RecordingExportRequestAcceptedResponse = {
273
+ readonly export: RecordingExport;
274
+ readonly recording: Recording;
275
+ };
276
+ export type RecordingList = {
277
+ readonly pagination: {
278
+ readonly has_more: boolean;
279
+ readonly next_cursor: string | null;
280
+ readonly page_size: number;
281
+ };
282
+ readonly recordings: readonly Recording[];
283
+ };
284
+ export type ListRecordingsInput = {
285
+ readonly cursor?: string;
286
+ readonly episodeId?: string;
287
+ readonly pageSize?: number;
288
+ readonly spaceId?: string;
289
+ };
290
+ export type CreateRecordingDownloadURLInput = {
291
+ readonly expiresInSeconds: number;
292
+ readonly download?: boolean;
293
+ };
227
294
  export type ChalkServerClient = {
228
295
  readonly spaces: {
229
296
  archive(spaceId: string): Promise<Space>;
@@ -231,6 +298,7 @@ export type ChalkServerClient = {
231
298
  get(spaceId: string): Promise<Space>;
232
299
  list(input?: ListSpacesInput): Promise<SpaceList>;
233
300
  restore(spaceId: string): Promise<Space>;
301
+ update(spaceId: string, input: UpdateSpaceInput): Promise<Space>;
234
302
  };
235
303
  readonly episodes: {
236
304
  create(spaceId: string, input: CreateEpisodeInput, options?: ChalkIdempotencyOptions): Promise<Episode>;
@@ -247,6 +315,12 @@ export type ChalkServerClient = {
247
315
  rotate(apiKeyId: string, input?: RotateAPIKeyInput): Promise<APIKeyWithSecret>;
248
316
  revoke(apiKeyId: string): Promise<void>;
249
317
  };
318
+ readonly recordings: {
319
+ list(input?: ListRecordingsInput): Promise<RecordingList>;
320
+ get(recordingId: string): Promise<Recording>;
321
+ requestExport(recordingId: string): Promise<RecordingExportRequestAcceptedResponse>;
322
+ createDownloadURL(recordingId: string, input: CreateRecordingDownloadURLInput): Promise<RecordingDownloadURL>;
323
+ };
250
324
  readonly publicInvites: {
251
325
  get(spaceId: string): Promise<SpacePublicInvite>;
252
326
  update(spaceId: string, input: UpdateSpacePublicInviteInput): Promise<SpacePublicInvite>;