@paakd/api 0.0.3 → 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.
Files changed (124) hide show
  1. package/dist/gen/src/proto/files/v1/entities/file_pb.d.ts +199 -0
  2. package/dist/gen/src/proto/files/v1/entities/file_pb.d.ts.map +1 -0
  3. package/dist/gen/src/proto/files/v1/entities/file_pb.js +77 -0
  4. package/dist/gen/src/proto/files/v1/service_pb.d.ts +44 -0
  5. package/dist/gen/src/proto/files/v1/service_pb.d.ts.map +1 -0
  6. package/dist/gen/src/proto/files/v1/service_pb.js +18 -0
  7. package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.d.ts +391 -0
  8. package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.d.ts.map +1 -0
  9. package/dist/gen/src/proto/promotions/v1/entities/campaign_pb.js +140 -0
  10. package/dist/gen/src/proto/promotions/v1/service_pb.d.ts +68 -0
  11. package/dist/gen/src/proto/promotions/v1/service_pb.d.ts.map +1 -0
  12. package/dist/gen/src/proto/promotions/v1/service_pb.js +18 -0
  13. package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.d.ts +508 -0
  14. package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.d.ts.map +1 -0
  15. package/dist/gen/src/proto/stocknodes/v1/entities/stocknode_pb.js +150 -0
  16. package/dist/gen/src/proto/stocknodes/v1/service_pb.d.ts +68 -0
  17. package/dist/gen/src/proto/stocknodes/v1/service_pb.d.ts.map +1 -0
  18. package/dist/gen/src/proto/stocknodes/v1/service_pb.js +18 -0
  19. package/dist/src/index.d.ts +828 -5
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js +48 -5
  22. package/dist/src/interceptors.d.ts +1 -1
  23. package/dist/src/interceptors.d.ts.map +1 -1
  24. package/dist/src/interceptors.js +2 -2
  25. package/package.json +8 -10
  26. package/buf/validate/validate_pb.ts +0 -5001
  27. package/dist/src/address.d.ts +0 -53
  28. package/dist/src/address.d.ts.map +0 -1
  29. package/dist/src/address.js +0 -233
  30. package/dist/src/address.spec.d.ts +0 -2
  31. package/dist/src/address.spec.d.ts.map +0 -1
  32. package/dist/src/address.spec.js +0 -488
  33. package/dist/src/auth.d.ts +0 -27
  34. package/dist/src/auth.d.ts.map +0 -1
  35. package/dist/src/auth.js +0 -155
  36. package/dist/src/auth.spec.d.ts +0 -2
  37. package/dist/src/auth.spec.d.ts.map +0 -1
  38. package/dist/src/auth.spec.js +0 -582
  39. package/dist/src/compressor/brotli.d.ts +0 -3
  40. package/dist/src/compressor/brotli.d.ts.map +0 -1
  41. package/dist/src/compressor/brotli.js +0 -30
  42. package/dist/src/policies.d.ts +0 -217
  43. package/dist/src/policies.d.ts.map +0 -1
  44. package/dist/src/policies.js +0 -322
  45. package/dist/src/policies.spec.d.ts +0 -2
  46. package/dist/src/policies.spec.d.ts.map +0 -1
  47. package/dist/src/policies.spec.js +0 -463
  48. package/dist/src/products.d.ts +0 -39
  49. package/dist/src/products.d.ts.map +0 -1
  50. package/dist/src/products.js +0 -95
  51. package/dist/src/products.spec.d.ts +0 -2
  52. package/dist/src/products.spec.d.ts.map +0 -1
  53. package/dist/src/products.spec.js +0 -519
  54. package/dist/src/profile.d.ts +0 -62
  55. package/dist/src/profile.d.ts.map +0 -1
  56. package/dist/src/profile.js +0 -151
  57. package/dist/src/profile.spec.d.ts +0 -2
  58. package/dist/src/profile.spec.d.ts.map +0 -1
  59. package/dist/src/profile.spec.js +0 -475
  60. package/dist/src/registration.d.ts +0 -60
  61. package/dist/src/registration.d.ts.map +0 -1
  62. package/dist/src/registration.js +0 -147
  63. package/dist/src/test-utils.d.ts +0 -87
  64. package/dist/src/test-utils.d.ts.map +0 -1
  65. package/dist/src/test-utils.js +0 -132
  66. package/gen/buf/validate/validate_pb.ts +0 -4799
  67. package/gen/src/proto/auth/v1/authv1connect/service.connect.go +0 -454
  68. package/gen/src/proto/auth/v1/entities/auth.pb.go +0 -818
  69. package/gen/src/proto/auth/v1/entities/auth_pb.ts +0 -348
  70. package/gen/src/proto/auth/v1/entities/policy.pb.go +0 -727
  71. package/gen/src/proto/auth/v1/entities/policy_pb.ts +0 -306
  72. package/gen/src/proto/auth/v1/service-AuthService_connectquery.ts +0 -70
  73. package/gen/src/proto/auth/v1/service.pb.go +0 -119
  74. package/gen/src/proto/auth/v1/service_pb.ts +0 -152
  75. package/gen/src/proto/customers/v1/customersv1connect/service.connect.go +0 -358
  76. package/gen/src/proto/customers/v1/entities/address.pb.go +0 -1073
  77. package/gen/src/proto/customers/v1/entities/address_pb.ts +0 -478
  78. package/gen/src/proto/customers/v1/entities/profile.pb.go +0 -633
  79. package/gen/src/proto/customers/v1/entities/profile_pb.ts +0 -252
  80. package/gen/src/proto/customers/v1/service-CustomerService_connectquery.ts +0 -50
  81. package/gen/src/proto/customers/v1/service.pb.go +0 -110
  82. package/gen/src/proto/customers/v1/service_pb.ts +0 -121
  83. package/gen/src/proto/files/v1/entities/file.pb.go +0 -669
  84. package/gen/src/proto/files/v1/entities/file_pb.ts +0 -265
  85. package/gen/src/proto/files/v1/filesv1connect/service.connect.go +0 -200
  86. package/gen/src/proto/files/v1/service-FileService_connectquery.ts +0 -25
  87. package/gen/src/proto/files/v1/service.pb.go +0 -85
  88. package/gen/src/proto/files/v1/service_pb.ts +0 -65
  89. package/gen/src/proto/products/v1/entities/category.pb.go +0 -744
  90. package/gen/src/proto/products/v1/entities/category_pb.ts +0 -318
  91. package/gen/src/proto/products/v1/entities/collection.pb.go +0 -528
  92. package/gen/src/proto/products/v1/entities/collection_pb.ts +0 -214
  93. package/gen/src/proto/products/v1/entities/product/create.pb.go +0 -453
  94. package/gen/src/proto/products/v1/entities/product/create_pb.ts +0 -199
  95. package/gen/src/proto/products/v1/entities/product/option.pb.go +0 -206
  96. package/gen/src/proto/products/v1/entities/product/option_pb.ts +0 -74
  97. package/gen/src/proto/products/v1/entities/product/shared.pb.go +0 -2890
  98. package/gen/src/proto/products/v1/entities/product/shared_pb.ts +0 -1317
  99. package/gen/src/proto/products/v1/entities/product/update.pb.go +0 -794
  100. package/gen/src/proto/products/v1/entities/product/update_pb.ts +0 -325
  101. package/gen/src/proto/products/v1/entities/tag.pb.go +0 -610
  102. package/gen/src/proto/products/v1/entities/tag_pb.ts +0 -233
  103. package/gen/src/proto/products/v1/entities/taxonomy.pb.go +0 -1352
  104. package/gen/src/proto/products/v1/entities/taxonomy_pb.ts +0 -606
  105. package/gen/src/proto/products/v1/entities/type.pb.go +0 -553
  106. package/gen/src/proto/products/v1/entities/type_pb.ts +0 -215
  107. package/gen/src/proto/products/v1/entities/variant.pb.go +0 -1474
  108. package/gen/src/proto/products/v1/entities/variant_pb.ts +0 -629
  109. package/gen/src/proto/products/v1/productsv1connect/service.connect.go +0 -1195
  110. package/gen/src/proto/products/v1/service-ProductsService_connectquery.ts +0 -199
  111. package/gen/src/proto/products/v1/service.pb.go +0 -250
  112. package/gen/src/proto/products/v1/service_pb.ts +0 -429
  113. package/gen/src/proto/promotions/v1/entities/campaign.pb.go +0 -1229
  114. package/gen/src/proto/promotions/v1/entities/campaign_pb.ts +0 -511
  115. package/gen/src/proto/promotions/v1/promotionsv1connect/service.connect.go +0 -289
  116. package/gen/src/proto/promotions/v1/service-CampaignService_connectquery.ts +0 -42
  117. package/gen/src/proto/promotions/v1/service.pb.go +0 -98
  118. package/gen/src/proto/promotions/v1/service_pb.ts +0 -95
  119. package/gen/src/proto/stocknodes/v1/entities/stocknode.pb.go +0 -1499
  120. package/gen/src/proto/stocknodes/v1/entities/stocknode_pb.ts +0 -655
  121. package/gen/src/proto/stocknodes/v1/service-StockNodesService_connectquery.ts +0 -41
  122. package/gen/src/proto/stocknodes/v1/service.pb.go +0 -98
  123. package/gen/src/proto/stocknodes/v1/service_pb.ts +0 -95
  124. package/gen/src/proto/stocknodes/v1/stocknodesv1connect/service.connect.go +0 -297
