coyotte508 HF staff commited on
Commit
ab600b2
1 Parent(s): 44a299a

♻️ Simplify transactions

Browse files
package.json CHANGED
@@ -33,10 +33,10 @@
33
  "prettier-plugin-svelte": "^2.9.0",
34
  "svelte": "^3.55.1",
35
  "svelte-check": "^3.0.2",
36
- "svelte-preprocess": "^5.0.1",
37
  "tinygesture": "^2.0.0",
38
  "tslib": "^2.3.1",
39
- "typescript": "^4.9.4",
40
  "unocss": "^0.48.4",
41
  "vite": "^4.0.4"
42
  },
 
33
  "prettier-plugin-svelte": "^2.9.0",
34
  "svelte": "^3.55.1",
35
  "svelte-check": "^3.0.2",
36
+ "svelte-preprocess": "^5.0.3",
37
  "tinygesture": "^2.0.0",
38
  "tslib": "^2.3.1",
39
+ "typescript": "^5.0.3",
40
  "unocss": "^0.48.4",
41
  "vite": "^4.0.4"
42
  },
pnpm-lock.yaml CHANGED
@@ -32,10 +32,10 @@ specifiers:
32
  sharp: ^0.31.2
33
  svelte: ^3.55.1
34
  svelte-check: ^3.0.2
35
- svelte-preprocess: ^5.0.1
36
  tinygesture: ^2.0.0
37
  tslib: ^2.3.1
38
- typescript: ^4.9.4
39
  unocss: ^0.48.4
40
  vite: ^4.0.4
41
 
@@ -61,8 +61,8 @@ devDependencies:
61
  '@types/lodash': 4.14.188
62
  '@types/marked': 4.0.7
63
  '@types/sharp': 0.31.0
64
- '@typescript-eslint/eslint-plugin': 5.42.0_aztydxbwb5dw26jymrshygayce
65
- '@typescript-eslint/parser': 5.42.0_v5bglvupnukcksncywgdzapdrq
66
  '@unocss/preset-icons': 0.46.3
67
  '@unocss/preset-uno': 0.46.3
68
  '@unocss/reset': 0.46.3
@@ -73,10 +73,10 @@ devDependencies:
73
  prettier-plugin-svelte: 2.9.0_kdmmghgdi3ngrsq6otxkjilbry
74
  svelte: 3.55.1
75
  svelte-check: 3.0.2_svelte@3.55.1
76
- svelte-preprocess: 5.0.1_atrrhq7vg4ekua4nnyrpuardle
77
  tinygesture: 2.0.0
78
  tslib: 2.4.1
79
- typescript: 4.9.4
80
  unocss: 0.48.4_vite@4.0.4
81
  vite: 4.0.4
82
 
@@ -1380,12 +1380,6 @@ packages:
1380
  resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
1381
  dev: true
1382
 
1383
- /@types/sass/1.43.1:
1384
- resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
1385
- dependencies:
1386
- '@types/node': 18.11.9
1387
- dev: true
1388
-
1389
  /@types/semver/7.3.13:
1390
  resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
1391
  dev: true
@@ -1407,7 +1401,7 @@ packages:
1407
  '@types/webidl-conversions': 7.0.0
1408
  dev: false
1409
 
1410
- /@typescript-eslint/eslint-plugin/5.42.0_aztydxbwb5dw26jymrshygayce:
1411
  resolution: {integrity: sha512-5TJh2AgL6+wpL8H/GTSjNb4WrjKoR2rqvFxR/DDTqYNk6uXn8BJMEcncLSpMbf/XV1aS0jAjYwn98uvVCiAywQ==}
1412
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1413
  peerDependencies:
@@ -1418,23 +1412,23 @@ packages:
1418
  typescript:
1419
  optional: true
1420
  dependencies:
1421
- '@typescript-eslint/parser': 5.42.0_v5bglvupnukcksncywgdzapdrq
1422
  '@typescript-eslint/scope-manager': 5.42.0
1423
- '@typescript-eslint/type-utils': 5.42.0_v5bglvupnukcksncywgdzapdrq
1424
- '@typescript-eslint/utils': 5.42.0_v5bglvupnukcksncywgdzapdrq
1425
  debug: 4.3.4
1426
  eslint: 8.26.0
