Skip to content

Commit be202a9

Browse files
committed
[Components] prodatakey #16916
Sources - New Event (Instant) Actions - Open And Close Device - Retrieve Credential - Retrieve Organization
1 parent 40e9973 commit be202a9

File tree

11 files changed

+493
-469
lines changed

11 files changed

+493
-469
lines changed

components/prodatakey/actions/create-customer/create-customer.mjs

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import prodatakey from "../../prodatakey.app.mjs";
2+
3+
export default {
4+
key: "prodatakey-open-and-close-device",
5+
name: "Open and Close Device",
6+
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)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
prodatakey,
11+
organizationId: {
12+
propDefinition: [
13+
prodatakey,
14+
"organizationId",
15+
],
16+
},
17+
cloudNodeId: {
18+
propDefinition: [
19+
prodatakey,
20+
"cloudNodeId",
21+
({ organizationId }) => ({
22+
organizationId,
23+
}),
24+
],
25+
},
26+
deviceId: {
27+
propDefinition: [
28+
prodatakey,
29+
"deviceId",
30+
({
31+
organizationId, cloudNodeId,
32+
}) => ({
33+
organizationId,
34+
cloudNodeId,
35+
}),
36+
],
37+
},
38+
dwell: {
39+
type: "integer",
40+
label: "Dwell",
41+
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.",
42+
min: 1,
43+
max: 5400,
44+
optional: true,
45+
},
46+
},
47+
async run({ $ }) {
48+
const response = await this.prodatakey.openAndCloseDevice({
49+
$,
50+
organizationId: this.organizationId,
51+
cloudNodeId: this.cloudNodeId,
52+
deviceId: this.deviceId,
53+
data: {
54+
dwell: this.dwell,
55+
},
56+
});
57+
58+
$.export("$summary", `Successfully sent command to device with ID: ${this.deviceId}`);
59+
return response;
60+
},
61+
};

