@corti/sdk 0.1.2-alpha → 0.1.4-alpha

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 (90) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/recordings/client/Client.d.ts +2 -4
  4. package/dist/cjs/api/resources/recordings/client/Client.js +7 -6
  5. package/dist/cjs/api/types/TemplatesSection.d.ts +1 -1
  6. package/dist/cjs/api/types/TemplatesSectionTranslation.d.ts +11 -0
  7. package/dist/cjs/api/types/TemplatesSectionTranslation.js +5 -0
  8. package/dist/cjs/api/types/TemplatesTranslation.d.ts +2 -2
  9. package/dist/cjs/api/types/index.d.ts +1 -0
  10. package/dist/cjs/api/types/index.js +1 -0
  11. package/dist/cjs/core/exports.d.ts +1 -0
  12. package/dist/cjs/core/exports.js +17 -0
  13. package/dist/cjs/core/file/exports.d.ts +1 -0
  14. package/dist/cjs/core/file/exports.js +2 -0
  15. package/dist/cjs/core/file/file.d.ts +5 -0
  16. package/dist/cjs/core/file/file.js +203 -0
  17. package/dist/cjs/core/file/index.d.ts +2 -0
  18. package/dist/cjs/core/file/index.js +18 -0
  19. package/dist/cjs/core/file/types.d.ts +66 -0
  20. package/dist/cjs/core/file/types.js +2 -0
  21. package/dist/cjs/core/index.d.ts +1 -0
  22. package/dist/cjs/core/index.js +2 -1
  23. package/dist/cjs/core/schemas/utils/maybeSkipValidation.js +1 -1
  24. package/dist/cjs/core/websocket/ws.js +1 -1
  25. package/dist/cjs/custom/CortiAuth.d.ts +8 -0
  26. package/dist/cjs/custom/CortiAuth.js +7 -0
  27. package/dist/cjs/custom/CortiClient.js +2 -7
  28. package/dist/cjs/custom/CustomStream.js +2 -2
  29. package/dist/cjs/custom/CustomTranscribe.js +2 -2
  30. package/dist/cjs/custom/utils/getEnvironmentFromString.d.ts +6 -0
  31. package/dist/cjs/custom/utils/getEnvironmentFromString.js +12 -0
  32. package/dist/cjs/environments.d.ts +1 -6
  33. package/dist/cjs/environments.js +0 -5
  34. package/dist/cjs/exports.d.ts +1 -0
  35. package/dist/cjs/exports.js +17 -0
  36. package/dist/cjs/serialization/types/TemplatesSection.d.ts +2 -2
  37. package/dist/cjs/serialization/types/TemplatesSection.js +2 -2
  38. package/dist/cjs/serialization/types/TemplatesSectionTranslation.d.ts +14 -0
  39. package/dist/cjs/serialization/types/TemplatesSectionTranslation.js +45 -0
  40. package/dist/cjs/serialization/types/TemplatesTranslation.d.ts +2 -2
  41. package/dist/cjs/serialization/types/TemplatesTranslation.js +2 -2
  42. package/dist/cjs/serialization/types/index.d.ts +1 -0
  43. package/dist/cjs/serialization/types/index.js +1 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/Client.mjs +2 -2
  47. package/dist/esm/api/resources/recordings/client/Client.d.mts +2 -4
  48. package/dist/esm/api/resources/recordings/client/Client.mjs +7 -6
  49. package/dist/esm/api/types/TemplatesSection.d.mts +1 -1
  50. package/dist/esm/api/types/TemplatesSectionTranslation.d.mts +11 -0
  51. package/dist/esm/api/types/TemplatesSectionTranslation.mjs +4 -0
  52. package/dist/esm/api/types/TemplatesTranslation.d.mts +2 -2
  53. package/dist/esm/api/types/index.d.mts +1 -0
  54. package/dist/esm/api/types/index.mjs +1 -0
  55. package/dist/esm/core/exports.d.mts +1 -0
  56. package/dist/esm/core/exports.mjs +1 -0
  57. package/dist/esm/core/file/exports.d.mts +1 -0
  58. package/dist/esm/core/file/exports.mjs +1 -0
  59. package/dist/esm/core/file/file.d.mts +5 -0
  60. package/dist/esm/core/file/file.mjs +167 -0
  61. package/dist/esm/core/file/index.d.mts +2 -0
  62. package/dist/esm/core/file/index.mjs +2 -0
  63. package/dist/esm/core/file/types.d.mts +66 -0
  64. package/dist/esm/core/file/types.mjs +1 -0
  65. package/dist/esm/core/index.d.mts +1 -0
  66. package/dist/esm/core/index.mjs +1 -0
  67. package/dist/esm/core/schemas/utils/maybeSkipValidation.mjs +1 -1
  68. package/dist/esm/core/websocket/ws.mjs +1 -1
  69. package/dist/esm/custom/CortiAuth.d.mts +8 -0
  70. package/dist/esm/custom/CortiAuth.mjs +7 -0
  71. package/dist/esm/custom/CortiClient.mjs +2 -7
  72. package/dist/esm/custom/CustomStream.mjs +2 -2
  73. package/dist/esm/custom/CustomTranscribe.mjs +2 -2
  74. package/dist/esm/custom/utils/getEnvironmentFromString.d.mts +6 -0
  75. package/dist/esm/custom/utils/getEnvironmentFromString.mjs +9 -0
  76. package/dist/esm/environments.d.mts +1 -6
  77. package/dist/esm/environments.mjs +0 -5
  78. package/dist/esm/exports.d.mts +1 -0
  79. package/dist/esm/exports.mjs +1 -0
  80. package/dist/esm/serialization/types/TemplatesSection.d.mts +2 -2
  81. package/dist/esm/serialization/types/TemplatesSection.mjs +2 -2
  82. package/dist/esm/serialization/types/TemplatesSectionTranslation.d.mts +14 -0
  83. package/dist/esm/serialization/types/TemplatesSectionTranslation.mjs +9 -0
  84. package/dist/esm/serialization/types/TemplatesTranslation.d.mts +2 -2
  85. package/dist/esm/serialization/types/TemplatesTranslation.mjs +2 -2
  86. package/dist/esm/serialization/types/index.d.mts +1 -0
  87. package/dist/esm/serialization/types/index.mjs +1 -0
  88. package/dist/esm/version.d.mts +1 -1
  89. package/dist/esm/version.mjs +1 -1
  90. package/package.json +3 -2
