2020-08-24 11:35:32 +00:00
|
|
|
import { exportMethodToDispatcher, exportPropertyToDispatcher, exportsElementsToDispatcher } from "../lib/dispatcher/nopeDispatcherDecorators";
|
2020-08-23 07:28:03 +00:00
|
|
|
import { nopeObservable } from "../lib/observables/nopeObservable";
|
2020-08-24 11:35:32 +00:00
|
|
|
import { exportMethodToOpenAPI, exportsElementsToOpenAPI } from "../lib/openapi/nopeOpenAPIDecorators";
|
2020-08-23 07:28:03 +00:00
|
|
|
import { IF01 } from "./testExternalDescriptor";
|
|
|
|
import { IF02 } from "./testExternalDescriptorReference";
|
|
|
|
|
2020-08-23 09:23:38 +00:00
|
|
|
export interface IF00 {
|
2020-08-24 07:39:55 +00:00
|
|
|
// Test property
|
2020-08-23 09:23:38 +00:00
|
|
|
hello: 'world'
|
|
|
|
}
|
|
|
|
|
2020-08-24 11:35:32 +00:00
|
|
|
@exportsElementsToOpenAPI({
|
|
|
|
uri: 'test'
|
|
|
|
})
|
2020-08-24 07:39:55 +00:00
|
|
|
@exportsElementsToDispatcher({
|
|
|
|
uri: 'test'
|
|
|
|
})
|
2020-08-23 07:28:03 +00:00
|
|
|
export class CLWithInterface {
|
|
|
|
@exportPropertyToDispatcher
|
|
|
|
exportedAttributeSimple = new nopeObservable<boolean>(false);
|
2020-08-24 11:35:32 +00:00
|
|
|
|
2020-08-23 07:28:03 +00:00
|
|
|
@exportPropertyToDispatcher
|
|
|
|
exportedAttributeComplex = new nopeObservable<{
|
2020-08-24 07:39:55 +00:00
|
|
|
element01: IF00,
|
2020-08-23 07:28:03 +00:00
|
|
|
num: number
|
|
|
|
}>({
|
2020-08-24 07:39:55 +00:00
|
|
|
element01: {
|
2020-08-24 11:35:32 +00:00
|
|
|
hello: "world"
|
2020-08-24 07:39:55 +00:00
|
|
|
},
|
2020-08-23 07:28:03 +00:00
|
|
|
num: 0
|
|
|
|
});
|
|
|
|
|
2020-08-24 07:39:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Function which will add two Nodes.
|
|
|
|
* @param a Parameter a
|
|
|
|
* @param b Parameter b
|
|
|
|
*/
|
2020-08-24 11:35:32 +00:00
|
|
|
@exportMethodToOpenAPI()
|
2020-08-24 07:39:55 +00:00
|
|
|
@exportMethodToDispatcher({
|
|
|
|
url: 'exportedFunction'
|
|
|
|
})
|
2020-08-24 11:35:32 +00:00
|
|
|
async exportedFunctionShouldNotBeHosted(/* COMMENT */ a: number, b: IF00, operator: (a: number, b: IF01) => Promise<{
|
2020-08-24 07:39:55 +00:00
|
|
|
test: IF02,
|
|
|
|
x: string
|
2020-08-24 11:35:32 +00:00
|
|
|
}>) {
|
|
|
|
// Comment etc.
|
|
|
|
return await operator(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
@exportMethodToOpenAPI()
|
|
|
|
@exportMethodToDispatcher({
|
|
|
|
url: 'exportedFunction'
|
|
|
|
})
|
|
|
|
async exportedFunctionShouldBeHosted(/* COMMENT */ a: number, b?: number) {
|
2020-08-24 07:39:55 +00:00
|
|
|
// Comment etc.
|
2020-08-24 11:35:32 +00:00
|
|
|
return a + b || 0;
|
2020-08-23 07:28:03 +00:00
|
|
|
}
|
|
|
|
|
2020-08-24 11:35:32 +00:00
|
|
|
|
2020-08-24 07:39:55 +00:00
|
|
|
/**
|
|
|
|
* Function which will add two Nodes.
|
|
|
|
* @param a Parameter a
|
|
|
|
* @param b Parameter b
|
|
|
|
*/
|
|
|
|
@exportMethodToDispatcher({
|
|
|
|
url: 'exportedStringFunction'
|
|
|
|
})
|
2020-08-24 11:35:32 +00:00
|
|
|
async exportedStringFunction(a: string, b: string) {
|
2020-08-24 07:39:55 +00:00
|
|
|
// Comment etc.
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2020-08-24 11:35:32 +00:00
|
|
|
exportedFunctionWithError(a: number, b: number, operator: (a: number, b: number) => Promise<number>) {
|
|
|
|
return operator(a, b);
|
2020-08-23 07:28:03 +00:00
|
|
|
}
|
|
|
|
}
|