@reactionary/provider-commercetools 0.1.13 → 0.2.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.
@@ -9,8 +9,8 @@ var __decorateClass = (decorators, target, key, kind) => {
9
9
  __defProp(target, key, result);
10
10
  return result;
11
11
  };
12
- import { OrderItemSchema, OrderProvider, OrderQueryByIdSchema, OrderSchema, Reactionary } from "@reactionary/core";
13
- import { CommercetoolsOrderIdentifierSchema } from "../schema/commercetools.schema.js";
12
+ import { OrderProvider, OrderQueryByIdSchema, OrderSchema, Reactionary, success, error } from "@reactionary/core";
13
+ import {} from "../schema/commercetools.schema.js";
14
14
  class CommercetoolsOrderProvider extends OrderProvider {
15
15
  constructor(config, cache, context, client) {
16
16
  super(cache, context);
@@ -25,9 +25,12 @@ class CommercetoolsOrderProvider extends OrderProvider {
25
25
  const client = await this.getClient();
26
26
  try {
27
27
  const remote = await client.withId({ ID: payload.order.key }).get().execute();
28
- return this.parseSingle(remote.body);
28
+ return success(this.parseSingle(remote.body));
29
29
  } catch (e) {
30
- return this.createEmptyOrder();
30
+ return error({
31
+ type: "NotFound",
32
+ identifier: payload
33
+ });
31
34
  }
32
35
  }
33
36
  parseSingle(_body) {
@@ -123,13 +126,6 @@ class CommercetoolsOrderProvider extends OrderProvider {
123
126
  };
124
127
  items.push(item);
125
128
  }
126
- const meta = {
127
- cache: {
128
- hit: false,
129
- key: this.generateCacheKeySingle(identifier)
130
- },
131
- placeholder: false
132
- };
133
129
  const result = {
134
130
  identifier,
135
131
  name,
@@ -141,7 +137,6 @@ class CommercetoolsOrderProvider extends OrderProvider {
141
137
  userId: {
142
138
  userId: ""
143
139
  },
144
- meta,
145
140
  orderStatus
146
141
  };
147
142
  return result;
@@ -15,7 +15,7 @@ import {
15
15
  PriceProvider,
16
16
  PriceSchema,
17
17
  Reactionary,
18
- TieredPriceSchema
18
+ success
19
19
  } from "@reactionary/core";
20
20
  class CommercetoolsPriceProvider extends PriceProvider {
21
21
  constructor(config, cache, context, client) {
@@ -42,7 +42,7 @@ class CommercetoolsPriceProvider extends PriceProvider {
42
42
  const sku = [result.masterVariant, ...result.variants].find(
43
43
  (x) => x.sku === payload.variant.sku
44
44
  );
45
- return this.parseSingle(sku, { includeDiscounts: true });
45
+ return success(this.parseSingle(sku, { includeDiscounts: true }));
46
46
  }
47
47
  async getListPrice(payload) {
48
48
  const client = await this.getClient();
@@ -63,7 +63,7 @@ class CommercetoolsPriceProvider extends PriceProvider {
63
63
  const sku = [result.masterVariant, ...result.variants].find(
64
64
  (x) => x.sku === payload.variant.sku
65
65
  );
66
- return this.parseSingle(sku);
66
+ return success(this.parseSingle(sku));
67
67
  }
68
68
  async getClient() {
69
69
  const client = await this.client.getClient();
@@ -91,13 +91,8 @@ class CommercetoolsPriceProvider extends PriceProvider {
91
91
  sku: body.sku
92
92
  }
93
93
  };
94
- const meta = {
95
- cache: { hit: false, key: this.generateCacheKeySingle(identifier) },
96
- placeholder: false
97
- };
98
94
  const result = {
99
95
  identifier,
100
- meta,
101
96
  tieredPrices: [],
102
97
  unitPrice
103
98
  };
@@ -23,7 +23,8 @@ import {
23
23
  ProductSearchResultSchema,
24
24
  ProductVariantIdentifierSchema,
25
25
  ProductVariantOptionSchema,
26
- Reactionary
26
+ Reactionary,
27
+ success
27
28
  } from "@reactionary/core";
28
29
  import createDebug from "debug";
29
30
  import { CommercetoolsCategoryLookupSchema, CommercetoolsResolveCategoryQueryByIdSchema, CommercetoolsResolveCategoryQueryByKeySchema } from "../schema/commercetools.schema.js";
@@ -185,7 +186,7 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
185
186
  facet: facetIdentifier,
186
187
  key: resolvedId || "unknown"
187
188
  };
188
- return facetValueIdentifier;
189
+ return success(facetValueIdentifier);
189
190
  }
190
191
  async queryByTerm(payload) {
191
192
  const client = await this.getClient();
@@ -246,7 +247,7 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
246
247
  `Search for term "${payload.search.term}" returned ${responseBody.results.length} products (page ${payload.search.paginationOptions.pageNumber} of ${result.totalPages})`
247
248
  );
248
249
  }
249
- return result;
250
+ return success(result);
250
251
  }
251
252
  async patchCategoryFacetValues(result) {
252
253
  const categoryFacet = result.facets.find(
@@ -278,19 +279,11 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
278
279
  const variants = [body.masterVariant, ...body.variants].map(
279
280
  (variant) => this.parseVariant(variant, body)
280
281
  );
281
- const meta = {
282
- cache: {
283
- hit: false,
284
- key: ""
285
- },
286
- placeholder: false
287
- };
288
282
  const product = {
289
283
  identifier,
290
284
  name,
291
285
  slug,
292
- variants,
293
- meta
286
+ variants
294
287
  };
295
288
  return product;
296
289
  }
@@ -313,10 +306,6 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
313
306
  }
314
307
  const result = {
315
308
  identifier,
316
- meta: {
317
- cache: { hit: false, key: "unknown" },
318
- placeholder: false
319
- },
320
309
  pageNumber: (Math.ceil(body.offset / body.limit) || 0) + 1,
321
310
  pageSize: body.limit,
322
311
  totalCount: body.total || 0,
@@ -386,12 +375,6 @@ class CommercetoolsSearchProvider extends ProductSearchProvider {
386
375
  });
387
376
  }
388
377
  }
