@digipair/skill-pushbullet 0.91.0-0 → 0.91.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.
package/index.cjs.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,55 @@
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 PushbulletService = class PushbulletService {
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
+ 'Access-Token': this.PUSHBULLET_ACCESS_TOKEN
23
+ }, headers),
24
+ body: data
25
+ });
26
+ if (!response.ok) throw new Error('[SKILL-PUSHBULLET] REQUEST FAILED: ' + response.status);
27
+ return await response.json();
28
+ }
29
+ async sendSms(params, _pinsSettingsList, context) {
30
+ var _context_protected;
31
+ const { message, phoneNumber } = params;
32
+ return await this.call('/texts', 'POST', JSON.stringify({
33
+ data: {
34
+ addresses: [
35
+ phoneNumber
36
+ ],
37
+ message,
38
+ target_device_iden: this.TARGET_DEVICE_ID
39
+ }
40
+ }), {
41
+ 'Content-Type': 'application/json'
42
+ }, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
43
+ }
44
+ constructor(context, params){
45
+ var _context_privates_PUSHBULLET_ACCESS_TOKEN, _ref;
46
+ this.PUSHBULLET_ACCESS_TOKEN = (_ref = (_context_privates_PUSHBULLET_ACCESS_TOKEN = context.privates.PUSHBULLET_ACCESS_TOKEN) != null ? _context_privates_PUSHBULLET_ACCESS_TOKEN : params == null ? void 0 : params.PUSHBULLET_ACCESS_TOKEN) != null ? _ref : process.env['PUSHBULLET_ACCESS_TOKEN'];
47
+ var _context_privates_PUSHBULLET_TARGET_DEVICE_ID, _ref1;
48
+ this.TARGET_DEVICE_ID = (_ref1 = (_context_privates_PUSHBULLET_TARGET_DEVICE_ID = context.privates.PUSHBULLET_TARGET_DEVICE_ID) != null ? _context_privates_PUSHBULLET_TARGET_DEVICE_ID : params == null ? void 0 : params.PUSHBULLET_TARGET_DEVICE_ID) != null ? _ref1 : process.env['PUSHBULLET_TARGET_DEVICE_ID'];
49
+ var _context_privates_PUSHBULLET_API_ENDPOINT, _ref2, _ref3;
50
+ this.API_ENDPOINT = (_ref3 = (_ref2 = (_context_privates_PUSHBULLET_API_ENDPOINT = context.privates.PUSHBULLET_API_ENDPOINT) != null ? _context_privates_PUSHBULLET_API_ENDPOINT : params == null ? void 0 : params.PUSHBULLET_API_ENDPOINT) != null ? _ref2 : process.env['PUSHBULLET_API_ENDPOINT']) != null ? _ref3 : 'https://api.pushbullet.com/v2';
51
+ }
52
+ };
53
+ const sendSms = (params, pinsSettingsList, context)=>new PushbulletService(context, params).sendSms(params, pinsSettingsList, context);
54
+
55
+ exports.sendSms = sendSms;
package/index.esm.js ADDED
@@ -0,0 +1,51 @@
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 PushbulletService = class PushbulletService {
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
+ 'Access-Token': this.PUSHBULLET_ACCESS_TOKEN
19
+ }, headers),
20
+ body: data
21
+ });
22
+ if (!response.ok) throw new Error('[SKILL-PUSHBULLET] REQUEST FAILED: ' + response.status);
23
+ return await response.json();
24
+ }
25
+ async sendSms(params, _pinsSettingsList, context) {
26
+ var _context_protected;
27
+ const { message, phoneNumber } = params;
28
+ return await this.call('/texts', 'POST', JSON.stringify({
29
+ data: {
30
+ addresses: [
31
+ phoneNumber
32
+ ],
33
+ message,
34
+ target_device_iden: this.TARGET_DEVICE_ID
35
+ }
36
+ }), {
37
+ 'Content-Type': 'application/json'
38
+ }, (_context_protected = context.protected) == null ? void 0 : _context_protected.signal);
39
+ }
40
+ constructor(context, params){
41
+ var _context_privates_PUSHBULLET_ACCESS_TOKEN, _ref;
42
+ this.PUSHBULLET_ACCESS_TOKEN = (_ref = (_context_privates_PUSHBULLET_ACCESS_TOKEN = context.privates.PUSHBULLET_ACCESS_TOKEN) != null ? _context_privates_PUSHBULLET_ACCESS_TOKEN : params == null ? void 0 : params.PUSHBULLET_ACCESS_TOKEN) != null ? _ref : process.env['PUSHBULLET_ACCESS_TOKEN'];
43
+ var _context_privates_PUSHBULLET_TARGET_DEVICE_ID, _ref1;
44
+ this.TARGET_DEVICE_ID = (_ref1 = (_context_privates_PUSHBULLET_TARGET_DEVICE_ID = context.privates.PUSHBULLET_TARGET_DEVICE_ID) != null ? _context_privates_PUSHBULLET_TARGET_DEVICE_ID : params == null ? void 0 : params.PUSHBULLET_TARGET_DEVICE_ID) != null ? _ref1 : process.env['PUSHBULLET_TARGET_DEVICE_ID'];
45
+ var _context_privates_PUSHBULLET_API_ENDPOINT, _ref2, _ref3;
46
+ this.API_ENDPOINT = (_ref3 = (_ref2 = (_context_privates_PUSHBULLET_API_ENDPOINT = context.privates.PUSHBULLET_API_ENDPOINT) != null ? _context_privates_PUSHBULLET_API_ENDPOINT : params == null ? void 0 : params.PUSHBULLET_API_ENDPOINT) != null ? _ref2 : process.env['PUSHBULLET_API_ENDPOINT']) != null ? _ref3 : 'https://api.pushbullet.com/v2';
47
+ }
48
+ };
49
+ const sendSms = (params, pinsSettingsList, context)=>new PushbulletService(context, params).sendSms(params, pinsSettingsList, context);
50
+
51
+ export { sendSms };
@@ -0,0 +1,2 @@
1
+ import { PinsSettings } from '@digipair/engine';
2
+ export declare const sendSms: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
package/package.json CHANGED
@@ -1,28 +1,12 @@
1
1
  {
2
2
  "name": "@digipair/skill-pushbullet",
3
- "version": "0.91.0-0",
4
- "type": "module",
5
- "main": "dist/libs/skill-pushbullet/index.cjs.js",
6
- "module": "dist/libs/skill-pushbullet/index.esm.js",
7
- "types": "dist/libs/skill-pushbullet/index.esm.d.ts",
8
- "exports": {
9
- "./package.json": "./libs/skill-pushbullet/package.json",
10
- ".": {
11
- "development": "./dist/libs/skill-pushbullet/src/index.ts",
12
- "types": "./dist/libs/skill-pushbullet/index.esm.d.ts",
13
- "import": "./dist/libs/skill-pushbullet/index.esm.js",
14
- "default": "./dist/libs/skill-pushbullet/index.cjs.js"
15
- }
16
- },
3
+ "version": "0.91.0",
17
4
  "keywords": [
18
5
  "digipair",
19
- "tool",
20
- "service"
6
+ "service",
7
+ "tool"
21
8
  ],
22
- "nx": {
23
- "name": "skill-pushbullet"
24
- },
25
- "dependencies": {
26
- "@digipair/engine": "0.91.0-0"
27
- }
28
- }
9
+ "dependencies": {},
10
+ "main": "./index.cjs.js",
11
+ "module": "./index.esm.js"
12
+ }
package/.swcrc DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "jsc": {
3
- "target": "es2017",
4
- "parser": {
5
- "syntax": "typescript",
6
- "decorators": true,
7
- "dynamicImport": true
8
- },
9
- "transform": {
10
- "decoratorMetadata": true,
11
- "legacyDecorator": true
12
- },
13
- "keepClassNames": true,
14
- "externalHelpers": true,
15
- "loose": true
16
- },
17
- "module": {
18
- "type": "es6"
19
- },
20
- "sourceMaps": true,
21
- "exclude": [
22
- "jest.config.ts",
23
- ".*\\.spec.tsx?$",
24
- ".*\\.test.tsx?$",
25
- "./src/jest-setup.ts$",
26
- "./**/jest-setup.ts$"
27
- ]
28
- }
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # mylib
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build mylib` to build the library.
package/eslint.config.mjs DELETED
@@ -1,22 +0,0 @@
1
- import baseConfig from '../../eslint.config.mjs';
2
-
3
- export default [
4
- ...baseConfig,
5
- {
6
- files: ['**/*.json'],
7
- rules: {
8
- '@nx/dependency-checks': [
9
- 'error',
10
- {
11
- ignoredFiles: [
12
- '{projectRoot}/eslint.config.{js,cjs,mjs}',
13
- '{projectRoot}/rollup.config.{js,ts,mjs,mts,cjs,cts}',
14
- ],
15
- },
16
- ],
17
- },
18
- languageOptions: {
19
- parser: await import('jsonc-eslint-parser'),
20
- },
21
- },
22
- ];
package/rollup.config.cjs DELETED
@@ -1,28 +0,0 @@
1
- const { withNx } = require('@nx/rollup/with-nx');
2
-
3
- module.exports = withNx(
4
- {
5
- main: 'libs/skill-pushbullet/src/index.ts',
6
- outputPath: 'dist/libs/skill-pushbullet',
7
- tsConfig: 'libs/skill-pushbullet/tsconfig.lib.json',
8
- compiler: 'swc',
9
- format: ['esm', "cjs"],
10
- assets: [
11
- {
12
- input: 'libs/skill-pushbullet/',
13
- glob: 'package.json',
14
- output: '.'
15
- },
16
- {
17
- input: 'libs/skill-pushbullet/src/',
18
- glob: '*.json',
19
- output: '.'
20
- }
21
- ]
22
- },
23
- {
24
- // Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
25
- // e.g.
26
- // output: { sourcemap: true },
27
- }
28
- );
@@ -1,7 +0,0 @@
1
- import { skillPushbullet } from './skill-pushbullet';
2
-
3
- describe('skillPushbullet', () => {
4
- it('should work', () => {
5
- expect(skillPushbullet()).toEqual('skill-pushbullet');
6
- });
7
- });
@@ -1,62 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-unused-vars */
3
- import { PinsSettings } from '@digipair/engine';
4
-
5
- class PushbulletService {
6
- private TARGET_DEVICE_ID: string;
7
- private PUSHBULLET_ACCESS_TOKEN: string;
8
- private API_ENDPOINT: string;
9
-
10
- constructor(context: any, params: any) {
11
- this.PUSHBULLET_ACCESS_TOKEN =
12
- context.privates.PUSHBULLET_ACCESS_TOKEN ??
13
- params?.PUSHBULLET_ACCESS_TOKEN ??
14
- process.env['PUSHBULLET_ACCESS_TOKEN'];
15
- this.TARGET_DEVICE_ID =
16
- context.privates.PUSHBULLET_TARGET_DEVICE_ID ??
17
- params?.PUSHBULLET_TARGET_DEVICE_ID ??
18
- process.env['PUSHBULLET_TARGET_DEVICE_ID'];
19
-
20
- this.API_ENDPOINT =
21
- context.privates.PUSHBULLET_API_ENDPOINT ??
22
- params?.PUSHBULLET_API_ENDPOINT ??
23
- process.env['PUSHBULLET_API_ENDPOINT'] ??
24
- 'https://api.pushbullet.com/v2';
25
- }
26
-
27
- async call(url: string, method: string, data: any, headers: any, signal: AbortSignal) {
28
- const response = await fetch(`${this.API_ENDPOINT}${url}`, {
29
- signal,
30
- method,
31
- headers: {
32
- 'Access-Token': this.PUSHBULLET_ACCESS_TOKEN,
33
- ...headers,
34
- },
35
- body: data,
36
- });
37
- if (!response.ok) throw new Error('[SKILL-PUSHBULLET] REQUEST FAILED: ' + response.status);
38
- return await response.json();
39
- }
40
-
41
- async sendSms(params: any, _pinsSettingsList: PinsSettings[], context: any): Promise<any> {
42
- const { message, phoneNumber } = params;
43
- return await this.call(
44
- '/texts',
45
- 'POST',
46
- JSON.stringify({
47
- data: {
48
- addresses: [phoneNumber],
49
- message,
50
- target_device_iden: this.TARGET_DEVICE_ID,
51
- },
52
- }),
53
- {
54
- 'Content-Type': 'application/json',
55
- },
56
- context.protected?.signal,
57
- );
58
- }
59
- }
60
-
61
- export const sendSms = (params: any, pinsSettingsList: PinsSettings[], context: any) =>
62
- new PushbulletService(context, params).sendSms(params, pinsSettingsList, context);
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "../engine"
8
- },
9
- {
10
- "path": "./tsconfig.lib.json"
11
- }
12
- ]
13
- }
package/tsconfig.lib.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "outDir": "dist",
6
- "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
7
- "emitDeclarationOnly": true,
8
- "module": "esnext",
9
- "moduleResolution": "node",
10
- "forceConsistentCasingInFileNames": true,
11
- "types": ["node"]
12
- },
13
- "include": ["src/**/*.ts"],
14
- "references": [
15
- {
16
- "path": "../engine/tsconfig.lib.json"
17
- }
18
- ]
19
- }
File without changes
File without changes
File without changes