@spotto/contract 1.0.70-alpha.41 → 1.0.70-alpha.43

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 (74) hide show
  1. package/dist/assets/[id]/get.d.ts +7 -1
  2. package/dist/events/constants.d.ts +2 -1
  3. package/dist/events/constants.js.map +1 -1
  4. package/dist/events/get/response.d.ts +4 -2
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/manifests/[id]/delete.d.ts +9 -0
  9. package/dist/manifests/[id]/delete.js +3 -0
  10. package/dist/manifests/[id]/delete.js.map +1 -0
  11. package/dist/manifests/[id]/get.d.ts +22 -0
  12. package/dist/manifests/[id]/get.js.map +1 -1
  13. package/dist/manifests/[id]/index.d.ts +1 -0
  14. package/dist/manifests/[id]/index.js +1 -0
  15. package/dist/manifests/[id]/index.js.map +1 -1
  16. package/dist/manifests/[id]/patch/request.d.ts +7 -0
  17. package/dist/manifests/[id]/patch/request.js.map +1 -1
  18. package/dist/manifests/formItems.d.ts +62 -0
  19. package/dist/manifests/formItems.js +3 -0
  20. package/dist/manifests/formItems.js.map +1 -0
  21. package/dist/manifests/index.d.ts +2 -0
  22. package/dist/manifests/index.js +2 -0
  23. package/dist/manifests/index.js.map +1 -1
  24. package/dist/manifests/post/request.d.ts +6 -0
  25. package/dist/manifests/post/request.js.map +1 -1
  26. package/dist/manifests/rules.d.ts +131 -0
  27. package/dist/manifests/rules.js +3 -0
  28. package/dist/manifests/rules.js.map +1 -0
  29. package/dist/organisations/constants.d.ts +15 -0
  30. package/dist/organisations/constants.js.map +1 -1
  31. package/dist/shared/readiness.d.ts +42 -0
  32. package/dist/snapshots/[id]/get.d.ts +50 -1
  33. package/dist/snapshots/[id]/get.js.map +1 -1
  34. package/dist/snapshots/post/request.d.ts +48 -0
  35. package/dist/snapshots/post/request.js.map +1 -1
  36. package/dist/snapshots/post/response.d.ts +21 -1
  37. package/dist/submissions/post/request.d.ts +7 -0
  38. package/dist/submissions/post/response.d.ts +8 -0
  39. package/dist/submissions/shared.d.ts +2 -0
  40. package/dist/tasks/[id]/index.d.ts +39 -0
  41. package/dist/tasks/[id]/index.js +3 -0
  42. package/dist/tasks/[id]/index.js.map +1 -0
  43. package/dist/tasks/access.d.ts +27 -0
  44. package/dist/tasks/access.js +3 -0
  45. package/dist/tasks/access.js.map +1 -0
  46. package/dist/tasks/get.d.ts +39 -0
  47. package/dist/tasks/get.js +5 -0
  48. package/dist/tasks/get.js.map +1 -0
  49. package/dist/tasks/index.d.ts +6 -0
  50. package/dist/tasks/index.js +23 -0
  51. package/dist/tasks/index.js.map +1 -0
  52. package/dist/tasks/post.d.ts +47 -0
  53. package/dist/tasks/post.js +3 -0
  54. package/dist/tasks/post.js.map +1 -0
  55. package/dist/tasks/settlement.d.ts +59 -0
  56. package/dist/tasks/settlement.js +18 -0
  57. package/dist/tasks/settlement.js.map +1 -0
  58. package/dist/tasks/shared.d.ts +219 -0
  59. package/dist/tasks/shared.js +36 -0
  60. package/dist/tasks/shared.js.map +1 -0
  61. package/dist/tasktemplates/index.d.ts +82 -0
  62. package/dist/tasktemplates/index.js +3 -0
  63. package/dist/tasktemplates/index.js.map +1 -0
  64. package/dist/users/current.d.ts +7 -0
  65. package/dist/workflows/index.d.ts +2 -44
  66. package/dist/workflows/index.js +16 -0
  67. package/dist/workflows/index.js.map +1 -1
  68. package/dist/workflows/legacy.d.ts +60 -0
  69. package/dist/workflows/legacy.js +3 -0
  70. package/dist/workflows/legacy.js.map +1 -0
  71. package/dist/workflows/workflow.d.ts +398 -0
  72. package/dist/workflows/workflow.js +69 -0
  73. package/dist/workflows/workflow.js.map +1 -0
  74. package/package.json +2 -2
