@djangocfg/monitor 2.1.360 → 2.1.361

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,197 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Django CFG API",
5
+ "version": "1.0.0",
6
+ "description": "RESTful API with modern architecture"
7
+ },
8
+ "paths": {
9
+ "/cfg/monitor/ingest/": {
10
+ "post": {
11
+ "operationId": "cfg_monitor_ingest_create",
12
+ "description": "Accepts a batch of up to 50 frontend events. No authentication required — anonymous visitors can send events.",
13
+ "summary": "Ingest browser events",
14
+ "tags": [
15
+ "cfg_monitor"
16
+ ],
17
+ "requestBody": {
18
+ "content": {
19
+ "application/json": {
20
+ "schema": {
21
+ "$ref": "#/components/schemas/IngestBatchRequest"
22
+ }
23
+ }
24
+ },
25
+ "required": true
26
+ },
27
+ "security": [
28
+ {}
29
+ ],
30
+ "responses": {
31
+ "202": {
32
+ "description": "Accepted"
33
+ }
34
+ },
35
+ "x-async-capable": false
36
+ }
37
+ }
38
+ },
39
+ "components": {
40
+ "schemas": {
41
+ "FrontendEventIngestRequest": {
42
+ "type": "object",
43
+ "description": "Single browser event payload.",
44
+ "properties": {
45
+ "event_type": {
46
+ "$ref": "#/components/schemas/FrontendEventTypeEnum"
47
+ },
48
+ "message": {
49
+ "type": "string",
50
+ "minLength": 1,
51
+ "maxLength": 5000
52
+ },
53
+ "level": {
54
+ "allOf": [
55
+ {
56
+ "$ref": "#/components/schemas/FrontendEventLevelEnum"
57
+ }
58
+ ],
59
+ "default": "error"
60
+ },
61
+ "stack_trace": {
62
+ "type": "string",
63
+ "default": "",
64
+ "maxLength": 10000
65
+ },
66
+ "url": {
67
+ "type": "string",
68
+ "default": "",
69
+ "maxLength": 2000
70
+ },
71
+ "fingerprint": {
72
+ "type": "string",
73
+ "default": "",
74
+ "maxLength": 64
75
+ },
76
+ "http_status": {
77
+ "type": [
78
+ "integer",
79
+ "null"
80
+ ]
81
+ },
82
+ "http_method": {
83
+ "type": "string",
84
+ "default": "",
85
+ "maxLength": 10
86
+ },
87
+ "http_url": {
88
+ "type": "string",
89
+ "default": "",
90
+ "maxLength": 2000
91
+ },
92
+ "session_id": {
93
+ "type": "string",
94
+ "default": "",
95
+ "maxLength": 64
96
+ },
97
+ "user_agent": {
98
+ "type": "string",
99
+ "default": "",
100
+ "maxLength": 500
101
+ },
102
+ "build_id": {
103
+ "type": "string",
104
+ "default": "",
105
+ "maxLength": 100
106
+ },
107
+ "environment": {
108
+ "type": "string",
109
+ "default": "",
110
+ "maxLength": 20
111
+ },
112
+ "extra": {},
113
+ "project_name": {
114
+ "type": "string",
115
+ "default": "",
116
+ "maxLength": 100
117
+ }
118
+ },
119
+ "required": [
120
+ "event_type",
121
+ "message"
122
+ ]
123
+ },
124
+ "FrontendEventLevelEnum": {
125
+ "enum": [
126
+ "error",
127
+ "warning",
128
+ "info",
129
+ "debug"
130
+ ],
131
+ "type": "string",
132
+ "description": "* `error` - Error\n* `warning` - Warning\n* `info` - Info\n* `debug` - Debug"
133
+ },
134
+ "FrontendEventTypeEnum": {
135
+ "enum": [
136
+ "JS_ERROR",
137
+ "NETWORK_ERROR",
138
+ "ERROR",
139
+ "WARNING",
140
+ "PAGE_VIEW",
141
+ "PERFORMANCE",
142
+ "CONSOLE"
143
+ ],
144
+ "type": "string",
145
+ "description": "* `JS_ERROR` - Js Error\n* `NETWORK_ERROR` - Network Error\n* `ERROR` - Error\n* `WARNING` - Warning\n* `PAGE_VIEW` - Page View\n* `PERFORMANCE` - Performance\n* `CONSOLE` - Console"
146
+ },
147
+ "IngestBatchRequest": {
148
+ "type": "object",
149
+ "description": "Batch of up to 50 browser events.",
150
+ "properties": {
151
+ "events": {
152
+ "type": "array",
153
+ "items": {
154
+ "$ref": "#/components/schemas/FrontendEventIngestRequest"
155
+ },
156
+ "maxItems": 25,
157
+ "minItems": 1
158
+ }
159
+ },
160
+ "required": [
161
+ "events"
162
+ ]
163
+ }
164
+ },
165
+ "securitySchemes": {
166
+ "apiKeyAuth": {
167
+ "type": "apiKey",
168
+ "in": "header",
169
+ "name": "X-API-Key"
170
+ },
171
+ "basicAuth": {
172
+ "type": "http",
173
+ "scheme": "basic"
174
+ },
175
+ "cookieAuth": {
176
+ "type": "apiKey",
177
+ "in": "cookie",
178
+ "name": "sessionid"
179
+ },
180
+ "jwtAuth": {
181
+ "type": "http",
182
+ "scheme": "bearer",
183
+ "bearerFormat": "JWT"
184
+ },
185
+ "jwtAuthWithLastLogin": {
186
+ "type": "http",
187
+ "scheme": "bearer",
188
+ "bearerFormat": "JWT"
189
+ }
190
+ }
191
+ },
192
+ "servers": [
193
+ {
194
+ "url": "http://localhost:8000"
195
+ }
196
+ ]
197
+ }
@@ -79,7 +79,11 @@ function detectLocale(): string | null {
79
79
  return null;
80
80
  }
