@medusajs/types 1.8.9 → 1.8.10-beta-20230705211101

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 (40) hide show
  1. package/dist/bundles.d.ts +1 -0
  2. package/dist/bundles.js +2 -1
  3. package/dist/bundles.js.map +1 -1
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +2 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/joiner/index.d.ts +46 -0
  8. package/dist/{admin/common.js → joiner/index.js} +1 -1
  9. package/dist/joiner/index.js.map +1 -0
  10. package/dist/logger/index.d.ts +15 -0
  11. package/dist/{admin/widget.js → logger/index.js} +1 -1
  12. package/dist/logger/index.js.map +1 -0
  13. package/dist/modules-sdk/index.d.ts +2 -7
  14. package/dist/modules-sdk/index.js.map +1 -1
  15. package/package.json +2 -1
  16. package/dist/admin/application.d.ts +0 -6
  17. package/dist/admin/application.js +0 -3
  18. package/dist/admin/application.js.map +0 -1
  19. package/dist/admin/common.d.ts +0 -14
  20. package/dist/admin/common.js.map +0 -1
  21. package/dist/admin/config.d.ts +0 -17
  22. package/dist/admin/config.js +0 -3
  23. package/dist/admin/config.js.map +0 -1
  24. package/dist/admin/helpers.d.ts +0 -14
  25. package/dist/admin/helpers.js +0 -3
  26. package/dist/admin/helpers.js.map +0 -1
  27. package/dist/admin/index.d.ts +0 -4
  28. package/dist/admin/index.js +0 -21
  29. package/dist/admin/index.js.map +0 -1
  30. package/dist/admin/widget.d.ts +0 -20
  31. package/dist/admin/widget.js.map +0 -1
  32. package/dist/tax/common.d.ts +0 -20
  33. package/dist/tax/common.js +0 -3
  34. package/dist/tax/common.js.map +0 -1
  35. package/dist/tax/index.d.ts +0 -2
  36. package/dist/tax/index.js +0 -19
  37. package/dist/tax/index.js.map +0 -1
  38. package/dist/tax/tax-calculation-strategy.d.ts +0 -23
  39. package/dist/tax/tax-calculation-strategy.js +0 -10
  40. package/dist/tax/tax-calculation-strategy.js.map +0 -1
package/dist/bundles.d.ts CHANGED
@@ -8,3 +8,4 @@ export * as SearchTypes from "./search";
8
8
  export * as StockLocationTypes from "./stock-location";
9
9
  export * as TransactionBaseTypes from "./transaction-base";
10
10
  export * as DAL from "./dal";
11
+ export * as LoggerTypes from "./logger";
package/dist/bundles.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DAL = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.ProductTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0;
26
+ exports.LoggerTypes = exports.DAL = exports.TransactionBaseTypes = exports.StockLocationTypes = exports.SearchTypes = exports.ModulesSdkTypes = exports.ProductTypes = exports.InventoryTypes = exports.EventBusTypes = exports.CommonTypes = exports.CacheTypes = void 0;
27
27
  exports.CacheTypes = __importStar(require("./cache"));
28
28
  exports.CommonTypes = __importStar(require("./common"));
29
29
  exports.EventBusTypes = __importStar(require("./event-bus"));
@@ -34,4 +34,5 @@ exports.SearchTypes = __importStar(require("./search"));
34
34
  exports.StockLocationTypes = __importStar(require("./stock-location"));
35
35
  exports.TransactionBaseTypes = __importStar(require("./transaction-base"));
36
36
  exports.DAL = __importStar(require("./dal"));
37
+ exports.LoggerTypes = __importStar(require("./logger"));
37
38
  //# sourceMappingURL=bundles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAqC;AACrC,wDAAuC;AACvC,6DAA4C;AAC5C,8DAA6C;AAC7C,0DAAyC;AACzC,iEAAgD;AAChD,wDAAuC;AACvC,uEAAsD;AACtD,2EAA0D;AAC1D,6CAA4B"}
