@acmekit/index 2.13.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 +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders/index.d.ts +4 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +27 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/migrations/Migration20231019174230.d.ts +5 -0
- package/dist/migrations/Migration20231019174230.d.ts.map +1 -0
- package/dist/migrations/Migration20231019174230.js +12 -0
- package/dist/migrations/Migration20231019174230.js.map +1 -0
- package/dist/migrations/Migration20241209173313.d.ts +6 -0
- package/dist/migrations/Migration20241209173313.d.ts.map +1 -0
- package/dist/migrations/Migration20241209173313.js +36 -0
- package/dist/migrations/Migration20241209173313.js.map +1 -0
- package/dist/migrations/Migration20250122154720.d.ts +6 -0
- package/dist/migrations/Migration20250122154720.d.ts.map +1 -0
- package/dist/migrations/Migration20250122154720.js +16 -0
- package/dist/migrations/Migration20250122154720.js.map +1 -0
- package/dist/migrations/Migration20250127105159.d.ts +6 -0
- package/dist/migrations/Migration20250127105159.d.ts.map +1 -0
- package/dist/migrations/Migration20250127105159.js +16 -0
- package/dist/migrations/Migration20250127105159.js.map +1 -0
- package/dist/migrations/Migration20250127144442.d.ts +6 -0
- package/dist/migrations/Migration20250127144442.d.ts.map +1 -0
- package/dist/migrations/Migration20250127144442.js +16 -0
- package/dist/migrations/Migration20250127144442.js.map +1 -0
- package/dist/migrations/Migration20250128132404.d.ts +6 -0
- package/dist/migrations/Migration20250128132404.d.ts.map +1 -0
- package/dist/migrations/Migration20250128132404.js +16 -0
- package/dist/migrations/Migration20250128132404.js.map +1 -0
- package/dist/migrations/Migration20250218132404.d.ts +6 -0
- package/dist/migrations/Migration20250218132404.d.ts.map +1 -0
- package/dist/migrations/Migration20250218132404.js +48 -0
- package/dist/migrations/Migration20250218132404.js.map +1 -0
- package/dist/migrations/Migration20250515161913.d.ts +6 -0
- package/dist/migrations/Migration20250515161913.d.ts.map +1 -0
- package/dist/migrations/Migration20250515161913.js +62 -0
- package/dist/migrations/Migration20250515161913.js.map +1 -0
- package/dist/models/index-data.d.ts +8 -0
- package/dist/models/index-data.d.ts.map +1 -0
- package/dist/models/index-data.js +12 -0
- package/dist/models/index-data.js.map +1 -0
- package/dist/models/index-metadata.d.ts +10 -0
- package/dist/models/index-metadata.d.ts.map +1 -0
- package/dist/models/index-metadata.js +23 -0
- package/dist/models/index-metadata.js.map +1 -0
- package/dist/models/index-relation.d.ts +11 -0
- package/dist/models/index-relation.d.ts.map +1 -0
- package/dist/models/index-relation.js +14 -0
- package/dist/models/index-relation.js.map +1 -0
- package/dist/models/index-sync.d.ts +7 -0
- package/dist/models/index-sync.d.ts.map +1 -0
- package/dist/models/index-sync.js +18 -0
- package/dist/models/index-sync.js.map +1 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +15 -0
- package/dist/models/index.js.map +1 -0
- package/dist/services/data-synchronizer.d.ts +35 -0
- package/dist/services/data-synchronizer.d.ts.map +1 -0
- package/dist/services/data-synchronizer.js +238 -0
- package/dist/services/data-synchronizer.js.map +1 -0
- package/dist/services/index-data.d.ts +8 -0
- package/dist/services/index-data.d.ts.map +1 -0
- package/dist/services/index-data.js +9 -0
- package/dist/services/index-data.js.map +1 -0
- package/dist/services/index-metadata.d.ts +8 -0
- package/dist/services/index-metadata.d.ts.map +1 -0
- package/dist/services/index-metadata.js +9 -0
- package/dist/services/index-metadata.js.map +1 -0
- package/dist/services/index-module-service.d.ts +75 -0
- package/dist/services/index-module-service.d.ts.map +1 -0
- package/dist/services/index-module-service.js +340 -0
- package/dist/services/index-module-service.js.map +1 -0
- package/dist/services/index-relation.d.ts +8 -0
- package/dist/services/index-relation.d.ts.map +1 -0
- package/dist/services/index-relation.js +9 -0
- package/dist/services/index-relation.js.map +1 -0
- package/dist/services/index-sync.d.ts +8 -0
- package/dist/services/index-sync.d.ts.map +1 -0
- package/dist/services/index-sync.js +9 -0
- package/dist/services/index-sync.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +9 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/postgres-provider.d.ts +132 -0
- package/dist/services/postgres-provider.d.ts.map +1 -0
- package/dist/services/postgres-provider.js +516 -0
- package/dist/services/postgres-provider.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/base-graphql-schema.d.ts +2 -0
- package/dist/utils/base-graphql-schema.d.ts.map +1 -0
- package/dist/utils/base-graphql-schema.js +10 -0
- package/dist/utils/base-graphql-schema.js.map +1 -0
- package/dist/utils/build-config.d.ts +28 -0
- package/dist/utils/build-config.d.ts.map +1 -0
- package/dist/utils/build-config.js +840 -0
- package/dist/utils/build-config.js.map +1 -0
- package/dist/utils/create-partitions.d.ts +4 -0
- package/dist/utils/create-partitions.d.ts.map +1 -0
- package/dist/utils/create-partitions.js +80 -0
- package/dist/utils/create-partitions.js.map +1 -0
- package/dist/utils/default-schema.d.ts +2 -0
- package/dist/utils/default-schema.d.ts.map +1 -0
- package/dist/utils/default-schema.js +41 -0
- package/dist/utils/default-schema.js.map +1 -0
- package/dist/utils/flatten-object-keys.d.ts +23 -0
- package/dist/utils/flatten-object-keys.d.ts.map +1 -0
- package/dist/utils/flatten-object-keys.js +54 -0
- package/dist/utils/flatten-object-keys.js.map +1 -0
- package/dist/utils/gql-to-types.d.ts +3 -0
- package/dist/utils/gql-to-types.d.ts.map +1 -0
- package/dist/utils/gql-to-types.js +98 -0
- package/dist/utils/gql-to-types.js.map +1 -0
- package/dist/utils/index-metadata-status.d.ts +7 -0
- package/dist/utils/index-metadata-status.d.ts.map +1 -0
- package/dist/utils/index-metadata-status.js +11 -0
- package/dist/utils/index-metadata-status.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +26 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/normalize-fields-selection.d.ts +2 -0
- package/dist/utils/normalize-fields-selection.d.ts.map +1 -0
- package/dist/utils/normalize-fields-selection.js +10 -0
- package/dist/utils/normalize-fields-selection.js.map +1 -0
- package/dist/utils/normalze-table-name.d.ts +3 -0
- package/dist/utils/normalze-table-name.d.ts.map +1 -0
- package/dist/utils/normalze-table-name.js +13 -0
- package/dist/utils/normalze-table-name.js.map +1 -0
- package/dist/utils/query-builder.d.ts +61 -0
- package/dist/utils/query-builder.d.ts.map +1 -0
- package/dist/utils/query-builder.js +791 -0
- package/dist/utils/query-builder.js.map +1 -0
- package/dist/utils/sync/configuration.d.ts +17 -0
- package/dist/utils/sync/configuration.d.ts.map +1 -0
- package/dist/utils/sync/configuration.js +114 -0
- package/dist/utils/sync/configuration.js.map +1 -0
- package/dist/utils/sync/orchestrator.d.ts +33 -0
- package/dist/utils/sync/orchestrator.d.ts.map +1 -0
- package/dist/utils/sync/orchestrator.js +195 -0
- package/dist/utils/sync/orchestrator.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
15
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
16
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
17
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
18
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
19
|
+
};
|
|
20
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
23
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
|
+
};
|
|
25
|
+
var _PostgresProvider_isReady_;
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.PostgresProvider = void 0;
|
|
28
|
+
const types_1 = require("@acmekit/framework/types");
|
|
29
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
30
|
+
const _models_1 = require("../models");
|
|
31
|
+
const utils_2 = require("../utils");
|
|
32
|
+
const flatten_object_keys_1 = require("../utils/flatten-object-keys");
|
|
33
|
+
const normalize_fields_selection_1 = require("../utils/normalize-fields-selection");
|
|
34
|
+
class PostgresProvider {
|
|
35
|
+
constructor(container, options, moduleOptions) {
|
|
36
|
+
_PostgresProvider_isReady_.set(this, void 0);
|
|
37
|
+
this.eventActionToMethodMap_ = {
|
|
38
|
+
created: "onCreate",
|
|
39
|
+
updated: "onUpdate",
|
|
40
|
+
deleted: "onDelete",
|
|
41
|
+
attached: "onAttach",
|
|
42
|
+
detached: "onDetach",
|
|
43
|
+
};
|
|
44
|
+
this.manager_ = container.manager;
|
|
45
|
+
this.query_ = container.query;
|
|
46
|
+
this.moduleOptions_ = moduleOptions;
|
|
47
|
+
this.baseRepository_ = container.baseRepository;
|
|
48
|
+
this.schemaObjectRepresentation_ = options.schemaObjectRepresentation;
|
|
49
|
+
this.schemaEntitiesMap_ = options.entityMap;
|
|
50
|
+
}
|
|
51
|
+
async onApplicationStart() {
|
|
52
|
+
let initalizedOk = () => { };
|
|
53
|
+
let initalizedNok = () => { };
|
|
54
|
+
__classPrivateFieldSet(this, _PostgresProvider_isReady_, new Promise((resolve, reject) => {
|
|
55
|
+
initalizedOk = resolve;
|
|
56
|
+
initalizedNok = reject;
|
|
57
|
+
}), "f");
|
|
58
|
+
await (0, utils_2.createPartitions)(this.schemaObjectRepresentation_, this.manager_.fork())
|
|
59
|
+
.then(initalizedOk)
|
|
60
|
+
.catch(initalizedNok);
|
|
61
|
+
}
|
|
62
|
+
static parseData(data, schemaEntityObjectRepresentation) {
|
|
63
|
+
const data_ = Array.isArray(data) ? data : [data];
|
|
64
|
+
// Always keep the id in the entity properties
|
|
65
|
+
const entityProperties = ["id"];
|
|
66
|
+
const parentsProperties = {};
|
|
67
|
+
/**
|
|
68
|
+
* Split fields into entity properties and parents properties
|
|
69
|
+
*/
|
|
70
|
+
schemaEntityObjectRepresentation.fields.forEach((field) => {
|
|
71
|
+
if (field.includes(".")) {
|
|
72
|
+
const parentAlias = field.split(".")[0];
|
|
73
|
+
const parentSchemaObjectRepresentation = schemaEntityObjectRepresentation.parents.find((parent) => parent.inverseSideProp === parentAlias);
|
|
74
|
+
if (!parentSchemaObjectRepresentation) {
|
|
75
|
+
throw new Error(`IndexModule error, unable to parse data for ${schemaEntityObjectRepresentation.entity}. The parent schema object representation could not be found for the alias ${parentAlias} for the entity ${schemaEntityObjectRepresentation.entity}.`);
|
|
76
|
+
}
|
|
77
|
+
parentsProperties[parentSchemaObjectRepresentation.ref.entity] ??= [];
|
|
78
|
+
parentsProperties[parentSchemaObjectRepresentation.ref.entity].push(field);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
entityProperties.push(field);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
data: data_,
|
|
86
|
+
entityProperties,
|
|
87
|
+
parentsProperties,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static parseMessageData(message) {
|
|
91
|
+
const isExpectedFormat = (0, utils_1.isDefined)(message?.data) && (0, utils_1.isDefined)(message?.metadata?.action);
|
|
92
|
+
if (!isExpectedFormat) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const result = {
|
|
96
|
+
action: "",
|
|
97
|
+
data: [],
|
|
98
|
+
ids: [],
|
|
99
|
+
};
|
|
100
|
+
result.action = message.metadata.action;
|
|
101
|
+
result.data = message.data;
|
|
102
|
+
result.data = Array.isArray(result.data) ? result.data : [result.data];
|
|
103
|
+
result.ids = result.data.flatMap((d) => Array.isArray(d.id) ? d.id : [d.id]);
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
consumeEvent(schemaEntityObjectRepresentation) {
|
|
107
|
+
return async (event) => {
|
|
108
|
+
await __classPrivateFieldGet(this, _PostgresProvider_isReady_, "f");
|
|
109
|
+
const data_ = Array.isArray(event.data)
|
|
110
|
+
? event.data
|
|
111
|
+
: [event.data];
|
|
112
|
+
let ids = data_.flatMap((d) => Array.isArray(d.id) ? d.id : [d.id]);
|
|
113
|
+
let action = event.name.split(".").pop() || "";
|
|
114
|
+
const parsedMessage = PostgresProvider.parseMessageData(event);
|
|
115
|
+
if (parsedMessage) {
|
|
116
|
+
action = parsedMessage.action;
|
|
117
|
+
ids = parsedMessage.ids;
|
|
118
|
+
}
|
|
119
|
+
const targetMethod = this.eventActionToMethodMap_[action];
|
|
120
|
+
if (!targetMethod) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const { fields, alias } = schemaEntityObjectRepresentation;
|
|
124
|
+
let withDeleted;
|
|
125
|
+
if (action === utils_1.CommonEvents.DELETED || action === utils_1.CommonEvents.DETACHED) {
|
|
126
|
+
withDeleted = true;
|
|
127
|
+
}
|
|
128
|
+
// Process ids in batches of 100
|
|
129
|
+
const batchSize = 100;
|
|
130
|
+
const idsBatches = [];
|
|
131
|
+
for (let i = 0; i < ids.length; i += batchSize) {
|
|
132
|
+
idsBatches.push(ids.slice(i, i + batchSize));
|
|
133
|
+
}
|
|
134
|
+
for (const idsBatch of idsBatches) {
|
|
135
|
+
const graphConfig = {
|
|
136
|
+
entity: alias,
|
|
137
|
+
filters: {
|
|
138
|
+
id: idsBatch,
|
|
139
|
+
},
|
|
140
|
+
fields: [...new Set(["id", ...fields])],
|
|
141
|
+
withDeleted,
|
|
142
|
+
};
|
|
143
|
+
const { data: entityData } = await this.query_.graph(graphConfig);
|
|
144
|
+
const argument = {
|
|
145
|
+
entity: schemaEntityObjectRepresentation.entity,
|
|
146
|
+
data: entityData,
|
|
147
|
+
schemaEntityObjectRepresentation,
|
|
148
|
+
};
|
|
149
|
+
await this[targetMethod](argument);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
async query(config, sharedContext = {}) {
|
|
154
|
+
await __classPrivateFieldGet(this, _PostgresProvider_isReady_, "f");
|
|
155
|
+
const { fields = [], filters = {}, joinFilters = {}, idsOnly } = config;
|
|
156
|
+
const { take, skip, order: inputOrderBy = {} } = config.pagination ?? {};
|
|
157
|
+
const select = (0, normalize_fields_selection_1.normalizeFieldsSelection)(fields);
|
|
158
|
+
const where = (0, flatten_object_keys_1.flattenObjectKeys)((0, utils_1.unflattenObjectKeys)(filters));
|
|
159
|
+
const inputOrderByObj = (0, utils_1.unflattenObjectKeys)(inputOrderBy);
|
|
160
|
+
const joinWhere = (0, flatten_object_keys_1.flattenObjectKeys)((0, utils_1.unflattenObjectKeys)(joinFilters));
|
|
161
|
+
const orderBy = (0, flatten_object_keys_1.flattenObjectKeys)(inputOrderByObj);
|
|
162
|
+
const { manager } = sharedContext;
|
|
163
|
+
let hasPagination = false;
|
|
164
|
+
let hasCount = false;
|
|
165
|
+
if ((0, utils_1.isDefined)(skip) || (0, utils_1.isDefined)(take)) {
|
|
166
|
+
hasPagination = true;
|
|
167
|
+
if ((0, utils_1.isDefined)(skip)) {
|
|
168
|
+
hasCount = true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const requestedFields = (0, utils_1.deepMerge)((0, utils_1.deepMerge)(select, filters), inputOrderByObj);
|
|
172
|
+
const connection = manager.getConnection();
|
|
173
|
+
const qb = new utils_2.QueryBuilder({
|
|
174
|
+
schema: this.schemaObjectRepresentation_,
|
|
175
|
+
entityMap: this.schemaEntitiesMap_,
|
|
176
|
+
knex: connection.getKnex(),
|
|
177
|
+
selector: {
|
|
178
|
+
select,
|
|
179
|
+
where,
|
|
180
|
+
joinWhere,
|
|
181
|
+
},
|
|
182
|
+
options: {
|
|
183
|
+
skip,
|
|
184
|
+
take,
|
|
185
|
+
orderBy,
|
|
186
|
+
},
|
|
187
|
+
rawConfig: config,
|
|
188
|
+
requestedFields,
|
|
189
|
+
idsOnly,
|
|
190
|
+
});
|
|
191
|
+
const { sql, sqlCount } = qb.buildQuery({
|
|
192
|
+
hasPagination,
|
|
193
|
+
hasCount,
|
|
194
|
+
});
|
|
195
|
+
const [resultSet, countResult] = await Promise.all([
|
|
196
|
+
manager.execute(sql),
|
|
197
|
+
hasCount ? manager.execute(sqlCount) : null,
|
|
198
|
+
]);
|
|
199
|
+
const resultMetadata = hasPagination
|
|
200
|
+
? {
|
|
201
|
+
estimate_count: hasCount
|
|
202
|
+
? parseInt(countResult[0]?.estimate_count ?? 0)
|
|
203
|
+
: undefined,
|
|
204
|
+
skip,
|
|
205
|
+
take,
|
|
206
|
+
}
|
|
207
|
+
: undefined;
|
|
208
|
+
return {
|
|
209
|
+
data: qb.buildObjectFromResultset(resultSet),
|
|
210
|
+
metadata: resultMetadata,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Create the index entry and the index relation entry when this event is emitted.
|
|
215
|
+
* @param entity
|
|
216
|
+
* @param data
|
|
217
|
+
* @param schemaEntityObjectRepresentation
|
|
218
|
+
* @param sharedContext
|
|
219
|
+
* @protected
|
|
220
|
+
*/
|
|
221
|
+
async onCreate({ entity, data, schemaEntityObjectRepresentation, }, sharedContext = {}) {
|
|
222
|
+
const { transactionManager: em } = sharedContext;
|
|
223
|
+
const indexRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexData));
|
|
224
|
+
const indexRelationRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexRelation));
|
|
225
|
+
const { data: data_, entityProperties, parentsProperties, } = PostgresProvider.parseData(data, schemaEntityObjectRepresentation);
|
|
226
|
+
/**
|
|
227
|
+
* Clean the entity data to only keep the properties that are defined in the schema
|
|
228
|
+
*/
|
|
229
|
+
const cleanedData = data_.map((entityData) => {
|
|
230
|
+
return entityProperties.reduce((acc, property) => {
|
|
231
|
+
acc[property] = entityData[property];
|
|
232
|
+
return acc;
|
|
233
|
+
}, {});
|
|
234
|
+
});
|
|
235
|
+
/**
|
|
236
|
+
* Loop through the data and create index entries for each entity as well as the
|
|
237
|
+
* index relation entries if the entity has parents
|
|
238
|
+
*/
|
|
239
|
+
const entitiesToUpsert = new Set();
|
|
240
|
+
const relationsToUpsert = new Set();
|
|
241
|
+
cleanedData.forEach((entityData, index) => {
|
|
242
|
+
entitiesToUpsert.add(JSON.stringify({
|
|
243
|
+
id: entityData.id,
|
|
244
|
+
name: entity,
|
|
245
|
+
data: entityData,
|
|
246
|
+
staled_at: null,
|
|
247
|
+
}));
|
|
248
|
+
/**
|
|
249
|
+
* Retrieve the parents to attach it to the index entry.
|
|
250
|
+
*/
|
|
251
|
+
for (const [parentEntity, parentProperties] of Object.entries(parentsProperties)) {
|
|
252
|
+
const parentAlias = parentProperties[0].split(".")[0];
|
|
253
|
+
const parentData = data_[index][parentAlias];
|
|
254
|
+
if (!parentData) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const parentDataCollection = Array.isArray(parentData)
|
|
258
|
+
? parentData
|
|
259
|
+
: [parentData];
|
|
260
|
+
for (const parentData_ of parentDataCollection) {
|
|
261
|
+
relationsToUpsert.add(JSON.stringify({
|
|
262
|
+
parent_id: parentData_.id,
|
|
263
|
+
parent_name: parentEntity,
|
|
264
|
+
child_id: entityData.id,
|
|
265
|
+
child_name: entity,
|
|
266
|
+
pivot: `${parentEntity}-${entity}`,
|
|
267
|
+
staled_at: null,
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (entitiesToUpsert.size) {
|
|
273
|
+
await indexRepository.upsertMany(Array.from(entitiesToUpsert).map((entity) => JSON.parse(entity)), {
|
|
274
|
+
onConflictAction: "merge",
|
|
275
|
+
onConflictFields: ["id", "name"],
|
|
276
|
+
onConflictMergeFields: ["data", "staled_at"],
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (relationsToUpsert.size) {
|
|
280
|
+
await indexRelationRepository.upsertMany(Array.from(relationsToUpsert).map((relation) => JSON.parse(relation)), {
|
|
281
|
+
onConflictAction: "merge",
|
|
282
|
+
onConflictFields: [
|
|
283
|
+
"pivot",
|
|
284
|
+
"parent_id",
|
|
285
|
+
"child_id",
|
|
286
|
+
"parent_name",
|
|
287
|
+
"child_name",
|
|
288
|
+
],
|
|
289
|
+
onConflictMergeFields: ["staled_at"],
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Update the index entry when this event is emitted.
|
|
295
|
+
* @param entity
|
|
296
|
+
* @param data
|
|
297
|
+
* @param schemaEntityObjectRepresentation
|
|
298
|
+
* @param sharedContext
|
|
299
|
+
* @protected
|
|
300
|
+
*/
|
|
301
|
+
async onUpdate({ entity, data, schemaEntityObjectRepresentation, }, sharedContext = {}) {
|
|
302
|
+
const { transactionManager: em } = sharedContext;
|
|
303
|
+
const indexRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexData));
|
|
304
|
+
const { data: data_, entityProperties } = PostgresProvider.parseData(data, schemaEntityObjectRepresentation);
|
|
305
|
+
await indexRepository.upsertMany(data_.map((entityData) => {
|
|
306
|
+
return {
|
|
307
|
+
id: entityData.id,
|
|
308
|
+
name: entity,
|
|
309
|
+
data: entityProperties.reduce((acc, property) => {
|
|
310
|
+
acc[property] = entityData[property];
|
|
311
|
+
return acc;
|
|
312
|
+
}, {}),
|
|
313
|
+
staled_at: null,
|
|
314
|
+
};
|
|
315
|
+
}), {
|
|
316
|
+
onConflictAction: "merge",
|
|
317
|
+
onConflictFields: ["id", "name"],
|
|
318
|
+
onConflictMergeFields: ["data", "staled_at"],
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Delete the index entry when this event is emitted.
|
|
323
|
+
* @param entity
|
|
324
|
+
* @param data
|
|
325
|
+
* @param schemaEntityObjectRepresentation
|
|
326
|
+
* @param sharedContext
|
|
327
|
+
* @protected
|
|
328
|
+
*/
|
|
329
|
+
async onDelete({ entity, data, schemaEntityObjectRepresentation, }, sharedContext = {}) {
|
|
330
|
+
const { transactionManager: em } = sharedContext;
|
|
331
|
+
const indexRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexData));
|
|
332
|
+
const indexRelationRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexRelation));
|
|
333
|
+
const { data: data_ } = PostgresProvider.parseData(data, schemaEntityObjectRepresentation);
|
|
334
|
+
const ids = data_.map((entityData) => entityData.id);
|
|
335
|
+
await indexRepository.nativeDelete({
|
|
336
|
+
id: { $in: ids },
|
|
337
|
+
name: entity,
|
|
338
|
+
});
|
|
339
|
+
await indexRelationRepository.nativeDelete({
|
|
340
|
+
$or: [
|
|
341
|
+
{
|
|
342
|
+
parent_id: { $in: ids },
|
|
343
|
+
parent_name: entity,
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
child_id: { $in: ids },
|
|
347
|
+
child_name: entity,
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* event emitted from the link modules to attach a link entity to its parent and child entities from the linked modules.
|
|
354
|
+
* @param entity
|
|
355
|
+
* @param data
|
|
356
|
+
* @param schemaEntityObjectRepresentation
|
|
357
|
+
* @protected
|
|
358
|
+
*/
|
|
359
|
+
async onAttach({ entity, data, schemaEntityObjectRepresentation, }, sharedContext = {}) {
|
|
360
|
+
const { transactionManager: em } = sharedContext;
|
|
361
|
+
const indexRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexData));
|
|
362
|
+
const indexRelationRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexRelation));
|
|
363
|
+
const { data: data_, entityProperties } = PostgresProvider.parseData(data, schemaEntityObjectRepresentation);
|
|
364
|
+
/**
|
|
365
|
+
* Retrieve the property that represent the foreign key related to the parent entity of the link entity.
|
|
366
|
+
* Then from the service name of the parent entity, retrieve the entity name using the linkable keys.
|
|
367
|
+
*/
|
|
368
|
+
const parentPropertyId = schemaEntityObjectRepresentation.moduleConfig.relationships[0].foreignKey;
|
|
369
|
+
const parentServiceName = schemaEntityObjectRepresentation.moduleConfig.relationships[0]
|
|
370
|
+
.serviceName;
|
|
371
|
+
const parentEntityName = this.schemaObjectRepresentation_._serviceNameModuleConfigMap[parentServiceName].linkableKeys?.[parentPropertyId];
|
|
372
|
+
if (!parentEntityName) {
|
|
373
|
+
throw new Error(`IndexModule error, unable to handle attach event for ${entity}. The parent entity name could not be found using the linkable keys from the module ${parentServiceName}.`);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Retrieve the property that represent the foreign key related to the child entity of the link entity.
|
|
377
|
+
* Then from the service name of the child entity, retrieve the entity name using the linkable keys.
|
|
378
|
+
*/
|
|
379
|
+
const childPropertyId = schemaEntityObjectRepresentation.moduleConfig.relationships[1].foreignKey;
|
|
380
|
+
const childServiceName = schemaEntityObjectRepresentation.moduleConfig.relationships[1]
|
|
381
|
+
.serviceName;
|
|
382
|
+
const childEntityName = this.schemaObjectRepresentation_._serviceNameModuleConfigMap[childServiceName].linkableKeys?.[childPropertyId];
|
|
383
|
+
if (!childEntityName) {
|
|
384
|
+
throw new Error(`IndexModule error, unable to handle attach event for ${entity}. The child entity name could not be found using the linkable keys from the module ${childServiceName}.`);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Clean the link entity data to only keep the properties that are defined in the schema
|
|
388
|
+
*/
|
|
389
|
+
const cleanedData = data_.map((entityData) => {
|
|
390
|
+
return entityProperties.reduce((acc, property) => {
|
|
391
|
+
acc[property] = entityData[property];
|
|
392
|
+
return acc;
|
|
393
|
+
}, {});
|
|
394
|
+
});
|
|
395
|
+
let relationsToUpsert = [];
|
|
396
|
+
const entitiesToUpsert = cleanedData.map((entityData) => {
|
|
397
|
+
relationsToUpsert.push({
|
|
398
|
+
parent_id: entityData[parentPropertyId],
|
|
399
|
+
parent_name: parentEntityName,
|
|
400
|
+
child_id: entityData.id,
|
|
401
|
+
child_name: entity,
|
|
402
|
+
pivot: `${parentEntityName}-${entity}`,
|
|
403
|
+
staled_at: null,
|
|
404
|
+
}, {
|
|
405
|
+
parent_id: entityData.id,
|
|
406
|
+
parent_name: entity,
|
|
407
|
+
child_id: entityData[childPropertyId],
|
|
408
|
+
child_name: childEntityName,
|
|
409
|
+
pivot: `${entity}-${childEntityName}`,
|
|
410
|
+
staled_at: null,
|
|
411
|
+
});
|
|
412
|
+
return {
|
|
413
|
+
id: entityData.id,
|
|
414
|
+
name: entity,
|
|
415
|
+
data: entityData,
|
|
416
|
+
staled_at: null,
|
|
417
|
+
};
|
|
418
|
+
});
|
|
419
|
+
if (entitiesToUpsert.length) {
|
|
420
|
+
await indexRepository.upsertMany(entitiesToUpsert, {
|
|
421
|
+
onConflictAction: "merge",
|
|
422
|
+
onConflictFields: ["id", "name"],
|
|
423
|
+
onConflictMergeFields: ["data", "staled_at"],
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (relationsToUpsert.length) {
|
|
427
|
+
await indexRelationRepository.upsertMany(relationsToUpsert, {
|
|
428
|
+
onConflictAction: "merge",
|
|
429
|
+
onConflictFields: [
|
|
430
|
+
"pivot",
|
|
431
|
+
"parent_id",
|
|
432
|
+
"child_id",
|
|
433
|
+
"parent_name",
|
|
434
|
+
"child_name",
|
|
435
|
+
],
|
|
436
|
+
onConflictMergeFields: ["staled_at"],
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Event emitted from the link modules to detach a link entity from its parent and child entities from the linked modules.
|
|
442
|
+
* @param entity
|
|
443
|
+
* @param data
|
|
444
|
+
* @param schemaEntityObjectRepresentation
|
|
445
|
+
* @param sharedContext
|
|
446
|
+
* @protected
|
|
447
|
+
*/
|
|
448
|
+
async onDetach({ entity, data, schemaEntityObjectRepresentation, }, sharedContext = {}) {
|
|
449
|
+
const { transactionManager: em } = sharedContext;
|
|
450
|
+
const indexRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexData));
|
|
451
|
+
const indexRelationRepository = em.getRepository((0, utils_1.toMikroORMEntity)(_models_1.IndexRelation));
|
|
452
|
+
const { data: data_ } = PostgresProvider.parseData(data, schemaEntityObjectRepresentation);
|
|
453
|
+
const ids = data_.map((entityData) => entityData.id);
|
|
454
|
+
await indexRepository.nativeDelete({
|
|
455
|
+
id: { $in: ids },
|
|
456
|
+
name: entity,
|
|
457
|
+
});
|
|
458
|
+
await indexRelationRepository.nativeDelete({
|
|
459
|
+
$or: [
|
|
460
|
+
{
|
|
461
|
+
parent_id: { $in: ids },
|
|
462
|
+
parent_name: entity,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
child_id: { $in: ids },
|
|
466
|
+
child_name: entity,
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
exports.PostgresProvider = PostgresProvider;
|
|
473
|
+
_PostgresProvider_isReady_ = new WeakMap();
|
|
474
|
+
__decorate([
|
|
475
|
+
(0, utils_1.InjectManager)(),
|
|
476
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
477
|
+
__metadata("design:type", Function),
|
|
478
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
479
|
+
__metadata("design:returntype", Promise)
|
|
480
|
+
], PostgresProvider.prototype, "query", null);
|
|
481
|
+
__decorate([
|
|
482
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
483
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
484
|
+
__metadata("design:type", Function),
|
|
485
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
486
|
+
__metadata("design:returntype", Promise)
|
|
487
|
+
], PostgresProvider.prototype, "onCreate", null);
|
|
488
|
+
__decorate([
|
|
489
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
490
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
491
|
+
__metadata("design:type", Function),
|
|
492
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
493
|
+
__metadata("design:returntype", Promise)
|
|
494
|
+
], PostgresProvider.prototype, "onUpdate", null);
|
|
495
|
+
__decorate([
|
|
496
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
497
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
498
|
+
__metadata("design:type", Function),
|
|
499
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
500
|
+
__metadata("design:returntype", Promise)
|
|
501
|
+
], PostgresProvider.prototype, "onDelete", null);
|
|
502
|
+
__decorate([
|
|
503
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
504
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
505
|
+
__metadata("design:type", Function),
|
|
506
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
507
|
+
__metadata("design:returntype", Promise)
|
|
508
|
+
], PostgresProvider.prototype, "onAttach", null);
|
|
509
|
+
__decorate([
|
|
510
|
+
(0, utils_1.InjectTransactionManager)(),
|
|
511
|
+
__param(1, (0, utils_1.AcmeKitContext)()),
|
|
512
|
+
__metadata("design:type", Function),
|
|
513
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
514
|
+
__metadata("design:returntype", Promise)
|
|
515
|
+
], PostgresProvider.prototype, "onDetach", null);
|
|
516
|
+
//# sourceMappingURL=postgres-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-provider.js","sourceRoot":"","sources":["../../src/services/postgres-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAOiC;AACjC,oDAWiC;AAMjC,qCAAkD;AAClD,oCAAyD;AACzD,sEAAgE;AAChE,oFAA8E;AAQ9E,MAAa,gBAAgB;IAmB3B,YACE,SAA+B,EAC/B,OAGC,EACD,aAA4C;QAxB9C,6CAA2B;QAER,4BAAuB,GAAG;YAC3C,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,UAAU;YACnB,QAAQ,EAAE,UAAU;YACpB,QAAQ,EAAE,UAAU;SACrB,CAAA;QAkBC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAA;QACjC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAA;QAC7B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAA;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,cAAc,CAAA;QAE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;;;;6CA6ElB;AAWK;IADL,IAAA,gCAAwB,GAAE;IAWxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;gDAwGlB;AAWK;IADL,IAAA,gCAAwB,GAAE;IAWxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;gDA8BlB;AAWK;IADL,IAAA,gCAAwB,GAAE;IAWxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;gDAgClB;AAUK;IADL,IAAA,gCAAwB,GAAE;IAWxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;gDAsHlB;AAWK;IADL,IAAA,gCAAwB,GAAE;IAWxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;gDAgClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/index.ts","../src/loaders/index.ts","../src/migrations/migration20231019174230.ts","../src/migrations/migration20241209173313.ts","../src/migrations/migration20250122154720.ts","../src/migrations/migration20250127105159.ts","../src/migrations/migration20250127144442.ts","../src/migrations/migration20250128132404.ts","../src/migrations/migration20250218132404.ts","../src/migrations/migration20250515161913.ts","../src/models/index-data.ts","../src/models/index-metadata.ts","../src/models/index-relation.ts","../src/models/index-sync.ts","../src/models/index.ts","../src/services/data-synchronizer.ts","../src/services/index-data.ts","../src/services/index-metadata.ts","../src/services/index-module-service.ts","../src/services/index-relation.ts","../src/services/index-sync.ts","../src/services/index.ts","../src/services/postgres-provider.ts","../src/types/index.ts","../src/utils/base-graphql-schema.ts","../src/utils/build-config.ts","../src/utils/create-partitions.ts","../src/utils/default-schema.ts","../src/utils/flatten-object-keys.ts","../src/utils/gql-to-types.ts","../src/utils/index-metadata-status.ts","../src/utils/index.ts","../src/utils/normalize-fields-selection.ts","../src/utils/normalze-table-name.ts","../src/utils/query-builder.ts","../src/utils/__tests__/build-config.spec.ts","../src/utils/__tests__/flatten-object-keys.spec.ts","../src/utils/__tests__/normalize-fields-selcetion.spec.ts","../src/utils/sync/configuration.ts","../src/utils/sync/orchestrator.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const schemaObjectRepresentationPropertiesToOmit: string[];
|
|
2
|
+
export type Select = {
|
|
3
|
+
[key: string]: boolean | Select | Select[];
|
|
4
|
+
};
|
|
5
|
+
export type Where = {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export type OrderBy = {
|
|
9
|
+
[path: string]: OrderBy | "ASC" | "DESC" | 1 | -1 | true | false;
|
|
10
|
+
};
|
|
11
|
+
export type QueryFormat = {
|
|
12
|
+
select: Select;
|
|
13
|
+
where?: Where;
|
|
14
|
+
joinWhere?: Where;
|
|
15
|
+
};
|
|
16
|
+
export type QueryOptions = {
|
|
17
|
+
skip?: number;
|
|
18
|
+
take?: number;
|
|
19
|
+
orderBy?: OrderBy | OrderBy[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0CAA0C,UAOtD,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;CACjE,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,KAAK,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;CAC9B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schemaObjectRepresentationPropertiesToOmit = void 0;
|
|
4
|
+
exports.schemaObjectRepresentationPropertiesToOmit = [
|
|
5
|
+
"_schemaPropertiesMap",
|
|
6
|
+
"_serviceNameModuleConfigMap",
|
|
7
|
+
"JSON",
|
|
8
|
+
"DateTime",
|
|
9
|
+
"Date",
|
|
10
|
+
"Time",
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,0CAA0C,GAAG;IACxD,sBAAsB;IACtB,6BAA6B;IAC7B,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;CACP,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-graphql-schema.d.ts","sourceRoot":"","sources":["../../src/utils/base-graphql-schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,+EAK7B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseGraphqlSchema = void 0;
|
|
4
|
+
exports.baseGraphqlSchema = `
|
|
5
|
+
scalar DateTime
|
|
6
|
+
scalar Date
|
|
7
|
+
scalar Time
|
|
8
|
+
scalar JSON
|
|
9
|
+
`;
|
|
10
|
+
//# sourceMappingURL=base-graphql-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-graphql-schema.js","sourceRoot":"","sources":["../../src/utils/base-graphql-schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;;;;;CAKhC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IndexTypes } from "@acmekit/framework/types";
|
|
2
|
+
import { GraphQLUtils } from "@acmekit/framework/utils";
|
|
3
|
+
export declare const CustomDirectives: {
|
|
4
|
+
Listeners: {
|
|
5
|
+
configurationPropertyName: string;
|
|
6
|
+
isRequired: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
directive: string;
|
|
9
|
+
definition: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare function makeSchemaExecutable(inputSchema: string): GraphQLUtils.GraphQLSchema | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* This util build an internal representation object from the provided schema.
|
|
15
|
+
* It will resolve all modules, fields, link module representation to build
|
|
16
|
+
* the appropriate representation for the index module.
|
|
17
|
+
*
|
|
18
|
+
* This representation will be used to re construct the expected output object from a search
|
|
19
|
+
* but can also be used for anything since the relation tree is available through ref.
|
|
20
|
+
*
|
|
21
|
+
* @param schema
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildSchemaObjectRepresentation(schema: string): {
|
|
24
|
+
objectRepresentation: IndexTypes.SchemaObjectRepresentation;
|
|
25
|
+
entitiesMap: Record<string, any>;
|
|
26
|
+
executableSchema: GraphQLUtils.GraphQLSchema;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=build-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-config.d.ts","sourceRoot":"","sources":["../../src/utils/build-config.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAIX,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAGL,YAAY,EAGb,MAAM,0BAA0B,CAAA;AAIjC,eAAO,MAAM,gBAAgB;;;;;;;;CAQ5B,CAAA;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,0CAUvD;AA0qCD;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG;IAC/D,oBAAoB,EAAE,UAAU,CAAC,0BAA0B,CAAA;IAC3D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAChC,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAAA;CAC7C,CA+CA"}
|