serverless-plugin-module-registry 1.0.9 → 1.0.10
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/service.js +1178 -0
- package/package.json +3 -1
- package/src/service.d.ts +168 -0
- package/src/service.js +1178 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverless-plugin-module-registry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "A Serverless Framework plugin that scans module registry files and stores feature mappings in DynamoDB for cross-module discovery",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist/**/*",
|
|
51
|
+
"src/service.js",
|
|
52
|
+
"src/service.d.ts",
|
|
51
53
|
"README.md",
|
|
52
54
|
"LICENSE"
|
|
53
55
|
],
|
package/src/service.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Module Registry Service Functions - Type Definitions
|
|
3
|
+
* -------------------------------------------
|
|
4
|
+
* TypeScript definitions for the service layer functions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Types for better developer experience
|
|
8
|
+
export interface ModuleInfo {
|
|
9
|
+
moduleName: string
|
|
10
|
+
description: string
|
|
11
|
+
version: string
|
|
12
|
+
maintainer?: string
|
|
13
|
+
tags: string[]
|
|
14
|
+
apiGatewayId?: string
|
|
15
|
+
lastUpdated: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface FeatureInfo {
|
|
19
|
+
featureName: string
|
|
20
|
+
description: string
|
|
21
|
+
version: string
|
|
22
|
+
endpoints: string[]
|
|
23
|
+
customPolicies: any[]
|
|
24
|
+
customFeature?: boolean
|
|
25
|
+
endpointCount: number
|
|
26
|
+
lastUpdated: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface FeatureDetails extends FeatureInfo {
|
|
30
|
+
moduleName: string
|
|
31
|
+
policyCount: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface EndpointInfo {
|
|
35
|
+
endpoint: string
|
|
36
|
+
moduleName: string
|
|
37
|
+
featureName: string
|
|
38
|
+
featureDescription: string
|
|
39
|
+
version: string
|
|
40
|
+
customFeature?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// New interface for custom feature creation
|
|
44
|
+
export interface CreateCustomFeatureData {
|
|
45
|
+
moduleName: string
|
|
46
|
+
featureName: string
|
|
47
|
+
description: string
|
|
48
|
+
version: string
|
|
49
|
+
endpoints?: string[]
|
|
50
|
+
customPolicies?: any[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Lists all deployed modules with basic metadata
|
|
55
|
+
*/
|
|
56
|
+
export declare function listAllModules(): Promise<ModuleInfo[]>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets all features for a specific module
|
|
60
|
+
*/
|
|
61
|
+
export declare function getModuleFeatures(moduleName: string): Promise<FeatureInfo[]>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Gets detailed information about a specific feature
|
|
65
|
+
*/
|
|
66
|
+
export declare function getFeatureDetails(moduleName: string, featureId: string): Promise<FeatureDetails | null>
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets feature details by featureId only (without knowing module name)
|
|
70
|
+
* Uses GSI2 to lookup feature directly by featureId
|
|
71
|
+
*/
|
|
72
|
+
export declare function getFeatureById(featureId: string): Promise<FeatureDetails | null>
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Gets module metadata (basic info without features)
|
|
76
|
+
*/
|
|
77
|
+
export declare function getModuleMetadata(moduleName: string): Promise<ModuleInfo | null>
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Gets endpoint summary across all modules for discovery
|
|
81
|
+
*/
|
|
82
|
+
export declare function getAllEndpoints(): Promise<EndpointInfo[]>
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Gets endpoint summary from non-custom features only
|
|
86
|
+
*/
|
|
87
|
+
export declare function getNonCustomEndpoints(): Promise<EndpointInfo[]>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new custom feature in the module registry
|
|
91
|
+
*/
|
|
92
|
+
export declare function createCustomFeature(featureData: CreateCustomFeatureData): Promise<FeatureInfo>
|
|
93
|
+
|
|
94
|
+
// =============================================================================
|
|
95
|
+
// ABAC (Attribute-Based Access Control) Functions
|
|
96
|
+
// =============================================================================
|
|
97
|
+
|
|
98
|
+
export interface AbacGenerationOptions {
|
|
99
|
+
region?: string
|
|
100
|
+
accountId?: string
|
|
101
|
+
apiId?: string
|
|
102
|
+
selectedFeatures?: SelectedFeature[]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface AbacPolicyDocument {
|
|
106
|
+
Version: string
|
|
107
|
+
Statement: Array<{
|
|
108
|
+
Sid: string
|
|
109
|
+
Effect: 'Allow' | 'Deny'
|
|
110
|
+
Action: string | string[]
|
|
111
|
+
Resource: string | string[]
|
|
112
|
+
Condition: {
|
|
113
|
+
StringLike: {
|
|
114
|
+
[key: string]: string
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}>
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface AbacTag {
|
|
121
|
+
Key: string
|
|
122
|
+
Value: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface SelectedFeature {
|
|
126
|
+
moduleName: string
|
|
127
|
+
featureName: string
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Generates a single module-level managed policy with ABAC conditions
|
|
132
|
+
*/
|
|
133
|
+
export declare function generateModuleAbacPolicy(
|
|
134
|
+
moduleName: string,
|
|
135
|
+
options?: AbacGenerationOptions
|
|
136
|
+
): Promise<AbacPolicyDocument>
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Generates ABAC policy documents for all modules
|
|
140
|
+
*/
|
|
141
|
+
export declare function generateAllModuleAbacPolicies(
|
|
142
|
+
options?: AbacGenerationOptions
|
|
143
|
+
): Promise<Record<string, AbacPolicyDocument>>
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Creates resource tags for a role based on selected features
|
|
147
|
+
*/
|
|
148
|
+
export declare function generateAbacTags(
|
|
149
|
+
selectedFeatures: SelectedFeature[]
|
|
150
|
+
): Promise<AbacTag[]>
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Gets required managed policy ARNs for a set of selected features
|
|
154
|
+
*/
|
|
155
|
+
export declare function getRequiredModulePolicyArns(
|
|
156
|
+
selectedFeatures: SelectedFeature[],
|
|
157
|
+
accountId: string,
|
|
158
|
+
policyPrefix: string
|
|
159
|
+
): Promise<string[]>
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Creates a structured logger for module registry operations
|
|
163
|
+
*/
|
|
164
|
+
export declare function createModuleRegistryLogger(context: string): {
|
|
165
|
+
info: (message: string, data?: any) => void
|
|
166
|
+
warn: (message: string, data?: any) => void
|
|
167
|
+
error: (message: string, error?: any) => void
|
|
168
|
+
}
|