@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.
@@ -16,7 +16,7 @@ export { createNote } from "./notes.js";
16
16
  export { executeAction } from "./actions.js";
17
17
  export { createBenefit } from "./benefits.js";
18
18
  export { createBenefitEnrollment } from "./benefit-enrollments.js";
19
- export { createCourse, updateCourse, deleteCourse, createForm, updateForm, deleteForm, createContact, deleteContact, createDeal, updateDeal, createOrganization, createKbCollection, updateKbCollection, deleteKbCollection, createKbArticle, updateKbArticle, deleteKbArticle, createChannel, updateChannel, deleteChannel, createChannelKbCollection, updateChannelKbCollection, updateEvent, updateStory, updateDonationCampaign, deleteDonationCampaign, updateTask, deleteTask, updateNote, deleteNote, updateSpace, deleteSpace, createEmployee, updateEmployee, createEmployeeCertification, createEmployment, updateEmployment, deleteEmployment, terminateEmployment, createEmploymentTerm, updateEmploymentTerm, createEmploymentVariationKind, updateEmploymentVariationKind, createCompensation, updateCompensation, deleteCompensation, createTimeClock, } from "./mutations.js";
19
+ export { createCourse, updateCourse, deleteCourse, createForm, updateForm, deleteForm, createContact, deleteContact, createDeal, updateDeal, createOrganization, createAddress, updateAddress, createEmailAddress, updateEmailAddress, createPhoneNumber, updatePhoneNumber, createKbCollection, updateKbCollection, deleteKbCollection, createKbArticle, updateKbArticle, deleteKbArticle, createChannel, updateChannel, deleteChannel, createChannelKbCollection, updateChannelKbCollection, updateEvent, updateStory, updateDonationCampaign, deleteDonationCampaign, updateTask, deleteTask, updateNote, deleteNote, updateSpace, deleteSpace, createEmployee, updateEmployee, createEmployeeCertification, createEmployment, updateEmployment, deleteEmployment, terminateEmployment, createEmploymentTerm, updateEmploymentTerm, createEmploymentVariationKind, updateEmploymentVariationKind, createCompensation, updateCompensation, deleteCompensation, createTimeClock, } from "./mutations.js";
20
20
  export { getForm, listForms, createFormResponse, updateFormResponse, } from "./forms.js";
21
21
  export type { Form } from "./forms.js";
22
22
  export { getChannel, listChannels } from "./help-center.js";
