@gapi/onesignal-notifications 1.8.169 → 1.8.170

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/client.js CHANGED
@@ -265,8 +265,8 @@ let OneSignalClientService = class OneSignalClientService {
265
265
  });
266
266
  }
267
267
  };
268
- OneSignalClientService = __decorate([
269
- core_1.Service(),
268
+ exports.OneSignalClientService = OneSignalClientService;
269
+ exports.OneSignalClientService = OneSignalClientService = __decorate([
270
+ (0, core_1.Service)(),
270
271
  __metadata("design:paramtypes", [onesignal_config_1.OneSignalConfig])
271
272
  ], OneSignalClientService);
272
- exports.OneSignalClientService = OneSignalClientService;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,6 @@ import { OneSignalConfig } from './onesignal.config';
3
3
  export declare class OneSignalModule {
4
4
  static forRoot(config: OneSignalConfig): ModuleWithServices;
5
5
  }
6
- export * from './notification';
7
6
  export * from './client';
8
7
  export * from './interfaces/index';
8
+ export * from './notification';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -13,7 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
13
17
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
18
  };
15
19
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
21
  };
18
22
  var OneSignalModule_1;
19
23
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -28,10 +32,10 @@ let OneSignalModule = OneSignalModule_1 = class OneSignalModule {
28
32
  };
29
33
  }
30
34
  };
31
- OneSignalModule = OneSignalModule_1 = __decorate([
32
- core_1.Module()
33
- ], OneSignalModule);
34
35
  exports.OneSignalModule = OneSignalModule;
35
- __exportStar(require("./notification"), exports);
36
+ exports.OneSignalModule = OneSignalModule = OneSignalModule_1 = __decorate([
37
+ (0, core_1.Module)()
38
+ ], OneSignalModule);
36
39
  __exportStar(require("./client"), exports);
37
40
  __exportStar(require("./interfaces/index"), exports);
41
+ __exportStar(require("./notification"), exports);
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./client"), exports);
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Domain } from 'domain';
3
2
  import { ClientRequest } from 'http';
4
3
  import { TLSSocket } from 'tls';
@@ -28,15 +27,15 @@ export interface SendNotificationHttpResponse {
28
27
  [key: string]: string;
29
28
  }>;
30
29
  rawTrailers: Array<any>;
31
- read: Function;
30
+ read: (size?: number) => Buffer | null;
32
31
  readable: boolean;
33
32
  req: ClientRequest;
34
33
  request: Request;
35
34
  socket: TLSSocket;
36
35
  statusCode: number;
37
36
  statusMessage: string;
38
- toJSON: Function;
39
37
  trailers: Record<string, any>;
38
+ toJSON: () => Record<string, any>;
40
39
  upgrade: boolean;
41
40
  url: string;
42
41
  }
@@ -64,6 +64,15 @@ const ALLOWED_FIELDS = [
64
64
  'android_channel_id',
65
65
  'existing_android_channel_id',
66
66
  ];
67
+ // interface ClientNotification {
68
+ // postBody: PostBody;
69
+ // setContent(contents): void;
70
+ // setExcludedSegments(excludedSegments: string[]): void;
71
+ // setFilters(filters: string): void;
72
+ // setIncludedSegments(includedSegments: string[]): void;
73
+ // setParameter(name: string, value: any): void;
74
+ // setTargetDevices(include_player_ids: string[]): void;
75
+ // }
67
76
  class Notification {
68
77
  constructor(initialBody) {
69
78
  this.allowed_fields = ALLOWED_FIELDS;
@@ -0,0 +1,38 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+ import tsParser from '@typescript-eslint/parser';
3
+ import tsPlugin from '@typescript-eslint/eslint-plugin';
4
+ import prettierPlugin from 'eslint-plugin-prettier';
5
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
6
+ import prettierConfig from 'eslint-config-prettier';
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist/*']),
10
+ {
11
+ files: ['./src/**/*.ts', './src/**/*.tsx'],
12
+ languageOptions: {
13
+ parser: tsParser,
14
+ ecmaVersion: 2018,
15
+ sourceType: 'module',
16
+ },
17
+ plugins: {
18
+ '@typescript-eslint': tsPlugin,
19
+ prettier: prettierPlugin,
20
+ 'simple-import-sort': simpleImportSort, // ✅ MUST MATCH RULE PREFIX
21
+ },
22
+ rules: {
23
+ ...tsPlugin.configs.recommended.rules,
24
+ ...prettierConfig.rules,
25
+
26
+ '@typescript-eslint/explicit-function-return-type': 'off',
27
+ '@typescript-eslint/camelcase': 'off',
28
+ '@typescript-eslint/interface-name-prefix': 'off',
29
+
30
+ 'simple-import-sort/imports': 'error',
31
+ 'simple-import-sort/exports': 'error',
32
+ 'sort-imports': 'off',
33
+ 'import/order': 'off',
34
+
35
+ 'prettier/prettier': 'error',
36
+ },
37
+ },
38
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/onesignal-notifications",
3
- "version": "1.8.169",
3
+ "version": "1.8.170",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/onesignal-notifications.git"
@@ -31,8 +31,8 @@
31
31
  "request": "^2.88.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@rxdi/core": "^0.7.193",
35
- "@types/node": "^13.11.1",
34
+ "@rxdi/core": "^0.7.194",
35
+ "@types/node": "^25.0.3",
36
36
  "@types/request": "^2.48.1"
37
37
  },
