zitejs 0.10.0-start.20 → 0.10.0-start.21

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 (60) hide show
  1. package/dist/cjs/auth/actions.d.ts +28 -0
  2. package/dist/cjs/auth/actions.js +93 -0
  3. package/dist/cjs/auth/client.d.ts +357 -0
  4. package/dist/cjs/auth/client.js +66 -0
  5. package/dist/cjs/auth/index.d.ts +2 -249
  6. package/dist/cjs/auth/index.js +11 -114
  7. package/dist/cjs/auth/index.test.js +18 -0
  8. package/dist/cjs/auth/profileUpdates.d.ts +9 -0
  9. package/dist/cjs/auth/profileUpdates.js +11 -0
  10. package/dist/cjs/check/start/sourceRules.js +70 -21
  11. package/dist/cjs/integrations/rules.js +5 -3
  12. package/dist/cjs/runtime/index.d.ts +54 -15
  13. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
  14. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +33 -0
  15. package/dist/cjs/sync/lib.js +10 -5
  16. package/dist/cjs/sync/lib.test.js +10 -0
  17. package/dist/esm/auth/actions.d.ts +28 -0
  18. package/dist/esm/auth/actions.js +55 -0
  19. package/dist/esm/auth/client.d.ts +357 -0
  20. package/dist/esm/auth/client.js +62 -0
  21. package/dist/esm/auth/index.d.ts +2 -249
  22. package/dist/esm/auth/index.js +2 -109
  23. package/dist/esm/auth/index.test.js +18 -0
  24. package/dist/esm/auth/profileUpdates.d.ts +9 -0
  25. package/dist/esm/auth/profileUpdates.js +6 -0
  26. package/dist/esm/check/start/sourceRules.js +70 -21
  27. package/dist/esm/integrations/rules.js +5 -3
  28. package/dist/esm/runtime/index.d.ts +54 -15
  29. package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
  30. package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +31 -0
  31. package/dist/esm/start/airtable/dispatch.js +3 -3
  32. package/dist/esm/start/airtable/formulas.d.ts +1 -1
  33. package/dist/esm/start/airtable/formulas.js +12 -10
  34. package/dist/esm/start/airtable/index.d.ts +2 -2
  35. package/dist/esm/start/describe.d.ts +8 -1
  36. package/dist/esm/start/describe.js +5 -3
  37. package/dist/esm/start/factories.test-d.d.ts +2 -1
  38. package/dist/esm/start/host.d.ts +2 -2
  39. package/dist/esm/start/index.d.ts +1 -1
  40. package/dist/esm/start/index.js +4 -2
  41. package/dist/esm/start/outbound.d.ts +2 -2
  42. package/dist/esm/start/outbound.js +3 -1
  43. package/dist/esm/start/router.d.ts +7 -0
  44. package/dist/esm/start/router.js +35 -0
  45. package/dist/esm/start/runLog.d.ts +2 -2
  46. package/dist/esm/start/scope.d.ts +3 -3
  47. package/dist/esm/start/server.d.ts +3 -3
  48. package/dist/esm/start/server.js +2 -1
  49. package/dist/esm/start/types.d.ts +1 -1
  50. package/dist/esm/start/version.d.ts +1 -1
  51. package/dist/esm/start/version.js +1 -1
  52. package/dist/esm/start/vite.js +3 -3
  53. package/dist/esm/start/workflow.d.ts +6 -2
  54. package/dist/esm/start/workflow.js +9 -2
  55. package/dist/esm/start/workflow.test-d.js +10 -1
  56. package/dist/esm/start/workflowRun.d.ts +5 -0
  57. package/dist/esm/start/workflowRun.js +11 -1
  58. package/dist/esm/sync/lib.js +10 -5
  59. package/dist/esm/sync/lib.test.js +10 -0
  60. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  import { errorOf } from "./runLog.js";
5
5
  import { runInScope } from "./scope.js";
6
6
  import { createSteps } from "./steps.js";
7
- import { isAutomation } from "./workflow.js";
7
+ import { isAutomation, isUnfinishedAutomation } from "./workflow.js";
8
8
  import { workflowModules } from "./workflowModules.js";
9
9
  const platformCall = (...args) => {
10
10
  const call = globalThis.__wrapSdkCall;
@@ -113,6 +113,16 @@ export async function loadWorkflows(modules = workflowModules) {
113
113
  }
114
114
  return found;
115
115
  }
