zitejs 0.9.144 → 0.9.145

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.
@@ -87,8 +87,11 @@ export type ZiteTrigger = {
87
87
  };
88
88
  /**
89
89
  * What a form trigger's run gets as `input`: one submission. `answers` is
90
- * keyed by question name; `submission` is the whole export, as the Fillout
91
- * API returns it (`questions`, `calculations`, `urlParameters`, …).
90
+ * keyed by question name, `answersById` by question id; `submission` is the
91
+ * whole export, as the Fillout API returns it (`questions`, `calculations`,
92
+ * `urlParameters`, …). Two questions with the same label are named
93
+ * `Email` and `Email (1)` in an order the form doesn't show, so read those by
94
+ * id.
92
95
  */
93
96
  export type ZiteFormTriggerInput = {
94
97
  event: "submitted";
@@ -97,6 +100,7 @@ export type ZiteFormTriggerInput = {
97
100
  submissionId: string;
98
101
  submittedAt: string | null;
99
102
  answers: Record<string, unknown>;
103
+ answersById: Record<string, unknown>;
100
104
  submission: Record<string, unknown> & {
101
105
  submissionId: string;
102
106
  };
@@ -226,7 +226,11 @@ const stepStub = {
226
226
  execute: async ({ input, trigger }) => {
227
227
  // @ts-expect-error a form submission has no cursor API
228
228
  trigger?.advance("x");
229
- return { email: input.answers.Email, id: input.submissionId };
229
+ return {
230
+ email: input.answers.Email,
231
+ workEmail: input.answersById["wWorkEmail"],
232
+ id: input.submissionId,
233
+ };
230
234
  },
231
235
  });
232
236
  (0, index_js_1.createEndpoint)({
@@ -87,8 +87,11 @@ export type ZiteTrigger = {
87
87
  };
88
88
  /**
89
89
  * What a form trigger's run gets as `input`: one submission. `answers` is
90
- * keyed by question name; `submission` is the whole export, as the Fillout
91
- * API returns it (`questions`, `calculations`, `urlParameters`, …).
90
+ * keyed by question name, `answersById` by question id; `submission` is the
91
+ * whole export, as the Fillout API returns it (`questions`, `calculations`,
92
+ * `urlParameters`, …). Two questions with the same label are named
93
+ * `Email` and `Email (1)` in an order the form doesn't show, so read those by
94
+ * id.
92
95
  */
93
96
  export type ZiteFormTriggerInput = {
94
97
  event: "submitted";
@@ -97,6 +100,7 @@ export type ZiteFormTriggerInput = {
97
100
  submissionId: string;
98
101
  submittedAt: string | null;
99
102
  answers: Record<string, unknown>;
103
+ answersById: Record<string, unknown>;
100
104
  submission: Record<string, unknown> & {
101
105
  submissionId: string;
102
106
  };
@@ -224,7 +224,11 @@ describe("platform-triggered runs", () => {
224
224
  execute: async ({ input, trigger }) => {
225
225
  // @ts-expect-error a form submission has no cursor API
226
226
  trigger?.advance("x");
227
- return { email: input.answers.Email, id: input.submissionId };
227
+ return {
228
+ email: input.answers.Email,
229
+ workEmail: input.answersById["wWorkEmail"],
230
+ id: input.submissionId,
231
+ };
228
232
  },
229
233
  });
230
234
  createEndpoint({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.144",
3
+ "version": "0.9.145",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -97,6 +97,7 @@
97
97
  "test": "vitest run",
98
98
  "test:watch": "vitest",
99
99
  "typecheck": "tsc --noEmit",
100
+ "release": "node ./scripts/release.mjs",
100
101
  "prepublishOnly": "npm run build"
101
102
  },
102
103
  "files": [