1427
  ignore: 5.2.0
1428
  natural-compare-lite: 1.4.0
1429
  regexpp: 3.2.0
1430
  semver: 7.3.8
1431
- tsutils: 3.21.0_typescript@4.9.4
1432
- typescript: 4.9.4
1433
  transitivePeerDependencies:
1434
  - supports-color
1435
  dev: true
1436
 
1437
- /@typescript-eslint/parser/5.42.0_v5bglvupnukcksncywgdzapdrq:
1438
  resolution: {integrity: sha512-Ixh9qrOTDRctFg3yIwrLkgf33AHyEIn6lhyf5cCfwwiGtkWhNpVKlEZApi3inGQR/barWnY7qY8FbGKBO7p3JA==}
1439
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1440
  peerDependencies:
@@ -1446,10 +1440,10 @@ packages:
1446
  dependencies:
1447
  '@typescript-eslint/scope-manager': 5.42.0
1448
  '@typescript-eslint/types': 5.42.0
1449
- '@typescript-eslint/typescript-estree': 5.42.0_typescript@4.9.4
1450
  debug: 4.3.4
1451
  eslint: 8.26.0
1452
- typescript: 4.9.4
1453
  transitivePeerDependencies:
1454
  - supports-color
1455
  dev: true
@@ -1462,7 +1456,7 @@ packages:
1462
  '@typescript-eslint/visitor-keys': 5.42.0
1463
  dev: true
1464
 
1465
- /@typescript-eslint/type-utils/5.42.0_v5bglvupnukcksncywgdzapdrq:
1466
  resolution: {integrity: sha512-HW14TXC45dFVZxnVW8rnUGnvYyRC0E/vxXShFCthcC9VhVTmjqOmtqj6H5rm9Zxv+ORxKA/1aLGD7vmlLsdlOg==}
1467
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1468
  peerDependencies:
@@ -1472,12 +1466,12 @@ packages:
1472
  typescript:
1473
  optional: true
1474
  dependencies:
1475
- '@typescript-eslint/typescript-estree': 5.42.0_typescript@4.9.4
1476
- '@typescript-eslint/utils': 5.42.0_v5bglvupnukcksncywgdzapdrq
1477
  debug: 4.3.4
1478
  eslint: 8.26.0
1479
- tsutils: 3.21.0_typescript@4.9.4
1480
- typescript: 4.9.4
1481
  transitivePeerDependencies:
1482
  - supports-color
1483
  dev: true
@@ -1487,7 +1481,7 @@ packages:
1487
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1488
  dev: true
1489
 
1490
- /@typescript-eslint/typescript-estree/5.42.0_typescript@4.9.4:
1491
  resolution: {integrity: sha512-2O3vSq794x3kZGtV7i4SCWZWCwjEtkWfVqX4m5fbUBomOsEOyd6OAD1qU2lbvV5S8tgy/luJnOYluNyYVeOTTg==}
1492
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1493
  peerDependencies:
@@ -1502,13 +1496,13 @@ packages:
1502
  globby: 11.1.0
1503
  is-glob: 4.0.3
1504
  semver: 7.3.8
1505
- tsutils: 3.21.0_typescript@4.9.4
1506
- typescript: 4.9.4
1507
  transitivePeerDependencies:
1508
  - supports-color
1509
  dev: true
1510
 
1511
- /@typescript-eslint/utils/5.42.0_v5bglvupnukcksncywgdzapdrq:
1512
  resolution: {integrity: sha512-JZ++3+h1vbeG1NUECXQZE3hg0kias9kOtcQr3+JVQ3whnjvKuMyktJAAIj6743OeNPnGBmjj7KEmiDL7qsdnCQ==}
1513
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1514
  peerDependencies:
@@ -1518,7 +1512,7 @@ packages:
1518
  '@types/semver': 7.3.13
1519
  '@typescript-eslint/scope-manager': 5.42.0
1520
  '@typescript-eslint/types': 5.42.0
1521
- '@typescript-eslint/typescript-estree': 5.42.0_typescript@4.9.4
1522
  eslint: 8.26.0
1523
  eslint-scope: 5.1.1
1524
  eslint-utils: 3.0.0_eslint@8.26.0
@@ -3318,7 +3312,7 @@ packages:
3318
  picocolors: 1.0.0
