@getclarify/nodejs-sdk 0.0.5 → 0.0.7
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 +10 -1
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +13 -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 +4 -2
- package/dist/cjs/http/http-client.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/json-api/link.js.map +1 -1
- package/dist/cjs/resources/access.d.ts +130 -0
- package/dist/cjs/resources/access.d.ts.map +1 -0
- package/dist/cjs/resources/access.js +98 -0
- package/dist/cjs/resources/access.js.map +1 -0
- 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/resources/resources.d.ts +8 -7
- package/dist/cjs/resources/resources.d.ts.map +1 -1
- package/dist/cjs/resources/resources.js +63 -10
- package/dist/cjs/resources/resources.js.map +1 -1
- 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 +10 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +13 -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 +4 -2
- package/dist/esm/http/http-client.js.map +1 -1
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-api/link.js.map +1 -1
- package/dist/esm/resources/access.d.ts +130 -0
- package/dist/esm/resources/access.d.ts.map +1 -0
- package/dist/esm/resources/access.js +98 -0
- package/dist/esm/resources/access.js.map +1 -0
- 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/resources/resources.d.ts +8 -7
- package/dist/esm/resources/resources.d.ts.map +1 -1
- package/dist/esm/resources/resources.js +63 -10
- package/dist/esm/resources/resources.js.map +1 -1
- 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 +10 -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 +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/access.d.ts +130 -0
- package/dist/types/resources/access.d.ts.map +1 -0
- 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/resources/resources.d.ts +8 -7
- package/dist/types/resources/resources.d.ts.map +1 -1
- 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
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { AccessResource } from './resources/access.js';
|
|
2
|
+
import { CommentsResource } from './resources/comments.js';
|
|
1
3
|
import { RecordsResource } from './resources/records.js';
|
|
4
|
+
import { RelationshipsResource } from './resources/relationships.js';
|
|
2
5
|
import { ResourcesResource } from './resources/resources.js';
|
|
3
6
|
import type { ClarifyClientConfig } from './types/index.js';
|
|
4
7
|
/**
|
|
@@ -6,7 +9,7 @@ import type { ClarifyClientConfig } from './types/index.js';
|
|
|
6
9
|
*
|
|
7
10
|
* @example
|
|
8
11
|
* ```typescript
|
|
9
|
-
* import { ClarifyClient } from '@
|
|
12
|
+
* import { ClarifyClient } from '@getclarify/nodejs-sdk';
|
|
10
13
|
*
|
|
11
14
|
* const clarify = new ClarifyClient({
|
|
12
15
|
* baseUrl: 'https://api.clarify.ai',
|
|
@@ -32,6 +35,12 @@ export declare class ClarifyClient {
|
|
|
32
35
|
* Responses include a `relationships` map with fully resolved related records.
|
|
33
36
|
*/
|
|
34
37
|
readonly resources: ResourcesResource;
|
|
38
|
+
/** Resource for creating, reading, updating, and deleting comments. */
|
|
39
|
+
readonly comments: CommentsResource;
|
|
40
|
+
/** Resource for listing, replacing, and unlinking record relationships. */
|
|
41
|
+
readonly relationships: RelationshipsResource;
|
|
42
|
+
/** Resource for listing, creating, updating, and revoking record access grants. */
|
|
43
|
+
readonly access: AccessResource;
|
|
35
44
|
private readonly config;
|
|
36
45
|
private readonly httpClient;
|
|
37
46
|
/**
|
package/dist/cjs/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,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;IACxB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,MAAM,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;IACxB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IAEpC,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAE9C,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,MAAM,EAAE,mBAAmB;IAcvC;;OAEG;IACH,OAAO,CAAC,aAAa;CA4BtB"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -3,7 +3,10 @@ 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 access_js_1 = require("./resources/access.js");
|
|
7
|
+
const comments_js_1 = require("./resources/comments.js");
|
|
6
8
|
const records_js_1 = require("./resources/records.js");
|
|
9
|
+
const relationships_js_1 = require("./resources/relationships.js");
|
|
7
10
|
const resources_js_1 = require("./resources/resources.js");
|
|
8
11
|
const index_js_2 = require("./types/index.js");
|
|
9
12
|
/**
|
|
@@ -11,7 +14,7 @@ const index_js_2 = require("./types/index.js");
|
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```typescript
|
|
14
|
-
* import { ClarifyClient } from '@
|
|
17
|
+
* import { ClarifyClient } from '@getclarify/nodejs-sdk';
|
|
15
18
|
*
|
|
16
19
|
* const clarify = new ClarifyClient({
|
|
17
20
|
* baseUrl: 'https://api.clarify.ai',
|
|
@@ -37,6 +40,12 @@ class ClarifyClient {
|
|
|
37
40
|
* Responses include a `relationships` map with fully resolved related records.
|
|
38
41
|
*/
|
|
39
42
|
resources;
|
|
43
|
+
/** Resource for creating, reading, updating, and deleting comments. */
|
|
44
|
+
comments;
|
|
45
|
+
/** Resource for listing, replacing, and unlinking record relationships. */
|
|
46
|
+
relationships;
|
|
47
|
+
/** Resource for listing, creating, updating, and revoking record access grants. */
|
|
48
|
+
access;
|
|
40
49
|
config;
|
|
41
50
|
httpClient;
|
|
42
51
|
/**
|
|
@@ -50,6 +59,9 @@ class ClarifyClient {
|
|
|
50
59
|
this.httpClient = new http_client_js_1.HttpClient(this.config);
|
|
51
60
|
this.records = new records_js_1.RecordsResource(this.httpClient, this.config);
|
|
52
61
|
this.resources = new resources_js_1.ResourcesResource(this.httpClient, this.config);
|
|
62
|
+
this.comments = new comments_js_1.CommentsResource(this.httpClient, this.config);
|
|
63
|
+
this.relationships = new relationships_js_1.RelationshipsResource(this.httpClient, this.config);
|
|
64
|
+
this.access = new access_js_1.AccessResource(this.httpClient, this.config);
|
|
53
65
|
}
|
|
54
66
|
/**
|
|
55
67
|
* Resolves configuration with defaults and validates required fields.
|
package/dist/cjs/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,qDAAuD;AACvD,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;IAE9C,mFAAmF;IAC1E,MAAM,CAAiB;IAEf,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MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,iCAAsB,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,yBAAc,CAAC,OAAO;YACjD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,yBAAc,CAAC,OAAO;YACjD,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;SACzD,CAAC;IACJ,CAAC;CACF;AAzED,sCAyEC"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAgBzD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;YACW,gBAAgB;IAmC9B;;OAEG;YACW,cAAc;IAgD5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;YACW,KAAK;CAGpB"}
|
|
@@ -21,6 +21,7 @@ class HttpClient {
|
|
|
21
21
|
headers,
|
|
22
22
|
};
|
|
23
23
|
if (options.body !== undefined) {
|
|
24
|
+
headers['Content-Type'] = 'application/json';
|
|
24
25
|
requestInit.body = JSON.stringify(options.body);
|
|
25
26
|
}
|
|
26
27
|
return this.executeWithRetry(url, requestInit);
|
|
@@ -53,7 +54,6 @@ class HttpClient {
|
|
|
53
54
|
*/
|
|
54
55
|
buildHeaders() {
|
|
55
56
|
return {
|
|
56
|
-
'Content-Type': 'application/json',
|
|
57
57
|
Accept: 'application/json',
|
|
58
58
|
Authorization: `api-key ${this.config.apiKey}`,
|
|
59
59
|
};
|
|
@@ -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,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACK,QAAQ,CACd,IAAY,EACZ,KAAwE;QAExE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CA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AS,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/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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
|
-
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';
|
|
6
|
+
export { ResourcesResource, type ResourceLinked, type SingleResourceResponse, type ListResourceResponse, type SortDirection, type ResourceGetParams, type ResourceListParams, type ResourceFilterValue, 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';
|
|
9
|
+
export { AccessResource, type AccessGranteeType, type AccessLevel, type AccessGrantLevel, type AccessGrant, type AccessViewerEntry, type AccessGrantListResponse, type AccessGrantInput, type AccessListParams, type AccessGrantParams, type AccessGrantBulkParams, type AccessUpdateParams, type AccessRevokeParams, } from './resources/access.js';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/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,KA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AuB,GAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC"}
|
package/dist/cjs/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.AccessResource = 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,10 @@ 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; } });
|
|
23
|
+
var access_js_1 = require("./resources/access.js");
|
|
24
|
+
Object.defineProperty(exports, "AccessResource", { enumerable: true, get: function () { return access_js_1.AccessResource; } });
|
|
19
25
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/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,yDAakC;AAZhC,iHAAA,iBAAiB,OAAA;AAanB,uDAMiC;AAL/B,+GAAA,gBAAgB,OAAA;AAMlB,iEAIsC;AAHpC,yHAAA,qBAAqB,OAAA;AAIvB,mDAc+B;AAb7B,2GAAA,cAAc,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/json-api/link.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,6EAA6E;AAC7E,sDA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,CAAC;QACrC,YAAY,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,YAAY,CACnB,QAAqB,EACrB,WAA0C;IAE1C,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC5B,OAAO;IACT,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,130 @@
|
|
|
1
|
+
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
+
import type { ResolvedConfig, Resource, SingleResponse } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
/** Who a grant is for: one workspace member, or everyone in the workspace. */
|
|
5
|
+
export type AccessGranteeType = 'user' | 'workspace';
|
|
6
|
+
/** The access levels a grant can be created or updated with. */
|
|
7
|
+
export type AccessLevel = 'view' | 'edit';
|
|
8
|
+
/**
|
|
9
|
+
* The access levels a grant can hold when read back. `owner` marks the
|
|
10
|
+
* record's owner and is read-only; `manage` is reserved.
|
|
11
|
+
*/
|
|
12
|
+
export type AccessGrantLevel = AccessLevel | 'owner' | 'manage';
|
|
13
|
+
/**
|
|
14
|
+
* A single access grant on a record, as returned in `attributes` by the access
|
|
15
|
+
* endpoints.
|
|
16
|
+
*/
|
|
17
|
+
export interface AccessGrant {
|
|
18
|
+
_id: string;
|
|
19
|
+
object_id: string;
|
|
20
|
+
grantee_type: AccessGranteeType;
|
|
21
|
+
grantee_id: string | null;
|
|
22
|
+
access_level: AccessGrantLevel;
|
|
23
|
+
_created_at: string;
|
|
24
|
+
_created_by: string | null;
|
|
25
|
+
_updated_at: string | null;
|
|
26
|
+
_updated_by: string | null;
|
|
27
|
+
}
|
|
28
|
+
/** A meeting or message viewer who reads it through a public link or a delegation. */
|
|
29
|
+
export interface AccessViewerEntry {
|
|
30
|
+
kind: 'public-link'
|
|
31
|
+
/** Deprecated and never returned. */
|
|
32
|
+
| 'workspace-public' | 'legacy-delegate' | 'entity-wide-delegate';
|
|
33
|
+
grantee_id: string | null;
|
|
34
|
+
access_level: AccessGrantLevel | null;
|
|
35
|
+
owners: Array<{
|
|
36
|
+
owner_id: string;
|
|
37
|
+
access_level: AccessGrantLevel | null;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
/** JSON:API collection of a record's grants. */
|
|
41
|
+
export interface AccessGrantListResponse {
|
|
42
|
+
data: Resource<AccessGrant>[];
|
|
43
|
+
meta: {
|
|
44
|
+
viewerAccess: AccessViewerEntry[];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** The shared record an access operation targets. */
|
|
48
|
+
interface AccessAnchor {
|
|
49
|
+
/** The shared record's object type, e.g. 'meeting', 'list', 'deal'. */
|
|
50
|
+
entity: string;
|
|
51
|
+
/** The shared record's ID. */
|
|
52
|
+
id: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One grant to create. A `workspace` grant addresses everyone, so it carries no
|
|
56
|
+
* `granteeId`.
|
|
57
|
+
*/
|
|
58
|
+
export type AccessGrantInput = {
|
|
59
|
+
granteeType: 'user';
|
|
60
|
+
/** The ID of the user to share the record with. */
|
|
61
|
+
granteeId: string;
|
|
62
|
+
accessLevel: AccessLevel;
|
|
63
|
+
/** Whether to notify the grantee. Defaults to true. */
|
|
64
|
+
notify?: boolean;
|
|
65
|
+
} | {
|
|
66
|
+
granteeType: 'workspace';
|
|
67
|
+
accessLevel: AccessLevel;
|
|
68
|
+
/** Ignored for workspace grants, which never notify. */
|
|
69
|
+
notify?: boolean;
|
|
70
|
+
};
|
|
71
|
+
export type AccessListParams = AccessAnchor;
|
|
72
|
+
export type AccessGrantParams = AccessAnchor & AccessGrantInput;
|
|
73
|
+
export interface AccessGrantBulkParams extends AccessAnchor {
|
|
74
|
+
/** Up to 1000 grants for the same record. */
|
|
75
|
+
grants: AccessGrantInput[];
|
|
76
|
+
}
|
|
77
|
+
export interface AccessUpdateParams extends AccessAnchor {
|
|
78
|
+
/** The ID of the grant to change. */
|
|
79
|
+
grantId: string;
|
|
80
|
+
accessLevel: AccessLevel;
|
|
81
|
+
}
|
|
82
|
+
export interface AccessRevokeParams extends AccessAnchor {
|
|
83
|
+
/** The ID of the grant to revoke. */
|
|
84
|
+
grantId: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Manages who can access a record: lists, creates, updates, and revokes the
|
|
88
|
+
* access grants on a single record of any shareable object (`meeting`, `list`,
|
|
89
|
+
* `message`, `task`, `deal`, `company`, `person`, or a custom object).
|
|
90
|
+
*
|
|
91
|
+
* Mutations are allowed only to the record's owner (lists, records), a
|
|
92
|
+
* participant (meetings), the owning mailbox (messages), or the assignee or
|
|
93
|
+
* creator (tasks).
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* await clarify.access.grant({
|
|
98
|
+
* entity: 'meeting',
|
|
99
|
+
* id: 'meeting-123',
|
|
100
|
+
* granteeType: 'workspace',
|
|
101
|
+
* accessLevel: 'view',
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare class AccessResource extends BaseResource {
|
|
106
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
107
|
+
private getAccessPath;
|
|
108
|
+
/**
|
|
109
|
+
* Lists every grant on a record, including the read-only `owner` row.
|
|
110
|
+
*/
|
|
111
|
+
list(params: AccessListParams): Promise<AccessGrantListResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* Shares a record with a user or the whole workspace.
|
|
114
|
+
*/
|
|
115
|
+
grant(params: AccessGrantParams): Promise<SingleResponse<AccessGrant>>;
|
|
116
|
+
/**
|
|
117
|
+
* Shares a record with several grantees in one request.
|
|
118
|
+
*/
|
|
119
|
+
grantBulk(params: AccessGrantBulkParams): Promise<AccessGrantListResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Changes the access level of an existing grant.
|
|
122
|
+
*/
|
|
123
|
+
update(params: AccessUpdateParams): Promise<SingleResponse<AccessGrant>>;
|
|
124
|
+
/**
|
|
125
|
+
* Revokes a grant. The record itself is unchanged.
|
|
126
|
+
*/
|
|
127
|
+
revoke(params: AccessRevokeParams): Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
export {};
|
|
130
|
+
//# sourceMappingURL=access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../src/resources/access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,cAAc,EACf,MAAM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CAAC;IAQnC;;OAEG;IACG,MAAM,CACV,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAavC;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAMxD"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessResource = void 0;
|
|
4
|
+
const base_resource_js_1 = require("./base-resource.js");
|
|
5
|
+
const ACCESS_GRANT_TYPE = 'object-record-access';
|
|
6
|
+
function toGrantResource(input) {
|
|
7
|
+
return {
|
|
8
|
+
type: ACCESS_GRANT_TYPE,
|
|
9
|
+
attributes: {
|
|
10
|
+
grantee_type: input.granteeType,
|
|
11
|
+
grantee_id: input.granteeType === 'user' ? input.granteeId : null,
|
|
12
|
+
access_level: input.accessLevel,
|
|
13
|
+
notify: input.notify,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Manages who can access a record: lists, creates, updates, and revokes the
|
|
19
|
+
* access grants on a single record of any shareable object (`meeting`, `list`,
|
|
20
|
+
* `message`, `task`, `deal`, `company`, `person`, or a custom object).
|
|
21
|
+
*
|
|
22
|
+
* Mutations are allowed only to the record's owner (lists, records), a
|
|
23
|
+
* participant (meetings), the owning mailbox (messages), or the assignee or
|
|
24
|
+
* creator (tasks).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* await clarify.access.grant({
|
|
29
|
+
* entity: 'meeting',
|
|
30
|
+
* id: 'meeting-123',
|
|
31
|
+
* granteeType: 'workspace',
|
|
32
|
+
* accessLevel: 'view',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
class AccessResource extends base_resource_js_1.BaseResource {
|
|
37
|
+
constructor(httpClient, config) {
|
|
38
|
+
super(httpClient, config);
|
|
39
|
+
}
|
|
40
|
+
getAccessPath(anchor) {
|
|
41
|
+
return `${this.basePath}/objects/${anchor.entity}/records/${anchor.id}/access`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Lists every grant on a record, including the read-only `owner` row.
|
|
45
|
+
*/
|
|
46
|
+
async list(params) {
|
|
47
|
+
return this.httpClient.request({
|
|
48
|
+
method: 'GET',
|
|
49
|
+
path: this.getAccessPath(params),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Shares a record with a user or the whole workspace.
|
|
54
|
+
*/
|
|
55
|
+
async grant(params) {
|
|
56
|
+
return this.httpClient.request({
|
|
57
|
+
method: 'POST',
|
|
58
|
+
path: this.getAccessPath(params),
|
|
59
|
+
body: { data: toGrantResource(params) },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Shares a record with several grantees in one request.
|
|
64
|
+
*/
|
|
65
|
+
async grantBulk(params) {
|
|
66
|
+
return this.httpClient.request({
|
|
67
|
+
method: 'POST',
|
|
68
|
+
path: `${this.getAccessPath(params)}/bulk`,
|
|
69
|
+
body: { data: params.grants.map(toGrantResource) },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Changes the access level of an existing grant.
|
|
74
|
+
*/
|
|
75
|
+
async update(params) {
|
|
76
|
+
return this.httpClient.request({
|
|
77
|
+
method: 'PATCH',
|
|
78
|
+
path: `${this.getAccessPath(params)}/${params.grantId}`,
|
|
79
|
+
body: {
|
|
80
|
+
data: {
|
|
81
|
+
type: ACCESS_GRANT_TYPE,
|
|
82
|
+
attributes: { access_level: params.accessLevel },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Revokes a grant. The record itself is unchanged.
|
|
89
|
+
*/
|
|
90
|
+
async revoke(params) {
|
|
91
|
+
await this.httpClient.request({
|
|
92
|
+
method: 'DELETE',
|
|
93
|
+
path: `${this.getAccessPath(params)}/${params.grantId}`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.AccessResource = AccessResource;
|
|
98
|
+
//# sourceMappingURL=access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../../src/resources/access.ts"],"names":[],"mappings":";;;AAMA,yDAAkD;AAElD,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AA2GjD,SAAS,eAAe,CAAC,KAAuB;IAC9C,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE;YACV,YAAY,EAAE,KAAK,CAAC,WAAW;YAC/B,UAAU,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;YACjE,YAAY,EAAE,KAAK,CAAC,WAAW;YAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,cAAe,SAAQ,+BAAY;IAC9C,YAAY,UAAsB,EAAE,MAAsB;QACxD,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAEO,aAAa,CAAC,MAAoB;QACxC,OAAO,GAAG,IAAI,CAAC,QAAQ,YAAY,MAAM,CAAC,MAAM,YAAY,MAAM,CAAC,EAAE,SAAS,CAAC;IACjF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAA0B;YACtD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,MAAyB;QACnC,O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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;;;;;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
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,M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