@vendure/core 2.3.2 → 2.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.
Files changed (106) hide show
  1. package/README.md +11 -11
  2. package/dist/api/config/generate-error-code-enum.js +3 -3
  3. package/dist/api/config/generate-permissions.js +29 -29
  4. package/dist/api/config/graphql-custom-fields.js +150 -150
  5. package/dist/api/schema/admin-api/administrator.api.graphql +47 -47
  6. package/dist/api/schema/admin-api/administrator.type.graphql +14 -14
  7. package/dist/api/schema/admin-api/asset.api.graphql +68 -68
  8. package/dist/api/schema/admin-api/auth.api.graphql +22 -22
  9. package/dist/api/schema/admin-api/channel.api.graphql +69 -69
  10. package/dist/api/schema/admin-api/collection-admin.type.graphql +4 -4
  11. package/dist/api/schema/admin-api/collection.api.graphql +94 -94
  12. package/dist/api/schema/admin-api/country.api.graphql +41 -41
  13. package/dist/api/schema/admin-api/customer-admin.type.graphql +4 -4
  14. package/dist/api/schema/admin-api/customer-group.api.graphql +37 -37
  15. package/dist/api/schema/admin-api/customer.api.graphql +63 -63
  16. package/dist/api/schema/admin-api/duplicate-entity.api.graphql +40 -40
  17. package/dist/api/schema/admin-api/facet-admin.type.graphql +3 -3
  18. package/dist/api/schema/admin-api/facet.api.graphql +100 -100
  19. package/dist/api/schema/admin-api/global-settings.api.graphql +26 -26
  20. package/dist/api/schema/admin-api/global-settings.type.graphql +28 -28
  21. package/dist/api/schema/admin-api/history-entry-admin.type.graphql +4 -4
  22. package/dist/api/schema/admin-api/import.api.graphql +3 -3
  23. package/dist/api/schema/admin-api/import.type.graphql +5 -5
  24. package/dist/api/schema/admin-api/job.api.graphql +63 -63
  25. package/dist/api/schema/admin-api/order-admin.type.graphql +37 -37
  26. package/dist/api/schema/admin-api/order.api.graphql +461 -461
  27. package/dist/api/schema/admin-api/payment-method.api.graphql +65 -65
  28. package/dist/api/schema/admin-api/payment.api.graphql +2 -2
  29. package/dist/api/schema/admin-api/product-admin.type.graphql +21 -21
  30. package/dist/api/schema/admin-api/product-option-group.api.graphql +58 -58
  31. package/dist/api/schema/admin-api/product-search-admin.type.graphql +5 -5
  32. package/dist/api/schema/admin-api/product-search.api.graphql +10 -10
  33. package/dist/api/schema/admin-api/product.api.graphql +214 -214
  34. package/dist/api/schema/admin-api/promotion.api.graphql +70 -70
  35. package/dist/api/schema/admin-api/province.api.graphql +37 -37
  36. package/dist/api/schema/admin-api/role.api.graphql +33 -33
  37. package/dist/api/schema/admin-api/seller.api.graphql +31 -31
  38. package/dist/api/schema/admin-api/shipping-method.api.graphql +91 -91
  39. package/dist/api/schema/admin-api/stock-level.type.graphql +9 -9
  40. package/dist/api/schema/admin-api/stock-location.api.graphql +51 -51
  41. package/dist/api/schema/admin-api/stock-location.type.graphql +7 -7
  42. package/dist/api/schema/admin-api/stock-movement.type.graphql +80 -80
  43. package/dist/api/schema/admin-api/tag.api.graphql +25 -25
  44. package/dist/api/schema/admin-api/tax-category.api.graphql +36 -36
  45. package/dist/api/schema/admin-api/tax-rate.api.graphql +37 -37
  46. package/dist/api/schema/admin-api/zone.api.graphql +42 -42
  47. package/dist/api/schema/common/address.type.graphql +16 -16
  48. package/dist/api/schema/common/asset.type.graphql +31 -31
  49. package/dist/api/schema/common/auth.type.graphql +12 -12
  50. package/dist/api/schema/common/channel.type.graphql +24 -24
  51. package/dist/api/schema/common/collection.type.graphql +40 -40
  52. package/dist/api/schema/common/common-enums.graphql +35 -35
  53. package/dist/api/schema/common/common-error-results.graphql +98 -98
  54. package/dist/api/schema/common/common-types.graphql +284 -284
  55. package/dist/api/schema/common/currency-code.graphql +322 -322
  56. package/dist/api/schema/common/custom-field-types.graphql +166 -166
  57. package/dist/api/schema/common/customer-group.type.graphql +10 -10
  58. package/dist/api/schema/common/customer.type.graphql +18 -18
  59. package/dist/api/schema/common/facet-value.type.graphql +19 -19
  60. package/dist/api/schema/common/facet.type.graphql +35 -35
  61. package/dist/api/schema/common/history-entry.type.graphql +43 -43
  62. package/dist/api/schema/common/language-code.graphql +325 -325
  63. package/dist/api/schema/common/order.type.graphql +257 -257
  64. package/dist/api/schema/common/payment-method.type.graphql +21 -21
  65. package/dist/api/schema/common/product-option-group.type.graphql +38 -38
  66. package/dist/api/schema/common/product-search.type.graphql +69 -69
  67. package/dist/api/schema/common/product.type.graphql +70 -70
  68. package/dist/api/schema/common/promotion.type.graphql +31 -31
  69. package/dist/api/schema/common/region.type.graphql +65 -65
  70. package/dist/api/schema/common/role.type.graphql +14 -14
  71. package/dist/api/schema/common/seller.type.graphql +6 -6
  72. package/dist/api/schema/common/shipping-method.type.graphql +27 -27
  73. package/dist/api/schema/common/tag.type.graphql +11 -11
  74. package/dist/api/schema/common/tax-category.type.graphql +7 -7
  75. package/dist/api/schema/common/tax-rate.type.graphql +16 -16
  76. package/dist/api/schema/common/user.type.graphql +17 -17
  77. package/dist/api/schema/common/zone.type.graphql +8 -8
  78. package/dist/api/schema/shop-api/shop-error-results.graphql +114 -114
  79. package/dist/api/schema/shop-api/shop.api.graphql +250 -250
  80. package/dist/config/auth/native-authentication-strategy.js +5 -5
  81. package/dist/i18n/messages/de.json +116 -116
  82. package/dist/i18n/messages/en.json +138 -138
  83. package/dist/i18n/messages/es.json +38 -38
  84. package/dist/i18n/messages/fr.json +138 -138
  85. package/dist/i18n/messages/pt_BR.json +99 -99
  86. package/dist/i18n/messages/pt_PT.json +118 -118
  87. package/dist/i18n/messages/ru.json +118 -118
  88. package/dist/i18n/messages/uk.json +118 -118
  89. package/dist/migrate.js +15 -15
  90. package/dist/plugin/default-search-plugin/api/api-extensions.js +8 -8
  91. package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +3 -3
  92. package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +7 -5
  93. package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js.map +1 -1
  94. package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +4 -4
  95. package/dist/service/helpers/request-context/request-context.service.js +6 -2
  96. package/dist/service/helpers/request-context/request-context.service.js.map +1 -1
  97. package/dist/service/services/product.service.js +5 -3
  98. package/dist/service/services/product.service.js.map +1 -1
  99. package/package.json +3 -3
  100. package/LICENSE +0 -9
  101. package/cli/cli-utils.d.ts +0 -1
  102. package/cli/cli-utils.js +0 -8
  103. package/cli/cli-utils.js.map +0 -1
  104. package/cli/vendure-cli.d.ts +0 -2
  105. package/cli/vendure-cli.js +0 -119
  106. package/cli/vendure-cli.js.map +0 -1
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Vendure
2
-
3
- A headless [GraphQL](https://graphql.org/) ecommerce framework built on [Node.js](https://nodejs.org) with [Nest](https://nestjs.com/) with [TypeScript](http://www.typescriptlang.org/).
4
-
5
- ```bash
6
- $ npm install @vendure/core
7
- ```
8
-
9
- ### [www.vendure.io](https://www.vendure.io/)
10
-
11
- See the [Getting Started](https://www.vendure.io/docs/getting-started/) guide for instructions on use.
1
+ # Vendure
2
+
3
+ A headless [GraphQL](https://graphql.org/) ecommerce framework built on [Node.js](https://nodejs.org) with [Nest](https://nestjs.com/) with [TypeScript](http://www.typescriptlang.org/).
4
+
5
+ ```bash
6
+ $ npm install @vendure/core
7
+ ```
8
+
9
+ ### [www.vendure.io](https://www.vendure.io/)
10
+
11
+ See the [Getting Started](https://www.vendure.io/docs/getting-started/) guide for instructions on use.
@@ -20,9 +20,9 @@ function generateErrorCodeEnum(typeDefsOrSchema) {
20
20
  if (!errorNodes.length) {
21
21
  return schema;
22
22
  }
23
- const errorCodeEnum = `
24
- extend enum ErrorCode {
25
- ${errorNodes.map(n => camelToUpperSnakeCase((n === null || n === void 0 ? void 0 : n.name.value) || '')).join('\n')}
23
+ const errorCodeEnum = `
24
+ extend enum ErrorCode {
25
+ ${errorNodes.map(n => camelToUpperSnakeCase((n === null || n === void 0 ? void 0 : n.name.value) || '')).join('\n')}
26
26
  }`;
27
27
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(errorCodeEnum));
28
28
  }
@@ -4,35 +4,35 @@ exports.generatePermissionEnum = void 0;
4
4
  const stitch_1 = require("@graphql-tools/stitch");
5
5
  const graphql_1 = require("graphql");
6
6
  const constants_1 = require("../../common/constants");
7
- const PERMISSION_DESCRIPTION = `@description
8
- Permissions for administrators and customers. Used to control access to
9
- GraphQL resolvers via the {@link Allow} decorator.
10
-
11
- ## Understanding Permission.Owner
12
-
13
- \`Permission.Owner\` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only
14
- be accessible to the "owner" of that resource.
15
-
16
- For example, the Shop API \`activeCustomer\` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
17
- based on the activeUserId of the current session. As a result, the resolver code looks like this:
18
-
19
- @example
20
- \`\`\`TypeScript
21
- \\@Query()
22
- \\@Allow(Permission.Owner)
23
- async activeCustomer(\\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
24
- const userId = ctx.activeUserId;
25
- if (userId) {
26
- return this.customerService.findOneByUserId(ctx, userId);
27
- }
28
- }
29
- \`\`\`
30
-
31
- Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
32
- nor statically encoded at build-time, any resolvers using \`Permission.Owner\` **must** include logic to enforce that only the owner
33
- of the resource has access. If not, then it is the equivalent of using \`Permission.Public\`.
34
-
35
-
7
+ const PERMISSION_DESCRIPTION = `@description
8
+ Permissions for administrators and customers. Used to control access to
9
+ GraphQL resolvers via the {@link Allow} decorator.
10
+
11
+ ## Understanding Permission.Owner
12
+
13
+ \`Permission.Owner\` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only
14
+ be accessible to the "owner" of that resource.
15
+
16
+ For example, the Shop API \`activeCustomer\` query resolver should only return the Customer object for the "owner" of that Customer, i.e.
17
+ based on the activeUserId of the current session. As a result, the resolver code looks like this:
18
+
19
+ @example
20
+ \`\`\`TypeScript
21
+ \\@Query()
22
+ \\@Allow(Permission.Owner)
23
+ async activeCustomer(\\@Ctx() ctx: RequestContext): Promise<Customer | undefined> {
24
+ const userId = ctx.activeUserId;
25
+ if (userId) {
26
+ return this.customerService.findOneByUserId(ctx, userId);
27
+ }
28
+ }
29
+ \`\`\`
30
+
31
+ Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally
32
+ nor statically encoded at build-time, any resolvers using \`Permission.Owner\` **must** include logic to enforce that only the owner
33
+ of the resource has access. If not, then it is the equivalent of using \`Permission.Public\`.
34
+
35
+
36
36
  @docsCategory common`;
37
37
  /**
38
38
  * Generates the `Permission` GraphQL enum based on the default & custom permission definitions.
@@ -15,13 +15,13 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
15
15
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
16
16
  let customFieldTypeDefs = '';
17
17
  if (!schema.getType('JSON')) {
18
- customFieldTypeDefs += `
19
- scalar JSON
18
+ customFieldTypeDefs += `
19
+ scalar JSON
20
20
  `;
21
21
  }
22
22
  if (!schema.getType('DateTime')) {
23
- customFieldTypeDefs += `
24
- scalar DateTime
23
+ customFieldTypeDefs += `
24
+ scalar DateTime
25
25
  `;
26
26
  }
27
27
  const customFieldsConfig = (0, get_custom_fields_config_without_interfaces_1.getCustomFieldsConfigWithoutInterfaces)(customFieldConfig, schema);
@@ -59,72 +59,72 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
59
59
  const filterableFields = customEntityFields.filter(field => field.type !== 'relation');
60
60
  if (schema.getType(entityName)) {
61
61
  if (customEntityFields.length) {
62
- customFieldTypeDefs += `
63
- type ${entityName}CustomFields {
64
- ${mapToFields(customEntityFields, wrapListType(getGraphQlType))}
65
- }
66
-
67
- extend type ${entityName} {
68
- customFields: ${entityName}CustomFields
69
- }
62
+ customFieldTypeDefs += `
63
+ type ${entityName}CustomFields {
64
+ ${mapToFields(customEntityFields, wrapListType(getGraphQlType))}
65
+ }
66
+
67
+ extend type ${entityName} {
68
+ customFields: ${entityName}CustomFields
69
+ }
70
70
  `;
71
71
  }
72
72
  else {
73
- customFieldTypeDefs += `
74
- extend type ${entityName} {
75
- customFields: JSON
76
- }
73
+ customFieldTypeDefs += `
74
+ extend type ${entityName} {
75
+ customFields: JSON
76
+ }
77
77
  `;
78
78
  }
79
79
  }
80
80
  if (localizedFields.length && schema.getType(`${entityName}Translation`)) {
81
- customFieldTypeDefs += `
82
- type ${entityName}TranslationCustomFields {
83
- ${mapToFields(localizedFields, wrapListType(getGraphQlType))}
84
- }
85
-
86
- extend type ${entityName}Translation {
87
- customFields: ${entityName}TranslationCustomFields
88
- }
81
+ customFieldTypeDefs += `
82
+ type ${entityName}TranslationCustomFields {
83
+ ${mapToFields(localizedFields, wrapListType(getGraphQlType))}
84
+ }
85
+
86
+ extend type ${entityName}Translation {
87
+ customFields: ${entityName}TranslationCustomFields
88
+ }
89
89
  `;
90
90
  }
91
91
  if (schema.getType(`Create${entityName}Input`)) {
92
92
  if (writeableNonLocalizedFields.length) {
93
- customFieldTypeDefs += `
94
- input Create${entityName}CustomFieldsInput {
95
- ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
96
- }
97
-
98
- extend input Create${entityName}Input {
99
- customFields: Create${entityName}CustomFieldsInput
100
- }
93
+ customFieldTypeDefs += `
94
+ input Create${entityName}CustomFieldsInput {
95
+ ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
96
+ }
97
+
98
+ extend input Create${entityName}Input {
99
+ customFields: Create${entityName}CustomFieldsInput
100
+ }
101
101
  `;
102
102
  }
103
103
  else {
104
- customFieldTypeDefs += `
105
- extend input Create${entityName}Input {
106
- customFields: JSON
107
- }
104
+ customFieldTypeDefs += `
105
+ extend input Create${entityName}Input {
106
+ customFields: JSON
107
+ }
108
108
  `;
109
109
  }
110
110
  }
111
111
  if (schema.getType(`Update${entityName}Input`)) {
112
112
  if (writeableNonLocalizedFields.length) {
113
- customFieldTypeDefs += `
114
- input Update${entityName}CustomFieldsInput {
115
- ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
116
- }
117
-
118
- extend input Update${entityName}Input {
119
- customFields: Update${entityName}CustomFieldsInput
120
- }
113
+ customFieldTypeDefs += `
114
+ input Update${entityName}CustomFieldsInput {
115
+ ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
116
+ }
117
+
118
+ extend input Update${entityName}Input {
119
+ customFields: Update${entityName}CustomFieldsInput
120
+ }
121
121
  `;
122
122
  }
123
123
  else {
124
- customFieldTypeDefs += `
125
- extend input Update${entityName}Input {
126
- customFields: JSON
127
- }
124
+ customFieldTypeDefs += `
125
+ extend input Update${entityName}Input {
126
+ customFields: JSON
127
+ }
128
128
  `;
129
129
  }
130
130
  }
@@ -132,17 +132,17 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
132
132
  if (customEntityNonListFields.length && schema.getType(`${entityName}SortParameter`)) {
133
133
  // Sorting list fields makes no sense, so we only add "sort" fields
134
134
  // to non-list fields.
135
- customFieldTypeDefs += `
136
- extend input ${entityName}SortParameter {
137
- ${mapToFields(customEntityNonListFields, () => 'SortOrder')}
138
- }
135
+ customFieldTypeDefs += `
136
+ extend input ${entityName}SortParameter {
137
+ ${mapToFields(customEntityNonListFields, () => 'SortOrder')}
138
+ }
139
139
  `;
140
140
  }
141
141
  if (filterableFields.length && schema.getType(`${entityName}FilterParameter`)) {
142
- customFieldTypeDefs += `
143
- extend input ${entityName}FilterParameter {
144
- ${mapToFields(filterableFields, getFilterOperator)}
145
- }
142
+ customFieldTypeDefs += `
143
+ extend input ${entityName}FilterParameter {
144
+ ${mapToFields(filterableFields, getFilterOperator)}
145
+ }
146
146
  `;
147
147
  }
148
148
  if (writeableLocalizedFields) {
@@ -154,21 +154,21 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
154
154
  for (const inputName of translationInputs) {
155
155
  if (schema.getType(inputName)) {
156
156
  if (writeableLocalizedFields.length) {
157
- customFieldTypeDefs += `
158
- input ${inputName}CustomFields {
159
- ${mapToFields(writeableLocalizedFields, wrapListType(getGraphQlType))}
160
- }
161
-
162
- extend input ${inputName} {
163
- customFields: ${inputName}CustomFields
164
- }
157
+ customFieldTypeDefs += `
158
+ input ${inputName}CustomFields {
159
+ ${mapToFields(writeableLocalizedFields, wrapListType(getGraphQlType))}
160
+ }
161
+
162
+ extend input ${inputName} {
163
+ customFields: ${inputName}CustomFields
164
+ }
165
165
  `;
166
166
  }
167
167
  else {
168
- customFieldTypeDefs += `
169
- extend input ${inputName} {
170
- customFields: JSON
171
- }
168
+ customFieldTypeDefs += `
169
+ extend input ${inputName} {
170
+ customFields: JSON
171
+ }
172
172
  `;
173
173
  }
174
174
  }
@@ -180,26 +180,26 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
180
180
  // For custom fields on the Address entity, we also extend the OrderAddress
181
181
  // type (which is used to store address snapshots on Orders)
182
182
  if (schema.getType('OrderAddress')) {
183
- customFieldTypeDefs += `
184
- extend type OrderAddress {
185
- customFields: AddressCustomFields
186
- }
183
+ customFieldTypeDefs += `
184
+ extend type OrderAddress {
185
+ customFields: AddressCustomFields
186
+ }
187
187
  `;
188
188
  }
189
189
  if (schema.getType('UpdateOrderAddressInput')) {
190
- customFieldTypeDefs += `
191
- extend input UpdateOrderAddressInput {
192
- customFields: UpdateAddressCustomFieldsInput
193
- }
190
+ customFieldTypeDefs += `
191
+ extend input UpdateOrderAddressInput {
192
+ customFields: UpdateAddressCustomFieldsInput
193
+ }
194
194
  `;
195
195
  }
196
196
  }
197
197
  else {
198
198
  if (schema.getType('OrderAddress')) {
199
- customFieldTypeDefs += `
200
- extend type OrderAddress {
201
- customFields: JSON
202
- }
199
+ customFieldTypeDefs += `
200
+ extend type OrderAddress {
201
+ customFields: JSON
202
+ }
203
203
  `;
204
204
  }
205
205
  }
@@ -208,28 +208,28 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
208
208
  exports.addGraphQLCustomFields = addGraphQLCustomFields;
209
209
  function addServerConfigCustomFields(typeDefsOrSchema, customFieldConfig) {
210
210
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
211
- const customFieldTypeDefs = `
212
- """
213
- This type is deprecated in v2.2 in favor of the EntityCustomFields type,
214
- which allows custom fields to be defined on user-supplies entities.
215
- """
216
- type CustomFields {
217
- ${Object.keys(customFieldConfig).reduce((output, name) => output + name + ': [CustomFieldConfig!]!\n', '')}
218
- }
219
-
220
- type EntityCustomFields {
221
- entityName: String!
222
- customFields: [CustomFieldConfig!]!
223
- }
224
-
225
- extend type ServerConfig {
226
- """
227
- This field is deprecated in v2.2 in favor of the entityCustomFields field,
228
- which allows custom fields to be defined on user-supplies entities.
229
- """
230
- customFieldConfig: CustomFields!
231
- entityCustomFields: [EntityCustomFields!]!
232
- }
211
+ const customFieldTypeDefs = `
212
+ """
213
+ This type is deprecated in v2.2 in favor of the EntityCustomFields type,
214
+ which allows custom fields to be defined on user-supplies entities.
215
+ """
216
+ type CustomFields {
217
+ ${Object.keys(customFieldConfig).reduce((output, name) => output + name + ': [CustomFieldConfig!]!\n', '')}
218
+ }
219
+
220
+ type EntityCustomFields {
221
+ entityName: String!
222
+ customFields: [CustomFieldConfig!]!
223
+ }
224
+
225
+ extend type ServerConfig {
226
+ """
227
+ This field is deprecated in v2.2 in favor of the entityCustomFields field,
228
+ which allows custom fields to be defined on user-supplies entities.
229
+ """
230
+ customFieldConfig: CustomFields!
231
+ entityCustomFields: [EntityCustomFields!]!
232
+ }
233
233
  `;
234
234
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
235
235
  }
@@ -237,10 +237,10 @@ exports.addServerConfigCustomFields = addServerConfigCustomFields;
237
237
  function addActiveAdministratorCustomFields(typeDefsOrSchema, administratorCustomFields) {
238
238
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
239
239
  const writableCustomFields = administratorCustomFields === null || administratorCustomFields === void 0 ? void 0 : administratorCustomFields.filter(field => field.readonly !== true);
240
- const extension = `
241
- extend input UpdateActiveAdministratorInput {
242
- customFields: ${0 < (writableCustomFields === null || writableCustomFields === void 0 ? void 0 : writableCustomFields.length) ? 'UpdateAdministratorCustomFieldsInput' : 'JSON'}
243
- }
240
+ const extension = `
241
+ extend input UpdateActiveAdministratorInput {
242
+ customFields: ${0 < (writableCustomFields === null || writableCustomFields === void 0 ? void 0 : writableCustomFields.length) ? 'UpdateAdministratorCustomFieldsInput' : 'JSON'}
243
+ }
244
244
  `;
245
245
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(extension));
246
246
  }
@@ -261,14 +261,14 @@ function addRegisterCustomerCustomFieldsInput(typeDefsOrSchema, customerCustomFi
261
261
  if (publicWritableCustomFields.length < 1) {
262
262
  return schema;
263
263
  }
264
- const customFieldTypeDefs = `
265
- input RegisterCustomerCustomFieldsInput {
266
- ${mapToFields(publicWritableCustomFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
267
- }
268
-
269
- extend input RegisterCustomerInput {
270
- customFields: RegisterCustomerCustomFieldsInput
271
- }
264
+ const customFieldTypeDefs = `
265
+ input RegisterCustomerCustomFieldsInput {
266
+ ${mapToFields(publicWritableCustomFields, wrapListType(getGraphQlInputType), shared_utils_1.getGraphQlInputName)}
267
+ }
268
+
269
+ extend input RegisterCustomerInput {
270
+ customFields: RegisterCustomerCustomFieldsInput
271
+ }
272
272
  `;
273
273
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
274
274
  }
@@ -283,10 +283,10 @@ function addModifyOrderCustomFields(typeDefsOrSchema, orderCustomFields) {
283
283
  return schema;
284
284
  }
285
285
  if (schema.getType('ModifyOrderInput') && schema.getType('UpdateOrderCustomFieldsInput')) {
286
- const customFieldTypeDefs = `
287
- extend input ModifyOrderInput {
288
- customFields: UpdateOrderCustomFieldsInput
289
- }
286
+ const customFieldTypeDefs = `
287
+ extend input ModifyOrderInput {
288
+ customFields: UpdateOrderCustomFieldsInput
289
+ }
290
290
  `;
291
291
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
292
292
  }
@@ -352,34 +352,34 @@ function addOrderLineCustomFieldsInput(typeDefsOrSchema, orderLineCustomFields)
352
352
  }
353
353
  let extendedSchema = new graphql_1.GraphQLSchema(schemaConfig);
354
354
  if (schema.getType('AddItemInput')) {
355
- const customFieldTypeDefs = `
356
- extend input AddItemInput {
357
- customFields: OrderLineCustomFieldsInput
358
- }
355
+ const customFieldTypeDefs = `
356
+ extend input AddItemInput {
357
+ customFields: OrderLineCustomFieldsInput
358
+ }
359
359
  `;
360
360
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
361
361
  }
362
362
  if (schema.getType('OrderLineInput')) {
363
- const customFieldTypeDefs = `
364
- extend input OrderLineInput {
365
- customFields: OrderLineCustomFieldsInput
366
- }
363
+ const customFieldTypeDefs = `
364
+ extend input OrderLineInput {
365
+ customFields: OrderLineCustomFieldsInput
366
+ }
367
367
  `;
368
368
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
369
369
  }
370
370
  if (schema.getType('AddItemToDraftOrderInput')) {
371
- const customFieldTypeDefs = `
372
- extend input AddItemToDraftOrderInput {
373
- customFields: OrderLineCustomFieldsInput
374
- }
371
+ const customFieldTypeDefs = `
372
+ extend input AddItemToDraftOrderInput {
373
+ customFields: OrderLineCustomFieldsInput
374
+ }
375
375
  `;
376
376
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
377
377
  }
378
378
  if (schema.getType('AdjustDraftOrderLineInput')) {
379
- const customFieldTypeDefs = `
380
- extend input AdjustDraftOrderLineInput {
381
- customFields: OrderLineCustomFieldsInput
382
- }
379
+ const customFieldTypeDefs = `
380
+ extend input AdjustDraftOrderLineInput {
381
+ customFields: OrderLineCustomFieldsInput
382
+ }
383
383
  `;
384
384
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
385
385
  }
@@ -391,17 +391,17 @@ function addShippingMethodQuoteCustomFields(typeDefsOrSchema, shippingMethodCust
391
391
  let customFieldTypeDefs = '';
392
392
  const publicCustomFields = shippingMethodCustomFields.filter(f => f.public !== false);
393
393
  if (0 < publicCustomFields.length) {
394
- customFieldTypeDefs = `
395
- extend type ShippingMethodQuote {
396
- customFields: ShippingMethodCustomFields
397
- }
394
+ customFieldTypeDefs = `
395
+ extend type ShippingMethodQuote {
396
+ customFields: ShippingMethodCustomFields
397
+ }
398
398
  `;
399
399
  }
400
400
  else {
401
- customFieldTypeDefs = `
402
- extend type ShippingMethodQuote {
403
- customFields: JSON
404
- }
401
+ customFieldTypeDefs = `
402
+ extend type ShippingMethodQuote {
403
+ customFields: JSON
404
+ }
405
405
  `;
406
406
  }
407
407
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
@@ -412,17 +412,17 @@ function addPaymentMethodQuoteCustomFields(typeDefsOrSchema, paymentMethodCustom
412
412
  let customFieldTypeDefs = '';
413
413
  const publicCustomFields = paymentMethodCustomFields.filter(f => f.public !== false);
414
414
  if (0 < publicCustomFields.length) {
415
- customFieldTypeDefs = `
416
- extend type PaymentMethodQuote {
417
- customFields: PaymentMethodCustomFields
418
- }
415
+ customFieldTypeDefs = `
416
+ extend type PaymentMethodQuote {
417
+ customFields: PaymentMethodCustomFields
418
+ }
419
419
  `;
420
420
  }
421
421
  else {
422
- customFieldTypeDefs = `
423
- extend type PaymentMethodQuote {
424
- customFields: JSON
425
- }
422
+ customFieldTypeDefs = `
423
+ extend type PaymentMethodQuote {
424
+ customFields: JSON
425
+ }
426
426
  `;
427
427
  }
428
428
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
@@ -1,47 +1,47 @@
1
- type Query {
2
- administrators(options: AdministratorListOptions): AdministratorList!
3
- administrator(id: ID!): Administrator
4
- activeAdministrator: Administrator
5
- }
6
-
7
- type Mutation {
8
- "Create a new Administrator"
9
- createAdministrator(input: CreateAdministratorInput!): Administrator!
10
- "Update an existing Administrator"
11
- updateAdministrator(input: UpdateAdministratorInput!): Administrator!
12
- "Update the active (currently logged-in) Administrator"
13
- updateActiveAdministrator(input: UpdateActiveAdministratorInput!): Administrator!
14
- "Delete an Administrator"
15
- deleteAdministrator(id: ID!): DeletionResponse!
16
- "Delete multiple Administrators"
17
- deleteAdministrators(ids: [ID!]!): [DeletionResponse!]!
18
- "Assign a Role to an Administrator"
19
- assignRoleToAdministrator(administratorId: ID!, roleId: ID!): Administrator!
20
- }
21
-
22
- # generated by generateListOptions function
23
- input AdministratorListOptions
24
-
25
- input CreateAdministratorInput {
26
- firstName: String!
27
- lastName: String!
28
- emailAddress: String!
29
- password: String!
30
- roleIds: [ID!]!
31
- }
32
-
33
- input UpdateAdministratorInput {
34
- id: ID!
35
- firstName: String
36
- lastName: String
37
- emailAddress: String
38
- password: String
39
- roleIds: [ID!]
40
- }
41
-
42
- input UpdateActiveAdministratorInput {
43
- firstName: String
44
- lastName: String
45
- emailAddress: String
46
- password: String
47
- }
1
+ type Query {
2
+ administrators(options: AdministratorListOptions): AdministratorList!
3
+ administrator(id: ID!): Administrator
4
+ activeAdministrator: Administrator
5
+ }
6
+
7
+ type Mutation {
8
+ "Create a new Administrator"
9
+ createAdministrator(input: CreateAdministratorInput!): Administrator!
10
+ "Update an existing Administrator"
11
+ updateAdministrator(input: UpdateAdministratorInput!): Administrator!
12
+ "Update the active (currently logged-in) Administrator"
13
+ updateActiveAdministrator(input: UpdateActiveAdministratorInput!): Administrator!
14
+ "Delete an Administrator"
15
+ deleteAdministrator(id: ID!): DeletionResponse!
16
+ "Delete multiple Administrators"
17
+ deleteAdministrators(ids: [ID!]!): [DeletionResponse!]!
18
+ "Assign a Role to an Administrator"
19
+ assignRoleToAdministrator(administratorId: ID!, roleId: ID!): Administrator!
20
+ }
21
+
22
+ # generated by generateListOptions function
23
+ input AdministratorListOptions
24
+
25
+ input CreateAdministratorInput {
26
+ firstName: String!
27
+ lastName: String!
28
+ emailAddress: String!
29
+ password: String!
30
+ roleIds: [ID!]!
31
+ }
32
+
33
+ input UpdateAdministratorInput {
34
+ id: ID!
35
+ firstName: String
36
+ lastName: String
37
+ emailAddress: String
38
+ password: String
39
+ roleIds: [ID!]
40
+ }
41
+
42
+ input UpdateActiveAdministratorInput {
43
+ firstName: String
44
+ lastName: String
45
+ emailAddress: String
46
+ password: String
47
+ }
@@ -1,14 +1,14 @@
1
- type Administrator implements Node {
2
- id: ID!
3
- createdAt: DateTime!
4
- updatedAt: DateTime!
5
- firstName: String!
6
- lastName: String!
7
- emailAddress: String!
8
- user: User!
9
- }
10
-
11
- type AdministratorList implements PaginatedList {
12
- items: [Administrator!]!
13
- totalItems: Int!
14
- }
1
+ type Administrator implements Node {
2
+ id: ID!
3
+ createdAt: DateTime!
4
+ updatedAt: DateTime!
5
+ firstName: String!
6
+ lastName: String!
7
+ emailAddress: String!
8
+ user: User!
9
+ }
10
+
11
+ type AdministratorList implements PaginatedList {
12
+ items: [Administrator!]!
13
+ totalItems: Int!
14
+ }