@medusajs/search 0.0.1 → 2.18.0

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.
Files changed (102) hide show
  1. package/README.md +4 -1
  2. package/dist/index.d.ts +7 -8
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +11 -21
  5. package/dist/index.js.map +1 -0
  6. package/dist/joiner-config.d.ts +8 -2
  7. package/dist/joiner-config.d.ts.map +1 -0
  8. package/dist/joiner-config.js +9 -1
  9. package/dist/joiner-config.js.map +1 -0
  10. package/dist/loaders/{container.d.ts → providers.d.ts} +2 -1
  11. package/dist/loaders/providers.d.ts.map +1 -0
  12. package/dist/loaders/providers.js +23 -0
  13. package/dist/loaders/providers.js.map +1 -0
  14. package/dist/migrations/Migration20260805085626.d.ts +6 -0
  15. package/dist/migrations/Migration20260805085626.d.ts.map +1 -0
  16. package/dist/migrations/Migration20260805085626.js +23 -0
  17. package/dist/migrations/Migration20260805085626.js.map +1 -0
  18. package/dist/models/index.d.ts +3 -2
  19. package/dist/models/index.d.ts.map +1 -0
  20. package/dist/models/index.js +6 -16
  21. package/dist/models/index.js.map +1 -0
  22. package/dist/models/search-index-sync.d.ts +25 -0
  23. package/dist/models/search-index-sync.d.ts.map +1 -0
  24. package/dist/models/search-index-sync.js +42 -0
  25. package/dist/models/search-index-sync.js.map +1 -0
  26. package/dist/models/search-index.d.ts +21 -0
  27. package/dist/models/search-index.d.ts.map +1 -0
  28. package/dist/models/search-index.js +29 -0
  29. package/dist/models/search-index.js.map +1 -0
  30. package/dist/services/index.d.ts +2 -0
  31. package/dist/services/index.d.ts.map +1 -0
  32. package/dist/services/index.js +4 -1
  33. package/dist/services/index.js.map +1 -0
  34. package/dist/services/search-module-service.d.ts +45 -22
  35. package/dist/services/search-module-service.d.ts.map +1 -0
  36. package/dist/services/search-module-service.js +160 -45
  37. package/dist/services/search-module-service.js.map +1 -0
  38. package/dist/services/search-provider.d.ts +23 -0
  39. package/dist/services/search-provider.d.ts.map +1 -0
  40. package/dist/services/search-provider.js +64 -0
  41. package/dist/services/search-provider.js.map +1 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -0
  43. package/dist/types/index.d.ts +80 -110
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +5 -5
  46. package/dist/types/index.js.map +1 -0
  47. package/dist/utils/index.d.ts +63 -3
  48. package/dist/utils/index.d.ts.map +1 -0
  49. package/dist/utils/index.js +384 -17
  50. package/dist/utils/index.js.map +1 -0
  51. package/dist/utils/ingestion.d.ts +12 -0
  52. package/dist/utils/ingestion.d.ts.map +1 -0
  53. package/dist/utils/ingestion.js +69 -0
  54. package/dist/utils/ingestion.js.map +1 -0
  55. package/dist/utils/migrations.d.ts +11 -0
  56. package/dist/utils/migrations.d.ts.map +1 -0
  57. package/dist/utils/migrations.js +98 -0
  58. package/dist/utils/migrations.js.map +1 -0
  59. package/dist/utils/seeding.d.ts +14 -0
  60. package/dist/utils/seeding.d.ts.map +1 -0
  61. package/dist/utils/seeding.js +343 -0
  62. package/dist/utils/seeding.js.map +1 -0
  63. package/package.json +26 -45
  64. package/dist/initialize/index.d.ts +0 -8
  65. package/dist/initialize/index.js +0 -17
  66. package/dist/loaders/connection.d.ts +0 -4
  67. package/dist/loaders/connection.js +0 -41
  68. package/dist/loaders/container.js +0 -21
  69. package/dist/loaders/index.d.ts +0 -2
  70. package/dist/loaders/index.js +0 -10
  71. package/dist/migrations/Migration20231019174230.d.ts +0 -4
  72. package/dist/migrations/Migration20231019174230.js +0 -18
  73. package/dist/models/catalog-relation.d.ts +0 -15
  74. package/dist/models/catalog-relation.js +0 -72
  75. package/dist/models/catalog.d.ts +0 -11
  76. package/dist/models/catalog.js +0 -55
  77. package/dist/module-definition.d.ts +0 -2
  78. package/dist/module-definition.js +0 -15
  79. package/dist/scripts/bin/run-migration-down.d.ts +0 -3
  80. package/dist/scripts/bin/run-migration-down.js +0 -32
  81. package/dist/scripts/bin/run-migration-up.d.ts +0 -3
  82. package/dist/scripts/bin/run-migration-up.js +0 -32
  83. package/dist/scripts/bin/run-seed.d.ts +0 -3
  84. package/dist/scripts/bin/run-seed.js +0 -38
  85. package/dist/scripts/index.d.ts +0 -2
  86. package/dist/scripts/index.js +0 -18
  87. package/dist/scripts/migration-down.d.ts +0 -10
  88. package/dist/scripts/migration-down.js +0 -52
  89. package/dist/scripts/migration-up.d.ts +0 -10
  90. package/dist/scripts/migration-up.js +0 -56
  91. package/dist/scripts/seed-data/index.d.ts +0 -8
  92. package/dist/scripts/seed-data/index.js +0 -138
  93. package/dist/scripts/seed.d.ts +0 -5
  94. package/dist/scripts/seed.js +0 -65
  95. package/dist/services/postgres-provider.d.ts +0 -126
  96. package/dist/services/postgres-provider.js +0 -441
  97. package/dist/utils/build-config.d.ts +0 -21
  98. package/dist/utils/build-config.js +0 -437
  99. package/dist/utils/create-partitions.d.ts +0 -3
  100. package/dist/utils/create-partitions.js +0 -27
  101. package/dist/utils/query-builder.d.ts +0 -28
  102. package/dist/utils/query-builder.js +0 -375
