Skip to content

New Components - prodatakey #17059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import prodatakey from "../../prodatakey.app.mjs";

export default {
key: "prodatakey-open-and-close-device",
name: "Open and Close Device",
description: "Opens and closes a device in the ProdataKey system. [See the documentation](https://developer.pdk.io/web/2.0/rest/devices#open-and-close-a-device)",
version: "0.0.1",
type: "action",
props: {
prodatakey,
organizationId: {
propDefinition: [
prodatakey,
"organizationId",
],
},
cloudNodeId: {
propDefinition: [
prodatakey,
"cloudNodeId",
({ organizationId }) => ({
organizationId,
}),
],
},
deviceId: {
propDefinition: [
prodatakey,
"deviceId",
({
organizationId, cloudNodeId,
}) => ({
organizationId,
cloudNodeId,
}),
],
},
dwell: {
type: "integer",
label: "Dwell",
description: "The amount of time (in tenths of a second) the device will remain open before closing. This value will override the dwell time configured in pdk.io.",
min: 1,
max: 5400,
optional: true,
},
},
async run({ $ }) {
const response = await this.prodatakey.openAndCloseDevice({
$,
organizationId: this.organizationId,
cloudNodeId: this.cloudNodeId,
deviceId: this.deviceId,
data: {
dwell: this.dwell,
},
});

$.export("$summary", `Successfully sent command to device with ID: ${this.deviceId}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import prodatakey from "../../prodatakey.app.mjs";

export default {
key: "prodatakey-retrieve-credential",
name: "Retrieve Credential",
description: "Retrieve a specific credential using the system ID, holder ID, and credential ID. [See the documentation](https://developer.pdk.io/web/2.0/rest/credentials)",
version: "0.0.1",
type: "action",
props: {
prodatakey,
organizationId: {
propDefinition: [
prodatakey,
"organizationId",
],
},
holderId: {
propDefinition: [
prodatakey,
"holderId",
({ organizationId }) => ({
organizationId,
}),
],
},
credentialId: {
propDefinition: [
prodatakey,
"credentialId",
({
organizationId, holderId,
}) => ({
organizationId,
holderId,
}),
],
},
},
async run({ $ }) {
const response = await this.prodatakey.retrieveCredential({
$,
organizationId: this.organizationId,
holderId: this.holderId,
credentialId: this.credentialId,
});

$.export("$summary", `Successfully retrieved credential with ID ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import prodatakey from "../../prodatakey.app.mjs";

export default {
key: "prodatakey-retrieve-organization",
name: "Retrieve Organization",
description: "Retrieve an existing organization. [See the documentation](https://developer.pdk.io/web/2.0/rest/organizations#retrieve-an-organization)",
version: "0.0.1",
type: "action",
props: {
prodatakey,
organizationId: {
propDefinition: [
prodatakey,
"organizationId",
],
},
},
async run({ $ }) {
const response = await this.prodatakey.retrieveOrganization({
$,
organizationId: this.organizationId,
});

$.export("$summary", `Successfully retrieved organization: ${response.name}`);
return response;
},
};
127 changes: 127 additions & 0 deletions components/prodatakey/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
export const EVENT_OPTIONS =
[
{
label: "Triggers when a controller's relay circuits stabilize.",
value: "device.alarm.circuitbreaker.off",
},
{
label: "Triggers when a controller's relay circuits become unstable (e.g. due to loose wires).",
value: "device.alarm.circuitbreaker.on",
},
{
label: "Triggers when a device equipped with a door position sensor (DPS) is forced open.",
value: "device.alarm.forced",
},
{
label: "Triggers when a forced alarm has cleared.",
value: "device.alarm.forced.cleared",
},
{
label: "Triggers when prop alarms are cleared for all devices.",
value: "device.alarm.propped.alloff",
},
{
label: "Triggers when a prop alarm has cleared for a device.",
value: "device.alarm.propped.off",
},
{
label: "Triggers when a device equipped with a door position sensor (DPS) is propped open.",
value: "device.alarm.propped.on",
},
{
label: "Triggers when auto open is deactivated.",
value: "device.autoopen.off",
},
{
label: "Triggers when auto open is activated.",
value: "device.autoopen.on",
},
{
label: "Triggers when an auto open override is deactivated.",
value: "device.autoopen.override.off",
},
{
label: "Triggers when an auto open override is activated.",
value: "device.autoopen.override.on",
},
{
label: "Triggers when do not disturb (DND) is deactivated.",
value: "device.forceclose.off",
},
{
label: "Triggers when do not disturb (DND) is activated.",
value: "device.forceclose.on",
},
{
label: "Triggers when force unlock is deactivated.",
value: "device.forceopen.off",
},
{
label: "Triggers when force unlock is activated.",
value: "device.forceopen.on",
},
{
label: "Triggers when a door position sensor (DPS) changes to a closed state.",
value: "device.input.dps.closed",
},
{
label: "Triggers when a door position sensor (DPS) changes to an open state.",
value: "device.input.dps.opened",
},
{
label: "Triggers when a device is locked.",
value: "device.input.relay.off",
},
{
label: "Triggers when a device is unlocked.",
value: "device.input.relay.on",
},
{
label: "Triggers when the request to exit (REX) is deactivated.",
value: "device.input.rex.off",
},
{
label: "Triggers when the request to exit (REX) is activated.",
value: "device.input.rex.on",
},
{
label: "Triggers when a credential scan is emulated on a device (e.g. when opening a device using a software button).",
value: "device.input.virtualread",
},
{
label: "Triggers when a holder is recognized and granted access.",
value: "device.request.allowed",
},
{
label: "Triggers when a holder is recognized but denied access.",
value: "device.request.denied",
},
{
label: "Triggers when a holder enters a duress PIN.",
value: "device.request.duress",
},
{
label: "Triggers when access is granted using an emergency card. Since emergency cards can be used while a system is offline, these events may be delayed.",
value: "device.request.ecard.allowed",
},
{
label: "Triggers when access is denied using an emergency card. Since emergency cards can be used while a system is offline, these events may be delayed.",
value: "device.request.ecard.denied",
},
{
label: "Triggers when a holder is recognized.",
value: "device.request.found",
},
{
label: "Triggers when a credential is denied due to facility code filtering.",
value: "device.request.filtered",
},
{
label: "Triggers when a holder is granted access after multiple sequential scans. This behavior may be used to configure other actions, such as activating or deactivating an alarm system.",
value: "device.request.multiallowed",
},
{
label: "Triggers when a credential is presented but the holder is not recognized.",
value: "device.request.unknown",
},
];
7 changes: 5 additions & 2 deletions components/prodatakey/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/prodatakey",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream ProdataKey Components",
"main": "prodatakey.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
Loading
Loading