389
- __decorateClass([
390
- Reactionary({
391
- inputSchema: CommercetoolsResolveCategoryQueryByIdSchema,
392
- outputSchema: CommercetoolsCategoryLookupSchema
393
- })
394
- ], CommercetoolsSearchProvider.prototype, "resolveCategoryFromId", 1);
395
378
  __decorateClass([
396
379
  Reactionary({
397
380
  inputSchema: CommercetoolsResolveCategoryQueryByKeySchema,
@@ -20,7 +20,9 @@ import {
20
20
  ProductQueryBySKUSchema,
21
21
  ProductQueryBySlugSchema,
22
22
  ProductSchema,
23
- Reactionary
23
+ Reactionary,
24
+ success,
25
+ error
24
26
  } from "@reactionary/core";
25
27
  class CommercetoolsProductProvider extends ProductProvider {
26
28
  constructor(config, cache, context, client) {
@@ -34,12 +36,9 @@ class CommercetoolsProductProvider extends ProductProvider {
34
36
  }
35
37
  async getById(payload) {
36
38
  const client = await this.getClient();
37
- try {
38
- const remote = await client.withKey({ key: payload.identifier.key }).get().execute();
39
- return this.parseSingle(remote.body);
40
- } catch (error) {
41
- return this.createEmptyProduct(payload.identifier.key);
42
- }
39
+ const remote = await client.withKey({ key: payload.identifier.key }).get().execute();
40
+ const value = this.parseSingle(remote.body);
41
+ return success(value);
43
42
  }
44
43
  async getBySlug(payload) {
45
44
  const client = await this.getClient();
@@ -51,9 +50,13 @@ class CommercetoolsProductProvider extends ProductProvider {
51
50
  }
52
51
  }).execute();
53
52
  if (remote.body.count === 0) {
54
- return null;
53
+ return error({
54
+ type: "NotFound",
55
+ identifier: payload.slug
56
+ });
55
57
  }
56
- return this.parseSingle(remote.body.results[0]);
58
+ const result = this.parseSingle(remote.body.results[0]);
59
+ return success(result);
57
60
  }
58
61
  async getBySKU(payload) {
59
62
  const client = await this.getClient();
@@ -65,7 +68,8 @@ class CommercetoolsProductProvider extends ProductProvider {
65
68
  "var.skus": [payload].map((p) => p.variant.sku)
66
69
  }
67
70
  }).execute();
68
- return this.parseSingle(remote.body.results[0]);
71
+ const result = this.parseSingle(remote.body.results[0]);
72
+ return success(result);
69
73
  }
70
74
  parseSingle(data) {
71
75
  const identifier = { key: data.key || data.id };
@@ -88,10 +92,6 @@ class CommercetoolsProductProvider extends ProductProvider {
88
92
  otherVariants.push(this.parseVariant(variant, data));
89
93
  }
90
94
  }
91
- const meta = {
92
- cache: { hit: false, key: this.generateCacheKeySingle(identifier) },
93
- placeholder: false
94
- };
95
95
  const result = {
96
96
  identifier,
97
97
  name,
@@ -99,7 +99,6 @@ class CommercetoolsProductProvider extends ProductProvider {
99
99
  description,
100
100
  sharedAttributes,
101
101
  mainVariant,
102
- meta,
103
102
  brand: "",
104
103
  longDescription: "",
105
104
  manufacturer: "",
@@ -132,26 +131,24 @@ class CommercetoolsProductProvider extends ProductProvider {
132
131
  })
133
132
  )
134
133
  ];
135
- const options = (variant.attributes ?? []).filter((attr) => this.isVariantAttributeAnOption(attr)).map(
136
- (attr) => {
137
- const attrVal = this.parseAttributeValue(attr);
138
- const optionIdentifier = {
139
- key: attr.name
140
- };
141
- const option = {
142
- identifier: optionIdentifier,
143
- name: attr.name,
144
- value: {
145
- identifier: {
146
- key: attrVal.value,
147
- option: optionIdentifier
148
- },
149
- label: attrVal.label
150
- }
151
- };
152
- return option;
153
- }
154
- ) || [];
134
+ const options = (variant.attributes ?? []).filter((attr) => this.isVariantAttributeAnOption(attr)).map((attr) => {
135
+ const attrVal = this.parseAttributeValue(attr);
136
+ const optionIdentifier = {
137
+ key: attr.name
138
+ };
139
+ const option = {
140
+ identifier: optionIdentifier,
141
+ name: attr.name,
142
+ value: {
143
+ identifier: {
144
+ key: attrVal.value,
145
+ option: optionIdentifier
146
+ },
147
+ label: attrVal.label
148
+ }
149
+ };
150
+ return option;
151
+ }) || [];
155
152
  const result = {
156
153
  identifier,
157
154
  images,
@@ -209,7 +206,7 @@ __decorateClass([
209
206
  __decorateClass([
210
207
  Reactionary({
211
208
  inputSchema: ProductQueryBySlugSchema,
212
- outputSchema: ProductSchema.nullable()
209
+ outputSchema: ProductSchema
213
210
  })
214
211
  ], CommercetoolsProductProvider.prototype, "getBySlug", 1);
215
212
  __decorateClass([
@@ -12,9 +12,13 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  import {
13
13
  ProfileMutationUpdateSchema,
14
14
  ProfileProvider,
15
- ProfileQuerySelfSchema,
16
15
  ProfileSchema,
17
- Reactionary
16
+ Reactionary,
17
+ success,
18
+ error,
19
+ ProfileMutationSetBillingAddressSchema,
20
+ ProfileMutationRemoveShippingAddressSchema,
21
+ ProfileMutationAddShippingAddressSchema
18
22
  } from "@reactionary/core";
19
23
  class CommercetoolsProfileProvider extends ProfileProvider {
20
24
  constructor(config, cache, context, client) {
@@ -26,46 +30,345 @@ class CommercetoolsProfileProvider extends ProfileProvider {
26
30
  const client = await this.client.getClient();
27
31
  return client.withProjectKey({ projectKey: this.config.projectKey });
28
32
  }
29
- async getSelf(payload) {
33
+ async getById(payload) {
30
34
  const client = await this.getClient();
31
35
  const remote = await client.me().get().execute();
36
+ if (remote.body.id !== payload.identifier.userId) {
37
+ return error({
38
+ type: "NotFound",
39
+ identifier: payload.identifier
40
+ });
41
+ }
32
42
  const model = this.parseSingle(remote.body);
33
- return model;
43
+ return success(model);
44
+ }
45
+ async addShippingAddress(payload) {
46
+ const client = await this.getClient();
47
+ const remote = await client.me().get().execute();
48
+ let customer = remote.body;
49
+ if (customer.id !== payload.identifier.userId) {
50
+ return error({
51
+ type: "NotFound",
52
+ identifier: payload.identifier
53
+ });
54
+ }
55
+ const updateResponse = await client.me().post({
56
+ body: {
57
+ version: customer.version,
58
+ actions: [
59
+ {
60
+ action: "addAddress",
61
+ address: this.createCTAddressDraft(payload.address)
62
+ }
63
+ ]
64
+ }
65
+ }).execute();
66
+ customer = updateResponse.body;
67
+ const model = this.parseSingle(customer);
68
+ return success(model);
69
+ }
70
+ async updateShippingAddress(payload) {
71
+ const client = await this.getClient();
72
+ const remote = await client.me().get().execute();
73
+ let customer = remote.body;
74
+ if (customer.id !== payload.identifier.userId) {
75
+ return error({
76
+ type: "NotFound",
77
+ identifier: payload.identifier
78
+ });
79
+ }
80
+ const targetAddress = customer.addresses.find((addr) => addr.key === payload.address.identifier.nickName);
81
+ if (!targetAddress) {
82
+ return error({
83
+ type: "NotFound",
84
+ identifier: payload.identifier
85
+ });
86
+ }
87
+ const updateResponse = await client.me().post({
88
+ body: {
89
+ version: customer.version,
90
+ actions: [
91
+ {
92
+ action: "changeAddress",
93
+ addressId: targetAddress.id,
94
+ address: this.createCTAddressDraft(payload.address)
95
+ }
96
+ ]
97
+ }
98
+ }).execute();
99
+ customer = updateResponse.body;
100
+ const model = this.parseSingle(customer);
101
+ return success(model);
102
+ }
103
+ async removeShippingAddress(payload) {
104
+ const client = await this.getClient();
105
+ const remote = await client.me().get().execute();
106
+ let customer = remote.body;
107
+ if (customer.id !== payload.identifier.userId) {
108
+ return error({
109
+ type: "NotFound",
110
+ identifier: payload.identifier
111
+ });
112
+ }
113
+ const updateActions = [];
114
+ const addressToRemove = customer.addresses.find((addr) => addr.key === payload.addressIdentifier.nickName);
115
+ if (addressToRemove) {
116
+ updateActions.push({
117
+ action: "removeAddress",
118
+ addressId: addressToRemove.id
119
+ });
120
+ } else {
121
+ return error({
122
+ type: "NotFound",
123
+ identifier: payload.identifier
124
+ });
125
+ }
126
+ const needsNewDefaultShippingAddress = addressToRemove && customer.defaultShippingAddressId === addressToRemove.id;
127
+ if (needsNewDefaultShippingAddress) {
128
+ const newDefaultAddress = customer.addresses.find((addr) => addr.id !== addressToRemove.id && addr.id !== customer.defaultBillingAddressId);
129
+ if (newDefaultAddress) {
130
+ updateActions.push({
131
+ action: "setDefaultShippingAddress",
132
+ addressKey: newDefaultAddress.key
133
+ });
134
+ }
135
+ }
136
+ const updateResponse = await client.me().post({
137
+ body: {
138
+ version: customer.version,
139
+ actions: updateActions
140
+ }
141
+ }).execute();
142
+ customer = updateResponse.body;
143
+ const model = this.parseSingle(customer);
144
+ return success(model);
145
+ }
146
+ async makeShippingAddressDefault(payload) {
147
+ const client = await this.getClient();
148
+ const remote = await client.me().get().execute();
149
+ let customer = remote.body;
150
+ if (customer.id !== payload.identifier.userId) {
151
+ return error({
152
+ type: "NotFound",
153
+ identifier: payload.identifier
154
+ });
155
+ }
156
+ const addressToMakeDefault = customer.addresses.find((addr) => addr.key === payload.addressIdentifier.nickName);
157
+ if (!addressToMakeDefault) {
158
+ return error({
159
+ type: "NotFound",
160
+ identifier: payload.identifier
161
+ });
162
+ }
163
+ if (addressToMakeDefault.id === customer.defaultBillingAddressId) {
164
+ return error({
165
+ type: "InvalidInput",
166
+ error: {
167
+ field: "addressIdentifier",
168
+ message: "Cannot set shipping address as default billing address"
169
+ }
170
+ });
171
+ }
172
+ const updateResponse = await client.me().post({
173
+ body: {
174
+ version: customer.version,
175
+ actions: [
176
+ {
177
+ action: "setDefaultShippingAddress",
178
+ addressKey: addressToMakeDefault.key
179
+ }
180
+ ]
181
+ }
182
+ }).execute();
183
+ customer = updateResponse.body;
184
+ const model = this.parseSingle(customer);
185
+ return success(model);
186
+ }
187
+ async setBillingAddress(payload) {
188
+ const client = await this.getClient();
189
+ const remote = await client.me().get().execute();
190
+ let customer = remote.body;
191
+ if (customer.id !== payload.identifier.userId) {
192
+ return error({
193
+ type: "NotFound",
194
+ identifier: payload.identifier
195
+ });
196
+ }
197
+ const updateActions = [];
198
+ const mainAddress = customer.defaultBillingAddressId ? customer.addresses.find((addr) => addr.id === customer.defaultBillingAddressId) : null;
199
+ if (!mainAddress) {
200
+ const newAddress = this.createCTAddressDraft(payload.address);
201
+ updateActions.push({
202
+ action: "addAddress",
203
+ address: newAddress
204
+ });
205
+ updateActions.push({
206
+ action: "setDefaultBillingAddress",
207
+ addressKey: newAddress.key
208
+ });
209
+ } else {
210
+ updateActions.push({
211
+ action: "changeAddress",
212
+ addressId: mainAddress.id,
213
+ address: this.createCTAddressDraft(payload.address)
214
+ });
215
+ }
216
+ if (updateActions.length > 0) {
217
+ const updateResponse = await client.me().post({
218
+ body: {
219
+ version: customer.version,
220
+ actions: updateActions
221
+ }
222
+ }).execute();
223
+ customer = updateResponse.body;
224
+ }
225
+ const model = this.parseSingle(customer);
226
+ return success(model);
34
227
  }
35
228
  async update(payload) {
36
- throw new Error("Method not implemented.");
229
+ const client = await this.getClient();
230
+ const remote = await client.me().get().execute();
231
+ let customer = remote.body;
232
+ if (customer.id !== payload.identifier.userId) {
233
+ return error({
234
+ type: "NotFound",
235
+ identifier: payload.identifier
236
+ });
237
+ }
238
+ const updateActions = [];
239
+ if (payload.email !== void 0) {
240
+ updateActions.push({
241
+ action: "changeEmail",
242
+ email: payload.email
243
+ });
244
+ }
245
+ const mainAddress = customer.defaultBillingAddressId ? customer.addresses.find((addr) => addr.id === customer.defaultBillingAddressId) : null;
246
+ if (!mainAddress) {
247
+ updateActions.push({
248
+ action: "addAddress",
249
+ address: {
250
+ key: `billing-address-${customer.id}`,
251
+ email: payload.email || customer.email,
252
+ phone: payload.phone,
253
+ country: this.context.taxJurisdiction.countryCode
254
+ }
255
+ });
256
+ updateActions.push({
257
+ action: "setDefaultBillingAddress",
258
+ addressKey: `billing-address-${customer.id}`
259
+ });
260
+ } else {
261
+ updateActions.push({
262
+ action: "changeAddress",
263
+ addressId: mainAddress.id,
264
+ address: {
265
+ ...mainAddress,
266
+ email: payload.email || customer.email,
267
+ phone: payload.phone
268
+ }
269
+ });
270
+ }
271
+ if (updateActions.length > 0) {
272
+ const updateResponse = await client.me().post({
273
+ body: {
274
+ version: customer.version,
275
+ actions: updateActions
276
+ }
277
+ }).execute();
278
+ customer = updateResponse.body;
279
+ }
280
+ const model = this.parseSingle(customer);
281
+ return success(model);
282
+ }
283
+ parseAddress(address) {
284
+ const result = {
285
+ identifier: {
286
+ nickName: address.key || ""
287
+ },
288
+ firstName: address.firstName || "",
289
+ lastName: address.lastName || "",
290
+ streetAddress: address.streetName || "",
291
+ streetNumber: address.streetNumber || "",
292
+ city: address.city || "",
293
+ region: address.region || "",
294
+ postalCode: address.postalCode || "",
295
+ countryCode: address.country
296
+ };
297
+ return result;
37
298
  }
38
299
  parseSingle(body) {
39
300
  const email = body.email;
40
301
  const emailVerified = body.isEmailVerified;
302
+ let defaultCTBillingAddress = body.addresses.find((addr) => addr.id === body.defaultBillingAddressId);
303
+ const phone = defaultCTBillingAddress?.phone ?? "";
304
+ if (this.isIncompleteAddress(defaultCTBillingAddress)) {
305
+ defaultCTBillingAddress = void 0;
306
+ }
307
+ const defaultCTShippingAddress = body.addresses.find((addr) => addr.id === body.defaultShippingAddressId);
308
+ const alternateShippingAddresses = body.addresses.filter((x) => x.id !== body.defaultBillingAddressId && x.id !== body.defaultShippingAddressId).map((addr) => this.parseAddress(addr));
309
+ const billingAddress = defaultCTBillingAddress ? this.parseAddress(defaultCTBillingAddress) : void 0;
310
+ const shippingAddress = defaultCTShippingAddress ? this.parseAddress(defaultCTShippingAddress) : void 0;
41
311
  const result = {
42
312
  identifier: {
43
- userId: ""
313
+ userId: body.id
44
314
  },
45
315
  email,
46
316
  emailVerified,
47
- alternateShippingAddresses: [],
48
- createdAt: "",
49
- meta: {
50
- cache: {
51
- hit: false,
52
- key: ""
53
- },
54
- placeholder: false
55
- },
56
- phone: "",
317
+ alternateShippingAddresses,
318
+ billingAddress,
319
+ shippingAddress,
320
+ createdAt: body.createdAt,
321
+ phone,
57
322
  phoneVerified: false,
58
- updatedAt: ""
323
+ updatedAt: body.lastModifiedAt
59
324
  };
60
325
  return result;
61
326
  }
327
+ createCTAddressDraft(address) {
328
+ return {
329
+ key: address.identifier.nickName,
330
+ firstName: address.firstName,
331
+ lastName: address.lastName,
332
+ streetName: address.streetAddress,
333
+ streetNumber: address.streetNumber,
334
+ postalCode: address.postalCode,
335
+ city: address.city,
336
+ region: address.region,
337
+ country: address.countryCode || this.context.taxJurisdiction.countryCode
338
+ };
339
+ }
340
+ /**
341
+ * Checks if an address only contains phone information and lacks essential address fields.
342
+ * An address is considered incomplete if it exists but has no firstName, lastName, streetName,
343
+ * streetNumber, or city.
344
+ * @param address - The address to check, or undefined
345
+ * @returns true if the address exists but lacks essential fields, false otherwise (including when address is undefined)
346
+ */
347
+ isIncompleteAddress(address) {
348
+ if (!address) {
349
+ return false;
350
+ }
351
+ return !address.firstName && !address.lastName && !address.streetName && !address.streetNumber && !address.city;
352
+ }
62
353
  }
63
354
  __decorateClass([
64
355
  Reactionary({
65
- inputSchema: ProfileQuerySelfSchema,
356
+ inputSchema: ProfileMutationAddShippingAddressSchema,
357
+ outputSchema: ProfileSchema
358
+ })
359
+ ], CommercetoolsProfileProvider.prototype, "addShippingAddress", 1);
360
+ __decorateClass([
361
+ Reactionary({
362
+ inputSchema: ProfileMutationRemoveShippingAddressSchema,
363
+ outputSchema: ProfileSchema
364
+ })
365
+ ], CommercetoolsProfileProvider.prototype, "removeShippingAddress", 1);
366
+ __decorateClass([
367
+ Reactionary({
368
+ inputSchema: ProfileMutationSetBillingAddressSchema,
66
369
  outputSchema: ProfileSchema
67
370
  })
68
- ], CommercetoolsProfileProvider.prototype, "getSelf", 1);
371
+ ], CommercetoolsProfileProvider.prototype, "setBillingAddress", 1);
69
372
  __decorateClass([
70
373
  Reactionary({
71
374
  inputSchema: ProfileMutationUpdateSchema,
@@ -9,7 +9,7 @@ var __decorateClass = (decorators, target, key, kind) => {
9
9
  __defProp(target, key, result);
10
10
  return result;
11
11
  };
12
- import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema } from "@reactionary/core";
12
+ import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema, success, error } from "@reactionary/core";
13
13
  import z from "zod";
14
14
  class CommercetoolsStoreProvider extends StoreProvider {
15
15
  constructor(config, cache, context, client) {
@@ -33,7 +33,7 @@ class CommercetoolsStoreProvider extends StoreProvider {
33
33
  for (const r of remote.body.results) {
34
34
  results.push(this.parseSingle(r));
35
35
  }
36
- return results;
36
+ return success(results);
37
37
  }
38
38
  parseSingle(body) {
39
39
  let name = "";
@@ -46,18 +46,10 @@ class CommercetoolsStoreProvider extends StoreProvider {
46
46
  const fulfillmentCenter = {
47
47
  key: body.key
48
48
  };
49
- const meta = {
50
- cache: {
51
- hit: false,
52
- key: ""
53
- },
54
- placeholder: false
55
- };
56
49
  const result = {
57
50
  identifier,
58
51
  fulfillmentCenter,
59
- name,
60
- meta
52
+ name
61
53
  };
62
54
  return result;
63
55
  }