@paakd/api 0.0.4 → 0.0.5
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/gen/src/proto/files/v1/entities/file_pb.d.ts +199 -0
- package/dist/gen/src/proto/files/v1/entities/file_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/files/v1/entities/file_pb.js +77 -0
- package/dist/gen/src/proto/files/v1/service_pb.d.ts +44 -0
- package/dist/gen/src/proto/files/v1/service_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/files/v1/service_pb.js +18 -0
- package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.d.ts +391 -0
- package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.js +140 -0
- package/dist/gen/src/proto/promotions/v1/service_pb.d.ts +68 -0
- package/dist/gen/src/proto/promotions/v1/service_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/promotions/v1/service_pb.js +18 -0
- package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.d.ts +508 -0
- package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.js +150 -0
- package/dist/gen/src/proto/stocknodes/v1/service_pb.d.ts +68 -0
- package/dist/gen/src/proto/stocknodes/v1/service_pb.d.ts.map +1 -0
- package/dist/gen/src/proto/stocknodes/v1/service_pb.js +18 -0
- package/dist/src/index.d.ts +828 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +48 -5
- package/dist/src/interceptors.d.ts +1 -1
- package/dist/src/interceptors.d.ts.map +1 -1
- package/dist/src/interceptors.js +2 -2
- package/package.json +6 -6
- package/dist/src/address.d.ts +0 -53
- package/dist/src/address.d.ts.map +0 -1
- package/dist/src/address.js +0 -233
- package/dist/src/address.spec.d.ts +0 -2
- package/dist/src/address.spec.d.ts.map +0 -1
- package/dist/src/address.spec.js +0 -488
- package/dist/src/auth.d.ts +0 -27
- package/dist/src/auth.d.ts.map +0 -1
- package/dist/src/auth.js +0 -155
- package/dist/src/auth.spec.d.ts +0 -2
- package/dist/src/auth.spec.d.ts.map +0 -1
- package/dist/src/auth.spec.js +0 -582
- package/dist/src/compressor/brotli.d.ts +0 -3
- package/dist/src/compressor/brotli.d.ts.map +0 -1
- package/dist/src/compressor/brotli.js +0 -30
- package/dist/src/policies.d.ts +0 -217
- package/dist/src/policies.d.ts.map +0 -1
- package/dist/src/policies.js +0 -322
- package/dist/src/policies.spec.d.ts +0 -2
- package/dist/src/policies.spec.d.ts.map +0 -1
- package/dist/src/policies.spec.js +0 -463
- package/dist/src/products.d.ts +0 -39
- package/dist/src/products.d.ts.map +0 -1
- package/dist/src/products.js +0 -95
- package/dist/src/products.spec.d.ts +0 -2
- package/dist/src/products.spec.d.ts.map +0 -1
- package/dist/src/products.spec.js +0 -519
- package/dist/src/profile.d.ts +0 -62
- package/dist/src/profile.d.ts.map +0 -1
- package/dist/src/profile.js +0 -151
- package/dist/src/profile.spec.d.ts +0 -2
- package/dist/src/profile.spec.d.ts.map +0 -1
- package/dist/src/profile.spec.js +0 -475
- package/dist/src/registration.d.ts +0 -60
- package/dist/src/registration.d.ts.map +0 -1
- package/dist/src/registration.js +0 -147
- package/dist/src/test-utils.d.ts +0 -87
- package/dist/src/test-utils.d.ts.map +0 -1
- package/dist/src/test-utils.js +0 -132
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAsBrE,UAAU,mBAAmB;IAC3B,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,CAA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Ac,mDAAmD,CAAA;AACjE,cAAc,mDAAmD,CAAA;AACjE,cAAc,4CAA4C,CAAA;AAC1D,cAAc,mDAAmD,CAAA;AACjE,cAAc,qDAAqD,CAAA;AACnE,cAAc,8CAA8C,CAAA;AAC5D,cAAc,mDAAmD,CAAA;AACjE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qDAAqD,CAAA;AACnE,cAAc,sDAAsD,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -13,9 +13,52 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
exports.createAPIClient = void 0;
|
|
27
|
+
const config_1 = require("@paakd/config");
|
|
28
|
+
const connect_1 = require("@connectrpc/connect");
|
|
29
|
+
const service_pb_1 = require("../gen/src/proto/products/v1/service_pb");
|
|
30
|
+
const connect_node_1 = require("@connectrpc/connect-node");
|
|
31
|
+
const core_1 = require("@paakd/core");
|
|
32
|
+
const interceptors_1 = require("./interceptors");
|
|
33
|
+
const service_pb_2 = require("../gen/src/proto/customers/v1/service_pb");
|
|
34
|
+
const service_pb_3 = require("../gen/src/proto/auth/v1/service_pb");
|
|
35
|
+
const service_pb_4 = require("../gen/src/proto/stocknodes/v1/service_pb");
|
|
36
|
+
const service_pb_5 = require("../gen/src/proto/files/v1/service_pb");
|
|
37
|
+
const service_pb_6 = require("../gen/src/proto/promotions/v1/service_pb");
|
|
38
|
+
const createAPIClient = (_a) => __awaiter(void 0, [_a], void 0, function* ({ conf, headers = {}, jwt = '', debug = false, }) {
|
|
39
|
+
const checkoutConfig = yield (0, config_1.getCheckoutConfig)(conf);
|
|
40
|
+
const reqHeaders = yield (0, core_1.getRequestHeaders)(conf);
|
|
41
|
+
const transport = (0, connect_node_1.createGrpcTransport)({
|
|
42
|
+
baseUrl: checkoutConfig.enterpriseURL,
|
|
43
|
+
interceptors: [
|
|
44
|
+
(0, interceptors_1.createHeadersInterceptor)(Object.assign(Object.assign({}, reqHeaders), headers)),
|
|
45
|
+
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
46
|
+
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt, debug),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, connect_1.createClient)(service_pb_2.CustomerService, transport)), (0, connect_1.createClient)(service_pb_3.AuthService, transport)), (0, connect_1.createClient)(service_pb_1.ProductsService, transport)), (0, connect_1.createClient)(service_pb_5.FileService, transport)), (0, connect_1.createClient)(service_pb_6.CampaignService, transport)), (0, connect_1.createClient)(service_pb_4.StockNodesService, transport));
|
|
50
|
+
});
|
|
51
|
+
exports.createAPIClient = createAPIClient;
|
|
52
|
+
__exportStar(require("../gen/src/proto/auth/v1/entities/auth_pb"), exports);
|
|
53
|
+
__exportStar(require("../gen/src/proto/auth/v1/entities/policy_pb"), exports);
|
|
54
|
+
__exportStar(require("../gen/src/proto/customers/v1/entities/address_pb"), exports);
|
|
55
|
+
__exportStar(require("../gen/src/proto/customers/v1/entities/profile_pb"), exports);
|
|
56
|
+
__exportStar(require("../gen/src/proto/files/v1/entities/file_pb"), exports);
|
|
57
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/category_pb"), exports);
|
|
58
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/collection_pb"), exports);
|
|
59
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/tag_pb"), exports);
|
|
60
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/taxonomy_pb"), exports);
|
|
61
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/type_pb"), exports);
|
|
62
|
+
__exportStar(require("../gen/src/proto/products/v1/entities/variant_pb"), exports);
|
|
63
|
+
__exportStar(require("../gen/src/proto/promotions/v1/entities/campaign_pb"), exports);
|
|
64
|
+
__exportStar(require("../gen/src/proto/stocknodes/v1/entities/stocknode_pb"), exports);
|
|
@@ -11,6 +11,6 @@ export interface RequestLogger {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function createLoggingInterceptor(reqLogger?: (request: UnaryRequest | StreamRequest) => RequestLogger): Interceptor;
|
|
13
13
|
export declare function createAuthenticationInterceptor(checkoutConfig: Checkout): Interceptor;
|
|
14
|
-
export declare function createCustomerAuthenticationInterceptor(jwtKey: string): Interceptor;
|
|
14
|
+
export declare function createCustomerAuthenticationInterceptor(jwtKey: string, debug?: boolean): Interceptor;
|
|
15
15
|
export declare function createHeadersInterceptor(headers: Record<string, string | null>): Interceptor;
|
|
16
16
|
//# sourceMappingURL=interceptors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptors.d.ts","sourceRoot":"","sources":["../../src/interceptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,aAAa,EAElB,KAAK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AAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AA4BD,wBAAgB,wBAAwB,CACtC,SAAS,GAAE,CACT,OAAO,EAAE,YAAY,GAAG,aAAa,KAClC,aAAoC,GACxC,WAAW,CAab;AAED,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,QAAQ,GACvB,WAAW,CASb;AAED,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,OAAO,GACd,WAAW,CASb;AAsFD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACrC,WAAW,CA0Cb"}
|
package/dist/src/interceptors.js
CHANGED
|
@@ -62,10 +62,10 @@ function createAuthenticationInterceptor(checkoutConfig) {
|
|
|
62
62
|
return yield next(req);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function createCustomerAuthenticationInterceptor(jwtKey) {
|
|
65
|
+
function createCustomerAuthenticationInterceptor(jwtKey, debug) {
|
|
66
66
|
return next => (req) => __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
if (!jwtKey) {
|
|
68
|
-
throw new connect_1.ConnectError('JWT
|
|
68
|
+
throw new connect_1.ConnectError('JWT token is not provided', connect_1.Code.Unauthenticated);
|
|
69
69
|
}
|
|
70
70
|
req.header.set('Authorization', `Bearer ${jwtKey}`);
|
|
71
71
|
return yield next(req);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paakd/api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"main": "./dist/src/index.js",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"
|
|
20
|
-
"@paakd/entities": "0.0.
|
|
19
|
+
"@paakd/core": "0.0.5",
|
|
20
|
+
"@paakd/entities": "0.0.5"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@bufbuild/buf": "^1.60.0",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"prettier": "^3.5.3",
|
|
44
44
|
"typescript": "^5.8.3",
|
|
45
45
|
"vitest": "4.0.16",
|
|
46
|
-
"@paakd/
|
|
47
|
-
"@paakd/config": "0.0.
|
|
48
|
-
"@paakd/typescript-config": "0.0.
|
|
46
|
+
"@paakd/config": "0.0.5",
|
|
47
|
+
"@paakd/eslint-config": "0.0.5",
|
|
48
|
+
"@paakd/typescript-config": "0.0.5"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
package/dist/src/address.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { AddAddressRequest, UpdateAddressRequest, GetAddressResponse, DeleteAddressResponse } from '../gen/src/proto/customers/v1/entities/address_pb';
|
|
2
|
-
export interface GetAddressProps {
|
|
3
|
-
body: {
|
|
4
|
-
customerId: string;
|
|
5
|
-
addressId: string;
|
|
6
|
-
jwt: string;
|
|
7
|
-
};
|
|
8
|
-
headers: Record<string, string | null>;
|
|
9
|
-
}
|
|
10
|
-
export interface GetAddressesProps {
|
|
11
|
-
body: {
|
|
12
|
-
customerId: string;
|
|
13
|
-
jwt: string;
|
|
14
|
-
};
|
|
15
|
-
headers: Record<string, string | null>;
|
|
16
|
-
}
|
|
17
|
-
export interface AddAddressProps {
|
|
18
|
-
body: Omit<AddAddressRequest, '$typeName'> & {
|
|
19
|
-
jwt: string;
|
|
20
|
-
};
|
|
21
|
-
headers: Record<string, string | null>;
|
|
22
|
-
}
|
|
23
|
-
export interface UpdateAddressProps {
|
|
24
|
-
body: Omit<UpdateAddressRequest, '$typeName'> & {
|
|
25
|
-
jwt: string;
|
|
26
|
-
};
|
|
27
|
-
headers: Record<string, string | null>;
|
|
28
|
-
}
|
|
29
|
-
export interface DeleteAddressProps {
|
|
30
|
-
body: {
|
|
31
|
-
customerId: string;
|
|
32
|
-
addressId: string;
|
|
33
|
-
jwt: string;
|
|
34
|
-
};
|
|
35
|
-
headers: Record<string, string | null>;
|
|
36
|
-
}
|
|
37
|
-
export type SuccessResponse<T> = {
|
|
38
|
-
value: T;
|
|
39
|
-
status: 'success';
|
|
40
|
-
};
|
|
41
|
-
export type ErrorResponse = {
|
|
42
|
-
code: number;
|
|
43
|
-
rawMessage: string;
|
|
44
|
-
message: string;
|
|
45
|
-
status: 'failed';
|
|
46
|
-
};
|
|
47
|
-
export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;
|
|
48
|
-
export declare function getAddresses({ body: { customerId, jwt }, headers, }: GetAddressesProps): Promise<ApiResponse<GetAddressResponse[]>>;
|
|
49
|
-
export declare function getAddress({ body: { customerId, addressId, jwt }, headers, }: GetAddressProps): Promise<ApiResponse<GetAddressResponse>>;
|
|
50
|
-
export declare function addAddress({ body: { jwt, ...val }, headers, }: AddAddressProps): Promise<ApiResponse<GetAddressResponse | undefined>>;
|
|
51
|
-
export declare function deleteAddress({ body: { customerId, addressId, jwt }, headers, }: DeleteAddressProps): Promise<ApiResponse<DeleteAddressResponse>>;
|
|
52
|
-
export declare function updateAddress({ body: { jwt, ...val }, headers, }: UpdateAddressProps): Promise<ApiResponse<GetAddressResponse | undefined>>;
|
|
53
|
-
//# sourceMappingURL=address.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,iBAAiB,EAC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awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.getAddresses = getAddresses;
|
|
24
|
-
exports.getAddress = getAddress;
|
|
25
|
-
exports.addAddress = addAddress;
|
|
26
|
-
exports.deleteAddress = deleteAddress;
|
|
27
|
-
exports.updateAddress = updateAddress;
|
|
28
|
-
const connect_1 = require("@connectrpc/connect");
|
|
29
|
-
const connect_node_1 = require("@connectrpc/connect-node");
|
|
30
|
-
const config_1 = require("@paakd/config");
|
|
31
|
-
const service_pb_1 = require("../gen/src/proto/customers/v1/service_pb");
|
|
32
|
-
const brotli_1 = require("./compressor/brotli");
|
|
33
|
-
const interceptors_1 = require("./interceptors");
|
|
34
|
-
function getAddresses(_a) {
|
|
35
|
-
return __awaiter(this, arguments, void 0, function* ({ body: { customerId, jwt }, headers, }) {
|
|
36
|
-
try {
|
|
37
|
-
const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
|
|
38
|
-
const addressClient = (0, connect_1.createClient)(service_pb_1.CustomerService, (0, connect_node_1.createGrpcTransport)({
|
|
39
|
-
baseUrl: checkoutConfig.enterpriseURL,
|
|
40
|
-
interceptors: [
|
|
41
|
-
(0, interceptors_1.createHeadersInterceptor)(headers),
|
|
42
|
-
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
43
|
-
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt),
|
|
44
|
-
],
|
|
45
|
-
acceptCompression: [brotli_1.brotliCompression],
|
|
46
|
-
sendCompression: brotli_1.brotliCompression,
|
|
47
|
-
}));
|
|
48
|
-
const { addresses } = yield addressClient.getAddresses({
|
|
49
|
-
customerId,
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
value: addresses,
|
|
53
|
-
status: 'success',
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
if (err instanceof connect_1.ConnectError) {
|
|
58
|
-
return {
|
|
59
|
-
code: err.code,
|
|
60
|
-
rawMessage: err.rawMessage,
|
|
61
|
-
message: err.rawMessage,
|
|
62
|
-
status: 'failed',
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
code: connect_1.Code.Internal,
|
|
67
|
-
rawMessage: 'error fetching addresses.',
|
|
68
|
-
message: 'error fetching addresses.',
|
|
69
|
-
status: 'failed',
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function getAddress(_a) {
|
|
75
|
-
return __awaiter(this, arguments, void 0, function* ({ body: { customerId, addressId, jwt }, headers, }) {
|
|
76
|
-
try {
|
|
77
|
-
const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
|
|
78
|
-
const addressClient = (0, connect_1.createClient)(service_pb_1.CustomerService, (0, connect_node_1.createGrpcTransport)({
|
|
79
|
-
baseUrl: checkoutConfig.enterpriseURL,
|
|
80
|
-
interceptors: [
|
|
81
|
-
(0, interceptors_1.createHeadersInterceptor)(headers),
|
|
82
|
-
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
83
|
-
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt),
|
|
84
|
-
],
|
|
85
|
-
acceptCompression: [brotli_1.brotliCompression],
|
|
86
|
-
sendCompression: brotli_1.brotliCompression,
|
|
87
|
-
}));
|
|
88
|
-
const value = yield addressClient.getAddress({
|
|
89
|
-
customerId,
|
|
90
|
-
addressId,
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
value,
|
|
94
|
-
status: 'success',
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
if (err instanceof connect_1.ConnectError) {
|
|
99
|
-
return {
|
|
100
|
-
code: err.code,
|
|
101
|
-
rawMessage: err.rawMessage,
|
|
102
|
-
message: err.rawMessage,
|
|
103
|
-
status: 'failed',
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
code: connect_1.Code.Internal,
|
|
108
|
-
rawMessage: 'error fetching address.',
|
|
109
|
-
message: 'error fetching address.',
|
|
110
|
-
status: 'failed',
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function addAddress(_a) {
|
|
116
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
var _b = _a.body, { jwt } = _b, val = __rest(_b, ["jwt"]), { headers } = _a;
|
|
118
|
-
try {
|
|
119
|
-
const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
|
|
120
|
-
const addressClient = (0, connect_1.createClient)(service_pb_1.CustomerService, (0, connect_node_1.createGrpcTransport)({
|
|
121
|
-
baseUrl: checkoutConfig.enterpriseURL,
|
|
122
|
-
interceptors: [
|
|
123
|
-
(0, interceptors_1.createHeadersInterceptor)(headers),
|
|
124
|
-
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
125
|
-
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt),
|
|
126
|
-
],
|
|
127
|
-
acceptCompression: [brotli_1.brotliCompression],
|
|
128
|
-
sendCompression: brotli_1.brotliCompression,
|
|
129
|
-
}));
|
|
130
|
-
const { address } = yield addressClient.addAddress(val);
|
|
131
|
-
return {
|
|
132
|
-
value: address,
|
|
133
|
-
status: 'success',
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
catch (err) {
|
|
137
|
-
if (err instanceof connect_1.ConnectError) {
|
|
138
|
-
return {
|
|
139
|
-
code: err.code,
|
|
140
|
-
rawMessage: err.rawMessage,
|
|
141
|
-
message: err.rawMessage,
|
|
142
|
-
status: 'failed',
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
code: connect_1.Code.Internal,
|
|
147
|
-
rawMessage: 'error adding address.',
|
|
148
|
-
message: 'error adding address.',
|
|
149
|
-
status: 'failed',
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function deleteAddress(_a) {
|
|
155
|
-
return __awaiter(this, arguments, void 0, function* ({ body: { customerId, addressId, jwt }, headers, }) {
|
|
156
|
-
try {
|
|
157
|
-
const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
|
|
158
|
-
const addressClient = (0, connect_1.createClient)(service_pb_1.CustomerService, (0, connect_node_1.createGrpcTransport)({
|
|
159
|
-
baseUrl: checkoutConfig.enterpriseURL,
|
|
160
|
-
interceptors: [
|
|
161
|
-
(0, interceptors_1.createHeadersInterceptor)(headers),
|
|
162
|
-
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
163
|
-
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt),
|
|
164
|
-
],
|
|
165
|
-
acceptCompression: [brotli_1.brotliCompression],
|
|
166
|
-
sendCompression: brotli_1.brotliCompression,
|
|
167
|
-
}));
|
|
168
|
-
const value = yield addressClient.deleteAddress({
|
|
169
|
-
customerId,
|
|
170
|
-
addressId,
|
|
171
|
-
});
|
|
172
|
-
return {
|
|
173
|
-
value,
|
|
174
|
-
status: 'success',
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
catch (err) {
|
|
178
|
-
if (err instanceof connect_1.ConnectError) {
|
|
179
|
-
return {
|
|
180
|
-
code: err.code,
|
|
181
|
-
rawMessage: err.rawMessage,
|
|
182
|
-
message: err.rawMessage,
|
|
183
|
-
status: 'failed',
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
code: connect_1.Code.Internal,
|
|
188
|
-
rawMessage: 'error deleting address.',
|
|
189
|
-
message: 'error deleting address.',
|
|
190
|
-
status: 'failed',
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function updateAddress(_a) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
var _b = _a.body, { jwt } = _b, val = __rest(_b, ["jwt"]), { headers } = _a;
|
|
198
|
-
try {
|
|
199
|
-
const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
|
|
200
|
-
const addressClient = (0, connect_1.createClient)(service_pb_1.CustomerService, (0, connect_node_1.createGrpcTransport)({
|
|
201
|
-
baseUrl: checkoutConfig.enterpriseURL,
|
|
202
|
-
interceptors: [
|
|
203
|
-
(0, interceptors_1.createHeadersInterceptor)(headers),
|
|
204
|
-
(0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
|
|
205
|
-
(0, interceptors_1.createCustomerAuthenticationInterceptor)(jwt),
|
|
206
|
-
],
|
|
207
|
-
acceptCompression: [brotli_1.brotliCompression],
|
|
208
|
-
sendCompression: brotli_1.brotliCompression,
|
|
209
|
-
}));
|
|
210
|
-
const { address } = yield addressClient.updateAddress(val);
|
|
211
|
-
return {
|
|
212
|
-
value: address,
|
|
213
|
-
status: 'success',
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
catch (err) {
|
|
217
|
-
if (err instanceof connect_1.ConnectError) {
|
|
218
|
-
return {
|
|
219
|
-
code: err.code,
|
|
220
|
-
rawMessage: err.rawMessage,
|
|
221
|
-
message: err.rawMessage,
|
|
222
|
-
status: 'failed',
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
return {
|
|
226
|
-
code: connect_1.Code.Internal,
|
|
227
|
-
rawMessage: 'error updating address.',
|
|
228
|
-
message: 'error updating address.',
|
|
229
|
-
status: 'failed',
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"address.spec.d.ts","sourceRoot":"","sources":["../../src/address.spec.ts"],"names":[],"mappings":""}
|