emailengine-app 2.78.0 → 2.79.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 (142) hide show
  1. package/.ncurc.js +23 -13
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +29 -0
  4. package/config/e2e.toml +2 -1
  5. package/config/test.toml +2 -1
  6. package/data/google-crawlers.json +1 -1
  7. package/lib/account.js +70 -35
  8. package/lib/api-reference/format.js +91 -4
  9. package/lib/api-reference/model.js +144 -19
  10. package/lib/api-reference/schema-tree.js +282 -28
  11. package/lib/api-routes/account-routes.js +80 -34
  12. package/lib/api-routes/blocklist-routes.js +21 -47
  13. package/lib/api-routes/chat-routes.js +10 -12
  14. package/lib/api-routes/delivery-test-routes.js +6 -26
  15. package/lib/api-routes/export-routes.js +2 -0
  16. package/lib/api-routes/gateway-routes.js +52 -11
  17. package/lib/api-routes/license-routes.js +2 -0
  18. package/lib/api-routes/mailbox-routes.js +29 -26
  19. package/lib/api-routes/message-routes.js +27 -21
  20. package/lib/api-routes/oauth2-app-routes.js +11 -29
  21. package/lib/api-routes/operation-impact.js +80 -0
  22. package/lib/api-routes/outbox-routes.js +15 -5
  23. package/lib/api-routes/permission-map.js +397 -0
  24. package/lib/api-routes/route-helpers.js +223 -9
  25. package/lib/api-routes/route-metadata.js +28 -0
  26. package/lib/api-routes/settings-routes.js +30 -25
  27. package/lib/api-routes/stats-routes.js +2 -2
  28. package/lib/api-routes/submit-routes.js +53 -31
  29. package/lib/api-routes/template-routes.js +3 -0
  30. package/lib/api-routes/token-routes.js +319 -33
  31. package/lib/api-routes/webhook-route-routes.js +14 -4
  32. package/lib/auth-token.js +80 -8
  33. package/lib/consts.js +10 -0
  34. package/lib/db.js +20 -2
  35. package/lib/delivery-error.js +30 -1
  36. package/lib/email-client/base-client.js +27 -41
  37. package/lib/email-client/gmail-client.js +19 -10
  38. package/lib/email-client/imap/mailbox.js +23 -24
  39. package/lib/email-client/imap/subconnection.js +10 -7
  40. package/lib/email-client/imap/sync-operations.js +46 -46
  41. package/lib/email-client/imap-client.js +36 -26
  42. package/lib/email-client/message-builder.js +3 -3
  43. package/lib/email-client/notification-handler.js +1 -1
  44. package/lib/email-client/outlook/graph-api.js +10 -4
  45. package/lib/email-client/outlook-client.js +53 -54
  46. package/lib/email-client/smtp-pool-manager.js +1 -1
  47. package/lib/enum-descriptions.js +92 -2
  48. package/lib/export.js +1 -1
  49. package/lib/field-usage.js +133 -0
  50. package/lib/gateway.js +1 -1
  51. package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
  52. package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
  53. package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
  54. package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
  55. package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
  56. package/lib/imapproxy/imap-server.js +27 -7
  57. package/lib/license-beacon.js +4 -9
  58. package/lib/lists.js +49 -1
  59. package/lib/llm-pre-process.js +5 -5
  60. package/lib/logger.js +5 -1
  61. package/lib/metrics-collector.js +2 -2
  62. package/lib/oauth/gmail.js +9 -12
  63. package/lib/oauth/mail-ru.js +5 -7
  64. package/lib/oauth/outlook.js +9 -9
  65. package/lib/oauth/pubsub/google.js +25 -10
  66. package/lib/oauth/scope-checker.js +1 -1
  67. package/lib/oauth2-apps.js +223 -294
  68. package/lib/openapi/build-document.js +15 -7
  69. package/lib/openapi/joi-schema.js +20 -0
  70. package/lib/outbox.js +85 -17
  71. package/lib/pre-process.js +8 -8
  72. package/lib/queue-stats.js +49 -0
  73. package/lib/read-env-value.js +1 -1
  74. package/lib/reconnection-manager.js +2 -2
  75. package/lib/rewrite-text-nodes.js +4 -3
  76. package/lib/routes-ui.js +4 -0
  77. package/lib/schemas.js +216 -160
  78. package/lib/settings.js +84 -5
  79. package/lib/sub-script.js +2 -1
  80. package/lib/swagger-options.js +2 -1
  81. package/lib/templates.js +4 -4
  82. package/lib/threads.js +2 -2
  83. package/lib/token-audit-log.js +208 -0
  84. package/lib/token-permission-view.js +219 -0
  85. package/lib/token-permissions.js +172 -0
  86. package/lib/tokens.js +99 -15
  87. package/lib/tools.js +142 -37
  88. package/lib/ui-routes/account-routes.js +31 -11
  89. package/lib/ui-routes/admin-config-routes.js +18 -10
  90. package/lib/ui-routes/admin-entities-routes.js +66 -22
  91. package/lib/ui-routes/auth-routes.js +30 -24
  92. package/lib/ui-routes/export-routes.js +10 -4
  93. package/lib/ui-routes/oauth-config-routes.js +5 -5
  94. package/lib/ui-routes/reference-routes.js +3 -3
  95. package/lib/ui-routes/route-helpers.js +51 -2
  96. package/lib/ui-routes/settings-page.js +1 -1
  97. package/lib/ui-routes/smtp-test-routes.js +1 -1
  98. package/lib/ui-routes/suppression-list-routes.js +294 -0
  99. package/lib/ui-routes/unsubscribe-routes.js +19 -29
  100. package/lib/utils/network.js +2 -2
  101. package/lib/web-safe-html.js +1 -1
  102. package/lib/webhook-routing.js +80 -0
  103. package/lib/webhooks.js +20 -14
  104. package/package.json +11 -10
  105. package/sbom.json +1 -1
  106. package/server.js +80 -41
  107. package/static/css/flyonui.css +1 -1
  108. package/static/css/src/app.tailwind.css +136 -9
  109. package/static/js/reference.js +456 -10
  110. package/static/js/ui.js +43 -0
  111. package/static/licenses.html +51 -41
  112. package/translations/messages.pot +59 -59
  113. package/views/accounts/account.hbs +69 -7
  114. package/views/accounts/browse.hbs +18 -35
  115. package/views/config/logging.hbs +6 -0
  116. package/views/config/oauth/app.hbs +0 -2
  117. package/views/config/security.hbs +13 -0
  118. package/views/partials/oauth_form.hbs +0 -15
  119. package/views/partials/reference/disclosure.hbs +8 -2
  120. package/views/partials/reference/operation.hbs +47 -13
  121. package/views/partials/reference/params.hbs +17 -1
  122. package/views/partials/reference/schema-node.hbs +110 -52
  123. package/views/partials/reference/schema-tools.hbs +25 -0
  124. package/views/partials/reference/try-it.hbs +84 -11
  125. package/views/partials/side_menu.hbs +1 -0
  126. package/views/partials/ui/checkbox.hbs +2 -2
  127. package/views/partials/ui/tabs.hbs +7 -1
  128. package/views/reference/token.hbs +4 -0
  129. package/views/suppression-lists/index.hbs +85 -0
  130. package/views/suppression-lists/list.hbs +87 -0
  131. package/views/templates/index.hbs +8 -2
  132. package/views/tokens/index.hbs +31 -4
  133. package/views/tokens/new.hbs +324 -2
  134. package/workers/api.js +146 -57
  135. package/workers/documents.js +46 -26
  136. package/workers/export.js +20 -8
  137. package/workers/imap-proxy.js +2 -2
  138. package/workers/imap.js +12 -6
  139. package/workers/smtp.js +13 -7
  140. package/workers/submit.js +40 -30
  141. package/workers/webhooks.js +59 -25
  142. package/lib/feature-flags.js +0 -48