38
38
  "main": "./dist/index.js",
package/src/client.ts CHANGED
@@ -18,7 +18,7 @@ function checkCredential(credentialName, credential): boolean {
18
18
  if (ALLOWED_CREDENTIALS[i].name === credentialName) {
19
19
  if (typeof credential !== ALLOWED_CREDENTIALS[i].type) {
20
20
  throw new Error(
21
- credentialName + ' must be a ' + ALLOWED_CREDENTIALS[i].type
21
+ credentialName + ' must be a ' + ALLOWED_CREDENTIALS[i].type,
22
22
  );
23
23
  }
24
24
  if (ALLOWED_CREDENTIALS[i].requiredFields) {
@@ -27,7 +27,7 @@ function checkCredential(credentialName, credential): boolean {
27
27
  throw new Error(
28
28
  credentialName +
29
29
  ' must contain ' +
30
- ALLOWED_CREDENTIALS[i].requiredFields[j]
30
+ ALLOWED_CREDENTIALS[i].requiredFields[j],
31
31
  );
32
32
  }
33
33
  }
@@ -93,7 +93,7 @@ export class OneSignalClientService implements OneSignalClient {
93
93
  url: string,
94
94
  apiKey: string,
95
95
  method: 'PUT' | 'POST' | 'GET' | 'DELETE',
96
- body
96
+ body,
97
97
  ): Promise<any> {
98
98
  const options = {
99
99
  url: url,
@@ -132,11 +132,11 @@ export class OneSignalClientService implements OneSignalClient {
132
132
  }
133
133
 
134
134
  async sendNotification(
135
- notification: Notification
135
+ notification: Notification,
136
136
  ): Promise<SendNotificationResponse> {
137
137
  if (!notification || !notification.postBody) {
138
138
  throw new Error(
139
- 'notification parameter must be a typeof Notification object.'
139
+ 'notification parameter must be a typeof Notification object.',
140
140
  );
141
141
  }
142
142
  const postBody = notification.postBody;
@@ -146,7 +146,7 @@ export class OneSignalClientService implements OneSignalClient {
146
146
  this.API_URI + Constants.NOTIFICATIONS_PATH,
147
147
  this.userAuthKey,
148
148
  'POST',
149
- postBody
149
+ postBody,
150
150
  );
151
151
  }
152
152
  if (this.app) {
@@ -155,7 +155,7 @@ export class OneSignalClientService implements OneSignalClient {
155
155
  this.API_URI + Constants.NOTIFICATIONS_PATH,
156
156
  this.app.appAuthKey,
157
157
  'POST',
158
- postBody
158
+ postBody,
159
159
  );
160
160
  }
161
161
  throw new Error('You must set either an "app" or "apps" on Client');
@@ -176,7 +176,7 @@ export class OneSignalClientService implements OneSignalClient {
176
176
  notificationUri,
177
177
  this.app.appAuthKey,
178
178
  'DELETE',
179
- null
179
+ null,
180
180
  );
181
181
  }
182
182
 
@@ -195,7 +195,7 @@ export class OneSignalClientService implements OneSignalClient {
195
195
  notificationUri,
196
196
  this.app.appAuthKey,
197
197
  'GET',
198
- null
198
+ null,
199
199
  );
200
200
  }
201
201
 
@@ -224,7 +224,7 @@ export class OneSignalClientService implements OneSignalClient {
224
224
  this.API_URI + Constants.APPS_PATH,
225
225
  this.userAuthKey,
226
226
  'GET',
227
- null
227
+ null,
228
228
  );
229
229
  }
230
230
 
@@ -236,7 +236,7 @@ export class OneSignalClientService implements OneSignalClient {
236
236
  this.API_URI + Constants.APPS_PATH + '/' + appId,
237
237
  this.userAuthKey,
238
238
  'GET',
239
- null
239
+ null,
240
240
  );
241
241
  }
242
242
 
@@ -251,7 +251,7 @@ export class OneSignalClientService implements OneSignalClient {
251
251
  this.API_URI + Constants.APPS_PATH,
252
252
  this.userAuthKey,
253
253
  'POST',
254
- body
254
+ body,
255
255
  );
256
256
  }
257
257
 
@@ -266,7 +266,7 @@ export class OneSignalClientService implements OneSignalClient {
266
266
  this.API_URI + Constants.APPS_PATH + '/' + this.app.appId,
267
267
  this.userAuthKey,
268
268
  'PUT',
269
- body
269
+ body,
270
270
  );
