@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.
- package/CHANGELOG.md +35 -0
- package/README.md +56 -0
- package/dist/declarations/src/bookings.d.ts +58 -0
- package/dist/declarations/src/calls.d.ts +26 -0
- package/dist/declarations/src/campaigns.d.ts +39 -0
- package/dist/declarations/src/client.d.ts +10 -0
- package/dist/declarations/src/cms.d.ts +75 -0
- package/dist/declarations/src/contacts.d.ts +36 -0
- package/dist/declarations/src/courses.d.ts +68 -0
- package/dist/declarations/src/donations.d.ts +51 -0
- package/dist/declarations/src/events.d.ts +59 -0
- package/dist/declarations/src/forms.d.ts +69 -0
- package/dist/declarations/src/generated/index.d.ts +45354 -0
- package/dist/declarations/src/help-center.d.ts +4 -0
- package/dist/declarations/src/index.d.ts +39 -0
- package/dist/declarations/src/kb.d.ts +30 -0
- package/dist/declarations/src/mutations.d.ts +515 -0
- package/dist/declarations/src/notes.d.ts +18 -0
- package/dist/declarations/src/people.d.ts +53 -0
- package/dist/declarations/src/search.d.ts +4 -0
- package/dist/declarations/src/spaces.d.ts +19 -0
- package/dist/declarations/src/stories.d.ts +28 -0
- package/dist/declarations/src/system.d.ts +36 -0
- package/dist/declarations/src/tasks.d.ts +16 -0
- package/dist/declarations/src/types.d.ts +19 -0
- package/dist/declarations/src/utils/paginate.d.ts +34 -0
- package/dist/uidu-client.cjs.d.ts +2 -2
- package/dist/uidu-client.cjs.dev.js +682 -0
- package/dist/uidu-client.cjs.js +6 -15
- package/dist/uidu-client.cjs.prod.js +682 -0
- package/dist/uidu-client.esm.js +560 -0
- package/package.json +8 -3
- package/src/cms.ts +43 -0
- package/src/donations.ts +10 -0
- package/src/events.ts +10 -0
- package/src/generated/index.ts +2967 -84
- package/src/index.ts +70 -5
- package/src/mutations.test.ts +43 -0
- package/src/mutations.ts +216 -0
- package/src/notes.ts +15 -0
- package/src/people.test.ts +63 -0
- package/src/people.ts +93 -0
- package/src/queries/cms/CreateFieldValue.graphql +16 -0
- package/src/queries/cms/CreatePage.graphql +15 -0
- package/src/queries/cms/CreatePageBlock.graphql +14 -0
- package/src/queries/cms/CreateProject.graphql +16 -0
- package/src/queries/contacts/ContactMutations.graphql +53 -0
- package/src/queries/courses/CourseMutations.graphql +38 -0
- package/src/queries/donations/CreateDonationCampaign.graphql +13 -0
- package/src/queries/donations/DonationCampaignMutations.graphql +25 -0
- package/src/queries/events/CreateEvent.graphql +13 -0
- package/src/queries/events/UpdateEvent.graphql +12 -0
- package/src/queries/forms/FormMutations.graphql +40 -0
- package/src/queries/help-center/ChannelMutations.graphql +40 -0
- package/src/queries/kb/KbMutations.graphql +81 -0
- package/src/queries/notes/CreateNote.graphql +14 -0
- package/src/queries/notes/NoteMutations.graphql +25 -0
- package/src/queries/people/ListCircles.graphql +17 -0
- package/src/queries/people/ListKinds.graphql +18 -0
- package/src/queries/people/ListOffices.graphql +16 -0
- package/src/queries/people/PeopleMutations.graphql +88 -0
- package/src/queries/spaces/CreateSpace.graphql +15 -0
- package/src/queries/spaces/SpaceMutations.graphql +25 -0
- package/src/queries/stories/CreateStory.graphql +13 -0
- package/src/queries/stories/UpdateStory.graphql +12 -0
- package/src/queries/system/CreateWorkspace.graphql +15 -0
- package/src/queries/system/GenerateWorkspaceApiCredentials.graphql +18 -0
- package/src/queries/tasks/CreateTask.graphql +13 -0
- package/src/queries/tasks/TaskMutations.graphql +25 -0
- package/src/spaces.ts +15 -0
- package/src/stories.ts +10 -0
- package/src/system.ts +33 -0
- package/src/tasks.ts +15 -0
- package/src/utils/paginate.test.ts +116 -0
- package/src/utils/relay.test.ts +35 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { UiduClient } from "./client.js";
|
|
2
|
+
import { type CreateStoryMutationVariables, type GetStoryQuery, type GetStoryQueryVariables, type ListStoriesQueryVariables } from "./generated/index.js";
|
|
3
|
+
export type Story = NonNullable<NonNullable<GetStoryQuery['currentWorkspace']>['story']>;
|
|
4
|
+
export declare function getStory(client: UiduClient, variables: GetStoryQueryVariables): Promise<Story | null>;
|
|
5
|
+
export declare function listStories(client: UiduClient, variables?: ListStoriesQueryVariables): Promise<{
|
|
6
|
+
__typename?: "Story";
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
cover?: string | null;
|
|
10
|
+
coverData?: any | null;
|
|
11
|
+
published?: boolean | null;
|
|
12
|
+
publishedAt?: any | null;
|
|
13
|
+
publicPath?: string | null;
|
|
14
|
+
}[]>;
|
|
15
|
+
export declare function createStory(client: UiduClient, variables: CreateStoryMutationVariables): Promise<{
|
|
16
|
+
__typename?: "CreateStoryPayload";
|
|
17
|
+
story?: {
|
|
18
|
+
__typename?: "Story";
|
|
19
|
+
id: string;
|
|
20
|
+
name?: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
errors: Array<{
|
|
23
|
+
__typename?: "Error";
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}>;
|
|
28
|
+
} | null>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { UiduClient } from "./client.js";
|
|
2
|
+
import { type CreateWorkspaceMutationVariables, type GenerateWorkspaceApiCredentialsMutationVariables } from "./generated/index.js";
|
|
3
|
+
export declare function createWorkspace(client: UiduClient, variables: CreateWorkspaceMutationVariables): Promise<{
|
|
4
|
+
__typename?: "CreateWorkspacePayload";
|
|
5
|
+
workspace?: {
|
|
6
|
+
__typename?: "Workspace";
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
} | null;
|
|
10
|
+
errors: Array<{
|
|
11
|
+
__typename?: "Error";
|
|
12
|
+
key: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}>;
|
|
16
|
+
} | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Rotate + return a workspace's API credentials (apiKey/apiSecret). Operates on
|
|
19
|
+
* the current workspace. Use the returned credentials to wire a scaffolded app.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateWorkspaceApiCredentials(client: UiduClient, variables: GenerateWorkspaceApiCredentialsMutationVariables): Promise<{
|
|
22
|
+
__typename?: "GenerateWorkspaceApiCredentialsPayload";
|
|
23
|
+
apiKey?: string | null;
|
|
24
|
+
apiSecret?: string | null;
|
|
25
|
+
workspace?: {
|
|
26
|
+
__typename?: "Workspace";
|
|
27
|
+
id: string;
|
|
28
|
+
name?: string | null;
|
|
29
|
+
} | null;
|
|
30
|
+
errors: Array<{
|
|
31
|
+
__typename?: "Error";
|
|
32
|
+
key: string;
|
|
33
|
+
name: string;
|
|
34
|
+
type: string;
|
|
35
|
+
}>;
|
|
36
|
+
} | null>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UiduClient } from "./client.js";
|
|
2
|
+
import { type CreateTaskMutationVariables } from "./generated/index.js";
|
|
3
|
+
export declare function createTask(client: UiduClient, variables: CreateTaskMutationVariables): Promise<{
|
|
4
|
+
__typename?: "CreateTaskPayload";
|
|
5
|
+
task?: {
|
|
6
|
+
__typename?: "Task";
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
} | null;
|
|
10
|
+
errors: Array<{
|
|
11
|
+
__typename?: "Error";
|
|
12
|
+
key: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}>;
|
|
16
|
+
} | null>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UiduClientConfig {
|
|
2
|
+
workspace: string;
|
|
3
|
+
publicToken?: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
endpoint?: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export interface UiduErrorOptions {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
graphQLErrors?: ReadonlyArray<unknown>;
|
|
12
|
+
cause?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export declare class UiduError extends Error {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly graphQLErrors: ReadonlyArray<unknown>;
|
|
17
|
+
readonly cause?: unknown;
|
|
18
|
+
constructor(opts: UiduErrorOptions);
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
import type { UiduClient } from "../client.js";
|
|
3
|
+
type RelayPageInfo = {
|
|
4
|
+
endCursor?: string | null;
|
|
5
|
+
hasNextPage: boolean;
|
|
6
|
+
};
|
|
7
|
+
type RelayConnection<TNode> = {
|
|
8
|
+
edges?: ReadonlyArray<{
|
|
9
|
+
node?: TNode | null;
|
|
10
|
+
} | null> | null;
|
|
11
|
+
pageInfo?: RelayPageInfo | null;
|
|
12
|
+
};
|
|
13
|
+
export type PaginateOptions<TResult, TVars, TNode> = {
|
|
14
|
+
/** Variables for the first page. `after` is set by paginate itself. */
|
|
15
|
+
variables?: Omit<TVars, 'after'>;
|
|
16
|
+
/** Pluck the Relay connection out of the query result. */
|
|
17
|
+
extract: (data: TResult) => RelayConnection<TNode> | null | undefined;
|
|
18
|
+
/** Safety bound on iterations. Defaults to 1000. */
|
|
19
|
+
maxPages?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Walks every page of a Relay-style connection and returns a flat array of nodes.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { paginate, ListEventsDocument } from '@uidu/client';
|
|
26
|
+
* const all = await paginate(client, ListEventsDocument, {
|
|
27
|
+
* variables: { first: 100 },
|
|
28
|
+
* extract: (d) => d.currentWorkspace?.events,
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
export declare function paginate<TResult, TVars extends {
|
|
32
|
+
after?: string | null;
|
|
33
|
+
}, TNode>(client: UiduClient, document: TypedDocumentNode<TResult, TVars>, options: PaginateOptions<TResult, TVars, TNode>): Promise<TNode[]>;
|
|
34
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidWlkdS1jbGllbnQuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|