@doswiftly/storefront-operations 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @doswiftly/storefront-operations
3
+ *
4
+ * This package contains only GraphQL operation files (.graphql).
5
+ * Import them directly in your codegen configuration:
6
+ *
7
+ * documents: [
8
+ * 'node_modules/@doswiftly/storefront-operations/**\/*.graphql',
9
+ * ]
10
+ */
11
+
12
+ module.exports = {
13
+ // This package is meant to be consumed by GraphQL codegen
14
+ // The actual operations are in .graphql files
15
+ };
@@ -0,0 +1,433 @@
1
+ # ============================================
2
+ # DoSwiftly Storefront API - Mutations
3
+ # SSOT: Backend defines all mutation operations
4
+ # ============================================
5
+
6
+ # ============================================
7
+ # Cart Mutations
8
+ # ============================================
9
+
10
+ mutation CartCreate($input: CartCreateInput) {
11
+ cartCreate(input: $input) {
12
+ cart {
13
+ ...Cart
14
+ }
15
+ userErrors {
16
+ ...UserError
17
+ }
18
+ }
19
+ }
20
+
21
+ mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
22
+ cartLinesAdd(cartId: $cartId, lines: $lines) {
23
+ cart {
24
+ ...Cart
25
+ }
26
+ userErrors {
27
+ ...UserError
28
+ }
29
+ }
30
+ }
31
+
32
+ mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
33
+ cartLinesUpdate(cartId: $cartId, lines: $lines) {
34
+ cart {
35
+ ...Cart
36
+ }
37
+ userErrors {
38
+ ...UserError
39
+ }
40
+ }
41
+ }
42
+
43
+ mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {
44
+ cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
45
+ cart {
46
+ ...Cart
47
+ }
48
+ userErrors {
49
+ ...UserError
50
+ }
51
+ }
52
+ }
53
+
54
+ mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
55
+ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
56
+ cart {
57
+ ...Cart
58
+ }
59
+ userErrors {
60
+ ...UserError
61
+ }
62
+ }
63
+ }
64
+
65
+ mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
66
+ cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
67
+ cart {
68
+ ...Cart
69
+ }
70
+ userErrors {
71
+ ...UserError
72
+ }
73
+ }
74
+ }
75
+
76
+ mutation CartNoteUpdate($cartId: ID!, $note: String!) {
77
+ cartNoteUpdate(cartId: $cartId, note: $note) {
78
+ cart {
79
+ ...Cart
80
+ }
81
+ userErrors {
82
+ ...UserError
83
+ }
84
+ }
85
+ }
86
+
87
+ # ============================================
88
+ # Customer Auth Mutations
89
+ # ============================================
90
+
91
+ mutation CustomerCreate($input: CustomerCreateInput!) {
92
+ customerCreate(input: $input) {
93
+ customer {
94
+ ...Customer
95
+ }
96
+ customerAccessToken {
97
+ ...CustomerAccessToken
98
+ }
99
+ userErrors {
100
+ ...UserError
101
+ }
102
+ }
103
+ }
104
+
105
+ mutation CustomerLogin($input: CustomerAccessTokenCreateInput!) {
106
+ customerAccessTokenCreate(input: $input) {
107
+ customerAccessToken {
108
+ ...CustomerAccessToken
109
+ }
110
+ userErrors {
111
+ ...UserError
112
+ }
113
+ }
114
+ }
115
+
116
+ mutation CustomerLogout($customerAccessToken: String!) {
117
+ customerAccessTokenDelete(customerAccessToken: $customerAccessToken) {
118
+ deletedAccessToken
119
+ deletedCustomerAccessTokenId
120
+ userErrors {
121
+ ...UserError
122
+ }
123
+ }
124
+ }
125
+
126
+ mutation CustomerTokenRenew($customerAccessToken: String!) {
127
+ customerAccessTokenRenew(customerAccessToken: $customerAccessToken) {
128
+ customerAccessToken {
129
+ ...CustomerAccessToken
130
+ }
131
+ userErrors {
132
+ ...UserError
133
+ }
134
+ }
135
+ }
136
+
137
+ # ============================================
138
+ # Customer Profile Mutations
139
+ # ============================================
140
+
141
+ mutation CustomerUpdate($customer: CustomerUpdateInput!, $customerAccessToken: String!) {
142
+ customerUpdate(customer: $customer, customerAccessToken: $customerAccessToken) {
143
+ customer {
144
+ ...Customer
145
+ }
146
+ userErrors {
147
+ ...UserError
148
+ }
149
+ }
150
+ }
151
+
152
+ # ============================================
153
+ # Customer Address Mutations
154
+ # ============================================
155
+
156
+ mutation CustomerAddressCreate($address: MailingAddressInput!, $customerAccessToken: String!) {
157
+ customerAddressCreate(address: $address, customerAccessToken: $customerAccessToken) {
158
+ address {
159
+ ...MailingAddress
160
+ }
161
+ userErrors {
162
+ ...UserError
163
+ }
164
+ }
165
+ }
166
+
167
+ mutation CustomerAddressUpdate($id: ID!, $address: MailingAddressInput!, $customerAccessToken: String!) {
168
+ customerAddressUpdate(id: $id, address: $address, customerAccessToken: $customerAccessToken) {
169
+ address {
170
+ ...MailingAddress
171
+ }
172
+ userErrors {
173
+ ...UserError
174
+ }
175
+ }
176
+ }
177
+
178
+ mutation CustomerAddressDelete($id: ID!, $customerAccessToken: String!) {
179
+ customerAddressDelete(id: $id, customerAccessToken: $customerAccessToken) {
180
+ deletedAddressId
181
+ userErrors {
182
+ ...UserError
183
+ }
184
+ }
185
+ }
186
+
187
+ mutation CustomerDefaultAddressUpdate($addressId: ID!, $customerAccessToken: String!) {
188
+ customerDefaultAddressUpdate(addressId: $addressId, customerAccessToken: $customerAccessToken) {
189
+ customer {
190
+ ...Customer
191
+ }
192
+ userErrors {
193
+ ...UserError
194
+ }
195
+ }
196
+ }
197
+
198
+ # ============================================
199
+ # Customer Password Mutations
200
+ # ============================================
201
+
202
+ mutation CustomerPasswordRecover($email: String!) {
203
+ customerRecover(email: $email) {
204
+ userErrors {
205
+ ...UserError
206
+ }
207
+ }
208
+ }
209
+
210
+ mutation CustomerPasswordReset($id: ID!, $input: String!, $password: String!) {
211
+ customerReset(id: $id, input: $input, password: $password) {
212
+ customer {
213
+ ...Customer
214
+ }
215
+ customerAccessToken {
216
+ ...CustomerAccessToken
217
+ }
218
+ userErrors {
219
+ ...UserError
220
+ }
221
+ }
222
+ }
223
+
224
+ # ============================================
225
+ # Checkout Mutations
226
+ # ============================================
227
+
228
+ mutation CheckoutCreate($input: CheckoutCreateInput!) {
229
+ checkoutCreate(input: $input) {
230
+ checkout {
231
+ ...Checkout
232
+ }
233
+ userErrors {
234
+ ...CheckoutUserError
235
+ }
236
+ }
237
+ }
238
+
239
+ mutation CheckoutShippingAddressUpdate($checkoutId: ID!, $shippingAddress: CheckoutAddressInput!) {
240
+ checkoutShippingAddressUpdate(checkoutId: $checkoutId, shippingAddress: $shippingAddress) {
241
+ checkout {
242
+ ...Checkout
243
+ }
244
+ userErrors {
245
+ ...CheckoutUserError
246
+ }
247
+ }
248
+ }
249
+
250
+ mutation CheckoutBillingAddressUpdate($checkoutId: ID!, $billingAddress: CheckoutAddressInput!) {
251
+ checkoutBillingAddressUpdate(checkoutId: $checkoutId, billingAddress: $billingAddress) {
252
+ checkout {
253
+ ...Checkout
254
+ }
255
+ userErrors {
256
+ ...CheckoutUserError
257
+ }
258
+ }
259
+ }
260
+
261
+ mutation CheckoutEmailUpdate($checkoutId: ID!, $email: String!) {
262
+ checkoutEmailUpdate(checkoutId: $checkoutId, email: $email) {
263
+ checkout {
264
+ ...Checkout
265
+ }
266
+ userErrors {
267
+ ...CheckoutUserError
268
+ }
269
+ }
270
+ }
271
+
272
+ mutation CheckoutShippingLineUpdate($checkoutId: ID!, $shippingRateHandle: String!) {
273
+ checkoutShippingLineUpdate(checkoutId: $checkoutId, shippingRateHandle: $shippingRateHandle) {
274
+ checkout {
275
+ ...Checkout
276
+ }
277
+ userErrors {
278
+ ...CheckoutUserError
279
+ }
280
+ }
281
+ }
282
+
283
+ mutation CheckoutDiscountCodeApply($checkoutId: ID!, $discountCode: String!) {
284
+ checkoutDiscountCodeApply(checkoutId: $checkoutId, discountCode: $discountCode) {
285
+ checkout {
286
+ ...Checkout
287
+ }
288
+ userErrors {
289
+ ...CheckoutUserError
290
+ }
291
+ }
292
+ }
293
+
294
+ mutation CheckoutDiscountCodeRemove($checkoutId: ID!, $discountCode: String!) {
295
+ checkoutDiscountCodeRemove(checkoutId: $checkoutId, discountCode: $discountCode) {
296
+ checkout {
297
+ ...Checkout
298
+ }
299
+ userErrors {
300
+ ...CheckoutUserError
301
+ }
302
+ }
303
+ }
304
+
305
+ mutation CheckoutDiscountCodeValidate($checkoutId: ID!, $discountCode: String!) {
306
+ checkoutDiscountCodeValidate(checkoutId: $checkoutId, discountCode: $discountCode) {
307
+ result {
308
+ valid
309
+ discount {
310
+ code
311
+ title
312
+ type
313
+ value
314
+ discountAmount {
315
+ amount
316
+ currencyCode
317
+ }
318
+ }
319
+ error {
320
+ code
321
+ message
322
+ }
323
+ }
324
+ userErrors {
325
+ ...CheckoutUserError
326
+ }
327
+ }
328
+ }
329
+
330
+ mutation CheckoutPaymentMethodUpdate($checkoutId: ID!, $paymentMethodId: ID!) {
331
+ checkoutPaymentMethodUpdate(checkoutId: $checkoutId, paymentMethodId: $paymentMethodId) {
332
+ checkout {
333
+ ...Checkout
334
+ }
335
+ userErrors {
336
+ ...CheckoutUserError
337
+ }
338
+ }
339
+ }
340
+
341
+ mutation CheckoutComplete($checkoutId: ID!, $input: CheckoutCompleteInput) {
342
+ checkoutComplete(checkoutId: $checkoutId, input: $input) {
343
+ checkout {
344
+ ...Checkout
345
+ }
346
+ order {
347
+ ...Order
348
+ }
349
+ paymentUrl
350
+ userErrors {
351
+ ...CheckoutUserError
352
+ }
353
+ }
354
+ }
355
+
356
+ # ============================================
357
+ # Gift Card Checkout Mutations (GAP-001)
358
+ # ============================================
359
+
360
+ mutation CheckoutGiftCardApply($checkoutId: ID!, $giftCardCode: String!) {
361
+ checkoutGiftCardApply(checkoutId: $checkoutId, giftCardCode: $giftCardCode) {
362
+ checkout {
363
+ ...Checkout
364
+ }
365
+ userErrors {
366
+ ...CheckoutUserError
367
+ }
368
+ }
369
+ }
370
+
371
+ mutation CheckoutGiftCardRemove($checkoutId: ID!, $giftCardCode: String!) {
372
+ checkoutGiftCardRemove(checkoutId: $checkoutId, giftCardCode: $giftCardCode) {
373
+ checkout {
374
+ ...Checkout
375
+ }
376
+ userErrors {
377
+ ...CheckoutUserError
378
+ }
379
+ }
380
+ }
381
+
382
+ mutation CheckoutGiftCardRecipientUpdate($input: CheckoutGiftCardRecipientInput!) {
383
+ checkoutGiftCardRecipientUpdate(input: $input) {
384
+ checkout {
385
+ ...Checkout
386
+ }
387
+ userErrors {
388
+ ...CheckoutUserError
389
+ }
390
+ }
391
+ }
392
+
393
+ # ============================================
394
+ # Return Mutations (R30 - Returns/RMA)
395
+ # ============================================
396
+
397
+ mutation ReturnCreate($input: ReturnCreateInput!, $customerAccessToken: String!) {
398
+ returnCreate(input: $input, customerAccessToken: $customerAccessToken) {
399
+ return {
400
+ ...Return
401
+ }
402
+ userErrors {
403
+ ...UserError
404
+ }
405
+ }
406
+ }
407
+
408
+ mutation ReturnCancel($id: ID!, $customerAccessToken: String!) {
409
+ returnCancel(id: $id, customerAccessToken: $customerAccessToken) {
410
+ return {
411
+ ...Return
412
+ }
413
+ userErrors {
414
+ ...UserError
415
+ }
416
+ }
417
+ }
418
+
419
+ # ============================================
420
+ # Loyalty Program Mutations (R8, R10.4)
421
+ # ============================================
422
+
423
+ mutation RedeemLoyaltyReward($input: RedeemRewardInput!) {
424
+ redeemLoyaltyReward(input: $input) {
425
+ ...RedeemRewardPayload
426
+ }
427
+ }
428
+
429
+ mutation GenerateReferralCode {
430
+ generateReferralCode {
431
+ ...GenerateReferralCodePayload
432
+ }
433
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@doswiftly/storefront-operations",
3
+ "version": "1.0.5",
4
+ "description": "GraphQL operations for DoSwiftly Storefront - SSOT from backend",
5
+ "homepage": "https://doswiftly.pl",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "main": "index.js",
10
+ "exports": {
11
+ "./queries.graphql": "./queries.graphql",
12
+ "./mutations.graphql": "./mutations.graphql",
13
+ "./fragments.graphql": "./fragments.graphql",
14
+ "./*.graphql": "./*.graphql"
15
+ },
16
+ "scripts": {
17
+ "sync": "node scripts/sync-operations.js",
18
+ "build": "npm run sync"
19
+ },
20
+ "keywords": [
21
+ "graphql",
22
+ "operations",
23
+ "storefront",
24
+ "ecommerce",
25
+ "codegen"
26
+ ],
27
+ "author": "DoSwiftly Team",
28
+ "license": "MIT",
29
+ "files": [
30
+ "queries.graphql",
31
+ "mutations.graphql",
32
+ "fragments.graphql",
33
+ "README.md"
34
+ ]
35
+ }