116
+ /** Each `createAutomation(...)` exported without its `.handler()`, by export name: describe refuses them. */
117
+ export async function loadUnfinishedWorkflows(modules = workflowModules) {
118
+ const found = [];
119
+ for (const [file, load] of Object.entries(modules)) {
120
+ for (const [id, value] of Object.entries(await load()))
121
+ if (isUnfinishedAutomation(value))
122
+ found.push({ id, file });
123
+ }
124
+ return found;
125
+ }
116
126
  /** The input as the run log keeps it: a trigger's `seen` list can hold thousands of ids. */
117
127
  export const loggedInput = (rawInput) => {
118
128
  const raw = asRecord(rawInput);
@@ -517,8 +517,9 @@ export function generateDbTs(inputSchema, { hasStartApps = false } = {}) {
517
517
  lines.push('// `not: null` means "is set". An empty `in: []` matches nothing; an', "// empty `notIn: []` applies no filter.");
518
518
  lines.push('// sort: [{ field: "fieldName", direction: "asc" | "desc" }]');
519
519
  lines.push("// limit defaults to 500, max 2000; offset is a row count (a number)");
520
- lines.push("// a filter value of `undefined` is REJECTED (it would query unfiltered", "// and match an arbitrary record). Check the value first.");
520
+ lines.push("// a filter value of `undefined` drops that filter and reads as if it weren't", "// there. Check the value first: `{ owner: user?.id }` signed out reads every row.");
521
521
  lines.push("// .findOne({ id?, filters?, fields? }) → T | undefined");
522
+ lines.push("// a filter value of `undefined`, or an `undefined` id with no filters, matches", "// no record and returns undefined");
522
523
  lines.push("// .create({ record }) → T");
523
524
  lines.push("// .update({ id, record }) → { id: string, fields: Partial<T> }");
524
525
  lines.push("// .delete({ id }) → { success: true, id: string }");
@@ -1395,18 +1396,22 @@ export function generateEmailSdk(integrationId, runtime = "classic") {
1395
1396
  "// Always use 'zitejs/email' — never a relative path like '../../.zite/integrations/email'.",
1396
1397
  "// The tsconfig aliases resolve zitejs/* imports to the correct .zite/ files.",
1397
1398
  "//",
1398
- "// await Email.send({ to, subject, body: [{ type: 'text', content: '...' }] })",
1399
- "// => { success: boolean; messageId: string }",
1399
+ "// await Email.send({ to, subject, html: '<p>...</p>' })",
1400
+ "// => { success: boolean; messageId: string; warnings?: string[] }",
1400
1401
  "//",
1401
- "// RTL languages (Hebrew, Arabic): pass direction: 'rtl' — dir attributes",
1402
- "// inside body text are stripped by the sanitizer and will not work.",
1402
+ "// Emails written before html support pass `body` (blocks) instead; they",
1403
+ "// keep working.",
1404
+ "//",
1405
+ "// RTL languages (Hebrew, Arabic): pass direction: 'rtl'.",
1403
1406
  "",
1404
1407
  "import { createEmailClient } from 'zitejs/runtime';",
1405
1408
  "",
1406
1409
  "export type {",
1407
1410
  " EmailBlock,",
1411
+ " SendBlocksEmailParams,",
1408
1412
  " SendEmailParams,",
1409
1413
  " SendEmailResult,",
1414
+ " SendHtmlEmailParams,",
1410
1415
  "} from 'zitejs/runtime';",
1411
1416
  "",
1412
1417
  `export const Email = createEmailClient(${tsSingleQuoted(integrationId)});`,
@@ -577,6 +577,16 @@ describe('generateIntegrationsIndex', () => {
577
577
  const jira = await integrations.get('tickets');
578
578
  const cloudId: string = jira.cloudId;
579
579
  const siteUrl: string = jira.siteUrl;
580
+ `)).toEqual([
581
+ expect.stringContaining("Type 'string | undefined' is not assignable"),
582
+ ]);
583
+ });
584
+ it('types the Shopify storefront URL as always present and only its token as optional', () => {
585
+ const generated = generateIntegrationsIndex([{ name: 'shopify', serviceType: 'shopify', perUser: false }], { reexportAirtable: false });
586
+ expect(typeErrorsIn(generated, `import { integrations } from 'zitejs/integrations';
587
+ const shop = await integrations.get('shopify');
588
+ const storefrontApiUrl: string = shop.storefrontApiUrl;
589
+ const storefrontAccessToken: string = shop.storefrontAccessToken;
580
590
  `)).toEqual([
581
591
  expect.stringContaining("Type 'string | undefined' is not assignable"),
582
592
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.10.0-start.20",
3
+ "version": "0.10.0-start.21",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "sideEffects": false,