zitejs 0.9.143 → 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)({
@@ -44,6 +44,7 @@ declare const FIELDS_BY_TYPE: {
44
44
  clickup: readonly string[];
45
45
  dropbox: readonly string[];
46
46
  zendesk: readonly string[];
47
+ smartsheet: readonly string[];
47
48
  amazonS3: readonly string[];
48
49
  snowflake: readonly string[];
49
50
  databricks: readonly string[];
@@ -56,6 +56,9 @@ const FIELDS_BY_TYPE = {
56
56
  // only valid on the account it was issued for, so the subdomain travels with
57
57
  // it rather than being configured per app.
58
58
  zendesk: extras("subdomain"),
59
+ // Smartsheet's US, EU, AU and Gov regions are separate, and a token is only
60
+ // valid on its own region's host, so the host travels with it.
61
+ smartsheet: extras("apiBaseUrl"),
59
62
  // The IAM key alone reaches nothing: every call needs the region and the
60
63
  // bucket, and S3-compatible providers need the endpoint too.
61
64
  amazonS3: extras("keyId", "region", "bucket", "endpoint", "pathPrefix"),
@@ -18,6 +18,7 @@ const index_js_1 = require("../index.js");
18
18
  ]);
19
19
  (0, vitest_1.expect)(index_js_1.CREDENTIAL_FIELDS.jira).toEqual(["accessToken", "cloudId", "siteUrl"]);
20
20
  (0, vitest_1.expect)(index_js_1.CREDENTIAL_FIELDS.granola).toEqual(["accessToken"]);
21
+ (0, vitest_1.expect)(index_js_1.CREDENTIAL_FIELDS.smartsheet).toEqual(["accessToken", "apiBaseUrl"]);
21
22
  });
22
23
  (0, vitest_1.it)("has no type the runtime never serves", () => {
23
24
  for (const type of index_js_1.NON_CREDENTIAL_SERVICE_TYPES) {
@@ -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({
@@ -44,6 +44,7 @@ declare const FIELDS_BY_TYPE: {
44
44
  clickup: readonly string[];
45
45
  dropbox: readonly string[];
46
46
  zendesk: readonly string[];
47
+ smartsheet: readonly string[];
47
48
  amazonS3: readonly string[];
48
49
  snowflake: readonly string[];
49
50
  databricks: readonly string[];
@@ -53,6 +53,9 @@ const FIELDS_BY_TYPE = {
53
53
  // only valid on the account it was issued for, so the subdomain travels with
54
54
  // it rather than being configured per app.
55
55
  zendesk: extras("subdomain"),
56
+ // Smartsheet's US, EU, AU and Gov regions are separate, and a token is only
57
+ // valid on its own region's host, so the host travels with it.
58
+ smartsheet: extras("apiBaseUrl"),
56
59
  // The IAM key alone reaches nothing: every call needs the region and the
57
60
  // bucket, and S3-compatible providers need the endpoint too.
58
61
  amazonS3: extras("keyId", "region", "bucket", "endpoint", "pathPrefix"),
@@ -16,6 +16,7 @@ describe("CREDENTIAL_FIELDS", () => {
16
16
  ]);
17
17
  expect(CREDENTIAL_FIELDS.jira).toEqual(["accessToken", "cloudId", "siteUrl"]);
18
18
  expect(CREDENTIAL_FIELDS.granola).toEqual(["accessToken"]);
19
+ expect(CREDENTIAL_FIELDS.smartsheet).toEqual(["accessToken", "apiBaseUrl"]);
19
20
  });
20
21
  it("has no type the runtime never serves", () => {
21
22
  for (const type of NON_CREDENTIAL_SERVICE_TYPES) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.143",
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": [