@@ -9,8 +9,11 @@
9
9
  <p id="confirm-text"></p>
10
10
  </div>
11
11
  <div class="modal-footer">
12
+ {{!-- Both buttons dismiss through data-overlay. The OK button used to close the overlay
13
+ from its own handler, which races with HSOverlay's deferred open and close and can
14
+ strand the dialog on screen - see window.uiConfirmModal in static/js/ui.js. --}}
12
15
  <button type="button" id="confirm-cancel" class="btn btn-soft btn-neutral" data-overlay="#confirmModal">Close</button>
13
- <button type="button" id="confirm-ok" class="btn btn-primary">OK</button>
16
+ <button type="button" id="confirm-ok" class="btn btn-primary" data-overlay="#confirmModal">OK</button>
14
17
  </div>
15
18
  {{/ui/modal}}
16
19
 
@@ -19,24 +22,13 @@
19
22
  <p id="alert-text"></p>
20
23
  </div>
21
24
  <div class="modal-footer">
22
- <button type="button" id="alert-ok" class="btn btn-primary">OK</button>
25
+ <button type="button" id="alert-ok" class="btn btn-primary" data-overlay="#alertModal">OK</button>
23
26
  </div>
24
27
  {{/ui/modal}}
25
28
 
26
29
  <script type="module">
27
30
  import { EmailEngineClient } from '/static/js/ee-client.js';
28
31
 
