skikrumb-api 1.2.1 → 1.2.3

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/.kanelrc.js ADDED
@@ -0,0 +1,24 @@
1
+ const path = require('path');
2
+
3
+ /** @type {import('kanel').Config} */
4
+ module.exports = {
5
+ connection: {
6
+ host: '127.0.0.1',
7
+ user: 'postgres',
8
+ password: 'postgres',
9
+ database: 'skikrumb',
10
+ port: 54322
11
+ },
12
+ schemas: ['public'],
13
+ preDeleteOutputFolder: true,
14
+ outputPath: './lib/database.types.ts',
15
+ customTypeMap: {
16
+ 'pg_catalog.tsvector': 'string',
17
+ 'pg_catalog.date': 'string',
18
+ 'pg_catalog.timestamptz': 'string',
19
+ 'pg_catalog.uuid': 'string',
20
+ 'pg_catalog.bpchar': 'string',
21
+ 'pg_catalog.int8': 'number',
22
+ 'pg_catalog.numeric': 'number',
23
+ },
24
+ };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const skiKrumb: (options?: {
4
4
  requestedWith: string | undefined;
5
5
  url: string | undefined;
6
6
  }) => {
7
+ createDevice: (deveui: string, serialNumber: string) => Promise<any>;
7
8
  createPaymentIntent: (form: any) => Promise<any>;
8
9
  createPrePurchaseIntent: (form: any) => Promise<any>;
9
10
  readApiKeys: () => Promise<apiKeys[]>;
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import ky from 'ky';
11
11
  export const skiKrumb = (options = {
12
12
  apiKey: '',
13
- requestedWith: 'skiKrumb API Wrapper',
13
+ requestedWith: 'skiKrumb Node & Client API Wrapper',
14
14
  url: 'https://api.skikrumb.ca'
15
15
  }) => {
16
16
  const api = ky.extend({
@@ -24,10 +24,20 @@ export const skiKrumb = (options = {
24
24
  ]
25
25
  }
26
26
  });
27
+ const createDevice = (deveui, serialNumber) => __awaiter(void 0, void 0, void 0, function* () {
28
+ if (!deveui || !serialNumber)
29
+ throw new Error('Must pass Lora MAC (deveui) and Serial Number');
30
+ return yield api.post(`${options.url}/devices`, {
31
+ headers: {
32
+ 'content-type': 'application/json'
33
+ },
34
+ json: { deveui: deveui, serial_number: serialNumber }
35
+ }).json();
36
+ });
27
37
  const createPaymentIntent = (form) => __awaiter(void 0, void 0, void 0, function* () {
28
38
  if (!form)
29
39
  throw new Error('Form values not posted.');
30
- return api.post(`${options.url}/payments/intent`, {
40
+ return api.post(`${options.url}/payments/purchase/intent`, {
31
41
  body: form
32
42
  }).json();
33
43
  });
@@ -63,11 +73,12 @@ export const skiKrumb = (options = {
63
73
  return api.get(`${options.url}/keys`).json();
64
74
  });
65
75
  return {
76
+ createDevice,
66
77
  createPaymentIntent,
67
78
  createPrePurchaseIntent,
68
79
  readApiKeys,
69
80
  readDataForDevices,
70
81
  readDeviceDailyDistance,
71
- readDeviceData
82
+ readDeviceData,
72
83
  };
73
84
  };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "prepublish": "npm run build",
9
9
  "build": "tsc",
10
+ "publish": "npm publish",
10
11
  "test": "echo \"Error: no test specified\" && exit 1"
11
12
  },
12
13
  "keywords": [],
package/readme.md CHANGED
@@ -18,7 +18,7 @@ import skiKrumb from 'skikrumb-api';
18
18
  const {readDeviceData} = skiKrumb({
19
19
  apiKey: 'YOUR_API_KEY',
20
20
  requestedWith: 'My Application Name',
21
- url: 'Defaults to http://api.skikrumb.ca'
21
+ url: 'Defaults to https://api.skikrumb.ca'
22
22
  })
23
23
  ```
24
24
  ### skiKrumb(options?)
@@ -52,4 +52,4 @@ Defaults to production skiKrumb API URL. Possible values: `https://api-dev.skikr
52
52
  > Requires an API key. Request an API Key by emailing info@skikrumb.ca
53
53
 
54
54
  > &copy; skiKrumb
55
- > `2023`
55
+ > `2023`