Skip to content

Commit e8d786a

Browse files
committed
revert classes
1 parent 8bdbaae commit e8d786a

File tree

18 files changed

+144
-69
lines changed

18 files changed

+144
-69
lines changed

.babelrc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"plugins": [
33
"@babel/plugin-transform-flow-strip-types",
4-
"@babel/plugin-proposal-object-rest-spread"
54
],
65
"presets": [
6+
"@babel/preset-typescript",
77
["@babel/preset-env", {
88
"targets": {
9-
"node": "14",
10-
},
11-
"exclude": ["proposal-dynamic-import"]
9+
"node": "18"
10+
}
1211
}]
1312
],
1413
"sourceMaps": "inline"

package-lock.json

Lines changed: 89 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
7575
"@babel/plugin-transform-flow-strip-types": "7.25.9",
7676
"@babel/preset-env": "7.26.0",
77+
"@babel/preset-typescript": "^7.26.0",
7778
"@saithodev/semantic-release-backmerge": "4.0.1",
7879
"@semantic-release/changelog": "6.0.3",
7980
"@semantic-release/commit-analyzer": "13.0.1",
@@ -119,7 +120,7 @@
119120
"docs": "jsdoc -c ./jsdoc-conf.json",
120121
"lint": "flow && eslint --cache ./",
121122
"lint-fix": "eslint --fix --cache ./",
122-
"build": "babel src/ -d lib/ --copy-files",
123+
"build": "babel src/ -d lib/ --copy-files --extensions '.ts,.js'",
123124
"build:types": "tsc && prettier --write 'types/{**/*,*}.ts' && npm run lint-fix",
124125
"watch": "babel --watch src/ -d lib/ --copy-files",
125126
"test:mongodb:runnerstart": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=$npm_config_dbversion} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} mongodb-runner start -t ${MONGODB_TOPOLOGY} --version ${MONGODB_VERSION} -- --port 27017",

