@paakd/api 0.0.1 → 0.0.2

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 (201) hide show
  1. package/buf/validate/validate_pb.ts +5001 -0
  2. package/dist/gen/buf/validate/validate_pb.d.ts +4634 -0
  3. package/dist/gen/buf/validate/validate_pb.d.ts.map +1 -0
  4. package/dist/gen/buf/validate/validate_pb.js +414 -0
  5. package/dist/gen/src/proto/auth/v1/entities/auth_pb.d.ts +268 -0
  6. package/dist/gen/src/proto/auth/v1/entities/auth_pb.d.ts.map +1 -0
  7. package/dist/gen/src/proto/auth/v1/entities/auth_pb.js +120 -0
  8. package/dist/gen/src/proto/auth/v1/entities/policy_pb.d.ts +235 -0
  9. package/dist/gen/src/proto/auth/v1/entities/policy_pb.d.ts.map +1 -0
  10. package/dist/gen/src/proto/auth/v1/entities/policy_pb.js +98 -0
  11. package/dist/gen/src/proto/auth/v1/service_pb.d.ts +117 -0
  12. package/dist/gen/src/proto/auth/v1/service_pb.d.ts.map +1 -0
  13. package/dist/gen/src/proto/auth/v1/service_pb.js +22 -0
  14. package/dist/gen/src/proto/customers/v1/entities/address_pb.d.ts +371 -0
  15. package/dist/gen/src/proto/customers/v1/entities/address_pb.d.ts.map +1 -0
  16. package/dist/gen/src/proto/customers/v1/entities/address_pb.js +84 -0
  17. package/dist/gen/src/proto/customers/v1/entities/profile_pb.d.ts +189 -0
  18. package/dist/gen/src/proto/customers/v1/entities/profile_pb.d.ts.map +1 -0
  19. package/dist/gen/src/proto/customers/v1/entities/profile_pb.js +70 -0
  20. package/dist/gen/src/proto/customers/v1/service_pb.d.ts +85 -0
  21. package/dist/gen/src/proto/customers/v1/service_pb.d.ts.map +1 -0
  22. package/dist/gen/src/proto/customers/v1/service_pb.js +22 -0
  23. package/dist/gen/src/proto/products/v1/entities/category_pb.d.ts +234 -0
  24. package/dist/gen/src/proto/products/v1/entities/category_pb.d.ts.map +1 -0
  25. package/dist/gen/src/proto/products/v1/entities/category_pb.js +84 -0
  26. package/dist/gen/src/proto/products/v1/entities/collection_pb.d.ts +159 -0
  27. package/dist/gen/src/proto/products/v1/entities/collection_pb.d.ts.map +1 -0
  28. package/dist/gen/src/proto/products/v1/entities/collection_pb.js +70 -0
  29. package/dist/gen/src/proto/products/v1/entities/product/create_pb.d.ts +146 -0
  30. package/dist/gen/src/proto/products/v1/entities/product/create_pb.d.ts.map +1 -0
  31. package/dist/gen/src/proto/products/v1/entities/product/create_pb.js +32 -0
  32. package/dist/gen/src/proto/products/v1/entities/product/option_pb.d.ts +50 -0
  33. package/dist/gen/src/proto/products/v1/entities/product/option_pb.d.ts.map +1 -0
  34. package/dist/gen/src/proto/products/v1/entities/product/option_pb.js +32 -0
  35. package/dist/gen/src/proto/products/v1/entities/product/shared_pb.d.ts +1042 -0
  36. package/dist/gen/src/proto/products/v1/entities/product/shared_pb.d.ts.map +1 -0
  37. package/dist/gen/src/proto/products/v1/entities/product/shared_pb.js +258 -0
  38. package/dist/gen/src/proto/products/v1/entities/product/update_pb.d.ts +236 -0
  39. package/dist/gen/src/proto/products/v1/entities/product/update_pb.d.ts.map +1 -0
  40. package/dist/gen/src/proto/products/v1/entities/product/update_pb.js +88 -0
  41. package/dist/gen/src/proto/products/v1/entities/tag_pb.d.ts +175 -0
  42. package/dist/gen/src/proto/products/v1/entities/tag_pb.d.ts.map +1 -0
  43. package/dist/gen/src/proto/products/v1/entities/tag_pb.js +84 -0
  44. package/dist/gen/src/proto/products/v1/entities/taxonomy_pb.d.ts +477 -0
  45. package/dist/gen/src/proto/products/v1/entities/taxonomy_pb.d.ts.map +1 -0
  46. package/dist/gen/src/proto/products/v1/entities/taxonomy_pb.js +235 -0
  47. package/dist/gen/src/proto/products/v1/entities/type_pb.d.ts +158 -0
  48. package/dist/gen/src/proto/products/v1/entities/type_pb.d.ts.map +1 -0
  49. package/dist/gen/src/proto/products/v1/entities/type_pb.js +70 -0
  50. package/dist/gen/src/proto/products/v1/entities/variant_pb.d.ts +489 -0
  51. package/dist/gen/src/proto/products/v1/entities/variant_pb.d.ts.map +1 -0
  52. package/dist/gen/src/proto/products/v1/entities/variant_pb.js +147 -0
  53. package/dist/gen/src/proto/products/v1/service_pb.d.ts +316 -0
  54. package/dist/gen/src/proto/products/v1/service_pb.d.ts.map +1 -0
  55. package/dist/gen/src/proto/products/v1/service_pb.js +36 -0
  56. package/dist/src/address.d.ts +53 -0
  57. package/dist/src/address.d.ts.map +1 -0
  58. package/dist/src/address.js +233 -0
  59. package/dist/src/address.spec.d.ts +2 -0
  60. package/dist/src/address.spec.d.ts.map +1 -0
  61. package/dist/src/address.spec.js +488 -0
  62. package/dist/src/auth.d.ts +27 -0
  63. package/dist/src/auth.d.ts.map +1 -0
  64. package/dist/src/auth.js +155 -0
  65. package/dist/src/auth.spec.d.ts +2 -0
  66. package/dist/src/auth.spec.d.ts.map +1 -0
  67. package/dist/src/auth.spec.js +582 -0
  68. package/dist/src/compressor/brotli.d.ts +3 -0
  69. package/dist/src/compressor/brotli.d.ts.map +1 -0
  70. package/dist/src/compressor/brotli.js +30 -0
  71. package/dist/src/index.d.ts +6 -0
  72. package/dist/src/index.d.ts.map +1 -0
  73. package/dist/src/interceptors.d.ts +16 -0
  74. package/dist/src/interceptors.d.ts.map +1 -0
  75. package/dist/src/interceptors.js +156 -0
  76. package/dist/src/interceptors.spec.d.ts +2 -0
  77. package/dist/src/interceptors.spec.d.ts.map +1 -0
  78. package/dist/src/interceptors.spec.js +1063 -0
  79. package/dist/src/policies.d.ts +217 -0
  80. package/dist/src/policies.d.ts.map +1 -0
  81. package/dist/src/policies.js +322 -0
  82. package/dist/src/policies.spec.d.ts +2 -0
  83. package/dist/src/policies.spec.d.ts.map +1 -0
  84. package/dist/src/policies.spec.js +463 -0
  85. package/dist/src/products.d.ts +39 -0
  86. package/dist/src/products.d.ts.map +1 -0
  87. package/dist/src/products.js +95 -0
  88. package/dist/src/products.spec.d.ts +2 -0
  89. package/dist/src/products.spec.d.ts.map +1 -0
  90. package/dist/src/products.spec.js +519 -0
  91. package/dist/src/profile.d.ts +62 -0
  92. package/dist/src/profile.d.ts.map +1 -0
  93. package/dist/src/profile.js +151 -0
  94. package/dist/src/profile.spec.d.ts +2 -0
  95. package/dist/src/profile.spec.d.ts.map +1 -0
  96. package/dist/src/profile.spec.js +475 -0
  97. package/dist/src/registration.d.ts +60 -0
  98. package/dist/src/registration.d.ts.map +1 -0
  99. package/dist/src/registration.js +147 -0
  100. package/dist/src/test-utils.d.ts +87 -0
  101. package/dist/src/test-utils.d.ts.map +1 -0
  102. package/dist/src/test-utils.js +132 -0
  103. package/gen/buf/validate/validate_pb.ts +4799 -0
  104. package/gen/src/proto/auth/v1/authv1connect/service.connect.go +454 -0
  105. package/gen/src/proto/auth/v1/entities/auth.pb.go +818 -0
  106. package/gen/src/proto/auth/v1/entities/auth_pb.ts +348 -0
  107. package/gen/src/proto/auth/v1/entities/policy.pb.go +727 -0
  108. package/gen/src/proto/auth/v1/entities/policy_pb.ts +306 -0
  109. package/gen/src/proto/auth/v1/service-AuthService_connectquery.ts +70 -0
  110. package/gen/src/proto/auth/v1/service.pb.go +119 -0
  111. package/gen/src/proto/auth/v1/service_pb.ts +152 -0
  112. package/gen/src/proto/customers/v1/customersv1connect/service.connect.go +358 -0
  113. package/gen/src/proto/customers/v1/entities/address.pb.go +1073 -0
  114. package/gen/src/proto/customers/v1/entities/address_pb.ts +478 -0
  115. package/gen/src/proto/customers/v1/entities/profile.pb.go +633 -0
  116. package/gen/src/proto/customers/v1/entities/profile_pb.ts +252 -0
  117. package/gen/src/proto/customers/v1/service-CustomerService_connectquery.ts +50 -0
  118. package/gen/src/proto/customers/v1/service.pb.go +110 -0
  119. package/gen/src/proto/customers/v1/service_pb.ts +121 -0
  120. package/gen/src/proto/files/v1/entities/file.pb.go +669 -0
  121. package/gen/src/proto/files/v1/entities/file_pb.ts +265 -0
  122. package/gen/src/proto/files/v1/filesv1connect/service.connect.go +200 -0
  123. package/gen/src/proto/files/v1/service-FileService_connectquery.ts +25 -0
  124. package/gen/src/proto/files/v1/service.pb.go +85 -0
  125. package/gen/src/proto/files/v1/service_pb.ts +65 -0
  126. package/gen/src/proto/products/v1/entities/category.pb.go +744 -0
  127. package/gen/src/proto/products/v1/entities/category_pb.ts +318 -0
  128. package/gen/src/proto/products/v1/entities/collection.pb.go +528 -0
  129. package/gen/src/proto/products/v1/entities/collection_pb.ts +214 -0
  130. package/gen/src/proto/products/v1/entities/product/create.pb.go +453 -0
  131. package/gen/src/proto/products/v1/entities/product/create_pb.ts +199 -0
  132. package/gen/src/proto/products/v1/entities/product/option.pb.go +206 -0
  133. package/gen/src/proto/products/v1/entities/product/option_pb.ts +74 -0
  134. package/gen/src/proto/products/v1/entities/product/shared.pb.go +2890 -0
  135. package/gen/src/proto/products/v1/entities/product/shared_pb.ts +1317 -0
  136. package/gen/src/proto/products/v1/entities/product/update.pb.go +794 -0
  137. package/gen/src/proto/products/v1/entities/product/update_pb.ts +325 -0
  138. package/gen/src/proto/products/v1/entities/tag.pb.go +610 -0
  139. package/gen/src/proto/products/v1/entities/tag_pb.ts +233 -0
  140. package/gen/src/proto/products/v1/entities/taxonomy.pb.go +1352 -0
  141. package/gen/src/proto/products/v1/entities/taxonomy_pb.ts +606 -0
  142. package/gen/src/proto/products/v1/entities/type.pb.go +553 -0
  143. package/gen/src/proto/products/v1/entities/type_pb.ts +215 -0
  144. package/gen/src/proto/products/v1/entities/variant.pb.go +1474 -0
  145. package/gen/src/proto/products/v1/entities/variant_pb.ts +629 -0
  146. package/gen/src/proto/products/v1/productsv1connect/service.connect.go +1195 -0
  147. package/gen/src/proto/products/v1/service-ProductsService_connectquery.ts +199 -0
  148. package/gen/src/proto/products/v1/service.pb.go +250 -0
  149. package/gen/src/proto/products/v1/service_pb.ts +429 -0
  150. package/gen/src/proto/promotions/v1/entities/campaign.pb.go +1229 -0
  151. package/gen/src/proto/promotions/v1/entities/campaign_pb.ts +511 -0
  152. package/gen/src/proto/promotions/v1/promotionsv1connect/service.connect.go +289 -0
  153. package/gen/src/proto/promotions/v1/service-CampaignService_connectquery.ts +42 -0
  154. package/gen/src/proto/promotions/v1/service.pb.go +98 -0
  155. package/gen/src/proto/promotions/v1/service_pb.ts +95 -0
  156. package/gen/src/proto/stocknodes/v1/entities/stocknode.pb.go +1499 -0
  157. package/gen/src/proto/stocknodes/v1/entities/stocknode_pb.ts +655 -0
  158. package/gen/src/proto/stocknodes/v1/service-StockNodesService_connectquery.ts +41 -0
  159. package/gen/src/proto/stocknodes/v1/service.pb.go +98 -0
  160. package/gen/src/proto/stocknodes/v1/service_pb.ts +95 -0
  161. package/gen/src/proto/stocknodes/v1/stocknodesv1connect/service.connect.go +297 -0
  162. package/package.json +5 -2
  163. package/src/address.spec.ts +0 -662
  164. package/src/address.ts +0 -300
  165. package/src/auth.spec.ts +0 -771
  166. package/src/auth.ts +0 -168
  167. package/src/compressor/brotli.ts +0 -26
  168. package/src/index.ts +0 -5
  169. package/src/interceptors.spec.ts +0 -1343
  170. package/src/interceptors.ts +0 -224
  171. package/src/policies.spec.ts +0 -595
  172. package/src/policies.ts +0 -431
  173. package/src/products.spec.ts +0 -710
  174. package/src/products.ts +0 -112
  175. package/src/profile.spec.ts +0 -626
  176. package/src/profile.ts +0 -169
  177. package/src/proto/auth/v1/entities/auth.proto +0 -140
  178. package/src/proto/auth/v1/entities/policy.proto +0 -57
  179. package/src/proto/auth/v1/service.proto +0 -26
  180. package/src/proto/customers/v1/entities/address.proto +0 -101
  181. package/src/proto/customers/v1/entities/profile.proto +0 -118
  182. package/src/proto/customers/v1/service.proto +0 -36
  183. package/src/proto/files/v1/entities/file.proto +0 -62
  184. package/src/proto/files/v1/service.proto +0 -19
  185. package/src/proto/products/v1/entities/category.proto +0 -98
  186. package/src/proto/products/v1/entities/collection.proto +0 -72
  187. package/src/proto/products/v1/entities/product/create.proto +0 -41
  188. package/src/proto/products/v1/entities/product/option.proto +0 -17
  189. package/src/proto/products/v1/entities/product/shared.proto +0 -255
  190. package/src/proto/products/v1/entities/product/update.proto +0 -66
  191. package/src/proto/products/v1/entities/tag.proto +0 -73
  192. package/src/proto/products/v1/entities/taxonomy.proto +0 -146
  193. package/src/proto/products/v1/entities/type.proto +0 -98
  194. package/src/proto/products/v1/entities/variant.proto +0 -127
  195. package/src/proto/products/v1/service.proto +0 -78
  196. package/src/proto/promotions/v1/entities/campaign.proto +0 -145
  197. package/src/proto/promotions/v1/service.proto +0 -17
  198. package/src/proto/stocknodes/v1/entities/stocknode.proto +0 -167
  199. package/src/proto/stocknodes/v1/service.proto +0 -21
  200. package/src/registration.ts +0 -170
  201. package/src/test-utils.ts +0 -176
