@vendure/core 3.2.0 → 3.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.
Files changed (101) hide show
  1. package/LICENSE.md +42 -42
  2. package/README.md +11 -11
  3. package/dist/api/config/generate-error-code-enum.js +3 -3
  4. package/dist/api/config/generate-permissions.js +29 -29
  5. package/dist/api/config/graphql-custom-fields.js +158 -158
  6. package/dist/api/schema/admin-api/administrator.api.graphql +47 -47
  7. package/dist/api/schema/admin-api/administrator.type.graphql +14 -14
  8. package/dist/api/schema/admin-api/asset.api.graphql +68 -68
  9. package/dist/api/schema/admin-api/auth.api.graphql +22 -22
  10. package/dist/api/schema/admin-api/channel.api.graphql +69 -69
  11. package/dist/api/schema/admin-api/collection-admin.type.graphql +4 -4
  12. package/dist/api/schema/admin-api/collection.api.graphql +94 -94
  13. package/dist/api/schema/admin-api/country.api.graphql +41 -41
  14. package/dist/api/schema/admin-api/customer-admin.type.graphql +4 -4
  15. package/dist/api/schema/admin-api/customer-group.api.graphql +37 -37
  16. package/dist/api/schema/admin-api/customer.api.graphql +63 -63
  17. package/dist/api/schema/admin-api/duplicate-entity.api.graphql +40 -40
  18. package/dist/api/schema/admin-api/facet-admin.type.graphql +3 -3
  19. package/dist/api/schema/admin-api/facet.api.graphql +100 -100
  20. package/dist/api/schema/admin-api/global-settings.api.graphql +26 -26
  21. package/dist/api/schema/admin-api/global-settings.type.graphql +28 -28
  22. package/dist/api/schema/admin-api/history-entry-admin.type.graphql +4 -4
  23. package/dist/api/schema/admin-api/import.api.graphql +3 -3
  24. package/dist/api/schema/admin-api/import.type.graphql +5 -5
  25. package/dist/api/schema/admin-api/job.api.graphql +63 -63
  26. package/dist/api/schema/admin-api/order-admin.type.graphql +37 -37
  27. package/dist/api/schema/admin-api/order.api.graphql +463 -463
  28. package/dist/api/schema/admin-api/payment-method.api.graphql +65 -65
  29. package/dist/api/schema/admin-api/payment.api.graphql +2 -2
  30. package/dist/api/schema/admin-api/product-admin.type.graphql +21 -21
  31. package/dist/api/schema/admin-api/product-option-group.api.graphql +58 -58
  32. package/dist/api/schema/admin-api/product-search-admin.type.graphql +5 -5
  33. package/dist/api/schema/admin-api/product-search.api.graphql +10 -10
  34. package/dist/api/schema/admin-api/product.api.graphql +225 -225
  35. package/dist/api/schema/admin-api/promotion.api.graphql +70 -70
  36. package/dist/api/schema/admin-api/province.api.graphql +37 -37
  37. package/dist/api/schema/admin-api/role.api.graphql +33 -33
  38. package/dist/api/schema/admin-api/seller.api.graphql +31 -31
  39. package/dist/api/schema/admin-api/shipping-method.api.graphql +91 -91
  40. package/dist/api/schema/admin-api/stock-level.type.graphql +9 -9
  41. package/dist/api/schema/admin-api/stock-location.api.graphql +51 -51
  42. package/dist/api/schema/admin-api/stock-location.type.graphql +7 -7
  43. package/dist/api/schema/admin-api/stock-movement.type.graphql +80 -80
  44. package/dist/api/schema/admin-api/tag.api.graphql +25 -25
  45. package/dist/api/schema/admin-api/tax-category.api.graphql +36 -36
  46. package/dist/api/schema/admin-api/tax-rate.api.graphql +37 -37
  47. package/dist/api/schema/admin-api/zone.api.graphql +42 -42
  48. package/dist/api/schema/common/address.type.graphql +16 -16
  49. package/dist/api/schema/common/asset.type.graphql +31 -31
  50. package/dist/api/schema/common/auth.type.graphql +12 -12
  51. package/dist/api/schema/common/channel.type.graphql +24 -24
  52. package/dist/api/schema/common/collection.type.graphql +40 -40
  53. package/dist/api/schema/common/common-enums.graphql +35 -35
  54. package/dist/api/schema/common/common-error-results.graphql +107 -107
  55. package/dist/api/schema/common/common-types.graphql +285 -285
  56. package/dist/api/schema/common/currency-code.graphql +322 -322
  57. package/dist/api/schema/common/custom-field-types.graphql +265 -265
  58. package/dist/api/schema/common/customer-group.type.graphql +10 -10
  59. package/dist/api/schema/common/customer.type.graphql +18 -18
  60. package/dist/api/schema/common/facet-value.type.graphql +19 -19
  61. package/dist/api/schema/common/facet.type.graphql +35 -35
  62. package/dist/api/schema/common/history-entry.type.graphql +43 -43
  63. package/dist/api/schema/common/language-code.graphql +325 -325
  64. package/dist/api/schema/common/order.type.graphql +257 -257
  65. package/dist/api/schema/common/payment-method.type.graphql +21 -21
  66. package/dist/api/schema/common/product-option-group.type.graphql +38 -38
  67. package/dist/api/schema/common/product-search.type.graphql +69 -69
  68. package/dist/api/schema/common/product.type.graphql +70 -70
  69. package/dist/api/schema/common/promotion.type.graphql +31 -31
  70. package/dist/api/schema/common/region.type.graphql +65 -65
  71. package/dist/api/schema/common/role.type.graphql +14 -14
  72. package/dist/api/schema/common/seller.type.graphql +6 -6
  73. package/dist/api/schema/common/shipping-method.type.graphql +27 -27
  74. package/dist/api/schema/common/tag.type.graphql +11 -11
  75. package/dist/api/schema/common/tax-category.type.graphql +7 -7
  76. package/dist/api/schema/common/tax-rate.type.graphql +16 -16
  77. package/dist/api/schema/common/user.type.graphql +17 -17
  78. package/dist/api/schema/common/zone.type.graphql +8 -8
  79. package/dist/api/schema/shop-api/shop-error-results.graphql +114 -114
  80. package/dist/api/schema/shop-api/shop.api.graphql +287 -287
  81. package/dist/config/auth/native-authentication-strategy.js +5 -5
  82. package/dist/i18n/messages/de.json +117 -117
  83. package/dist/i18n/messages/en.json +140 -140
  84. package/dist/i18n/messages/es.json +38 -38
  85. package/dist/i18n/messages/fr.json +138 -138
  86. package/dist/i18n/messages/pt_BR.json +99 -99
  87. package/dist/i18n/messages/pt_PT.json +118 -118
  88. package/dist/i18n/messages/ru.json +118 -118
  89. package/dist/i18n/messages/uk.json +118 -118
  90. package/dist/migrate.js +15 -15
  91. package/dist/plugin/default-search-plugin/api/api-extensions.js +8 -8
  92. package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +3 -3
  93. package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +5 -5
  94. package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +4 -4
  95. package/package.json +4 -4
  96. package/cli/cli-utils.d.ts +0 -1
  97. package/cli/cli-utils.js +0 -8
  98. package/cli/cli-utils.js.map +0 -1
  99. package/cli/vendure-cli.d.ts +0 -2
  100. package/cli/vendure-cli.js +0 -119
  101. package/cli/vendure-cli.js.map +0 -1
