@barumetric/contracts 1.3.2 → 1.3.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.
@@ -12,16 +12,16 @@ import { Empty } from "./google/protobuf/empty";
12
12
  export const protobufPackage = "categories.v1";
13
13
 
14
14
  export enum AttributeType {
15
- ATTRIBUTE_TYPE_UNSPECIFIED = 0,
16
- ATTRIBUTE_TYPE_STRING = 1,
17
- ATTRIBUTE_TYPE_TEXT = 2,
18
- ATTRIBUTE_TYPE_INTEGER = 3,
19
- ATTRIBUTE_TYPE_FLOAT = 4,
20
- ATTRIBUTE_TYPE_BOOLEAN = 5,
21
- ATTRIBUTE_TYPE_ENUM = 6,
22
- ATTRIBUTE_TYPE_MULTI_ENUM = 7,
23
- ATTRIBUTE_TYPE_RANGE = 8,
24
- ATTRIBUTE_TYPE_DATE = 9,
15
+ UNSPECIFIED = 0,
16
+ STRING = 1,
17
+ TEXT = 2,
18
+ INTEGER = 3,
19
+ FLOAT = 4,
20
+ BOOLEAN = 5,
21
+ ENUM = 6,
22
+ MULTI_ENUM = 7,
23
+ RANGE = 8,
24
+ DATE = 9,
25
25
  UNRECOGNIZED = -1,
26
26
  }
27
27
 
@@ -132,6 +132,92 @@ export interface EnumValueInput {
132
132
  sortOrder: number;
133
133
  }
134
134
 
135
+ /** Attribute management messages */
136
+ export interface GetAttributeRequest {
137
+ id: string;
138
+ }
139
+
140
+ export interface GetAttributeResponse {
141
+ attribute: Attribute | undefined;
142
+ }
143
+
144
+ export interface Attribute {
145
+ id: string;
146
+ name: string;
147
+ key: string;
148
+ type: AttributeType;
149
+ defaultIsRequired: boolean;
150
+ defaultIsFilterable: boolean;
151
+ unit?: string | undefined;
152
+ minValue?: number | undefined;
153
+ maxValue?: number | undefined;
154
+ enumValues: EnumValue[];
155
+ }
156
+
157
+ export interface CreateAttributeRequest {
158
+ name: string;
159
+ key: string;
160
+ type: AttributeType;
161
+ defaultIsRequired: boolean;
162
+ defaultIsFilterable: boolean;
163
+ unit?: string | undefined;
164
+ minValue?: number | undefined;
165
+ maxValue?: number | undefined;
166
+ enumValues: EnumValueInput[];
167
+ }
168
+
169
+ export interface CreateAttributeResponse {
170
+ ok: boolean;
171
+ id: string;
172
+ }
173
+
174
+ export interface UpdateAttributeRequest {
175
+ id: string;
176
+ name?: string | undefined;
177
+ key?: string | undefined;
178
+ type?: AttributeType | undefined;
179
+ defaultIsRequired?: boolean | undefined;
180
+ defaultIsFilterable?: boolean | undefined;
181
+ unit?: string | undefined;
182
+ minValue?: number | undefined;
183
+ maxValue?: number | undefined;
184
+ enumValues: EnumValueInput[];
185
+ }
186
+
187
+ export interface UpdateAttributeResponse {
188
+ ok: boolean;
189
+ }
190
+
191
+ export interface DeleteAttributeRequest {
192
+ id: string;
193
+ }
194
+
195
+ export interface DeleteAttributeResponse {
196
+ ok: boolean;
197
+ }
198
+
199
+ /** Category-Attribute relationship messages */
200
+ export interface AssignAttributeToCategoryRequest {
201
+ categoryId: string;
202
+ attributeId: string;
203
+ isRequired?: boolean | undefined;
204
+ isFilterable?: boolean | undefined;
205
+ sortOrder?: number | undefined;
206
+ }
207
+
208
+ export interface AssignAttributeToCategoryResponse {
209
+ ok: boolean;
210
+ }
211
+
212
+ export interface UnassignAttributeFromCategoryRequest {
213
+ categoryId: string;
214
+ attributeId: string;
215
+ }
216
+
217
+ export interface UnassignAttributeFromCategoryResponse {
218
+ ok: boolean;
219
+ }
220
+
135
221
  export const CATEGORIES_V1_PACKAGE_NAME = "categories.v1";
136
222
 
