Skip to content

Commit

Permalink
Merge pull request #24 from gandalf-network/staging
Browse files Browse the repository at this point in the history
Staging -> Prod [ Gandalf Email Trait ]
  • Loading branch information
TosinJs authored Jun 12, 2024
2 parents 784ccd8 + f31f3b9 commit 8abe582
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ import Connect from "@gandalf-network/connect";
const connect = new Connect({
publicKey: process.env.PUBLIC_KEY,
redirectURL: "YOUR_REDIRECT_URL",
services: { "NETFLIX": true } // At least one service is required
services:
{
uber: {
traits: ["rating"], // At least one trait or activity is required
activities: ["trip"],
},
gandalf: {
traits: ["email"]
}
} // Only one non "Gandalf" service (e.g "netflix", "instacart") is supported per Connect URL
})
```

Expand All @@ -43,7 +52,16 @@ const Connect = require("@gandalf-network/connect");
const connect = new Connect({
publicKey: process.env.PUBLIC_KEY,
redirectURL: "YOUR_REDIRECT_URL",
services: { "NETFLIX": true } // At least one service is required
services:
{
uber: {
traits: ["rating"], // At least one trait or activity is required
activities: ["trip"],
},
gandalf: {
traits: ["email"]
}
} // Only one non "Gandalf" service (e.g "uber", "amazon") is supported per Connect URL
})
```

Expand Down
3 changes: 3 additions & 0 deletions examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const services: InputData = {
traits: [TraitLabel.Plan],
activities: [ActivityType.Trip],
},
gandalf: {
traits: ["email"]
}
}

async function example() {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gandalf-network/connect",
"version": "1.0.8",
"version": "1.0.9",
"description": "",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ class Connect {

const keys = Object.keys(input).map((key) => key.toLowerCase());

if (keys.length > 1) {
if (keys.length > 2 || (keys.length === 2 && !keys.includes('gandalf'))) {
throw new GandalfError(
`Only one service is supported per Connect URL`,
`Only one non Gandalf service is supported per Connect URL`,
GandalfErrorCode.InvalidService,
);
}
Expand Down Expand Up @@ -266,4 +266,4 @@ class Connect {
}
}

export default Connect;
export default Connect;
5 changes: 4 additions & 1 deletion tests/connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ describe("Connect SDK", () => {
traits: ["rating"],
activities: ["trip"],
},
gandalf: {
traits: ["email"],
}
}
const stringData = JSON.stringify(services);

Expand Down Expand Up @@ -206,7 +209,7 @@ describe("Connect SDK", () => {
});

await expect(connect.generateURL()).rejects.toThrow(
"Only one service is supported per Connect URL",
"Only one non Gandalf service is supported per Connect URL",
);
expect(connect.verificationComplete).toEqual(false);
});
Expand Down

0 comments on commit 8abe582

Please sign in to comment.