@medusajs/types 0.0.1 → 0.0.2-next-20230322093850
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/dist/bundles.d.ts +3 -0
- package/dist/bundles.js +30 -0
- package/dist/bundles.js.map +1 -0
- package/dist/common/config-module.d.ts +37 -0
- package/dist/common/config-module.js +3 -0
- package/dist/common/config-module.js.map +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +18 -0
- package/dist/common/index.js.map +1 -0
- package/dist/event-bus/common.d.ts +14 -0
- package/dist/event-bus/common.js +3 -0
- package/dist/event-bus/common.js.map +1 -0
- package/dist/event-bus/event-bus-module.d.ts +7 -0
- package/dist/event-bus/event-bus-module.js +3 -0
- package/dist/event-bus/event-bus-module.js.map +1 -0
- package/dist/event-bus/event-bus.d.ts +7 -0
- package/dist/event-bus/event-bus.js +3 -0
- package/dist/event-bus/event-bus.js.map +1 -0
- package/dist/event-bus/index.d.ts +3 -0
- package/dist/event-bus/index.js +20 -0
- package/dist/event-bus/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/event-bus.d.ts +11 -0
- package/dist/interfaces/event-bus.js +3 -0
- package/dist/interfaces/event-bus.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +29 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/services/event-bus.d.ts +11 -0
- package/dist/interfaces/services/event-bus.js +3 -0
- package/dist/interfaces/services/event-bus.js.map +1 -0
- package/dist/interfaces/services/transaction-base.d.ts +20 -0
- package/dist/interfaces/services/transaction-base.js +3 -0
- package/dist/interfaces/services/transaction-base.js.map +1 -0
- package/dist/interfaces/transaction-base.d.ts +0 -0
- package/dist/interfaces/transaction-base.js +1 -0
- package/dist/interfaces/transaction-base.js.map +1 -0
- package/dist/search/index-types.d.ts +3 -0
- package/dist/search/index-types.js +7 -0
- package/dist/search/index-types.js.map +1 -0
- package/dist/search/index.d.ts +17 -0
- package/dist/search/index.js +20 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/indexes.d.ts +3 -0
- package/dist/search/indexes.js +7 -0
- package/dist/search/indexes.js.map +1 -0
- package/dist/search/interface.d.ts +62 -0
- package/dist/search/interface.js +3 -0
- package/dist/search/interface.js.map +1 -0
- package/dist/search/settings.d.ts +14 -0
- package/dist/search/settings.js +3 -0
- package/dist/search/settings.js.map +1 -0
- package/dist/transaction-base/index.d.ts +1 -0
- package/dist/transaction-base/index.js +18 -0
- package/dist/transaction-base/index.js.map +1 -0
- package/dist/transaction-base/transaction-base.d.ts +4 -0
- package/dist/transaction-base/transaction-base.js +3 -0
- package/dist/transaction-base/transaction-base.js.map +1 -0
- package/package.json +5 -1
package/dist/bundles.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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.TransactionBaseTypes = exports.EventBusTypes = exports.CommonTypes = void 0;
|
|
27
|
+
exports.CommonTypes = __importStar(require("./common"));
|
|
28
|
+
exports.EventBusTypes = __importStar(require("./event-bus"));
|
|
29
|
+
exports.TransactionBaseTypes = __importStar(require("./transaction-base"));
|
|
30
|
+
//# sourceMappingURL=bundles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAuC;AACvC,6DAA4C;AAC5C,2EAA0D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
|
|
2
|
+
import { LoggerOptions } from "typeorm";
|
|
3
|
+
declare type SessionOptions = {
|
|
4
|
+
name?: string;
|
|
5
|
+
resave?: boolean;
|
|
6
|
+
rolling?: boolean;
|
|
7
|
+
saveUninitialized?: boolean;
|
|
8
|
+
secret?: string;
|
|
9
|
+
ttl?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare type ConfigModule = {
|
|
12
|
+
projectConfig: {
|
|
13
|
+
redis_url?: string;
|
|
14
|
+
session_options?: SessionOptions;
|
|
15
|
+
jwt_secret?: string;
|
|
16
|
+
cookie_secret?: string;
|
|
17
|
+
database_url?: string;
|
|
18
|
+
database_type: string;
|
|
19
|
+
database_database?: string;
|
|
20
|
+
database_schema?: string;
|
|
21
|
+
database_logging: LoggerOptions;
|
|
22
|
+
database_extra?: Record<string, unknown> & {
|
|
23
|
+
ssl: {
|
|
24
|
+
rejectUnauthorized: false;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
store_cors?: string;
|
|
28
|
+
admin_cors?: string;
|
|
29
|
+
};
|
|
30
|
+
featureFlags: Record<string, boolean | string>;
|
|
31
|
+
modules?: Record<string, false | string | Partial<InternalModuleDeclaration | ExternalModuleDeclaration>>;
|
|
32
|
+
plugins: ({
|
|
33
|
+
resolve: string;
|
|
34
|
+
options: Record<string, unknown>;
|
|
35
|
+
} | string)[];
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-module.js","sourceRoot":"","sources":["../../src/common/config-module.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./config-module";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config-module"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare type Subscriber<T = unknown> = (data: T, eventName: string) => Promise<void>;
|
|
2
|
+
export declare type SubscriberContext = {
|
|
3
|
+
subscriberId: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type SubscriberDescriptor = {
|
|
6
|
+
id: string;
|
|
7
|
+
subscriber: Subscriber;
|
|
8
|
+
};
|
|
9
|
+
export declare type EventHandler<T = unknown> = (data: T, eventName: string) => Promise<void>;
|
|
10
|
+
export declare type EmitData<T = unknown> = {
|
|
11
|
+
eventName: string;
|
|
12
|
+
data: T;
|
|
13
|
+
options?: Record<string, unknown>;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/event-bus/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EmitData, Subscriber, SubscriberContext } from "./common";
|
|
2
|
+
export interface IEventBusModuleService {
|
|
3
|
+
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
|
|
4
|
+
emit<T>(data: EmitData<T>[]): Promise<void>;
|
|
5
|
+
subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
6
|
+
unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus-module.js","sourceRoot":"","sources":["../../src/event-bus/event-bus-module.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Subscriber, SubscriberContext } from ".";
|
|
2
|
+
import { ITransactionBaseService } from "../transaction-base/transaction-base";
|
|
3
|
+
export interface IEventBusService extends ITransactionBaseService {
|
|
4
|
+
subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
5
|
+
unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
6
|
+
emit<T>(event: string, data: T, options?: unknown): Promise<unknown | void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/event-bus/event-bus.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./common"), exports);
|
|
18
|
+
__exportStar(require("./event-bus"), exports);
|
|
19
|
+
__exportStar(require("./event-bus-module"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event-bus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,8CAA2B;AAC3B,qDAAkC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,5 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bundles"), exports);
|
|
18
|
+
__exportStar(require("./common"), exports);
|
|
19
|
+
__exportStar(require("./event-bus"), exports);
|
|
17
20
|
__exportStar(require("./shared-context"), exports);
|
|
21
|
+
__exportStar(require("./transaction-base"), exports);
|
|
18
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,2CAAwB;AACxB,8CAA2B;AAC3B,mDAAgC;AAChC,qDAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TransactionBaseService } from "@medusajs/medusa";
|
|
2
|
+
import { EmitData, Subscriber, SubscriberContext } from "../event-bus";
|
|
3
|
+
export interface IEventBusService extends TransactionBaseService {
|
|
4
|
+
emit<T>(event: string, data: T, options?: unknown): Promise<unknown | void>;
|
|
5
|
+
}
|
|
6
|
+
export interface IEventBusModuleService {
|
|
7
|
+
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
|
|
8
|
+
emit<T>(data: EmitData<T>[]): Promise<void>;
|
|
9
|
+
subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
10
|
+
unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/interfaces/event-bus.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.ITransactionBaseService = exports.EventBus = void 0;
|
|
27
|
+
exports.EventBus = __importStar(require("../event-bus/event-bus"));
|
|
28
|
+
exports.ITransactionBaseService = __importStar(require("../transaction-base/transaction-base"));
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmD;AACnD,gGAAgF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EmitData, Subscriber, SubscriberContext } from "../../event-bus";
|
|
2
|
+
import { ITransactionBaseService } from "./transaction-base";
|
|
3
|
+
export interface IEventBusService extends ITransactionBaseService {
|
|
4
|
+
emit<T>(event: string, data: T, options?: unknown): Promise<unknown | void>;
|
|
5
|
+
}
|
|
6
|
+
export interface IEventBusModuleService {
|
|
7
|
+
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
|
|
8
|
+
emit<T>(data: EmitData<T>[]): Promise<void>;
|
|
9
|
+
subscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
10
|
+
unsubscribe(eventName: string | symbol, subscriber: Subscriber, context?: SubscriberContext): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../src/interfaces/services/event-bus.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EntityManager } from "typeorm";
|
|
2
|
+
import { IsolationLevel } from "typeorm/driver/types/IsolationLevel";
|
|
3
|
+
export interface ITransactionBaseService {
|
|
4
|
+
manager_: EntityManager;
|
|
5
|
+
transactionManager_: EntityManager | undefined;
|
|
6
|
+
withTransaction(transactionManager?: EntityManager): this;
|
|
7
|
+
shouldRetryTransaction_(err: {
|
|
8
|
+
code: string;
|
|
9
|
+
} | Record<string, unknown>): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps some work within a transactional block. If the service already has
|
|
12
|
+
* a transaction manager attached this will be reused, otherwise a new
|
|
13
|
+
* transaction manager is created.
|
|
14
|
+
* @param work - the transactional work to be done
|
|
15
|
+
* @param isolationOrErrorHandler - the isolation level to be used for the work.
|
|
16
|
+
* @param maybeErrorHandlerOrDontFail Potential error handler
|
|
17
|
+
* @return the result of the transactional work
|
|
18
|
+
*/
|
|
19
|
+
atomicPhase_<TResult, TError>(work: (transactionManager: EntityManager) => Promise<TResult | never>, isolationOrErrorHandler?: IsolationLevel | ((error: TError) => Promise<never | TResult | void>), maybeErrorHandlerOrDontFail?: (error: TError) => Promise<never | TResult | void>): Promise<never | TResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../../src/interfaces/services/transaction-base.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=transaction-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../src/interfaces/transaction-base.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/search/index-types.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./index-types";
|
|
2
|
+
export * from "./interface";
|
|
3
|
+
export * from "./settings";
|
|
4
|
+
export declare type IndexSettings = {
|
|
5
|
+
/**
|
|
6
|
+
* Settings specific to the provider. E.g. `searchableAttributes`.
|
|
7
|
+
*/
|
|
8
|
+
indexSettings: Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Primary key for the index. Used to enforce unique documents in an index. See more in Meilisearch' https://docs.meilisearch.com/learn/core_concepts/primary_key.html.
|
|
11
|
+
*/
|
|
12
|
+
primaryKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Document transformer. Used to transform documents before they are added to the index.
|
|
15
|
+
*/
|
|
16
|
+
transformer?: (document: any) => any;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index-types"), exports);
|
|
18
|
+
__exportStar(require("./interface"), exports);
|
|
19
|
+
__exportStar(require("./settings"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/search/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,8CAA2B;AAC3B,6CAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexes.js","sourceRoot":"","sources":["../../src/search/indexes.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface ISearchService {
|
|
2
|
+
options: Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Used to create an index
|
|
5
|
+
* @param indexName the index name
|
|
6
|
+
* @param options the options
|
|
7
|
+
* @return returns response from search engine provider
|
|
8
|
+
*/
|
|
9
|
+
createIndex(indexName: string, options: unknown): unknown;
|
|
10
|
+
/**
|
|
11
|
+
* Used to get an index
|
|
12
|
+
* @param indexName - the index name.
|
|
13
|
+
* @return returns response from search engine provider
|
|
14
|
+
*/
|
|
15
|
+
getIndex(indexName: string): unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Used to index documents by the search engine provider
|
|
18
|
+
* @param indexName the index name
|
|
19
|
+
* @param documents documents array to be indexed
|
|
20
|
+
* @param type of documents to be added (e.g: products, regions, orders, etc)
|
|
21
|
+
* @return returns response from search engine provider
|
|
22
|
+
*/
|
|
23
|
+
addDocuments(indexName: string, documents: unknown, type: string): unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Used to replace documents
|
|
26
|
+
* @param indexName the index name.
|
|
27
|
+
* @param documents array of document objects that will replace existing documents
|
|
28
|
+
* @param type type of documents to be replaced (e.g: products, regions, orders, etc)
|
|
29
|
+
* @return returns response from search engine provider
|
|
30
|
+
*/
|
|
31
|
+
replaceDocuments(indexName: string, documents: unknown, type: string): unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Used to delete document
|
|
34
|
+
* @param indexName the index name
|
|
35
|
+
* @param document_id the id of the document
|
|
36
|
+
* @return returns response from search engine provider
|
|
37
|
+
*/
|
|
38
|
+
deleteDocument(indexName: string, document_id: string | number): unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Used to delete all documents
|
|
41
|
+
* @param indexName the index name
|
|
42
|
+
* @return returns response from search engine provider
|
|
43
|
+
*/
|
|
44
|
+
deleteAllDocuments(indexName: string): unknown;
|
|
45
|
+
/**
|
|
46
|
+
* Used to search for a document in an index
|
|
47
|
+
* @param indexName the index name
|
|
48
|
+
* @param query the search query
|
|
49
|
+
* @param options
|
|
50
|
+
* - any options passed to the request object other than the query and indexName
|
|
51
|
+
* - additionalOptions contain any provider specific options
|
|
52
|
+
* @return returns response from search engine provider
|
|
53
|
+
*/
|
|
54
|
+
search(indexName: string, query: string | null, options: unknown): unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Used to update the settings of an index
|
|
57
|
+
* @param indexName the index name
|
|
58
|
+
* @param settings settings object
|
|
59
|
+
* @return returns response from search engine provider
|
|
60
|
+
*/
|
|
61
|
+
updateSettings(indexName: string, settings: unknown): unknown;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/search/interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare type IndexSettings = {
|
|
2
|
+
/**
|
|
3
|
+
* Settings specific to the provider. E.g. `searchableAttributes`.
|
|
4
|
+
*/
|
|
5
|
+
indexSettings: Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Primary key for the index. Used to enforce unique documents in an index. See more in Meilisearch' https://docs.meilisearch.com/learn/core_concepts/primary_key.html.
|
|
8
|
+
*/
|
|
9
|
+
primaryKey?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Document transformer. Used to transform documents before they are added to the index.
|
|
12
|
+
*/
|
|
13
|
+
transformer?: (document: any) => any;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/search/settings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./transaction-base";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./transaction-base"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transaction-base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-base.js","sourceRoot":"","sources":["../../src/transaction-base/transaction-base.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next-20230322093850",
|
|
4
4
|
"description": "Medusa Types definition",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
],
|
|
17
17
|
"author": "Medusa",
|
|
18
18
|
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@medusajs/modules-sdk": "0.1.0-next-20230322093850"
|
|
21
|
+
},
|
|
19
22
|
"devDependencies": {
|
|
20
23
|
"cross-env": "^5.2.1",
|
|
21
24
|
"typeorm": "^0.3.11",
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
"scripts": {
|
|
25
28
|
"prepare": "cross-env NODE_ENV=production yarn run build",
|
|
26
29
|
"build": "tsc --build",
|
|
30
|
+
"watch": "tsc --build --watch",
|
|
27
31
|
"test": "exit 0"
|
|
28
32
|
}
|
|
29
33
|
}
|