spec/.babelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"@babel/plugin-proposal-object-rest-spread"
44
],
55
"presets": [
6+
"@babel/preset-typescript",
67
["@babel/preset-env", {
78
"targets": {
8-
"node": "14"
9+
"node": "18"
910
}
1011
}]
1112
],
12-
"sourceMaps": "inline",
13-
"retainLines": true
13+
"sourceMaps": "inline"
1414
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
export interface AnalyticsAdapter {
1+
export class AnalyticsAdapter {
22
/**
33
@param {any} parameters: the analytics request body, analytics info will be in the dimensions property
44
@param {Request} req: the original http request
55
*/
6-
appOpened(parameters: any, req: any): Promise<any>;
6+
async appOpened(parameters: any, req: any): Promise<any> {}
77
/**
88
@param {String} eventName: the name of the custom eventName
99
@param {any} parameters: the analytics request body, analytics info will be in the dimensions property
1010
@param {Request} req: the original http request
1111
*/
12-
trackEvent(eventName: string, parameters: any, req: any): Promise<any>;
12+
async trackEvent(eventName: string, parameters: any, req: any): Promise<any> {
13+
14+
}
1315
}
1416

src/Adapters/Cache/CacheAdapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
* @interface
44
* @memberof module:Adapters
55
*/
6-
export interface CacheAdapter {
6+
export class CacheAdapter {
77
/**
88
* Get a value in the cache
99
* @param {String} key Cache key to get
1010
* @return {Promise} that will eventually resolve to the value in the cache.
1111
*/
12-
get(key: string): Promise<string>;
12+
async get(key: string): Promise<string> { return ''};
1313

1414
/**
1515
* Set a value in the cache
1616
* @param {String} key Cache key to set
1717
* @param {String} value Value to set the key
1818
* @param {String} ttl Optional TTL
1919
*/
20-
put(key: string, value: string, ttl: number): void;
20+
put(key: string, value: string, ttl: number): void {}
2121

2222
/**
2323
* Remove a value from the cache.
2424
* @param {String} key Cache key to remove
2525
*/
26-
del(key: string): void;
26+
del(key: string): void {}
2727

2828
/**
2929
* Empty a cache
3030
*/
31-
clear(): void;
31+
clear(): void {}
3232
}

src/Adapters/Email/MailAdapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
* Mail Adapter prototype
66
* A MailAdapter should implement at least sendMail()
77
*/
8-
export interface MailAdapter {
8+
export class MailAdapter {
99
/**
1010
* A method for sending mail
1111
* @param options would have the parameters
1212
* - to: the recipient
1313
* - text: the raw text of the message
1414
* - subject: the subject of the email
1515
*/
16-
sendMail(options: { to: string; text: string; subject: string }): Promise<void>;
16+
async sendMail(options: { to: string; text: string; subject: string }): Promise<void> {}
1717

1818
/* You can implement those methods if you want
1919
* to provide HTML templates etc...

src/Adapters/Files/FilesAdapter.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Parse from 'parse/node';
2222
* @interface
2323
* @memberof module:Adapters
2424
*/
25-
export interface FilesAdapter {
25+
export class FilesAdapter {
2626
/** Responsible for storing the file in order to be retrieved later by its filename
2727
*
2828
* @param {string} filename - the filename to save
@@ -36,23 +36,29 @@ export interface FilesAdapter {
3636
*
3737
* @return {Promise} a promise that should fail if the storage didn't succeed
3838
*/
39-
createFile(filename: string, data, contentType: string, options: Object): Promise<any>
39+
createFile(filename: string, data, contentType: string, options: Object): Promise<any> {
40+
return Promise.resolve();
41+
}
4042

4143
/** Responsible for deleting the specified file
4244
*
4345
* @param {string} filename - the filename to delete
4446
*
4547
* @return {Promise} a promise that should fail if the deletion didn't succeed
4648
*/
47-
deleteFile(filename: string): Promise<any>
49+
deleteFile(filename: string): Promise<any> {
50+
return Promise.resolve();
51+
}
4852

4953
/** Responsible for retrieving the data of the specified file
5054
*
5155
* @param {string} filename - the name of file to retrieve
5256
*
5357
* @return {Promise} a promise that should pass with the file data or fail on error
5458
*/
55-
getFileData(filename: string): Promise<any>
59+
getFileData(filename: string): Promise<any> {
60+
return Promise.resolve();
61+
}
5662

5763
/** Returns an absolute URL where the file can be accessed
5864
*
@@ -61,7 +67,9 @@ export interface FilesAdapter {
6167
*
6268
* @return {string | Promise<string>} Absolute URL
6369
*/
64-
getFileLocation(config: Config, filename: string): string | Promise<string>
70+
getFileLocation(config: Config, filename: string): string | Promise<string> {
71+
return Promise.resolve();
72+
}
6573

6674
/** Validate a filename for this adapter type
6775
*
@@ -91,6 +99,7 @@ export interface FilesAdapter {
9199
// getMetadata(filename: string): Promise<any> {}
92100
}
93101

102+
94103
/**
95104
* Simple filename validation
96105
*

src/Adapters/Logger/LoggerAdapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* Allows you to change the logger mechanism
77
* Default is WinstonLoggerAdapter.js
88
*/
9-
export interface LoggerAdapter {
9+
export class LoggerAdapter {
1010

1111
/**
1212
* log
1313
* @param {String} level
1414
* @param {String} message
1515
* @param {Object} metadata
1616
*/
17-
log(level: string, message: string, metadata: any): void;
17+
log(level: string, message: string, metadata: any): void {}
1818
}
1919

src/Adapters/Logger/WinstonLoggerAdapter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { LoggerAdapter } from './LoggerAdapter';
21
import { logger, addTransport, configureLogger } from './WinstonLogger';
32

43
const MILLISECONDS_IN_A_DAY = 24 * 60 * 60 * 1000;
54

6-
export class WinstonLoggerAdapter extends LoggerAdapter {
5+
export class WinstonLoggerAdapter {
76
constructor(options) {
8-
super();
97
if (options) {
108
configureLogger(options);
119
}

src/Adapters/PubSub/PubSubAdapter.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
* @interface
44
* @memberof module:Adapters
55
*/
6-
export interface PubSubAdapter {
6+
export class PubSubAdapter {
77
/**
88
* @returns {PubSubAdapter.Publisher}
99
*/
10-
createPublisher(): Publisher;
10+
createPublisher(): Publisher {
11+
throw new Error('not implemented');
12+
}
1113
/**
1214
* @returns {PubSubAdapter.Subscriber}
1315
*/
14-
createSubscriber(): Subscriber;
16+
createSubscriber(): Subscriber {
17+
throw new Error('not implemented');
18+
}
1519
}
1620

1721
/**

src/Adapters/Push/PushAdapter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @flow
21
/*eslint no-unused-vars: "off"*/
32
// Push Adapter
43
//

0 commit comments

Comments
 (0)