@medusajs/search 0.0.1
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/README.md +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -0
- package/dist/initialize/index.d.ts +8 -0
- package/dist/initialize/index.js +17 -0
- package/dist/joiner-config.d.ts +2 -0
- package/dist/joiner-config.js +4 -0
- package/dist/loaders/connection.d.ts +4 -0
- package/dist/loaders/connection.js +41 -0
- package/dist/loaders/container.d.ts +4 -0
- package/dist/loaders/container.js +21 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.js +10 -0
- package/dist/migrations/Migration20231019174230.d.ts +4 -0
- package/dist/migrations/Migration20231019174230.js +18 -0
- package/dist/models/catalog-relation.d.ts +15 -0
- package/dist/models/catalog-relation.js +72 -0
- package/dist/models/catalog.d.ts +11 -0
- package/dist/models/catalog.js +55 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +18 -0
- package/dist/module-definition.d.ts +2 -0
- package/dist/module-definition.js +15 -0
- package/dist/scripts/bin/run-migration-down.d.ts +3 -0
- package/dist/scripts/bin/run-migration-down.js +32 -0
- package/dist/scripts/bin/run-migration-up.d.ts +3 -0
- package/dist/scripts/bin/run-migration-up.js +32 -0
- package/dist/scripts/bin/run-seed.d.ts +3 -0
- package/dist/scripts/bin/run-seed.js +38 -0
- package/dist/scripts/index.d.ts +2 -0
- package/dist/scripts/index.js +18 -0
- package/dist/scripts/migration-down.d.ts +10 -0
- package/dist/scripts/migration-down.js +52 -0
- package/dist/scripts/migration-up.d.ts +10 -0
- package/dist/scripts/migration-up.js +56 -0
- package/dist/scripts/seed-data/index.d.ts +8 -0
- package/dist/scripts/seed-data/index.js +138 -0
- package/dist/scripts/seed.d.ts +5 -0
- package/dist/scripts/seed.js +65 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +8 -0
- package/dist/services/postgres-provider.d.ts +126 -0
- package/dist/services/postgres-provider.js +441 -0
- package/dist/services/search-module-service.d.ts +31 -0
- package/dist/services/search-module-service.js +66 -0
- package/dist/types/index.d.ts +122 -0
- package/dist/types/index.js +7 -0
- package/dist/utils/build-config.d.ts +21 -0
- package/dist/utils/build-config.js +437 -0
- package/dist/utils/create-partitions.d.ts +3 -0
- package/dist/utils/create-partitions.js +27 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/query-builder.d.ts +28 -0
- package/dist/utils/query-builder.js +375 -0
- package/package.json +67 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.runMigrations = void 0;
|
|
27
|
+
const utils_1 = require("@medusajs/utils");
|
|
28
|
+
const SearchModels = __importStar(require("../models"));
|
|
29
|
+
/**
|
|
30
|
+
* This script is only valid for mikro orm managers. If a user provide a custom manager
|
|
31
|
+
* he is in charge of running the migrations.
|
|
32
|
+
* @param options
|
|
33
|
+
* @param logger
|
|
34
|
+
* @param moduleDeclaration
|
|
35
|
+
*/
|
|
36
|
+
async function runMigrations({ options, logger, } = {}) {
|
|
37
|
+
logger ?? (logger = console);
|
|
38
|
+
const dbData = utils_1.ModulesSdkUtils.loadDatabaseConfig("search", options?.defaultAdapterOptions);
|
|
39
|
+
const entities = Object.values(SearchModels);
|
|
40
|
+
const pathToMigrations = __dirname + "/../migrations";
|
|
41
|
+
const orm = await utils_1.DALUtils.mikroOrmCreateConnection(dbData, entities, pathToMigrations);
|
|
42
|
+
try {
|
|
43
|
+
const migrator = orm.getMigrator();
|
|
44
|
+
const pendingMigrations = await migrator.getPendingMigrations();
|
|
45
|
+
logger.info(`Running pending migrations: ${pendingMigrations}`);
|
|
46
|
+
await migrator.up({
|
|
47
|
+
migrations: pendingMigrations.map((m) => m.name),
|
|
48
|
+
});
|
|
49
|
+
logger.info("Search module migration executed");
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
logger.error(`Search module migration failed to run - Error: ${error}`);
|
|
53
|
+
}
|
|
54
|
+
await orm.close();
|
|
55
|
+
}
|
|
56
|
+
exports.runMigrations = runMigrations;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchData = exports.createRandomEntries = void 0;
|
|
4
|
+
// ESM
|
|
5
|
+
const faker_1 = require("@faker-js/faker");
|
|
6
|
+
function createRandomEntries() {
|
|
7
|
+
const productId = faker_1.faker.string.uuid();
|
|
8
|
+
const catalogEntries = [];
|
|
9
|
+
const catalogRelationEntries = [];
|
|
10
|
+
/**
|
|
11
|
+
* build product entry
|
|
12
|
+
*/
|
|
13
|
+
const productEntry = {
|
|
14
|
+
id: productId,
|
|
15
|
+
name: "Product",
|
|
16
|
+
data: {
|
|
17
|
+
id: productId,
|
|
18
|
+
title: faker_1.faker.commerce.productName(),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
catalogEntries.push(productEntry);
|
|
22
|
+
/**
|
|
23
|
+
* build 10 variant entries
|
|
24
|
+
*/
|
|
25
|
+
for (let i = 0; i < 10; i++) {
|
|
26
|
+
const variantId = faker_1.faker.string.uuid();
|
|
27
|
+
const variantEntry = {
|
|
28
|
+
id: variantId,
|
|
29
|
+
name: "ProductVariant",
|
|
30
|
+
data: {
|
|
31
|
+
id: variantId,
|
|
32
|
+
title: faker_1.faker.commerce.productName(),
|
|
33
|
+
product_id: productId,
|
|
34
|
+
sku: faker_1.faker.commerce.productName(),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
catalogEntries.push(variantEntry);
|
|
38
|
+
/**
|
|
39
|
+
* build relation between product and variant
|
|
40
|
+
*/
|
|
41
|
+
const productVariantRelationEntry = {
|
|
42
|
+
parent_id: productId,
|
|
43
|
+
parent_name: "Product",
|
|
44
|
+
child_id: variantId,
|
|
45
|
+
child_name: "ProductVariant",
|
|
46
|
+
pivot: "Product-ProductVariant",
|
|
47
|
+
};
|
|
48
|
+
catalogRelationEntries.push(productVariantRelationEntry);
|
|
49
|
+
const priceSetId = faker_1.faker.string.uuid();
|
|
50
|
+
const linkProductPriceSetId = faker_1.faker.string.uuid();
|
|
51
|
+
/**
|
|
52
|
+
* build link entry between variant and price set
|
|
53
|
+
*/
|
|
54
|
+
const linkProductPriceSetEntry = {
|
|
55
|
+
id: linkProductPriceSetId,
|
|
56
|
+
name: "LinkProductVariantPriceSet",
|
|
57
|
+
data: {
|
|
58
|
+
id: linkProductPriceSetId,
|
|
59
|
+
variant_id: variantId,
|
|
60
|
+
price_set_id: priceSetId,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
catalogEntries.push(linkProductPriceSetEntry);
|
|
64
|
+
/**
|
|
65
|
+
* build relation between variant and link entry
|
|
66
|
+
*/
|
|
67
|
+
const variantLinkRelationEntry = {
|
|
68
|
+
parent_id: variantId,
|
|
69
|
+
parent_name: "ProductVariant",
|
|
70
|
+
child_id: linkProductPriceSetId,
|
|
71
|
+
child_name: "LinkProductVariantPriceSet",
|
|
72
|
+
pivot: "ProductVariant-LinkProductVariantPriceSet",
|
|
73
|
+
};
|
|
74
|
+
catalogRelationEntries.push(variantLinkRelationEntry);
|
|
75
|
+
/**
|
|
76
|
+
* build price set entry
|
|
77
|
+
*/
|
|
78
|
+
const priceSetEntry = {
|
|
79
|
+
id: priceSetId,
|
|
80
|
+
name: "PriceSet",
|
|
81
|
+
data: {
|
|
82
|
+
id: priceSetId,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
catalogEntries.push(priceSetEntry);
|
|
86
|
+
/**
|
|
87
|
+
* build relation between link entry and price set
|
|
88
|
+
*/
|
|
89
|
+
const linkPriceSetRelationEntry = {
|
|
90
|
+
parent_id: linkProductPriceSetId,
|
|
91
|
+
parent_name: "LinkProductVariantPriceSet",
|
|
92
|
+
child_id: priceSetId,
|
|
93
|
+
child_name: "PriceSet",
|
|
94
|
+
pivot: "LinkProductVariantPriceSet-PriceSet",
|
|
95
|
+
};
|
|
96
|
+
catalogRelationEntries.push(linkPriceSetRelationEntry);
|
|
97
|
+
/**
|
|
98
|
+
* build 3 money amount entries
|
|
99
|
+
*/
|
|
100
|
+
for (let j = 0; j < 3; j++) {
|
|
101
|
+
const moneyAmountId = faker_1.faker.string.uuid();
|
|
102
|
+
/**
|
|
103
|
+
* build money amount entry
|
|
104
|
+
*/
|
|
105
|
+
const moneyAmountEntry = {
|
|
106
|
+
id: moneyAmountId,
|
|
107
|
+
name: "MoneyAmount",
|
|
108
|
+
data: {
|
|
109
|
+
id: moneyAmountId,
|
|
110
|
+
amount: faker_1.faker.commerce.price({
|
|
111
|
+
dec: 0,
|
|
112
|
+
}),
|
|
113
|
+
//currency_code: faker.finance.currencyCode(),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
catalogEntries.push(moneyAmountEntry);
|
|
117
|
+
/**
|
|
118
|
+
* build relation between price set and money amount
|
|
119
|
+
*/
|
|
120
|
+
const moneyAmountPriceSetRelationEntry = {
|
|
121
|
+
parent_id: priceSetId,
|
|
122
|
+
parent_name: "PriceSet",
|
|
123
|
+
child_id: moneyAmountId,
|
|
124
|
+
child_name: "MoneyAmount",
|
|
125
|
+
pivot: "PriceSet-MoneyAmount",
|
|
126
|
+
};
|
|
127
|
+
catalogRelationEntries.push(moneyAmountPriceSetRelationEntry);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
catalogEntries,
|
|
132
|
+
catalogRelationEntries,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
exports.createRandomEntries = createRandomEntries;
|
|
136
|
+
exports.searchData = faker_1.faker.helpers.multiple(createRandomEntries, {
|
|
137
|
+
count: 10000,
|
|
138
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.run = void 0;
|
|
27
|
+
const utils_1 = require("@medusajs/utils");
|
|
28
|
+
const SearchModels = __importStar(require("../models"));
|
|
29
|
+
const os_1 = require("os");
|
|
30
|
+
const path_1 = require("path");
|
|
31
|
+
async function run({ options, logger, path, }) {
|
|
32
|
+
logger?.info(`Loading seed data from ${path}...`);
|
|
33
|
+
const { searchData } = await Promise.resolve(`${(0, path_1.resolve)(process.cwd(), path)}`).then(s => __importStar(require(s))).catch((e) => {
|
|
34
|
+
logger?.warn(`Failed to load seed data from ${path}. Please, provide a relative path and check that you export the following searchData.${os_1.EOL}${e}`);
|
|
35
|
+
logger?.warn(`Fallback to the default seed data from ${__dirname}/seed-data/index.ts`);
|
|
36
|
+
throw e;
|
|
37
|
+
});
|
|
38
|
+
logger ?? (logger = console);
|
|
39
|
+
const dbData = utils_1.ModulesSdkUtils.loadDatabaseConfig("search", options?.defaultAdapterOptions);
|
|
40
|
+
const entities = Object.values(SearchModels);
|
|
41
|
+
const pathToMigrations = __dirname + "/../migrations";
|
|
42
|
+
const orm = await utils_1.DALUtils.mikroOrmCreateConnection(dbData, entities, pathToMigrations);
|
|
43
|
+
const manager = orm.em.fork();
|
|
44
|
+
try {
|
|
45
|
+
logger?.info("Inserting search data...");
|
|
46
|
+
await createSearchData(manager, searchData);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
logger?.error(`Failed to insert the seed data in the PostgreSQL database ${dbData.clientUrl}.${os_1.EOL}${e}`);
|
|
50
|
+
}
|
|
51
|
+
await orm.close(true);
|
|
52
|
+
}
|
|
53
|
+
exports.run = run;
|
|
54
|
+
async function createSearchData(manager, searchData) {
|
|
55
|
+
const catalogEntries = [];
|
|
56
|
+
const catalogRelationEntries = [];
|
|
57
|
+
const catalogRepository = manager.getRepository(SearchModels.Catalog);
|
|
58
|
+
const catalogRelationRepository = manager.getRepository(SearchModels.CatalogRelation);
|
|
59
|
+
for (const searchItems of searchData) {
|
|
60
|
+
catalogEntries.push(...searchItems.catalogEntries.map((item) => catalogRepository.create(item)));
|
|
61
|
+
catalogRelationEntries.push(...searchItems.catalogRelationEntries.map((item) => catalogRelationRepository.create(item)));
|
|
62
|
+
}
|
|
63
|
+
await manager.persistAndFlush(catalogEntries);
|
|
64
|
+
await manager.persistAndFlush(catalogRelationEntries);
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SearchModuleService } from "./search-module-service";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SearchModuleService = void 0;
|
|
7
|
+
var search_module_service_1 = require("./search-module-service");
|
|
8
|
+
Object.defineProperty(exports, "SearchModuleService", { enumerable: true, get: function () { return __importDefault(search_module_service_1).default; } });
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { IEventBusModuleService, Message, RemoteJoinerQuery, Subscriber } from "@medusajs/types";
|
|
2
|
+
import { EntityManager } from "@mikro-orm/postgresql";
|
|
3
|
+
import { QueryFormat, QueryOptions, SchemaObjectEntityRepresentation, SchemaObjectRepresentation, SearchModuleOptions, StorageProvider } from "../types";
|
|
4
|
+
type InjectedDependencies = {
|
|
5
|
+
manager: EntityManager;
|
|
6
|
+
eventBusModuleService: IEventBusModuleService;
|
|
7
|
+
storageProviderCtr: StorageProvider;
|
|
8
|
+
storageProviderOptions: unknown;
|
|
9
|
+
remoteQuery: (query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any>;
|
|
10
|
+
};
|
|
11
|
+
export declare class PostgresProvider {
|
|
12
|
+
#private;
|
|
13
|
+
protected readonly eventActionToMethodMap_: {
|
|
14
|
+
created: string;
|
|
15
|
+
updated: string;
|
|
16
|
+
deleted: string;
|
|
17
|
+
attached: string;
|
|
18
|
+
detached: string;
|
|
19
|
+
};
|
|
20
|
+
protected container_: InjectedDependencies;
|
|
21
|
+
protected readonly schemaObjectRepresentation_: SchemaObjectRepresentation;
|
|
22
|
+
protected readonly schemaEntitiesMap_: Record<string, any>;
|
|
23
|
+
protected readonly moduleOptions_: SearchModuleOptions;
|
|
24
|
+
protected get remoteQuery_(): (query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any>;
|
|
25
|
+
constructor(container: any, options: {
|
|
26
|
+
schemaObjectRepresentation: SchemaObjectRepresentation;
|
|
27
|
+
entityMap: Record<string, any>;
|
|
28
|
+
}, moduleOptions: SearchModuleOptions);
|
|
29
|
+
onApplicationStart(): Promise<void>;
|
|
30
|
+
protected static parseData<TData extends {
|
|
31
|
+
id: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}>(data: TData | TData[], schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation): {
|
|
34
|
+
data: TData[];
|
|
35
|
+
entityProperties: string[];
|
|
36
|
+
parentsProperties: {
|
|
37
|
+
[entity: string]: string[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
protected static parseMessageData<T>(message?: Message<T>): {
|
|
41
|
+
action: string;
|
|
42
|
+
data: {
|
|
43
|
+
id: string;
|
|
44
|
+
}[];
|
|
45
|
+
ids: string[];
|
|
46
|
+
} | void;
|
|
47
|
+
query(selection: QueryFormat, options?: QueryOptions): any;
|
|
48
|
+
queryAndCount(selection: QueryFormat, options?: QueryOptions): Promise<any[]>;
|
|
49
|
+
consumeEvent(schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation): Subscriber;
|
|
50
|
+
/**
|
|
51
|
+
* Create the catalog entry and the catalog relation entry when this event is emitted.
|
|
52
|
+
* @param entity
|
|
53
|
+
* @param data
|
|
54
|
+
* @param schemaEntityObjectRepresentation
|
|
55
|
+
* @protected
|
|
56
|
+
*/
|
|
57
|
+
protected onCreate<TData extends {
|
|
58
|
+
id: string;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
61
|
+
entity: string;
|
|
62
|
+
data: TData | TData[];
|
|
63
|
+
schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Update the catalog entry when this event is emitted.
|
|
67
|
+
* @param entity
|
|
68
|
+
* @param data
|
|
69
|
+
* @param schemaEntityObjectRepresentation
|
|
70
|
+
* @protected
|
|
71
|
+
*/
|
|
72
|
+
protected onUpdate<TData extends {
|
|
73
|
+
id: string;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
76
|
+
entity: string;
|
|
77
|
+
data: TData | TData[];
|
|
78
|
+
schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation;
|
|
79
|
+
}): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Delete the catalog entry when this event is emitted.
|
|
82
|
+
* @param entity
|
|
83
|
+
* @param data
|
|
84
|
+
* @param schemaEntityObjectRepresentation
|
|
85
|
+
* @protected
|
|
86
|
+
*/
|
|
87
|
+
protected onDelete<TData extends {
|
|
88
|
+
id: string;
|
|
89
|
+
[key: string]: unknown;
|
|
90
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
91
|
+
entity: string;
|
|
92
|
+
data: TData | TData[];
|
|
93
|
+
schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation;
|
|
94
|
+
}): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* event emitted from the link modules to attach a link entity to its parent and child entities from the linked modules.
|
|
97
|
+
* @param entity
|
|
98
|
+
* @param data
|
|
99
|
+
* @param schemaEntityObjectRepresentation
|
|
100
|
+
* @protected
|
|
101
|
+
*/
|
|
102
|
+
protected onAttach<TData extends {
|
|
103
|
+
id: string;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
106
|
+
entity: string;
|
|
107
|
+
data: TData | TData[];
|
|
108
|
+
schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation;
|
|
109
|
+
}): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Event emitted from the link modules to detach a link entity from its parent and child entities from the linked modules.
|
|
112
|
+
* @param entity
|
|
113
|
+
* @param data
|
|
114
|
+
* @param schemaEntityObjectRepresentation
|
|
115
|
+
* @protected
|
|
116
|
+
*/
|
|
117
|
+
protected onDetach<TData extends {
|
|
118
|
+
id: string;
|
|
119
|
+
[key: string]: unknown;
|
|
120
|
+
}>({ entity, data, schemaEntityObjectRepresentation, }: {
|
|
121
|
+
entity: string;
|
|
122
|
+
data: TData | TData[];
|
|
123
|
+
schemaEntityObjectRepresentation: SchemaObjectEntityRepresentation;
|
|
124
|
+
}): Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
export {};
|