Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

build registry

vholikf6863924081c
diff --git a/packages/registry/r/block-1.json b/packages/registry/r/block-1.json
index cb22c451b..ac2b44aaa 100644
--- a/packages/registry/r/block-1.json
+++ b/packages/registry/r/block-1.json
@@ -3,8 +3,10 @@
"name": "block-1",
"description": "A block with a test module, product-test link, and API route.",
"dependencies": [],
- "registryDependencies": [],
- "docs": "## Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```\n\n## Usage\n\nThe test module provides a service that can be injected into your API routes:\n\n```ts\nimport { MedusaRequest, MedusaResponse } from '@medusajs/framework';\nimport TestModuleService from '../../../modules/test/service';\n\nexport async function GET(req: MedusaRequest, res: MedusaResponse) {\n const testService = req.scope.resolve<TestModuleService>('testModuleService');\n const result = await testService.doSomething();\n res.json(result);\n}\n```\n\n## Links\n\nThis block includes a `product-test` link that connects products to test entities.",
+ "registryDependencies": [
+ "block-2"
+ ],
+ "docs": "## Test Block Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```",
"categories": [
"test"
],
diff --git a/packages/registry/r/block-2.json b/packages/registry/r/block-2.json
new file mode 100644
index 000000000..9c9da9925
--- /dev/null
+++ b/packages/registry/r/block-2.json
@@ -0,0 +1,44 @@
+{
+ "$schema": "https://raw.githubusercontent.com/mercurjs/mercur/new/packages/registry/schema/registry-item.json",
+ "name": "block-2",
+ "description": "A block with a sample module, product-sample link, workflow, and API route.",
+ "dependencies": [],
+ "registryDependencies": [],
+ "docs": "## Sample Block Configuration\n\nAdd the sample module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/sample',\n options: {\n apiKey: process.env.SAMPLE_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nSAMPLE_API_KEY=your-api-key\n```",
+ "categories": [
+ "sample",
+ "workflow"
+ ],
+ "files": [
+ {
+ "path": "block-2/modules/sample/index.ts",
+ "content": "import { Module } from \"@medusajs/framework/utils\"\nimport SampleModuleService from \"./service\"\n\nexport const SAMPLE_MODULE = \"sample\"\n\nexport default Module(SAMPLE_MODULE, {\n service: SampleModuleService,\n})\n",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/modules/sample/service.ts",
+ "content": "import { MedusaService } from \"@medusajs/framework/utils\"\nimport Sample from \"./models/sample\"\n\nclass SampleModuleService extends MedusaService({\n Sample,\n}) {}\n\nexport default SampleModuleService\n",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/modules/sample/models/sample.ts",
+ "content": "import { model } from \"@medusajs/framework/utils\"\n\nconst Sample = model.define(\"sample\", {\n id: model.id().primaryKey(),\n name: model.text(),\n})\n\nexport default Sample\n",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/links/product-sample.ts",
+ "content": "import { defineLink } from \"@medusajs/framework/utils\"\nimport ProductModule from \"@medusajs/medusa/product\"\nimport SampleModule from \"../modules/sample\"\n\nexport default defineLink(\n ProductModule.linkable.product,\n SampleModule.linkable.sample\n)\n",
+ "type": "registry:link"
+ },
+ {
+ "path": "block-2/workflows/hello-world/hello-world.ts",
+ "content": "import {\n createStep,\n createWorkflow,\n WorkflowResponse,\n StepResponse,\n} from \"@medusajs/framework/workflows-sdk\"\n\nconst step1 = createStep(\"step-1\", async () => {\n return new StepResponse(`Hello from step one!`)\n})\n\ntype WorkflowInput = {\n name: string\n}\n\nconst step2 = createStep(\n \"step-2\",\n async ({ name }: WorkflowInput) => {\n return new StepResponse(`Hello ${name} from step two!`)\n }\n)\n\ntype WorkflowOutput = {\n message1: string\n message2: string\n}\n\nconst helloWorldWorkflow = createWorkflow(\n \"hello-world\",\n (input: WorkflowInput) => {\n const greeting1 = step1()\n const greeting2 = step2(input)\n\n return new WorkflowResponse({\n message1: greeting1,\n message2: greeting2,\n })\n }\n)\n\nexport default helloWorldWorkflow\n",
+ "type": "registry:workflow"
+ },
+ {
+ "path": "block-2/api/hello/workflow/route.ts",
+ "content": "import type { MedusaRequest, MedusaResponse } from \"@medusajs/framework/http\"\nimport helloWorldWorkflow from \"../../../workflows/hello-world/hello-world\"\n\nexport const GET = async (req: MedusaRequest, res: MedusaResponse) => {\n const { result } = await helloWorldWorkflow(req.scope).run({\n input: {\n name: (req.query.name as string) || \"World\",\n },\n })\n\n res.json(result)\n}\n",
+ "type": "registry:api"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/registry/r/registry.json b/packages/registry/r/registry.json
index 8b8f054ee..8b7504544 100644
--- a/packages/registry/r/registry.json
+++ b/packages/registry/r/registry.json
@@ -7,8 +7,10 @@
"name": "block-1",
"description": "A block with a test module, product-test link, and API route.",
"dependencies": [],
- "registryDependencies": [],
- "docs": "## Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```\n\n## Usage\n\nThe test module provides a service that can be injected into your API routes:\n\n```ts\nimport { MedusaRequest, MedusaResponse } from '@medusajs/framework';\nimport TestModuleService from '../../../modules/test/service';\n\nexport async function GET(req: MedusaRequest, res: MedusaResponse) {\n const testService = req.scope.resolve<TestModuleService>('testModuleService');\n const result = await testService.doSomething();\n res.json(result);\n}\n```\n\n## Links\n\nThis block includes a `product-test` link that connects products to test entities.",
+ "registryDependencies": [
+ "block-2"
+ ],
+ "docs": "## Test Block Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```",
"files": [
{
"path": "block-1/modules/test/index.ts",
@@ -34,6 +36,43 @@
"categories": [
"test"
]
+ },
+ {
+ "name": "block-2",
+ "description": "A block with a sample module, product-sample link, workflow, and API route.",
+ "dependencies": [],
+ "registryDependencies": [],
+ "docs": "## Sample Block Configuration\n\nAdd the sample module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/sample',\n options: {\n apiKey: process.env.SAMPLE_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nSAMPLE_API_KEY=your-api-key\n```",
+ "files": [
+ {
+ "path": "block-2/modules/sample/index.ts",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/modules/sample/service.ts",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/modules/sample/models/sample.ts",
+ "type": "registry:module"
+ },
+ {
+ "path": "block-2/links/product-sample.ts",
+ "type": "registry:link"
+ },
+ {
+ "path": "block-2/workflows/hello-world/hello-world.ts",
+ "type": "registry:workflow"
+ },
+ {
+ "path": "block-2/api/hello/workflow/route.ts",
+ "type": "registry:api"
+ }
+ ],
+ "categories": [
+ "sample",
+ "workflow"
+ ]
}
]
}
\ No newline at end of file