81
81
 
82
- /** Default baseUrl from `NEXT_PUBLIC_API_URL` (empty for static builds). */
82
+ /** Default baseUrl from `NEXT_PUBLIC_API_URL`.
83
+ *
84
+ * Both browser and server use NEXT_PUBLIC_API_URL — requests go
85
+ * directly to Django without Next.js proxy.
86
+ */
83
87
  function defaultBaseUrl(): string {
84
88
  try {
85
89
  if (typeof process !== 'undefined' && process.env) {
@@ -90,8 +94,15 @@ function defaultBaseUrl(): string {
90
94
  return '';
91
95
  }
92
96
 
93
- /** Default API key fallback from `NEXT_PUBLIC_API_KEY`. */
97
+ /** Default API key fallback from `NEXT_PUBLIC_API_KEY`.
98
+ *
99
+ * In the browser: returns null — requests go through the Next.js rewrite
100
+ * and the key is injected server-side (never exposed in the bundle).
101
+ * On the server: reads NEXT_PUBLIC_API_KEY as a fallback for SSR calls
102
+ * that bypass the rewrite (e.g. server components calling Django directly).
103
+ */
94
104
  function defaultApiKey(): string | null {
105
+ if (isBrowser) return null;
95
106
  try {
96
107
  if (typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_API_KEY) {
97
108
  return process.env.NEXT_PUBLIC_API_KEY;
@@ -0,0 +1,197 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Django CFG API",
5
+ "version": "1.0.0",
6
+ "description": "RESTful API with modern architecture"
7
+ },
8
+ "paths": {
9
+ "/cfg/monitor/ingest/": {
10
+ "post": {
11
+ "operationId": "cfg_monitor_ingest_create",
12
+ "description": "Accepts a batch of up to 50 frontend events. No authentication required — anonymous visitors can send events.",
13
+ "summary": "Ingest browser events",
14
+ "tags": [
15
+ "cfg_monitor"
16
+ ],
17
+ "requestBody": {
18
+ "content": {
19
+ "application/json": {
20
+ "schema": {
21
+ "$ref": "#/components/schemas/IngestBatchRequest"
22
+ }
23
+ }
24
+ },
25
+ "required": true
26
+ },
27
+ "security": [
28
+ {}
29
+ ],
30
+ "responses": {
31
+ "202": {
32
+ "description": "Accepted"
33
+ }
34
+ },
35
+ "x-async-capable": false
36
+ }
37
+ }
38
+ },
39
+ "components": {
40
+ "schemas": {
41
+ "FrontendEventIngestRequest": {
42
+ "type": "object",
43
+ "description": "Single browser event payload.",
44
+ "properties": {
45
+ "event_type": {
46
+ "$ref": "#/components/schemas/FrontendEventTypeEnum"
47
+ },
48
+ "message": {
49
+ "type": "string",
50
+ "minLength": 1,
51
+ "maxLength": 5000
52
+ },
53
+ "level": {
54
+ "allOf": [
55
+ {
56
+ "$ref": "#/components/schemas/FrontendEventLevelEnum"
57
+ }
58
+ ],
59
+ "default": "error"
60
+ },
61
+ "stack_trace": {
62
+ "type": "string",
63
+ "default": "",
64
+ "maxLength": 10000
65
+ },
66
+ "url": {
67
+ "type": "string",
68
+ "default": "",
69
+ "maxLength": 2000
70
+ },
71
+ "fingerprint": {
72
+ "type": "string",
73
+ "default": "",
74
+ "maxLength": 64
75
+ },
76
+ "http_status": {
77
+ "type": [
78
+ "integer",
79
+ "null"
80
+ ]
81
+ },
82
+ "http_method": {
83
+ "type": "string",
84
+ "default": "",
85
+ "maxLength": 10
86
+ },
87
+ "http_url": {
88
+ "type": "string",
89
+ "default": "",
90
+ "maxLength": 2000
91
+ },
92
+ "session_id": {
93
+ "type": "string",
94
+ "default": "",
95
+ "maxLength": 64
96
+ },
97
+ "user_agent": {
98
+ "type": "string",
99
+ "default": "",
100
+ "maxLength": 500
101
+ },
102
+ "build_id": {
103
+ "type": "string",
104
+ "default": "",
105
+ "maxLength": 100
106
+ },
107
+ "environment": {
108
+ "type": "string",
109
+ "default": "",
110
+ "maxLength": 20
111
+ },
112
+ "extra": {},
113
+ "project_name": {
114
+ "type": "string",
115
+ "default": "",
116
+ "maxLength": 100
117
+ }
118
+ },
119
+ "required": [
120
+ "event_type",
121
+ "message"
122
+ ]
123
+ },
124
+ "FrontendEventLevelEnum": {
125
+ "enum": [
126
+ "error",
127
+ "warning",
128
+ "info",
129
+ "debug"
130
+ ],
131
+ "type": "string",
132
+ "description": "* `error` - Error\n* `warning` - Warning\n* `info` - Info\n* `debug` - Debug"
133
+ },
134
+ "FrontendEventTypeEnum": {
135
+ "enum": [
136
+ "JS_ERROR",
137
+ "NETWORK_ERROR",
138
+ "ERROR",
139
+ "WARNING",
140
+ "PAGE_VIEW",
141
+ "PERFORMANCE",
142
+ "CONSOLE"
143
+ ],
144
+ "type": "string",
145
+ "description": "* `JS_ERROR` - Js Error\n* `NETWORK_ERROR` - Network Error\n* `ERROR` - Error\n* `WARNING` - Warning\n* `PAGE_VIEW` - Page View\n* `PERFORMANCE` - Performance\n* `CONSOLE` - Console"
146
+ },
147
+ "IngestBatchRequest": {
148
+ "type": "object",
149
+ "description": "Batch of up to 50 browser events.",
150
+ "properties": {
151
+ "events": {
152
+ "type": "array",
153
+ "items": {
154
+ "$ref": "#/components/schemas/FrontendEventIngestRequest"
155
+ },
156
+ "maxItems": 25,
157
+ "minItems": 1
158
+ }
159
+ },
160
+ "required": [
161
+ "events"
162
+ ]
163
+ }
164
+ },
165
+ "securitySchemes": {
166
+ "apiKeyAuth": {
167
+ "type": "apiKey",
168
+ "in": "header",
169
+ "name": "X-API-Key"
170
+ },
171
+ "basicAuth": {
172
+ "type": "http",
173
+ "scheme": "basic"
174
+ },
175
+ "cookieAuth": {
176
+ "type": "apiKey",
177
+ "in": "cookie",
178
+ "name": "sessionid"
179
+ },
180
+ "jwtAuth": {
181
+ "type": "http",
182
+ "scheme": "bearer",
183
+ "bearerFormat": "JWT"
184
+ },
185
+ "jwtAuthWithLastLogin": {
186
+ "type": "http",
187
+ "scheme": "bearer",
188
+ "bearerFormat": "JWT"
189
+ }
190
+ }
191
+ },
192
+ "servers": [
193
+ {
194
+ "url": "http://localhost:8000"
195
+ }
196
+ ]
197
+ }