@@ -4,6 +4,16 @@ import { GetManifestResponse } from '../../manifests';
4
4
  import { IEmbeddedEntity } from '../../shared/embed';
5
5
  import { GetTypeResponse } from '../../types';
6
6
  import { SnapshotTypeEnum } from '../get';
7
+ import { ISubmissionAttachment, ISubmissionFieldValue } from '../../submissions/shared';
8
+ /**
9
+ * One answer of a manifest check: the name of the field item it answers and
10
+ * one value slot, as a form submission sends its values. `id`, the field's
11
+ * id, may be sent beside the name; it is tested against it, and the stored
12
+ * answer always carries both.
13
+ */
14
+ export declare type ISnapshotAnswer = Omit<ISubmissionFieldValue, 'id' | 'computed'> & {
15
+ id?: string;
16
+ };
7
17
  export interface PostSnapshotRequest {
8
18
  reader?: IEmbeddedEntity;
9
19
  location?: IEmbeddedEntity & {
@@ -47,6 +57,44 @@ export interface PostSnapshotRequest {
47
57
  * subtree travels with them. Audited in `membershipSync.severed`.
48
58
  */
49
59
  updateGroupMembership?: boolean;
60
+ /**
61
+ * A ULID the client mints for this snapshot, unique within the organisation.
62
+ * A request that repeats one writes nothing and returns the snapshot stored
63
+ * the first time, marked `replayed: true` — what makes it safe for an
64
+ * offline client to send a queued snapshot again. A reference that arrives
65
+ * with a different snapshot, or from a different user, is refused with a
66
+ * 409.
67
+ */
68
+ clientReference?: string;
69
+ /**
70
+ * The task this check or stocktake was taken for. The snapshot is saved
71
+ * whatever the task's state, and the item's `task` block in the response
72
+ * says what happened to it. A snapshot sent without one still completes
73
+ * the open task it is the work of.
74
+ */
75
+ taskId?: string;
76
+ /**
77
+ * The answers to the form items of the manifest copy this check embeds:
78
+ * one entry per answered INPUT field item, name-keyed, one value slot each
79
+ * (a CHECKBOXES field sends one entry per ticked option; an unanswered
80
+ * optional field sends none). Values for COMPUTED and CONTEXT items, and for
81
+ * names the copy does not ask, are ignored: the server derives the first
82
+ * two itself.
83
+ *
84
+ * A client that asks form items ALWAYS sends this key, as `[]` when nothing
85
+ * was answered. Leaving the key out is how a client that predates form
86
+ * items is told apart: its check is recorded without answers.
87
+ */
88
+ fieldValues?: ISnapshotAnswer[];
89
+ /** The files captured for the copy's signature and photo blocks, one per
90
+ * block, uploaded ahead of the request. */
91
+ attachments?: ISubmissionAttachment[];
92
+ /**
93
+ * Ignored. A client that evaluates the copy's rules for its own screen may
94
+ * send what it found; the server evaluates them itself and stores only its
95
+ * own results (`GetSnapshotResponse['ruleResults']`).
96
+ */
97
+ ruleResults?: unknown;
50
98
  }
51
99
  export declare type PostSnapshotsRequest = PostSnapshotRequest[];
52
100
  export declare const testPostSnapshotRequest1: PostSnapshotRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/snapshots/post/request.ts"],"names":[],"mappings":";;;AAyDA,SAAS;AACI,QAAA,wBAAwB,GAAwB;IAC3D,MAAM,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5D,QAAQ,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,YAAY,EAAE;IAChE,cAAc,EAAE;QACd;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,8BAA8B;YACzC,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,uBAAuB;YACjC,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,eAAe;YAC1B,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,2BAA2B;YACpC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,iBAAiB;SAC5B;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;IACD,SAAS,EAAE,aAAa;CACzB,CAAA;AAEY,QAAA,wBAAwB,GAAwB;IAC3D,MAAM,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5D,QAAQ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C1B;QACD;YACE,OAAO,EAAE,2BAA2B;YACpC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,YAAY;SACvB;KACF;IACD,aAAa,EAAE;QACb;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,gBAAgB;SAC1B;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;IACD,SAAS,EAAE,aAAa;CACzB,CAAA"}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/snapshots/post/request.ts"],"names":[],"mappings":";;;AA6GA,SAAS;AACI,QAAA,wBAAwB,GAAwB;IAC3D,MAAM,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5D,QAAQ,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE,IAAI,EAAE,YAAY,EAAE;IAChE,cAAc,EAAE;QACd;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,8BAA8B;YACzC,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,uBAAuB;YACjC,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,eAAe;YAC1B,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,iBAAiB;SAC5B;QACD;YACE,OAAO,EAAE,2BAA2B;YACpC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,iB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,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,gBAAgB;SAC1B;QACD;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,gBAAgB;SAC1B;QACD;YACE,OAAO,EAAE,2BAA2B;YACpC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,YAAY;SACvB;KACF;IACD,aAAa,EAAE;QACb;YACE,OAAO,EAAE,0BAA0B;YACnC,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,gBAAgB;SAC1B;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;KACV;IACD,SAAS,EAAE,aAAa;CACzB,CAAA"}
