@pvh-afl/graphql 1.1.46 → 1.1.47

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.
@@ -1,3 +1,4 @@
1
+ import { AuthUser } from '@pvh-afl/core';
1
2
  import { CustomerService } from './customer.service';
2
3
  import { Customer, CustomerLoginResult, CustomerUpdateInput } from './customer.types';
3
4
  interface GqlContext {
@@ -11,7 +12,7 @@ export declare class CustomerResolver {
11
12
  constructor(customerService: CustomerService);
12
13
  customer(ctx: GqlContext, customerAccessToken: string): Promise<Customer | null>;
13
14
  customerLogin(ctx: GqlContext, email: string, password: string): Promise<CustomerLoginResult>;
14
- customerUpdate(ctx: GqlContext, customerAccessToken: string, input: CustomerUpdateInput): Promise<Customer>;
15
+ customerUpdate(ctx: GqlContext, user: AuthUser, input: CustomerUpdateInput): Promise<Customer>;
15
16
  }
16
17
  export {};
17
18
  //# sourceMappingURL=customer.resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customer.resolver.d.ts","sourceRoot":"","sources":["../../src/customer/customer.resolver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEtF,UAAU,UAAU;IAClB,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBACa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAavD,QAAQ,CACD,GAAG,EAAE,UAAU,EAK1B,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAkBrB,aAAa,CACN,GAAG,EAAE,UAAU,EAE1B,KAAK,EAAE,MAAM,EAEb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAkBzB,cAAc,CACP,GAAG,EAAE,UAAU,EAK1B,mBAAmB,EAAE,MAAM,EAK3B,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC;CAIrB"}
1
+ {"version":3,"file":"customer.resolver.d.ts","sourceRoot":"","sources":["../../src/customer/customer.resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEtF,UAAU,UAAU;IAClB,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBACa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAavD,QAAQ,CACD,GAAG,EAAE,UAAU,EAK1B,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAkBrB,aAAa,CACN,GAAG,EAAE,UAAU,EAE1B,KAAK,EAAE,MAAM,EAEb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAmBzB,cAAc,CACP,GAAG,EAAE,UAAU,EACX,IAAI,EAAE,QAAQ,EAK7B,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC;CAIrB"}
@@ -20,9 +20,9 @@ let CustomerResolver = class CustomerResolver {
20
20
  const brand = ctx.brand ?? ctx.req.brand;
21
21
  return this.customerService.login(brand, email, password);
22
22
  }
23
- async customerUpdate(ctx, customerAccessToken, input) {
23
+ async customerUpdate(ctx, user, input) {
24
24
  const brand = ctx.brand ?? ctx.req.brand;
25
- return this.customerService.updateProfile(brand, customerAccessToken, input);
25
+ return this.customerService.updateProfile(brand, user.customerId, input);
26
26
  }
27
27
  };
28
28
  exports.CustomerResolver = CustomerResolver;
@@ -72,27 +72,25 @@ tslib_1.__decorate([
72
72
  (0, graphql_1.Mutation)(() => customer_types_1.Customer, {
73
73
  description: `Update the logged-in customer's profile (firstName, lastName, gender, birthDate).
74
74
 
75
- The customer is identified by their Storefront customerAccessToken (from
76
- customerLogin) this proves account ownership. Only the fields provided in
77
- input are updated; omitted fields are left unchanged. firstName / lastName are
78
- written as native Shopify customer fields; gender / birthDate are written to the
79
- facts.gender / facts.birth_date customer metafields all via the Shopify Admin
80
- API in a single mutation.
75
+ Authentication: send the customer's first-party access token as an
76
+ \`Authorization: Bearer <jwt>\` header. The customer is identified from the
77
+ verified token (never from the request body), so a caller can only ever update
78
+ their own account. Only the fields provided in input are updated; omitted fields
79
+ are left unchanged. firstName / lastName are written as native Shopify customer
80
+ fields; gender / birthDate are written to the facts.gender / facts.birth_date
81
+ customer metafields — all via the Shopify Admin API in a single mutation.
81
82
 
82
83
  Returns the updated customer.`,
83
84
  }),
84
- (0, common_1.UseGuards)(core_1.TenantGuard),
85
+ (0, common_1.UseGuards)(core_1.TenantGuard, core_1.JwtAuthGuard),
85
86
  tslib_1.__param(0, (0, graphql_1.Context)()),
86
- tslib_1.__param(1, (0, graphql_1.Args)('customerAccessToken', {
87
- type: () => String,
88
- description: 'Storefront customer access token from customerLogin',
89
- })),
87
+ tslib_1.__param(1, (0, core_1.CurrentUser)()),
90
88
  tslib_1.__param(2, (0, graphql_1.Args)('input', {
91
89
  type: () => customer_types_1.CustomerUpdateInput,
92
90
  description: 'Profile fields to update',
93
91
  })),
94
92
  tslib_1.__metadata("design:type", Function),
95
- tslib_1.__metadata("design:paramtypes", [Object, String, customer_types_1.CustomerUpdateInput]),
93
+ tslib_1.__metadata("design:paramtypes", [Object, Object, customer_types_1.CustomerUpdateInput]),
96
94
  tslib_1.__metadata("design:returntype", Promise)
97
95
  ], CustomerResolver.prototype, "customerUpdate", null);
98
96
  exports.CustomerResolver = CustomerResolver = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"customer.resolver.js","sourceRoot":"","sources":["../../src/customer/customer.resolver.ts"],"names":[],"mappings":";;;;AAAA,6CAA2E;AAC3E,2CAA2C;AAC3C,wCAA4C;AAC5C,yDAAqD;AACrD,qDAAsF;AAQ/E,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACE;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAa3D,AAAN,KAAK,CAAC,QAAQ,CACD,GAAe,EAK1B,mBAA2B;QAE3B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACrE,CAAC;IAeK,AAAN,KAAK,CAAC,aAAa,CACN,GAAe,EAE1B,KAAa,EAEb,QAAgB;QAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAeK,AAAN,KAAK,CAAC,cAAc,CACP,GAAe,EAK1B,mBAA2B,EAK3B,KAA0B;QAE1B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC/E,CAAC;CACF,CAAA;AA/EY,4CAAgB;AAcrB;IAXL,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,yBAAQ,EAAE;QACrB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE;;;;;;2DAM0C;KACxD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37
37
  /**
38
- * Update the logged-in customer's profile "facts" (gender, birth_date).
38
+ * Update the logged-in customer's profile (firstName, lastName, gender,
39
+ * birth_date).
39
40
  *
40
- * The customer is identified by their Storefront access token: we resolve the
41
- * token to a customer (proving ownership) and then write the metafields via
42
- * the Admin API. Returns the updated customer.
41
+ * The customer is identified by the `customerId` from their verified
42
+ * first-party JWT (resolved by JwtAuthGuard, never from client input), so
43
+ * ownership is implicit: a caller can only ever update their own account and
44
+ * CustomerUpdateInput carries no customer id. We write native fields and the
45
+ * facts metafields via the Admin API, then re-read the persisted state.
43
46
  */
44
- updateProfile(brand: string, customerAccessToken: string, input: CustomerUpdateInput): Promise<Customer>;
47
+ updateProfile(brand: string, customerId: string, input: CustomerUpdateInput): Promise<Customer>;
45
48
  }
46
49
  //# sourceMappingURL=customer.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customer.service.d.ts","sourceRoot":"","sources":["../../src/customer/customer.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,qBACa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,mBAAmB;IAGpD,OAAO,CAAC,kBAAkB;IAQ1B;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAalB;;;;;;;;OAQG;IACG,KAAK,CACT,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAsC/B;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAkB3B;;;;;;OAMG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,MAAM,EAC3B,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC;CAqCrB"}
1
+ {"version":3,"file":"customer.service.d.ts","sourceRoot":"","sources":["../../src/customer/customer.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAGlB,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,qBACa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,mBAAmB;IAGpD,OAAO,CAAC,kBAAkB;IAQ1B;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAalB;;;;;;;;OAQG;IACG,KAAK,CACT,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IAsC/B;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAkB3B;;;;;;;;;OASG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC;CAgCrB"}
@@ -105,21 +105,17 @@ let CustomerService = class CustomerService {
105
105
  return this.toCustomer(customer, facts);
106
106
  }
107
107
  /**
108
- * Update the logged-in customer's profile "facts" (gender, birth_date).
108
+ * Update the logged-in customer's profile (firstName, lastName, gender,
109
+ * birth_date).
109
110
  *
110
- * The customer is identified by their Storefront access token: we resolve the
111
- * token to a customer (proving ownership) and then write the metafields via
112
- * the Admin API. Returns the updated customer.
111
+ * The customer is identified by the `customerId` from their verified
112
+ * first-party JWT (resolved by JwtAuthGuard, never from client input), so
113
+ * ownership is implicit: a caller can only ever update their own account and
114
+ * CustomerUpdateInput carries no customer id. We write native fields and the
115
+ * facts metafields via the Admin API, then re-read the persisted state.
113
116
  */
114
- async updateProfile(brand, customerAccessToken, input) {
115
- const commerce = this.getCommerceService(brand);
116
- // Resolve the token to a customer — this proves the caller owns the account.
117
- const customerResult = await commerce.getCustomer(customerAccessToken);
118
- if (!customerResult.success || !customerResult.data) {
119
- throw new Error(customerResult.error?.message ?? 'Invalid or expired customer access token');
120
- }
121
- const customer = customerResult.data;
122
- const updateResult = await this.adminService.updateCustomer(brand, customer.id, {
117
+ async updateProfile(brand, customerId, input) {
118
+ const updateResult = await this.adminService.updateCustomer(brand, customerId, {
123
119
  firstName: input.firstName,
124
120
  lastName: input.lastName,
125
121
  gender: input.gender,
@@ -128,15 +124,23 @@ let CustomerService = class CustomerService {
128
124
  if (!updateResult.success) {
129
125
  throw new Error(updateResult.error ?? 'Failed to update customer profile');
130
126
  }
131
- // Re-read the persisted state so the response is authoritative: names and
132
- // the Shopify-derived displayName from Storefront, facts from Admin. Falls
133
- // back to the pre-update customer if the refetch fails.
127
+ // Re-read the persisted state so the response is authoritative: native
128
+ // fields + Shopify-derived displayName and the facts metafields, both via
129
+ // the Admin API (there is no Storefront token in the JWT flow). Fall back to
130
+ // the submitted input if the profile refetch fails.
134
131
  const [refreshed, updatedFacts] = await Promise.all([
135
- commerce.getCustomer(customerAccessToken),
136
- this.adminService.getCustomerFacts(brand, customer.id),
132
+ this.adminService.getCustomer(brand, customerId),
133
+ this.adminService.getCustomerFacts(brand, customerId),
137
134
  ]);
138
- const fresh = refreshed.success && refreshed.data ? refreshed.data : customer;
139
- core_1.logger.info('Customer profile updated', { brand, customerId: customer.id });
135
+ const fresh = refreshed ?? {
136
+ id: customerId,
137
+ email: null,
138
+ firstName: input.firstName ?? null,
139
+ lastName: input.lastName ?? null,
140
+ phone: null,
141
+ displayName: [input.firstName, input.lastName].filter(Boolean).join(' '),
142
+ };
143
+ core_1.logger.info('Customer profile updated', { brand, customerId });
140
144
  return this.toCustomer(fresh, updatedFacts);
141
145
  }
142
146
  };
@@ -1 +1 @@
1
- {"version":3,"file":"customer.service.js","sourceRoot":"","sources":["../../src/customer/customer.service.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,wCAOuB;AACvB,qDAK0B;AAGnB,IAAM,eAAe,GAArB,MAAM,eAAe;IAEP;IACA;IAFnB,YACmB,kBAAsC,EACtC,YAAiC;QADjC,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,iBAAY,GAAZ,YAAY,CAAqB;IACjD,CAAC;IAEI,kBAAkB,CAAC,KAAa;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kDAAkD,KAAK,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,QAAuC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACK,QAAQ,CAAC,KAAc;QAC7B,IAAI,KAAK,KAAK,uBAAM,CAAC,IAAI,IAAI,KAAK,KAAK,uBAAM,CAAC,MAAM,EAAE,CAAC;YACrD,OAAO,KAAe,CAAC;QACzB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACK,UAAU,CAAC,QAA0B,EAAE,KAAoB;QACjE,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,SAAS;YAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,SAAS;YAC1C,QAAQ,EAAE,QAAQ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"description": "AFL GraphQL - Shared GraphQL modules for multi-brand commerce platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "@nestjs/common": "^10.0.0",
23
23
  "@nestjs/core": "^10.0.0",
24
24
  "@nestjs/graphql": "^12.0.0",
25
- "@pvh-afl/core": "^1.1.26",
25
+ "@pvh-afl/core": "^1.1.31",
26
26
  "graphql": "^16.0.0"
27
27
  },
28
28
  "devDependencies": {
@@ -32,7 +32,7 @@
32
32
  "@nestjs/core": "^10.4.0",
33
33
  "@nestjs/graphql": "^12.2.0",
34
34
  "@nestjs/testing": "^10.4.0",
35
- "@pvh-afl/core": "^1.1.26",
35
+ "@pvh-afl/core": "^1.1.31",
36
36
  "@types/jest": "^29.5.0",
37
37
  "graphql": "^16.9.0",
38
38
  "graphql-type-json": "^0.3.2",