@friggframework/schemas 2.0.0-next.78 → 2.0.0-next.80

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,302 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://friggframework.org/schemas/api-authorization.json",
4
+ "title": "Frigg Authorization API Schemas",
5
+ "description": "JSON schemas for authorization and authentication API requests and responses",
6
+ "definitions": {
7
+ "authorizationRequirements": {
8
+ "type": "object",
9
+ "description": "Authorization requirements response from GET /api/authorize",
10
+ "required": ["type", "step", "totalSteps", "isMultiStep"],
11
+ "properties": {
12
+ "type": {
13
+ "type": "string",
14
+ "enum": ["oauth2", "form", "api-key", "basic"],
15
+ "description": "Type of authentication required"
16
+ },
17
+ "step": {
18
+ "type": "integer",
19
+ "minimum": 1,
20
+ "description": "Current step number (1-indexed)"
21
+ },
22
+ "totalSteps": {
23
+ "type": "integer",
24
+ "minimum": 1,
25
+ "description": "Total number of steps in the auth flow"
26
+ },
27
+ "isMultiStep": {
28
+ "type": "boolean",
29
+ "description": "Whether this is a multi-step authentication flow"
30
+ },
31
+ "sessionId": {
32
+ "type": "string",
33
+ "description": "Session ID for multi-step flows (required after step 1)"
34
+ },
35
+ "data": {
36
+ "type": "object",
37
+ "description": "Step-specific data (schema varies by type)",
38
+ "oneOf": [
39
+ { "$ref": "#/definitions/oauth2Requirements" },
40
+ { "$ref": "#/definitions/formRequirements" },
41
+ { "$ref": "#/definitions/apiKeyRequirements" }
42
+ ]
43
+ }
44
+ }
45
+ },
46
+ "oauth2Requirements": {
47
+ "type": "object",
48
+ "description": "OAuth2 authentication requirements",
49
+ "required": ["url"],
50
+ "properties": {
51
+ "url": {
52
+ "type": "string",
53
+ "format": "uri",
54
+ "description": "OAuth2 authorization URL to redirect user to"
55
+ },
56
+ "scopes": {
57
+ "type": "array",
58
+ "items": { "type": "string" },
59
+ "description": "Requested OAuth scopes"
60
+ }
61
+ }
62
+ },
63
+ "formRequirements": {
64
+ "type": "object",
65
+ "description": "Form-based authentication requirements",
66
+ "required": ["jsonSchema"],
67
+ "properties": {
68
+ "jsonSchema": {
69
+ "type": "object",
70
+ "description": "JSON Schema for the form fields",
71
+ "required": ["type", "properties"],
72
+ "properties": {
73
+ "title": { "type": "string" },
74
+ "description": { "type": "string" },
75
+ "type": { "const": "object" },
76
+ "required": {
77
+ "type": "array",
78
+ "items": { "type": "string" }
79
+ },
80
+ "properties": {
81
+ "type": "object",
82
+ "additionalProperties": true
83
+ }
84
+ }
85
+ },
86
+ "uiSchema": {
87
+ "type": "object",
88
+ "description": "UI schema for form rendering (react-jsonschema-form format)",
89
+ "additionalProperties": true
90
+ }
91
+ }
92
+ },
93
+ "apiKeyRequirements": {
94
+ "type": "object",
95
+ "description": "API key authentication requirements",
96
+ "required": ["fields"],
97
+ "properties": {
98
+ "fields": {
99
+ "type": "array",
100
+ "items": {
101
+ "type": "object",
102
+ "required": ["name", "type"],
103
+ "properties": {
104
+ "name": { "type": "string" },
105
+ "type": { "type": "string", "enum": ["api_key", "secret", "token"] },
106
+ "label": { "type": "string" },
107
+ "required": { "type": "boolean" }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "getEntityTypeRequirementsResponse": {
114
+ "type": "object",
115
+ "description": "Authorization requirements response from GET /api/entities/types/:typeName/requirements",
116
+ "required": ["type", "step", "totalSteps", "isMultiStep"],
117
+ "properties": {
118
+ "type": {
119
+ "type": "string",
120
+ "enum": ["oauth2", "form", "api-key", "basic"],
121
+ "description": "Type of authentication required"
122
+ },
123
+ "step": {
124
+ "type": "integer",
125
+ "minimum": 1,
126
+ "description": "Current step number (1-indexed)"
127
+ },
128
+ "totalSteps": {
129
+ "type": "integer",
130
+ "minimum": 1,
131
+ "description": "Total number of steps in the auth flow"
132
+ },
133
+ "isMultiStep": {
134
+ "type": "boolean",
135
+ "description": "Whether this is a multi-step authentication flow"
136
+ },
137
+ "sessionId": {
138
+ "type": "string",
139
+ "description": "Session ID for multi-step flows (required after step 1)"
140
+ },
141
+ "data": {
142
+ "type": "object",
143
+ "description": "Step-specific data (schema varies by type)",
144
+ "oneOf": [
145
+ { "$ref": "#/definitions/oauth2Requirements" },
146
+ { "$ref": "#/definitions/formRequirements" },
147
+ { "$ref": "#/definitions/apiKeyRequirements" }
148
+ ]
149
+ }
150
+ }
151
+ },
152
+ "authorizationRequest": {
153
+ "type": "object",
154
+ "description": "Authorization request to POST /api/authorize",
155
+ "required": ["entityType"],
156
+ "properties": {
157
+ "entityType": {
158
+ "type": "string",
159
+ "description": "Type of entity being authorized (module name)"
160
+ },
161
+ "moduleType": {
162
+ "type": "string",
163
+ "description": "Module type (v2 API) - same as entityType"
164
+ },
165
+ "data": {
166
+ "type": "object",
167
+ "description": "Authentication credentials or OAuth callback data",
168
+ "additionalProperties": true
169
+ },
170
+ "step": {
171
+ "type": "integer",
172
+ "minimum": 1,
173
+ "default": 1,
174
+ "description": "Current step number for multi-step flows"
175
+ },
176
+ "sessionId": {
177
+ "type": "string",
178
+ "description": "Session ID from previous step (required for step > 1)"
179
+ },
180
+ "connectingEntityType": {
181
+ "type": "string",
182
+ "description": "Type of entity being connected to (for paired integrations)"
183
+ }
184
+ }
185
+ },
186
+ "authorizationResponse": {
187
+ "type": "object",
188
+ "description": "Authorization response (success or next step)",
189
+ "oneOf": [
190
+ { "$ref": "#/definitions/authorizationSuccess" },
191
+ { "$ref": "#/definitions/authorizationNextStep" }
192
+ ]
193
+ },
194
+ "authorizationSuccess": {
195
+ "type": "object",
196
+ "description": "Successful authorization completion",
197
+ "required": ["entity_id", "credential_id", "type"],
198
+ "properties": {
199
+ "entity_id": {
200
+ "type": "string",
201
+ "description": "ID of created/updated entity"
202
+ },
203
+ "credential_id": {
204
+ "type": "string",
205
+ "description": "ID of created/updated credential"
206
+ },
207
+ "type": {
208
+ "type": "string",
209
+ "description": "Entity type (module name)"
210
+ },
211
+ "display": {
212
+ "type": "string",
213
+ "description": "Display name for the entity"
214
+ }
215
+ }
216
+ },
217
+ "authorizationNextStep": {
218
+ "type": "object",
219
+ "description": "Next step in multi-step authorization",
220
+ "required": ["nextStep", "sessionId", "requirements"],
221
+ "properties": {
222
+ "nextStep": {
223
+ "type": "integer",
224
+ "minimum": 2,
225
+ "description": "Next step number"
226
+ },
227
+ "sessionId": {
228
+ "type": "string",
229
+ "description": "Session ID to use for next step"
230
+ },
231
+ "requirements": {
232
+ "$ref": "#/definitions/authorizationRequirements",
233
+ "description": "Requirements for the next step"
234
+ },
235
+ "message": {
236
+ "type": "string",
237
+ "description": "Message to display to user (e.g., 'OTP sent to your email')"
238
+ }
239
+ }
240
+ },
241
+ "authorizationSession": {
242
+ "type": "object",
243
+ "description": "Authorization session stored in database",
244
+ "required": ["sessionId", "userId", "entityType", "currentStep", "maxSteps", "expiresAt"],
245
+ "properties": {
246
+ "id": {
247
+ "type": "string",
248
+ "description": "Database ID (ObjectId for MongoDB, integer for PostgreSQL)"
249
+ },
250
+ "sessionId": {
251
+ "type": "string",
252
+ "format": "uuid",
253
+ "description": "Unique session identifier"
254
+ },
255
+ "userId": {
256
+ "type": "string",
257
+ "description": "User ID initiating the auth flow"
258
+ },
259
+ "entityType": {
260
+ "type": "string",
261
+ "description": "Type of entity being authorized"
262
+ },
263
+ "currentStep": {
264
+ "type": "integer",
265
+ "minimum": 1,
266
+ "default": 1,
267
+ "description": "Current step in the flow"
268
+ },
269
+ "maxSteps": {
270
+ "type": "integer",
271
+ "minimum": 1,
272
+ "description": "Total number of steps"
273
+ },
274
+ "stepData": {
275
+ "type": "object",
276
+ "description": "Data collected from previous steps",
277
+ "additionalProperties": true
278
+ },
279
+ "expiresAt": {
280
+ "type": "string",
281
+ "format": "date-time",
282
+ "description": "Session expiration timestamp"
283
+ },
284
+ "completed": {
285
+ "type": "boolean",
286
+ "default": false,
287
+ "description": "Whether the session has completed successfully"
288
+ },
289
+ "createdAt": {
290
+ "type": "string",
291
+ "format": "date-time",
292
+ "description": "Session creation timestamp"
293
+ },
294
+ "updatedAt": {
295
+ "type": "string",
296
+ "format": "date-time",
297
+ "description": "Last update timestamp"
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
@@ -0,0 +1,176 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://friggframework.org/schemas/api-credentials.json",
4
+ "title": "Frigg Credentials API Schemas",
5
+ "description": "JSON schemas for credentials API requests and responses",
6
+ "definitions": {
7
+ "credential": {
8
+ "type": "object",
9
+ "description": "A credential object representing authentication data for an external system. Tokens are masked in responses.",
10
+ "required": ["id", "type", "userId", "authIsValid"],
11
+ "properties": {
12
+ "id": {
13
+ "type": "string",
14
+ "description": "Unique identifier for the credential"
15
+ },
16
+ "type": {
17
+ "type": "string",
18
+ "description": "Module type (e.g., 'hubspot', 'salesforce', 'slack')"
19
+ },
20
+ "externalId": {
21
+ "type": "string",
22
+ "description": "ID from the external system (e.g., account ID, organization ID)"
23
+ },
24
+ "userId": {
25
+ "type": "string",
26
+ "description": "ID of the user who owns this credential"
27
+ },
28
+ "authIsValid": {
29
+ "type": "boolean",
30
+ "description": "Whether the authentication is currently valid"
31
+ },
32
+ "entityCount": {
33
+ "type": "integer",
34
+ "minimum": 0,
35
+ "description": "Number of entities using this credential"
36
+ },
37
+ "createdAt": {
38
+ "type": "string",
39
+ "format": "date-time",
40
+ "description": "Timestamp when the credential was created"
41
+ },
42
+ "updatedAt": {
43
+ "type": "string",
44
+ "format": "date-time",
45
+ "description": "Timestamp when the credential was last updated"
46
+ }
47
+ }
48
+ },
49
+ "listCredentialsResponse": {
50
+ "type": "object",
51
+ "description": "Response from GET /api/credentials - returns list of credentials for the authenticated user",
52
+ "required": ["credentials"],
53
+ "properties": {
54
+ "credentials": {
55
+ "type": "array",
56
+ "items": {
57
+ "$ref": "#/definitions/credential"
58
+ },
59
+ "description": "Array of credential objects (tokens masked)"
60
+ }
61
+ }
62
+ },
63
+ "getCredentialResponse": {
64
+ "description": "Response from GET /api/credentials/:id - returns a single credential",
65
+ "allOf": [
66
+ {
67
+ "$ref": "#/definitions/credential"
68
+ }
69
+ ]
70
+ },
71
+ "deleteCredentialResponse": {
72
+ "type": "object",
73
+ "description": "Response from DELETE /api/credentials/:id",
74
+ "required": ["success"],
75
+ "properties": {
76
+ "success": {
77
+ "type": "boolean",
78
+ "description": "Whether the deletion was successful"
79
+ },
80
+ "message": {
81
+ "type": "string",
82
+ "description": "Optional message providing additional context"
83
+ }
84
+ }
85
+ },
86
+ "reauthorizeCredentialRequest": {
87
+ "type": "object",
88
+ "description": "Request to POST /api/credentials/:id/reauthorize - refresh or update credential authentication",
89
+ "required": ["data"],
90
+ "properties": {
91
+ "data": {
92
+ "type": "object",
93
+ "description": "Authentication data (OAuth code, API keys, form fields, etc.)",
94
+ "additionalProperties": true
95
+ },
96
+ "step": {
97
+ "type": "integer",
98
+ "minimum": 1,
99
+ "default": 1,
100
+ "description": "Current step number for multi-step reauthorization flows"
101
+ },
102
+ "sessionId": {
103
+ "type": "string",
104
+ "description": "Session ID from previous step (required for step > 1)"
105
+ }
106
+ }
107
+ },
108
+ "reauthorizeCredentialResponse": {
109
+ "type": "object",
110
+ "description": "Response from POST /api/credentials/:id/reauthorize - either success or next step",
111
+ "oneOf": [
112
+ {
113
+ "$ref": "#/definitions/reauthorizeCredentialSuccess"
114
+ },
115
+ {
116
+ "$ref": "#/definitions/reauthorizeCredentialNextStep"
117
+ }
118
+ ]
119
+ },
120
+ "reauthorizeCredentialSuccess": {
121
+ "type": "object",
122
+ "description": "Successful reauthorization completion",
123
+ "required": ["success", "credential_id", "authIsValid"],
124
+ "properties": {
125
+ "success": {
126
+ "type": "boolean",
127
+ "const": true,
128
+ "description": "Indicates successful reauthorization"
129
+ },
130
+ "credential_id": {
131
+ "type": "string",
132
+ "description": "ID of the reauthorized credential"
133
+ },
134
+ "authIsValid": {
135
+ "type": "boolean",
136
+ "const": true,
137
+ "description": "Authentication is now valid"
138
+ },
139
+ "message": {
140
+ "type": "string",
141
+ "description": "Optional success message"
142
+ }
143
+ }
144
+ },
145
+ "reauthorizeCredentialNextStep": {
146
+ "type": "object",
147
+ "description": "Next step in multi-step reauthorization flow",
148
+ "required": ["step", "totalSteps", "sessionId", "requirements"],
149
+ "properties": {
150
+ "step": {
151
+ "type": "integer",
152
+ "minimum": 2,
153
+ "description": "Next step number"
154
+ },
155
+ "totalSteps": {
156
+ "type": "integer",
157
+ "minimum": 2,
158
+ "description": "Total number of steps in the flow"
159
+ },
160
+ "sessionId": {
161
+ "type": "string",
162
+ "description": "Session ID to use for the next step"
163
+ },
164
+ "requirements": {
165
+ "type": "object",
166
+ "description": "Requirements for the next step (form fields, OAuth URL, etc.)",
167
+ "additionalProperties": true
168
+ },
169
+ "message": {
170
+ "type": "string",
171
+ "description": "Message to display to user (e.g., 'OTP sent to your email')"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }