@uidu/client 3.21.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/declarations/src/candidates.d.ts +69 -3
  3. package/dist/declarations/src/comments.d.ts +47 -0
  4. package/dist/declarations/src/contracts.d.ts +2 -0
  5. package/dist/declarations/src/decisions.d.ts +58 -0
  6. package/dist/declarations/src/generated/index.d.ts +6727 -1966
  7. package/dist/declarations/src/index.d.ts +10 -4
  8. package/dist/declarations/src/models.d.ts +28 -1
  9. package/dist/declarations/src/mutations.d.ts +156 -1
  10. package/dist/declarations/src/votes.d.ts +114 -0
  11. package/dist/uidu-client.cjs.dev.js +301 -3
  12. package/dist/uidu-client.cjs.prod.js +301 -3
  13. package/dist/uidu-client.esm.js +286 -4
  14. package/package.json +1 -1
  15. package/src/candidates.ts +21 -2
  16. package/src/comments.ts +44 -0
  17. package/src/decisions.test.ts +275 -0
  18. package/src/decisions.ts +135 -0
  19. package/src/generated/index.ts +1209 -36
  20. package/src/index.ts +26 -0
  21. package/src/models.ts +50 -0
  22. package/src/mutations.ts +72 -0
  23. package/src/queries/candidates/CandidateMutations.graphql +14 -9
  24. package/src/queries/candidates/CandidateQueries.graphql +1 -7
  25. package/src/queries/candidates/PoolContactFields.graphql +29 -0
  26. package/src/queries/comments/Comments.graphql +65 -0
  27. package/src/queries/contacts/AddressMutations.graphql +41 -0
  28. package/src/queries/contacts/EmailAddressMutations.graphql +39 -0
  29. package/src/queries/contacts/PhoneNumberMutations.graphql +39 -0
  30. package/src/queries/decisions/DecisionFields.graphql +83 -0
  31. package/src/queries/decisions/DecisionMutations.graphql +59 -0
  32. package/src/queries/decisions/DecisionQueries.graphql +32 -0
  33. package/src/queries/models/ModelFields.graphql +2 -0
  34. package/src/queries/models/ModelQueries.graphql +33 -0
  35. package/src/queries/votes/Votes.graphql +60 -0
  36. package/src/recruiting.test.ts +41 -0
  37. package/src/votes.ts +38 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @uidu/client
2
2
 
3
+ ## 3.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bc58ddd: Decisions, comments and votes, plus a ModelItem's history — what a custom app needs to let its team propose, answer, discuss and rank its own records natively: `listDecisions`, `getDecision`, `createDecision` (a `proposal` of the app's instance, opened straight away), `answerDecision` (creates or updates the caller's answer), `listComments`, `createComment`, `vote`, `unvote` and `getModelItemLog` (events with `changes` keyed by Field GlobalID). Every ModelItem now carries `votesCount` and `commentsCount`. Each asks only for the fields a custom app session may read.
8
+ - e315ca7: Contacts: addresses, email addresses and phone numbers can now be created and updated on a Contact or Organization (`createAddress`/`updateAddress`, `createEmailAddress`/`updateEmailAddress`, `createPhoneNumber`/`updatePhoneNumber`), each polymorphic via `addressableId`/`emailableId`/`phoneableId`. New CLI entities `addresses`, `email-addresses`, `phone-numbers` (create/update, write-only — no standalone list/get query exists).
9
+
10
+ ## 3.22.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 5155877: Recruiting: a pool contact is a referral. `createPoolContact` takes `sourceId` (a referring Organization or a User), `sourceChannel` and `referredOn`; `getPool` and the payloads return them; `updatePoolContact` corrects a referral.
15
+
3
16
  ## 3.21.0
4
17
 
5
18
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  import type { UiduClient } from "./client.js";
2
- import { type CreateCandidateMutationVariables, type CreatePoolContactMutationVariables, type DeletePoolContactMutationVariables, type FindCandidatesQuery, type FindCandidatesQueryVariables, type GetCandidateQuery, type GetCandidateQueryVariables, type GetPoolQuery, type GetPoolQueryVariables, type ListCandidatesQuery, type ListCandidatesQueryVariables, type ListPoolsQuery, type ListPoolsQueryVariables, type UpdateCandidateMutationVariables } from "./generated/index.js";
2
+ import { type CreateCandidateMutationVariables, type CreatePoolContactMutationVariables, type DeletePoolContactMutationVariables, type FindCandidatesQuery, type FindCandidatesQueryVariables, type GetCandidateQuery, type GetCandidateQueryVariables, type GetPoolQuery, type GetPoolQueryVariables, type ListCandidatesQuery, type ListCandidatesQueryVariables, type ListPoolsQuery, type ListPoolsQueryVariables, type UpdateCandidateMutationVariables, type UpdatePoolContactMutationVariables } from "./generated/index.js";
3
3
  export type CandidateSearch = NonNullable<NonNullable<FindCandidatesQuery['currentWorkspace']>['findCandidates']>;