package/LICENSE.md CHANGED
@@ -1,42 +1,42 @@
1
- # License
2
- Copyright (C) Vendure GmbH
3
-
4
- This software is available under two different licenses:
5
- * GNU General Public License version 3 (GPLv3) as Vendure Community Edition
6
- * Vendure Commercial License (VCL)
7
-
8
- The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
9
-
10
- ## GNU General Public License version 3 (GPLv3)
11
-
12
- If you decide to choose the GPLv3 license, you must comply with the following terms:
13
-
14
- This program is free software: you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation, either version 3 of the License, or
17
- (at your option) any later version.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program. If not, see <http://www.gnu.org/licenses/>.
26
-
27
- Additional permission under GNU GPL version 3 section 7:
28
-
29
- An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
30
- which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
31
-
32
- ## Vendure Commercial License (VCL)
33
-
34
- Alternatively, commercial and supported versions of the program - also known as
35
- Commercial Distributions - must be used in accordance with the terms and conditions
36
- contained in a separate written agreement between you and Vendure GmbH.
37
- For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
38
-
39
- Please see also:
40
-
41
- - [Licensing FAQ - license-faq.md](license/license-faq.md)
42
- - [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
1
+ # License
2
+ Copyright (C) Vendure GmbH
3
+
4
+ This software is available under two different licenses:
5
+ * GNU General Public License version 3 (GPLv3) as Vendure Community Edition
6
+ * Vendure Commercial License (VCL)
7
+
8
+ The default Vendure license, without a valid Vendure Commercial License agreement, is the Open-Source GPLv3 license.
9
+
10
+ ## GNU General Public License version 3 (GPLv3)
11
+
12
+ If you decide to choose the GPLv3 license, you must comply with the following terms:
13
+
14
+ This program is free software: you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation, either version 3 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
26
+
27
+ Additional permission under GNU GPL version 3 section 7:
28
+
29
+ An additional exception under section 7 of the GPL is included in the plugin-exception.txt file,
30
+ which allows you to distribute Vendure plugins (i.e. extensions) under a different license.
31
+
32
+ ## Vendure Commercial License (VCL)
33
+
34
+ Alternatively, commercial and supported versions of the program - also known as
35
+ Commercial Distributions - must be used in accordance with the terms and conditions
36
+ contained in a separate written agreement between you and Vendure GmbH.
37
+ For more information about the Vendure Commercial License (VCL) please contact contact@vendure.io.
38
+
39
+ Please see also:
40
+
41
+ - [Licensing FAQ - license-faq.md](license/license-faq.md)
42
+ - [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](license/gpl-3.0.txt)
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.
@@ -21,9 +21,9 @@ function generateErrorCodeEnum(typeDefsOrSchema) {
21
21
  if (!errorNodes.length) {
22
22
  return schema;
23
23
  }
24
- const errorCodeEnum = `
25
- extend enum ErrorCode {
26
- ${errorNodes.map(n => camelToUpperSnakeCase((n === null || n === void 0 ? void 0 : n.name.value) || '')).join('\n')}
24
+ const errorCodeEnum = `
25
+ extend enum ErrorCode {
26
+ ${errorNodes.map(n => camelToUpperSnakeCase((n === null || n === void 0 ? void 0 : n.name.value) || '')).join('\n')}
27
27
  }`;
28
28
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(errorCodeEnum));
29
29
  }
@@ -4,35 +4,35 @@ exports.generatePermissionEnum = generatePermissionEnum;
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.
@@ -22,13 +22,13 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
22
22
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
23
23
  let customFieldTypeDefs = '';
24
24
  if (!schema.getType('JSON')) {
25
- customFieldTypeDefs += `
26
- scalar JSON
25
+ customFieldTypeDefs += `
26
+ scalar JSON
27
27
  `;
28
28
  }
29
29
  if (!schema.getType('DateTime')) {
30
- customFieldTypeDefs += `
31
- scalar DateTime
30
+ customFieldTypeDefs += `
31
+ scalar DateTime
32
32
  `;
33
33
  }
34
34
  const customFieldsConfig = (0, get_custom_fields_config_without_interfaces_1.getCustomFieldsConfigWithoutInterfaces)(customFieldConfig, schema);
@@ -69,39 +69,39 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
69
69
  if (schema.getType(entityName)) {
70
70
  if (customEntityFields.length) {
71
71
  for (const structCustomField of structCustomFields) {
72
- customFieldTypeDefs += `
73
- type ${getStructTypeName(entityName, structCustomField)} {
74
- ${mapToStructFields(structCustomField.fields, wrapListType(getGraphQlTypeForStructField))}
75
- }
72
+ customFieldTypeDefs += `
73
+ type ${getStructTypeName(entityName, structCustomField)} {
74
+ ${mapToStructFields(structCustomField.fields, wrapListType(getGraphQlTypeForStructField))}
75
+ }
76
76
  `;
77
77
  }
78
- customFieldTypeDefs += `
79
- type ${entityName}CustomFields {
80
- ${mapToFields(customEntityFields, wrapListType(getGraphQlType(entityName)))}
81
- }
82
-
83
- extend type ${entityName} {
84
- customFields: ${entityName}CustomFields
85
- }
78
+ customFieldTypeDefs += `
79
+ type ${entityName}CustomFields {
80
+ ${mapToFields(customEntityFields, wrapListType(getGraphQlType(entityName)))}
81
+ }
82
+
83
+ extend type ${entityName} {
84
+ customFields: ${entityName}CustomFields
85
+ }
86
86
  `;
87
87
  }
88
88
  else {
89
- customFieldTypeDefs += `
90
- extend type ${entityName} {
91
- customFields: JSON
92
- }
89
+ customFieldTypeDefs += `
90
+ extend type ${entityName} {
91
+ customFields: JSON
92
+ }
93
93
  `;
94
94
  }
