@uidu/client 3.22.0 → 3.23.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 +7 -0
- package/dist/declarations/src/comments.d.ts +47 -0
- package/dist/declarations/src/contracts.d.ts +2 -0
- package/dist/declarations/src/decisions.d.ts +58 -0
- package/dist/declarations/src/generated/index.d.ts +6745 -2112
- package/dist/declarations/src/index.d.ts +9 -3
- package/dist/declarations/src/models.d.ts +28 -1
- package/dist/declarations/src/mutations.d.ts +156 -1
- package/dist/declarations/src/votes.d.ts +114 -0
- package/dist/uidu-client.cjs.dev.js +284 -1
- package/dist/uidu-client.cjs.prod.js +284 -1
- package/dist/uidu-client.esm.js +270 -2
- package/package.json +1 -1
- package/src/comments.ts +44 -0
- package/src/decisions.test.ts +275 -0
- package/src/decisions.ts +135 -0
- package/src/generated/index.ts +1182 -32
- package/src/index.ts +25 -0
- package/src/models.ts +50 -0
- package/src/mutations.ts +72 -0
- package/src/queries/comments/Comments.graphql +65 -0
- package/src/queries/contacts/AddressMutations.graphql +41 -0
- package/src/queries/contacts/EmailAddressMutations.graphql +39 -0
- package/src/queries/contacts/PhoneNumberMutations.graphql +39 -0
- package/src/queries/decisions/DecisionFields.graphql +83 -0
- package/src/queries/decisions/DecisionMutations.graphql +59 -0
- package/src/queries/decisions/DecisionQueries.graphql +32 -0
- package/src/queries/models/ModelFields.graphql +2 -0
- package/src/queries/models/ModelQueries.graphql +33 -0
- package/src/queries/votes/Votes.graphql +60 -0
- package/src/votes.ts +38 -0
package/src/index.ts
CHANGED
|
@@ -98,6 +98,12 @@ export {
|
|
|
98
98
|
createDeal,
|
|
99
99
|
updateDeal,
|
|
100
100
|
createOrganization,
|
|
101
|
+
createAddress,
|
|
102
|
+
updateAddress,
|
|
103
|
+
createEmailAddress,
|
|
104
|
+
updateEmailAddress,
|
|
105
|
+
createPhoneNumber,
|
|
106
|
+
updatePhoneNumber,
|
|
101
107
|
createKbCollection,
|
|
102
108
|
updateKbCollection,
|
|
103
109
|
deleteKbCollection,
|
|
@@ -327,6 +333,23 @@ export {
|
|
|
327
333
|
} from './goals';
|
|
328
334
|
export type { Goal, Timeframe } from './goals';
|
|
329
335
|
|
|
336
|
+
export {
|
|
337
|
+
listDecisions,
|
|
338
|
+
getDecision,
|
|
339
|
+
createDecision,
|
|
340
|
+
answerDecision,
|
|
341
|
+
} from './decisions';
|
|
342
|
+
export type {
|
|
343
|
+
Decision,
|
|
344
|
+
DecisionResponse,
|
|
345
|
+
DecisionResponseType,
|
|
346
|
+
DecisionWithResponses,
|
|
347
|
+
} from './decisions';
|
|
348
|
+
export { listComments, createComment } from './comments';
|
|
349
|
+
export type { Comment } from './comments';
|
|
350
|
+
export { vote, unvote } from './votes';
|
|
351
|
+
export type { Vote } from './votes';
|
|
352
|
+
|
|
330
353
|
export {
|
|
331
354
|
listExpenseReports,
|
|
332
355
|
getExpenseReport,
|
|
@@ -352,6 +375,7 @@ export {
|
|
|
352
375
|
getModel,
|
|
353
376
|
listModelItems,
|
|
354
377
|
getModelItem,
|
|
378
|
+
getModelItemLog,
|
|
355
379
|
createModel,
|
|
356
380
|
updateModel,
|
|
357
381
|
createField,
|
|
@@ -373,5 +397,6 @@ export type {
|
|
|
373
397
|
ModelField,
|
|
374
398
|
ModelFieldOption,
|
|
375
399
|
ModelItem,
|
|
400
|
+
ModelItemLogEvent,
|
|
376
401
|
EnsureModelOptions,
|
|
377
402
|
} from './models';
|
package/src/models.ts
CHANGED
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
type FieldValueAttributes,
|
|
21
21
|
GetModelDocument,
|
|
22
22
|
GetModelItemDocument,
|
|
23
|
+
GetModelItemLogDocument,
|
|
24
|
+
type GetModelItemLogQuery,
|
|
23
25
|
ListAppModelsDocument,
|
|
24
26
|
ListModelItemsDocument,
|
|
25
27
|
type ModelFieldFragment,
|
|
@@ -39,6 +41,7 @@ import {
|
|
|
39
41
|
type UpdateModelMutationVariables,
|
|
40
42
|
} from './generated';
|
|
41
43
|
import { UiduError } from './types';
|
|
44
|
+
import { nodes } from './utils/relay';
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* The data engine a custom app keeps its records in: the Models of its own
|
|
@@ -107,6 +110,53 @@ export async function getModelItem(
|
|
|
107
110
|
return node?.__typename === 'ModelItem' ? node : null;
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
/** One event of a ModelItem's history, as `getModelItemLog` returns it. */
|
|
114
|
+
export type ModelItemLogEvent = NonNullable<
|
|
115
|
+
NonNullable<
|
|
116
|
+
NonNullable<
|
|
117
|
+
Extract<
|
|
118
|
+
NonNullable<GetModelItemLogQuery['node']>,
|
|
119
|
+
{ __typename: 'ModelItem' }
|
|
120
|
+
>['logs']['edges']
|
|
121
|
+
>[number]
|
|
122
|
+
>['node']
|
|
123
|
+
> & {
|
|
124
|
+
/**
|
|
125
|
+
* `data.changes`: each changed Field's GlobalID → `[from, to]`, the raw
|
|
126
|
+
* `content.value` (a select's is the option's GlobalID). The record's own
|
|
127
|
+
* columns that changed are in it too, under their names.
|
|
128
|
+
*/
|
|
129
|
+
changes: Record<string, [unknown, unknown]>;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A ModelItem's history: the events of its own stream, by default only
|
|
134
|
+
* `Database::ModelItem::Updated`, each with who (`currentUser`), when
|
|
135
|
+
* (`timestamp`) and what changed (`changes`). Needs Database::ModelItem::ReadLog
|
|
136
|
+
* in a custom app. Empty when the id is not a ModelItem or can't be seen.
|
|
137
|
+
*/
|
|
138
|
+
export async function getModelItemLog(
|
|
139
|
+
client: UiduClient,
|
|
140
|
+
variables: { id: string; types?: string[]; first?: number; after?: string },
|
|
141
|
+
): Promise<ModelItemLogEvent[]> {
|
|
142
|
+
const { types = ['Database::ModelItem::Updated'], ...rest } = variables;
|
|
143
|
+
const { node } = await client.query(GetModelItemLogDocument, {
|
|
144
|
+
...rest,
|
|
145
|
+
types,
|
|
146
|
+
});
|
|
147
|
+
if (node?.__typename !== 'ModelItem') return [];
|
|
148
|
+
return nodes(node.logs).map((event) => {
|
|
149
|
+
const changes = (event.data as { changes?: unknown } | null)?.changes;
|
|
150
|
+
return {
|
|
151
|
+
...event,
|
|
152
|
+
changes:
|
|
153
|
+
changes && typeof changes === 'object'
|
|
154
|
+
? (changes as Record<string, [unknown, unknown]>)
|
|
155
|
+
: {},
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
110
160
|
// --- writes -----------------------------------------------------------------
|
|
111
161
|
|
|
112
162
|
/**
|
package/src/mutations.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// place; read functions stay in their per-scope domain files.
|
|
6
6
|
import type { UiduClient } from './client';
|
|
7
7
|
import {
|
|
8
|
+
CreateAddressDocument,
|
|
9
|
+
type CreateAddressMutationVariables,
|
|
8
10
|
CreateChannelDocument,
|
|
9
11
|
type CreateChannelMutationVariables,
|
|
10
12
|
CreateChannelKbCollectionDocument,
|
|
@@ -17,6 +19,8 @@ import {
|
|
|
17
19
|
type CreateCompensationMutationVariables,
|
|
18
20
|
CreateDealDocument,
|
|
19
21
|
type CreateDealMutationVariables,
|
|
22
|
+
CreateEmailAddressDocument,
|
|
23
|
+
type CreateEmailAddressMutationVariables,
|
|
20
24
|
CreateEmployeeDocument,
|
|
21
25
|
type CreateEmployeeMutationVariables,
|
|
22
26
|
CreateEmployeeCertificationDocument,
|
|
@@ -35,6 +39,8 @@ import {
|
|
|
35
39
|
type CreateKbCollectionMutationVariables,
|
|
36
40
|
CreateOrganizationDocument,
|
|
37
41
|
type CreateOrganizationMutationVariables,
|
|
42
|
+
CreatePhoneNumberDocument,
|
|
43
|
+
type CreatePhoneNumberMutationVariables,
|
|
38
44
|
CreateTimeClockDocument,
|
|
39
45
|
type CreateTimeClockMutationVariables,
|
|
40
46
|
DeleteCompensationDocument,
|
|
@@ -46,6 +52,8 @@ import {
|
|
|
46
52
|
DiscardRecordDocument,
|
|
47
53
|
type DiscardRecordMutation,
|
|
48
54
|
type DiscardRecordMutationVariables,
|
|
55
|
+
UpdateAddressDocument,
|
|
56
|
+
type UpdateAddressMutationVariables,
|
|
49
57
|
UpdateChannelDocument,
|
|
50
58
|
type UpdateChannelMutationVariables,
|
|
51
59
|
UpdateChannelKbCollectionDocument,
|
|
@@ -58,6 +66,8 @@ import {
|
|
|
58
66
|
type UpdateDealMutationVariables,
|
|
59
67
|
UpdateDonationCampaignDocument,
|
|
60
68
|
type UpdateDonationCampaignMutationVariables,
|
|
69
|
+
UpdateEmailAddressDocument,
|
|
70
|
+
type UpdateEmailAddressMutationVariables,
|
|
61
71
|
UpdateEmployeeDocument,
|
|
62
72
|
type UpdateEmployeeMutationVariables,
|
|
63
73
|
UpdateEmploymentDocument,
|
|
@@ -76,6 +86,8 @@ import {
|
|
|
76
86
|
type UpdateKbCollectionMutationVariables,
|
|
77
87
|
UpdateNoteDocument,
|
|
78
88
|
type UpdateNoteMutationVariables,
|
|
89
|
+
UpdatePhoneNumberDocument,
|
|
90
|
+
type UpdatePhoneNumberMutationVariables,
|
|
79
91
|
UpdateSpaceDocument,
|
|
80
92
|
type UpdateSpaceMutationVariables,
|
|
81
93
|
UpdateStoryDocument,
|
|
@@ -211,6 +223,66 @@ export async function createOrganization(
|
|
|
211
223
|
) {
|
|
212
224
|
return (await c.mutate(CreateOrganizationDocument, v)).createOrganization ?? null;
|
|
213
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Create an address on an addressable record (a Contact or Organization):
|
|
228
|
+
* `{ input: { attributes: { addressableId, address, kind, primary, … } } }`.
|
|
229
|
+
* Returns the payload (with `errors`) or null. The new address is at
|
|
230
|
+
* `address.node`.
|
|
231
|
+
*/
|
|
232
|
+
export async function createAddress(c: UiduClient, v: CreateAddressMutationVariables) {
|
|
233
|
+
return (await c.mutate(CreateAddressDocument, v)).createAddress ?? null;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Update an address: `{ input: { id, attributes } }`. Returns the payload
|
|
237
|
+
* (with `errors`) or null.
|
|
238
|
+
*/
|
|
239
|
+
export async function updateAddress(c: UiduClient, v: UpdateAddressMutationVariables) {
|
|
240
|
+
return (await c.mutate(UpdateAddressDocument, v)).updateAddress ?? null;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Create an email address on an emailable record (a Contact or Organization):
|
|
244
|
+
* `{ input: { attributes: { emailableId, email, kind, primary, … } } }`.
|
|
245
|
+
* Returns the payload (with `errors`) or null. The new email address is at
|
|
246
|
+
* `emailAddress.node`.
|
|
247
|
+
*/
|
|
248
|
+
export async function createEmailAddress(
|
|
249
|
+
c: UiduClient,
|
|
250
|
+
v: CreateEmailAddressMutationVariables,
|
|
251
|
+
) {
|
|
252
|
+
return (await c.mutate(CreateEmailAddressDocument, v)).createEmailAddress ?? null;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Update an email address: `{ input: { id, attributes } }`. Returns the
|
|
256
|
+
* payload (with `errors`) or null.
|
|
257
|
+
*/
|
|
258
|
+
export async function updateEmailAddress(
|
|
259
|
+
c: UiduClient,
|
|
260
|
+
v: UpdateEmailAddressMutationVariables,
|
|
261
|
+
) {
|
|
262
|
+
return (await c.mutate(UpdateEmailAddressDocument, v)).updateEmailAddress ?? null;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Create a phone number on a phoneable record (a Contact or Organization):
|
|
266
|
+
* `{ input: { attributes: { phoneableId, phone, kind, primary, … } } }`.
|
|
267
|
+
* Returns the payload (with `errors`) or null. The new phone number is at
|
|
268
|
+
* `phoneNumber.node`.
|
|
269
|
+
*/
|
|
270
|
+
export async function createPhoneNumber(
|
|
271
|
+
c: UiduClient,
|
|
272
|
+
v: CreatePhoneNumberMutationVariables,
|
|
273
|
+
) {
|
|
274
|
+
return (await c.mutate(CreatePhoneNumberDocument, v)).createPhoneNumber ?? null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Update a phone number: `{ input: { id, attributes } }`. Returns the payload
|
|
278
|
+
* (with `errors`) or null.
|
|
279
|
+
*/
|
|
280
|
+
export async function updatePhoneNumber(
|
|
281
|
+
c: UiduClient,
|
|
282
|
+
v: UpdatePhoneNumberMutationVariables,
|
|
283
|
+
) {
|
|
284
|
+
return (await c.mutate(UpdatePhoneNumberDocument, v)).updatePhoneNumber ?? null;
|
|
285
|
+
}
|
|
214
286
|
|
|
215
287
|
// --- People / HR (employees & employments) ---
|
|
216
288
|
// An Employee is the HR record wrapping a workspace User (`userId`); an
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Comments on any commentable record — for a custom app, one of its ModelItems
|
|
2
|
+
# or Decisions — read through `node(id:)`. Only the fields Comments::Comment::Read
|
|
3
|
+
# lets a session see: no attachments, votes or admin paths.
|
|
4
|
+
|
|
5
|
+
fragment CommentFields on Comment {
|
|
6
|
+
id
|
|
7
|
+
bodyData
|
|
8
|
+
parent {
|
|
9
|
+
id
|
|
10
|
+
}
|
|
11
|
+
createdAt
|
|
12
|
+
updatedAt
|
|
13
|
+
contact {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
avatar
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
query ListComments($commentableId: ID!, $first: Int, $after: String) {
|
|
21
|
+
node(id: $commentableId) {
|
|
22
|
+
__typename
|
|
23
|
+
... on ModelItem {
|
|
24
|
+
id
|
|
25
|
+
comments(first: $first, after: $after) {
|
|
26
|
+
pageInfo {
|
|
27
|
+
hasNextPage
|
|
28
|
+
endCursor
|
|
29
|
+
}
|
|
30
|
+
edges {
|
|
31
|
+
node {
|
|
32
|
+
...CommentFields
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
... on Decision {
|
|
38
|
+
id
|
|
39
|
+
comments(first: $first, after: $after) {
|
|
40
|
+
pageInfo {
|
|
41
|
+
hasNextPage
|
|
42
|
+
endCursor
|
|
43
|
+
}
|
|
44
|
+
edges {
|
|
45
|
+
node {
|
|
46
|
+
...CommentFields
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
mutation CreateComment($input: CreateCommentInput!) {
|
|
55
|
+
createComment(input: $input) {
|
|
56
|
+
comment {
|
|
57
|
+
...CommentFields
|
|
58
|
+
}
|
|
59
|
+
errors {
|
|
60
|
+
key
|
|
61
|
+
name
|
|
62
|
+
type
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
mutation CreateAddress($input: CreateAddressInput!) {
|
|
2
|
+
createAddress(input: $input) {
|
|
3
|
+
address {
|
|
4
|
+
node {
|
|
5
|
+
id
|
|
6
|
+
address
|
|
7
|
+
formattedAddress
|
|
8
|
+
kind
|
|
9
|
+
name
|
|
10
|
+
primary
|
|
11
|
+
placeId
|
|
12
|
+
url
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
errors {
|
|
16
|
+
key
|
|
17
|
+
name
|
|
18
|
+
type
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
mutation UpdateAddress($input: UpdateAddressInput!) {
|
|
24
|
+
updateAddress(input: $input) {
|
|
25
|
+
address {
|
|
26
|
+
id
|
|
27
|
+
address
|
|
28
|
+
formattedAddress
|
|
29
|
+
kind
|
|
30
|
+
name
|
|
31
|
+
primary
|
|
32
|
+
placeId
|
|
33
|
+
url
|
|
34
|
+
}
|
|
35
|
+
errors {
|
|
36
|
+
key
|
|
37
|
+
name
|
|
38
|
+
type
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
mutation CreateEmailAddress($input: CreateEmailAddressInput!) {
|
|
2
|
+
createEmailAddress(input: $input) {
|
|
3
|
+
emailAddress {
|
|
4
|
+
node {
|
|
5
|
+
id
|
|
6
|
+
email
|
|
7
|
+
kind
|
|
8
|
+
name
|
|
9
|
+
primary
|
|
10
|
+
verified
|
|
11
|
+
verifiedAt
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
errors {
|
|
15
|
+
key
|
|
16
|
+
name
|
|
17
|
+
type
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
mutation UpdateEmailAddress($input: UpdateEmailAddressInput!) {
|
|
23
|
+
updateEmailAddress(input: $input) {
|
|
24
|
+
emailAddress {
|
|
25
|
+
id
|
|
26
|
+
email
|
|
27
|
+
kind
|
|
28
|
+
name
|
|
29
|
+
primary
|
|
30
|
+
verified
|
|
31
|
+
verifiedAt
|
|
32
|
+
}
|
|
33
|
+
errors {
|
|
34
|
+
key
|
|
35
|
+
name
|
|
36
|
+
type
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
mutation CreatePhoneNumber($input: CreatePhoneNumberInput!) {
|
|
2
|
+
createPhoneNumber(input: $input) {
|
|
3
|
+
phoneNumber {
|
|
4
|
+
node {
|
|
5
|
+
id
|
|
6
|
+
phone
|
|
7
|
+
kind
|
|
8
|
+
name
|
|
9
|
+
primary
|
|
10
|
+
verified
|
|
11
|
+
verifiedAt
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
errors {
|
|
15
|
+
key
|
|
16
|
+
name
|
|
17
|
+
type
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
mutation UpdatePhoneNumber($input: UpdatePhoneNumberInput!) {
|
|
23
|
+
updatePhoneNumber(input: $input) {
|
|
24
|
+
phoneNumber {
|
|
25
|
+
id
|
|
26
|
+
phone
|
|
27
|
+
kind
|
|
28
|
+
name
|
|
29
|
+
primary
|
|
30
|
+
verified
|
|
31
|
+
verifiedAt
|
|
32
|
+
}
|
|
33
|
+
errors {
|
|
34
|
+
key
|
|
35
|
+
name
|
|
36
|
+
type
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# A decision as a custom app session token may read it (Decisions::Decision::Read
|
|
2
|
+
# in uidu's CustomApps::Permissions): what is proposed, its options, the answers
|
|
3
|
+
# and where it stands. Asking for a field outside that list — members,
|
|
4
|
+
# attachments, relationships, logs — fails the whole query for a session.
|
|
5
|
+
# A responder or owner is a User or a Contact; for anything else (an agent, a
|
|
6
|
+
# workflow run) only `__typename` comes back.
|
|
7
|
+
|
|
8
|
+
fragment DecisionPerson on DecisionResponder {
|
|
9
|
+
__typename
|
|
10
|
+
... on User {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
avatar
|
|
14
|
+
}
|
|
15
|
+
... on Contact {
|
|
16
|
+
id
|
|
17
|
+
name
|
|
18
|
+
avatar
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fragment DecisionResponseFields on DecisionResponse {
|
|
23
|
+
id
|
|
24
|
+
responseType
|
|
25
|
+
value
|
|
26
|
+
reason
|
|
27
|
+
createdAt
|
|
28
|
+
updatedAt
|
|
29
|
+
decisionOption {
|
|
30
|
+
id
|
|
31
|
+
}
|
|
32
|
+
responder {
|
|
33
|
+
...DecisionPerson
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fragment DecisionFields on Decision {
|
|
38
|
+
id
|
|
39
|
+
name
|
|
40
|
+
descriptionData
|
|
41
|
+
kind
|
|
42
|
+
config
|
|
43
|
+
aasmState
|
|
44
|
+
isAnonymous
|
|
45
|
+
multiSelect
|
|
46
|
+
answerable
|
|
47
|
+
closesAt
|
|
48
|
+
closedAt
|
|
49
|
+
outcomeData
|
|
50
|
+
participantCount
|
|
51
|
+
responseCount
|
|
52
|
+
consensusLevel
|
|
53
|
+
results
|
|
54
|
+
createdAt
|
|
55
|
+
updatedAt
|
|
56
|
+
owner {
|
|
57
|
+
__typename
|
|
58
|
+
... on User {
|
|
59
|
+
id
|
|
60
|
+
name
|
|
61
|
+
avatar
|
|
62
|
+
}
|
|
63
|
+
... on Contact {
|
|
64
|
+
id
|
|
65
|
+
name
|
|
66
|
+
avatar
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
myResponse {
|
|
70
|
+
...DecisionResponseFields
|
|
71
|
+
}
|
|
72
|
+
decisionOptions {
|
|
73
|
+
edges {
|
|
74
|
+
node {
|
|
75
|
+
id
|
|
76
|
+
name
|
|
77
|
+
descriptionData
|
|
78
|
+
position
|
|
79
|
+
responseCount
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# A custom app may set only workspaceAppId, kind, name and descriptionData on
|
|
2
|
+
# create, and only responseType and reason on an answer (Decisions::Decision::*
|
|
3
|
+
# in uidu's CustomApps::Permissions).
|
|
4
|
+
|
|
5
|
+
mutation CreateDecision($input: CreateDecisionInput!) {
|
|
6
|
+
createDecision(input: $input) {
|
|
7
|
+
decision {
|
|
8
|
+
node {
|
|
9
|
+
...DecisionFields
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
errors {
|
|
13
|
+
key
|
|
14
|
+
name
|
|
15
|
+
type
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
mutation OpenDecision($input: OpenDecisionInput!) {
|
|
21
|
+
openDecision(input: $input) {
|
|
22
|
+
decision {
|
|
23
|
+
...DecisionFields
|
|
24
|
+
}
|
|
25
|
+
errors {
|
|
26
|
+
key
|
|
27
|
+
name
|
|
28
|
+
type
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
mutation CreateDecisionResponse($input: CreateDecisionResponseInput!) {
|
|
34
|
+
createDecisionResponse(input: $input) {
|
|
35
|
+
decisionResponse {
|
|
36
|
+
node {
|
|
37
|
+
...DecisionResponseFields
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
errors {
|
|
41
|
+
key
|
|
42
|
+
name
|
|
43
|
+
type
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
mutation UpdateDecisionResponse($input: UpdateDecisionResponseInput!) {
|
|
49
|
+
updateDecisionResponse(input: $input) {
|
|
50
|
+
decisionResponse {
|
|
51
|
+
...DecisionResponseFields
|
|
52
|
+
}
|
|
53
|
+
errors {
|
|
54
|
+
key
|
|
55
|
+
name
|
|
56
|
+
type
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Under a custom app session uidu narrows `decisions` to the app's own
|
|
2
|
+
# (`workspace_app_id`); with a Bearer it is every decision of the workspace.
|
|
3
|
+
query ListDecisions($params: SearchParams, $first: Int, $after: String) {
|
|
4
|
+
currentWorkspace {
|
|
5
|
+
decisions(params: $params, first: $first, after: $after) {
|
|
6
|
+
pageInfo {
|
|
7
|
+
hasNextPage
|
|
8
|
+
endCursor
|
|
9
|
+
}
|
|
10
|
+
edges {
|
|
11
|
+
node {
|
|
12
|
+
...DecisionFields
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
query GetDecision($id: ID!) {
|
|
20
|
+
currentWorkspace {
|
|
21
|
+
decision(id: $id) {
|
|
22
|
+
...DecisionFields
|
|
23
|
+
decisionResponses {
|
|
24
|
+
edges {
|
|
25
|
+
node {
|
|
26
|
+
...DecisionResponseFields
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -42,3 +42,36 @@ query GetModelItem($id: ID!) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
# The item's history: the events of its own stream (`modelItem_<id>`), by
|
|
47
|
+
# default only `Database::ModelItem::Updated`. `data.changes` maps each changed
|
|
48
|
+
# Field's GlobalID to `[from, to]` (the raw `content.value`; a select's is the
|
|
49
|
+
# option's GlobalID). No `metadata`: a session may not read it.
|
|
50
|
+
query GetModelItemLog($id: ID!, $types: JSON, $first: Int, $after: String) {
|
|
51
|
+
node(id: $id) {
|
|
52
|
+
__typename
|
|
53
|
+
... on ModelItem {
|
|
54
|
+
id
|
|
55
|
+
logs(types: $types, first: $first, after: $after) {
|
|
56
|
+
pageInfo {
|
|
57
|
+
hasNextPage
|
|
58
|
+
endCursor
|
|
59
|
+
}
|
|
60
|
+
edges {
|
|
61
|
+
node {
|
|
62
|
+
id
|
|
63
|
+
type
|
|
64
|
+
data
|
|
65
|
+
timestamp
|
|
66
|
+
createdAt
|
|
67
|
+
currentUser {
|
|
68
|
+
id
|
|
69
|
+
name
|
|
70
|
+
avatar
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# A vote of the session's user on a votable record — for a custom app, one of
|
|
2
|
+
# its ModelItems. Only `voteFlag` and `emoji` may be set (Votes::Vote::Create).
|
|
3
|
+
|
|
4
|
+
fragment VoteFields on Vote {
|
|
5
|
+
id
|
|
6
|
+
voteFlag
|
|
7
|
+
emoji
|
|
8
|
+
mine
|
|
9
|
+
createdAt
|
|
10
|
+
voter {
|
|
11
|
+
__typename
|
|
12
|
+
... on Contact {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
avatar
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
mutation CreateVote($input: CreateVoteInput!) {
|
|
21
|
+
createVote(input: $input) {
|
|
22
|
+
vote {
|
|
23
|
+
node {
|
|
24
|
+
...VoteFields
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
votable {
|
|
28
|
+
__typename
|
|
29
|
+
... on ModelItem {
|
|
30
|
+
id
|
|
31
|
+
votesCount
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
errors {
|
|
35
|
+
key
|
|
36
|
+
name
|
|
37
|
+
type
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
mutation DeleteVote($input: DeleteVoteInput!) {
|
|
43
|
+
deleteVote(input: $input) {
|
|
44
|
+
vote {
|
|
45
|
+
id
|
|
46
|
+
}
|
|
47
|
+
votable {
|
|
48
|
+
__typename
|
|
49
|
+
... on ModelItem {
|
|
50
|
+
id
|
|
51
|
+
votesCount
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
errors {
|
|
55
|
+
key
|
|
56
|
+
name
|
|
57
|
+
type
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|