@digipair/skill-nuki 0.112.3 → 0.114.1

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.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # skill-test
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build skill-nuki` to build the library.
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ let NukiService = class NukiService {
4
+ constructor(context, params){
5
+ this.NUKI_API_KEY = context.privates.NUKI_API_KEY ?? params?.NUKI_API_KEY ?? process.env['NUKI_API_KEY'];
6
+ this.API_ENDPOINT = context.privates.NUKI_API_ENDPOINT ?? params?.NUKI_API_ENDPOINT ?? process.env['NUKI_API_ENDPOINT'] ?? 'https://api.nuki.io/smartlock';
7
+ }
8
+ async call(url, method, data, headers, signal) {
9
+ const response = await fetch(`${this.API_ENDPOINT}${url}`, {
10
+ signal,
11
+ method,
12
+ headers: {
13
+ Authorization: 'Bearer ' + this.NUKI_API_KEY,
14
+ ...headers
15
+ },
16
+ body: data
17
+ });
18
+ if (!response.ok) throw new Error('[SKILL-NUKI] REQUEST FAILED: ' + response.status);
19
+ return await response.json();
20
+ }
21
+ async unlock(params, _pinsSettingsList, context) {
22
+ const { id } = params;
23
+ return await this.call(`/${id}/action/unlock`, 'POST', null, {}, context.protected?.signal);
24
+ }
25
+ async lock(params, _pinsSettingsList, context) {
26
+ const { id } = params;
27
+ return await this.call(`/${id}/action/lock`, 'POST', null, {}, context.protected?.signal);
28
+ }
29
+ };
30
+ const lock = (params, pinsSettingsList, context)=>new NukiService(context, params).lock(params, pinsSettingsList, context);
31
+ const unlock = (params, pinsSettingsList, context)=>new NukiService(context, params).unlock(params, pinsSettingsList, context);
32
+
33
+ exports.lock = lock;
34
+ exports.unlock = unlock;
@@ -0,0 +1,31 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ let NukiService = class NukiService {
2
+ constructor(context, params){
3
+ this.NUKI_API_KEY = context.privates.NUKI_API_KEY ?? params?.NUKI_API_KEY ?? process.env['NUKI_API_KEY'];
4
+ this.API_ENDPOINT = context.privates.NUKI_API_ENDPOINT ?? params?.NUKI_API_ENDPOINT ?? process.env['NUKI_API_ENDPOINT'] ?? 'https://api.nuki.io/smartlock';
5
+ }
6
+ async call(url, method, data, headers, signal) {
7
+ const response = await fetch(`${this.API_ENDPOINT}${url}`, {
8
+ signal,
9
+ method,
10
+ headers: {
11
+ Authorization: 'Bearer ' + this.NUKI_API_KEY,
12
+ ...headers
13
+ },
14
+ body: data
15
+ });
16
+ if (!response.ok) throw new Error('[SKILL-NUKI] REQUEST FAILED: ' + response.status);
17
+ return await response.json();
18
+ }
19
+ async unlock(params, _pinsSettingsList, context) {
20
+ const { id } = params;
21
+ return await this.call(`/${id}/action/unlock`, 'POST', null, {}, context.protected?.signal);
22
+ }
23
+ async lock(params, _pinsSettingsList, context) {
24
+ const { id } = params;
25
+ return await this.call(`/${id}/action/lock`, 'POST', null, {}, context.protected?.signal);
26
+ }
27
+ };
28
+ const lock = (params, pinsSettingsList, context)=>new NukiService(context, params).lock(params, pinsSettingsList, context);
29
+ const unlock = (params, pinsSettingsList, context)=>new NukiService(context, params).unlock(params, pinsSettingsList, context);
30
+
31
+ export { lock, unlock };
@@ -0,0 +1,2 @@
1
+ export * from './lib/skill-nuki';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
2
  export declare const lock: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
3
3
  export declare const unlock: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
4
+ //# sourceMappingURL=skill-nuki.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-nuki.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-nuki.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAyChD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACN,CAAC;AAE3E,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBACN,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,33 @@
1
1
  {
2
2
  "name": "@digipair/skill-nuki",
3
- "version": "0.112.3",
3
+ "version": "0.114.1",
4
+ "main": "./dist/index.cjs.js",
5
+ "module": "./dist/index.esm.js",
6
+ "types": "./dist/index.d.ts",
4
7
  "keywords": [
5
8
  "digipair",
6
9
  "service",
7
10
  "tool"
8
11
  ],
9
- "dependencies": {},
10
- "main": "./index.cjs.js",
11
- "module": "./index.esm.js"
12
- }
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.esm.js",
16
+ "default": "./dist/index.cjs.js"
17
+ },
18
+ "./index.esm.js": "./dist/index.esm.js",
19
+ "./index.cjs.js": "./dist/index.cjs.js",
20
+ "./package.json": "./package.json",
21
+ "./schema.json": "./dist/schema.json",
22
+ "./schema.fr.json": "./dist/schema.fr.json"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "package.json"
28
+ ],
29
+ "nx": {
30
+ "name": "skill-nuki"
31
+ },
32
+ "dependencies": {}
33
+ }
package/index.cjs.js DELETED
@@ -1,50 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _extends() {
6
- _extends = Object.assign || function assign(target) {
7
- for(var i = 1; i < arguments.length; i++){
8
- var source = arguments[i];
9
- for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
10
- }
11
- return target;
12
- };
13
- return _extends.apply(this, arguments);
14
- }
15
-
16
- let NukiService = class NukiService {
17
- async call(url, method, data, headers, signal) {
18
- const response = await fetch(`${this.API_ENDPOINT}${url}`, {
19
- signal,
20
- method,
21
- headers: _extends({
22
- Authorization: 'Bearer ' + this.NUKI_API_KEY
23
- }, headers),
24
- body: data
25
- });
26
- if (!response.ok) throw new Error('[SKILL-NUKI] REQUEST FAILED: ' + response.status);
27
- return await response.json();
28
- }
29
- async unlock(params, _pinsSettingsList, context) {
30
- var _context_protected;
31
- const { id } = params;
32
- return await this.call(`/${id}/action/unlock`, 'POST', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
33
- }
34
- async lock(params, _pinsSettingsList, context) {
35
- var _context_protected;
36
- const { id } = params;
37
- return await this.call(`/${id}/action/lock`, 'POST', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
38
- }
39
- constructor(context, params){
40
- var _context_privates_NUKI_API_KEY, _ref;
41
- this.NUKI_API_KEY = (_ref = (_context_privates_NUKI_API_KEY = context.privates.NUKI_API_KEY) != null ? _context_privates_NUKI_API_KEY : params == null ? void 0 : params.NUKI_API_KEY) != null ? _ref : process.env['NUKI_API_KEY'];
42
- var _context_privates_NUKI_API_ENDPOINT, _ref1, _ref2;
43
- this.API_ENDPOINT = (_ref2 = (_ref1 = (_context_privates_NUKI_API_ENDPOINT = context.privates.NUKI_API_ENDPOINT) != null ? _context_privates_NUKI_API_ENDPOINT : params == null ? void 0 : params.NUKI_API_ENDPOINT) != null ? _ref1 : process.env['NUKI_API_ENDPOINT']) != null ? _ref2 : 'https://api.nuki.io/smartlock';
44
- }
45
- };
46
- const lock = (params, pinsSettingsList, context)=>new NukiService(context, params).lock(params, pinsSettingsList, context);
47
- const unlock = (params, pinsSettingsList, context)=>new NukiService(context, params).unlock(params, pinsSettingsList, context);
48
-
49
- exports.lock = lock;
50
- exports.unlock = unlock;
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './libs/skill-vespa/src/index';
package/index.esm.js DELETED
@@ -1,45 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign || function assign(target) {
3
- for(var i = 1; i < arguments.length; i++){
4
- var source = arguments[i];
5
- for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
6
- }
7
- return target;
8
- };
9
- return _extends.apply(this, arguments);
10
- }
11
-
12
- let NukiService = class NukiService {
13
- async call(url, method, data, headers, signal) {
14
- const response = await fetch(`${this.API_ENDPOINT}${url}`, {
15
- signal,
16
- method,
17
- headers: _extends({
18
- Authorization: 'Bearer ' + this.NUKI_API_KEY
19
- }, headers),
20
- body: data
21
- });
22
- if (!response.ok) throw new Error('[SKILL-NUKI] REQUEST FAILED: ' + response.status);
23
- return await response.json();
24
- }
25
- async unlock(params, _pinsSettingsList, context) {
26
- var _context_protected;
27
- const { id } = params;
28
- return await this.call(`/${id}/action/unlock`, 'POST', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
29
- }
30
- async lock(params, _pinsSettingsList, context) {
31
- var _context_protected;
32
- const { id } = params;
33
- return await this.call(`/${id}/action/lock`, 'POST', null, {}, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
34
- }
35
- constructor(context, params){
36
- var _context_privates_NUKI_API_KEY, _ref;
37
- this.NUKI_API_KEY = (_ref = (_context_privates_NUKI_API_KEY = context.privates.NUKI_API_KEY) != null ? _context_privates_NUKI_API_KEY : params == null ? void 0 : params.NUKI_API_KEY) != null ? _ref : process.env['NUKI_API_KEY'];
38
- var _context_privates_NUKI_API_ENDPOINT, _ref1, _ref2;
39
- this.API_ENDPOINT = (_ref2 = (_ref1 = (_context_privates_NUKI_API_ENDPOINT = context.privates.NUKI_API_ENDPOINT) != null ? _context_privates_NUKI_API_ENDPOINT : params == null ? void 0 : params.NUKI_API_ENDPOINT) != null ? _ref1 : process.env['NUKI_API_ENDPOINT']) != null ? _ref2 : 'https://api.nuki.io/smartlock';
40
- }
41
- };
42
- const lock = (params, pinsSettingsList, context)=>new NukiService(context, params).lock(params, pinsSettingsList, context);
43
- const unlock = (params, pinsSettingsList, context)=>new NukiService(context, params).unlock(params, pinsSettingsList, context);
44
-
45
- export { lock, unlock };
@@ -1 +0,0 @@
1
- export * from './lib/skill-nuki';
File without changes
File without changes
File without changes