3319
  sade: 1.8.1
3320
  svelte: 3.55.1
3321
- svelte-preprocess: 5.0.1_atrrhq7vg4ekua4nnyrpuardle
3322
  typescript: 4.9.4
3323
  transitivePeerDependencies:
3324
  - '@babel/core'
@@ -3341,8 +3335,8 @@ packages:
3341
  svelte: 3.55.1
3342
  dev: true
3343
 
3344
- /svelte-preprocess/5.0.1_atrrhq7vg4ekua4nnyrpuardle:
3345
- resolution: {integrity: sha512-0HXyhCoc9rsW4zGOgtInylC6qj259E1hpFnJMJWTf+aIfeqh4O/QHT31KT2hvPEqQfdjmqBR/kO2JDkkciBLrQ==}
3346
  engines: {node: '>= 14.10.0'}
3347
  requiresBuild: true
3348
  peerDependencies:
@@ -3356,7 +3350,54 @@ packages:
3356
  stylus: ^0.55.0
3357
  sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0
3358
  svelte: ^3.23.0
3359
- typescript: ^3.9.5 || ^4.0.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3360
  peerDependenciesMeta:
3361
  '@babel/core':
3362
  optional: true
@@ -3380,7 +3421,6 @@ packages:
3380
  optional: true
3381
  dependencies:
3382
  '@types/pug': 2.0.6
3383
- '@types/sass': 1.43.1
3384
  detect-indent: 6.1.0
3385
  magic-string: 0.27.0
3386
  sorcery: 0.11.0
@@ -3454,14 +3494,14 @@ packages:
3454
  /tslib/2.4.1:
3455
  resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
3456
 
3457
- /tsutils/3.21.0_typescript@4.9.4:
3458
  resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
3459
  engines: {node: '>= 6'}
3460
  peerDependencies:
3461
  typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
3462
  dependencies:
3463
  tslib: 1.14.1
3464
- typescript: 4.9.4
3465
  dev: true
3466
 
3467
  /tunnel-agent/0.6.0:
@@ -3488,6 +3528,12 @@ packages:
3488
  hasBin: true
3489
  dev: true
3490
 
 
 
 
 
 
 
3491
  /ufo/0.8.6:
3492
  resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==}
3493
  dev: true
 
32
  sharp: ^0.31.2
33
  svelte: ^3.55.1
34
  svelte-check: ^3.0.2
35
+ svelte-preprocess: ^5.0.3
36
  tinygesture: ^2.0.0
37
  tslib: ^2.3.1
38
+ typescript: ^5.0.3
39
  unocss: ^0.48.4
40
  vite: ^4.0.4
41
 
 
61
  '@types/lodash': 4.14.188
62
  '@types/marked': 4.0.7
63
  '@types/sharp': 0.31.0
64
+ '@typescript-eslint/eslint-plugin': 5.42.0_maf6oeqzrvvbbdpgg7uzhystc4
65
+ '@typescript-eslint/parser': 5.42.0_wjftjwwutwf6hy45blo2onh3s4
66
  '@unocss/preset-icons': 0.46.3
67
  '@unocss/preset-uno': 0.46.3
68
  '@unocss/reset': 0.46.3
 
73
  prettier-plugin-svelte: 2.9.0_kdmmghgdi3ngrsq6otxkjilbry
74
  svelte: 3.55.1
75
  svelte-check: 3.0.2_svelte@3.55.1
76
+ svelte-preprocess: 5.0.3_77gy2s7m5yt4ef3uq3cbqgx4fm
77
  tinygesture: 2.0.0
78
  tslib: 2.4.1
79
+ typescript: 5.0.3
80
  unocss: 0.48.4_vite@4.0.4
81
  vite: 4.0.4
82
 
 
1380
  resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
1381
  dev: true
1382
 
 
 
 
 
 
 
1383
  /@types/semver/7.3.13:
1384
  resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
1385
  dev: true
 
1401
  '@types/webidl-conversions': 7.0.0
1402
  dev: false
1403
 
1404
+ /@typescript-eslint/eslint-plugin/5.42.0_maf6oeqzrvvbbdpgg7uzhystc4:
1405
  resolution: {integrity: sha512-5TJh2AgL6+wpL8H/GTSjNb4WrjKoR2rqvFxR/DDTqYNk6uXn8BJMEcncLSpMbf/XV1aS0jAjYwn98uvVCiAywQ==}