137
223
  export interface CategoriesServiceClient {
@@ -146,6 +232,24 @@ export interface CategoriesServiceClient {
146
232
  updateCategory(request: UpdateCategoryRequest): Observable<UpdateCategoryResponse>;
147
233
 
148
234
  deleteCategory(request: DeleteCategoryRequest): Observable<DeleteCategoryResponse>;
235
+
236
+ /** Attribute management */
237
+
238
+ getAttribute(request: GetAttributeRequest): Observable<GetAttributeResponse>;
239
+
240
+ createAttribute(request: CreateAttributeRequest): Observable<CreateAttributeResponse>;
241
+
242
+ updateAttribute(request: UpdateAttributeRequest): Observable<UpdateAttributeResponse>;
243
+
244
+ deleteAttribute(request: DeleteAttributeRequest): Observable<DeleteAttributeResponse>;
245
+
246
+ /** Category-Attribute relationship management */
247
+
248
+ assignAttributeToCategory(request: AssignAttributeToCategoryRequest): Observable<AssignAttributeToCategoryResponse>;
249
+
250
+ unassignAttributeFromCategory(
251
+ request: UnassignAttributeFromCategoryRequest,
252
+ ): Observable<UnassignAttributeFromCategoryResponse>;
149
253
  }
150
254
 
151
255
  export interface CategoriesServiceController {
@@ -172,6 +276,40 @@ export interface CategoriesServiceController {
172
276
  deleteCategory(
173
277
  request: DeleteCategoryRequest,
174
278
  ): Promise<DeleteCategoryResponse> | Observable<DeleteCategoryResponse> | DeleteCategoryResponse;
279
+
280
+ /** Attribute management */
281
+
282
+ getAttribute(
283
+ request: GetAttributeRequest,
284
+ ): Promise<GetAttributeResponse> | Observable<GetAttributeResponse> | GetAttributeResponse;
285
+
286
+ createAttribute(
287
+ request: CreateAttributeRequest,
288
+ ): Promise<CreateAttributeResponse> | Observable<CreateAttributeResponse> | CreateAttributeResponse;
289
+
290
+ updateAttribute(
291
+ request: UpdateAttributeRequest,
292
+ ): Promise<UpdateAttributeResponse> | Observable<UpdateAttributeResponse> | UpdateAttributeResponse;
293
+
294
+ deleteAttribute(
295
+ request: DeleteAttributeRequest,
296
+ ): Promise<DeleteAttributeResponse> | Observable<DeleteAttributeResponse> | DeleteAttributeResponse;
297
+
298
+ /** Category-Attribute relationship management */
299
+
300
+ assignAttributeToCategory(
301
+ request: AssignAttributeToCategoryRequest,
302
+ ):
303
+ | Promise<AssignAttributeToCategoryResponse>
304
+ | Observable<AssignAttributeToCategoryResponse>
305
+ | AssignAttributeToCategoryResponse;
306
+
307
+ unassignAttributeFromCategory(
308
+ request: UnassignAttributeFromCategoryRequest,
309
+ ):
310
+ | Promise<UnassignAttributeFromCategoryResponse>
311
+ | Observable<UnassignAttributeFromCategoryResponse>
312
+ | UnassignAttributeFromCategoryResponse;
175
313
  }
176
314
 
177
315
  export function CategoriesServiceControllerMethods() {
@@ -183,6 +321,12 @@ export function CategoriesServiceControllerMethods() {
183
321
  "createCategory",
184
322
  "updateCategory",
185
323
  "deleteCategory",
324
+ "getAttribute",
325
+ "createAttribute",
326
+ "updateAttribute",
327
+ "deleteAttribute",
328
+ "assignAttributeToCategory",
329
+ "unassignAttributeFromCategory",
186
330
  ];
187
331
  for (const method of grpcMethods) {
188
332
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,6 +12,16 @@ service CategoriesService {
12
12
  rpc CreateCategory (CreateCategoryRequest) returns (CreateCategoryResponse);
13
13
  rpc UpdateCategory (UpdateCategoryRequest) returns (UpdateCategoryResponse);
14
14
  rpc DeleteCategory (DeleteCategoryRequest) returns (DeleteCategoryResponse);
15
+
16
+ // Attribute management
17
+ rpc GetAttribute (GetAttributeRequest) returns (GetAttributeResponse);
18
+ rpc CreateAttribute (CreateAttributeRequest) returns (CreateAttributeResponse);
19
+ rpc UpdateAttribute (UpdateAttributeRequest) returns (UpdateAttributeResponse);
20
+ rpc DeleteAttribute (DeleteAttributeRequest) returns (DeleteAttributeResponse);
21
+
22
+ // Category-Attribute relationship management
23
+ rpc AssignAttributeToCategory (AssignAttributeToCategoryRequest) returns (AssignAttributeToCategoryResponse);
24
+ rpc UnassignAttributeFromCategory (UnassignAttributeFromCategoryRequest) returns (UnassignAttributeFromCategoryResponse);
15
25
  }
16
26
 
17
27
  message GetCategoryRequest {
@@ -122,14 +132,100 @@ message EnumValueInput {
122
132
  }
123
133
 
124
134
  enum AttributeType {
125
- ATTRIBUTE_TYPE_UNSPECIFIED = 0;
126
- ATTRIBUTE_TYPE_STRING = 1;
127
- ATTRIBUTE_TYPE_TEXT = 2;
128
- ATTRIBUTE_TYPE_INTEGER = 3;
129
- ATTRIBUTE_TYPE_FLOAT = 4;
130
- ATTRIBUTE_TYPE_BOOLEAN = 5;
131
- ATTRIBUTE_TYPE_ENUM = 6;
132
- ATTRIBUTE_TYPE_MULTI_ENUM = 7;
133
- ATTRIBUTE_TYPE_RANGE = 8;
134
- ATTRIBUTE_TYPE_DATE = 9;
135
+ UNSPECIFIED = 0;
136
+ STRING = 1;
137
+ TEXT = 2;
138
+ INTEGER = 3;
139
+ FLOAT = 4;
140
+ BOOLEAN = 5;
141
+ ENUM = 6;
142
+ MULTI_ENUM = 7;
143
+ RANGE = 8;
144
+ DATE = 9;
145
+ }
146
+
147
+ // Attribute management messages
148
+ message GetAttributeRequest {
149
+ string id = 1;
150
+ }
151
+
152
+ message GetAttributeResponse {
153
+ Attribute attribute = 1;
154
+ }
155
+
156
+ message Attribute {
157
+ string id = 1;
158
+ string name = 2;
159
+ string key = 3;
160
+ AttributeType type = 4;
161
+ bool default_is_required = 5;
162
+ bool default_is_filterable = 6;
163
+ optional string unit = 7;
164
+ optional float min_value = 8;
165
+ optional float max_value = 9;
166
+ repeated EnumValue enum_values = 10;
167
+ }
168
+
169
+ message CreateAttributeRequest {
170
+ string name = 1;
171
+ string key = 2;
172
+ AttributeType type = 3;
173
+ bool default_is_required = 4;
174
+ bool default_is_filterable = 5;
175
+ optional string unit = 6;
176
+ optional float min_value = 7;
177
+ optional float max_value = 8;
178
+ repeated EnumValueInput enum_values = 9;
179
+ }
180
+
181
+ message CreateAttributeResponse {
182
+ bool ok = 1;
183
+ string id = 2;
184
+ }
185
+
186
+ message UpdateAttributeRequest {
187
+ string id = 1;
188
+ optional string name = 2;
189
+ optional string key = 3;
190
+ optional AttributeType type = 4;
191
+ optional bool default_is_required = 5;
192
+ optional bool default_is_filterable = 6;
193
+ optional string unit = 7;
194
+ optional float min_value = 8;
195
+ optional float max_value = 9;
196
+ repeated EnumValueInput enum_values = 10;
197
+ }
198
+
199
+ message UpdateAttributeResponse {
200
+ bool ok = 1;
201
+ }
202
+
203
+ message DeleteAttributeRequest {
204
+ string id = 1;
205
+ }
206
+
207
+ message DeleteAttributeResponse {
208
+ bool ok = 1;
209
+ }
210
+
211
+ // Category-Attribute relationship messages
212
+ message AssignAttributeToCategoryRequest {
213
+ string category_id = 1;
214
+ string attribute_id = 2;
215
+ optional bool is_required = 3;
216
+ optional bool is_filterable = 4;
217
+ optional int32 sort_order = 5;
218
+ }
219
+
220
+ message AssignAttributeToCategoryResponse {
221
+ bool ok = 1;
222
+ }
223
+
224
+ message UnassignAttributeFromCategoryRequest {
225
+ string category_id = 1;
226
+ string attribute_id = 2;
227
+ }
228
+
229
+ message UnassignAttributeFromCategoryResponse {
230
+ bool ok = 1;
135
231
  }