@@ -0,0 +1,14 @@
1
+ import { SearchTypes } from "@medusajs/framework/types";
2
+ import { SearchIndexContext, SearchIndexRegistry, SearchIndexSeedAction, SearchSeedRuntime } from "../types";
3
+ type LockContext = Pick<SearchIndexContext, "locking" | "logger">;
4
+ /**
5
+ * Which indexes need data, and where it goes. A drifted definition is filled into
6
+ * its replacement and swapped in; otherwise an index needs seeding if it was never
7
+ * filled, its last attempt failed, or it holds nothing — the last catching an
8
+ * engine that lost its data while the record still says ready.
9
+ */
10
+ export declare function createSeedPlan(context: SearchIndexRegistry): Promise<SearchIndexSeedAction[]>;
11
+ export declare function executeSeedPlan(context: SearchSeedRuntime & LockContext, actions: SearchIndexSeedAction[]): Promise<void>;
12
+ export declare function reindexIndexes(context: SearchSeedRuntime & LockContext, input?: SearchTypes.SearchReindexInput): Promise<SearchTypes.SearchReindexResult>;
13
+ export {};
14
+ //# sourceMappingURL=seeding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seeding.d.ts","sourceRoot":"","sources":["../../src/utils/seeding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAEvD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EAGrB,iBAAiB,EAClB,MAAM,QAAQ,CAAA;AAWf,KAAK,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAA;AAKjE;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,qBAAqB,EAAE,CAAC,CA0DlC;AAcD,wBAAsB,eAAe,CACnC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EACxC,OAAO,EAAE,qBAAqB,EAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAUf;AA6DD,wBAAsB,cAAc,CAClC,OAAO,EAAE,iBAAiB,GAAG,WAAW,EACxC,KAAK,GAAE,WAAW,CAAC,kBAAuB,GACzC,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CA0B1C"}
@@ -0,0 +1,343 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSeedPlan = createSeedPlan;
4
+ exports.executeSeedPlan = executeSeedPlan;
5
+ exports.reindexIndexes = reindexIndexes;
6
+ const utils_1 = require("@medusajs/framework/utils");
7
+ const crypto_1 = require("crypto");
8
+ const index_1 = require("./index");
9
+ const migrations_1 = require("./migrations");
10
+ /* -------------------------------- planning -------------------------------- */
11
+ /**
12
+ * Which indexes need data, and where it goes. A drifted definition is filled into
13
+ * its replacement and swapped in; otherwise an index needs seeding if it was never
14
+ * filled, its last attempt failed, or it holds nothing — the last catching an
15
+ * engine that lost its data while the record still says ready.
16
+ */
17
+ async function createSeedPlan(context) {
18
+ const definitions = [...context.indexes.values()];
19
+ if (!definitions.length) {
20
+ return [];
21
+ }
22
+ const records = await context.indexService.list({ name: definitions.map((definition) => definition.name) }, { take: null });
23
+ const byName = new Map(records.map((record) => [record.name, record]));
24
+ const actions = [];
25
+ for (const definition of definitions) {
26
+ const record = byName.get(definition.name);
27
+ // No record means the index was never migrated, so there is nothing to fill.
28
+ // Creating one is a migration's job, not a booting app's.
29
+ if (!record) {
30
+ continue;
31
+ }
32
+ if (record.definition_hash !== definition.definition_hash ||
33
+ record.provider !== definition.provider) {
34
+ const swap = !!context.providers.retrieve(definition.provider).swapIndex;
35
+ actions.push({
36
+ index: definition.name,
37
+ target_physical_name: swap
38
+ ? (0, migrations_1.shadowIndexName)(definition)
39
+ : definition.physical_name,
40
+ swap,
41
+ reason: "schema_changed",
42
+ });
43
+ continue;
44
+ }
45
+ if (record.status === index_1.SearchIndexState.ERROR) {
46
+ actions.push(inPlace(definition, "last_run_failed"));
47
+ continue;
48
+ }
49
+ if (record.status !== index_1.SearchIndexState.READY) {
50
+ actions.push(inPlace(definition, "index_created"));
51
+ continue;
52
+ }
53
+ if ((await countDocuments(context, definition)) === 0) {
54
+ actions.push(inPlace(definition, "index_empty"));
55
+ }
56
+ }
57
+ return actions;
58
+ }
59
+ function inPlace(definition, reason) {
60
+ return {
61
+ index: definition.name,
62
+ target_physical_name: definition.physical_name,
63
+ swap: false,
64
+ reason,
65
+ };
66
+ }
67
+ async function executeSeedPlan(context, actions) {
68
+ for (const action of actions) {
69
+ const definition = (0, index_1.retrieveIndexDefinition)(context.indexes, action.index);
70
+ // One instance per index. Without this every replica in a rolling deploy
71
+ // would seed the same index at the same time.
72
+ await withIndexLock(context, definition.name, async () => {
73
+ await runSeed(context, { definition, action });
74
+ });
75
+ }
76
+ }
77
+ async function runSeed(context, { definition, action, }) {
78
+ const provider = context.providers.retrieve(definition.provider);
79
+ const record = await retrieveRecord(context, definition.name);
80
+ const sync = await startSync(context, { record });
81
+ await context.indexService.update({
82
+ selector: { id: record.id },
83
+ data: { status: index_1.SearchIndexState.BUILDING },
84
+ });
85
+ try {
86
+ // Seeding writes into an index a migration already created — only a `swap`
87
+ // needs its replacement built here. If the target is missing, the provider
88
+ // says so on the first write.
89
+ const { documents_synced } = await streamSeed(context, {
90
+ index: definition,
91
+ sync_id: sync.id,
92
+ target_index: action.target_physical_name,
93
+ last_key: sync.last_key ?? undefined,
94
+ });
95
+ if (action.swap) {
96
+ await provider.swapIndex({
97
+ alias: definition.physical_name,
98
+ index: action.target_physical_name,
99
+ });
100
+ }
101
+ await completeSync(context, { sync_id: sync.id, documents_synced });
102
+ await context.indexService.update({
103
+ selector: { id: record.id },
104
+ data: {
105
+ status: index_1.SearchIndexState.READY,
106
+ definition_hash: definition.definition_hash,
107
+ // A migration may have moved the index to another provider; the record
108
+ // follows once the seed has landed there.
109
+ provider: definition.provider,
110
+ },
111
+ });
112
+ }
113
+ catch (error) {
114
+ await failSync(context, {
115
+ sync_id: sync.id,
116
+ record_id: record.id,
117
+ error,
118
+ });
119
+ throw error;
120
+ }
121
+ }
122
+ async function reindexIndexes(context, input = {}) {
123
+ const names = input.index
124
+ ? Array.isArray(input.index)
125
+ ? input.index
126
+ : [input.index]
127
+ : [...context.indexes.keys()];
128
+ const definitions = names.map((name) => (0, index_1.retrieveIndexDefinition)(context.indexes, name));
129
+ const jobId = (0, crypto_1.randomUUID)();
130
+ for (const definition of definitions) {
131
+ // Same lock boot seeding takes, so a reindex never races a startup seed
132
+ // (or another reindex) on the same index. Unlike boot, an explicit reindex
133
+ // must not quietly skip — the caller asked for work to happen.
134
+ if (context.locking) {
135
+ await context.locking.execute(`search:seed:${definition.name}`, () => reindexOne(context, { definition, jobId, input }));
136
+ }
137
+ else {
138
+ await reindexOne(context, { definition, jobId, input });
139
+ }
140
+ }
141
+ return { job_id: jobId, indexes: names };
142
+ }
143
+ async function reindexOne(context, { definition, jobId, input, }) {
144
+ const provider = context.providers.retrieve(definition.provider);
145
+ const record = await retrieveRecord(context, definition.name);
146
+ const sync = await startSync(context, {
147
+ record,
148
+ jobId,
149
+ filters: input.filters,
150
+ });
151
+ // A partial rebuild must never swap: the replacement would only hold the
152
+ // filtered slice, so aliasing over would delete everything else.
153
+ const useSwap = (input.strategy ?? "swap") === "swap" &&
154
+ !!provider.swapIndex &&
155
+ !input.filters;
156
+ const target = useSwap
157
+ ? (0, migrations_1.shadowIndexName)(definition)
158
+ : definition.physical_name;
159
+ await context.indexService.update({
160
+ selector: { id: record.id },
161
+ data: { status: index_1.SearchIndexState.BUILDING },
162
+ });
163
+ try {
164
+ // Only the replacement is new; rebuilding in place writes into the index a
165
+ // migration already created, whatever its current schema.
166
+ if (useSwap) {
167
+ await provider.upsertIndex({
168
+ index: { ...definition, physical_name: target },
169
+ });
170
+ }
171
+ const { documents_synced } = await streamSeed(context, {
172
+ index: definition,
173
+ sync_id: sync.id,
174
+ target_index: target,
175
+ filters: input.filters,
176
+ last_key: sync.last_key ?? undefined,
177
+ });
178
+ if (useSwap) {
179
+ await provider.swapIndex({
180
+ alias: definition.physical_name,
181
+ index: target,
182
+ });
183
+ }
184
+ await completeSync(context, { sync_id: sync.id, documents_synced });
185
+ await context.indexService.update({
186
+ selector: { id: record.id },
187
+ data: {
188
+ status: index_1.SearchIndexState.READY,
189
+ definition_hash: definition.definition_hash,
190
+ provider: definition.provider,
191
+ },
192
+ });
193
+ }
194
+ catch (error) {
195
+ // Leave the replacement behind on failure; the live one is untouched.
196
+ await failSync(context, { sync_id: sync.id, record_id: record.id, error });
197
+ throw error;
198
+ }
199
+ }
200
+ /* -------------------------------- streaming ------------------------------- */
201
+ // Streams one index' `seed` in, advancing the sync row's `last_key` per batch so
202
+ // an interrupted run resumes rather than restarting.
203
+ async function streamSeed(context, { index, sync_id, target_index, filters, last_key, }) {
204
+ const provider = context.providers.retrieve(index.provider);
205
+ const batchSize = context.options.reindex?.batch_size ?? index_1.DEFAULT_REINDEX_BATCH_SIZE;
206
+ let buffer = [];
207
+ let synced = 0;
208
+ const flush = async () => {
209
+ if (!buffer.length) {
210
+ return;
211
+ }
212
+ const batch = buffer;
213
+ buffer = [];
214
+ const task = await provider.upsertDocuments({
215
+ index: target_index,
216
+ documents: batch,
217
+ });
218
+ // Per batch rather than once at the end: it bounds how much can be in
219
+ // flight, and the swap that follows depends on all of it having landed.
220
+ (0, index_1.assertTaskAccepted)(task, index.name);
221
+ await settle(context, index, task);
222
+ synced += batch.length;
223
+ await context.syncService.update({
224
+ selector: { id: sync_id },
225
+ data: {
226
+ documents_synced: synced,
227
+ last_key: batch[batch.length - 1][index.primary_key],
228
+ },
229
+ });
230
+ };
231
+ for await (const documents of index.seed({
232
+ container: context.container,
233
+ index,
234
+ filters,
235
+ last_key,
236
+ })) {
237
+ for (const document of documents) {
238
+ buffer.push(document);
239
+ if (buffer.length >= batchSize) {
240
+ await flush();
241
+ }
242
+ }
243
+ }
244
+ await flush();
245
+ return { documents_synced: synced };
246
+ }
247
+ // Blocks until a write lands. Not optional here: a `swap` puts the new index in
248
+ // front of reads, so its documents have to be in it first.
249
+ async function settle(context, definition, task) {
250
+ const provider = context.providers.retrieve(definition.provider);
251
+ if (!provider.waitForTask || task.status === "succeeded") {
252
+ return;
253
+ }
254
+ (0, index_1.assertTaskAccepted)(await provider.waitForTask(task), definition.name);
255
+ }
256
+ /* ------------------------------ sync records ------------------------------ */
257
+ // Opens a sync row, cancelling any earlier unfinished one and inheriting its
258
+ // `last_key` so an interrupted run resumes.
259
+ async function startSync(context, { record, jobId, filters, }) {
260
+ const resumable = await findResumableSync(context, record.name);
261
+ if (resumable) {
262
+ await context.syncService.update({
263
+ selector: { id: resumable.id },
264
+ data: { status: index_1.SearchSyncStatus.CANCELED },
265
+ });
266
+ }
267
+ const [sync] = await context.syncService.create([
268
+ {
269
+ search_index_id: record.id,
270
+ job_id: jobId ?? (0, crypto_1.randomUUID)(),
271
+ status: index_1.SearchSyncStatus.PROCESSING,
272
+ filters: filters ?? null,
273
+ last_key: resumable?.last_key ?? null,
274
+ started_at: new Date(),
275
+ },
276
+ ]);
277
+ return sync;
278
+ }
279
+ async function completeSync(context, { sync_id, documents_synced }) {
280
+ await context.syncService.update({
281
+ selector: { id: sync_id },
282
+ data: {
283
+ status: index_1.SearchSyncStatus.DONE,
284
+ documents_synced,
285
+ completed_at: new Date(),
286
+ },
287
+ });
288
+ }
289
+ async function failSync(context, { sync_id, record_id, error, }) {
290
+ await context.syncService.update({
291
+ selector: { id: sync_id },
292
+ data: {
293
+ status: index_1.SearchSyncStatus.FAILED,
294
+ error: error.message,
295
+ completed_at: new Date(),
296
+ },
297
+ });
298
+ await context.indexService.update({
299
+ selector: { id: record_id },
300
+ data: { status: index_1.SearchIndexState.ERROR },
301
+ });
302
+ }
303
+ // The most recent unfinished run for an index, if any.
304
+ async function findResumableSync(context, indexName) {
305
+ const [record] = await context.indexService.list({ name: indexName });
306
+ if (!record) {
307
+ return undefined;
308
+ }
309
+ const [sync] = await context.syncService.list({
310
+ search_index_id: record.id,
311
+ status: [index_1.SearchSyncStatus.PENDING, index_1.SearchSyncStatus.PROCESSING],
312
+ }, { order: { created_at: "DESC" }, take: 1 });
313
+ return sync;
314
+ }
315
+ /* --------------------------------- helpers -------------------------------- */
316
+ async function countDocuments(context, definition) {
317
+ const indexes = await context.providers
318
+ .retrieve(definition.provider)
319
+ .listIndexes();
320
+ return (indexes.find((info) => info.name === definition.physical_name)
321
+ ?.document_count ?? 0);
322
+ }
323
+ async function withIndexLock(context, name, job) {
324
+ if (!context.locking) {
325
+ return await job();
326
+ }
327
+ try {
328
+ return await context.locking.execute(`search:seed:${name}`, job);
329
+ }
330
+ catch (error) {
331
+ // Another instance holds the lock and is doing the work.
332
+ context.logger.info(`[Search] Skipping seed of "${name}": ${error.message}`);
333
+ return undefined;
334
+ }
335
+ }
336
+ async function retrieveRecord(context, name) {
337
+ const [record] = await context.indexService.list({ name });
338
+ if (!record) {
339
+ throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `Search index "${name}" has no record; run migrations to create it`);
340
+ }
341
+ return record;
342
+ }
343
+ //# sourceMappingURL=seeding.js.map
@@ -0,0 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,UAAU,aAAa,CAC1B,OAAoB,EACpB,IAAY,EACZ,GAAqB;IAErB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,MAAM,GAAG,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,CAAA;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,yDAAyD;QACzD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC5E,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,OAAiD,EACjD,IAAY;IAEZ,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,SAAS,EAC3B,iBAAiB,IAAI,8CAA8C,CACpE,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,21 +1,25 @@
1
1
  {
2
2
  "name": "@medusajs/search",
3
- "version": "0.0.1",
3
+ "version": "2.18.0",
4
4
  "description": "Medusa Search module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist"
8
+ "dist",
9
+ "!dist/**/__tests__",
10
+ "!dist/**/__mocks__",
11
+ "!dist/**/__fixtures__"
9
12
  ],