4
4
  export type Candidate = CandidateSearch['candidates'][number];
5
5
  export type CandidateDetail = Extract<NonNullable<GetCandidateQuery['node']>, {
@@ -171,8 +171,12 @@ export declare function listPools(client: UiduClient, variables?: ListPoolsQuery
171
171
  */
172
172
  export declare function getPool(client: UiduClient, variables: GetPoolQueryVariables): Promise<PoolDetail | null>;
173
173
  /**
174
- * Add a contact to a pool (`attributes: { poolId, contactId }`). Returns the
175
- * mutation payload as-is (including any `errors`).
174
+ * Refer a contact to a pool (`attributes: { poolId, contactId, sourceId?,
175
+ * sourceChannel?, referredOn? }`). Each call is one referral, so the same
176
+ * person may enter the same pool more than once: `sourceId` is who sent them
177
+ * (the GlobalID of a referring Organization or of a User), `sourceChannel` a
178
+ * short slug like an application's, `referredOn` the day (`YYYY-MM-DD`, today
179
+ * when left out). Returns the mutation payload as-is (including any `errors`).
176
180
  */
177
181
  export declare function createPoolContact(client: UiduClient, variables: CreatePoolContactMutationVariables): Promise<{
178
182
  __typename?: "CreatePoolContactPayload";
@@ -181,6 +185,22 @@ export declare function createPoolContact(client: UiduClient, variables: CreateP
181
185
  node?: {
182
186
  __typename?: "PoolContact";
183
187
  id: string;
188
+ createdAt: any;
189
+ sourceChannel?: string | null;
190
+ referredOn?: any | null;
191
+ source?: {
192
+ __typename: "Application";
193
+ } | {
194
+ __typename: "Organization";
195
+ id: string;
196
+ name?: string | null;
197
+ } | {
198
+ __typename: "Pool";
199
+ } | {
200
+ __typename: "User";
201
+ id: string;
202
+ name?: string | null;
203
+ } | null;
184
204
  pool: {
185
205
  __typename?: "Pool";
186
206
  id: string;
@@ -190,6 +210,7 @@ export declare function createPoolContact(client: UiduClient, variables: CreateP
190
210
  __typename?: "Contact";
191
211
  id: string;
192
212
  name?: string | null;
213
+ email?: string | null;
193
214
  };
194
215
  } | null;
195
216
  } | null;
@@ -200,6 +221,51 @@ export declare function createPoolContact(client: UiduClient, variables: CreateP
200
221
  type: string;
201
222
  }>;
202
223
  } | null>;
224
+ /**
225
+ * Correct a referral, by the PoolContact's GlobalID (`id`, `attributes: {
226
+ * sourceId?, sourceChannel?, referredOn? }`). Returns the mutation payload
227
+ * as-is (including any `errors`).
228
+ */
229
+ export declare function updatePoolContact(client: UiduClient, variables: UpdatePoolContactMutationVariables): Promise<{
230
+ __typename?: "UpdatePoolContactPayload";
231
+ poolContact?: {
232
+ __typename?: "PoolContact";
233
+ id: string;
234
+ createdAt: any;
235
+ sourceChannel?: string | null;
236
+ referredOn?: any | null;
237
+ source?: {
238
+ __typename: "Application";
239
+ } | {
240
+ __typename: "Organization";
241
+ id: string;
242
+ name?: string | null;
243
+ } | {
244
+ __typename: "Pool";
245
+ } | {
246
+ __typename: "User";
247
+ id: string;
248
+ name?: string | null;
249
+ } | null;
250
+ pool: {
251
+ __typename?: "Pool";
252
+ id: string;
253
+ name?: string | null;
254
+ };
255
+ contact: {
256
+ __typename?: "Contact";
257
+ id: string;
258
+ name?: string | null;
259
+ email?: string | null;
260
+ };
261
+ } | null;
262
+ errors: Array<{
263
+ __typename?: "Error";
264
+ key: string;
265
+ name: string;
266
+ type: string;
267
+ }>;
268
+ } | null>;
203
269
  /**
204
270
  * Take a contact out of a pool, by the PoolContact's GlobalID. Returns the
205
271
  * mutation payload as-is (including any `errors`).
@@ -0,0 +1,47 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type CommentFieldsFragment } from "./generated/index.js";
3
+ export type Comment = CommentFieldsFragment;
4
+ /**
5
+ * The comments on a ModelItem or a Decision, flat (a reply
6
+ * carries `parent.id`). Empty when the record has none, isn't commentable or can't be seen.
7
+ */
8
+ export declare function listComments(client: UiduClient, variables: {
9
+ commentableId: string;
10
+ first?: number;
11
+ after?: string;
12
+ }): Promise<Comment[]>;
13
+ /**
14
+ * Comment on a ModelItem or a Decision as the token's user, or reply to a
15
+ * comment (`parentId`: its `id`). `bodyData` is an editor document (Tiptap JSON).
16
+ * Returns the payload (`comment`, `errors`) or null.
17
+ */
18
+ export declare function createComment(client: UiduClient, variables: {
19
+ commentableId: string;
20
+ bodyData: unknown;
21
+ parentId?: string;
22
+ }): Promise<{
23
+ __typename?: "CreateCommentPayload";
24
+ comment?: {
25
+ __typename?: "Comment";
26
+ id: string;
27
+ bodyData?: any | null;
28
+ createdAt: any;
29
+ updatedAt: any;
30
+ parent?: {
31
+ __typename?: "Comment";
32
+ id: string;
33
+ } | null;
34
+ contact?: {
35
+ __typename?: "Contact";
36
+ id: string;
37
+ name?: string | null;
38
+ avatar?: string | null;
39
+ } | null;
40
+ } | null;
41
+ errors: Array<{
42
+ __typename?: "Error";
43
+ key: string;
44
+ name: string;
45
+ type: string;
46
+ }>;
47
+ } | null>;
@@ -425,6 +425,8 @@ export declare function discardContract(client: UiduClient, variables: DiscardCo
425
425
  __typename?: "WorkSite";
426
426
  } | {
427
427
  __typename?: "Workflow";
428
+ } | {
429
+ __typename?: "WorkspaceAgent";
428
430
  } | {
429
431
  __typename?: "WorkspaceAgentAiChat";
430
432
  } | {
@@ -0,0 +1,58 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type DecisionFieldsFragment, type DecisionResponseFieldsFragment, type GetDecisionQuery } from "./generated/index.js";
3
+ export type Decision = DecisionFieldsFragment;
4
+ export type DecisionResponse = DecisionResponseFieldsFragment;
5
+ export type DecisionWithResponses = NonNullable<NonNullable<GetDecisionQuery['currentWorkspace']>['decision']>;
6
+ /** How a person answers a proposal. */
7
+ export type DecisionResponseType = 'agree' | 'disagree' | 'abstain' | 'block';
8
+ type MutationError = {
9
+ key: string;
10
+ name: string;
11
+ type: string;
12
+ };
13
+ /**
14
+ * The workspace's decisions, newest first, with their options and the
15
+ * caller's own answer (`myResponse`); a custom app's session gets only its own.
16
+ * `term` searches by text; page with `first`/`after`.
17
+ */
18
+ export declare function listDecisions(client: UiduClient, variables?: {
19
+ term?: string;
20
+ first?: number;
21
+ after?: string;
22
+ }): Promise<Decision[]>;
23
+ /** One decision with every answer (`decisionResponses`), or null when it can't be seen. */
24
+ export declare function getDecision(client: UiduClient, variables: {
25
+ id: string;
26
+ }): Promise<DecisionWithResponses | null>;
27
+ /**
28
+ * Propose something in a custom app: a `proposal` decision of the app's
29
+ * instance (`workspaceAppId`), opened straight away so it takes answers — a
30
+ * new decision is a draft until `openDecision`. Pass `open: false` to leave it
31
+ * a draft. Returns `{ decision, errors }`; on a failed open, `decision` is the
32
+ * draft that was created.
33
+ */
34
+ export declare function createDecision(client: UiduClient, variables: {
35
+ workspaceAppId: string;
36
+ name: string;
37
+ /** Tiptap/ProseMirror JSON (`{ type: 'doc', content: [...] }`). */
38
+ descriptionData?: unknown;
39
+ open?: boolean;
40
+ }): Promise<{
41
+ decision: Decision | null;
42
+ errors: MutationError[];
43
+ }>;
44
+ /**
45
+ * Answer a decision as the token's user, or change that answer: pass
46
+ * `responseId` (the decision's `myResponse.id`) when there is one already. A
47
+ * `block` wants a `reason`. Returns `{ decisionResponse, errors }`.
48
+ */
49
+ export declare function answerDecision(client: UiduClient, variables: {
50
+ decisionId: string;
51
+ responseType: DecisionResponseType;
52
+ reason?: string | null;
53
+ responseId?: string | null;
54
+ }): Promise<{
55
+ decisionResponse: DecisionResponse | null;
56
+ errors: MutationError[];
57
+ }>;
58
+ export {};