@uidu/client 3.0.0 → 3.2.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 (75) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +56 -0
  3. package/dist/declarations/src/bookings.d.ts +58 -0
  4. package/dist/declarations/src/calls.d.ts +26 -0
  5. package/dist/declarations/src/campaigns.d.ts +39 -0
  6. package/dist/declarations/src/client.d.ts +10 -0
  7. package/dist/declarations/src/cms.d.ts +75 -0
  8. package/dist/declarations/src/contacts.d.ts +36 -0
  9. package/dist/declarations/src/courses.d.ts +68 -0
  10. package/dist/declarations/src/donations.d.ts +51 -0
  11. package/dist/declarations/src/events.d.ts +59 -0
  12. package/dist/declarations/src/forms.d.ts +69 -0
  13. package/dist/declarations/src/generated/index.d.ts +45354 -0
  14. package/dist/declarations/src/help-center.d.ts +4 -0
  15. package/dist/declarations/src/index.d.ts +39 -0
  16. package/dist/declarations/src/kb.d.ts +30 -0
  17. package/dist/declarations/src/mutations.d.ts +515 -0
  18. package/dist/declarations/src/notes.d.ts +18 -0
  19. package/dist/declarations/src/people.d.ts +53 -0
  20. package/dist/declarations/src/search.d.ts +4 -0
  21. package/dist/declarations/src/spaces.d.ts +19 -0
  22. package/dist/declarations/src/stories.d.ts +28 -0
  23. package/dist/declarations/src/system.d.ts +36 -0
  24. package/dist/declarations/src/tasks.d.ts +16 -0
  25. package/dist/declarations/src/types.d.ts +19 -0
  26. package/dist/declarations/src/utils/paginate.d.ts +34 -0
  27. package/dist/uidu-client.cjs.d.ts +2 -2
  28. package/dist/uidu-client.cjs.dev.js +682 -0
  29. package/dist/uidu-client.cjs.js +6 -15
  30. package/dist/uidu-client.cjs.prod.js +682 -0
  31. package/dist/uidu-client.esm.js +560 -0
  32. package/package.json +8 -3
  33. package/src/cms.ts +43 -0
  34. package/src/donations.ts +10 -0
  35. package/src/events.ts +10 -0
  36. package/src/generated/index.ts +2967 -84
  37. package/src/index.ts +70 -5
  38. package/src/mutations.test.ts +43 -0
  39. package/src/mutations.ts +216 -0
  40. package/src/notes.ts +15 -0
  41. package/src/people.test.ts +63 -0
  42. package/src/people.ts +93 -0
  43. package/src/queries/cms/CreateFieldValue.graphql +16 -0
  44. package/src/queries/cms/CreatePage.graphql +15 -0
  45. package/src/queries/cms/CreatePageBlock.graphql +14 -0
  46. package/src/queries/cms/CreateProject.graphql +16 -0
  47. package/src/queries/contacts/ContactMutations.graphql +53 -0
  48. package/src/queries/courses/CourseMutations.graphql +38 -0
  49. package/src/queries/donations/CreateDonationCampaign.graphql +13 -0
  50. package/src/queries/donations/DonationCampaignMutations.graphql +25 -0
  51. package/src/queries/events/CreateEvent.graphql +13 -0
  52. package/src/queries/events/UpdateEvent.graphql +12 -0
  53. package/src/queries/forms/FormMutations.graphql +40 -0
  54. package/src/queries/help-center/ChannelMutations.graphql +40 -0
  55. package/src/queries/kb/KbMutations.graphql +81 -0
  56. package/src/queries/notes/CreateNote.graphql +14 -0
  57. package/src/queries/notes/NoteMutations.graphql +25 -0
  58. package/src/queries/people/ListCircles.graphql +17 -0
  59. package/src/queries/people/ListKinds.graphql +18 -0
  60. package/src/queries/people/ListOffices.graphql +16 -0
  61. package/src/queries/people/PeopleMutations.graphql +88 -0
  62. package/src/queries/spaces/CreateSpace.graphql +15 -0
  63. package/src/queries/spaces/SpaceMutations.graphql +25 -0
  64. package/src/queries/stories/CreateStory.graphql +13 -0
  65. package/src/queries/stories/UpdateStory.graphql +12 -0
  66. package/src/queries/system/CreateWorkspace.graphql +15 -0
  67. package/src/queries/system/GenerateWorkspaceApiCredentials.graphql +18 -0
  68. package/src/queries/tasks/CreateTask.graphql +13 -0
  69. package/src/queries/tasks/TaskMutations.graphql +25 -0
  70. package/src/spaces.ts +15 -0
  71. package/src/stories.ts +10 -0
  72. package/src/system.ts +33 -0
  73. package/src/tasks.ts +15 -0
  74. package/src/utils/paginate.test.ts +116 -0
  75. package/src/utils/relay.test.ts +35 -0
