@balena/open-balena-api 38.0.0-build-enum-fields-13a401c1cff5edfc27c31beeb2e08389ad2623c5-1 → 38.0.0-build-Limit-size-ofl-arge-fields-3a101838568f7ce669c484581668e2e59fbeb045-1

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/balena.sbvr CHANGED
@@ -41,6 +41,7 @@ Term: user
41
41
  Concept Type: actor
42
42
  Fact type: user has username
43
43
  Necessity: Each user has exactly one username.
44
+ Necessity: Each user has a username that has a Length (Type) that is less than or equal to 73.
44
45
  Necessity: Each username is of exactly one user.
45
46
  Fact type: user has password
46
47
  Necessity: Each user has at most one password.
@@ -69,8 +70,12 @@ Fact type: api key is of actor
69
70
  Necessity: each api key is of exactly one actor
70
71
  Fact type: api key has name
71
72
  Necessity: Each api key has at most one name.
73
+ -- TODO: Pitch cleanup and reduce to 50
74
+ Necessity: each api key that has a name, has a name that has a Length (Type) that is less than or equal to 1564.
72
75
  Fact type: api key has description
73
76
  Necessity: Each api key has at most one description.
77
+ -- TODO: Pitch cleanup and reduce to 150
78
+ Necessity: each api key that has a description, has a description that has a Length (Type) that is less than or equal to 1244.
74
79
 
75
80
 
76
81
  Vocabulary: balena
@@ -353,6 +358,7 @@ Term: application
353
358
  Fact type: application has service name
354
359
  Term Form: service
355
360
  Database Table Name: service
361
+ Necessity: each service has a service name that has a Length (Type) that is greater than 0 and is less than or equal to 63.
356
362
 
357
363
  Fact type: service has label name
358
364
  Term Form: service label
@@ -365,7 +371,7 @@ Term: application
365
371
  Fact type: application has tag key
366
372
  Term Form: application tag
367
373
  Database Table Name: application tag
368
- Necessity: each application tag has a tag key that has a Length (Type) that is greater than 0.
374
+ Necessity: each application tag has a tag key that has a Length (Type) that is greater than 0 and is less than or equal to 100.
369
375
 
370
376
  Term: device
371
377
  Concept Type: actor (Auth)
@@ -402,14 +408,15 @@ Term: device
402
408
  Fact type: device has tag key
403
409
  Term Form: device tag
404
410
  Database Table Name: device tag
405
- Necessity: each device tag has a tag key that has a Length (Type) that is greater than 0.
411
+ Necessity: each device tag has a tag key that has a Length (Type) that is greater than 0 and is less than or equal to 100.
406
412
 
407
413
  Term: release
408
414
 
409
415
  Fact type: release has tag key
410
416
  Term Form: release tag
411
417
  Database Table Name: release tag
412
- Necessity: each release tag has a tag key that has a Length (Type) that is greater than 0.
418
+ -- TODO: Pitch cleanup and reduce to 100
419
+ Necessity: each release tag has a tag key that has a Length (Type) that is greater than 0 and is less than or equal to 164.
413
420
 
414
421
  Fact type: image is part of release
415
422
  Synonymous Form: release contains image
@@ -433,46 +440,54 @@ Fact type: user (Auth) is member of organization
433
440
 
434
441
  Fact type: organization has name (Auth)
435
442
  Necessity: each organization has exactly one name (Auth).
436
- Necessity: each name (Auth) of an organization, has a Length (Type) that is greater than 0.
443
+ -- TODO: Pitch cleanup and reduce to 100
444
+ Necessity: each name (Auth) of an organization, has a Length (Type) that is greater than 0 and is less than or equal to 220.
437
445
  Fact type: organization has handle
438
446
  Necessity: each organization has exactly one handle.
439
447
  Necessity: each handle is of exactly one organization.
440
- Necessity: each handle of an organization, has a Length (Type) that is greater than 0.
448
+ -- TODO: Pitch cleanup and reduce to 100
449
+ Necessity: each handle of an organization, has a Length (Type) that is greater than 0 and is less than or equal to 220.
441
450
 
442
451
 
443
452
  -- user
444
453
 
445
454
  Fact type: user (Auth) has email
446
455
  Necessity: each user (Auth) has at most one email.
447
- Necessity: each user (Auth) that has an email, has an email that has a Length (Type) that is greater than 4.
456
+ Necessity: each user (Auth) that has an email, has an email that has a Length (Type) that is greater than 4 and is less than or equal to 254.
448
457
  Necessity: each email is of exactly one user (Auth).
449
458
 
