@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
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnvironment = getEnvironment;
4
+ function getEnvironment(environment) {
5
+ return typeof environment === "string"
6
+ ? {
7
+ base: `https://api.${environment}.corti.app/v2`,
8
+ wss: `wss://api.${environment}.corti.app`,
9
+ login: `https://auth.${environment}.corti.app/realms`,
10
+ }
11
+ : environment;
12
+ }
@@ -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;
@@ -5,11 +5,6 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CortiEnvironment = void 0;
7
7
  exports.CortiEnvironment = {
8
- BetaEu: {
9
- base: "https://api.beta-eu.corti.app/v2",
10
- wss: "wss://api.beta-eu.corti.app",
11
- login: "https://auth.beta-eu.corti.app/realms",
12
- },
13
8
  Eu: {
14
9
  base: "https://api.eu.corti.app/v2",
15
10
  wss: "wss://api.eu.corti.app",
@@ -0,0 +1 @@
1
+ export * from "./core/exports.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./core/exports.js"), exports);
@@ -5,7 +5,7 @@ import * as serializers from "../index.js";
5
5
  import * as Corti from "../../api/index.js";
6
6
  import * as core from "../../core/index.js";
7
7
  import { TemplatesWritingStyle } from "./TemplatesWritingStyle.js";
8
- import { TemplatesTranslation } from "./TemplatesTranslation.js";
8
+ import { TemplatesSectionTranslation } from "./TemplatesSectionTranslation.js";
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
  }
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TemplatesSection = void 0;
40
40
  const core = __importStar(require("../../core/index.js"));
41
41
  const TemplatesWritingStyle_js_1 = require("./TemplatesWritingStyle.js");
