syllable-sdk 1.0.10 → 1.0.11-rc.2

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.
@@ -13,6 +13,7 @@ export const RequestStatus = {
13
13
  Duplicate: "DUPLICATE",
14
14
  Initiated: "INITIATED",
15
15
  Connected: "CONNECTED",
16
+ CallCompleted: "CALL_COMPLETED",
16
17
  Failed: "FAILED",
17
18
  Canceled: "CANCELED",
18
19
  Invalid: "INVALID",
@@ -2,15 +2,64 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import * as z from "zod/v3";
6
+
5
7
  declare const __brand: unique symbol;
6
8
  export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
9
+ export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
10
+ T[keyof T];
11
+ export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
12
+ | T[keyof T]
13
+ | Unrecognized<T[keyof T] extends number ? number : string>;
7
14
 
8
- export function catchUnrecognizedEnum<T>(value: T): Unrecognized<T> {
15
+ function unrecognized<T>(value: T): Unrecognized<T> {
16
+ unrecognizedCount++;
9
17
  return value as Unrecognized<T>;
10
18
  }
11
19
 
12
- type Prettify<T> = { [K in keyof T]: T[K] } & {};
13
- export type ClosedEnum<T> = T[keyof T];
14
- export type OpenEnum<T> =
15
- | Prettify<T[keyof T]>
16
- | Unrecognized<T[keyof T] extends number ? number : string>;
20
+ let unrecognizedCount = 0;
21
+ let refCount = 0;
22
+ export function unrecognizedCounter() {
23
+ refCount++;
24
+ const start = unrecognizedCount;
25
+ return {
26
+ count: () => {
27
+ const count = unrecognizedCount - start;
28
+ if (--refCount === 0) unrecognizedCount = 0;
29
+ return count;
30
+ },
31
+ };
32
+ }
33
+
34
+ export function inboundSchema<T extends Record<string, string>>(
35
+ enumObj: T,
36
+ ): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
37
+ const options = Object.values(enumObj);
38
+ return z.union([
39
+ ...options.map(x => z.literal(x)),
40
+ z.string().transform(x => unrecognized(x)),
41
+ ] as any);
42
+ }
43
+
44
+ export function inboundSchemaInt<T extends Record<string, number | string>>(
45
+ enumObj: T,
46
+ ): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
47
+ // For numeric enums, Object.values returns both numbers and string keys
48
+ const options = Object.values(enumObj).filter(v => typeof v === "number");
49
+ return z.union([
50
+ ...options.map(x => z.literal(x)),
51
+ z.number().int().transform(x => unrecognized(x)),
52
+ ] as any);
53
+ }
54
+
55
+ export function outboundSchema<T extends Record<string, string>>(
56
+ _: T,
57
+ ): z.ZodType<string, z.ZodTypeDef, OpenEnum<T>> {
58
+ return z.string() as any;
59
+ }
60
+
61
+ export function outboundSchemaInt<T extends Record<string, number | string>>(
62
+ _: T,
63
+ ): z.ZodType<number, z.ZodTypeDef, OpenEnum<T>> {
64
+ return z.number().int() as any;
65
+ }
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  export { blobLikeSchema, isBlobLike } from "./blobs.js";
6
- export { catchUnrecognizedEnum } from "./enums.js";
7
6
  export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
8
7
  export type { Result } from "./fp.js";
9
8
  export type { PageIterator, Paginator } from "./operations.js";
package/types/enums.d.ts CHANGED
@@ -1,12 +1,16 @@
1
+ import * as z from "zod/v3";
1
2
  declare const __brand: unique symbol;
2
3
  export type Unrecognized<T> = T & {
3
4
  [__brand]: "unrecognized";
4
5
  };
5
- export declare function catchUnrecognizedEnum<T>(value: T): Unrecognized<T>;
6
- type Prettify<T> = {
7
- [K in keyof T]: T[K];
8
- } & {};
9
- export type ClosedEnum<T> = T[keyof T];
10
- export type OpenEnum<T> = Prettify<T[keyof T]> | Unrecognized<T[keyof T] extends number ? number : string>;
6
+ export type ClosedEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T];
7
+ export type OpenEnum<T extends Readonly<Record<string, string | number>>> = T[keyof T] | Unrecognized<T[keyof T] extends number ? number : string>;
8
+ export declare function unrecognizedCounter(): {
9
+ count: () => number;
10
+ };
11
+ export declare function inboundSchema<T extends Record<string, string>>(enumObj: T): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown>;
12
+ export declare function inboundSchemaInt<T extends Record<string, number | string>>(enumObj: T): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown>;
13
+ export declare function outboundSchema<T extends Record<string, string>>(_: T): z.ZodType<string, z.ZodTypeDef, OpenEnum<T>>;
14
+ export declare function outboundSchemaInt<T extends Record<string, number | string>>(_: T): z.ZodType<number, z.ZodTypeDef, OpenEnum<T>>;
11
15
  export {};
