@or-sdk/password 1.0.1-beta.2600.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/README.md ADDED
@@ -0,0 +1,21 @@
1
+ ## Installation:
2
+ ```
3
+ $ npm i @or-sdk/password
4
+ ```
5
+
6
+ ## Usage:
7
+ ```typescript
8
+ import { Password } from '@or-sdk/password'
9
+
10
+ // with direct api url
11
+ const passwords = new Password({
12
+ token: 'my-account-token-string',
13
+ sdkApiUrl: 'http://example.password/endpoint'
14
+ });
15
+
16
+ // with service discovery(slower)
17
+ const passwords = new Password({
18
+ token: 'my-account-token-string',
19
+ discoveryUrl: 'http://example.password/endpoint'
20
+ });
21
+ ```
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.Password = void 0;
55
+ var base_1 = require("@or-sdk/base");
56
+ var constants_1 = require("./constants");
57
+ var sdk_api_1 = require("@or-sdk/sdk-api");
58
+ var Password = (function (_super) {
59
+ __extends(Password, _super);
60
+ function Password(params) {
61
+ var _this = this;
62
+ var token = params.token, discoveryUrl = params.discoveryUrl, sdkApiUrl = params.sdkApiUrl;
63
+ _this = _super.call(this, {
64
+ token: token,
65
+ discoveryUrl: discoveryUrl,
66
+ serviceKey: constants_1.SERVICE_KEY,
67
+ }) || this;
68
+ _this.sdkApi = new sdk_api_1.SdkApi({
69
+ token: token,
70
+ discoveryUrl: discoveryUrl,
71
+ sdkUrl: sdkApiUrl,
72
+ });
73
+ return _this;
74
+ }
75
+ Password.prototype.startResetPassword = function (email, redirectPath) {
76
+ return __awaiter(this, void 0, void 0, function () {
77
+ return __generator(this, function (_a) {
78
+ return [2, this.callApiV2({
79
+ route: '/password/forgot-start',
80
+ method: 'POST',
81
+ data: {
82
+ email: email,
83
+ redirectPath: redirectPath,
84
+ },
85
+ })];
86
+ });
87
+ });
88
+ };
89
+ Password.prototype.endResetPassword = function (_a) {
90
+ var email = _a.email, key = _a.key, password = _a.password, type = _a.type;
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ return __generator(this, function (_b) {
93
+ switch (_b.label) {
94
+ case 0: return [4, this.callApiV2({
95
+ route: '/password/forgot-end',
96
+ method: 'POST',
97
+ data: {
98
+ email: email,
99
+ key: key,
100
+ password: password,
101
+ type: type,
102
+ },
103
+ })];
104
+ case 1: return [2, _b.sent()];
105
+ }
106
+ });
107
+ });
108
+ };
109
+ Password.prototype.createMultiUser = function (_a) {
110
+ var token = _a.token, type = _a.type, password = _a.password;
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ return __generator(this, function (_b) {
113
+ switch (_b.label) {
114
+ case 0: return [4, this.callApiV2({
115
+ route: '/multi-user/create-finish',
116
+ method: 'POST',
117
+ data: {
118
+ token: token,
119
+ password: password,
120
+ type: type,
121
+ },
122
+ })];
123
+ case 1: return [2, _b.sent()];
124
+ }
125
+ });
126
+ });
127
+ };
128
+ return Password;
129
+ }(base_1.Base));
130
+ exports.Password = Password;
131
+ //# sourceMappingURL=Password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Password.js","sourceRoot":"","sources":["../../src/Password.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAEpC,yCAA0C;AAC1C,2CAAyC;AASzC;IAA8B,4BAAI;IAShC,kBAAY,MAAsB;QAAlC,iBAcC;QAbS,IAAA,KAAK,GAA8B,MAAM,MAApC,EAAE,YAAY,GAAgB,MAAM,aAAtB,EAAE,SAAS,GAAK,MAAM,UAAX,CAAY;gBAElD,kBAAM;YACJ,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,UAAU,EAAE,uBAAW;SACxB,CAAC;QAEF,KAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC;YACvB,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;;IACL,CAAC;IAEY,qCAAkB,GAA/B,UAAgC,KAAa,EAAE,YAA4B;;;gBACzE,WAAO,IAAI,CAAC,SAAS,CAAC;wBACpB,KAAK,EAAE,wBAAwB;wBAC/B,MAAM,EAAE,MAAM;wBACd,IAAI,EAAE;4BACJ,KAAK,OAAA;4BACL,YAAY,cAAA;yBACb;qBACF,CAAC,EAAC;;;KACJ;IAEY,mCAAgB,GAA7B,UAA8B,EAAsD;YAApD,KAAK,WAAA,EAAE,GAAG,SAAA,EAAE,QAAQ,cAAA,EAAE,IAAI,UAAA;;;;4BACjD,WAAM,IAAI,CAAC,SAAS,CAAC;4BAC1B,KAAK,EAAE,sBAAsB;4BAC7B,MAAM,EAAE,MAAM;4BACd,IAAI,EAAE;gCACJ,KAAK,OAAA;gCACL,GAAG,KAAA;gCACH,QAAQ,UAAA;gCACR,IAAI,MAAA;6BACL;yBACF,CAAC,EAAA;4BATF,WAAO,SASL,EAAC;;;;KACJ;IAEY,kCAAe,GAA5B,UAA6B,EAA2C;YAAzC,KAAK,WAAA,EAAE,IAAI,UAAA,EAAE,QAAQ,cAAA;;;;4BAC3C,WAAM,IAAI,CAAC,SAAS,CAAC;4BAC1B,KAAK,EAAE,2BAA2B;4BAClC,MAAM,EAAE,MAAM;4BACd,IAAI,EAAE;gCACJ,KAAK,OAAA;gCACL,QAAQ,UAAA;gCACR,IAAI,MAAA;6BACL;yBACF,CAAC,EAAA;4BARF,WAAO,SAQL,EAAC;;;;KACJ;IACH,eAAC;AAAD,CAAC,AA5DD,CAA8B,WAAI,GA4DjC;AA5DY,4BAAQ"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVICE_KEY = void 0;
4
+ exports.SERVICE_KEY = 'REPLACE_ME';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = 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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Password = void 0;
18
+ var Password_1 = require("./Password");
19
+ Object.defineProperty(exports, "Password", { enumerable: true, get: function () { return Password_1.Password; } });
20
+ __exportStar(require("./types"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,0CAAwB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateMultTypes = void 0;
4
+ var CreateMultTypes;
5
+ (function (CreateMultTypes) {
6
+ CreateMultTypes["createUser"] = "createUser";
7
+ CreateMultTypes["attachUser"] = "attachUser";
8
+ })(CreateMultTypes = exports.CreateMultTypes || (exports.CreateMultTypes = {}));
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAiBA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,4CAAwB,CAAA;IACxB,4CAAwB,CAAA;AAC1B,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B"}
@@ -0,0 +1,67 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Base } from '@or-sdk/base';
11
+ import { SERVICE_KEY } from './constants';
12
+ import { SdkApi } from '@or-sdk/sdk-api';
13
+ export class Password extends Base {
14
+ constructor(params) {
15
+ const { token, discoveryUrl, sdkApiUrl } = params;
16
+ super({
17
+ token,
18
+ discoveryUrl,
19
+ serviceKey: SERVICE_KEY,
20
+ });
21
+ this.sdkApi = new SdkApi({
22
+ token,
23
+ discoveryUrl,
24
+ sdkUrl: sdkApiUrl,
25
+ });
26
+ }
27
+ startResetPassword(email, redirectPath) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return this.callApiV2({
30
+ route: '/password/forgot-start',
31
+ method: 'POST',
32
+ data: {
33
+ email,
34
+ redirectPath,
35
+ },
36
+ });
37
+ });
38
+ }
39
+ endResetPassword({ email, key, password, type }) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ return yield this.callApiV2({
42
+ route: '/password/forgot-end',
43
+ method: 'POST',
44
+ data: {
45
+ email,
46
+ key,
47
+ password,
48
+ type,
49
+ },
50
+ });
51
+ });
52
+ }
53
+ createMultiUser({ token, type, password }) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ return yield this.callApiV2({
56
+ route: '/multi-user/create-finish',
57
+ method: 'POST',
58
+ data: {
59
+ token,
60
+ password,
61
+ type,
62
+ },
63
+ });
64
+ });
65
+ }
66
+ }
67
+ //# sourceMappingURL=Password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Password.js","sourceRoot":"","sources":["../../src/Password.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AASzC,MAAM,OAAO,QAAS,SAAQ,IAAI;IAShC,YAAY,MAAsB;QAChC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAElD,KAAK,CAAC;YACJ,KAAK;YACL,YAAY;YACZ,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,KAAK;YACL,YAAY;YACZ,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;IACL,CAAC;IAEY,kBAAkB,CAAC,KAAa,EAAE,YAA4B;;YACzE,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,wBAAwB;gBAC/B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,KAAK;oBACL,YAAY;iBACb;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,gBAAgB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAA0B;;YAClF,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;gBAC1B,KAAK,EAAE,sBAAsB;gBAC7B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,KAAK;oBACL,GAAG;oBACH,QAAQ;oBACR,IAAI;iBACL;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAoB;;YACtE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC;gBAC1B,KAAK,EAAE,2BAA2B;gBAClC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,KAAK;oBACL,QAAQ;oBACR,IAAI;iBACL;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
@@ -0,0 +1,2 @@
1
+ export const SERVICE_KEY = 'REPLACE_ME';
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Password } from './Password';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ export var CreateMultTypes;
2
+ (function (CreateMultTypes) {
3
+ CreateMultTypes["createUser"] = "createUser";
4
+ CreateMultTypes["attachUser"] = "attachUser";
5
+ })(CreateMultTypes || (CreateMultTypes = {}));
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,4CAAwB,CAAA;IACxB,4CAAwB,CAAA;AAC1B,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B"}
@@ -0,0 +1,10 @@
1
+ import { Base } from '@or-sdk/base';
2
+ import { PasswordConfig, CreateMultParams, EndResetPasswordParams } from './types';
3
+ export declare class Password extends Base {
4
+ private readonly sdkApi;
5
+ constructor(params: PasswordConfig);
6
+ startResetPassword(email: string, redirectPath?: string | null): Promise<unknown>;
7
+ endResetPassword({ email, key, password, type }: EndResetPasswordParams): Promise<unknown>;
8
+ createMultiUser({ token, type, password }: CreateMultParams): Promise<unknown>;
9
+ }
10
+ //# sourceMappingURL=Password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Password.d.ts","sourceRoot":"","sources":["../../src/Password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAWnF,qBAAa,QAAS,SAAQ,IAAI;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAQpB,MAAM,EAAE,cAAc;IAgBrB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI;IAW9D,gBAAgB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,sBAAsB;IAavE,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,gBAAgB;CAWzE"}
@@ -0,0 +1,2 @@
1
+ export declare const SERVICE_KEY = "REPLACE_ME";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Password } from './Password';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Token } from '@or-sdk/base';
2
+ export type PasswordConfig = {
3
+ token: Token;
4
+ discoveryUrl?: string;
5
+ sdkApiUrl?: string;
6
+ };
7
+ export declare enum CreateMultTypes {
8
+ createUser = "createUser",
9
+ attachUser = "attachUser"
10
+ }
11
+ export type CreateMultParams = {
12
+ token: string;
13
+ password: string;
14
+ type: CreateMultTypes;
15
+ };
16
+ export type EndResetPasswordParams = {
17
+ email: string;
18
+ password: string;
19
+ type?: string;
20
+ key: string;
21
+ };
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG;IAI3B,KAAK,EAAE,KAAK,CAAC;IAIb,YAAY,CAAC,EAAE,MAAM,CAAC;IAItB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe;IACzB,UAAU,eAAc;IACxB,UAAU,eAAc;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "version": "1.0.1-beta.2600.0",
3
+ "name": "@or-sdk/password",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "scripts": {
8
+ "build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
9
+ "build:cjs": "tsc --project tsconfig.json",
10
+ "build:esm": "tsc --project tsconfig.esm.json",
11
+ "build:types": "tsc --project tsconfig.types.json",
12
+ "build:watch": "concurrently -r --hide 1,2 \"pnpm build:watch:cjs\" \"pnpm build:watch:esm\" \"pnpm build:watch:types\"",
13
+ "build:watch:cjs": "tsc --project tsconfig.json -w",
14
+ "build:watch:esm": "tsc --project tsconfig.esm.json -w",
15
+ "build:watch:types": "tsc --project tsconfig.types.json -w",
16
+ "clean": "rm -rf ./dist",
17
+ "dev": "pnpm build:watch:esm"
18
+ },
19
+ "devDependencies": {
20
+ "concurrently": "^6.4.0",
21
+ "typescript": "^4.4.4"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@or-sdk/base": "^0.35.1",
28
+ "@or-sdk/sdk-api": "^0.26.6"
29
+ }
30
+ }
@@ -0,0 +1,73 @@
1
+ import { Base } from '@or-sdk/base';
2
+ import { PasswordConfig, CreateMultParams, EndResetPasswordParams } from './types';
3
+ import { SERVICE_KEY } from './constants';
4
+ import { SdkApi } from '@or-sdk/sdk-api';
5
+
6
+ /**
7
+ * OneReach Password service client
8
+ * ## Installation:
9
+ * ```
10
+ * $ npm i @or-sdk/password
11
+ * ```
12
+ */
13
+ export class Password extends Base {
14
+ private readonly sdkApi: SdkApi;
15
+
16
+ /**
17
+ * ```typescript
18
+ * import { Password } from '@or-sdk/password'
19
+ * const password = new Password({token: 'my-account-token-string', discoveryUrl: 'http://example.tables/endpoint'});
20
+ * ```
21
+ */
22
+ constructor(params: PasswordConfig) {
23
+ const { token, discoveryUrl, sdkApiUrl } = params;
24
+
25
+ super({
26
+ token,
27
+ discoveryUrl,
28
+ serviceKey: SERVICE_KEY,
29
+ });
30
+
31
+ this.sdkApi = new SdkApi({
32
+ token,
33
+ discoveryUrl,
34
+ sdkUrl: sdkApiUrl,
35
+ });
36
+ }
37
+
38
+ public async startResetPassword(email: string, redirectPath?: string | null) {
39
+ return this.callApiV2({
40
+ route: '/password/forgot-start',
41
+ method: 'POST',
42
+ data: {
43
+ email,
44
+ redirectPath,
45
+ },
46
+ });
47
+ }
48
+
49
+ public async endResetPassword({ email, key, password, type }: EndResetPasswordParams) {
50
+ return await this.callApiV2({
51
+ route: '/password/forgot-end',
52
+ method: 'POST',
53
+ data: {
54
+ email,
55
+ key,
56
+ password,
57
+ type,
58
+ },
59
+ });
60
+ }
61
+
62
+ public async createMultiUser({ token, type, password }: CreateMultParams) {
63
+ return await this.callApiV2({
64
+ route: '/multi-user/create-finish',
65
+ method: 'POST',
66
+ data: {
67
+ token,
68
+ password,
69
+ type,
70
+ },
71
+ });
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ export const SERVICE_KEY = 'REPLACE_ME';
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Password } from './Password';
2
+ export * from './types';
package/src/types.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { Token } from '@or-sdk/base';
2
+
3
+ export type PasswordConfig = {
4
+ /**
5
+ * token
6
+ */
7
+ token: Token;
8
+ /**
9
+ * function which return token
10
+ */
11
+ discoveryUrl?: string;
12
+ /**
13
+ * Url of OneReach SDK api
14
+ */
15
+ sdkApiUrl?: string;
16
+ };
17
+
18
+ export enum CreateMultTypes {
19
+ createUser ='createUser',
20
+ attachUser ='attachUser',
21
+ }
22
+
23
+ export type CreateMultParams = {
24
+ token: string;
25
+ password: string;
26
+ type: CreateMultTypes;
27
+ };
28
+
29
+ export type EndResetPasswordParams = {
30
+ email: string;
31
+ password: string;
32
+ type?: string;
33
+ key: string;
34
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.esm.json",
3
+ "compilerOptions": {
4
+ "declarationDir": "./dist/types",
5
+ "rootDir": "./src",
6
+ "declaration": true
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/esm",
5
+ "declarationDir": "./dist/types",
6
+ "module": "ES6",
7
+ "target": "es6",
8
+ "rootDir": "./src",
9
+ "declaration": true,
10
+ "declarationMap": true
11
+ }
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/cjs/",
5
+ "rootDir": "./src"
6
+ }
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist/types/",
5
+ "rootDir": "./src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "emitDeclarationOnly": true
9
+ }
10
+ }