450
459
  Fact type: user (Auth) has public key
451
460
  Term Form: user public key
461
+ Necessity: each user public key has a public key that has a Length (Type) that is less than or equal to 2850.
452
462
 
453
463
 
454
464
  -- user public key
455
465
 
456
466
  Fact type: user public key has title
457
467
  Necessity: each user public key has exactly one title
468
+ Necessity: each user public key has a title that has a Length (Type) that is less than or equal to 120.
458
469
 
459
470
 
460
471
  -- application type
461
472
 
462
473
  Fact type: application type has name (Auth)
463
474
  Necessity: each application type has exactly one name (Auth)
475
+ Necessity: each application type has a name (Auth) that has a Length (Type) that is less than or equal to 20.
464
476
  Fact type: application type supports web url
465
477
  Fact type: application type supports multicontainer
466
478
  Fact type: application type supports gateway mode
467
479
  Fact type: application type needs os version range
468
480
  Necessity: each application type needs at most one os version range
481
+ Necessity: each application type that needs an os version range, needs an os version range that has a Length (Type) that is less than or equal to 50.
469
482
  Fact type: application type requires payment
470
483
  Fact type: application type is legacy
471
484
  Fact type: application type has slug
472
485
  Necessity: each application type has exactly one slug
486
+ Necessity: each application type has a slug that has a Length (Type) that is less than or equal to 30.
473
487
  Necessity: each slug is of exactly one application type
474
488
  Fact type: application type has description (Auth)
475
489
  Necessity: each application type has at most one description (Auth).
490
+ Necessity: each application type that has a description (Auth), has a description (Auth) that has a Length (Type) that is less than or equal to 200.
476
491
  Fact type: application type has maximum device count
477
492
  Necessity: each application type has at most one maximum device count
478
493
 
@@ -488,6 +503,8 @@ Fact type: application has app name
488
503
  Fact type: application has slug
489
504
  Necessity: each application has exactly one slug
490
505
  Necessity: each slug is of exactly one application
506
+ -- handle size [1, 220] + '/' + name size [4, 100] => total slug size [6, 321]
507
+ Necessity: each application has a slug that has a Length (Type) that is greater than or equal to 6 and is less than or equal to 321.
491
508
  Fact type: application is for device type
492
509
  Synonymous Form: device type is default for application
493
510
  Necessity: each application is for exactly one device type
@@ -511,8 +528,7 @@ Fact type: service instance has service type
511
528
  Definition: "vpn"
512
529
  Fact type: service instance has ip address
513
530
  Necessity: each service instance has exactly one ip address.
514
- -- TODO: Reduce to 39 in a follow-up major
515
- Necessity: each service instance has an ip address that has a Length (Type) that is less than or equal to 255.
531
+ Necessity: each service instance has an ip address that has a Length (Type) that is less than or equal to 39.
516
532
  Fact type: service instance has last heartbeat
517
533
  Necessity: each service instance has exactly one last heartbeat.
518
534
 
@@ -522,12 +538,16 @@ Fact type: service instance has last heartbeat
522
538
  Fact type: device has uuid
523
539
  Necessity: each device has exactly one uuid.
524
540
  Necessity: each uuid is of exactly one device.
541
+ -- We enforce uuids to be 32 or 62 using a hook b/c of pre-existing data
542
+ Necessity: each device has a uuid that has a Length (Type) that is less than or equal to 62.
525
543
  Fact type: device has local id
526
544
  Necessity: each device has at most one local id.
527
545
  Fact type: device has device name
528
546
  Necessity: each device has exactly one device name.
529
547
  Fact type: device has note
530
548
  Necessity: each device has at most one note.
549
+ -- 1MB
550
+ Necessity: each device that has a note, has a note that has a Length (Type) that is less than or equal to 1000000.
531
551
  Fact type: device is of device type
532
552
  Synonymous Form: device type describes device
533
553
  Necessity: each device is of exactly one device type.
@@ -544,6 +564,7 @@ Fact type: device is locked until date
544
564
  Necessity: each device is locked until at most one date.
545
565
  Fact type: device has public address
546
566
  Necessity: each device has at most one public address
567
+ Necessity: each device that has a public address, has a public address that has a Length (Type) that is less than or equal to 50.
547
568
  Fact type: device has ip address
548
569
  Necessity: each device has at most one ip address
549
570
  -- Enough to fit 50 IPv6 addresses (39 chars long) space delimited
@@ -577,13 +598,17 @@ Fact type: device has download progress
577
598
  Necessity: each device has at most one download progress.
578
599
  Fact type: device has status