@@ -61,9 +61,15 @@ export { getContact, listContacts, getDeal, listDeals, getOrganization, listOrga
61
61
  export type { Contact, Deal, Organization } from "./contacts.js";
62
62
  export { listGoals, getGoal, listTimeframes, updateGoal, goalValue, toGoalRaw, goalProgress, goalTimeElapsed, isGoalBehind, } from "./goals.js";
63
63
  export type { Goal, Timeframe } from "./goals.js";
64
+ export { listDecisions, getDecision, createDecision, answerDecision, } from "./decisions.js";
65
+ export type { Decision, DecisionResponse, DecisionResponseType, DecisionWithResponses, } from "./decisions.js";
66
+ export { listComments, createComment } from "./comments.js";
67
+ export type { Comment } from "./comments.js";
68
+ export { vote, unvote } from "./votes.js";
69
+ export type { Vote } from "./votes.js";
64
70
  export { listExpenseReports, getExpenseReport, createExpenseReport, updateExpenseReport, createExpense, updateExpense, listAnalyticAccounts, allocateExpense, } from "./expenses.js";
65
71
  export type { ExpenseReport, Expense, AnalyticAccount } from "./expenses.js";
66
72
  export { getKbArticle, listKbArticles, getKbCollection, listKbCollections, } from "./kb.js";
67
73
  export type { KbArticle, KbCollection } from "./kb.js";
68
- export { listModels, getModel, listModelItems, getModelItem, createModel, updateModel, createField, updateField, deleteField, createFieldOption, updateFieldOption, deleteFieldOption, createModelItem, updateModelItem, deleteModelItem, updateFieldValue, deleteFieldValue, toFieldValuesAttributes, ensureModel, } from "./models.js";
69
- export type { Model, ModelField, ModelFieldOption, ModelItem, EnsureModelOptions, } from "./models.js";
74
+ export { listModels, getModel, listModelItems, getModelItem, getModelItemLog, createModel, updateModel, createField, updateField, deleteField, createFieldOption, updateFieldOption, deleteFieldOption, createModelItem, updateModelItem, deleteModelItem, updateFieldValue, deleteFieldValue, toFieldValuesAttributes, ensureModel, } from "./models.js";
75
+ export type { Model, ModelField, ModelFieldOption, ModelItem, ModelItemLogEvent, EnsureModelOptions, } from "./models.js";
@@ -1,5 +1,5 @@
1
1
  import type { UiduClient } from "./client.js";
2
- import { type CreateFieldMutationVariables, type CreateFieldOptionMutationVariables, type CreateModelItemMutationVariables, type CreateModelMutationVariables, type DeleteFieldMutationVariables, type DeleteFieldOptionMutationVariables, type DeleteFieldValueMutationVariables, type DeleteModelItemMutationVariables, type FieldKind, type FieldValueAttributes, type ModelFieldFragment, type ModelFieldOptionFragment, type ModelItemFieldsFragment, type ModelSchemaFragment, type SearchParams, type UpdateFieldMutationVariables, type UpdateFieldOptionMutationVariables, type UpdateFieldValueMutationVariables, type UpdateModelItemMutationVariables, type UpdateModelMutationVariables } from "./generated/index.js";
2
+ import { type CreateFieldMutationVariables, type CreateFieldOptionMutationVariables, type CreateModelItemMutationVariables, type CreateModelMutationVariables, type DeleteFieldMutationVariables, type DeleteFieldOptionMutationVariables, type DeleteFieldValueMutationVariables, type DeleteModelItemMutationVariables, type FieldKind, type FieldValueAttributes, type GetModelItemLogQuery, type ModelFieldFragment, type ModelFieldOptionFragment, type ModelItemFieldsFragment, type ModelSchemaFragment, type SearchParams, type UpdateFieldMutationVariables, type UpdateFieldOptionMutationVariables, type UpdateFieldValueMutationVariables, type UpdateModelItemMutationVariables, type UpdateModelMutationVariables } from "./generated/index.js";
3
3
  /**
4
4
  * The data engine a custom app keeps its records in: the Models of its own
5
5
  * WorkspaceApp, their Fields, and their ModelItems.
@@ -48,6 +48,29 @@ export declare function getModelItem(client: UiduClient, variables: {
48
48
  id: string;
49
49
  };
50
50
  }) | null>;
51
+ /** One event of a ModelItem's history, as `getModelItemLog` returns it. */
52
+ export type ModelItemLogEvent = NonNullable<NonNullable<NonNullable<Extract<NonNullable<GetModelItemLogQuery['node']>, {
53
+ __typename: 'ModelItem';
54
+ }>['logs']['edges']>[number]>['node']> & {
55
+ /**
56
+ * `data.changes`: each changed Field's GlobalID → `[from, to]`, the raw
57
+ * `content.value` (a select's is the option's GlobalID). The record's own
58
+ * columns that changed are in it too, under their names.
59
+ */
60
+ changes: Record<string, [unknown, unknown]>;
61
+ };
62
+ /**
63
+ * A ModelItem's history: the events of its own stream, by default only
64
+ * `Database::ModelItem::Updated`, each with who (`currentUser`), when
65
+ * (`timestamp`) and what changed (`changes`). Needs Database::ModelItem::ReadLog
66
+ * in a custom app. Empty when the id is not a ModelItem or can't be seen.
67
+ */
68
+ export declare function getModelItemLog(client: UiduClient, variables: {
69
+ id: string;
70
+ types?: string[];
71
+ first?: number;
72
+ after?: string;
73
+ }): Promise<ModelItemLogEvent[]>;
51
74
  /**
52
75
  * Create a model in a WorkspaceApp (`attributes.modelableId`, `name`,
53
76
  * `namePlural`). Returns the payload (with `errors`) or null.
@@ -263,6 +286,8 @@ export declare function createModelItem(client: UiduClient, variables: CreateMod
263
286
  id: string;
264
287
  name?: string | null;
265
288
  fieldValuesByShortname?: any | null;
289
+ votesCount: number;
290
+ commentsCount: number;
266
291
  createdAt: any;
267
292
  updatedAt: any;
268
293
  } | null;
@@ -285,6 +310,8 @@ export declare function updateModelItem(client: UiduClient, variables: UpdateMod
285
310
  id: string;
286
311
  name?: string | null;
287
312
  fieldValuesByShortname?: any | null;
313
+ votesCount: number;
314
+ commentsCount: number;
288
315
  createdAt: any;
289
316
  updatedAt: any;
290
317
  } | null;
@@ -1,5 +1,5 @@
1
1
  import type { UiduClient } from "./client.js";
2
- import { type CreateChannelMutationVariables, type CreateChannelKbCollectionMutationVariables, type CreateContactMutationVariables, type CreateCourseMutationVariables, type CreateCompensationMutationVariables, type CreateDealMutationVariables, type CreateEmployeeMutationVariables, type CreateEmployeeCertificationMutationVariables, type CreateEmploymentMutationVariables, type CreateEmploymentTermMutationVariables, type CreateEmploymentVariationKindMutationVariables, type CreateFormMutationVariables, type CreateKbArticleMutationVariables, type CreateKbCollectionMutationVariables, type CreateOrganizationMutationVariables, type CreateTimeClockMutationVariables, type DeleteCompensationMutationVariables, type DeleteDonationCampaignMutationVariables, type DeleteRecordMutation, type DiscardRecordMutation, type DiscardRecordMutationVariables, type UpdateChannelMutationVariables, type UpdateChannelKbCollectionMutationVariables, type UpdateCompensationMutationVariables, type UpdateCourseMutationVariables, type UpdateDealMutationVariables, type UpdateDonationCampaignMutationVariables, type UpdateEmployeeMutationVariables, type UpdateEmploymentMutationVariables, type UpdateEmploymentTermMutationVariables, type UpdateEmploymentVariationKindMutationVariables, type UpdateEventMutationVariables, type UpdateFormMutationVariables, type UpdateKbArticleMutationVariables, type UpdateKbCollectionMutationVariables, type UpdateNoteMutationVariables, type UpdateSpaceMutationVariables, type UpdateStoryMutationVariables, type UpdateTaskMutationVariables } from "./generated/index.js";
2
+ import { type CreateAddressMutationVariables, type CreateChannelMutationVariables, type CreateChannelKbCollectionMutationVariables, type CreateContactMutationVariables, type CreateCourseMutationVariables, type CreateCompensationMutationVariables, type CreateDealMutationVariables, type CreateEmailAddressMutationVariables, type CreateEmployeeMutationVariables, type CreateEmployeeCertificationMutationVariables, type CreateEmploymentMutationVariables, type CreateEmploymentTermMutationVariables, type CreateEmploymentVariationKindMutationVariables, type CreateFormMutationVariables, type CreateKbArticleMutationVariables, type CreateKbCollectionMutationVariables, type CreateOrganizationMutationVariables, type CreatePhoneNumberMutationVariables, type CreateTimeClockMutationVariables, type DeleteCompensationMutationVariables, type DeleteDonationCampaignMutationVariables, type DeleteRecordMutation, type DiscardRecordMutation, type DiscardRecordMutationVariables, type UpdateAddressMutationVariables, type UpdateChannelMutationVariables, type UpdateChannelKbCollectionMutationVariables, type UpdateCompensationMutationVariables, type UpdateCourseMutationVariables, type UpdateDealMutationVariables, type UpdateDonationCampaignMutationVariables, type UpdateEmailAddressMutationVariables, type UpdateEmployeeMutationVariables, type UpdateEmploymentMutationVariables, type UpdateEmploymentTermMutationVariables, type UpdateEmploymentVariationKindMutationVariables, type UpdateEventMutationVariables, type UpdateFormMutationVariables, type UpdateKbArticleMutationVariables, type UpdateKbCollectionMutationVariables, type UpdateNoteMutationVariables, type UpdatePhoneNumberMutationVariables, type UpdateSpaceMutationVariables, type UpdateStoryMutationVariables, type UpdateTaskMutationVariables } from "./generated/index.js";
3
3
  /** `{ input: { id } }`, plus `permanent: true` to skip the trash. */
4
4
  type DeleteRecordVariables = DiscardRecordMutationVariables & {
5
5
  permanent?: boolean;
@@ -188,6 +188,161 @@ export declare function createOrganization(c: UiduClient, v: CreateOrganizationM
188
188
  type: string;
189
189
  }>;
190
190
  } | null>;
191
+ /**
192
+ * Create an address on an addressable record (a Contact or Organization):
193
+ * `{ input: { attributes: { addressableId, address, kind, primary, … } } }`.
194
+ * Returns the payload (with `errors`) or null. The new address is at
195
+ * `address.node`.
196
+ */
197
+ export declare function createAddress(c: UiduClient, v: CreateAddressMutationVariables): Promise<{
198
+ __typename?: "CreateAddressPayload";
199
+ address?: {
200
+ __typename?: "AddressEdge";
201
+ node?: {
202
+ __typename?: "Address";
203
+ id: string;
204
+ address?: string | null;
205
+ formattedAddress?: string | null;
206
+ kind?: string | null;
207
+ name?: string | null;
208
+ primary?: boolean | null;
209
+ placeId?: string | null;
210
+ url?: string | null;
211
+ } | null;
212
+ } | null;
213
+ errors: Array<{
214
+ __typename?: "Error";
215
+ key: string;
216
+ name: string;
217
+ type: string;
218
+ }>;
219
+ } | null>;
220
+ /**
221
+ * Update an address: `{ input: { id, attributes } }`. Returns the payload
222
+ * (with `errors`) or null.
223
+ */
224
+ export declare function updateAddress(c: UiduClient, v: UpdateAddressMutationVariables): Promise<{
225
+ __typename?: "UpdateAddressPayload";
226
+ address?: {
227
+ __typename?: "Address";
228
+ id: string;
229
+ address?: string | null;
230
+ formattedAddress?: string | null;
231
+ kind?: string | null;
232
+ name?: string | null;
233
+ primary?: boolean | null;
234
+ placeId?: string | null;
235
+ url?: string | null;
236
+ } | null;
237
+ errors: Array<{
238
+ __typename?: "Error";
239
+ key: string;
240
+ name: string;
241
+ type: string;
242
+ }>;
243
+ } | null>;
244
+ /**
245
+ * Create an email address on an emailable record (a Contact or Organization):
246
+ * `{ input: { attributes: { emailableId, email, kind, primary, … } } }`.
247
+ * Returns the payload (with `errors`) or null. The new email address is at
248
+ * `emailAddress.node`.
249
+ */
250
+ export declare function createEmailAddress(c: UiduClient, v: CreateEmailAddressMutationVariables): Promise<{
251
+ __typename?: "CreateEmailAddressPayload";
252
+ emailAddress?: {
253
+ __typename?: "EmailAddressEdge";
254
+ node?: {
255
+ __typename?: "EmailAddress";
256
+ id: string;
257
+ email: string;
258
+ kind?: string | null;
259
+ name?: string | null;
260
+ primary: boolean;
261
+ verified: boolean;
262
+ verifiedAt?: any | null;
263
+ } | null;
264
+ } | null;
265
+ errors: Array<{
266
+ __typename?: "Error";
267
+ key: string;
268
+ name: string;
269
+ type: string;
270
+ }>;
271
+ } | null>;
272
+ /**
273
+ * Update an email address: `{ input: { id, attributes } }`. Returns the
274
+ * payload (with `errors`) or null.
275
+ */
276
+ export declare function updateEmailAddress(c: UiduClient, v: UpdateEmailAddressMutationVariables): Promise<{
277
+ __typename?: "UpdateEmailAddressPayload";
278
+ emailAddress?: {
279
+ __typename?: "EmailAddress";
280
+ id: string;
281
+ email: string;
282
+ kind?: string | null;
283
+ name?: string | null;
284
+ primary: boolean;
285
+ verified: boolean;
286
+ verifiedAt?: any | null;
287
+ } | null;
288
+ errors: Array<{
289
+ __typename?: "Error";
290
+ key: string;
291
+ name: string;
292
+ type: string;
293
+ }>;
294
+ } | null>;
295
+ /**
296
+ * Create a phone number on a phoneable record (a Contact or Organization):
297
+ * `{ input: { attributes: { phoneableId, phone, kind, primary, … } } }`.
298
+ * Returns the payload (with `errors`) or null. The new phone number is at
299
+ * `phoneNumber.node`.
300
+ */
301
+ export declare function createPhoneNumber(c: UiduClient, v: CreatePhoneNumberMutationVariables): Promise<{
302
+ __typename?: "CreatePhoneNumberPayload";
303
+ phoneNumber?: {
304
+ __typename?: "PhoneNumberEdge";
305
+ node?: {
306
+ __typename?: "PhoneNumber";
307
+ id: string;
308
+ phone: string;
309
+ kind?: string | null;
310
+ name?: string | null;
311
+ primary: boolean;
312
+ verified: boolean;
313
+ verifiedAt?: any | null;
314
+ } | null;
315
+ } | null;
316
+ errors: Array<{
317
+ __typename?: "Error";
318
+ key: string;
319
+ name: string;
320
+ type: string;
321
+ }>;
322
+ } | null>;
323
+ /**
324
+ * Update a phone number: `{ input: { id, attributes } }`. Returns the payload
325
+ * (with `errors`) or null.
326
+ */
327
+ export declare function updatePhoneNumber(c: UiduClient, v: UpdatePhoneNumberMutationVariables): Promise<{
328
+ __typename?: "UpdatePhoneNumberPayload";
329
+ phoneNumber?: {
330
+ __typename?: "PhoneNumber";
331
+ id: string;
332
+ phone: string;
333
+ kind?: string | null;
334
+ name?: string | null;
335
+ primary: boolean;
336
+ verified: boolean;
337
+ verifiedAt?: any | null;
338
+ } | null;
339
+ errors: Array<{
340
+ __typename?: "Error";
341
+ key: string;
342
+ name: string;
343
+ type: string;
344
+ }>;
345
+ } | null>;
191
346
  /**
192
347
  * Create the HR record for a workspace user (`attributes.userId`). Returns the
193
348
  * payload (with `errors`) or null. The new employee is at `employee.node`.
@@ -0,0 +1,114 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type VoteFieldsFragment } from "./generated/index.js";
3
+ export type Vote = VoteFieldsFragment;
4
+ /**
5
+ * Vote on a record as the token's user: an upvote by default, `voteFlag:
6
+ * false` for a downvote, or a reaction with `emoji`. Returns the payload: the
7
+ * vote at `vote.node`, the record's new `votable.votesCount`, and `errors`.
8
+ */
9
+ export declare function vote(client: UiduClient, variables: {
10
+ votableId: string;
11
+ voteFlag?: boolean;
12
+ emoji?: string;
13
+ }): Promise<{
14
+ __typename?: "CreateVotePayload";
15
+ vote: {
16
+ __typename?: "VoteEdge";
17
+ node?: {
18
+ __typename?: "Vote";
19
+ id: string;
20
+ voteFlag?: string | null;
21
+ emoji?: string | null;
22
+ mine: boolean;
23
+ createdAt: any;
24
+ voter?: {
25
+ __typename: "Account";
26
+ } | {
27
+ __typename: "App";
28
+ } | {
29
+ __typename: "Contact";
30
+ id: string;
31
+ name?: string | null;
32
+ avatar?: string | null;
33
+ } | {
34
+ __typename: "WorkspaceApp";
35
+ } | null;
36
+ } | null;
37
+ };
38
+ votable: {
39
+ __typename: "Blob";
40
+ } | {
41
+ __typename: "Comment";
42
+ } | {
43
+ __typename: "DataView";
44
+ } | {
45
+ __typename: "EventStoreEvent";
46
+ } | {
47
+ __typename: "Grant";
48
+ } | {
49
+ __typename: "KbArticle";
50
+ } | {
51
+ __typename: "Message";
52
+ } | {
53
+ __typename: "ModelItem";
54
+ id: string;
55
+ votesCount: number;
56
+ } | {
57
+ __typename: "Post";
58
+ } | {
59
+ __typename: "WorkspaceAgentAiChat";
60
+ } | {
61
+ __typename: "WorkspaceApp";
62
+ };
63
+ errors: Array<{
64
+ __typename?: "Error";
65
+ key: string;
66
+ name: string;
67
+ type: string;
68
+ }>;
69
+ } | null>;
70
+ /**
71
+ * Take back one's own vote (`id` of a vote whose `mine` is true). Someone
72
+ * else's comes back as an error, not thrown. Returns the payload with the
73
+ * record's new `votable.votesCount`.
74
+ */
75
+ export declare function unvote(client: UiduClient, variables: {
76
+ id: string;
77
+ }): Promise<{
78
+ __typename?: "DeleteVotePayload";
79
+ vote?: {
80
+ __typename?: "Vote";
81
+ id: string;
82
+ } | null;
83
+ votable: {
84
+ __typename: "Blob";
85
+ } | {
86
+ __typename: "Comment";
87
+ } | {
88
+ __typename: "DataView";
89
+ } | {
90
+ __typename: "EventStoreEvent";
91
+ } | {
92
+ __typename: "Grant";
93
+ } | {
94
+ __typename: "KbArticle";
95
+ } | {
96
+ __typename: "Message";
97
+ } | {
98
+ __typename: "ModelItem";
99
+ id: string;
100
+ votesCount: number;
101
+ } | {
102
+ __typename: "Post";
103
+ } | {
104
+ __typename: "WorkspaceAgentAiChat";
105
+ } | {
106
+ __typename: "WorkspaceApp";
107
+ };
108
+ errors: Array<{
109
+ __typename?: "Error";
110
+ key: string;
111
+ name: string;
112
+ type: string;
113
+ }>;
114
+ } | null>;