@awesomate/sdk 0.22.0 → 0.24.0

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/index.d.ts CHANGED
@@ -24,7 +24,7 @@
24
24
  * Docs: https://hub.awesomate.ai/docs/sdk/
25
25
  */
26
26
  /** This package's version, sent to the hub with every server call. */
27
- export declare const VERSION = "0.22.0";
27
+ export declare const VERSION = "0.24.0";
28
28
  /** Augmented by the generated awesomate.d.ts, so each kind's rows are typed. */
29
29
  export interface Kinds {
30
30
  }
@@ -516,12 +516,27 @@ export declare class AwesomateClient {
516
516
  */
517
517
  business(): Promise<BusinessIdentity>;
518
518
  /**
519
- * The business map: the seven divisions every business has, the jobs in each and who holds them,
520
- * which agents and automations help which job and how far each may go, and what is missing, most
521
- * important first. Read only: the owner changes the map in the hub. Needs the account's token
522
- * (hosting:read, every plan), never an app key, and the account must have the business map.
519
+ * The business map: the seven departments every business has, their sub-departments, the roles in
520
+ * each and who holds them, which agents and automations help which role and how far each may go,
521
+ * and what is missing, most important first. Read only: the owner changes the map in the hub.
522
+ * Needs the account's token (hosting:read, every plan), never an app key, and the account must
523
+ * have the business map. Since 0.24.0 in the words the owner sees; businessMapV1() is the old shape.
523
524
  */
524
525
  businessMap(): Promise<BusinessMap>;
526
+ /** Every role on the map, one line each: slug, title, department and who holds it. */
527
+ businessMapRoles(): Promise<BusinessMapRoleSummary[]>;
528
+ /**
529
+ * One role by its slug, with the line each helper's instructions carry (`helpers[].instructionLine`):
530
+ * which role it helps, for whom, how far it may go and where its procedures are.
531
+ */
532
+ businessMapRole(slug: string): Promise<BusinessMapRoleDetail>;
533
+ /**
534
+ * The business map in its first shape, where a department is a `division`, a sub-department a
535
+ * `department` and a role a `job`.
536
+ * @deprecated Use businessMap(), which uses the words the owner sees. v1 is removed once it has
537
+ * gone 30 days unused, and not before 2026-11-06.
538
+ */
539
+ businessMapV1(): Promise<BusinessMapV1>;
525
540
  /** Details waiting for the owner's yes on Your business: from the website, the account, a team member or a file. */
526
541
  businessSuggestions(): Promise<BusinessSuggestion[]>;
527
542
  /** Grouped numbers (counts, sums) in the Business Data API's shape. */
@@ -592,20 +607,20 @@ export interface BusinessMapHelper {
592
607
  ref: string;
593
608
  label: string;
594
609
  }
595
- /** A job on the map. `slug` is its stable name for routing work: "whoever holds quotes". */
596
- export interface BusinessMapJob {
610
+ /** A role on the map. `slug` is its stable name for routing work: "whoever holds quotes". */
611
+ export interface BusinessMapRole {
597
612
  id: number;
598
613
  slug: string;
599
614
  title: string;
600
615
  mission: string | null;
601
616
  /** active: someone holds it. open: nobody does. hire_next: the owner's next hire. */
602
617
  state: 'active' | 'open' | 'hire_next';
603
- isOwnerJob: boolean;
604
- /** Runs its division: the division manager, above its departments, so departmentNo is null (the owner's job excepted). */
605
- headsDivision: boolean;
606
- /** Runs its department: the person responsible for it, and for its department-level KPIs. */
618
+ isOwnerRole: boolean;
619
+ /** Runs its department: above its sub-departments, so subDepartmentNo is null (the owner's role excepted). */
607
620
  headsDepartment: boolean;
608
- departmentNo: number | null;
621
+ /** Runs its sub-department: the person responsible for it, and for its KPIs. */
622
+ headsSubDepartment: boolean;
623
+ subDepartmentNo: number | null;
609
624
  reportsTo: {
610
625
  id: number;
611
626
  title: string;
@@ -628,12 +643,12 @@ export interface BusinessMapJob {
628
643
  exceptions: string | null;
629
644
  minutesSavedPerRun: number | null;
630
645
  }>;
631
- /** The tag this job's procedures carry in 1Brain, such as 'job:quotes'. The map keeps no procedure text. */
646
+ /** The tag this role's procedures carry in 1Brain, such as 'job:quotes'. The map keeps no procedure text. */
632
647
  proceduresTag: string;
633
- /** Quarterly priorities on this hat, every quarter. */
648
+ /** Quarterly priorities on this role, every quarter. */
634
649
  priorities: BusinessMapPriority[];
635
650
  }
636
- /** A quarterly priority on a hat: one of the few things it must move this quarter. */
651
+ /** A quarterly priority on a role: one of the few things it must move this quarter. */
637
652
  export interface BusinessMapPriority {
638
653
  id: number;
639
654
  /** '2026-Q4'. */
@@ -649,15 +664,15 @@ export interface BusinessMapPriority {
649
664
  export interface BusinessMapPathStep {
650
665
  position: number;
651
666
  label: string;
652
- divisionNo: 1 | 2 | 3 | 4 | 5 | 6 | 7;
667
+ departmentNo: 1 | 2 | 3 | 4 | 5 | 6 | 7;
653
668
  verb: string;
654
- /** The job that looks after the step, when the owner named one. */
655
- job: {
669
+ /** The role that looks after the step, when the owner named one. */
670
+ role: {
656
671
  id: number;
657
672
  slug: string;
658
673
  title: string;
659
674
  } | null;
660
- /** Who looks after it: the job's holder, else whoever runs the division (byDefault). */
675
+ /** Who looks after it: the role's holder, else whoever runs the department (byDefault). */
661
676
  owner: {
662
677
  name: string;
663
678
  byDefault: boolean;
@@ -665,8 +680,23 @@ export interface BusinessMapPathStep {
665
680
  /** Where this step hands over to the next, in the owner's words. */
666
681
  handoffRule: string | null;
667
682
  }
668
- /** One of the seven divisions, in board order (7 first). */
669
- export interface BusinessMapDivision {
683
+ /** A sub-department and who runs it: the holder of the role that heads it, else whoever runs the department (byDefault). */
684
+ export interface BusinessMapSubDepartment {
685
+ no: number;
686
+ name: string;
687
+ gloss: string;
688
+ runBy: {
689
+ name: string;
690
+ byDefault: boolean;
691
+ };
692
+ headRole: {
693
+ id: number;
694
+ slug: string;
695
+ title: string;
696
+ } | null;
697
+ }
698
+ /** One of the seven departments, in board order (7 first). */
699
+ export interface BusinessMapDepartment {
670
700
  no: 1 | 2 | 3 | 4 | 5 | 6 | 7;
671
701
  /** Envision, Form, Promise, Balance, Fulfil, Refine, Share. */
672
702
  verb: string;
@@ -678,26 +708,12 @@ export interface BusinessMapDivision {
678
708
  name: string;
679
709
  byDefault: boolean;
680
710
  };
681
- jobs: BusinessMapJob[];
682
- /** Helping here but not yet put on a job, with how they were placed, in words. */
711
+ roles: BusinessMapRole[];
712
+ /** Helping here but not yet put on a role, with how they were placed, in words. */
683
713
  helpers: Array<BusinessMapHelper & {
684
714
  placedBy: string;
685
715
  }>;
686
- /** Each department and who runs it: the holder of the job that heads it, else whoever runs the division (byDefault). */
687
- departments: Array<{
688
- no: number;
689
- name: string;
690
- gloss: string;
691
- runBy: {
692
- name: string;
693
- byDefault: boolean;
694
- };
695
- headJob: {
696
- id: number;
697
- slug: string;
698
- title: string;
699
- } | null;
700
- }>;
716
+ subDepartments: BusinessMapSubDepartment[];
701
717
  ideas: Array<{
702
718
  label: string;
703
719
  what: string;
@@ -709,27 +725,34 @@ export interface BusinessMapDivision {
709
725
  kind: 'lead' | 'result';
710
726
  }>;
711
727
  question: string;
712
- /** 1Brain departments whose procedures belong in this division. */
728
+ /** 1Brain Departments whose procedures belong in this department. */
713
729
  oneBrainDepartments: string[];
730
+ /** People on the map who hold no role yet. They sit in Form (department 1) for display; empty for every other department. */
731
+ noRoleYet: Array<{
732
+ id: number;
733
+ name: string;
734
+ }>;
714
735
  }
715
736
  /** The business map, as businessMap() returns it. No email addresses. */
716
737
  export interface BusinessMap {
738
+ version: 2;
717
739
  business: {
718
740
  name: string | null;
719
741
  ownerName: string;
720
742
  };
721
743
  /** false: the owner has not started the map, so it is worked out from what the account runs. */
722
744
  stored: boolean;
745
+ /** access: what the person may do in the hub (owner, full or view). */
723
746
  people: Array<{
724
747
  id: number | null;
725
748
  name: string;
726
749
  kind: 'owner' | 'staff' | 'contractor' | 'adviser' | null;
727
- role: 'owner' | 'full' | 'view' | null;
750
+ access: 'owner' | 'full' | 'view' | null;
728
751
  location: string | null;
729
752
  fromTeamAccess: boolean;
730
753
  }>;
731
- divisions: BusinessMapDivision[];
732
- /** Helpers we could not place on a division. */
754
+ departments: BusinessMapDepartment[];
755
+ /** Helpers we could not place on a department. */
733
756
  unplaced: Array<BusinessMapHelper & {
734
757
  placedBy: string;
735
758
  }>;
@@ -745,6 +768,225 @@ export interface BusinessMap {
745
768
  /** This quarter, '2026-Q4' (UTC): the one the map shows priorities for. */
746
769
  quarter: string;
747
770
  /** What is missing, most important first. */
771
+ gaps: Array<{
772
+ kind: 'procedure_first' | 'no_helper' | 'role_open' | 'path_missing' | 'path_unowned' | 'owner_everywhere' | 'unplaced';
773
+ department: number | null;
774
+ title: string;
775
+ detail: string;
776
+ action: {
777
+ label: string;
778
+ path: string;
779
+ } | null;
780
+ }>;
781
+ /** oneBrainCategory: the 1Brain category this business is, once linked. */
782
+ settings: {
783
+ adviser: string | null;
784
+ runsWeek: string | null;
785
+ oneBrainCategory: string | null;
786
+ };
787
+ counts: {
788
+ people: number;
789
+ helpers: number;
790
+ placed: number;
791
+ departmentsWithHelpers: number;
792
+ roles: number;
793
+ };
794
+ /** Sources that could not be read just now: a missing helper may simply not have been read. */
795
+ unavailable: string[];
796
+ }
797
+ /** One role in businessMapRoles(). */
798
+ export interface BusinessMapRoleSummary {
799
+ slug: string;
800
+ title: string;
801
+ state: BusinessMapRole['state'];
802
+ department: {
803
+ no: number;
804
+ verb: string;
805
+ name: string;
806
+ };
807
+ /** The accountable holder, else the first; null when nobody holds it. */
808
+ holder: string | null;
809
+ }
810
+ /** One role, as businessMapRole() returns it. */
811
+ export interface BusinessMapRoleDetail {
812
+ slug: string;
813
+ title: string;
814
+ mission: string | null;
815
+ state: BusinessMapRole['state'];
816
+ department: {
817
+ no: number;
818
+ verb: string;
819
+ name: string;
820
+ };
821
+ headsDepartment: boolean;
822
+ headsSubDepartment: boolean;
823
+ reportsTo: {
824
+ title: string;
825
+ slug: string | null;
826
+ } | null;
827
+ holder: string | null;
828
+ procedures: {
829
+ where: '1Brain';
830
+ tag: string;
831
+ };
832
+ /** This quarter's and next quarter's. */
833
+ priorities: Array<{
834
+ quarter: string;
835
+ title: string;
836
+ status: BusinessMapPriority['status'];
837
+ owner: string | null;
838
+ dueOn: string | null;
839
+ }>;
840
+ pathSteps: Array<{
841
+ position: number;
842
+ label: string;
843
+ handoffRule: string | null;
844
+ }>;
845
+ holders: Array<{
846
+ name: string;
847
+ accountable: boolean;
848
+ timeSharePct: number | null;
849
+ }>;
850
+ responsibilities: Array<{
851
+ text: string;
852
+ level: BusinessMapLevel;
853
+ levelLabel: string;
854
+ exceptions: string | null;
855
+ }>;
856
+ helpers: Array<{
857
+ kind: BusinessMapHelper['kind'];
858
+ ref: string;
859
+ label: string;
860
+ supervisor: string;
861
+ level: BusinessMapLevel | null;
862
+ levelLabel: string | null;
863
+ exceptions: string | null;
864
+ instructionLine: string;
865
+ }>;
866
+ }
867
+ /**
868
+ * A job on the v1 map (a role).
869
+ * @deprecated v1 shape, from businessMapV1(). Use BusinessMapRole.
870
+ */
871
+ export interface BusinessMapJob {
872
+ id: number;
873
+ slug: string;
874
+ title: string;
875
+ mission: string | null;
876
+ state: 'active' | 'open' | 'hire_next';
877
+ isOwnerJob: boolean;
878
+ /** Runs its division (a department). */
879
+ headsDivision: boolean;
880
+ /** Runs its department (a sub-department). */
881
+ headsDepartment: boolean;
882
+ /** The sub-department. */
883
+ departmentNo: number | null;
884
+ reportsTo: {
885
+ id: number;
886
+ title: string;
887
+ } | null;
888
+ holders: BusinessMapRole['holders'];
889
+ responsibilities: BusinessMapRole['responsibilities'];
890
+ helpers: BusinessMapRole['helpers'];
891
+ proceduresTag: string;
892
+ priorities: BusinessMapPriority[];
893
+ }
894
+ /**
895
+ * One step of the customer's path on the v1 map.
896
+ * @deprecated v1 shape, from businessMapV1(). Use BusinessMapPathStep.
897
+ */
898
+ export interface BusinessMapPathStepV1 {
899
+ position: number;
900
+ label: string;
901
+ /** The department. */
902
+ divisionNo: 1 | 2 | 3 | 4 | 5 | 6 | 7;
903
+ verb: string;
904
+ /** The role. */
905
+ job: {
906
+ id: number;
907
+ slug: string;
908
+ title: string;
909
+ } | null;
910
+ owner: {
911
+ name: string;
912
+ byDefault: boolean;
913
+ };
914
+ handoffRule: string | null;
915
+ }
916
+ /**
917
+ * A division on the v1 map (a department).
918
+ * @deprecated v1 shape, from businessMapV1(). Use BusinessMapDepartment.
919
+ */
920
+ export interface BusinessMapDivision {
921
+ no: 1 | 2 | 3 | 4 | 5 | 6 | 7;
922
+ verb: string;
923
+ name: string;
924
+ purpose: string;
925
+ stage: 'survive' | 'grow' | 'scale';
926
+ runBy: {
927
+ name: string;
928
+ byDefault: boolean;
929
+ };
930
+ jobs: BusinessMapJob[];
931
+ helpers: Array<BusinessMapHelper & {
932
+ placedBy: string;
933
+ }>;
934
+ /** The sub-departments. */
935
+ departments: Array<{
936
+ no: number;
937
+ name: string;
938
+ gloss: string;
939
+ runBy: {
940
+ name: string;
941
+ byDefault: boolean;
942
+ };
943
+ headJob: {
944
+ id: number;
945
+ slug: string;
946
+ title: string;
947
+ } | null;
948
+ }>;
949
+ ideas: BusinessMapDepartment['ideas'];
950
+ numbers: BusinessMapDepartment['numbers'];
951
+ question: string;
952
+ oneBrainDepartments: string[];
953
+ noHatYet: Array<{
954
+ id: number;
955
+ name: string;
956
+ }>;
957
+ }
958
+ /**
959
+ * The business map in its first shape, as businessMapV1() returns it.
960
+ * @deprecated Use BusinessMap, from businessMap().
961
+ */
962
+ export interface BusinessMapV1 {
963
+ business: {
964
+ name: string | null;
965
+ ownerName: string;
966
+ };
967
+ stored: boolean;
968
+ /** role: the person's access. */
969
+ people: Array<{
970
+ id: number | null;
971
+ name: string;
972
+ kind: 'owner' | 'staff' | 'contractor' | 'adviser' | null;
973
+ role: 'owner' | 'full' | 'view' | null;
974
+ location: string | null;
975
+ fromTeamAccess: boolean;
976
+ }>;
977
+ divisions: BusinessMapDivision[];
978
+ unplaced: Array<BusinessMapHelper & {
979
+ placedBy: string;
980
+ }>;
981
+ path: {
982
+ stored: boolean;
983
+ template: {
984
+ key: string;
985
+ label: string;
986
+ } | null;
987
+ steps: BusinessMapPathStepV1[];
988
+ };
989
+ quarter: string;
748
990
  gaps: Array<{
749
991
  kind: 'procedure_first' | 'no_helper' | 'job_open' | 'path_missing' | 'path_unowned' | 'owner_everywhere' | 'unplaced';
750
992
  division: number | null;
@@ -758,6 +1000,7 @@ export interface BusinessMap {
758
1000
  settings: {
759
1001
  adviser: string | null;
760
1002
  runsWeek: string | null;
1003
+ oneBrainCategory: string | null;
761
1004
  };
762
1005
  counts: {
763
1006
  people: number;
@@ -766,7 +1009,6 @@ export interface BusinessMap {
766
1009
  divisionsWithHelpers: number;
767
1010
  jobs: number;
768
1011
  };
769
- /** Sources that could not be read just now: a missing helper may simply not have been read. */
770
1012
  unavailable: string[];
771
1013
  }
772
1014
  /** A detail waiting for the owner's yes. */
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * Docs: https://hub.awesomate.ai/docs/sdk/
25
25
  */
26
26
  /** This package's version, sent to the hub with every server call. */
27
- export const VERSION = '0.22.0';
27
+ export const VERSION = '0.24.0';
28
28
  const DEFAULT_BASE = 'https://hub.awesomate.ai';
29
29
  const ERROR_CODES = ['unauthenticated', 'forbidden', 'not_found', 'validation', 'consent_blocked', 'rate_limited', 'conflict', 'unavailable'];
30
30
  /**
@@ -402,12 +402,33 @@ export class AwesomateClient {
402
402
  return this.request('GET', '/api/my-business/v1/identity?format=json');
403
403
  }
404
404
  /**
405
- * The business map: the seven divisions every business has, the jobs in each and who holds them,
406
- * which agents and automations help which job and how far each may go, and what is missing, most
407
- * important first. Read only: the owner changes the map in the hub. Needs the account's token
408
- * (hosting:read, every plan), never an app key, and the account must have the business map.
405
+ * The business map: the seven departments every business has, their sub-departments, the roles in
406
+ * each and who holds them, which agents and automations help which role and how far each may go,
407
+ * and what is missing, most important first. Read only: the owner changes the map in the hub.
408
+ * Needs the account's token (hosting:read, every plan), never an app key, and the account must
409
+ * have the business map. Since 0.24.0 in the words the owner sees; businessMapV1() is the old shape.
409
410
  */
410
411
  async businessMap() {
412
+ return (await this.request('GET', '/api/my-business/v2/map?format=json')).map;
413
+ }
414
+ /** Every role on the map, one line each: slug, title, department and who holds it. */
415
+ async businessMapRoles() {
416
+ return (await this.request('GET', '/api/my-business/v2/map/roles')).roles;
417
+ }
418
+ /**
419
+ * One role by its slug, with the line each helper's instructions carry (`helpers[].instructionLine`):
420
+ * which role it helps, for whom, how far it may go and where its procedures are.
421
+ */
422
+ async businessMapRole(slug) {
423
+ return (await this.request('GET', `/api/my-business/v2/map/roles/${encodeURIComponent(slug)}`)).role;
424
+ }
425
+ /**
426
+ * The business map in its first shape, where a department is a `division`, a sub-department a
427
+ * `department` and a role a `job`.
428
+ * @deprecated Use businessMap(), which uses the words the owner sees. v1 is removed once it has
429
+ * gone 30 days unused, and not before 2026-11-06.
430
+ */
431
+ async businessMapV1() {
411
432
  return (await this.request('GET', '/api/my-business/v1/map?format=json')).map;
412
433
  }
413
434
  /** Details waiting for the owner's yes on Your business: from the website, the account, a team member or a file. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/sdk",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Your own Awesomate data from Node and the browser: query contacts and app data with generated types, and sign your app's own users in",
5
5
  "license": "MIT",
6
6
  "type": "module",