579
600
  Necessity: each device has at most one status.
601
+ -- TODO: Pitch changing this to an ENUM
602
+ Necessity: each device that has a status, has a status that has a Length (Type) that is less than or equal to 50.
580
603
  Fact type: device has os version
581
604
  Necessity: each device has at most one os version
605
+ Necessity: each device that has an os version, has an os version that has a Length (Type) that is less than or equal to 70.
582
606
  Fact type: device has os variant
583
607
  Necessity: each device has at most one os variant
584
608
  Definition: "prod" or "dev"
585
609
  Fact type: device has supervisor version
586
610
  Necessity: each device has at most one supervisor version
611
+ Necessity: each device that has a supervisor version, has a supervisor version that has a Length (Type) that is less than or equal to 20.
587
612
  Fact type: device has provisioning progress
588
613
  Necessity: each device has at most one provisioning progress
589
614
  Fact type: device has provisioning state
@@ -592,6 +617,7 @@ Fact type: device has api port
592
617
  Necessity: each device has at most one api port
593
618
  Fact type: device has api secret
594
619
  Necessity: each device has at most one api secret
620
+ Necessity: each device that has an api secret, has an api secret that has a Length (Type) that is less than or equal to 64.
595
621
  Fact type: device is managed by service instance
596
622
  Synonymous Form: service instance manages device
597
623
  Necessity: each device is managed by at most one service instance
@@ -619,12 +645,16 @@ Fact type: device has last update status event
619
645
 
620
646
  Fact type: application config variable has value
621
647
  Necessity: each application config variable has exactly one value.
648
+ -- TODO: Pitch cleanup and reduce to 100KB
649
+ Necessity: each application config variable has a value that has a Length (Type) that is less than or equal to 492001.
622
650
 
623
651
 
624
652
  -- device config variable
625
653
 
626
654
  Fact type: device config variable has value
627
655
  Necessity: each device config variable has exactly one value.
656
+ -- TODO: Pitch cleanup and reduce to 100KB
657
+ Necessity: each device config variable has a value that has a Length (Type) that is less than or equal to 372340.
628
658
 
629
659
  -- device type
630
660
 
@@ -642,6 +672,8 @@ Fact type: device type is of cpu architecture
642
672
 
643
673
  Fact type: device type has logo
644
674
  Necessity: each device type has at most one logo
675
+ -- 300KB in base64
676
+ Necessity: each device type that has a logo, has a logo that has a Length (Type) that is less than or equal to 400000.
645
677
 
646
678
  Fact type: device type has contract
647
679
  Necessity: each device type has at most one contract
@@ -667,17 +699,21 @@ Fact type: cpu architecture has slug
667
699
 
668
700
  Fact type: device manufacturer has slug
669
701
  Necessity: each device manufacturer has exactly one slug
702
+ Necessity: each device manufacturer has a slug that has a Length (Type) that is less than or equal to 50.
670
703
  Necessity: each slug is of exactly one device manufacturer
671
704
  Fact type: device manufacturer has name (Auth)
672
705
  Necessity: each device manufacturer has exactly one name (Auth)
706
+ Necessity: each device manufacturer has a name (Auth) that has a Length (Type) that is less than or equal to 100.
673
707
 
674
708
  -- device family
675
709
 
676
710
  Fact type: device family has slug
677
711
  Necessity: each device family has exactly one slug
712
+ Necessity: each device family has a slug that has a Length (Type) that is less than or equal to 50.
678
713
  Necessity: each slug is of exactly one device family
679
714
  Fact type: device family has name (Auth)
680
715
  Necessity: each device family has exactly one name (Auth)
716
+ Necessity: each device family has a name (Auth) that has a Length (Type) that is less than or equal to 50.
681
717
  Fact type: device family is manufactured by device manufacturer
682
718
  Synonymous Form: device manufacturer manufactures device family
683
719
  Necessity: each device family is manufactured by at most one device manufacturer
@@ -690,6 +726,7 @@ Fact type: release belongs to application
690
726
  Necessity: each release belongs to exactly one application.
691
727
  Fact type: release has commit
692
728
  Necessity: each release has exactly one commit.
729
+ Necessity: each release has a commit that has a Length (Type) that is less than or equal to 40.
693
730
  Fact type: release has composition
694
731
  Necessity: each release has exactly one composition.
695
732
  Fact type: release has status
@@ -701,6 +738,8 @@ Fact type: release has source
701
738
  Definition: "cloud" or "local"
702
739
  Fact type: release has build log
703
740
  Necessity: each release has at most one build log.
