dry-ux 1.23.0 → 1.24.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.
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
declare type
|
|
1
|
+
declare type Args<T> = {
|
|
2
2
|
args?: T;
|
|
3
3
|
skipAuthCheck?: boolean;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
declare type Result<T = void> = T extends void ? Promise<any> : Promise<T>;
|
|
6
|
+
export declare type DajaxiceFn<TArgs> = <TResult = void>(args?: Args<TArgs>) => Result<TResult>;
|
|
6
7
|
/**
|
|
7
8
|
* This function is used to create a type safe proxy for the Dajaxice functions.
|
|
8
9
|
* @param modules: The modules object from the Dajaxice generated file.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DajaxiceFn } from "./DajaxiceProxy";
|
|
2
|
+
export declare const modules: DajaxiceModules;
|
|
3
|
+
export declare type DajaxiceModules = {
|
|
4
|
+
employee?: {
|
|
5
|
+
getDetails: DajaxiceFn<{
|
|
6
|
+
id: number;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
organization?: {
|
|
10
|
+
setName: DajaxiceFn<{
|
|
11
|
+
name: string;
|
|
12
|
+
}>;
|
|
13
|
+
getName: DajaxiceFn<{}>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modules = void 0;
|
|
4
|
+
const DajaxiceProxy_1 = require("./DajaxiceProxy");
|
|
5
|
+
exports.modules = {};
|
|
6
|
+
const Api = (0, DajaxiceProxy_1.DajaxiceProxy)({
|
|
7
|
+
modules: exports.modules,
|
|
8
|
+
});
|
|
9
|
+
Api.employee.getDetails({ args: { id: 1 } }).then(res => {
|
|
10
|
+
console.log(res.name, res.id);
|
|
11
|
+
});
|
|
12
|
+
Api.organization.setName({ args: { name: "test" } }).then(res => {
|
|
13
|
+
console.log(res);
|
|
14
|
+
});
|
|
15
|
+
Api.organization.getName().then(res => {
|
|
16
|
+
console.log(res);
|
|
17
|
+
});
|