@friggframework/schemas 2.0.0-next.30

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.
@@ -0,0 +1,358 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.friggframework.org/api-module-definition.schema.json",
4
+ "title": "Frigg API Module Definition",
5
+ "description": "Schema for defining a Frigg API module including authentication, API configuration, and required methods.",
6
+ "type": "object",
7
+ "required": ["moduleName", "getName", "requiredAuthMethods"],
8
+ "properties": {
9
+ "API": {
10
+ "type": "object",
11
+ "description": "API class or configuration object for the module"
12
+ },
13
+ "getName": {
14
+ "type": "object",
15
+ "description": "Function that returns the module name",
16
+ "properties": {
17
+ "type": {
18
+ "type": "string",
19
+ "enum": ["function"]
20
+ }
21
+ }
22
+ },
23
+ "moduleName": {
24
+ "type": "string",
25
+ "description": "Module name identifier",
26
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
27
+ "minLength": 1,
28
+ "maxLength": 100
29
+ },
30
+ "requiredAuthMethods": {
31
+ "type": "object",
32
+ "description": "Required authentication methods and configuration",
33
+ "properties": {
34
+ "getToken": {
35
+ "type": "object",
36
+ "description": "OAuth token retrieval method",
37
+ "properties": {
38
+ "type": {"type": "string", "enum": ["function"]},
39
+ "async": {"type": "boolean", "default": true}
40
+ }
41
+ },
42
+ "apiPropertiesToPersist": {
43
+ "type": "object",
44
+ "description": "Properties to persist for credentials and entities",
45
+ "required": ["credential", "entity"],
46
+ "properties": {
47
+ "credential": {
48
+ "type": "array",
49
+ "description": "Credential properties to persist",
50
+ "items": {
51
+ "type": "string",
52
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
53
+ },
54
+ "uniqueItems": true,
55
+ "examples": [["access_token", "refresh_token", "expires_at"]]
56
+ },
57
+ "entity": {
58
+ "type": "array",
59
+ "description": "Entity properties to persist",
60
+ "items": {
61
+ "type": "string",
62
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
63
+ },
64
+ "uniqueItems": true,
65
+ "examples": [["external_id", "name", "type"]]
66
+ }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "getCredentialDetails": {
71
+ "type": "object",
72
+ "description": "Method to retrieve credential details",
73
+ "properties": {
74
+ "type": {"type": "string", "enum": ["function"]},
75
+ "async": {"type": "boolean", "default": true}
76
+ }
77
+ },
78
+ "getEntityDetails": {
79
+ "type": "object",
80
+ "description": "Method to retrieve entity details",
81
+ "properties": {
82
+ "type": {"type": "string", "enum": ["function"]},
83
+ "async": {"type": "boolean", "default": true}
84
+ }
85
+ },
86
+ "testAuthRequest": {
87
+ "type": "object",
88
+ "description": "Method to test authentication",
89
+ "properties": {
90
+ "type": {"type": "string", "enum": ["function"]},
91
+ "async": {"type": "boolean", "default": true}
92
+ }
93
+ }
94
+ },
95
+ "additionalProperties": false
96
+ },
97
+ "env": {
98
+ "type": "object",
99
+ "description": "Environment variable configuration",
100
+ "properties": {
101
+ "client_id": {
102
+ "type": "string",
103
+ "description": "OAuth client ID from environment variable"
104
+ },
105
+ "client_secret": {
106
+ "type": "string",
107
+ "description": "OAuth client secret from environment variable"
108
+ },
109
+ "scope": {
110
+ "type": "string",
111
+ "description": "OAuth scope from environment variable"
112
+ },
113
+ "redirect_uri": {
114
+ "type": "string",
115
+ "description": "OAuth redirect URI from environment variable",
116
+ "format": "uri"
117
+ },
118
+ "api_key": {
119
+ "type": "string",
120
+ "description": "API key from environment variable"
121
+ },
122
+ "base_url": {
123
+ "type": "string",
124
+ "description": "Base API URL from environment variable",
125
+ "format": "uri"
126
+ }
127
+ },
128
+ "patternProperties": {
129
+ "^[A-Z][A-Z0-9_]*$": {
130
+ "type": "string",
131
+ "description": "Custom environment variable"
132
+ }
133
+ },
134
+ "additionalProperties": false
135
+ },
136
+ "config": {
137
+ "type": "object",
138
+ "description": "Module configuration",
139
+ "properties": {
140
+ "name": {
141
+ "type": "string",
142
+ "description": "Configuration name"
143
+ },
144
+ "version": {
145
+ "type": "string",
146
+ "description": "Module version",
147
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?$"
148
+ },
149
+ "authType": {
150
+ "type": "string",
151
+ "description": "Authentication type",
152
+ "enum": ["oauth2", "api-key", "basic", "bearer", "custom"]
153
+ },
154
+ "baseURL": {
155
+ "type": "string",
156
+ "description": "Base API URL",
157
+ "format": "uri"
158
+ },
159
+ "rateLimit": {
160
+ "type": "object",
161
+ "description": "Rate limiting configuration",
162
+ "properties": {
163
+ "requests": {
164
+ "type": "integer",
165
+ "description": "Maximum requests",
166
+ "minimum": 1
167
+ },
168
+ "period": {
169
+ "type": "string",
170
+ "description": "Time period for rate limit",
171
+ "enum": ["second", "minute", "hour", "day"]
172
+ }
173
+ },
174
+ "additionalProperties": false
175
+ },
176
+ "timeout": {
177
+ "type": "integer",
178
+ "description": "Request timeout in milliseconds",
179
+ "minimum": 1000,
180
+ "maximum": 300000,
181
+ "default": 30000
182
+ },
183
+ "retries": {
184
+ "type": "integer",
185
+ "description": "Number of retries for failed requests",
186
+ "minimum": 0,
187
+ "maximum": 10,
188
+ "default": 3
189
+ }
190
+ },
191
+ "additionalProperties": true
192
+ },
193
+ "manager": {
194
+ "type": "object",
195
+ "description": "Module manager configuration",
196
+ "properties": {
197
+ "Entity": {
198
+ "type": "object",
199
+ "description": "Entity model class"
200
+ },
201
+ "Credential": {
202
+ "type": "object",
203
+ "description": "Credential model class"
204
+ },
205
+ "methods": {
206
+ "type": "object",
207
+ "description": "Available manager methods",
208
+ "properties": {
209
+ "getInstance": {
210
+ "type": "object",
211
+ "description": "Get module instance method"
212
+ },
213
+ "getEntitiesForUserId": {
214
+ "type": "object",
215
+ "description": "Get entities for user method"
216
+ },
217
+ "validateAuthorizationRequirements": {
218
+ "type": "object",
219
+ "description": "Validate auth requirements method"
220
+ },
221
+ "getAuthorizationRequirements": {
222
+ "type": "object",
223
+ "description": "Get auth requirements method"
224
+ },
225
+ "testAuth": {
226
+ "type": "object",
227
+ "description": "Test authentication method"
228
+ },
229
+ "processAuthorizationCallback": {
230
+ "type": "object",
231
+ "description": "Process auth callback method"
232
+ }
233
+ },
234
+ "additionalProperties": true
235
+ }
236
+ },
237
+ "additionalProperties": true
238
+ },
239
+ "webhooks": {
240
+ "type": "object",
241
+ "description": "Webhook configuration",
242
+ "properties": {
243
+ "enabled": {
244
+ "type": "boolean",
245
+ "description": "Whether webhooks are enabled",
246
+ "default": false
247
+ },
248
+ "endpoints": {
249
+ "type": "array",
250
+ "description": "Webhook endpoint configurations",
251
+ "items": {
252
+ "type": "object",
253
+ "required": ["path", "events"],
254
+ "properties": {
255
+ "path": {
256
+ "type": "string",
257
+ "description": "Webhook endpoint path",
258
+ "pattern": "^/[a-zA-Z0-9/_-]*$"
259
+ },
260
+ "events": {
261
+ "type": "array",
262
+ "description": "Events handled by this endpoint",
263
+ "items": {"type": "string"},
264
+ "uniqueItems": true
265
+ },
266
+ "method": {
267
+ "type": "string",
268
+ "description": "HTTP method",
269
+ "enum": ["POST", "PUT", "PATCH"],
270
+ "default": "POST"
271
+ },
272
+ "authentication": {
273
+ "type": "object",
274
+ "description": "Webhook authentication requirements",
275
+ "properties": {
276
+ "type": {
277
+ "type": "string",
278
+ "enum": ["signature", "token", "none"],
279
+ "default": "signature"
280
+ },
281
+ "secret": {
282
+ "type": "string",
283
+ "description": "Webhook secret for signature verification"
284
+ }
285
+ }
286
+ }
287
+ },
288
+ "additionalProperties": false
289
+ }
290
+ }
291
+ },
292
+ "additionalProperties": false
293
+ }
294
+ },
295
+ "additionalProperties": false,
296
+ "examples": [
297
+ {
298
+ "moduleName": "hubspot",
299
+ "getName": {
300
+ "type": "function"
301
+ },
302
+ "requiredAuthMethods": {
303
+ "getToken": {
304
+ "type": "function",
305
+ "async": true
306
+ },
307
+ "apiPropertiesToPersist": {
308
+ "credential": ["access_token", "refresh_token", "expires_at"],
309
+ "entity": ["external_id", "portal_id"]
310
+ },
311
+ "getCredentialDetails": {
312
+ "type": "function",
313
+ "async": true
314
+ },
315
+ "getEntityDetails": {
316
+ "type": "function",
317
+ "async": true
318
+ },
319
+ "testAuthRequest": {
320
+ "type": "function",
321
+ "async": true
322
+ }
323
+ },
324
+ "env": {
325
+ "client_id": "HUBSPOT_CLIENT_ID",
326
+ "client_secret": "HUBSPOT_CLIENT_SECRET",
327
+ "scope": "HUBSPOT_SCOPE",
328
+ "redirect_uri": "https://api.myapp.com/auth/hubspot/callback"
329
+ },
330
+ "config": {
331
+ "name": "HubSpot",
332
+ "version": "2.0.0",
333
+ "authType": "oauth2",
334
+ "baseURL": "https://api.hubapi.com",
335
+ "rateLimit": {
336
+ "requests": 100,
337
+ "period": "minute"
338
+ },
339
+ "timeout": 30000,
340
+ "retries": 3
341
+ },
342
+ "webhooks": {
343
+ "enabled": true,
344
+ "endpoints": [
345
+ {
346
+ "path": "/webhooks/hubspot",
347
+ "events": ["contact.creation", "deal.propertyChange"],
348
+ "method": "POST",
349
+ "authentication": {
350
+ "type": "signature",
351
+ "secret": "HUBSPOT_WEBHOOK_SECRET"
352
+ }
353
+ }
354
+ ]
355
+ }
356
+ }
357
+ ]
358
+ }
@@ -0,0 +1,276 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://schemas.friggframework.org/app-definition.schema.json",
4
+ "title": "Frigg Application Definition",
5
+ "description": "Schema for defining a Frigg application configuration including integrations, user management, security settings, and more.",
6
+ "type": "object",
7
+ "required": ["integrations"],
8
+ "properties": {
9
+ "integrations": {
10
+ "type": "array",
11
+ "description": "Array of integration classes to enable in the application",
12
+ "items": {
13
+ "type": "object",
14
+ "description": "Integration class or configuration object"
15
+ },
16
+ "default": []
17
+ },
18
+ "user": {
19
+ "type": "object",
20
+ "description": "User management configuration",
21
+ "properties": {
22
+ "password": {
23
+ "type": "boolean",
24
+ "description": "Enable password-based authentication",
25
+ "default": true
26
+ },
27
+ "fields": {
28
+ "type": "array",
29
+ "description": "Additional user fields",
30
+ "items": {
31
+ "type": "string"
32
+ },
33
+ "examples": [["email", "firstName", "lastName"]]
34
+ },
35
+ "model": {
36
+ "type": "object",
37
+ "description": "Custom user model class"
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "auth": {
43
+ "type": "object",
44
+ "description": "Authentication configuration for integrations",
45
+ "properties": {
46
+ "jwtSecret": {
47
+ "type": "string",
48
+ "description": "JWT secret key (should be set via environment variable)"
49
+ },
50
+ "tokenExpiry": {
51
+ "type": "string",
52
+ "description": "Token expiration time",
53
+ "pattern": "^\\d+[smhd]$",
54
+ "default": "24h"
55
+ },
56
+ "refreshTokenExpiry": {
57
+ "type": "string",
58
+ "description": "Refresh token expiration time",
59
+ "pattern": "^\\d+[smhd]$",
60
+ "default": "7d"
61
+ }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ "database": {
66
+ "type": "object",
67
+ "description": "Database connection and model configuration",
68
+ "properties": {
69
+ "uri": {
70
+ "type": "string",
71
+ "description": "Database connection URI (should be set via environment variable)",
72
+ "format": "uri"
73
+ },
74
+ "mongodb": {
75
+ "type": "object",
76
+ "description": "MongoDB-specific options",
77
+ "properties": {
78
+ "useNewUrlParser": {
79
+ "type": "boolean",
80
+ "default": true
81
+ },
82
+ "useUnifiedTopology": {
83
+ "type": "boolean",
84
+ "default": true
85
+ }
86
+ },
87
+ "additionalProperties": true
88
+ }
89
+ },
90
+ "additionalProperties": true
91
+ },
92
+ "encryption": {
93
+ "type": "object",
94
+ "description": "Encryption settings for sensitive data",
95
+ "properties": {
96
+ "useDefaultKMSForFieldLevelEncryption": {
97
+ "type": "boolean",
98
+ "description": "Use default KMS for field-level encryption",
99
+ "default": true
100
+ }
101
+ },
102
+ "additionalProperties": false
103
+ },
104
+ "vpc": {
105
+ "type": "object",
106
+ "description": "Virtual Private Cloud settings",
107
+ "properties": {
108
+ "enable": {
109
+ "type": "boolean",
110
+ "description": "Enable VPC for enhanced security",
111
+ "default": true
112
+ }
113
+ },
114
+ "additionalProperties": false
115
+ },
116
+ "security": {
117
+ "type": "object",
118
+ "description": "Security settings for the application",
119
+ "properties": {
120
+ "cors": {
121
+ "type": "object",
122
+ "description": "CORS (Cross-Origin Resource Sharing) settings",
123
+ "properties": {
124
+ "origin": {
125
+ "oneOf": [
126
+ {"type": "string"},
127
+ {"type": "array", "items": {"type": "string"}},
128
+ {"type": "boolean"}
129
+ ],
130
+ "description": "Allowed origins for CORS requests",
131
+ "default": "http://localhost:3000"
132
+ },
133
+ "credentials": {
134
+ "type": "boolean",
135
+ "description": "Allow credentials in CORS requests",
136
+ "default": true
137
+ },
138
+ "methods": {
139
+ "type": "array",
140
+ "description": "Allowed HTTP methods",
141
+ "items": {
142
+ "type": "string",
143
+ "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]
144
+ }
145
+ },
146
+ "allowedHeaders": {
147
+ "type": "array",
148
+ "description": "Allowed request headers",
149
+ "items": {"type": "string"}
150
+ }
151
+ },
152
+ "additionalProperties": false
153
+ },
154
+ "rateLimit": {
155
+ "type": "object",
156
+ "description": "Rate limiting configuration",
157
+ "properties": {
158
+ "windowMs": {
159
+ "type": "integer",
160
+ "description": "Time window in milliseconds",
161
+ "minimum": 1000,
162
+ "default": 900000
163
+ },
164
+ "max": {
165
+ "type": "integer",
166
+ "description": "Maximum requests per window",
167
+ "minimum": 1,
168
+ "default": 100
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ }
173
+ },
174
+ "additionalProperties": false
175
+ },
176
+ "webhooks": {
177
+ "type": "object",
178
+ "description": "Webhook handling configuration",
179
+ "properties": {
180
+ "secret": {
181
+ "type": "string",
182
+ "description": "Webhook secret for signature verification"
183
+ },
184
+ "prefix": {
185
+ "type": "string",
186
+ "description": "Webhook endpoint prefix",
187
+ "pattern": "^/[a-zA-Z0-9/_-]*$",
188
+ "default": "/webhooks"
189
+ }
190
+ },
191
+ "additionalProperties": false
192
+ },
193
+ "logging": {
194
+ "type": "object",
195
+ "description": "Logging configuration",
196
+ "properties": {
197
+ "level": {
198
+ "type": "string",
199
+ "description": "Log level",
200
+ "enum": ["error", "warn", "info", "debug", "trace"],
201
+ "default": "info"
202
+ },
203
+ "format": {
204
+ "type": "string",
205
+ "description": "Log format",
206
+ "enum": ["json", "text", "combined"],
207
+ "default": "json"
208
+ }
209
+ },
210
+ "additionalProperties": false
211
+ },
212
+ "custom": {
213
+ "type": "object",
214
+ "description": "Custom application-specific configuration",
215
+ "properties": {
216
+ "appName": {
217
+ "type": "string",
218
+ "description": "Application name",
219
+ "default": "My Frigg Application"
220
+ },
221
+ "version": {
222
+ "type": "string",
223
+ "description": "Application version",
224
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?$",
225
+ "default": "1.0.0"
226
+ },
227
+ "environment": {
228
+ "type": "string",
229
+ "description": "Runtime environment",
230
+ "enum": ["development", "staging", "production", "test"],
231
+ "default": "development"
232
+ },
233
+ "features": {
234
+ "type": "object",
235
+ "description": "Feature flags and toggles",
236
+ "patternProperties": {
237
+ "^[a-zA-Z][a-zA-Z0-9_]*$": {
238
+ "type": "boolean"
239
+ }
240
+ },
241
+ "additionalProperties": false
242
+ }
243
+ },
244
+ "additionalProperties": true
245
+ }
246
+ },
247
+ "additionalProperties": false,
248
+ "examples": [
249
+ {
250
+ "integrations": [],
251
+ "user": {
252
+ "password": true
253
+ },
254
+ "encryption": {
255
+ "useDefaultKMSForFieldLevelEncryption": true
256
+ },
257
+ "vpc": {
258
+ "enable": true
259
+ },
260
+ "security": {
261
+ "cors": {
262
+ "origin": "http://localhost:3000",
263
+ "credentials": true
264
+ }
265
+ },
266
+ "logging": {
267
+ "level": "info"
268
+ },
269
+ "custom": {
270
+ "appName": "My Frigg Application",
271
+ "version": "1.0.0",
272
+ "environment": "development"
273
+ }
274
+ }
275
+ ]
276
+ }