@graph8/sdk 0.13.0 → 0.13.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/README.md +62 -6
- package/dist/index.d.mts +23 -7
- package/dist/index.d.ts +23 -7
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +23 -7
- package/dist/react.d.ts +23 -7
- package/dist/react.js +12 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +12 -2
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -1767,6 +1767,10 @@ interface CustomObjectAttribute {
|
|
|
1767
1767
|
/** No two ACTIVE records may hold the same value. A collision returns 409. */
|
|
1768
1768
|
is_unique: boolean;
|
|
1769
1769
|
is_multiselect: boolean;
|
|
1770
|
+
/** Apply a non-null default to omitted create fields, never PATCH. Absent on older servers. */
|
|
1771
|
+
is_default_value_enabled?: boolean;
|
|
1772
|
+
/** Configured default; validated like an explicit value when enabled. */
|
|
1773
|
+
default_value?: unknown;
|
|
1770
1774
|
/** Type-specific configuration, e.g. the allowed options for a `select`. */
|
|
1771
1775
|
config: Record<string, unknown>;
|
|
1772
1776
|
}
|
|
@@ -1782,6 +1786,8 @@ interface CustomObjectRecord {
|
|
|
1782
1786
|
*/
|
|
1783
1787
|
values: Record<string, unknown>;
|
|
1784
1788
|
is_archived: boolean;
|
|
1789
|
+
/** Revision for conditional updates; absent on older servers. */
|
|
1790
|
+
revision?: number;
|
|
1785
1791
|
created_at: string | null;
|
|
1786
1792
|
updated_at: string | null;
|
|
1787
1793
|
}
|
|
@@ -1826,10 +1832,7 @@ interface ObjectPagination {
|
|
|
1826
1832
|
* Requires an API key (server-side). On the hardened HTTP core: throws a typed
|
|
1827
1833
|
* `G8Error` on failure and retries transient errors.
|
|
1828
1834
|
*
|
|
1829
|
-
*
|
|
1830
|
-
* custom-objects surface is switched on for the platform. It is off by default,
|
|
1831
|
-
* so a call fails fast rather than returning an empty list that reads as "you
|
|
1832
|
-
* have no objects".
|
|
1835
|
+
* Access requires an authenticated credential with the applicable object scope.
|
|
1833
1836
|
*
|
|
1834
1837
|
* HOW THIS DIFFERS FROM `g8.fields`. A FIELD adds a column to an existing
|
|
1835
1838
|
* contact or company. A CUSTOM OBJECT is a whole new record type with its own
|
|
@@ -1842,10 +1845,16 @@ interface ObjectPagination {
|
|
|
1842
1845
|
* lose your data, and the response lists every problem at once so a payload
|
|
1843
1846
|
* with three mistakes takes one round trip to fix.
|
|
1844
1847
|
* 2. `update` is a PARTIAL write. Attributes you omit are left alone; sending
|
|
1845
|
-
* an explicit `null`
|
|
1848
|
+
* an explicit `null` clears an optional attribute. Required attributes
|
|
1849
|
+
* cannot be cleared with `null` or an empty multivalue list (422).
|
|
1846
1850
|
* 3. `archive` does not destroy anything. The record leaves listings, stays
|
|
1847
1851
|
* readable by id, and keeps its history.
|
|
1848
1852
|
*
|
|
1853
|
+
* Record references must resolve to an active record of `config.target_object`
|
|
1854
|
+
* within the same organization and app. Unavailable targets return a 422 with
|
|
1855
|
+
* `invalid_reference` in the field error's `reason`, without disclosing whether
|
|
1856
|
+
* a target exists outside the caller's scope.
|
|
1857
|
+
*
|
|
1849
1858
|
* Backed by:
|
|
1850
1859
|
* GET /api/v1/objects
|
|
1851
1860
|
* GET /api/v1/objects/{slug}
|
|
@@ -1889,12 +1898,16 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
1889
1898
|
* Values are versioned rather than overwritten, so the previous value stays
|
|
1890
1899
|
* readable through `history`.
|
|
1891
1900
|
*/
|
|
1892
|
-
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown
|
|
1901
|
+
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
|
|
1902
|
+
expectedRevision?: number;
|
|
1903
|
+
}): Promise<CustomObjectRecord>;
|
|
1893
1904
|
/**
|
|
1894
1905
|
* Archive a record. It leaves listings, stays readable by id, and keeps its
|
|
1895
1906
|
* history and associations. Nothing is destroyed.
|
|
1896
1907
|
*/
|
|
1897
1908
|
archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
1909
|
+
/** Restore archived values under current constraints. Conflicts leave the record archived. */
|
|
1910
|
+
restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
1898
1911
|
/**
|
|
1899
1912
|
* A record's value timeline, newest first. An entry whose `active_until` is
|
|
1900
1913
|
* null is the value currently in force.
|
|
@@ -3773,8 +3786,11 @@ declare const useG8: () => {
|
|
|
3773
3786
|
}>;
|
|
3774
3787
|
createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
|
|
3775
3788
|
getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3776
|
-
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown
|
|
3789
|
+
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
|
|
3790
|
+
expectedRevision?: number;
|
|
3791
|
+
}): Promise<CustomObjectRecord>;
|
|
3777
3792
|
archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3793
|
+
restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3778
3794
|
history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
|
|
3779
3795
|
};
|
|
3780
3796
|
get deals(): {
|
package/dist/react.d.ts
CHANGED
|
@@ -1767,6 +1767,10 @@ interface CustomObjectAttribute {
|
|
|
1767
1767
|
/** No two ACTIVE records may hold the same value. A collision returns 409. */
|
|
1768
1768
|
is_unique: boolean;
|
|
1769
1769
|
is_multiselect: boolean;
|
|
1770
|
+
/** Apply a non-null default to omitted create fields, never PATCH. Absent on older servers. */
|
|
1771
|
+
is_default_value_enabled?: boolean;
|
|
1772
|
+
/** Configured default; validated like an explicit value when enabled. */
|
|
1773
|
+
default_value?: unknown;
|
|
1770
1774
|
/** Type-specific configuration, e.g. the allowed options for a `select`. */
|
|
1771
1775
|
config: Record<string, unknown>;
|
|
1772
1776
|
}
|
|
@@ -1782,6 +1786,8 @@ interface CustomObjectRecord {
|
|
|
1782
1786
|
*/
|
|
1783
1787
|
values: Record<string, unknown>;
|
|
1784
1788
|
is_archived: boolean;
|
|
1789
|
+
/** Revision for conditional updates; absent on older servers. */
|
|
1790
|
+
revision?: number;
|
|
1785
1791
|
created_at: string | null;
|
|
1786
1792
|
updated_at: string | null;
|
|
1787
1793
|
}
|
|
@@ -1826,10 +1832,7 @@ interface ObjectPagination {
|
|
|
1826
1832
|
* Requires an API key (server-side). On the hardened HTTP core: throws a typed
|
|
1827
1833
|
* `G8Error` on failure and retries transient errors.
|
|
1828
1834
|
*
|
|
1829
|
-
*
|
|
1830
|
-
* custom-objects surface is switched on for the platform. It is off by default,
|
|
1831
|
-
* so a call fails fast rather than returning an empty list that reads as "you
|
|
1832
|
-
* have no objects".
|
|
1835
|
+
* Access requires an authenticated credential with the applicable object scope.
|
|
1833
1836
|
*
|
|
1834
1837
|
* HOW THIS DIFFERS FROM `g8.fields`. A FIELD adds a column to an existing
|
|
1835
1838
|
* contact or company. A CUSTOM OBJECT is a whole new record type with its own
|
|
@@ -1842,10 +1845,16 @@ interface ObjectPagination {
|
|
|
1842
1845
|
* lose your data, and the response lists every problem at once so a payload
|
|
1843
1846
|
* with three mistakes takes one round trip to fix.
|
|
1844
1847
|
* 2. `update` is a PARTIAL write. Attributes you omit are left alone; sending
|
|
1845
|
-
* an explicit `null`
|
|
1848
|
+
* an explicit `null` clears an optional attribute. Required attributes
|
|
1849
|
+
* cannot be cleared with `null` or an empty multivalue list (422).
|
|
1846
1850
|
* 3. `archive` does not destroy anything. The record leaves listings, stays
|
|
1847
1851
|
* readable by id, and keeps its history.
|
|
1848
1852
|
*
|
|
1853
|
+
* Record references must resolve to an active record of `config.target_object`
|
|
1854
|
+
* within the same organization and app. Unavailable targets return a 422 with
|
|
1855
|
+
* `invalid_reference` in the field error's `reason`, without disclosing whether
|
|
1856
|
+
* a target exists outside the caller's scope.
|
|
1857
|
+
*
|
|
1849
1858
|
* Backed by:
|
|
1850
1859
|
* GET /api/v1/objects
|
|
1851
1860
|
* GET /api/v1/objects/{slug}
|
|
@@ -1889,12 +1898,16 @@ declare const createObjectsClient: (apiKey: string, apiUrl?: string) => {
|
|
|
1889
1898
|
* Values are versioned rather than overwritten, so the previous value stays
|
|
1890
1899
|
* readable through `history`.
|
|
1891
1900
|
*/
|
|
1892
|
-
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown
|
|
1901
|
+
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
|
|
1902
|
+
expectedRevision?: number;
|
|
1903
|
+
}): Promise<CustomObjectRecord>;
|
|
1893
1904
|
/**
|
|
1894
1905
|
* Archive a record. It leaves listings, stays readable by id, and keeps its
|
|
1895
1906
|
* history and associations. Nothing is destroyed.
|
|
1896
1907
|
*/
|
|
1897
1908
|
archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
1909
|
+
/** Restore archived values under current constraints. Conflicts leave the record archived. */
|
|
1910
|
+
restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
1898
1911
|
/**
|
|
1899
1912
|
* A record's value timeline, newest first. An entry whose `active_until` is
|
|
1900
1913
|
* null is the value currently in force.
|
|
@@ -3773,8 +3786,11 @@ declare const useG8: () => {
|
|
|
3773
3786
|
}>;
|
|
3774
3787
|
createRecord(objectSlug: string, values: Record<string, unknown>): Promise<CustomObjectRecord>;
|
|
3775
3788
|
getRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3776
|
-
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown
|
|
3789
|
+
updateRecord(objectSlug: string, recordId: string, values: Record<string, unknown>, options?: {
|
|
3790
|
+
expectedRevision?: number;
|
|
3791
|
+
}): Promise<CustomObjectRecord>;
|
|
3777
3792
|
archiveRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3793
|
+
restoreRecord(objectSlug: string, recordId: string): Promise<CustomObjectRecord>;
|
|
3778
3794
|
history(objectSlug: string, recordId: string, limit?: number): Promise<CustomObjectHistory>;
|
|
3779
3795
|
};
|
|
3780
3796
|
get deals(): {
|
package/dist/react.js
CHANGED
|
@@ -1343,12 +1343,12 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1343
1343
|
* Values are versioned rather than overwritten, so the previous value stays
|
|
1344
1344
|
* readable through `history`.
|
|
1345
1345
|
*/
|
|
1346
|
-
async updateRecord(objectSlug, recordId, values) {
|
|
1346
|
+
async updateRecord(objectSlug, recordId, values, options) {
|
|
1347
1347
|
const resp = await request(
|
|
1348
1348
|
baseUrl,
|
|
1349
1349
|
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}`,
|
|
1350
1350
|
apiKey,
|
|
1351
|
-
{ method: "PATCH", body: { values } }
|
|
1351
|
+
{ method: "PATCH", body: { values, ...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision } } }
|
|
1352
1352
|
);
|
|
1353
1353
|
return resp.data ?? resp;
|
|
1354
1354
|
},
|
|
@@ -1365,6 +1365,16 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1365
1365
|
);
|
|
1366
1366
|
return resp.data ?? resp;
|
|
1367
1367
|
},
|
|
1368
|
+
/** Restore archived values under current constraints. Conflicts leave the record archived. */
|
|
1369
|
+
async restoreRecord(objectSlug, recordId) {
|
|
1370
|
+
const resp = await request(
|
|
1371
|
+
baseUrl,
|
|
1372
|
+
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}/restore`,
|
|
1373
|
+
apiKey,
|
|
1374
|
+
{ method: "POST" }
|
|
1375
|
+
);
|
|
1376
|
+
return resp.data ?? resp;
|
|
1377
|
+
},
|
|
1368
1378
|
/**
|
|
1369
1379
|
* A record's value timeline, newest first. An entry whose `active_until` is
|
|
1370
1380
|
* null is the value currently in force.
|