29
- // the OK/Close buttons are wired once; each confirm() call resets
30
- // confirmResult and resolves through a {once:true} close.overlay listener
31
- let confirmResult = false;
32
- document.getElementById('confirm-ok').addEventListener('click', () => {
33
- confirmResult = true;
34
- uiModal.close('#confirmModal');
35
- });
36
- document.getElementById('alert-ok').addEventListener('click', () => {
37
- uiModal.close('#alertModal');
38
- });
39
-
40
32
  // Create client with UI container. The embed follows the admin theme -
41
33
  // its own dark mode toggle stays hidden and the mode tracks the topbar
42
34
  // theme switch (data-theme on the root element) and the system scheme.
@@ -47,34 +39,25 @@
47
39
  container: document.getElementById('email-client'),
48
40
  darkMode: uiEffectiveTheme() === 'dark',
49
41
  showDarkModeToggle: false,
42
+ // Text is this page's to fill; the answer comes from the shared dialog helper
50
43
  confirmMethod: (message, title = 'Confirm', cancelText = 'Cancel', okText = 'OK') => {
51
- return new Promise((resolve) => {
52
- confirmResult = false;
53
- document.getElementById('confirm-text').textContent = message;
54
- document.getElementById('confirmModalLabel').textContent = title;
55
- document.getElementById('confirm-cancel').textContent = cancelText;
56
- document.getElementById('confirm-ok').textContent = okText;
44
+ document.getElementById('confirm-text').textContent = message;
45
+ document.getElementById('confirmModalLabel').textContent = title;
46
+ document.getElementById('confirm-cancel').textContent = cancelText;
47
+ document.getElementById('confirm-ok').textContent = okText;
57
48
 
58
- document.getElementById('confirmModal').addEventListener('close.overlay', () => {
59
- resolve(confirmResult);
60
- }, { once: true });
61
-
62
- uiModal.open('#confirmModal');
63
- });
49
+ return uiConfirmModal('#confirmModal', '#confirm-ok');
64
50
  },
65
51
 
52
+ // An alert has nothing to answer, so callers just await it being dismissed. The
53
+ // resolved value is deliberately passed through rather than forced to true: forcing
54
+ // it would report a dialog that never opened as one the reader acknowledged.
66
55
  alertMethod: (message, title = 'Notice', cancelText = null, okText = 'OK') => {
67
- return new Promise((resolve) => {
68
- document.getElementById('alert-text').textContent = message;
69
- document.getElementById('alertModalLabel').textContent = title;
70
- document.getElementById('alert-ok').textContent = okText;
71
-
72
- document.getElementById('alertModal').addEventListener('close.overlay', () => {
73
- resolve(true);
74
- }, { once: true });
56
+ document.getElementById('alert-text').textContent = message;
57
+ document.getElementById('alertModalLabel').textContent = title;
58
+ document.getElementById('alert-ok').textContent = okText;
75
59
 
76
- uiModal.open('#alertModal');
77
- });
60
+ return uiConfirmModal('#alertModal', '#alert-ok');
78
61
  }
79
62
  });
80
63
 
@@ -41,6 +41,12 @@
41
41
  removed.</div>
42
42
  {{/if}}
43
43
 
