@uidu/client 3.12.0 → 3.13.1

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 (71) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/declarations/src/actions.d.ts +10 -0
  3. package/dist/declarations/src/applications.d.ts +56 -3
  4. package/dist/declarations/src/benefit-enrollments.d.ts +5 -0
  5. package/dist/declarations/src/benefits.d.ts +5 -0
  6. package/dist/declarations/src/bookings.d.ts +22 -0
  7. package/dist/declarations/src/calls.d.ts +8 -0
  8. package/dist/declarations/src/campaigns.d.ts +12 -0
  9. package/dist/declarations/src/client.d.ts +13 -1
  10. package/dist/declarations/src/cms.d.ts +32 -0
  11. package/dist/declarations/src/contacts.d.ts +16 -0
  12. package/dist/declarations/src/courses.d.ts +23 -0
  13. package/dist/declarations/src/donations.d.ts +19 -0
  14. package/dist/declarations/src/events.d.ts +19 -0
  15. package/dist/declarations/src/forms.d.ts +19 -0
  16. package/dist/declarations/src/generated/index.d.ts +2893 -176
  17. package/dist/declarations/src/goals.d.ts +4 -0
  18. package/dist/declarations/src/help-center.d.ts +4 -0
  19. package/dist/declarations/src/index.d.ts +3 -3
  20. package/dist/declarations/src/kb.d.ts +15 -0
  21. package/dist/declarations/src/models.d.ts +54 -0
  22. package/dist/declarations/src/mutations.d.ts +175 -1
  23. package/dist/declarations/src/notes.d.ts +4 -0
  24. package/dist/declarations/src/people.d.ts +8 -0
  25. package/dist/declarations/src/search.d.ts +7 -0
  26. package/dist/declarations/src/sites.d.ts +23 -1
  27. package/dist/declarations/src/spaces.d.ts +4 -0
  28. package/dist/declarations/src/stories.d.ts +11 -0
  29. package/dist/declarations/src/system.d.ts +4 -0
  30. package/dist/declarations/src/tasks.d.ts +4 -0
  31. package/dist/declarations/src/types.d.ts +4 -0
  32. package/dist/uidu-client.cjs.dev.js +585 -10
  33. package/dist/uidu-client.cjs.prod.js +585 -10
  34. package/dist/uidu-client.esm.js +582 -11
  35. package/package.json +1 -1
  36. package/src/actions.ts +10 -6
  37. package/src/applications.test.ts +42 -0
  38. package/src/applications.ts +31 -2
  39. package/src/benefit-enrollments.ts +5 -0
  40. package/src/benefits.ts +5 -0
  41. package/src/bookings.ts +22 -0
  42. package/src/calls.ts +8 -0
  43. package/src/campaigns.ts +12 -0
  44. package/src/client.ts +13 -1
  45. package/src/cms.ts +32 -0
  46. package/src/contacts.ts +16 -0
  47. package/src/courses.ts +23 -0
  48. package/src/donations.ts +19 -0
  49. package/src/events.ts +19 -0
  50. package/src/forms.ts +19 -0
  51. package/src/generated/index.ts +2528 -172
  52. package/src/goals.ts +4 -0
  53. package/src/help-center.ts +4 -0
  54. package/src/index.ts +8 -1
  55. package/src/kb.ts +15 -0
  56. package/src/models.ts +54 -0
  57. package/src/mutations.ts +162 -0
  58. package/src/notes.ts +4 -0
  59. package/src/people.ts +8 -0
  60. package/src/queries/applications/UpdateApplication.graphql +17 -0
  61. package/src/queries/cms/GetPage.graphql +1 -0
  62. package/src/queries/people/TimeClockMutations.graphql +17 -0
  63. package/src/queries/sites/CreateSite.graphql +15 -0
  64. package/src/search.ts +7 -0
  65. package/src/sites.test.ts +26 -0
  66. package/src/sites.ts +17 -0
  67. package/src/spaces.ts +4 -0
  68. package/src/stories.ts +11 -0
  69. package/src/system.ts +4 -0
  70. package/src/tasks.ts +4 -0
  71. package/src/types.ts +4 -0
