@frockbot/applet-sdk 0.7.231 → 0.7.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin/index.d.ts +89 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/applet-sdk",
3
- "version": "0.7.231",
3
+ "version": "0.7.232",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Authoring SDK for FrockBot Plugins: the declarations a Plugin is written against, and the build pipeline the cloud build service runs.",
package/plugin/index.d.ts CHANGED
@@ -401,31 +401,55 @@ export interface PluginContext {
401
401
  connectionId: string,
402
402
  ) => Promise<ConnectionLease | CapabilityFailure>;
403
403
  /**
404
- * The `http` grant, second half: the deployment's own sender, sending for
405
- * this Bot. The Plugin holds no credential and names no provider; a
406
- * deployment that has bound no sender answers unavailable.
404
+ * The `http` grant, second half: the deployment's own sender, sending from
405
+ * this Bot's own address. The Plugin holds no credential, names no provider
406
+ * and never names the sender; a deployment that has bound no sender, or a
407
+ * Bot with no address yet, answers unavailable. One call is one message to
408
+ * every recipient: `unavailable` means nothing left and the decision is
409
+ * still good, while `unknown` means it may have left — the decision is
410
+ * spent, and sending again could deliver it twice.
411
+ *
412
+ * Two kinds. Mail a person approved on a draft card goes to anyone, with
413
+ * their decision's id; a reply to it reaches the person, not the Bot. A
414
+ * note to the Bot's owner (`owner: true`) needs no decision: the kernel
415
+ * holds it to one of the owner's own addresses, to at most one message per
416
+ * `key` and to a daily count per Bot.
407
417
  */
408
- readonly email?: (request: {
409
- /**
410
- * The Approval whose decision authorizes this send. The kernel refuses a
411
- * send whose Approval is missing, undecided, denied, expired or already
412
- * spent, so one decision sends at most one message.
413
- */
414
- approvalId: string;
415
- /**
416
- * The Card that decision was given on. The Approval is bound to the
417
- * surface and to the values it was showing, so a send whose message is
418
- * not the one that was approved is refused.
419
- */
420
- surfaceId: string;
421
- to: string[];
422
- cc?: string[];
423
- subject: string;
424
- body: string;
425
- /** The `Message-Id` this answers, when it answers one. */
426
- inReplyTo?: string;
427
- }) => Promise<
428
- | { status: "sent"; messageId: string; undelivered?: string[] }
418
+ readonly email?: (
419
+ request:
420
+ | {
421
+ /**
422
+ * The Approval whose decision authorizes this send. The kernel
423
+ * refuses a send whose Approval is missing, undecided, denied,
424
+ * expired or already spent, so one decision sends at most one
425
+ * message.
426
+ */
427
+ approvalId: string;
428
+ /**
429
+ * The Card that decision was given on. The Approval is bound to the
430
+ * surface and to the values it was showing, so a send whose message
431
+ * is not the one that was approved is refused.
432
+ */
433
+ surfaceId: string;
434
+ to: string[];
435
+ cc?: string[];
436
+ subject: string;
437
+ body: string;
438
+ /** The `Message-Id` this answers, when it answers one. */
439
+ inReplyTo?: string;
440
+ }
441
+ | {
442
+ owner: true;
443
+ /** What makes a retry the same send, such as the card's surface. */
444
+ key: string;
445
+ /** One of the owner's own addresses; absent, their sign-in one. */
446
+ to?: string;
447
+ subject: string;
448
+ body: string;
449
+ },
450
+ ) => Promise<
451
+ | { status: "sent"; messageId: string; to?: string }
452
+ | { status: "unknown"; reason: string }
429
453
  | CapabilityFailure
430
454
  >;
431
455
  /** The `schedule` grant: a durable Routine operation attributed to this call. */
@@ -900,6 +924,20 @@ export interface PluginCardPress {
900
924
  record?: { [key: string]: unknown };
901
925
  }
902
926
 
927
+ /**
928
+ * What a card's `revise` is handed: the fields of a card the person edited
929
+ * and then approved, before the kernel records that decision.
930
+ */
931
+ export interface PluginCardEdit {
932
+ /** The card the decided surface was drawn from. */
933
+ cardId: string;
934
+ surfaceId: string;
935
+ /** The surface's data model as the person left it when they pressed. */
936
+ dataModel: { [key: string]: unknown };
937
+ /** The Card's data model as the kernel stores it. */
938
+ record: { [key: string]: unknown };
939
+ }
940
+
903
941
  /** A card handler's refusal: the Card is left exactly as it was. */
904
942
  export interface PluginCardDrop {
905
943
  drop: true;
@@ -940,6 +978,21 @@ export type PluginCardDraw =
940
978
  | undefined
941
979
  | void;
942
980
 
981
+ /**
982
+ * What a card's `revise` answers with: what the decision now covers, the
983
+ * words it is recorded with, and optionally messages that settle the card's
984
+ * face onto those values — which, like a press's, may not ask for a
985
+ * decision. Return `{ drop: true, reason }` to refuse the edit: the person is
986
+ * told why, and nothing is decided.
987
+ */
988
+ export type PluginCardRevision =
989
+ | {
990
+ covers: { [key: string]: unknown };
991
+ decision: PluginCardDecision;
992
+ messages?: CardMessage[];
993
+ }
994
+ | PluginCardDrop;
995
+
943
996
  /**
944
997
  * The words the decision a card asks for is recorded with. They are stated
945
998
  * here rather than on the `ApprovalActions` component because the Frock
@@ -975,6 +1028,18 @@ export interface PluginCard {
975
1028
  ctx: PluginContext,
976
1029
  ) => Promise<PluginCardAnswer> | PluginCardAnswer
977
1030
  >;
1031
+ /**
1032
+ * The person edited this card's fields and approved it. Say what the
1033
+ * decision now covers: the kernel binds the Approval to those `covers`
1034
+ * before it records the decision, so what you later act on has to be
1035
+ * exactly them. A surface only sends its fields back when it was created
1036
+ * with `sendDataModel: true`. A card with no `revise` is decided as it was
1037
+ * drawn, whatever its fields hold.
1038
+ */
1039
+ revise?(
1040
+ edit: PluginCardEdit,
1041
+ ctx: PluginContext,
1042
+ ): Promise<PluginCardRevision> | PluginCardRevision;
978
1043
  }
979
1044
 
980
1045
  /**