@@ -1,5 +1,25 @@
1
+ import { TaskSettlement } from '../../tasks/settlement';
1
2
  import { GetSnapshotResponse } from '../[id]/get';
3
+ export interface PostSnapshotsResponseItem extends GetSnapshotResponse {
4
+ /**
5
+ * What the snapshot did to tasks: the one it named, and any other open
6
+ * task on the target it was the work of. Present when the organisation has
7
+ * tasks switched on and the snapshot named a task or completed one. On a
8
+ * replayed item it reports the tasks as they stand, and completes nothing
9
+ * again.
10
+ */
11
+ task?: TaskSettlement;
12
+ /**
13
+ * Present, and true, when the request repeated a `clientReference` and this
14
+ * is the snapshot stored the first time. Nothing was written for it: the
15
+ * item is frozen as it was recorded, its `asset.c_readiness` and
16
+ * `c_satisfiesManifest` included, so read the asset again for its state
17
+ * now. Absent on a snapshot this request created.
18
+ */
19
+ replayed?: boolean;
20
+ }
2
21
  export interface PostSnapshotsResponse {
22
+ /** How many snapshots this request created — a replayed item is not counted. */
3
23
  inserted: number;
4
- items: GetSnapshotResponse[];
24
+ items: PostSnapshotsResponseItem[];
5
25
  }
@@ -14,4 +14,11 @@ export interface PostSubmissionRequest {
14
14
  capturedAt: string;
15
15
  fieldValues?: ISubmissionFieldValue[];
16
16
  attachments?: ISubmissionAttachment[];
17
+ /**
18
+ * The task this capture was made for. The capture is saved whatever the
19
+ * task's state, and the response's `task` block says what happened to it.
20
+ * A capture sent without one still completes the open task it is the work
21
+ * of.
22
+ */
23
+ taskId?: string;
17
24
  }
@@ -1,4 +1,5 @@
1
1
  import { GetAssetResponse } from '../../assets';
2
+ import { TaskSettlement } from '../../tasks/settlement';
2
3
  import { GetSubmissionResponse, ISubmissionEffect } from '../shared';
3
4
  /**
4
5
  * Delivery status of one effect on a fresh submit (§4.2): a raiseAlert entry
@@ -19,4 +20,11 @@ export interface PostSubmissionResponse extends GetSubmissionResponse {
19
20
  /** Fresh target readiness after recompute; absent when the target has gone. */
20
21
  readiness?: GetAssetResponse['readiness'];
21
22
  effects?: PostSubmissionResponseEffect[];
23
+ /**
24
+ * What the capture did to tasks: the one it named, and any other open task
25
+ * on the target it was the work of. Present when the organisation has tasks
26
+ * switched on and the capture named a task or completed one. On a replay it
27
+ * reports the tasks as they stand, and completes nothing again.
28
+ */
29
+ task?: TaskSettlement;
22
30
  }