1406
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1407
  peerDependencies:
 
1412
  typescript:
1413
  optional: true
1414
  dependencies:
1415
+ '@typescript-eslint/parser': 5.42.0_wjftjwwutwf6hy45blo2onh3s4
1416
  '@typescript-eslint/scope-manager': 5.42.0
1417
+ '@typescript-eslint/type-utils': 5.42.0_wjftjwwutwf6hy45blo2onh3s4
1418
+ '@typescript-eslint/utils': 5.42.0_wjftjwwutwf6hy45blo2onh3s4
1419
  debug: 4.3.4
1420
  eslint: 8.26.0
1421
  ignore: 5.2.0
1422
  natural-compare-lite: 1.4.0
1423
  regexpp: 3.2.0
1424
  semver: 7.3.8
1425
+ tsutils: 3.21.0_typescript@5.0.3
1426
+ typescript: 5.0.3
1427
  transitivePeerDependencies:
1428
  - supports-color
1429
  dev: true
1430
 
1431
+ /@typescript-eslint/parser/5.42.0_wjftjwwutwf6hy45blo2onh3s4:
1432
  resolution: {integrity: sha512-Ixh9qrOTDRctFg3yIwrLkgf33AHyEIn6lhyf5cCfwwiGtkWhNpVKlEZApi3inGQR/barWnY7qY8FbGKBO7p3JA==}
1433
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1434
  peerDependencies:
 
1440
  dependencies:
1441
  '@typescript-eslint/scope-manager': 5.42.0
1442
  '@typescript-eslint/types': 5.42.0
1443
+ '@typescript-eslint/typescript-estree': 5.42.0_typescript@5.0.3
1444
  debug: 4.3.4
1445
  eslint: 8.26.0
1446
+ typescript: 5.0.3
1447
  transitivePeerDependencies:
1448
  - supports-color
1449
  dev: true
 
1456
  '@typescript-eslint/visitor-keys': 5.42.0
1457
  dev: true
1458
 
1459
+ /@typescript-eslint/type-utils/5.42.0_wjftjwwutwf6hy45blo2onh3s4:
1460
  resolution: {integrity: sha512-HW14TXC45dFVZxnVW8rnUGnvYyRC0E/vxXShFCthcC9VhVTmjqOmtqj6H5rm9Zxv+ORxKA/1aLGD7vmlLsdlOg==}
1461
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1462
  peerDependencies:
 
1466
  typescript:
1467
  optional: true
1468
  dependencies:
1469
+ '@typescript-eslint/typescript-estree': 5.42.0_typescript@5.0.3
1470
+ '@typescript-eslint/utils': 5.42.0_wjftjwwutwf6hy45blo2onh3s4
1471
  debug: 4.3.4
1472
  eslint: 8.26.0
1473
+ tsutils: 3.21.0_typescript@5.0.3
1474
+ typescript: 5.0.3
1475
  transitivePeerDependencies:
1476
  - supports-color
1477
  dev: true
 
1481
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1482
  dev: true
1483
 
1484
+ /@typescript-eslint/typescript-estree/5.42.0_typescript@5.0.3:
1485
  resolution: {integrity: sha512-2O3vSq794x3kZGtV7i4SCWZWCwjEtkWfVqX4m5fbUBomOsEOyd6OAD1qU2lbvV5S8tgy/luJnOYluNyYVeOTTg==}
1486
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1487
  peerDependencies:
 
1496
  globby: 11.1.0
1497
  is-glob: 4.0.3
1498
  semver: 7.3.8
1499
+ tsutils: 3.21.0_typescript@5.0.3
1500
+ typescript: 5.0.3
1501
  transitivePeerDependencies:
1502
  - supports-color
1503
  dev: true
1504
 
1505
+ /@typescript-eslint/utils/5.42.0_wjftjwwutwf6hy45blo2onh3s4:
1506
  resolution: {integrity: sha512-JZ++3+h1vbeG1NUECXQZE3hg0kias9kOtcQr3+JVQ3whnjvKuMyktJAAIj6743OeNPnGBmjj7KEmiDL7qsdnCQ==}
1507
  engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