package/src/profile.ts DELETED
@@ -1,169 +0,0 @@
1
- import { Code, ConnectError, createClient } from '@connectrpc/connect'
2
- import { createGrpcTransport } from '@connectrpc/connect-node'
3
- import { getCheckoutConfig } from '@paakd/config'
4
- import { CustomerService } from '../gen/src/proto/customers/v1/service_pb'
5
- import type { UpdateProfileRequest } from '../gen/src/proto/customers/v1/entities/profile_pb'
6
- import { brotliCompression } from './compressor/brotli'
7
- import {
8
- createAuthenticationInterceptor,
9
- createCustomerAuthenticationInterceptor,
10
- createHeadersInterceptor,
11
- } from './interceptors'
12
-
13
- export interface GetBasicProfileProps {
14
- body: {
15
- customerId: string
16
- jwt: string
17
- }
18
- headers: Record<string, string | null>
19
- }
20
-
21
- export interface GetProfileProps {
22
- body: {
23
- customerId: string
24
- jwt: string
25
- }
26
- headers: Record<string, string | null>
27
- }
28
-
29
- export interface UpdateProfileProps {
30
- body: Omit<UpdateProfileRequest, '$typeName'> & { jwt: string }
31
- headers: Record<string, string | null>
32
- }
33
-
34
- export async function getBasicProfile({
35
- body: { customerId, jwt },
36
- headers,
37
- }: GetBasicProfileProps) {
38
- try {
39
- const checkoutConfig = await getCheckoutConfig()
40
- const profileClient = createClient(
41
- CustomerService,
42
- createGrpcTransport({
43
- baseUrl: checkoutConfig.enterpriseURL,
44
- interceptors: [
45
- createHeadersInterceptor(headers),
46
- createAuthenticationInterceptor(checkoutConfig),
47
- createCustomerAuthenticationInterceptor(jwt),
48
- ],
49
- acceptCompression: [brotliCompression],
50
- sendCompression: brotliCompression,
51
- })
52
- )
53
-
54
- const value = await profileClient.basicProfile({
55
- customerId,
56
- })
57
-
58
- return {
59
- value,
60
- status: 'success',
61
- }
62
- } catch (err: unknown) {
63
- if (err instanceof ConnectError) {
64
- return {
65
- code: err.code,
66
- rawMessage: err.rawMessage,
67
- message: err.rawMessage,
68
- status: 'failed',
69
- }
70
- }
71
-
72
- return {
73
- code: Code.Internal,
74
- rawMessage: 'An unexpected error occurred while fetching the profile.',
75
- message: 'An unexpected error occurred while fetching the profile.',
76
- status: 'failed',
77
- } as unknown as ConnectError
78
- }
79
- }
80
-
81
- export async function getProfile({
82
- body: { customerId, jwt },
83
- headers,
84
- }: GetProfileProps) {
85
- try {
86
- const checkoutConfig = await getCheckoutConfig()
87
- const profileClient = createClient(
88
- CustomerService,
89
- createGrpcTransport({
90
- baseUrl: checkoutConfig.enterpriseURL,
91
- interceptors: [
92
- createHeadersInterceptor(headers),
93
- createAuthenticationInterceptor(checkoutConfig),
94
- createCustomerAuthenticationInterceptor(jwt),
95
- ],
96
- acceptCompression: [brotliCompression],
97
- sendCompression: brotliCompression,
98
- })
99
- )
100
-
101
- const value = await profileClient.profile({
102
- customerId,
103
- })
104
-
105
- return {
106
- value,
107
- status: 'success',
108
- }
109
- } catch (err: unknown) {
110
- if (err instanceof ConnectError) {
111
- return {
112
- code: err.code,
113
- rawMessage: err.rawMessage,
114
- message: err.rawMessage,
115
- status: 'failed',
116
- }
117
- }
118
-
119
- return {
120
- code: Code.Internal,
121
- rawMessage: 'An unexpected error occurred while fetching the profile.',
122
- message: 'An unexpected error occurred while fetching the profile.',
123
- status: 'failed',
124
- } as unknown as ConnectError
125
- }
126
- }
127
-
128
- export async function updateProfile({
129
- body: { jwt, ...prop },
130
- headers,
131
- }: UpdateProfileProps) {
132
- const checkoutConfig = await getCheckoutConfig()
133
- const transport = createGrpcTransport({
134
- baseUrl: checkoutConfig.enterpriseURL,
135
- interceptors: [
136
- createHeadersInterceptor(headers),
137
- createAuthenticationInterceptor(checkoutConfig),
138
- createCustomerAuthenticationInterceptor(jwt),
139
- ],
140
- acceptCompression: [brotliCompression],
141
- sendCompression: brotliCompression,
142
- })
143
- const profile = createClient(CustomerService, transport)
144
-
145
- try {
146
- const value = await profile.updateProfile(prop)
147
-
148
- return {
149
- value,
150
- status: 'success',
151
- }
152
- } catch (err: unknown) {
153
- if (err instanceof ConnectError) {
154
- return {
155
- code: err.code,
156
- rawMessage: err.rawMessage,
157
- message: err.rawMessage,
158
- status: 'failed',
159
- }
160
- }
161
-
162
- return {
163
- code: Code.Internal,
164
- rawMessage: 'profile update failed',
165
- message: 'An unexpected error occurred during profile update.',
166
- status: 'failed',
167
- } as unknown as ConnectError
168
- }
169
- }
@@ -1,140 +0,0 @@
1
- syntax = "proto3";
2
-
3
-
4
- import "buf/validate/validate.proto";
5
- import "google/protobuf/timestamp.proto";
6
-
7
- message LoginRequest {
8
- string email = 1 [
9
- (buf.validate.field).string.email = true
10
- ];
11
- string password = 2 [
12
- (buf.validate.field).string.min_len = 8,
13
- (buf.validate.field).string.max_len = 100
14
- ];
15
- }
16
-
17
- message RefreshToken {
18
- string expires_at = 1; // Duration in seconds
19
- string token = 2; // Refresh token
20
- string email = 3; // User's email
21
- string customer_id = 4; // Customer ID associated with the token
22
- google.protobuf.Timestamp started_at = 5; // Timestamp when the token was issued
23
- }
24
-
25
- message AccessToken {
26
- string token = 1; // Access token
27
- string expires_at = 2; // Duration in seconds
28
- }
29
-
30
- message LoginResponse {
31
- RefreshToken refresh_token = 1;
32
- AccessToken access_token = 2;
33
- string email = 3;
34
- }
35
-
36
- message TokenRefreshRequest {
37
- string refresh_token = 1 [
38
- (buf.validate.field).string.min_len = 1,
39
- (buf.validate.field).string.max_len = 120
40
- ];
41
- }
42
-
43
-
44
- message VerifyEmailRequest {
45
- enum EmailLocale {
46
- EN_GB = 0;
47
- EN_US = 1;
48
- NL_NL = 2;
49
- DE_DE = 3;
50
- }
51
-
52
- string email = 1 [
53
- (buf.validate.field).string.email = true
54
- ];
55
- EmailLocale locale = 2 [
56
- (buf.validate.field).enum.defined_only = true
57
- ];
58
-
59
- string idempotency_key = 3;
60
- }
61
-
62
- message VerifyEmailResponse {
63
- string idempotency_key = 1;
64
- }
65
-
66
- message ValidateOTPRequest {
67
- string email = 1 [
68
- (buf.validate.field).string.email = true
69
- ];
70
- string otp = 2 [
71
- (buf.validate.field).string.min_len = 6,
72
- (buf.validate.field).string.max_len = 6
73
- ];
74
- }
75
-
76
- message ValidateOTPResponse {
77
- bool valid = 1; // Indicates if the OTP is valid
78
- string message = 2; // Additional message, e.g., "OTP is valid" or "OTP is invalid"
79
- }
80
-
81
- message RegisterRequest {
82
-
83
- string email = 1 [
84
- (buf.validate.field).string.email = true
85
- ];
86
- optional string password = 2 [
87
- (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED,
88
- (buf.validate.field).required = false
89
- ];
90
- string first_name = 3 [
91
- (buf.validate.field).string.min_len = 2,
92
- (buf.validate.field).string.max_len = 20
93
- ];
94
- string other_names = 4 [
95
- (buf.validate.field).string.max_len = 20
96
- ];
97
- string last_name = 5 [
98
- (buf.validate.field).string.min_len = 2,
99
- (buf.validate.field).string.max_len = 20
100
- ];
101
- optional string otp = 6 [
102
- (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED,
103
- (buf.validate.field).required = false
104
- ];
105
-
106
- option (buf.validate.message).cel = {
107
- id: "password_complexity_lowercase_must",
108
- message: "Password must contain at least one lowercase letter",
109
- expression: "this.password != '' ? string(this.password).matches('[a-z]') : true"
110
- };
111
- option (buf.validate.message).cel = {
112
- id: "password_complexity_uppercase_must",
113
- message: "Password must contain at least one uppercase letter",
114
- expression: "this.password != '' ? string(this.password).matches('[A-Z]') : true"
115
- };
116
- option (buf.validate.message).cel = {
117
- id: "password_complexity_digit_must",
118
- message: "Password must contain at least one digit",
119
- expression: "this.password != '' ? string(this.password).matches('[0-9]') : true"
120
- };
121
- option (buf.validate.message).cel = {
122
- id: "password_complexity_special_char_must",
123
- message: "Password must contain at least one special character",
124
- expression: "this.password != '' ? string(this.password).matches('[!@#$%^&*(),.?\":{}|<>]') : true"
125
- };
126
-
127
- option (buf.validate.message).cel = {
128
- id: "full_account_password_required_if_otp_not_empty",
129
- message: "Password is required if OTP is provided",
130
- expression: "this.otp != '' ? this.password != '' : true"
131
- };
132
-
133
- option (buf.validate.message).cel = {
134
- id: "full_account_otp_required_if_password_not_empty",
135
- message: "OTP is required if password is provided",
136
- expression: "this.password != '' ? this.otp != '' : true"
137
- };
138
- }
139
-
140
- message RegisterResponse {}
@@ -1,57 +0,0 @@
1
- syntax = "proto3";
2
-
3
-
4
- import "buf/validate/validate.proto";
5
-
6
- message Policy {
7
- string p_type = 1; // Policy type
8
- string v0 = 2; // First value
9
- string v1 = 3; // Second value (optional)
10
- string v2 = 4; // Third value (optional)
11
- string v3 = 5; // Fourth value (optional)
12
- string v4 = 6; // Fifth value (optional)
13
- string v5 = 7; // Sixth value (optional)
14
- }
15
- message GetPoliciesResponse {
16
- repeated Policy policies = 1; // List of policies
17
- }
18
-
19
- message SavePolicyRequest {
20
- repeated Policy policies = 1; // List of policies to save
21
- }
22
-
23
- message ChangePolicyRequest {
24
- string p_type = 1 [(buf.validate.field).required = true]; // Policy type
25
- repeated string rule = 2; // Rules associated with the policy
26
- }
27
- message Rules {
28
- repeated string rules = 1; // List of rules
29
- }
30
-
31
- message ChangePoliciesRequest {
32
- string p_type = 1;
33
- repeated Rules rules = 2; // List of rules to add
34
- }
35
-
36
- message PolicyEmptyRequest {}
37
- message PolicyEmptyResponse {}
38
-
39
-
40
- message FilterEntry {
41
- string key = 1;
42
- repeated StringArray values = 2;
43
- }
44
-
45
- message StringArray {
46
- repeated string items = 1;
47
- }
48
-
49
- message FilteredPolicyRequest {
50
- repeated FilterEntry filter = 1;
51
- }
52
-
53
- message RemoveFilteredPolicyRequest {
54
- string p_type = 1;
55
- int32 field_index = 2;
56
- repeated string field_values = 3;
57
- }
@@ -1,26 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package apps.enterprise.interfaces.rpc.auth.v1;
4
-
5
- option go_package = "paakd.com/packages/api/gen/auth/v1;authv1";
6
-
7
- import "src/proto/auth/v1/entities/policy.proto";
8
- import "src/proto/auth/v1/entities/auth.proto";
9
-
10
- service AuthService {
11
- rpc Login(LoginRequest) returns (LoginResponse) {}
12
- rpc RefreshToken(TokenRefreshRequest) returns (LoginResponse) {}
13
- rpc VerifyEmail(VerifyEmailRequest) returns (VerifyEmailResponse) {}
14
- rpc ValidateOTP(ValidateOTPRequest) returns (ValidateOTPResponse) {}
15
- rpc Register(RegisterRequest) returns (RegisterResponse) {}
16
-
17
-
18
- rpc GetPolicies(PolicyEmptyRequest) returns (GetPoliciesResponse) {}
19
- rpc SavePolicies(SavePolicyRequest) returns (PolicyEmptyResponse) {}
20
- rpc AddPolicy(ChangePolicyRequest) returns (PolicyEmptyResponse) {}
21
- rpc RemovePolicy(ChangePolicyRequest) returns (PolicyEmptyResponse) {}
22
- rpc AddPolicies(ChangePoliciesRequest) returns (PolicyEmptyResponse) {}
23
- rpc RemovePolicies(ChangePoliciesRequest) returns (PolicyEmptyResponse) {}
24
- rpc GetFilteredPolicy(FilteredPolicyRequest) returns (GetPoliciesResponse) {}
25
- rpc RemoveFilteredPolicy(RemoveFilteredPolicyRequest) returns (PolicyEmptyResponse) {}
26
- }
@@ -1,101 +0,0 @@
1
- syntax = "proto3";
2
-
3
-
4
- import "buf/validate/validate.proto";
5
-
6
-
7
- message GetAddressesRequest {
8
- string customer_id = 1;
9
- }
10
-
11
- message GetAddressRequest {
12
- string customer_id = 1;
13
- string address_id = 2;
14
- }
15
-
16
- message GetAddressResponse {
17
- string first_name = 1;
18
- string last_name = 2;
19
- string address_1 = 3;
20
- string address_2 = 4;
21
- string address_3 = 5;
22
- string phone_number = 6;
23
- bool is_default = 7;
24
- bool is_valid = 8;
25
- string zip_code = 9;
26
- string country = 10;
27
- string country_code = 11;
28
- string company = 12;
29
- string city = 13;
30
- string province = 14;
31
- string address_type = 15;
32
- string address_provider = 16;
33
- string state_code = 17;
34
- string id = 18;
35
- string email_address = 19;
36
- string county_province = 20;
37
- }
38
-
39
- message GetAddressesResponse {
40
- repeated GetAddressResponse addresses = 1;
41
- }
42
-
43
- message AddAddressRequest {
44
- string customer_id = 1 ;
45
- string first_name = 2;
46
- string last_name = 3 ;
47
- string address_1 = 4;
48
- string address_2 = 5;
49
- string address_3 = 6;
50
- string phone_number = 7;
51
- bool is_default = 8;
52
- bool is_valid = 9;
53
- string zip_code = 10;
54
- string country = 11;
55
- string country_code = 12;
56
- string company = 13;
57
- string city = 14;
58
- string province = 15;
59
- string address_type = 16;
60
- string address_provider = 17;
61
- string state_code = 18;
62
- }
63
-
64
- message AddAddressResponse {
65
- GetAddressResponse address = 1;
66
- }
67
-
68
- message UpdateAddressRequest {
69
- string customer_id = 1 ;
70
- string first_name = 2;
71
- string last_name = 3 ;
72
- string address_1 = 4;
73
- string address_2 = 5;
74
- string address_3 = 6;
75
- string phone_number = 7;
76
- bool is_default = 8;
77
- bool is_valid = 9;
78
- string zip_code = 10;
79
- string country = 11;
80
- string country_code = 12;
81
- string company = 13;
82
- string city = 14;
83
- string province = 15;
84
- string address_type = 16;
85
- string address_provider = 17;
86
- string state_code = 18;
87
- string address_id = 19;
88
- }
89
-
90
- message UpdateAddressResponse {
91
- GetAddressResponse address = 1;
92
- }
93
-
94
- message DeleteAddressRequest {
95
- string customer_id = 1;
96
- string address_id = 2;
97
- }
98
-
99
- message DeleteAddressResponse {
100
- bool success = 1;
101
- }
@@ -1,118 +0,0 @@
1
- syntax = "proto3";
2
-
3
-
4
- import "buf/validate/validate.proto";
5
-
6
- message BasicProfileRequest {
7
- string customer_id = 1 [
8
- (buf.validate.field).required = true,
9
- (buf.validate.field).string.pattern = "^[a-z]{3}[_][0-9a-hjkmnp-tv-z]{26}$"
10
- ];
11
- }
12
-
13
- message BasicProfileResponse {
14
- string id = 1;
15
- string email = 2;
16
- string first_name = 3;
17
- string last_name = 4;
18
- string other_names = 5;
19
- }
20
-
21
- message ProfileRequest {
22
- string customer_id = 1 [
23
- (buf.validate.field).required = true,
24
- (buf.validate.field).string.pattern = "^[a-z]{3}[_][0-9a-hjkmnp-tv-z]{26}$"
25
- ];
26
- }
27
-
28
- message ProfileResponse {
29
- string customer_id = 1 ;
30
- string first_name = 2;
31
- string last_name = 3 ;
32
- string other_names = 4;
33
- string date_of_birth = 5;
34
- string email = 6;
35
- string gender = 7 ;
36
- string phone = 8;
37
- }
38
-
39
- message ChangePasswordRequest {
40
- string customer_id = 1 [
41
- (buf.validate.field).required = true,
42
- (buf.validate.field).string.len = 26
43
- ];
44
- string old_password = 2 [
45
- (buf.validate.field).required = true
46
- ];
47
- string new_password = 3 [
48
- (buf.validate.field).required = true
49
- ];
50
-
51
- option (buf.validate.message).cel = {
52
- id: "password_complexity_lowercase_must",
53
- message: "Password must contain at least one lowercase letter",
54
- expression: "this.new_password != '' ? string(this.new_password).matches('[a-z]') : true"
55
- };
56
- option (buf.validate.message).cel = {
57
- id: "password_complexity_uppercase_must",
58
- message: "Password must contain at least one uppercase letter",
59
- expression: "this.new_password != '' ? string(this.new_password).matches('[A-Z]') : true"
60
- };
61
- option (buf.validate.message).cel = {
62
- id: "password_complexity_digit_must",
63
- message: "Password must contain at least one digit",
64
- expression: "this.new_password != '' ? string(this.new_password).matches('[0-9]') : true"
65
- };
66
- option (buf.validate.message).cel = {
67
- id: "password_complexity_special_char_must",
68
- message: "Password must contain at least one special character",
69
- expression: "this.new_password != '' ? string(this.new_password).matches('[!@#$%^&*(),.?\":{}|<>]') : true"
70
- };
71
-
72
- option (buf.validate.message).cel = {
73
- id: "password_and_new_password_different",
74
- message: "Password and new password must be different",
75
- expression: "this.old_password != this.new_password"
76
- };
77
- }
78
-
79
- message ChangePasswordResponse {
80
- }
81
-
82
- message UpdateProfileRequest {
83
- string customer_id = 1 [
84
- (buf.validate.field).required = true,
85
- (buf.validate.field).string.min_len = 26
86
- ];
87
- string first_name = 2 [
88
- (buf.validate.field).required = true,
89
- (buf.validate.field).string.min_len = 2,
90
- (buf.validate.field).string.max_len = 20
91
- ];
92
- string last_name = 3 [
93
- (buf.validate.field).required = true,
94
- (buf.validate.field).string.min_len = 2,
95
- (buf.validate.field).string.max_len = 20
96
- ];
97
- string other_names = 4 [
98
- (buf.validate.field).string.max_len = 20
99
- ];
100
- string date_of_birth = 5;
101
- string email = 6 [
102
- (buf.validate.field).required = true,
103
- (buf.validate.field).string.email = true
104
- ];
105
- string gender = 7;
106
- string phone = 8 [
107
- (buf.validate.field).string.max_len = 20
108
- ];
109
-
110
- option (buf.validate.message).cel = {
111
- id: "gender_must_be_valid",
112
- message: "Gender must be either 'male', 'female', or 'other'",
113
- expression: "this.gender != '' ? string(this.gender).matches('^(male|female|other)$') : true"
114
- };
115
-
116
- }
117
-
118
- message UpdateProfileResponse {}
@@ -1,36 +0,0 @@
1
- syntax = "proto3";
2
-
3
- package apps.enterprise.interfaces.rpc.customers.v1;
4
-
5
- option go_package = "paakd.com/packages/api/gen/customers/v1;customersv1";
6
-
7
- import "src/proto/customers/v1/entities/address.proto";
8
- import "src/proto/customers/v1/entities/profile.proto";
9
-
10
-
11
- service CustomerService {
12
- rpc BasicProfile(BasicProfileRequest) returns (BasicProfileResponse) {
13
- option idempotency_level = NO_SIDE_EFFECTS;
14
- };
15
- rpc Profile(ProfileRequest) returns (ProfileResponse) {
16
- option idempotency_level = NO_SIDE_EFFECTS;
17
- };
18
- rpc ChangePassword(ChangePasswordRequest) returns (ChangePasswordResponse) {};
19
- rpc UpdateProfile(UpdateProfileRequest) returns (UpdateProfileResponse) {};
20
-
21
- rpc GetAddress(GetAddressRequest) returns (GetAddressResponse) {
22
- option idempotency_level = NO_SIDE_EFFECTS;
23
- };
24
- rpc GetAddresses(GetAddressesRequest) returns (GetAddressesResponse) {
25
- option idempotency_level = NO_SIDE_EFFECTS;
26
- };
27
- rpc AddAddress(AddAddressRequest) returns (AddAddressResponse) {
28
- option idempotency_level = NO_SIDE_EFFECTS;
29
- };
30
- rpc UpdateAddress(UpdateAddressRequest) returns (UpdateAddressResponse) {
31
- option idempotency_level = NO_SIDE_EFFECTS;
32
- };
33
- rpc DeleteAddress(DeleteAddressRequest) returns (DeleteAddressResponse) {
34
- option idempotency_level = NO_SIDE_EFFECTS;
35
- };
36
- }
@@ -1,62 +0,0 @@
1
- syntax = "proto3";
2
-
3
-
4
- import "buf/validate/validate.proto";
5
-
6
-
7
- message ListFilesRequest {
8
- int32 offset = 1 [
9
- (buf.validate.field).int32.gte = 0
10
- ];
11
- uint32 limit = 2 [
12
- (buf.validate.field).uint32.gte = 1,
13
- (buf.validate.field).uint32.lte = 100
14
- ];
15
- optional string order_by = 3;
16
- optional string filter = 4;
17
- optional bool ascending = 5;
18
- optional string request_path = 6;
19
- }
20
-
21
- message ListFilesResponse {
22
- repeated FileResponse files = 1;
23
- }
24
-
25
- message GetFileRequest {
26
- string id = 1;
27
- }
28
-
29
- message GetFileResponse {
30
- FileResponse file = 1;
31
- }
32
-
33
- message DeleteFileRequest {
34
- string id = 1;
35
- }
36
-
37
- message DeleteFileResponse {}
38
-
39
- message UpdateFileRequest {
40
- string id = 1;
41
- optional string line_item_id = 2;
42
- optional string video_product_id = 3;
43
- optional string video_product_variant_id = 4;
44
- optional string product_category_id = 5;
45
- optional string video_product_category_id = 6;
46
- }
47
-
48
- message UpdateFileResponse {
49
- }
50
-
51
- message FileResponse {
52
- string id = 1;
53
- string name = 2;
54
- string path = 3;
55
- string type = 4;
56
- string source = 5;
57
- string line_item_id = 6;
58
- string video_product_id = 7;
59
- string video_product_variant_id = 8;
60
- string product_category_id = 9;
61
- string video_product_category_id = 10;
62
- }