@warpstore/warpstore-package 1.0.2 → 1.0.4
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/src/core/errors/custom-domain-error.d.ts +8 -0
- package/dist/src/core/errors/custom-domain-error.d.ts.map +1 -0
- package/dist/src/core/errors/custom-domain-error.js +13 -0
- package/dist/src/core/errors/domain-error.d.ts +10 -0
- package/dist/src/core/errors/domain-error.d.ts.map +1 -0
- package/dist/src/core/errors/domain-error.js +11 -0
- package/dist/src/core/errors/index.d.ts +3 -0
- package/dist/src/core/errors/index.d.ts.map +1 -0
- package/dist/src/core/errors/index.js +18 -0
- package/dist/src/core/logic/either.d.ts +16 -0
- package/dist/src/core/logic/either.d.ts.map +1 -0
- package/dist/src/core/logic/either.js +35 -0
- package/dist/src/core/logic/index.d.ts +2 -0
- package/dist/src/core/logic/index.d.ts.map +1 -0
- package/dist/src/core/logic/index.js +17 -0
- package/dist/src/core/validators/index.d.ts +2 -0
- package/dist/src/core/validators/index.d.ts.map +1 -0
- package/dist/src/core/validators/index.js +17 -0
- package/dist/src/core/validators/ip.d.ts +2 -0
- package/dist/src/core/validators/ip.d.ts.map +1 -0
- package/dist/src/core/validators/ip.js +7 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +19 -0
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +17 -0
- package/dist/src/lib/request-manager.d.ts +13 -0
- package/dist/src/lib/request-manager.d.ts.map +1 -0
- package/dist/src/lib/request-manager.js +32 -0
- package/dist/src/main.d.ts +11 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +18 -0
- package/dist/src/modules/checkout/checkout.d.ts +9 -0
- package/dist/src/modules/checkout/checkout.d.ts.map +1 -0
- package/dist/src/modules/checkout/checkout.js +13 -0
- package/dist/src/modules/checkout/dtos.d.ts +28 -0
- package/dist/src/modules/checkout/dtos.d.ts.map +1 -0
- package/dist/src/modules/checkout/dtos.js +2 -0
- package/dist/src/modules/checkout/errors/errors.d.ts +7 -0
- package/dist/src/modules/checkout/errors/errors.d.ts.map +1 -0
- package/dist/src/modules/checkout/errors/errors.js +10 -0
- package/dist/src/modules/checkout/errors/index.d.ts +1 -0
- package/dist/src/modules/checkout/errors/index.d.ts.map +1 -0
- package/dist/src/modules/checkout/errors/index.js +1 -0
- package/dist/src/modules/template/index.d.ts +5 -0
- package/dist/src/modules/template/index.d.ts.map +1 -0
- package/dist/src/modules/template/index.js +10 -0
- package/dist/src/modules/template/versions/dtos.d.ts +76 -0
- package/dist/src/modules/template/versions/dtos.d.ts.map +1 -0
- package/dist/src/modules/template/versions/dtos.js +13 -0
- package/dist/src/modules/template/versions/errors/errors.d.ts +7 -0
- package/dist/src/modules/template/versions/errors/errors.d.ts.map +1 -0
- package/dist/src/modules/template/versions/errors/errors.js +10 -0
- package/dist/src/modules/template/versions/errors/index.d.ts +1 -0
- package/dist/src/modules/template/versions/errors/index.d.ts.map +1 -0
- package/dist/src/modules/template/versions/errors/index.js +1 -0
- package/dist/src/modules/template/versions/index.d.ts +2 -0
- package/dist/src/modules/template/versions/index.d.ts.map +1 -0
- package/dist/src/modules/template/versions/index.js +17 -0
- package/dist/src/modules/template/versions/v1.d.ts +24 -0
- package/dist/src/modules/template/versions/v1.d.ts.map +1 -0
- package/dist/src/modules/template/versions/v1.js +31 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -9
- package/src/core/errors/custom-domain-error.ts +0 -12
- package/src/core/errors/domain-error.ts +0 -7
- package/src/core/errors/index.ts +0 -2
- package/src/core/logic/either.ts +0 -41
- package/src/core/logic/index.ts +0 -1
- package/src/index.ts +0 -18
- package/src/lib/index.ts +0 -1
- package/src/lib/request-manager.ts +0 -48
- package/src/main.ts +0 -7
- package/src/template/index.ts +0 -7
- package/src/template/versions/dtos.ts +0 -81
- package/src/template/versions/errors/errors.ts +0 -12
- package/src/template/versions/errors/index.ts +0 -0
- package/src/template/versions/index.ts +0 -1
- package/src/template/versions/v1.ts +0 -37
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DomainError } from "./domain-error";
|
|
2
|
+
export declare class CustomDomainError<T> extends DomainError {
|
|
3
|
+
errorName: T;
|
|
4
|
+
constructor(name: T, additionalInfo?: DomainError.additionalInfo);
|
|
5
|
+
}
|
|
6
|
+
export declare namespace CustomDomainError {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=custom-domain-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-domain-error.d.ts","sourceRoot":"","sources":["../../../../src/core/errors/custom-domain-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,qBAAa,iBAAiB,CAAC,CAAC,CAAE,SAAQ,WAAW;IAEjD,SAAS,EAAE,CAAC,CAAA;gBAEA,IAAI,EAAE,CAAC,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,cAAc;CAMnE;AAED,yBAAiB,iBAAiB,CAAC;CAElC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomDomainError = void 0;
|
|
4
|
+
const domain_error_1 = require("./domain-error");
|
|
5
|
+
class CustomDomainError extends domain_error_1.DomainError {
|
|
6
|
+
constructor(name, additionalInfo) {
|
|
7
|
+
super();
|
|
8
|
+
this.errorName = name;
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.addifiionalInfo = additionalInfo;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CustomDomainError = CustomDomainError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class DomainError extends Error {
|
|
2
|
+
addifiionalInfo?: DomainError.additionalInfo;
|
|
3
|
+
constructor(message?: string, additionalInfo?: DomainError.additionalInfo);
|
|
4
|
+
}
|
|
5
|
+
export declare namespace DomainError {
|
|
6
|
+
type additionalInfo = {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=domain-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-error.d.ts","sourceRoot":"","sources":["../../../../src/core/errors/domain-error.ts"],"names":[],"mappings":"AACA,qBAAa,WAAY,SAAQ,KAAK;IAElC,eAAe,CAAC,EAAE,WAAW,CAAC,cAAc,CAAA;gBAEhC,OAAO,CAAC,EAAE,MAAM,EAAG,cAAc,CAAC,EAAE,WAAW,CAAC,cAAc;CAK7E;AAED,yBAAiB,WAAW,CAAC;IACzB,KAAY,cAAc,GAAG;QACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACrB,CAAA;CACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DomainError = void 0;
|
|
4
|
+
class DomainError extends Error {
|
|
5
|
+
constructor(message, additionalInfo) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = this.constructor.name;
|
|
8
|
+
this.addifiionalInfo = additionalInfo;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.DomainError = DomainError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./domain-error"), exports);
|
|
18
|
+
__exportStar(require("./custom-domain-error"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class Failure<F, S> {
|
|
2
|
+
readonly value: F;
|
|
3
|
+
constructor(value: F);
|
|
4
|
+
isFailure(): this is Failure<F, S>;
|
|
5
|
+
isSuccess(): this is Success<F, S>;
|
|
6
|
+
}
|
|
7
|
+
export declare class Success<F, S> {
|
|
8
|
+
readonly value: S;
|
|
9
|
+
constructor(value: S);
|
|
10
|
+
isFailure(): this is Failure<F, S>;
|
|
11
|
+
isSuccess(): this is Success<F, S>;
|
|
12
|
+
}
|
|
13
|
+
export type Either<F, S> = Failure<F, S> | Success<F, S>;
|
|
14
|
+
export declare const failure: <F, S>(f?: F | undefined) => Either<F, S>;
|
|
15
|
+
export declare const success: <F, S>(s?: S | undefined) => Either<F, S>;
|
|
16
|
+
//# sourceMappingURL=either.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"either.d.ts","sourceRoot":"","sources":["../../../../src/core/logic/either.ts"],"names":[],"mappings":"AAAA,qBAAa,OAAO,CAAC,CAAC,EAAE,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;gBAEL,KAAK,EAAE,CAAC;IAIpB,SAAS,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAIlC,SAAS,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CAGnC;AAED,qBAAa,OAAO,CAAC,CAAC,EAAE,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;gBAEL,KAAK,EAAE,CAAC;IAIpB,SAAS,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAIlC,SAAS,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CAGnC;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,2CAEnB,CAAA;AAED,eAAO,MAAM,OAAO,2CAEnB,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.success = exports.failure = exports.Success = exports.Failure = void 0;
|
|
4
|
+
class Failure {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
this.value = value;
|
|
7
|
+
}
|
|
8
|
+
isFailure() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
isSuccess() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Failure = Failure;
|
|
16
|
+
class Success {
|
|
17
|
+
constructor(value) {
|
|
18
|
+
this.value = value;
|
|
19
|
+
}
|
|
20
|
+
isFailure() {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
isSuccess() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Success = Success;
|
|
28
|
+
const failure = (f) => {
|
|
29
|
+
return new Failure(f);
|
|
30
|
+
};
|
|
31
|
+
exports.failure = failure;
|
|
32
|
+
const success = (s) => {
|
|
33
|
+
return new Success(s);
|
|
34
|
+
};
|
|
35
|
+
exports.success = success;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/logic/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
__exportStar(require("./either"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/validators/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
__exportStar(require("./ip"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip.d.ts","sourceRoot":"","sources":["../../../../src/core/validators/ip.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,OAAQ,MAAM,YAA6C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateIp = void 0;
|
|
4
|
+
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
5
|
+
const ipv6Regex = /^([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$/;
|
|
6
|
+
const validateIp = (ip) => ipv4Regex.test(ip) || ipv6Regex.test(ip);
|
|
7
|
+
exports.validateIp = validateIp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const main_1 = require("./main");
|
|
4
|
+
(async () => {
|
|
5
|
+
const warpstore = new main_1.WarpStore();
|
|
6
|
+
main_1.WarpStore.setApiUrl("http://localhost:5000");
|
|
7
|
+
const response = await warpstore.template.v1.getStoreInfo({
|
|
8
|
+
subDomain: "test",
|
|
9
|
+
clientInfo: {
|
|
10
|
+
ip: "",
|
|
11
|
+
userAgent: ""
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
console.log(response.value);
|
|
15
|
+
if (response.isFailure()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
"sd";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
__exportStar(require("./request-manager"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Either } from "../core/logic";
|
|
2
|
+
export declare class RequestManager {
|
|
3
|
+
static makeRequest<TResponse, TError>(path: string, httpInput?: RequestManager.HttpInput): Promise<Either<TError, TResponse>>;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace RequestManager {
|
|
6
|
+
type HttpInput = {
|
|
7
|
+
method: "GET" | "POST";
|
|
8
|
+
body?: object;
|
|
9
|
+
headers?: object;
|
|
10
|
+
query?: object;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=request-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-manager.d.ts","sourceRoot":"","sources":["../../../src/lib/request-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,sBAAqB;AAGxD,qBAAa,cAAc;WAEV,WAAW,CAAC,SAAS,EAAE,MAAM,EAAG,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,cAAc,CAAC,SAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CA+BlJ;AAED,yBAAiB,cAAc,CAAC;IAG5B,KAAY,SAAS,GAAG;QACpB,MAAM,EAAE,KAAK,GAAG,MAAM,CAAA;QACtB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,KAAK,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestManager = void 0;
|
|
4
|
+
const errors_1 = require("../core/errors");
|
|
5
|
+
const logic_1 = require("../core/logic");
|
|
6
|
+
const main_1 = require("../main");
|
|
7
|
+
class RequestManager {
|
|
8
|
+
static async makeRequest(path, httpInput = {}) {
|
|
9
|
+
const { body, headers, query, method } = httpInput;
|
|
10
|
+
const url = new URL(main_1.WarpStore.apiUrl + path);
|
|
11
|
+
if (query) {
|
|
12
|
+
Object.keys(query).forEach(key => {
|
|
13
|
+
const value = query;
|
|
14
|
+
url.searchParams.append(key, value[key]);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const fetchResponse = await fetch(url.toString(), {
|
|
18
|
+
method: method ?? "GET",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
...headers
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify(body)
|
|
24
|
+
});
|
|
25
|
+
const response = await fetchResponse.json();
|
|
26
|
+
if (fetchResponse.status !== 200) {
|
|
27
|
+
return (0, logic_1.failure)(new errors_1.CustomDomainError(response?.error?.name, response?.error));
|
|
28
|
+
}
|
|
29
|
+
return (0, logic_1.success)(response);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.RequestManager = RequestManager;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Checkout } from "./modules/checkout/checkout";
|
|
2
|
+
import { Template } from "./modules/template";
|
|
3
|
+
export declare class WarpStore {
|
|
4
|
+
private requestManager;
|
|
5
|
+
checkout: Checkout;
|
|
6
|
+
template: Template;
|
|
7
|
+
constructor();
|
|
8
|
+
static apiUrl: string;
|
|
9
|
+
static setApiUrl(url: string): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,qBAAa,SAAS;IAClB,OAAO,CAAC,cAAc,CAAgB;IACtC,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;;IAQlB,MAAM,CAAC,MAAM,SAA8B;IAE3C,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM;CAG/B"}
|
package/dist/src/main.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarpStore = void 0;
|
|
4
|
+
const lib_1 = require("./lib");
|
|
5
|
+
const checkout_1 = require("./modules/checkout/checkout");
|
|
6
|
+
const template_1 = require("./modules/template");
|
|
7
|
+
class WarpStore {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.requestManager = new lib_1.RequestManager();
|
|
10
|
+
this.checkout = new checkout_1.Checkout();
|
|
11
|
+
this.template = new template_1.Template();
|
|
12
|
+
}
|
|
13
|
+
static setApiUrl(url) {
|
|
14
|
+
WarpStore.apiUrl = url;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.WarpStore = WarpStore;
|
|
18
|
+
WarpStore.apiUrl = "https://api.warpstore.app";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Either } from "../../core/logic";
|
|
2
|
+
import { PlaceOrderInputDto, PlaceOrderOutputDto } from "./dtos";
|
|
3
|
+
import { PlaceOrderError } from "./errors/errors";
|
|
4
|
+
export declare class Checkout {
|
|
5
|
+
placeOrder(input: PlaceOrderInputDto): Promise<Either<PlaceOrderError, PlaceOrderOutputDto>>;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace Checkout {
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../../src/modules/checkout/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAW,yBAAoB;AAG9C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,qBAAa,QAAQ;IAGX,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;CAOrG;AAGD,yBAAiB,QAAQ,CAAC;CAGzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Checkout = void 0;
|
|
4
|
+
const lib_1 = require("../../lib");
|
|
5
|
+
class Checkout {
|
|
6
|
+
async placeOrder(input) {
|
|
7
|
+
return await lib_1.RequestManager.makeRequest("/store/checkout/order/place-order", {
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: input
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Checkout = Checkout;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PaymentMethodsEnum } from "../template/versions/dtos";
|
|
2
|
+
export type Item = {
|
|
3
|
+
productId: string;
|
|
4
|
+
quantity: number;
|
|
5
|
+
variables?: Record<string, string> | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type PlaceOrderInputDto = {
|
|
8
|
+
items: Item[];
|
|
9
|
+
storeId: string;
|
|
10
|
+
customer: {
|
|
11
|
+
fullName: string;
|
|
12
|
+
email: string;
|
|
13
|
+
cpf: string;
|
|
14
|
+
phone: string;
|
|
15
|
+
};
|
|
16
|
+
gameUserReference: string;
|
|
17
|
+
couponCode?: string;
|
|
18
|
+
discordAccessToken?: string;
|
|
19
|
+
paymentGateway: keyof typeof PaymentMethodsEnum;
|
|
20
|
+
};
|
|
21
|
+
export type PlaceOrderOutputDto = {
|
|
22
|
+
id: string;
|
|
23
|
+
qrCode?: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
paymentLink?: string;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../src/modules/checkout/dtos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,IAAI,GAAG;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;CACjD,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,EAAE,MAAM,OAAO,kBAAkB,CAAA;CAClD,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACrB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomDomainError } from "../../../core/errors";
|
|
2
|
+
type Error = "GatewayNotEnabledError" | "ProductNotFoundError" | "StoreNotFoundError" | "InsufficientStockError" | "ProductNotFromSameStoreError" | "LimitPerUserReachedError" | string;
|
|
3
|
+
export declare class PlaceOrderError extends CustomDomainError<Error> {
|
|
4
|
+
constructor(name: Error);
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/modules/checkout/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,6BAAsB;AAElD,KAAK,KAAK,GAAI,wBAAwB,GAClC,sBAAsB,GACtB,oBAAoB,GACpB,wBAAwB,GACxB,8BAA8B,GAC9B,0BAA0B,GAAG,MAAM,CAAA;AAEvC,qBAAa,eAAgB,SAAQ,iBAAiB,CAAC,KAAK,CAAC;gBAE7C,IAAI,EAAE,KAAK;CAG1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaceOrderError = void 0;
|
|
4
|
+
const errors_1 = require("../../../core/errors");
|
|
5
|
+
class PlaceOrderError extends errors_1.CustomDomainError {
|
|
6
|
+
constructor(name) {
|
|
7
|
+
super(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PlaceOrderError = PlaceOrderError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/checkout/errors/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/template/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,QAAQ;IAEjB,EAAE,EAAE,UAAU,CAAmB;CAGpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Template = void 0;
|
|
4
|
+
const versions_1 = require("./versions");
|
|
5
|
+
class Template {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.v1 = new versions_1.TemplateV1();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.Template = Template;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const PlanEnum: {
|
|
2
|
+
readonly BASIC: "BASIC";
|
|
3
|
+
readonly SUPER: "SUPER";
|
|
4
|
+
readonly ADVANCED: "ADVANCED";
|
|
5
|
+
};
|
|
6
|
+
export declare const PaymentMethodsEnum: {
|
|
7
|
+
readonly MERCADO_PAGO: "MERCADO_PAGO";
|
|
8
|
+
readonly PIX: "PIX";
|
|
9
|
+
readonly STRIPE: "STRIPE";
|
|
10
|
+
};
|
|
11
|
+
export type StoreThemeDto = {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
logo: string;
|
|
16
|
+
favicon: string;
|
|
17
|
+
banner: string;
|
|
18
|
+
subdomain: string;
|
|
19
|
+
domain: string | undefined;
|
|
20
|
+
currency: string;
|
|
21
|
+
keywords: string;
|
|
22
|
+
plan: keyof typeof PlanEnum;
|
|
23
|
+
theme: {
|
|
24
|
+
primaryColor: string;
|
|
25
|
+
secondaryColor: string;
|
|
26
|
+
backgroundPrimaryColor: string;
|
|
27
|
+
backgroundSecondaryColor: string;
|
|
28
|
+
};
|
|
29
|
+
widgets: {
|
|
30
|
+
FEATURED_PRODUCT?: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
image: string;
|
|
34
|
+
price: number;
|
|
35
|
+
};
|
|
36
|
+
DISCORD?: {
|
|
37
|
+
discordURL: string;
|
|
38
|
+
};
|
|
39
|
+
ONLINE_PLAYERS?: {
|
|
40
|
+
ip: string;
|
|
41
|
+
port: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
visualEffects: {
|
|
45
|
+
SNOW_FLAKE?: {
|
|
46
|
+
color: string;
|
|
47
|
+
radius: number;
|
|
48
|
+
snowFlakeCount: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
socialMedia: {
|
|
52
|
+
instagram?: string;
|
|
53
|
+
tiktok?: string;
|
|
54
|
+
youtube?: string;
|
|
55
|
+
discord?: string;
|
|
56
|
+
};
|
|
57
|
+
paymentMethods: keyof typeof PaymentMethodsEnum[];
|
|
58
|
+
categories: {
|
|
59
|
+
id: string;
|
|
60
|
+
title: string;
|
|
61
|
+
slug: string;
|
|
62
|
+
description: string;
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
65
|
+
export type ProductInfoDto = {
|
|
66
|
+
products: {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
description: string;
|
|
70
|
+
price: number;
|
|
71
|
+
image: string;
|
|
72
|
+
};
|
|
73
|
+
quantityReturned: number;
|
|
74
|
+
totalQuantity: number;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=dtos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../../../src/modules/template/versions/dtos.ts"],"names":[],"mappings":"AAEA,eAAQ,MAAO,QAAQ;;;;CAIb,CAAA;AAEV,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,OAAO,QAAQ,CAAA;IAC3B,KAAK,EAAE;QACH,YAAY,EAAE,MAAM,CAAA;QACpB,cAAc,EAAE,MAAM,CAAA;QACtB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,wBAAwB,EAAE,MAAM,CAAA;KACnC,CAAC;IACF,OAAO,EAAE;QACL,gBAAgB,CAAC,EAAE;YACf,EAAE,EAAE,MAAM,CAAA;YACV,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,OAAO,CAAC,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;SACrB,CAAA;QACD,cAAc,CAAC,EAAE;YACb,EAAE,EAAE,MAAM,CAAA;YACV,IAAI,EAAE,MAAM,CAAA;SACf,CAAA;KACJ,CAAC;IACF,aAAa,EAAE;QACX,UAAU,CAAC,EAAE;YACT,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,cAAc,EAAE,MAAM,CAAA;SACzB,CAAA;KACJ,CAAC;IACF,WAAW,EAAE;QACT,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;KACnB,CAAC;IACF,cAAc,EAAE,MAAM,OAAO,kBAAkB,EAAE,CAAA;IAEjD,UAAU,EAAE;QACR,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;KACtB,EAAE,CAAA;CACN,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,QAAQ,EAAE;QACN,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;CACxB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentMethodsEnum = exports.PlanEnum = void 0;
|
|
4
|
+
exports.PlanEnum = {
|
|
5
|
+
BASIC: "BASIC",
|
|
6
|
+
SUPER: "SUPER",
|
|
7
|
+
ADVANCED: "ADVANCED"
|
|
8
|
+
};
|
|
9
|
+
exports.PaymentMethodsEnum = {
|
|
10
|
+
MERCADO_PAGO: 'MERCADO_PAGO',
|
|
11
|
+
PIX: 'PIX',
|
|
12
|
+
STRIPE: 'STRIPE',
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomDomainError } from "../../../../core/errors";
|
|
2
|
+
type Error = "NoParamsProvidedError" | "StoreNotFoundError" | "InvalidRequestError" | "InvalidIpError" | "InvalidUserAgent";
|
|
3
|
+
export declare class GetStoreInfoError extends CustomDomainError<Error> {
|
|
4
|
+
constructor(name: Error);
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/template/versions/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gCAAsB;AAElD,KAAK,KAAK,GAAG,uBAAuB,GAAI,oBAAoB,GAAG,qBAAqB,GACjF,gBAAgB,GAAG,kBAAkB,CAAA;AAExC,qBAAa,iBAAkB,SAAQ,iBAAiB,CAAC,KAAK,CAAC;gBAE/C,IAAI,EAAE,KAAK;CAG1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetStoreInfoError = void 0;
|
|
4
|
+
const errors_1 = require("../../../../core/errors");
|
|
5
|
+
class GetStoreInfoError extends errors_1.CustomDomainError {
|
|
6
|
+
constructor(name) {
|
|
7
|
+
super(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.GetStoreInfoError = GetStoreInfoError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/template/versions/errors/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/template/versions/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA"}
|