@gorgo/medusa-integration 0.0.3 → 0.0.5
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/.medusa/server/src/admin/index.js +546 -119
- package/.medusa/server/src/admin/index.mjs +549 -122
- package/.medusa/server/src/api/admin/integrations/[provider_id]/route.js +7 -2
- package/.medusa/server/src/api/admin/integrations/__tests__/helpers.unit.spec.d.ts +1 -0
- package/.medusa/server/src/api/admin/integrations/__tests__/helpers.unit.spec.js +30 -0
- package/.medusa/server/src/api/admin/integrations/_helpers.d.ts +3 -3
- package/.medusa/server/src/api/admin/integrations/_helpers.js +8 -8
- package/.medusa/server/src/api/admin/integrations/catalog/route.d.ts +3 -0
- package/.medusa/server/src/api/admin/integrations/catalog/route.js +10 -0
- package/.medusa/server/src/api/admin/integrations/middlewares.js +16 -1
- package/.medusa/server/src/api/admin/integrations/route.js +17 -3
- package/.medusa/server/src/api/admin/integrations/validators.d.ts +7 -0
- package/.medusa/server/src/api/admin/integrations/validators.js +8 -2
- package/.medusa/server/src/index.d.ts +1 -1
- package/.medusa/server/src/jobs/__tests__/test-integration-connections.unit.spec.d.ts +1 -0
- package/.medusa/server/src/jobs/__tests__/test-integration-connections.unit.spec.js +27 -0
- package/.medusa/server/src/jobs/test-integration-connections.d.ts +7 -0
- package/.medusa/server/src/jobs/test-integration-connections.js +21 -8
- package/.medusa/server/src/lib/__tests__/catalog-fallback.unit.spec.d.ts +1 -0
- package/.medusa/server/src/lib/__tests__/catalog-fallback.unit.spec.js +37 -0
- package/.medusa/server/src/lib/__tests__/catalog.unit.spec.d.ts +1 -0
- package/.medusa/server/src/lib/__tests__/catalog.unit.spec.js +71 -0
- package/.medusa/server/src/lib/catalog.d.ts +9 -0
- package/.medusa/server/src/lib/catalog.generated.d.ts +2 -0
- package/.medusa/server/src/lib/catalog.generated.js +88 -0
- package/.medusa/server/src/lib/catalog.js +55 -0
- package/.medusa/server/src/modules/integration/descriptor/__tests__/build-zod.unit.spec.js +43 -1
- package/.medusa/server/src/modules/integration/descriptor/__tests__/define.unit.spec.js +3 -3
- package/.medusa/server/src/modules/integration/descriptor/__tests__/introspect.unit.spec.js +3 -3
- package/.medusa/server/src/modules/integration/descriptor/__tests__/section-write.unit.spec.d.ts +1 -0
- package/.medusa/server/src/modules/integration/descriptor/__tests__/section-write.unit.spec.js +64 -0
- package/.medusa/server/src/modules/integration/descriptor/__tests__/validate.unit.spec.js +28 -2
- package/.medusa/server/src/modules/integration/descriptor/build-zod.js +7 -1
- package/.medusa/server/src/modules/integration/descriptor/define.d.ts +5 -5
- package/.medusa/server/src/modules/integration/descriptor/define.js +1 -1
- package/.medusa/server/src/modules/integration/descriptor/introspect.js +2 -2
- package/.medusa/server/src/modules/integration/descriptor/meta.d.ts +1 -1
- package/.medusa/server/src/modules/integration/descriptor/section-write.d.ts +10 -0
- package/.medusa/server/src/modules/integration/descriptor/section-write.js +24 -0
- package/.medusa/server/src/modules/integration/loaders/__tests__/package-meta.unit.spec.d.ts +1 -0
- package/.medusa/server/src/modules/integration/loaders/__tests__/package-meta.unit.spec.js +63 -0
- package/.medusa/server/src/modules/integration/loaders/load-providers.js +10 -38
- package/.medusa/server/src/modules/integration/loaders/package-meta.d.ts +22 -0
- package/.medusa/server/src/modules/integration/loaders/package-meta.js +45 -0
- package/.medusa/server/src/modules/integration/loaders/resolve-package-meta.d.ts +8 -0
- package/.medusa/server/src/modules/integration/loaders/resolve-package-meta.js +59 -0
- package/.medusa/server/src/modules/integration/migrations/Migration20260720130920.d.ts +5 -0
- package/.medusa/server/src/modules/integration/migrations/Migration20260720130920.js +18 -0
- package/.medusa/server/src/modules/integration/migrations/Migration20260724101525.d.ts +5 -0
- package/.medusa/server/src/modules/integration/migrations/Migration20260724101525.js +16 -0
- package/.medusa/server/src/modules/integration/models/integration.d.ts +9 -5
- package/.medusa/server/src/modules/integration/models/integration.js +3 -3
- package/.medusa/server/src/modules/integration/services/__tests__/integration-module.unit.spec.d.ts +1 -0
- package/.medusa/server/src/modules/integration/services/__tests__/integration-module.unit.spec.js +344 -0
- package/.medusa/server/src/modules/integration/services/__tests__/integration-provider.unit.spec.js +2 -2
- package/.medusa/server/src/modules/integration/services/integration-module.d.ts +48 -11
- package/.medusa/server/src/modules/integration/services/integration-module.js +56 -6
- package/.medusa/server/src/modules/integration/types/index.d.ts +11 -0
- package/.medusa/server/src/modules/integration/types/index.js +4 -2
- package/.medusa/server/src/modules/integration/utils/integration.d.ts +11 -7
- package/.medusa/server/src/modules/integration/utils/integration.js +12 -8
- package/.medusa/server/src/subscribers/__tests__/invalidate-options-cache.unit.spec.d.ts +1 -0
- package/.medusa/server/src/subscribers/__tests__/invalidate-options-cache.unit.spec.js +53 -0
- package/.medusa/server/src/types/http/integration/admin/entities.d.ts +39 -4
- package/.medusa/server/src/types/http/integration/admin/responses.d.ts +17 -2
- package/.medusa/server/src/types/integration/common.d.ts +3 -3
- package/.medusa/server/src/workflows/integration/steps/apply-integration-section.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/steps/apply-integration-section.js +13 -20
- package/.medusa/server/src/workflows/integration/steps/set-integration-enabled.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/steps/upsert-integration-record.d.ts +2 -2
- package/.medusa/server/src/workflows/integration/workflows/set-integration-enabled.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/workflows/upsert-integration.js +2 -2
- package/README.md +41 -2
- package/README.ru.md +85 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
Integration Module for Medusa
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://docs.gorgojs.com/integrations/integration">Documentation</a>
|
|
7
|
+
<br/>
|
|
8
|
+
A Medusa module that lets plugins declare their settings and store admins configure them right in the Admin — no <code>medusa-config</code> edits, no redeploys, secrets encrypted at rest.
|
|
9
|
+
<br/>
|
|
10
|
+
<a href="https://github.com/gorgojs/medusa-integrations/blob/HEAD/packages/modules/integration/README.ru.md">Читать README на русском ↗</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
5
13
|
<br/>
|
|
6
14
|
|
|
7
15
|
<p align="center">
|
|
8
16
|
<a href="https://medusajs.com">
|
|
9
17
|
<img src="https://img.shields.io/badge/Medusa-^2.17.2-blue?logo=medusa" alt="Medusa" />
|
|
10
18
|
</a>
|
|
19
|
+
<a href="https://medusajs.com">
|
|
20
|
+
<img src="https://img.shields.io/badge/Tested_with_Medusa-v2.17.2-green?logo=checkmarx" alt="Medusa" />
|
|
21
|
+
</a>
|
|
11
22
|
</p>
|
|
12
23
|
|
|
13
24
|
<p align="center">
|
|
14
25
|
<a href="https://t.me/gorgojs_chat">
|
|
15
|
-
<img src="https://img.shields.io/badge/Telegram-Support_Chat-0088cc?logo=telegram&style=social" alt="
|
|
26
|
+
<img src="https://img.shields.io/badge/Telegram-Support_Chat-0088cc?logo=telegram&style=social" alt="Support Chat on Telegram" />
|
|
16
27
|
</a>
|
|
17
28
|
</p>
|
|
18
29
|
|
|
@@ -22,9 +33,33 @@ Integration Module for Medusa
|
|
|
22
33
|
</a>
|
|
23
34
|
</p>
|
|
24
35
|
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **No-code configuration in the Admin.** Plugin credentials and settings are managed under Settings → Integrations — no `medusa-config`/env edits and no redeploys.
|
|
39
|
+
- **Encrypted secrets at rest.** Fields marked `secret` are encrypted (AES-256-GCM) and never reach the browser.
|
|
40
|
+
- **Declarative descriptor** (`defineIntegration`) for plugin authors: options, sections, validation, and a connection test in one place.
|
|
41
|
+
- **Rich option types & validation:** `string` / `url` / `email` / `uuid` / `number` / `boolean` / `enum` / `json`, per-option and cross-section rules, conditional visibility, read-only fields, i18n labels, and an icon.
|
|
42
|
+
- **Multiple instances** of the same provider (e.g. several accounts).
|
|
43
|
+
- **Connection test** from the Admin.
|
|
44
|
+
- **Typed runtime resolve:** consumers read a validated, decrypted config; incomplete or disabled configs never resolve, so drafts don't leak into runtime.
|
|
45
|
+
- **Custom admin widgets** per provider.
|
|
46
|
+
- **Anonymous telemetry.**
|
|
47
|
+
|
|
48
|
+
## What is the integration module?
|
|
49
|
+
|
|
50
|
+
Plugins need settings — API keys, modes, webhooks. Usually these live in `medusa-config`/env, which requires code access and a redeploy for every change, with secrets kept in plain text. This module moves settings into the **Admin and the database**: a store admin fills in a form, secrets are encrypted, and the consuming plugin reads the ready config at runtime. Plugin authors only **describe** the settings form — the module handles the UI, storage, encryption, and validation.
|
|
51
|
+
|
|
52
|
+
## Integrated plugins & providers
|
|
53
|
+
|
|
54
|
+
| Provider | Category | `resolve` |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| [T-Kassa](https://docs.gorgojs.com/integrations/t-kassa) | `payment` | `@gorgo/medusa-payment-tkassa-v2/providers/integration-tkassa` |
|
|
57
|
+
|
|
58
|
+
Any plugin can ship an integration provider — see the [documentation](https://docs.gorgojs.com/integrations/integration).
|
|
59
|
+
|
|
25
60
|
## 💬 Support & Community
|
|
26
61
|
|
|
27
|
-
Got questions or ideas about the
|
|
62
|
+
Got questions or ideas about the module? Join the Telegram support chat — [@gorgojs_chat](https://t.me/gorgojs_chat)
|
|
28
63
|
|
|
29
64
|
Connect with other Medusa developers on Telegram — [@medusajs_chat](https://t.me/medusajs_chat)
|
|
30
65
|
|
|
@@ -41,6 +76,10 @@ yarn add @gorgo/medusa-integration
|
|
|
41
76
|
npm install @gorgo/medusa-integration
|
|
42
77
|
```
|
|
43
78
|
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
The complete installation, configuration, and usage guide is available on the [Gorgo documentation website](https://docs.gorgojs.com/integrations/integration).
|
|
82
|
+
|
|
44
83
|
## License
|
|
45
84
|
|
|
46
85
|
Licensed under the [MIT License](LICENSE).
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
Модуль интеграций для Medusa
|
|
3
|
+
</h1>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://docs.gorgojs.ru/integrations/integration">Документация</a>
|
|
7
|
+
<br/>
|
|
8
|
+
Модуль Medusa, который позволяет плагинам описывать свои настройки, а администраторам магазина — конфигурировать их прямо в админке: без правок <code>medusa-config</code> и передеплоя, с шифрованием секретов.
|
|
9
|
+
<br/>
|
|
10
|
+
<a href="https://github.com/gorgojs/medusa-integrations/blob/HEAD/packages/modules/integration/README.md">Read README in English ↗</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<br>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://medusajs.com">
|
|
17
|
+
<img src="https://img.shields.io/badge/Medusa-^2.17.2-blue?logo=medusa" alt="Medusa" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://medusajs.com">
|
|
20
|
+
<img src="https://img.shields.io/badge/Протестировано_с_Medusa-v2.17.2-green?logo=checkmarx" alt="Medusa" />
|
|
21
|
+
</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<a href="https://t.me/gorgojs_chat">
|
|
26
|
+
<img src="https://img.shields.io/badge/Telegram-Чат_поддержки-0088cc?logo=telegram&style=social" alt="Чат поддержки в Telegram" />
|
|
27
|
+
</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://t.me/medusajs_chat">
|
|
32
|
+
<img src="https://img.shields.io/badge/Telegram-Чат_dev--сообщества_Medusa.js-0088cc?logo=telegram&style=social" alt="Чат сообщества разработчиков Medusa.js в Telegram" />
|
|
33
|
+
</a>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
## Возможности
|
|
37
|
+
|
|
38
|
+
- **No-code конфигурация в админке.** Учётные данные и параметры плагинов задаются в разделе Настройки → Интеграции — без правок `medusa-config`/env и передеплоя.
|
|
39
|
+
- **Шифрование секретов на месте (at-rest).** Поля с пометкой `secret` шифруются (AES-256-GCM) и никогда не уходят в браузер.
|
|
40
|
+
- **Декларативный дескриптор** (`defineIntegration`) для авторов плагинов: опции, секции, валидация и проверка соединения — в одном месте.
|
|
41
|
+
- **Богатые типы опций и валидация:** `string` / `url` / `email` / `uuid` / `number` / `boolean` / `enum` / `json`, правила на уровне опции и меж-секционные, условная видимость, read-only-поля, i18n-подписи и иконка.
|
|
42
|
+
- **Несколько экземпляров** одного провайдера (например, несколько аккаунтов).
|
|
43
|
+
- **Проверка соединения** прямо из админки.
|
|
44
|
+
- **Типизированный резолв в рантайме:** потребитель получает провалидированный расшифрованный конфиг; неполные или выключенные конфигурации не резолвятся — черновик не «протекает» в рантайм.
|
|
45
|
+
- **Кастомные виджеты** провайдера в админке.
|
|
46
|
+
- **Анонимная телеметрия.**
|
|
47
|
+
|
|
48
|
+
## Что такое модуль интеграций?
|
|
49
|
+
|
|
50
|
+
Плагинам нужны настройки — ключи API, режимы, вебхуки. Обычно их держат в `medusa-config`/env: это требует доступа к коду и передеплоя при каждом изменении, а секреты лежат в открытом виде. Модуль переносит настройки в **админку и БД**: администратор магазина заполняет форму, секреты шифруются, а плагин-потребитель читает готовый конфиг в рантайме. Автор плагина при этом лишь **описывает** форму настроек — UI, хранение, шифрование и валидацию берёт на себя модуль.
|
|
51
|
+
|
|
52
|
+
## Подключённые плагины и провайдеры
|
|
53
|
+
|
|
54
|
+
| Провайдер | Категория | `resolve` |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| [T-Kassa](https://docs.gorgojs.ru/integrations/t-kassa) | `payment` | `@gorgo/medusa-payment-tkassa-v2/providers/integration-tkassa` |
|
|
57
|
+
|
|
58
|
+
Любой плагин может поставлять integration-провайдер — см. [документацию](https://docs.gorgojs.ru/integrations/integration).
|
|
59
|
+
|
|
60
|
+
## 💬 Поддержка и сообщество
|
|
61
|
+
|
|
62
|
+
Есть вопросы по модулю или идеи? Пишите в чат поддержки в Telegram — [@gorgojs_chat](https://t.me/gorgojs_chat)
|
|
63
|
+
|
|
64
|
+
Общайтесь с другими разработчиками Medusa в Telegram — [@medusajs_chat](https://t.me/medusajs_chat)
|
|
65
|
+
|
|
66
|
+
## Требования
|
|
67
|
+
|
|
68
|
+
- Medusa v2.17.2 или выше
|
|
69
|
+
- Node.js v20 или выше
|
|
70
|
+
|
|
71
|
+
## Установка
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
yarn add @gorgo/medusa-integration
|
|
75
|
+
# или
|
|
76
|
+
npm install @gorgo/medusa-integration
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Документация
|
|
80
|
+
|
|
81
|
+
Полное руководство по установке, настройке и использованию доступно на [сайте документации Gorgo](https://docs.gorgojs.ru/integrations/integration).
|
|
82
|
+
|
|
83
|
+
## Лицензия
|
|
84
|
+
|
|
85
|
+
Распространяется на условиях [лицензии MIT](LICENSE).
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gorgo/medusa-integration",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Integration module for Medusa",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Gorgo",
|
|
7
|
+
"url": "https://gorgojs.com"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"files": [
|
|
7
11
|
".medusa/server"
|
|
8
12
|
],
|
|
9
13
|
"repository": {
|
|
10
14
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/gorgojs/medusa-
|
|
12
|
-
"directory": "packages/
|
|
15
|
+
"url": "https://github.com/gorgojs/medusa-integrations",
|
|
16
|
+
"directory": "packages/modules/integration"
|
|
13
17
|
},
|
|
14
18
|
"exports": {
|
|
15
19
|
".": {
|