dn-react-router-toolkit 0.9.5 → 0.9.6
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/api/index.js +25 -22
- package/dist/api/index.mjs +25 -22
- package/dist/api/resource_handler.js +25 -22
- package/dist/api/resource_handler.mjs +25 -22
- package/package.json +1 -1
package/dist/api/index.js
CHANGED
|
@@ -490,30 +490,33 @@ function resourceHandler({
|
|
|
490
490
|
});
|
|
491
491
|
}
|
|
492
492
|
const pathname = new URL(request.url).pathname;
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return (0, import_gw_response4.httpForbidden)();
|
|
501
|
-
}
|
|
502
|
-
switch (request.method) {
|
|
503
|
-
case "PATCH": {
|
|
504
|
-
const handler = patchResourceHandler({
|
|
505
|
-
repository,
|
|
506
|
-
validators,
|
|
507
|
-
primaryKey
|
|
508
|
-
});
|
|
509
|
-
return handler(existing, request);
|
|
493
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
494
|
+
if (segments.length === 3) {
|
|
495
|
+
const itemId = segments.at(-1);
|
|
496
|
+
if (itemId) {
|
|
497
|
+
const existing = await repository.find(itemId);
|
|
498
|
+
if (!existing) {
|
|
499
|
+
return (0, import_gw_response4.httpNotFound)();
|
|
510
500
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
return (0, import_gw_response4.httpNoContent)();
|
|
501
|
+
if (isOwnedBy && (!auth || !isOwnedBy(auth, existing))) {
|
|
502
|
+
return (0, import_gw_response4.httpForbidden)();
|
|
514
503
|
}
|
|
515
|
-
|
|
516
|
-
|
|
504
|
+
switch (request.method) {
|
|
505
|
+
case "PATCH": {
|
|
506
|
+
const handler = patchResourceHandler({
|
|
507
|
+
repository,
|
|
508
|
+
validators,
|
|
509
|
+
primaryKey
|
|
510
|
+
});
|
|
511
|
+
return handler(existing, request);
|
|
512
|
+
}
|
|
513
|
+
case "DELETE": {
|
|
514
|
+
await repository.delete(itemId);
|
|
515
|
+
return (0, import_gw_response4.httpNoContent)();
|
|
516
|
+
}
|
|
517
|
+
default: {
|
|
518
|
+
return (0, import_gw_response4.httpMethodNotAllowed)();
|
|
519
|
+
}
|
|
517
520
|
}
|
|
518
521
|
}
|
|
519
522
|
}
|
package/dist/api/index.mjs
CHANGED
|
@@ -486,30 +486,33 @@ function resourceHandler({
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
const pathname = new URL(request.url).pathname;
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
491
|
-
const
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return httpForbidden2();
|
|
497
|
-
}
|
|
498
|
-
switch (request.method) {
|
|
499
|
-
case "PATCH": {
|
|
500
|
-
const handler = patchResourceHandler({
|
|
501
|
-
repository,
|
|
502
|
-
validators,
|
|
503
|
-
primaryKey
|
|
504
|
-
});
|
|
505
|
-
return handler(existing, request);
|
|
489
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
490
|
+
if (segments.length === 3) {
|
|
491
|
+
const itemId = segments.at(-1);
|
|
492
|
+
if (itemId) {
|
|
493
|
+
const existing = await repository.find(itemId);
|
|
494
|
+
if (!existing) {
|
|
495
|
+
return httpNotFound3();
|
|
506
496
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
return httpNoContent();
|
|
497
|
+
if (isOwnedBy && (!auth || !isOwnedBy(auth, existing))) {
|
|
498
|
+
return httpForbidden2();
|
|
510
499
|
}
|
|
511
|
-
|
|
512
|
-
|
|
500
|
+
switch (request.method) {
|
|
501
|
+
case "PATCH": {
|
|
502
|
+
const handler = patchResourceHandler({
|
|
503
|
+
repository,
|
|
504
|
+
validators,
|
|
505
|
+
primaryKey
|
|
506
|
+
});
|
|
507
|
+
return handler(existing, request);
|
|
508
|
+
}
|
|
509
|
+
case "DELETE": {
|
|
510
|
+
await repository.delete(itemId);
|
|
511
|
+
return httpNoContent();
|
|
512
|
+
}
|
|
513
|
+
default: {
|
|
514
|
+
return httpMethodNotAllowed();
|
|
515
|
+
}
|
|
513
516
|
}
|
|
514
517
|
}
|
|
515
518
|
}
|
|
@@ -268,30 +268,33 @@ function resourceHandler({
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
const pathname = new URL(request.url).pathname;
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return (0, import_gw_response3.httpForbidden)();
|
|
279
|
-
}
|
|
280
|
-
switch (request.method) {
|
|
281
|
-
case "PATCH": {
|
|
282
|
-
const handler = patchResourceHandler({
|
|
283
|
-
repository,
|
|
284
|
-
validators,
|
|
285
|
-
primaryKey
|
|
286
|
-
});
|
|
287
|
-
return handler(existing, request);
|
|
271
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
272
|
+
if (segments.length === 3) {
|
|
273
|
+
const itemId = segments.at(-1);
|
|
274
|
+
if (itemId) {
|
|
275
|
+
const existing = await repository.find(itemId);
|
|
276
|
+
if (!existing) {
|
|
277
|
+
return (0, import_gw_response3.httpNotFound)();
|
|
288
278
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return (0, import_gw_response3.httpNoContent)();
|
|
279
|
+
if (isOwnedBy && (!auth || !isOwnedBy(auth, existing))) {
|
|
280
|
+
return (0, import_gw_response3.httpForbidden)();
|
|
292
281
|
}
|
|
293
|
-
|
|
294
|
-
|
|
282
|
+
switch (request.method) {
|
|
283
|
+
case "PATCH": {
|
|
284
|
+
const handler = patchResourceHandler({
|
|
285
|
+
repository,
|
|
286
|
+
validators,
|
|
287
|
+
primaryKey
|
|
288
|
+
});
|
|
289
|
+
return handler(existing, request);
|
|
290
|
+
}
|
|
291
|
+
case "DELETE": {
|
|
292
|
+
await repository.delete(itemId);
|
|
293
|
+
return (0, import_gw_response3.httpNoContent)();
|
|
294
|
+
}
|
|
295
|
+
default: {
|
|
296
|
+
return (0, import_gw_response3.httpMethodNotAllowed)();
|
|
297
|
+
}
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
300
|
}
|
|
@@ -254,30 +254,33 @@ function resourceHandler({
|
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
const pathname = new URL(request.url).pathname;
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return httpForbidden2();
|
|
265
|
-
}
|
|
266
|
-
switch (request.method) {
|
|
267
|
-
case "PATCH": {
|
|
268
|
-
const handler = patchResourceHandler({
|
|
269
|
-
repository,
|
|
270
|
-
validators,
|
|
271
|
-
primaryKey
|
|
272
|
-
});
|
|
273
|
-
return handler(existing, request);
|
|
257
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
258
|
+
if (segments.length === 3) {
|
|
259
|
+
const itemId = segments.at(-1);
|
|
260
|
+
if (itemId) {
|
|
261
|
+
const existing = await repository.find(itemId);
|
|
262
|
+
if (!existing) {
|
|
263
|
+
return httpNotFound2();
|
|
274
264
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return httpNoContent();
|
|
265
|
+
if (isOwnedBy && (!auth || !isOwnedBy(auth, existing))) {
|
|
266
|
+
return httpForbidden2();
|
|
278
267
|
}
|
|
279
|
-
|
|
280
|
-
|
|
268
|
+
switch (request.method) {
|
|
269
|
+
case "PATCH": {
|
|
270
|
+
const handler = patchResourceHandler({
|
|
271
|
+
repository,
|
|
272
|
+
validators,
|
|
273
|
+
primaryKey
|
|
274
|
+
});
|
|
275
|
+
return handler(existing, request);
|
|
276
|
+
}
|
|
277
|
+
case "DELETE": {
|
|
278
|
+
await repository.delete(itemId);
|
|
279
|
+
return httpNoContent();
|
|
280
|
+
}
|
|
281
|
+
default: {
|
|
282
|
+
return httpMethodNotAllowed();
|
|
283
|
+
}
|
|
281
284
|
}
|
|
282
285
|
}
|
|
283
286
|
}
|