@gravitee/gamma-modules-sdk 1.0.0 → 1.2.0-gma-901.02c1fc7

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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './permissions';
2
2
  export * from './environment';
3
+ export * from './license';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -35,6 +35,26 @@ var e = class {
35
35
  getSnapshot() {
36
36
  return null;
37
37
  }
38
- }, s = new o(), c = () => null;
38
+ }, s = new o(), c = () => null, l = class {
39
+ setLicense(e) {}
40
+ getLicense() {
41
+ return null;
42
+ }
43
+ hasFeature(e) {
44
+ return !1;
45
+ }
46
+ hasPack(e) {
47
+ return !1;
48
+ }
49
+ isExpired() {
50
+ return !1;
51
+ }
52
+ subscribe(e) {
53
+ return () => {};
54
+ }
55
+ getSnapshot() {
56
+ return null;
57
+ }
58
+ }, u = new l(), d = (e) => !1, f = (e) => !1;
39
59
  //#endregion
40
- export { o as EnvironmentService, r as PermissionGate, e as PermissionService, s as environmentService, i as normalizeCrudMapRecord, a as normalizeOrganizationPermissionsFromRoles, t as permissionService, c as useEnvironment, n as useHasPermission };
60
+ export { o as EnvironmentService, l as LicenseService, r as PermissionGate, e as PermissionService, s as environmentService, u as licenseService, i as normalizeCrudMapRecord, a as normalizeOrganizationPermissionsFromRoles, t as permissionService, c as useEnvironment, d as useHasFeature, f as useHasPack, n as useHasPermission };
@@ -0,0 +1,4 @@
1
+ export type { License } from './types';
2
+ export type { ILicenseService, UseHasFeatureFn, UseHasPackFn } from './interfaces';
3
+ export { LicenseService, licenseService, useHasFeature, useHasPack } from './stubs';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/license/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { License } from './types';
2
+ export interface ILicenseService {
3
+ setLicense(license: License | null): void;
4
+ getLicense(): License | null;
5
+ /** Pure membership check: the feature key is present in `license.features`. Does not account for expiry. */
6
+ hasFeature(feature: string): boolean;
7
+ /** Pure membership check: the pack key is present in `license.packs`. Does not account for expiry. */
8
+ hasPack(pack: string): boolean;
9
+ /** Whether the current license is expired (server-computed `license.isExpired`). */
10
+ isExpired(): boolean;
11
+ subscribe(listener: () => void): () => void;
12
+ getSnapshot(): License | null;
13
+ }
14
+ export type UseHasFeatureFn = (feature: string) => boolean;
15
+ export type UseHasPackFn = (pack: string) => boolean;
16
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/license/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1C,UAAU,IAAI,OAAO,GAAG,IAAI,CAAC;IAC7B,4GAA4G;IAC5G,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,sGAAsG;IACtG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,oFAAoF;IACpF,SAAS,IAAI,OAAO,CAAC;IACrB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,WAAW,IAAI,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { ILicenseService, UseHasFeatureFn, UseHasPackFn } from './interfaces';
2
+ import { License } from './types';
3
+ /**
4
+ * Stub implementations replaced at runtime by the host via Module Federation
5
+ * (`additionalShared`, singleton). Remotes bundle these for typing and a
6
+ * minimal runtime shape only.
7
+ */
8
+ export declare class LicenseService implements ILicenseService {
9
+ setLicense(_license: License | null): void;
10
+ getLicense(): License | null;
11
+ hasFeature(_feature: string): boolean;
12
+ hasPack(_pack: string): boolean;
13
+ isExpired(): boolean;
14
+ subscribe(_listener: () => void): () => void;
15
+ getSnapshot(): License | null;
16
+ }
17
+ export declare const licenseService: ILicenseService;
18
+ export declare const useHasFeature: UseHasFeatureFn;
19
+ export declare const useHasPack: UseHasPackFn;
20
+ //# sourceMappingURL=stubs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/license/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;GAIG;AAEH,qBAAa,cAAe,YAAW,eAAe;IACpD,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI;IAC1C,UAAU,IAAI,OAAO,GAAG,IAAI;IAG5B,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAGrC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAG/B,SAAS,IAAI,OAAO;IAGpB,SAAS,CAAC,SAAS,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAG5C,WAAW,IAAI,OAAO,GAAG,IAAI;CAG9B;AAED,eAAO,MAAM,cAAc,EAAE,eAAsC,CAAC;AAEpE,eAAO,MAAM,aAAa,EAAE,eAA6C,CAAC;AAE1E,eAAO,MAAM,UAAU,EAAE,YAAuC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface License {
2
+ readonly tier: string;
3
+ readonly packs: string[];
4
+ readonly features: string[];
5
+ readonly scope?: string;
6
+ readonly expiresAt?: string;
7
+ readonly isExpired?: boolean;
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/license/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Technical catalog shared by the Gamma host and every federated module.
3
+ *
4
+ * Pure data — no React, no host dependency. The host enriches this with presentation
5
+ * (titles, icons, upsell copy); modules consume the pack ids to gate enterprise features.
6
+ * This is the single source of truth for the module → required-packs mapping.
7
+ */
8
+ /** Gamma module plugin ids. Must match `plugin.properties#id` of `gravitee-gamma-module-<id>`. */
9
+ export type ModuleId = 'aim' | 'apim' | 'platform' | 'authz' | 'esm' | 'edge';
10
+ /** Enterprise license pack ids, exactly as they appear in `license.packs`. */
11
+ export type Pack = 'agent-management' | 'agent-mesh' | 'event-streaming-management' | 'event-native-management' | 'native-kafka' | 'edge-management' | 'authorization-management' | 'identity-and-access-management';
12
+ /** Named constants for pack ids so host and modules share one vocabulary instead of raw strings. */
13
+ export declare const PACKS: {
14
+ readonly AGENT_MANAGEMENT: "agent-management";
15
+ readonly AGENT_MESH: "agent-mesh";
16
+ readonly EVENT_STREAMING_MANAGEMENT: "event-streaming-management";
17
+ readonly EVENT_NATIVE_MANAGEMENT: "event-native-management";
18
+ readonly NATIVE_KAFKA: "native-kafka";
19
+ readonly EDGE_MANAGEMENT: "edge-management";
20
+ readonly AUTHORIZATION_MANAGEMENT: "authorization-management";
21
+ readonly IDENTITY_AND_ACCESS_MANAGEMENT: "identity-and-access-management";
22
+ };
23
+ export interface ModulePacks {
24
+ readonly moduleId: ModuleId;
25
+ /** Packs that unlock this module. Empty ⇒ core module: ships with every installation, no license gate. */
26
+ readonly packs: readonly Pack[];
27
+ }
28
+ /**
29
+ * Canonical module → required-packs mapping.
30
+ *
31
+ * A module is licensed when the org holds *all* of its packs. Core modules (`apim`, `platform`)
32
+ * have no requirement and are always accessible.
33
+ *
34
+ * and whether `aim` additionally requires `agent-mesh`.
35
+ */
36
+ export declare const MODULE_PACKS: readonly ModulePacks[];
37
+ /** Packs required to unlock `moduleId`. Empty for core modules and unknown ids. */
38
+ export declare function packsForModule(moduleId: ModuleId): readonly Pack[];
39
+ //# sourceMappingURL=modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,kGAAkG;AAClG,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9E,8EAA8E;AAC9E,MAAM,MAAM,IAAI,GACZ,kBAAkB,GAClB,YAAY,GACZ,4BAA4B,GAC5B,yBAAyB,GACzB,cAAc,GACd,iBAAiB,GACjB,0BAA0B,GAC1B,gCAAgC,CAAC;AAErC,oGAAoG;AACpG,eAAO,MAAM,KAAK;;;;;;;;;CASuB,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,WAAW,EAO9C,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,IAAI,EAAE,CAElE"}
@@ -0,0 +1,41 @@
1
+ //#region src/modules.ts
2
+ var e = {
3
+ AGENT_MANAGEMENT: "agent-management",
4
+ AGENT_MESH: "agent-mesh",
5
+ EVENT_STREAMING_MANAGEMENT: "event-streaming-management",
6
+ EVENT_NATIVE_MANAGEMENT: "event-native-management",
7
+ NATIVE_KAFKA: "native-kafka",
8
+ EDGE_MANAGEMENT: "edge-management",
9
+ AUTHORIZATION_MANAGEMENT: "authorization-management",
10
+ IDENTITY_AND_ACCESS_MANAGEMENT: "identity-and-access-management"
11
+ }, t = [
12
+ {
13
+ moduleId: "aim",
14
+ packs: [e.AGENT_MANAGEMENT]
15
+ },
16
+ {
17
+ moduleId: "apim",
18
+ packs: []
19
+ },
20
+ {
21
+ moduleId: "platform",
22
+ packs: []
23
+ },
24
+ {
25
+ moduleId: "authz",
26
+ packs: [e.AUTHORIZATION_MANAGEMENT]
27
+ },
28
+ {
29
+ moduleId: "esm",
30
+ packs: [e.EVENT_STREAMING_MANAGEMENT, e.EVENT_NATIVE_MANAGEMENT]
31
+ },
32
+ {
33
+ moduleId: "edge",
34
+ packs: [e.EDGE_MANAGEMENT]
35
+ }
36
+ ];
37
+ function n(e) {
38
+ return t.find((t) => t.moduleId === e)?.packs ?? [];
39
+ }
40
+ //#endregion
41
+ export { t as MODULE_PACKS, e as PACKS, n as packsForModule };
package/dist/types.d.ts CHANGED
@@ -2,4 +2,7 @@ export type { IPermissionService, NormalizeCrudMapRecordFn, NormalizeOrgPermissi
2
2
  export type { PermissionCheck, PermissionScope, UserRole } from './permissions/types';
3
3
  export type { Environment } from './environment/types';
4
4
  export type { IEnvironmentService, UseEnvironmentFn } from './environment/interfaces';
5
+ export type { License } from './license/types';
6
+ export type { ILicenseService, UseHasFeatureFn, UseHasPackFn } from './license/interfaces';
7
+ export type { ModuleId, Pack, ModulePacks } from './modules';
5
8
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3F,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/gamma-modules-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.2.0-gma-901.02c1fc7",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "packageManager": "yarn@4.13.0",
@@ -24,6 +24,10 @@
24
24
  "types": "./dist/routing.d.ts",
25
25
  "import": "./dist/routing.js"
26
26
  },
27
+ "./modules": {
28
+ "types": "./dist/modules.d.ts",
29
+ "import": "./dist/modules.js"
30
+ },
27
31
  "./mock": {
28
32
  "types": "./dist/mock.d.ts",
29
33
  "import": "./dist/mock.js"