@open-mercato/core 0.4.2-canary-eb5f87d5f9 → 0.4.2-canary-802e036384
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/modules/api_docs/lib/resources.js +1 -1
- package/dist/modules/api_docs/lib/resources.js.map +1 -1
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +1 -1
- package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +1 -1
- package/dist/modules/workflows/lib/activity-executor.js +1 -1
- package/dist/modules/workflows/lib/activity-executor.js.map +1 -1
- package/package.json +2 -2
- package/src/modules/api_docs/lib/resources.ts +1 -1
- package/src/modules/business_rules/api/__tests__/execute.route.test.ts +9 -9
- package/src/modules/business_rules/api/__tests__/logs-detail.route.test.ts +7 -7
- package/src/modules/business_rules/api/__tests__/logs.route.test.ts +14 -14
- package/src/modules/business_rules/api/__tests__/rules-detail.route.test.ts +4 -4
- package/src/modules/business_rules/api/__tests__/rules.route.test.ts +29 -29
- package/src/modules/business_rules/api/__tests__/sets-detail.route.test.ts +6 -6
- package/src/modules/business_rules/api/__tests__/sets-members.route.test.ts +16 -16
- package/src/modules/business_rules/api/__tests__/sets.route.test.ts +17 -17
- package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +1 -1
- package/src/modules/workflows/lib/__tests__/call-api.test.ts +2 -2
- package/src/modules/workflows/lib/activity-executor.ts +1 -1
|
@@ -58,7 +58,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
58
58
|
test('should return 401 when not authenticated', async () => {
|
|
59
59
|
mockGetAuthFromRequest.mockResolvedValue(null)
|
|
60
60
|
|
|
61
|
-
const request = new Request('http://localhost:
|
|
61
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets')
|
|
62
62
|
const response = await GET(request)
|
|
63
63
|
|
|
64
64
|
expect(response.status).toBe(401)
|
|
@@ -85,7 +85,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
85
85
|
|
|
86
86
|
mockEm.findAndCount.mockResolvedValue([mockSets, 1])
|
|
87
87
|
|
|
88
|
-
const request = new Request('http://localhost:
|
|
88
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?page=1&pageSize=50')
|
|
89
89
|
const response = await GET(request)
|
|
90
90
|
|
|
91
91
|
expect(response.status).toBe(200)
|
|
@@ -99,7 +99,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
99
99
|
test('should filter by enabled status', async () => {
|
|
100
100
|
mockEm.findAndCount.mockResolvedValue([[], 0])
|
|
101
101
|
|
|
102
|
-
const request = new Request('http://localhost:
|
|
102
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?enabled=true')
|
|
103
103
|
await GET(request)
|
|
104
104
|
|
|
105
105
|
expect(mockEm.findAndCount).toHaveBeenCalledWith(
|
|
@@ -112,7 +112,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
112
112
|
test('should search by set name', async () => {
|
|
113
113
|
mockEm.findAndCount.mockResolvedValue([[], 0])
|
|
114
114
|
|
|
115
|
-
const request = new Request('http://localhost:
|
|
115
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?search=manufacturing')
|
|
116
116
|
await GET(request)
|
|
117
117
|
|
|
118
118
|
expect(mockEm.findAndCount).toHaveBeenCalledWith(
|
|
@@ -125,7 +125,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
125
125
|
test('should filter by setId', async () => {
|
|
126
126
|
mockEm.findAndCount.mockResolvedValue([[], 0])
|
|
127
127
|
|
|
128
|
-
const request = new Request('http://localhost:
|
|
128
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?setId=SET-001')
|
|
129
129
|
await GET(request)
|
|
130
130
|
|
|
131
131
|
expect(mockEm.findAndCount).toHaveBeenCalledWith(
|
|
@@ -140,7 +140,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
140
140
|
test('should return 401 when not authenticated', async () => {
|
|
141
141
|
mockGetAuthFromRequest.mockResolvedValue(null)
|
|
142
142
|
|
|
143
|
-
const request = new Request('http://localhost:
|
|
143
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
144
144
|
method: 'POST',
|
|
145
145
|
body: JSON.stringify({ setId: 'SET-NEW', setName: 'New Set' }),
|
|
146
146
|
})
|
|
@@ -162,7 +162,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
162
162
|
mockEm.create.mockReturnValue({ id: '223e4567-e89b-12d3-a456-426614174002', ...newSet })
|
|
163
163
|
mockEm.persistAndFlush.mockResolvedValue(undefined)
|
|
164
164
|
|
|
165
|
-
const request = new Request('http://localhost:
|
|
165
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
166
166
|
method: 'POST',
|
|
167
167
|
body: JSON.stringify(newSet),
|
|
168
168
|
})
|
|
@@ -184,7 +184,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
184
184
|
mockEm.create.mockReturnValue({ id: '223e4567-e89b-12d3-a456-426614174002', ...newSet })
|
|
185
185
|
mockEm.persistAndFlush.mockResolvedValue(undefined)
|
|
186
186
|
|
|
187
|
-
const request = new Request('http://localhost:
|
|
187
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
188
188
|
method: 'POST',
|
|
189
189
|
body: JSON.stringify(newSet),
|
|
190
190
|
})
|
|
@@ -206,7 +206,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
206
206
|
setName: 'Test',
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
const request = new Request('http://localhost:
|
|
209
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
210
210
|
method: 'POST',
|
|
211
211
|
body: JSON.stringify(invalidSet),
|
|
212
212
|
})
|
|
@@ -222,7 +222,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
222
222
|
test('should return 401 when not authenticated', async () => {
|
|
223
223
|
mockGetAuthFromRequest.mockResolvedValue(null)
|
|
224
224
|
|
|
225
|
-
const request = new Request('http://localhost:
|
|
225
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
226
226
|
method: 'PUT',
|
|
227
227
|
body: JSON.stringify({ id: 'set-1', setName: 'Updated' }),
|
|
228
228
|
})
|
|
@@ -247,7 +247,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
247
247
|
mockEm.assign.mockImplementation((target: any, data: any) => Object.assign(target, data))
|
|
248
248
|
mockEm.persistAndFlush.mockResolvedValue(undefined)
|
|
249
249
|
|
|
250
|
-
const request = new Request('http://localhost:
|
|
250
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
251
251
|
method: 'PUT',
|
|
252
252
|
body: JSON.stringify({
|
|
253
253
|
id: '123e4567-e89b-12d3-a456-426614174001',
|
|
@@ -267,7 +267,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
267
267
|
test('should return 404 if set not found', async () => {
|
|
268
268
|
mockEm.findOne.mockResolvedValue(null)
|
|
269
269
|
|
|
270
|
-
const request = new Request('http://localhost:
|
|
270
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
271
271
|
method: 'PUT',
|
|
272
272
|
body: JSON.stringify({
|
|
273
273
|
id: '999e4567-e89b-12d3-a456-999999999999',
|
|
@@ -282,7 +282,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
282
282
|
})
|
|
283
283
|
|
|
284
284
|
test('should return 400 if id is missing', async () => {
|
|
285
|
-
const request = new Request('http://localhost:
|
|
285
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
286
286
|
method: 'PUT',
|
|
287
287
|
body: JSON.stringify({
|
|
288
288
|
setName: 'Updated',
|
|
@@ -300,7 +300,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
300
300
|
test('should return 401 when not authenticated', async () => {
|
|
301
301
|
mockGetAuthFromRequest.mockResolvedValue(null)
|
|
302
302
|
|
|
303
|
-
const request = new Request('http://localhost:
|
|
303
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?id=set-1', {
|
|
304
304
|
method: 'DELETE',
|
|
305
305
|
})
|
|
306
306
|
const response = await DELETE(request)
|
|
@@ -322,7 +322,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
322
322
|
mockEm.findOne.mockResolvedValue(existingSet)
|
|
323
323
|
mockEm.persistAndFlush.mockResolvedValue(undefined)
|
|
324
324
|
|
|
325
|
-
const request = new Request('http://localhost:
|
|
325
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?id=123e4567-e89b-12d3-a456-426614174001', {
|
|
326
326
|
method: 'DELETE',
|
|
327
327
|
})
|
|
328
328
|
const response = await DELETE(request)
|
|
@@ -337,7 +337,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
337
337
|
test('should return 404 if set not found', async () => {
|
|
338
338
|
mockEm.findOne.mockResolvedValue(null)
|
|
339
339
|
|
|
340
|
-
const request = new Request('http://localhost:
|
|
340
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets?id=999e4567-e89b-12d3-a456-999999999999', {
|
|
341
341
|
method: 'DELETE',
|
|
342
342
|
})
|
|
343
343
|
const response = await DELETE(request)
|
|
@@ -348,7 +348,7 @@ describe('Business Rules API - /api/business_rules/sets', () => {
|
|
|
348
348
|
})
|
|
349
349
|
|
|
350
350
|
test('should return 400 if id is missing', async () => {
|
|
351
|
-
const request = new Request('http://localhost:
|
|
351
|
+
const request = new Request('http://localhost:5050/api/business_rules/sets', {
|
|
352
352
|
method: 'DELETE',
|
|
353
353
|
})
|
|
354
354
|
const response = await DELETE(request)
|
|
@@ -247,7 +247,7 @@ export default function RecordsPage({ params }: { params: { entityId?: string }
|
|
|
247
247
|
<div className="space-y-2">
|
|
248
248
|
<div>
|
|
249
249
|
<div className="font-medium mb-1">1) Configure environment variables</div>
|
|
250
|
-
<pre className="bg-muted p-3 rounded text-xs overflow-auto"><code>{`export BASE_URL="http://localhost:
|
|
250
|
+
<pre className="bg-muted p-3 rounded text-xs overflow-auto"><code>{`export BASE_URL="http://localhost:5050/api"
|
|
251
251
|
export API_KEY="<paste API key secret here>" # scoped with entities.features
|
|
252
252
|
export ENTITY_ID="${entityId}"
|
|
253
253
|
export RECORD_ID="<record uuid>"`}</code></pre>
|
|
@@ -175,7 +175,7 @@ describe('executeCallApi', () => {
|
|
|
175
175
|
|
|
176
176
|
it('should build full URL from relative path', async () => {
|
|
177
177
|
// Arrange
|
|
178
|
-
process.env.APP_URL = 'http://localhost:
|
|
178
|
+
process.env.APP_URL = 'http://localhost:5050'
|
|
179
179
|
|
|
180
180
|
mockFetch.mockResolvedValue({
|
|
181
181
|
ok: true,
|
|
@@ -195,7 +195,7 @@ describe('executeCallApi', () => {
|
|
|
195
195
|
|
|
196
196
|
// Assert
|
|
197
197
|
const [url] = mockFetch.mock.calls[0] as any
|
|
198
|
-
expect(url).toBe('http://localhost:
|
|
198
|
+
expect(url).toBe('http://localhost:5050/api/sales/orders')
|
|
199
199
|
})
|
|
200
200
|
|
|
201
201
|
it('should throw error for 401 Unauthorized (non-retriable)', async () => {
|
|
@@ -708,7 +708,7 @@ export async function executeCallApi(
|
|
|
708
708
|
* - Absolute URLs → validate domain matches APP_URL (SSRF prevention)
|
|
709
709
|
*/
|
|
710
710
|
function buildApiUrl(endpoint: string): string {
|
|
711
|
-
const appUrl = process.env.APP_URL || 'http://localhost:
|
|
711
|
+
const appUrl = process.env.APP_URL || 'http://localhost:5050'
|
|
712
712
|
|
|
713
713
|
// Relative path - prepend APP_URL
|
|
714
714
|
if (endpoint.startsWith('/')) {
|