10
- "bin": {
11
- "medusa-search-migrations-down": "dist/scripts/bin/run-migration-down.js",
12
- "medusa-search-migrations-up": "dist/scripts/bin/run-migration-up.js",
13
- "medusa-search-seed": "dist/scripts/bin/run-seed.js"
13
+ "engines": {
14
+ "node": ">=20"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",
17
- "url": "https://github.com/medusajs/medusa",
18
- "directory": "packages/search"
18
+ "url": "git+https://github.com/medusajs/medusa.git",
19
+ "directory": "packages/modules/search"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/medusajs/medusa/issues"
19
23
  },
20
24
  "publishConfig": {
21
25
  "access": "public"
@@ -23,45 +27,22 @@
23
27
  "author": "Medusa",
24
28
  "license": "MIT",
25
29
  "scripts": {
26
- "watch": "tsc --build --watch",
27
- "watch:test": "tsc --build tsconfig.spec.json --watch",
28
- "prepublishOnly": "cross-env NODE_ENV=production tsc --build && tsc-alias -p tsconfig.json",
29
- "build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
30
- "test": "jest --runInBand --bail --passWithNoTests --forceExit -- ./src/__tests__/**/*.ts",
31
- "test:integration": "jest --runInBand --passWithNoTests --forceExit -- ./integration-tests/**/__tests__/**/*.ts",
32
- "migration:generate": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:generate",
33
- "migration:initial": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:create --initial",
34
- "migration:create": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:create",
35
- "migration:up": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:up",
36
- "orm:cache:clear": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm cache:clear",
37
- "experiment": "ts-node src/_experiments/experiment.ts"
30
+ "watch": "yarn run -T tsc --build --watch",
31
+ "watch:test": "yarn run -T tsc --build tsconfig.spec.json --watch",
32
+ "resolve:aliases": "yarn run -T tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && yarn run -T tsc-alias -p tsconfig.resolved.json && yarn run -T rimraf tsconfig.resolved.json",
33
+ "build": "yarn run -T rimraf dist && yarn run -T tsc --build && npm run resolve:aliases",
34
+ "test": "../../../node_modules/.bin/jest --bail --forceExit --passWithNoTests --testPathPattern=src",
35
+ "test:integration": "../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/.*\\.spec\\.ts\"",
36
+ "migration:initial": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:create --initial -n InitialSetupMigration",
37
+ "migration:create": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:create",
38
+ "migration:up": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:up",
39
+ "orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm cache:clear"
38
40
  },
39
41
  "devDependencies": {
40
- "@faker-js/faker": "^8.2.0",
41
- "@medusajs/types": "^1.11.1",
42
- "@mikro-orm/cli": "5.7.12",
43
- "cross-env": "^5.2.1",
44
- "jest": "^29.6.3",
45
- "medusa-test-utils": "^1.1.40",
46
- "pg-god": "^1.0.12",
47
- "rimraf": "^3.0.2",
48
- "ts-jest": "^29.1.1",
49
- "ts-node": "^10.9.1",
50
- "tsc-alias": "^1.8.6",
51
- "typescript": "^5.1.6"
42
+ "@medusajs/framework": "2.18.0",
43
+ "@medusajs/test-utils": "2.18.0"
52
44
  },
53
- "dependencies": {
54
- "@graphql-tools/merge": "^9.0.0",
55
- "@graphql-tools/schema": "^10.0.0",
56
- "@medusajs/modules-sdk": "^1.11.0",
57
- "@medusajs/utils": "^1.10.1",
58
- "@mikro-orm/core": "5.7.12",
59
- "@mikro-orm/migrations": "5.7.12",
60
- "@mikro-orm/postgresql": "5.7.12",
61
- "awilix": "^8.0.0",
62
- "dotenv": "^16.1.4",
63
- "graphql": "^16.8.1",
64
- "knex": "2.4.2",
65
- "lodash": "^4.17.21"
45
+ "peerDependencies": {
46
+ "@medusajs/framework": "2.18.0"
66
47
  }
67
48
  }
@@ -1,8 +0,0 @@
1
- import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
2
- import { IEventBusModuleService, RemoteJoinerQuery } from "@medusajs/types";
3
- import { SearchModuleOptions } from "../types";
4
- import { SearchModuleService } from "../services";
5
- export declare const initialize: (options: SearchModuleOptions | ExternalModuleDeclaration | InternalModuleDeclaration, injectedDependencies: {
6
- eventBusModuleService: IEventBusModuleService;
7
- remoteQuery: (query: string | RemoteJoinerQuery | object, variables?: Record<string, unknown>) => Promise<any>;
8
- }) => Promise<SearchModuleService>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialize = void 0;
4
- const modules_sdk_1 = require("@medusajs/modules-sdk");
5
- const module_definition_1 = require("../module-definition");
6
- const initialize = async (options, injectedDependencies) => {
7
- if (!injectedDependencies?.eventBusModuleService) {
8
- throw new Error("SearchModule is missing the eventBusModuleService dependency to work");
9
- }
10
- if (!injectedDependencies?.remoteQuery) {
11
- throw new Error("SearchModule is missing the remoteQuery dependency to work");
12
- }
13
- const serviceKey = modules_sdk_1.Modules.SEARCH;
14
- const loaded = await modules_sdk_1.MedusaModule.bootstrap(serviceKey, modules_sdk_1.MODULE_PACKAGE_NAMES[modules_sdk_1.Modules.SEARCH], options, module_definition_1.moduleDefinition, injectedDependencies);
15
- return loaded[serviceKey];
16
- };
17
- exports.initialize = initialize;
@@ -1,4 +0,0 @@
1
- import { InternalModuleDeclaration, LoaderOptions } from "@medusajs/modules-sdk";
2
- import { SearchModuleOptions } from "../types";
3
- declare const _default: ({ options, container, logger }: LoaderOptions<SearchModuleOptions>, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>;
4
- export default _default;
@@ -1,41 +0,0 @@
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
- const utils_1 = require("@medusajs/utils");
27
- const SearchModels = __importStar(require("../models"));
28
- exports.default = async ({ options, container, logger }, moduleDeclaration) => {
29
- if (options?.defaultAdapterOptions) {
30
- const entities = Object.values(SearchModels);
31
- const pathToMigrations = __dirname + "/../migrations";
32
- await utils_1.ModulesSdkUtils.mikroOrmConnectionLoader({
33
- entities,
34
- container,
35
- options: options.defaultAdapterOptions,
36
- moduleDeclaration,
37
- logger,
38
- pathToMigrations,
39
- });
40
- }
41
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _services_1 = require("../services");
4
- const awilix_1 = require("awilix");
5
- const postgres_provider_1 = require("../services/postgres-provider");
6
- exports.default = async ({ container, options, }) => {
7
- container.register({
8
- searchModuleService: (0, awilix_1.asClass)(_services_1.SearchModuleService).singleton(),
9
- });
10
- if (!options?.customAdapter && !options?.defaultAdapterOptions) {
11
- throw new Error("Search module error, either customAdapter or defaultAdapterOptions must be provided. None have been provided.");
12
- }
13
- container.register("storageProviderCtrOptions", (0, awilix_1.asValue)(undefined));
14
- if (!options?.customAdapter) {
15
- container.register("storageProviderCtr", (0, awilix_1.asValue)(postgres_provider_1.PostgresProvider));
16
- }
17
- else {
18
- container.register("storageProviderCtr", (0, awilix_1.asValue)(options.customAdapter.constructor));
19
- container.register("storageProviderCtrOptions", (0, awilix_1.asValue)(options.customAdapter.options));
20
- }
21
- };
@@ -1,2 +0,0 @@
1
- export { default as containerLoader } from "./container";
2
- export { default as connectionLoader } from "./connection";
@@ -1,10 +0,0 @@
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.connectionLoader = exports.containerLoader = void 0;
7
- var container_1 = require("./container");
8
- Object.defineProperty(exports, "containerLoader", { enumerable: true, get: function () { return __importDefault(container_1).default; } });
9
- var connection_1 = require("./connection");
10
- Object.defineProperty(exports, "connectionLoader", { enumerable: true, get: function () { return __importDefault(connection_1).default; } });
@@ -1,4 +0,0 @@
1
- import { Migration } from "@mikro-orm/migrations";
2
- export declare class Migration20231019174230 extends Migration {
3
- up(): Promise<void>;
4
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Migration20231019174230 = void 0;
4
- const migrations_1 = require("@mikro-orm/migrations");
5
- class Migration20231019174230 extends migrations_1.Migration {
6
- async up() {
7
- const schema = this.config.get("schema")
8
- ? `"${this.config.get("schema")}".`
9
- : "";
10
- this.addSql(`create table ${schema}"catalog" ("id" text not null, "name" text not null, "data" jsonb not null default '{}', constraint "catalog_pkey" primary key ("id", "name")) PARTITION BY LIST("name");`);
11
- this.addSql(`create index "IDX_catalog_id" on ${schema}"catalog" ("id");`);
12
- this.addSql(`create index "IDX_catalog_name" on ${schema}"catalog" ("name");`);
13
- this.addSql(`create index "IDX_catalog_data_gin" on ${schema}"catalog" using GIN ("data");`);
14
- this.addSql(`create table ${schema}"catalog_relation" ("id" bigserial, "pivot" text not null, "parent_id" text not null, "parent_name" text not null, "child_id" text not null, "child_name" text not null, constraint "catalog_relation_pkey" primary key ("id", "pivot")) PARTITION BY LIST("pivot");`);
15
- this.addSql(`create index "IDX_catalog_relation_child_id" on ${schema}"catalog_relation" ("child_id");`);
16
- }
17
- }
18
- exports.Migration20231019174230 = Migration20231019174230;
@@ -1,15 +0,0 @@
1
- import { OptionalProps, Ref } from "@mikro-orm/core";
2
- import Catalog from "./catalog";
3
- type OptionalRelations = "parent" | "child" | "parent_id" | "child_id" | "parent_name" | "child_name";
4
- export declare class CatalogRelation {
5
- [OptionalProps]: OptionalRelations;
6
- id: string;
7
- pivot: string;
8
- parent_id?: string;
9
- parent_name?: string;
10
- child_id?: string;
11
- child_name?: string;
12
- parent?: Ref<Catalog>;
13
- child?: Ref<Catalog>;
14
- }
15
- export default CatalogRelation;