agl 43.7.0 → 43.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +33 -0
- package/dist_serve/bundle.js +871 -858
- package/dist_serve/bundle.js.map +2 -2
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/aglapi/aglapisurface.document.js +824 -6
- package/dist_ts/aglapi/interfaces.d.ts +43 -0
- package/dist_ts/aglapi/interfaces.js +11 -1
- package/dist_ts/classes.apnsclient.d.ts +97 -0
- package/dist_ts/classes.apnsclient.js +363 -0
- package/dist_ts/classes.authmodels.js +19 -6
- package/dist_ts/classes.authstore.js +15 -2
- package/dist_ts/classes.cli.js +8 -1
- package/dist_ts/classes.controller.d.ts +30 -3
- package/dist_ts/classes.controller.js +250 -9
- package/dist_ts/classes.controllerdevices.d.ts +35 -7
- package/dist_ts/classes.controllerdevices.js +86 -13
- package/dist_ts/classes.controllerpush.d.ts +111 -0
- package/dist_ts/classes.controllerpush.js +299 -0
- package/dist_ts/classes.fcmclient.d.ts +78 -0
- package/dist_ts/classes.fcmclient.js +278 -0
- package/dist_ts/classes.inbox.d.ts +10 -2
- package/dist_ts/classes.inbox.js +9 -2
- package/dist_ts/classes.mcpclient.d.ts +5 -0
- package/dist_ts/classes.mcpclient.js +20 -8
- package/dist_ts/classes.mcpcontrollerhost.d.ts +3 -0
- package/dist_ts/classes.mcpcontrollerhost.js +21 -2
- package/dist_ts/classes.mcptools.d.ts +1 -1
- package/dist_ts/classes.mcptools.js +2 -1
- package/dist_ts/classes.mcpvalidation.js +4 -1
- package/dist_ts/classes.mcpworkercaller.d.ts +6 -0
- package/dist_ts/classes.mcpworkercaller.js +26 -4
- package/dist_ts/classes.pushdelivery.d.ts +115 -0
- package/dist_ts/classes.pushdelivery.js +311 -0
- package/dist_ts/classes.pushhandover.d.ts +46 -0
- package/dist_ts/classes.pushhandover.js +131 -0
- package/dist_ts/classes.pushregistrations.d.ts +96 -0
- package/dist_ts/classes.pushregistrations.js +263 -0
- package/dist_ts/classes.pushsettings.d.ts +125 -0
- package/dist_ts/classes.pushsettings.js +377 -0
- package/dist_ts/classes.ticketstore.d.ts +3 -3
- package/dist_ts/classes.ticketstore.js +23 -4
- package/dist_ts/classes.workercallers.d.ts +73 -2
- package/dist_ts/classes.workercallers.js +354 -43
- package/dist_ts/driver/classes.directreports.d.ts +5 -0
- package/dist_ts/driver/classes.directreports.js +3 -2
- package/dist_ts/fleet/classes.workerlaunches.d.ts +6 -4
- package/dist_ts/fleet/classes.workerlaunches.js +10 -9
- package/dist_ts/fleet/classes.workers.d.ts +12 -2
- package/dist_ts/fleet/classes.workers.js +82 -2
- package/dist_ts/functions.deviceapi.d.ts +23 -3
- package/dist_ts/functions.deviceapi.js +43 -3
- package/dist_ts/functions.mcptickettools.d.ts +60 -0
- package/dist_ts/functions.mcptickettools.js +4 -3
- package/dist_ts/functions.pushcli.d.ts +43 -0
- package/dist_ts/functions.pushcli.js +201 -0
- package/dist_ts/functions.pushcredentials.d.ts +53 -0
- package/dist_ts/functions.pushcredentials.js +111 -0
- package/dist_ts/functions.pushwire.d.ts +8 -0
- package/dist_ts/functions.pushwire.js +83 -0
- package/dist_ts/functions.remotecli.d.ts +2 -2
- package/dist_ts/functions.remotecli.js +4 -4
- package/dist_ts/functions.ticketcli.d.ts +4 -2
- package/dist_ts/functions.ticketcli.js +70 -4
- package/dist_ts/functions.ticketlisting.d.ts +38 -0
- package/dist_ts/functions.ticketlisting.js +211 -0
- package/dist_ts/functions.ticketvalidation.d.ts +62 -0
- package/dist_ts/functions.ticketvalidation.js +41 -3
- package/dist_ts/functions.workercallervalidation.js +3 -2
- package/dist_ts/functions.workerprocessproof.d.ts +12 -0
- package/dist_ts/functions.workerprocessproof.js +32 -1
- package/dist_ts/interfaces.auth.d.ts +27 -3
- package/dist_ts/interfaces.auth.js +9 -1
- package/dist_ts/interfaces.lifecycle.d.ts +7 -1
- package/dist_ts/interfaces.push.d.ts +69 -0
- package/dist_ts/interfaces.push.js +25 -0
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +4 -2
- package/dist_ts_interfaces/devices.d.ts +178 -2
- package/dist_ts_interfaces/devices.js +24 -2
- package/dist_ts_interfaces/index.d.ts +1 -0
- package/dist_ts_interfaces/index.js +2 -1
- package/dist_ts_interfaces/mcprequests.d.ts +3 -2
- package/dist_ts_interfaces/mcprequests.js +3 -1
- package/dist_ts_interfaces/push.d.ts +166 -0
- package/dist_ts_interfaces/push.js +24 -0
- package/dist_ts_interfaces/requests.tickets.d.ts +31 -3
- package/dist_ts_interfaces/requests.tickets.js +2 -2
- package/dist_ts_interfaces/tickets.d.ts +174 -2
- package/dist_ts_interfaces/tickets.js +20 -2
- package/dist_ts_interfaces/workercallers.d.ts +43 -3
- package/package.json +2 -2
- package/readme.md +95 -14
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aglapi/aglapisurface.document.ts +823 -5
- package/ts/aglapi/interfaces.ts +10 -0
- package/ts/classes.apnsclient.ts +389 -0
- package/ts/classes.authmodels.ts +21 -5
- package/ts/classes.authstore.ts +14 -1
- package/ts/classes.cli.ts +7 -0
- package/ts/classes.controller.ts +273 -7
- package/ts/classes.controllerdevices.ts +94 -12
- package/ts/classes.controllerpush.ts +351 -0
- package/ts/classes.fcmclient.ts +292 -0
- package/ts/classes.inbox.ts +13 -2
- package/ts/classes.mcpclient.ts +22 -7
- package/ts/classes.mcpcontrollerhost.ts +22 -1
- package/ts/classes.mcptools.ts +1 -0
- package/ts/classes.mcpvalidation.ts +2 -0
- package/ts/classes.mcpworkercaller.ts +24 -2
- package/ts/classes.pushdelivery.ts +378 -0
- package/ts/classes.pushhandover.ts +98 -0
- package/ts/classes.pushregistrations.ts +244 -0
- package/ts/classes.pushsettings.ts +428 -0
- package/ts/classes.ticketstore.ts +21 -3
- package/ts/classes.workercallers.ts +329 -37
- package/ts/driver/classes.directreports.ts +7 -1
- package/ts/fleet/classes.workerlaunches.ts +9 -7
- package/ts/fleet/classes.workers.ts +65 -2
- package/ts/functions.deviceapi.ts +54 -2
- package/ts/functions.mcptickettools.ts +3 -2
- package/ts/functions.pushcli.ts +212 -0
- package/ts/functions.pushcredentials.ts +129 -0
- package/ts/functions.pushwire.ts +106 -0
- package/ts/functions.remotecli.ts +3 -2
- package/ts/functions.ticketcli.ts +70 -5
- package/ts/functions.ticketlisting.ts +214 -0
- package/ts/functions.ticketvalidation.ts +41 -2
- package/ts/functions.workercallervalidation.ts +2 -1
- package/ts/functions.workerprocessproof.ts +34 -0
- package/ts/interfaces.auth.ts +26 -3
- package/ts/interfaces.lifecycle.ts +7 -1
- package/ts/interfaces.push.ts +78 -0
- package/ts/plugins.ts +3 -1
- package/ts_interfaces/devices.schema.json +327 -0
- package/ts_interfaces/devices.ts +206 -1
- package/ts_interfaces/index.ts +1 -0
- package/ts_interfaces/mcprequests.ts +3 -0
- package/ts_interfaces/push.ts +162 -0
- package/ts_interfaces/requests.tickets.ts +32 -2
- package/ts_interfaces/tickets.ts +136 -3
- package/ts_interfaces/workercallers.ts +34 -2
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements.inbox.ts +50 -9
package/ts_interfaces/devices.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import type { ITypedRequest, implementsTR } from '@api.global/typedrequest-interfaces';
|
|
18
18
|
|
|
19
19
|
/** The device protocol this controller speaks. */
|
|
20
|
-
export const deviceProtocolVersion = { major: 1, minor:
|
|
20
|
+
export const deviceProtocolVersion = { major: 1, minor: 4 } as const;
|
|
21
21
|
|
|
22
22
|
/** The scheme of a pairing payload: `agl-pair:?origin=<https origin>&controller=<controller id>&code=<base64url>`. */
|
|
23
23
|
export const devicePairingScheme = 'agl-pair' as const;
|
|
@@ -809,8 +809,177 @@ export interface IDeviceHostDevice {
|
|
|
809
809
|
* @asType integer
|
|
810
810
|
*/
|
|
811
811
|
lastSeenAt?: number;
|
|
812
|
+
/** Its notifications, while it is registered for them; absent while it is not. Since protocol 1.4. */
|
|
813
|
+
push?: IDeviceHostPush;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** The push service a device registers its token with: Apple's (APNs) or Firebase Cloud Messaging. Since protocol 1.4. */
|
|
817
|
+
export type TDevicePushPlatform = 'apns' | 'fcm';
|
|
818
|
+
|
|
819
|
+
/** The APNs environment a device token belongs to: `sandbox` for a development build, else `production`. Since protocol 1.4. */
|
|
820
|
+
export type TDevicePushEnvironment = 'sandbox' | 'production';
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Why a notification to a device did not go out: `credential_refused`, Apple or Google refused the host's credential
|
|
824
|
+
* for the platform, and the host sends nothing on it until the owner sets the credential again; `refused`, the push
|
|
825
|
+
* service refused the notification itself; `rate_limited`, it asked the host to send less; `service_failed`, it failed
|
|
826
|
+
* the request; `unreachable`, the host could not reach it. A later minor may add a reason: an app shows one it does not
|
|
827
|
+
* know as a failure without a named cause. Since protocol 1.4.
|
|
828
|
+
*/
|
|
829
|
+
export type TDevicePushFailureReason = 'credential_refused' | 'refused' | 'rate_limited' | 'service_failed' | 'unreachable';
|
|
830
|
+
|
|
831
|
+
/** A notification to the device that did not go out. Since protocol 1.4. */
|
|
832
|
+
export interface IDevicePushFailure {
|
|
833
|
+
/**
|
|
834
|
+
* Unix milliseconds of the failed send.
|
|
835
|
+
* @asType integer
|
|
836
|
+
*/
|
|
837
|
+
at: number;
|
|
838
|
+
reason: TDevicePushFailureReason;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* The notifications a device registered for, as the host sends them: never its token. Since protocol 1.4.
|
|
843
|
+
*/
|
|
844
|
+
export interface IDeviceHostPush {
|
|
845
|
+
/** Whether the device asked for direct report results too, besides what waits in the Inbox. */
|
|
846
|
+
reports: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Whether notifications carry previews: where an item lives, what it asks and its id (`IDevicePushInboxData`). One
|
|
849
|
+
* setting for every device of the host, which only the owner changes on the host; off unless the owner turns it on.
|
|
850
|
+
*/
|
|
851
|
+
previews: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Whether the host can send the device notifications now: it holds a credential for the device's platform that Apple
|
|
854
|
+
* or Google did not refuse. While it does not, the registration stays and nothing is sent until the owner sets the
|
|
855
|
+
* credential on the host.
|
|
856
|
+
*/
|
|
857
|
+
available: boolean;
|
|
858
|
+
/** The last notification to the device that did not go out, while none went out after it. */
|
|
859
|
+
lastFailure?: IDevicePushFailure;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* A notification's text with previews off for an item of each kind: one fixed sentence that says only the kind.
|
|
864
|
+
* Since protocol 1.4.
|
|
865
|
+
*/
|
|
866
|
+
export const devicePushSentences: Readonly<Record<TDeviceInboxKind, string>> = {
|
|
867
|
+
permission: 'A session waits for your permission.',
|
|
868
|
+
question: 'A session asks you a question.',
|
|
869
|
+
elicitation: 'A session asks you to fill in a form.',
|
|
870
|
+
native_wait: 'A session waits for you on the host.',
|
|
871
|
+
driver: 'The driver needs your input.',
|
|
872
|
+
deploy_go: 'A deploy waits for your go.',
|
|
873
|
+
window_go: 'A maintenance window waits for your go.',
|
|
874
|
+
ticket_question: 'A ticket asks you a question.',
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
/** A summary notification's text. Since protocol 1.4. */
|
|
878
|
+
export const devicePushSummarySentence = 'New items wait for you in the Inbox.';
|
|
879
|
+
|
|
880
|
+
/** A direct report's notification text with previews off. Since protocol 1.4. */
|
|
881
|
+
export const devicePushReportSentence = 'A direct report has a new result.';
|
|
882
|
+
|
|
883
|
+
/** The text of the owner's test notification. Since protocol 1.4. */
|
|
884
|
+
export const devicePushTestSentence = 'Push from AGL works.';
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* One Inbox item that came: an alert (iOS: thread `inbox`, interruption level `active`; Android: channel Inbox). With
|
|
888
|
+
* previews off it says only the kind's fixed sentence; with previews on also where the item lives, what it asks and
|
|
889
|
+
* its id. Tapping it opens the Inbox. Since protocol 1.4.
|
|
890
|
+
*/
|
|
891
|
+
export interface IDevicePushInboxData {
|
|
892
|
+
type: 'inbox';
|
|
893
|
+
/**
|
|
894
|
+
* The notification's key: base64url of HMAC-SHA256 under the registration's own random salt over the item's id. It
|
|
895
|
+
* names nothing, and the same item has the same key for as long as the registration stands, across restarts of the
|
|
896
|
+
* host, so a notification sent again replaces the one shown (iOS: `apns-collapse-id`; Android: the notification's
|
|
897
|
+
* tag), and a `clear` removes it.
|
|
898
|
+
*/
|
|
899
|
+
key: string;
|
|
900
|
+
kind: TDeviceInboxKind;
|
|
901
|
+
/** The number of items in the Inbox after this one came, in decimal: the app's badge (iOS: also `aps.badge`). */
|
|
902
|
+
badge: string;
|
|
903
|
+
/** Previews off: `devicePushSentences` for the kind. Previews on: the item's title, one line of at most 280 characters. */
|
|
904
|
+
body: string;
|
|
905
|
+
/** Previews on only: where the item lives, such as the session's name, `Driver` or the ticket's key and title. */
|
|
906
|
+
title?: string;
|
|
907
|
+
/** Previews on only: the item's id, as `device.inbox.list` names it. */
|
|
908
|
+
itemId?: string;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* More than four items came at once: one notification says so (iOS: thread `inbox`, level `active`; Android: channel
|
|
913
|
+
* Inbox) instead of one per item, with no item's kind, place or id. Since protocol 1.4.
|
|
914
|
+
*/
|
|
915
|
+
export interface IDevicePushSummaryData {
|
|
916
|
+
type: 'summary';
|
|
917
|
+
/** The registration's one summary key, the same for every summary, so a later summary replaces an earlier one. */
|
|
918
|
+
key: string;
|
|
919
|
+
/** The number of items that came, in decimal. */
|
|
920
|
+
count: string;
|
|
921
|
+
/** The number of items in the Inbox, in decimal: the app's badge. */
|
|
922
|
+
badge: string;
|
|
923
|
+
/** `devicePushSummarySentence`. */
|
|
924
|
+
body: string;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* A direct report's new `result:` line, sent only to a registration with `reports` (iOS: thread `reports`,
|
|
929
|
+
* interruption level `passive`; Android: channel Reports, low importance). It leaves the badge alone: a result waits
|
|
930
|
+
* for nobody. Since protocol 1.4.
|
|
931
|
+
*/
|
|
932
|
+
export interface IDevicePushReportData {
|
|
933
|
+
type: 'report';
|
|
934
|
+
/** As an item's key, over the report's name: a newer result of the same report replaces the older one. */
|
|
935
|
+
key: string;
|
|
936
|
+
/** Previews off: `devicePushReportSentence`. Previews on: the `result:` line. */
|
|
937
|
+
body: string;
|
|
938
|
+
/** Previews on only: the report's name. */
|
|
939
|
+
title?: string;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* The owner's test notification, which the owner sends on the host to see that notifications reach the device (iOS:
|
|
944
|
+
* thread `inbox`, interruption level `active`; Android: channel Inbox). It names no item and leaves the badge alone;
|
|
945
|
+
* tapping it opens the Inbox. Since protocol 1.4.
|
|
946
|
+
*/
|
|
947
|
+
export interface IDevicePushTestData {
|
|
948
|
+
type: 'test';
|
|
949
|
+
/** The registration's one test key, the same for every test, so a later test replaces an earlier one. */
|
|
950
|
+
key: string;
|
|
951
|
+
/** `devicePushTestSentence`. */
|
|
952
|
+
body: string;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Items left the Inbox: remove their notifications (Android cancels them by tag; on iOS it is a background push, which
|
|
957
|
+
* the system may hold back, so an app also matches its notifications against `device.inbox.list` on every connect).
|
|
958
|
+
* Since protocol 1.4.
|
|
959
|
+
*/
|
|
960
|
+
export interface IDevicePushClearData {
|
|
961
|
+
type: 'clear';
|
|
962
|
+
/** The keys of the notifications to remove, separated by single spaces. */
|
|
963
|
+
keys: string;
|
|
964
|
+
/** The number of items in the Inbox now, in decimal: the app's badge. */
|
|
965
|
+
badge: string;
|
|
812
966
|
}
|
|
813
967
|
|
|
968
|
+
/**
|
|
969
|
+
* What a notification from the host carries, the same for both platforms, each value a string because FCM data carries
|
|
970
|
+
* only strings: FCM sends it as a data-only message's `data` (the Android app builds the notification itself), APNs as
|
|
971
|
+
* the payload's `agl` object beside `aps` (an alert push for `inbox`, `summary`, `report` and `test`, a background push
|
|
972
|
+
* for `clear`). No notification carries a session's or a ticket's id with previews off. A later minor may add keys and
|
|
973
|
+
* types: an app ignores keys it does not know, and a notification whose `type` it does not know, except an iOS alert
|
|
974
|
+
* push, which the system presents from `aps` without running the app. Since protocol 1.4.
|
|
975
|
+
*/
|
|
976
|
+
export type TDevicePushData =
|
|
977
|
+
| IDevicePushInboxData
|
|
978
|
+
| IDevicePushSummaryData
|
|
979
|
+
| IDevicePushReportData
|
|
980
|
+
| IDevicePushTestData
|
|
981
|
+
| IDevicePushClearData;
|
|
982
|
+
|
|
814
983
|
/**
|
|
815
984
|
* Why a section was not read: `not_running`, what answers it does not run now (the configuration service the deploy
|
|
816
985
|
* monitor reads, the inference proxy or the accounts service; it may be starting); `outdated`, it runs a release this
|
|
@@ -1493,6 +1662,40 @@ export interface IReq_DeviceHostGet extends implementsTR<ITypedRequest, IReq_Dev
|
|
|
1493
1662
|
};
|
|
1494
1663
|
}
|
|
1495
1664
|
|
|
1665
|
+
/**
|
|
1666
|
+
* Registers this device for notifications of what comes into the Inbox, and with `reports` of the direct reports'
|
|
1667
|
+
* results too: one registration per device, which the next one replaces, so an app registers again with its current
|
|
1668
|
+
* token on every connect. Taken also while the host holds no credential to send with (the answer's `available` says
|
|
1669
|
+
* so). The token stays on the host: no answer, event or log repeats it. Scope `device`. Since protocol 1.4.
|
|
1670
|
+
*/
|
|
1671
|
+
export interface IReq_DevicePushRegister extends implementsTR<ITypedRequest, IReq_DevicePushRegister> {
|
|
1672
|
+
method: 'device.push.register';
|
|
1673
|
+
request: {
|
|
1674
|
+
platform: TDevicePushPlatform;
|
|
1675
|
+
/**
|
|
1676
|
+
* APNs: the device token as lowercase hex, 32 to 100 bytes. FCM: the registration token as the Firebase SDK hands
|
|
1677
|
+
* it, 1 to 1024 characters of letters, digits, `_`, `-` and `:`.
|
|
1678
|
+
*/
|
|
1679
|
+
token: string;
|
|
1680
|
+
/** APNs only, and required there: the environment the token belongs to. */
|
|
1681
|
+
environment?: TDevicePushEnvironment;
|
|
1682
|
+
/** Whether to notify the direct reports' results too. */
|
|
1683
|
+
reports: boolean;
|
|
1684
|
+
};
|
|
1685
|
+
/** The registration as `device.host.get` shows it. */
|
|
1686
|
+
response: { push: IDeviceHostPush };
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Ends this device's registration: the host sends it no notification from then on. `removed` says whether it held one.
|
|
1691
|
+
* Scope `device`. Since protocol 1.4.
|
|
1692
|
+
*/
|
|
1693
|
+
export interface IReq_DevicePushUnregister extends implementsTR<ITypedRequest, IReq_DevicePushUnregister> {
|
|
1694
|
+
method: 'device.push.unregister';
|
|
1695
|
+
request: {};
|
|
1696
|
+
response: { removed: boolean };
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1496
1699
|
/**
|
|
1497
1700
|
* One column of the shared board, as the browser's board shows its cards: the tasks (an epic and its subtasks show on
|
|
1498
1701
|
* their task's card in the browser; a device opens them with `device.ticket.get`), in the column's order, `limit` from
|
|
@@ -1634,6 +1837,8 @@ export const deviceMethods = [
|
|
|
1634
1837
|
'device.directreports.list',
|
|
1635
1838
|
'device.directreport.message',
|
|
1636
1839
|
'device.host.get',
|
|
1840
|
+
'device.push.register',
|
|
1841
|
+
'device.push.unregister',
|
|
1637
1842
|
'device.board.list',
|
|
1638
1843
|
'device.ticket.get',
|
|
1639
1844
|
'device.ticket.comment',
|
package/ts_interfaces/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { controllerMcpTicketMethods, type TControllerMcpTicketTypedRequest } fro
|
|
|
5
5
|
import { controllerMcpFleetMethods, type TControllerMcpFleetTypedRequest } from './requests.fleet.js';
|
|
6
6
|
import { controllerMcpSessionFeedMethods, type TControllerMcpSessionFeedTypedRequest } from './sessionfeed.js';
|
|
7
7
|
import { controllerMcpDeployMethods, type TControllerMcpDeployTypedRequest } from './deployments.js';
|
|
8
|
+
import { controllerMcpPushMethods, type TControllerMcpPushTypedRequest } from './push.js';
|
|
8
9
|
import * as plugins from './plugins.js';
|
|
9
10
|
import type { IProxyCapacityAnswer, IProxyCapacityRequest } from './proxycapacity.js';
|
|
10
11
|
import type { IReq_ControllerMcpWorkerEnroll, IWorkerCallerSubject } from './workercallers.js';
|
|
@@ -68,6 +69,7 @@ export const controllerMcpMethods = [
|
|
|
68
69
|
...controllerMcpFleetWorkerMethods,
|
|
69
70
|
...controllerMcpSessionFeedMethods,
|
|
70
71
|
...controllerMcpDeployMethods,
|
|
72
|
+
...controllerMcpPushMethods,
|
|
71
73
|
'agl.mcp.worker.enroll',
|
|
72
74
|
] as const;
|
|
73
75
|
export type TControllerMcpMethod = (typeof controllerMcpMethods)[number];
|
|
@@ -492,6 +494,7 @@ export type TControllerMcpTypedRequest =
|
|
|
492
494
|
| TControllerMcpFleetWorkerTypedRequest
|
|
493
495
|
| TControllerMcpSessionFeedTypedRequest
|
|
494
496
|
| TControllerMcpDeployTypedRequest
|
|
497
|
+
| TControllerMcpPushTypedRequest
|
|
495
498
|
| IReq_ControllerMcpSettingsGet
|
|
496
499
|
| IReq_ControllerMcpSettingsUpdate
|
|
497
500
|
| TControllerMcpWorkspaceTypedRequest
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type * as plugins from './plugins.js';
|
|
2
|
+
import type { TDevicePushEnvironment, TDevicePushFailureReason, TDevicePushPlatform } from './devices.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Notifications from the host (AGL-1639): the push settings the owner sets with `agl push` against the running
|
|
6
|
+
* controller, through its private channel with the local owner capability. The answers name what the host holds for
|
|
7
|
+
* each push service (key id, team id, topic, Firebase project, service account address), never a key, a token or a
|
|
8
|
+
* device's push token.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* What the host holds for one push service: `unset`, no credential; `ready`, a credential it sends with;
|
|
13
|
+
* `refused`, Apple or Google refused it, and nothing is sent on the platform until the owner sets it again;
|
|
14
|
+
* `unreadable`, the stored credential cannot be read or unsealed on this machine, so the owner sets it again.
|
|
15
|
+
*/
|
|
16
|
+
export type TPushCredentialState = 'unset' | 'ready' | 'refused' | 'unreadable';
|
|
17
|
+
|
|
18
|
+
/** A send that failed, as `agl push status` shows it: the reason and, when the push service named one, its code. */
|
|
19
|
+
export interface IPushFailureStatus {
|
|
20
|
+
/** Unix milliseconds. */
|
|
21
|
+
at: number;
|
|
22
|
+
reason: TDevicePushFailureReason;
|
|
23
|
+
/** The push service's own code (an APNs `reason`, an FCM `errorCode` or an OAuth `error`), never its message. */
|
|
24
|
+
vendorReason?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Set when the push service refused while its clock and the host's were apart (Google's `invalid_grant` with its
|
|
27
|
+
* `Date` more than 60 s off the host's clock): the service's clock minus the host's, in milliseconds, so a positive
|
|
28
|
+
* value is a host clock behind. The send is `service_failed` and tried again, the credential kept.
|
|
29
|
+
*/
|
|
30
|
+
clockSkewMs?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A clock skew as `agl push status` and the failure journal name it: how far apart, and which clock is behind. */
|
|
34
|
+
export const pushClockSkewText = (clockSkewMsArg: number): string => (
|
|
35
|
+
`${Math.round(Math.abs(clockSkewMsArg) / 1000)} s apart, the host's clock ${clockSkewMsArg > 0 ? 'behind' : 'ahead'}`
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/** What the host holds for Apple's push service. */
|
|
39
|
+
export interface IPushApnsStatus {
|
|
40
|
+
state: TPushCredentialState;
|
|
41
|
+
/** The key's 10-character id; absent while unset. */
|
|
42
|
+
keyId?: string;
|
|
43
|
+
/** The 10-character Apple team id; absent while unset. */
|
|
44
|
+
teamId?: string;
|
|
45
|
+
/** The app's bundle id, the topic every notification names; absent while unset. */
|
|
46
|
+
topic?: string;
|
|
47
|
+
/** Unix milliseconds the credential was set. */
|
|
48
|
+
setAt?: number;
|
|
49
|
+
/** While `refused`: when and why Apple refused the credential. */
|
|
50
|
+
refused?: IPushFailureStatus;
|
|
51
|
+
/** The paired devices registered for APNs notifications. */
|
|
52
|
+
registrations: number;
|
|
53
|
+
/** The last send on the platform that failed since the controller started. */
|
|
54
|
+
lastFailure?: IPushFailureStatus;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** What the host holds for Firebase Cloud Messaging. */
|
|
58
|
+
export interface IPushFcmStatus {
|
|
59
|
+
state: TPushCredentialState;
|
|
60
|
+
/** The Firebase project id; absent while unset. */
|
|
61
|
+
projectId?: string;
|
|
62
|
+
/** The service account's address; absent while unset. */
|
|
63
|
+
clientEmail?: string;
|
|
64
|
+
/** Unix milliseconds the credential was set. */
|
|
65
|
+
setAt?: number;
|
|
66
|
+
/** While `refused`: when and why Google refused the credential. */
|
|
67
|
+
refused?: IPushFailureStatus;
|
|
68
|
+
/** The paired devices registered for FCM notifications. */
|
|
69
|
+
registrations: number;
|
|
70
|
+
/** The last send on the platform that failed since the controller started. */
|
|
71
|
+
lastFailure?: IPushFailureStatus;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The host's push settings: one for every device of the host. */
|
|
75
|
+
export interface IPushStatus {
|
|
76
|
+
/** Whether notifications carry previews (`IDevicePushInboxData`); off unless the owner turns it on. */
|
|
77
|
+
previews: boolean;
|
|
78
|
+
apns: IPushApnsStatus;
|
|
79
|
+
fcm: IPushFcmStatus;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** A change to the push settings: the settings after it, and whether it changed anything. */
|
|
83
|
+
export interface IPushChange {
|
|
84
|
+
changed: boolean;
|
|
85
|
+
status: IPushStatus;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* What the owner's test notification came to on one device: `delivered`; `unregistered`, the push service no longer
|
|
90
|
+
* knows the device's token (the registration was removed, and the app registers again on its next connect);
|
|
91
|
+
* `unavailable`, the host holds no usable credential for the device's platform, so nothing was sent; `no_answer`, the
|
|
92
|
+
* push service did not answer within `pushTestAnswerWaitMs`, and the notification may still arrive; or why it did not go out.
|
|
93
|
+
*/
|
|
94
|
+
export type TPushTestOutcome = 'delivered' | 'unregistered' | 'unavailable' | 'no_answer' | TDevicePushFailureReason;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* How long `agl push test` waits for each device's answer: under the CLI's 30 s request timeout, although one attempt may
|
|
98
|
+
* take a token request, a send, a token asked anew and a send again, at 15 s each.
|
|
99
|
+
*/
|
|
100
|
+
export const pushTestAnswerWaitMs = 20_000;
|
|
101
|
+
|
|
102
|
+
/** One registered device's answer to `agl push test`: never its token. */
|
|
103
|
+
export interface IPushTestResult {
|
|
104
|
+
deviceId: string;
|
|
105
|
+
name: string;
|
|
106
|
+
platform: TDevicePushPlatform;
|
|
107
|
+
environment?: TDevicePushEnvironment;
|
|
108
|
+
outcome: TPushTestOutcome;
|
|
109
|
+
/** The push service's own code, when it named one. */
|
|
110
|
+
vendorReason?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Every `agl push` request: the request without the owner capability, and its answer. */
|
|
114
|
+
export interface IPushOperations {
|
|
115
|
+
status: { request: Record<never, never>; response: IPushStatus };
|
|
116
|
+
'apns.set': {
|
|
117
|
+
/** `signingKey` is the AuthKey .p8 file's text, which the controller seals and never repeats. */
|
|
118
|
+
request: { keyId: string; teamId: string; topic?: string; signingKey: string };
|
|
119
|
+
response: IPushChange;
|
|
120
|
+
};
|
|
121
|
+
'apns.unset': { request: Record<never, never>; response: IPushChange };
|
|
122
|
+
'fcm.set': {
|
|
123
|
+
/** `serviceAccount` is the service account key file's JSON text, which the controller seals and never repeats. */
|
|
124
|
+
request: { serviceAccount: string };
|
|
125
|
+
response: IPushChange;
|
|
126
|
+
};
|
|
127
|
+
'fcm.unset': { request: Record<never, never>; response: IPushChange };
|
|
128
|
+
previews: { request: { previews: boolean }; response: IPushChange };
|
|
129
|
+
/** Sends the test notification (`IDevicePushTestData`) to every registered device, or to the one `deviceId` names. */
|
|
130
|
+
test: { request: { deviceId?: string }; response: { results: IPushTestResult[] } };
|
|
131
|
+
}
|
|
132
|
+
export type TPushOperation = keyof IPushOperations;
|
|
133
|
+
export const pushOperations = ['status', 'apns.set', 'apns.unset', 'fcm.set', 'fcm.unset', 'previews', 'test'] as const satisfies readonly TPushOperation[];
|
|
134
|
+
|
|
135
|
+
/** The request fields that carry a secret: no answer, log or error repeats them, and the request's echo redacts them. */
|
|
136
|
+
export const pushSecretRequestFields = ['signingKey', 'serviceAccount'] as const;
|
|
137
|
+
|
|
138
|
+
/** Why the controller refused an `agl push` request; its sentence names the cause, never the input. */
|
|
139
|
+
export const pushErrorCodes = ['push_credential_invalid', 'push_device_unknown', 'push_unavailable'] as const;
|
|
140
|
+
export type TPushErrorCode = (typeof pushErrorCodes)[number];
|
|
141
|
+
|
|
142
|
+
export const controllerMcpPushMethods = [
|
|
143
|
+
'agl.mcp.push.status',
|
|
144
|
+
'agl.mcp.push.apns.set',
|
|
145
|
+
'agl.mcp.push.apns.unset',
|
|
146
|
+
'agl.mcp.push.fcm.set',
|
|
147
|
+
'agl.mcp.push.fcm.unset',
|
|
148
|
+
'agl.mcp.push.previews',
|
|
149
|
+
'agl.mcp.push.test',
|
|
150
|
+
] as const satisfies readonly `agl.mcp.push.${TPushOperation}`[];
|
|
151
|
+
export type TControllerMcpPushMethod = (typeof controllerMcpPushMethods)[number];
|
|
152
|
+
export type TControllerMcpPushRequest<TOperation extends TPushOperation> = {
|
|
153
|
+
method: `agl.mcp.push.${TOperation}`;
|
|
154
|
+
request: IPushOperations[TOperation]['request'] & { ownerToken: string };
|
|
155
|
+
response: IPushOperations[TOperation]['response'];
|
|
156
|
+
} & plugins.typedrequestInterfaces.ITypedRequest;
|
|
157
|
+
export type TControllerMcpPushTypedRequest = { [TOperation in TPushOperation]: TControllerMcpPushRequest<TOperation> }[TPushOperation];
|
|
158
|
+
|
|
159
|
+
/** The operation a private push method names. */
|
|
160
|
+
export const pushOperationOf = (methodArg: TControllerMcpPushMethod): TPushOperation => (
|
|
161
|
+
methodArg.slice('agl.mcp.push.'.length) as TPushOperation
|
|
162
|
+
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type * as plugins from './plugins.js';
|
|
2
2
|
import type {
|
|
3
3
|
ITicket, ITicketAnswer, ITicketAsk, ITicketBoard, ITicketChanges, ITicketComment, ITicketCreate,
|
|
4
|
-
ITicketDetail, ITicketFilters, ITicketGet, ITicketMove, ITicketQuestion, TTicketLink, TTicketOperation, TTicketReferenceContent, TTicketRequest,
|
|
4
|
+
ITicketDetail, ITicketFilters, ITicketGet, ITicketMove, ITicketOverview, ITicketOverviewRequest, ITicketPageRequest, TTicketPage, ITicketQuestion, TTicketLink, TTicketOperation, TTicketReferenceContent, TTicketRequest,
|
|
5
5
|
TTicketResponse,
|
|
6
6
|
} from './tickets.js';
|
|
7
7
|
|
|
8
8
|
export const controllerMcpTicketMethods = [
|
|
9
|
-
'agl.mcp.ticket.list', 'agl.mcp.ticket.board', 'agl.mcp.ticket.search', 'agl.mcp.ticket.get',
|
|
9
|
+
'agl.mcp.ticket.list', 'agl.mcp.ticket.page', 'agl.mcp.ticket.overview', 'agl.mcp.ticket.board', 'agl.mcp.ticket.search', 'agl.mcp.ticket.get',
|
|
10
10
|
'agl.mcp.ticket.comments', 'agl.mcp.ticket.create', 'agl.mcp.ticket.update',
|
|
11
11
|
'agl.mcp.ticket.move', 'agl.mcp.ticket.comment', 'agl.mcp.ticket.link', 'agl.mcp.ticket.unlink',
|
|
12
12
|
'agl.mcp.ticket.ask', 'agl.mcp.ticket.answer',
|
|
@@ -45,6 +45,34 @@ export interface IReq_ControllerMcpTicketList extends plugins.typedrequestInterf
|
|
|
45
45
|
request: ITicketFilters & { ownerToken?: string };
|
|
46
46
|
response: { tickets: ITicket[] };
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Lists the board in pages of `limit` tickets (1 to 200, default 50, within 256 KiB), as summaries without
|
|
50
|
+
* description and source words unless `view` is `full`. Beyond the filters of the whole listing it narrows by
|
|
51
|
+
* `statuses`, `open`, `kind`, `priorities`, `parent` (direct children), `assignee` (a person or session id),
|
|
52
|
+
* `unassigned`, `keys` and `updatedSince`, and sorts by `board`, `updated`, `created` or `priority`. `total` and
|
|
53
|
+
* `columns` count everything the filters match. `nextCursor` continues with the same filters, sort and view;
|
|
54
|
+
* `moved` tells that the board changed since the first page.
|
|
55
|
+
*/
|
|
56
|
+
export interface IReq_ControllerMcpTicketPage extends plugins.typedrequestInterfaces.implementsTR<
|
|
57
|
+
TControllerMcpTicketRequest<'page'>, IReq_ControllerMcpTicketPage
|
|
58
|
+
> {
|
|
59
|
+
method: 'agl.mcp.ticket.page';
|
|
60
|
+
request: ITicketPageRequest & { ownerToken?: string };
|
|
61
|
+
response: TTicketPage;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reads the board at a glance without any ticket's texts: counts by column, priority, AutoLabel, project and
|
|
65
|
+
* assignee, each open epic's progress, the tickets that need someone (urgent, needs input, open questions,
|
|
66
|
+
* review, ready without an assignee, stale) and the tickets changed last. Lists hold at most `limit` tickets and
|
|
67
|
+
* carry the count of all they stand for.
|
|
68
|
+
*/
|
|
69
|
+
export interface IReq_ControllerMcpTicketOverview extends plugins.typedrequestInterfaces.implementsTR<
|
|
70
|
+
TControllerMcpTicketRequest<'overview'>, IReq_ControllerMcpTicketOverview
|
|
71
|
+
> {
|
|
72
|
+
method: 'agl.mcp.ticket.overview';
|
|
73
|
+
request: ITicketOverviewRequest & { ownerToken?: string };
|
|
74
|
+
response: ITicketOverview;
|
|
75
|
+
}
|
|
48
76
|
/** Reads the board: its columns, the tickets the filters match, and the caller as `viewer`. */
|
|
49
77
|
export interface IReq_ControllerMcpTicketBoard extends plugins.typedrequestInterfaces.implementsTR<
|
|
50
78
|
TControllerMcpTicketRequest<'board'>, IReq_ControllerMcpTicketBoard
|
|
@@ -179,6 +207,8 @@ export interface IReq_ControllerMcpTicketAnswer extends plugins.typedrequestInte
|
|
|
179
207
|
}
|
|
180
208
|
export type TControllerMcpTicketTypedRequest =
|
|
181
209
|
| IReq_ControllerMcpTicketList
|
|
210
|
+
| IReq_ControllerMcpTicketPage
|
|
211
|
+
| IReq_ControllerMcpTicketOverview
|
|
182
212
|
| IReq_ControllerMcpTicketBoard
|
|
183
213
|
| IReq_ControllerMcpTicketSearch
|
|
184
214
|
| IReq_ControllerMcpTicketGet
|
package/ts_interfaces/tickets.ts
CHANGED
|
@@ -6,7 +6,8 @@ export type TTicketColumn = (typeof ticketColumns)[number];
|
|
|
6
6
|
/** The columns of finished work; the board folds them. */
|
|
7
7
|
export const ticketDoneColumns: readonly TTicketColumn[] = ['released', 'closed'];
|
|
8
8
|
export type TTicketKind = 'epic' | 'task' | 'subtask';
|
|
9
|
-
export
|
|
9
|
+
export const ticketPriorities = ['urgent', 'high', 'normal', 'low', 'none'] as const;
|
|
10
|
+
export type TTicketPriority = (typeof ticketPriorities)[number];
|
|
10
11
|
export interface ITicketPerson {
|
|
11
12
|
id: string;
|
|
12
13
|
name: string;
|
|
@@ -221,6 +222,127 @@ export interface ITicketFilters {
|
|
|
221
222
|
label?: string;
|
|
222
223
|
text?: string;
|
|
223
224
|
}
|
|
225
|
+
/** How a page sorts: the board's own order, newest change first, newest ticket first, or urgent first and then the board's order. */
|
|
226
|
+
export const ticketPageSorts = ['board', 'updated', 'created', 'priority'] as const;
|
|
227
|
+
export type TTicketPageSort = (typeof ticketPageSorts)[number];
|
|
228
|
+
/**
|
|
229
|
+
* How many tickets one page returns unless it names `limit`, the most it may name, and the bytes a page holds at most
|
|
230
|
+
* (its tickets serialized; a page holds at least one ticket). The budget wins over `limit`.
|
|
231
|
+
*/
|
|
232
|
+
export const ticketListPage = { default: 50, maximum: 200, bytes: 256 * 1024 } as const;
|
|
233
|
+
/**
|
|
234
|
+
* One page of the board. Beyond a listing's filters it narrows by several columns (`statuses`), by open work (`open`:
|
|
235
|
+
* true leaves out released and closed tickets, false keeps only those), kind, priorities, a parent's direct children,
|
|
236
|
+
* an assignee (a person id or a session id), tickets without one, named keys and a time of last change.
|
|
237
|
+
*/
|
|
238
|
+
export interface ITicketPageRequest extends ITicketFilters {
|
|
239
|
+
statuses?: TTicketColumn[];
|
|
240
|
+
open?: boolean;
|
|
241
|
+
kind?: TTicketKind;
|
|
242
|
+
priorities?: TTicketPriority[];
|
|
243
|
+
/** A ticket key: its direct children, as the board's epic filter matches them. */
|
|
244
|
+
parent?: string;
|
|
245
|
+
/** A person id or a session id (`harness:nativeId`), as a ticket's assignee holds them; never a display name. */
|
|
246
|
+
assignee?: string;
|
|
247
|
+
unassigned?: boolean;
|
|
248
|
+
/** Up to 200 keys: reads those tickets in one call. */
|
|
249
|
+
keys?: string[];
|
|
250
|
+
/** An ISO 8601 instant: tickets changed at or after it. */
|
|
251
|
+
updatedSince?: string;
|
|
252
|
+
/** `board` when absent. */
|
|
253
|
+
sort?: TTicketPageSort;
|
|
254
|
+
/** `summary` (a ticket without its texts) when absent; `full` returns whole tickets. */
|
|
255
|
+
view?: 'summary' | 'full';
|
|
256
|
+
/** Tickets on the page, 1 to 200 (`ticketListPage.maximum`); 50 when absent. */
|
|
257
|
+
limit?: number;
|
|
258
|
+
/** A page's `nextCursor`, with the same filters, sort and view. */
|
|
259
|
+
cursor?: string;
|
|
260
|
+
}
|
|
261
|
+
/** A ticket without its description, source words and link details. Empty fields are left out. */
|
|
262
|
+
export interface ITicketSummary {
|
|
263
|
+
key: string;
|
|
264
|
+
revision: number;
|
|
265
|
+
project: string;
|
|
266
|
+
kind: TTicketKind;
|
|
267
|
+
title: string;
|
|
268
|
+
columnId: TTicketColumn;
|
|
269
|
+
priority: TTicketPriority;
|
|
270
|
+
updatedAt: string;
|
|
271
|
+
assignee?: Pick<ITicketPerson, 'id' | 'name' | 'sessionId'>;
|
|
272
|
+
parentId?: string;
|
|
273
|
+
labels?: string[];
|
|
274
|
+
autoLabels?: TTicketAutoLabel[];
|
|
275
|
+
/** How many links of each kind the ticket holds. */
|
|
276
|
+
links?: Partial<Record<TTicketLink['kind'], number>>;
|
|
277
|
+
releasePlan?: ITicketReleasePlan;
|
|
278
|
+
deployPlan?: ITicketDeployPlanInput;
|
|
279
|
+
maintenanceWindow?: Pick<ITicketMaintenanceWindow, 'from' | 'to' | 'targets'>;
|
|
280
|
+
/** Unanswered questions on the ticket. */
|
|
281
|
+
openQuestions?: number;
|
|
282
|
+
}
|
|
283
|
+
interface ITicketPageBase {
|
|
284
|
+
/** How many tickets the filters match, on every page. */
|
|
285
|
+
total: number;
|
|
286
|
+
/** How many of them each column holds; a column without any is left out. */
|
|
287
|
+
columns: Partial<Record<TTicketColumn, number>>;
|
|
288
|
+
/** The board revision this page was read at. */
|
|
289
|
+
revision: number;
|
|
290
|
+
/** Present while more tickets follow: pass it as `cursor` with the same filters, sort and view. */
|
|
291
|
+
nextCursor?: string;
|
|
292
|
+
/**
|
|
293
|
+
* The board changed since the first page of this cursor. A page continues after the last ticket shown as the board
|
|
294
|
+
* stands now, so a ticket that changed its place meanwhile may be missing or shown twice; list again for an exact reading.
|
|
295
|
+
*/
|
|
296
|
+
moved?: true;
|
|
297
|
+
}
|
|
298
|
+
export type TTicketPage = (ITicketPageBase & { view: 'summary'; tickets: ITicketSummary[] })
|
|
299
|
+
| (ITicketPageBase & { view: 'full'; tickets: ITicket[] });
|
|
300
|
+
/** The overview's defaults: tickets per list, the days after which active work counts as stale, and the most projects, assignees and epics listed. */
|
|
301
|
+
export const ticketOverviewDefaults = { limit: 5, maximumLimit: 50, staleDays: 3, groups: 50 } as const;
|
|
302
|
+
export interface ITicketOverviewRequest {
|
|
303
|
+
/** Only this project's tickets. */
|
|
304
|
+
project?: string;
|
|
305
|
+
/** Only the tickets assigned to the caller's verified session. */
|
|
306
|
+
mine?: boolean;
|
|
307
|
+
/** Tickets per list, 1 to 50; 5 when absent. */
|
|
308
|
+
limit?: number;
|
|
309
|
+
/** Days without a change after which in_progress, needs_input and review work counts as stale, 1 to 365; 3 when absent. */
|
|
310
|
+
staleDays?: number;
|
|
311
|
+
}
|
|
312
|
+
/** Some tickets of a kind and how many there are in all. */
|
|
313
|
+
export interface ITicketOverviewGroup { total: number; tickets: ITicketSummary[] }
|
|
314
|
+
/** The board at a glance, without any ticket's texts; see `ticketOverview`. */
|
|
315
|
+
export interface ITicketOverview {
|
|
316
|
+
revision: number;
|
|
317
|
+
total: number;
|
|
318
|
+
/** Tickets that are neither released nor closed. */
|
|
319
|
+
open: number;
|
|
320
|
+
columns: Record<TTicketColumn, number>;
|
|
321
|
+
/** Open tickets by priority. */
|
|
322
|
+
priorities: Record<TTicketPriority, number>;
|
|
323
|
+
autoLabels: Record<TTicketAutoLabel, number>;
|
|
324
|
+
/** Most open work first; `projectsTotal` counts all. */
|
|
325
|
+
projects: { project: string; total: number; open: number; columns: Partial<Record<TTicketColumn, number>> }[];
|
|
326
|
+
projectsTotal: number;
|
|
327
|
+
/** Who holds open tickets, most first; `assigneesTotal` counts all. */
|
|
328
|
+
assignees: (Pick<ITicketPerson, 'id' | 'name' | 'sessionId'> & { open: number; columns: Partial<Record<TTicketColumn, number>> })[];
|
|
329
|
+
assigneesTotal: number;
|
|
330
|
+
unassignedOpen: number;
|
|
331
|
+
/** Open epics with their direct children: how many, how many done, and where they stand; `epicsTotal` counts all. */
|
|
332
|
+
epics: { key: string; title: string; project: string; columnId: TTicketColumn; children: number; done: number;
|
|
333
|
+
columns: Partial<Record<TTicketColumn, number>> }[];
|
|
334
|
+
epicsTotal: number;
|
|
335
|
+
attention: {
|
|
336
|
+
urgent: ITicketOverviewGroup;
|
|
337
|
+
needsInput: ITicketOverviewGroup;
|
|
338
|
+
openQuestions: ITicketOverviewGroup;
|
|
339
|
+
review: ITicketOverviewGroup;
|
|
340
|
+
unassignedReady: ITicketOverviewGroup;
|
|
341
|
+
stale: ITicketOverviewGroup;
|
|
342
|
+
};
|
|
343
|
+
/** The tickets changed last, newest first. */
|
|
344
|
+
recent: ITicketSummary[];
|
|
345
|
+
}
|
|
224
346
|
export interface ITicketChanges {
|
|
225
347
|
title?: string;
|
|
226
348
|
description?: string;
|
|
@@ -297,6 +419,9 @@ export interface ITicketBoard {
|
|
|
297
419
|
}
|
|
298
420
|
export interface ITicketOperations {
|
|
299
421
|
list: { request: ITicketFilters; response: { tickets: ITicket[] } };
|
|
422
|
+
/** `list` in pages, as summaries unless `view` is `full`, with further filters and a sort. */
|
|
423
|
+
page: { request: ITicketPageRequest; response: TTicketPage };
|
|
424
|
+
overview: { request: ITicketOverviewRequest; response: ITicketOverview };
|
|
300
425
|
board: { request: ITicketFilters; response: ITicketBoard };
|
|
301
426
|
search: { request: { query: string; label?: string }; response: { tickets: ITicket[] } };
|
|
302
427
|
get: { request: ITicketGet; response: ITicketDetail };
|
|
@@ -370,6 +495,14 @@ export const ticketErrorMessages = {
|
|
|
370
495
|
ticket_question_answered: 'The question already has a different answer; a second answer is refused. Ask a new question instead.',
|
|
371
496
|
ticket_answer_invalid: 'An answer chooses existing option ids (one unless multiSelect) and/or gives free text where the question allows it.',
|
|
372
497
|
} as const;
|
|
373
|
-
|
|
374
|
-
|
|
498
|
+
/**
|
|
499
|
+
* What a page refuses about its cursor. Kept apart from `ticketErrorMessages`, which the device contract lists code by
|
|
500
|
+
* code: a device pages nothing, and is answered `invalid_request` should it ever meet one.
|
|
501
|
+
*/
|
|
502
|
+
export const ticketPageErrorMessages = {
|
|
503
|
+
ticket_cursor_invalid: 'The cursor is not the nextCursor of a ticket page; list again without cursor.',
|
|
504
|
+
ticket_cursor_mismatch: 'The cursor pages other filters, another sort or another view; repeat those or list again without cursor.',
|
|
505
|
+
} as const;
|
|
506
|
+
export type TTicketClientErrorCode = Uppercase<keyof typeof ticketErrorMessages | keyof typeof ticketPageErrorMessages>;
|
|
507
|
+
export const ticketClientErrorMessages = Object.fromEntries(Object.entries({ ...ticketErrorMessages, ...ticketPageErrorMessages })
|
|
375
508
|
.map(([codeArg, messageArg]) => [codeArg.toUpperCase(), messageArg])) as Record<TTicketClientErrorCode, string>;
|