@cohostvip/cohost-types 0.3.4

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.
@@ -0,0 +1,169 @@
1
+ import { z } from "zod";
2
+ export type ApiVersion = "2025-04-15" | "2025-07-15" | "2025-12-15";
3
+ export declare const apiVersion: ApiVersion;
4
+ export declare const apiVersionSchema: z.ZodDefault<z.ZodEnum<["2025-04-15", "2025-07-15", "2025-12-15"]>>;
5
+ /**
6
+ * A namespaced identifier representing the entity an order is associated with.
7
+ *
8
+ * Must begin with one of the following prefixes:
9
+ * - "evt_" for events
10
+ * - "ven_" for venues
11
+ * - "org_" for organizers
12
+ *
13
+ * @example "evt_abc123"
14
+ * @example "org_def456"
15
+ *
16
+ * @schema string()
17
+ * @pattern ^((evt|ven|org)_[a-zA-Z0-9]+)$
18
+ */
19
+ export declare const contextIdSchema: z.ZodString;
20
+ /**
21
+ * Schema for MultipartText - a rich content object that supports multiple representations of text.
22
+ * Allows content to be stored and retrieved in various formats (HTML, plain text, markdown, or structured blocks).
23
+ * This enables flexible rendering and editing across different contexts and platforms.
24
+ */
25
+ export declare const multipartTextSchema: z.ZodObject<{
26
+ /** HTML version of the content. */
27
+ html: z.ZodOptional<z.ZodString>;
28
+ /** Plain text version of the content. */
29
+ text: z.ZodOptional<z.ZodString>;
30
+ /** Markdown version of the content. */
31
+ md: z.ZodOptional<z.ZodString>;
32
+ /** Optional rich editor blocks (if structured editing is supported). */
33
+ blocks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodAny, "many">>>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ html?: string | undefined;
36
+ text?: string | undefined;
37
+ md?: string | undefined;
38
+ blocks?: any[] | null | undefined;
39
+ }, {
40
+ html?: string | undefined;
41
+ text?: string | undefined;
42
+ md?: string | undefined;
43
+ blocks?: any[] | null | undefined;
44
+ }>;
45
+ /**
46
+ * A photo object with resolution options and optional metadata.
47
+ */
48
+ export declare const photoSchema: z.ZodObject<{
49
+ /** High-resolution (2x) image URL. */
50
+ "2x": z.ZodOptional<z.ZodString>;
51
+ /** Internal photo ID, if stored in a media system. */
52
+ id: z.ZodOptional<z.ZodString>;
53
+ /**
54
+ * Primary image URL.
55
+ * This is the default image URL to be used when no other resolution is specified.
56
+ *
57
+ * @example "https://picsum.photos/500"
58
+ *
59
+ *
60
+ * @x-faker image.imageUrl
61
+ */
62
+ url: z.ZodString;
63
+ /** Width of the image in pixels. */
64
+ width: z.ZodOptional<z.ZodNumber>;
65
+ /** Height of the image in pixels. */
66
+ height: z.ZodOptional<z.ZodNumber>;
67
+ /** Optional caption for the image. */
68
+ caption: z.ZodOptional<z.ZodString>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ url: string;
71
+ "2x"?: string | undefined;
72
+ id?: string | undefined;
73
+ width?: number | undefined;
74
+ height?: number | undefined;
75
+ caption?: string | undefined;
76
+ }, {
77
+ url: string;
78
+ "2x"?: string | undefined;
79
+ id?: string | undefined;
80
+ width?: number | undefined;
81
+ height?: number | undefined;
82
+ caption?: string | undefined;
83
+ }>;
84
+ /**
85
+ * Base metadata for any record stored in the system.
86
+ * Includes an ID and timestamps for creation and optional updates.
87
+ *
88
+ * @export
89
+ */
90
+ export declare const dataRecordSchema: z.ZodObject<{
91
+ /**
92
+ * Unique identifier for the record.
93
+ * @example "rec_123abc"
94
+ */
95
+ id: z.ZodString;
96
+ /**
97
+ * ISO 8601 timestamp indicating when the record was created.
98
+ * @example "2025-04-16T10:15:00Z"
99
+ */
100
+ created: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
101
+ /**
102
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
103
+ * @example "2025-04-18T08:00:00Z"
104
+ */
105
+ changed: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ id: string;
108
+ created: string;
109
+ changed: string;
110
+ }, {
111
+ id: string;
112
+ created?: string | undefined;
113
+ changed?: string | undefined;
114
+ }>;
115
+ export declare const upsertableDataRecordSchema: z.ZodObject<{
116
+ created: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
117
+ changed: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
118
+ } & {
119
+ id: z.ZodOptional<z.ZodString>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ created: string;
122
+ changed: string;
123
+ id?: string | undefined;
124
+ }, {
125
+ id?: string | undefined;
126
+ created?: string | undefined;
127
+ changed?: string | undefined;
128
+ }>;
129
+ /**
130
+ * Extension of `DataRecord` for resources returned from RESTful APIs.
131
+ * Includes a schema version to ensure compatibility with evolving formats.
132
+ *
133
+ * @export
134
+ */
135
+ export declare const versionedDataRecordSchema: z.ZodObject<{
136
+ /**
137
+ * Unique identifier for the record.
138
+ * @example "rec_123abc"
139
+ */
140
+ id: z.ZodString;
141
+ /**
142
+ * ISO 8601 timestamp indicating when the record was created.
143
+ * @example "2025-04-16T10:15:00Z"
144
+ */
145
+ created: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
146
+ /**
147
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
148
+ * @example "2025-04-18T08:00:00Z"
149
+ */
150
+ changed: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
151
+ } & {
152
+ /**
153
+ * Schema version identifier for this record.
154
+ * Helps manage compatibility across client-server contracts.
155
+ * @example "2025-01-10"
156
+ */
157
+ version: z.ZodDefault<z.ZodEnum<["2025-04-15", "2025-07-15", "2025-12-15"]>>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ id: string;
160
+ created: string;
161
+ changed: string;
162
+ version: "2025-04-15" | "2025-07-15" | "2025-12-15";
163
+ }, {
164
+ id: string;
165
+ created?: string | undefined;
166
+ changed?: string | undefined;
167
+ version?: "2025-04-15" | "2025-07-15" | "2025-12-15" | undefined;
168
+ }>;
169
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEpE,eAAO,MAAM,UAAU,EAAE,UAAyB,CAAC;AAEnD,eAAO,MAAM,gBAAgB,qEAA2E,CAAC;AAEzG;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,aAAqD,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B,mCAAmC;;IAGnC,yCAAyC;;IAGzC,uCAAuC;;IAGvC,wEAAwE;;;;;;;;;;;;EAExE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;IACtB,sCAAsC;;IAGtC,sDAAsD;;IAGtD;;;;;;;;OAQG;;IAGH,oCAAoC;;IAGpC,qCAAqC;;IAGrC,sCAAsC;;;;;;;;;;;;;;;;EAEtC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;OAGG;;IAGH;;;OAGG;;IAKH;;;OAGG;;;;;;;;;;EAIH,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;EAErC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;IAjCpC;;;OAGG;;IAGH;;;OAGG;;IAKH;;;OAGG;;;IAiBH;;;;OAIG;;;;;;;;;;;;EAEH,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { z } from "zod";
2
+ export const apiVersion = "2025-12-15";
3
+ export const apiVersionSchema = z.enum(["2025-04-15", "2025-07-15", "2025-12-15"]).default("2025-12-15");
4
+ /**
5
+ * A namespaced identifier representing the entity an order is associated with.
6
+ *
7
+ * Must begin with one of the following prefixes:
8
+ * - "evt_" for events
9
+ * - "ven_" for venues
10
+ * - "org_" for organizers
11
+ *
12
+ * @example "evt_abc123"
13
+ * @example "org_def456"
14
+ *
15
+ * @schema string()
16
+ * @pattern ^((evt|ven|org)_[a-zA-Z0-9]+)$
17
+ */
18
+ export const contextIdSchema = z.string().regex(/^((evt|ven|org)_[a-zA-Z0-9]+)$/);
19
+ /**
20
+ * Schema for MultipartText - a rich content object that supports multiple representations of text.
21
+ * Allows content to be stored and retrieved in various formats (HTML, plain text, markdown, or structured blocks).
22
+ * This enables flexible rendering and editing across different contexts and platforms.
23
+ */
24
+ export const multipartTextSchema = z.object({
25
+ /** HTML version of the content. */
26
+ html: z.string().optional().describe("HTML version of the content"),
27
+ /** Plain text version of the content. */
28
+ text: z.string().optional().describe("Plain text version of the content"),
29
+ /** Markdown version of the content. */
30
+ md: z.string().optional().describe("Markdown version of the content"),
31
+ /** Optional rich editor blocks (if structured editing is supported). */
32
+ blocks: z.array(z.any()).nullable().optional().describe("Optional rich editor blocks for structured editing"),
33
+ });
34
+ /**
35
+ * A photo object with resolution options and optional metadata.
36
+ */
37
+ export const photoSchema = z.object({
38
+ /** High-resolution (2x) image URL. */
39
+ "2x": z.string().optional(),
40
+ /** Internal photo ID, if stored in a media system. */
41
+ id: z.string().optional(),
42
+ /**
43
+ * Primary image URL.
44
+ * This is the default image URL to be used when no other resolution is specified.
45
+ *
46
+ * @example "https://picsum.photos/500"
47
+ *
48
+ *
49
+ * @x-faker image.imageUrl
50
+ */
51
+ url: z.string().min(5).max(2048),
52
+ /** Width of the image in pixels. */
53
+ width: z.number().optional(),
54
+ /** Height of the image in pixels. */
55
+ height: z.number().optional(),
56
+ /** Optional caption for the image. */
57
+ caption: z.string().optional(),
58
+ });
59
+ /**
60
+ * Base metadata for any record stored in the system.
61
+ * Includes an ID and timestamps for creation and optional updates.
62
+ *
63
+ * @export
64
+ */
65
+ export const dataRecordSchema = z.object({
66
+ /**
67
+ * Unique identifier for the record.
68
+ * @example "rec_123abc"
69
+ */
70
+ id: z.string(),
71
+ /**
72
+ * ISO 8601 timestamp indicating when the record was created.
73
+ * @example "2025-04-16T10:15:00Z"
74
+ */
75
+ created: z.string().refine((val) => !Number.isNaN(Date.parse(val)), {
76
+ message: "Invalid ISO 8601 date string",
77
+ }).default(new Date().toISOString()),
78
+ /**
79
+ * ISO 8601 timestamp indicating when the record was last updated, if applicable.
80
+ * @example "2025-04-18T08:00:00Z"
81
+ */
82
+ changed: z.string().refine((val) => !Number.isNaN(Date.parse(val)), {
83
+ message: "Invalid ISO 8601 date string",
84
+ }).default(new Date().toISOString()),
85
+ });
86
+ export const upsertableDataRecordSchema = dataRecordSchema.extend({
87
+ id: dataRecordSchema.shape.id.optional(),
88
+ });
89
+ /**
90
+ * Extension of `DataRecord` for resources returned from RESTful APIs.
91
+ * Includes a schema version to ensure compatibility with evolving formats.
92
+ *
93
+ * @export
94
+ */
95
+ export const versionedDataRecordSchema = dataRecordSchema.extend({
96
+ /**
97
+ * Schema version identifier for this record.
98
+ * Helps manage compatibility across client-server contracts.
99
+ * @example "2025-01-10"
100
+ */
101
+ version: apiVersionSchema,
102
+ });
103
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,UAAU,GAAe,YAAY,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAEzG;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAElF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,mCAAmC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,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AAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;QAClE,OAAO,EAAE,8BAA8B;KACxC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEpC;;;OAGG;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;QAClE,OAAO,EAAE,8BAA8B;KACxC,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAChE,EAAE,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC/D;;;;OAIG;IACH,OAAO,EAAE,gBAAgB;CAC1B,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@cohostvip/cohost-types",
3
+ "version": "0.3.4",
4
+ "description": "TypeScript type definitions for the Cohost API",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc --project tsconfig.json",
20
+ "dev": "tsc --watch --project tsconfig.json",
21
+ "clean": "rm -rf dist",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "^5.0.0",
26
+ "zod": "^3.23.0"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/cohostvip/cohost-js.git",
31
+ "directory": "packages/types"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/cohostvip/cohost-js/issues"
35
+ },
36
+ "homepage": "https://github.com/cohostvip/cohost-js/tree/main/packages/types",
37
+ "author": "Cohost <support@cohost.vip> (https://cohost.vip)",
38
+ "license": "MIT",
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "keywords": [
46
+ "cohost",
47
+ "types",
48
+ "typescript",
49
+ "sdk"
50
+ ]
51
+ }