@uidu/client 3.9.0 → 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 +9 -0
- package/dist/declarations/src/actions.d.ts +12 -0
- package/dist/declarations/src/client.d.ts +15 -0
- package/dist/declarations/src/generated/index.d.ts +7389 -16
- package/dist/declarations/src/index.d.ts +4 -1
- package/dist/declarations/src/models.d.ts +326 -0
- package/dist/declarations/src/types.d.ts +8 -1
- package/dist/uidu-client.cjs.dev.js +281 -2
- package/dist/uidu-client.cjs.prod.js +281 -2
- package/dist/uidu-client.esm.js +261 -3
- package/package.json +1 -1
- package/src/actions.ts +19 -0
- package/src/client.test.ts +56 -0
- package/src/client.ts +47 -4
- package/src/generated/index.ts +3572 -16
- package/src/index.ts +31 -1
- package/src/models.test.ts +245 -0
- package/src/models.ts +328 -0
- package/src/queries/actions/ExecuteAction.graphql +10 -0
- package/src/queries/models/ModelFields.graphql +39 -0
- package/src/queries/models/ModelMutations.graphql +173 -0
- package/src/queries/models/ModelQueries.graphql +44 -0
- package/src/types.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
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
|
+
|
|
3
12
|
## 3.9.0
|
|
4
13
|
|
|
5
14
|
### Minor 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>;
|
|
@@ -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;
|