42
- const TemplatesTranslation_js_1 = require("./TemplatesTranslation.js");
42
+ const TemplatesSectionTranslation_js_1 = require("./TemplatesSectionTranslation.js");
43
43
  exports.TemplatesSection = core.serialization.object({
44
44
  dateUpdated: core.serialization.property("date_updated", core.serialization.date().optionalNullable()),
45
45
  name: core.serialization.string(),
@@ -48,5 +48,5 @@ exports.TemplatesSection = core.serialization.object({
48
48
  description: core.serialization.string(),
49
49
  defaultWritingStyle: core.serialization.property("default_writing_style", TemplatesWritingStyle_js_1.TemplatesWritingStyle),
50
50
  sectionType: core.serialization.property("section_type", core.serialization.string()),
51
- translations: core.serialization.list(TemplatesTranslation_js_1.TemplatesTranslation),
51
+ translations: core.serialization.list(TemplatesSectionTranslation_js_1.TemplatesSectionTranslation),
52
52
  });
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.js";
5
+ import * as Corti from "../../api/index.js";
6
+ import * as core from "../../core/index.js";
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,45 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.TemplatesSectionTranslation = void 0;
40
+ const core = __importStar(require("../../core/index.js"));
41
+ exports.TemplatesSectionTranslation = core.serialization.object({
42
+ languagesId: core.serialization.property("languages_id", core.serialization.string()),
43
+ name: core.serialization.string().optionalNullable(),
44
+ description: core.serialization.string().optionalNullable(),
45
+ });
@@ -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
  }
@@ -40,6 +40,6 @@ exports.TemplatesTranslation = void 0;
40
40
  const core = __importStar(require("../../core/index.js"));
41
41
  exports.TemplatesTranslation = core.serialization.object({
42
42
  languagesId: core.serialization.property("languages_id", core.serialization.string()),
43
- name: core.serialization.string().optionalNullable(),
44
- description: core.serialization.string().optionalNullable(),
43
+ name: core.serialization.string().optional(),
44
+ description: core.serialization.string().optional(),
45
45
  });
@@ -56,6 +56,7 @@ export * from "./InteractionsGenderEnum.js";
56
56
  export * from "./CommonSourceEnum.js";
57
57
  export * from "./TranscriptsParticipantRoleEnum.js";
58
58
  export * from "./TemplatesWritingStyle.js";
59
+ export * from "./TemplatesSectionTranslation.js";
59
60
  export * from "./TemplatesTranslation.js";
60
61
  export * from "./StreamConfigMessage.js";
61
62
  export * from "./StreamConfig.js";
@@ -72,6 +72,7 @@ __exportStar(require("./InteractionsGenderEnum.js"), exports);
72
72
  __exportStar(require("./CommonSourceEnum.js"), exports);
73
73
  __exportStar(require("./TranscriptsParticipantRoleEnum.js"), exports);
74
74
  __exportStar(require("./TemplatesWritingStyle.js"), exports);
75
+ __exportStar(require("./TemplatesSectionTranslation.js"), exports);
75
76
  __exportStar(require("./TemplatesTranslation.js"), exports);
76
77
  __exportStar(require("./StreamConfigMessage.js"), exports);
77
78
  __exportStar(require("./StreamConfig.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.2-alpha";
1
+ export declare const SDK_VERSION = "0.1.4-alpha";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.2-alpha";
4
+ exports.SDK_VERSION = "0.1.4-alpha";
@@ -27,8 +27,8 @@ export class CortiClient {
27
27
  "Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
28
28
  "X-Fern-Language": "JavaScript",
29
29
  "X-Fern-SDK-Name": "@corti/sdk",
30
- "X-Fern-SDK-Version": "0.1.2-alpha",
31
- "User-Agent": "@corti/sdk/0.1.2-alpha",
30
+ "X-Fern-SDK-Version": "0.1.4-alpha",
31
+ "User-Agent": "@corti/sdk/0.1.4-alpha",
32
32
  "X-Fern-Runtime": core.RUNTIME.type,
33
33
  "X-Fern-Runtime-Version": core.RUNTIME.version,
34
34
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -4,8 +4,6 @@
4
4
  import * as environments from "../../../../environments.mjs";
5
5
  import * as core from "../../../../core/index.mjs";
6
6
  import * as Corti from "../../../index.mjs";
7
- import * as fs from "fs";
8
- import { Blob } from "buffer";
9
7
  export declare namespace Recordings {
10
8
  interface Options {
11
9
  environment: core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls>;
@@ -52,7 +50,7 @@ export declare class Recordings {
52
50
  /**
53
51
  * Upload a recording for a given interaction. There is a maximum limit of 60 minutes in length and 150MB in size for recordings.
54
52
  *
55
- * @param {File | fs.ReadStream | Blob} bytes
53
+ * @param {core.file.Uploadable} uploadable
56
54
  * @param {Corti.Uuid} id
57
55
  * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration.
58
56
  *
@@ -61,7 +59,7 @@ export declare class Recordings {
61
59
  * @throws {@link Corti.InternalServerError}
62
60
  * @throws {@link Corti.GatewayTimeoutError}
63
61
  */
64
- upload(bytes: File | fs.ReadStream | Blob, id: Corti.Uuid, requestOptions?: Recordings.RequestOptions): core.HttpResponsePromise<Corti.RecordingsCreateResponse>;
62
+ upload(uploadable: core.file.Uploadable, id: Corti.Uuid, requestOptions?: Recordings.RequestOptions): core.HttpResponsePromise<Corti.RecordingsCreateResponse>;
65
63
  private __upload;
66
64
  /**
67
65
  * Retrieve a specific recording for a given interaction.
@@ -112,7 +112,7 @@ export class Recordings {
112
112
  /**
113
113
  * Upload a recording for a given interaction. There is a maximum limit of 60 minutes in length and 150MB in size for recordings.
114
114
  *
115
- * @param {File | fs.ReadStream | Blob} bytes
115
+ * @param {core.file.Uploadable} uploadable
116
116
  * @param {Corti.Uuid} id
117
117
  * @param {Recordings.RequestOptions} requestOptions - Request-specific configuration.
118
118
  *
@@ -121,23 +121,24 @@ export class Recordings {
121
121
  * @throws {@link Corti.InternalServerError}
122
122
  * @throws {@link Corti.GatewayTimeoutError}
123
123
  */
124
- upload(bytes, id, requestOptions) {
125
- return core.HttpResponsePromise.fromPromise(this.__upload(bytes, id, requestOptions));
124
+ upload(uploadable, id, requestOptions) {
125
+ return core.HttpResponsePromise.fromPromise(this.__upload(uploadable, id, requestOptions));
126
126
  }
127
- __upload(bytes, id, requestOptions) {
127
+ __upload(uploadable, id, requestOptions) {
128
128
  return __awaiter(this, void 0, void 0, function* () {
129
129
  var _a, _b;
130
+ const _binaryUploadRequest = yield core.file.toBinaryUploadRequest(uploadable);
130
131
  const _response = yield core.fetcher({
131
132
  url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `interactions/${encodeURIComponent(serializers.Uuid.jsonOrThrow(id, { omitUndefined: true }))}/recordings/`),
132
133
  method: "POST",
133
134
  headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
134
135
  Authorization: yield this._getAuthorizationHeader(),
135
136
  "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
136
- }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
137
+ }), _binaryUploadRequest.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
137
138
  contentType: "application/octet-stream",
138
139
  requestType: "bytes",
139
140
  duplex: "half",
140
- body: bytes,
141
+ body: _binaryUploadRequest.body,
141
142
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
142
143
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
143
144
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -18,5 +18,5 @@ export interface TemplatesSection {
18
18
  /** Type of section */
19
19
  sectionType: string;
20
20
  /** Available translations for the section */
21
- translations: Corti.TemplatesTranslation[];
21
+ translations: Corti.TemplatesSectionTranslation[];
22
22
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TemplatesSectionTranslation {
5
+ /** Language identifier */
6
+ languagesId: string;
7
+ /** Localized name */
8
+ name?: string | null;
9
+ /** Localized description */
10
+ description?: string | null;
11
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -5,7 +5,7 @@ export interface TemplatesTranslation {
5
5
  /** Language identifier */
6
6
  languagesId: string;
7
7
  /** Localized name */
8
- name?: string | null;
8
+ name?: string;
9
9
  /** Localized description */
10
- description?: string | null;
10
+ description?: string;
11
11
  }
@@ -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";
@@ -0,0 +1 @@
1
+ export * from "./file/exports.mjs";
@@ -0,0 +1 @@
1
+ export * from "./file/exports.mjs";
@@ -0,0 +1 @@
1
+ export { Uploadable } from "./types.mjs";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Uploadable } from "./types.mjs";
2
+ export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
3
+ body: Uploadable.FileLike;
4
+ headers?: Record<string, string>;
5
+ }>;
@@ -0,0 +1,167 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export function toBinaryUploadRequest(file) {
11
+ return __awaiter(this, void 0, void 0, function* () {
12
+ const { data, filename, contentLength, contentType } = yield getFileWithMetadata(file);
13
+ const request = {
14
+ body: data,
15
+ headers: {},
16
+ };
17
+ if (filename) {
18
+ request.headers["Content-Disposition"] = `attachment; filename="${filename}"`;
19
+ }
20
+ if (contentType) {
21
+ request.headers["Content-Type"] = contentType;
22
+ }
23
+ if (contentLength != null) {
24
+ request.headers["Content-Length"] = contentLength.toString();
25
+ }
26
+ return request;
27
+ });
28
+ }
29
+ function getFileWithMetadata(file) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ var _a, _b, _c, _d, _e;
32
+ if (isFileLike(file)) {
33
+ return getFileWithMetadata({
34
+ data: file,
35
+ });
36
+ }
37
+ if ("path" in file) {
38
+ const fs = yield import("fs");
39
+ if (!fs || !fs.createReadStream) {
40
+ throw new Error("File path uploads are not supported in this environment.");
41
+ }
42
+ const data = fs.createReadStream(file.path);
43
+ const contentLength = (_a = file.contentLength) !== null && _a !== void 0 ? _a : (yield tryGetFileSizeFromPath(file.path));
44
+ const filename = (_b = file.filename) !== null && _b !== void 0 ? _b : getNameFromPath(file.path);
45
+ return {
46
+ data,
47
+ filename,
48
+ contentType: file.contentType,
49
+ contentLength,
50
+ };
51
+ }
52
+ if ("data" in file) {
53
+ const data = file.data;
54
+ const contentLength = (_c = file.contentLength) !== null && _c !== void 0 ? _c : (yield tryGetContentLengthFromFileLike(data));
55
+ const filename = (_d = file.filename) !== null && _d !== void 0 ? _d : tryGetNameFromFileLike(data);
56
+ return {
57
+ data,
58
+ filename,
59
+ contentType: (_e = file.contentType) !== null && _e !== void 0 ? _e : tryGetContentTypeFromFileLike(data),
60
+ contentLength,
61
+ };
62
+ }
63
+ throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`);
64
+ });
65
+ }
66
+ function isFileLike(value) {
67
+ return (isBuffer(value) ||
68
+ isArrayBufferView(value) ||
69
+ isArrayBuffer(value) ||
70
+ isUint8Array(value) ||
71
+ isBlob(value) ||
72
+ isFile(value) ||
73
+ isStreamLike(value) ||
74
+ isReadableStream(value));
75
+ }
76
+ function tryGetFileSizeFromPath(path) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ try {
79
+ const fs = yield import("fs");
80
+ if (!fs || !fs.promises || !fs.promises.stat) {
81
+ return undefined;
82
+ }
83
+ const fileStat = yield fs.promises.stat(path);
84
+ return fileStat.size;
85
+ }
86
+ catch (fallbackError) {
87
+ return undefined;
88
+ }
89
+ });
90
+ }
91
+ function tryGetNameFromFileLike(data) {
92
+ if (isNamedValue(data)) {
93
+ return data.name;
94
+ }
95
+ if (isPathedValue(data)) {
96
+ return getNameFromPath(data.path.toString());
97
+ }
98
+ return undefined;
99
+ }
100
+ function tryGetContentLengthFromFileLike(data) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ if (isBuffer(data)) {
103
+ return data.length;
104
+ }
105
+ if (isArrayBufferView(data)) {
106
+ return data.byteLength;
107
+ }
108
+ if (isArrayBuffer(data)) {
109
+ return data.byteLength;
110
+ }
111
+ if (isBlob(data)) {
112
+ return data.size;
113
+ }
114
+ if (isFile(data)) {
115
+ return data.size;
116
+ }
117
+ if (isPathedValue(data)) {
118
+ return yield tryGetFileSizeFromPath(data.path.toString());
119
+ }
120
+ return undefined;
121
+ });
122
+ }
123
+ function tryGetContentTypeFromFileLike(data) {
124
+ if (isBlob(data)) {
125
+ return data.type;
126
+ }
127
+ if (isFile(data)) {
128
+ return data.type;
129
+ }
130
+ return undefined;
131
+ }
132
+ function getNameFromPath(path) {
133
+ const lastForwardSlash = path.lastIndexOf("/");
134
+ const lastBackSlash = path.lastIndexOf("\\");
135
+ const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
136
+ return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path;
137
+ }
138
+ function isNamedValue(value) {
139
+ return typeof value === "object" && value != null && "name" in value;
140
+ }
141
+ function isPathedValue(value) {
142
+ return typeof value === "object" && value != null && "path" in value;
143
+ }
144
+ function isStreamLike(value) {
145
+ return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
146
+ }
147
+ function isReadableStream(value) {
148
+ return typeof value === "object" && value != null && "getReader" in value;
149
+ }
150
+ function isBuffer(value) {
151
+ return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
152
+ }
153
+ function isArrayBufferView(value) {
154
+ return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
155
+ }
156
+ function isArrayBuffer(value) {
157
+ return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
158
+ }
159
+ function isUint8Array(value) {
160
+ return typeof Uint8Array !== "undefined" && value instanceof Uint8Array;
161
+ }
162
+ function isBlob(value) {
163
+ return typeof Blob !== "undefined" && value instanceof Blob;
164
+ }
165
+ function isFile(value) {
166
+ return typeof File !== "undefined" && value instanceof File;
167
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./file.mjs";
2
+ export * from "./types.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./file.mjs";
2
+ export * from "./types.mjs";
@@ -0,0 +1,66 @@
1
+ /**
2
+ * A file that can be uploaded. Can be a file-like object (stream, buffer, blob, etc.),
3
+ * a path to a file, or an object with a file-like object and metadata.
4
+ */
5
+ export type Uploadable = Uploadable.FileLike | Uploadable.FromPath | Uploadable.WithMetadata;
6
+ export declare namespace Uploadable {
7
+ /**
8
+ * Various file-like objects that can be used to upload a file.
9
+ */
10
+ type FileLike = ArrayBuffer | ArrayBufferLike | ArrayBufferView | Uint8Array | import("buffer").Buffer | import("buffer").Blob | import("buffer").File | import("stream").Readable | import("stream/web").ReadableStream | globalThis.Blob | globalThis.File | ReadableStream;
11
+ /**
12
+ * A file path with optional metadata, used for uploading a file from the file system.
13
+ */
14
+ type FromPath = {
15
+ /** The path to the file to upload */
16
+ path: string;
17
+ /**
18
+ * Optional override for the file name (defaults to basename of path).
19
+ * This is used to set the `Content-Disposition` header in upload requests.
20
+ */
21
+ filename?: string;
22
+ /**
23
+ * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
24
+ * This is used to set the `Content-Type` header in upload requests.
25
+ */
26
+ contentType?: string;
27
+ /**
28
+ * Optional file size in bytes.
29
+ * If not provided, the file size will be determined from the file system.
30
+ * The content length is used to set the `Content-Length` header in upload requests.
31
+ */
32
+ contentLength?: number;
33
+ };
34
+ /**
35
+ * A file-like object with metadata, used for uploading files.
36
+ */
37
+ type WithMetadata = {
38
+ /** The file data */
39
+ data: FileLike;
40
+ /**
41
+ * Optional override for the file name (defaults to basename of path).
42
+ * This is used to set the `Content-Disposition` header in upload requests.
43
+ */
44
+ filename?: string;
45
+ /**
46
+ * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain').
47
+ * This is used to set the `Content-Type` header in upload requests.
48
+ *
49
+ * If not provided, the content type may be determined from the data itself.
50
+ * * If the data is a `File`, `Blob`, or similar, the content type will be determined from the file itself, if the type is set.
51
+ * * Any other data type will not have a content type set, and the upload request will use `Content-Type: application/octet-stream` instead.
52
+ */
53
+ contentType?: string;
54
+ /**
55
+ * Optional file size in bytes.
56
+ * The content length is used to set the `Content-Length` header in upload requests.
57
+ * If the content length is not provided and cannot be determined, the upload request will not include the `Content-Length` header, but will use `Transfer-Encoding: chunked` instead.
58
+ *
59
+ * If not provided, the file size will be determined depending on the data type.
60
+ * * If the data is of type `fs.ReadStream` (`createReadStream`), the size will be determined from the file system.
61
+ * * If the data is a `Buffer`, `ArrayBuffer`, `Uint8Array`, `Blob`, `File`, or similar, the size will be determined from the data itself.
62
+ * * If the data is a `Readable` or `ReadableStream`, the size will not be determined.
63
+ */
64
+ contentLength?: number;
65
+ };
66
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -7,3 +7,4 @@ export * from "./websocket/index.mjs";
7
7
  export * from "./base64.mjs";
8
8
  export * from "./utils/index.mjs";
9
9
  export * from "./pagination/index.mjs";
10
+ export * as file from "./file/index.mjs";
@@ -7,3 +7,4 @@ export * from "./websocket/index.mjs";
7
7
  export * from "./base64.mjs";
8
8
  export * from "./utils/index.mjs";
9
9
  export * from "./pagination/index.mjs";
10
+ export * as file from "./file/index.mjs";
@@ -6,7 +6,7 @@ function transformAndMaybeSkipValidation(transform) {
6
6
  const transformed = transform(value, opts);
7
7
  const { skipValidation = false } = opts !== null && opts !== void 0 ? opts : {};
8
8
  if (!transformed.ok && skipValidation) {
9
- // eslint-disable-next-line no-console
9
+ // biome-ignore lint/suspicious/noConsole: allow console
10
10
  console.warn([
11
11
  "Failed to validate.",
12
12
  ...transformed.errors.map((error) => " - " +