@pipedream/addressfinder 0.0.1 → 0.1.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.
@@ -0,0 +1,77 @@
1
+ import addressfinder from "../../addressfinder.app.mjs";
2
+
3
+ export default {
4
+ key: "addressfinder-verify-address-au",
5
+ name: "Verify Australian Address",
6
+ description: "Validates an Australian address. [See the documentation](https://addressfinder.com.au/api/au/address/verification/)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ addressfinder,
11
+ address: {
12
+ type: "string",
13
+ label: "Address",
14
+ description: "The Australian address to be verified, e.g. `30 Hoipo Road, SOMERSBY NSW`",
15
+ },
16
+ database: {
17
+ type: "string[]",
18
+ label: "Database(s)",
19
+ description: "Which database(s) to return data from",
20
+ options: [
21
+ {
22
+ value: "gnaf",
23
+ label: "Return physical addresses from the GNAF database.",
24
+ },
25
+ {
26
+ value: "paf",
27
+ label: "Return postal addresses from the PAF database.",
28
+ },
29
+ ],
30
+ },
31
+ gps: {
32
+ type: "boolean",
33
+ label: "GPS Coordinates",
34
+ description: "Return GPS coordinates from the datasource specified (when available)",
35
+ optional: true,
36
+ },
37
+ extended: {
38
+ type: "boolean",
39
+ label: "Extended",
40
+ description: "Returns extended information from the GNAF database",
41
+ optional: true,
42
+ },
43
+ domain: {
44
+ propDefinition: [
45
+ addressfinder,
46
+ "domain",
47
+ ],
48
+ },
49
+ },
50
+ async run({ $ }) {
51
+ const {
52
+ address, database, domain,
53
+ } = this;
54
+ const response = await this.addressfinder.verifyAustralianAddress({
55
+ $,
56
+ params: {
57
+ q: address,
58
+ ...(database?.includes?.("gnaf") && {
59
+ gnaf: 1,
60
+ }),
61
+ ...(database?.includes?.("paf") && {
62
+ paf: 1,
63
+ }),
64
+ ...(this.gps && {
65
+ gps: 1,
66
+ }),
67
+ ...(this.extended && {
68
+ extended: 1,
69
+ }),
70
+ domain,
71
+ },
72
+ });
73
+
74
+ $.export("$summary", `Successfully verified AU address "${address}"`);
75
+ return response;
76
+ },
77
+ };
@@ -0,0 +1,35 @@
1
+ import addressfinder from "../../addressfinder.app.mjs";
2
+
3
+ export default {
4
+ key: "addressfinder-verify-address-nz",
5
+ name: "Verify New Zealand Address",
6
+ description: "Validates a New Zealand address. [See the documentation](https://addressfinder.com.au/api/nz/address/verification/)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ addressfinder,
11
+ address: {
12
+ type: "string",
13
+ label: "New Zealand Address",
14
+ description: "The New Zealand address to be verified, e.g. `186 Willis St, Te Aro`",
15
+ },
16
+ domain: {
17
+ propDefinition: [
18
+ addressfinder,
19
+ "domain",
20
+ ],
21
+ },
22
+ },
23
+ async run({ $ }) {
24
+ const { address } = this;
25
+ const response = await this.addressfinder.verifyNewZealandAddress({
26
+ $,
27
+ params: {
28
+ q: address,
29
+ domain: this.domain,
30
+ },
31
+ });
32
+ $.export("$summary", `Successfully verified NZ address "${address}"`);
33
+ return response;
34
+ },
35
+ };
@@ -0,0 +1,59 @@
1
+ import addressfinder from "../../addressfinder.app.mjs";
2
+
3
+ export default {
4
+ key: "addressfinder-verify-email",
5
+ name: "Verify Email",
6
+ description: "Validates the input email. [See the documentation](https://addressfinder.com.au/api/email/verification/)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ addressfinder,
11
+ email: {
12
+ type: "string",
13
+ label: "Email Address",
14
+ description: "The email address to be verified",
15
+ },
16
+ domain: {
17
+ propDefinition: [
18
+ addressfinder,
19
+ "domain",
20
+ ],
21
+ },
22
+ features: {
23
+ type: "string[]",
24
+ label: "Features",
25
+ description: "The methods of verification to be completed. This will impact the query processing time and data returned in the response.",
26
+ optional: true,
27
+ options: [
28
+ {
29
+ label: "Domain - a check to verify that the domain of the email address is configured to receive emails.",
30
+ value: "domain",
31
+ },
32
+ {
33
+ label: "Connection - a check to verify that the email account exists at the provided domain.",
34
+ value: "connection",
35
+ },
36
+ {
37
+ label: "Email provider - a check that determines the underlaying provider of the email service.",
38
+ value: "provider",
39
+ },
40
+ ],
41
+ },
42
+ },
43
+ async run({ $ }) {
44
+ const {
45
+ email, domain,
46
+ } = this;
47
+ const response = await this.addressfinder.verifyEmailAddress({
48
+ $,
49
+ params: {
50
+ email,
51
+ domain,
52
+ features: this.features?.join?.(),
53
+ },
54
+ });
55
+
56
+ $.export("$summary", `Successfully verified email ${email}`);
57
+ return response;
58
+ },
59
+ };
@@ -1,11 +1,55 @@
1
+ import { axios } from "@pipedream/platform";
2
+
1
3
  export default {
2
4
  type: "app",
3
5
  app: "addressfinder",
4
- propDefinitions: {},
6
+ propDefinitions: {
7
+ domain: {
8
+ type: "string",
9
+ label: "Domain",
10
+ description:
11
+ "Used to identify which of your services is calling the API for activity monitoring purposes. [See the documentation](https://addressfinder.com/r/faq/what-is-the-domain-option-used-for/) for more information.",
12
+ optional: true,
13
+ },
14
+ },
5
15
  methods: {
6
- // this.$auth contains connected account data
7
- authKeys() {
8
- console.log(Object.keys(this.$auth));
16
+ _baseUrl() {
17
+ return "https://api.addressfinder.io/api";
18
+ },
19
+ async _makeRequest({
20
+ $ = this, headers, params, ...args
21
+ }) {
22
+ return axios($, {
23
+ baseURL: this._baseUrl(),
24
+ headers: {
25
+ ...headers,
26
+ Authorization: this.$auth.secret,
27
+ },
28
+ params: {
29
+ ...params,
30
+ format: "json",
31
+ key: this.$auth.key,
32
+ },
33
+ ...args,
34
+ });
35
+ },
36
+ async verifyAustralianAddress(args) {
37
+ return this._makeRequest({
38
+ url: "/au/address/v2/verification",
39
+ ...args,
40
+ });
41
+ },
42
+ async verifyEmailAddress(args) {
43
+ return this._makeRequest({
44
+ url: "/email/v1/verification",
45
+ ...args,
46
+ });
47
+ },
48
+ async verifyNewZealandAddress(args) {
49
+ return this._makeRequest({
50
+ url: "/nz/address/verification",
51
+ ...args,
52
+ });
9
53
  },
10
54
  },
11
- };
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/addressfinder",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Pipedream Addressfinder Components",
5
5
  "main": "addressfinder.app.mjs",
6
6
  "keywords": [
@@ -11,5 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@pipedream/platform": "^3.0.0"
14
17
  }
15
18
  }