1508
  peerDependencies:
 
1512
  '@types/semver': 7.3.13
1513
  '@typescript-eslint/scope-manager': 5.42.0
1514
  '@typescript-eslint/types': 5.42.0
1515
+ '@typescript-eslint/typescript-estree': 5.42.0_typescript@5.0.3
1516
  eslint: 8.26.0
1517
  eslint-scope: 5.1.1
1518
  eslint-utils: 3.0.0_eslint@8.26.0
 
3312
  picocolors: 1.0.0
3313
  sade: 1.8.1
3314
  svelte: 3.55.1
3315
+ svelte-preprocess: 5.0.3_atrrhq7vg4ekua4nnyrpuardle
3316
  typescript: 4.9.4
3317
  transitivePeerDependencies:
3318
  - '@babel/core'
 
3335
  svelte: 3.55.1
3336
  dev: true
3337
 
3338
+ /svelte-preprocess/5.0.3_77gy2s7m5yt4ef3uq3cbqgx4fm:
3339
+ resolution: {integrity: sha512-GrHF1rusdJVbOZOwgPWtpqmaexkydznKzy5qIC2FabgpFyKN57bjMUUUqPRfbBXK5igiEWn1uO/DXsa2vJ5VHA==}
3340
  engines: {node: '>= 14.10.0'}
3341
  requiresBuild: true
3342
  peerDependencies:
 
3350
  stylus: ^0.55.0
3351
  sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0
3352
  svelte: ^3.23.0
3353
+ typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0'
3354
+ peerDependenciesMeta:
3355
+ '@babel/core':
3356
+ optional: true
3357
+ coffeescript:
3358
+ optional: true
3359
+ less:
3360
+ optional: true
3361
+ postcss:
3362
+ optional: true
3363
+ postcss-load-config:
3364
+ optional: true
3365
+ pug:
3366
+ optional: true
3367
+ sass:
3368
+ optional: true
3369
+ stylus:
3370
+ optional: true
3371
+ sugarss:
3372
+ optional: true
3373
+ typescript:
3374
+ optional: true
3375
+ dependencies:
3376
+ '@types/pug': 2.0.6
3377
+ detect-indent: 6.1.0
3378
+ magic-string: 0.27.0
3379
+ sorcery: 0.11.0
3380
+ strip-indent: 3.0.0
3381
+ svelte: 3.55.1
3382
+ typescript: 5.0.3
3383
+ dev: true
3384
+
3385
+ /svelte-preprocess/5.0.3_atrrhq7vg4ekua4nnyrpuardle:
3386
+ resolution: {integrity: sha512-GrHF1rusdJVbOZOwgPWtpqmaexkydznKzy5qIC2FabgpFyKN57bjMUUUqPRfbBXK5igiEWn1uO/DXsa2vJ5VHA==}
3387
+ engines: {node: '>= 14.10.0'}
3388
+ requiresBuild: true
3389
+ peerDependencies:
3390
+ '@babel/core': ^7.10.2
3391
+ coffeescript: ^2.5.1
3392
+ less: ^3.11.3 || ^4.0.0
3393
+ postcss: ^7 || ^8
3394
+ postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0
3395
+ pug: ^3.0.0
3396
+ sass: ^1.26.8
3397
+ stylus: ^0.55.0
3398
+ sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0
3399
+ svelte: ^3.23.0
3400
+ typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0'
3401
  peerDependenciesMeta:
3402
  '@babel/core':
3403
  optional: true
 
3421
  optional: true
3422
  dependencies:
3423
  '@types/pug': 2.0.6
 
3424
  detect-indent: 6.1.0
3425
  magic-string: 0.27.0
3426
  sorcery: 0.11.0
 
3494
  /tslib/2.4.1:
3495
  resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
3496
 
3497
+ /tsutils/3.21.0_typescript@5.0.3:
3498
  resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
3499
  engines: {node: '>= 6'}
3500
  peerDependencies:
3501
  typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
3502
  dependencies:
3503
  tslib: 1.14.1
3504
+ typescript: 5.0.3
3505
  dev: true
3506
 
3507
  /tunnel-agent/0.6.0:
 
3528
  hasBin: true
3529
  dev: true
3530
 