components/prodatakey/actions/retrieve-credential/retrieve-credential.mjs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,45 @@
11
import prodatakey from "../../prodatakey.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "prodatakey-retrieve-credential",
65
name: "Retrieve Credential",
76
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)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
prodatakey,
12-
systemId: {
13-
type: "string",
14-
label: "System ID",
11+
organizationId: {
12+
propDefinition: [
13+
prodatakey,
14+
"organizationId",
15+
],
1516
},
1617
holderId: {
17-
type: "string",
18-
label: "Holder ID",
18+
propDefinition: [
19+
prodatakey,
20+
"holderId",
21+
({ organizationId }) => ({
22+
organizationId,
23+
}),
24+
],
1925
},
2026
credentialId: {
2127
propDefinition: [
2228
prodatakey,
2329
"credentialId",
24-
(c) => ({
25-
systemId: c.systemId,
26-
holderId: c.holderId,
30+
({
31+
organizationId, holderId,
32+
}) => ({
33+
organizationId,
34+
holderId,
2735
}),
2836
],
2937
},
3038
},
3139
async run({ $ }) {
3240
const response = await this.prodatakey.retrieveCredential({
33-
systemId: this.systemId,
41+
$,
42+
organizationId: this.organizationId,
3443
holderId: this.holderId,
3544
credentialId: this.credentialId,
3645
});

components/prodatakey/actions/retrieve-organization/retrieve-organization.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import prodatakey from "../../prodatakey.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "prodatakey-retrieve-organization",
65
name: "Retrieve Organization",
7-
description: "Retrieve an existing organization. [See the documentation](https://developer.pdk.io/web/2.0/rest/organizations)",
6+
description: "Retrieve an existing organization. [See the documentation](https://developer.pdk.io/web/2.0/rest/organizations#retrieve-an-organization)",
87
version: "0.0.1",
98
type: "action",
109
props: {
@@ -18,6 +17,7 @@ export default {
1817
},
1918
async run({ $ }) {
2019
const response = await this.prodatakey.retrieveOrganization({
20+
$,
2121
organizationId: this.organizationId,
2222
});
2323

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
export const EVENT_OPTIONS =
2+
[
3+
{
4+
label: "Triggers when a controller's relay circuits stabilize.",
5+
value: "device.alarm.circuitbreaker.off",
6+
},
7+
{
8+
label: "Triggers when a controller's relay circuits become unstable (e.g. due to loose wires).",
9+
value: "device.alarm.circuitbreaker.on",
10+
},
11+
{
12+
label: "Triggers when a device equipped with a door position sensor (DPS) is forced open.",
13+
value: "device.alarm.forced",
14+
},
15+
{
16+
label: "Triggers when a forced alarm has cleared.",
17+
value: "device.alarm.forced.cleared",
18+
},
19+
{
20+
label: "Triggers when prop alarms are cleared for all devices.",
21+
value: "device.alarm.propped.alloff",
22+
},
23+
{
24+
label: "Triggers when a prop alarm has cleared for a device.",
25+
value: "device.alarm.propped.off",
26+
},
27+
{
28+
label: "Triggers when a device equipped with a door position sensor (DPS) is propped open.",
29+
value: "device.alarm.propped.on",
30+
},
31+
{
32+
label: "Triggers when auto open is deactivated.",
33+
value: "device.autoopen.off",
34+
},
35+
{
36+
label: "Triggers when auto open is activated.",
37+
value: "device.autoopen.on",
38+
},
39+
{
40+
label: "Triggers when an auto open override is deactivated.",
41+
value: "device.autoopen.override.off",
42+
},
43+
{
44+
label: "Triggers when an auto open override is activated.",
45+
value: "device.autoopen.override.on",
46+
},
47+
{
48+
label: "Triggers when do not disturb (DND) is deactivated.",
49+
value: "device.forceclose.off",
50+
},
51+
{
52+
label: "Triggers when do not disturb (DND) is activated.",
53+
value: "device.forceclose.on",
54+
},
55+
{
56+
label: "Triggers when force unlock is deactivated.",
57+
value: "device.forceopen.off",
58+
},
59+
{
60+
label: "Triggers when force unlock is activated.",
61+
value: "device.forceopen.on",
62+
},
63+
{
64+
label: "Triggers when a door position sensor (DPS) changes to a closed state.",
65+
value: "device.input.dps.closed",
66+
},
67+
{
68+
label: "Triggers when a door position sensor (DPS) changes to an open state.",
69+
value: "device.input.dps.opened",
70+
},
71+
{
72+
label: "Triggers when a device is locked.",
73+
value: "device.input.relay.off",
74+
},
75+
{
76+
label: "Triggers when a device is unlocked.",
77+
value: "device.input.relay.on",
78+
},
79+
{
80+
label: "Triggers when the request to exit (REX) is deactivated.",
81+
value: "device.input.rex.off",
82+
},
83+
{
84+
label: "Triggers when the request to exit (REX) is activated.",
85+
value: "device.input.rex.on",
86+
},
87+
{
88+
label: "Triggers when a credential scan is emulated on a device (e.g. when opening a device using a software button).",
89+
value: "device.input.virtualread",
90+
},
91+
{
92+
label: "Triggers when a holder is recognized and granted access.",
93+
value: "device.request.allowed",
94+
},
95+
{
96+
label: "Triggers when a holder is recognized but denied access.",
97+
value: "device.request.denied",
98+
},
99+
{
100+
label: "Triggers when a holder enters a duress PIN.",
101+
value: "device.request.duress",
102+
},
103+
{
104+
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.",
105+
value: "device.request.ecard.allowed",
106+
},
107+
{
108+
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.",
109+
value: "device.request.ecard.denied",
110+
},
111+
{
112+
label: "Triggers when a holder is recognized.",
113+
value: "device.request.found",
114+
},
115+
{
116+
label: "Triggers when a credential is denied due to facility code filtering.",
117+
value: "device.request.filtered",
118+
},
119+
{
120+
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.",
121+
value: "device.request.multiallowed",
122+
},
123+
{
124+
label: "Triggers when a credential is presented but the holder is not recognized.",
125+
value: "device.request.unknown",
126+
},
127+
];

components/prodatakey/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/prodatakey",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream ProdataKey Components",
55
"main": "prodatakey.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
1518
}

0 commit comments

Comments
 (0)