95
95
  }
96
96
  if (localizedFields.length && schema.getType(`${entityName}Translation`)) {
97
- customFieldTypeDefs += `
98
- type ${entityName}TranslationCustomFields {
99
- ${mapToFields(localizedFields, wrapListType(getGraphQlType(entityName)))}
100
- }
101
-
102
- extend type ${entityName}Translation {
103
- customFields: ${entityName}TranslationCustomFields
104
- }
97
+ customFieldTypeDefs += `
98
+ type ${entityName}TranslationCustomFields {
99
+ ${mapToFields(localizedFields, wrapListType(getGraphQlType(entityName)))}
100
+ }
101
+
102
+ extend type ${entityName}Translation {
103
+ customFields: ${entityName}TranslationCustomFields
104
+ }
105
105
  `;
106
106
  }
107
107
  const hasCreateInputType = schema.getType(`Create${entityName}Input`);
@@ -110,67 +110,67 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
110
110
  // Define any Struct input types that are required by
111
111
  // the create and/or update input types.
112
112
  for (const structCustomField of structCustomFields) {
113
- customFieldTypeDefs += `
114
- input ${getStructInputName(entityName, structCustomField)} {
115
- ${mapToStructFields(structCustomField.fields, wrapListType(getGraphQlInputType(entityName)))}
116
- }
113
+ customFieldTypeDefs += `
114
+ input ${getStructInputName(entityName, structCustomField)} {
115
+ ${mapToStructFields(structCustomField.fields, wrapListType(getGraphQlInputType(entityName)))}
116
+ }
117
117
  `;
118
118
  }