1
+ {"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAqC;AACrC,wDAAuC;AACvC,6DAA4C;AAC5C,8DAA6C;AAC7C,0DAAyC;AACzC,iEAAgD;AAChD,wDAAuC;AACvC,uEAAsD;AACtD,2EAA0D;AAC1D,6CAA4B;AAC5B,wDAAuC"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./cache";
3
3
  export * from "./common";
4
4
  export * from "./event-bus";
5
5
  export * from "./inventory";
6
+ export * from "./joiner";
6
7
  export * from "./modules-sdk";
7
8
  export * from "./product";
8
9
  export * from "./product-category";
@@ -11,3 +12,4 @@ export * from "./shared-context";
11
12
  export * from "./stock-location";
12
13
  export * from "./transaction-base";
13
14
  export * from "./dal";
15
+ export * from "./logger";
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./cache"), exports);
19
19
  __exportStar(require("./common"), exports);
20
20
  __exportStar(require("./event-bus"), exports);
21
21
  __exportStar(require("./inventory"), exports);
22
+ __exportStar(require("./joiner"), exports);
22
23
  __exportStar(require("./modules-sdk"), exports);
23
24
  __exportStar(require("./product"), exports);
24
25
  __exportStar(require("./product-category"), exports);
@@ -27,4 +28,5 @@ __exportStar(require("./shared-context"), exports);
27
28
  __exportStar(require("./stock-location"), exports);
28
29
  __exportStar(require("./transaction-base"), exports);
29
30
  __exportStar(require("./dal"), exports);
31
+ __exportStar(require("./logger"), exports);
30
32
  //# 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,4CAAyB;AACzB,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B;AAC3B,gDAA6B;AAC7B,4CAAyB;AACzB,qDAAkC;AAClC,2CAAwB;AACxB,mDAAgC;AAChC,mDAAgC;AAChC,qDAAkC;AAClC,wCAAqB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,8CAA2B;AAC3B,2CAAwB;AACxB,gDAA6B;AAC7B,4CAAyB;AACzB,qDAAkC;AAClC,2CAAwB;AACxB,mDAAgC;AAChC,mDAAgC;AAChC,qDAAkC;AAClC,wCAAqB;AACrB,2CAAwB"}
@@ -0,0 +1,46 @@
1
+ export declare type JoinerRelationship = {
2
+ alias: string;
3
+ foreignKey: string;
4
+ primaryKey: string;
5
+ serviceName: string;
6
+ inverse?: boolean;
7
+ };
8
+ export interface JoinerServiceConfig {
9
+ serviceName: string;
10
+ primaryKeys: string[];
11
+ relationships?: JoinerRelationship[];
12
+ extends?: {
13
+ serviceName: string;
14
+ resolve: JoinerRelationship;
15
+ }[];
16
+ }
17
+ export interface JoinerArgument {
18
+ name: string;
19
+ value?: any;
20
+ field?: string;
21
+ }
22
+ export interface RemoteJoinerQuery {
23
+ service: string;
24
+ expands?: Array<{
25
+ property: string;
26
+ fields: string[];
27
+ args?: JoinerArgument[];
28
+ relationships?: JoinerRelationship[];
29
+ }>;
30
+ fields: string[];
31
+ args?: JoinerArgument[];
32
+ }
33
+ export interface RemoteNestedExpands {
34
+ [key: string]: {
35
+ fields: string[];
36
+ args?: JoinerArgument[];
37
+ expands?: RemoteNestedExpands;
38
+ };
39
+ }
40
+ export interface RemoteExpandProperty {
41
+ property: string;
42
+ serviceConfig: JoinerServiceConfig;
43
+ fields: string[];
44
+ args?: JoinerArgument[];
45
+ expands?: RemoteNestedExpands;
46
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=common.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/joiner/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ export interface Logger {
2
+ panic: (data: any) => void;
3
+ shouldLog: (level: string) => void;
4
+ setLogLevel: (level: string) => void;
5
+ unsetLogLevel: () => void;
6
+ activity: (message: string, config?: any) => void;
7
+ progress: (activityId: any, message: any) => void;
8
+ error: (messageOrError: any, error?: any) => void;
9
+ failure: (activityId: any, message: any) => void;
10
+ success: (activityId: any, message: any) => void;
11
+ debug: (message: any) => void;
12
+ info: (message: any) => void;
13
+ warn: (message: any) => void;
14
+ log: (...args: any[]) => void;
15
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=widget.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":""}
@@ -1,14 +1,9 @@
1
- import { Logger as _Logger } from "winston";
2
- import { MedusaContainer } from "../common/medusa-container";
1
+ import { MedusaContainer } from "../common";
2
+ import { Logger } from "../logger";
3
3
  export declare type Constructor<T> = new (...args: any[]) => T;
4
4
  export * from "../common/medusa-container";
5
5
  export declare type LogLevel = "query" | "schema" | "error" | "warn" | "info" | "log" | "migration";
6
6
  export declare type LoggerOptions = boolean | "all" | LogLevel[];
7
- export declare type Logger = _Logger & {
8
- progress: (activityId: string, msg: string) => void;
9
- info: (msg: string) => void;
10
- warn: (msg: string) => void;
11
- };
12
7
  export declare enum MODULE_SCOPE {
13
8
  INTERNAL = "internal",
14
9
  EXTERNAL = "external"
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,6DAA0C;AAkB1C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;AACvB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,6CAAqB,CAAA;AACvB,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,6DAA0C;AAY1C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;AACvB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,6CAAqB,CAAA;AACvB,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@medusajs/types",
3
- "version": "1.8.9",
3
+ "version": "1.8.10-beta-20230705211101",
4
4
  "description": "Medusa Types definition",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "https://github.com/medusajs/medusa",
@@ -1,6 +0,0 @@
1
- import { DomainKey, HookPointKey, LoadedWidget, WidgetsConfig } from "./widget";
2
- export declare type InjectionZone = `${DomainKey}.${HookPointKey}`;
3
- export declare type InjectionZones = Map<InjectionZone, LoadedWidget[]>;
4
- export interface Application {
5
- registerWidgets(identifier: string, config: WidgetsConfig): void;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=application.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../src/admin/application.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- export interface IBaseExtension {
3
- /**
4
- * The name of the extension, used to identify it in the admin panel and improve debugging.
5
- */
6
- name: string;
7
- /**
8
- * The component to render in the admin panel.
9
- */
10
- Component: React.ComponentType<any>;
11
- }
12
- export interface IBaseLoadedExtension extends IBaseExtension {
13
- origin: string;
14
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/admin/common.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { Application } from "./application";
2
- import { WidgetsConfig } from "./widget";
3
- export declare type ExtensionConfig = {
4
- /**
5
- * A unique identifier for the customization configuration, used to differentiate it from other customization sources.
6
- * It is recommended to use the name of the package where the customization configuration is defined, for example, `my-medusa-plugin`.
7
- */
8
- identifier: string;
9
- /**
10
- * The configuration for custom widgets in the admin panel.
11
- * Define your own widgets here to use in the admin panel.
12
- */
13
- widgets?: WidgetsConfig;
14
- };
15
- export declare type Extension = {
16
- setup(app: Application): void;
17
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/admin/config.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import type { NavigateFunction } from "react-router-dom";
2
- declare type NotificationFunction = (title: string, message: string) => void;
3
- export declare type Notify = {
4
- error: NotificationFunction;
5
- success: NotificationFunction;
6
- info: NotificationFunction;
7
- warning: NotificationFunction;
8
- };
9
- export declare type Navigate = NavigateFunction;
10
- export declare type FeatureFlagHelpers = {
11
- isFeatureEnabled: (flag: string) => boolean;
12
- featureToggleList: Record<string, boolean>;
13
- };
14
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/admin/helpers.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export * from "./application";
2
- export * from "./common";
3
- export * from "./config";
4
- export * from "./widget";
@@ -1,21 +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 __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("./application"), exports);
18
- __exportStar(require("./common"), exports);
19
- __exportStar(require("./config"), exports);
20
- __exportStar(require("./widget"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,2CAAwB;AACxB,2CAAwB;AACxB,2CAAwB"}
@@ -1,20 +0,0 @@
1
- import { IBaseExtension, IBaseLoadedExtension } from "./common";
2
- import { FeatureFlagHelpers, Navigate, Notify } from "./helpers";
3
- export interface Widget extends IBaseExtension {
4
- }
5
- export declare type DomainKey = "product" | "product_collection" | "order" | "customer";
6
- export declare type HookPointKey = "details";
7
- declare type HookPoint = {
8
- [key in HookPointKey]?: Widget[];
9
- };
10
- export declare type WidgetsConfig = {
11
- [key in DomainKey]?: HookPoint;
12
- };
13
- export interface LoadedWidget extends Widget, IBaseLoadedExtension {
14
- }
15
- export interface WidgetProps {
16
- notify: Notify;
17
- navigate: Navigate;
18
- featureFlags: FeatureFlagHelpers;
19
- }
20
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/admin/widget.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- /** The amount of a gift card allocated to a line item */
2
- export declare type GiftCardAllocation = {
3
- amount: number;
4
- unit_amount: number;
5
- };
6
- /** The amount of a discount allocated to a line item */
7
- export declare type DiscountAllocation = {
8
- amount: number;
9
- unit_amount: number;
10
- };
11
- /**
12
- * A map of line item ids and its corresponding gift card and discount
13
- * allocations
14
- */
15
- export declare type LineAllocationsMap = {
16
- [K: string]: {
17
- gift_card?: GiftCardAllocation;
18
- discount?: DiscountAllocation;
19
- };
20
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tax/common.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from "./common";
2
- export * from "./tax-calculation-strategy";
package/dist/tax/index.js DELETED
@@ -1,19 +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 __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("./tax-calculation-strategy"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tax/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,6DAA0C"}
@@ -1,23 +0,0 @@
1
- import { LineAllocationsMap } from "./common";
2
- export declare type TaxCalculationContext = {
3
- shipping_address: any;
4
- customer: any;
5
- region: any;
6
- is_return: boolean;
7
- shipping_methods: any;
8
- allocation_map: LineAllocationsMap;
9
- tax_calculation_strategy: ITaxCalculationStrategy;
10
- };
11
- export interface ITaxCalculationStrategy {
12
- /**
13
- * Calculates the tax amount for a given set of line items under applicable
14
- * tax conditions and calculation contexts.
15
- * @param items - the line items to calculate the tax total for
16
- * @param taxLines - the tax lines that applies to the calculation
17
- * @param calculationContext - other details relevant for the calculation
18
- * @return the tax total
19
- */
20
- calculate(items: any, // LineItem[],
21
- taxLines: any[], calculationContext: TaxCalculationContext): Promise<number>;
22
- }
23
- export declare function isTaxCalculationStrategy(object: any): object is ITaxCalculationStrategy;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTaxCalculationStrategy = void 0;
4
- function isTaxCalculationStrategy(
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- object) {
7
- return typeof object.calculate === "function";
8
- }
9
- exports.isTaxCalculationStrategy = isTaxCalculationStrategy;
10
- //# sourceMappingURL=tax-calculation-strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tax-calculation-strategy.js","sourceRoot":"","sources":["../../src/tax/tax-calculation-strategy.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,wBAAwB;AACtC,8DAA8D;AAC9D,MAAW;IAEX,OAAO,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,CAAA;AAC/C,CAAC;AALD,4DAKC"}