@medusajs/link-modules 0.2.12-snapshot-20240521095428 → 0.2.12-snapshot-20240522193310
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/definitions/customer-auth.d.ts +2 -0
- package/dist/definitions/customer-auth.js +63 -0
- package/dist/definitions/index.d.ts +2 -0
- package/dist/definitions/index.js +2 -0
- package/dist/definitions/user-auth.d.ts +2 -0
- package/dist/definitions/user-auth.js +63 -0
- package/dist/utils/generate-schema.js +6 -3
- package/package.json +4 -4
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.CustomerAuth = void 0;
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
6
|
+
exports.CustomerAuth = {
|
7
|
+
serviceName: utils_1.LINKS.CustomerAuth,
|
8
|
+
isLink: true,
|
9
|
+
databaseConfig: {
|
10
|
+
tableName: "customer_auth_identity",
|
11
|
+
idPrefix: "cusauth",
|
12
|
+
},
|
13
|
+
alias: [
|
14
|
+
{
|
15
|
+
name: "customer_auth_identity",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: "customer_auth_identities",
|
19
|
+
},
|
20
|
+
],
|
21
|
+
primaryKeys: ["id", "customer_id", "auth_identity_id"],
|
22
|
+
relationships: [
|
23
|
+
{
|
24
|
+
serviceName: modules_sdk_1.Modules.CUSTOMER,
|
25
|
+
primaryKey: "id",
|
26
|
+
foreignKey: "customer_id",
|
27
|
+
alias: "customer",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
serviceName: modules_sdk_1.Modules.AUTH,
|
31
|
+
isInternalService: true,
|
32
|
+
primaryKey: "id",
|
33
|
+
foreignKey: "auth_identity_id",
|
34
|
+
alias: "auth",
|
35
|
+
},
|
36
|
+
],
|
37
|
+
extends: [
|
38
|
+
{
|
39
|
+
serviceName: modules_sdk_1.Modules.CUSTOMER,
|
40
|
+
fieldAlias: {
|
41
|
+
auth_identity: "auth_link.auth_identity",
|
42
|
+
},
|
43
|
+
relationship: {
|
44
|
+
serviceName: utils_1.LINKS.CustomerAuth,
|
45
|
+
primaryKey: "customer_id",
|
46
|
+
foreignKey: "id",
|
47
|
+
alias: "auth_link",
|
48
|
+
},
|
49
|
+
},
|
50
|
+
{
|
51
|
+
serviceName: modules_sdk_1.Modules.AUTH,
|
52
|
+
fieldAlias: {
|
53
|
+
customer: "customer_link.customer",
|
54
|
+
},
|
55
|
+
relationship: {
|
56
|
+
serviceName: utils_1.LINKS.CustomerAuth,
|
57
|
+
primaryKey: "auth_identity_id",
|
58
|
+
foreignKey: "id",
|
59
|
+
alias: "customer_link",
|
60
|
+
},
|
61
|
+
},
|
62
|
+
],
|
63
|
+
};
|
@@ -30,3 +30,5 @@ __exportStar(require("./region-payment-provider"), exports);
|
|
30
30
|
__exportStar(require("./sales-channel-location"), exports);
|
31
31
|
__exportStar(require("./shipping-option-price-set"), exports);
|
32
32
|
__exportStar(require("./order-fulfillment"), exports);
|
33
|
+
__exportStar(require("./user-auth"), exports);
|
34
|
+
__exportStar(require("./customer-auth"), exports);
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UserAuth = void 0;
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
6
|
+
exports.UserAuth = {
|
7
|
+
serviceName: utils_1.LINKS.UserAuth,
|
8
|
+
isLink: true,
|
9
|
+
databaseConfig: {
|
10
|
+
tableName: "user_auth_identity",
|
11
|
+
idPrefix: "usrauth",
|
12
|
+
},
|
13
|
+
alias: [
|
14
|
+
{
|
15
|
+
name: "user_auth_identity",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: "user_auth_identities",
|
19
|
+
},
|
20
|
+
],
|
21
|
+
primaryKeys: ["id", "user_id", "auth_identity_id"],
|
22
|
+
relationships: [
|
23
|
+
{
|
24
|
+
serviceName: modules_sdk_1.Modules.USER,
|
25
|
+
primaryKey: "id",
|
26
|
+
foreignKey: "user_id",
|
27
|
+
alias: "user",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
serviceName: modules_sdk_1.Modules.AUTH,
|
31
|
+
isInternalService: true,
|
32
|
+
primaryKey: "id",
|
33
|
+
foreignKey: "auth_identity_id",
|
34
|
+
alias: "auth",
|
35
|
+
},
|
36
|
+
],
|
37
|
+
extends: [
|
38
|
+
{
|
39
|
+
serviceName: modules_sdk_1.Modules.USER,
|
40
|
+
fieldAlias: {
|
41
|
+
auth_identity: "auth_link.auth_identity",
|
42
|
+
},
|
43
|
+
relationship: {
|
44
|
+
serviceName: utils_1.LINKS.UserAuth,
|
45
|
+
primaryKey: "user_id",
|
46
|
+
foreignKey: "id",
|
47
|
+
alias: "auth_link",
|
48
|
+
},
|
49
|
+
},
|
50
|
+
{
|
51
|
+
serviceName: modules_sdk_1.Modules.AUTH,
|
52
|
+
fieldAlias: {
|
53
|
+
user: "user_link.user",
|
54
|
+
},
|
55
|
+
relationship: {
|
56
|
+
serviceName: utils_1.LINKS.UserAuth,
|
57
|
+
primaryKey: "auth_identity_id",
|
58
|
+
foreignKey: "id",
|
59
|
+
alias: "user_link",
|
60
|
+
},
|
61
|
+
},
|
62
|
+
],
|
63
|
+
};
|
@@ -7,7 +7,8 @@ const compose_link_name_1 = require("./compose-link-name");
|
|
7
7
|
function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { logger: console }) {
|
8
8
|
let fieldNames;
|
9
9
|
let entityName;
|
10
|
-
|
10
|
+
const isReadOnlyLink = joinerConfig.isReadOnlyLink;
|
11
|
+
if (!isReadOnlyLink) {
|
11
12
|
fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey);
|
12
13
|
entityName = (0, utils_1.toPascalCase)("Link_" +
|
13
14
|
(joinerConfig.databaseConfig?.tableName ??
|
@@ -16,7 +17,9 @@ function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { lo
|
|
16
17
|
let typeDef = "";
|
17
18
|
for (const extend of joinerConfig.extends ?? []) {
|
18
19
|
const extendedModule = modules_sdk_1.MedusaModule.getModuleInstance(extend.serviceName);
|
19
|
-
if (!
|
20
|
+
if (!isReadOnlyLink &&
|
21
|
+
!extendedModule &&
|
22
|
+
!extend.relationship.isInternalService) {
|
20
23
|
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
24
|
}
|
22
25
|
const extJoinerConfig = modules_sdk_1.MedusaModule.getJoinerConfig(extend.relationship.serviceName);
|
@@ -38,7 +41,7 @@ function generateGraphQLSchema(joinerConfig, primary, foreign, { logger } = { lo
|
|
38
41
|
}
|
39
42
|
`;
|
40
43
|
}
|
41
|
-
if (
|
44
|
+
if (isReadOnlyLink) {
|
42
45
|
return typeDef;
|
43
46
|
}
|
44
47
|
// Pivot table fields
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/link-modules",
|
3
|
-
"version": "0.2.12-snapshot-
|
3
|
+
"version": "0.2.12-snapshot-20240522193310",
|
4
4
|
"description": "Medusa Default Link Modules Package and Definitions",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -39,9 +39,9 @@
|
|
39
39
|
"typescript": "^5.1.6"
|
40
40
|
},
|
41
41
|
"dependencies": {
|
42
|
-
"@medusajs/modules-sdk": "1.13.0-snapshot-
|
43
|
-
"@medusajs/types": "1.12.0-snapshot-
|
44
|
-
"@medusajs/utils": "1.12.0-snapshot-
|
42
|
+
"@medusajs/modules-sdk": "1.13.0-snapshot-20240522193310",
|
43
|
+
"@medusajs/types": "1.12.0-snapshot-20240522193310",
|
44
|
+
"@medusajs/utils": "1.12.0-snapshot-20240522193310",
|
45
45
|
"@mikro-orm/core": "5.9.7",
|
46
46
|
"@mikro-orm/postgresql": "5.9.7",
|
47
47
|
"awilix": "^8.0.0"
|