119
119
  }
120
120
  if (hasCreateInputType) {
121
121
  if (writeableNonLocalizedFields.length) {
122
- customFieldTypeDefs += `
123
- input Create${entityName}CustomFieldsInput {
124
- ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType(entityName)), shared_utils_1.getGraphQlInputName)}
125
- }
126
-
127
- extend input Create${entityName}Input {
128
- customFields: Create${entityName}CustomFieldsInput
129
- }
122
+ customFieldTypeDefs += `
123
+ input Create${entityName}CustomFieldsInput {
124
+ ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType(entityName)), shared_utils_1.getGraphQlInputName)}
125
+ }
126
+
127
+ extend input Create${entityName}Input {
128
+ customFields: Create${entityName}CustomFieldsInput
129
+ }
130
130
  `;
131
131
  }
132
132
  else {
133
- customFieldTypeDefs += `
134
- extend input Create${entityName}Input {
135
- customFields: JSON
136
- }
133
+ customFieldTypeDefs += `
134
+ extend input Create${entityName}Input {
135
+ customFields: JSON
136
+ }
137
137
  `;
138
138
  }
139
139
  }
140
140
  if (hasUpdateInputType) {
141
141
  if (writeableNonLocalizedFields.length) {
142
- customFieldTypeDefs += `
143
- input Update${entityName}CustomFieldsInput {
144
- ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType(entityName)), shared_utils_1.getGraphQlInputName)}
145
- }
146
-
147
- extend input Update${entityName}Input {
148
- customFields: Update${entityName}CustomFieldsInput
149
- }
142
+ customFieldTypeDefs += `
143
+ input Update${entityName}CustomFieldsInput {
144
+ ${mapToFields(writeableNonLocalizedFields, wrapListType(getGraphQlInputType(entityName)), shared_utils_1.getGraphQlInputName)}
145
+ }
146
+
147
+ extend input Update${entityName}Input {
148
+ customFields: Update${entityName}CustomFieldsInput
149
+ }
150
150
  `;
151
151
  }
152
152
  else {
153
- customFieldTypeDefs += `
154
- extend input Update${entityName}Input {
155
- customFields: JSON
156
- }
153
+ customFieldTypeDefs += `
154
+ extend input Update${entityName}Input {
155
+ customFields: JSON
156
+ }
157
157
  `;
158
158
  }
159
159
  }
