@uidu/client 3.4.0 → 3.5.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 +32 -0
- package/dist/declarations/src/calls.d.ts +1 -0
- package/dist/declarations/src/generated/index.d.ts +4 -1
- package/dist/declarations/src/index.d.ts +4 -3
- package/dist/declarations/src/utils/fieldValues.d.ts +37 -0
- package/dist/uidu-client.cjs.dev.js +132 -2
- package/dist/uidu-client.cjs.prod.js +132 -2
- package/dist/uidu-client.esm.js +131 -3
- package/package.json +1 -1
- package/src/client.test.ts +165 -0
- package/src/client.ts +5 -1
- package/src/generated/index.ts +5 -3
- package/src/index.ts +8 -15
- package/src/queries/calls/ListCalls.graphql +1 -0
- package/src/utils/fieldValues.test.ts +268 -0
- package/src/utils/fieldValues.ts +164 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @uidu/client
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 45e1997: Normalize `fieldValuesAttributes[].content` on every mutation.
|
|
8
|
+
|
|
9
|
+
The API stores each field value as JSON and reads it back as `content['value']`,
|
|
10
|
+
so `content` must always be `{ value: … }`. A bare scalar wasn't rejected at the
|
|
11
|
+
mutation boundary — the record saved, the server-side typed columns stayed
|
|
12
|
+
empty, and later reads of that field errored out. Code-generating agents hit
|
|
13
|
+
this constantly, since `FieldValueAttributes.content` is typed as an untyped
|
|
14
|
+
`JSON` scalar.
|
|
15
|
+
|
|
16
|
+
`UiduClient.mutate` now wraps a bare `content` in `{ value }` before sending,
|
|
17
|
+
and warns once per mutation outside production so the call site gets fixed.
|
|
18
|
+
Doing it in `mutate` rather than per function covers all ~50 authoring
|
|
19
|
+
mutations and reaches `fieldValuesAttributes` wherever it nests — under
|
|
20
|
+
`contactAttributes.contactableAttributes`, inside `pageBlocksAttributes[]`, and
|
|
21
|
+
on the 15 other `*Attributes` types that carry it. Already-wrapped payloads,
|
|
22
|
+
`content` payloads themselves, the caller's object, and every untouched subtree
|
|
23
|
+
are left alone by reference. Reads (`query`) are unaffected.
|
|
24
|
+
|
|
25
|
+
The helpers are exported as `normalizeFieldValueContent` and
|
|
26
|
+
`normalizeFieldValuesAttributes` for callers that assemble
|
|
27
|
+
`fieldValuesAttributes` outside the SDK.
|
|
28
|
+
|
|
29
|
+
## 3.4.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- 689299a: Select `publicUrl` in the `ListCalls` query so `listCalls` — and the derived `listJobs` — expose `publicUrl` on every record. Previously it was only selected in `GetCall`, so list results carried `publicPath` but not the absolute `publicUrl`, despite the `Call` type advertising it.
|
|
34
|
+
|
|
3
35
|
## 3.4.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
|
@@ -15,6 +15,7 @@ export declare function listCalls(client: UiduClient, variables?: ListCallsQuery
|
|
|
15
15
|
salaryMax?: number | null;
|
|
16
16
|
publishedAt?: any | null;
|
|
17
17
|
expiresAt?: any | null;
|
|
18
|
+
publicUrl?: string | null;
|
|
18
19
|
publicPath?: string | null;
|
|
19
20
|
published?: boolean | null;
|
|
20
21
|
primaryAddress?: {
|
|
@@ -25534,6 +25534,8 @@ export type NoteAttributes = {
|
|
|
25534
25534
|
relatedAttributes?: InputMaybe<Array<RelationshipAttributes>>;
|
|
25535
25535
|
/** Relationships */
|
|
25536
25536
|
relationshipsAttributes?: InputMaybe<Array<RelationshipAttributes>>;
|
|
25537
|
+
/** The app instance this note lives in */
|
|
25538
|
+
workspaceAppId?: InputMaybe<Scalars['ID']['input']>;
|
|
25537
25539
|
};
|
|
25538
25540
|
/** The connection type for Note. */
|
|
25539
25541
|
export type NoteConnection = {
|
|
@@ -25623,7 +25625,7 @@ export type NoteTemplateEdge = {
|
|
|
25623
25625
|
node?: Maybe<NoteTemplate>;
|
|
25624
25626
|
};
|
|
25625
25627
|
/** Objects can be applied to */
|
|
25626
|
-
export type Notifiable = Application | Blob | Comment | Contact | Donation | EventStoreEvent | Export | FormResponse | Import | Mention | Order | Task | Ticket;
|
|
25628
|
+
export type Notifiable = Application | Blob | Comment | Contact | Donation | EventStoreEvent | Export | FormResponse | Import | Mention | Order | Space | Task | Ticket | Workspace;
|
|
25627
25629
|
export type Notification = ActiveRecordTimestamp & Node & {
|
|
25628
25630
|
__typename?: 'Notification';
|
|
25629
25631
|
createdAt: Scalars['ISO8601DateTime']['output'];
|
|
@@ -42705,6 +42707,7 @@ export type ListCallsQuery = {
|
|
|
42705
42707
|
salaryMax?: number | null;
|
|
42706
42708
|
publishedAt?: any | null;
|
|
42707
42709
|
expiresAt?: any | null;
|
|
42710
|
+
publicUrl?: string | null;
|
|
42708
42711
|
publicPath?: string | null;
|
|
42709
42712
|
published?: boolean | null;
|
|
42710
42713
|
primaryAddress?: {
|
|
@@ -3,10 +3,11 @@ export { UiduError } from "./types.js";
|
|
|
3
3
|
export type { UiduClientConfig, UiduErrorOptions } from "./types.js";
|
|
4
4
|
export { paginate } from "./utils/paginate.js";
|
|
5
5
|
export type { PaginateOptions } from "./utils/paginate.js";
|
|
6
|
+
export { normalizeFieldValueContent, normalizeFieldValuesAttributes, } from "./utils/fieldValues.js";
|
|
6
7
|
export { ListApplicationsDocument, ListBookingsDocument, ListCalendarsDocument, ListCalendarEventsDocument, ListCallsDocument, ListCampaignsDocument, ListEmailCampaignsDocument, ListCoursesDocument, ListDealsDocument, ListDonationCampaignsDocument, ListEmployeesDocument, ListEnrollmentsDocument, ListEventsDocument, ListFormsDocument, ListKbArticlesDocument, ListKbCollectionsDocument, ListLecturesDocument, ListPagesDocument, ListStoriesDocument, } from "./generated/index.js";
|
|
7
8
|
export { getPage, listPages, getTemplate, createProject, createPage, createPageBlock, createFieldValue, } from "./cms.js";
|
|
8
9
|
export type { Page, Template } from "./cms.js";
|
|
9
|
-
export { createWorkspace, generateWorkspaceApiCredentials
|
|
10
|
+
export { createWorkspace, generateWorkspaceApiCredentials } from "./system.js";
|
|
10
11
|
export { createSpace } from "./spaces.js";
|
|
11
12
|
export { createTask } from "./tasks.js";
|
|
12
13
|
export { createNote } from "./notes.js";
|
|
@@ -35,9 +36,9 @@ export { getBooking, listBookings, getCalendar, listCalendars, getCalendarEvent,
|
|
|
35
36
|
export type { Booking, Calendar, CalendarEvent } from "./bookings.js";
|
|
36
37
|
export { getCourse, listCourses, getEnrollment, listEnrollments, getLecture, listLectures, } from "./courses.js";
|
|
37
38
|
export type { Course, Enrollment, Lecture } from "./courses.js";
|
|
38
|
-
export { getCampaign, listCampaigns, listEmailCampaigns
|
|
39
|
+
export { getCampaign, listCampaigns, listEmailCampaigns } from "./campaigns.js";
|
|
39
40
|
export type { Campaign } from "./campaigns.js";
|
|
40
|
-
export { getContact, listContacts, getDeal, listDeals
|
|
41
|
+
export { getContact, listContacts, getDeal, listDeals } from "./contacts.js";
|
|
41
42
|
export type { Contact, Deal } from "./contacts.js";
|
|
42
43
|
export { getKbArticle, listKbArticles, getKbCollection, listKbCollections, } from "./kb.js";
|
|
43
44
|
export type { KbArticle, KbCollection } from "./kb.js";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The API stores every answer in a `content` JSON column and reads it back with
|
|
3
|
+
* `content['value']` — so `content` must always be an object shaped
|
|
4
|
+
* `{ value: <the answer> }`, never the bare answer.
|
|
5
|
+
*
|
|
6
|
+
* Passing a flat scalar (`content: 'hello'`) is the single most common mistake
|
|
7
|
+
* when writing field values by hand or via a code-generating agent: the server
|
|
8
|
+
* accepts the mutation but the typed columns silently stay empty, and later
|
|
9
|
+
* reads of that field blow up. We normalize here so the flat shape is
|
|
10
|
+
* impossible to send rather than merely documented.
|
|
11
|
+
*
|
|
12
|
+
* `fieldValuesAttributes` shows up on 15 different `*Attributes` types and
|
|
13
|
+
* nests arbitrarily (`contactAttributes.contactableAttributes.…`,
|
|
14
|
+
* `pageAttributes.pageBlocksAttributes[].…`), so the walk below is keyed on the
|
|
15
|
+
* property name at any depth rather than on a fixed path. It runs once per
|
|
16
|
+
* mutation in `UiduClient.mutate`.
|
|
17
|
+
*/
|
|
18
|
+
type FieldValueLike = {
|
|
19
|
+
content?: unknown;
|
|
20
|
+
} & Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a `content` payload in `{ value }` unless it already carries a `value`
|
|
23
|
+
* key. Returns the input untouched when there is nothing to do.
|
|
24
|
+
*/
|
|
25
|
+
export declare function normalizeFieldValueContent(content: unknown): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a standalone `fieldValuesAttributes` array. Exported for callers
|
|
28
|
+
* that assemble one by hand outside an SDK mutation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeFieldValuesAttributes<T extends FieldValueLike>(attributes: ReadonlyArray<T | null | undefined> | null | undefined): typeof attributes;
|
|
31
|
+
/**
|
|
32
|
+
* Normalize every `fieldValuesAttributes` array reachable from a mutation's
|
|
33
|
+
* variables, at any depth. Returns the input untouched — same reference, and
|
|
34
|
+
* same references for every unchanged subtree — when there is nothing to do.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeMutationVariables<V>(variables: V): V;
|
|
37
|
+
export {};
|