@vendure/core 2.2.4 → 2.2.6
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/dist/api/common/user-has-permissions-on-custom-field.js +3 -0
- package/dist/api/common/user-has-permissions-on-custom-field.js.map +1 -1
- package/dist/api/config/graphql-custom-fields.js +150 -150
- package/dist/api/resolvers/entity/order-entity.resolver.d.ts +1 -0
- package/dist/api/resolvers/entity/order-entity.resolver.js +15 -0
- package/dist/api/resolvers/entity/order-entity.resolver.js.map +1 -1
- package/dist/app.module.js +24 -1
- package/dist/app.module.js.map +1 -1
- package/dist/bootstrap.js +5 -11
- package/dist/bootstrap.js.map +1 -1
- package/dist/common/finite-state-machine/types.d.ts +1 -1
- package/dist/config/entity/entity-duplicators/product-duplicator.js +6 -3
- package/dist/config/entity/entity-duplicators/product-duplicator.js.map +1 -1
- package/dist/config/fulfillment/default-fulfillment-process.js +0 -1
- package/dist/config/fulfillment/default-fulfillment-process.js.map +1 -1
- package/dist/config/fulfillment/fulfillment-handler.d.ts +1 -1
- package/dist/config/payment/payment-method-handler.d.ts +4 -4
- package/dist/config/vendure-config.d.ts +2 -2
- package/dist/entity/global-settings/global-settings.entity.d.ts +5 -0
- package/dist/entity/global-settings/global-settings.entity.js +5 -0
- package/dist/entity/global-settings/global-settings.entity.js.map +1 -1
- package/dist/entity/refund/refund.entity.d.ts +5 -0
- package/dist/entity/refund/refund.entity.js +5 -0
- package/dist/entity/refund/refund.entity.js.map +1 -1
- package/dist/entity/subscribers.d.ts +5 -0
- package/dist/entity/subscribers.js +5 -0
- package/dist/entity/subscribers.js.map +1 -1
- package/dist/event-bus/events/initializer-event.d.ts +1 -1
- package/dist/event-bus/events/initializer-event.js +1 -1
- package/dist/job-queue/subscribable-job.d.ts +2 -1
- package/dist/job-queue/subscribable-job.js +1 -0
- package/dist/job-queue/subscribable-job.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.d.ts +3 -1
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +6 -4
- package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.d.ts +3 -1
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +8 -6
- package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js.map +1 -1
- package/dist/plugin/default-search-plugin/search-strategy/search-strategy.d.ts +3 -0
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.d.ts +4 -0
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +8 -4
- package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js.map +1 -1
- package/dist/service/helpers/custom-field-relation/custom-field-relation.service.js +6 -2
- package/dist/service/helpers/custom-field-relation/custom-field-relation.service.js.map +1 -1
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.d.ts +0 -7
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js +5 -52
- package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js.map +1 -1
- package/dist/service/helpers/entity-hydrator/merge-deep.d.ts +9 -0
- package/dist/service/helpers/entity-hydrator/merge-deep.js +50 -0
- package/dist/service/helpers/entity-hydrator/merge-deep.js.map +1 -0
- package/dist/service/helpers/order-modifier/order-modifier.js +7 -0
- package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
- package/dist/service/helpers/order-splitter/order-splitter.js +3 -2
- package/dist/service/helpers/order-splitter/order-splitter.js.map +1 -1
- package/dist/service/initializer.service.d.ts +3 -0
- package/dist/service/initializer.service.js +3 -0
- package/dist/service/initializer.service.js.map +1 -1
- package/dist/service/services/order.service.js +1 -1
- package/dist/service/services/order.service.js.map +1 -1
- package/dist/service/services/product.service.js +2 -2
- package/dist/service/services/product.service.js.map +1 -1
- package/dist/service/services/shipping-method.service.js +1 -1
- package/dist/service/services/shipping-method.service.js.map +1 -1
- package/package.json +3 -3
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.userHasPermissionsOnCustomField = void 0;
|
|
4
4
|
function userHasPermissionsOnCustomField(ctx, fieldDef) {
|
|
5
5
|
var _a;
|
|
6
|
+
if (ctx.apiType === 'shop' && fieldDef.public === true) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
6
9
|
const requiresPermission = (_a = fieldDef.requiresPermission) !== null && _a !== void 0 ? _a : [];
|
|
7
10
|
const permissionsArray = Array.isArray(requiresPermission) ? requiresPermission : [requiresPermission];
|
|
8
11
|
if (permissionsArray.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-has-permissions-on-custom-field.js","sourceRoot":"","sources":["../../../src/api/common/user-has-permissions-on-custom-field.ts"],"names":[],"mappings":";;;AAMA,SAAgB,+BAA+B,CAAC,GAAmB,EAAE,QAA2B;;IAC5F,MAAM,kBAAkB,GAAG,MAAC,QAAQ,CAAC,kBAAmC,mCAAI,EAAE,CAAC;IAC/E,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACvG,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,GAAG,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AACpD,CAAC;
|
|
1
|
+
{"version":3,"file":"user-has-permissions-on-custom-field.js","sourceRoot":"","sources":["../../../src/api/common/user-has-permissions-on-custom-field.ts"],"names":[],"mappings":";;;AAMA,SAAgB,+BAA+B,CAAC,GAAmB,EAAE,QAA2B;;IAC5F,IAAI,GAAG,CAAC,OAAO,KAAK,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,kBAAkB,GAAG,MAAC,QAAQ,CAAC,kBAAmC,mCAAI,EAAE,CAAC;IAC/E,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACvG,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,GAAG,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AACpD,CAAC;AAVD,0EAUC"}
|
|
@@ -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));
|
|
@@ -16,6 +16,7 @@ export declare class OrderEntityResolver {
|
|
|
16
16
|
surcharges(ctx: RequestContext, order: Order): Promise<import("../../..").Surcharge[]>;
|
|
17
17
|
customer(ctx: RequestContext, order: Order): Promise<import("../../..").Customer | undefined>;
|
|
18
18
|
lines(ctx: RequestContext, order: Order): Promise<import("../../..").OrderLine[]>;
|
|
19
|
+
shippingLines(ctx: RequestContext, order: Order): Promise<import("../../..").ShippingLine[]>;
|
|
19
20
|
history(ctx: RequestContext, apiType: ApiType, order: Order, args: OrderHistoryArgs): Promise<import("@vendure/common/lib/shared-types").PaginatedList<import("../../../entity/history-entry/order-history-entry.entity").OrderHistoryEntry>>;
|
|
20
21
|
promotions(ctx: RequestContext, order: Order): Promise<import("../../..").Promotion[]>;
|
|
21
22
|
}
|
|
@@ -63,6 +63,13 @@ let OrderEntityResolver = class OrderEntityResolver {
|
|
|
63
63
|
const { lines } = await (0, utils_1.assertFound)(this.orderService.findOne(ctx, order.id));
|
|
64
64
|
return lines;
|
|
65
65
|
}
|
|
66
|
+
async shippingLines(ctx, order) {
|
|
67
|
+
if (order.shippingLines) {
|
|
68
|
+
return order.shippingLines;
|
|
69
|
+
}
|
|
70
|
+
const { shippingLines } = await (0, utils_1.assertFound)(this.orderService.findOne(ctx, order.id, ['shippingLines.shippingMethod']));
|
|
71
|
+
return shippingLines;
|
|
72
|
+
}
|
|
66
73
|
async history(ctx, apiType, order, args) {
|
|
67
74
|
const publicOnly = apiType === 'shop';
|
|
68
75
|
const options = Object.assign({}, args.options);
|
|
@@ -123,6 +130,14 @@ __decorate([
|
|
|
123
130
|
__metadata("design:paramtypes", [request_context_1.RequestContext, order_entity_1.Order]),
|
|
124
131
|
__metadata("design:returntype", Promise)
|
|
125
132
|
], OrderEntityResolver.prototype, "lines", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, graphql_1.ResolveField)(),
|
|
135
|
+
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
136
|
+
__param(1, (0, graphql_1.Parent)()),
|
|
137
|
+
__metadata("design:type", Function),
|
|
138
|
+
__metadata("design:paramtypes", [request_context_1.RequestContext, order_entity_1.Order]),
|
|
139
|
+
__metadata("design:returntype", Promise)
|
|
140
|
+
], OrderEntityResolver.prototype, "shippingLines", null);
|
|
126
141
|
__decorate([
|
|
127
142
|
(0, graphql_1.ResolveField)(),
|
|
128
143
|
__param(0, (0, request_context_decorator_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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AAc,EAAmB,oBAAK;;wDAKhE;AAGK;IADL,IAAA,sBAAY,GAAE;IACM,WAAA,IAAA,+BAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,gBAAM,GAAE,CAAA;;qCAAzB,gCAAc,EAAmB,oBAAK;;6DAKrE;AAGK;IADL,IAAA,sBAAY,GAAE;IACG,WAAA,IAAA,gBAAM,GAAE,CAAA;;qCAAQ,oBAAK;;0DAEtC;AAGK;IADL,IAAA,sBAAY,GAAE;IACK,WAAA,IAAA,+BAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,gBAAM,GAAE,CAAA;;qCAAzB,gCAAc,EAAmB,oBAAK;;4DAOpE;AAGK;IADL,IAAA,sBAAY,GAAE;IACO,WAAA,IAAA,+BAAG,GAAE,CAAA;IAAuB,WAAA,IAAA,gBAAM,GAAE,CAAA;;qCAAzB,gCAAc,EAAmB,oBAAK;;8DAQtE;mCA3CQ,wBAAwB;IADpC,IAAA,kBAAQ,EAAC,OAAO,CAAC;qCAEoB,4BAAY;GADrC,wBAAwB,CA4CpC"}
|
package/dist/app.module.js
CHANGED
|
@@ -8,9 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.AppModule = void 0;
|
|
13
16
|
const common_1 = require("@nestjs/common");
|
|
17
|
+
const cookie_session_1 = __importDefault(require("cookie-session"));
|
|
14
18
|
const api_module_1 = require("./api/api.module");
|
|
15
19
|
const config_module_1 = require("./config/config.module");
|
|
16
20
|
const config_service_1 = require("./config/config.service");
|
|
@@ -29,12 +33,30 @@ let AppModule = class AppModule {
|
|
|
29
33
|
}
|
|
30
34
|
configure(consumer) {
|
|
31
35
|
const { adminApiPath, shopApiPath, middleware } = this.configService.apiOptions;
|
|
36
|
+
const { cookieOptions } = this.configService.authOptions;
|
|
32
37
|
const i18nextHandler = this.i18nService.handle();
|
|
33
38
|
const defaultMiddleware = [
|
|
34
39
|
{ handler: i18nextHandler, route: adminApiPath },
|
|
35
40
|
{ handler: i18nextHandler, route: shopApiPath },
|
|
36
41
|
];
|
|
37
42
|
const allMiddleware = defaultMiddleware.concat(middleware);
|
|
43
|
+
// If the Admin API and Shop API should have specific cookies names, we need to create separate cookie sessions
|
|
44
|
+
if (typeof (cookieOptions === null || cookieOptions === void 0 ? void 0 : cookieOptions.name) === 'object') {
|
|
45
|
+
const shopApiCookieName = cookieOptions.name.shop;
|
|
46
|
+
const adminApiCookieName = cookieOptions.name.admin;
|
|
47
|
+
allMiddleware.push({
|
|
48
|
+
handler: (0, cookie_session_1.default)(Object.assign(Object.assign({}, cookieOptions), { name: adminApiCookieName })),
|
|
49
|
+
route: adminApiPath,
|
|
50
|
+
});
|
|
51
|
+
allMiddleware.push({
|
|
52
|
+
handler: (0, cookie_session_1.default)(Object.assign(Object.assign({}, cookieOptions), { name: shopApiCookieName })),
|
|
53
|
+
route: shopApiPath,
|
|
54
|
+
});
|
|
55
|
+
allMiddleware.push({
|
|
56
|
+
handler: (0, cookie_session_1.default)(Object.assign(Object.assign({}, cookieOptions), { name: shopApiCookieName })),
|
|
57
|
+
route: '/',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
38
60
|
const consumableMiddlewares = allMiddleware.filter(mid => !mid.beforeListen);
|
|
39
61
|
const middlewareByRoute = this.groupMiddlewareByRoute(consumableMiddlewares);
|
|
40
62
|
for (const [route, handlers] of Object.entries(middlewareByRoute)) {
|
|
@@ -75,6 +97,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
75
97
|
connection_module_1.ConnectionModule,
|
|
76
98
|
],
|
|
77
99
|
}),
|
|
78
|
-
__metadata("design:paramtypes", [config_service_1.ConfigService,
|
|
100
|
+
__metadata("design:paramtypes", [config_service_1.ConfigService,
|
|
101
|
+
i18n_service_1.I18nService])
|
|
79
102
|
], AppModule);
|
|
80
103
|
//# sourceMappingURL=app.module.js.map
|
package/dist/app.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+F;AAC/F,oEAA2C;AAE3C,iDAA6C;AAE7C,0DAAsD;AACtD,4DAAwD;AACxD,mEAAwD;AACxD,sEAAkE;AAClE,4EAAuE;AACvE,oDAAgD;AAChD,sDAAkD;AAClD,0DAAsD;AACtD,qFAAgF;AAChF,6DAAyD;AAclD,IAAM,SAAS,GAAf,MAAM,SAAS;IAClB,YACY,aAA4B,EAC5B,WAAwB;QADxB,kBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAW,GAAX,WAAW,CAAa;IACjC,CAAC;IAEJ,SAAS,CAAC,QAA4B;QAClC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC;QAChF,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;QAEzD,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QACjD,MAAM,iBAAiB,GAAiB;YACpC,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE;YAChD,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE;SAClD,CAAC;QAEF,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE3D,+GAA+G;QAC/G,I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ED;;OAEG;IACK,sBAAsB,CAAC,eAA6B;QACxD,MAAM,MAAM,GAAG,EAA8C,CAAC;QAC9D,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACvB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAhEY,8BAAS;oBAAT,SAAS;IAZrB,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,6CAAoB;YACpB,4BAAY;YACZ,wBAAU;YACV,sBAAS;YACT,4BAAY,CAAC,OAAO,EAAE;YACtB,uCAAiB;YACjB,8BAAa;YACb,oCAAgB;SACnB;KACJ,CAAC;qCAG6B,8BAAa;QACf,0BAAW;GAH3B,SAAS,CAgErB"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -199,7 +199,8 @@ async function runPluginConfigurations(config) {
|
|
|
199
199
|
for (const plugin of config.plugins) {
|
|
200
200
|
const configFn = (0, plugin_metadata_1.getConfigurationFunction)(plugin);
|
|
201
201
|
if (typeof configFn === 'function') {
|
|
202
|
-
|
|
202
|
+
const result = await configFn(config);
|
|
203
|
+
Object.assign(config, result);
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
206
|
return config;
|
|
@@ -324,16 +325,9 @@ async function validateDbTablesForWorker(worker) {
|
|
|
324
325
|
function configureSessionCookies(app, userConfig) {
|
|
325
326
|
var _a;
|
|
326
327
|
const { cookieOptions } = userConfig.authOptions;
|
|
327
|
-
// If the Admin API and Shop API should have
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const adminApiCookieName = cookieOptions.name.admin;
|
|
331
|
-
const { shopApiPath, adminApiPath } = userConfig.apiOptions;
|
|
332
|
-
app.use(cookieSession(Object.assign(Object.assign({}, cookieOptions), { name: shopApiCookieName })));
|
|
333
|
-
app.use(`/${shopApiPath}`, cookieSession(Object.assign(Object.assign({}, cookieOptions), { name: shopApiCookieName })));
|
|
334
|
-
app.use(`/${adminApiPath}`, cookieSession(Object.assign(Object.assign({}, cookieOptions), { name: adminApiCookieName })));
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
328
|
+
// If the Admin API and Shop API should have the same cookie name
|
|
329
|
+
// Else, the specific cookie middlewares are handled in the 'AppModule#configure' method
|
|
330
|
+
if (typeof (cookieOptions === null || cookieOptions === void 0 ? void 0 : cookieOptions.name) === 'string' || (cookieOptions === null || cookieOptions === void 0 ? void 0 : cookieOptions.name) === undefined) {
|
|
337
331
|
app.use(cookieSession(Object.assign(Object.assign({}, cookieOptions), { name: (_a = cookieOptions === null || cookieOptions === void 0 ? void 0 : cookieOptions.name) !== null && _a !== void 0 ? _a : shared_constants_1.DEFAULT_COOKIE_NAME })));
|
|
338
332
|
}
|
|
339
333
|
}
|