@orion-js/services 3.11.15 → 4.0.0-alpha.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/dist/index.cjs +1325 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1301 -0
- package/package.json +21 -16
- package/LICENSE +0 -21
- package/lib/example/AuthService/AuthService.d.ts +0 -5
- package/lib/example/AuthService/AuthService.js +0 -33
- package/lib/example/AuthService/TokenStorage.d.ts +0 -4
- package/lib/example/AuthService/TokenStorage.js +0 -28
- package/lib/example/AuthService/index.test.d.ts +0 -1
- package/lib/example/AuthService/index.test.js +0 -12
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -14
- package/lib/typedi.d.ts +0 -3
- package/lib/typedi.js +0 -15
package/package.json
CHANGED
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/services",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "
|
|
5
|
-
"types": "
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
|
+
"main": "./dist/index.cjs",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"
|
|
7
|
+
"dist"
|
|
8
8
|
],
|
|
9
9
|
"author": "nicolaslopezj",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "bun test",
|
|
13
13
|
"prepare": "yarn run build",
|
|
14
|
-
"clean": "rm -rf ./
|
|
15
|
-
"build": "
|
|
14
|
+
"clean": "rm -rf ./dist",
|
|
15
|
+
"build": "bun run build.ts",
|
|
16
16
|
"watch": "tsc -w",
|
|
17
|
-
"upgrade-interactive": "yarn upgrade-interactive"
|
|
17
|
+
"upgrade-interactive": "yarn upgrade-interactive",
|
|
18
|
+
"dev": "bun --watch src/index.ts"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@orion-js/helpers": "^
|
|
21
|
+
"@orion-js/helpers": "^4.0.0-alpha.2",
|
|
21
22
|
"typedi": "^0.10.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@types/jest": "^27.0.2",
|
|
25
25
|
"@types/lodash": "4.14.176",
|
|
26
|
-
"@types/node": "16.11.7",
|
|
27
|
-
"jest": "27.3.1",
|
|
28
26
|
"reflect-metadata": "^0.1.13",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
27
|
+
"typescript": "^5.4.5",
|
|
28
|
+
"@types/bun": "^1.2.4"
|
|
31
29
|
},
|
|
32
30
|
"publishConfig": {
|
|
33
31
|
"access": "public"
|
|
34
32
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
-
|
|
33
|
+
"gitHead": "9fd28b6f6b348cebc9f0dc207805647969277372",
|
|
34
|
+
"type": "module",
|
|
35
|
+
"module": "./dist/index.js",
|
|
36
|
+
"exports": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"require": "./dist/index.cjs"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Orionjs Team
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AuthService = void 0;
|
|
13
|
-
const typedi_1 = require("../../typedi");
|
|
14
|
-
const TokenStorage_1 = require("./TokenStorage");
|
|
15
|
-
// import {getInstance, Service} from '@orion-js/services'
|
|
16
|
-
let AuthService = class AuthService {
|
|
17
|
-
login(email) {
|
|
18
|
-
const token = `${email}-token`;
|
|
19
|
-
const result = this.tokenStorage.storeToken(token);
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
onLogin() {
|
|
23
|
-
return 'loggedin';
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, typedi_1.Inject)(),
|
|
28
|
-
__metadata("design:type", TokenStorage_1.TokenStorage)
|
|
29
|
-
], AuthService.prototype, "tokenStorage", void 0);
|
|
30
|
-
AuthService = __decorate([
|
|
31
|
-
(0, typedi_1.Service)()
|
|
32
|
-
], AuthService);
|
|
33
|
-
exports.AuthService = AuthService;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TokenStorage = void 0;
|
|
13
|
-
const AuthService_1 = require("./AuthService");
|
|
14
|
-
const typedi_1 = require("../../typedi");
|
|
15
|
-
let TokenStorage = class TokenStorage {
|
|
16
|
-
storeToken(token) {
|
|
17
|
-
const message = this.authService.onLogin();
|
|
18
|
-
return `Stored token ${token} ${message}`;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, typedi_1.Inject)(() => AuthService_1.AuthService),
|
|
23
|
-
__metadata("design:type", AuthService_1.AuthService)
|
|
24
|
-
], TokenStorage.prototype, "authService", void 0);
|
|
25
|
-
TokenStorage = __decorate([
|
|
26
|
-
(0, typedi_1.Service)()
|
|
27
|
-
], TokenStorage);
|
|
28
|
-
exports.TokenStorage = TokenStorage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("reflect-metadata");
|
|
4
|
-
const typedi_1 = require("../../typedi");
|
|
5
|
-
const AuthService_1 = require("./AuthService");
|
|
6
|
-
describe('Example AuthService', () => {
|
|
7
|
-
it('should create the instance and run all the methods using circular dependencies', () => {
|
|
8
|
-
const auth = (0, typedi_1.getInstance)(AuthService_1.AuthService);
|
|
9
|
-
const result = auth.login('user@email.com');
|
|
10
|
-
expect(result).toBe('Stored token user@email.com-token loggedin');
|
|
11
|
-
});
|
|
12
|
-
});
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
require("reflect-metadata");
|
|
14
|
-
__exportStar(require("./typedi"), exports);
|
package/lib/typedi.d.ts
DELETED
package/lib/typedi.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInstance = exports.Container = exports.Inject = exports.Service = void 0;
|
|
7
|
-
const typedi_1 = __importDefault(require("typedi"));
|
|
8
|
-
var typedi_2 = require("typedi");
|
|
9
|
-
Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return typedi_2.Service; } });
|
|
10
|
-
Object.defineProperty(exports, "Inject", { enumerable: true, get: function () { return typedi_2.Inject; } });
|
|
11
|
-
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return typedi_2.Container; } });
|
|
12
|
-
function getInstance(service) {
|
|
13
|
-
return typedi_1.default.get(service);
|
|
14
|
-
}
|
|
15
|
-
exports.getInstance = getInstance;
|