@zapier/zapier-sdk 0.9.0 → 0.11.0

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 (187) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +7 -7
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +14 -0
  5. package/dist/api/debug.d.ts +1 -0
  6. package/dist/api/debug.d.ts.map +1 -1
  7. package/dist/api/debug.js +42 -1
  8. package/dist/api/debug.test.d.ts +2 -0
  9. package/dist/api/debug.test.d.ts.map +1 -0
  10. package/dist/api/debug.test.js +59 -0
  11. package/dist/api/schemas.d.ts +451 -251
  12. package/dist/api/schemas.d.ts.map +1 -1
  13. package/dist/api/schemas.js +51 -29
  14. package/dist/index.cjs +968 -582
  15. package/dist/index.d.mts +2537 -2229
  16. package/dist/index.d.ts +2 -3
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -3
  19. package/dist/index.mjs +966 -576
  20. package/dist/plugins/findFirstAuthentication/index.d.ts +1 -1
  21. package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
  22. package/dist/plugins/findFirstAuthentication/index.js +9 -1
  23. package/dist/plugins/findFirstAuthentication/index.test.js +3 -4
  24. package/dist/plugins/findFirstAuthentication/schemas.d.ts +5 -3
  25. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +1 -1
  26. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
  27. package/dist/plugins/findUniqueAuthentication/index.js +4 -0
  28. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +5 -3
  29. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +1 -1
  30. package/dist/plugins/getAction/index.d.ts.map +1 -1
  31. package/dist/plugins/getAction/index.js +10 -0
  32. package/dist/plugins/getAction/schemas.d.ts +5 -3
  33. package/dist/plugins/getAction/schemas.d.ts.map +1 -1
  34. package/dist/plugins/getApp/index.d.ts.map +1 -1
  35. package/dist/plugins/getApp/index.js +8 -0
  36. package/dist/plugins/getApp/index.test.js +2 -2
  37. package/dist/plugins/getApp/schemas.d.ts +3 -1
  38. package/dist/plugins/getApp/schemas.d.ts.map +1 -1
  39. package/dist/plugins/getApp/schemas.js +2 -4
  40. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  41. package/dist/plugins/getAuthentication/index.js +8 -0
  42. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  43. package/dist/plugins/getProfile/index.js +4 -0
  44. package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
  45. package/dist/plugins/getProfile/schemas.js +4 -3
  46. package/dist/plugins/listActions/index.d.ts.map +1 -1
  47. package/dist/plugins/listActions/index.js +9 -0
  48. package/dist/plugins/listActions/schemas.d.ts +5 -3
  49. package/dist/plugins/listActions/schemas.d.ts.map +1 -1
  50. package/dist/plugins/listActions/schemas.js +2 -4
  51. package/dist/plugins/listApps/index.d.ts.map +1 -1
  52. package/dist/plugins/listApps/index.js +4 -0
  53. package/dist/plugins/listApps/index.test.js +1 -1
  54. package/dist/plugins/listApps/schemas.d.ts.map +1 -1
  55. package/dist/plugins/listApps/schemas.js +3 -9
  56. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  57. package/dist/plugins/listAuthentications/index.js +8 -0
  58. package/dist/plugins/listAuthentications/schemas.d.ts +5 -3
  59. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  60. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  61. package/dist/plugins/listInputFieldChoices/index.js +14 -2
  62. package/dist/plugins/listInputFieldChoices/schemas.d.ts +5 -3
  63. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  64. package/dist/plugins/listInputFieldChoices/schemas.js +10 -19
  65. package/dist/plugins/listInputFields/index.d.ts +4 -4
  66. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  67. package/dist/plugins/listInputFields/index.js +71 -5
  68. package/dist/plugins/listInputFields/index.test.js +5 -9
  69. package/dist/plugins/listInputFields/schemas.d.ts +8 -6
  70. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  71. package/dist/plugins/registry/index.d.ts.map +1 -1
  72. package/dist/plugins/registry/index.js +8 -2
  73. package/dist/plugins/request/index.d.ts.map +1 -1
  74. package/dist/plugins/request/index.js +1 -0
  75. package/dist/plugins/runAction/index.d.ts.map +1 -1
  76. package/dist/plugins/runAction/index.js +12 -0
  77. package/dist/plugins/runAction/schemas.d.ts +5 -3
  78. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  79. package/dist/resolvers/actionKey.d.ts +13 -7
  80. package/dist/resolvers/actionKey.d.ts.map +1 -1
  81. package/dist/resolvers/actionType.d.ts +8 -7
  82. package/dist/resolvers/actionType.d.ts.map +1 -1
  83. package/dist/resolvers/appKey.d.ts +2 -6
  84. package/dist/resolvers/appKey.d.ts.map +1 -1
  85. package/dist/resolvers/authenticationId.d.ts +7 -7
  86. package/dist/resolvers/authenticationId.d.ts.map +1 -1
  87. package/dist/resolvers/authenticationId.js +16 -7
  88. package/dist/resolvers/index.d.ts +3 -35
  89. package/dist/resolvers/index.d.ts.map +1 -1
  90. package/dist/resolvers/index.js +4 -87
  91. package/dist/resolvers/inputFieldKey.d.ts +11 -0
  92. package/dist/resolvers/inputFieldKey.d.ts.map +1 -0
  93. package/dist/resolvers/inputFieldKey.js +47 -0
  94. package/dist/resolvers/inputs.d.ts +13 -4
  95. package/dist/resolvers/inputs.d.ts.map +1 -1
  96. package/dist/resolvers/inputs.js +36 -0
  97. package/dist/schemas/Action.d.ts +8 -8
  98. package/dist/schemas/Action.d.ts.map +1 -1
  99. package/dist/schemas/Action.js +8 -3
  100. package/dist/schemas/App.d.ts +183 -11
  101. package/dist/schemas/App.d.ts.map +1 -1
  102. package/dist/schemas/App.js +7 -9
  103. package/dist/schemas/Auth.d.ts +12 -12
  104. package/dist/schemas/Auth.js +1 -1
  105. package/dist/schemas/Field.d.ts +112 -97
  106. package/dist/schemas/Field.d.ts.map +1 -1
  107. package/dist/schemas/Field.js +63 -52
  108. package/dist/schemas/Run.d.ts +3 -0
  109. package/dist/schemas/Run.d.ts.map +1 -0
  110. package/dist/schemas/Run.js +31 -0
  111. package/dist/schemas/UserProfile.d.ts +11 -11
  112. package/dist/schemas/UserProfile.d.ts.map +1 -1
  113. package/dist/schemas/UserProfile.js +21 -7
  114. package/dist/sdk.d.ts +11 -4
  115. package/dist/sdk.d.ts.map +1 -1
  116. package/dist/types/domain.d.ts +17 -1
  117. package/dist/types/domain.d.ts.map +1 -1
  118. package/dist/types/plugin.d.ts +5 -0
  119. package/dist/types/plugin.d.ts.map +1 -1
  120. package/dist/types/properties.d.ts +3 -1
  121. package/dist/types/properties.d.ts.map +1 -1
  122. package/dist/types/sdk.d.ts +5 -0
  123. package/dist/types/sdk.d.ts.map +1 -1
  124. package/dist/utils/domain-utils.d.ts +1 -16
  125. package/dist/utils/domain-utils.d.ts.map +1 -1
  126. package/dist/utils/domain-utils.js +7 -51
  127. package/dist/utils/schema-utils.d.ts +44 -21
  128. package/dist/utils/schema-utils.d.ts.map +1 -1
  129. package/dist/utils/schema-utils.js +17 -11
  130. package/dist/utils/string-utils.d.ts +12 -0
  131. package/dist/utils/string-utils.d.ts.map +1 -0
  132. package/dist/utils/string-utils.js +23 -0
  133. package/dist/utils/string-utils.test.d.ts +2 -0
  134. package/dist/utils/string-utils.test.d.ts.map +1 -0
  135. package/dist/utils/string-utils.test.js +36 -0
  136. package/package.json +1 -1
  137. package/src/api/client.ts +12 -0
  138. package/src/api/debug.test.ts +76 -0
  139. package/src/api/debug.ts +46 -2
  140. package/src/api/schemas.ts +51 -29
  141. package/src/index.ts +4 -5
  142. package/src/plugins/findFirstAuthentication/index.test.ts +8 -5
  143. package/src/plugins/findFirstAuthentication/index.ts +14 -2
  144. package/src/plugins/findUniqueAuthentication/index.ts +4 -0
  145. package/src/plugins/getAction/index.ts +14 -0
  146. package/src/plugins/getApp/index.test.ts +2 -2
  147. package/src/plugins/getApp/index.ts +8 -0
  148. package/src/plugins/getApp/schemas.ts +7 -12
  149. package/src/plugins/getAuthentication/index.ts +8 -0
  150. package/src/plugins/getProfile/index.ts +4 -0
  151. package/src/plugins/getProfile/schemas.ts +4 -6
  152. package/src/plugins/listActions/index.ts +9 -0
  153. package/src/plugins/listActions/schemas.ts +20 -25
  154. package/src/plugins/listApps/index.test.ts +1 -1
  155. package/src/plugins/listApps/index.ts +4 -0
  156. package/src/plugins/listApps/schemas.ts +17 -26
  157. package/src/plugins/listAuthentications/index.ts +8 -0
  158. package/src/plugins/listInputFieldChoices/index.ts +21 -1
  159. package/src/plugins/listInputFieldChoices/schemas.ts +61 -76
  160. package/src/plugins/listInputFields/index.test.ts +5 -9
  161. package/src/plugins/listInputFields/index.ts +89 -11
  162. package/src/plugins/listInputFields/schemas.ts +6 -3
  163. package/src/plugins/registry/index.ts +8 -2
  164. package/src/plugins/request/index.ts +1 -0
  165. package/src/plugins/runAction/index.ts +18 -0
  166. package/src/resolvers/actionKey.ts +15 -13
  167. package/src/resolvers/actionType.ts +10 -12
  168. package/src/resolvers/appKey.ts +2 -6
  169. package/src/resolvers/authenticationId.ts +25 -19
  170. package/src/resolvers/index.ts +7 -113
  171. package/src/resolvers/inputFieldKey.ts +70 -0
  172. package/src/resolvers/inputs.ts +51 -7
  173. package/src/schemas/Action.ts +8 -3
  174. package/src/schemas/App.ts +7 -9
  175. package/src/schemas/Auth.ts +1 -1
  176. package/src/schemas/Field.ts +97 -60
  177. package/src/schemas/Run.ts +40 -0
  178. package/src/schemas/UserProfile.ts +24 -7
  179. package/src/sdk.ts +17 -7
  180. package/src/types/domain.ts +24 -1
  181. package/src/types/plugin.ts +5 -0
  182. package/src/types/sdk.ts +5 -0
  183. package/src/utils/domain-utils.ts +9 -67
  184. package/src/utils/schema-utils.ts +96 -44
  185. package/src/utils/string-utils.test.ts +45 -0
  186. package/src/utils/string-utils.ts +26 -0
  187. package/tsconfig.tsbuildinfo +1 -1