741
+ -- 1MB
742
+ Necessity: each release that has a build log, has a build log that has a Length (Type) that is less than or equal to 1000000.
704
743
  Fact type: release is invalidated
705
744
  Fact type: release has start timestamp
706
745
  Necessity: each release has exactly one start timestamp.
@@ -710,6 +749,7 @@ Fact type: release has update timestamp
710
749
  Necessity: each release has exactly one update timestamp.
711
750
  Fact type: release has release version
712
751
  Necessity: each release has at most one release version
752
+ Necessity: each release that has a release version, has a release version that has a Length (Type) that is less than or equal to 81.
713
753
  Note: Deprecated.
714
754
  Fact type: release has contract
715
755
  Necessity: each release has at most one contract
@@ -727,19 +767,26 @@ Fact type: release has semver patch
727
767
  Necessity: each release has exactly one semver patch.
728
768
  Fact type: release has semver prerelease
729
769
  Necessity: each release has exactly one semver prerelease.
770
+ Necessity: each release has a semver prerelease that has a Length (Type) that is less than or equal to 100.
730
771
  Fact type: release has semver build
731
772
  Necessity: each release has exactly one semver build.
773
+ Necessity: each release has a semver build that has a Length (Type) that is less than or equal to 50.
732
774
  Fact type: release has variant
733
775
  Necessity: each release has exactly one variant.
776
+ Necessity: each release has a variant that has a Length (Type) that is less than or equal to 50.
734
777
  Fact type: release has revision
735
778
  Necessity: each release has at most one revision.
736
779
  Necessity: each release that has a revision, has a revision that is greater than or equal to 0.
737
780
  Fact type: release has known issue list
738
781
  Necessity: each release has at most one known issue list.
782
+ Necessity: each release that has a known issue list, has a known issue list that has a Length (Type) that is less than or equal to 1000.
739
783
  Fact type: release has note
740
784
  Necessity: each release has at most one note.
785
+ -- 1MB
786
+ Necessity: each release that has a note, has a note that has a Length (Type) that is less than or equal to 1000000.
741
787
  Fact type: release has invalidation reason
742
788
  Necessity: each release has at most one invalidation reason.
789
+ Necessity: each release that has an invalidation reason, has an invalidation reason that has a Length (Type) that is less than or equal to 255.
743
790
  Necessity: each release that has an invalidation reason, is invalidated.
744
791
  Fact type: release has asset key
745
792
  Term Form: release asset
@@ -755,6 +802,8 @@ Fact type: release asset has asset
755
802
 
756
803
  Fact type: service environment variable has value
757
804
  Necessity: each service environment variable has exactly one value.
805
+ -- 100KB
806
+ Necessity: each service environment variable has a value that has a Length (Type) that is less than or equal to 100000.
758
807
 
759
808
 
760
809
  -- image
@@ -765,6 +814,8 @@ Fact type: image has end timestamp
765
814
  Necessity: each image has at most one end timestamp.
766
815
  Fact type: image has dockerfile
767
816
  Necessity: each image has at most one dockerfile.
817
+ -- 1MB
818
+ Necessity: each image that has a dockerfile, has a dockerfile that has a Length (Type) that is less than or equal to 1000000.
768
819
  Fact type: image is a build of service
769
820
  Synonymous Form: service is built by image
770
821
  Necessity: each image is a build of exactly one service.
@@ -780,8 +831,12 @@ Fact type: image has project type
780
831
  Definition: "Standard Dockerfile" or "project type unavailable" or "NodeJS" or "node.js" or "local deploy" or "external service" or "Dockerfile.template" or "dockerfile template" or "dockerfile" or "Could not be detected" or "Architecture-specific Dockerfile" or "Archicture-specific Dockerfile"
781
832
  Fact type: image has error message
782
833
  Necessity: each image has at most one error message
834
+ -- 300KB
835
+ Necessity: each image that has an error message, has an error message that has a Length (Type) that is less than or equal to 300000.
783
836
  Fact type: image has build log
784
837
  Necessity: each image has at most one build log.
838
+ -- 1.5MB
839
+ Necessity: each image that has a build log, has a build log that has a Length (Type) that is less than or equal to 1500000.
785
840
  Fact type: image has push timestamp
786
841
  Necessity: each image has at most one push timestamp.
787
842
  Fact type: image has status
@@ -789,6 +844,8 @@ Fact type: image has status
789
844
  Definition: "running" or "success" or "failed" or "error" or "cancelled" or "interrupted"
790
845
  Fact type: image has content hash
791
846
  Necessity: each image has at most one content hash.