12
16
  //# sourceMappingURL=enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/types/enums.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAElE;AAED,KAAK,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,EAAE,CAAC;AACjD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACvC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACpB,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/types/enums.ts"],"names":[],"mapp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AC,CAAC,CAAC,CAE9C;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACzE,CAAC,EAAE,CAAC,GACH,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAE9C"}
package/types/enums.js CHANGED
@@ -2,9 +2,83 @@
2
2
  /*
3
3
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
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
+ })();
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.catchUnrecognizedEnum = catchUnrecognizedEnum;
7
- function catchUnrecognizedEnum(value) {
39
+ exports.unrecognizedCounter = unrecognizedCounter;
40
+ exports.inboundSchema = inboundSchema;
41
+ exports.inboundSchemaInt = inboundSchemaInt;
42
+ exports.outboundSchema = outboundSchema;
43
+ exports.outboundSchemaInt = outboundSchemaInt;
44
+ const z = __importStar(require("zod/v3"));
45
+ function unrecognized(value) {
46
+ unrecognizedCount++;
8
47
  return value;
9
48
  }
49
+ let unrecognizedCount = 0;
50
+ let refCount = 0;
51
+ function unrecognizedCounter() {
52
+ refCount++;
53
+ const start = unrecognizedCount;
54
+ return {
55
+ count: () => {
56
+ const count = unrecognizedCount - start;
57
+ if (--refCount === 0)
58
+ unrecognizedCount = 0;
59
+ return count;
60
+ },
61
+ };
62
+ }
63
+ function inboundSchema(enumObj) {
64
+ const options = Object.values(enumObj);
65
+ return z.union([
66
+ ...options.map(x => z.literal(x)),
67
+ z.string().transform(x => unrecognized(x)),
68
+ ]);
69
+ }
70
+ function inboundSchemaInt(enumObj) {
71
+ // For numeric enums, Object.values returns both numbers and string keys
72
+ const options = Object.values(enumObj).filter(v => typeof v === "number");
73
+ return z.union([
74
+ ...options.map(x => z.literal(x)),
75
+ z.number().int().transform(x => unrecognized(x)),
76
+ ]);
77
+ }
78
+ function outboundSchema(_) {
79
+ return z.string();
80
+ }
81
+ function outboundSchemaInt(_) {
82
+ return z.number().int();
83
+ }
10
84
  //# sourceMappingURL=enums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/types/enums.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAKH,sDAEC;AAFD,SAAgB,qBAAqB,CAAI,KAAQ;IAC/C,OAAO,KAAwB,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/types/enums.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBH,kDAUC;AAED,sCAQC;AAED,4CASC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AM,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;KAC1C,CAAC,CAAC;AACZ,CAAC;AAED,SAAgB,cAAc,CAC5B,CAAI;IAEJ,OAAO,CAAC,CAAC,MAAM,EAAS,CAAC;AAC3B,CAAC;AAED,SAAgB,iBAAiB,CAC/B,CAAI;IAEJ,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAS,CAAC;AACjC,CAAC"}
package/types/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { blobLikeSchema, isBlobLike } from "./blobs.js";
2
- export { catchUnrecognizedEnum } from "./enums.js";
3
2
  export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js";
4
3
  export type { Result } from "./fp.js";
5
4
  export type { PageIterator, Paginator } from "./operations.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
package/types/index.js CHANGED
@@ -3,12 +3,10 @@
3
3
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RFCDate = exports.createPageIterator = exports.catchUnrecognizedEnum = exports.isBlobLike = exports.blobLikeSchema = void 0;
6
+ exports.RFCDate = exports.createPageIterator = exports.isBlobLike = exports.blobLikeSchema = void 0;
7
7
  var blobs_js_1 = require("./blobs.js");
8
8
  Object.defineProperty(exports, "blobLikeSchema", { enumerable: true, get: function () { return blobs_js_1.blobLikeSchema; } });
9
9
  Object.defineProperty(exports, "isBlobLike", { enumerable: true, get: function () { return blobs_js_1.isBlobLike; } });
10
- var enums_js_1 = require("./enums.js");
11
- Object.defineProperty(exports, "catchUnrecognizedEnum", { enumerable: true, get: function () { return enums_js_1.catchUnrecognizedEnum; } });
12
10
  var operations_js_1 = require("./operations.js");
13
11
  Object.defineProperty(exports, "createPageIterator", { enumerable: true, get: function () { return operations_js_1.createPageIterator; } });
14
12
  var rfcdate_js_1 = require("./rfcdate.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAwD;AAA/C,0GAAA,cAAc,OAAA;AAAE,sGAAA,UAAU,OAAA;AACnC,uCAAmD;AAA1C,iHAAA,qBAAqB,OAAA;AAI9B,iDAAqD;AAA5C,mHAAA,kBAAkB,OAAA;AAC3B,2CAAuC;AAA9B,qGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAwD;AAA/C,0GAAA,cAAc,OAAA;AAAE,sGAAA,UAAU,OAAA;AAInC,iDAAqD;AAA5C,mHAAA,kBAAkB,OAAA;AAC3B,2CAAuC;AAA9B,qGAAA,OAAO,OAAA"}