oc-server 0.4.0 → 0.4.2
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/dist/Server.d.ts +2 -2
- package/dist/serverClient.js +3 -1
- package/package.json +1 -1
package/dist/Server.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export type ServerContext<E = unknown> = Omit<DataContext<any, E>, 'params' | 'a
|
|
|
3
3
|
export type Action<I, O, E> = (params: I, ctx: ServerContext<E>) => Promise<O> | O;
|
|
4
4
|
type AnyAction = Action<any, any, any>;
|
|
5
5
|
export declare class Server<E, A extends Record<string, AnyAction> = {}, InitialInput = any, InitialOutput = any> {
|
|
6
|
-
|
|
7
|
-
actions: A;
|
|
6
|
+
readonly initial: Action<InitialInput, InitialOutput, E>;
|
|
7
|
+
readonly actions: A;
|
|
8
8
|
constructor(initial: Action<InitialInput, InitialOutput, E>);
|
|
9
9
|
action<ActionName extends string, I, O>(name: ActionName, action: Action<I, O, E>): Server<E, A & Record<ActionName, Action<I, O, E>>, InitialInput, InitialOutput>;
|
|
10
10
|
getData(): DataProvider<any, any, any>;
|
package/dist/serverClient.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
/// <reference types="oc-vite/client" />
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.serverClient = void 0;
|
|
5
|
+
const Server_1 = require("./Server");
|
|
5
6
|
exports.serverClient = new Proxy({}, {
|
|
6
7
|
get(_target, prop) {
|
|
7
8
|
return (data) => {
|
|
8
9
|
const componentName = 'COMPONENT_NAME';
|
|
9
10
|
const componentVersion = 'COMPONENT_VERSION';
|
|
10
|
-
const baseUrl =
|
|
11
|
+
const baseUrl = (0, Server_1.getSettings)().baseUrl ??
|
|
12
|
+
window.oc?.renderedComponents?.[componentName]?.baseUrl;
|
|
11
13
|
return window.oc.getAction({
|
|
12
14
|
action: prop,
|
|
13
15
|
baseUrl,
|