3531
+ /typescript/5.0.3:
3532
+ resolution: {integrity: sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==}
3533
+ engines: {node: '>=12.20'}
3534
+ hasBin: true
3535
+ dev: true
3536
+
3537
  /ufo/0.8.6:
3538
  resolution: {integrity: sha512-fk6CmUgwKCfX79EzcDQQpSCMxrHstvbLswFChHS0Vump+kFkw7nJBfTZoC1j0bOGoY9I7R3n2DGek5ajbcYnOw==}
3539
  dev: true
src/lib/server/db/index.ts CHANGED
@@ -1,5 +1,5 @@
1
  import { MONGODB_URL } from '$env/static/private';
2
- import { MongoClient } from 'mongodb';
3
  import { createPageCollection } from './page';
4
  import { createPictureCollections } from './picture';
5
  import { createProductCollection } from './product';
@@ -20,3 +20,7 @@ const { pictures, picturesFs } = createPictureCollections(db);
20
 
21
  export { client, db };
22
  export const collections = { products, pictures, pages, users, picturesFs };
 
 
 
 
 
1
  import { MONGODB_URL } from '$env/static/private';
2
+ import { MongoClient, type WithSessionCallback } from 'mongodb';
3
  import { createPageCollection } from './page';
4
  import { createPictureCollections } from './picture';
5
  import { createProductCollection } from './product';
 
20
 
21
  export { client, db };
22
  export const collections = { products, pictures, pages, users, picturesFs };
23
+
24
+ export async function withTransaction(cb: WithSessionCallback) {
25
+ await client.withSession((session) => session.withTransaction(cb));
26
+ }
src/lib/server/photo.ts CHANGED
@@ -1,5 +1,5 @@
1
  import sharp from 'sharp';
2
- import { client, collections } from '$lib/server/db';
3
  import { generateId } from '$lib/utils/generateId';
4
  import type { ClientSession } from 'mongodb';
5
  import { error } from '@sveltejs/kit';
@@ -44,43 +44,40 @@ export async function generatePicture(
44
 
45
  const _id = generateId(name);
46
 
47
- await client.withSession(
48
- async (session) =>
49
- await session.withTransaction(async (session) => {
50
- await collections.pictures.insertOne(
51
- {
52
- _id,
53
- name,
54
- storage: formats.map((format) => ({
55
- _id: `${_id}-${format.width}x${format.height}`,
56
- width: format.width,
57
- height: format.height,
58
- size: format.data.length
59
- })),
60
- ...(opts?.productId && { productId: opts.productId }),
61
- createdAt: new Date(),
62
- updatedAt: new Date()
63
- },
64
- { session }
65
- );
66
 
67
- await collections.picturesFs.insertMany(
68
- formats.map(
69
- (format) => ({
70
- _id: `${_id}-${format.width}x${format.height}`,
71
- createdAt: new Date(),
72
- updatedAt: new Date(),
73
- size: format.data.length,
74
- data: format.data,
75
- picture: _id
76
- }),
77
- { session }
78
- )
79
- );
80
 
81
- if (opts?.cb) {
82
- await opts.cb(session);
83
- }
84
- })
85
- );
86
  }
 
1
  import sharp from 'sharp';
2
+ import { collections, withTransaction } from '$lib/server/db';
3
  import { generateId } from '$lib/utils/generateId';
4
  import type { ClientSession } from 'mongodb';
5
  import { error } from '@sveltejs/kit';
 
44
 
45
  const _id = generateId(name);
46
 
47
+ await withTransaction(async (session) => {
48
+ await collections.pictures.insertOne(
49
+ {
50
+ _id,
51
+ name,
52
+ storage: formats.map((format) => ({
53
+ _id: `${_id}-${format.width}x${format.height}`,
54
+ width: format.width,
55
+ height: format.height,
56
+ size: format.data.length
57
+ })),
58
+ ...(opts?.productId && { productId: opts.productId }),
59
+ createdAt: new Date(),
60
+ updatedAt: new Date()
61
+ },
62
+ { session }
63
+ );
 
 
64
 
65
+ await collections.picturesFs.insertMany(
66
+ formats.map(
67
+ (format) => ({
68
+ _id: `${_id}-${format.width}x${format.height}`,
69
+ createdAt: new Date(),
70
+ updatedAt: new Date(),
71
+ size: format.data.length,
72
+ data: format.data,
73
+ picture: _id
74
+ }),
75
+ { session }
76
+ )
77
+ );
78
 
79
+ if (opts?.cb) {
80
+ await opts.cb(session);
81
+ }
82
+ });
 
