@gorgo/medusa-integration 0.3.0-beta.1 → 0.3.0-beta.3
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 +73 -37
- package/.medusa/server/src/admin/index.mjs +74 -38
- package/.medusa/server/src/api/admin/integrations/license-status/route.d.ts +8 -0
- package/.medusa/server/src/api/admin/integrations/license-status/route.js +14 -0
- package/.medusa/server/src/modules/integration/descriptor/define.d.ts +0 -2
- package/.medusa/server/src/modules/integration/descriptor/define.js +1 -1
- package/.medusa/server/src/modules/integration/loaders/__tests__/check-licenses.unit.spec.js +70 -18
- package/.medusa/server/src/modules/integration/loaders/__tests__/package-meta.unit.spec.js +13 -1
- package/.medusa/server/src/modules/integration/loaders/check-licenses.d.ts +5 -0
- package/.medusa/server/src/modules/integration/loaders/check-licenses.js +51 -12
- package/.medusa/server/src/modules/integration/loaders/license-state.d.ts +9 -0
- package/.medusa/server/src/modules/integration/loaders/license-state.js +22 -0
- package/.medusa/server/src/modules/integration/loaders/package-meta.d.ts +9 -1
- package/.medusa/server/src/modules/integration/loaders/package-meta.js +16 -2
- package/.medusa/server/src/modules/integration/services/integration-module.d.ts +3 -1
- package/.medusa/server/src/modules/integration/services/integration-module.js +6 -1
- package/.medusa/server/src/modules/integration/types/index.d.ts +19 -2
- package/.medusa/server/src/modules/integration/types/index.js +4 -2
- package/.medusa/server/src/types/http/integration/admin/responses.d.ts +4 -0
- package/package.json +1 -1
|
@@ -7,13 +7,30 @@ export declare const IntegrationProviderRegistrationPrefix = "int_";
|
|
|
7
7
|
export declare const INTEGRATION_OPTIONS_KEY = "integrationModuleOptions";
|
|
8
8
|
/** Container key under which the resolved per-identifier package metadata map is registered. */
|
|
9
9
|
export declare const INTEGRATION_PACKAGE_META_KEY = "integrationPackageMeta";
|
|
10
|
+
/** Container key under which the per-package license verdicts are registered. */
|
|
11
|
+
export declare const INTEGRATION_LICENSE_STATE_KEY = "integrationLicenseState";
|
|
10
12
|
/** Resolved npm-package facts for one provider identifier (from its package.json). */
|
|
11
13
|
export type PackageMeta = {
|
|
12
14
|
name: string | null;
|
|
13
15
|
version: string | null;
|
|
14
16
|
author: string | null;
|
|
15
17
|
authorUrl: string | null;
|
|
18
|
+
/** `gorgo.license` from the package.json: whether the package is licensed at all. */
|
|
19
|
+
license: PackageLicenseRequirement;
|
|
16
20
|
};
|
|
21
|
+
/** How a package declares itself licensed. `null` = not a licensed package. */
|
|
22
|
+
export type PackageLicenseRequirement = "required" | "optional" | null;
|
|
23
|
+
/** Verdict of the license check for one npm package. */
|
|
24
|
+
export type LicenseState = "ok" | "grace" | "stale" | "failed" | "undetermined";
|
|
25
|
+
export type LicenseStateEntry = {
|
|
26
|
+
package: string;
|
|
27
|
+
state: LicenseState;
|
|
28
|
+
reason?: string;
|
|
29
|
+
/** Provider identifiers this package ships — lets the list map a row to its verdict. */
|
|
30
|
+
identifiers: string[];
|
|
31
|
+
};
|
|
32
|
+
/** npm package name → verdict. Empty when the verifier is not installed. */
|
|
33
|
+
export type LicenseStateMap = Record<string, LicenseStateEntry>;
|
|
17
34
|
/** identifier → PackageMeta. Empty when resolution is unavailable. */
|
|
18
35
|
export type PackageMetaMap = Record<string, PackageMeta>;
|
|
19
36
|
export type IntegrationModuleOptions = {
|
|
@@ -21,6 +38,6 @@ export type IntegrationModuleOptions = {
|
|
|
21
38
|
encryptionKey?: string;
|
|
22
39
|
/** Integration-providers, each `{ resolve, id?, options? }` — like payment/fulfillment. */
|
|
23
40
|
providers?: ModuleProvider[];
|
|
24
|
-
/**
|
|
25
|
-
|
|
41
|
+
/** Project license key. Defaults to `GORGO_LICENSE`. */
|
|
42
|
+
license?: string;
|
|
26
43
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTEGRATION_PACKAGE_META_KEY = exports.INTEGRATION_OPTIONS_KEY = exports.IntegrationProviderRegistrationPrefix = exports.IntegrationProviderRegistrationKey = void 0;
|
|
3
|
+
exports.INTEGRATION_LICENSE_STATE_KEY = exports.INTEGRATION_PACKAGE_META_KEY = exports.INTEGRATION_OPTIONS_KEY = exports.IntegrationProviderRegistrationPrefix = exports.IntegrationProviderRegistrationKey = void 0;
|
|
4
4
|
/** Awilix list-key under which every registered integration-provider key is collected. */
|
|
5
5
|
exports.IntegrationProviderRegistrationKey = "integration_providers";
|
|
6
6
|
/** Prefix for each provider's container registration key: `int_<identifier>[_<id>]`. */
|
|
@@ -9,4 +9,6 @@ exports.IntegrationProviderRegistrationPrefix = "int_";
|
|
|
9
9
|
exports.INTEGRATION_OPTIONS_KEY = "integrationModuleOptions";
|
|
10
10
|
/** Container key under which the resolved per-identifier package metadata map is registered. */
|
|
11
11
|
exports.INTEGRATION_PACKAGE_META_KEY = "integrationPackageMeta";
|
|
12
|
-
|
|
12
|
+
/** Container key under which the per-package license verdicts are registered. */
|
|
13
|
+
exports.INTEGRATION_LICENSE_STATE_KEY = "integrationLicenseState";
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9pbnRlZ3JhdGlvbi90eXBlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSwwRkFBMEY7QUFDN0UsUUFBQSxrQ0FBa0MsR0FBRyx1QkFBdUIsQ0FBQTtBQUV6RSx3RkFBd0Y7QUFDM0UsUUFBQSxxQ0FBcUMsR0FBRyxNQUFNLENBQUE7QUFFM0QsNEVBQTRFO0FBQy9ELFFBQUEsdUJBQXVCLEdBQUcsMEJBQTBCLENBQUE7QUFFakUsZ0dBQWdHO0FBQ25GLFFBQUEsNEJBQTRCLEdBQUcsd0JBQXdCLENBQUE7QUFFcEUsaUZBQWlGO0FBQ3BFLFFBQUEsNkJBQTZCLEdBQUcseUJBQXlCLENBQUEifQ==
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DeleteResponse } from "@medusajs/framework/types";
|
|
2
2
|
import type { CatalogItem, IntegrationOverviewItem, MaskedIntegration } from "./entities";
|
|
3
3
|
import type { CategoryKind, TestConnectionResult, UiDescriptor } from "../../../integration";
|
|
4
|
+
import type { LicenseStateEntry } from "../../../../modules/integration/types";
|
|
4
5
|
export interface AdminIntegrationListResponse {
|
|
5
6
|
integrations: IntegrationOverviewItem[];
|
|
6
7
|
/** Total items after filtering (pagination total). */
|
|
@@ -32,3 +33,6 @@ export interface AdminIntegrationTestResponse extends TestConnectionResult {
|
|
|
32
33
|
export interface AdminIntegrationCatalogResponse {
|
|
33
34
|
integrations: CatalogItem[];
|
|
34
35
|
}
|
|
36
|
+
export interface AdminIntegrationLicenseStatusResponse {
|
|
37
|
+
packages: LicenseStateEntry[];
|
|
38
|
+
}
|