@medusajs/types 0.0.2-next-20230324075823 → 0.0.2-rc.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.
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../src/interfaces/event-bus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * as EventBus from "../event-bus/event-bus";
2
+ export * as ITransactionBaseService from "../transaction-base/transaction-base";
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=event-bus.js.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=transaction-base.js.map
@@ -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,3 @@
1
+ export declare const indexTypes: {
2
+ PRODUCTS: string;
3
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.indexTypes = void 0;
4
+ exports.indexTypes = {
5
+ PRODUCTS: "products"
6
+ };
7
+ //# sourceMappingURL=indexes.js.map
@@ -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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/types",
3
- "version": "0.0.2-next-20230324075823",
3
+ "version": "0.0.2-rc.1",
4
4
  "description": "Medusa Types definition",
5
5
  "main": "dist/index.js",
6
6
  "repository": {