package/src/sites.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { UiduClient } from './client';
2
2
  import {
3
+ CreateSiteDocument,
4
+ type CreateSiteMutationVariables,
3
5
  GetSiteByDomainDocument,
4
6
  GetSiteDocument,
5
7
  GetSitePageBySlugDocument,
@@ -171,3 +173,18 @@ export async function getSingletonBlock(
171
173
  if (node?.__typename !== 'Site' || !node.singletonBlock) return null;
172
174
  return toPage(node.singletonBlock);
173
175
  }
176
+
177
+ // --- writes -----------------------------------------------------------------
178
+
179
+ /**
180
+ * Provisions a new Site in the workspace/account (`tenantId`). Bearer token
181
+ * (`apiKey`) — this is workspace admin territory, never a public write.
182
+ * Returns the mutation payload as-is, including `errors`.
183
+ */
184
+ export async function createSite(
185
+ client: UiduClient,
186
+ variables: CreateSiteMutationVariables,
187
+ ) {
188
+ const result = await client.mutate(CreateSiteDocument, variables);
189
+ return result.createSite ?? null;
190
+ }
package/src/spaces.ts CHANGED
@@ -6,6 +6,10 @@ import {
6
6
 
7
7
  // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
8
 
9
+ /**
10
+ * Create a space, the container tasks live in. Returns the payload (with
11
+ * `errors`) or null; the new space is at `space.node`.
12
+ */
9
13
  export async function createSpace(
10
14
  client: UiduClient,
11
15
  variables: CreateSpaceMutationVariables,
package/src/stories.ts CHANGED
@@ -14,6 +14,9 @@ export type Story = NonNullable<
14
14
  NonNullable<GetStoryQuery['currentWorkspace']>['story']
15
15
  >;
16
16
 
17
+ /**
18
+ * One story with its rich-text `body`, or null.
19
+ */
17
20
  export async function getStory(
18
21
  client: UiduClient,
19
22
  variables: GetStoryQueryVariables,
@@ -22,6 +25,10 @@ export async function getStory(
22
25
  return result.currentWorkspace?.story ?? null;
23
26
  }
24
27
 
28
+ /**
29
+ * The workspace's stories as a flat array of summaries (no `body`); page with
30
+ * `first`/`after`.
31
+ */
25
32
  export async function listStories(
26
33
  client: UiduClient,
27
34
  variables: ListStoriesQueryVariables = {},
@@ -30,6 +37,10 @@ export async function listStories(
30
37
  return nodes(result.currentWorkspace?.storiesConnection);
31
38
  }
32
39
 
40
+ /**
41
+ * Create a story; returns the payload as-is, `{ errors, story }`, validation
42
+ * failures included.
43
+ */
33
44
  export async function createStory(
34
45
  client: UiduClient,
35
46
  variables: CreateStoryMutationVariables,
package/src/system.ts CHANGED
@@ -9,6 +9,10 @@ import {
9
9
  // Workspace-level authoring. Requires a doorkeeper Bearer token (apiKey on the
10
10
  // client) — these run as the authenticated account, subject to its Pundit role.
11
11
 
12
+ /**
13
+ * Create a workspace owned by the authenticated account (`attributes.name`,
14
+ * `subdomain`…). Returns the payload (with `errors`) or null.
15
+ */
12
16
  export async function createWorkspace(
13
17
  client: UiduClient,
14
18
  variables: CreateWorkspaceMutationVariables,
package/src/tasks.ts CHANGED
@@ -6,6 +6,10 @@ import {
6
6
 
7
7
  // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
8
 
9
+ /**
10
+ * Create a task, usually in a space (`attributes.spaceId`). Returns the
11
+ * payload (with `errors`) or null.
12
+ */
9
13
  export async function createTask(
10
14
  client: UiduClient,
11
15
  variables: CreateTaskMutationVariables,
package/src/types.ts CHANGED
@@ -20,6 +20,10 @@ export interface UiduErrorOptions {
20
20
  cause?: unknown;
21
21
  }
22
22
 
23
+ /**
24
+ * What `UiduClient` throws: `code` is `GRAPHQL_ERROR` (with `graphQLErrors`),
25
+ * `NETWORK_ERROR`, `TOKEN_ERROR` or `CONFIG_ERROR`.
26
+ */
23
27
  export class UiduError extends Error {
24
28
  readonly code: string;
25
29
  readonly graphQLErrors: ReadonlyArray<unknown>;