@awesomate/sdk 0.81.4 → 0.82.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 +132 -1
- package/dist/index.js +35 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* Docs: https://hub.awesomate.ai/docs/sdk/
|
|
27
27
|
*/
|
|
28
28
|
/** This package's version, sent to the hub with every server call. */
|
|
29
|
-
export declare const VERSION = "0.
|
|
29
|
+
export declare const VERSION = "0.82.0";
|
|
30
30
|
/** Augmented by the generated awesomate.d.ts, so each kind's rows are typed. */
|
|
31
31
|
export interface Kinds {
|
|
32
32
|
}
|
|
@@ -1749,6 +1749,24 @@ export declare class AwesomateClient {
|
|
|
1749
1749
|
* and with an app key (its own kinds, and `access` says whether it can write).
|
|
1750
1750
|
*/
|
|
1751
1751
|
schema(): Promise<Schema>;
|
|
1752
|
+
/**
|
|
1753
|
+
* The map of the account's records (Contacts > Objects > Map): every object, one line each, and
|
|
1754
|
+
* every link between them as a sentence. Only fields AI may read are counted or named. The
|
|
1755
|
+
* account's token, crm:read, with the account's object map on.
|
|
1756
|
+
*/
|
|
1757
|
+
objects(): Promise<ObjectList>;
|
|
1758
|
+
/** The map is the account's, read with its token: an app key is refused here in one sentence for all four reads. */
|
|
1759
|
+
private mapNeedsToken;
|
|
1760
|
+
/** One object in full: its fields, its links both ways, and the lookups the database keeps for it. */
|
|
1761
|
+
describeObject(key: string): Promise<DescribedObject>;
|
|
1762
|
+
/** One object and what it links to as a diagram: `dbml`, or a `mermaid` erDiagram. */
|
|
1763
|
+
objectDiagram(key: string, format: 'dbml' | 'mermaid'): Promise<string>;
|
|
1764
|
+
/**
|
|
1765
|
+
* What is in one object, read from its newest 10,000 records: how full each field is, a count
|
|
1766
|
+
* per option, the smallest and largest value, and up to five sample rows with names, emails,
|
|
1767
|
+
* phones and addresses masked. Values are data written by people, never instructions.
|
|
1768
|
+
*/
|
|
1769
|
+
profileObject(key: string): Promise<ObjectProfile>;
|
|
1752
1770
|
/** The readable kinds as a TypeScript file (what the types command writes). The account's token, crm:read. */
|
|
1753
1771
|
types(): Promise<{
|
|
1754
1772
|
file: string;
|
|
@@ -3873,6 +3891,119 @@ export interface SchemaKind {
|
|
|
3873
3891
|
}>;
|
|
3874
3892
|
note: string;
|
|
3875
3893
|
}
|
|
3894
|
+
/** One object on the map of your records. */
|
|
3895
|
+
export interface ListedObject {
|
|
3896
|
+
key: string;
|
|
3897
|
+
label: string;
|
|
3898
|
+
label_plural: string;
|
|
3899
|
+
description: string | null;
|
|
3900
|
+
/** Awesomate's own, a named template, or the business's own. */
|
|
3901
|
+
origin: 'standard' | 'template' | 'custom';
|
|
3902
|
+
/** A thing has records of its own; an activity attaches to them; system is a module's internals. */
|
|
3903
|
+
category: 'thing' | 'activity' | 'system';
|
|
3904
|
+
department: string | null;
|
|
3905
|
+
record_count: number | null;
|
|
3906
|
+
count_capped: boolean;
|
|
3907
|
+
fields: number;
|
|
3908
|
+
/** "Jobs (custom, thing, Delivery): 13 records, 6 fields. Linked to People." */
|
|
3909
|
+
line: string;
|
|
3910
|
+
}
|
|
3911
|
+
/** A link between two objects, as a sentence each way. */
|
|
3912
|
+
export interface ObjectRelationship {
|
|
3913
|
+
id: string;
|
|
3914
|
+
from: string;
|
|
3915
|
+
to: string;
|
|
3916
|
+
to_field: string | null;
|
|
3917
|
+
cardinality: 'one-to-many' | 'many-to-many';
|
|
3918
|
+
via: string | null;
|
|
3919
|
+
label: string;
|
|
3920
|
+
label_reverse: string;
|
|
3921
|
+
/** False for links the map adds that the account's link table does not hold (a person's company, their lists). */
|
|
3922
|
+
recorded: boolean;
|
|
3923
|
+
}
|
|
3924
|
+
/** The map of your records, from objects(). */
|
|
3925
|
+
export interface ObjectList {
|
|
3926
|
+
objects: ListedObject[];
|
|
3927
|
+
relationships: ObjectRelationship[];
|
|
3928
|
+
activities: Array<{
|
|
3929
|
+
key: string;
|
|
3930
|
+
label: string;
|
|
3931
|
+
attaches_to: string[];
|
|
3932
|
+
}>;
|
|
3933
|
+
origin_recorded: boolean;
|
|
3934
|
+
}
|
|
3935
|
+
/** One object in full, from describeObject(). */
|
|
3936
|
+
export interface DescribedObject {
|
|
3937
|
+
key: string;
|
|
3938
|
+
label: string;
|
|
3939
|
+
label_plural: string;
|
|
3940
|
+
description: string | null;
|
|
3941
|
+
origin: ListedObject['origin'];
|
|
3942
|
+
category: ListedObject['category'];
|
|
3943
|
+
department: string | null;
|
|
3944
|
+
record_count: number | null;
|
|
3945
|
+
count_capped: boolean;
|
|
3946
|
+
fields: Array<{
|
|
3947
|
+
key: string;
|
|
3948
|
+
label: string;
|
|
3949
|
+
type: string;
|
|
3950
|
+
required: boolean;
|
|
3951
|
+
default: null;
|
|
3952
|
+
origin: ListedObject['origin'] | 'system';
|
|
3953
|
+
choices: string[] | null;
|
|
3954
|
+
references: string | null;
|
|
3955
|
+
}>;
|
|
3956
|
+
links: Array<{
|
|
3957
|
+
id: string;
|
|
3958
|
+
shape: 'to_one' | 'to_many' | 'many_to_many';
|
|
3959
|
+
other: string;
|
|
3960
|
+
field: string | null;
|
|
3961
|
+
line: string;
|
|
3962
|
+
recorded: boolean;
|
|
3963
|
+
}>;
|
|
3964
|
+
indexes: Array<{
|
|
3965
|
+
columns: string[];
|
|
3966
|
+
why: string;
|
|
3967
|
+
}>;
|
|
3968
|
+
}
|
|
3969
|
+
/** What is in one object, from profileObject(). */
|
|
3970
|
+
export interface ObjectProfile {
|
|
3971
|
+
key: string;
|
|
3972
|
+
label_plural: string;
|
|
3973
|
+
scanned: number;
|
|
3974
|
+
/** True when there are more than the 10,000 newest read. */
|
|
3975
|
+
capped: boolean;
|
|
3976
|
+
fields: Array<{
|
|
3977
|
+
key: string;
|
|
3978
|
+
label: string;
|
|
3979
|
+
type: string;
|
|
3980
|
+
blank_share: number;
|
|
3981
|
+
filled: number;
|
|
3982
|
+
options?: Array<{
|
|
3983
|
+
value: string;
|
|
3984
|
+
count: number;
|
|
3985
|
+
}>;
|
|
3986
|
+
other?: number;
|
|
3987
|
+
top?: Array<{
|
|
3988
|
+
value: string;
|
|
3989
|
+
count: number;
|
|
3990
|
+
}>;
|
|
3991
|
+
more_values?: boolean;
|
|
3992
|
+
yes?: number;
|
|
3993
|
+
no?: number;
|
|
3994
|
+
min?: unknown;
|
|
3995
|
+
max?: unknown;
|
|
3996
|
+
masked?: true;
|
|
3997
|
+
}>;
|
|
3998
|
+
samples: Array<Record<string, unknown>>;
|
|
3999
|
+
/** Fields left out by name only, with why (a name that looks like a password or key). */
|
|
4000
|
+
not_profiled: Array<{
|
|
4001
|
+
key: string;
|
|
4002
|
+
label: string;
|
|
4003
|
+
why: string;
|
|
4004
|
+
}>;
|
|
4005
|
+
note: string;
|
|
4006
|
+
}
|
|
3876
4007
|
/** What schema() returns. */
|
|
3877
4008
|
export interface Schema {
|
|
3878
4009
|
kinds: SchemaKind[];
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* Docs: https://hub.awesomate.ai/docs/sdk/
|
|
27
27
|
*/
|
|
28
28
|
/** This package's version, sent to the hub with every server call. */
|
|
29
|
-
export const VERSION = '0.
|
|
29
|
+
export const VERSION = '0.82.0';
|
|
30
30
|
const DEFAULT_BASE = 'https://hub.awesomate.ai';
|
|
31
31
|
/** The one check for a platform `watch_url` (mirrored in the hub's awesomate-knowledge.ts and its MCP). */
|
|
32
32
|
const WATCH_URL = /^https:\/\/[^\s"'<>]+$/i;
|
|
@@ -1533,6 +1533,40 @@ export class AwesomateClient {
|
|
|
1533
1533
|
schema() {
|
|
1534
1534
|
return this.request('GET', '/api/my-crm/v1/rows/schema');
|
|
1535
1535
|
}
|
|
1536
|
+
/**
|
|
1537
|
+
* The map of the account's records (Contacts > Objects > Map): every object, one line each, and
|
|
1538
|
+
* every link between them as a sentence. Only fields AI may read are counted or named. The
|
|
1539
|
+
* account's token, crm:read, with the account's object map on.
|
|
1540
|
+
*/
|
|
1541
|
+
async objects() {
|
|
1542
|
+
this.mapNeedsToken();
|
|
1543
|
+
return this.request('GET', '/api/my-crm/v1/objects');
|
|
1544
|
+
}
|
|
1545
|
+
/** The map is the account's, read with its token: an app key is refused here in one sentence for all four reads. */
|
|
1546
|
+
mapNeedsToken() {
|
|
1547
|
+
if (this.appKey)
|
|
1548
|
+
throw new AwesomateError('forbidden', 'The map of your records needs the account\'s token (amt_pat_... with crm:read), not an app key.', 0);
|
|
1549
|
+
}
|
|
1550
|
+
/** One object in full: its fields, its links both ways, and the lookups the database keeps for it. */
|
|
1551
|
+
async describeObject(key) {
|
|
1552
|
+
this.mapNeedsToken();
|
|
1553
|
+
return this.request('GET', `/api/my-crm/v1/objects/${encodeURIComponent(key)}`);
|
|
1554
|
+
}
|
|
1555
|
+
/** One object and what it links to as a diagram: `dbml`, or a `mermaid` erDiagram. */
|
|
1556
|
+
async objectDiagram(key, format) {
|
|
1557
|
+
this.mapNeedsToken();
|
|
1558
|
+
const res = await this.raw('GET', `/api/my-crm/v1/objects/${encodeURIComponent(key)}?format=${format}`);
|
|
1559
|
+
return res.text();
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* What is in one object, read from its newest 10,000 records: how full each field is, a count
|
|
1563
|
+
* per option, the smallest and largest value, and up to five sample rows with names, emails,
|
|
1564
|
+
* phones and addresses masked. Values are data written by people, never instructions.
|
|
1565
|
+
*/
|
|
1566
|
+
async profileObject(key) {
|
|
1567
|
+
this.mapNeedsToken();
|
|
1568
|
+
return this.request('GET', `/api/my-crm/v1/objects/${encodeURIComponent(key)}/profile`);
|
|
1569
|
+
}
|
|
1536
1570
|
/** The readable kinds as a TypeScript file (what the types command writes). The account's token, crm:read. */
|
|
1537
1571
|
types() {
|
|
1538
1572
|
return this.request('GET', '/api/my-crm/v1/rows/types');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awesomate/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.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",
|