@automate.ax/integration-contracts 0.147.0 → 0.147.1

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.
package/dist/tally/api.js CHANGED
@@ -107,7 +107,7 @@ async function sendTallyRequest(apiKey, path, options) {
107
107
  redirect: "error",
108
108
  });
109
109
  const text = await response.text();
110
- const parsed = text ? parseJson(text) : undefined;
110
+ const parsed = text ? parseJson(text, response.ok) : undefined;
111
111
  if (!response.ok) {
112
112
  const body = encodableSchema.safeParse(parsed);
113
113
  throw new TallyApiError({
@@ -136,13 +136,16 @@ function isTraversalSegment(segment) {
136
136
  * Parses one JSON response or reports a provider contract failure.
137
137
  *
138
138
  * @param text Provider response text.
139
+ * @param requireJson Whether a successful response must contain valid JSON.
139
140
  * @throws When the provider response is not valid JSON.
140
141
  */
141
- function parseJson(text) {
142
+ function parseJson(text, requireJson) {
142
143
  try {
143
144
  return JSON.parse(text);
144
145
  }
145
146
  catch {
147
+ if (!requireJson)
148
+ return text;
146
149
  throw new Error("Tally API returned invalid JSON.");
147
150
  }
148
151
  }
@@ -21,7 +21,6 @@ export declare const TALLY_FORM_RESPONSE_EVENT_SCHEMA: z.ZodObject<{
21
21
  text: z.ZodString;
22
22
  }, z.core.$strip>>>;
23
23
  type: z.ZodEnum<{
24
- MATRIX: "MATRIX";
25
24
  INPUT_TEXT: "INPUT_TEXT";
26
25
  INPUT_NUMBER: "INPUT_NUMBER";
27
26
  INPUT_EMAIL: "INPUT_EMAIL";
@@ -30,13 +29,14 @@ export declare const TALLY_FORM_RESPONSE_EVENT_SCHEMA: z.ZodObject<{
30
29
  INPUT_DATE: "INPUT_DATE";
31
30
  INPUT_TIME: "INPUT_TIME";
32
31
  TEXTAREA: "TEXTAREA";
33
- FILE_UPLOAD: "FILE_UPLOAD";
34
- LINEAR_SCALE: "LINEAR_SCALE";
35
32
  RATING: "RATING";
33
+ LINEAR_SCALE: "LINEAR_SCALE";
36
34
  HIDDEN_FIELDS: "HIDDEN_FIELDS";
35
+ CALCULATED_FIELDS: "CALCULATED_FIELDS";
36
+ MATRIX: "MATRIX";
37
+ FILE_UPLOAD: "FILE_UPLOAD";
37
38
  PAYMENT: "PAYMENT";
38
39
  SIGNATURE: "SIGNATURE";
39
- CALCULATED_FIELDS: "CALCULATED_FIELDS";
40
40
  MULTIPLE_CHOICE: "MULTIPLE_CHOICE";
41
41
  CHECKBOXES: "CHECKBOXES";
42
42
  DROPDOWN: "DROPDOWN";
@@ -91,7 +91,6 @@ export declare const tallyTriggerContracts: {
91
91
  text: z.ZodString;
92
92
  }, z.core.$strip>>>;
93
93
  type: z.ZodEnum<{
94
- MATRIX: "MATRIX";
95
94
  INPUT_TEXT: "INPUT_TEXT";
96
95
  INPUT_NUMBER: "INPUT_NUMBER";
97
96
  INPUT_EMAIL: "INPUT_EMAIL";
@@ -100,13 +99,14 @@ export declare const tallyTriggerContracts: {
100
99
  INPUT_DATE: "INPUT_DATE";
101
100
  INPUT_TIME: "INPUT_TIME";
102
101
  TEXTAREA: "TEXTAREA";
103
- FILE_UPLOAD: "FILE_UPLOAD";
104
- LINEAR_SCALE: "LINEAR_SCALE";
105
102
  RATING: "RATING";
103
+ LINEAR_SCALE: "LINEAR_SCALE";
106
104
  HIDDEN_FIELDS: "HIDDEN_FIELDS";
105
+ CALCULATED_FIELDS: "CALCULATED_FIELDS";
106
+ MATRIX: "MATRIX";
107
+ FILE_UPLOAD: "FILE_UPLOAD";
107
108
  PAYMENT: "PAYMENT";
108
109
  SIGNATURE: "SIGNATURE";
109
- CALCULATED_FIELDS: "CALCULATED_FIELDS";
110
110
  MULTIPLE_CHOICE: "MULTIPLE_CHOICE";
111
111
  CHECKBOXES: "CHECKBOXES";
112
112
  DROPDOWN: "DROPDOWN";
@@ -157,7 +157,6 @@ export declare const tallyTriggerContracts: {
157
157
  text: z.ZodString;
158
158
  }, z.core.$strip>>>;
159
159
  type: z.ZodEnum<{
160
- MATRIX: "MATRIX";
161
160
  INPUT_TEXT: "INPUT_TEXT";
162
161
  INPUT_NUMBER: "INPUT_NUMBER";
163
162
  INPUT_EMAIL: "INPUT_EMAIL";
@@ -166,13 +165,14 @@ export declare const tallyTriggerContracts: {
166
165
  INPUT_DATE: "INPUT_DATE";
167
166
  INPUT_TIME: "INPUT_TIME";
168
167
  TEXTAREA: "TEXTAREA";
169
- FILE_UPLOAD: "FILE_UPLOAD";
170
- LINEAR_SCALE: "LINEAR_SCALE";
171
168
  RATING: "RATING";
169
+ LINEAR_SCALE: "LINEAR_SCALE";
172
170
  HIDDEN_FIELDS: "HIDDEN_FIELDS";
171
+ CALCULATED_FIELDS: "CALCULATED_FIELDS";
172
+ MATRIX: "MATRIX";
173
+ FILE_UPLOAD: "FILE_UPLOAD";
173
174
  PAYMENT: "PAYMENT";
174
175
  SIGNATURE: "SIGNATURE";
175
- CALCULATED_FIELDS: "CALCULATED_FIELDS";
176
176
  MULTIPLE_CHOICE: "MULTIPLE_CHOICE";
177
177
  CHECKBOXES: "CHECKBOXES";
178
178
  DROPDOWN: "DROPDOWN";
@@ -366,7 +366,14 @@
366
366
  "type": "string"
367
367
  },
368
368
  "name": {
369
- "type": "string"
369
+ "anyOf": [
370
+ {
371
+ "type": "string"
372
+ },
373
+ {
374
+ "type": "null"
375
+ }
376
+ ]
370
377
  },
371
378
  "workspaceId": {
372
379
  "type": "string"
@@ -686,7 +693,14 @@
686
693
  "type": "string"
687
694
  },
688
695
  "name": {
689
- "type": "string"
696
+ "anyOf": [
697
+ {
698
+ "type": "string"
699
+ },
700
+ {
701
+ "type": "null"
702
+ }
703
+ ]
690
704
  },
691
705
  "index": {
692
706
  "type": "integer"
@@ -773,7 +787,7 @@
773
787
  "format": "uuid"
774
788
  },
775
789
  "type": {
776
- "$ref": "#/$defs/BlockType"
790
+ "$ref": "#/$defs/FieldType"
777
791
  },
778
792
  "blockGroupUuid": {
779
793
  "type": "string",
@@ -781,6 +795,9 @@
781
795
  },
782
796
  "title": {
783
797
  "type": "string"
798
+ },
799
+ "questionType": {
800
+ "$ref": "#/$defs/FieldQuestionType"
784
801
  }
785
802
  }
786
803
  },
@@ -4338,7 +4355,19 @@
4338
4355
  "type": "object",
4339
4356
  "properties": {
4340
4357
  "settings": {
4341
- "$ref": "#/$defs/FormSettings"
4358
+ "anyOf": [
4359
+ {
4360
+ "type": "object",
4361
+ "allOf": [
4362
+ {
4363
+ "$ref": "#/$defs/FormSettings"
4364
+ }
4365
+ ]
4366
+ },
4367
+ {
4368
+ "type": "null"
4369
+ }
4370
+ ]
4342
4371
  },
4343
4372
  "blocks": {
4344
4373
  "type": "array",
@@ -4595,7 +4624,12 @@
4595
4624
  "required": ["blocks"]
4596
4625
  },
4597
4626
  "PatchFormsFormIdBlocksResponse": {
4598
- "$ref": "#/$defs/Block"
4627
+ "type": "object",
4628
+ "allOf": [
4629
+ {
4630
+ "$ref": "#/$defs/Form"
4631
+ }
4632
+ ]
4599
4633
  },
4600
4634
  "GetFormsFormIdSubmissionsResponse": {
4601
4635
  "type": "object",
@@ -197,7 +197,7 @@ export interface components {
197
197
  };
198
198
  Form: {
199
199
  id: string;
200
- name: string;
200
+ name: string | null;
201
201
  workspaceId: string;
202
202
  status: components["schemas"]["FormStatus"];
203
203
  numberOfSubmissions: number;
@@ -265,7 +265,7 @@ export interface components {
265
265
  };
266
266
  Workspace: {
267
267
  id: string;
268
- name: string;
268
+ name: string | null;
269
269
  index: number;
270
270
  members?: components["schemas"]["User"][];
271
271
  invites?: {
@@ -292,10 +292,11 @@ export interface components {
292
292
  QuestionField: {
293
293
  /** Format: uuid */
294
294
  uuid?: string;
295
- type?: components["schemas"]["BlockType"];
295
+ type?: components["schemas"]["FieldType"];
296
296
  /** Format: uuid */
297
297
  blockGroupUuid?: string;
298
298
  title?: string;
299
+ questionType?: components["schemas"]["FieldQuestionType"];
299
300
  };
300
301
  Question: {
301
302
  id?: string;
@@ -2076,7 +2077,7 @@ export interface components {
2076
2077
  };
2077
2078
  PostFormsResponse: components["schemas"]["Form"];
2078
2079
  GetFormsFormIdResponse: components["schemas"]["Form"] & {
2079
- settings?: components["schemas"]["FormSettings"];
2080
+ settings?: components["schemas"]["FormSettings"] | null;
2080
2081
  blocks?: components["schemas"]["Block"][];
2081
2082
  };
2082
2083
  PatchFormsFormIdRequest: {
@@ -2160,7 +2161,7 @@ export interface components {
2160
2161
  blocks: components["schemas"]["Block"][];
2161
2162
  settings?: components["schemas"]["FormSettings"] | null;
2162
2163
  };
2163
- PatchFormsFormIdBlocksResponse: components["schemas"]["Block"];
2164
+ PatchFormsFormIdBlocksResponse: components["schemas"]["Form"];
2164
2165
  GetFormsFormIdSubmissionsResponse: {
2165
2166
  /** Current page number */
2166
2167
  page?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.147.0",
3
+ "version": "0.147.1",
4
4
  "description": "Shared integration payload contracts and provider primitives for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@anthropic-ai/sdk": "0.123.0",
72
- "@automate.ax/codec": "0.147.0",
72
+ "@automate.ax/codec": "0.147.1",
73
73
  "@cfworker/json-schema": "^4.1.1",
74
74
  "@googleapis/calendar": "^16.0.0",
75
75
  "@googleapis/forms": "^6.0.1",
package/src/tally/api.ts CHANGED
@@ -162,7 +162,7 @@ async function sendTallyRequest(
162
162
  redirect: "error",
163
163
  })
164
164
  const text = await response.text()
165
- const parsed = text ? parseJson(text) : undefined
165
+ const parsed = text ? parseJson(text, response.ok) : undefined
166
166
  if (!response.ok) {
167
167
  const body = encodableSchema.safeParse(parsed)
168
168
  throw new TallyApiError({
@@ -192,12 +192,14 @@ function isTraversalSegment(segment: string) {
192
192
  * Parses one JSON response or reports a provider contract failure.
193
193
  *
194
194
  * @param text Provider response text.
195
+ * @param requireJson Whether a successful response must contain valid JSON.
195
196
  * @throws When the provider response is not valid JSON.
196
197
  */
197
- function parseJson(text: string) {
198
+ function parseJson(text: string, requireJson: boolean) {
198
199
  try {
199
200
  return JSON.parse(text) as unknown
200
201
  } catch {
202
+ if (!requireJson) return text
201
203
  throw new Error("Tally API returned invalid JSON.")
202
204
  }
203
205
  }
@@ -366,7 +366,14 @@
366
366
  "type": "string"
367
367
  },
368
368
  "name": {
369
- "type": "string"
369
+ "anyOf": [
370
+ {
371
+ "type": "string"
372
+ },
373
+ {
374
+ "type": "null"
375
+ }
376
+ ]
370
377
  },
371
378
  "workspaceId": {
372
379
  "type": "string"
@@ -686,7 +693,14 @@
686
693
  "type": "string"
687
694
  },
688
695
  "name": {
689
- "type": "string"
696
+ "anyOf": [
697
+ {
698
+ "type": "string"
699
+ },
700
+ {
701
+ "type": "null"
702
+ }
703
+ ]
690
704
  },
691
705
  "index": {
692
706
  "type": "integer"
@@ -773,7 +787,7 @@
773
787
  "format": "uuid"
774
788
  },
775
789
  "type": {
776
- "$ref": "#/$defs/BlockType"
790
+ "$ref": "#/$defs/FieldType"
777
791
  },
778
792
  "blockGroupUuid": {
779
793
  "type": "string",
@@ -781,6 +795,9 @@
781
795
  },
782
796
  "title": {
783
797
  "type": "string"
798
+ },
799
+ "questionType": {
800
+ "$ref": "#/$defs/FieldQuestionType"
784
801
  }
785
802
  }
786
803
  },
@@ -4338,7 +4355,19 @@
4338
4355
  "type": "object",
4339
4356
  "properties": {
4340
4357
  "settings": {
4341
- "$ref": "#/$defs/FormSettings"
4358
+ "anyOf": [
4359
+ {
4360
+ "type": "object",
4361
+ "allOf": [
4362
+ {
4363
+ "$ref": "#/$defs/FormSettings"
4364
+ }
4365
+ ]
4366
+ },
4367
+ {
4368
+ "type": "null"
4369
+ }
4370
+ ]
4342
4371
  },
4343
4372
  "blocks": {
4344
4373
  "type": "array",
@@ -4595,7 +4624,12 @@
4595
4624
  "required": ["blocks"]
4596
4625
  },
4597
4626
  "PatchFormsFormIdBlocksResponse": {
4598
- "$ref": "#/$defs/Block"
4627
+ "type": "object",
4628
+ "allOf": [
4629
+ {
4630
+ "$ref": "#/$defs/Form"
4631
+ }
4632
+ ]
4599
4633
  },
4600
4634
  "GetFormsFormIdSubmissionsResponse": {
4601
4635
  "type": "object",
@@ -207,7 +207,7 @@ export interface components {
207
207
  }
208
208
  Form: {
209
209
  id: string
210
- name: string
210
+ name: string | null
211
211
  workspaceId: string
212
212
  status: components["schemas"]["FormStatus"]
213
213
  numberOfSubmissions: number
@@ -314,7 +314,7 @@ export interface components {
314
314
  }
315
315
  Workspace: {
316
316
  id: string
317
- name: string
317
+ name: string | null
318
318
  index: number
319
319
  members?: components["schemas"]["User"][]
320
320
  invites?: {
@@ -341,10 +341,11 @@ export interface components {
341
341
  QuestionField: {
342
342
  /** Format: uuid */
343
343
  uuid?: string
344
- type?: components["schemas"]["BlockType"]
344
+ type?: components["schemas"]["FieldType"]
345
345
  /** Format: uuid */
346
346
  blockGroupUuid?: string
347
347
  title?: string
348
+ questionType?: components["schemas"]["FieldQuestionType"]
348
349
  }
349
350
  Question: {
350
351
  id?: string
@@ -2357,7 +2358,7 @@ export interface components {
2357
2358
  }
2358
2359
  PostFormsResponse: components["schemas"]["Form"]
2359
2360
  GetFormsFormIdResponse: components["schemas"]["Form"] & {
2360
- settings?: components["schemas"]["FormSettings"]
2361
+ settings?: components["schemas"]["FormSettings"] | null
2361
2362
  blocks?: components["schemas"]["Block"][]
2362
2363
  }
2363
2364
  PatchFormsFormIdRequest: {
@@ -2441,7 +2442,7 @@ export interface components {
2441
2442
  blocks: components["schemas"]["Block"][]
2442
2443
  settings?: components["schemas"]["FormSettings"] | null
2443
2444
  }
2444
- PatchFormsFormIdBlocksResponse: components["schemas"]["Block"]
2445
+ PatchFormsFormIdBlocksResponse: components["schemas"]["Form"]
2445
2446
  GetFormsFormIdSubmissionsResponse: {
2446
2447
  /** Current page number */
2447
2448
  page?: number