271
271
  }
272
272
 
@@ -312,7 +312,7 @@ export class OneSignalClientService implements OneSignalClient {
312
312
  this.API_URI + Constants.DEVICES_PATH,
313
313
  this.app.appAuthKey,
314
314
  'POST',
315
- body
315
+ body,
316
316
  );
317
317
  }
318
318
 
@@ -324,7 +324,7 @@ export class OneSignalClientService implements OneSignalClient {
324
324
  this.API_URI + Constants.DEVICES_PATH + '/' + deviceId,
325
325
  this.app.appAuthKey,
326
326
  'PUT',
327
- body
327
+ body,
328
328
  );
329
329
  }
330
330
 
@@ -339,7 +339,7 @@ export class OneSignalClientService implements OneSignalClient {
339
339
  this.API_URI + Constants.NOTIFICATIONS_PATH + '/' + notificationId,
340
340
  this.app.appAuthKey,
341
341
  'PUT',
342
- body
342
+ body,
343
343
  );
344
344
  }
345
345
 
package/src/index.ts CHANGED
@@ -13,6 +13,6 @@ export class OneSignalModule {
13
13
  }
14
14
  }
15
15
 
16
- export * from './notification';
17
16
  export * from './client';
18
17
  export * from './interfaces/index';
18
+ export * from './notification';
@@ -26,15 +26,15 @@ export interface SendNotificationHttpResponse {
26
26
  method: any;
27
27
  rawHeaders: Array<{ [key: string]: string }>;
28
28
  rawTrailers: Array<any>;
29
- read: Function;
29
+ read: (size?: number) => Buffer | null;
30
30
  readable: boolean;
31
31
  req: ClientRequest;
32
32
  request: Request;
33
33
  socket: TLSSocket;
34
34
  statusCode: number;
35
35
  statusMessage: string;
36
- toJSON: Function;
37
36
  trailers: Record<string, any>;
37
+ toJSON: () => Record<string, any>;
38
38
  upgrade: boolean;
39
39
  url: string;
40
40
  }
@@ -77,15 +77,15 @@ export interface PostBody {
77
77
  include_player_ids: string[];
78
78
  }
79
79
 
80
- interface ClientNotification {
81
- postBody: PostBody;
82
- setContent(contents): void;
83
- setExcludedSegments(excludedSegments: string[]): void;
84
- setFilters(filters: string): void;
85
- setIncludedSegments(includedSegments: string[]): void;
86
- setParameter(name: string, value: any): void;
87
- setTargetDevices(include_player_ids: string[]): void;
88
- }
80
+ // interface ClientNotification {
81
+ // postBody: PostBody;
82
+ // setContent(contents): void;
83
+ // setExcludedSegments(excludedSegments: string[]): void;
84
+ // setFilters(filters: string): void;
85
+ // setIncludedSegments(includedSegments: string[]): void;
86
+ // setParameter(name: string, value: any): void;
87
+ // setTargetDevices(include_player_ids: string[]): void;
88
+ // }
89
89
 
90
90
  export class Notification {
91
91
  public initialBody: {
@@ -124,7 +124,7 @@ export class Notification {
124
124
  }
125
125
 
126
126
  throw new Error(
127
- 'Body must include one of the following fields: contents, content_available, template_id'
127
+ 'Body must include one of the following fields: contents, content_available, template_id',
128
128
  );
129
129
  }
130
130
 
@@ -137,7 +137,7 @@ export class Notification {
137
137
  name +
138
138
  '" is not present in documentation. You should add a ' +
139
139
  'exclamation mark to the begging of the name, if you want to set it : !' +
140
- name
140
+ name,
141
141
  );
142
142
  }
143
143
  this.postBody[name] = value;
package/tsconfig.json CHANGED
@@ -10,21 +10,10 @@
10
10
  "moduleResolution": "node",
11
11
  "outDir": "dist",
12
12
  "rootDir": "./src",
13
- "lib": [
14
- "es2017",
15
- "es2016",
16
- "es2015",
17
- "es6",
18
- "dom",
19
- "esnext.asynciterable"
20
- ],
13
+ "lib": ["es2017", "es2016", "es2015", "es6", "dom", "esnext.asynciterable"],
21
14
  "skipLibCheck": true,
22
- "types": [
23
- "node"
24
- ],
25
- "typeRoots": [
26
- "node_modules/"
27
- ]
15
+ "types": [],
16
+ "typeRoots": ["node_modules/"]
28
17
  },
29
18
  "angularCompilerOptions": {
30
19
  "annotateForClosureCompiler": true,
@@ -33,7 +22,5 @@
33
22
  "flatModuleOutFile": "gapi-amqp.js",
34
23
  "flatModuleId": "gapi-amqp"
35
24
  },
36
- "files": [
37
- "./src/index.ts"
38
- ]
39
- }
25
+ "files": ["./src/index.ts"]
26
+ }