skikrumb-api 1.2.9 → 1.3.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/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const skiKrumb: (options?: {
5
5
  url: string | undefined;
6
6
  }) => {
7
7
  createDevice: (deveui: string, serialNumber: string) => Promise<any>;
8
+ createDeviceDownlink: (userId: string, deveui: string, type?: string) => Promise<any>;
8
9
  createPaymentIntent: (form: any) => Promise<any>;
9
10
  createPrePurchaseIntent: (form: any) => Promise<any>;
10
11
  readApiKeys: () => Promise<apiKeys[]>;
package/dist/index.js CHANGED
@@ -34,6 +34,31 @@ export const skiKrumb = (options = {
34
34
  json: { deveui: deveui, serial_number: serialNumber }
35
35
  }).json();
36
36
  });
37
+ const createDeviceDownlink = (userId_1, deveui_1, ...args_1) => __awaiter(void 0, [userId_1, deveui_1, ...args_1], void 0, function* (userId, deveui, type = 'beep') {
38
+ if (!userId || !deveui || !type)
39
+ throw new Error('Must pass userId, Lora MAC (deveui) and message type');
40
+ let message = 'DAgAC04zKE9EPTEwKQ0K';
41
+ switch (type) {
42
+ case 'help-off':
43
+ message = 'DBECAAAAAAAAAAAB';
44
+ break;
45
+ }
46
+ return yield api.post(`${options.url}/devices/downlink`, {
47
+ headers: {
48
+ 'content-type': 'application/json'
49
+ },
50
+ json: {
51
+ "device": deveui,
52
+ "userId": userId,
53
+ "data": {
54
+ "params": {
55
+ "data": message,
56
+ "port": 100
57
+ }
58
+ }
59
+ }
60
+ }).json();
61
+ });
37
62
  const createPaymentIntent = (form) => __awaiter(void 0, void 0, void 0, function* () {
38
63
  if (!form)
39
64
  throw new Error('Form values not posted.');
@@ -77,6 +102,7 @@ export const skiKrumb = (options = {
77
102
  });
78
103
  return {
79
104
  createDevice,
105
+ createDeviceDownlink,
80
106
  createPaymentIntent,
81
107
  createPrePurchaseIntent,
82
108
  readApiKeys,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "author": "",
14
14
  "license": "UNLICENSED",
15
15
  "devDependencies": {
16
- "typescript": "^5.1.6"
16
+ "typescript": "^5.7.2"
17
17
  },
18
18
  "dependencies": {
19
19
  "ky": "^0.33.3"