@a1liu/solidarity-tech-api 0.1.6 → 0.1.7

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,255 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Zod schemas for the only endpoints whose responses are described with a body
4
+ * schema in the OpenAPI document. Every other endpoint documents its response
5
+ * with a bare description, so those calls fall back to `z.unknown()`.
6
+ */
7
+ /** Pagination envelope returned alongside every list response. */
8
+ export declare const paginationMeta: z.ZodObject<{
9
+ total_count: z.ZodNumber;
10
+ limit: z.ZodNumber;
11
+ offset: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ /** Postal address embedded in a user record. */
14
+ export declare const userAddress: z.ZodObject<{
15
+ address1: z.ZodNullable<z.ZodString>;
16
+ address2: z.ZodNullable<z.ZodString>;
17
+ city: z.ZodNullable<z.ZodString>;
18
+ state: z.ZodNullable<z.ZodString>;
19
+ zip_code: z.ZodNullable<z.ZodString>;
20
+ country: z.ZodNullable<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ export declare const activity: z.ZodObject<{
23
+ id: z.ZodNumber;
24
+ user_id: z.ZodNumber;
25
+ name: z.ZodString;
26
+ actionable_id: z.ZodNumber;
27
+ actionable_type: z.ZodString;
28
+ action: z.ZodObject<{
29
+ id: z.ZodNumber;
30
+ user_id: z.ZodNumber;
31
+ agent_user_id: z.ZodNullable<z.ZodNumber>;
32
+ field_type: z.ZodNullable<z.ZodString>;
33
+ old_value: z.ZodNullable<z.ZodString>;
34
+ new_value: z.ZodNullable<z.ZodString>;
35
+ data_import_id: z.ZodNullable<z.ZodNumber>;
36
+ created_at: z.ZodString;
37
+ updated_at: z.ZodString;
38
+ }, z.core.$strip>;
39
+ created_at: z.ZodString;
40
+ updated_at: z.ZodString;
41
+ }, z.core.$strip>;
42
+ export declare const activitiesResponse: z.ZodObject<{
43
+ data: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodNumber;
45
+ user_id: z.ZodNumber;
46
+ name: z.ZodString;
47
+ actionable_id: z.ZodNumber;
48
+ actionable_type: z.ZodString;
49
+ action: z.ZodObject<{
50
+ id: z.ZodNumber;
51
+ user_id: z.ZodNumber;
52
+ agent_user_id: z.ZodNullable<z.ZodNumber>;
53
+ field_type: z.ZodNullable<z.ZodString>;
54
+ old_value: z.ZodNullable<z.ZodString>;
55
+ new_value: z.ZodNullable<z.ZodString>;
56
+ data_import_id: z.ZodNullable<z.ZodNumber>;
57
+ created_at: z.ZodString;
58
+ updated_at: z.ZodString;
59
+ }, z.core.$strip>;
60
+ created_at: z.ZodString;
61
+ updated_at: z.ZodString;
62
+ }, z.core.$strip>>;
63
+ meta: z.ZodObject<{
64
+ total_count: z.ZodNumber;
65
+ limit: z.ZodNumber;
66
+ offset: z.ZodNumber;
67
+ }, z.core.$strip>;
68
+ }, z.core.$strip>;
69
+ export declare const call: z.ZodObject<{
70
+ id: z.ZodNumber;
71
+ user_id: z.ZodNumber;
72
+ direction: z.ZodString;
73
+ agent_user_id: z.ZodNullable<z.ZodNumber>;
74
+ duration: z.ZodNumber;
75
+ picked_up: z.ZodBoolean;
76
+ left_voicemail: z.ZodBoolean;
77
+ twilio_call_sid: z.ZodString;
78
+ created_at: z.ZodString;
79
+ ended_at: z.ZodString;
80
+ }, z.core.$strip>;
81
+ export declare const callsResponse: z.ZodObject<{
82
+ data: z.ZodArray<z.ZodObject<{
83
+ id: z.ZodNumber;
84
+ user_id: z.ZodNumber;
85
+ direction: z.ZodString;
86
+ agent_user_id: z.ZodNullable<z.ZodNumber>;
87
+ duration: z.ZodNumber;
88
+ picked_up: z.ZodBoolean;
89
+ left_voicemail: z.ZodBoolean;
90
+ twilio_call_sid: z.ZodString;
91
+ created_at: z.ZodString;
92
+ ended_at: z.ZodString;
93
+ }, z.core.$strip>>;
94
+ meta: z.ZodObject<{
95
+ total_count: z.ZodNumber;
96
+ limit: z.ZodNumber;
97
+ offset: z.ZodNumber;
98
+ }, z.core.$strip>;
99
+ }, z.core.$strip>;
100
+ export declare const chapter: z.ZodObject<{
101
+ id: z.ZodNumber;
102
+ name: z.ZodString;
103
+ logo_url: z.ZodNullable<z.ZodString>;
104
+ organization_id: z.ZodNumber;
105
+ chapter_phone_number: z.ZodString;
106
+ }, z.core.$strip>;
107
+ export declare const chaptersResponse: z.ZodObject<{
108
+ data: z.ZodArray<z.ZodObject<{
109
+ id: z.ZodNumber;
110
+ name: z.ZodString;
111
+ logo_url: z.ZodNullable<z.ZodString>;
112
+ organization_id: z.ZodNumber;
113
+ chapter_phone_number: z.ZodString;
114
+ }, z.core.$strip>>;
115
+ meta: z.ZodObject<{
116
+ total_count: z.ZodNumber;
117
+ limit: z.ZodNumber;
118
+ offset: z.ZodNumber;
119
+ }, z.core.$strip>;
120
+ }, z.core.$strip>;
121
+ export declare const customUserProperty: z.ZodObject<{
122
+ id: z.ZodNumber;
123
+ name: z.ZodString;
124
+ key: z.ZodString;
125
+ field_type: z.ZodString;
126
+ options: z.ZodNullable<z.ZodArray<z.ZodObject<{
127
+ label: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
128
+ value: z.ZodString;
129
+ }, z.core.$strip>>>;
130
+ scope_id: z.ZodNumber;
131
+ scope_type: z.ZodEnum<{
132
+ Organization: "Organization";
133
+ Chapter: "Chapter";
134
+ }>;
135
+ }, z.core.$strip>;
136
+ export declare const customUserPropertiesResponse: z.ZodObject<{
137
+ data: z.ZodArray<z.ZodObject<{
138
+ id: z.ZodNumber;
139
+ name: z.ZodString;
140
+ key: z.ZodString;
141
+ field_type: z.ZodString;
142
+ options: z.ZodNullable<z.ZodArray<z.ZodObject<{
143
+ label: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
144
+ value: z.ZodString;
145
+ }, z.core.$strip>>>;
146
+ scope_id: z.ZodNumber;
147
+ scope_type: z.ZodEnum<{
148
+ Organization: "Organization";
149
+ Chapter: "Chapter";
150
+ }>;
151
+ }, z.core.$strip>>;
152
+ meta: z.ZodObject<{
153
+ total_count: z.ZodNumber;
154
+ limit: z.ZodNumber;
155
+ offset: z.ZodNumber;
156
+ }, z.core.$strip>;
157
+ }, z.core.$strip>;
158
+ export declare const text: z.ZodObject<{
159
+ id: z.ZodNumber;
160
+ user_id: z.ZodNumber;
161
+ direction: z.ZodString;
162
+ body: z.ZodString;
163
+ media_urls: z.ZodArray<z.ZodString>;
164
+ segment_size: z.ZodNumber;
165
+ chapter_phone_number_id: z.ZodNumber;
166
+ twilio_error_code: z.ZodNullable<z.ZodNumber>;
167
+ created_at: z.ZodString;
168
+ }, z.core.$strip>;
169
+ export declare const textsResponse: z.ZodObject<{
170
+ data: z.ZodArray<z.ZodObject<{
171
+ id: z.ZodNumber;
172
+ user_id: z.ZodNumber;
173
+ direction: z.ZodString;
174
+ body: z.ZodString;
175
+ media_urls: z.ZodArray<z.ZodString>;
176
+ segment_size: z.ZodNumber;
177
+ chapter_phone_number_id: z.ZodNumber;
178
+ twilio_error_code: z.ZodNullable<z.ZodNumber>;
179
+ created_at: z.ZodString;
180
+ }, z.core.$strip>>;
181
+ meta: z.ZodObject<{
182
+ total_count: z.ZodNumber;
183
+ limit: z.ZodNumber;
184
+ offset: z.ZodNumber;
185
+ }, z.core.$strip>;
186
+ }, z.core.$strip>;
187
+ export declare const user: z.ZodObject<{
188
+ id: z.ZodNumber;
189
+ hash_id: z.ZodString;
190
+ phone_number: z.ZodNullable<z.ZodString>;
191
+ email: z.ZodNullable<z.ZodString>;
192
+ first_name: z.ZodNullable<z.ZodString>;
193
+ last_name: z.ZodNullable<z.ZodString>;
194
+ preferred_language: z.ZodString;
195
+ second_language: z.ZodNullable<z.ZodString>;
196
+ chapter_id: z.ZodNumber;
197
+ branch_id: z.ZodNullable<z.ZodNumber>;
198
+ created_at: z.ZodString;
199
+ custom_user_properties: z.ZodRecord<z.ZodString, z.ZodString>;
200
+ address: z.ZodObject<{
201
+ address1: z.ZodNullable<z.ZodString>;
202
+ address2: z.ZodNullable<z.ZodString>;
203
+ city: z.ZodNullable<z.ZodString>;
204
+ state: z.ZodNullable<z.ZodString>;
205
+ zip_code: z.ZodNullable<z.ZodString>;
206
+ country: z.ZodNullable<z.ZodString>;
207
+ }, z.core.$strip>;
208
+ sms_permission: z.ZodBoolean;
209
+ call_permission: z.ZodBoolean;
210
+ email_permission: z.ZodBoolean;
211
+ }, z.core.$strip>;
212
+ export declare const usersResponse: z.ZodObject<{
213
+ data: z.ZodArray<z.ZodObject<{
214
+ id: z.ZodNumber;
215
+ hash_id: z.ZodString;
216
+ phone_number: z.ZodNullable<z.ZodString>;
217
+ email: z.ZodNullable<z.ZodString>;
218
+ first_name: z.ZodNullable<z.ZodString>;
219
+ last_name: z.ZodNullable<z.ZodString>;
220
+ preferred_language: z.ZodString;
221
+ second_language: z.ZodNullable<z.ZodString>;
222
+ chapter_id: z.ZodNumber;
223
+ branch_id: z.ZodNullable<z.ZodNumber>;
224
+ created_at: z.ZodString;
225
+ custom_user_properties: z.ZodRecord<z.ZodString, z.ZodString>;
226
+ address: z.ZodObject<{
227
+ address1: z.ZodNullable<z.ZodString>;
228
+ address2: z.ZodNullable<z.ZodString>;
229
+ city: z.ZodNullable<z.ZodString>;
230
+ state: z.ZodNullable<z.ZodString>;
231
+ zip_code: z.ZodNullable<z.ZodString>;
232
+ country: z.ZodNullable<z.ZodString>;
233
+ }, z.core.$strip>;
234
+ sms_permission: z.ZodBoolean;
235
+ call_permission: z.ZodBoolean;
236
+ email_permission: z.ZodBoolean;
237
+ }, z.core.$strip>>;
238
+ meta: z.ZodObject<{
239
+ total_count: z.ZodNumber;
240
+ limit: z.ZodNumber;
241
+ offset: z.ZodNumber;
242
+ }, z.core.$strip>;
243
+ }, z.core.$strip>;
244
+ export type Activity = z.infer<typeof activity>;
245
+ export type ActivitiesResponse = z.infer<typeof activitiesResponse>;
246
+ export type Call = z.infer<typeof call>;
247
+ export type CallsResponse = z.infer<typeof callsResponse>;
248
+ export type Chapter = z.infer<typeof chapter>;
249
+ export type ChaptersResponse = z.infer<typeof chaptersResponse>;
250
+ export type CustomUserProperty = z.infer<typeof customUserProperty>;
251
+ export type CustomUserPropertiesResponse = z.infer<typeof customUserPropertiesResponse>;
252
+ export type Text = z.infer<typeof text>;
253
+ export type TextsResponse = z.infer<typeof textsResponse>;
254
+ export type User = z.infer<typeof user>;
255
+ export type UsersResponse = z.infer<typeof usersResponse>;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usersResponse = exports.user = exports.textsResponse = exports.text = exports.customUserPropertiesResponse = exports.customUserProperty = exports.chaptersResponse = exports.chapter = exports.callsResponse = exports.call = exports.activitiesResponse = exports.activity = exports.userAddress = exports.paginationMeta = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Zod schemas for the only endpoints whose responses are described with a body
7
+ * schema in the OpenAPI document. Every other endpoint documents its response
8
+ * with a bare description, so those calls fall back to `z.unknown()`.
9
+ */
10
+ /** Pagination envelope returned alongside every list response. */
11
+ exports.paginationMeta = zod_1.z.object({
12
+ total_count: zod_1.z.number().int(),
13
+ limit: zod_1.z.number().int(),
14
+ offset: zod_1.z.number().int(),
15
+ });
16
+ /** Postal address embedded in a user record. */
17
+ exports.userAddress = zod_1.z.object({
18
+ address1: zod_1.z.string().nullable(),
19
+ address2: zod_1.z.string().nullable(),
20
+ city: zod_1.z.string().nullable(),
21
+ state: zod_1.z.string().nullable(),
22
+ zip_code: zod_1.z.string().nullable(),
23
+ country: zod_1.z.string().nullable(),
24
+ });
25
+ // GET /activities
26
+ exports.activity = zod_1.z.object({
27
+ id: zod_1.z.number().int(),
28
+ user_id: zod_1.z.number().int(),
29
+ name: zod_1.z.string(),
30
+ actionable_id: zod_1.z.number().int(),
31
+ actionable_type: zod_1.z.string(),
32
+ action: zod_1.z.object({
33
+ id: zod_1.z.number().int(),
34
+ user_id: zod_1.z.number().int(),
35
+ agent_user_id: zod_1.z.number().int().nullable(),
36
+ field_type: zod_1.z.string().nullable(),
37
+ old_value: zod_1.z.string().nullable(),
38
+ new_value: zod_1.z.string().nullable(),
39
+ data_import_id: zod_1.z.number().int().nullable(),
40
+ created_at: zod_1.z.string(),
41
+ updated_at: zod_1.z.string(),
42
+ }),
43
+ created_at: zod_1.z.string(),
44
+ updated_at: zod_1.z.string(),
45
+ });
46
+ exports.activitiesResponse = zod_1.z.object({
47
+ data: zod_1.z.array(exports.activity),
48
+ meta: exports.paginationMeta,
49
+ });
50
+ // GET /calls
51
+ exports.call = zod_1.z.object({
52
+ id: zod_1.z.number().int(),
53
+ user_id: zod_1.z.number().int(),
54
+ direction: zod_1.z.string(),
55
+ agent_user_id: zod_1.z.number().int().nullable(),
56
+ duration: zod_1.z.number().int(),
57
+ picked_up: zod_1.z.boolean(),
58
+ left_voicemail: zod_1.z.boolean(),
59
+ twilio_call_sid: zod_1.z.string(),
60
+ created_at: zod_1.z.string(),
61
+ ended_at: zod_1.z.string(),
62
+ });
63
+ exports.callsResponse = zod_1.z.object({
64
+ data: zod_1.z.array(exports.call),
65
+ meta: exports.paginationMeta,
66
+ });
67
+ // GET /chapters
68
+ exports.chapter = zod_1.z.object({
69
+ id: zod_1.z.number().int(),
70
+ name: zod_1.z.string(),
71
+ logo_url: zod_1.z.string().nullable(),
72
+ organization_id: zod_1.z.number().int(),
73
+ chapter_phone_number: zod_1.z.string(),
74
+ });
75
+ exports.chaptersResponse = zod_1.z.object({
76
+ data: zod_1.z.array(exports.chapter),
77
+ meta: exports.paginationMeta,
78
+ });
79
+ // GET /custom_user_properties
80
+ exports.customUserProperty = zod_1.z.object({
81
+ id: zod_1.z.number().int(),
82
+ name: zod_1.z.string(),
83
+ key: zod_1.z.string(),
84
+ field_type: zod_1.z.string(),
85
+ options: zod_1.z
86
+ .array(zod_1.z.object({
87
+ label: zod_1.z.record(zod_1.z.string(), zod_1.z.string().nullable()),
88
+ value: zod_1.z.string(),
89
+ }))
90
+ .nullable(),
91
+ scope_id: zod_1.z.number().int(),
92
+ scope_type: zod_1.z.enum(["Organization", "Chapter"]),
93
+ });
94
+ exports.customUserPropertiesResponse = zod_1.z.object({
95
+ data: zod_1.z.array(exports.customUserProperty),
96
+ meta: exports.paginationMeta,
97
+ });
98
+ // GET /texts
99
+ exports.text = zod_1.z.object({
100
+ id: zod_1.z.number().int(),
101
+ user_id: zod_1.z.number().int(),
102
+ direction: zod_1.z.string(),
103
+ body: zod_1.z.string(),
104
+ media_urls: zod_1.z.array(zod_1.z.string()),
105
+ segment_size: zod_1.z.number().int(),
106
+ chapter_phone_number_id: zod_1.z.number().int(),
107
+ twilio_error_code: zod_1.z.number().int().nullable(),
108
+ created_at: zod_1.z.string(),
109
+ });
110
+ exports.textsResponse = zod_1.z.object({
111
+ data: zod_1.z.array(exports.text),
112
+ meta: exports.paginationMeta,
113
+ });
114
+ // GET /users
115
+ exports.user = zod_1.z.object({
116
+ id: zod_1.z.number().int(),
117
+ hash_id: zod_1.z.string(),
118
+ phone_number: zod_1.z.string().nullable(),
119
+ email: zod_1.z.string().nullable(),
120
+ first_name: zod_1.z.string().nullable(),
121
+ last_name: zod_1.z.string().nullable(),
122
+ preferred_language: zod_1.z.string(),
123
+ second_language: zod_1.z.string().nullable(),
124
+ chapter_id: zod_1.z.number().int(),
125
+ branch_id: zod_1.z.number().int().nullable(),
126
+ created_at: zod_1.z.string(),
127
+ custom_user_properties: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
128
+ address: exports.userAddress,
129
+ sms_permission: zod_1.z.boolean(),
130
+ call_permission: zod_1.z.boolean(),
131
+ email_permission: zod_1.z.boolean(),
132
+ });
133
+ exports.usersResponse = zod_1.z.object({
134
+ data: zod_1.z.array(exports.user),
135
+ meta: exports.paginationMeta,
136
+ });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@a1liu/solidarity-tech-api",
3
3
  "main": "dist/index.js",
4
4
  "types": "dist/index.d.ts",
5
- "version": "0.1.6",
5
+ "version": "0.1.7",
6
6
  "devDependencies": {
7
7
  "@types/bun": "latest"
8
8
  },
@@ -10,16 +10,14 @@
10
10
  "typescript": "^5.0.0"
11
11
  },
12
12
  "scripts": {
13
- "compile": "tsc -p tsconfig.build.json"
13
+ "compile": "tsc -p tsconfig.build.json",
14
+ "update": "./script.sh"
14
15
  },
15
16
  "files": [
16
17
  "dist"
17
18
  ],
18
19
  "dependencies": {
19
- "@api/solidarity-tech": "file:.api/apis/solidarity-tech",
20
- "api": "^6.1.1",
21
- "json-schema-to-ts": "^3.1.0",
22
- "oas": "^24.3.6"
20
+ "zod": "^4.4.3"
23
21
  },
24
22
  "repository": {
25
23
  "type": "git",