@@ -28,15 +28,13 @@ export declare const AuthenticationItemSchema: z.ZodObject<Omit<{
28
28
  version: z.ZodOptional<z.ZodString>;
29
29
  user_id: z.ZodOptional<z.ZodNumber>;
30
30
  }, "strip", z.ZodTypeAny, {
31
- date: string;
32
31
  id: number;
32
+ date: string;
33
33
  account_id: number;
34
34
  is_invite_only: boolean;
35
35
  is_private: boolean;
36
36
  shared_with_all: boolean;
37
37
  url?: string | undefined;
38
- title?: string | null | undefined;
39
- version?: string | undefined;
40
38
  label?: string | null | undefined;
41
39
  permissions?: Record<string, boolean> | undefined;
42
40
  lastchanged?: string | undefined;
@@ -45,23 +43,23 @@ export declare const AuthenticationItemSchema: z.ZodObject<Omit<{
45
43
  is_shared?: string | undefined;
46
44
  marked_stale_at?: string | null | undefined;
47
45
  identifier?: string | null | undefined;
46
+ title?: string | null | undefined;
48
47
  groups?: string | undefined;
49
48
  members?: string | undefined;
50
49
  user_id?: number | undefined;
50
+ version?: string | undefined;
51
51
  implementation_id?: string | undefined;
52
52
  is_expired?: string | undefined;
53
53
  expired_at?: string | null | undefined;
54
54
  app_key?: string | undefined;
55
55
  }, {
56
- date: string;
57
56
  id: number;
57
+ date: string;
58
58
  account_id: number;
59
59
  is_invite_only: boolean;
60
60
  is_private: boolean;
61
61
  shared_with_all: boolean;
62
62
  url?: string | undefined;
63
- title?: string | null | undefined;
64
- version?: string | undefined;
65
63
  label?: string | null | undefined;
66
64
  permissions?: Record<string, boolean> | undefined;
67
65
  lastchanged?: string | undefined;
@@ -70,9 +68,11 @@ export declare const AuthenticationItemSchema: z.ZodObject<Omit<{
70
68
  is_shared?: string | undefined;
71
69
  marked_stale_at?: string | null | undefined;
72
70
  identifier?: string | null | undefined;
71
+ title?: string | null | undefined;
73
72
  groups?: string | undefined;
74
73
  members?: string | undefined;
75
74
  user_id?: number | undefined;
75
+ version?: string | undefined;
76
76
  implementation_id?: string | undefined;
77
77
  is_expired?: string | undefined;
78
78
  expired_at?: string | null | undefined;
@@ -107,15 +107,13 @@ export declare const AuthItemSchema: z.ZodObject<Omit<{
107
107
  version: z.ZodOptional<z.ZodString>;
108
108
  user_id: z.ZodOptional<z.ZodNumber>;
109
109
  }, "strip", z.ZodTypeAny, {
110
- date: string;
111
110
  id: number;
111
+ date: string;
112
112
  account_id: number;
113
113
  is_invite_only: boolean;
114
114
  is_private: boolean;
115
115
  shared_with_all: boolean;
116
116
  url?: string | undefined;
117
- title?: string | null | undefined;
118
- version?: string | undefined;
119
117
  label?: string | null | undefined;
120
118
  permissions?: Record<string, boolean> | undefined;
121
119
  lastchanged?: string | undefined;
@@ -124,23 +122,23 @@ export declare const AuthItemSchema: z.ZodObject<Omit<{
124
122
  is_shared?: string | undefined;
125
123
  marked_stale_at?: string | null | undefined;
126
124
  identifier?: string | null | undefined;
125
+ title?: string | null | undefined;
127
126
  groups?: string | undefined;
128
127
  members?: string | undefined;
129
128
  user_id?: number | undefined;
129
+ version?: string | undefined;
130
130
  implementation_id?: string | undefined;
131
131
  is_expired?: string | undefined;
132
132
  expired_at?: string | null | undefined;
133
133
  app_key?: string | undefined;
134
134
  }, {
135
- date: string;
136
135
  id: number;
136
+ date: string;
137
137
  account_id: number;
138
138
  is_invite_only: boolean;
139
139
  is_private: boolean;
140
140
  shared_with_all: boolean;
141
141
  url?: string | undefined;
142
- title?: string | null | undefined;
143
- version?: string | undefined;
144
142
  label?: string | null | undefined;
145
143
  permissions?: Record<string, boolean> | undefined;
146
144
  lastchanged?: string | undefined;
@@ -149,9 +147,11 @@ export declare const AuthItemSchema: z.ZodObject<Omit<{
149
147
  is_shared?: string | undefined;
150
148
  marked_stale_at?: string | null | undefined;
151
149
  identifier?: string | null | undefined;
150
+ title?: string | null | undefined;
152
151
  groups?: string | undefined;
153
152
  members?: string | undefined;
154
153
  user_id?: number | undefined;
154
+ version?: string | undefined;
155
155
  implementation_id?: string | undefined;
156
156
  is_expired?: string | undefined;
157
157
  expired_at?: string | null | undefined;
@@ -32,7 +32,7 @@ export const AuthenticationItemSchema = withFormatter(AuthenticationSchema.omit(
32
32
  }
33
33
  return {
34
34
  title: item.title || `Authentication ${item.id}`,
35
- subtitle: `(ID: ${item.id})`,
35
+ id: item.id?.toString(),
36
36
  details,
37
37
  };
38
38
  },
@@ -1,47 +1,18 @@
1
1
  import { z } from "zod";
2
- export declare const InputFieldItemSchema: z.ZodObject<Omit<{
2
+ export declare const BaseFieldItemSchema: z.ZodObject<{
3
+ type: z.ZodString;
3
4
  key: z.ZodString;
4
- alters_custom_fields: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
5
- capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
- choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
- key: z.ZodOptional<z.ZodString>;
8
- label: z.ZodOptional<z.ZodString>;
9
- sample: z.ZodOptional<z.ZodString>;
10
- value: z.ZodOptional<z.ZodString>;
11
- }, "strip", z.ZodTypeAny, {
12
- value?: string | undefined;
13
- key?: string | undefined;
14
- label?: string | undefined;
15
- sample?: string | undefined;
16
- }, {
17
- value?: string | undefined;
18
- key?: string | undefined;
19
- label?: string | undefined;
20
- sample?: string | undefined;
21
- }>, "many">>;
22
- computed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
23
- custom_field: z.ZodOptional<z.ZodBoolean>;
24
- default: z.ZodOptional<z.ZodString>;
25
- depends_on: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
- format: z.ZodOptional<z.ZodLiteral<"SELECT">>;
27
- from_search: z.ZodOptional<z.ZodBoolean>;
28
- from_write: z.ZodOptional<z.ZodBoolean>;
29
- help_text: z.ZodOptional<z.ZodString>;
30
- help_text_html: z.ZodOptional<z.ZodString>;
31
- input_format: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
32
- label: z.ZodOptional<z.ZodString>;
33
- language: z.ZodOptional<z.ZodString>;
34
- parent_key: z.ZodOptional<z.ZodString>;
35
- placeholder: z.ZodOptional<z.ZodString>;
36
- prefill: z.ZodOptional<z.ZodString>;
37
- required: z.ZodOptional<z.ZodBoolean>;
38
- searchfill: z.ZodOptional<z.ZodString>;
39
- send_in_json: z.ZodOptional<z.ZodBoolean>;
40
- regex: z.ZodOptional<z.ZodString>;
41
- type: z.ZodOptional<z.ZodEnum<["integer", "string", "text", "datetime", "boolean", "file", "decimal", "copy", "password", "dict", "code", "filter", "json"]>>;
42
- list: z.ZodOptional<z.ZodBoolean>;
43
- }, "depends_on" | "format" | "placeholder" | "required"> & {
44
- id: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ type: string;
7
+ key: string;
8
+ }, {
9
+ type: string;
10
+ key: string;
11
+ }>;
12
+ export declare const InputFieldItemSchema: z.ZodObject<{
13
+ key: z.ZodString;
14
+ } & {
15
+ type: z.ZodLiteral<"input_field">;
45
16
  default_value: z.ZodString;
46
17
  depends_on: z.ZodArray<z.ZodString, "many">;
47
18
  description: z.ZodString;
@@ -59,86 +30,130 @@ export declare const InputFieldItemSchema: z.ZodObject<Omit<{
59
30
  type: string;
60
31
  }>>;
61
32
  }, "strip", z.ZodTypeAny, {
33
+ type: "input_field";
62
34
  key: string;
63
- title: string;
35
+ depends_on: string[];
36
+ placeholder: string;
64
37
  description: string;
38
+ title: string;
39
+ default_value: string;
40
+ invalidates_input_fields: boolean;
41
+ is_required: boolean;
42
+ value_type: string;
43
+ format?: string | undefined;
44
+ items?: {
45
+ type: string;
46
+ } | undefined;
47
+ }, {
48
+ type: "input_field";
49
+ key: string;
65
50
  depends_on: string[];
66
51
  placeholder: string;
67
- id: string;
52
+ description: string;
53
+ title: string;
68
54
  default_value: string;
69
55
  invalidates_input_fields: boolean;
70
56
  is_required: boolean;
71
57
  value_type: string;
72
- default?: string | undefined;
73
- type?: "string" | "boolean" | "text" | "password" | "code" | "filter" | "integer" | "datetime" | "file" | "decimal" | "copy" | "dict" | "json" | undefined;
74
- label?: string | undefined;
75
- alters_custom_fields?: boolean | null | undefined;
76
- capabilities?: string[] | undefined;
77
- choices?: {
78
- value?: string | undefined;
79
- key?: string | undefined;
80
- label?: string | undefined;
81
- sample?: string | undefined;
82
- }[] | undefined;
83
- computed?: boolean | null | undefined;
84
- custom_field?: boolean | undefined;
85
58
  format?: string | undefined;
86
- from_search?: boolean | undefined;
87
- from_write?: boolean | undefined;
88
- help_text?: string | undefined;
89
- help_text_html?: string | undefined;
90
- input_format?: string[] | undefined;
91
- language?: string | undefined;
92
- parent_key?: string | undefined;
93
- prefill?: string | undefined;
94
- searchfill?: string | undefined;
95
- send_in_json?: boolean | undefined;
96
- regex?: string | undefined;
97
- list?: boolean | undefined;
98
59
  items?: {
99
60
  type: string;
100
61
  } | undefined;
62
+ }>;
63
+ export declare const InfoFieldItemSchema: z.ZodObject<{
64
+ key: z.ZodString;
65
+ } & {
66
+ type: z.ZodLiteral<"info_field">;
67
+ description: z.ZodString;
68
+ title: z.ZodOptional<z.ZodString>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ type: "info_field";
71
+ key: string;
72
+ description: string;
73
+ title?: string | undefined;
101
74
  }, {
75
+ type: "info_field";
76
+ key: string;
77
+ description: string;
78
+ title?: string | undefined;
79
+ }>;
80
+ type FieldsetItemType = z.infer<typeof InputFieldItemSchema> | z.infer<typeof InfoFieldItemSchema> | FieldsetItem;
81
+ export interface FieldsetItem {
82
+ type: "fieldset";
102
83
  key: string;
103
84
  title: string;
85
+ fields: FieldsetItemType[];
86
+ }
87
+ export declare const FieldsetItemSchema: z.ZodType<FieldsetItem>;
88
+ export declare const RootFieldItemSchema: z.ZodUnion<[z.ZodObject<{
89
+ key: z.ZodString;
90
+ } & {
91
+ type: z.ZodLiteral<"input_field">;
92
+ default_value: z.ZodString;
93
+ depends_on: z.ZodArray<z.ZodString, "many">;
94
+ description: z.ZodString;
95
+ invalidates_input_fields: z.ZodBoolean;
96
+ is_required: z.ZodBoolean;
97
+ placeholder: z.ZodString;
98
+ title: z.ZodString;
99
+ value_type: z.ZodString;
100
+ format: z.ZodOptional<z.ZodString>;
101
+ items: z.ZodOptional<z.ZodObject<{
102
+ type: z.ZodString;
103
+ }, "strip", z.ZodTypeAny, {
104
+ type: string;
105
+ }, {
106
+ type: string;
107
+ }>>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ type: "input_field";
110
+ key: string;
111
+ depends_on: string[];
112
+ placeholder: string;
104
113
  description: string;
114
+ title: string;
115
+ default_value: string;
116
+ invalidates_input_fields: boolean;
117
+ is_required: boolean;
118
+ value_type: string;
119
+ format?: string | undefined;
120
+ items?: {
121
+ type: string;
122
+ } | undefined;
123
+ }, {
124
+ type: "input_field";
125
+ key: string;
105
126
  depends_on: string[];
106
127
  placeholder: string;
107
- id: string;
128
+ description: string;
129
+ title: string;
108
130
  default_value: string;
109
131
  invalidates_input_fields: boolean;
110
132
  is_required: boolean;
111
133
  value_type: string;
112
- default?: string | undefined;
113
- type?: "string" | "boolean" | "text" | "password" | "code" | "filter" | "integer" | "datetime" | "file" | "decimal" | "copy" | "dict" | "json" | undefined;
114
- label?: string | undefined;
115
- alters_custom_fields?: boolean | null | undefined;
116
- capabilities?: string[] | undefined;
117
- choices?: {
118
- value?: string | undefined;
119
- key?: string | undefined;
120
- label?: string | undefined;
121
- sample?: string | undefined;
122
- }[] | undefined;
123
- computed?: boolean | null | undefined;
124
- custom_field?: boolean | undefined;
125
134
  format?: string | undefined;
126
- from_search?: boolean | undefined;
127
- from_write?: boolean | undefined;
128
- help_text?: string | undefined;
129
- help_text_html?: string | undefined;
130
- input_format?: string[] | undefined;
131
- language?: string | undefined;
132
- parent_key?: string | undefined;
133
- prefill?: string | undefined;
134
- searchfill?: string | undefined;
135
- send_in_json?: boolean | undefined;
136
- regex?: string | undefined;
137
- list?: boolean | undefined;
138
135
  items?: {
139
136
  type: string;
140
137
  } | undefined;
141
- }>;
138
+ }>, z.ZodObject<{
139
+ key: z.ZodString;
140
+ } & {
141
+ type: z.ZodLiteral<"info_field">;
142
+ description: z.ZodString;
143
+ title: z.ZodOptional<z.ZodString>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ type: "info_field";
146
+ key: string;
147
+ description: string;
148
+ title?: string | undefined;
149
+ }, {
150
+ type: "info_field";
151
+ key: string;
152
+ description: string;
153
+ title?: string | undefined;
154
+ }>, z.ZodType<FieldsetItem, z.ZodTypeDef, FieldsetItem>]>;
142
155
  export type InputFieldItem = z.infer<typeof InputFieldItemSchema>;
143
- export type FieldItem = InputFieldItem;
156
+ export type InfoFieldItem = z.infer<typeof InfoFieldItemSchema>;
157
+ export type RootFieldItem = z.infer<typeof RootFieldItemSchema>;
158
+ export {};
144
159
  //# sourceMappingURL=Field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/schemas/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkHhC,CAAC;AAMF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/schemas/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAMH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkFhC,CAAC;AAMF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;EAc/B,CAAC;AAOF,KAAK,gBAAgB,GACjB,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GACpC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GACnC,YAAY,CAAC;AAEjB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAanD,CAAC;AAML,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAI9B,CAAC;AAMH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -1,47 +1,51 @@
1
1
  import { z } from "zod";
2
2
  import { withFormatter } from "../utils/schema-utils";
3
- import { NeedSchema } from "../api/schemas";
3
+ // ============================================================================
4
+ // Base Field Schema
5
+ // ============================================================================
6
+ export const BaseFieldItemSchema = z.object({
7
+ type: z.string(), // "input_field", "info_field", or "fieldset"
8
+ key: z.string(), // From need.key
9
+ });
4
10
  // ============================================================================
5
11
  // Input Field Item Schema (extends API Need schema with computed fields and formatting)
6
12
  // ============================================================================
7
- export const InputFieldItemSchema = withFormatter(NeedSchema.omit({
8
- depends_on: true,
9
- placeholder: true,
10
- required: true,
11
- format: true,
12
- }).extend({
13
- id: z.string(), // Mapped from 'key'
13
+ export const InputFieldItemSchema = withFormatter(BaseFieldItemSchema.extend({
14
+ type: z.literal("input_field"),
14
15
  default_value: z.string(), // Mapped from 'default' with fallback to ""
15
- depends_on: z.array(z.string()), // Override: mapped from 'depends_on' with fallback to []
16
+ depends_on: z.array(z.string()), // Mapped from 'depends_on' with fallback to []
16
17
  description: z.string(), // Mapped from 'help_text' with fallback to ""
17
18
  invalidates_input_fields: z.boolean(), // Mapped from 'alters_custom_fields' with fallback to false
18
- is_required: z.boolean(), // Override: mapped from 'required' with fallback to false
19
- placeholder: z.string(), // Override: mapped from 'placeholder' with fallback to ""
19
+ is_required: z.boolean(), // Mapped from 'required' with fallback to false
20
+ placeholder: z.string(), // Mapped from 'placeholder' with fallback to ""
20
21
  title: z.string(), // Mapped from 'label' with fallback to ""
21
22
  value_type: z.string(), // Computed from InputFieldType enum
22
- format: z.string().optional(), // Override: computed from InputFieldFormat enum (optional)
23
+ format: z.string().optional(), // Computed from InputFieldFormat enum (optional)
23
24
  items: z.object({ type: z.string() }).optional(), // Computed from ItemsType enum (optional, only for arrays)
24
25
  }), {
25
26
  format: (item) => {
26
27
  const details = [];
27
28
  // Type and required status
28
29
  const typeInfo = [
29
- item.type && `Type: ${item.type}`,
30
- `Required: ${item.required ? "Yes" : "No"}`,
30
+ item.value_type && `Type: ${item.value_type}`,
31
+ `Required: ${item.is_required ? "Yes" : "No"}`,
31
32
  ]
32
33
  .filter(Boolean)
33
34
  .join(" | ");
34
35
  if (typeInfo) {
35
36
  details.push({ text: typeInfo, style: "dim" });
36
37
  }
37
- // Help text
38
- if (item.helpText) {
39
- details.push({ text: item.helpText, style: "normal" });
38
+ // Description
39
+ if (item.description) {
40
+ details.push({
41
+ text: item.description,
42
+ style: "normal",
43
+ });
40
44
  }
41
45
  // Default value
42
- if (item.default !== undefined) {
46
+ if (item.default_value) {
43
47
  details.push({
44
- text: `Default: ${item.default}`,
48
+ text: `Default: ${item.default_value}`,
45
49
  style: "accent",
46
50
  });
47
51
  }
@@ -52,20 +56,10 @@ export const InputFieldItemSchema = withFormatter(NeedSchema.omit({
52
56
  style: "dim",
53
57
  });
54
58
  }
55
- // Choices
56
- if (item.choices && item.choices.length > 0) {
57
- const choiceText = item.choices.length <= 3
58
- ? `Choices: ${item.choices.map((c) => c.label || c.value).join(", ")}`
59
- : `Choices: ${item.choices
60
- .slice(0, 3)
61
- .map((c) => c.label || c.value)
62
- .join(", ")} (+${item.choices.length - 3} more)`;
63
- details.push({ text: choiceText, style: "accent" });
64
- }
65
59
  // Dependencies
66
- if (item.dependsOn && item.dependsOn.length > 0) {
60
+ if (item.depends_on && item.depends_on.length > 0) {
67
61
  details.push({
68
- text: `Depends on: ${item.dependsOn.join(", ")}`,
62
+ text: `Depends on: ${item.depends_on.join(", ")}`,
69
63
  style: "warning",
70
64
  });
71
65
  }
@@ -73,33 +67,50 @@ export const InputFieldItemSchema = withFormatter(NeedSchema.omit({
73
67
  if (item.format) {
74
68
  details.push({ text: `Format: ${item.format}`, style: "dim" });
75
69
  }
76
- // Input format
77
- if (item.inputFormat && item.inputFormat.length > 0) {
70
+ // Items type for arrays
71
+ if (item.items) {
78
72
  details.push({
79
- text: `Input formats: ${item.inputFormat.join(", ")}`,
73
+ text: `Items type: ${item.items.type}`,
80
74
  style: "dim",
81
75
  });
82
76
  }
83
- // Special field flags
84
- const flags = [];
85
- if (item.computed)
86
- flags.push("computed");
87
- if (item.customField)
88
- flags.push("custom");
89
- if (flags.length > 0) {
90
- details.push({
91
- text: `Flags: ${flags.join(", ")}`,
92
- style: "success",
93
- });
94
- }
95
- // Backwards compatibility: show description if no helpText
96
- if (item.description && !item.helpText) {
97
- details.push({ text: item.description, style: "normal" });
98
- }
99
77
  return {
100
- title: item.label || item.name || item.key,
101
- subtitle: `(${item.key})`,
78
+ title: item.title || item.key,
79
+ key: item.key,
80
+ description: item.description,
102
81
  details,
103
82
  };
104
83
  },
105
84
  });
85
+ // ============================================================================
86
+ // Info Field Item Schema (for help text and copy fields)
87
+ // ============================================================================
88
+ export const InfoFieldItemSchema = withFormatter(BaseFieldItemSchema.extend({
89
+ type: z.literal("info_field"),
90
+ description: z.string(), // From need.help_text
91
+ title: z.string().optional(), // Optional title
92
+ }), {
93
+ format: (item) => ({
94
+ title: item.title || "Info",
95
+ key: item.key,
96
+ description: item.description,
97
+ details: [{ text: item.description, style: "normal" }],
98
+ }),
99
+ });
100
+ export const FieldsetItemSchema = BaseFieldItemSchema.extend({
101
+ type: z.literal("fieldset"),
102
+ title: z.string(),
103
+ fields: z.lazy(() => z.array(z.union([
104
+ InputFieldItemSchema,
105
+ InfoFieldItemSchema,
106
+ FieldsetItemSchema,
107
+ ]))),
108
+ });
109
+ // ============================================================================
110
+ // Root Field Item Schema (union of all possible field types)
111
+ // ============================================================================
112
+ export const RootFieldItemSchema = z.union([
113
+ InputFieldItemSchema,
114
+ InfoFieldItemSchema,
115
+ FieldsetItemSchema,
116
+ ]);
@@ -0,0 +1,3 @@
1
+ import { z } from "zod";
2
+ export declare const ActionResultItemSchema: z.ZodUnknown;
3
+ //# sourceMappingURL=Run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Run.d.ts","sourceRoot":"","sources":["../../src/schemas/Run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,sBAAsB,cAGlC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { withFormatter } from "../utils/schema-utils";
3
+ // Type guard to safely access object properties
4
+ function getStringProperty(obj, key) {
5
+ if (typeof obj === "object" && obj !== null && key in obj) {
6
+ const value = obj[key];
7
+ return typeof value === "string" ? value : undefined;
8
+ }
9
+ return undefined;
10
+ }
11
+ // Formatter for action results - handles any data structure
12
+ function formatActionResult(item) {
13
+ // Try to extract common fields for structured display
14
+ const obj = typeof item === "object" && item !== null ? item : {};
15
+ // Try common title fields
16
+ const title = getStringProperty(obj, "title") ||
17
+ getStringProperty(obj, "name") ||
18
+ getStringProperty(obj, "label") ||
19
+ getStringProperty(obj, "subject") ||
20
+ "Action Result";
21
+ return {
22
+ title,
23
+ id: getStringProperty(obj, "id"),
24
+ key: getStringProperty(obj, "key"),
25
+ description: getStringProperty(obj, "description"),
26
+ data: item, // Let formatJsonOutput handle the JSON rendering
27
+ details: [], // Not used when data is provided
28
+ };
29
+ }
30
+ // Flexible schema for action results - can be any object
31
+ export const ActionResultItemSchema = withFormatter(z.unknown().describe("Action execution result"), { format: formatActionResult });
@@ -40,9 +40,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
40
40
  enable_totp_2fa: z.ZodBoolean;
41
41
  viewed_help: z.ZodRecord<z.ZodString, z.ZodBoolean>;
42
42
  show_editor_migration_mesaging: z.ZodBoolean;
43
- switches: z.ZodRecord<z.ZodString, z.ZodAny>;
44
- organizations: z.ZodArray<z.ZodNullable<z.ZodAny>, "many">;
45
- primary_organization: z.ZodNullable<z.ZodAny>;
43
+ switches: z.ZodRecord<z.ZodString, z.ZodUnknown>;
44
+ organizations: z.ZodArray<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, "many">;
45
+ primary_organization: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
46
  has_active_zaps: z.ZodBoolean;
47
47
  has_google_sso: z.ZodBoolean;
48
48
  auth_realm: z.ZodString;
@@ -59,7 +59,6 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
59
59
  }, "user_id"> & {
60
60
  full_name: z.ZodString;
61
61
  }, "strip", z.ZodTypeAny, {
62
- email: string;
63
62
  code: string;
64
63
  id: number;
65
64
  auto_provisioned: boolean;
@@ -69,6 +68,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
69
68
  personas: string;
70
69
  user_generated_personas: string;
71
70
  last_login: string;
71
+ email: string;
72
72
  email_hash: string;
73
73
  email_confirmed: boolean;
74
74
  timezone: string;
@@ -97,8 +97,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
97
97
  enable_totp_2fa: boolean;
98
98
  viewed_help: Record<string, boolean>;
99
99
  show_editor_migration_mesaging: boolean;
100
- switches: Record<string, any>;
101
- organizations: any[];
100
+ switches: Record<string, unknown>;
101
+ organizations: (Record<string, unknown> | null)[];
102
+ primary_organization: Record<string, unknown> | null;
102
103
  has_active_zaps: boolean;
103
104
  has_google_sso: boolean;
104
105
  auth_realm: string;
@@ -107,9 +108,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
107
108
  role: string;
108
109
  }[];
109
110
  full_name: string;
110
- primary_organization?: any;
111
111
  }, {
112
- email: string;
113
112
  code: string;
114
113
  id: number;
115
114
  auto_provisioned: boolean;
@@ -119,6 +118,7 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
119
118
  personas: string;
120
119
  user_generated_personas: string;
121
120
  last_login: string;
121
+ email: string;
122
122
  email_hash: string;
123
123
  email_confirmed: boolean;
124
124
  timezone: string;
@@ -147,8 +147,9 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
147
147
  enable_totp_2fa: boolean;
148
148
  viewed_help: Record<string, boolean>;
149
149
  show_editor_migration_mesaging: boolean;
150
- switches: Record<string, any>;
151
- organizations: any[];
150
+ switches: Record<string, unknown>;
151
+ organizations: (Record<string, unknown> | null)[];
152
+ primary_organization: Record<string, unknown> | null;
152
153
  has_active_zaps: boolean;
153
154
  has_google_sso: boolean;
154
155
  auth_realm: string;
@@ -157,7 +158,6 @@ export declare const UserProfileItemSchema: z.ZodObject<Omit<{
157
158
  role: string;
158
159
  }[];
159
160
  full_name: string;
160
- primary_organization?: any;
161
161
  }>;
162
162
  export type UserProfileItem = z.infer<typeof UserProfileItemSchema>;
163
163
  //# sourceMappingURL=UserProfile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../src/schemas/UserProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BjC,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../src/schemas/UserProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CjC,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}