forked from PipedreamHQ/pipedream
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
People Data Labs new action + improvements (PipedreamHQ#11381)
* Adding package file * pnpm * Search people action * More props and syntax improvement * Request improvements * fixes * Bugfix
- Loading branch information
Showing
7 changed files
with
162 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
components/people_data_labs/actions/search-people/search-people.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { QUERY_TYPE_OPTIONS } from "../../common/constants.mjs"; | ||
import app from "../../people_data_labs.app.mjs"; | ||
|
||
export default { | ||
key: "people_data_labs-search-people", | ||
name: "Search People", | ||
description: "Find specific segments of people that you need to power your projects and products. [See the docs here](https://docs.peopledatalabs.com/docs/reference-person-search-api)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
query: { | ||
label: "Query", | ||
type: "string", | ||
description: "The query to perform (can be an [Elasticsearch](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#query) or [SQL query](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#sql)). Click the preferred query type for the documentation.", | ||
}, | ||
queryType: { | ||
label: "Query Type", | ||
type: "string", | ||
description: "Which type of query is being used.", | ||
options: QUERY_TYPE_OPTIONS, | ||
}, | ||
size: { | ||
label: "Size", | ||
type: "integer", | ||
description: "The batch size or the maximum number of matched records to return for this query if they exist", | ||
default: 1, | ||
min: 1, | ||
max: 100, | ||
optional: true, | ||
}, | ||
datasets: { | ||
label: "Datasets", | ||
type: "string[]", | ||
description: "Specifies which [dataset(s)](https://docs.peopledatalabs.com/docs/datasets) the API should search against.", | ||
optional: true, | ||
}, | ||
titlecase: { | ||
type: "boolean", | ||
label: "Title Case", | ||
description: "By default, all text in the response data returns as lowercase. Setting to `true` will titlecase any records returned.", | ||
optional: true, | ||
}, | ||
pretty: { | ||
propDefinition: [ | ||
app, | ||
"pretty", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
app, query, queryType, ...data | ||
} = this; | ||
const params = { | ||
[queryType]: query, | ||
...data, | ||
}; | ||
|
||
const res = await app.searchPeople({ | ||
$, | ||
params, | ||
}); | ||
$.export("$summary", res?.status === 200 | ||
? `Found ${res?.data?.length} records` | ||
: "No records found"); | ||
return res; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export const QUERY_TYPE_OPTIONS = [ | ||
{ | ||
label: "Elasticsearch query", | ||
value: "query", | ||
}, | ||
{ | ||
label: "SQL query", | ||
value: "sql", | ||
}, | ||
]; | ||
|
||
export const DATASET_OPTIONS = [ | ||
{ | ||
label: "All", | ||
value: "all", | ||
}, | ||
{ | ||
label: "Resume", | ||
value: "resume", | ||
}, | ||
{ | ||
label: "Email", | ||
value: "email", | ||
}, | ||
{ | ||
label: "Phone", | ||
value: "phone", | ||
}, | ||
{ | ||
label: "Mobile Phone", | ||
value: "mobile_phone", | ||
}, | ||
{ | ||
label: "Street Address", | ||
value: "street_address", | ||
}, | ||
{ | ||
label: "Consumer Social", | ||
value: "consumer_social", | ||
}, | ||
{ | ||
label: "Developer", | ||
value: "developer", | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@pipedream/people_data_labs", | ||
"version": "0.1.0", | ||
"description": "Pipedream People Data Labs Components", | ||
"main": "people_data_labs.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"people_data_labs" | ||
], | ||
"homepage": "https://pipedream.com/apps/people_data_labs", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^1.6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.