@getclarify/nodejs-sdk 0.0.5 → 0.0.6
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/cjs/client.d.ts +7 -1
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +9 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/http/http-client.d.ts.map +1 -1
- package/dist/cjs/http/http-client.js +3 -1
- package/dist/cjs/http/http-client.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/json-api/link.js.map +1 -1
- package/dist/cjs/resources/comments.d.ts +83 -0
- package/dist/cjs/resources/comments.d.ts.map +1 -0
- package/dist/cjs/resources/comments.js +75 -0
- package/dist/cjs/resources/comments.js.map +1 -0
- package/dist/cjs/resources/records.d.ts +17 -3
- package/dist/cjs/resources/records.d.ts.map +1 -1
- package/dist/cjs/resources/records.js +22 -2
- package/dist/cjs/resources/records.js.map +1 -1
- package/dist/cjs/resources/relationships.d.ts +80 -0
- package/dist/cjs/resources/relationships.d.ts.map +1 -0
- package/dist/cjs/resources/relationships.js +77 -0
- package/dist/cjs/resources/relationships.js.map +1 -0
- package/dist/cjs/types/common.d.ts +13 -0
- package/dist/cjs/types/common.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/esm/client.d.ts +7 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +9 -1
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/http/http-client.d.ts.map +1 -1
- package/dist/esm/http/http-client.js +3 -1
- package/dist/esm/http/http-client.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-api/link.js.map +1 -1
- package/dist/esm/resources/comments.d.ts +83 -0
- package/dist/esm/resources/comments.d.ts.map +1 -0
- package/dist/esm/resources/comments.js +75 -0
- package/dist/esm/resources/comments.js.map +1 -0
- package/dist/esm/resources/records.d.ts +17 -3
- package/dist/esm/resources/records.d.ts.map +1 -1
- package/dist/esm/resources/records.js +22 -2
- package/dist/esm/resources/records.js.map +1 -1
- package/dist/esm/resources/relationships.d.ts +80 -0
- package/dist/esm/resources/relationships.d.ts.map +1 -0
- package/dist/esm/resources/relationships.js +77 -0
- package/dist/esm/resources/relationships.js.map +1 -0
- package/dist/esm/types/common.d.ts +13 -0
- package/dist/esm/types/common.d.ts.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/types/client.d.ts +7 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/http/http-client.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/comments.d.ts +83 -0
- package/dist/types/resources/comments.d.ts.map +1 -0
- package/dist/types/resources/records.d.ts +17 -3
- package/dist/types/resources/records.d.ts.map +1 -1
- package/dist/types/resources/relationships.d.ts +80 -0
- package/dist/types/resources/relationships.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +13 -0
- package/dist/types/types/common.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RelationshipsResource = void 0;
|
|
4
|
+
const base_resource_js_1 = require("./base-resource.js");
|
|
5
|
+
/**
|
|
6
|
+
* Manages the records linked to a record through a relationship field.
|
|
7
|
+
*
|
|
8
|
+
* The public API exposes replace and unlink only. `replace` sets the full set
|
|
9
|
+
* of links (unlisted links are removed; it is not additive), and `unlink`
|
|
10
|
+
* removes the listed links. There is no additive-link method.
|
|
11
|
+
*
|
|
12
|
+
* To create records and link them, `records.createBulk` the records, then
|
|
13
|
+
* `relationships.replace` each anchor's links from inside one `execute-code`
|
|
14
|
+
* script so the loop stays in the runtime.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* await clarify.relationships.replace({
|
|
19
|
+
* entity: 'company',
|
|
20
|
+
* id: 'company-123',
|
|
21
|
+
* relationship: 'contacts',
|
|
22
|
+
* related: [{ type: 'person', id: 'person-1' }],
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
class RelationshipsResource extends base_resource_js_1.BaseResource {
|
|
27
|
+
constructor(httpClient, config) {
|
|
28
|
+
super(httpClient, config);
|
|
29
|
+
}
|
|
30
|
+
getRelationshipPath(anchor) {
|
|
31
|
+
return `${this.basePath}/objects/${anchor.entity}/records/${anchor.id}/relationships/${anchor.relationship}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lists the records linked to a record through the given relationship.
|
|
35
|
+
*/
|
|
36
|
+
async list(params) {
|
|
37
|
+
const query = {};
|
|
38
|
+
if (params.include && params.include.length > 0) {
|
|
39
|
+
query.include = params.include.join(',');
|
|
40
|
+
}
|
|
41
|
+
if (params.page?.offset !== undefined) {
|
|
42
|
+
query['page[offset]'] = params.page.offset;
|
|
43
|
+
}
|
|
44
|
+
if (params.page?.limit !== undefined) {
|
|
45
|
+
query['page[limit]'] = params.page.limit;
|
|
46
|
+
}
|
|
47
|
+
return this.httpClient.request({
|
|
48
|
+
method: 'GET',
|
|
49
|
+
path: this.getRelationshipPath(params),
|
|
50
|
+
query,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Replaces the full set of records linked through the relationship. Links not
|
|
55
|
+
* listed in `related` are removed; this is not additive.
|
|
56
|
+
*/
|
|
57
|
+
async replace(params) {
|
|
58
|
+
await this.httpClient.request({
|
|
59
|
+
method: 'PATCH',
|
|
60
|
+
path: this.getRelationshipPath(params),
|
|
61
|
+
body: { data: params.related },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Removes the listed records from the relationship. The records themselves
|
|
66
|
+
* are not deleted.
|
|
67
|
+
*/
|
|
68
|
+
async unlink(params) {
|
|
69
|
+
await this.httpClient.request({
|
|
70
|
+
method: 'DELETE',
|
|
71
|
+
path: this.getRelationshipPath(params),
|
|
72
|
+
body: { data: params.related },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.RelationshipsResource = RelationshipsResource;
|
|
77
|
+
//# sourceMappingURL=relationships.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.js","sourceRoot":"","sources":["../../../src/resources/relationships.ts"],"names":[],"mappings":";;;AAEA,yDAAkD;AAsClD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,qBAAsB,SAAQ,+BAAY;IACrD,YAAY,UAAsB,EAAE,MAAsB;QACxD,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAEO,mBAAmB,CAAC,MAA0B;QACpD,OAAO,GAAG,IAAI,CAAC,QAAQ,YAAY,MAAM,CAAC,MAAM,YAAY,MAAM,CAAC,EAAE,kBAAkB,MAAM,CAAC,YAAY,EAAE,CAAC;IAC/G,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,MAA8B;QAE9B,MAAM,KAAK,GAAgD,EAAE,CAAC;QAE9D,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;YACtC,KAAK,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAC7C,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YACrC,KAAK,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3C,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAkB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACtC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,MAA+B;QAC3C,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAwB;YACnD,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,MAA+B;QAC1C,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAwB;YACnD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACtC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AA3DD,sDA2DC"}
|
|
@@ -89,11 +89,23 @@ export interface ListOptions {
|
|
|
89
89
|
filter?: FilterOptions;
|
|
90
90
|
sort?: SortOptions | SortOptions[];
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Options for creating records, including upsert-by-unique-field.
|
|
94
|
+
*/
|
|
95
|
+
export interface CreateRecordOptions {
|
|
96
|
+
/**
|
|
97
|
+
* Name of a unique field to upsert on. When a create matches an existing
|
|
98
|
+
* record on this field, the record is updated instead of duplicated. Maps to
|
|
99
|
+
* the API's `match_on` body field.
|
|
100
|
+
*/
|
|
101
|
+
matchOn?: string;
|
|
102
|
+
}
|
|
92
103
|
/**
|
|
93
104
|
* Request body for creating a single resource.
|
|
94
105
|
*/
|
|
95
106
|
export interface CreateBody<T = Record<string, unknown>> {
|
|
96
107
|
data: ResourceCreate<T>;
|
|
108
|
+
match_on?: string;
|
|
97
109
|
}
|
|
98
110
|
/**
|
|
99
111
|
* Request body for updating a single resource.
|
|
@@ -106,6 +118,7 @@ export interface UpdateBody<T = Record<string, unknown>> {
|
|
|
106
118
|
*/
|
|
107
119
|
export interface BulkCreateBody<T = Record<string, unknown>> {
|
|
108
120
|
data: ResourceCreate<T>[];
|
|
121
|
+
match_on?: string;
|
|
109
122
|
}
|
|
110
123
|
/**
|
|
111
124
|
* Request body for bulk update operations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE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C,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,CAAC,SAAS,EAAE,MAAM,GAAG;QACnB,2DAA2D;QAC3D,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;QAC7C,iCAAiC;QACjC,KAAK,CAAC,EAAE,QAAQ,CAAC;QACjB,kCAAkC;QAClC,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { ClarifyClientConfig, ResolvedConfig } from './config.js';
|
|
2
2
|
export { DEFAULT_CONFIG } from './config.js';
|
|
3
|
-
export type { ResourceIdentifier, Resource, ResourceCreate, ResourceUpdate, SingleResponse, ListResponse, PaginationLinks, PaginationMeta, PaginationOptions, FilterOptions, SortOptions, ListOptions, CreateBody, UpdateBody, BulkCreateBody, BulkUpdateBody, BulkDeleteBody, HttpMethod, GetRecordOptions, FieldOperationRules, UpdateRecordOptions, } from './common.js';
|
|
3
|
+
export type { ResourceIdentifier, Resource, ResourceCreate, ResourceUpdate, SingleResponse, ListResponse, PaginationLinks, PaginationMeta, PaginationOptions, FilterOptions, SortOptions, ListOptions, CreateBody, UpdateBody, BulkCreateBody, BulkUpdateBody, BulkDeleteBody, HttpMethod, GetRecordOptions, FieldOperationRules, UpdateRecordOptions, CreateRecordOptions, } from './common.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,YAAY,EACV,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { CommentsResource } from './resources/comments.js';
|
|
1
2
|
import { RecordsResource } from './resources/records.js';
|
|
3
|
+
import { RelationshipsResource } from './resources/relationships.js';
|
|
2
4
|
import { ResourcesResource } from './resources/resources.js';
|
|
3
5
|
import type { ClarifyClientConfig } from './types/index.js';
|
|
4
6
|
/**
|
|
@@ -6,7 +8,7 @@ import type { ClarifyClientConfig } from './types/index.js';
|
|
|
6
8
|
*
|
|
7
9
|
* @example
|
|
8
10
|
* ```typescript
|
|
9
|
-
* import { ClarifyClient } from '@
|
|
11
|
+
* import { ClarifyClient } from '@getclarify/nodejs-sdk';
|
|
10
12
|
*
|
|
11
13
|
* const clarify = new ClarifyClient({
|
|
12
14
|
* baseUrl: 'https://api.clarify.ai',
|
|
@@ -32,6 +34,10 @@ export declare class ClarifyClient {
|
|
|
32
34
|
* Responses include a `relationships` map with fully resolved related records.
|
|
33
35
|
*/
|
|
34
36
|
readonly resources: ResourcesResource;
|
|
37
|
+
/** Resource for creating, reading, updating, and deleting comments. */
|
|
38
|
+
readonly comments: CommentsResource;
|
|
39
|
+
/** Resource for listing, replacing, and unlinking record relationships. */
|
|
40
|
+
readonly relationships: RelationshipsResource;
|
|
35
41
|
private readonly config;
|
|
36
42
|
private readonly httpClient;
|
|
37
43
|
/**
|
package/dist/esm/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM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,OAAO,CAAC,aAAa;CA4BtB"}
|
package/dist/esm/client.js
CHANGED
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClarifyClient = void 0;
|
|
4
4
|
const index_js_1 = require("./errors/index.js");
|
|
5
5
|
const http_client_js_1 = require("./http/http-client.js");
|
|
6
|
+
const comments_js_1 = require("./resources/comments.js");
|
|
6
7
|
const records_js_1 = require("./resources/records.js");
|
|
8
|
+
const relationships_js_1 = require("./resources/relationships.js");
|
|
7
9
|
const resources_js_1 = require("./resources/resources.js");
|
|
8
10
|
const index_js_2 = require("./types/index.js");
|
|
9
11
|
/**
|
|
@@ -11,7 +13,7 @@ const index_js_2 = require("./types/index.js");
|
|
|
11
13
|
*
|
|
12
14
|
* @example
|
|
13
15
|
* ```typescript
|
|
14
|
-
* import { ClarifyClient } from '@
|
|
16
|
+
* import { ClarifyClient } from '@getclarify/nodejs-sdk';
|
|
15
17
|
*
|
|
16
18
|
* const clarify = new ClarifyClient({
|
|
17
19
|
* baseUrl: 'https://api.clarify.ai',
|
|
@@ -37,6 +39,10 @@ class ClarifyClient {
|
|
|
37
39
|
* Responses include a `relationships` map with fully resolved related records.
|
|
38
40
|
*/
|
|
39
41
|
resources;
|
|
42
|
+
/** Resource for creating, reading, updating, and deleting comments. */
|
|
43
|
+
comments;
|
|
44
|
+
/** Resource for listing, replacing, and unlinking record relationships. */
|
|
45
|
+
relationships;
|
|
40
46
|
config;
|
|
41
47
|
httpClient;
|
|
42
48
|
/**
|
|
@@ -50,6 +56,8 @@ class ClarifyClient {
|
|
|
50
56
|
this.httpClient = new http_client_js_1.HttpClient(this.config);
|
|
51
57
|
this.records = new records_js_1.RecordsResource(this.httpClient, this.config);
|
|
52
58
|
this.resources = new resources_js_1.ResourcesResource(this.httpClient, this.config);
|
|
59
|
+
this.comments = new comments_js_1.CommentsResource(this.httpClient, this.config);
|
|
60
|
+
this.relationships = new relationships_js_1.RelationshipsResource(this.httpClient, this.config);
|
|
53
61
|
}
|
|
54
62
|
/**
|
|
55
63
|
* Resolves configuration with defaults and validates required fields.
|
package/dist/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAC3D,0DAAmD;AACnD,uDAAyD;AACzD,2DAA6D;AAE7D,+CAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,aAAa;IACxB,oCAAoC;IAC3B,OAAO,CAAkB;IAElC;;;OAGG;IACM,SAAS,CAAoB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAC3D,0DAAmD;AACnD,yDAA2D;AAC3D,uDAAyD;AACzD,mEAAqE;AACrE,2DAA6D;AAE7D,+CAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,aAAa;IACxB,oCAAoC;IAC3B,OAAO,CAAkB;IAElC;;;OAGG;IACM,SAAS,CAAoB;IAEtC,uEAAuE;IAC9D,QAAQ,CAAmB;IAEpC,2EAA2E;IAClE,aAAa,CAAwB;IAE7B,MAAM,CAAiB;IACvB,UAAU,CAAa;IAExC;;;;;OAKG;IACH,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,2BAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9C,IAAI,CAAC,OAAO,GAAG,IAAI,4BAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,CAAC,SAAS,GAAG,IAAI,gCAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,GAAG,IAAI,8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"","sources":["../../../src/http/http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CAC1E;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;gBAE5B,MAAM,EAAE,cAAc;IAIlC;;OAEG;IACG,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAezD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;YACW,gBAAgB;
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/http/http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CAC1E;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;gBAE5B,MAAM,EAAE,cAAc;IAIlC;;OAEG;IACG,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAezD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;YACW,gBAAgB;IAmC9B;;OAEG;YACW,cAAc;IAgD5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;YACW,KAAK;CAGpB"}
|
|
@@ -84,6 +84,8 @@ class HttpClient {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
// FIXME: lastError is `Error | undefined`; if every attempt left it undefined this throws undefined. Should throw a real Error fallback.
|
|
88
|
+
// oxlint-disable-next-line typescript/only-throw-error
|
|
87
89
|
throw lastError;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
@@ -137,7 +139,7 @@ class HttpClient {
|
|
|
137
139
|
/**
|
|
138
140
|
* Sleeps for the specified duration.
|
|
139
141
|
*/
|
|
140
|
-
sleep(ms) {
|
|
142
|
+
async sleep(ms) {
|
|
141
143
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
142
144
|
}
|
|
143
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../../src/http/http-client.ts"],"names":[],"mappings":";;;AAAA,iDAI4B;AAa5B;;GAEG;AACH,MAAa,UAAU;IACJ,MAAM,CAAiB;IAExC,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAI,OAA2B;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACpC,MAAM,WAAW,GAAgB;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO;SACR,CA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K,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAChC,MAAM,IAAI,8BAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACrD,CAAC;gBAED,MAAM,IAAI,8BAAmB,CAC3B,2BAA2B,KAAK,CAAC,OAAO,EAAE,EAC1C,KAAK,CACN,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,8BAAmB,CAC3B,uBAAuB,EACvB,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CACzB,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,OAAe;QACtC,mDAAmD;QACnD,MAAM,SAAS,GAAG,IAAI,CAAC;QACvB,MAAM,QAAQ,GAAG,KAAK,CAAC;QACvB,MAAM,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1D,kCAAkC;QAClC,MAAM,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACtD,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,KAAK,CAAC,EAAU;QAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AA5KD,gCA4KC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { ClarifyClient } from './client.js';
|
|
2
2
|
export { ClarifyError, ClarifyApiError, ClarifyValidationError, ClarifyTimeoutError, ClarifyNetworkError, } from './errors/index.js';
|
|
3
3
|
export type { ApiErrorDetail } from './errors/index.js';
|
|
4
|
-
export type { ClarifyClientConfig, ResourceIdentifier, Resource, ResourceCreate, ResourceUpdate, SingleResponse, ListResponse, PaginationLinks, PaginationMeta, PaginationOptions, FilterOptions, SortOptions, ListOptions, GetRecordOptions, FieldOperationRules, UpdateRecordOptions, } from './types/index.js';
|
|
4
|
+
export type { ClarifyClientConfig, ResourceIdentifier, Resource, ResourceCreate, ResourceUpdate, SingleResponse, ListResponse, PaginationLinks, PaginationMeta, PaginationOptions, FilterOptions, SortOptions, ListOptions, GetRecordOptions, FieldOperationRules, UpdateRecordOptions, CreateRecordOptions, } from './types/index.js';
|
|
5
5
|
export { RecordsResource } from './resources/records.js';
|
|
6
6
|
export { ResourcesResource, type ResourceLinked, type SingleResourceResponse, type ListResourceResponse, type SortDirection, type ResourceGetParams, type ResourceListParams, type ResourceRelationshipInput, type ResourceRelationshipsInput, type ResourceCreateParams, type ResourceDeleteParams, } from './resources/resources.js';
|
|
7
|
+
export { CommentsResource, type RichTextNode, type Comment, type CommentCreateParams, type CommentUpdateParams, } from './resources/comments.js';
|
|
8
|
+
export { RelationshipsResource, type RelationshipListParams, type RelationshipWriteParams, } from './resources/relationships.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,8BAA8B,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResourcesResource = exports.RecordsResource = exports.ClarifyNetworkError = exports.ClarifyTimeoutError = exports.ClarifyValidationError = exports.ClarifyApiError = exports.ClarifyError = exports.ClarifyClient = void 0;
|
|
3
|
+
exports.RelationshipsResource = exports.CommentsResource = exports.ResourcesResource = exports.RecordsResource = exports.ClarifyNetworkError = exports.ClarifyTimeoutError = exports.ClarifyValidationError = exports.ClarifyApiError = exports.ClarifyError = exports.ClarifyClient = void 0;
|
|
4
4
|
// Main client export
|
|
5
5
|
var client_js_1 = require("./client.js");
|
|
6
6
|
Object.defineProperty(exports, "ClarifyClient", { enumerable: true, get: function () { return client_js_1.ClarifyClient; } });
|
|
@@ -16,4 +16,8 @@ var records_js_1 = require("./resources/records.js");
|
|
|
16
16
|
Object.defineProperty(exports, "RecordsResource", { enumerable: true, get: function () { return records_js_1.RecordsResource; } });
|
|
17
17
|
var resources_js_1 = require("./resources/resources.js");
|
|
18
18
|
Object.defineProperty(exports, "ResourcesResource", { enumerable: true, get: function () { return resources_js_1.ResourcesResource; } });
|
|
19
|
+
var comments_js_1 = require("./resources/comments.js");
|
|
20
|
+
Object.defineProperty(exports, "CommentsResource", { enumerable: true, get: function () { return comments_js_1.CommentsResource; } });
|
|
21
|
+
var relationships_js_1 = require("./resources/relationships.js");
|
|
22
|
+
Object.defineProperty(exports, "RelationshipsResource", { enumerable: true, get: function () { return relationships_js_1.RelationshipsResource; } });
|
|
19
23
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qBAAqB;AACrB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,gBAAgB;AAChB,8CAM2B;AALzB,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qBAAqB;AACrB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AAEtB,gBAAgB;AAChB,8CAM2B;AALzB,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AACf,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;AAyBrB,sCAAsC;AACtC,qDAAyD;AAAhD,6GAAA,eAAe,OAAA;AACxB,yDAYkC;AAXhC,iHAAA,iBAAiB,OAAA;AAYnB,uDAMiC;AAL/B,+GAAA,gBAAgB,OAAA;AAMlB,iEAIsC;AAHpC,yHAAA,qBAAqB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/json-api/link.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,6EAA6E;AAC7E,sDAAsD;;AAkDtD,kCAuBC;AA1CD,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,WAAW,CAA4B,GAAM;IAC3D,MAAM,QAA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T,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACd,SAAS;QACX,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,IAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,EAAE,CACnD,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAC7B,CAAC;QACJ,CAAC;aAAM,CAAC;YACL,GAAG,CAAC,IAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,IAAc,EAAE,WAAW,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CACjB,GAAW,EACX,WAA0C;IAE1C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,mCAAmC,GAAG,8DAA8D,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
+
import type { ResolvedConfig } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
/**
|
|
5
|
+
* A single rich-text (BlockNote) node. A comment body is an array of these.
|
|
6
|
+
* The SDK ships zero dependencies, so this mirrors the API's node shape
|
|
7
|
+
* (`z.array(z.record(z.any()))`) without importing the workspace type.
|
|
8
|
+
*
|
|
9
|
+
* A paragraph's visible text lives in a nested `content` array of inline nodes,
|
|
10
|
+
* e.g. `[{ type: 'paragraph', content: [{ type: 'text', text: 'Hi' }] }]`. A
|
|
11
|
+
* bare string `content` is treated as empty and rejected with a 422.
|
|
12
|
+
*/
|
|
13
|
+
export type RichTextNode = Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* A comment row as returned by the comments endpoints. These endpoints return
|
|
16
|
+
* the flat row directly, not a JSON:API `{ data }` envelope.
|
|
17
|
+
*/
|
|
18
|
+
export interface Comment {
|
|
19
|
+
_id: string;
|
|
20
|
+
message: RichTextNode[];
|
|
21
|
+
owner_id: string;
|
|
22
|
+
entity: string;
|
|
23
|
+
_created_at: string;
|
|
24
|
+
_created_by: string;
|
|
25
|
+
_updated_at: string | null;
|
|
26
|
+
_updated_by: string | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parameters for creating a comment.
|
|
30
|
+
*/
|
|
31
|
+
export interface CommentCreateParams {
|
|
32
|
+
/** The object type of the record to comment on, e.g. 'deal', 'person'. */
|
|
33
|
+
entity: string;
|
|
34
|
+
/** The ID of the record to attach the comment to. */
|
|
35
|
+
ownerId: string;
|
|
36
|
+
/** The comment body as a non-empty array of rich-text (BlockNote) nodes. */
|
|
37
|
+
message: RichTextNode[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters for updating a comment.
|
|
41
|
+
*/
|
|
42
|
+
export interface CommentUpdateParams {
|
|
43
|
+
/** The new comment body as a non-empty array of rich-text nodes. */
|
|
44
|
+
message: RichTextNode[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Manages CRUD operations for comments on records.
|
|
48
|
+
*
|
|
49
|
+
* There is no bulk comment endpoint; to comment on many records, loop `create`
|
|
50
|
+
* inside a single `execute-code` script so the work stays in the runtime.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* await clarify.comments.create({
|
|
55
|
+
* entity: 'deal',
|
|
56
|
+
* ownerId: 'deal-123',
|
|
57
|
+
* message: [
|
|
58
|
+
* { type: 'paragraph', content: [{ type: 'text', text: 'Following up.' }] },
|
|
59
|
+
* ],
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare class CommentsResource extends BaseResource {
|
|
64
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
65
|
+
private get commentsPath();
|
|
66
|
+
/**
|
|
67
|
+
* Creates a comment on a record.
|
|
68
|
+
*/
|
|
69
|
+
create(params: CommentCreateParams): Promise<Comment>;
|
|
70
|
+
/**
|
|
71
|
+
* Retrieves a single comment by ID.
|
|
72
|
+
*/
|
|
73
|
+
get(id: string): Promise<Comment>;
|
|
74
|
+
/**
|
|
75
|
+
* Updates a comment's body.
|
|
76
|
+
*/
|
|
77
|
+
update(id: string, params: CommentUpdateParams): Promise<Comment>;
|
|
78
|
+
/**
|
|
79
|
+
* Deletes a comment by ID.
|
|
80
|
+
*/
|
|
81
|
+
delete(id: string): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../src/resources/comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D,OAAO,KAAK,YAAY,GAEvB;IAED;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAY3D;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvC;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUvE;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMxC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentsResource = void 0;
|
|
4
|
+
const base_resource_js_1 = require("./base-resource.js");
|
|
5
|
+
/**
|
|
6
|
+
* Manages CRUD operations for comments on records.
|
|
7
|
+
*
|
|
8
|
+
* There is no bulk comment endpoint; to comment on many records, loop `create`
|
|
9
|
+
* inside a single `execute-code` script so the work stays in the runtime.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* await clarify.comments.create({
|
|
14
|
+
* entity: 'deal',
|
|
15
|
+
* ownerId: 'deal-123',
|
|
16
|
+
* message: [
|
|
17
|
+
* { type: 'paragraph', content: [{ type: 'text', text: 'Following up.' }] },
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
class CommentsResource extends base_resource_js_1.BaseResource {
|
|
23
|
+
constructor(httpClient, config) {
|
|
24
|
+
super(httpClient, config);
|
|
25
|
+
}
|
|
26
|
+
get commentsPath() {
|
|
27
|
+
return `${this.basePath}/comments`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a comment on a record.
|
|
31
|
+
*/
|
|
32
|
+
async create(params) {
|
|
33
|
+
return this.httpClient.request({
|
|
34
|
+
method: 'POST',
|
|
35
|
+
path: this.commentsPath,
|
|
36
|
+
body: {
|
|
37
|
+
entity: params.entity,
|
|
38
|
+
owner_id: params.ownerId,
|
|
39
|
+
message: params.message,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves a single comment by ID.
|
|
45
|
+
*/
|
|
46
|
+
async get(id) {
|
|
47
|
+
return this.httpClient.request({
|
|
48
|
+
method: 'GET',
|
|
49
|
+
path: `${this.commentsPath}/${id}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Updates a comment's body.
|
|
54
|
+
*/
|
|
55
|
+
async update(id, params) {
|
|
56
|
+
return this.httpClient.request({
|
|
57
|
+
method: 'PATCH',
|
|
58
|
+
path: `${this.commentsPath}/${id}`,
|
|
59
|
+
body: {
|
|
60
|
+
message: params.message,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Deletes a comment by ID.
|
|
66
|
+
*/
|
|
67
|
+
async delete(id) {
|
|
68
|
+
await this.httpClient.request({
|
|
69
|
+
method: 'DELETE',
|
|
70
|
+
path: `${this.commentsPath}/${id}`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.CommentsResource = CommentsResource;
|
|
75
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../../src/resources/comments.ts"],"names":[],"mappings":";;;AAEA,yDAAkD;AAgDlD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,gBAAiB,SAAQ,+BAAY;IAChD,YAAY,UAAsB,EAAE,MAAsB;QACxD,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,IAAY,YAAY;QACtB,OAAO,GAAG,IAAI,CAAC,QAAQ,WAAW,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAA2B;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAU;YACtC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,IAAI,EAAE;gBACJ,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,QAAQ,EAAE,MAAM,CAAC,OAAO;gBACxB,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAU;YACtC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAA2B;QAClD,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAU;YACtC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE;YAClC,IAAI,EAAE;gBACJ,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAwB;YACnD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,4CAwDC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
-
import type { GetRecordOptions, ListResponse, ResolvedConfig, ResourceCreate, ResourceUpdate, SingleResponse, UpdateRecordOptions } from '../types/index.js';
|
|
2
|
+
import type { CreateRecordOptions, GetRecordOptions, ListResponse, ResolvedConfig, ResourceCreate, ResourceUpdate, SingleResponse, UpdateRecordOptions } from '../types/index.js';
|
|
3
3
|
import { BaseResource } from './base-resource.js';
|
|
4
4
|
/**
|
|
5
5
|
* Manages CRUD operations for records.
|
|
@@ -35,6 +35,7 @@ export declare class RecordsResource extends BaseResource {
|
|
|
35
35
|
*
|
|
36
36
|
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
37
37
|
* @param attributes - The record attributes to create
|
|
38
|
+
* @param options - Optional create options including `matchOn` for upsert
|
|
38
39
|
* @returns The created record wrapped in a JSON:API response
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
@@ -44,14 +45,21 @@ export declare class RecordsResource extends BaseResource {
|
|
|
44
45
|
* website: 'https://acme.com'
|
|
45
46
|
* });
|
|
46
47
|
* console.log(response.data.id);
|
|
48
|
+
*
|
|
49
|
+
* // Upsert by a unique field instead of always creating
|
|
50
|
+
* await client.records.create('person',
|
|
51
|
+
* { email: 'jane@acme.com', name: 'Jane Doe' },
|
|
52
|
+
* { matchOn: 'email' },
|
|
53
|
+
* );
|
|
47
54
|
* ```
|
|
48
55
|
*/
|
|
49
|
-
create<T = Record<string, unknown>>(entity: string, attributes: T): Promise<SingleResponse<T>>;
|
|
56
|
+
create<T = Record<string, unknown>>(entity: string, attributes: T, options?: CreateRecordOptions): Promise<SingleResponse<T>>;
|
|
50
57
|
/**
|
|
51
58
|
* Creates multiple records in bulk.
|
|
52
59
|
*
|
|
53
60
|
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
54
61
|
* @param records - Array of record create objects with type and attributes
|
|
62
|
+
* @param options - Optional create options including `matchOn` for upsert
|
|
55
63
|
* @returns The created records wrapped in a JSON:API list response
|
|
56
64
|
*
|
|
57
65
|
* @example
|
|
@@ -61,9 +69,15 @@ export declare class RecordsResource extends BaseResource {
|
|
|
61
69
|
* { type: 'company', attributes: { name: 'Widget Inc' } }
|
|
62
70
|
* ]);
|
|
63
71
|
* console.log(response.data.length);
|
|
72
|
+
*
|
|
73
|
+
* // Upsert a batch by a unique field
|
|
74
|
+
* await client.records.createBulk('person', [
|
|
75
|
+
* { type: 'person', attributes: { email: 'jane@acme.com', name: 'Jane' } },
|
|
76
|
+
* { type: 'person', attributes: { email: 'joe@acme.com', name: 'Joe' } },
|
|
77
|
+
* ], { matchOn: 'email' });
|
|
64
78
|
* ```
|
|
65
79
|
*/
|
|
66
|
-
createBulk<T = Record<string, unknown>>(entity: string, records: ResourceCreate<T>[]): Promise<ListResponse<T>>;
|
|
80
|
+
createBulk<T = Record<string, unknown>>(entity: string, records: ResourceCreate<T>[], options?: CreateRecordOptions): Promise<ListResponse<T>>;
|
|
67
81
|
/**
|
|
68
82
|
* Updates a single record.
|
|
69
83
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../src/resources/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAGV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,E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|
|
51
51
|
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
52
52
|
* @param attributes - The record attributes to create
|
|
53
|
+
* @param options - Optional create options including `matchOn` for upsert
|
|
53
54
|
* @returns The created record wrapped in a JSON:API response
|
|
54
55
|
*
|
|
55
56
|
* @example
|
|
@@ -59,15 +60,24 @@ class RecordsResource extends base_resource_js_1.BaseResource {
|
|
|
59
60
|
* website: 'https://acme.com'
|
|
60
61
|
* });
|
|
61
62
|
* console.log(response.data.id);
|
|
63
|
+
*
|
|
64
|
+
* // Upsert by a unique field instead of always creating
|
|
65
|
+
* await client.records.create('person',
|
|
66
|
+
* { email: 'jane@acme.com', name: 'Jane Doe' },
|
|
67
|
+
* { matchOn: 'email' },
|
|
68
|
+
* );
|
|
62
69
|
* ```
|
|
63
70
|
*/
|
|
64
|
-
async create(entity, attributes) {
|
|
71
|
+
async create(entity, attributes, options) {
|
|
65
72
|
const body = {
|
|
66
73
|
data: {
|
|
67
74
|
type: entity,
|
|
68
75
|
attributes,
|
|
69
76
|
},
|
|
70
77
|
};
|
|
78
|
+
if (options?.matchOn) {
|
|
79
|
+
body.match_on = options.matchOn;
|
|
80
|
+
}
|
|
71
81
|
return this.httpClient.request({
|
|
72
82
|
method: 'POST',
|
|
73
83
|
path: this.getEntityPath(entity),
|
|
@@ -79,6 +89,7 @@ class RecordsResource extends base_resource_js_1.BaseResource {
|
|
|
79
89
|
*
|
|
80
90
|
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
81
91
|
* @param records - Array of record create objects with type and attributes
|
|
92
|
+
* @param options - Optional create options including `matchOn` for upsert
|
|
82
93
|
* @returns The created records wrapped in a JSON:API list response
|
|
83
94
|
*
|
|
84
95
|
* @example
|
|
@@ -88,12 +99,21 @@ class RecordsResource extends base_resource_js_1.BaseResource {
|
|
|
88
99
|
* { type: 'company', attributes: { name: 'Widget Inc' } }
|
|
89
100
|
* ]);
|
|
90
101
|
* console.log(response.data.length);
|
|
102
|
+
*
|
|
103
|
+
* // Upsert a batch by a unique field
|
|
104
|
+
* await client.records.createBulk('person', [
|
|
105
|
+
* { type: 'person', attributes: { email: 'jane@acme.com', name: 'Jane' } },
|
|
106
|
+
* { type: 'person', attributes: { email: 'joe@acme.com', name: 'Joe' } },
|
|
107
|
+
* ], { matchOn: 'email' });
|
|
91
108
|
* ```
|
|
92
109
|
*/
|
|
93
|
-
async createBulk(entity, records) {
|
|
110
|
+
async createBulk(entity, records, options) {
|
|
94
111
|
const body = {
|
|
95
112
|
data: records,
|
|
96
113
|
};
|
|
114
|
+
if (options?.matchOn) {
|
|
115
|
+
body.match_on = options.matchOn;
|
|
116
|
+
}
|
|
97
117
|
return this.httpClient.request({
|
|
98
118
|
method: 'POST',
|
|
99
119
|
path: `${this.getEntityPath(entity)}/bulk`,
|