847
+ -- TODO: Pitch cleanup and change to exactly equal 71
848
+ Necessity: each image that has a content hash, has a content hash that has a Length (Type) that is less than or equal to 71.
792
849
  Fact type: image has contract
793
850
  Necessity: each image has at most one contract
794
851
 
@@ -797,36 +854,48 @@ Fact type: image has contract
797
854
 
798
855
  Fact type: image label has value
799
856
  Necessity: each image label has exactly one value.
857
+ -- TODO: Pitch cleanup and reduce to 255
858
+ Necessity: each image label has a value that has a Length (Type) that is less than or equal to 300.
800
859
 
801
860
 
802
861
  -- service label
803
862
 
804
863
  Fact type: service label has value
805
864
  Necessity: each service label has exactly one value.
865
+ -- TODO: Pitch cleanup and reduce to 255
866
+ Necessity: each service label has a value that has a Length (Type) that is less than or equal to 300.
806
867
 
807
868
 
808
869
  -- device environment variable
809
870
 
810
871
  Fact type: device environment variable has value
811
872
  Necessity: each device environment variable has exactly one value.
873
+ -- TODO: Pitch cleanup and reduce to 100KB
874
+ Necessity: each device environment variable has a value that has a Length (Type) that is less than or equal to 515798.
812
875
 
813
876
 
814
877
  -- application environment variable
815
878
 
816
879
  Fact type: application environment variable has value
817
880
  Necessity: each application environment variable has exactly one value.
881
+ -- TODO: Pitch cleanup and reduce to 100KB
882
+ Necessity: each application environment variable has a value that has a Length (Type) that is less than or equal to 106104.
818
883
 
819
884
 
820
885
  -- image environment variable
821
886
 
822
887
  Fact type: image environment variable has value
823
888
  Necessity: each image environment variable has exactly one value.
889
+ -- 100KB
890
+ Necessity: each image environment variable has a value that has a Length (Type) that is less than or equal to 100000.
824
891
 
825
892
 
826
893
  -- device service environment variable
827
894
 
828
895
  Fact type: device service environment variable has value
829
896
  Necessity: each device service environment variable has exactly one value.
897
+ -- TODO: Pitch cleanup and reduce to 100KB
898
+ Necessity: each device service environment variable has a value that has a Length (Type) that is less than or equal to 278379.
830
899
  Fact type: device service environment variable has service install
831
900
  Necessity: each device service environment variable has exactly one service install.
832
901
 
@@ -835,18 +904,24 @@ Fact type: device service environment variable has service install
835
904
 
836
905
  Fact type: application tag has value
837
906
  Necessity: each application tag has exactly one value.
907
+ -- 1KB
908
+ Necessity: each application tag has a value that has a Length (Type) that is greater than 0 and is less than or equal to 1000.
838
909
 
839
910
 
840
911
  -- device tag
841
912
 
842
913
  Fact type: device tag has value
843
914
  Necessity: each device tag has exactly one value.
915
+ -- TODO: Pitch cleanup and reduce to 10KB
916
+ Necessity: each device tag has a value that has a Length (Type) that is greater than 0 and is less than or equal to 60158.
844
917
 
845
918
 
846
919
  -- release tag
847
920
 
848
921
  Fact type: release tag has value
849
922
  Necessity: each release tag has exactly one value.
923
+ -- 1KB
924
+ Necessity: each release tag has a value that has a Length (Type) that is greater than 0 and is less than or equal to 1000.
850
925
 
851
926
 
852
927
  -- image install
@@ -3,7 +3,7 @@ import type { StatePatchV2Body } from './routes/state-patch-v2.js';
3
3
  import type { sbvrUtils } from '@balena/pinejs';
4
4
  export declare const v3ValidPatchFields: ("status" | "is_online" | "ip_address" | "mac_address" | "is_undervolted" | "cpu_id" | "os_version" | "os_variant" | "supervisor_version" | "provisioning_progress" | "provisioning_state" | "api_port" | "api_secret" | "update_status")[];
5
5
  export declare const v2ValidPatchFields: Array<Exclude<keyof NonNullable<StatePatchV2Body['local']>, 'apps'>>;
6
- declare const constrainedDeviceTextFields: (["ip_address", number, string] | ["mac_address", number, string])[];
6
+ declare const constrainedDeviceTextFields: (["status", number, null] | ["os_version", number, null] | ["supervisor_version", number, null] | ["api_secret", number, null] | ["ip_address", number, string] | ["mac_address", number, string] | ["note", number, null])[];
7
7
  export declare function truncateConstrainedDeviceFields<T extends Partial<Pick<Device['Write'], (typeof constrainedDeviceTextFields)[number][0]>>>(object: T, deviceId: number): T;