160
160
  if (sortableFields.length && schema.getType(`${entityName}SortParameter`)) {
161
161
  // Sorting list fields makes no sense, so we only add "sort" fields
162
162
  // to non-list fields.
163
- customFieldTypeDefs += `
164
- extend input ${entityName}SortParameter {
165
- ${mapToFields(sortableFields, () => 'SortOrder')}
166
- }
163
+ customFieldTypeDefs += `
164
+ extend input ${entityName}SortParameter {
165
+ ${mapToFields(sortableFields, () => 'SortOrder')}
166
+ }
167
167
  `;
168
168
  }
169
169
  if (filterableFields.length && schema.getType(`${entityName}FilterParameter`)) {
170
- customFieldTypeDefs += `
171
- extend input ${entityName}FilterParameter {
172
- ${mapToFields(filterableFields, getFilterOperator)}
173
- }
170
+ customFieldTypeDefs += `
171
+ extend input ${entityName}FilterParameter {
172
+ ${mapToFields(filterableFields, getFilterOperator)}
173
+ }
174
174
  `;
175
175
  }
176
176
  if (writeableLocalizedFields) {
@@ -182,21 +182,21 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
182
182
  for (const inputName of translationInputs) {
183
183
  if (schema.getType(inputName)) {
184
184
  if (writeableLocalizedFields.length) {
185
- customFieldTypeDefs += `
186
- input ${inputName}CustomFields {
187
- ${mapToFields(writeableLocalizedFields, wrapListType(getGraphQlType(entityName)))}
188
- }
189
-
190
- extend input ${inputName} {
191
- customFields: ${inputName}CustomFields
192
- }
185
+ customFieldTypeDefs += `
186
+ input ${inputName}CustomFields {
187
+ ${mapToFields(writeableLocalizedFields, wrapListType(getGraphQlType(entityName)))}
188
+ }
189
+
190
+ extend input ${inputName} {
191
+ customFields: ${inputName}CustomFields
192
+ }
193
193
  `;
194
194
  }
195
195
  else {
196
- customFieldTypeDefs += `
197
- extend input ${inputName} {
198
- customFields: JSON
199
- }
196
+ customFieldTypeDefs += `
197
+ extend input ${inputName} {
198
+ customFields: JSON
199
+ }
200
200
  `;
201
201
  }
202
202
  }
@@ -209,26 +209,26 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
209
209
  // For custom fields on the Address entity, we also extend the OrderAddress
210
210
  // type (which is used to store address snapshots on Orders)
211
211
  if (schema.getType('OrderAddress')) {
212
- customFieldTypeDefs += `
213
- extend type OrderAddress {
214
- customFields: AddressCustomFields
215
- }
212
+ customFieldTypeDefs += `
213
+ extend type OrderAddress {
214
+ customFields: AddressCustomFields
215
+ }
216
216
  `;
217
217
  }
218
218
  if (schema.getType('UpdateOrderAddressInput') && (writeablePublicAddressFields === null || writeablePublicAddressFields === void 0 ? void 0 : writeablePublicAddressFields.length)) {
219
- customFieldTypeDefs += `
220
- extend input UpdateOrderAddressInput {
221
- customFields: UpdateAddressCustomFieldsInput
222
- }
219
+ customFieldTypeDefs += `
220
+ extend input UpdateOrderAddressInput {
221
+ customFields: UpdateAddressCustomFieldsInput
222
+ }
223
223
  `;
224
224
  }
225
225
  }
226
226
  else {
227
227
  if (schema.getType('OrderAddress')) {
228
- customFieldTypeDefs += `
229
- extend type OrderAddress {
230
- customFields: JSON
231
- }
228
+ customFieldTypeDefs += `
229
+ extend type OrderAddress {
230
+ customFields: JSON
231
+ }
232
232
  `;
233
233
  }
234
234
  }
@@ -236,38 +236,38 @@ function addGraphQLCustomFields(typeDefsOrSchema, customFieldConfig, publicOnly)
236
236
  }
237
237
  function addServerConfigCustomFields(typeDefsOrSchema, customFieldConfig) {
238
238
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
239
- const customFieldTypeDefs = `
240
- """
241
- This type is deprecated in v2.2 in favor of the EntityCustomFields type,
242
- which allows custom fields to be defined on user-supplied entities.
243
- """
244
- type CustomFields {
245
- ${Object.keys(customFieldConfig).reduce((output, name) => output + name + ': [CustomFieldConfig!]!\n', '')}
246
- }
247
-
248
- type EntityCustomFields {
249
- entityName: String!
250
- customFields: [CustomFieldConfig!]!
251
- }
252
-
253
- extend type ServerConfig {
254
- """
255
- This field is deprecated in v2.2 in favor of the entityCustomFields field,
256
- which allows custom fields to be defined on user-supplies entities.
257
- """
258
- customFieldConfig: CustomFields!
259
- entityCustomFields: [EntityCustomFields!]!
260
- }
239
+ const customFieldTypeDefs = `
240
+ """
241
+ This type is deprecated in v2.2 in favor of the EntityCustomFields type,
242
+ which allows custom fields to be defined on user-supplied entities.
243
+ """
244
+ type CustomFields {
245
+ ${Object.keys(customFieldConfig).reduce((output, name) => output + name + ': [CustomFieldConfig!]!\n', '')}
246
+ }
247
+
248
+ type EntityCustomFields {
249
+ entityName: String!
250
+ customFields: [CustomFieldConfig!]!
251
+ }
252
+
253
+ extend type ServerConfig {
254
+ """
255
+ This field is deprecated in v2.2 in favor of the entityCustomFields field,
256
+ which allows custom fields to be defined on user-supplies entities.
257
+ """
258
+ customFieldConfig: CustomFields!
259
+ entityCustomFields: [EntityCustomFields!]!
260
+ }
261
261
  `;
262
262
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
263
263
  }
264
264
  function addActiveAdministratorCustomFields(typeDefsOrSchema, administratorCustomFields) {
265
265
  const schema = typeof typeDefsOrSchema === 'string' ? (0, graphql_1.buildSchema)(typeDefsOrSchema) : typeDefsOrSchema;
266
266
  const writableCustomFields = administratorCustomFields === null || administratorCustomFields === void 0 ? void 0 : administratorCustomFields.filter(field => field.readonly !== true && field.internal !== true);
267
- const extension = `
268
- extend input UpdateActiveAdministratorInput {
269
- customFields: ${0 < (writableCustomFields === null || writableCustomFields === void 0 ? void 0 : writableCustomFields.length) ? 'UpdateAdministratorCustomFieldsInput' : 'JSON'}
270
- }
267
+ const extension = `
268
+ extend input UpdateActiveAdministratorInput {
269
+ customFields: ${0 < (writableCustomFields === null || writableCustomFields === void 0 ? void 0 : writableCustomFields.length) ? 'UpdateAdministratorCustomFieldsInput' : 'JSON'}
270
+ }
271
271
  `;
272
272
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(extension));
273
273
  }
@@ -287,14 +287,14 @@ function addRegisterCustomerCustomFieldsInput(typeDefsOrSchema, customerCustomFi
287
287
  if (publicWritableCustomFields.length < 1) {
288
288
  return schema;
289
289
  }
290
- const customFieldTypeDefs = `
291
- input RegisterCustomerCustomFieldsInput {
292
- ${mapToFields(publicWritableCustomFields, wrapListType(getGraphQlInputType('Customer')), shared_utils_1.getGraphQlInputName)}
293
- }
294
-
295
- extend input RegisterCustomerInput {
296
- customFields: RegisterCustomerCustomFieldsInput
297
- }
290
+ const customFieldTypeDefs = `
291
+ input RegisterCustomerCustomFieldsInput {
292
+ ${mapToFields(publicWritableCustomFields, wrapListType(getGraphQlInputType('Customer')), shared_utils_1.getGraphQlInputName)}
293
+ }
294
+
295
+ extend input RegisterCustomerInput {
296
+ customFields: RegisterCustomerCustomFieldsInput
297
+ }
298
298
  `;
299
299
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
300
300
  }
@@ -308,10 +308,10 @@ function addModifyOrderCustomFields(typeDefsOrSchema, orderCustomFields) {
308
308
  return schema;
309
309
  }
310
310
  if (schema.getType('ModifyOrderInput') && schema.getType('UpdateOrderCustomFieldsInput')) {
311
- const customFieldTypeDefs = `
312
- extend input ModifyOrderInput {
313
- customFields: UpdateOrderCustomFieldsInput
314
- }
311
+ const customFieldTypeDefs = `
312
+ extend input ModifyOrderInput {
313
+ customFields: UpdateOrderCustomFieldsInput
314
+ }
315
315
  `;
316
316
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
317
317
  }
@@ -400,34 +400,34 @@ function addOrderLineCustomFieldsInput(typeDefsOrSchema, orderLineCustomFields,
400
400
  }
401
401
  let extendedSchema = new graphql_1.GraphQLSchema(schemaConfig);
402
402
  if (schema.getType('AddItemInput')) {
403
- const customFieldTypeDefs = `
404
- extend input AddItemInput {
405
- customFields: OrderLineCustomFieldsInput
406
- }
403
+ const customFieldTypeDefs = `
404
+ extend input AddItemInput {
405
+ customFields: OrderLineCustomFieldsInput
406
+ }
407
407
  `;
408
408
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
409
409
  }
410
410
  if (schema.getType('OrderLineInput')) {
411
- const customFieldTypeDefs = `
412
- extend input OrderLineInput {
413
- customFields: OrderLineCustomFieldsInput
414
- }
411
+ const customFieldTypeDefs = `
412
+ extend input OrderLineInput {
413
+ customFields: OrderLineCustomFieldsInput
414
+ }
415
415
  `;
416
416
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
417
417
  }
418
418
  if (schema.getType('AddItemToDraftOrderInput')) {
419
- const customFieldTypeDefs = `
420
- extend input AddItemToDraftOrderInput {
421
- customFields: OrderLineCustomFieldsInput
422
- }
419
+ const customFieldTypeDefs = `
420
+ extend input AddItemToDraftOrderInput {
421
+ customFields: OrderLineCustomFieldsInput
422
+ }
423
423
  `;
424
424
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
425
425
  }
426
426
  if (schema.getType('AdjustDraftOrderLineInput')) {
427
- const customFieldTypeDefs = `
428
- extend input AdjustDraftOrderLineInput {
429
- customFields: OrderLineCustomFieldsInput
430
- }
427
+ const customFieldTypeDefs = `
428
+ extend input AdjustDraftOrderLineInput {
429
+ customFields: OrderLineCustomFieldsInput
430
+ }
431
431
  `;
432
432
  extendedSchema = (0, graphql_1.extendSchema)(extendedSchema, (0, graphql_1.parse)(customFieldTypeDefs));
433
433
  }
@@ -438,17 +438,17 @@ function addShippingMethodQuoteCustomFields(typeDefsOrSchema, shippingMethodCust
438
438
  let customFieldTypeDefs = '';
439
439
  const publicCustomFields = shippingMethodCustomFields.filter(f => f.public !== false);
440
440
  if (0 < publicCustomFields.length) {
441
- customFieldTypeDefs = `
442
- extend type ShippingMethodQuote {
443
- customFields: ShippingMethodCustomFields
444
- }
441
+ customFieldTypeDefs = `
442
+ extend type ShippingMethodQuote {
443
+ customFields: ShippingMethodCustomFields
444
+ }
445
445
  `;
446
446
  }
447
447
  else {
448
- customFieldTypeDefs = `
449
- extend type ShippingMethodQuote {
450
- customFields: JSON
451
- }
448
+ customFieldTypeDefs = `
449
+ extend type ShippingMethodQuote {
450
+ customFields: JSON
451
+ }
452
452
  `;
453
453
  }
454
454
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));
@@ -458,17 +458,17 @@ function addPaymentMethodQuoteCustomFields(typeDefsOrSchema, paymentMethodCustom
458
458
  let customFieldTypeDefs = '';
459
459
  const publicCustomFields = paymentMethodCustomFields.filter(f => f.public !== false);
460
460
  if (0 < publicCustomFields.length) {
461
- customFieldTypeDefs = `
462
- extend type PaymentMethodQuote {
463
- customFields: PaymentMethodCustomFields
464
- }
461
+ customFieldTypeDefs = `
462
+ extend type PaymentMethodQuote {
463
+ customFields: PaymentMethodCustomFields
464
+ }
465
465
  `;
466
466
  }
467
467
  else {
468
- customFieldTypeDefs = `
469
- extend type PaymentMethodQuote {
470
- customFields: JSON
471
- }
468
+ customFieldTypeDefs = `
469
+ extend type PaymentMethodQuote {
470
+ customFields: JSON
471
+ }
472
472
  `;
473
473
  }
474
474
  return (0, graphql_1.extendSchema)(schema, (0, graphql_1.parse)(customFieldTypeDefs));