diff --git a/.gitignore b/.gitignore index 85c491c..453b3dc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ uv.lock .venv **/node_modules +**/dist diff --git a/rest/nodejs/src/api/checkout.ts b/rest/nodejs/src/api/checkout.ts index 840b3d0..a1dafaa 100644 --- a/rest/nodejs/src/api/checkout.ts +++ b/rest/nodejs/src/api/checkout.ts @@ -1,5 +1,5 @@ import { createHash } from "crypto"; -import { type Context } from "hono"; +import type { Context } from "hono"; import { v4 as uuidv4 } from "uuid"; import { z } from "zod"; @@ -15,7 +15,7 @@ import { saveCheckout, saveIdempotencyRecord, saveOrder, -} from "../data"; +} from "../data/index.js"; import { CheckoutResponseStatusSchema, type Expectation, @@ -36,7 +36,7 @@ import { type PaymentCreateRequest, PaymentDataSchema, type PostalAddress, -} from "../models"; +} from "../models/index.js"; /** * Schema for the request body when completing a checkout session. diff --git a/rest/nodejs/src/api/discovery.ts b/rest/nodejs/src/api/discovery.ts index 14b992f..cbcd60e 100644 --- a/rest/nodejs/src/api/discovery.ts +++ b/rest/nodejs/src/api/discovery.ts @@ -1,5 +1,5 @@ -import { type Context } from "hono"; -import { type UcpDiscoveryProfile } from "../models"; +import type { Context } from "hono"; +import type { UcpDiscoveryProfile } from "../models"; /** * Service for handling UCP discovery requests. diff --git a/rest/nodejs/src/api/order.ts b/rest/nodejs/src/api/order.ts index a65f25c..d55f028 100644 --- a/rest/nodejs/src/api/order.ts +++ b/rest/nodejs/src/api/order.ts @@ -1,6 +1,6 @@ -import { type Context } from "hono"; -import { getOrder, logRequest, saveOrder } from "../data"; -import { type Order } from "../models"; +import type { Context } from "hono"; +import { getOrder, logRequest, saveOrder } from "../data/index.js"; +import type { Order } from "../models"; /** * Service for managing orders. diff --git a/rest/nodejs/src/api/testing.ts b/rest/nodejs/src/api/testing.ts index 00b2144..a850d77 100644 --- a/rest/nodejs/src/api/testing.ts +++ b/rest/nodejs/src/api/testing.ts @@ -1,6 +1,6 @@ -import { type Context } from "hono"; +import type { Context } from "hono"; -import { CheckoutService } from "./checkout"; +import { CheckoutService } from "./checkout.js"; export class TestingService { constructor(private readonly checkoutService: CheckoutService) {} diff --git a/rest/nodejs/src/data/index.ts b/rest/nodejs/src/data/index.ts index 4d5e042..ac57414 100644 --- a/rest/nodejs/src/data/index.ts +++ b/rest/nodejs/src/data/index.ts @@ -4,7 +4,7 @@ * transactions databases (SQLite). */ -export * from "./db"; -export * from "./inventory"; -export * from "./products"; -export * from "./transactions"; +export * from "./db.js"; +export * from "./inventory.js"; +export * from "./products.js"; +export * from "./transactions.js"; diff --git a/rest/nodejs/src/data/inventory.ts b/rest/nodejs/src/data/inventory.ts index d23d373..ca4b97c 100644 --- a/rest/nodejs/src/data/inventory.ts +++ b/rest/nodejs/src/data/inventory.ts @@ -1,4 +1,4 @@ -import { getTransactionsDb } from "./db"; +import { getTransactionsDb } from "./db.js"; /** * Retrieves the available inventory quantity for a given product. diff --git a/rest/nodejs/src/data/products.ts b/rest/nodejs/src/data/products.ts index f6c3623..5923896 100644 --- a/rest/nodejs/src/data/products.ts +++ b/rest/nodejs/src/data/products.ts @@ -1,4 +1,4 @@ -import { getProductsDb } from "./db"; +import { getProductsDb } from "./db.js"; /** * Represents a product in the catalog. diff --git a/rest/nodejs/src/data/transactions.ts b/rest/nodejs/src/data/transactions.ts index c2369a8..17e3816 100644 --- a/rest/nodejs/src/data/transactions.ts +++ b/rest/nodejs/src/data/transactions.ts @@ -1,6 +1,6 @@ -import { type ExtendedCheckoutResponse, type Order } from "../models"; +import type { ExtendedCheckoutResponse, Order } from "../models"; -import { getTransactionsDb } from "./db"; +import { getTransactionsDb } from "./db.js"; /** * Represents the structure of a checkout session stored in the database. diff --git a/rest/nodejs/src/index.ts b/rest/nodejs/src/index.ts index 7ffdf3d..8d03f9b 100644 --- a/rest/nodejs/src/index.ts +++ b/rest/nodejs/src/index.ts @@ -4,17 +4,17 @@ import { type Context, Hono } from "hono"; import { requestId } from "hono/request-id"; import { pinoHttp } from "pino-http"; -import { CheckoutService, zCompleteCheckoutRequest } from "./api/checkout"; -import { DiscoveryService } from "./api/discovery"; -import { OrderService } from "./api/order"; -import { TestingService } from "./api/testing"; -import { initDbs } from "./data/db"; +import { CheckoutService, zCompleteCheckoutRequest } from "./api/checkout.js"; +import { DiscoveryService } from "./api/discovery.js"; +import { OrderService } from "./api/order.js"; +import { TestingService } from "./api/testing.js"; +import { initDbs } from "./data/db.js"; import { ExtendedCheckoutCreateRequestSchema, ExtendedCheckoutUpdateRequestSchema, OrderSchema, -} from "./models"; -import { IdParamSchema, prettyValidation } from "./utils/validation"; +} from "./models/index.js"; +import { IdParamSchema, prettyValidation } from "./utils/validation.js"; const app = new Hono(); diff --git a/rest/nodejs/src/models/extensions.ts b/rest/nodejs/src/models/extensions.ts index 7c2b3f5..88eb037 100644 --- a/rest/nodejs/src/models/extensions.ts +++ b/rest/nodejs/src/models/extensions.ts @@ -11,7 +11,7 @@ import { FulfillmentDestinationResponseSchema, OrderSchema, PaymentCredentialSchema, -} from "./spec_generated"; +} from "./spec_generated.js"; export const ExtendedPaymentCredentialSchema = PaymentCredentialSchema.extend({ token: z.string().optional(), diff --git a/rest/nodejs/src/models/index.ts b/rest/nodejs/src/models/index.ts index 28e9880..8adad2d 100644 --- a/rest/nodejs/src/models/index.ts +++ b/rest/nodejs/src/models/index.ts @@ -1,2 +1,2 @@ -export * from "./extensions"; -export * from "./spec_generated"; +export * from "./extensions.js"; +export * from "./spec_generated.js"; diff --git a/rest/nodejs/src/utils/validation.ts b/rest/nodejs/src/utils/validation.ts index 093d18a..b7a5426 100644 --- a/rest/nodejs/src/utils/validation.ts +++ b/rest/nodejs/src/utils/validation.ts @@ -1,4 +1,4 @@ -import { type Context } from "hono"; +import type { Context } from "hono"; import * as z from "zod"; /**