primcli 3.0.0-preview.15 → 3.0.0-preview.16
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.
- package/dist/{api-command-D5Nbd6Pq.js → api-command-D1LX7Tjj.js} +811 -435
- package/dist/{machine-session-DyGP7wDs.js → machine-session-DJoBSWTy.js} +4 -4
- package/dist/{notify-session-B64Lgv6Z.js → notify-session-7oM8bkRx.js} +2 -2
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/help.js +5 -2
- package/dist/oclif/index.js +207 -85
- package/dist/oclif/receiver-heal.js +2 -2
- package/dist/{repeats-Dj_o6c-X-C1y88ZwJ.js → repeats-Dj_o6c-X-BLUY-8zn.js} +5 -5
- package/dist/{scoped-chat-CocomDwR.js → scoped-chat-CrQpmC0K.js} +1 -1
- package/dist/{signal-command-lJM0763f.js → signal-command-Bkr_XwLC.js} +4 -4
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as getOwnGrant, B as awaitingRejectedError, G as isAwaitingRejectedError, J as EMAIL_RULE_OBJECTION_EVENT_TYPES,
|
|
1
|
+
import { $t as getOwnGrant, B as awaitingRejectedError, G as isAwaitingRejectedError, J as EMAIL_RULE_OBJECTION_EVENT_TYPES, R as ReplyStateUnsupportedError, V as ensureSearchReportsReplyState, Wt as getEmail, X as SENT_EMAIL_EVENT_TYPES, Y as EMAIL_RULE_REQUEST_EVENT_TYPES, Z as WEBHOOK_EVENT_TYPES, at as AutomatedFilterUnsupportedError, ct as automatedSurfaceForOperation, ft as isAutomatedRejectedError, lt as ensureSearchReportsAutomated, ot as assertAutomatedVerdict, q as replyStateSurfaceForOperation, qn as sdk_gen_exports, rn as getThread, st as automatedRejectedError, ut as expectedAutomatedVerdicts, y as parseRetryAfter, yn as listEndpoints, z as assertAwaitingFilterRows } from "./repeats-Dj_o6c-X-BLUY-8zn.js";
|
|
2
2
|
import { C as saveCliCredentials, F as agentProfilesDirectory, H as requireDefaultLoginProfile, N as agentProfileDirectory, R as loadConnectedAgentProfile, S as resolveCliAuth, W as PrimitiveApiClient, _ as deleteCliCredentials, b as loadCliCredentials, c as resolveConfigEnvironment, d as validateCliHeaderName, f as validateCliHeaderValue, i as loadCliConfig, j as AGENT_PROFILE_ENV, m as cliAccessTokenExpiresAt, p as acquireCliCredentialsLock, w as saveSignupCredentials, x as normalizeApiBaseUrl, y as detectPrimitiveKeyEnvMisname } from "./cli-config-Ms_0vNjq.js";
|
|
3
3
|
import "./oclif/global-org-flag.js";
|
|
4
4
|
import { a as thrownErrorBody } from "./json-output-ch756TXV.js";
|
|
@@ -6460,7 +6460,7 @@ const operationManifest = [
|
|
|
6460
6460
|
},
|
|
6461
6461
|
"webhook_attempt_count": {
|
|
6462
6462
|
"type": "integer",
|
|
6463
|
-
"description": "
|
|
6463
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
|
|
6464
6464
|
},
|
|
6465
6465
|
"thread_id": {
|
|
6466
6466
|
"type": ["string", "null"],
|
|
@@ -14029,7 +14029,7 @@ const operationManifest = [
|
|
|
14029
14029
|
"binaryResponse": false,
|
|
14030
14030
|
"bodyRequired": false,
|
|
14031
14031
|
"command": "get-email-rule-covering-me",
|
|
14032
|
-
"description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
|
|
14032
|
+
"description": "One rule that covers one of your own mailboxes, read-only, with its current version; or one that no longer does but decided on mail at your own mailbox (covers_now false), shown as the version that last decided on your mail, without its current name. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
|
|
14033
14033
|
"hasJsonBody": false,
|
|
14034
14034
|
"method": "GET",
|
|
14035
14035
|
"operationId": "getEmailRuleCoveringMe",
|
|
@@ -14175,7 +14175,7 @@ const operationManifest = [
|
|
|
14175
14175
|
"exclusiveMinimum": 0
|
|
14176
14176
|
},
|
|
14177
14177
|
"reads_in_full": {
|
|
14178
|
-
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
|
|
14178
|
+
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
|
|
14179
14179
|
"type": "integer",
|
|
14180
14180
|
"minimum": 0
|
|
14181
14181
|
},
|
|
@@ -14346,7 +14346,7 @@ const operationManifest = [
|
|
|
14346
14346
|
"exclusiveMinimum": 0
|
|
14347
14347
|
},
|
|
14348
14348
|
"reads_in_full": {
|
|
14349
|
-
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
|
|
14349
|
+
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
|
|
14350
14350
|
"type": "integer",
|
|
14351
14351
|
"minimum": 0
|
|
14352
14352
|
},
|
|
@@ -15142,7 +15142,7 @@ const operationManifest = [
|
|
|
15142
15142
|
"binaryResponse": false,
|
|
15143
15143
|
"bodyRequired": false,
|
|
15144
15144
|
"command": "list-email-rules-covering-me",
|
|
15145
|
-
"description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address):
|
|
15145
|
+
"description": "Every email rule that covers one of your own mailboxes now, yours included, newest first, in any state. A rule covers you when the scope it runs with now reaches one of your own mailboxes (your member mailbox, or a personal agent's address), and covers.via says how: author_reach, it runs over everything its author can read, which includes your mail (an author who reads the organization's mail or holds an access entry for your mailbox); selected, it names your mailbox or its domain; own_mailboxes, it is your own rule over your own mail. Another member's own_mailboxes rule never covers you. You see its name, wording, current tree, state, kind and author, and which of your own mailboxes it reaches. Its wording and tree are shown as written, so they can name other addresses (a condition on who an email is from or to). While it covers you, you also see who receives what it matches (receivers): how many API keys, webhooks and shares, the member each belongs to (or the organization), and the sites the webhooks deliver to. You do not see which keys, webhooks or shares they are (no ids, names, prefixes, or URLs beyond the site), the other inboxes and domains its scope names, or its saved expectations. Each listed rule carries its current version's english and explanation; its tree is on GET /v1/email-rules/covering-me/{id}. A page can hold fewer rules than limit, or none, and still carry a cursor (one request reads a bounded number of rules): keep reading until meta.cursor is null. For what happened to one email of yours, every rule's decision on it and, for another member's rule covering you, who receives what it shares: GET /v1/emails/{id}/rule-results (primitive email-rules list-email-rule-results --email-id <email-id>). Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token). Only on your own dashboard session or the Primitive CLI.",
|
|
15146
15146
|
"hasJsonBody": false,
|
|
15147
15147
|
"method": "GET",
|
|
15148
15148
|
"operationId": "listEmailRulesCoveringMe",
|
|
@@ -15292,7 +15292,7 @@ const operationManifest = [
|
|
|
15292
15292
|
"exclusiveMinimum": 0
|
|
15293
15293
|
},
|
|
15294
15294
|
"reads_in_full": {
|
|
15295
|
-
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
|
|
15295
|
+
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
|
|
15296
15296
|
"type": "integer",
|
|
15297
15297
|
"minimum": 0
|
|
15298
15298
|
},
|
|
@@ -15463,7 +15463,7 @@ const operationManifest = [
|
|
|
15463
15463
|
"exclusiveMinimum": 0
|
|
15464
15464
|
},
|
|
15465
15465
|
"reads_in_full": {
|
|
15466
|
-
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
|
|
15466
|
+
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
|
|
15467
15467
|
"type": "integer",
|
|
15468
15468
|
"minimum": 0
|
|
15469
15469
|
},
|
|
@@ -15591,6 +15591,14 @@ const operationManifest = [
|
|
|
15591
15591
|
"created_at": {
|
|
15592
15592
|
"type": "string",
|
|
15593
15593
|
"format": "date-time"
|
|
15594
|
+
},
|
|
15595
|
+
"english": {
|
|
15596
|
+
"description": "What its author asked for, in their words, at its current version. Null when it has no version, was deleted after the page was read, or the words could not be read in time; GET /v1/email-rules/covering-me/{id} shows them with its tree.",
|
|
15597
|
+
"type": ["string", "null"]
|
|
15598
|
+
},
|
|
15599
|
+
"explanation": {
|
|
15600
|
+
"description": "What its current version matches, as compiled. Null as english is.",
|
|
15601
|
+
"type": ["string", "null"]
|
|
15594
15602
|
}
|
|
15595
15603
|
},
|
|
15596
15604
|
"required": [
|
|
@@ -15938,6 +15946,43 @@ const operationManifest = [
|
|
|
15938
15946
|
},
|
|
15939
15947
|
"required": ["evaluation_scope", "scope_selection"]
|
|
15940
15948
|
},
|
|
15949
|
+
"scope_warnings": {
|
|
15950
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
15951
|
+
"maxItems": 150,
|
|
15952
|
+
"type": "array",
|
|
15953
|
+
"items": {
|
|
15954
|
+
"type": "object",
|
|
15955
|
+
"properties": {
|
|
15956
|
+
"name": {
|
|
15957
|
+
"type": "string",
|
|
15958
|
+
"maxLength": 320
|
|
15959
|
+
},
|
|
15960
|
+
"kind": {
|
|
15961
|
+
"type": "string",
|
|
15962
|
+
"enum": ["address", "domain"]
|
|
15963
|
+
},
|
|
15964
|
+
"reason": {
|
|
15965
|
+
"type": "string",
|
|
15966
|
+
"enum": [
|
|
15967
|
+
"unknown_domain",
|
|
15968
|
+
"inactive_domain",
|
|
15969
|
+
"unknown_address"
|
|
15970
|
+
],
|
|
15971
|
+
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
15972
|
+
},
|
|
15973
|
+
"message": {
|
|
15974
|
+
"type": "string",
|
|
15975
|
+
"maxLength": 1e3
|
|
15976
|
+
}
|
|
15977
|
+
},
|
|
15978
|
+
"required": [
|
|
15979
|
+
"name",
|
|
15980
|
+
"kind",
|
|
15981
|
+
"reason",
|
|
15982
|
+
"message"
|
|
15983
|
+
]
|
|
15984
|
+
}
|
|
15985
|
+
},
|
|
15941
15986
|
"kind": {
|
|
15942
15987
|
"description": "Only grant.",
|
|
15943
15988
|
"type": "string",
|
|
@@ -16065,194 +16110,9 @@ const operationManifest = [
|
|
|
16065
16110
|
"responseSchema": {
|
|
16066
16111
|
"type": "object",
|
|
16067
16112
|
"properties": {
|
|
16068
|
-
"
|
|
16069
|
-
"
|
|
16070
|
-
"
|
|
16071
|
-
"id": {
|
|
16072
|
-
"type": "string",
|
|
16073
|
-
"format": "uuid"
|
|
16074
|
-
},
|
|
16075
|
-
"status": {
|
|
16076
|
-
"type": "string",
|
|
16077
|
-
"enum": [
|
|
16078
|
-
"pending",
|
|
16079
|
-
"accepted",
|
|
16080
|
-
"declined",
|
|
16081
|
-
"withdrawn"
|
|
16082
|
-
]
|
|
16083
|
-
},
|
|
16084
|
-
"name": { "type": "string" },
|
|
16085
|
-
"english": { "type": "string" },
|
|
16086
|
-
"tree": {
|
|
16087
|
-
"type": "object",
|
|
16088
|
-
"properties": {
|
|
16089
|
-
"version": {
|
|
16090
|
-
"type": "number",
|
|
16091
|
-
"const": 1
|
|
16092
|
-
},
|
|
16093
|
-
"vocabulary": {
|
|
16094
|
-
"type": "string",
|
|
16095
|
-
"description": "Vocabulary version, such as v1."
|
|
16096
|
-
},
|
|
16097
|
-
"when": {
|
|
16098
|
-
"type": "object",
|
|
16099
|
-
"propertyNames": { "type": "string" },
|
|
16100
|
-
"additionalProperties": {},
|
|
16101
|
-
"description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
|
|
16102
|
-
},
|
|
16103
|
-
"questions": {
|
|
16104
|
-
"type": "array",
|
|
16105
|
-
"items": { "type": "string" },
|
|
16106
|
-
"description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, never attachment contents. A grant rule needs every one yes; a do_not_share rule matches on any yes."
|
|
16107
|
-
}
|
|
16108
|
-
},
|
|
16109
|
-
"required": [
|
|
16110
|
-
"version",
|
|
16111
|
-
"vocabulary",
|
|
16112
|
-
"when",
|
|
16113
|
-
"questions"
|
|
16114
|
-
]
|
|
16115
|
-
},
|
|
16116
|
-
"explanation": { "type": "string" },
|
|
16117
|
-
"assumptions": {
|
|
16118
|
-
"type": "array",
|
|
16119
|
-
"items": { "type": "string" }
|
|
16120
|
-
},
|
|
16121
|
-
"warnings": {
|
|
16122
|
-
"type": "array",
|
|
16123
|
-
"items": { "type": "string" },
|
|
16124
|
-
"description": "As the member who asked sent them, normally from their compile, then every compiler note on the rule's tree and words they lack. The compiler's note that the rule matches nearly everything, in its own wording, counted that member's recent mail: anyone else reads it naming them."
|
|
16125
|
-
},
|
|
16126
|
-
"server_explanation": {
|
|
16127
|
-
"description": "What the rule as asked actually does: Primitive's own reading of the request's tree, never the words of the member who asked or of a model. Null when the tree no longer reads as one.",
|
|
16128
|
-
"type": ["string", "null"]
|
|
16129
|
-
},
|
|
16130
|
-
"server_notes": {
|
|
16131
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
16132
|
-
"type": "array",
|
|
16133
|
-
"items": { "type": "string" }
|
|
16134
|
-
},
|
|
16135
|
-
"compiled_by": { "type": "string" },
|
|
16136
|
-
"vocabulary": { "type": "string" },
|
|
16137
|
-
"proposed_via": {
|
|
16138
|
-
"type": "string",
|
|
16139
|
-
"enum": ["session", "oauth"],
|
|
16140
|
-
"description": "session: the proposer's own session; oauth: an OAuth or CLI token acting for them."
|
|
16141
|
-
},
|
|
16142
|
-
"created_at": {
|
|
16143
|
-
"type": "string",
|
|
16144
|
-
"format": "date-time"
|
|
16145
|
-
},
|
|
16146
|
-
"decided_at": {
|
|
16147
|
-
"type": ["string", "null"],
|
|
16148
|
-
"format": "date-time"
|
|
16149
|
-
},
|
|
16150
|
-
"decided_by_user_id": {
|
|
16151
|
-
"type": ["string", "null"],
|
|
16152
|
-
"format": "uuid"
|
|
16153
|
-
},
|
|
16154
|
-
"proposer": {
|
|
16155
|
-
"type": "object",
|
|
16156
|
-
"properties": {
|
|
16157
|
-
"user_id": {
|
|
16158
|
-
"type": "string",
|
|
16159
|
-
"format": "uuid"
|
|
16160
|
-
},
|
|
16161
|
-
"name": { "type": ["string", "null"] },
|
|
16162
|
-
"email": {
|
|
16163
|
-
"description": "Sign-in email; null unless you can list member emails, this is you, or they asked you.",
|
|
16164
|
-
"type": ["string", "null"]
|
|
16165
|
-
},
|
|
16166
|
-
"active": {
|
|
16167
|
-
"type": "boolean",
|
|
16168
|
-
"description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
|
|
16169
|
-
}
|
|
16170
|
-
},
|
|
16171
|
-
"required": [
|
|
16172
|
-
"user_id",
|
|
16173
|
-
"name",
|
|
16174
|
-
"email",
|
|
16175
|
-
"active"
|
|
16176
|
-
]
|
|
16177
|
-
},
|
|
16178
|
-
"target": {
|
|
16179
|
-
"type": "object",
|
|
16180
|
-
"properties": {
|
|
16181
|
-
"user_id": {
|
|
16182
|
-
"type": ["string", "null"],
|
|
16183
|
-
"format": "uuid",
|
|
16184
|
-
"description": "Null unless you can list members or this is you."
|
|
16185
|
-
},
|
|
16186
|
-
"name": {
|
|
16187
|
-
"description": "Null unless you can list members or this is you.",
|
|
16188
|
-
"type": ["string", "null"]
|
|
16189
|
-
},
|
|
16190
|
-
"email": {
|
|
16191
|
-
"description": "Sign-in email; null unless you can list member emails or this is you.",
|
|
16192
|
-
"type": ["string", "null"]
|
|
16193
|
-
},
|
|
16194
|
-
"active": {
|
|
16195
|
-
"type": "boolean",
|
|
16196
|
-
"description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
|
|
16197
|
-
}
|
|
16198
|
-
},
|
|
16199
|
-
"required": [
|
|
16200
|
-
"user_id",
|
|
16201
|
-
"name",
|
|
16202
|
-
"email",
|
|
16203
|
-
"active"
|
|
16204
|
-
]
|
|
16205
|
-
},
|
|
16206
|
-
"target_address_typed": {
|
|
16207
|
-
"description": "The address the proposer typed to name the target; null for anyone else, and when named by user id.",
|
|
16208
|
-
"type": ["string", "null"]
|
|
16209
|
-
},
|
|
16210
|
-
"is_proposer": { "type": "boolean" },
|
|
16211
|
-
"is_target": { "type": "boolean" },
|
|
16212
|
-
"share_id": {
|
|
16213
|
-
"type": ["string", "null"],
|
|
16214
|
-
"format": "uuid",
|
|
16215
|
-
"description": "The share accepting created, while it exists."
|
|
16216
|
-
},
|
|
16217
|
-
"message": {
|
|
16218
|
-
"description": "What the member asking wrote about why; null when they wrote nothing.",
|
|
16219
|
-
"type": ["string", "null"]
|
|
16220
|
-
},
|
|
16221
|
-
"decline_reason": {
|
|
16222
|
-
"description": "Why the member asked declined it; null unless they gave a reason when declining.",
|
|
16223
|
-
"type": ["string", "null"]
|
|
16224
|
-
},
|
|
16225
|
-
"edited_on_accept": {
|
|
16226
|
-
"description": "Once accepted: whether the rule was changed first, as on the share. Null until then, or when unreadable.",
|
|
16227
|
-
"type": ["boolean", "null"]
|
|
16228
|
-
},
|
|
16229
|
-
"notice": {
|
|
16230
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
16231
|
-
"type": ["string", "null"]
|
|
16232
|
-
}
|
|
16233
|
-
},
|
|
16234
|
-
"required": [
|
|
16235
|
-
"id",
|
|
16236
|
-
"status",
|
|
16237
|
-
"name",
|
|
16238
|
-
"english",
|
|
16239
|
-
"tree",
|
|
16240
|
-
"explanation",
|
|
16241
|
-
"assumptions",
|
|
16242
|
-
"warnings",
|
|
16243
|
-
"compiled_by",
|
|
16244
|
-
"vocabulary",
|
|
16245
|
-
"proposed_via",
|
|
16246
|
-
"created_at",
|
|
16247
|
-
"decided_at",
|
|
16248
|
-
"decided_by_user_id",
|
|
16249
|
-
"proposer",
|
|
16250
|
-
"target",
|
|
16251
|
-
"target_address_typed",
|
|
16252
|
-
"is_proposer",
|
|
16253
|
-
"is_target",
|
|
16254
|
-
"share_id"
|
|
16255
|
-
]
|
|
16113
|
+
"notice": {
|
|
16114
|
+
"description": "What is now shared, in words. When you changed the rule and it can now match mail the request left out by who it was sent to (such as mail where an address is only copied), that comes first; when you changed its english, tree or explanation (edited_on_accept; a new name alone is no change), that rule.current is what you agreed to and request what was asked.",
|
|
16115
|
+
"type": "string"
|
|
16256
16116
|
},
|
|
16257
16117
|
"rule": {
|
|
16258
16118
|
"type": "object",
|
|
@@ -16491,11 +16351,11 @@ const operationManifest = [
|
|
|
16491
16351
|
"rule_deleted",
|
|
16492
16352
|
null
|
|
16493
16353
|
],
|
|
16494
|
-
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
16354
|
+
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
16495
16355
|
},
|
|
16496
16356
|
"accepted_rule_version": {
|
|
16497
16357
|
"type": "integer",
|
|
16498
|
-
"description": "The version of the rule that was accepted. A
|
|
16358
|
+
"description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
|
|
16499
16359
|
},
|
|
16500
16360
|
"edited_on_accept": {
|
|
16501
16361
|
"type": "boolean",
|
|
@@ -16619,15 +16479,200 @@ const operationManifest = [
|
|
|
16619
16479
|
"rule_id"
|
|
16620
16480
|
]
|
|
16621
16481
|
},
|
|
16622
|
-
"
|
|
16623
|
-
"
|
|
16624
|
-
"
|
|
16482
|
+
"request": {
|
|
16483
|
+
"type": "object",
|
|
16484
|
+
"properties": {
|
|
16485
|
+
"id": {
|
|
16486
|
+
"type": "string",
|
|
16487
|
+
"format": "uuid"
|
|
16488
|
+
},
|
|
16489
|
+
"status": {
|
|
16490
|
+
"type": "string",
|
|
16491
|
+
"enum": [
|
|
16492
|
+
"pending",
|
|
16493
|
+
"accepted",
|
|
16494
|
+
"declined",
|
|
16495
|
+
"withdrawn"
|
|
16496
|
+
]
|
|
16497
|
+
},
|
|
16498
|
+
"name": { "type": "string" },
|
|
16499
|
+
"english": { "type": "string" },
|
|
16500
|
+
"tree": {
|
|
16501
|
+
"type": "object",
|
|
16502
|
+
"properties": {
|
|
16503
|
+
"version": {
|
|
16504
|
+
"type": "number",
|
|
16505
|
+
"const": 1
|
|
16506
|
+
},
|
|
16507
|
+
"vocabulary": {
|
|
16508
|
+
"type": "string",
|
|
16509
|
+
"description": "Vocabulary version, such as v1."
|
|
16510
|
+
},
|
|
16511
|
+
"when": {
|
|
16512
|
+
"type": "object",
|
|
16513
|
+
"propertyNames": { "type": "string" },
|
|
16514
|
+
"additionalProperties": {},
|
|
16515
|
+
"description": "A condition {column, op, value?, min_confidence?} (see GET /email-rules/vocabulary) or {all: [...]}, {any: [...]}, {not: ...}."
|
|
16516
|
+
},
|
|
16517
|
+
"questions": {
|
|
16518
|
+
"type": "array",
|
|
16519
|
+
"items": { "type": "string" },
|
|
16520
|
+
"description": "Yes/no questions asked once the conditions match, over the email's text and attachment names, never attachment contents. A grant rule needs every one yes; a do_not_share rule matches on any yes."
|
|
16521
|
+
}
|
|
16522
|
+
},
|
|
16523
|
+
"required": [
|
|
16524
|
+
"version",
|
|
16525
|
+
"vocabulary",
|
|
16526
|
+
"when",
|
|
16527
|
+
"questions"
|
|
16528
|
+
]
|
|
16529
|
+
},
|
|
16530
|
+
"explanation": { "type": "string" },
|
|
16531
|
+
"assumptions": {
|
|
16532
|
+
"type": "array",
|
|
16533
|
+
"items": { "type": "string" }
|
|
16534
|
+
},
|
|
16535
|
+
"warnings": {
|
|
16536
|
+
"type": "array",
|
|
16537
|
+
"items": { "type": "string" },
|
|
16538
|
+
"description": "As the member who asked sent them, normally from their compile, then every compiler note on the rule's tree and words they lack. The compiler's note that the rule matches nearly everything, in its own wording, counted that member's recent mail: anyone else reads it naming them."
|
|
16539
|
+
},
|
|
16540
|
+
"server_explanation": {
|
|
16541
|
+
"description": "What the rule as asked actually does: Primitive's own reading of the request's tree, never the words of the member who asked or of a model. Null when the tree no longer reads as one.",
|
|
16542
|
+
"type": ["string", "null"]
|
|
16543
|
+
},
|
|
16544
|
+
"server_notes": {
|
|
16545
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
16546
|
+
"type": "array",
|
|
16547
|
+
"items": { "type": "string" }
|
|
16548
|
+
},
|
|
16549
|
+
"compiled_by": { "type": "string" },
|
|
16550
|
+
"vocabulary": { "type": "string" },
|
|
16551
|
+
"proposed_via": {
|
|
16552
|
+
"type": "string",
|
|
16553
|
+
"enum": ["session", "oauth"],
|
|
16554
|
+
"description": "session: the proposer's own session; oauth: an OAuth or CLI token acting for them."
|
|
16555
|
+
},
|
|
16556
|
+
"created_at": {
|
|
16557
|
+
"type": "string",
|
|
16558
|
+
"format": "date-time"
|
|
16559
|
+
},
|
|
16560
|
+
"decided_at": {
|
|
16561
|
+
"type": ["string", "null"],
|
|
16562
|
+
"format": "date-time"
|
|
16563
|
+
},
|
|
16564
|
+
"decided_by_user_id": {
|
|
16565
|
+
"type": ["string", "null"],
|
|
16566
|
+
"format": "uuid"
|
|
16567
|
+
},
|
|
16568
|
+
"proposer": {
|
|
16569
|
+
"type": "object",
|
|
16570
|
+
"properties": {
|
|
16571
|
+
"user_id": {
|
|
16572
|
+
"type": "string",
|
|
16573
|
+
"format": "uuid"
|
|
16574
|
+
},
|
|
16575
|
+
"name": { "type": ["string", "null"] },
|
|
16576
|
+
"email": {
|
|
16577
|
+
"description": "Sign-in email; null unless you can list member emails, this is you, or they asked you.",
|
|
16578
|
+
"type": ["string", "null"]
|
|
16579
|
+
},
|
|
16580
|
+
"active": {
|
|
16581
|
+
"type": "boolean",
|
|
16582
|
+
"description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
|
|
16583
|
+
}
|
|
16584
|
+
},
|
|
16585
|
+
"required": [
|
|
16586
|
+
"user_id",
|
|
16587
|
+
"name",
|
|
16588
|
+
"email",
|
|
16589
|
+
"active"
|
|
16590
|
+
]
|
|
16591
|
+
},
|
|
16592
|
+
"target": {
|
|
16593
|
+
"type": "object",
|
|
16594
|
+
"properties": {
|
|
16595
|
+
"user_id": {
|
|
16596
|
+
"type": ["string", "null"],
|
|
16597
|
+
"format": "uuid",
|
|
16598
|
+
"description": "Null unless you can list members or this is you."
|
|
16599
|
+
},
|
|
16600
|
+
"name": {
|
|
16601
|
+
"description": "Null unless you can list members or this is you.",
|
|
16602
|
+
"type": ["string", "null"]
|
|
16603
|
+
},
|
|
16604
|
+
"email": {
|
|
16605
|
+
"description": "Sign-in email; null unless you can list member emails or this is you.",
|
|
16606
|
+
"type": ["string", "null"]
|
|
16607
|
+
},
|
|
16608
|
+
"active": {
|
|
16609
|
+
"type": "boolean",
|
|
16610
|
+
"description": "Still a member under the membership recorded (a request or share with someone who left no longer works)."
|
|
16611
|
+
}
|
|
16612
|
+
},
|
|
16613
|
+
"required": [
|
|
16614
|
+
"user_id",
|
|
16615
|
+
"name",
|
|
16616
|
+
"email",
|
|
16617
|
+
"active"
|
|
16618
|
+
]
|
|
16619
|
+
},
|
|
16620
|
+
"target_address_typed": {
|
|
16621
|
+
"description": "The address the proposer typed to name the target; null for anyone else, and when named by user id.",
|
|
16622
|
+
"type": ["string", "null"]
|
|
16623
|
+
},
|
|
16624
|
+
"is_proposer": { "type": "boolean" },
|
|
16625
|
+
"is_target": { "type": "boolean" },
|
|
16626
|
+
"share_id": {
|
|
16627
|
+
"type": ["string", "null"],
|
|
16628
|
+
"format": "uuid",
|
|
16629
|
+
"description": "The share accepting created, while it exists."
|
|
16630
|
+
},
|
|
16631
|
+
"message": {
|
|
16632
|
+
"description": "What the member asking wrote about why; null when they wrote nothing.",
|
|
16633
|
+
"type": ["string", "null"]
|
|
16634
|
+
},
|
|
16635
|
+
"decline_reason": {
|
|
16636
|
+
"description": "Why the member asked declined it; null unless they gave a reason when declining.",
|
|
16637
|
+
"type": ["string", "null"]
|
|
16638
|
+
},
|
|
16639
|
+
"edited_on_accept": {
|
|
16640
|
+
"description": "Once accepted: whether the rule was changed first, as on the share. Null until then, or when unreadable.",
|
|
16641
|
+
"type": ["boolean", "null"]
|
|
16642
|
+
},
|
|
16643
|
+
"notice": {
|
|
16644
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
16645
|
+
"type": ["string", "null"]
|
|
16646
|
+
}
|
|
16647
|
+
},
|
|
16648
|
+
"required": [
|
|
16649
|
+
"id",
|
|
16650
|
+
"status",
|
|
16651
|
+
"name",
|
|
16652
|
+
"english",
|
|
16653
|
+
"tree",
|
|
16654
|
+
"explanation",
|
|
16655
|
+
"assumptions",
|
|
16656
|
+
"warnings",
|
|
16657
|
+
"compiled_by",
|
|
16658
|
+
"vocabulary",
|
|
16659
|
+
"proposed_via",
|
|
16660
|
+
"created_at",
|
|
16661
|
+
"decided_at",
|
|
16662
|
+
"decided_by_user_id",
|
|
16663
|
+
"proposer",
|
|
16664
|
+
"target",
|
|
16665
|
+
"target_address_typed",
|
|
16666
|
+
"is_proposer",
|
|
16667
|
+
"is_target",
|
|
16668
|
+
"share_id"
|
|
16669
|
+
]
|
|
16625
16670
|
}
|
|
16626
16671
|
},
|
|
16627
16672
|
"required": [
|
|
16628
|
-
"request",
|
|
16629
16673
|
"rule",
|
|
16630
|
-
"share"
|
|
16674
|
+
"share",
|
|
16675
|
+
"request"
|
|
16631
16676
|
]
|
|
16632
16677
|
},
|
|
16633
16678
|
"sdkName": "acceptEmailRuleRequest",
|
|
@@ -16927,6 +16972,43 @@ const operationManifest = [
|
|
|
16927
16972
|
},
|
|
16928
16973
|
"required": ["evaluation_scope", "scope_selection"]
|
|
16929
16974
|
},
|
|
16975
|
+
"scope_warnings": {
|
|
16976
|
+
"description": "Names in the scope_selection sent that match nothing this organization receives mail at (a typo, or an inbox not yet in use), as a test or write would warn of them. Present only when there are some; writes ignore it.",
|
|
16977
|
+
"maxItems": 150,
|
|
16978
|
+
"type": "array",
|
|
16979
|
+
"items": {
|
|
16980
|
+
"type": "object",
|
|
16981
|
+
"properties": {
|
|
16982
|
+
"name": {
|
|
16983
|
+
"type": "string",
|
|
16984
|
+
"maxLength": 320
|
|
16985
|
+
},
|
|
16986
|
+
"kind": {
|
|
16987
|
+
"type": "string",
|
|
16988
|
+
"enum": ["address", "domain"]
|
|
16989
|
+
},
|
|
16990
|
+
"reason": {
|
|
16991
|
+
"type": "string",
|
|
16992
|
+
"enum": [
|
|
16993
|
+
"unknown_domain",
|
|
16994
|
+
"inactive_domain",
|
|
16995
|
+
"unknown_address"
|
|
16996
|
+
],
|
|
16997
|
+
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
16998
|
+
},
|
|
16999
|
+
"message": {
|
|
17000
|
+
"type": "string",
|
|
17001
|
+
"maxLength": 1e3
|
|
17002
|
+
}
|
|
17003
|
+
},
|
|
17004
|
+
"required": [
|
|
17005
|
+
"name",
|
|
17006
|
+
"kind",
|
|
17007
|
+
"reason",
|
|
17008
|
+
"message"
|
|
17009
|
+
]
|
|
17010
|
+
}
|
|
17011
|
+
},
|
|
16930
17012
|
"sql": {
|
|
16931
17013
|
"description": "Present only when include_sql was true.",
|
|
16932
17014
|
"type": "object",
|
|
@@ -17318,6 +17400,43 @@ const operationManifest = [
|
|
|
17318
17400
|
}
|
|
17319
17401
|
},
|
|
17320
17402
|
"required": ["evaluation_scope", "scope_selection"]
|
|
17403
|
+
},
|
|
17404
|
+
"scope_warnings": {
|
|
17405
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
17406
|
+
"maxItems": 150,
|
|
17407
|
+
"type": "array",
|
|
17408
|
+
"items": {
|
|
17409
|
+
"type": "object",
|
|
17410
|
+
"properties": {
|
|
17411
|
+
"name": {
|
|
17412
|
+
"type": "string",
|
|
17413
|
+
"maxLength": 320
|
|
17414
|
+
},
|
|
17415
|
+
"kind": {
|
|
17416
|
+
"type": "string",
|
|
17417
|
+
"enum": ["address", "domain"]
|
|
17418
|
+
},
|
|
17419
|
+
"reason": {
|
|
17420
|
+
"type": "string",
|
|
17421
|
+
"enum": [
|
|
17422
|
+
"unknown_domain",
|
|
17423
|
+
"inactive_domain",
|
|
17424
|
+
"unknown_address"
|
|
17425
|
+
],
|
|
17426
|
+
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
17427
|
+
},
|
|
17428
|
+
"message": {
|
|
17429
|
+
"type": "string",
|
|
17430
|
+
"maxLength": 1e3
|
|
17431
|
+
}
|
|
17432
|
+
},
|
|
17433
|
+
"required": [
|
|
17434
|
+
"name",
|
|
17435
|
+
"kind",
|
|
17436
|
+
"reason",
|
|
17437
|
+
"message"
|
|
17438
|
+
]
|
|
17439
|
+
}
|
|
17321
17440
|
}
|
|
17322
17441
|
},
|
|
17323
17442
|
"required": [
|
|
@@ -17524,11 +17643,15 @@ const operationManifest = [
|
|
|
17524
17643
|
},
|
|
17525
17644
|
"scope_warnings": {
|
|
17526
17645
|
"description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
|
|
17646
|
+
"maxItems": 150,
|
|
17527
17647
|
"type": "array",
|
|
17528
17648
|
"items": {
|
|
17529
17649
|
"type": "object",
|
|
17530
17650
|
"properties": {
|
|
17531
|
-
"name": {
|
|
17651
|
+
"name": {
|
|
17652
|
+
"type": "string",
|
|
17653
|
+
"maxLength": 320
|
|
17654
|
+
},
|
|
17532
17655
|
"kind": {
|
|
17533
17656
|
"type": "string",
|
|
17534
17657
|
"enum": ["address", "domain"]
|
|
@@ -17542,7 +17665,10 @@ const operationManifest = [
|
|
|
17542
17665
|
],
|
|
17543
17666
|
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
17544
17667
|
},
|
|
17545
|
-
"message": {
|
|
17668
|
+
"message": {
|
|
17669
|
+
"type": "string",
|
|
17670
|
+
"maxLength": 1e3
|
|
17671
|
+
}
|
|
17546
17672
|
},
|
|
17547
17673
|
"required": [
|
|
17548
17674
|
"name",
|
|
@@ -17732,13 +17858,43 @@ const operationManifest = [
|
|
|
17732
17858
|
}
|
|
17733
17859
|
},
|
|
17734
17860
|
"undecided_samples": {
|
|
17735
|
-
"description": "Made-up emails not decided, by index. Only a write
|
|
17861
|
+
"description": "Made-up emails not decided, by index. Only a write that saves a version or activates the rule, sent with if_expectations_pass or judged by default, judges them.",
|
|
17736
17862
|
"type": "array",
|
|
17737
17863
|
"items": {
|
|
17738
17864
|
"type": "integer",
|
|
17739
17865
|
"minimum": 0
|
|
17740
17866
|
}
|
|
17741
17867
|
},
|
|
17868
|
+
"failed_sample_details": {
|
|
17869
|
+
"description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
|
|
17870
|
+
"type": "array",
|
|
17871
|
+
"items": {
|
|
17872
|
+
"type": "object",
|
|
17873
|
+
"properties": {
|
|
17874
|
+
"index": {
|
|
17875
|
+
"type": "integer",
|
|
17876
|
+
"minimum": 0
|
|
17877
|
+
},
|
|
17878
|
+
"label": { "type": ["string", "null"] }
|
|
17879
|
+
},
|
|
17880
|
+
"required": ["index", "label"]
|
|
17881
|
+
}
|
|
17882
|
+
},
|
|
17883
|
+
"undecided_sample_details": {
|
|
17884
|
+
"description": "undecided_samples with each one's label, as failed_sample_details.",
|
|
17885
|
+
"type": "array",
|
|
17886
|
+
"items": {
|
|
17887
|
+
"type": "object",
|
|
17888
|
+
"properties": {
|
|
17889
|
+
"index": {
|
|
17890
|
+
"type": "integer",
|
|
17891
|
+
"minimum": 0
|
|
17892
|
+
},
|
|
17893
|
+
"label": { "type": ["string", "null"] }
|
|
17894
|
+
},
|
|
17895
|
+
"required": ["index", "label"]
|
|
17896
|
+
}
|
|
17897
|
+
},
|
|
17742
17898
|
"note": {
|
|
17743
17899
|
"description": "On an update that saved a version that did not pass, or a do_not_share rule created active: that it was saved anyway, is current, and whether it is live.",
|
|
17744
17900
|
"type": "string"
|
|
@@ -17764,7 +17920,7 @@ const operationManifest = [
|
|
|
17764
17920
|
"required": ["version", "note"]
|
|
17765
17921
|
},
|
|
17766
17922
|
"affects": {
|
|
17767
|
-
"description": "After an update that saved a version: API keys listing the rule
|
|
17923
|
+
"description": "After an update that saved a version, or turned a grant rule active: API keys listing the rule and the webhooks they own, which read and receive what a grant rule grants from now on. shares_ended is always 0: a new version keeps the rule's share (share_notice says so). Saving a version does not by itself change the rule's state. Absent after any other write, and if not read.",
|
|
17768
17924
|
"type": "object",
|
|
17769
17925
|
"properties": {
|
|
17770
17926
|
"keys": {
|
|
@@ -17787,11 +17943,11 @@ const operationManifest = [
|
|
|
17787
17943
|
]
|
|
17788
17944
|
},
|
|
17789
17945
|
"notice": {
|
|
17790
|
-
"description": "After a write that saved a version of an active rule keys or
|
|
17946
|
+
"description": "After a write that saved a version of an active rule keys, webhooks or a share read without checking it first: what it changes, and how to have the next one checked.",
|
|
17791
17947
|
"type": "string"
|
|
17792
17948
|
},
|
|
17793
17949
|
"share_notice": {
|
|
17794
|
-
"description": "After a write that
|
|
17950
|
+
"description": "After a write that saved a version of a rule with a live share: that the share goes on under it, given even when affects is not, with whom it is and the version they accepted when those can be read.",
|
|
17795
17951
|
"type": "string"
|
|
17796
17952
|
}
|
|
17797
17953
|
},
|
|
@@ -18003,6 +18159,43 @@ const operationManifest = [
|
|
|
18003
18159
|
},
|
|
18004
18160
|
"required": ["evaluation_scope", "scope_selection"]
|
|
18005
18161
|
},
|
|
18162
|
+
"scope_warnings": {
|
|
18163
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
18164
|
+
"maxItems": 150,
|
|
18165
|
+
"type": "array",
|
|
18166
|
+
"items": {
|
|
18167
|
+
"type": "object",
|
|
18168
|
+
"properties": {
|
|
18169
|
+
"name": {
|
|
18170
|
+
"type": "string",
|
|
18171
|
+
"maxLength": 320
|
|
18172
|
+
},
|
|
18173
|
+
"kind": {
|
|
18174
|
+
"type": "string",
|
|
18175
|
+
"enum": ["address", "domain"]
|
|
18176
|
+
},
|
|
18177
|
+
"reason": {
|
|
18178
|
+
"type": "string",
|
|
18179
|
+
"enum": [
|
|
18180
|
+
"unknown_domain",
|
|
18181
|
+
"inactive_domain",
|
|
18182
|
+
"unknown_address"
|
|
18183
|
+
],
|
|
18184
|
+
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
18185
|
+
},
|
|
18186
|
+
"message": {
|
|
18187
|
+
"type": "string",
|
|
18188
|
+
"maxLength": 1e3
|
|
18189
|
+
}
|
|
18190
|
+
},
|
|
18191
|
+
"required": [
|
|
18192
|
+
"name",
|
|
18193
|
+
"kind",
|
|
18194
|
+
"reason",
|
|
18195
|
+
"message"
|
|
18196
|
+
]
|
|
18197
|
+
}
|
|
18198
|
+
},
|
|
18006
18199
|
"kind": {
|
|
18007
18200
|
"description": "Only grant.",
|
|
18008
18201
|
"type": "string",
|
|
@@ -18079,7 +18272,7 @@ const operationManifest = [
|
|
|
18079
18272
|
"type": ["string", "null"]
|
|
18080
18273
|
},
|
|
18081
18274
|
"server_notes": {
|
|
18082
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
18275
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
18083
18276
|
"type": "array",
|
|
18084
18277
|
"items": { "type": "string" }
|
|
18085
18278
|
},
|
|
@@ -18178,7 +18371,7 @@ const operationManifest = [
|
|
|
18178
18371
|
"type": ["boolean", "null"]
|
|
18179
18372
|
},
|
|
18180
18373
|
"notice": {
|
|
18181
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
18374
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
18182
18375
|
"type": ["string", "null"]
|
|
18183
18376
|
},
|
|
18184
18377
|
"target_can_accept": {
|
|
@@ -18322,7 +18515,7 @@ const operationManifest = [
|
|
|
18322
18515
|
"type": ["string", "null"]
|
|
18323
18516
|
},
|
|
18324
18517
|
"server_notes": {
|
|
18325
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
18518
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
18326
18519
|
"type": "array",
|
|
18327
18520
|
"items": { "type": "string" }
|
|
18328
18521
|
},
|
|
@@ -18421,7 +18614,7 @@ const operationManifest = [
|
|
|
18421
18614
|
"type": ["boolean", "null"]
|
|
18422
18615
|
},
|
|
18423
18616
|
"notice": {
|
|
18424
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
18617
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
18425
18618
|
"type": ["string", "null"]
|
|
18426
18619
|
}
|
|
18427
18620
|
},
|
|
@@ -19384,7 +19577,7 @@ const operationManifest = [
|
|
|
19384
19577
|
"type": ["string", "null"]
|
|
19385
19578
|
},
|
|
19386
19579
|
"server_notes": {
|
|
19387
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
19580
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
19388
19581
|
"type": "array",
|
|
19389
19582
|
"items": { "type": "string" }
|
|
19390
19583
|
},
|
|
@@ -19483,7 +19676,7 @@ const operationManifest = [
|
|
|
19483
19676
|
"type": ["boolean", "null"]
|
|
19484
19677
|
},
|
|
19485
19678
|
"notice": {
|
|
19486
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
19679
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
19487
19680
|
"type": ["string", "null"]
|
|
19488
19681
|
}
|
|
19489
19682
|
},
|
|
@@ -19601,11 +19794,15 @@ const operationManifest = [
|
|
|
19601
19794
|
},
|
|
19602
19795
|
"scope_warnings": {
|
|
19603
19796
|
"description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
|
|
19797
|
+
"maxItems": 150,
|
|
19604
19798
|
"type": "array",
|
|
19605
19799
|
"items": {
|
|
19606
19800
|
"type": "object",
|
|
19607
19801
|
"properties": {
|
|
19608
|
-
"name": {
|
|
19802
|
+
"name": {
|
|
19803
|
+
"type": "string",
|
|
19804
|
+
"maxLength": 320
|
|
19805
|
+
},
|
|
19609
19806
|
"kind": {
|
|
19610
19807
|
"type": "string",
|
|
19611
19808
|
"enum": ["address", "domain"]
|
|
@@ -19619,7 +19816,10 @@ const operationManifest = [
|
|
|
19619
19816
|
],
|
|
19620
19817
|
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
19621
19818
|
},
|
|
19622
|
-
"message": {
|
|
19819
|
+
"message": {
|
|
19820
|
+
"type": "string",
|
|
19821
|
+
"maxLength": 1e3
|
|
19822
|
+
}
|
|
19623
19823
|
},
|
|
19624
19824
|
"required": [
|
|
19625
19825
|
"name",
|
|
@@ -19698,11 +19898,11 @@ const operationManifest = [
|
|
|
19698
19898
|
"rule_deleted",
|
|
19699
19899
|
null
|
|
19700
19900
|
],
|
|
19701
|
-
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
19901
|
+
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
19702
19902
|
},
|
|
19703
19903
|
"accepted_rule_version": {
|
|
19704
19904
|
"type": "integer",
|
|
19705
|
-
"description": "The version of the rule that was accepted. A
|
|
19905
|
+
"description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
|
|
19706
19906
|
},
|
|
19707
19907
|
"edited_on_accept": {
|
|
19708
19908
|
"type": "boolean",
|
|
@@ -20283,7 +20483,7 @@ const operationManifest = [
|
|
|
20283
20483
|
"type": ["string", "null"]
|
|
20284
20484
|
},
|
|
20285
20485
|
"server_notes": {
|
|
20286
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
20486
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
20287
20487
|
"type": "array",
|
|
20288
20488
|
"items": { "type": "string" }
|
|
20289
20489
|
},
|
|
@@ -20382,7 +20582,7 @@ const operationManifest = [
|
|
|
20382
20582
|
"type": ["boolean", "null"]
|
|
20383
20583
|
},
|
|
20384
20584
|
"notice": {
|
|
20385
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
20585
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
20386
20586
|
"type": ["string", "null"]
|
|
20387
20587
|
}
|
|
20388
20588
|
},
|
|
@@ -20419,7 +20619,7 @@ const operationManifest = [
|
|
|
20419
20619
|
"binaryResponse": false,
|
|
20420
20620
|
"bodyRequired": false,
|
|
20421
20621
|
"command": "list-email-rule-results",
|
|
20422
|
-
"description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
|
|
20622
|
+
"description": "What each rule you can see decided about this email (matched, not matched, or not run), in the words of the deciding version. A do_not_share rule that matched it blocks sharing while active; earlier shares stay. Only a caller who can read the email gets an answer. classification is every fact the classifier read, as rule conditions read it. At most 50 rules are listed, results first; not_listed counts the rest. Another member's rule that decided on your own mail is listed read_only (dashboard and CLI only), with who receives what it shares (receivers) while it covers you; hidden counts deciding rules you cannot see. Whether a rule delivered the email by webhook is not in the rule results: on your own mail, rule_deliveries on GET /v1/emails/{id} (primitive emails get <email-id> --json) counts each rule's webhook deliveries; on another member's mail, GET /v1/webhooks/deliveries?email_id=<email-id> (primitive webhook-deliveries list --email-id <email-id>, with webhooks:read) lists them. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
|
|
20423
20623
|
"hasJsonBody": false,
|
|
20424
20624
|
"method": "GET",
|
|
20425
20625
|
"operationId": "listEmailRuleResults",
|
|
@@ -20720,7 +20920,7 @@ const operationManifest = [
|
|
|
20720
20920
|
"exclusiveMinimum": 0
|
|
20721
20921
|
},
|
|
20722
20922
|
"reads_in_full": {
|
|
20723
|
-
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches.",
|
|
20923
|
+
"description": "On a rule over your mail: how many of these keys also list one of your own mailboxes, or its domain, so they read your mail there beyond what this rule matches. It counts what they can read, not whether any has read an email.",
|
|
20724
20924
|
"type": "integer",
|
|
20725
20925
|
"minimum": 0
|
|
20726
20926
|
},
|
|
@@ -21425,11 +21625,11 @@ const operationManifest = [
|
|
|
21425
21625
|
"rule_deleted",
|
|
21426
21626
|
null
|
|
21427
21627
|
],
|
|
21428
|
-
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
21628
|
+
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
21429
21629
|
},
|
|
21430
21630
|
"accepted_rule_version": {
|
|
21431
21631
|
"type": "integer",
|
|
21432
|
-
"description": "The version of the rule that was accepted. A
|
|
21632
|
+
"description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
|
|
21433
21633
|
},
|
|
21434
21634
|
"edited_on_accept": {
|
|
21435
21635
|
"type": "boolean",
|
|
@@ -21940,11 +22140,11 @@ const operationManifest = [
|
|
|
21940
22140
|
"rule_deleted",
|
|
21941
22141
|
null
|
|
21942
22142
|
],
|
|
21943
|
-
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
22143
|
+
"description": "Why it ended, once it has: stopped_by_granter, removed_by_beneficiary, stopped_by_admin, rule_changed (a new version of the rule was saved, on a share that ended before new versions kept shares) or rule_deleted (the rule was deleted; the share keeps its record, and the rule is no longer shown). Null while it has not."
|
|
21944
22144
|
},
|
|
21945
22145
|
"accepted_rule_version": {
|
|
21946
22146
|
"type": "integer",
|
|
21947
|
-
"description": "The version of the rule that was accepted. A
|
|
22147
|
+
"description": "The version of the rule that was accepted. A later version keeps the share: what each version matches is shared from when it is saved."
|
|
21948
22148
|
},
|
|
21949
22149
|
"edited_on_accept": {
|
|
21950
22150
|
"type": "boolean",
|
|
@@ -22543,6 +22743,11 @@ const operationManifest = [
|
|
|
22543
22743
|
"type": "string"
|
|
22544
22744
|
},
|
|
22545
22745
|
"subject": { "type": ["string", "null"] },
|
|
22746
|
+
"attachment_names": {
|
|
22747
|
+
"description": "On matched and near_miss: the file names the email lists, in order, at most 10 (the names its questions are given; never what is in the files). Parts with no name are left out; absent when there are none.",
|
|
22748
|
+
"type": "array",
|
|
22749
|
+
"items": { "type": "string" }
|
|
22750
|
+
},
|
|
22546
22751
|
"parts": {
|
|
22547
22752
|
"description": "How each top-level part of the rule decided. Present for matched, near_miss and no_match.",
|
|
22548
22753
|
"type": "array",
|
|
@@ -22742,11 +22947,15 @@ const operationManifest = [
|
|
|
22742
22947
|
},
|
|
22743
22948
|
"scope_warnings": {
|
|
22744
22949
|
"description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
|
|
22950
|
+
"maxItems": 150,
|
|
22745
22951
|
"type": "array",
|
|
22746
22952
|
"items": {
|
|
22747
22953
|
"type": "object",
|
|
22748
22954
|
"properties": {
|
|
22749
|
-
"name": {
|
|
22955
|
+
"name": {
|
|
22956
|
+
"type": "string",
|
|
22957
|
+
"maxLength": 320
|
|
22958
|
+
},
|
|
22750
22959
|
"kind": {
|
|
22751
22960
|
"type": "string",
|
|
22752
22961
|
"enum": ["address", "domain"]
|
|
@@ -22760,7 +22969,10 @@ const operationManifest = [
|
|
|
22760
22969
|
],
|
|
22761
22970
|
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
22762
22971
|
},
|
|
22763
|
-
"message": {
|
|
22972
|
+
"message": {
|
|
22973
|
+
"type": "string",
|
|
22974
|
+
"maxLength": 1e3
|
|
22975
|
+
}
|
|
22764
22976
|
},
|
|
22765
22977
|
"required": [
|
|
22766
22978
|
"name",
|
|
@@ -23362,7 +23574,7 @@ const operationManifest = [
|
|
|
23362
23574
|
"binaryResponse": false,
|
|
23363
23575
|
"bodyRequired": true,
|
|
23364
23576
|
"command": "update-email-rule",
|
|
23365
|
-
"description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys or
|
|
23577
|
+
"description": "Renames the rule, saves a new version (english and tree together; earlier versions stay) or restores one (restore_version), changes its state (draft is off; observe; active), its scope (evaluation_scope, with scope_selection when selected) or its saved expectations (judged in expectations_check). Anyone but its author who sees it may only set state draft, and while it is shared only if they manage members from the dashboard. A scope change saves a new version; a shared rule keeps its scope, and a kind never changes. A saved version takes effect at once, on the rule's share too, which goes on under it. if_version refuses a write once a version was saved since you read it; if_revision, once anything changed. Without if_expectations_pass a version is saved even when its expectations fail, except on an active rule keys, webhooks or a share read: that write is checked first unless if_expectations_pass is false. Needs mail:read, the email rules feature, and a member's own full-access credential (no API key, agent key or narrowed token).",
|
|
23366
23578
|
"hasJsonBody": true,
|
|
23367
23579
|
"method": "PATCH",
|
|
23368
23580
|
"operationId": "updateEmailRule",
|
|
@@ -23540,6 +23752,43 @@ const operationManifest = [
|
|
|
23540
23752
|
},
|
|
23541
23753
|
"required": ["evaluation_scope", "scope_selection"]
|
|
23542
23754
|
},
|
|
23755
|
+
"scope_warnings": {
|
|
23756
|
+
"description": "Ignored (the compile answer's scope_warnings).",
|
|
23757
|
+
"maxItems": 150,
|
|
23758
|
+
"type": "array",
|
|
23759
|
+
"items": {
|
|
23760
|
+
"type": "object",
|
|
23761
|
+
"properties": {
|
|
23762
|
+
"name": {
|
|
23763
|
+
"type": "string",
|
|
23764
|
+
"maxLength": 320
|
|
23765
|
+
},
|
|
23766
|
+
"kind": {
|
|
23767
|
+
"type": "string",
|
|
23768
|
+
"enum": ["address", "domain"]
|
|
23769
|
+
},
|
|
23770
|
+
"reason": {
|
|
23771
|
+
"type": "string",
|
|
23772
|
+
"enum": [
|
|
23773
|
+
"unknown_domain",
|
|
23774
|
+
"inactive_domain",
|
|
23775
|
+
"unknown_address"
|
|
23776
|
+
],
|
|
23777
|
+
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
23778
|
+
},
|
|
23779
|
+
"message": {
|
|
23780
|
+
"type": "string",
|
|
23781
|
+
"maxLength": 1e3
|
|
23782
|
+
}
|
|
23783
|
+
},
|
|
23784
|
+
"required": [
|
|
23785
|
+
"name",
|
|
23786
|
+
"kind",
|
|
23787
|
+
"reason",
|
|
23788
|
+
"message"
|
|
23789
|
+
]
|
|
23790
|
+
}
|
|
23791
|
+
},
|
|
23543
23792
|
"kind": {
|
|
23544
23793
|
"description": "Must be the rule's own (400 kind_mismatch).",
|
|
23545
23794
|
"type": "string",
|
|
@@ -23847,7 +24096,7 @@ const operationManifest = [
|
|
|
23847
24096
|
"maximum": 2147483647
|
|
23848
24097
|
},
|
|
23849
24098
|
"if_expectations_pass": {
|
|
23850
|
-
"description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys or
|
|
24099
|
+
"description": "true: judge the rule as this write leaves it (new tree, restored version, new scope, or the version it activates) against the expectations it leaves, as POST /email-rules/test would, before saving; it can take as long as a test. Failed: 409 expectations_failed; on emails the rule cannot read: 409 expectations_unreadable; undecided: 409 expectations_undecided (each with details.expectations_check); none to judge: 400 no_expectations. Refused writes save nothing; a pass saves unless the rule moved meanwhile (409 email_rule_conflict). Only writes that save a version or activate the rule are judged. Omitted: judged as with true when the write saves a version or changes the scope of an active rule that API keys, webhooks or a share read and that has expectations. false: never judged first.",
|
|
23851
24100
|
"type": "boolean"
|
|
23852
24101
|
},
|
|
23853
24102
|
"restore_version": {
|
|
@@ -24056,11 +24305,15 @@ const operationManifest = [
|
|
|
24056
24305
|
},
|
|
24057
24306
|
"scope_warnings": {
|
|
24058
24307
|
"description": "Names in scope_selection that match nothing this organization receives mail at (a typo, or an inbox not yet in use). Present only when there are some.",
|
|
24308
|
+
"maxItems": 150,
|
|
24059
24309
|
"type": "array",
|
|
24060
24310
|
"items": {
|
|
24061
24311
|
"type": "object",
|
|
24062
24312
|
"properties": {
|
|
24063
|
-
"name": {
|
|
24313
|
+
"name": {
|
|
24314
|
+
"type": "string",
|
|
24315
|
+
"maxLength": 320
|
|
24316
|
+
},
|
|
24064
24317
|
"kind": {
|
|
24065
24318
|
"type": "string",
|
|
24066
24319
|
"enum": ["address", "domain"]
|
|
@@ -24074,7 +24327,10 @@ const operationManifest = [
|
|
|
24074
24327
|
],
|
|
24075
24328
|
"description": "unknown_domain: none of the organization's domains. inactive_domain: one of its domains, not active now, so no new mail arrives. unknown_address: no inbox known as someone's, and no mail has reached it yet."
|
|
24076
24329
|
},
|
|
24077
|
-
"message": {
|
|
24330
|
+
"message": {
|
|
24331
|
+
"type": "string",
|
|
24332
|
+
"maxLength": 1e3
|
|
24333
|
+
}
|
|
24078
24334
|
},
|
|
24079
24335
|
"required": [
|
|
24080
24336
|
"name",
|
|
@@ -24264,13 +24520,43 @@ const operationManifest = [
|
|
|
24264
24520
|
}
|
|
24265
24521
|
},
|
|
24266
24522
|
"undecided_samples": {
|
|
24267
|
-
"description": "Made-up emails not decided, by index. Only a write
|
|
24523
|
+
"description": "Made-up emails not decided, by index. Only a write that saves a version or activates the rule, sent with if_expectations_pass or judged by default, judges them.",
|
|
24268
24524
|
"type": "array",
|
|
24269
24525
|
"items": {
|
|
24270
24526
|
"type": "integer",
|
|
24271
24527
|
"minimum": 0
|
|
24272
24528
|
}
|
|
24273
24529
|
},
|
|
24530
|
+
"failed_sample_details": {
|
|
24531
|
+
"description": "failed_samples with each one's label, from a write that judged them before saving (if_expectations_pass, or by default).",
|
|
24532
|
+
"type": "array",
|
|
24533
|
+
"items": {
|
|
24534
|
+
"type": "object",
|
|
24535
|
+
"properties": {
|
|
24536
|
+
"index": {
|
|
24537
|
+
"type": "integer",
|
|
24538
|
+
"minimum": 0
|
|
24539
|
+
},
|
|
24540
|
+
"label": { "type": ["string", "null"] }
|
|
24541
|
+
},
|
|
24542
|
+
"required": ["index", "label"]
|
|
24543
|
+
}
|
|
24544
|
+
},
|
|
24545
|
+
"undecided_sample_details": {
|
|
24546
|
+
"description": "undecided_samples with each one's label, as failed_sample_details.",
|
|
24547
|
+
"type": "array",
|
|
24548
|
+
"items": {
|
|
24549
|
+
"type": "object",
|
|
24550
|
+
"properties": {
|
|
24551
|
+
"index": {
|
|
24552
|
+
"type": "integer",
|
|
24553
|
+
"minimum": 0
|
|
24554
|
+
},
|
|
24555
|
+
"label": { "type": ["string", "null"] }
|
|
24556
|
+
},
|
|
24557
|
+
"required": ["index", "label"]
|
|
24558
|
+
}
|
|
24559
|
+
},
|
|
24274
24560
|
"note": {
|
|
24275
24561
|
"description": "On an update that saved a version that did not pass, or a do_not_share rule created active: that it was saved anyway, is current, and whether it is live.",
|
|
24276
24562
|
"type": "string"
|
|
@@ -24296,7 +24582,7 @@ const operationManifest = [
|
|
|
24296
24582
|
"required": ["version", "note"]
|
|
24297
24583
|
},
|
|
24298
24584
|
"affects": {
|
|
24299
|
-
"description": "After an update that saved a version: API keys listing the rule
|
|
24585
|
+
"description": "After an update that saved a version, or turned a grant rule active: API keys listing the rule and the webhooks they own, which read and receive what a grant rule grants from now on. shares_ended is always 0: a new version keeps the rule's share (share_notice says so). Saving a version does not by itself change the rule's state. Absent after any other write, and if not read.",
|
|
24300
24586
|
"type": "object",
|
|
24301
24587
|
"properties": {
|
|
24302
24588
|
"keys": {
|
|
@@ -24319,11 +24605,11 @@ const operationManifest = [
|
|
|
24319
24605
|
]
|
|
24320
24606
|
},
|
|
24321
24607
|
"notice": {
|
|
24322
|
-
"description": "After a write that saved a version of an active rule keys or
|
|
24608
|
+
"description": "After a write that saved a version of an active rule keys, webhooks or a share read without checking it first: what it changes, and how to have the next one checked.",
|
|
24323
24609
|
"type": "string"
|
|
24324
24610
|
},
|
|
24325
24611
|
"share_notice": {
|
|
24326
|
-
"description": "After a write that
|
|
24612
|
+
"description": "After a write that saved a version of a rule with a live share: that the share goes on under it, given even when affects is not, with whom it is and the version they accepted when those can be read.",
|
|
24327
24613
|
"type": "string"
|
|
24328
24614
|
}
|
|
24329
24615
|
},
|
|
@@ -24434,7 +24720,7 @@ const operationManifest = [
|
|
|
24434
24720
|
"type": ["string", "null"]
|
|
24435
24721
|
},
|
|
24436
24722
|
"server_notes": {
|
|
24437
|
-
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
24723
|
+
"description": "Primitive's own notes on the rule as asked, worked out from its tree and description each time the request is read, and to the member asked while pending, how to test it on look-alikes and that counts the asker quotes came from their own mail. Unlike warnings, never written by the member who asked, though a note can quote their words or tree values.",
|
|
24438
24724
|
"type": "array",
|
|
24439
24725
|
"items": { "type": "string" }
|
|
24440
24726
|
},
|
|
@@ -24533,7 +24819,7 @@ const operationManifest = [
|
|
|
24533
24819
|
"type": ["boolean", "null"]
|
|
24534
24820
|
},
|
|
24535
24821
|
"notice": {
|
|
24536
|
-
"description": "For the member asked, while pending: what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
24822
|
+
"description": "For the member asked, while pending: who asked (as proposer names them), what the rule actually does (server_explanation), Primitive's warnings, what accepting would share, then where to see what becomes of one email (rule-results and rule_deliveries). For the member who asked, once accepted with changes: that the request is not what is shared. Else null.",
|
|
24537
24823
|
"type": ["string", "null"]
|
|
24538
24824
|
}
|
|
24539
24825
|
},
|
|
@@ -25253,25 +25539,25 @@ const operationManifest = [
|
|
|
25253
25539
|
},
|
|
25254
25540
|
"webhook_attempt_count": {
|
|
25255
25541
|
"type": "integer",
|
|
25256
|
-
"description": "
|
|
25542
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
|
|
25257
25543
|
},
|
|
25258
25544
|
"webhook_last_attempt_at": {
|
|
25259
25545
|
"type": ["string", "null"],
|
|
25260
25546
|
"format": "date-time",
|
|
25261
|
-
"description": "
|
|
25547
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last attempt."
|
|
25262
25548
|
},
|
|
25263
25549
|
"webhook_last_status_code": {
|
|
25264
25550
|
"type": ["integer", "null"],
|
|
25265
|
-
"description": "
|
|
25551
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. What it last answered."
|
|
25266
25552
|
},
|
|
25267
25553
|
"webhook_last_error": {
|
|
25268
25554
|
"type": ["string", "null"],
|
|
25269
|
-
"description": "
|
|
25555
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its last error."
|
|
25270
25556
|
},
|
|
25271
25557
|
"webhook_fired_at": {
|
|
25272
25558
|
"type": ["string", "null"],
|
|
25273
25559
|
"format": "date-time",
|
|
25274
|
-
"description": "
|
|
25560
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. When it was delivered."
|
|
25275
25561
|
},
|
|
25276
25562
|
"smtp_helo": { "type": ["string", "null"] },
|
|
25277
25563
|
"smtp_mail_from": {
|
|
@@ -25798,7 +26084,7 @@ const operationManifest = [
|
|
|
25798
26084
|
},
|
|
25799
26085
|
"shared_through": {
|
|
25800
26086
|
"type": ["object", "null"],
|
|
25801
|
-
"description": "
|
|
26087
|
+
"description": "Only for a reader who has this email through a colleague's share of their mail, when that share is their only way to it: the share and who gave it. Null for everyone else, including on your own mail when a rule or share of yours gave it to someone: rule_deliveries counts the webhooks rules delivered it to, and GET /v1/email-rule-shares/{id}/emails lists what a share you gave has given.",
|
|
25802
26088
|
"required": [
|
|
25803
26089
|
"share_id",
|
|
25804
26090
|
"rule_name",
|
|
@@ -25827,7 +26113,7 @@ const operationManifest = [
|
|
|
25827
26113
|
},
|
|
25828
26114
|
"rule_deliveries": {
|
|
25829
26115
|
"type": ["object", "null"],
|
|
25830
|
-
"description": "Where Email Rules delivered this email by webhook, for the owner of the mailbox it is at, on their own dashboard session or the Primitive CLI. Null for everyone else, and when it could not be read in time. A key reading it through a rule is not a delivery.",
|
|
26116
|
+
"description": "Where Email Rules delivered this email by webhook, for the owner of the mailbox it is at, on their own dashboard session or the Primitive CLI. Null for everyone else, including on another member's mail even for an organization owner or admin (GET /v1/webhooks/deliveries?email_id=<email-id> lists its deliveries, a rule's included), and when it could not be read in time. A key reading it through a rule is not a delivery.",
|
|
25831
26117
|
"required": [
|
|
25832
26118
|
"rules",
|
|
25833
26119
|
"hidden",
|
|
@@ -26797,7 +27083,7 @@ const operationManifest = [
|
|
|
26797
27083
|
},
|
|
26798
27084
|
"webhook_attempt_count": {
|
|
26799
27085
|
"type": "integer",
|
|
26800
|
-
"description": "
|
|
27086
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
|
|
26801
27087
|
},
|
|
26802
27088
|
"thread_id": {
|
|
26803
27089
|
"type": ["string", "null"],
|
|
@@ -27535,7 +27821,7 @@ const operationManifest = [
|
|
|
27535
27821
|
},
|
|
27536
27822
|
"webhook_attempt_count": {
|
|
27537
27823
|
"type": "integer",
|
|
27538
|
-
"description": "
|
|
27824
|
+
"description": "Only this email's routed delivery (the webhook or Function routing sent it to), never a rule's. On mail routing sent nowhere it stays pending, 0 or null unless the email is sent later (POST /emails/{id}/replay), and says nothing about rule deliveries: those are in `rule_deliveries` on GET /emails/{id}, for the mailbox's owner. Its attempts."
|
|
27539
27825
|
},
|
|
27540
27826
|
"thread_id": {
|
|
27541
27827
|
"type": ["string", "null"],
|
|
@@ -54134,8 +54420,8 @@ function shownKey(key) {
|
|
|
54134
54420
|
function unknownFieldsNote(source, sent, all) {
|
|
54135
54421
|
const carriers = /* @__PURE__ */ new Map();
|
|
54136
54422
|
for (const sample of sent) {
|
|
54137
|
-
const
|
|
54138
|
-
for (const field of UNKNOWN_FIELDS.get(sample) ?? []) carriers.set(field, [...carriers.get(field) ?? [],
|
|
54423
|
+
const index = all.indexOf(sample);
|
|
54424
|
+
for (const field of UNKNOWN_FIELDS.get(sample) ?? []) carriers.set(field, [...carriers.get(field) ?? [], `${index + 1} (index ${index})`]);
|
|
54139
54425
|
}
|
|
54140
54426
|
if (carriers.size === 0) return null;
|
|
54141
54427
|
return `${source} has fields this CLI does not know, which it does not refuse but leaves for the API to judge (if the API refuses one, take it out): ${[...carriers].map(([field, numbers]) => `${field} (sample${numbers.length === 1 ? "" : "s"} ${numbers.join(", ")})`).join(", ")}.`;
|
|
@@ -54191,14 +54477,14 @@ function samplesFromJson(value, source) {
|
|
|
54191
54477
|
const samples = lookAlikeSamples(data);
|
|
54192
54478
|
if (samples.length === 0) throw usageError$2(`${source} is a generate-look-alikes answer with no look-alikes in it.`);
|
|
54193
54479
|
samples.forEach((sample, index) => {
|
|
54194
|
-
const unknown = checkSampleEmail(sample.email, `${source}, look-alike ${index + 1}`);
|
|
54480
|
+
const unknown = checkSampleEmail(sample.email, `${source}, look-alike ${index + 1} (index ${index})`);
|
|
54195
54481
|
if (unknown.length > 0) UNKNOWN_FIELDS.set(sample, unknown);
|
|
54196
54482
|
});
|
|
54197
54483
|
return samples;
|
|
54198
54484
|
}
|
|
54199
54485
|
if (!Array.isArray(data)) throw usageError$2(`${source} must hold a JSON array of samples, such as [{"expected": "no_match", "label": "a personal bill", "email": {...}}], or a generate-look-alikes answer.`);
|
|
54200
54486
|
return data.map((item, index) => {
|
|
54201
|
-
const at = `${source}, sample ${index + 1}`;
|
|
54487
|
+
const at = `${source}, sample ${index + 1} (index ${index})`;
|
|
54202
54488
|
if (!isRecord$1(item)) throw usageError$2(`${at} is not an object.`);
|
|
54203
54489
|
const unknown = Object.keys(item).filter((key) => !SAMPLE_KEYS.has(key));
|
|
54204
54490
|
if (item.expected !== "match" && item.expected !== "no_match") throw usageError$2(`${at}: expected must be "match" or "no_match".`);
|
|
@@ -54611,6 +54897,46 @@ function expectBodyFields(flags) {
|
|
|
54611
54897
|
value: expect
|
|
54612
54898
|
}];
|
|
54613
54899
|
}
|
|
54900
|
+
/** test-email-rule's flag that tests the emails an earlier answer tested. */
|
|
54901
|
+
const SAME_EMAILS_FLAG = "same-emails-as";
|
|
54902
|
+
const EMAIL_IDS_MAX = 200;
|
|
54903
|
+
/**
|
|
54904
|
+
* `email_ids` for test-email-rule, from --same-emails-as: every email an
|
|
54905
|
+
* earlier test's answer, saved as it printed it, tested (its results'
|
|
54906
|
+
* email_id), so a second tree is tested over the same mail rather than over
|
|
54907
|
+
* whatever is newest by then.
|
|
54908
|
+
*/
|
|
54909
|
+
function sameEmailsBodyFields(flags) {
|
|
54910
|
+
const file = flags[SAME_EMAILS_FLAG];
|
|
54911
|
+
if (typeof file !== "string") return [];
|
|
54912
|
+
const saved = readJsonFileFlag(file, `--${SAME_EMAILS_FLAG}`);
|
|
54913
|
+
const answer = isRecord(saved) && isRecord(saved.data) ? saved.data : saved;
|
|
54914
|
+
const results = isRecord(answer) && Array.isArray(answer.results) ? answer.results : null;
|
|
54915
|
+
if (!results) throw usageError(`--${SAME_EMAILS_FLAG} ${file} is not a saved test-email-rule answer: it has no results. Save one with test-email-rule --json > answer.json.`);
|
|
54916
|
+
const ids = [...new Set(results.flatMap((result) => isRecord(result) && typeof result.email_id === "string" && isEmailId(result.email_id) ? [result.email_id.toLowerCase()] : []))];
|
|
54917
|
+
if (ids.length === 0) throw usageError(`--${SAME_EMAILS_FLAG} ${file} names no emails.`);
|
|
54918
|
+
if (ids.length > EMAIL_IDS_MAX) throw usageError(`--${SAME_EMAILS_FLAG} ${file} names ${ids.length} emails; a test takes at most ${EMAIL_IDS_MAX}.`);
|
|
54919
|
+
return [{
|
|
54920
|
+
flag: `--${SAME_EMAILS_FLAG}`,
|
|
54921
|
+
property: "email_ids",
|
|
54922
|
+
value: ids
|
|
54923
|
+
}];
|
|
54924
|
+
}
|
|
54925
|
+
/**
|
|
54926
|
+
* The emails --same-emails-as names with the expected ones this test sends
|
|
54927
|
+
* (from the expect flags, or the body's own expect) are at most
|
|
54928
|
+
* EMAIL_IDS_MAX, as the API takes them: refused here, naming the flag,
|
|
54929
|
+
* rather than by the API as email_ids the caller never typed. A saved rule's
|
|
54930
|
+
* own expectations are not known here; the API counts those.
|
|
54931
|
+
*/
|
|
54932
|
+
function checkSameEmailsWithExpected(same, expect, base) {
|
|
54933
|
+
const ids = same[0]?.value;
|
|
54934
|
+
if (!Array.isArray(ids)) return;
|
|
54935
|
+
const sent = expect[0]?.value ?? (isRecord(base) ? base.expect : void 0);
|
|
54936
|
+
const expected = isRecord(sent) ? [sent.match, sent.no_match].flatMap((list) => Array.isArray(list) ? list.filter((id) => typeof id === "string") : []) : [];
|
|
54937
|
+
const all = /* @__PURE__ */ new Set([...ids, ...expected.map((id) => id.toLowerCase())]);
|
|
54938
|
+
if (all.size > EMAIL_IDS_MAX) throw usageError(`--${SAME_EMAILS_FLAG} names ${ids.length} emails and the expectations sent name others: ${all.size} in all, and a test takes at most ${EMAIL_IDS_MAX}.`);
|
|
54939
|
+
}
|
|
54614
54940
|
/**
|
|
54615
54941
|
* `expectations` for create-email-rule and update-email-rule, from
|
|
54616
54942
|
* --expectations-file. A file holding `null` removes the saved expectations,
|
|
@@ -54759,7 +55085,8 @@ function sampleNamer(request) {
|
|
|
54759
55085
|
const fromFile = sent && typeof request?.flags?.["expect-samples-file"] === "string";
|
|
54760
55086
|
return ({ index, label }) => {
|
|
54761
55087
|
const n = fromFile ? sentSampleNumber(index, request?.flags) : index + 1;
|
|
54762
|
-
|
|
55088
|
+
if (!sent) return `saved sample ${n} (index ${index}${label ? `, "${label}"` : ""})`;
|
|
55089
|
+
const name = `sample ${n}`;
|
|
54763
55090
|
return label ? `${name} ("${label}")` : name;
|
|
54764
55091
|
};
|
|
54765
55092
|
}
|
|
@@ -54846,7 +55173,52 @@ function notMatchedLine(result) {
|
|
|
54846
55173
|
const source = result.question_answers_source ? ` (${result.question_answers_source})` : "";
|
|
54847
55174
|
lines.push(` questions${source}: ${answers.map(answerText).join("; ")}`);
|
|
54848
55175
|
}
|
|
54849
|
-
return lines;
|
|
55176
|
+
return [...lines, ...attachmentsLine(result)];
|
|
55177
|
+
}
|
|
55178
|
+
/** Marks that reorder text on screen, so "inv\u202egpj.exe" could show as "invexe.jpg". */
|
|
55179
|
+
const BIDI_CONTROLS = /[\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
55180
|
+
/** The longest a sender's subject or file name is shown in a report line. */
|
|
55181
|
+
const SHOWN_TEXT_MAX = 100;
|
|
55182
|
+
/**
|
|
55183
|
+
* Text a sender wrote (a subject, an address, a file name), as a report
|
|
55184
|
+
* line shows it: no terminal control sequences or reordering marks, on one
|
|
55185
|
+
* line, cut at SHOWN_TEXT_MAX.
|
|
55186
|
+
*/
|
|
55187
|
+
function shownText(value) {
|
|
55188
|
+
if (typeof value !== "string") return "";
|
|
55189
|
+
const line = sanitizeForTerminal(value).replace(BIDI_CONTROLS, "").replaceAll(/\s+/g, " ").trim();
|
|
55190
|
+
return line.length > SHOWN_TEXT_MAX ? `${line.slice(0, 97)}...` : line;
|
|
55191
|
+
}
|
|
55192
|
+
/**
|
|
55193
|
+
* The file names a matched or near-miss result lists (attachment_names), on
|
|
55194
|
+
* one line under it: the names its questions are given, shown as shownText
|
|
55195
|
+
* shows a sender's text.
|
|
55196
|
+
*/
|
|
55197
|
+
function attachmentsLine(result) {
|
|
55198
|
+
const names = result.attachment_names;
|
|
55199
|
+
if (!Array.isArray(names)) return [];
|
|
55200
|
+
const shown = names.map(shownText).filter(Boolean);
|
|
55201
|
+
return shown.length > 0 ? [` attachments: ${shown.join(", ")}`] : [];
|
|
55202
|
+
}
|
|
55203
|
+
/**
|
|
55204
|
+
* The matched emails, each with who sent it, its subject and its attachments'
|
|
55205
|
+
* file names, so a match can be judged without opening it; cut as the not
|
|
55206
|
+
* matched list is.
|
|
55207
|
+
*/
|
|
55208
|
+
function matchedLines(results, expectations) {
|
|
55209
|
+
const flagged = new Set((expectations?.results ?? []).filter((result) => result.status !== "passed").map((result) => result.email_id));
|
|
55210
|
+
const matched = results.filter((result) => result.outcome === "matched").map((result, position) => ({
|
|
55211
|
+
result,
|
|
55212
|
+
position
|
|
55213
|
+
})).sort((a, b) => Number(flagged.has(b.result.email_id)) - Number(flagged.has(a.result.email_id)) || a.position - b.position).map(({ result }) => result);
|
|
55214
|
+
if (matched.length === 0) return [];
|
|
55215
|
+
const shown = matched.slice(0, 25);
|
|
55216
|
+
return [shown.length < matched.length ? `Matched (${shown.length} of ${matched.length} shown; the JSON has every result):` : `Matched (${matched.length}):`, ...shown.flatMap((result) => {
|
|
55217
|
+
const from = shownText(result.from_address);
|
|
55218
|
+
const subject = shownText(result.subject);
|
|
55219
|
+
const about = [from, subject ? `"${subject}"` : ""].filter(Boolean);
|
|
55220
|
+
return [` ${result.email_id}${about.length > 0 ? ` ${about.join(" ")}` : ""}`, ...attachmentsLine(result)];
|
|
55221
|
+
})];
|
|
54850
55222
|
}
|
|
54851
55223
|
function notMatchedLines(results, expectations) {
|
|
54852
55224
|
const flagged = new Set((expectations?.results ?? []).filter((result) => result.status !== "passed").map((result) => result.email_id));
|
|
@@ -54915,6 +55287,24 @@ function expectationsOutcome(expectations, testResults = [], name = sampleNamer(
|
|
|
54915
55287
|
};
|
|
54916
55288
|
return {};
|
|
54917
55289
|
}
|
|
55290
|
+
/** A time an answer gives, to the minute, in UTC. */
|
|
55291
|
+
function minuteUtc(value) {
|
|
55292
|
+
const at = new Date(value);
|
|
55293
|
+
return Number.isNaN(at.getTime()) ? value : `${at.toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
55294
|
+
}
|
|
55295
|
+
/**
|
|
55296
|
+
* The first line of a test report: which mail was tested. A test of recent
|
|
55297
|
+
* mail covers the newest emails, so a later one covers what has arrived since,
|
|
55298
|
+
* and two counts compare only over the same emails.
|
|
55299
|
+
*/
|
|
55300
|
+
function windowLine(data, tested) {
|
|
55301
|
+
const window = isRecord(data.window) ? data.window : void 0;
|
|
55302
|
+
const oldest = typeof window?.oldest_at === "string" ? window.oldest_at : void 0;
|
|
55303
|
+
const newest = typeof window?.newest_at === "string" ? window.newest_at : void 0;
|
|
55304
|
+
if (!window || !oldest || !newest) return [];
|
|
55305
|
+
const span = `Tested ${plural$1(tested, "email", "emails")} received ${minuteUtc(oldest)} to ${minuteUtc(newest)}.`;
|
|
55306
|
+
return window.mode === "recent" ? [`${span} A later test of recent mail covers what has arrived since: to compare two trees, test the second with --${SAME_EMAILS_FLAG} <this answer, saved with --json>.`] : [span];
|
|
55307
|
+
}
|
|
54918
55308
|
/** The stderr report and exit code of a test-email-rule answer. */
|
|
54919
55309
|
function testEmailRuleReport(data, request) {
|
|
54920
55310
|
if (!isRecord(data)) return { lines: [] };
|
|
@@ -54922,13 +55312,16 @@ function testEmailRuleReport(data, request) {
|
|
|
54922
55312
|
const result = data;
|
|
54923
55313
|
const results = Array.isArray(result.results) ? result.results : [];
|
|
54924
55314
|
const summary = isRecord(result.summary) ? result.summary : void 0;
|
|
55315
|
+
const counts = isRecord(data.counts) ? data.counts : void 0;
|
|
54925
55316
|
return {
|
|
54926
55317
|
lines: [
|
|
55318
|
+
...windowLine(data, (typeof counts?.emails === "number" ? counts.emails : results.length) - (typeof counts?.not_found === "number" ? counts.not_found : 0)),
|
|
54927
55319
|
...(Array.isArray(summary?.warnings) ? summary.warnings : []).map((warning) => `Warning: ${warning}`),
|
|
54928
55320
|
...scopeWarningLines(result.scope_warnings),
|
|
54929
55321
|
...conditionLines(summary),
|
|
54930
55322
|
...questionLines(summary, results),
|
|
54931
55323
|
...expectationsLines(result.expectations, results, name),
|
|
55324
|
+
...matchedLines(results, result.expectations),
|
|
54932
55325
|
...notMatchedLines(results, result.expectations)
|
|
54933
55326
|
],
|
|
54934
55327
|
...expectationsOutcome(result.expectations, results, name)
|
|
@@ -54939,28 +55332,50 @@ function indexList(value) {
|
|
|
54939
55332
|
return Array.isArray(value) ? value.filter((n) => typeof n === "number") : [];
|
|
54940
55333
|
}
|
|
54941
55334
|
/**
|
|
55335
|
+
* The labels a write's check gives the made-up emails it names, by index
|
|
55336
|
+
* (failed_sample_details and undecided_sample_details), from a server that
|
|
55337
|
+
* sends them.
|
|
55338
|
+
*/
|
|
55339
|
+
function sampleDetailLabels(check) {
|
|
55340
|
+
const labels = /* @__PURE__ */ new Map();
|
|
55341
|
+
if (!isRecord(check)) return labels;
|
|
55342
|
+
for (const key of ["failed_sample_details", "undecided_sample_details"]) {
|
|
55343
|
+
const details = check[key];
|
|
55344
|
+
if (!Array.isArray(details)) continue;
|
|
55345
|
+
for (const detail of details) if (isRecord(detail) && typeof detail.index === "number" && Number.isInteger(detail.index) && detail.index >= 0) labels.set(detail.index, typeof detail.label === "string" ? detail.label : null);
|
|
55346
|
+
}
|
|
55347
|
+
return labels;
|
|
55348
|
+
}
|
|
55349
|
+
/**
|
|
54942
55350
|
* How a rule write names a made-up email its check gives by index, from 0 in
|
|
54943
55351
|
* the set judged: those this write sends in place of the rule's
|
|
54944
55352
|
* (expectation_samples), or the rule's saved ones oldest first and then
|
|
54945
55353
|
* those it adds (add_expectation_samples). One this write sent is "sample
|
|
54946
55354
|
* N", its number in the samples file --pick took it from (or its place in
|
|
54947
|
-
* what was sent); any other is "saved sample N", its place among
|
|
54948
|
-
*
|
|
54949
|
-
*
|
|
55355
|
+
* what was sent); any other is "saved sample N (index i)", its place among
|
|
55356
|
+
* the rule's and the index the API names it by. With its label when known,
|
|
55357
|
+
* from the samples or from `labels` (sampleDetailLabels). `saved` is the
|
|
55358
|
+
* answer's expectation_samples, every one the rule keeps after the write,
|
|
55359
|
+
* when it has them.
|
|
54950
55360
|
*/
|
|
54951
|
-
function writtenSampleNamer(body, flags, saved) {
|
|
55361
|
+
function writtenSampleNamer(body, flags, saved, labels = /* @__PURE__ */ new Map()) {
|
|
54952
55362
|
const sent = isRecord(body) && Array.isArray(body.expectation_samples) ? body.expectation_samples : null;
|
|
54953
55363
|
const added = isRecord(body) && Array.isArray(body.add_expectation_samples) ? body.add_expectation_samples : null;
|
|
54954
55364
|
const kept = Array.isArray(saved) ? saved : null;
|
|
54955
55365
|
const labelled = (name, sample) => isRecord(sample) && typeof sample.label === "string" && sample.label ? `${name} ("${sample.label}")` : name;
|
|
55366
|
+
const indexed = (name, index) => {
|
|
55367
|
+
const sample = kept?.[index];
|
|
55368
|
+
const label = isRecord(sample) && typeof sample.label === "string" && sample.label ? sample.label : labels.get(index);
|
|
55369
|
+
return `${name} (index ${index}${label ? `, "${label}"` : ""})`;
|
|
55370
|
+
};
|
|
54956
55371
|
return (index) => {
|
|
54957
55372
|
if (sent) return labelled(`sample ${sentSampleNumber(index, flags)}`, sent[index]);
|
|
54958
55373
|
if (added) {
|
|
54959
55374
|
const start = kept ? kept.length - added.length : null;
|
|
54960
|
-
if (start === null) return `made-up email ${index + 1}
|
|
55375
|
+
if (start === null) return indexed(`made-up email ${index + 1}`, index);
|
|
54961
55376
|
if (index >= start) return labelled(`sample ${sentSampleNumber(index - start, flags)}`, added[index - start]);
|
|
54962
55377
|
}
|
|
54963
|
-
return
|
|
55378
|
+
return indexed(`saved sample ${index + 1}`, index);
|
|
54964
55379
|
};
|
|
54965
55380
|
}
|
|
54966
55381
|
function expectationsCheckLine(check, ruleId, name = (index) => `saved sample ${index + 1}`) {
|
|
@@ -55051,18 +55466,24 @@ function restoredLine(restored, currentVersion) {
|
|
|
55051
55466
|
return `Saved version ${restored.version} again ${as}.${note}`;
|
|
55052
55467
|
}
|
|
55053
55468
|
/**
|
|
55054
|
-
* Who an update that saved a version
|
|
55055
|
-
*
|
|
55056
|
-
* write ended.
|
|
55469
|
+
* Who an update that saved a version, or turned a grant rule active, reaches,
|
|
55470
|
+
* as its answer counts them: the keys listing the rule and the webhooks those
|
|
55471
|
+
* keys own, and the shares the write ended when it ended any. A new version
|
|
55472
|
+
* keeps a rule's share, so the API counts none; the answer's `share_notice`
|
|
55473
|
+
* says the share goes on.
|
|
55057
55474
|
*/
|
|
55058
|
-
function affectsLine(affects) {
|
|
55475
|
+
function affectsLine(affects, write = {}) {
|
|
55059
55476
|
if (!isRecord(affects)) return void 0;
|
|
55060
55477
|
const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
55061
55478
|
const keys = count(affects.keys);
|
|
55062
55479
|
const endpoints = count(affects.endpoints);
|
|
55063
|
-
const shares = count(affects.shares_ended);
|
|
55064
|
-
|
|
55065
|
-
|
|
55480
|
+
const shares = count(affects.shares_ended) ?? 0;
|
|
55481
|
+
const reach = `${plural$1(keys ?? 0, "API key", "API keys")} listing the rule and ${plural$1(endpoints ?? 0, "webhook", "webhooks")} those keys own`;
|
|
55482
|
+
if (write.activatedOnly && keys !== void 0 && endpoints !== void 0) return `Now active${write.scopeSent ? ", over the scope this write sent" : ""}: it reaches ${reach}.`;
|
|
55483
|
+
if (keys === void 0 || endpoints === void 0) return void 0;
|
|
55484
|
+
const ended = shares > 0 ? `; it ended ${plural$1(shares, "share", "shares")}` : "";
|
|
55485
|
+
if (write.stateSent !== void 0 && typeof write.state === "string") return `This version reaches ${reach}${ended}. The rule is now ${write.state}.`;
|
|
55486
|
+
return `This version reaches ${reach}${ended}. The rule keeps its state.`;
|
|
55066
55487
|
}
|
|
55067
55488
|
/** The rule's author, by name and email where the answer gives them. */
|
|
55068
55489
|
function authorLine(author) {
|
|
@@ -55089,7 +55510,15 @@ function writtenEmailRuleReport(data, request) {
|
|
|
55089
55510
|
}
|
|
55090
55511
|
const restored = restoredLine(rule.restored_from, rule.current_version);
|
|
55091
55512
|
if (restored) lines.push(restored);
|
|
55092
|
-
const
|
|
55513
|
+
const body = isRecord(request.body) ? request.body : {};
|
|
55514
|
+
const activatedOnly = body.state === "active" && body.tree === void 0 && body.restore_version === void 0;
|
|
55515
|
+
const scopeSent = body.evaluation_scope !== void 0;
|
|
55516
|
+
const reach = rule.kind === "do_not_share" && activatedOnly && !scopeSent ? void 0 : affectsLine(rule.affects, {
|
|
55517
|
+
activatedOnly,
|
|
55518
|
+
scopeSent,
|
|
55519
|
+
stateSent: body.state,
|
|
55520
|
+
state: rule.state
|
|
55521
|
+
});
|
|
55093
55522
|
if (reach) lines.push(reach);
|
|
55094
55523
|
for (const note of [
|
|
55095
55524
|
rule.share_notice,
|
|
@@ -55100,7 +55529,7 @@ function writtenEmailRuleReport(data, request) {
|
|
|
55100
55529
|
if (line) lines.push(line);
|
|
55101
55530
|
}
|
|
55102
55531
|
const sentExpectations = sentExpectationsIn(request.body);
|
|
55103
|
-
const name = writtenSampleNamer(request.body, request.flags, rule.expectation_samples);
|
|
55532
|
+
const name = writtenSampleNamer(request.body, request.flags, rule.expectation_samples, sampleDetailLabels(rule.expectations_check));
|
|
55104
55533
|
const checked = expectationsCheckLine(rule.expectations_check, ruleId, name);
|
|
55105
55534
|
if (checked) lines.push(checked);
|
|
55106
55535
|
else if (sentExpectations) lines.push(`Expectations were not checked on this write. Test them with \`primitive email-rules test-email-rule --rule-id ${ruleId}\`.`);
|
|
@@ -55197,14 +55626,17 @@ function readAgain(id) {
|
|
|
55197
55626
|
/**
|
|
55198
55627
|
* Who reads an active rule, from a refusal's details.read_by: the server
|
|
55199
55628
|
* sends it when it checked the write against the rule's expectations because
|
|
55200
|
-
* API keys or
|
|
55629
|
+
* API keys, webhooks or a share read the rule, whether or not the write asked.
|
|
55201
55630
|
* Undefined without it.
|
|
55202
55631
|
*/
|
|
55203
55632
|
function readByText(details) {
|
|
55204
55633
|
const readBy = details.read_by;
|
|
55205
55634
|
if (!isRecord(readBy)) return void 0;
|
|
55206
|
-
const { keys, webhooks } = readBy;
|
|
55207
|
-
|
|
55635
|
+
const { keys, webhooks, shares } = readBy;
|
|
55636
|
+
if (typeof keys !== "number" || typeof webhooks !== "number" || shares === null) return "API keys, webhooks or a share may read what it grants (they could not be counted in time)";
|
|
55637
|
+
const shared = typeof shares === "number" && shares > 0 ? `it is shared with ${plural$1(shares, "member", "members")}` : void 0;
|
|
55638
|
+
if (keys + webhooks === 0 && shared) return shared;
|
|
55639
|
+
return `${plural$1(keys, "API key", "API keys")} and ${plural$1(webhooks, "webhook", "webhooks")} read what it grants${shared ? `, and ${shared}` : ""}`;
|
|
55208
55640
|
}
|
|
55209
55641
|
/** How to save a write the default check refused, without the check. */
|
|
55210
55642
|
function saveUncheckedText(flags) {
|
|
@@ -55217,14 +55649,14 @@ function saveUncheckedText(flags) {
|
|
|
55217
55649
|
* expectations_failed, expectations_undecided, expectations_unreadable and
|
|
55218
55650
|
* no_expectations. The guard runs when the write sends if_expectations_pass,
|
|
55219
55651
|
* and by default (details.read_by) when it changes what an active rule that
|
|
55220
|
-
* API keys or
|
|
55652
|
+
* API keys, webhooks or a share read grants. Nothing was saved in any of them.
|
|
55221
55653
|
*/
|
|
55222
55654
|
function updateEmailRuleErrorHint(code, payload, ruleId, body, flags) {
|
|
55223
55655
|
const id = typeof ruleId === "string" && ruleId ? ruleId : "<rule-id>";
|
|
55224
55656
|
const details = errorDetails(payload);
|
|
55225
55657
|
const guarded = isRecord(body) && body.if_expectations_pass === true;
|
|
55226
55658
|
const readBy = readByText(details);
|
|
55227
|
-
const judged = readBy ? "was judged against its expectations before saving, as a write that changes what an active rule grants is by default while API keys or
|
|
55659
|
+
const judged = readBy ? "was judged against its expectations before saving, as a write that changes what an active rule grants is by default while API keys, webhooks or a share read it, and nothing was saved" : "was judged against its expectations before saving (if_expectations_pass), and nothing was saved";
|
|
55228
55660
|
const unchecked = readBy ? ` The rule is active and ${readBy}; to save the write without the check, ${saveUncheckedText(flags)}.` : "";
|
|
55229
55661
|
if (code === "email_rule_conflict") switch (details.reason) {
|
|
55230
55662
|
case "version_moved": return versionMovedHint(payload, ruleId);
|
|
@@ -55234,14 +55666,14 @@ function updateEmailRuleErrorHint(code, payload, ruleId, body, flags) {
|
|
|
55234
55666
|
}
|
|
55235
55667
|
case "expectations_moved": return `Hint: the rule's saved expectations changed while this write was checked against them, so nothing was saved. ${readAgain(id)}.`;
|
|
55236
55668
|
case "rule_changed": return guarded ? `Hint: the rule changed after this write was judged against its expectations and before it was saved, so saving it would have gone unchecked; nothing was saved. ${readAgain(id)}.` : `Hint: the rule changed while this write was being saved, so nothing was saved. ${readAgain(id)}.`;
|
|
55237
|
-
case "readers_changed": return "Hint: API keys or
|
|
55669
|
+
case "readers_changed": return "Hint: API keys, webhooks or a share started reading this rule while this write was being saved, and saving it would have changed what they receive without checking it against the rule's expectations, so nothing was saved. Send the write again: it is then checked first.";
|
|
55238
55670
|
default: return;
|
|
55239
55671
|
}
|
|
55240
55672
|
if (code === "expectations_failed" || code === "expectations_undecided") {
|
|
55241
55673
|
const check = isRecord(details.expectations_check) ? details.expectations_check : {};
|
|
55242
55674
|
const failed = Array.isArray(check.failed) ? check.failed : [];
|
|
55243
55675
|
const undecided = Array.isArray(check.undecided) ? check.undecided : [];
|
|
55244
|
-
const name = writtenSampleNamer(body, flags);
|
|
55676
|
+
const name = writtenSampleNamer(body, flags, void 0, sampleDetailLabels(check));
|
|
55245
55677
|
const failedAll = [...failed, ...indexList(check.failed_samples).map(name)];
|
|
55246
55678
|
const undecidedSamples = indexList(check.undecided_samples);
|
|
55247
55679
|
const undecidedAll = [...undecided, ...undecidedSamples.map(name)];
|
|
@@ -55345,7 +55777,7 @@ const BREADTH_SCOPE = {
|
|
|
55345
55777
|
/** The stderr report of compile-email-rule: how many recent emails it holds for. */
|
|
55346
55778
|
function compileEmailRuleReport(data, request) {
|
|
55347
55779
|
if (!isRecord(data)) return { lines: [] };
|
|
55348
|
-
const lines = (Array.isArray(data.warnings) ? data.warnings : []).filter((warning) => typeof warning === "string" && warning.trim() !== "").map((warning) => `Warning: ${warning.trim()}`);
|
|
55780
|
+
const lines = [...scopeWarningLines(data.scope_warnings), ...(Array.isArray(data.warnings) ? data.warnings : []).filter((warning) => typeof warning === "string" && warning.trim() !== "").map((warning) => `Warning: ${warning.trim()}`)];
|
|
55349
55781
|
const breadth = data.breadth;
|
|
55350
55782
|
const sent = isRecord(request?.body) && typeof request.body.evaluation_scope === "string" ? request.body.evaluation_scope : void 0;
|
|
55351
55783
|
const counted = isRecord(data.breadth_scope) && typeof data.breadth_scope.evaluation_scope === "string" ? data.breadth_scope.evaluation_scope : sent;
|
|
@@ -55381,11 +55813,11 @@ function listEmailRulesReport(data) {
|
|
|
55381
55813
|
return { lines };
|
|
55382
55814
|
}
|
|
55383
55815
|
/** create-email-rule's --fail-on-expectations: the exit code follows the check made after saving. */
|
|
55384
|
-
const FAIL_ON_EXPECTATIONS_HELP = "Exit 1 when an expectation in the answer's expectations_check failed, and 3 when none failed but one is undecided or the expectations this write sent were not checked (test the rule to decide). A create does not judge made-up emails, so with some it exits 3. Without it the command exits 0 whatever the check says.";
|
|
55816
|
+
const FAIL_ON_EXPECTATIONS_HELP = "Exit 1 when an expectation in the answer's expectations_check failed, and 3 when none failed but one is undecided or the expectations this write sent were not checked (test the rule to decide). A create does not judge made-up emails, so with some it exits 3. It judges emails by id on their stored classification without asking the rule's questions, so on a new rule with questions an email whose conditions hold stays undecided (exit 3) until `test-email-rule --rule-id` asks them. Without it the command exits 0 whatever the check says.";
|
|
55385
55817
|
/** update-email-rule's --fail-on-expectations: the server refuses the write. */
|
|
55386
|
-
const UPDATE_FAIL_ON_EXPECTATIONS_HELP = "Refuse the write unless the rule, as this write would leave it, passes its expectations. It sends if_expectations_pass (over any in --body-file or --raw-body), so the server judges a new version, a restored one, a new scope or turning the rule active before saving, on its emails by id and its made-up emails, and saves nothing when one failed (exit 1), one names an email the rule cannot read (exit 1, since sending again never decides it), one is undecided (exit 3, or 1 when the rule cannot run as its author or a made-up email is undecided for no reason the answer gives) or the rule has none (exit 1). It can take as long as a test of the rule; the command waits for it. Judging needs a credential that reads the mail's content. A write the server does not judge (one changing only expectations, say) is saved, and the exit code then follows the answer's expectations_check, as on create. Without it, the server still judges, and refuses the same way, a write that saves a version or changes the scope of an active rule that API keys or
|
|
55818
|
+
const UPDATE_FAIL_ON_EXPECTATIONS_HELP = "Refuse the write unless the rule, as this write would leave it, passes its expectations. It sends if_expectations_pass (over any in --body-file or --raw-body), so the server judges a new version, a restored one, a new scope or turning the rule active before saving, on its emails by id and its made-up emails, and saves nothing when one failed (exit 1), one names an email the rule cannot read (exit 1, since sending again never decides it), one is undecided (exit 3, or 1 when the rule cannot run as its author or a made-up email is undecided for no reason the answer gives) or the rule has none (exit 1). It can take as long as a test of the rule; the command waits for it. Judging needs a credential that reads the mail's content. A write the server does not judge (one changing only expectations, say) is saved, and the exit code then follows the answer's expectations_check, as on create. Without it, the server still judges, and refuses the same way, a write that saves a version or changes the scope of an active rule that API keys, webhooks or a share read and that has expectations (the refusal's details.read_by counts them), unless --no-if-expectations-pass is sent. With --json, a refused write's document holds the API's error alone; a saved write's holds the rule.";
|
|
55387
55819
|
/** When update-email-rule judges the made-up emails a samples flag sets. */
|
|
55388
|
-
const UPDATE_JUDGES_SAMPLES = `The write judges them before saving with --${FAIL_ON_EXPECTATIONS_FLAG}, when it saves a version or turns the rule active, and without it when it saves a version or changes the scope of an active rule that API keys or
|
|
55820
|
+
const UPDATE_JUDGES_SAMPLES = `The write judges them before saving with --${FAIL_ON_EXPECTATIONS_FLAG}, when it saves a version or turns the rule active, and without it when it saves a version or changes the scope of an active rule that API keys, webhooks or a share read, unless --no-if-expectations-pass is sent.`;
|
|
55389
55821
|
/** What a samples file flag reads. */
|
|
55390
55822
|
const SAMPLES_FILE_SHAPE = "A JSON file of made-up emails the rule must match or not: an array such as [{\"expected\": \"no_match\", \"label\": \"a personal bill\", \"email\": {...}}], with email as test-email-rule-on-sample takes it (text up to 4,000 characters, at most 10 each of to, cc, attachment_types and attachment_names), like the one generate-look-alikes --samples-file writes, or a generate-look-alikes answer saved as it printed it.";
|
|
55391
55823
|
const EXPECTATION_FLAG_NOTE = "Replaces any expect in --body-file or --raw-body. The answer reports them in expectations (passed, counts, results) and the exit code follows it; see --help-full.";
|
|
@@ -55411,6 +55843,25 @@ function endEmailRuleShareReport(data) {
|
|
|
55411
55843
|
const note = isRecord(data) && typeof data.note === "string" ? data.note.trim() : "";
|
|
55412
55844
|
return { lines: note ? [note] : [] };
|
|
55413
55845
|
}
|
|
55846
|
+
/**
|
|
55847
|
+
* accept-email-rule-request without --json: the answer's notice, then the
|
|
55848
|
+
* rule as it was agreed, since the answer's request block holds the rule as
|
|
55849
|
+
* it was asked and reads like what was accepted.
|
|
55850
|
+
*/
|
|
55851
|
+
function acceptEmailRuleRequestReport(data) {
|
|
55852
|
+
if (!isRecord(data)) return { lines: [] };
|
|
55853
|
+
const notice = typeof data.notice === "string" ? data.notice.split(/\n\s*\n/).map((part) => part.trim()).filter(Boolean) : [];
|
|
55854
|
+
const rule = isRecord(data.rule) ? data.rule : void 0;
|
|
55855
|
+
const current = rule && isRecord(rule.current) ? rule.current : void 0;
|
|
55856
|
+
const lines = [...notice];
|
|
55857
|
+
if (rule && typeof rule.name === "string" && typeof rule.id === "string") {
|
|
55858
|
+
const version = typeof current?.version === "number" ? `, version ${current.version}` : "";
|
|
55859
|
+
const state = typeof rule.state === "string" ? `, ${rule.state}` : "";
|
|
55860
|
+
const agreed = typeof current?.english === "string" ? ` What you agreed to: ${current.english}` : "";
|
|
55861
|
+
lines.push(`Accepted as ${rule.name} (${rule.id})${version}${state}.${agreed}`);
|
|
55862
|
+
}
|
|
55863
|
+
return { lines };
|
|
55864
|
+
}
|
|
55414
55865
|
const EMAIL_RULE_OPERATION_EXTENSIONS = {
|
|
55415
55866
|
testEmailRule: {
|
|
55416
55867
|
flags: {
|
|
@@ -55430,9 +55881,19 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
|
|
|
55430
55881
|
}),
|
|
55431
55882
|
[EXPECT_SAMPLES_FILE_FLAG]: Flags.string({ description: `${SAMPLES_FILE_SHAPE} Sets expect.samples (at most 20), beside any emails by id; the answer judges each in expectations.samples (index from 0 over those sent), and the report names each by its number in the file. Like any expect, it replaces a saved rule's own expectations and samples for this test. ${EXPECTATION_FLAG_NOTE}` }),
|
|
55432
55883
|
[PICK_FLAG]: Flags.string({ description: pickFlagHelp([EXPECT_SAMPLES_FILE_FLAG]) }),
|
|
55884
|
+
[SAME_EMAILS_FLAG]: Flags.string({ description: `Test the same emails as an earlier test: a file holding what test-email-rule --json printed. Sets email_ids to its results' email_id, over any in --body-file or --raw-body, so two trees are compared over the same mail; a test of recent mail covers the newest emails, which move on as mail arrives. At most ${EMAIL_IDS_MAX} emails, counting the expected ones a test adds (a saved rule's own, with --rule-id).` }),
|
|
55433
55885
|
...scopeSelectionFlags()
|
|
55434
55886
|
},
|
|
55435
|
-
bodyFields: (flags, base) =>
|
|
55887
|
+
bodyFields: (flags, base) => {
|
|
55888
|
+
const expect = expectBodyFields(flags);
|
|
55889
|
+
const same = sameEmailsBodyFields(flags);
|
|
55890
|
+
checkSameEmailsWithExpected(same, expect, base);
|
|
55891
|
+
return [
|
|
55892
|
+
...expect,
|
|
55893
|
+
...same,
|
|
55894
|
+
...scopeSelectionBodyFields(flags, base)
|
|
55895
|
+
];
|
|
55896
|
+
},
|
|
55436
55897
|
bodyProperties: ["expect", "scope_selection"],
|
|
55437
55898
|
fallbackExitCode: (data) => {
|
|
55438
55899
|
const expectations = data?.expectations;
|
|
@@ -55513,7 +55974,8 @@ const EMAIL_RULE_OPERATION_EXTENSIONS = {
|
|
|
55513
55974
|
[PICK_FLAG]: Flags.string({ description: pickFlagHelp([SAMPLES_FILE_FLAG]) })
|
|
55514
55975
|
},
|
|
55515
55976
|
bodyFields: samplesBodyFields(false),
|
|
55516
|
-
bodyProperties: ["expectation_samples"]
|
|
55977
|
+
bodyProperties: ["expectation_samples"],
|
|
55978
|
+
report: acceptEmailRuleRequestReport
|
|
55517
55979
|
},
|
|
55518
55980
|
compileEmailRule: {
|
|
55519
55981
|
flags: scopeSelectionFlags(),
|
|
@@ -55793,7 +56255,7 @@ function unknownEventTypes(eventTypes) {
|
|
|
55793
56255
|
function unknownEventTypesWarning(unknown) {
|
|
55794
56256
|
return `Warning: ${unknown.join(", ")} ${unknown.length === 1 ? "is" : "are"} not an event type this CLI knows. Subscriptions match exact names, so a misspelled name receives nothing. Continuing; newer event types may not be known to this CLI yet.\n`;
|
|
55795
56257
|
}
|
|
55796
|
-
function isPlainObject
|
|
56258
|
+
function isPlainObject(value) {
|
|
55797
56259
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
55798
56260
|
}
|
|
55799
56261
|
/**
|
|
@@ -55806,16 +56268,16 @@ async function currentEndpointRules(endpointId, listEndpoints) {
|
|
|
55806
56268
|
if (response.error) throw new EventTypesFlagError("Could not read the endpoint's current rules to keep them. Retry, or pass the full rules with --raw-body.");
|
|
55807
56269
|
const row = (response.data?.data ?? []).find((endpoint) => endpoint.id === endpointId);
|
|
55808
56270
|
if (!row) throw new EventTypesFlagError(`No endpoint ${endpointId} is visible to this credential, so its rules cannot be updated.`);
|
|
55809
|
-
return isPlainObject
|
|
56271
|
+
return isPlainObject(row.rules) ? row.rules : {};
|
|
55810
56272
|
}
|
|
55811
56273
|
/**
|
|
55812
56274
|
* Put `eventTypes` in the request body's `rules.event_types`, on top of
|
|
55813
56275
|
* `baseRules` (rules the caller passed in the body win over `baseRules`).
|
|
55814
56276
|
*/
|
|
55815
56277
|
function withEventTypes(body, eventTypes, baseRules = {}) {
|
|
55816
|
-
if (body !== void 0 && !isPlainObject
|
|
56278
|
+
if (body !== void 0 && !isPlainObject(body)) throw new EventTypesFlagError("--raw-body must be a JSON object when also passing --event-types.");
|
|
55817
56279
|
const current = body ?? {};
|
|
55818
|
-
if (current.rules !== void 0 && !isPlainObject
|
|
56280
|
+
if (current.rules !== void 0 && !isPlainObject(current.rules)) throw new EventTypesFlagError("rules in --raw-body must be a JSON object when also passing --event-types.");
|
|
55819
56281
|
const explicitRules = current.rules ?? {};
|
|
55820
56282
|
return {
|
|
55821
56283
|
...current,
|
|
@@ -55828,115 +56290,7 @@ function withEventTypes(body, eventTypes, baseRules = {}) {
|
|
|
55828
56290
|
}
|
|
55829
56291
|
/** True when the caller already passed `rules` in the request body. */
|
|
55830
56292
|
function bodyHasRules(body) {
|
|
55831
|
-
return isPlainObject
|
|
55832
|
-
}
|
|
55833
|
-
// src/oclif/endpoint-url-shown.ts
|
|
55834
|
-
/** The commands whose answers carry endpoints, by operation sdkName. */
|
|
55835
|
-
const ENDPOINT_URL_OPERATIONS = /* @__PURE__ */ new Set([
|
|
55836
|
-
"getEndpoint",
|
|
55837
|
-
"listEndpoints",
|
|
55838
|
-
"createEndpoint",
|
|
55839
|
-
"updateEndpoint"
|
|
55840
|
-
]);
|
|
55841
|
-
/** The commands that send a URL, whose value is checked for the placeholder. */
|
|
55842
|
-
const ENDPOINT_URL_WRITE_OPERATIONS = /* @__PURE__ */ new Set(["createEndpoint", "updateEndpoint"]);
|
|
55843
|
-
/** What a hidden query string is replaced with. */
|
|
55844
|
-
const HIDDEN_QUERY = "?... (query hidden)";
|
|
55845
|
-
const SHOW_URL_FLAG_DESCRIPTION = "Print each webhook URL in full, its query string included. Without it the query string is shown as ?... (query hidden), with url_query_hidden: true on the endpoint, because it can carry a secret such as a deployment protection bypass token.";
|
|
55846
|
-
/**
|
|
55847
|
-
* Said when an answer had a URL shortened: on stderr without --json, and in
|
|
55848
|
-
* the document's summary with --json --envelope.
|
|
55849
|
-
*/
|
|
55850
|
-
const HIDDEN_QUERY_NOTE = "A webhook URL's query string is hidden, as it can carry a secret. Pass --show-url to print it in full.";
|
|
55851
|
-
/**
|
|
55852
|
-
* The URL with its query string, and anything after it, replaced by
|
|
55853
|
-
* HIDDEN_QUERY; null when it has no query string. A `?` after a `#` is part
|
|
55854
|
-
* of the fragment, not a query.
|
|
55855
|
-
*/
|
|
55856
|
-
function urlWithQueryHidden(url) {
|
|
55857
|
-
const query = url.indexOf("?");
|
|
55858
|
-
if (query < 0) return null;
|
|
55859
|
-
const fragment = url.indexOf("#");
|
|
55860
|
-
if (fragment >= 0 && fragment < query) return null;
|
|
55861
|
-
return `${url.slice(0, query)}${HIDDEN_QUERY}`;
|
|
55862
|
-
}
|
|
55863
|
-
function hideOne(endpoint) {
|
|
55864
|
-
if (endpoint === null || typeof endpoint !== "object" || Array.isArray(endpoint)) return {
|
|
55865
|
-
value: endpoint,
|
|
55866
|
-
hidden: false
|
|
55867
|
-
};
|
|
55868
|
-
const url = endpoint.url;
|
|
55869
|
-
const shown = typeof url === "string" ? urlWithQueryHidden(url) : null;
|
|
55870
|
-
if (shown === null) return {
|
|
55871
|
-
value: endpoint,
|
|
55872
|
-
hidden: false
|
|
55873
|
-
};
|
|
55874
|
-
return {
|
|
55875
|
-
value: {
|
|
55876
|
-
...endpoint,
|
|
55877
|
-
url: shown,
|
|
55878
|
-
url_query_hidden: true
|
|
55879
|
-
},
|
|
55880
|
-
hidden: true
|
|
55881
|
-
};
|
|
55882
|
-
}
|
|
55883
|
-
/**
|
|
55884
|
-
* An answer's data (one endpoint, or a list of them) with each URL's query
|
|
55885
|
-
* string hidden, and whether any was.
|
|
55886
|
-
*/
|
|
55887
|
-
function endpointsWithQueryHidden(data) {
|
|
55888
|
-
if (!Array.isArray(data)) {
|
|
55889
|
-
const one = hideOne(data);
|
|
55890
|
-
return {
|
|
55891
|
-
data: one.value,
|
|
55892
|
-
hidden: one.hidden
|
|
55893
|
-
};
|
|
55894
|
-
}
|
|
55895
|
-
let hidden = false;
|
|
55896
|
-
return {
|
|
55897
|
-
data: data.map((row) => {
|
|
55898
|
-
const one = hideOne(row);
|
|
55899
|
-
hidden ||= one.hidden;
|
|
55900
|
-
return one.value;
|
|
55901
|
-
}),
|
|
55902
|
-
hidden
|
|
55903
|
-
};
|
|
55904
|
-
}
|
|
55905
|
-
function isPlainObject(value) {
|
|
55906
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
55907
|
-
const prototype = Object.getPrototypeOf(value);
|
|
55908
|
-
return prototype === Object.prototype || prototype === null;
|
|
55909
|
-
}
|
|
55910
|
-
/** How deep errorWithQueryHidden looks into an error payload. */
|
|
55911
|
-
const ERROR_DEPTH = 8;
|
|
55912
|
-
/**
|
|
55913
|
-
* An error answer with the query string hidden in every `url` it names, such
|
|
55914
|
-
* as `details.holder.url` on a 409 for a slot another endpoint holds.
|
|
55915
|
-
* Anything that is not a plain object or a list is left as it is.
|
|
55916
|
-
*/
|
|
55917
|
-
function errorWithQueryHidden(payload, depth = 0) {
|
|
55918
|
-
if (depth > ERROR_DEPTH) return payload;
|
|
55919
|
-
if (Array.isArray(payload)) return payload.map((entry) => errorWithQueryHidden(entry, depth + 1));
|
|
55920
|
-
if (!isPlainObject(payload)) return payload;
|
|
55921
|
-
const out = {};
|
|
55922
|
-
for (const [key, value] of Object.entries(payload)) out[key] = errorWithQueryHidden(value, depth + 1);
|
|
55923
|
-
return hideOne(out).value;
|
|
55924
|
-
}
|
|
55925
|
-
/**
|
|
55926
|
-
* A query string as a partial copy of HIDDEN_QUERY leaves it: a terminal's
|
|
55927
|
-
* word selection stops at its first space, after `?...`.
|
|
55928
|
-
*/
|
|
55929
|
-
const HIDDEN_QUERY_START = "?...";
|
|
55930
|
-
/**
|
|
55931
|
-
* The refusal for a request body whose url is a URL as these commands print
|
|
55932
|
-
* it with the query hidden, whole or cut at its first space, so a printed URL
|
|
55933
|
-
* is never written back in place of the real one; null for any other body.
|
|
55934
|
-
*/
|
|
55935
|
-
function hiddenQueryUrlRefusal(body) {
|
|
55936
|
-
if (body === null || typeof body !== "object" || Array.isArray(body)) return null;
|
|
55937
|
-
const url = body.url;
|
|
55938
|
-
if (typeof url !== "string" || !url.includes(HIDDEN_QUERY_START)) return null;
|
|
55939
|
-
return `The url carries ${HIDDEN_QUERY_START}, the start of ${HIDDEN_QUERY}, which is how the endpoint commands print a URL with its query string hidden, not the URL itself. Pass the full URL; \`primitive endpoints get <id> --show-url\` prints a webhook's URL in full.`;
|
|
56293
|
+
return isPlainObject(body) && body.rules !== void 0;
|
|
55940
56294
|
}
|
|
55941
56295
|
// src/oclif/endpoints-test-redirect.ts
|
|
55942
56296
|
async function detectFunctionEndpoint(endpointId, listEndpoints) {
|
|
@@ -56554,8 +56908,30 @@ function formatScheduledSummary(noun, sent, idempotencyKey) {
|
|
|
56554
56908
|
const byKey = idempotencyKey ? ` or \`primitive sent cancel --idempotency-key ${shellQuote(idempotencyKey)}\`` : "";
|
|
56555
56909
|
return `${noun} ${verb}${when} (id ${sent.id}). Nothing has gone out yet. Do not resend. To cancel it before then, run \`primitive sent cancel --id ${sent.id}\`${byKey}.`;
|
|
56556
56910
|
}
|
|
56557
|
-
|
|
56558
|
-
|
|
56911
|
+
/**
|
|
56912
|
+
* The API's own words for a refusal (`message` on its error), on one line and
|
|
56913
|
+
* ending in a full stop, or undefined when it gave none.
|
|
56914
|
+
*/
|
|
56915
|
+
function sendErrorMessage(payload) {
|
|
56916
|
+
const message = payload !== null && typeof payload === "object" ? payload.message : void 0;
|
|
56917
|
+
if (typeof message !== "string") return void 0;
|
|
56918
|
+
const line = sanitizeForTerminal(message).replaceAll(/\s+/g, " ").trim();
|
|
56919
|
+
if (!line) return void 0;
|
|
56920
|
+
const cut = line.length > SEND_ERROR_MESSAGE_MAX ? `${line.slice(0, SEND_ERROR_MESSAGE_MAX - 3).trimEnd()}...` : line;
|
|
56921
|
+
return /[.!?]["')\]]*$/.test(cut) ? cut : `${cut}.`;
|
|
56922
|
+
}
|
|
56923
|
+
/** The longest API message the failure line repeats; the error itself follows in full. */
|
|
56924
|
+
const SEND_ERROR_MESSAGE_MAX = 300;
|
|
56925
|
+
/**
|
|
56926
|
+
* The one line that says a send failed. A refusal leads with what the API
|
|
56927
|
+
* said was wrong (`message`, from sendErrorMessage), so the first line read
|
|
56928
|
+
* names the problem rather than only its status.
|
|
56929
|
+
*/
|
|
56930
|
+
function formatSendFailureSummary(noun, outcome, httpStatus, message) {
|
|
56931
|
+
if (outcome === "not_sent") {
|
|
56932
|
+
if (message) return `${noun} not sent${httpStatus === void 0 ? "" : ` (HTTP ${httpStatus})`}: ${message} Nothing went out; fix the problem before retrying.`;
|
|
56933
|
+
return `${noun} not sent: ${httpStatus === void 0 ? "the request failed before sending" : `the API rejected the request (HTTP ${httpStatus})`}. Nothing went out; fix the problem before retrying.`;
|
|
56934
|
+
}
|
|
56559
56935
|
return `${noun} send outcome uncertain (${httpStatus === void 0 ? "no response from the API" : `HTTP ${httpStatus}`}): it may or may not have gone out. Do not resend blindly; check sent history first.`;
|
|
56560
56936
|
}
|
|
56561
56937
|
function priorRepliesThatWentOut(replies, options = {}) {
|
|
@@ -56825,11 +57201,11 @@ function reportSendCommandResult(params) {
|
|
|
56825
57201
|
let errorPayload = null;
|
|
56826
57202
|
if (params.result.error) {
|
|
56827
57203
|
errorPayload = extractErrorPayload(params.result.error);
|
|
56828
|
-
params.onApiError(errorPayload);
|
|
56829
57204
|
const failure = classifySendError(httpStatus, errorPayload);
|
|
56830
57205
|
outcome = failure;
|
|
56831
|
-
outcomeMessage = failure === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, failure, httpStatus);
|
|
57206
|
+
outcomeMessage = failure === "already_sent" ? formatDeletedEarlierSendNotice() : formatSendFailureSummary(params.noun, failure, httpStatus, sendErrorMessage(errorPayload));
|
|
56832
57207
|
if (!params.json) params.writeStderr(`${outcomeMessage}\n`);
|
|
57208
|
+
params.onApiError(errorPayload);
|
|
56833
57209
|
} else {
|
|
56834
57210
|
sent = params.result.data?.data ?? null;
|
|
56835
57211
|
if (sent === null) {
|
|
@@ -57793,7 +58169,7 @@ function savedConnectedProfiles(configDir, exclude) {
|
|
|
57793
58169
|
*/
|
|
57794
58170
|
async function otherProfiles(configDir, session, current) {
|
|
57795
58171
|
if (session) try {
|
|
57796
|
-
const { connectedProfilesForSession } = await import("./machine-session-
|
|
58172
|
+
const { connectedProfilesForSession } = await import("./machine-session-DJoBSWTy.js").then((n) => n.s);
|
|
57797
58173
|
return {
|
|
57798
58174
|
inSession: true,
|
|
57799
58175
|
profiles: connectedProfilesForSession(configDir, session, current)
|
|
@@ -58838,7 +59214,7 @@ function buildFlags(operation) {
|
|
|
58838
59214
|
const bodyFieldFlagToProperty = /* @__PURE__ */ new Map();
|
|
58839
59215
|
if (operation.hasJsonBody) {
|
|
58840
59216
|
flags["raw-body"] = Flags.string({ description: "Full request body as raw JSON. Escape hatch for nested or complex fields (e.g. arrays); prefer per-field flags (e.g. --to, --from, --body-text) when available." });
|
|
58841
|
-
flags["body-file"] = Flags.string({ description:
|
|
59217
|
+
flags["body-file"] = Flags.string({ description: `Path to a JSON file used as the request body. Same role as --raw-body for callers passing a saved payload.${BODY_FILE_HELP[operation.sdkName] ? ` ${BODY_FILE_HELP[operation.sdkName]}` : ""}` });
|
|
58842
59218
|
const bodyFields = extractBodyFields(operation.requestSchema);
|
|
58843
59219
|
const aliasesForOperation = OPERATION_FLAG_ALIASES[operation.sdkName];
|
|
58844
59220
|
for (const field of bodyFields) {
|
|
@@ -58884,10 +59260,6 @@ function buildFlags(operation) {
|
|
|
58884
59260
|
multiple: true
|
|
58885
59261
|
});
|
|
58886
59262
|
if (operation.binaryResponse) flags.output = Flags.string({ description: "Write binary response bytes to a file" });
|
|
58887
|
-
if (ENDPOINT_URL_OPERATIONS.has(operation.sdkName)) {
|
|
58888
|
-
if (flags["show-url"] !== void 0) throw new Error(`${operation.sdkName}: --show-url is both a generated flag and the CLI's own`);
|
|
58889
|
-
flags["show-url"] = Flags.boolean({ description: SHOW_URL_FLAG_DESCRIPTION });
|
|
58890
|
-
}
|
|
58891
59263
|
if (ATTACHMENT_WAIT_OPERATIONS.has(operation.sdkName)) flags.wait = Flags.boolean({
|
|
58892
59264
|
allowNo: true,
|
|
58893
59265
|
default: true,
|
|
@@ -58983,13 +59355,40 @@ const OPERATION_HINTS = {
|
|
|
58983
59355
|
getMemory: "Tip: prefer `primitive memories get <key> [--function <function-id>]` for the common read path.",
|
|
58984
59356
|
deleteMemory: "Tip: prefer `primitive memories delete <key> [--function <function-id>]` for the common delete path.",
|
|
58985
59357
|
searchMemories: "Tip: prefer `primitive memories search [prefix] [--metadata-only] [--function <function-id>]` for the common search path.",
|
|
59358
|
+
listEmails: "Tip: for a one-line-per-email table, `primitive emails latest --limit 100`.",
|
|
58986
59359
|
createEmailRuleObjection: "Tip: say in --message (up to 500 characters) what you want. It can ask for less than turning the rule off: ask the author to narrow the rule, or to explain where its matches go (its receivers). The author accepts, which turns the rule off, or declines, optionally giving a reason, which you see in `primitive email-rule-oversight get-email-rule-objection <objection-id>`. You can withdraw it with `primitive email-rule-oversight withdraw-email-rule-objection <objection-id>`. Objecting does not change the rule.",
|
|
58987
|
-
declineEmailRuleObjection: "Tip: the member who objected sees --reason (up to 500 characters).
|
|
59360
|
+
declineEmailRuleObjection: "Tip: the member who objected sees --reason (up to 500 characters). If you narrow the rule instead of turning it off, decline with a reason saying what you changed: accepting turns the rule off, and the member sees the reason on the objection. When the objection asked you to explain a receiver, the reason can say what the receiver is for.",
|
|
58988
59361
|
listEndpoints: "Tip: without --json, a table on stderr after the JSON shows each endpoint's ENABLED and DELIVERING. DELIVERING is read from delivery.delivering, whether a webhook is being sent mail at all, not from enabled: an endpoint can be enabled and still not be delivering (its owner's key revoked, say), shown as no with the reason codes in parentheses. A webhook whose delivery could not be checked shows unknown, and a Function or pull endpoint shows -.",
|
|
58989
59362
|
startAgentSignup: "Tip: pass --terms-accepted. Capture the signup_token from the response and feed it to `primitive agent verify-agent-signup --signup-token <token> --verification-code <6-digit-code>` (the verify flag accepts --code as an alias). The high-level `primitive signup <email>` command walks an interactive user through both steps with friendlier prompts.",
|
|
58990
59363
|
testEmailRule: "Tip: --expect-match and --expect-no-match (or --expect-file) set expect, the emails the rule must match and must not. When no expect is sent, by these flags or in the body, a saved rule's saved expectations are judged instead. Either way, the answer reports the expectations it judged in expectations: passed, counts and per-email results. (create-email-rule and update-email-rule instead judge the rule's saved expectations on the version they save, in expectations_check: passed, decided, failed and undecided.) The exit code follows that report: 1 when one failed; 1 when one is undecided and testing again will not decide it (its email cannot be found or read, cannot be classified, or cannot be tested: skipped); 3 when the only undecided ones can be decided later (not classified yet, or a question unanswered), so test again later. Exit 1 also means the request failed. With --json, error.code tells these apart: expectations_failed, expectations_unresolvable, expectations_undecided (exit 3), or the API's own code. Without --json a readable report follows the JSON on stderr: warnings, how each condition held, the expectations, and the values each email that did not match was compared on.",
|
|
58991
59364
|
verifyAgentSignup: "Tip: pass --verification-code <code> (or --code; both work). The response carries OAuth tokens but not your assigned inbox domain; run `primitive domains list` (or `primitive whoami`) after success to see the managed *.primitive.email address that routes to this account."
|
|
58992
59365
|
};
|
|
59366
|
+
/**
|
|
59367
|
+
* A top-level text field of `body` longer than the spec's maxLength for it,
|
|
59368
|
+
* said as a refusal, or undefined. Counted after trimming the ends, by code
|
|
59369
|
+
* point, which is never more than the API counts, so nothing the API would
|
|
59370
|
+
* take is refused here; a message over the limit is refused before it is
|
|
59371
|
+
* sent rather than by the API after typing it.
|
|
59372
|
+
*/
|
|
59373
|
+
function overLongBodyField(schema, body) {
|
|
59374
|
+
if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
59375
|
+
const properties = schema?.properties;
|
|
59376
|
+
if (!properties) return void 0;
|
|
59377
|
+
for (const [field, value] of Object.entries(body)) {
|
|
59378
|
+
const max = properties[field]?.maxLength;
|
|
59379
|
+
if (typeof value !== "string" || typeof max !== "number") continue;
|
|
59380
|
+
const length = Array.from(value.trim()).length;
|
|
59381
|
+
if (length > max) return `${field} is ${length} characters; the API takes at most ${max}. Nothing was sent.`;
|
|
59382
|
+
}
|
|
59383
|
+
}
|
|
59384
|
+
/** What a write that takes a compile answer reads from --body-file, said beside the generic help. */
|
|
59385
|
+
const COMPILE_ANSWER = "the answer `compile-email-rule --json` printed (without --include-sql), unchanged: save it to a file";
|
|
59386
|
+
const BODY_FILE_HELP = {
|
|
59387
|
+
createEmailRule: `For this command, ${COMPILE_ANSWER}, and add --english with the description you compiled, and --name. The answer carries no scope: pass --evaluation-scope again if you compiled with one.`,
|
|
59388
|
+
updateEmailRule: `For a new version, ${COMPILE_ANSWER}, and add --english with the description you compiled (required with a new tree); --name only to rename it.`,
|
|
59389
|
+
createEmailRuleRequest: `For this command, ${COMPILE_ANSWER}, and add --english with the description you compiled, --name and --target-email.`,
|
|
59390
|
+
acceptEmailRuleRequest: `To change the rule as you accept it, ${COMPILE_ANSWER}, and add --english with the description you compiled.`
|
|
59391
|
+
};
|
|
58993
59392
|
const OPERATION_FLAG_ALIASES = { verifyAgentSignup: { verification_code: ["code"] } };
|
|
58994
59393
|
const OPERATION_EXTRA_BODY_FLAGS = { addDomain: { "mail-relay": {
|
|
58995
59394
|
property: "mail_relay",
|
|
@@ -59075,13 +59474,6 @@ function createOperationCommand(operation) {
|
|
|
59075
59474
|
"verifyAgentSignup",
|
|
59076
59475
|
"resendAgentSignupVerification"
|
|
59077
59476
|
].includes(operation.operationId)) requireDefaultLoginProfile();
|
|
59078
|
-
const prereadBody = ENDPOINT_URL_WRITE_OPERATIONS.has(operation.sdkName) && operation.hasJsonBody ? { value: readJsonBody(parsedFlags) } : void 0;
|
|
59079
|
-
if (prereadBody) {
|
|
59080
|
-
const urlFlag = [...bodyFieldFlagToProperty].find(([, property]) => property === "url")?.[0];
|
|
59081
|
-
const flagUrl = urlFlag ? parsedFlags[urlFlag] : void 0;
|
|
59082
|
-
const refusal = hiddenQueryUrlRefusal(typeof flagUrl === "string" ? { url: flagUrl } : prereadBody.value);
|
|
59083
|
-
if (refusal) throw new Errors.CLIError(refusal, { exit: 2 });
|
|
59084
|
-
}
|
|
59085
59477
|
await runWithTiming(parsedFlags.time === true, async () => {
|
|
59086
59478
|
const { apiClient, auth, baseUrlOverridden } = await createAuthenticatedCliApiClient({
|
|
59087
59479
|
apiKey: typeof parsedFlags["api-key"] === "string" ? parsedFlags["api-key"] : void 0,
|
|
@@ -59090,7 +59482,7 @@ function createOperationCommand(operation) {
|
|
|
59090
59482
|
});
|
|
59091
59483
|
let body;
|
|
59092
59484
|
if (operation.hasJsonBody) {
|
|
59093
|
-
const explicit =
|
|
59485
|
+
const explicit = readJsonBody(parsedFlags);
|
|
59094
59486
|
const overrides = collectBodyFieldFlags(parsedFlags, bodyFieldFlagToProperty);
|
|
59095
59487
|
const extensionFlagFor = /* @__PURE__ */ new Map();
|
|
59096
59488
|
for (const field of extension?.bodyFields?.(parsedFlags, explicit) ?? []) {
|
|
@@ -59110,10 +59502,6 @@ function createOperationCommand(operation) {
|
|
|
59110
59502
|
}
|
|
59111
59503
|
} else body = explicit;
|
|
59112
59504
|
}
|
|
59113
|
-
if (ENDPOINT_URL_WRITE_OPERATIONS.has(operation.sdkName)) {
|
|
59114
|
-
const refusal = hiddenQueryUrlRefusal(body);
|
|
59115
|
-
if (refusal) throw new Errors.CLIError(refusal, { exit: 2 });
|
|
59116
|
-
}
|
|
59117
59505
|
if (EVENT_TYPES_FLAG_OPERATIONS.has(operation.sdkName) && Array.isArray(parsedFlags["event-types"])) body = await applyEventTypesFlag({
|
|
59118
59506
|
body,
|
|
59119
59507
|
values: parsedFlags["event-types"],
|
|
@@ -59125,6 +59513,8 @@ function createOperationCommand(operation) {
|
|
|
59125
59513
|
quiet: parsedFlags.json === true
|
|
59126
59514
|
});
|
|
59127
59515
|
if (operation.bodyRequired && body === void 0) throw new Errors.CLIError(`Operation ${operation.operationId} requires a body. Pass each field as a --flag (see --help) or supply JSON via --raw-body / --body-file.`);
|
|
59516
|
+
const tooLong = overLongBodyField(operation.requestSchema, body);
|
|
59517
|
+
if (tooLong) throw new Errors.CLIError(tooLong, { exit: 2 });
|
|
59128
59518
|
const operationFn = sdk_gen_exports[operation.sdkName];
|
|
59129
59519
|
const query = collectValues(operation.queryParams, parsedFlags, operation.sdkName);
|
|
59130
59520
|
const replyStateSurface = replyStateSurfaceForOperation(operation.sdkName, query);
|
|
@@ -59233,7 +59623,7 @@ function createOperationCommand(operation) {
|
|
|
59233
59623
|
if (result.error) {
|
|
59234
59624
|
const errorPayload = extractErrorPayload(result.error);
|
|
59235
59625
|
const operationErrorHint = OPERATION_ERROR_HINTS[operation.sdkName]?.(extractErrorCode(errorPayload), body, errorPayload, collectValues(operation.pathParams, parsedFlags, operation.sdkName), parsedFlags);
|
|
59236
|
-
writeErrorWithHints(
|
|
59626
|
+
writeErrorWithHints(errorPayload, result.response, { codeHint: !(operationErrorHint && OPERATION_ERROR_HINTS_REPLACING_CODE_HINT.has(operation.sdkName)) });
|
|
59237
59627
|
if (operationErrorHint) process.stderr.write(`${operationErrorHint}\n`);
|
|
59238
59628
|
if (stepUpUrl) process.stderr.write(approveThenRerunHint(stepUpUrl));
|
|
59239
59629
|
if (replyStateSurface && isAwaitingRejectedError(errorPayload)) process.stderr.write(`${awaitingRejectedError(replyStateSurface).message}\n`);
|
|
@@ -59381,26 +59771,12 @@ function createOperationCommand(operation) {
|
|
|
59381
59771
|
}
|
|
59382
59772
|
};
|
|
59383
59773
|
}
|
|
59384
|
-
let
|
|
59385
|
-
let queryHidden = false;
|
|
59386
|
-
if (ENDPOINT_URL_OPERATIONS.has(operation.sdkName) && parsedFlags["show-url"] !== true && envelope) {
|
|
59387
|
-
const shown = endpointsWithQueryHidden(envelope.data);
|
|
59388
|
-
if (shown.hidden) {
|
|
59389
|
-
shownEnvelope = {
|
|
59390
|
-
...envelope,
|
|
59391
|
-
data: shown.data
|
|
59392
|
-
};
|
|
59393
|
-
queryHidden = true;
|
|
59394
|
-
if (jsonOutput && withEnvelope) summary.push(HIDDEN_QUERY_NOTE);
|
|
59395
|
-
}
|
|
59396
|
-
}
|
|
59397
|
-
let printed = jsonOutput && withEnvelope ? operationJsonDocument(shownEnvelope, summary) : operationOutputPayload(shownEnvelope, withEnvelope);
|
|
59774
|
+
let printed = jsonOutput && withEnvelope ? operationJsonDocument(envelope, summary) : operationOutputPayload(envelope, withEnvelope);
|
|
59398
59775
|
if (jsonOutput && report?.exitCode && report.error && printed !== null && typeof printed === "object" && !Array.isArray(printed)) printed = {
|
|
59399
59776
|
...printed,
|
|
59400
59777
|
error: report.error
|
|
59401
59778
|
};
|
|
59402
59779
|
this.log(JSON.stringify(printed, null, 2));
|
|
59403
|
-
if (queryHidden && !jsonOutput) process.stderr.write(`${HIDDEN_QUERY_NOTE}\n`);
|
|
59404
59780
|
if (reportError !== void 0) process.stderr.write(`Warning: ${operation.sdkName} succeeded but its report could not be built (${reportError}). The JSON above is the full answer; read it rather than the exit code.\n`);
|
|
59405
59781
|
if (report && !jsonOutput) for (const line of report.lines) process.stderr.write(`${line}\n`);
|
|
59406
59782
|
if (reportError !== void 0 && report?.exitCode && !jsonOutput) process.stderr.write(`The answer's expectations were not all shown to pass, so the command exits ${report.exitCode}.\n`);
|
|
@@ -59434,4 +59810,4 @@ function emptyDeliveriesHint(sdkName, query) {
|
|
|
59434
59810
|
function canonicalizeCliReferences(description) {
|
|
59435
59811
|
return description.replaceAll("`primitive emails:latest`", "`primitive emails latest`").replaceAll("`primitive describe emails:get-email | jq '.responseSchema.properties'`", "`primitive describe emails:get | jq '.responseSchema.properties'`");
|
|
59436
59812
|
}
|
|
59437
|
-
export { interactionNextActions as $,
|
|
59813
|
+
export { interactionNextActions as $, withAttachmentWait as $t, openBrowser as A, thrownErrorExitCode as At, serverRelationship as B, detectRuntimeSession as Bt, approveThenRerunHint as C, sendErrorMessage as Ct, canOfferCopyHotkey as D, sentHistoryWindowStart as Dt, withApproval as E, sendWaitClampNotice as Et, formatMailWakeLine as F, generatedAgentName as Ft, claimPendingMail as G, mailReach as Gt, wakeReadCommand as H, formatAlreadySentNotice as Ht, latestOwnOutbound as I, identitySuggestions as It, pendingMailPath as J, classificationOf as Jt, clearConsumedPendingMail as K, readCallerMailFor as Kt, readThreadContext as L, loadSkillLine as Lt, bareAddress$1 as M, cliInvocation as Mt, describeWake as N, connectNextSteps as Nt, formatBrowserLoginInstructions as O, serializeErrorPayload as Ot, displayAddress as P, defaultConnectionName as Pt, interactionHumanLine as Q, ATTACHMENT_WAIT_MAX_MS as Qt, sentInThread as R, currentMailSessionKey as Rt, STEP_UP_TOKEN_FLAG_DESCRIPTION as S, reportSendCommandResult as St, terminalApprovalIo as T, sendOutcomeExitCode as Tt, wakeRecipientField as U, withFlagSuggestion as Ut, skillFirstLine as V, runtimeSessionVariableList as Vt, wakeRelationship as W, emptyEmailListHint as Wt, recordPendingMail as X, noFactsMessage as Xt, readPendingMail as Y, isEmailId as Yt, removePendingMail as Z, ATTACHMENT_WAIT_FLAG_DESCRIPTION as Zt, surfaceUnauthorizedHint as _, routeWarningLines as _n, formatPriorRepliesCheckSkipped as _t, createOperationCommand as a, refuseOrgSelectionForProfile as an, MAX_SEND_WAIT_TIMEOUT_MS as at, BROWSER_FLAG_DESCRIPTION as b, operationManifest as bn, formatSendRecordFailureSummary as bt, formatErrorPayload as c, CliOrgRefusedError as cn, assertValidIdempotencyKey as ct, isGrantRefusal as d, fetchCliOrgs as dn, checkPriorReplies as dt, ConnectedAgentKeyRequiredError as en, readEmailInteraction as et, networkErrorHint as f, isBuiltInRoleKey as fn, classifySendError as ft, runWithTiming as g, switchCurrentOrg as gn, formatDeletedEarlierSendNotice as gt, refusalDetails as h, roleKeyText as hn, followUpCommandPrefix as ht, TIME_FLAG_DESCRIPTION as i, refreshStoredCliCredentials as in, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as it, explainPendingMailNotFound as j, DEFAULT_ENROLL_NAME as jt, listenForCopyHotkey as k, successfulSendOutcome as kt, hasControlCharacter as l, RESTRICTED_ROLE_NOTE as ln, buildFollowUpCommand as lt, readTextFileFlag as m, roleKeyLabel as mn, excludeSignalReplies as mt, API_ERROR_CODES as n, createAuthenticatedCliApiClient as nn, replyInteractionWarning as nt, extractErrorCode as o, resolveCliApiRequestConfig as on, SEND_OUTCOME_HELP as ot, parameterFlagName as p, revokeUserLogin as pn, deriveSendIdempotencyKey as pt, clearReadPendingMail as q, classificationFactLines as qt, OPERATION_PATH_FLAGS as r, createCliApiClient as rn, wakeInteractionSentence as rt, extractErrorPayload as s, selectedOrgFromEnv as sn, apiResultHttpStatus as st, API_BASE_URL_FLAG_DESCRIPTION as t, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as tn, replyExpectation as tt, headerFlagName as u, credentialsFromUserLogin as un, buildThrownSendFailureEnvelope as ut, takesStepUp as v, sanitizeForTerminal as vn, formatPriorRepliesWarning as vt, promptLine as w, sendIdentityFields as wt, STEP_UP_HEADER as x, priorRepliesThatWentOut as xt, writeErrorWithHints as y, setKnownCommands as yn, formatSendFailureSummary as yt, serverMuted as z, detectAgentRuntime as zt };
|