@@ -110,6 +110,8 @@ export interface ISubmissionPayload {
110
110
  attachments?: ISubmissionAttachment[];
111
111
  writeBack?: ISubmissionWriteBackAudit[];
112
112
  effects?: ISubmissionEffect[];
113
+ /** The task the capture was sent to complete, when it named one. */
114
+ taskId?: string;
113
115
  }
114
116
  /** The payload of a FormSubmissionVoided event. */
115
117
  export interface ISubmissionVoidPayload {
@@ -0,0 +1,39 @@
1
+ import { GetTaskResponse, TaskPriority } from '../shared';
2
+ /**
3
+ * PATCH /tasks/{id}: edit a task that is still open. What the task is done
4
+ * on and how it is completed never change: cancel it and raise another.
5
+ * `null` clears a time.
6
+ */
7
+ export interface UpdateTaskRequest {
8
+ title?: string;
9
+ instructions?: string;
10
+ priority?: TaskPriority;
11
+ /** Replaced wholesale. Empty: the task is for everyone. */
12
+ groups?: string[];
13
+ /** Replaced wholesale. */
14
+ requiredPermissions?: string[];
15
+ claimable?: boolean;
16
+ dueAt?: number | null;
17
+ expiresAt?: number | null;
18
+ }
19
+ export declare type UpdateTaskResponse = GetTaskResponse;
20
+ /** POST /tasks/{id}/assign: hand an open task to someone. */
21
+ export interface PostTaskAssignRequest {
22
+ userId: string;
23
+ }
24
+ /** POST /tasks/{id}/cancel. */
25
+ export interface PostTaskCancelRequest {
26
+ reason: string;
27
+ }
28
+ /**
29
+ * POST /tasks/{id}/complete: complete a task from a record already saved.
30
+ * Exactly one of the two, and the record must be the work the task asked
31
+ * for. A record sent with the task's id, or sent on the task's target while
32
+ * the task is open, completes it in the save and never needs this route.
33
+ */
34
+ export interface PostTaskCompleteRequest {
35
+ submissionId?: string;
36
+ snapshotId?: string;
37
+ }
38
+ /** The lifecycle routes each answer with the task as they left it. */
39
+ export declare type PostTaskTransitionResponse = GetTaskResponse;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tasks/[id]/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The caller's standing with tasks, on `GET /users/current`: present when the
3
+ * organisation has tasks switched on, absent when it does not, which the app
4
+ * reads as "show nothing of tasks".
5
+ */
6
+ export interface TaskAccess {
7
+ /** May read the task list (`tasks:view`). */
8
+ canView: boolean;
9
+ /** May take a task from the list (`tasks:claim`). */
10
+ canClaim: boolean;
11
+ /** May raise a one-off task (`tasks:create`). */
12
+ canCreate: boolean;
13
+ /** May hand a task to someone and take one back (`tasks:assign`). */
14
+ canAssign: boolean;
15
+ /** May edit and cancel tasks (`tasks:update`). */
16
+ canUpdate: boolean;
17
+ /**
18
+ * Sees every task of the organisation and may take any that is open, past
19
+ * the checks on seeing and taking one (`tasks:admin`). It stands in for no
20
+ * other permission: handing out, editing and cancelling still need theirs.
21
+ */
22
+ isAdmin: boolean;
23
+ }
24
+ /** The organisation's switch for tasks. Off or absent: every task route refuses. */
25
+ export interface TaskPreferences {
26
+ enabled: boolean;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/tasks/access.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { SortOrders } from '../shared';
2
+ import { GetTaskResponse, TaskEntity, TaskPriority, TaskStatus } from './shared';
3
+ export declare const TASK_SORT_FIELDS: readonly ["due", "priority", "updated", "created"];
4
+ /**
5
+ * `due` (the default) lists the soonest due first, a task with no due time
6
+ * last. `priority` lists the highest first, then the soonest due.
7
+ */
8
+ export declare type TaskSortField = (typeof TASK_SORT_FIELDS)[number];
9
+ export interface GetTasksQuery {
10
+ page?: number;
11
+ limit?: number;
12
+ ids?: string[];
13
+ /**
14
+ * Only what the caller can take now: open, takeable, not past its expiry,
15
+ * and passing every check a claim makes. Excludes `mine` and `status`.
16
+ */
17
+ available?: boolean;
18
+ /** Only the tasks assigned to the caller. With no `status`, the ones still owed. */
19
+ mine?: boolean;
20
+ /** Defaults to the statuses still owed, `OPEN` and `ASSIGNED`. */
21
+ status?: TaskStatus[];
22
+ /** Matches the title, the target's name and the instructions. */
23
+ search?: string;
24
+ /** Only tasks still owed and past their due time. */
25
+ overdue?: boolean;
26
+ priority?: TaskPriority;
27
+ entity?: TaskEntity;
28
+ /** Only the tasks on this asset or location. */
29
+ targetId?: string;
30
+ /** Only the tasks raised from this definition. */
31
+ templateId?: string;
32
+ sort?: TaskSortField;
33
+ sortOrder?: SortOrders;
34
+ }
35
+ export interface GetTasksResponse {
36
+ query: GetTasksQuery | null;
37
+ total: number;
38
+ items: GetTaskResponse[];
39
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TASK_SORT_FIELDS = void 0;
4
+ exports.TASK_SORT_FIELDS = ['due', 'priority', 'updated', 'created'];
5
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tasks/get.ts"],"names":[],"mappings":";;;AAQa,QAAA,gBAAgB,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAU,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './shared';
2
+ export * from './access';
3
+ export * from './get';
4
+ export * from './post';
5
+ export * from './settlement';
6
+ export * from './[id]';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared"), exports);
18
+ __exportStar(require("./access"), exports);
19
+ __exportStar(require("./get"), exports);
20
+ __exportStar(require("./post"), exports);
21
+ __exportStar(require("./settlement"), exports);
22
+ __exportStar(require("./[id]"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,2CAAwB;AACxB,wCAAqB;AACrB,yCAAsB;AACtB,+CAA4B;AAC5B,yCAAsB"}
@@ -0,0 +1,47 @@
1
+ import { GetTaskResponse, TaskCompletionDefinition, TaskEntity, TaskPriority } from './shared';
2
+ /**
3
+ * A one-off task on one target. Either name a definition (`template`), whose
4
+ * work, wording and audience the task takes, or describe the work in full
5
+ * with `title` and `completion`. A field sent beside a definition overrides
6
+ * the definition's for this task alone, except `completion`, which a
7
+ * definition always decides.
8
+ */
9
+ export interface PostTaskRequest {
10
+ /** The name of a task definition. */
11
+ template?: string;
12
+ target: {
13
+ entity: TaskEntity;
14
+ id: string;
15
+ };
16
+ /** Required when no definition is named. */
17
+ title?: string;
18
+ instructions?: string;
19
+ priority?: TaskPriority;
20
+ /** Required when no definition is named, and refused beside one. */
21
+ completion?: TaskCompletionDefinition;
22
+ /** User group ids the task is for. Empty: everyone. */
23
+ groups?: string[];
24
+ /** Permissions a person needs, besides `tasks:claim`, to take the task. */
25
+ requiredPermissions?: string[];
26
+ /** False: the task cannot be taken from the list and must be handed to someone. */
27
+ claimable?: boolean;
28
+ /** When the task falls due, as a time. Excludes `dueInMinutes`. */
29
+ dueAt?: number;
30
+ /** When the task falls due, counted from now. */
31
+ dueInMinutes?: number;
32
+ /** When the task expires, as a time. Excludes `expiresInMinutes`. */
33
+ expiresAt?: number;
34
+ /** When the task expires, counted from now. */
35
+ expiresInMinutes?: number;
36
+ /** Hand the task straight to this user. Needs `tasks:assign`. */
37
+ assignTo?: string;
38
+ /**
39
+ * A key the caller mints so that a request sent twice raises one task. A
40
+ * repeat returns the task raised the first time, with `replayed: true`.
41
+ */
42
+ idempotencyKey?: string;
43
+ }
44
+ export interface PostTaskResponse extends GetTaskResponse {
45
+ /** Present, and true, when the request repeated an `idempotencyKey`. */
46
+ replayed?: boolean;
47
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.js","sourceRoot":"","sources":["../../src/tasks/post.ts"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import { TaskStatus } from './shared';
2
+ /**
3
+ * What saving a form or a check did to tasks: the `task` block of the
4
+ * `POST /submissions` response and of each `POST /snapshots` item. The record
5
+ * is always saved, whatever this says.
6
+ */
7
+ export declare const TASK_SETTLEMENT_OUTCOMES: readonly ["COMPLETED", "ALREADY_COMPLETED", "CANCELLED", "EXPIRED", "NOT_SATISFIED", "NOT_FOUND", "NOT_COMPLETED"];
8
+ /**
9
+ * What happened to the task a record named.
10
+ * - `COMPLETED`: this record completed it.
11
+ * - `ALREADY_COMPLETED`: another record had completed it; `completedBy` says whose.
12
+ * - `CANCELLED`, `EXPIRED`: the task had ended before the record arrived. A
13
+ * task is expired from the instant of its expiry, whether or not anything
14
+ * had marked it so; a record that names one marks it.
15
+ * - `NOT_SATISFIED`: the record is not the work the task asked for; `reason` says why.
16
+ * - `NOT_FOUND`: no task of the organisation has that id.
17
+ * - `NOT_COMPLETED`: on a replay only. The record was stored by an earlier
18
+ * request that did not complete this task, and a replay completes
19
+ * nothing, so the task is still owed. `POST /tasks/{id}/complete`
20
+ * completes it from the stored record.
21
+ */
22
+ export declare type TaskSettlementOutcome = (typeof TASK_SETTLEMENT_OUTCOMES)[number];
23
+ export interface TaskSettlementPerson {
24
+ userId: string;
25
+ userName: string;
26
+ }
27
+ /** The task a record named with `taskId`. */
28
+ export interface NamedTaskSettlement {
29
+ id: string;
30
+ outcome: TaskSettlementOutcome;
31
+ /** The task's status after the save. Absent when the task was not found. */
32
+ status?: TaskStatus;
33
+ title?: string;
34
+ /** A sentence for the person who saved the record. Absent on `COMPLETED`. */
35
+ reason?: string;
36
+ /** On `COMPLETED`: the person the task was assigned to, when that was someone else. */
37
+ wasAssignedTo?: TaskSettlementPerson;
38
+ /** On `ALREADY_COMPLETED`: who completed it, and when. */
39
+ completedBy?: TaskSettlementPerson & {
40
+ at: number;
41
+ };
42
+ }
43
+ /** A task the record completed without naming it, by being the work it asked for. */
44
+ export interface MatchedTaskSettlement {
45
+ id: string;
46
+ title: string;
47
+ templateName?: string;
48
+ /** The person the task was assigned to, when that was someone else. */
49
+ wasAssignedTo?: TaskSettlementPerson;
50
+ }
51
+ export interface TaskSettlement {
52
+ /** Present when the record named a task. */
53
+ named?: NamedTaskSettlement;
54
+ /**
55
+ * The other open tasks on the target that this record completed: the
56
+ * oldest of each definition whose work it is.
57
+ */
58
+ matched: MatchedTaskSettlement[];
59
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TASK_SETTLEMENT_OUTCOMES = void 0;
4
+ /**
5
+ * What saving a form or a check did to tasks: the `task` block of the
6
+ * `POST /submissions` response and of each `POST /snapshots` item. The record
7
+ * is always saved, whatever this says.
8
+ */
9
+ exports.TASK_SETTLEMENT_OUTCOMES = [
10
+ 'COMPLETED',
11
+ 'ALREADY_COMPLETED',
12
+ 'CANCELLED',
13
+ 'EXPIRED',
14
+ 'NOT_SATISFIED',
15
+ 'NOT_FOUND',
16
+ 'NOT_COMPLETED',
17
+ ];
18
+ //# sourceMappingURL=settlement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlement.js","sourceRoot":"","sources":["../../src/tasks/settlement.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AAEU,QAAA,wBAAwB,GAAG;IACtC,WAAW;IACX,mBAAmB;IACnB,WAAW;IACX,SAAS;IACT,eAAe;IACf,WAAW;IACX,eAAe;CACP,CAAA"}