@@ -1,217 +0,0 @@
1
- import { Code, ConnectError } from '@connectrpc/connect';
2
- interface SavePoliciesProps {
3
- body: {
4
- inPolicies: string[][];
5
- };
6
- headers: Record<string, string | null>;
7
- }
8
- interface AddPolicyProps {
9
- body: {
10
- rule: string[];
11
- pType: string;
12
- };
13
- headers: Record<string, string | null>;
14
- }
15
- interface AddPoliciesProps {
16
- body: {
17
- inRules: string[][];
18
- pType: string;
19
- };
20
- headers: Record<string, string | null>;
21
- }
22
- interface RemovePolicyProps {
23
- body: {
24
- rule: string[];
25
- pType: string;
26
- };
27
- headers: Record<string, string | null>;
28
- }
29
- interface RemovePoliciesProps {
30
- body: {
31
- inRules: string[][];
32
- pType: string;
33
- };
34
- headers: Record<string, string | null>;
35
- }
36
- interface RemoveFilteredPolicyProps {
37
- body: {
38
- pType: string;
39
- fieldIndex: number;
40
- fieldValues: string[];
41
- };
42
- headers: Record<string, string | null>;
43
- }
44
- interface GetFilteredPolicyProps {
45
- body: {
46
- inFilter: Record<string, string[][]>;
47
- };
48
- headers: Record<string, string | null>;
49
- }
50
- export declare function getPolicies({ headers, }: {
51
- headers: Record<string, string | null>;
52
- }): Promise<ConnectError | {
53
- value: import("../gen/src/proto/auth/v1/entities/policy_pb").Policy[];
54
- status: string;
55
- } | {
56
- message: string;
57
- status: string;
58
- code: Code;
59
- metadata: Headers;
60
- details: ({
61
- desc: import("@bufbuild/protobuf").DescMessage;
62
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
63
- } | {
64
- type: string;
65
- value: Uint8Array;
66
- debug?: import("@bufbuild/protobuf").JsonValue;
67
- })[];
68
- rawMessage: string;
69
- name: string;
70
- cause: unknown;
71
- stack?: string;
72
- value?: undefined;
73
- }>;
74
- export declare function savePolicies({ body: { inPolicies }, headers, }: SavePoliciesProps): Promise<ConnectError | {
75
- status: string;
76
- } | {
77
- message: string;
78
- status: string;
79
- code: Code;
80
- metadata: Headers;
81
- details: ({
82
- desc: import("@bufbuild/protobuf").DescMessage;
83
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
84
- } | {
85
- type: string;
86
- value: Uint8Array;
87
- debug?: import("@bufbuild/protobuf").JsonValue;
88
- })[];
89
- rawMessage: string;
90
- name: string;
91
- cause: unknown;
92
- stack?: string;
93
- }>;
94
- export declare function addPolicy({ body: { rule, pType }, headers, }: AddPolicyProps): Promise<ConnectError | {
95
- status: string;
96
- } | {
97
- message: string;
98
- status: string;
99
- code: Code;
100
- metadata: Headers;
101
- details: ({
102
- desc: import("@bufbuild/protobuf").DescMessage;
103
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
104
- } | {
105
- type: string;
106
- value: Uint8Array;
107
- debug?: import("@bufbuild/protobuf").JsonValue;
108
- })[];
109
- rawMessage: string;
110
- name: string;
111
- cause: unknown;
112
- stack?: string;
113
- }>;
114
- export declare function addPolicies({ body: { inRules, pType }, headers, }: AddPoliciesProps): Promise<ConnectError | {
115
- status: string;
116
- } | {
117
- message: string;
118
- status: string;
119
- code: Code;
120
- metadata: Headers;
121
- details: ({
122
- desc: import("@bufbuild/protobuf").DescMessage;
123
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
124
- } | {
125
- type: string;
126
- value: Uint8Array;
127
- debug?: import("@bufbuild/protobuf").JsonValue;
128
- })[];
129
- rawMessage: string;
130
- name: string;
131
- cause: unknown;
132
- stack?: string;
133
- }>;
134
- export declare function removePolicy({ body: { rule, pType }, headers, }: RemovePolicyProps): Promise<ConnectError | {
135
- status: string;
136
- } | {
137
- message: string;
138
- status: string;
139
- code: Code;
140
- metadata: Headers;
141
- details: ({
142
- desc: import("@bufbuild/protobuf").DescMessage;
143
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
144
- } | {
145
- type: string;
146
- value: Uint8Array;
147
- debug?: import("@bufbuild/protobuf").JsonValue;
148
- })[];
149
- rawMessage: string;
150
- name: string;
151
- cause: unknown;
152
- stack?: string;
153
- }>;
154
- export declare function removePolicies({ body: { inRules, pType }, headers, }: RemovePoliciesProps): Promise<ConnectError | {
155
- status: string;
156
- } | {
157
- message: string;
158
- status: string;
159
- code: Code;
160
- metadata: Headers;
161
- details: ({
162
- desc: import("@bufbuild/protobuf").DescMessage;
163
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
164
- } | {
165
- type: string;
166
- value: Uint8Array;
167
- debug?: import("@bufbuild/protobuf").JsonValue;
168
- })[];
169
- rawMessage: string;
170
- name: string;
171
- cause: unknown;
172
- stack?: string;
173
- }>;
174
- export declare function removeFilteredPolicy({ body: { pType, fieldIndex, fieldValues }, headers, }: RemoveFilteredPolicyProps): Promise<ConnectError | {
175
- status: string;
176
- } | {
177
- message: string;
178
- status: string;
179
- code: Code;
180
- metadata: Headers;
181
- details: ({
182
- desc: import("@bufbuild/protobuf").DescMessage;
183
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
184
- } | {
185
- type: string;
186
- value: Uint8Array;
187
- debug?: import("@bufbuild/protobuf").JsonValue;
188
- })[];
189
- rawMessage: string;
190
- name: string;
191
- cause: unknown;
192
- stack?: string;
193
- }>;
194
- export declare function getFilteredPolicy({ body: { inFilter }, headers, }: GetFilteredPolicyProps): Promise<ConnectError | {
195
- value: import("../gen/src/proto/auth/v1/entities/policy_pb").Policy[];
196
- status: string;
197
- } | {
198
- message: string;
199
- status: string;
200
- code: Code;
201
- metadata: Headers;
202
- details: ({
203
- desc: import("@bufbuild/protobuf").DescMessage;
204
- value: import("@bufbuild/protobuf").MessageInitShape<import("@bufbuild/protobuf").DescMessage>;
205
- } | {
206
- type: string;
207
- value: Uint8Array;
208
- debug?: import("@bufbuild/protobuf").JsonValue;
209
- })[];
210
- rawMessage: string;
211
- name: string;
212
- cause: unknown;
213
- stack?: string;
214
- value?: undefined;
215
- }>;
216
- export {};
217
- //# sourceMappingURL=policies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.d.ts","sour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,IAAI,EAAE,EAAE,QAAQ,EAAE,EAClB,OAAO,GACR,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;GA+CxB"}
@@ -1,322 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getPolicies = getPolicies;
13
- exports.savePolicies = savePolicies;
14
- exports.addPolicy = addPolicy;
15
- exports.addPolicies = addPolicies;
16
- exports.removePolicy = removePolicy;
17
- exports.removePolicies = removePolicies;
18
- exports.removeFilteredPolicy = removeFilteredPolicy;
19
- exports.getFilteredPolicy = getFilteredPolicy;
20
- const connect_1 = require("@connectrpc/connect");
21
- const connect_node_1 = require("@connectrpc/connect-node");
22
- const config_1 = require("@paakd/config");
23
- const service_pb_1 = require("../gen/src/proto/auth/v1/service_pb");
24
- const brotli_1 = require("./compressor/brotli");
25
- const interceptors_1 = require("./interceptors");
26
- function getPolicies(_a) {
27
- return __awaiter(this, arguments, void 0, function* ({ headers, }) {
28
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
29
- const transport = (0, connect_node_1.createGrpcTransport)({
30
- baseUrl: checkoutConfig.enterpriseURL,
31
- interceptors: [
32
- (0, interceptors_1.createHeadersInterceptor)(headers),
33
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
34
- ],
35
- acceptCompression: [brotli_1.brotliCompression],
36
- sendCompression: brotli_1.brotliCompression,
37
- });
38
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
39
- try {
40
- const value = yield auth.getPolicies({});
41
- return {
42
- value: value.policies,
43
- status: 'success',
44
- };
45
- }
46
- catch (err) {
47
- if (err instanceof connect_1.ConnectError) {
48
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
49
- }
50
- return {
51
- code: connect_1.Code.Internal,
52
- rawMessage: 'An unexpected error occurred during login.',
53
- message: 'An unexpected error occurred during login.',
54
- status: 'failed',
55
- };
56
- }
57
- });
58
- }
59
- function savePolicies(_a) {
60
- return __awaiter(this, arguments, void 0, function* ({ body: { inPolicies }, headers, }) {
61
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
62
- const transport = (0, connect_node_1.createGrpcTransport)({
63
- baseUrl: checkoutConfig.enterpriseURL,
64
- interceptors: [
65
- (0, interceptors_1.createHeadersInterceptor)(headers),
66
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
67
- ],
68
- acceptCompression: [brotli_1.brotliCompression],
69
- sendCompression: brotli_1.brotliCompression,
70
- });
71
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
72
- const policies = inPolicies.map(policy => ({
73
- pType: policy[0],
74
- v0: policy[1],
75
- v1: policy.length > 2 ? policy[2] : '',
76
- v2: policy.length > 3 ? policy[3] : '',
77
- v3: policy.length > 4 ? policy[4] : '',
78
- v4: policy.length > 5 ? policy[5] : '',
79
- v5: policy.length > 6 ? policy[6] : '',
80
- }));
81
- try {
82
- yield auth.savePolicies({
83
- policies,
84
- });
85
- return {
86
- status: 'success',
87
- };
88
- }
89
- catch (err) {
90
- if (err instanceof connect_1.ConnectError) {
91
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
92
- }
93
- return {
94
- code: connect_1.Code.Internal,
95
- rawMessage: 'An unexpected error occurred while adding a policy.',
96
- message: 'An unexpected error occurred while adding a policy.',
97
- status: 'failed',
98
- };
99
- }
100
- });
101
- }
102
- function addPolicy(_a) {
103
- return __awaiter(this, arguments, void 0, function* ({ body: { rule, pType }, headers, }) {
104
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
105
- const transport = (0, connect_node_1.createGrpcTransport)({
106
- baseUrl: checkoutConfig.enterpriseURL,
107
- interceptors: [
108
- (0, interceptors_1.createHeadersInterceptor)(headers),
109
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
110
- ],
111
- acceptCompression: [brotli_1.brotliCompression],
112
- sendCompression: brotli_1.brotliCompression,
113
- });
114
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
115
- try {
116
- yield auth.addPolicy({
117
- rule,
118
- pType,
119
- });
120
- return {
121
- status: 'success',
122
- };
123
- }
124
- catch (err) {
125
- if (err instanceof connect_1.ConnectError) {
126
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
127
- }
128
- return {
129
- code: connect_1.Code.Internal,
130
- rawMessage: 'An unexpected error occurred while adding a policy.',
131
- message: 'An unexpected error occurred while adding a policy.',
132
- status: 'failed',
133
- };
134
- }
135
- });
136
- }
137
- function addPolicies(_a) {
138
- return __awaiter(this, arguments, void 0, function* ({ body: { inRules, pType }, headers, }) {
139
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
140
- const transport = (0, connect_node_1.createGrpcTransport)({
141
- baseUrl: checkoutConfig.enterpriseURL,
142
- interceptors: [
143
- (0, interceptors_1.createHeadersInterceptor)(headers),
144
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
145
- ],
146
- acceptCompression: [brotli_1.brotliCompression],
147
- sendCompression: brotli_1.brotliCompression,
148
- });
149
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
150
- const rules = inRules.map(rules => ({ rules }));
151
- try {
152
- yield auth.addPolicies({
153
- rules,
154
- pType,
155
- });
156
- return {
157
- status: 'success',
158
- };
159
- }
160
- catch (err) {
161
- if (err instanceof connect_1.ConnectError) {
162
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
163
- }
164
- return {
165
- code: connect_1.Code.Internal,
166
- rawMessage: 'An unexpected error occurred while adding policies.',
167
- message: 'An unexpected error occurred while adding policies.',
168
- status: 'failed',
169
- };
170
- }
171
- });
172
- }
173
- function removePolicy(_a) {
174
- return __awaiter(this, arguments, void 0, function* ({ body: { rule, pType }, headers, }) {
175
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
176
- const transport = (0, connect_node_1.createGrpcTransport)({
177
- baseUrl: checkoutConfig.enterpriseURL,
178
- interceptors: [
179
- (0, interceptors_1.createHeadersInterceptor)(headers),
180
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
181
- ],
182
- acceptCompression: [brotli_1.brotliCompression],
183
- sendCompression: brotli_1.brotliCompression,
184
- });
185
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
186
- try {
187
- yield auth.removePolicy({
188
- rule,
189
- pType,
190
- });
191
- return {
192
- status: 'success',
193
- };
194
- }
195
- catch (err) {
196
- if (err instanceof connect_1.ConnectError) {
197
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
198
- }
199
- return {
200
- code: connect_1.Code.Internal,
201
- rawMessage: 'An unexpected error occurred while removing a policy.',
202
- message: 'An unexpected error occurred while removing a policy.',
203
- status: 'failed',
204
- };
205
- }
206
- });
207
- }
208
- function removePolicies(_a) {
209
- return __awaiter(this, arguments, void 0, function* ({ body: { inRules, pType }, headers, }) {
210
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
211
- const transport = (0, connect_node_1.createGrpcTransport)({
212
- baseUrl: checkoutConfig.enterpriseURL,
213
- interceptors: [
214
- (0, interceptors_1.createHeadersInterceptor)(headers),
215
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
216
- ],
217
- acceptCompression: [brotli_1.brotliCompression],
218
- sendCompression: brotli_1.brotliCompression,
219
- });
220
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
221
- const rules = inRules.map(rules => ({ rules }));
222
- try {
223
- yield auth.removePolicies({
224
- rules,
225
- pType,
226
- });
227
- return {
228
- status: 'success',
229
- };
230
- }
231
- catch (err) {
232
- if (err instanceof connect_1.ConnectError) {
233
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
234
- }
235
- return {
236
- code: connect_1.Code.Internal,
237
- rawMessage: 'An unexpected error occurred while removing policies.',
238
- message: 'An unexpected error occurred while removing policies.',
239
- status: 'failed',
240
- };
241
- }
242
- });
243
- }
244
- function removeFilteredPolicy(_a) {
245
- return __awaiter(this, arguments, void 0, function* ({ body: { pType, fieldIndex, fieldValues }, headers, }) {
246
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
247
- const transport = (0, connect_node_1.createGrpcTransport)({
248
- baseUrl: checkoutConfig.enterpriseURL,
249
- interceptors: [
250
- (0, interceptors_1.createHeadersInterceptor)(headers),
251
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
252
- ],
253
- acceptCompression: [brotli_1.brotliCompression],
254
- sendCompression: brotli_1.brotliCompression,
255
- });
256
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
257
- try {
258
- yield auth.removeFilteredPolicy({
259
- pType,
260
- fieldIndex,
261
- fieldValues,
262
- });
263
- return {
264
- status: 'success',
265
- };
266
- }
267
- catch (err) {
268
- if (err instanceof connect_1.ConnectError) {
269
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
270
- }
271
- return {
272
- code: connect_1.Code.Internal,
273
- rawMessage: 'An unexpected error occurred while removing policies.',
274
- message: 'An unexpected error occurred while removing policies.',
275
- status: 'failed',
276
- };
277
- }
278
- });
279
- }
280
- function getFilteredPolicy(_a) {
281
- return __awaiter(this, arguments, void 0, function* ({ body: { inFilter }, headers, }) {
282
- const checkoutConfig = yield (0, config_1.getCheckoutConfig)();
283
- const transport = (0, connect_node_1.createGrpcTransport)({
284
- baseUrl: checkoutConfig.enterpriseURL,
285
- interceptors: [
286
- (0, interceptors_1.createHeadersInterceptor)(headers),
287
- (0, interceptors_1.createAuthenticationInterceptor)(checkoutConfig),
288
- ],
289
- acceptCompression: [brotli_1.brotliCompression],
290
- sendCompression: brotli_1.brotliCompression,
291
- });
292
- const auth = (0, connect_1.createClient)(service_pb_1.AuthService, transport);
293
- const filters = [];
294
- for (const [key, values] of Object.entries(inFilter)) {
295
- const v = values.map(v => ({ items: v }));
296
- filters.push({
297
- key,
298
- values: v,
299
- });
300
- }
301
- try {
302
- const value = yield auth.getFilteredPolicy({
303
- filter: filters,
304
- });
305
- return {
306
- value: value.policies,
307
- status: 'success',
308
- };
309
- }
310
- catch (err) {
311
- if (err instanceof connect_1.ConnectError) {
312
- return Object.assign(Object.assign({}, err), { message: err.rawMessage, status: 'failed' });
313
- }
314
- return {
315
- code: connect_1.Code.Internal,
316
- rawMessage: 'An unexpected error occurred while fetching policies.',
317
- message: 'An unexpected error occurred while fetching policies.',
318
- status: 'failed',
319
- };
320
- }
321
- });
322
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=policies.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.spec.d.ts","sourceRoot":"","sources":["../../src/policies.spec.ts"],"names":[],"mappings":""}