Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
uv.lock
.venv
**/node_modules
**/dist
6 changes: 3 additions & 3 deletions rest/nodejs/src/api/checkout.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -15,7 +15,7 @@ import {
saveCheckout,
saveIdempotencyRecord,
saveOrder,
} from "../data";
} from "../data/index.js";
import {
CheckoutResponseStatusSchema,
type Expectation,
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions rest/nodejs/src/api/discovery.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions rest/nodejs/src/api/order.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions rest/nodejs/src/api/testing.ts
Original file line number Diff line number Diff line change
@@ -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) {}
Expand Down
8 changes: 4 additions & 4 deletions rest/nodejs/src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
2 changes: 1 addition & 1 deletion rest/nodejs/src/data/inventory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTransactionsDb } from "./db";
import { getTransactionsDb } from "./db.js";

/**
* Retrieves the available inventory quantity for a given product.
Expand Down
2 changes: 1 addition & 1 deletion rest/nodejs/src/data/products.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getProductsDb } from "./db";
import { getProductsDb } from "./db.js";

/**
* Represents a product in the catalog.
Expand Down
4 changes: 2 additions & 2 deletions rest/nodejs/src/data/transactions.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 7 additions & 7 deletions rest/nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion rest/nodejs/src/models/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
FulfillmentDestinationResponseSchema,
OrderSchema,
PaymentCredentialSchema,
} from "./spec_generated";
} from "./spec_generated.js";

export const ExtendedPaymentCredentialSchema = PaymentCredentialSchema.extend({
token: z.string().optional(),
Expand Down
4 changes: 2 additions & 2 deletions rest/nodejs/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./extensions";
export * from "./spec_generated";
export * from "./extensions.js";
export * from "./spec_generated.js";
2 changes: 1 addition & 1 deletion rest/nodejs/src/utils/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Context } from "hono";
import type { Context } from "hono";
import * as z from "zod";

/**
Expand Down