83
  }
src/routes/admin/photos/[id]/+page.server.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { Picture } from '$lib/types/Picture';
2
- import { client, collections } from '$lib/server/db';
3
  import { error, redirect } from '@sveltejs/kit';
4
  import type { PageServerLoad, Actions } from './$types';
5
 
@@ -31,16 +30,17 @@ export const actions: Actions = {
31
  return {};
32
  },
33
  delete: async function ({ params }) {
34
- let picture: Picture | null = null;
35
-
36
- await client.withSession(
37
- async (session) =>
38
- await session.withTransaction(async (session) => {
39
- picture = (await collections.pictures.findOneAndDelete({ _id: params.id }, { session }))
40
- .value;
41
- await collections.picturesFs.deleteMany({ picture: params.id }, { session });
42
- })
43
- );
 
44
 
45
  if (!picture) {
46
  throw error(404);
 
1
+ import { collections, withTransaction } from '$lib/server/db';
 
2
  import { error, redirect } from '@sveltejs/kit';
3
  import type { PageServerLoad, Actions } from './$types';
4
 
 
30
  return {};
31
  },
32
  delete: async function ({ params }) {
33
+ const picture = await collections.pictures.findOne({ _id: params.id });
34
+
35
+ await withTransaction(async (session) => {
36
+ const res = await collections.pictures.deleteOne({ _id: params.id }, { session });
37
+
38
+ if (!res.deletedCount) {
39
+ throw new Error('Conflict during picture deletion');
40
+ }
41
+
42
+ await collections.picturesFs.deleteMany({ picture: params.id }, { session });
43
+ });
44
 
45
  if (!picture) {
46
  throw error(404);
src/routes/admin/produits/[id]/+page.server.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { client, collections } from '$lib/server/db';
2
  import type { Product } from '$lib/types/Product';
3
  import { error, redirect } from '@sveltejs/kit';
4
  import type { Actions, PageServerLoad } from './$types';
@@ -51,31 +51,28 @@ export const actions: Actions = {
51
  },
52
 
53
  delete: async ({ params }) => {
54
- await client.withSession(
55
- async (session) =>
56
- await session.withTransaction(async (session) => {
57
- const product = await collections.products.findOneAndDelete({ _id: params.id });
58
 
59
- if (!product.value) {
60
- throw error(404);
61
- }
62
 
63
- const pictures = await collections.pictures
64
- .find({ productId: params.id }, { session })
65
- .toArray();
66
 
67
- await collections.pictures.deleteMany(
68
- { _id: { $in: pictures.map((p) => p._id) } },
69
- { session }
70
- );
71
- await collections.picturesFs.deleteMany(
72
- {
73
- _id: { $in: pictures.flatMap((p) => p.storage.map((s) => s._id)) }
74
- },
75
- { session }
76
- );
77
- })
78
- );
79
 
80
  throw redirect(303, '/admin/produits');
81
  }
 
1
+ import { client, collections, withTransaction } from '$lib/server/db';
2
  import type { Product } from '$lib/types/Product';
3
  import { error, redirect } from '@sveltejs/kit';
4
  import type { Actions, PageServerLoad } from './$types';
 
51
  },
52
 
53
  delete: async ({ params }) => {
54
+ await withTransaction(async (session) => {
55
+ const product = await collections.products.findOneAndDelete({ _id: params.id });
 
 
56
 
57
+ if (!product.value) {
58
+ throw error(404);
59
+ }
60
 
61
+ const pictures = await collections.pictures
62
+ .find({ productId: params.id }, { session })
63
+ .toArray();
64
 
65
+ await collections.pictures.deleteMany(
66
+ { _id: { $in: pictures.map((p) => p._id) } },
67
+ { session }
68
+ );
69
+ await collections.picturesFs.deleteMany(
70
+ {
71
+ _id: { $in: pictures.flatMap((p) => p.storage.map((s) => s._id)) }
72
+ },
73
+ { session }
74
+ );
75
+ });
 
76
 
77
  throw redirect(303, '/admin/produits');
78
  }