8
8
  export declare function normalizeStatePatchDeviceBody<T extends {
9
9
  os_variant?: string;
@@ -39,8 +39,13 @@ const truncateText = (longText, length, delimiter) => {
39
39
  .trim();
40
40
  };
41
41
  const constrainedDeviceTextFields = [
42
+ ['status', 50, null],
43
+ ['os_version', 70, null],
44
+ ['supervisor_version', 20, null],
45
+ ['api_secret', 64, null],
42
46
  ['ip_address', 2000, ADDRESS_DELIMITER],
43
47
  ['mac_address', 900, ADDRESS_DELIMITER],
48
+ ['note', 1_000_000, null],
44
49
  ];
45
50
  export function truncateConstrainedDeviceFields(object, deviceId) {
46
51
  for (const [key, maxLength, delimiter] of constrainedDeviceTextFields) {
@@ -1 +1 @@
1
- {"version":3,"file":"state-patch-utils.js","sourceRoot":"","sources":["../../../src/features/device-state/state-patch-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,6CAA6C,EAC7C,mCAAmC,EACnC,yBAAyB,EACzB,mCAAmC,GACnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,gBAAgB;IAChB,eAAe;CAGf,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAE3B;IACH,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,eAAe,CAAC;IAC1D,aAAa;IACb,MAAM;IACN,mBAAmB;CACnB,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,sDAAsD;AACtD,MAAM,YAAY,GAAG,CACp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CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,SAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IACrE,MAAM,MAAM,GAAiC;QAC5C,MAAM,EAAE,QAAQ;KAChB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,MAAM,OAAO,CAAC,KAAK,CAAC;QACnB,QAAQ,EAAE,eAAe;QACzB,IAAI;QACJ,OAAO,EAAE;YACR,OAAO,EAAE,MAAM;SACf;KACD,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"state-patch-utils.js","sourceRoot":"","sources":["../../../src/features/device-state/state-patch-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,6CAA6C,EAC7C,mCAAmC,EACnC,yBAAyB,EACzB,mCAAmC,GACnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,gBAAgB;IAChB,eAAe;CAGf,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAE3B;IACH,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EA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AAE,UAAU,CAAC,EAAE;gBACjB,IAAI;gBACJ,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,IAAI,EAAE,IAAI;qBACV;iBACD;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAC1C,QAAoC,EACpC,QAAgB,EAChB,QAAkB,EACF,EAAE;IAClB,qEAAqE;IACrE,6BAA6B;IAC7B,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC9B,WAAW,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,IAAI,EAAE;KACtC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,SAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;IACrE,MAAM,MAAM,GAAiC;QAC5C,MAAM,EAAE,QAAQ;KAChB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,MAAM,OAAO,CAAC,KAAK,CAAC;QACnB,QAAQ,EAAE,eAAe;QACzB,IAAI;QACJ,OAAO,EAAE;YACR,OAAO,EAAE,MAAM;SACf;KACD,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import { addHooksForFieldSizeLimitChecks } from './setup-field-size-limits.js';
2
+ addHooksForFieldSizeLimitChecks('resin', 'api_key', {
3
+ name: 50,
4
+ description: 150,
5
+ });
6
+ addHooksForFieldSizeLimitChecks('resin', 'organization', {
7
+ name: 100,
8
+ handle: 100,
9
+ });
10
+ for (const resource of [
11
+ 'application_config_variable',
12
+ 'application_environment_variable',
13
+ 'device_config_variable',
14
+ 'device_environment_variable',
15
+ 'device_service_environment_variable',
16
+ ]) {
17
+ addHooksForFieldSizeLimitChecks('resin', resource, {
18
+ value: 100_000,
19
+ });
20
+ }
21
+ addHooksForFieldSizeLimitChecks('resin', 'device_tag', {
22
+ value: [0, 10_000],
23
+ });
24
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/features/field-size-limits/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAE/E,+BAA+B,CAAC,OAAO,EAAE,SAAS,EAAE;IACnD,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,GAAG;CAChB,CAAC,CAAC;AAEH,+BAA+B,CAAC,OAAO,EAAE,cAAc,EAAE;IACxD,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;CACX,CAAC,CAAC;AAEH,KAAK,MAAM,QAAQ,IAAI;IACtB,6BAA6B;IAC7B,kCAAkC;IAClC,wBAAwB;IACxB,6BAA6B;IAC7B,qCAAqC;CACrC,EAAE,CAAC;IACH,+BAA+B,CAAC,OAAO,EAAE,QAAQ,EAAE;QAClD,KAAK,EAAE,OAAO;KACd,CAAC,CAAC;AACJ,CAAC;AAED,+BAA+B,CAAC,OAAO,EAAE,YAAY,EAAE;IACtD,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This is a HACH and should only be used when pre-existing data blocks us from adding the respective Necessity directly in the sbvr.
3
+ */
4
+ export declare function addHooksForFieldSizeLimitChecks(model: string, resource: string, fieldSizeLimits: Record<string, number | [gt: number, le: number]>): void;
@@ -0,0 +1,37 @@
1
+ // TODO: We should cleanup the data and delete this file.
2
+ import { hooks, errors as pinejsErrors } from '@balena/pinejs';
3
+ import { odataNameToSqlName } from '@balena/odata-to-abstract-sql';
4
+ const { BadRequestError } = pinejsErrors;
5
+ const vowels = ['a', 'e', 'i', 'o', 'u'];
6
+ /**
7
+ * This is a HACH and should only be used when pre-existing data blocks us from adding the respective Necessity directly in the sbvr.
8
+ */
9
+ export function addHooksForFieldSizeLimitChecks(model, resource, fieldSizeLimits) {
10
+ const fieldSizeLimitEntries = Object.entries(fieldSizeLimits);
11
+ const hook = {
12
+ POSTPARSE: ({ request }) => {
13
+ for (const [field, limits] of fieldSizeLimitEntries) {
14
+ const value = request.values[field];
15
+ if (typeof value !== 'string') {
16
+ continue;
17
+ }
18
+ const [min, max] = Array.isArray(limits) ? limits : [null, limits];
19
+ if (value.length > max || (min != null && value.length <= min)) {
20
+ const [term, verb = 'has'] = odataNameToSqlName(field)
21
+ .split('-')
22
+ .reverse();
23
+ // hacky way to decide whether to use "a" or "an"
24
+ // should improve one we find cases that this isn't returning the correct results.
25
+ const aOrAn = vowels.includes(term[0]) ? 'an' : 'a';
26
+ const factType = `${verb} ${aOrAn} ${term}`;
27
+ const isGreaterThanAnd = min != null ? `is greater than ${min} and ` : '';
28
+ throw new BadRequestError(`It is necessary that each ${odataNameToSqlName(resource)} that ${factType}, ${factType} that has a Length (Type) that ${isGreaterThanAnd}is less than or equal to ${max}.`);
29
+ }
30
+ }
31
+ },
32
+ };
33
+ for (const method of ['POST', 'PATCH', 'PUT']) {
34
+ hooks.addPureHook(method, model, resource, hook);
35
+ }
36
+ }
37
+ //# sourceMappingURL=setup-field-size-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-field-size-limits.js","sourceRoot":"","sources":["../../../src/features/field-size-limits/setup-field-size-limits.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,EAAE,eAAe,EAAE,GA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AC;oBAE5C,MAAM,gBAAgB,GACrB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,mBAAmB,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;oBAElD,MAAM,IAAI,eAAe,CACxB,6BAA6B,kBAAkB,CAAC,QAAQ,CAAC,SAAS,QAAQ,KAAK,QAAQ,kCAAkC,gBAAgB,4BAA4B,GAAG,GAAG,CAC3K,CAAC;gBACH,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC;IAEF,KAAK,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,EAAE,CAAC;QACxD,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;AACF,CAAC"}
package/dist/hooks.d.ts CHANGED
@@ -8,6 +8,7 @@ import './features/device-provisioning/hooks/index.js';
8
8
  import './features/device-state/hooks.js';
9
9
  import './features/device-types/hooks/index.js';
10
10
  import './features/device-urls/hooks.js';
11
+ import './features/field-size-limits/hooks.js';
11
12
  import './features/hostapp/hooks/index.js';
12
13
  import './features/organizations/hooks/index.js';
13
14
  import './features/releases/hooks/index.js';
package/dist/hooks.js CHANGED
@@ -8,6 +8,7 @@ import './features/device-provisioning/hooks/index.js';
8
8
  import './features/device-state/hooks.js';
9
9
  import './features/device-types/hooks/index.js';
10
10
  import './features/device-urls/hooks.js';
11
+ import './features/field-size-limits/hooks.js';
11
12
  import './features/hostapp/hooks/index.js';
12
13
  import './features/organizations/hooks/index.js';
13
14
  import './features/releases/hooks/index.js';
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,iCAAiC,CAAC;AACzC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+CAA+C,CAAC;AACvD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,wCAAwC,CAAC;AAChD,OAAO,iCAAiC,CAAC;AACzC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,yCAAyC,CAAC;AACjD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2CAA2C,CAAC;AACnD,OAAO,0CAA0C,CAAC;AAClD,OAAO,0BAA0B,CAAC;AAClC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,4BAA4B,CAAC"}
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,wCAAwC,CAAC;AAChD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,iCAAiC,CAAC;AACzC,OAAO,oCAAoC,CAAC;AAC5C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+CAA+C,CAAC;AACvD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,wCAAwC,CAAC;AAChD,OAAO,iCAAiC,CAAC;AACzC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,yCAAyC,CAAC;AACjD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2CAA2C,CAAC;AACnD,OAAO,0CAA0C,CAAC;AAClD,OAAO,0BAA0B,CAAC;AAClC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,4BAA4B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { setUserTokenDataCallback } from './infra/auth/jwt.js';
11
11
  import { createAllPermissions } from './infra/auth/permissions.js';
12
12
  import { createScopedAccessToken } from './infra/auth/jwt.js';
13
13
  import { getApiKeyOptsFromRequest } from './features/api-keys/lib.js';
14
+ import { addHooksForFieldSizeLimitChecks } from './features/field-size-limits/setup-field-size-limits.js';
14
15
  import { createRateLimiter } from './infra/rate-limiting/index.js';
15
16
  import { DeviceOnlineStates } from './features/device-heartbeat/index.js';
16
17
  import type { GetUrlFunction } from './features/request-logging/index.js';
@@ -123,11 +124,11 @@ export declare const auth: {
123
124
  permissions: string[];
124
125
  };
125
126
  };
126
- getServiceFromRequest: (req: {
127
+ getServiceFromRequest: (// TODO: Drop me in the next major
128
+ /** @deprecated Use getAccessibleDeviceTypeJsons */
129
+ req: {
127
130
  apiKey?: sbvrUtils.ApiKey;
128
- }
129
- /** @deprecated Use getDeviceTypeJsonBySlug */
130
- ) => string | undefined;
131
+ } /** @deprecated Use getAccessibleDeviceTypeJsons */) => string | undefined;
131
132
  };
132
133
  export declare const rateLimiting: {
133
134
  createRateLimitMiddleware: (rateLimiter: ReturnType<typeof createRateLimiter>, keyOpts?: Parameters<(rateLimiter: ReturnType<typeof createRateLimiter>, { ignoreIP, allowReset, }?: {
@@ -149,6 +150,7 @@ export declare const rateLimiting: {
149
150
  export * as middleware from './exports/middleware.js';
150
151
  export declare const hooks: {
151
152
  addDeleteHookForDependents: (resource: string, dependents: Parameters<typeof import("./infra/cascade-delete/index.js").addDeleteHookForDependents>[2]) => void;
153
+ addHooksForFieldSizeLimitChecks: typeof addHooksForFieldSizeLimitChecks;
152
154
  };
153
155
  export declare const utils: {
154
156
  updateOrInsertModel: <T extends keyof import("./balena-model.js").default>(resource: T, filter: import("pinejs-client-core").FilterObj<import("./balena-model.js").default[T]["Read"]>, updateFields: Partial<import("./balena-model.js").default[T]["Write"]>, tx?: Tx) => Promise<{
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ import { createScopedAccessToken, createJwt } from './infra/auth/jwt.js';
30
30
  import { middleware as authMiddleware } from './infra/auth/index.js';
31
31
  import { augmentReqApiKeyPermissions, isApiKeyWithRole, getApiKeyOptsFromRequest, } from './features/api-keys/lib.js';
32
32
  import { setupDeleteCascade as addDeleteHookForDependents } from './features/cascade-delete/setup-delete-cascade.js';
33
+ import { addHooksForFieldSizeLimitChecks } from './features/field-size-limits/setup-field-size-limits.js';
33
34
  import { updateOrInsertModel, getOrInsertModelId, } from './infra/pinejs-client-helpers/index.js';
34
35
  import { normalizeHandle, refreshToken, publicKeys, } from './features/auth/index.js';
35
36
  import { getIP, getIPv4, isValidInteger, throttledForEach, getBodyOrQueryParam, } from './lib/utils.js';
@@ -114,6 +115,7 @@ export const rateLimiting = {
114
115
  export * as middleware from './exports/middleware.js';
115
116
  export const hooks = {
116
117
  addDeleteHookForDependents,
118
+ addHooksForFieldSizeLimitChecks,
117
119
  };
118
120
  export const utils = {
119
121
  updateOrInsertModel,