n8n-nodes-unifi-access 1.0.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.
Files changed (38) hide show
  1. package/README.md +76 -0
  2. package/dist/credentials/UnifiAccessApi.credentials.d.ts +10 -0
  3. package/dist/credentials/UnifiAccessApi.credentials.js +57 -0
  4. package/dist/credentials/UnifiAccessApi.credentials.js.map +1 -0
  5. package/dist/nodes/UnifiAccess/AccessPolicyDescription.d.ts +3 -0
  6. package/dist/nodes/UnifiAccess/AccessPolicyDescription.js +48 -0
  7. package/dist/nodes/UnifiAccess/AccessPolicyDescription.js.map +1 -0
  8. package/dist/nodes/UnifiAccess/CredentialDescription.d.ts +3 -0
  9. package/dist/nodes/UnifiAccess/CredentialDescription.js +152 -0
  10. package/dist/nodes/UnifiAccess/CredentialDescription.js.map +1 -0
  11. package/dist/nodes/UnifiAccess/DeviceDescription.d.ts +3 -0
  12. package/dist/nodes/UnifiAccess/DeviceDescription.js +27 -0
  13. package/dist/nodes/UnifiAccess/DeviceDescription.js.map +1 -0
  14. package/dist/nodes/UnifiAccess/EventOptions.d.ts +2 -0
  15. package/dist/nodes/UnifiAccess/EventOptions.js +61 -0
  16. package/dist/nodes/UnifiAccess/EventOptions.js.map +1 -0
  17. package/dist/nodes/UnifiAccess/GenericFunctions.d.ts +2 -0
  18. package/dist/nodes/UnifiAccess/GenericFunctions.js +64 -0
  19. package/dist/nodes/UnifiAccess/GenericFunctions.js.map +1 -0
  20. package/dist/nodes/UnifiAccess/NotificationDescription.d.ts +3 -0
  21. package/dist/nodes/UnifiAccess/NotificationDescription.js +104 -0
  22. package/dist/nodes/UnifiAccess/NotificationDescription.js.map +1 -0
  23. package/dist/nodes/UnifiAccess/UnifiAccess.node.d.ts +11 -0
  24. package/dist/nodes/UnifiAccess/UnifiAccess.node.js +373 -0
  25. package/dist/nodes/UnifiAccess/UnifiAccess.node.js.map +1 -0
  26. package/dist/nodes/UnifiAccess/UnifiAccess.node.json +18 -0
  27. package/dist/nodes/UnifiAccess/UnifiAccessTrigger.node.d.ts +12 -0
  28. package/dist/nodes/UnifiAccess/UnifiAccessTrigger.node.js +100 -0
  29. package/dist/nodes/UnifiAccess/UnifiAccessTrigger.node.js.map +1 -0
  30. package/dist/nodes/UnifiAccess/UnifiAccessTrigger.node.json +18 -0
  31. package/dist/nodes/UnifiAccess/UserDescription.d.ts +3 -0
  32. package/dist/nodes/UnifiAccess/UserDescription.js +414 -0
  33. package/dist/nodes/UnifiAccess/UserDescription.js.map +1 -0
  34. package/dist/nodes/UnifiAccess/unifiAccess.dark.svg +42 -0
  35. package/dist/nodes/UnifiAccess/unifiAccess.svg +42 -0
  36. package/dist/package.json +55 -0
  37. package/dist/tsconfig.tsbuildinfo +1 -0
  38. package/package.json +55 -0
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # n8n-nodes-unifi-access
2
+
3
+ This is an n8n community node. It lets you use the UniFi Access API in your n8n workflows.
4
+
5
+ UniFi Access is a door control system in the Ubiquiti ecosystem. This node allows you to manage
6
+ users, access policies, NFC cards, etc.
7
+
8
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
9
+
10
+ [Installation](#installation)
11
+ [Operations](#operations)
12
+ [Triggers](#triggers)
13
+ [Credentials](#credentials)
14
+ [Compatibility](#compatibility)
15
+ [Resources](#resources)
16
+
17
+ ## Installation
18
+
19
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
20
+
21
+ ## Operations
22
+
23
+ * Access Policy Actions
24
+ * Get an access policy
25
+ * Get access policies
26
+ * Credential Actions
27
+ * Delete an NFC card
28
+ * Enroll an NFC card
29
+ * Generate a random PIN
30
+ * Get NFC cards
31
+ * Get an NFC card
32
+ * Device Actions
33
+ * Get devices
34
+ * Notification Actions
35
+ * Add a webhook
36
+ * Delete a webhook
37
+ * Get webhooks
38
+ * Update a webhook
39
+ * User Actions
40
+ * Assign access policies to a user
41
+ * Assign NFC card to a user
42
+ * Clear a user's PIN
43
+ * Create a new user
44
+ * Delete a user
45
+ * Get a user
46
+ * Get users
47
+ * Send UniFi Identity invitation
48
+ * Set a user's PIN
49
+ * Unassign an NFC card from a user
50
+ * Update a user
51
+
52
+ ## Triggers
53
+ * Door Position Change
54
+ * Door Unlock
55
+ * Doorbell Call Incoming
56
+ * Doorbell Event Completed
57
+ * Doorbell Request-to-Enter
58
+ * Emergency Status Change
59
+ * Temporary Unlock End
60
+ * Temporary Unlock Start
61
+ * Unlock Schedule Active
62
+ * Unlock Schedule Inactive
63
+ * Visitor Status Change
64
+
65
+ ## Credentials
66
+
67
+ Create a new API token in the Settings->General section of the Access dashboard. You'll also need to specify the hostname of your Access server, including the port (usually port 12445). You'll probably also have to adjust your firewall to allow your n8n server to access the API port.
68
+
69
+ ## Compatibility
70
+
71
+ Tested again n8n 2.4.8 and UniFi Access 4.1.15.
72
+
73
+ ## Resources
74
+
75
+ * [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
76
+ * [UniFi Access API Documentation](https://assets.identity.ui.com/unifi-access/api_reference.pdf)
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class UnifiAccessApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ icon: Icon;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnifiAccessApi = void 0;
4
+ class UnifiAccessApi {
5
+ constructor() {
6
+ this.name = 'unifiAccessApi';
7
+ this.displayName = 'Unifi Access API';
8
+ this.documentationUrl = 'https://github.com/org/-unifi-access?tab=readme-ov-file#credentials';
9
+ this.icon = {
10
+ light: 'file:../nodes/UnifiAccess/unifiAccess.svg',
11
+ dark: 'file:../nodes/UnifiAccess/unifiAccess.dark.svg',
12
+ };
13
+ this.properties = [
14
+ {
15
+ displayName: 'Access Token',
16
+ name: 'accessToken',
17
+ type: 'string',
18
+ typeOptions: { password: true },
19
+ required: true,
20
+ default: '',
21
+ },
22
+ {
23
+ displayName: 'Unifi Access URL',
24
+ name: 'url',
25
+ type: 'string',
26
+ default: '',
27
+ required: true,
28
+ placeholder: 'https://example.com:12445',
29
+ },
30
+ {
31
+ displayName: 'Ignore SSL Issues (Insecure)',
32
+ name: 'allowUnauthorizedCerts',
33
+ type: 'boolean',
34
+ description: 'Whether to connect even if SSL certificate validtion is not possible',
35
+ default: false,
36
+ }
37
+ ];
38
+ this.authenticate = {
39
+ type: 'generic',
40
+ properties: {
41
+ headers: {
42
+ Authorization: '=Bearer {{$credentials.accessToken}}',
43
+ },
44
+ },
45
+ };
46
+ this.test = {
47
+ request: {
48
+ baseURL: '={{$credentials?.url}}/api/v1/developer/',
49
+ url: 'users?page_num=1&page_size=1',
50
+ method: 'GET',
51
+ skipSslCertificateValidation: '={{$credentials.allowUnauthorizedCerts}}',
52
+ },
53
+ };
54
+ }
55
+ }
56
+ exports.UnifiAccessApi = UnifiAccessApi;
57
+ //# sourceMappingURL=UnifiAccessApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnifiAccessApi.credentials.js","sourceRoot":"","sources":["../../credentials/UnifiAccessApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,cAAc;IAA3B;QACC,SAAI,GAAG,gBAAgB,CAAC;QAExB,gBAAW,GAAG,kBAAkB,CAAC;QAGjC,qBAAgB,GAAG,qEAAqE,CAAC;QAExF,SAAI,GAAS;YACX,KAAK,EAAE,2CAA2C;YAClD,IAAI,EAAE,gDAAgD;SACvD,CAAC;QAEH,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;aACX;YACC;gBACE,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,2BAA2B;aACzC;YAED;gBACE,WAAW,EAAE,8BAA8B;gBAC3C,IAAI,EAAE,wBAAwB;gBAC9B,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,sEAAsE;gBACnF,OAAO,EAAE,KAAK;aACf;SACH,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,sCAAsC;iBACrD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,0CAA0C;gBACnD,GAAG,EAAE,8BAA8B;gBAChC,MAAM,EAAE,KAAK;gBACb,4BAA4B,EAAE,0CAA0C;aAC3E;SACD,CAAC;IACH,CAAC;CAAA;AAzDD,wCAyDC"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const accessPolicyOperations: INodeProperties[];
3
+ export declare const accessPolicyFields: INodeProperties[];
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.accessPolicyFields = exports.accessPolicyOperations = void 0;
4
+ exports.accessPolicyOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['accessPolicy'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Get',
18
+ value: 'get',
19
+ action: 'Get an access policy',
20
+ description: 'Get an access policy',
21
+ },
22
+ {
23
+ name: 'Get Many',
24
+ value: 'getAll',
25
+ action: 'Get access policies',
26
+ description: 'Get access policies',
27
+ },
28
+ ],
29
+ default: 'getAll',
30
+ },
31
+ ];
32
+ exports.accessPolicyFields = [
33
+ {
34
+ displayName: 'Access Policy ID',
35
+ name: 'accessPolicyId',
36
+ type: 'string',
37
+ default: '',
38
+ required: true,
39
+ displayOptions: {
40
+ show: {
41
+ resource: ['accessPolicy'],
42
+ operation: ['get'],
43
+ },
44
+ },
45
+ description: "The access policy's ID",
46
+ },
47
+ ];
48
+ //# sourceMappingURL=AccessPolicyDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessPolicyDescription.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/AccessPolicyDescription.ts"],"names":[],"mappings":";;;AAEa,QAAA,sBAAsB,GAAsB;IACxD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACD,QAAQ,EAAE,CAAC,cAAc,CAAC;aAC3B;SACJ;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,sBAAsB;gBAC9B,WAAW,EAAE,sBAAsB;aACnC;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,qBAAqB;gBAC7B,WAAW,EAAE,qBAAqB;aAClC;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;QAChB,cAAc,EAAE;YACZ,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,cAAc,CAAC;gBAC1B,SAAS,EAAE,CAAC,KAAK,CAAC;aACnB;SACF;QACH,WAAW,EAAE,wBAAwB;KACrC;CACD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const credentialOperations: INodeProperties[];
3
+ export declare const credentialFields: INodeProperties[];
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.credentialFields = exports.credentialOperations = void 0;
4
+ exports.credentialOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['credential'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Delete NFC Card',
18
+ value: 'deleteNfc',
19
+ action: 'Delete an NFC card',
20
+ description: 'Delete an NFC card',
21
+ },
22
+ {
23
+ name: 'Enroll NFC Card',
24
+ value: 'enrollNfc',
25
+ action: 'Enroll an NFC card',
26
+ description: 'Wake up a UA reader and create a session to enroll an NFC card',
27
+ },
28
+ {
29
+ name: 'Generate PIN',
30
+ value: 'generatePin',
31
+ action: 'Generate a random PIN',
32
+ description: 'Generate a random PIN',
33
+ },
34
+ {
35
+ name: 'Get Many NFC Cards',
36
+ value: 'getAllNfcs',
37
+ action: 'Get NFC cards',
38
+ description: 'Get NFC cards',
39
+ },
40
+ {
41
+ name: 'Get NFC Card',
42
+ value: 'getNfc',
43
+ action: 'Get an NFC card',
44
+ description: 'Get an NFC card',
45
+ },
46
+ ],
47
+ default: 'generatePin',
48
+ },
49
+ ];
50
+ exports.credentialFields = [
51
+ {
52
+ displayName: 'Device Name or ID',
53
+ name: 'deviceId',
54
+ type: 'options',
55
+ typeOptions: {
56
+ loadOptionsMethod: 'getDevices',
57
+ },
58
+ default: '',
59
+ required: true,
60
+ displayOptions: {
61
+ show: {
62
+ resource: ['credential'],
63
+ operation: ['enrollNfc'],
64
+ },
65
+ },
66
+ description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
67
+ },
68
+ {
69
+ displayName: 'Reset NFC Card',
70
+ name: 'resetNfc',
71
+ type: 'boolean',
72
+ default: false,
73
+ displayOptions: {
74
+ show: {
75
+ resource: ['credential'],
76
+ operation: ['enrollNfc'],
77
+ },
78
+ },
79
+ description: "Whether we should reset this NFC card it it's already registered to another site",
80
+ },
81
+ {
82
+ displayName: 'Options',
83
+ name: 'optionsEnrollNfc',
84
+ type: 'collection',
85
+ placeholder: 'Add option',
86
+ default: {},
87
+ options: [
88
+ {
89
+ displayName: 'Max Wait Time',
90
+ name: 'maxWaitTime',
91
+ type: 'number',
92
+ default: 15,
93
+ description: 'Maximum number of seconds to wait for the NFC card to enroll',
94
+ typeOptions: {
95
+ minValue: 1,
96
+ maxValue: 300,
97
+ step: 1,
98
+ }
99
+ }
100
+ ],
101
+ displayOptions: {
102
+ show: {
103
+ resource: ['credential'],
104
+ operation: ['enrollNfc'],
105
+ },
106
+ },
107
+ },
108
+ {
109
+ displayName: 'NFC Token',
110
+ name: 'nfcToken',
111
+ type: 'string',
112
+ default: '',
113
+ required: true,
114
+ displayOptions: {
115
+ show: {
116
+ resource: ['credential'],
117
+ operation: ['getNfc', 'deleteNfc'],
118
+ },
119
+ },
120
+ typeOptions: {
121
+ password: true,
122
+ },
123
+ description: "The NFC card's token",
124
+ },
125
+ {
126
+ displayName: 'Options',
127
+ name: 'optionsGetAllNfcs',
128
+ type: 'collection',
129
+ placeholder: 'Add option',
130
+ default: {},
131
+ options: [
132
+ {
133
+ displayName: 'Limit',
134
+ name: 'limit',
135
+ type: 'number',
136
+ default: 50,
137
+ description: 'Max number of results to return',
138
+ typeOptions: {
139
+ minValue: 1,
140
+ step: 1,
141
+ }
142
+ }
143
+ ],
144
+ displayOptions: {
145
+ show: {
146
+ resource: ['credential'],
147
+ operation: ['getAllNfcs'],
148
+ },
149
+ },
150
+ },
151
+ ];
152
+ //# sourceMappingURL=CredentialDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialDescription.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/CredentialDescription.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAsB;IACtD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACD,QAAQ,EAAE,CAAC,YAAY,CAAC;aACzB;SACJ;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,oBAAoB;gBAC5B,WAAW,EAAE,oBAAoB;aACjC;YACE;gBACE,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,oBAAoB;gBAC5B,WAAW,EAAE,gEAAgE;aAC9E;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,aAAa;gBACpB,MAAM,EAAE,uBAAuB;gBAC/B,WAAW,EAAE,uBAAuB;aACrC;YACJ;gBACC,IAAI,EAAE,oBAAoB;gBAC1B,KAAK,EAAE,YAAY;gBACnB,MAAM,EAAE,eAAe;gBACvB,WAAW,EAAE,eAAe;aAC5B;YACD;gBACC,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,iBAAiB;gBACzB,WAAW,EAAE,iBAAiB;aAC9B;SACC;QACH,OAAO,EAAE,aAAa;KACtB;CACD,CAAC;AAEW,QAAA,gBAAgB,GAAsB;IACjD;QACE,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;YACX,iBAAiB,EAAE,YAAY;SAChC;QACD,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,IAAI;QAChB,cAAc,EAAE;YACZ,IAAI,EAAE;gBACJ,QAAQ,EAAE,CA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tB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACP;gBACE,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,iCAAiC;gBAC9C,WAAW,EAAE;oBACX,QAAQ,EAAE,CAAC;oBACX,IAAI,EAAE,CAAC;iBACR;aACF;SACF;QACD,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,YAAY,CAAC;gBACxB,SAAS,EAAE,CAAC,YAAY,CAAC;aAC1B;SACF;KACF;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const deviceOperations: INodeProperties[];
3
+ export declare const deviceFields: INodeProperties[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deviceFields = exports.deviceOperations = void 0;
4
+ exports.deviceOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['device'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Get Many',
18
+ value: 'getAll',
19
+ action: 'Get devices',
20
+ description: 'Get devices',
21
+ },
22
+ ],
23
+ default: 'getAll',
24
+ },
25
+ ];
26
+ exports.deviceFields = [];
27
+ //# sourceMappingURL=DeviceDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceDescription.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/DeviceDescription.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAsB;IAClD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACrB;SACJ;QACD,OAAO,EAAE;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,aAAa;gBACrB,WAAW,EAAE,aAAa;aAC3B;SACF;QACH,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,YAAY,GAAsB,EAC9C,CAAA"}
@@ -0,0 +1,2 @@
1
+ import type { INodePropertyOptions } from 'n8n-workflow';
2
+ export declare const eventOptions: INodePropertyOptions[];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eventOptions = void 0;
4
+ exports.eventOptions = [
5
+ {
6
+ name: 'Door Position Change',
7
+ value: 'access.device.dps_status',
8
+ description: 'Indicates a change in the door position sensor (DPS) status',
9
+ },
10
+ {
11
+ name: 'Door Unlock',
12
+ value: 'access.door.unlock',
13
+ description: 'Triggered on all door unlock events',
14
+ },
15
+ {
16
+ name: 'Doorbell Call Incoming',
17
+ value: 'access.doorbell.incoming',
18
+ description: 'Triggered when a doorbell rings (incoming call)',
19
+ },
20
+ {
21
+ name: 'Doorbell Event Completed',
22
+ value: 'access.doorbell.completed',
23
+ description: 'Triggered when a doorbell event is accepted, declined, or canceled',
24
+ },
25
+ {
26
+ name: 'Doorbell Request-to-Enter',
27
+ value: 'access.doorbell.incoming.REN',
28
+ description: 'Triggered by doorbells activated via Request-to-Enter (REN) buttons',
29
+ },
30
+ {
31
+ name: 'Emergency Status Change',
32
+ value: 'access.device.emergency_status',
33
+ description: 'Indicates a change in emergency mode status',
34
+ },
35
+ {
36
+ name: 'Temporary Unlock End',
37
+ value: 'access.temporary_unlock.end',
38
+ description: 'Triggered when a temporary unlock ends',
39
+ },
40
+ {
41
+ name: 'Temporary Unlock Start',
42
+ value: 'access.temporary_unlock.start',
43
+ description: 'Triggered when a temporary unlock starts',
44
+ },
45
+ {
46
+ name: 'Unlock Schedule Active',
47
+ value: 'access.unlock_schedule.activate',
48
+ description: 'Triggered when an unlock schedule becomes active',
49
+ },
50
+ {
51
+ name: 'Unlock Schedule Inactive',
52
+ value: 'access.unlock_schedule.deactivate',
53
+ description: 'Triggered when an unlock schedule becomes inactive',
54
+ },
55
+ {
56
+ name: 'Visitor Status Change',
57
+ value: 'access.visitor.status.changed',
58
+ description: 'Indicates that a visitor’s status has changed',
59
+ },
60
+ ];
61
+ //# sourceMappingURL=EventOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventOptions.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/EventOptions.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAA2B;IAClD;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,6DAA6D;KAC3E;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,qCAAqC;KACnD;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,iDAAiD;KAC/D;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,oEAAoE;KAClF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,qEAAqE;KACnF;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE,6CAA6C;KAC3D;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,wCAAwC;KACtD;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,+BAA+B;QACtC,WAAW,EAAE,0CAA0C;KACxD;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,iCAAiC;QACxC,WAAW,EAAE,kDAAkD;KAChE;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE,mCAAmC;QAC1C,WAAW,EAAE,oDAAoD;KAClE;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,+BAA+B;QACtC,WAAW,EAAE,+CAA+C;KAC7D;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IDataObject, IHttpRequestMethods } from 'n8n-workflow';
2
+ export declare function unifiAccessApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, method: IHttpRequestMethods, url: string, body?: IDataObject | IDataObject[], qs?: IDataObject, option?: IDataObject): Promise<IDataObject[]>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unifiAccessApiRequest = unifiAccessApiRequest;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ async function unifiAccessApiRequest(method, url, body = {}, qs = {}, option = {}) {
6
+ const credentials = await this.getCredentials('unifiAccessApi');
7
+ let options = {
8
+ headers: {
9
+ Accept: 'application/json',
10
+ 'Content-Type': 'application/json',
11
+ 'User-Agent': 'n8n',
12
+ },
13
+ method,
14
+ qs,
15
+ body,
16
+ url: `${credentials.url}/api/v1/developer/${url}`,
17
+ skipSslCertificateValidation: credentials.allowUnauthorizedCerts,
18
+ json: true,
19
+ };
20
+ options = Object.assign({}, options, option);
21
+ if (Object.keys(options.body).length === 0) {
22
+ delete options.body;
23
+ }
24
+ let result;
25
+ try {
26
+ const credentialType = 'unifiAccessApi';
27
+ result = await this.helpers.httpRequestWithAuthentication.call(this, credentialType, options);
28
+ }
29
+ catch (error) {
30
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
31
+ }
32
+ if (option.returnRaw) {
33
+ return [result];
34
+ }
35
+ if (result.code == "SUCCESS") {
36
+ if (result.data) {
37
+ if (Array.isArray(result.data)) {
38
+ if (result.data.length == 0) {
39
+ return [{}];
40
+ }
41
+ else {
42
+ return result.data;
43
+ }
44
+ }
45
+ else if (option.resultName) {
46
+ return [{ [option.resultName]: result.data }];
47
+ }
48
+ else {
49
+ return [result.data];
50
+ }
51
+ }
52
+ else {
53
+ return [{}];
54
+ }
55
+ }
56
+ else {
57
+ const errorOptions = {
58
+ message: result.code,
59
+ description: result.msg,
60
+ };
61
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), { 'message': result.code }, errorOptions);
62
+ }
63
+ }
64
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/GenericFunctions.ts"],"names":[],"mappings":";;AAYA,sDA2EC;AA9ED,+CAA4C;AAGrC,KAAK,UAAU,qBAAqB,CAE1C,MAA2B,EAC3B,GAAW,EAEX,OAAoC,EAAE,EACtC,KAAkB,EAAE,EACpB,SAAsB,EAAE;IAExB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAEhE,IAAI,OAAO,GAAwB;QAClC,OAAO,EAAE;YACR,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,KAAK;SACnB;QACD,MAAM;QACN,EAAE;QACF,IAAI;QACJ,GAAG,EAAE,GAAG,WAAW,CAAC,GAAG,qBAAqB,GAAG,EAAE;QACjD,4BAA4B,EAAE,WAAW,CAAC,sBAAiC;QAC3E,IAAI,EAAE,IAAI;KACV,CAAC;IASF,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAmB,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO,OAAO,CAAC,IAAI,CAAC;IACr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,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAe,EAAE,YAAY,CAAC,CAAC;IAC/F,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const notificationOperations: INodeProperties[];
3
+ export declare const notificationFields: INodeProperties[];
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationFields = exports.notificationOperations = void 0;
4
+ const EventOptions_1 = require("./EventOptions");
5
+ exports.notificationOperations = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: {
12
+ show: {
13
+ resource: ['notification'],
14
+ },
15
+ },
16
+ options: [
17
+ {
18
+ name: 'Add Webhook',
19
+ value: 'add',
20
+ action: 'Add a webhook endpoint',
21
+ description: 'Add a webhook endpoint',
22
+ },
23
+ {
24
+ name: 'Delete Webhook',
25
+ value: 'delete',
26
+ action: 'Delete a webhook endpoint',
27
+ description: 'Delete a webhook endpoint',
28
+ },
29
+ {
30
+ name: 'Get Many',
31
+ value: 'getAll',
32
+ action: 'Get webhook endpoints',
33
+ description: 'Get webhook endpoints',
34
+ },
35
+ {
36
+ name: 'Update Webhook',
37
+ value: 'update',
38
+ action: 'Update a webhook endpoint',
39
+ description: 'Update a webhook endpoint',
40
+ },
41
+ ],
42
+ default: 'getAll',
43
+ },
44
+ ];
45
+ exports.notificationFields = [
46
+ {
47
+ displayName: 'Webhook ID',
48
+ name: 'webhookId',
49
+ type: 'string',
50
+ default: '',
51
+ required: true,
52
+ displayOptions: {
53
+ show: {
54
+ resource: ['notification'],
55
+ operation: ['delete', 'update'],
56
+ },
57
+ },
58
+ description: "The ID of the webhook",
59
+ },
60
+ {
61
+ displayName: 'Name',
62
+ name: 'name',
63
+ type: 'string',
64
+ default: '',
65
+ required: true,
66
+ displayOptions: {
67
+ show: {
68
+ resource: ['notification'],
69
+ operation: ['add', 'update'],
70
+ },
71
+ },
72
+ description: "The name of the webhook subscription",
73
+ },
74
+ {
75
+ displayName: 'Endpoint',
76
+ name: 'endpoint',
77
+ type: 'string',
78
+ default: '',
79
+ required: true,
80
+ displayOptions: {
81
+ show: {
82
+ resource: ['notification'],
83
+ operation: ['add', 'update'],
84
+ },
85
+ },
86
+ description: "The URL where the events are sent",
87
+ },
88
+ {
89
+ displayName: 'Events',
90
+ name: 'events',
91
+ type: 'multiOptions',
92
+ options: [...EventOptions_1.eventOptions],
93
+ required: true,
94
+ default: [],
95
+ displayOptions: {
96
+ show: {
97
+ resource: ['notification'],
98
+ operation: ['add', 'update'],
99
+ },
100
+ },
101
+ description: 'The events to listen to',
102
+ },
103
+ ];
104
+ //# sourceMappingURL=NotificationDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationDescription.js","sourceRoot":"","sources":["../../../nodes/UnifiAccess/NotificationDescription.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAEjC,QAAA,sBAAsB,GAAsB;IACxD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACD,QAAQ,EAAE,CAAC,cAAc,CAAC;aAC3B;SACJ;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,wBAAwB;gBAChC,WAAW,EAAE,wBAAwB;aACrC;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,2BAA2B;gBACnC,WAAW,EAAE,2BAA2B;aACxC;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,uBAAuB;gBAC/B,WAAW,EAAE,uBAA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