44
+ {{#if sentryTrialManaged}}
45
+ <div class="alert alert-soft alert-info">Error reporting was enabled automatically when the trial license
46
+ was activated, so that problems with evaluation instances reach the EmailEngine developers. It turns
47
+ itself off when a full license is activated. Saving this page stores your own choice instead.</div>
48
+ {{/if}}
49
+
44
50
  <div>
45
51
  {{> ui/setting-ref name="sentryEnabled"}}
46
52
  {{> ui/checkbox id="settingsSentryEnabled" name="sentryEnabled"
@@ -92,10 +92,8 @@
92
92
  {{app.cloudData.description}}</em></dd>
93
93
  {{/if}}
94
94
 
95
- {{#unless app.legacy}}
96
95
  <dt>Accounts</dt>
97
96
  <dd class="font-mono"><small>{{app.accounts}}</small></dd>
98
- {{/unless}}
99
97
 
100
98
  {{#if app.clientId}}
101
99
  <dt>Client ID</dt>
@@ -42,6 +42,19 @@
42
42
  by default.</span>
43
43
  </div>
44
44
 
45
+ <div>
46
+ {{> ui/setting-ref name="tokenAuditLog"}}
47
+
48
+ {{#> ui/checkbox id="tokenAuditLog" name="tokenAuditLog" label="Access Token Audit Log"
49
+ checked=values.tokenAuditLog error=errors.tokenAuditLog}}
50
+ {{> ui/badge label=(when values.tokenAuditLog "enabled" "disabled") variant=(when values.tokenAuditLog "success" "neutral")}}
51
+ {{/ui/checkbox}}
52
+ <span class="helper-text">Record which requests each access token makes, readable at <a
53
+ href="/admin/reference/access-tokens#getV1TokensTokenLog" target="_blank"
54
+ rel="noopener noreferrer" class="link link-animated">the token log endpoint</a>. Adds a write to
55
+ every authenticated request, and entries only exist from the point this is switched on.</span>
56
+ </div>
57
+
45
58
  {{/ui/card}}
46
59
 
47
60
  {{#> ui/card title="Secrets and Encryption" id="secrets" bodyClass="space-y-4"}}
@@ -53,26 +53,16 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
53
53
 
54
54
  <div>
55
55
  {{#> ui/form-field id="name" label="Application name" error=errors.name}}
56
- {{#if appData.legacy}}
57
- <input type="text" class="input{{#if errors.name}} is-invalid{{/if}}" id="name" value="{{appData.name}}"
58
- placeholder="Enter application name, eg. &quot;My App&quot;&mldr;" disabled />
59
- {{else}}
60
56
  <input type="text" class="input{{#if errors.name}} is-invalid{{/if}}" id="name" name="name"
61
57
  value="{{values.name}}" placeholder="Enter application name, eg. &quot;My App&quot;&mldr;" required />
62
- {{/if}}
63
58
  <span class="helper-text">Application name used when listing apps.</span>
64
59
  {{/ui/form-field}}
65
60
  </div>
66
61
 
67
62
  <div>
68
63
  {{#> ui/form-field id="description" label="Description" error=errors.description}}
69
- {{#if appData.legacy}}
70
- <input type="text" class="input{{#if errors.description}} is-invalid{{/if}}" id="description"
71
- value="{{appData.description}}" placeholder="" disabled />
72
- {{else}}
73
64
  <input type="text" class="input{{#if errors.description}} is-invalid{{/if}}" id="description"
74
65
  name="description" value="{{values.description}}" placeholder="" />
75
- {{/if}}
76
66
  <span class="helper-text">Optional application description or a comment.</span>
77
67
  {{/ui/form-field}}
78
68
  </div>
@@ -80,13 +70,8 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
80
70
  {{#unless activeGmailService}}{{#unless activeOutlookService}}
81
71
  <div>
82
72
  {{#> ui/form-field id="title" label="Display title" error=errors.title}}
83
- {{#if appData.legacy}}
84
- <input type="text" class="input{{#if errors.title}} is-invalid{{/if}}" id="title" value="{{appData.title}}"
85
- placeholder="" disabled />
86
- {{else}}
87
73
  <input type="text" class="input{{#if errors.title}} is-invalid{{/if}}" id="title" name="title"
88
74
  value="{{values.title}}" placeholder="" />
89
- {{/if}}
90
75
  <span class="helper-text">Optional display title next to the application button on the account type
91
76
  selection page.</span>
92
77
  {{/ui/form-field}}
@@ -6,6 +6,9 @@
6
6
 
7
7
  Params:
8
8
  label - summary text (required)
9
+ preview - muted continuation of the summary, e.g. the first child names of a
10
+ collapsed property group (optional). "6 properties" on its own gives a
11
+ reader nothing to decide on, and one tag page renders 135 closed groups
9
12
  elId - element id on the <details> (optional). Deliberately NOT named `id`:
10
13
  Handlebars merges a partial's hash params into the caller's context,
11
14
  so a partial that reads `id` also picks up an `id` that merely
@@ -30,8 +33,11 @@
30
33
  <summary
31
34
  class="flex cursor-pointer list-none items-center gap-1 [&::-webkit-details-marker]:hidden {{#if primary}}text-primary hover:text-primary/80 text-sm font-semibold{{else}}text-base-content/60 hover:text-base-content text-xs{{/if}}">
32
35
  <span class="ee-ref-chevron icon-[tabler--chevron-right] shrink-0 {{#if primary}}size-4{{else}}size-3.5{{/if}}"></span>
33
- {{label}}
36
+ {{!-- truncate, not just nowrap: the preview is a hint about what is inside the group,
37
+ so it gives up its tail rather than pushing the summary past the viewport --}}
38
+ <span class="min-w-0 truncate">{{label}}{{#if preview}}<span
39
+ class="text-base-content/45 ms-1.5 font-normal">{{preview}}</span>{{/if}}</span>
34
40
  </summary>
35
41
  {{!-- own hash params are neutralized so they cannot fall through into nested ui/* calls inside the block --}}
36
- {{> @partial-block label="" elId="" open="" primary="" class=""}}
42
+ {{> @partial-block label="" preview="" elId="" open="" primary="" class=""}}
37
43
  </details>
@@ -45,24 +45,55 @@
45
45
  </div>
46
46
  {{/if}}
47
47
 
48
- {{> reference/params title="Path parameters" params=pathParams}}
49
- {{> reference/params title="Query parameters" params=queryParams}}
50
- {{> reference/params title="Headers" params=headerParams}}
48
+ {{> reference/params title="Path parameters" params=pathParams flags=""}}
49
+ {{> reference/params title="Query parameters" params=queryParams flags=queryFlags}}
50
+ {{> reference/params title="Headers" params=headerParams flags=""}}
51
51
 
52
+ {{!-- Example first, and open. It used to sit collapsed below the property tree, so on
53
+ a 128-property response the one artifact that answers "what does this look like"
54
+ was 6,700 pixels down and behind a click. The shape is what orients a reader
55
+ before any individual field matters. --}}
52
56
  {{#if body}}
53
57
  <div class="mt-5">
54
58
  {{> reference/section-heading label="Request body" suffix=body.contentType class="mb-2"}}
55
59
  {{#if body.descriptionHtml}}
56
60
  <div class="text-base-content/70 mb-2 text-sm"><p>{{{body.descriptionHtml}}}</p></div>
57
61
  {{/if}}
58
- {{#if body.tree}}
59
- {{> reference/schema body.tree}}
60
- {{/if}}
62
+ {{!-- Two views where they differ, one where they do not. The typical payload is
63
+ the curated one and stays the default; the complete one fills in every key
64
+ the curated example leaves out, which on submit is 61 of 71 fields. Only 8
65
+ of the document's 34 bodies differ, and completeJson is non-empty only when
66
+ exampleJson is - both come from the same schema - so the tab strip is
67
+ conditional inside one disclosure rather than the disclosure being written
68
+ out twice. See buildBody() in lib/api-reference/model.js. --}}
61
69
  {{#if body.exampleJson}}
62
- {{#> reference/disclosure label="Example request body" class="mt-3"}}
63
- <pre class="ee-code-block mt-2"><code class="language-json">{{body.exampleJson}}</code></pre>
70
+ {{#> reference/disclosure label="Example request body" open=true class="mb-3"}}
71
+ <div>
72
+ {{#if body.completeJson}}
73
+ {{#> ui/tabs label="Request body examples" class="mt-2 mb-2"}}
74
+ {{> ui/tab target=body.exampleTabId label="Typical" active=true}}
75
+ {{> ui/tab target=body.completeTabId label="Every field" active=""}}
76
+ {{/ui/tabs}}
77
+ <div id="{{body.exampleTabId}}" role="tabpanel" aria-labelledby="{{body.exampleTabId}}-tab">
78
+ <pre class="ee-code-block ee-ref-example"><code class="language-json">{{body.exampleJson}}</code></pre>
79
+ </div>
80
+ <div id="{{body.completeTabId}}" role="tabpanel" aria-labelledby="{{body.completeTabId}}-tab" class="hidden">
81
+ <p class="text-base-content/50 mb-2 text-xs">Every documented field, with a sample value. Send only
82
+ the ones you need.</p>
83
+ <pre class="ee-code-block ee-ref-example"><code class="language-json">{{body.completeJson}}</code></pre>
84
+ </div>
85
+ {{else}}
86
+ <pre class="ee-code-block ee-ref-example mt-2"><code class="language-json">{{body.exampleJson}}</code></pre>
87
+ {{/if}}
88
+ </div>
64
89
  {{/reference/disclosure}}
65
90
  {{/if}}
91
+ {{#if body.tree.showTools}}
92
+ {{> reference/schema-tools scope=body.scopeId label="Filter request body fields"}}
93
+ {{/if}}
94
+ {{#if body.tree}}
95
+ <div id="{{body.scopeId}}" class="mt-2">{{> reference/schema body.tree}}</div>
96
+ {{/if}}
66
97
  </div>
67
98
  {{/if}}
68
99
 
@@ -83,14 +114,17 @@
83
114
  {{#if descriptionHtml}}
84
115
  <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
85
116
  {{/if}}
86
- {{#if tree}}
87
- <div class="mt-2">{{> reference/schema tree}}</div>
88
- {{/if}}
89
117
  {{#if exampleJson}}
90
- {{#> reference/disclosure label="Example response" class="mt-3"}}
91
- <pre class="ee-code-block mt-2"><code class="language-json">{{exampleJson}}</code></pre>
118
+ {{#> reference/disclosure label="Example response" open=true class="mt-3 mb-3"}}
119
+ <pre class="ee-code-block ee-ref-example mt-2"><code class="language-json">{{exampleJson}}</code></pre>
92
120
  {{/reference/disclosure}}
93
121
  {{/if}}
122
+ {{#if tree.showTools}}
123
+ {{> reference/schema-tools scope=scopeId label="Filter response fields"}}
124
+ {{/if}}
125
+ {{#if tree}}
126
+ <div id="{{scopeId}}" class="mt-2">{{> reference/schema tree}}</div>
127
+ {{/if}}
94
128
  </div>
95
129
  {{/each}}
96
130
  </div>
@@ -3,18 +3,34 @@
3
3
  Renders nothing when the group is empty, so callers can include all three
4
4
  unconditionally.
5
5
  Params:
6
- title - group heading, e.g. "Path parameters" (required)
6
+ title - group heading, e.g. "Query parameters" (required)
7
7
  params - array of parameter view models from lib/api-reference/model.js (required)
8
+ flags - parameter names, when the model recognised the group as a flag list rather
9
+ than N documented parameters (optional; see flagNames() in model.js)
8
10
 
9
11
  Rows are reference/schema-node: buildParameter() emits the same field names as a
10
12
  schema tree node, so a parameter renders identically to a property without a
11
13
  second copy of the row markup.
14
+
15
+ A flag list is the exception. GET /v1/settings takes 87 same-typed, undocumented
16
+ booleans that together answer one question - which settings do you want back - and a
17
+ row each made roughly 260 lines of page carrying no more information than the chip
18
+ grid below. The model only sets `flags` when every member of the group is uniform, so
19
+ nothing with a description or a required member can land here.
12
20
  --}}
13
21
  {{#if params.length}}
14
22
  <div class="mt-4">
15
23
  {{> reference/section-heading label=title class="mb-2"}}
24
+ {{#if flags}}
25
+ <p class="text-base-content/70 mb-2 text-sm">Set any of these to <code class="ee-chip">true</code> to include it in the
26
+ response. All default to <code class="ee-chip">false</code>.</p>
27
+ <div class="flex flex-wrap gap-1">
28
+ {{#each flags}}<code class="ee-chip">{{this}}</code>{{/each}}
29
+ </div>
30
+ {{else}}
16
31
  <ul class="ee-ref-props">
17
32
  {{#each params}}{{> reference/schema-node}}{{/each}}
18
33
  </ul>
34
+ {{/if}}
19
35
  </div>
20
36
  {{/if}}
@@ -6,12 +6,25 @@
6
6
  (depth-capped, with $ref cycles marked instead of followed).
7
7
 
8
8
  Also rendered directly for operation parameters (reference/params) - the parameter
9
- view models from buildParameter() carry the same field names and simply have no
10
- children or variants, so the nested blocks below render nothing for them.
9
+ view models from buildParameter() carry the same field names as a tree node and simply
10
+ have no children or variants, so the nested blocks below render nothing for them.
11
11
 
12
12
  Context is a node from buildSchemaTree(): name, anchor, typeLabel, required, nullable,
13
- deprecated, constraints[], enumValues[], defaultValue, descriptionHtml, children[],
14
- variants[], openByDefault, truncated, circular, unresolved.
13
+ deprecated, constraints[], enumValues[], alsoAccepts[], defaultValue, descriptionHtml,
14
+ usageHtml, example, children[], variants[], openByDefault, childLabel, childPreview,
15
+ truncated, circular, unresolved.
16
+
17
+ The row is a two-column grid (.ee-ref-prop-row in app.tailwind.css): the name, type and
18
+ constraint chips sit in a rail on the left, the prose in a column beside it capped at a
19
+ readable measure. Before that the name sat above its own description at the same left
20
+ edge and the description ran the full content width - about 120 characters - so a
21
+ 128-property response read as one undifferentiated field. The grid collapses back to a
22
+ single stacked column when the row is too narrow to split.
23
+
24
+ A cut example carries the whole value twice, in two forms: `title` is the raw value for
25
+ the native tooltip, and `data-example` is the JSON form the try-it autocompleter inserts,
26
+ so the completion is never reconstructed from the rendered text - and never inserts an
27
+ unquoted string into a JSON body. Only the 54 cut rows in the document emit either.
15
28
 
16
29
  `anchor` is the dotted id of this property within its operation, e.g.
17
30
  "accountCreate.body.imap.tls.rejectUnauthorized", so a single field can be linked to
@@ -23,59 +36,104 @@
23
36
  --}}
24
37
  <li class="ee-ref-prop min-w-0"{{#if anchor}} id="{{anchor}}"{{/if}}>
25
38
 
26
- <div class="ee-ref-prop-head flex flex-wrap items-baseline gap-x-2 gap-y-1">
27
- {{#if name}}<code class="text-sm font-semibold break-all">{{name}}</code>{{/if}}
28
- <span class="text-primary text-xs font-medium">{{typeLabel}}</span>
29
- {{#if required}}<span class="text-error text-2xs font-semibold tracking-wide uppercase">required</span>{{/if}}
30
- {{#if nullable}}<span class="ee-chip">nullable</span>{{/if}}
31
- {{#if deprecated}}{{> ui/badge label="deprecated" variant="warning" soft=true icon="" class=""}}{{/if}}
32
- {{#each constraints}}<span class="ee-chip">{{this}}</span>{{/each}}
33
- {{#if anchor}}
34
- {{> reference/anchor-link target=anchor label=(concat "Link to the " name " property") small=true class="ee-ref-prop-anchor"}}
35
- {{/if}}
36
- </div>
39
+ <div class="ee-ref-prop-row">
37
40
 
38
- {{#if descriptionHtml}}
39
- <div class="text-base-content/70 mt-1 text-sm"><p>{{{descriptionHtml}}}</p></div>
40
- {{/if}}
41
+ <div class="ee-ref-prop-rail">
42
+ <div class="ee-ref-prop-line">
43
+ {{#if name}}<code class="text-sm font-semibold break-all">{{name}}</code>{{/if}}
44
+ {{#if anchor}}
45
+ {{> reference/anchor-link target=anchor label=(concat "Link to the " name " property") small=true class="ee-ref-prop-anchor"}}
46
+ {{/if}}
47
+ </div>
48
+ <div class="ee-ref-prop-line">
49
+ <span class="text-primary text-xs font-medium">{{typeLabel}}</span>
50
+ {{#if required}}<span class="text-error text-2xs font-semibold tracking-wide uppercase">required</span>{{/if}}
51
+ {{#if nullable}}<span class="ee-chip">nullable</span>{{/if}}
52
+ {{#if deprecated}}{{> ui/badge label="deprecated" variant="warning" soft=true icon="" class=""}}{{/if}}
53
+ {{#each constraints}}<span class="ee-chip">{{this}}</span>{{/each}}
54
+ </div>
55
+ </div>
41
56
 
42
- {{#if enumValues}}
43
- {{#if enumDocumented}}
44
- {{!-- documented values get a row each; joi .meta({enumDescriptions}) is the source --}}
45
- <div class="mt-1">
46
- <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed values</span>
47
- <ul class="ee-ref-nest mt-1 space-y-1">
48
- {{#each enumValues}}
49
- <li class="flex flex-wrap items-baseline gap-x-2 text-sm">
50
- <code class="ee-chip">{{value}}</code>
51
- {{#if description}}<span class="text-base-content/70">{{description}}</span>{{/if}}
52
- </li>
53
- {{/each}}
54
- </ul>
55
- </div>
56
- {{else}}
57
- <div class="mt-1 flex flex-wrap items-baseline gap-1">
58
- <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed</span>
59
- {{#each enumValues}}<code class="ee-chip">{{value}}</code>{{/each}}
60
- </div>
61
- {{/if}}
62
- {{/if}}
57
+ <div class="ee-ref-prop-body">
63
58
 
64
- {{#if defaultValue}}
65
- <div class="text-base-content/50 mt-1 text-xs">Default <code class="ee-chip">{{defaultValue}}</code></div>
66
- {{/if}}
59
+ {{!-- The example rides the end of the description rather than taking a line of
60
+ its own. The prose column is 34rem, the median description is 41 characters
61
+ and the median example 15, so 86% of these land on a line that already
62
+ exists; a line each would have added about 12,500px across five tag pages
63
+ that already run to 90,000. Which rows get one is decided by rowExample()
64
+ in lib/api-reference/schema-tree.js, not here. --}}
65
+ {{#if descriptionHtml}}
66
+ <div class="text-base-content/70 text-sm"><p>{{{descriptionHtml}}}{{#if example}} <code
67
+ class="ee-ref-example-value" {{#if example.title}}title="{{example.title}}" data-example="{{example.full}}"
68
+ {{/if}}>{{example.text}}</code>{{/if}}</p>
69
+ </div>
70
+ {{else if example}}
71
+ <div class="text-sm"><code class="ee-ref-example-value" {{#if example.title}}title="{{example.title}}"
72
+ data-example="{{example.full}}" {{/if}}>{{example.text}}</code></div>
73
+ {{/if}}
67
74
 
68
- {{#if circular}}
69
- <div class="text-warning mt-1 text-xs">Recursive reference - see the parent definition</div>
70
- {{/if}}
75
+ {{!-- Long-form guidance, closed. A field without one is unchanged; a field with
76
+ one costs a single summary line until someone wants the answer. The
77
+ seventeen fields that used to cram this into the description are why the
78
+ slot exists - see lib/field-usage.js. --}}
79
+ {{#if usageHtml}}
80
+ {{#> reference/disclosure label="When to use this" class="mt-1"}}
81
+ <div class="ee-ref-usage text-base-content/70 mt-1 text-sm"><p>{{{usageHtml}}}</p></div>
82
+ {{/reference/disclosure}}
83
+ {{/if}}
71
84
 
72
- {{#if truncated}}
73
- <div class="text-warning mt-1 text-xs">Nesting too deep to display</div>
74
- {{/if}}
85
+ {{#if enumValues}}
86
+ {{#if enumDocumented}}
87
+ {{!-- documented values get a row each; joi .meta({enumDescriptions}) is the source --}}
88
+ <div class="mt-1">
89
+ <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed values</span>
90
+ <ul class="ee-ref-nest mt-1 space-y-1">
91
+ {{#each enumValues}}
92
+ <li class="flex flex-wrap items-baseline gap-x-2 text-sm">
93
+ <code class="ee-chip">{{value}}</code>
94
+ {{#if description}}<span class="text-base-content/70">{{description}}</span>{{/if}}
95
+ </li>
96
+ {{/each}}
97
+ </ul>
98
+ </div>
99
+ {{else}}
100
+ <div class="mt-1 flex flex-wrap items-baseline gap-1">
101
+ <span class="text-base-content/50 text-2xs tracking-wide uppercase">Allowed</span>
102
+ {{#each enumValues}}<code class="ee-chip">{{value}}</code>{{/each}}
103
+ </div>
104
+ {{/if}}
105
+ {{/if}}
75
106
 
76
- {{#if unresolved}}
77
- <div class="text-warning mt-1 text-xs">Unresolved reference {{unresolved}}</div>
78
- {{/if}}
107
+ {{!-- Sentinels the schema accepts beside its own type - joi .allow(false) on a
108
+ string, an integer or an object. Deliberately not the "Allowed" row above:
109
+ that reads as the whole value domain, which claimed an IMAP configuration
110
+ object accepted nothing but `false`. --}}
111
+ {{#if alsoAccepts}}
112
+ <div class="text-base-content/50 mt-1 flex flex-wrap items-baseline gap-1 text-xs">
113
+ <span>Also accepts</span>
114
+ {{#each alsoAccepts}}<code class="ee-chip">{{this}}</code>{{/each}}
115
+ </div>
116
+ {{/if}}
117
+
118
+ {{#if defaultValue}}
119
+ <div class="text-base-content/50 mt-1 text-xs">Default <code class="ee-chip">{{defaultValue}}</code></div>
120
+ {{/if}}
121
+
122
+ {{#if circular}}
123
+ <div class="text-warning mt-1 text-xs">Recursive reference - see the parent definition</div>
124
+ {{/if}}
125
+
126
+ {{#if truncated}}
127
+ <div class="text-warning mt-1 text-xs">Nesting too deep to display</div>
128
+ {{/if}}
129
+
130
+ {{#if unresolved}}
131
+ <div class="text-warning mt-1 text-xs">Unresolved reference {{unresolved}}</div>
132
+ {{/if}}
133
+
134
+ </div>
135
+
136
+ </div>
79
137
 
80
138
  {{#if variants.length}}
81
139
  <div class="ee-ref-nest mt-2 space-y-2">
@@ -89,7 +147,7 @@
89
147
  {{/if}}
90
148
 
91
149
  {{#if children.length}}
92
- {{#> reference/disclosure label=childLabel open=openByDefault class="mt-2"}}
150
+ {{#> reference/disclosure label=childLabel preview=childPreview open=openByDefault class="mt-1"}}
93
151
  <ul class="ee-ref-props ee-ref-nest mt-2">
94
152
  {{#each children}}{{> reference/schema-node}}{{/each}}
95
153
  </ul>
@@ -0,0 +1,25 @@
1
+ {{!--
2
+ reference/schema-tools - the filter box and expand/collapse pair that sit beside a
3
+ large schema's heading.
4
+
5
+ Params:
6
+ scope - id of the element holding the property rows these act on (required)
7
+ label - what is being filtered, used as the placeholder and the accessible name,
8
+ e.g. "Filter response fields" (required)
9
+
10
+ Rendered only for schemas past a size threshold (see reference/operation): on a
11
+ three-property body a filter is noise, and a tag page would otherwise carry two dozen
12
+ of them. Behavior lives in static/js/reference.js, keyed off data-schema-tools and the
13
+ data-schema-scope id - the page itself is server-rendered and works without it, which
14
+ is why the controls degrade to a plain input and two buttons that simply do nothing if
15
+ the script never loads.
16
+
17
+ The script finds the input and the buttons by their position inside this container
18
+ rather than by hook attributes, so the shared ui/* partials can be used unchanged.
19
+ --}}
20
+ <div class="flex flex-wrap items-center gap-2" data-schema-tools data-schema-scope="{{scope}}">
21
+ {{> ui/search-input placeholder=label class="w-48" id="" name="" value="" type="" shortcut="" shortcutMac=""}}
22
+ {{> ui/btn label="Expand all" bare=true style="text" size="xs" icon="" id="" class="" type=""}}
23
+ {{> ui/btn label="Collapse all" bare=true style="text" size="xs" icon="" id="" class="" type=""}}
24
+ <span class="text-base-content/50 text-xs" data-schema-count role="status" aria-live="polite"></span>
25
+ </div>