@unifiedcommerce/plugin-uom 0.0.1 → 0.2.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/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { PluginDb as Db } from "@unifiedcommerce/core";
2
- import type { unitsOfMeasure, uomConversions, entityUom } from "./schema";
2
+ import type { unitsOfMeasure, uomConversions, entityUom } from "./schema.js";
3
3
  export type UnitOfMeasure = typeof unitsOfMeasure.$inferSelect;
4
4
  export type UOMConversion = typeof uomConversions.$inferSelect;
5
5
  export type EntityUOM = typeof entityUom.$inferSelect;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1E,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAC/D,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,YAAY,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7E,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAC/D,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,YAAY,CAAC;AACtD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "@unifiedcommerce/plugin-uom",
3
- "version": "0.0.1",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
- "types": "./dist/index.d.ts",
8
- "default": "./dist/index.js"
7
+ "bun": "./src/index.ts",
8
+ "import": "./dist/index.js",
9
+ "types": "./src/index.ts"
10
+ },
11
+ "./schema": {
12
+ "bun": "./src/schema.ts",
13
+ "import": "./dist/schema.js",
14
+ "require": "./dist/schema.js",
15
+ "types": "./src/schema.ts"
9
16
  }
10
17
  },
11
18
  "scripts": {
@@ -30,8 +37,8 @@
30
37
  "access": "public"
31
38
  },
32
39
  "files": [
33
- "dist",
34
40
  "src",
41
+ "dist",
35
42
  "README.md"
36
43
  ]
37
44
  }
package/src/index.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { defineCommercePlugin } from "@unifiedcommerce/core";
2
- import { unitsOfMeasure, uomConversions, entityUom } from "./schema";
3
- import { UOMService } from "./services/uom-service";
4
- import { buildUOMRoutes } from "./routes/uom";
5
- import type { Db } from "./types";
2
+ import { unitsOfMeasure, uomConversions, entityUom } from "./schema.js";
3
+ import { UOMService } from "./services/uom-service.js";
4
+ import { buildUOMRoutes } from "./routes/uom.js";
5
+ import type { Db } from "./types.js";
6
6
 
7
- export type { Db } from "./types";
8
- export { UOMService } from "./services/uom-service";
7
+ export type { Db } from "./types.js";
8
+ export { UOMService } from "./services/uom-service.js";
9
9
 
10
10
  export function uomPlugin() {
11
11
  return defineCommercePlugin({
@@ -18,7 +18,7 @@ export function uomPlugin() {
18
18
  schema: () => ({ unitsOfMeasure, uomConversions, entityUom }),
19
19
  hooks: () => [],
20
20
  routes: (ctx) => {
21
- const db = ctx.database.db as unknown as Db;
21
+ const db = ctx.database.db;
22
22
  if (!db) return [];
23
23
  return buildUOMRoutes(new UOMService(db), ctx);
24
24
  },
package/src/routes/uom.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { router } from "@unifiedcommerce/core";
2
2
  import { z } from "@hono/zod-openapi";
3
- import type { UOMService } from "../services/uom-service";
3
+ import type { UOMService } from "../services/uom-service.js";
4
4
  import type { PluginRouteRegistration } from "@unifiedcommerce/core";
5
5
 
6
6
  export function buildUOMRoutes(
@@ -1,8 +1,8 @@
1
1
  import { eq, and } from "drizzle-orm";
2
2
  import { Ok, Err } from "@unifiedcommerce/core";
3
3
  import type { PluginResult } from "@unifiedcommerce/core";
4
- import { unitsOfMeasure, uomConversions, entityUom } from "../schema";
5
- import type { Db, UnitOfMeasure, UOMConversion, EntityUOM, UOMCategory } from "../types";
4
+ import { unitsOfMeasure, uomConversions, entityUom } from "../schema.js";
5
+ import type { Db, UnitOfMeasure, UOMConversion, EntityUOM, UOMCategory } from "../types.js";
6
6
 
7
7
  export class UOMService {
8
8
  constructor(private db: Db) {}
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { PluginDb as Db } from "@unifiedcommerce/core";
2
- import type { unitsOfMeasure, uomConversions, entityUom } from "./schema";
2
+ import type { unitsOfMeasure, uomConversions, entityUom } from "./schema.js";
3
3
  export type UnitOfMeasure = typeof unitsOfMeasure.$inferSelect;
4
4
  export type UOMConversion = typeof uomConversions.$inferSelect;
5
5
  export type EntityUOM = typeof entityUom.$inferSelect;