@@ -286,7 +286,7 @@ export class ReconnectingWebSocket {
286
286
  if (this._options.debug) {
287
287
  // not using spread because compiled version uses Symbols
288
288
  // tslint:disable-next-line
289
- // eslint-disable-next-line no-console
289
+ // biome-ignore lint/suspicious/noConsole: allow console
290
290
  console.log.apply(console, ["RWS>", ...args]);
291
291
  }
292
292
  }
@@ -14,6 +14,7 @@
14
14
  import { Auth as FernAuth } from "../api/resources/auth/client/Client.mjs";
15
15
  import * as core from "../core/index.mjs";
16
16
  import * as Corti from "../api/index.mjs";
17
+ import * as environments from "../environments";
17
18
  interface AuthorizationCodeClient {
18
19
  clientId: string;
19
20
  redirectUri: string;
@@ -32,7 +33,14 @@ interface AuthorizationRefreshServer {
32
33
  interface Options {
33
34
  skipRedirect?: boolean;
34
35
  }
36
+ type AuthOptions = Omit<FernAuth.Options, 'environment'> & {
37
+ environment: core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls> | string;
38
+ };
35
39
  export declare class Auth extends FernAuth {
40
+ /**
41
+ * Patch: use custom AuthOptions type to support string-based environment
42
+ */
43
+ constructor(_options: AuthOptions);
36
44
  /**
37
45
  * Patch: called custom implementation this.__getToken_custom instead of this.__getToken
38
46
  */
@@ -25,7 +25,14 @@ import * as core from "../core/index.mjs";
25
25
  import { mergeHeaders, mergeOnlyDefinedHeaders } from "../core/headers.mjs";
26
26
  import * as serializers from "../serialization/index.mjs";
27
27
  import * as errors from "../errors/index.mjs";
28
+ import { getEnvironment } from "./utils/getEnvironmentFromString";
28
29
  export class Auth extends FernAuth {
30
+ /**
31
+ * Patch: use custom AuthOptions type to support string-based environment
32
+ */
33
+ constructor(_options) {
34
+ super(Object.assign(Object.assign({}, _options), { environment: getEnvironment(_options.environment) }));
35
+ }
29
36
  /**
30
37
  * Patch: called custom implementation this.__getToken_custom instead of this.__getToken
31
38
  */
@@ -48,6 +48,7 @@ import { RefreshBearerProvider } from "./RefreshBearerProvider.mjs";
48
48
  * Patch: added SDK_VERSION import
49
49
  */
50
50
  import { SDK_VERSION } from '../version.mjs';
51
+ import { getEnvironment } from "./utils/getEnvironmentFromString";
51
52
  export class CortiClient {
52
53
  constructor(_options) {
53
54
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
@@ -61,13 +62,7 @@ export class CortiClient {
61
62
  "User-Agent": `@corti/sdk/${SDK_VERSION}`,
62
63
  "X-Fern-Runtime": core.RUNTIME.type,
63
64
  "X-Fern-Runtime-Version": core.RUNTIME.version,
64
- }, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: "accessToken" in _options.auth ? _options.auth.accessToken : undefined, environment: typeof _options.environment === "string"
65
- ? {
66
- base: `https://api.${_options.environment}.corti.app/v2`,
67
- wss: `wss://api.${_options.environment}.corti.app`,
68
- login: `https://auth.${_options.environment}.corti.app/realms`,
69
- }
70
- : _options.environment });
65
+ }, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: "accessToken" in _options.auth ? _options.auth.accessToken : undefined, environment: getEnvironment(_options.environment) });
71
66
  /**
72
67
  * Patch: if `accessToken` is provided, use BearerProvider, otherwise use OAuthTokenProvider
73
68
  */
@@ -69,7 +69,7 @@ export class Stream extends FernStream {
69
69
  || parsedResponse.value.type === 'CONFIG_NOT_PROVIDED')) {
70
70
  ws.socket.dispatchEvent(new ErrorEvent({
71
71
  name: parsedResponse.value.type,
72
- message: `Configuration error "${parsedResponse.value.type}" : ${parsedResponse.value.reason || 'No reason provided'}`,
72
+ message: JSON.stringify(parsedResponse.value),
73
73
  }, ''));
74
74
  ws.close();
75
75
  return;
@@ -77,7 +77,7 @@ export class Stream extends FernStream {
77
77
  if (parsedResponse.ok && parsedResponse.value.type === 'error') {
78
78
  ws.socket.dispatchEvent(new ErrorEvent({
79
79
  name: 'error',
80
- message: JSON.stringify(parsedResponse.value.error),
80
+ message: JSON.stringify(parsedResponse.value),
81
81
  }, ''));
82
82
  ws.close();
83
83
  return;
@@ -67,7 +67,7 @@ export class Transcribe extends FernTranscribe {
67
67
  || parsedResponse.value.type === 'CONFIG_TIMEOUT')) {
68
68
  ws.socket.dispatchEvent(new ErrorEvent({
69
69
  name: parsedResponse.value.type,
70
- message: `Configuration error "${parsedResponse.value.type}" : ${parsedResponse.value.reason || 'No reason provided'}`,
70
+ message: JSON.stringify(parsedResponse.value),
71
71
  }, ''));
72
72
  ws.close();
73
73
  return;
@@ -75,7 +75,7 @@ export class Transcribe extends FernTranscribe {
75
75
  if (parsedResponse.ok && parsedResponse.value.type === 'error') {
76
76
  ws.socket.dispatchEvent(new ErrorEvent({
77
77
  name: 'error',
78
- message: JSON.stringify(parsedResponse.value.error),
78
+ message: JSON.stringify(parsedResponse.value),
79
79
  }, ''));
80
80
  ws.close();
81
81
  return;
@@ -0,0 +1,6 @@
1
+ import * as core from "../../core/index.mjs";
2
+ import * as environments from "../../environments.mjs";
3
+ type Environment = core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls> | string;
4
+ type CortiEnvironment = core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls>;
5
+ export declare function getEnvironment(environment: Environment): CortiEnvironment;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ export function getEnvironment(environment) {
2
+ return typeof environment === "string"
3
+ ? {
4
+ base: `https://api.${environment}.corti.app/v2`,
5
+ wss: `wss://api.${environment}.corti.app`,
6
+ login: `https://auth.${environment}.corti.app/realms`,
7
+ }
8
+ : environment;
9
+ }
@@ -7,11 +7,6 @@ export interface CortiEnvironmentUrls {
7
7
  login: string;
8
8
  }
9
9
  export declare const CortiEnvironment: {
10
- readonly BetaEu: {
11
- readonly base: "https://api.beta-eu.corti.app/v2";
12
- readonly wss: "wss://api.beta-eu.corti.app";
13
- readonly login: "https://auth.beta-eu.corti.app/realms";
14
- };
15
10
  readonly Eu: {
16
11
  readonly base: "https://api.eu.corti.app/v2";
17
12
  readonly wss: "wss://api.eu.corti.app";
@@ -23,4 +18,4 @@ export declare const CortiEnvironment: {
23
18
  readonly login: "https://auth.us.corti.app/realms";
24
19
  };
25
20
  };
26
- export type CortiEnvironment = typeof CortiEnvironment.BetaEu | typeof CortiEnvironment.Eu | typeof CortiEnvironment.Us;
21
+ export type CortiEnvironment = typeof CortiEnvironment.Eu | typeof CortiEnvironment.Us;
@@ -2,11 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export const CortiEnvironment = {
5
- BetaEu: {
6
- base: "https://api.beta-eu.corti.app/v2",
7
- wss: "wss://api.beta-eu.corti.app",
8
- login: "https://auth.beta-eu.corti.app/realms",
9
- },
10
5
  Eu: {
11
6
  base: "https://api.eu.corti.app/v2",
12
7
  wss: "wss://api.eu.corti.app",
@@ -0,0 +1 @@
1
+ export * from "./core/exports.mjs";
@@ -0,0 +1 @@
1
+ export * from "./core/exports.mjs";
@@ -5,7 +5,7 @@ import * as serializers from "../index.mjs";
5
5
  import * as Corti from "../../api/index.mjs";
6
6
  import * as core from "../../core/index.mjs";
7
7
  import { TemplatesWritingStyle } from "./TemplatesWritingStyle.mjs";
8
- import { TemplatesTranslation } from "./TemplatesTranslation.mjs";
8
+ import { TemplatesSectionTranslation } from "./TemplatesSectionTranslation.mjs";
9
9
  export declare const TemplatesSection: core.serialization.ObjectSchema<serializers.TemplatesSection.Raw, Corti.TemplatesSection>;
10
10
  export declare namespace TemplatesSection {
11
11
  interface Raw {
@@ -16,6 +16,6 @@ export declare namespace TemplatesSection {
16
16
  description: string;
17
17
  default_writing_style: TemplatesWritingStyle.Raw;
18
18
  section_type: string;
19
- translations: TemplatesTranslation.Raw[];
19
+ translations: TemplatesSectionTranslation.Raw[];
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as core from "../../core/index.mjs";
5
5
  import { TemplatesWritingStyle } from "./TemplatesWritingStyle.mjs";
6
- import { TemplatesTranslation } from "./TemplatesTranslation.mjs";
6
+ import { TemplatesSectionTranslation } from "./TemplatesSectionTranslation.mjs";
7
7
  export const TemplatesSection = core.serialization.object({
8
8
  dateUpdated: core.serialization.property("date_updated", core.serialization.date().optionalNullable()),
9
9
  name: core.serialization.string(),
@@ -12,5 +12,5 @@ export const TemplatesSection = core.serialization.object({
12
12
  description: core.serialization.string(),
13
13
  defaultWritingStyle: core.serialization.property("default_writing_style", TemplatesWritingStyle),
14
14
  sectionType: core.serialization.property("section_type", core.serialization.string()),
15
- translations: core.serialization.list(TemplatesTranslation),
15
+ translations: core.serialization.list(TemplatesSectionTranslation),
16
16
  });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.mjs";
5
+ import * as Corti from "../../api/index.mjs";
6
+ import * as core from "../../core/index.mjs";
7
+ export declare const TemplatesSectionTranslation: core.serialization.ObjectSchema<serializers.TemplatesSectionTranslation.Raw, Corti.TemplatesSectionTranslation>;
8
+ export declare namespace TemplatesSectionTranslation {
9
+ interface Raw {
10
+ languages_id: string;
11
+ name?: (string | null) | null;
12
+ description?: (string | null) | null;
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as core from "../../core/index.mjs";
5
+ export const TemplatesSectionTranslation = core.serialization.object({
6
+ languagesId: core.serialization.property("languages_id", core.serialization.string()),
7
+ name: core.serialization.string().optionalNullable(),
8
+ description: core.serialization.string().optionalNullable(),
9
+ });
@@ -8,7 +8,7 @@ export declare const TemplatesTranslation: core.serialization.ObjectSchema<seria
8
8
  export declare namespace TemplatesTranslation {
9
9
  interface Raw {
10
10
  languages_id: string;
11
- name?: (string | null) | null;
12
- description?: (string | null) | null;
11
+ name?: string | null;
12
+ description?: string | null;
13
13
  }
14
14
  }
@@ -4,6 +4,6 @@
4
4
  import * as core from "../../core/index.mjs";
5
5
  export const TemplatesTranslation = core.serialization.object({
6
6
  languagesId: core.serialization.property("languages_id", core.serialization.string()),
7
- name: core.serialization.string().optionalNullable(),
8
- description: core.serialization.string().optionalNullable(),
7
+ name: core.serialization.string().optional(),
8
+ description: core.serialization.string().optional(),
9
9
  });
@@ -56,6 +56,7 @@ export * from "./InteractionsGenderEnum.mjs";
56
56
  export * from "./CommonSourceEnum.mjs";
57
57
  export * from "./TranscriptsParticipantRoleEnum.mjs";
58
58
  export * from "./TemplatesWritingStyle.mjs";
59
+ export * from "./TemplatesSectionTranslation.mjs";
59
60
  export * from "./TemplatesTranslation.mjs";
60
61
  export * from "./StreamConfigMessage.mjs";
61
62
  export * from "./StreamConfig.mjs";
@@ -56,6 +56,7 @@ export * from "./InteractionsGenderEnum.mjs";
56
56
  export * from "./CommonSourceEnum.mjs";
57
57
  export * from "./TranscriptsParticipantRoleEnum.mjs";
58
58
  export * from "./TemplatesWritingStyle.mjs";
59
+ export * from "./TemplatesSectionTranslation.mjs";
59
60
  export * from "./TemplatesTranslation.mjs";
60
61
  export * from "./StreamConfigMessage.mjs";
61
62
  export * from "./StreamConfig.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.2-alpha";
1
+ export declare const SDK_VERSION = "0.1.4-alpha";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.2-alpha";
1
+ export const SDK_VERSION = "0.1.4-alpha";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corti/sdk",
3
- "version": "0.1.2-alpha",
3
+ "version": "0.1.4-alpha",
4
4
  "private": false,
5
5
  "repository": "github:corticph/corti-sdk-typescript",
6
6
  "license": "MIT",
@@ -66,7 +66,8 @@
66
66
  "msw": "^2.8.4",
67
67
  "@types/node": "^18.19.70",
68
68
  "prettier": "^3.4.2",
69
- "typescript": "~5.7.2"
69
+ "typescript": "~5.7.2",
70
+ "@faker-js/faker": "^9.9.0"
70
71
  },
71
72
  "browser": {
72
73
  "fs": false,