@medusajs/link-modules 0.2.12 → 1.0.0-rc-20241003153304
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/definitions/cart-payment-collection.d.ts +2 -1
- package/dist/definitions/cart-payment-collection.d.ts.map +1 -0
- package/dist/definitions/cart-payment-collection.js +15 -9
- package/dist/definitions/cart-payment-collection.js.map +1 -0
- package/dist/definitions/cart-promotion.d.ts +2 -1
- package/dist/definitions/cart-promotion.d.ts.map +1 -0
- package/dist/definitions/cart-promotion.js +22 -18
- package/dist/definitions/cart-promotion.js.map +1 -0
- package/dist/definitions/fulfillment-provider-location.d.ts +3 -0
- package/dist/definitions/fulfillment-provider-location.d.ts.map +1 -0
- package/dist/definitions/fulfillment-provider-location.js +72 -0
- package/dist/definitions/fulfillment-provider-location.js.map +1 -0
- package/dist/definitions/fulfillment-set-location.d.ts +3 -2
- package/dist/definitions/fulfillment-set-location.d.ts.map +1 -0
- package/dist/definitions/fulfillment-set-location.js +42 -33
- package/dist/definitions/fulfillment-set-location.js.map +1 -0
- package/dist/definitions/index.d.ts +7 -9
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/definitions/index.js +7 -9
- package/dist/definitions/index.js.map +1 -0
- package/dist/definitions/order-cart.d.ts +3 -0
- package/dist/definitions/order-cart.d.ts.map +1 -0
- package/dist/definitions/order-cart.js +68 -0
- package/dist/definitions/order-cart.js.map +1 -0
- package/dist/definitions/order-claim-payment-collection.d.ts +3 -0
- package/dist/definitions/order-claim-payment-collection.d.ts.map +1 -0
- package/dist/definitions/order-claim-payment-collection.js +74 -0
- package/dist/definitions/order-claim-payment-collection.js.map +1 -0
- package/dist/definitions/order-exchange-payment-collection.d.ts +3 -0
- package/dist/definitions/order-exchange-payment-collection.d.ts.map +1 -0
- package/dist/definitions/order-exchange-payment-collection.js +74 -0
- package/dist/definitions/order-exchange-payment-collection.js.map +1 -0
- package/dist/definitions/order-fulfillment.d.ts +3 -0
- package/dist/definitions/order-fulfillment.d.ts.map +1 -0
- package/dist/definitions/order-fulfillment.js +72 -0
- package/dist/definitions/order-fulfillment.js.map +1 -0
- package/dist/definitions/order-payment-collection.d.ts +3 -0
- package/dist/definitions/order-payment-collection.d.ts.map +1 -0
- package/dist/definitions/order-payment-collection.js +72 -0
- package/dist/definitions/order-payment-collection.js.map +1 -0
- package/dist/definitions/order-promotion.d.ts +2 -1
- package/dist/definitions/order-promotion.d.ts.map +1 -0
- package/dist/definitions/order-promotion.js +20 -11
- package/dist/definitions/order-promotion.js.map +1 -0
- package/dist/definitions/order-return-fulfillment.d.ts +3 -0
- package/dist/definitions/order-return-fulfillment.d.ts.map +1 -0
- package/dist/definitions/order-return-fulfillment.js +69 -0
- package/dist/definitions/order-return-fulfillment.js.map +1 -0
- package/dist/definitions/product-sales-channel.d.ts +2 -1
- package/dist/definitions/product-sales-channel.d.ts.map +1 -0
- package/dist/definitions/product-sales-channel.js +18 -9
- package/dist/definitions/product-sales-channel.js.map +1 -0
- package/dist/definitions/product-variant-inventory-item.d.ts +2 -1
- package/dist/definitions/product-variant-inventory-item.d.ts.map +1 -0
- package/dist/definitions/product-variant-inventory-item.js +21 -11
- package/dist/definitions/product-variant-inventory-item.js.map +1 -0
- package/dist/definitions/product-variant-price-set.d.ts +2 -1
- package/dist/definitions/product-variant-price-set.d.ts.map +1 -0
- package/dist/definitions/product-variant-price-set.js +18 -12
- package/dist/definitions/product-variant-price-set.js.map +1 -0
- package/dist/definitions/publishable-api-key-sales-channel.d.ts +2 -1
- package/dist/definitions/publishable-api-key-sales-channel.d.ts.map +1 -0
- package/dist/definitions/publishable-api-key-sales-channel.js +22 -8
- package/dist/definitions/publishable-api-key-sales-channel.js.map +1 -0
- package/dist/definitions/readonly/cart-customer.d.ts +3 -0
- package/dist/definitions/readonly/cart-customer.d.ts.map +1 -0
- package/dist/definitions/{cart-customer.js → readonly/cart-customer.js} +14 -5
- package/dist/definitions/readonly/cart-customer.js.map +1 -0
- package/dist/definitions/readonly/cart-product.d.ts +3 -0
- package/dist/definitions/readonly/cart-product.d.ts.map +1 -0
- package/dist/definitions/readonly/cart-product.js +50 -0
- package/dist/definitions/readonly/cart-product.js.map +1 -0
- package/dist/definitions/readonly/cart-region.d.ts +3 -0
- package/dist/definitions/readonly/cart-region.d.ts.map +1 -0
- package/dist/definitions/{cart-region.js → readonly/cart-region.js} +14 -5
- package/dist/definitions/readonly/cart-region.js.map +1 -0
- package/dist/definitions/readonly/cart-sales-channel.d.ts +3 -0
- package/dist/definitions/readonly/cart-sales-channel.d.ts.map +1 -0
- package/dist/definitions/{cart-sales-channel.js → readonly/cart-sales-channel.js} +14 -5
- package/dist/definitions/readonly/cart-sales-channel.js.map +1 -0
- package/dist/definitions/readonly/index.d.ts +12 -0
- package/dist/definitions/readonly/index.d.ts.map +1 -0
- package/dist/definitions/readonly/index.js +28 -0
- package/dist/definitions/readonly/index.js.map +1 -0
- package/dist/definitions/readonly/inventory-level-stock-location.d.ts +3 -0
- package/dist/definitions/readonly/inventory-level-stock-location.d.ts.map +1 -0
- package/dist/definitions/{inventory-level-stock-location.js → readonly/inventory-level-stock-location.js} +8 -3
- package/dist/definitions/readonly/inventory-level-stock-location.js.map +1 -0
- package/dist/definitions/readonly/line-item-adjustment-promotion.d.ts +3 -0
- package/dist/definitions/readonly/line-item-adjustment-promotion.d.ts.map +1 -0
- package/dist/definitions/readonly/line-item-adjustment-promotion.js +24 -0
- package/dist/definitions/readonly/line-item-adjustment-promotion.js.map +1 -0
- package/dist/definitions/readonly/order-customer.d.ts +3 -0
- package/dist/definitions/readonly/order-customer.d.ts.map +1 -0
- package/dist/definitions/{order-customer.js → readonly/order-customer.js} +14 -5
- package/dist/definitions/readonly/order-customer.js.map +1 -0
- package/dist/definitions/readonly/order-product.d.ts +3 -0
- package/dist/definitions/readonly/order-product.d.ts.map +1 -0
- package/dist/definitions/readonly/order-product.js +51 -0
- package/dist/definitions/readonly/order-product.js.map +1 -0
- package/dist/definitions/readonly/order-region.d.ts +3 -0
- package/dist/definitions/readonly/order-region.d.ts.map +1 -0
- package/dist/definitions/{order-region.js → readonly/order-region.js} +14 -5
- package/dist/definitions/readonly/order-region.js.map +1 -0
- package/dist/definitions/readonly/order-sales-channel.d.ts +3 -0
- package/dist/definitions/readonly/order-sales-channel.d.ts.map +1 -0
- package/dist/definitions/readonly/order-sales-channel.js +38 -0
- package/dist/definitions/readonly/order-sales-channel.js.map +1 -0
- package/dist/definitions/readonly/store-currency.d.ts +3 -0
- package/dist/definitions/readonly/store-currency.d.ts.map +1 -0
- package/dist/definitions/readonly/store-currency.js +24 -0
- package/dist/definitions/readonly/store-currency.js.map +1 -0
- package/dist/definitions/region-payment-provider.d.ts +2 -1
- package/dist/definitions/region-payment-provider.d.ts.map +1 -0
- package/dist/definitions/region-payment-provider.js +20 -11
- package/dist/definitions/region-payment-provider.js.map +1 -0
- package/dist/definitions/sales-channel-location.d.ts +2 -1
- package/dist/definitions/sales-channel-location.d.ts.map +1 -0
- package/dist/definitions/sales-channel-location.js +23 -11
- package/dist/definitions/sales-channel-location.js.map +1 -0
- package/dist/definitions/shipping-option-price-set.d.ts +2 -1
- package/dist/definitions/shipping-option-price-set.d.ts.map +1 -0
- package/dist/definitions/shipping-option-price-set.js +12 -9
- package/dist/definitions/shipping-option-price-set.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -0
- package/dist/initialize/index.d.ts +13 -4
- package/dist/initialize/index.d.ts.map +1 -0
- package/dist/initialize/index.js +42 -28
- package/dist/initialize/index.js.map +1 -0
- package/dist/initialize/module-definition.d.ts +2 -1
- package/dist/initialize/module-definition.d.ts.map +1 -0
- package/dist/initialize/module-definition.js +2 -2
- package/dist/initialize/module-definition.js.map +1 -0
- package/dist/loaders/connection.d.ts +2 -1
- package/dist/loaders/connection.d.ts.map +1 -0
- package/dist/loaders/connection.js +3 -3
- package/dist/loaders/connection.js.map +1 -0
- package/dist/loaders/container.d.ts +2 -2
- package/dist/loaders/container.d.ts.map +1 -0
- package/dist/loaders/container.js +6 -7
- package/dist/loaders/container.js.map +1 -0
- package/dist/loaders/index.d.ts +2 -1
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +2 -2
- package/dist/loaders/index.js.map +1 -0
- package/dist/migration/index.d.ts +103 -2
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +341 -46
- package/dist/migration/index.js.map +1 -0
- package/dist/repositories/index.d.ts +2 -1
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +2 -1
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/link.d.ts +20 -20
- package/dist/repositories/link.d.ts.map +1 -0
- package/dist/repositories/link.js +3 -3
- package/dist/repositories/link.js.map +1 -0
- package/dist/services/dynamic-service-class.d.ts +2 -1
- package/dist/services/dynamic-service-class.d.ts.map +1 -0
- package/dist/services/dynamic-service-class.js +10 -3
- package/dist/services/dynamic-service-class.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/link-module-service.d.ts +9 -7
- package/dist/services/link-module-service.d.ts.map +1 -0
- package/dist/services/link-module-service.js +38 -45
- package/dist/services/link-module-service.js.map +1 -0
- package/dist/services/link.d.ts +2 -1
- package/dist/services/link.d.ts.map +1 -0
- package/dist/services/link.js +2 -1
- package/dist/services/link.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/compress-name.d.ts +2 -0
- package/dist/utils/compress-name.d.ts.map +1 -0
- package/dist/utils/compress-name.js +33 -0
- package/dist/utils/compress-name.js.map +1 -0
- package/dist/utils/generate-entity.d.ts +2 -1
- package/dist/utils/generate-entity.d.ts.map +1 -0
- package/dist/utils/generate-entity.js +6 -6
- package/dist/utils/generate-entity.js.map +1 -0
- package/dist/utils/generate-schema.d.ts +2 -1
- package/dist/utils/generate-schema.d.ts.map +1 -0
- package/dist/utils/generate-schema.js +76 -20
- package/dist/utils/generate-schema.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -6
- package/dist/utils/index.js.map +1 -0
- package/package.json +22 -15
- package/dist/definitions/cart-customer.d.ts +0 -2
- package/dist/definitions/cart-region.d.ts +0 -2
- package/dist/definitions/cart-sales-channel.d.ts +0 -2
- package/dist/definitions/inventory-level-stock-location.d.ts +0 -2
- package/dist/definitions/order-customer.d.ts +0 -2
- package/dist/definitions/order-region.d.ts +0 -2
- package/dist/definitions/order-sales-channel.d.ts +0 -2
- package/dist/definitions/order-sales-channel.js +0 -67
- package/dist/definitions/product-shipping-profile.d.ts +0 -2
- package/dist/definitions/product-shipping-profile.js +0 -61
- package/dist/definitions/store-default-currency.d.ts +0 -2
- package/dist/definitions/store-default-currency.js +0 -19
- package/dist/utils/compose-link-name.d.ts +0 -2
- package/dist/utils/compose-link-name.js +0 -12
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"link-module-service.d.ts","sourceRoot":"","sources":["../../src/services/link-module-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,UAAU,EACV,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EASL,OAAO,EAER,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGvC,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;IAC7B,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,UAAU,EAAE,MAAM,CAA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a,GAAE,OAAY,GAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IA+CtC,QAAQ,CACZ,IAAI,EAAE,GAAG,EACQ,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;CAGjD"}
|
@@ -12,10 +12,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const utils_1 = require("@medusajs/utils");
|
15
|
+
const utils_1 = require("@medusajs/framework/utils");
|
16
16
|
const utils_2 = require("../utils");
|
17
17
|
class LinkModuleService {
|
18
|
-
constructor({ baseRepository, linkService,
|
18
|
+
constructor({ baseRepository, linkService, primaryKey, foreignKey, extraFields, entityName, serviceName, [utils_1.Modules.EVENT_BUS]: eventBusModuleService, }, moduleDeclaration) {
|
19
19
|
this.moduleDeclaration = moduleDeclaration;
|
20
20
|
this.baseRepository_ = baseRepository;
|
21
21
|
this.linkService_ = linkService;
|
@@ -71,14 +71,14 @@ class LinkModuleService {
|
|
71
71
|
config.take = null;
|
72
72
|
}
|
73
73
|
const rows = await this.linkService_.list(filters, config, sharedContext);
|
74
|
-
return
|
74
|
+
return rows.map((row) => row.toJSON());
|
75
75
|
}
|
76
76
|
async listAndCount(filters = {}, config = {}, sharedContext = {}) {
|
77
77
|
if (!(0, utils_1.isDefined)(config.take)) {
|
78
78
|
config.take = null;
|
79
79
|
}
|
80
80
|
const [rows, count] = await this.linkService_.listAndCount(filters, config, sharedContext);
|
81
|
-
return [
|
81
|
+
return [rows.map((row) => row.toJSON()), count];
|
82
82
|
}
|
83
83
|
async create(primaryKeyOrBulkData, foreignKeyData, extraFields, sharedContext = {}) {
|
84
84
|
const data = [];
|
@@ -92,18 +92,16 @@ class LinkModuleService {
|
|
92
92
|
}
|
93
93
|
const links = await this.linkService_.create(data, sharedContext);
|
94
94
|
await this.eventBusModuleService_?.emit(data.map(({ id }) => ({
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
eventGroupId: sharedContext.eventGroupId,
|
102
|
-
},
|
103
|
-
data: { id },
|
95
|
+
name: this.entityName_ + "." + utils_1.CommonEvents.ATTACHED,
|
96
|
+
metadata: {
|
97
|
+
source: this.serviceName_,
|
98
|
+
action: utils_1.CommonEvents.ATTACHED,
|
99
|
+
object: this.entityName_,
|
100
|
+
eventGroupId: sharedContext.eventGroupId,
|
104
101
|
},
|
102
|
+
data: { id },
|
105
103
|
})));
|
106
|
-
return
|
104
|
+
return links.map((row) => row.toJSON());
|
107
105
|
}
|
108
106
|
async dismiss(primaryKeyOrBulkData, foreignKeyData, sharedContext = {}) {
|
109
107
|
const data = [];
|
@@ -116,23 +114,21 @@ class LinkModuleService {
|
|
116
114
|
data.push(this.buildData(primaryKeyOrBulkData, foreignKeyData));
|
117
115
|
}
|
118
116
|
const links = await this.linkService_.dismiss(data, sharedContext);
|
119
|
-
return
|
117
|
+
return links.map((row) => row.toJSON());
|
120
118
|
}
|
121
119
|
async delete(data, sharedContext = {}) {
|
122
120
|
this.validateFields(data);
|
123
121
|
await this.linkService_.delete(data, sharedContext);
|
124
122
|
const allData = Array.isArray(data) ? data : [data];
|
125
123
|
await this.eventBusModuleService_?.emit(allData.map(({ id }) => ({
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
eventGroupId: sharedContext.eventGroupId,
|
133
|
-
},
|
134
|
-
data: { id },
|
124
|
+
name: this.entityName_ + "." + utils_1.CommonEvents.DETACHED,
|
125
|
+
metadata: {
|
126
|
+
source: this.serviceName_,
|
127
|
+
action: utils_1.CommonEvents.DETACHED,
|
128
|
+
object: this.entityName_,
|
129
|
+
eventGroupId: sharedContext.eventGroupId,
|
135
130
|
},
|
131
|
+
data: { id },
|
136
132
|
})));
|
137
133
|
}
|
138
134
|
async softDelete(data, { returnLinkableKeys } = {}, sharedContext = {}) {
|
@@ -155,16 +151,14 @@ class LinkModuleService {
|
|
155
151
|
});
|
156
152
|
}
|
157
153
|
await this.eventBusModuleService_?.emit(deletedEntities.map(({ id }) => ({
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
eventGroupId: sharedContext.eventGroupId,
|
165
|
-
},
|
166
|
-
data: { id },
|
154
|
+
name: this.entityName_ + "." + utils_1.CommonEvents.DETACHED,
|
155
|
+
metadata: {
|
156
|
+
source: this.serviceName_,
|
157
|
+
action: utils_1.CommonEvents.DETACHED,
|
158
|
+
object: this.entityName_,
|
159
|
+
eventGroupId: sharedContext.eventGroupId,
|
167
160
|
},
|
161
|
+
data: { id },
|
168
162
|
})));
|
169
163
|
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0;
|
170
164
|
}
|
@@ -191,16 +185,14 @@ class LinkModuleService {
|
|
191
185
|
});
|
192
186
|
}
|
193
187
|
await this.eventBusModuleService_?.emit(restoredEntities.map(({ id }) => ({
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
eventGroupId: sharedContext.eventGroupId,
|
201
|
-
},
|
202
|
-
data: { id },
|
188
|
+
name: this.entityName_ + "." + utils_1.CommonEvents.ATTACHED,
|
189
|
+
metadata: {
|
190
|
+
source: this.serviceName_,
|
191
|
+
action: utils_1.CommonEvents.ATTACHED,
|
192
|
+
object: this.entityName_,
|
193
|
+
eventGroupId: sharedContext.eventGroupId,
|
203
194
|
},
|
195
|
+
data: { id },
|
204
196
|
})));
|
205
197
|
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0;
|
206
198
|
}
|
@@ -210,21 +202,21 @@ class LinkModuleService {
|
|
210
202
|
}
|
211
203
|
exports.default = LinkModuleService;
|
212
204
|
__decorate([
|
213
|
-
(0, utils_1.InjectManager)(
|
205
|
+
(0, utils_1.InjectManager)(),
|
214
206
|
__param(2, (0, utils_1.MedusaContext)()),
|
215
207
|
__metadata("design:type", Function),
|
216
208
|
__metadata("design:paramtypes", [Object, String, Object]),
|
217
209
|
__metadata("design:returntype", Promise)
|
218
210
|
], LinkModuleService.prototype, "retrieve", null);
|
219
211
|
__decorate([
|
220
|
-
(0, utils_1.InjectManager)(
|
212
|
+
(0, utils_1.InjectManager)(),
|
221
213
|
__param(2, (0, utils_1.MedusaContext)()),
|
222
214
|
__metadata("design:type", Function),
|
223
215
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
224
216
|
__metadata("design:returntype", Promise)
|
225
217
|
], LinkModuleService.prototype, "list", null);
|
226
218
|
__decorate([
|
227
|
-
(0, utils_1.InjectManager)(
|
219
|
+
(0, utils_1.InjectManager)(),
|
228
220
|
__param(2, (0, utils_1.MedusaContext)()),
|
229
221
|
__metadata("design:type", Function),
|
230
222
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
@@ -277,3 +269,4 @@ __decorate([
|
|
277
269
|
__metadata("design:paramtypes", [Object, Object]),
|
278
270
|
__metadata("design:returntype", Promise)
|
279
271
|
], LinkModuleService.prototype, "restore_", null);
|
272
|
+
//# sourceMappingURL=link-module-service.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"link-module-service.js","sourceRoot":"","sources":["../../src/services/link-module-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA,qDAWkC;AAElC,oCAAiD;AAajD,MAAqB,iBAAiB;IAUpC,YACE,EACE,cAAc,EACd,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,CAAC,eAAO,CAAC,SAAS,CAAC,EAAE,qBAAqB,GACrB,EACd,iBAA4C;QAA5C,sBAAiB,GAAjB,iBAAiB,CAA2B;QAErD,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QAC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AA,IAAA,qBAAa,GAAE,CAAA;;;;+CAmBjB;AAEK;IAGH,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;mDA8CjB;AAGe;IADf,IAAA,gCAAwB,EAAC,8BAAsB,EAAE,iBAAiB,CAAC;IAGjE,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;oDAGjB;AAEK;IAGH,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;gDA6CjB;AAGK;IADL,IAAA,gCAAwB,EAAC,8BAAsB,EAAE,iBAAiB,CAAC;IAGjE,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;iDAGjB"}
|
package/dist/services/link.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Context, FindConfig } from "@medusajs/types";
|
1
|
+
import { Context, FindConfig } from "@medusajs/framework/types";
|
2
2
|
type InjectedDependencies = {
|
3
3
|
linkRepository: any;
|
4
4
|
};
|
@@ -14,3 +14,4 @@ export default class LinkService<TEntity> {
|
|
14
14
|
restore(data: any, sharedContext?: Context): Promise<[object[], Record<string, string[]>]>;
|
15
15
|
}
|
16
16
|
export {};
|
17
|
+
//# sourceMappingURL=link.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/services/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAS/D,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAA;CACpB,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,OAAO;IACtC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAA;gBAE3B,EAAE,cAAc,EAAE,EAAE,oBAAoB;IAK9C,IAAI,CACR,OAAO,GAAE,OAAY,EACrB,MAAM,GAAE,UAAU,CAAC,OAAO,CAAM,EACf,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,OAAO,EAAE,CAAC;IASf,YAAY,CAChB,OAAO,KAAK,EACZ,MAAM,GAAE,UAAU,CAAC,OAAO,CAAM,EACf,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IAMzB,MAAM,CACV,IAAI,EAAE,OAAO,EAAE,EACE,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,OAAO,EAAE,CAAC;IAOf,OAAO,CACX,IAAI,EAAE,OAAO,EAAE,EACE,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,OAAO,EAAE,CAAC;IAqBf,MAAM,CACV,IAAI,EAAE,OAAO,EACI,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,IAAI,CAAC;IAOV,UAAU,CACd,IAAI,EAAE,GAAG,EAAE,EACM,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAqB1C,OAAO,CACX,IAAI,EAAE,GAAG,EACQ,aAAa,GAAE,OAAY,GAC3C,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;CAmBjD"}
|
package/dist/services/link.js
CHANGED
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const utils_1 = require("@medusajs/utils");
|
15
|
+
const utils_1 = require("@medusajs/framework/utils");
|
16
16
|
const utils_2 = require("../utils");
|
17
17
|
class LinkService {
|
18
18
|
constructor({ linkRepository }) {
|
@@ -137,3 +137,4 @@ __decorate([
|
|
137
137
|
__metadata("design:paramtypes", [Object, Object]),
|
138
138
|
__metadata("design:returntype", Promise)
|
139
139
|
], LinkService.prototype, "restore", null);
|
140
|
+
//# sourceMappingURL=link.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CAAC;IAGhE,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;6CAmBjB;AAGK;IADL,IAAA,gCAAwB,EAAC,6BAAqB,EAAE,iBAAiB,CAAC;IAGhE,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;0CAmBjB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"root":["../src/index.ts","../src/definitions/cart-payment-collection.ts","../src/definitions/cart-promotion.ts","../src/definitions/fulfillment-provider-location.ts","../src/definitions/fulfillment-set-location.ts","../src/definitions/index.ts","../src/definitions/order-cart.ts","../src/definitions/order-claim-payment-collection.ts","../src/definitions/order-exchange-payment-collection.ts","../src/definitions/order-fulfillment.ts","../src/definitions/order-payment-collection.ts","../src/definitions/order-promotion.ts","../src/definitions/order-return-fulfillment.ts","../src/definitions/product-sales-channel.ts","../src/definitions/product-variant-inventory-item.ts","../src/definitions/product-variant-price-set.ts","../src/definitions/publishable-api-key-sales-channel.ts","../src/definitions/region-payment-provider.ts","../src/definitions/sales-channel-location.ts","../src/definitions/shipping-option-price-set.ts","../src/definitions/readonly/cart-customer.ts","../src/definitions/readonly/cart-product.ts","../src/definitions/readonly/cart-region.ts","../src/definitions/readonly/cart-sales-channel.ts","../src/definitions/readonly/index.ts","../src/definitions/readonly/inventory-level-stock-location.ts","../src/definitions/readonly/line-item-adjustment-promotion.ts","../src/definitions/readonly/order-customer.ts","../src/definitions/readonly/order-product.ts","../src/definitions/readonly/order-region.ts","../src/definitions/readonly/order-sales-channel.ts","../src/definitions/readonly/store-currency.ts","../src/initialize/index.ts","../src/initialize/module-definition.ts","../src/loaders/connection.ts","../src/loaders/container.ts","../src/loaders/index.ts","../src/migration/index.ts","../src/repositories/index.ts","../src/repositories/link.ts","../src/services/dynamic-service-class.ts","../src/services/index.ts","../src/services/link-module-service.ts","../src/services/link.ts","../src/types/index.ts","../src/utils/compress-name.ts","../src/utils/generate-entity.ts","../src/utils/generate-schema.ts","../src/utils/index.ts","../src/utils/__tests__/compress-name.spec.ts"],"version":"5.6.2"}
|
package/dist/types/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
package/dist/types/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"compress-name.d.ts","sourceRoot":"","sources":["../../src/utils/compress-name.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK,UAmCpD"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.compressName = compressName;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
|
+
function compressName(name, limit = 58) {
|
6
|
+
if (name.length <= limit) {
|
7
|
+
return name.toLowerCase();
|
8
|
+
}
|
9
|
+
const hash = (0, utils_1.simpleHash)(name).toLowerCase();
|
10
|
+
const hashLength = hash.length;
|
11
|
+
// Remove consecutive duplicates
|
12
|
+
const parts = name.toLowerCase().split("_");
|
13
|
+
const deduplicatedParts = [];
|
14
|
+
for (let i = 0; i < parts.length; i++) {
|
15
|
+
if (i === 0 || parts[i] !== parts[i - 1]) {
|
16
|
+
deduplicatedParts.push(parts[i]);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
let result = deduplicatedParts.join("_");
|
20
|
+
// If still greater than the limit, truncate each part to 4 characters
|
21
|
+
if (result.length > limit) {
|
22
|
+
const allParts = (0, utils_1.camelToSnakeCase)(name).split("_");
|
23
|
+
result = allParts.map((part) => part.substring(0, 4)).join("_");
|
24
|
+
}
|
25
|
+
name = result;
|
26
|
+
const nameLength = name.length;
|
27
|
+
const diff = nameLength + hashLength - limit;
|
28
|
+
if (diff > 0) {
|
29
|
+
return name.slice(0, nameLength - diff) + hash;
|
30
|
+
}
|
31
|
+
return (name + hash).toLowerCase();
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=compress-name.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"compress-name.js","sourceRoot":"","sources":["../../src/utils/compress-name.ts"],"names":[],"mappings":";;AAEA,oCAmCC;AArCD,qDAAwE;AAExE,SAAgB,YAAY,CAAC,IAAY,EAAE,KAAK,GAAG,EAAE;IACnD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;IAE9B,gCAAgC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3C,MAAM,iBAAiB,GAAa,EAAE,CAAA;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACzC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;IAED,IAAI,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAExC,sEAAsE;IACtE,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClD,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACjE,CAAC;IAED,IAAI,GAAG,MAAM,CAAA;IACb,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;IAC9B,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,CAAA;IAE5C,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;IAChD,CAAC;IAED,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;AACpC,CAAC"}
|
@@ -1,3 +1,4 @@
|
|
1
|
-
import { JoinerRelationship, ModuleJoinerConfig } from "@medusajs/types";
|
1
|
+
import { JoinerRelationship, ModuleJoinerConfig } from "@medusajs/framework/types";
|
2
2
|
import { EntitySchema } from "@mikro-orm/core";
|
3
3
|
export declare function generateEntity(joinerConfig: ModuleJoinerConfig, primary: JoinerRelationship, foreign: JoinerRelationship): EntitySchema<any, never>;
|
4
|
+
//# sourceMappingURL=generate-entity.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate-entity.d.ts","sourceRoot":"","sources":["../../src/utils/generate-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAQlC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAa9C,wBAAgB,cAAc,CAC5B,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,kBAAkB,4BA6F5B"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateEntity =
|
4
|
-
const utils_1 = require("@medusajs/utils");
|
3
|
+
exports.generateEntity = generateEntity;
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
5
5
|
const core_1 = require("@mikro-orm/core");
|
6
|
-
const
|
6
|
+
const compress_name_1 = require("./compress-name");
|
7
7
|
function getClass(...properties) {
|
8
8
|
return class LinkModel {
|
9
9
|
constructor(...values) {
|
@@ -16,7 +16,7 @@ function getClass(...properties) {
|
|
16
16
|
function generateEntity(joinerConfig, primary, foreign) {
|
17
17
|
const fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey);
|
18
18
|
const tableName = joinerConfig.databaseConfig?.tableName ??
|
19
|
-
(0,
|
19
|
+
(0, utils_1.composeTableName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey);
|
20
20
|
const fields = fieldNames.reduce((acc, curr) => {
|
21
21
|
acc[curr] = {
|
22
22
|
type: "string",
|
@@ -38,7 +38,7 @@ function generateEntity(joinerConfig, primary, foreign) {
|
|
38
38
|
const hashTableName = (0, utils_1.simpleHash)(tableName);
|
39
39
|
return new core_1.EntitySchema({
|
40
40
|
class: getClass(...fieldNames.concat("created_at", "updated_at", "deleted_at")),
|
41
|
-
tableName,
|
41
|
+
tableName: (0, compress_name_1.compressName)(tableName),
|
42
42
|
properties: {
|
43
43
|
id: {
|
44
44
|
type: "string",
|
@@ -90,4 +90,4 @@ function generateEntity(joinerConfig, primary, foreign) {
|
|
90
90
|
],
|
91
91
|
});
|
92
92
|
}
|
93
|
-
|
93
|
+
//# sourceMappingURL=generate-entity.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate-entity.js","sourceRoot":"","sources":["../../src/utils/generate-entity.ts"],"names":[],"mappings":";;AAwBA,wCAgGC;AAp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F,MAAM;oBACN,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;oBACvC,GAAG;oBACH,aAAa;aAChB;YACD;gBACE,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,GAAG,GAAG,aAAa;aACxD;YACD;gBACE,UAAU,EAAE,CAAC,YAAY,CAAC;gBAC1B,IAAI,EAAE,iBAAiB,GAAG,aAAa;aACxC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { ModuleJoinerConfig, ModuleJoinerRelationship } from "@medusajs/types";
|
1
|
+
import { ModuleJoinerConfig, ModuleJoinerRelationship } from "@medusajs/framework/types";
|
2
2
|
export declare function generateGraphQLSchema(joinerConfig: ModuleJoinerConfig, primary: ModuleJoinerRelationship, foreign: ModuleJoinerRelationship, { logger }?: {
|
3
3
|
logger: any;
|
4
4
|
}): string;
|
5
|
+
//# sourceMappingURL=generate-schema.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate-schema.d.ts","sourceRoot":"","sources":["../../src/utils/generate-schema.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,2BAA2B,CAAA;AASlC,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,wBAAwB,EACjC,EAAE,MAAM,EAAE,GAAE;IAAE,MAAM,MAAA;CAAwB,UAmM7C"}
|
@@ -1,44 +1,93 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.generateGraphQLSchema =
|
4
|
-
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
5
|
-
const utils_1 = require("@medusajs/utils");
|
6
|
-
const compose_link_name_1 = require("./compose-link-name");
|
3
|
+
exports.generateGraphQLSchema = generateGraphQLSchema;
|
4
|
+
const modules_sdk_1 = require("@medusajs/framework/modules-sdk");
|
5
|
+
const utils_1 = require("@medusajs/framework/utils");
|
7
6
|
function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { logger: console }) {
|
8
7
|
let fieldNames;
|
9
8
|
let entityName;
|
10
|
-
|
9
|
+
const isReadOnlyLink = joinerConfig.isReadOnlyLink;
|
10
|
+
if (!isReadOnlyLink) {
|
11
11
|
fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey);
|
12
12
|
entityName = (0, utils_1.toPascalCase)("Link_" +
|
13
13
|
(joinerConfig.databaseConfig?.tableName ??
|
14
|
-
(0,
|
14
|
+
(0, utils_1.composeTableName)(primary.serviceName, primary.foreignKey, foreign.serviceName, foreign.foreignKey)));
|
15
15
|
}
|
16
16
|
let typeDef = "";
|
17
17
|
for (const extend of joinerConfig.extends ?? []) {
|
18
18
|
const extendedModule = modules_sdk_1.MedusaModule.getModuleInstance(extend.serviceName);
|
19
|
-
if (!extendedModule
|
19
|
+
if (!extendedModule) {
|
20
20
|
throw new Error(`Module ${extend.serviceName} not found. Please verify that the module is configured and installed, also the module must be loaded before the link modules.`);
|
21
21
|
}
|
22
|
-
const extJoinerConfig =
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
/* const extJoinerConfig = MedusaModule.getJoinerConfig(
|
23
|
+
extend.relationship.serviceName
|
24
|
+
)*/
|
25
|
+
const extendedEntityName = extendedModule[extend.serviceName].__joinerConfig.linkableKeys[extend.relationship.primaryKey];
|
26
|
+
if (!isReadOnlyLink && (!primary || !foreign || !extendedEntityName)) {
|
27
|
+
logger.warn(`Link modules schema: No linkable key found for ${extend.relationship.primaryKey} on module ${extend.serviceName}.`);
|
26
28
|
continue;
|
27
29
|
}
|
28
30
|
const fieldName = (0, utils_1.camelToSnakeCase)((0, utils_1.lowerCaseFirst)(extend.relationship.alias));
|
29
31
|
let type = extend.relationship.isList ? `[${entityName}]` : entityName;
|
30
|
-
if (
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
if (joinerConfig?.isReadOnlyLink) {
|
33
|
+
// TODO: In readonly, the relation ship of the extend should be applied on all entities in the module that have the relationshiop foregin key attribute
|
34
|
+
/*type = extend.relationship.isList
|
35
|
+
? `[${extendedEntityName}]`
|
36
|
+
: extendedEntityName*/
|
37
|
+
continue;
|
34
38
|
}
|
39
|
+
/**
|
40
|
+
* Find the field aliases shortcut to extend the entity with it
|
41
|
+
*/
|
42
|
+
const fieldsAliasesField = Object.entries(extend.fieldAlias || {})
|
43
|
+
.map(([field, config]) => {
|
44
|
+
const path = (0, utils_1.isString)(config) ? config : config.path;
|
45
|
+
const isList = (0, utils_1.isString)(config)
|
46
|
+
? extend.relationship.isList
|
47
|
+
: config.isList ?? extend.relationship.isList;
|
48
|
+
// const pathSegments = path.split(",").reverse()
|
49
|
+
/*const relationshipMarkerIndex = pathSegments.findIndex((segment) => {
|
50
|
+
return !!joinerConfig.relationships!.find(
|
51
|
+
(relation) => relation.alias === targetEntityAlias
|
52
|
+
)
|
53
|
+
})
|
54
|
+
|
55
|
+
if (relationshipMarkerIndex === -1) {
|
56
|
+
return
|
57
|
+
}*/
|
58
|
+
/*const relationshipPropertyPath = pathSegments
|
59
|
+
.slice(0, relationshipMarkerIndex + 1)
|
60
|
+
.reverse()*/
|
61
|
+
const targetEntityAlias = path.split(".").pop();
|
62
|
+
const targetEntityRelation = joinerConfig.relationships?.find((relation) => relation.alias === targetEntityAlias);
|
63
|
+
if (!targetEntityRelation) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
const targetEntityName = modules_sdk_1.MedusaModule.getJoinerConfig(targetEntityRelation.serviceName).linkableKeys?.[targetEntityRelation.foreignKey];
|
67
|
+
if (!targetEntityName) {
|
68
|
+
logger.warn(`Link modules schema: No linkable key found for ${targetEntityRelation.foreignKey} on module ${targetEntityRelation.serviceName}.`);
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
// TODO: Re visit field aliases that access properties from a type
|
72
|
+
/*const targetEntityType = `${targetEntityName}${
|
73
|
+
relationshipPropertyPath.length
|
74
|
+
? relationshipPropertyPath.reduce((acc, value) => {
|
75
|
+
return `${acc}[${value}]`
|
76
|
+
}, targetEntityName)
|
77
|
+
: ""
|
78
|
+
}`*/
|
79
|
+
return `${field}: ${isList ? `[${targetEntityName}]` : targetEntityName}`;
|
80
|
+
})
|
81
|
+
.filter(Boolean);
|
35
82
|
typeDef += `
|
36
|
-
extend type ${
|
83
|
+
extend type ${extendedEntityName} {
|
37
84
|
${fieldName}: ${type}
|
85
|
+
|
86
|
+
${fieldsAliasesField.join("\n")}
|
38
87
|
}
|
39
88
|
`;
|
40
89
|
}
|
41
|
-
if (
|
90
|
+
if (isReadOnlyLink) {
|
42
91
|
return typeDef;
|
43
92
|
}
|
44
93
|
// Pivot table fields
|
@@ -56,9 +105,16 @@ function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { lo
|
|
56
105
|
nullable: !!extraFields[column].nullable,
|
57
106
|
};
|
58
107
|
}
|
108
|
+
// TODO: temporary, every module might always expose their schema
|
109
|
+
const doesPrimaryExportSchema = !!modules_sdk_1.MedusaModule.getJoinerConfig(primary.serviceName)?.schema;
|
110
|
+
const doesForeignExportSchema = !!modules_sdk_1.MedusaModule.getJoinerConfig(foreign.serviceName)?.schema;
|
59
111
|
// Link table relationships
|
60
|
-
const primaryField =
|
61
|
-
|
112
|
+
const primaryField = doesPrimaryExportSchema
|
113
|
+
? `${(0, utils_1.camelToSnakeCase)(primary.alias)}: ${(0, utils_1.toPascalCase)((0, utils_1.composeTableName)(primary.serviceName))}`
|
114
|
+
: "";
|
115
|
+
const foreignField = doesForeignExportSchema
|
116
|
+
? `${(0, utils_1.camelToSnakeCase)(foreign.alias)}: ${(0, utils_1.toPascalCase)((0, utils_1.composeTableName)(foreign.serviceName))}`
|
117
|
+
: "";
|
62
118
|
typeDef += `
|
63
119
|
type ${entityName} {
|
64
120
|
${Object.entries(fields)
|
@@ -75,7 +131,6 @@ function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { lo
|
|
75
131
|
`;
|
76
132
|
return typeDef;
|
77
133
|
}
|
78
|
-
exports.generateGraphQLSchema = generateGraphQLSchema;
|
79
134
|
function getGraphQLType(type) {
|
80
135
|
const typeDef = {
|
81
136
|
numeric: "Float",
|
@@ -104,3 +159,4 @@ function getGraphQLType(type) {
|
|
104
159
|
};
|
105
160
|
return typeDef[type] ?? "String";
|
106
161
|
}
|
162
|
+
//# sourceMappingURL=generate-schema.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"generate-schema.js","sourceRoot":"","sources":["../../src/utils/generate-schema.ts"],"names":[],"mappings":";;AAaA,sDAuMC;AApND,iEAA8D;AAK9D,qDAMkC;AAElC,SAAgB,qBAAqB,CACnC,YAAgC,EAChC,OAAiC,EACjC,OAAiC,EACjC,EAAE,MAAM,KAAiB,EAAE,MAAM,EAAE,OAAO,EAAE;IAE5C,IAAI,UAAqB,CAAA;IACzB,IAAI,UAAmB,CAAA;IAEvB,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,CAAA;IAClD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAErE,UAAU,GAAG,IAAA,oBAAY,EACvB,OAAO;YACL,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS;gBACrC,IAAA,wBAAgB,EACd,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,UAAU,CACnB,CAAC,CACP,CAAA;IACH,CAAC;IAED,IAAI,OAAO,GAAG,EAAE,CAAA;IAEhB,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QAChD,MAAM,cAAc,G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AAO,CAAC,MAAM,CAAS;SAC9B,GAAG,CACF,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAC9B,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,CAC9C;SACA,IAAI,CAAC,UAAU,CAAC;;QAEjB,YAAY;QACZ,YAAY;;;;;;GAMjB,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,IAAI;IAC1B,MAAM,OAAO,GAAG;QACd,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,UAAU;QACjB,SAAS,EAAE,UAAU;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;KACd,CAAA;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAA;AAClC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from "./compose-link-name";
|
2
1
|
export * from "./generate-entity";
|
3
2
|
export * from "./generate-schema";
|
4
3
|
export declare function shouldForceTransaction(target: any): boolean;
|
5
4
|
export declare function doNotForceTransaction(): boolean;
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AAEjC,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAE3D;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
|
package/dist/utils/index.js
CHANGED
@@ -14,16 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.
|
18
|
-
|
19
|
-
|
17
|
+
exports.shouldForceTransaction = shouldForceTransaction;
|
18
|
+
exports.doNotForceTransaction = doNotForceTransaction;
|
19
|
+
const modules_sdk_1 = require("@medusajs/framework/modules-sdk");
|
20
20
|
__exportStar(require("./generate-entity"), exports);
|
21
21
|
__exportStar(require("./generate-schema"), exports);
|
22
22
|
function shouldForceTransaction(target) {
|
23
|
-
return target.moduleDeclaration?.resources ===
|
23
|
+
return target.moduleDeclaration?.resources === modules_sdk_1.MODULE_RESOURCE_TYPE.ISOLATED;
|
24
24
|
}
|
25
|
-
exports.shouldForceTransaction = shouldForceTransaction;
|
26
25
|
function doNotForceTransaction() {
|
27
26
|
return false;
|
28
27
|
}
|
29
|
-
|
28
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,wDAEC;AAED,sDAEC;AAXD,iEAAsE;AAEtE,oDAAiC;AACjC,oDAAiC;AAEjC,SAAgB,sBAAsB,CAAC,MAAW;IAChD,OAAO,MAAM,CAAC,iBAAiB,EAAE,SAAS,KAAK,kCAAoB,CAAC,QAAQ,CAAA;AAC9E,CAAC;AAED,SAAgB,qBAAqB;IACnC,OAAO,KAAK,CAAA;AACd,CAAC"}
|