@suprsend/node-sdk 0.0.5 → 0.1.1
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/event.js +205 -0
- package/dist/identity.js +417 -0
- package/dist/identity_helper.js +648 -0
- package/dist/index.js +12 -0
- package/dist/request_json/event.json +47 -0
- package/dist/request_json/workflow.json +49 -3
- package/dist/signature.js +1 -1
- package/dist/utils.js +42 -32
- package/dist/workflow.js +4 -2
- package/package.json +10 -7
- package/src/event.js +148 -0
- package/src/identity.js +281 -0
- package/src/identity_helper.js +463 -0
- package/src/index.js +8 -0
- package/src/request_json/event.json +47 -0
- package/src/request_json/workflow.json +49 -3
- package/src/signature.js +1 -4
- package/src/utils.js +28 -23
- package/src/workflow.js +5 -3
package/src/workflow.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import get_request_signature from "./signature";
|
|
2
2
|
import { Validator } from "jsonschema";
|
|
3
|
-
import {
|
|
3
|
+
import { SuprsendError } from "./utils";
|
|
4
4
|
import axios from "axios";
|
|
5
5
|
|
|
6
|
+
const workflow_schema = require("./request_json/workflow.json");
|
|
7
|
+
|
|
6
8
|
class Workflow {
|
|
7
9
|
constructor(ss_instance, data) {
|
|
8
10
|
this.ss_instance = ss_instance;
|
|
@@ -38,7 +40,7 @@ class Workflow {
|
|
|
38
40
|
const signature = get_request_signature(
|
|
39
41
|
this.url,
|
|
40
42
|
"POST",
|
|
41
|
-
|
|
43
|
+
content_text,
|
|
42
44
|
headers,
|
|
43
45
|
this.ss_instance.env_secret
|
|
44
46
|
);
|
|
@@ -67,7 +69,7 @@ class Workflow {
|
|
|
67
69
|
if (!(this.data.data instanceof Object)) {
|
|
68
70
|
throw new SuprsendError("data must be a object");
|
|
69
71
|
}
|
|
70
|
-
const schema =
|
|
72
|
+
const schema = workflow_schema;
|
|
71
73
|
var v = new Validator();
|
|
72
74
|
const validated_data = v.validate(this.data, schema);
|
|
73
75
|
if (validated_data.valid) {
|