@friggframework/schemas 2.0.0--canary.545.ccb5010.0 → 2.0.0--canary.549.b074651.0

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @friggframework/schemas - Canonical JSON Schema definitions for Frigg Framework
3
- *
3
+ *
4
4
  * This package provides formal JSON Schema definitions for all core Frigg configuration
5
- * objects, along with runtime validation utilities and Express middleware.
5
+ * objects, along with runtime validation utilities.
6
6
  */
7
7
 
8
8
  const Ajv = require('ajv');
@@ -10,9 +10,6 @@ const addFormats = require('ajv-formats');
10
10
  const fs = require('fs');
11
11
  const path = require('path');
12
12
 
13
- // Import middleware
14
- const schemaValidationMiddleware = require('./middleware/schema-validation');
15
-
16
13
  // Initialize AJV with formats
17
14
  const ajv = new Ajv({
18
15
  allErrors: true,
@@ -28,15 +25,11 @@ const schemaDir = path.join(__dirname, 'schemas');
28
25
  // Load schema files
29
26
  const schemaFiles = [
30
27
  'app-definition.schema.json',
31
- 'integration-definition.schema.json',
28
+ 'integration-definition.schema.json',
32
29
  'api-module-definition.schema.json',
33
30
  'serverless-config.schema.json',
34
31
  'environment-config.schema.json',
35
- 'core-models.schema.json',
36
- 'api-authorization.schema.json',
37
- 'api-credentials.schema.json',
38
- 'api-entities.schema.json',
39
- 'api-proxy.schema.json'
32
+ 'core-models.schema.json'
40
33
  ];
41
34
 
42
35
  schemaFiles.forEach(file => {
@@ -124,195 +117,6 @@ function validateCoreModels(coreModels) {
124
117
  return validate('core-models', coreModels);
125
118
  }
126
119
 
127
- /**
128
- * Validate Authorization Requirements
129
- * @param {object} requirements - Authorization requirements object to validate
130
- * @returns {object} - Validation result
131
- */
132
- function validateAuthorizationRequirements(requirements) {
133
- return validate('api-authorization#/definitions/authorizationRequirements', requirements);
134
- }
135
-
136
- /**
137
- * Validate Authorization Request
138
- * @param {object} request - Authorization request object to validate
139
- * @returns {object} - Validation result
140
- */
141
- function validateAuthorizationRequest(request) {
142
- return validate('api-authorization#/definitions/authorizationRequest', request);
143
- }
144
-
145
- /**
146
- * Validate Authorization Response
147
- * @param {object} response - Authorization response object to validate
148
- * @returns {object} - Validation result
149
- */
150
- function validateAuthorizationResponse(response) {
151
- return validate('api-authorization#/definitions/authorizationResponse', response);
152
- }
153
-
154
- /**
155
- * Validate Authorization Session
156
- * @param {object} session - Authorization session object to validate
157
- * @returns {object} - Validation result
158
- */
159
- function validateAuthorizationSession(session) {
160
- return validate('api-authorization#/definitions/authorizationSession', session);
161
- }
162
-
163
- /**
164
- * Validate Credential
165
- * @param {object} credential - Credential object to validate
166
- * @returns {object} - Validation result
167
- */
168
- function validateCredential(credential) {
169
- return validate('api-credentials#/definitions/credential', credential);
170
- }
171
-
172
- /**
173
- * Validate List Credentials Response
174
- * @param {object} response - List credentials response object to validate
175
- * @returns {object} - Validation result
176
- */
177
- function validateListCredentialsResponse(response) {
178
- return validate('api-credentials#/definitions/listCredentialsResponse', response);
179
- }
180
-
181
- /**
182
- * Validate Get Credential Response
183
- * @param {object} response - Get credential response object to validate
184
- * @returns {object} - Validation result
185
- */
186
- function validateGetCredentialResponse(response) {
187
- return validate('api-credentials#/definitions/getCredentialResponse', response);
188
- }
189
-
190
- /**
191
- * Validate Delete Credential Response
192
- * @param {object} response - Delete credential response object to validate
193
- * @returns {object} - Validation result
194
- */
195
- function validateDeleteCredentialResponse(response) {
196
- return validate('api-credentials#/definitions/deleteCredentialResponse', response);
197
- }
198
-
199
- /**
200
- * Validate Reauthorize Credential Request
201
- * @param {object} request - Reauthorize credential request object to validate
202
- * @returns {object} - Validation result
203
- */
204
- function validateReauthorizeCredentialRequest(request) {
205
- return validate('api-credentials#/definitions/reauthorizeCredentialRequest', request);
206
- }
207
-
208
- /**
209
- * Validate Reauthorize Credential Response
210
- * @param {object} response - Reauthorize credential response object to validate
211
- * @returns {object} - Validation result
212
- */
213
- function validateReauthorizeCredentialResponse(response) {
214
- return validate('api-credentials#/definitions/reauthorizeCredentialResponse', response);
215
- }
216
-
217
- /**
218
- * Validate Proxy Request
219
- * @param {object} request - Proxy request object to validate
220
- * @returns {object} - Validation result
221
- */
222
- function validateProxyRequest(request) {
223
- return validate('api-proxy#/definitions/proxyRequest', request);
224
- }
225
-
226
- /**
227
- * Validate Proxy Response
228
- * @param {object} response - Proxy response object to validate
229
- * @returns {object} - Validation result
230
- */
231
- function validateProxyResponse(response) {
232
- return validate('api-proxy#/definitions/proxyResponseUnion', response);
233
- }
234
-
235
- /**
236
- * Validate Entity
237
- * @param {object} entity - Entity object to validate
238
- * @returns {object} - Validation result
239
- */
240
- function validateEntity(entity) {
241
- return validate('api-entities#/definitions/entity', entity);
242
- }
243
-
244
- /**
245
- * Validate List Entities Response
246
- * @param {object} response - List entities response object to validate
247
- * @returns {object} - Validation result
248
- */
249
- function validateListEntitiesResponse(response) {
250
- return validate('api-entities#/definitions/listEntitiesResponse', response);
251
- }
252
-
253
- /**
254
- * Validate Create Entity Request
255
- * @param {object} request - Create entity request object to validate
256
- * @returns {object} - Validation result
257
- */
258
- function validateCreateEntityRequest(request) {
259
- return validate('api-entities#/definitions/createEntityRequest', request);
260
- }
261
-
262
- /**
263
- * Validate Create Entity Response
264
- * @param {object} response - Create entity response object to validate
265
- * @returns {object} - Validation result
266
- */
267
- function validateCreateEntityResponse(response) {
268
- return validate('api-entities#/definitions/createEntityResponse', response);
269
- }
270
-
271
- /**
272
- * Validate Entity Type
273
- * @param {object} entityType - Entity type object to validate
274
- * @returns {object} - Validation result
275
- */
276
- function validateEntityType(entityType) {
277
- return validate('api-entities#/definitions/entityType', entityType);
278
- }
279
-
280
- /**
281
- * Validate List Entity Types Response
282
- * @param {object} response - List entity types response object to validate
283
- * @returns {object} - Validation result
284
- */
285
- function validateListEntityTypesResponse(response) {
286
- return validate('api-entities#/definitions/listEntityTypesResponse', response);
287
- }
288
-
289
- /**
290
- * Validate Get Entity Type Response
291
- * @param {object} response - Get entity type response object to validate
292
- * @returns {object} - Validation result
293
- */
294
- function validateGetEntityTypeResponse(response) {
295
- return validate('api-entities#/definitions/getEntityTypeResponse', response);
296
- }
297
-
298
- /**
299
- * Validate Reauthorize Entity Request
300
- * @param {object} request - Reauthorize entity request object to validate
301
- * @returns {object} - Validation result
302
- */
303
- function validateReauthorizeEntityRequest(request) {
304
- return validate('api-entities#/definitions/reauthorizeEntityRequest', request);
305
- }
306
-
307
- /**
308
- * Validate Reauthorize Entity Response
309
- * @param {object} response - Reauthorize entity response object to validate
310
- * @returns {object} - Validation result
311
- */
312
- function validateReauthorizeEntityResponse(response) {
313
- return validate('api-entities#/definitions/reauthorizeEntityResponse', response);
314
- }
315
-
316
120
  /**
317
121
  * Get all available schemas
318
122
  * @returns {object} - Object containing all loaded schemas
@@ -354,7 +158,6 @@ function formatErrors(errors) {
354
158
  }
355
159
 
356
160
  module.exports = {
357
- // Validation functions
358
161
  validate,
359
162
  validateAppDefinition,
360
163
  validateIntegrationDefinition,
@@ -362,39 +165,9 @@ module.exports = {
362
165
  validateServerlessConfig,
363
166
  validateEnvironmentConfig,
364
167
  validateCoreModels,
365
- validateAuthorizationRequirements,
366
- validateAuthorizationRequest,
367
- validateAuthorizationResponse,
368
- validateAuthorizationSession,
369
- validateCredential,
370
- validateListCredentialsResponse,
371
- validateGetCredentialResponse,
372
- validateDeleteCredentialResponse,
373
- validateReauthorizeCredentialRequest,
374
- validateReauthorizeCredentialResponse,
375
- validateProxyRequest,
376
- validateProxyResponse,
377
- validateEntity,
378
- validateListEntitiesResponse,
379
- validateCreateEntityRequest,
380
- validateCreateEntityResponse,
381
- validateEntityType,
382
- validateListEntityTypesResponse,
383
- validateGetEntityTypeResponse,
384
- validateReauthorizeEntityRequest,
385
- validateReauthorizeEntityResponse,
386
168
  getSchemas,
387
169
  getSchema,
388
170
  formatErrors,
389
171
  schemas,
390
- ajv,
391
-
392
- // Middleware exports
393
- middleware: schemaValidationMiddleware,
394
- validateBody: schemaValidationMiddleware.validateBody,
395
- validateQuery: schemaValidationMiddleware.validateQuery,
396
- validateParams: schemaValidationMiddleware.validateParams,
397
- validateResponse: schemaValidationMiddleware.validateResponse,
398
- SchemaRefs: schemaValidationMiddleware.SchemaRefs,
399
- SchemaValidationError: schemaValidationMiddleware.SchemaValidationError
172
+ ajv
400
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friggframework/schemas",
3
- "version": "2.0.0--canary.545.ccb5010.0",
3
+ "version": "2.0.0--canary.549.b074651.0",
4
4
  "description": "Canonical JSON Schema definitions for Frigg Framework",
5
5
  "main": "index.js",
6
6
  "author": "",
@@ -37,9 +37,7 @@
37
37
  "files": [
38
38
  "schemas/",
39
39
  "validators/",
40
- "mocks/",
41
- "middleware/",
42
40
  "index.js"
43
41
  ],
44
- "gitHead": "ccb5010339d2f13595db45f65ab501af02c0a360"
42
+ "gitHead": "b0746517496a65aca3ab8526084d3632f6e02ccb"
45
43
  }
@@ -16,29 +16,10 @@
16
16
  },
17
17
  "provider": {
18
18
  "type": "string",
19
- "description": "Deployment provider. Determines which @friggframework/provider-{name} package is loaded for runtime adapters, config generation, and deploy lifecycle. Built-in providers: 'aws' (default, serverless/Lambda), 'netlify' (Netlify Functions).",
20
- "enum": ["aws", "netlify"],
19
+ "description": "Cloud provider for deployment",
20
+ "enum": ["aws"],
21
21
  "default": "aws"
22
22
  },
23
- "label": {
24
- "type": "string",
25
- "description": "Human-readable display name for the application",
26
- "minLength": 1,
27
- "maxLength": 200,
28
- "examples": ["My Frigg Application", "Customer Portal Integrations"]
29
- },
30
- "managementMode": {
31
- "type": "string",
32
- "description": "Infrastructure management mode: 'managed' lets Frigg manage resources, 'discover' uses existing resources, 'custom' for manual configuration",
33
- "enum": ["managed", "discover", "custom"],
34
- "default": "managed"
35
- },
36
- "vpcIsolation": {
37
- "type": "string",
38
- "description": "VPC isolation strategy: 'isolated' creates separate VPC per stage, 'shared' reuses VPC across stages",
39
- "enum": ["isolated", "shared"],
40
- "default": "isolated"
41
- },
42
23
  "environment": {
43
24
  "type": "object",
44
25
  "description": "Environment variable configuration (key: true/false flags)",
@@ -631,61 +612,6 @@
631
612
  }
632
613
  },
633
614
  "additionalProperties": true
634
- },
635
- "extensions": {
636
- "type": "array",
637
- "description": "Extensions that add custom Prisma models, encrypted fields, admin routes, and bootstrap lifecycle hooks to a Frigg app. Each extension can declare a schema fragment, encryption config, route handler, and bootstrap function.",
638
- "items": {
639
- "type": "object",
640
- "required": ["name"],
641
- "properties": {
642
- "name": {
643
- "type": "string",
644
- "description": "Unique identifier for this extension",
645
- "minLength": 1,
646
- "examples": ["db-credentials", "audit-log"]
647
- },
648
- "schema": {
649
- "type": "string",
650
- "description": "Absolute path to a .prisma schema fragment. Models/enums from this file are composed into the main Prisma schema at build time.",
651
- "pattern": "\\.prisma$"
652
- },
653
- "encryption": {
654
- "type": "object",
655
- "description": "Encryption schema additions. Maps model names to arrays of field paths that should be encrypted at rest.",
656
- "patternProperties": {
657
- "^[A-Z][a-zA-Z0-9]*$": {
658
- "type": "object",
659
- "required": ["fields"],
660
- "properties": {
661
- "fields": {
662
- "type": "array",
663
- "items": { "type": "string" },
664
- "minItems": 1
665
- }
666
- },
667
- "additionalProperties": false
668
- }
669
- },
670
- "additionalProperties": false
671
- },
672
- "routes": {
673
- "type": "object",
674
- "description": "Express router to mount on the app. The handler factory receives (prisma, appDefinition) and returns an Express Router. Routes are protected by admin auth middleware.",
675
- "required": ["path"],
676
- "properties": {
677
- "path": {
678
- "type": "string",
679
- "description": "Base URL path for the extension routes",
680
- "pattern": "^/",
681
- "examples": ["/api/admin/oauth-credentials"]
682
- }
683
- },
684
- "additionalProperties": true
685
- }
686
- },
687
- "additionalProperties": true
688
- }
689
615
  }
690
616
  },
691
617
  "additionalProperties": false,
@@ -18,12 +18,12 @@
18
18
  "type": "object",
19
19
  "description": "Frigg User model schema",
20
20
  "required": [
21
- "id"
21
+ "_id"
22
22
  ],
23
23
  "properties": {
24
- "id": {
24
+ "_id": {
25
25
  "$ref": "#/definitions/objectId",
26
- "description": "Unique user identifier (maps to _id in MongoDB)"
26
+ "description": "Unique user identifier"
27
27
  },
28
28
  "email": {
29
29
  "type": "string",
@@ -148,13 +148,13 @@
148
148
  "type": "object",
149
149
  "description": "Frigg Credential model schema",
150
150
  "required": [
151
- "id",
151
+ "_id",
152
152
  "userId"
153
153
  ],
154
154
  "properties": {
155
- "id": {
155
+ "_id": {
156
156
  "$ref": "#/definitions/objectId",
157
- "description": "Unique credential identifier (maps to _id in MongoDB)"
157
+ "description": "Unique credential identifier"
158
158
  },
159
159
  "userId": {
160
160
  "$ref": "#/definitions/objectId",
@@ -165,12 +165,12 @@
165
165
  "description": "External system identifier",
166
166
  "maxLength": 255
167
167
  },
168
- "authIsValid": {
168
+ "auth_is_valid": {
169
169
  "type": "boolean",
170
170
  "description": "Whether authentication is currently valid",
171
171
  "default": false
172
172
  },
173
- "data": {
173
+ "authData": {
174
174
  "type": "object",
175
175
  "description": "Encrypted authentication data",
176
176
  "properties": {
@@ -263,14 +263,14 @@
263
263
  "type": "object",
264
264
  "description": "Frigg Entity model schema",
265
265
  "required": [
266
- "id",
266
+ "_id",
267
267
  "credentialId",
268
268
  "userId"
269
269
  ],
270
270
  "properties": {
271
- "id": {
271
+ "_id": {
272
272
  "$ref": "#/definitions/objectId",
273
- "description": "Unique entity identifier (maps to _id in MongoDB)"
273
+ "description": "Unique entity identifier"
274
274
  },
275
275
  "credentialId": {
276
276
  "$ref": "#/definitions/objectId",
@@ -423,7 +423,7 @@
423
423
  "examples": [
424
424
  {
425
425
  "user": {
426
- "id": "507f1f77bcf86cd799439011",
426
+ "_id": "507f1f77bcf86cd799439011",
427
427
  "email": "user@example.com",
428
428
  "firstName": "John",
429
429
  "lastName": "Doe",
@@ -446,11 +446,11 @@
446
446
  "updatedAt": "2023-01-01T00:00:00Z"
447
447
  },
448
448
  "credential": {
449
- "id": "507f1f77bcf86cd799439012",
449
+ "_id": "507f1f77bcf86cd799439012",
450
450
  "userId": "507f1f77bcf86cd799439011",
451
451
  "externalId": "12345",
452
- "authIsValid": true,
453
- "data": {
452
+ "auth_is_valid": true,
453
+ "authData": {
454
454
  "access_token": "encrypted_access_token",
455
455
  "refresh_token": "encrypted_refresh_token",
456
456
  "token_type": "Bearer",
@@ -466,7 +466,7 @@
466
466
  "updatedAt": "2023-01-01T00:00:00Z"
467
467
  },
468
468
  "entity": {
469
- "id": "507f1f77bcf86cd799439013",
469
+ "_id": "507f1f77bcf86cd799439013",
470
470
  "credentialId": "507f1f77bcf86cd799439012",
471
471
  "userId": "507f1f77bcf86cd799439011",
472
472
  "name": "HubSpot Contacts",