@@ -0,0 +1,38 @@
1
+ mutation CreateCourse($input: CreateCourseInput!) {
2
+ createCourse(input: $input) {
3
+ course {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
13
+
14
+ mutation UpdateCourse($input: UpdateCourseInput!) {
15
+ updateCourse(input: $input) {
16
+ course {
17
+ id
18
+ }
19
+ errors {
20
+ key
21
+ name
22
+ type
23
+ }
24
+ }
25
+ }
26
+
27
+ mutation DeleteCourse($input: DeleteCourseInput!) {
28
+ deleteCourse(input: $input) {
29
+ course {
30
+ id
31
+ }
32
+ errors {
33
+ key
34
+ name
35
+ type
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,13 @@
1
+ mutation CreateDonationCampaign($input: CreateDonationCampaignInput!) {
2
+ createDonationCampaign(input: $input) {
3
+ donationCampaign {
4
+ id
5
+ name
6
+ }
7
+ errors {
8
+ key
9
+ name
10
+ type
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ mutation UpdateDonationCampaign($input: UpdateDonationCampaignInput!) {
2
+ updateDonationCampaign(input: $input) {
3
+ donationCampaign {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
13
+
14
+ mutation DeleteDonationCampaign($input: DeleteDonationCampaignInput!) {
15
+ deleteDonationCampaign(input: $input) {
16
+ donationCampaign {
17
+ id
18
+ }
19
+ errors {
20
+ key
21
+ name
22
+ type
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ mutation CreateEvent($input: CreateEventInput!) {
2
+ createEvent(input: $input) {
3
+ event {
4
+ id
5
+ name
6
+ }
7
+ errors {
8
+ key
9
+ name
10
+ type
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ mutation UpdateEvent($input: UpdateEventInput!) {
2
+ updateEvent(input: $input) {
3
+ event {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,40 @@
1
+ mutation CreateForm($input: CreateFormInput!) {
2
+ createForm(input: $input) {
3
+ form {
4
+ node {
5
+ id
6
+ }
7
+ }
8
+ errors {
9
+ key
10
+ name
11
+ type
12
+ }
13
+ }
14
+ }
15
+
16
+ mutation UpdateForm($input: UpdateFormInput!) {
17
+ updateForm(input: $input) {
18
+ form {
19
+ id
20
+ }
21
+ errors {
22
+ key
23
+ name
24
+ type
25
+ }
26
+ }
27
+ }
28
+
29
+ mutation DeleteForm($input: DeleteFormInput!) {
30
+ deleteForm(input: $input) {
31
+ form {
32
+ id
33
+ }
34
+ errors {
35
+ key
36
+ name
37
+ type
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,40 @@
1
+ mutation CreateChannel($input: CreateChannelInput!) {
2
+ createChannel(input: $input) {
3
+ channel {
4
+ node {
5
+ id
6
+ }
7
+ }
8
+ errors {
9
+ key
10
+ name
11
+ type
12
+ }
13
+ }
14
+ }
15
+
16
+ mutation UpdateChannel($input: UpdateChannelInput!) {
17
+ updateChannel(input: $input) {
18
+ channel {
19
+ id
20
+ }
21
+ errors {
22
+ key
23
+ name
24
+ type
25
+ }
26
+ }
27
+ }
28
+
29
+ mutation DeleteChannel($input: DeleteChannelInput!) {
30
+ deleteChannel(input: $input) {
31
+ channel {
32
+ id
33
+ }
34
+ errors {
35
+ key
36
+ name
37
+ type
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,81 @@
1
+ mutation CreateKbCollection($input: CreateKbCollectionInput!) {
2
+ createKbCollection(input: $input) {
3
+ kbCollection {
4
+ node {
5
+ id
6
+ }
7
+ }
8
+ errors {
9
+ key
10
+ name
11
+ type
12
+ }
13
+ }
14
+ }
15
+
16
+ mutation UpdateKbCollection($input: UpdateKbCollectionInput!) {
17
+ updateKbCollection(input: $input) {
18
+ kbCollection {
19
+ id
20
+ }
21
+ errors {
22
+ key
23
+ name
24
+ type
25
+ }
26
+ }
27
+ }
28
+
29
+ mutation DeleteKbCollection($input: DeleteKbCollectionInput!) {
30
+ deleteKbCollection(input: $input) {
31
+ kbCollection {
32
+ id
33
+ }
34
+ errors {
35
+ key
36
+ name
37
+ type
38
+ }
39
+ }
40
+ }
41
+
42
+ mutation CreateKbArticle($input: CreateKbArticleInput!) {
43
+ createKbArticle(input: $input) {
44
+ kbArticle {
45
+ node {
46
+ id
47
+ }
48
+ }
49
+ errors {
50
+ key
51
+ name
52
+ type
53
+ }
54
+ }
55
+ }
56
+
57
+ mutation UpdateKbArticle($input: UpdateKbArticleInput!) {
58
+ updateKbArticle(input: $input) {
59
+ kbArticle {
60
+ id
61
+ }
62
+ errors {
63
+ key
64
+ name
65
+ type
66
+ }
67
+ }
68
+ }
69
+
70
+ mutation DeleteKbArticle($input: DeleteKbArticleInput!) {
71
+ deleteKbArticle(input: $input) {
72
+ kbArticle {
73
+ id
74
+ }
75
+ errors {
76
+ key
77
+ name
78
+ type
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,14 @@
1
+ mutation CreateNote($input: CreateNoteInput!) {
2
+ createNote(input: $input) {
3
+ note {
4
+ node {
5
+ id
6
+ }
7
+ }
8
+ errors {
9
+ key
10
+ name
11
+ type
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,25 @@
1
+ mutation UpdateNote($input: UpdateNoteInput!) {
2
+ updateNote(input: $input) {
3
+ note {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
13
+
14
+ mutation DeleteNote($input: DeleteNoteInput!) {
15
+ deleteNote(input: $input) {
16
+ note {
17
+ id
18
+ }
19
+ errors {
20
+ key
21
+ name
22
+ type
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,17 @@
1
+ query ListCircles($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ circles(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ kind
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ query ListKinds($models: [String!]!, $first: Int, $after: String) {
2
+ currentWorkspace {
3
+ kinds(models: $models, first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ code
13
+ model
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ query ListOffices($first: Int, $after: String) {
2
+ currentWorkspace {
3
+ offices(first: $first, after: $after) {
4
+ pageInfo {
5
+ hasNextPage
6
+ endCursor
7
+ }
8
+ edges {
9
+ node {
10
+ id
11
+ name
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,88 @@
1
+ mutation CreateEmployee($input: CreateEmployeeInput!) {
2
+ createEmployee(input: $input) {
3
+ employee {
4
+ node {
5
+ id
6
+ employeeCode
7
+ user {
8
+ id
9
+ name
10
+ email
11
+ }
12
+ }
13
+ }
14
+ errors {
15
+ key
16
+ name
17
+ type
18
+ }
19
+ }
20
+ }
21
+
22
+ mutation UpdateEmployee($input: UpdateEmployeeInput!) {
23
+ updateEmployee(input: $input) {
24
+ employee {
25
+ id
26
+ employeeCode
27
+ }
28
+ errors {
29
+ key
30
+ name
31
+ type
32
+ }
33
+ }
34
+ }
35
+
36
+ mutation CreateEmployment($input: CreateEmploymentInput!) {
37
+ createEmployment(input: $input) {
38
+ employment {
39
+ node {
40
+ id
41
+ jobTitle
42
+ contractType
43
+ classification
44
+ startDate
45
+ endDate
46
+ isActive
47
+ }
48
+ }
49
+ errors {
50
+ key
51
+ name
52
+ type
53
+ }
54
+ }
55
+ }
56
+
57
+ mutation UpdateEmployment($input: UpdateEmploymentInput!) {
58
+ updateEmployment(input: $input) {
59
+ employment {
60
+ id
61
+ jobTitle
62
+ contractType
63
+ classification
64
+ startDate
65
+ endDate
66
+ endReason
67
+ isActive
68
+ }
69
+ errors {
70
+ key
71
+ name
72
+ type
73
+ }
74
+ }
75
+ }
76
+
77
+ mutation DeleteEmployment($input: DeleteEmploymentInput!) {
78
+ deleteEmployment(input: $input) {
79
+ employment {
80
+ id
81
+ }
82
+ errors {
83
+ key
84
+ name
85
+ type
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,15 @@
1
+ mutation CreateSpace($input: CreateSpaceInput!) {
2
+ createSpace(input: $input) {
3
+ space {
4
+ node {
5
+ id
6
+ name
7
+ }
8
+ }
9
+ errors {
10
+ key
11
+ name
12
+ type
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,25 @@
1
+ mutation UpdateSpace($input: UpdateSpaceInput!) {
2
+ updateSpace(input: $input) {
3
+ space {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
13
+
14
+ mutation DeleteSpace($input: DeleteSpaceInput!) {
15
+ deleteSpace(input: $input) {
16
+ space {
17
+ id
18
+ }
19
+ errors {
20
+ key
21
+ name
22
+ type
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ mutation CreateStory($input: CreateStoryInput!) {
2
+ createStory(input: $input) {
3
+ story {
4
+ id
5
+ name
6
+ }
7
+ errors {
8
+ key
9
+ name
10
+ type
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ mutation UpdateStory($input: UpdateStoryInput!) {
2
+ updateStory(input: $input) {
3
+ story {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,15 @@
1
+ # Staged for codegen — validated on the next `yarn codegen` run against the live
2
+ # schema (needs UIDU_WORKSPACE + UIDU_PUBLIC_TOKEN). See plans/ai-connector.md.
3
+ mutation CreateWorkspace($input: CreateWorkspaceInput!) {
4
+ createWorkspace(input: $input) {
5
+ workspace {
6
+ id
7
+ name
8
+ }
9
+ errors {
10
+ key
11
+ name
12
+ type
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ # Staged for codegen — validated on the next `yarn codegen` run. See plans/ai-connector.md.
2
+ mutation GenerateWorkspaceApiCredentials(
3
+ $input: GenerateWorkspaceApiCredentialsInput!
4
+ ) {
5
+ generateWorkspaceApiCredentials(input: $input) {
6
+ apiKey
7
+ apiSecret
8
+ workspace {
9
+ id
10
+ name
11
+ }
12
+ errors {
13
+ key
14
+ name
15
+ type
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ mutation CreateTask($input: CreateTaskInput!) {
2
+ createTask(input: $input) {
3
+ task {
4
+ id
5
+ name
6
+ }
7
+ errors {
8
+ key
9
+ name
10
+ type
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ mutation UpdateTask($input: UpdateTaskInput!) {
2
+ updateTask(input: $input) {
3
+ task {
4
+ id
5
+ }
6
+ errors {
7
+ key
8
+ name
9
+ type
10
+ }
11
+ }
12
+ }
13
+
14
+ mutation DeleteTask($input: DeleteTaskInput!) {
15
+ deleteTask(input: $input) {
16
+ task {
17
+ id
18
+ }
19
+ errors {
20
+ key
21
+ name
22
+ type
23
+ }
24
+ }
25
+ }
package/src/spaces.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { UiduClient } from './client';
2
+ import {
3
+ CreateSpaceDocument,
4
+ type CreateSpaceMutationVariables,
5
+ } from './generated';
6
+
7
+ // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
+
9
+ export async function createSpace(
10
+ client: UiduClient,
11
+ variables: CreateSpaceMutationVariables,
12
+ ) {
13
+ const result = await client.mutate(CreateSpaceDocument, variables);
14
+ return result.createSpace ?? null;
15
+ }
package/src/stories.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { UiduClient } from './client';
2
2
  import {
3
+ CreateStoryDocument,
4
+ type CreateStoryMutationVariables,
3
5
  GetStoryDocument,
4
6
  type GetStoryQuery,
5
7
  type GetStoryQueryVariables,
@@ -27,3 +29,11 @@ export async function listStories(
27
29
  const result = await client.query(ListStoriesDocument, variables);
28
30
  return nodes(result.currentWorkspace?.storiesConnection);
29
31
  }
32
+
33
+ export async function createStory(
34
+ client: UiduClient,
35
+ variables: CreateStoryMutationVariables,
36
+ ) {
37
+ const result = await client.mutate(CreateStoryDocument, variables);
38
+ return result.createStory ?? null;
39
+ }
package/src/system.ts ADDED
@@ -0,0 +1,33 @@
1
+ import type { UiduClient } from './client';
2
+ import {
3
+ CreateWorkspaceDocument,
4
+ type CreateWorkspaceMutationVariables,
5
+ GenerateWorkspaceApiCredentialsDocument,
6
+ type GenerateWorkspaceApiCredentialsMutationVariables,
7
+ } from './generated';
8
+
9
+ // Workspace-level authoring. Requires a doorkeeper Bearer token (apiKey on the
10
+ // client) — these run as the authenticated account, subject to its Pundit role.
11
+
12
+ export async function createWorkspace(
13
+ client: UiduClient,
14
+ variables: CreateWorkspaceMutationVariables,
15
+ ) {
16
+ const result = await client.mutate(CreateWorkspaceDocument, variables);
17
+ return result.createWorkspace ?? null;
18
+ }
19
+
20
+ /**
21
+ * Rotate + return a workspace's API credentials (apiKey/apiSecret). Operates on
22
+ * the current workspace. Use the returned credentials to wire a scaffolded app.
23
+ */
24
+ export async function generateWorkspaceApiCredentials(
25
+ client: UiduClient,
26
+ variables: GenerateWorkspaceApiCredentialsMutationVariables,
27
+ ) {
28
+ const result = await client.mutate(
29
+ GenerateWorkspaceApiCredentialsDocument,
30
+ variables,
31
+ );
32
+ return result.generateWorkspaceApiCredentials ?? null;
33
+ }
package/src/tasks.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { UiduClient } from './client';
2
+ import {
3
+ CreateTaskDocument,
4
+ type CreateTaskMutationVariables,
5
+ } from './generated';
6
+
7
+ // Authoring (Bearer / doorkeeper token). Returns the payload, incl. `errors`.
8
+
9
+ export async function createTask(
10
+ client: UiduClient,
11
+ variables: CreateTaskMutationVariables,
12
+ ) {
13
+ const result = await client.mutate(CreateTaskDocument, variables);
14
+ return result.createTask ?? null;
15
+ }