@uidu/client 3.7.1 → 3.10.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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @uidu/client
2
2
 
3
+ ## 3.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 77ea8c5: Custom Space apps, SDK side (protocol v1).
8
+ - New `@uidu/app-bridge`: `connect()` does the postMessage handshake with the uidu page framing the app (origin-checked, trusts `https://*.uidu.org` by default plus explicit `hostOrigins`), exposes the typed `context`, and `getToken()` caches the short-lived session token and refreshes it through the host, sharing one refresh between concurrent callers.
9
+ - `@uidu/client`: `createClient({ endpoint, getToken })` asks for a Bearer token per request; `workspace` is optional when `endpoint` is given; `fromBridge(bridge)` builds that config. New `models` module (`listModels`, `getModel`, `listModelItems`, `getModelItem`, create/update/delete for models, fields, field options, model items and field values, `toFieldValuesAttributes`, `ensureModel`) reading through `node(id:)`, the only query root a custom app token has.
10
+ - `@uidu/react`: `<UiduAppProvider>` / `useUiduApp()` over the bridge — `connecting` / `ready` / `error`, with a session-backed client and a `<UiduProvider>` around ready children.
11
+
12
+ ## 3.9.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 454f652: Add `createBenefit` — provisions a benefit plan (`name`, `category`,
17
+ `currency`, `activeFrom`, plus employer/employee cost and eligibility
18
+ attributes). First-class operation backed by a new `CreateBenefit` document;
19
+ requires a Bearer token (`apiKey`), like the other HR writes.
20
+
21
+ ## 3.8.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 6d16ea2: Add `createBenefitEnrollment` — enrolls an employment in a benefit plan
26
+ (`benefitId`, `employmentId`, `enrolledAt`, plus optional `coverage` and cost
27
+ overrides). First-class operation backed by a new `CreateBenefitEnrollment`
28
+ document; requires a Bearer token (`apiKey`), like the other HR writes.
29
+ - df6e473: Add `createCcnl`, provisioning the first-class `Ccnl` record (a national
30
+ collective labor contract — code, sector, contract levels). This is distinct
31
+ from the `Kind`-tagged rows `listCcnls` already returned for populating an
32
+ employment's `ccnlId`; `Employment.ccnl`/`ccnlId` in fact point at this
33
+ first-class type. Requires a Bearer token (`apiKey`).
34
+
35
+ `@uidu/cli`: adds `create` to the existing `ccnls` resource, alongside its
36
+ `list`.
37
+
3
38
  ## 3.7.1
4
39
 
5
40
  ### Patch Changes
@@ -0,0 +1,12 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type ExecuteActionMutationVariables } from "./generated/index.js";
3
+ export declare function executeAction(client: UiduClient, variables: ExecuteActionMutationVariables): Promise<{
4
+ __typename?: "ExecuteActionPayload";
5
+ result?: any | null;
6
+ errors: Array<{
7
+ __typename?: "Error";
8
+ key: string;
9
+ name: string;
10
+ type: string;
11
+ }>;
12
+ } | null>;
@@ -0,0 +1,20 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type CreateBenefitEnrollmentMutationVariables } from "./generated/index.js";
3
+ export declare function createBenefitEnrollment(client: UiduClient, variables: CreateBenefitEnrollmentMutationVariables): Promise<{
4
+ __typename?: "CreateBenefitEnrollmentPayload";
5
+ benefitEnrollment?: {
6
+ __typename?: "BenefitEnrollmentEdge";
7
+ node?: {
8
+ __typename?: "BenefitEnrollment";
9
+ id: string;
10
+ humanName: string;
11
+ enrolledAt: any;
12
+ } | null;
13
+ } | null;
14
+ errors: Array<{
15
+ __typename?: "Error";
16
+ key: string;
17
+ name: string;
18
+ type: string;
19
+ }>;
20
+ } | null>;
@@ -0,0 +1,20 @@
1
+ import type { UiduClient } from "./client.js";
2
+ import { type CreateBenefitMutationVariables } from "./generated/index.js";
3
+ export declare function createBenefit(client: UiduClient, variables: CreateBenefitMutationVariables): Promise<{
4
+ __typename?: "CreateBenefitPayload";
5
+ benefit?: {
6
+ __typename?: "BenefitEdge";
7
+ node?: {
8
+ __typename?: "Benefit";
9
+ id: string;
10
+ name: string;
11
+ category: string;
12
+ } | null;
13
+ } | null;
14
+ errors: Array<{
15
+ __typename?: "Error";
16
+ key: string;
17
+ name: string;
18
+ type: string;
19
+ }>;
20
+ } | null>;
@@ -3,8 +3,23 @@ import { type UiduClientConfig } from "./types.js";
3
3
  export declare class UiduClient {
4
4
  readonly endpoint: string;
5
5
  private readonly client;
6
+ private readonly getToken?;
6
7
  constructor(config: UiduClientConfig);
7
8
  query<TResult, TVariables extends object = Record<string, never>>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables): Promise<TResult>;
9
+ private tokenFor;
8
10
  mutate<TResult, TVariables extends object = Record<string, never>>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables): Promise<TResult>;
9
11
  }
10
12
  export declare function createClient(config: UiduClientConfig): UiduClient;
13
+ /**
14
+ * Client config for a custom app, from a connected `@uidu/app-bridge`:
15
+ *
16
+ * ```ts
17
+ * const client = createClient(fromBridge(await connect()));
18
+ * ```
19
+ *
20
+ * Typed structurally so `@uidu/client` doesn't depend on the bridge.
21
+ */
22
+ export declare function fromBridge(bridge: {
23
+ graphqlUrl: string;
24
+ getToken: () => Promise<string>;
25
+ }): UiduClientConfig;