@roadwork/dapr-js-sdk
Advanced tools
Comparing version 0.1.25 to 0.1.26
@@ -0,5 +1,6 @@ | ||
import Dapr from './Dapr'; | ||
import { Request as Req, Response as Res } from 'restana'; | ||
import Dapr from './Dapr'; | ||
import { InvokerListenOptionsMethod } from './enum/InvokerListenOptionsMethod.enum'; | ||
import { HttpMethod } from './enum/HttpMethod.enum'; | ||
import HttpStatusCode from './enum/HttpStatusCode.enum'; | ||
export default Dapr; | ||
export { InvokerListenOptionsMethod, Req, Res }; | ||
export { HttpMethod, HttpStatusCode, Req, Res }; |
@@ -6,6 +6,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InvokerListenOptionsMethod = void 0; | ||
exports.HttpStatusCode = exports.HttpMethod = void 0; | ||
var Dapr_1 = __importDefault(require("./Dapr")); | ||
var InvokerListenOptionsMethod_enum_1 = require("./enum/InvokerListenOptionsMethod.enum"); | ||
Object.defineProperty(exports, "InvokerListenOptionsMethod", { enumerable: true, get: function () { return InvokerListenOptionsMethod_enum_1.InvokerListenOptionsMethod; } }); | ||
var HttpMethod_enum_1 = require("./enum/HttpMethod.enum"); | ||
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return HttpMethod_enum_1.HttpMethod; } }); | ||
var HttpStatusCode_enum_1 = __importDefault(require("./enum/HttpStatusCode.enum")); | ||
exports.HttpStatusCode = HttpStatusCode_enum_1.default; | ||
exports.default = Dapr_1.default; |
import { TypeDaprInvokerCallback } from '../types/DaprInvokerCallback.type'; | ||
import { InvokerListenOptionsType } from '../types/InvokerListenOptions.type'; | ||
import { InvokerListenOptionsMethod } from '../enum/InvokerListenOptionsMethod.enum'; | ||
import { HttpMethod } from '../enum/HttpMethod.enum'; | ||
export default class DaprInvoker { | ||
@@ -8,3 +8,3 @@ daprUrl: string; | ||
listen(methodName: string, cb: TypeDaprInvokerCallback, options?: InvokerListenOptionsType): Promise<void>; | ||
invoke(appId: string, methodName: string, data?: object, method?: InvokerListenOptionsMethod): Promise<object>; | ||
invoke(appId: string, methodName: string, method?: HttpMethod, data?: object): Promise<object>; | ||
} |
@@ -44,3 +44,3 @@ "use strict"; | ||
var Response_util_1 = __importDefault(require("../utils/Response.util")); | ||
var InvokerListenOptionsMethod_enum_1 = require("../enum/InvokerListenOptionsMethod.enum"); | ||
var HttpMethod_enum_1 = require("../enum/HttpMethod.enum"); | ||
var WebServerSingleton_1 = __importDefault(require("./WebServer/WebServerSingleton")); | ||
@@ -61,3 +61,3 @@ // https://docs.dapr.io/reference/api/service_invocation_api/ | ||
case 0: | ||
serverMethod = ((_a = options === null || options === void 0 ? void 0 : options.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || InvokerListenOptionsMethod_enum_1.InvokerListenOptionsMethod.GET; | ||
serverMethod = ((_a = options === null || options === void 0 ? void 0 : options.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || HttpMethod_enum_1.HttpMethod.GET; | ||
return [4 /*yield*/, WebServerSingleton_1.default.getServer()]; | ||
@@ -86,5 +86,5 @@ case 1: | ||
}; | ||
DaprInvoker.prototype.invoke = function (appId, methodName, data, method) { | ||
DaprInvoker.prototype.invoke = function (appId, methodName, method, data) { | ||
if (method === void 0) { method = HttpMethod_enum_1.HttpMethod.GET; } | ||
if (data === void 0) { data = {}; } | ||
if (method === void 0) { method = InvokerListenOptionsMethod_enum_1.InvokerListenOptionsMethod.GET; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -98,3 +98,3 @@ var fetchOptions, res; | ||
}; | ||
if (method !== InvokerListenOptionsMethod_enum_1.InvokerListenOptionsMethod.GET) { | ||
if (method !== HttpMethod_enum_1.HttpMethod.GET) { | ||
// @ts-ignore | ||
@@ -105,3 +105,3 @@ fetchOptions.headers = { | ||
} | ||
if (method !== InvokerListenOptionsMethod_enum_1.InvokerListenOptionsMethod.GET && data !== {}) { | ||
if (method !== HttpMethod_enum_1.HttpMethod.GET && data !== {}) { | ||
// @ts-ignore | ||
@@ -108,0 +108,0 @@ fetchOptions.body = JSON.stringify(data); |
@@ -1,4 +0,4 @@ | ||
import { InvokerListenOptionsMethod } from "../enum/InvokerListenOptionsMethod.enum"; | ||
import { HttpMethod } from "../enum/HttpMethod.enum"; | ||
export declare type InvokerListenOptionsType = { | ||
method?: InvokerListenOptionsMethod; | ||
method?: HttpMethod; | ||
}; |
{ | ||
"name": "@roadwork/dapr-js-sdk", | ||
"version": "0.1.25", | ||
"version": "0.1.26", | ||
"description": "An unofficial Dapr (https://dapr.io) SDK for Node.js", | ||
@@ -5,0 +5,0 @@ "types": "http/index.d.ts", |
2227
117920