@getclarify/nodejs-sdk 0.0.1 → 0.0.3
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 +104 -0
- package/dist/cjs/client.d.ts +0 -11
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +0 -13
- 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 +2 -2
- package/dist/cjs/http/http-client.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/base-resource.js +1 -1
- package/dist/cjs/resources/base-resource.js.map +1 -1
- package/dist/cjs/resources/records.d.ts +65 -90
- package/dist/cjs/resources/records.d.ts.map +1 -1
- package/dist/cjs/resources/records.js +111 -165
- package/dist/cjs/resources/records.js.map +1 -1
- package/dist/cjs/types/common.d.ts +28 -0
- package/dist/cjs/types/common.d.ts.map +1 -1
- package/dist/cjs/types/config.d.ts +4 -4
- package/dist/cjs/types/config.d.ts.map +1 -1
- package/dist/cjs/types/config.js +2 -2
- package/dist/cjs/types/config.js.map +1 -1
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/client.d.ts +0 -11
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +0 -13
- 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 +2 -2
- package/dist/esm/http/http-client.js.map +1 -1
- package/dist/esm/index.d.ts +1 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/base-resource.js +1 -1
- package/dist/esm/resources/base-resource.js.map +1 -1
- package/dist/esm/resources/records.d.ts +65 -90
- package/dist/esm/resources/records.d.ts.map +1 -1
- package/dist/esm/resources/records.js +111 -165
- package/dist/esm/resources/records.js.map +1 -1
- package/dist/esm/types/common.d.ts +28 -0
- package/dist/esm/types/common.d.ts.map +1 -1
- package/dist/esm/types/config.d.ts +4 -4
- package/dist/esm/types/config.d.ts.map +1 -1
- package/dist/esm/types/config.js +2 -2
- package/dist/esm/types/config.js.map +1 -1
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/types/client.d.ts +0 -11
- 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 +1 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/records.d.ts +65 -90
- package/dist/types/resources/records.d.ts.map +1 -1
- package/dist/types/types/common.d.ts +28 -0
- package/dist/types/types/common.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +4 -4
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/dist/cjs/resources/messages.d.ts +0 -105
- package/dist/cjs/resources/messages.d.ts.map +0 -1
- package/dist/cjs/resources/messages.js +0 -166
- package/dist/cjs/resources/messages.js.map +0 -1
- package/dist/cjs/resources/relationships.d.ts +0 -96
- package/dist/cjs/resources/relationships.d.ts.map +0 -1
- package/dist/cjs/resources/relationships.js +0 -157
- package/dist/cjs/resources/relationships.js.map +0 -1
- package/dist/cjs/resources/tasks.d.ts +0 -141
- package/dist/cjs/resources/tasks.d.ts.map +0 -1
- package/dist/cjs/resources/tasks.js +0 -211
- package/dist/cjs/resources/tasks.js.map +0 -1
- package/dist/esm/resources/messages.d.ts +0 -105
- package/dist/esm/resources/messages.d.ts.map +0 -1
- package/dist/esm/resources/messages.js +0 -166
- package/dist/esm/resources/messages.js.map +0 -1
- package/dist/esm/resources/relationships.d.ts +0 -96
- package/dist/esm/resources/relationships.d.ts.map +0 -1
- package/dist/esm/resources/relationships.js +0 -157
- package/dist/esm/resources/relationships.js.map +0 -1
- package/dist/esm/resources/tasks.d.ts +0 -141
- package/dist/esm/resources/tasks.d.ts.map +0 -1
- package/dist/esm/resources/tasks.js +0 -211
- package/dist/esm/resources/tasks.js.map +0 -1
- package/dist/types/resources/messages.d.ts +0 -105
- package/dist/types/resources/messages.d.ts.map +0 -1
- package/dist/types/resources/relationships.d.ts +0 -96
- package/dist/types/resources/relationships.d.ts.map +0 -1
- package/dist/types/resources/tasks.d.ts +0 -141
- package/dist/types/resources/tasks.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @getclarify/nodejs-sdk
|
|
2
|
+
|
|
3
|
+
JavaScript/TypeScript SDK for the Clarify platform.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18.0.0
|
|
8
|
+
- npm
|
|
9
|
+
|
|
10
|
+
## Development
|
|
11
|
+
|
|
12
|
+
### Install dependencies
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Build
|
|
19
|
+
|
|
20
|
+
Build ESM, CJS, and type definitions:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Individual build targets:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run build:esm # ES modules
|
|
30
|
+
npm run build:cjs # CommonJS
|
|
31
|
+
npm run build:types # TypeScript declarations
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Clean build artifacts:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run clean
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Lint
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run lint # Check for issues
|
|
44
|
+
npm run lint:fix # Auto-fix issues
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Test
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run test # Run tests once
|
|
51
|
+
npm run test:watch # Watch mode
|
|
52
|
+
npm run test:cov # With coverage
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Type check
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run tsc # One-time check
|
|
59
|
+
npm run tsc:watch # Watch mode
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Publishing
|
|
63
|
+
|
|
64
|
+
### 1. Ensure tests pass and code is clean
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm run lint
|
|
68
|
+
npm run test
|
|
69
|
+
npm run build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 2. Update version
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm version patch # 0.0.1 -> 0.0.2
|
|
76
|
+
npm version minor # 0.0.1 -> 0.1.0
|
|
77
|
+
npm version major # 0.0.1 -> 1.0.0
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 3. Verify package contents
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm publish --dry-run
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 4. Publish
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm publish
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Authentication
|
|
93
|
+
|
|
94
|
+
If not logged in:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm login
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or set a token for CI:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm config set //registry.npmjs.org/:_authToken=YOUR_NPM_TOKEN
|
|
104
|
+
```
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { MessagesResource } from './resources/messages.js';
|
|
2
1
|
import { RecordsResource } from './resources/records.js';
|
|
3
|
-
import { TasksResource } from './resources/tasks.js';
|
|
4
2
|
import type { ClarifyClientConfig } from './types/index.js';
|
|
5
3
|
/**
|
|
6
4
|
* The main client for interacting with the Clarify API.
|
|
@@ -23,20 +21,11 @@ import type { ClarifyClientConfig } from './types/index.js';
|
|
|
23
21
|
* type: 'company',
|
|
24
22
|
* attributes: { name: 'Acme Inc.' },
|
|
25
23
|
* });
|
|
26
|
-
*
|
|
27
|
-
* // Iterate through all records
|
|
28
|
-
* for await (const company of clarify.records.iterate('company')) {
|
|
29
|
-
* console.log(company.attributes.name);
|
|
30
|
-
* }
|
|
31
24
|
* ```
|
|
32
25
|
*/
|
|
33
26
|
export declare class ClarifyClient {
|
|
34
27
|
/** Resource for managing records */
|
|
35
28
|
readonly records: RecordsResource;
|
|
36
|
-
/** Resource for managing messages */
|
|
37
|
-
readonly messages: MessagesResource;
|
|
38
|
-
/** Resource for managing tasks */
|
|
39
|
-
readonly tasks: TasksResource;
|
|
40
29
|
private readonly config;
|
|
41
30
|
private readonly httpClient;
|
|
42
31
|
/**
|
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,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;IACxB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,MAAM,EAAE,mBAAmB;IAOvC;;OAEG;IACH,OAAO,CAAC,aAAa;CA4BtB"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -3,9 +3,7 @@ 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 messages_js_1 = require("./resources/messages.js");
|
|
7
6
|
const records_js_1 = require("./resources/records.js");
|
|
8
|
-
const tasks_js_1 = require("./resources/tasks.js");
|
|
9
7
|
const index_js_2 = require("./types/index.js");
|
|
10
8
|
/**
|
|
11
9
|
* The main client for interacting with the Clarify API.
|
|
@@ -28,20 +26,11 @@ const index_js_2 = require("./types/index.js");
|
|
|
28
26
|
* type: 'company',
|
|
29
27
|
* attributes: { name: 'Acme Inc.' },
|
|
30
28
|
* });
|
|
31
|
-
*
|
|
32
|
-
* // Iterate through all records
|
|
33
|
-
* for await (const company of clarify.records.iterate('company')) {
|
|
34
|
-
* console.log(company.attributes.name);
|
|
35
|
-
* }
|
|
36
29
|
* ```
|
|
37
30
|
*/
|
|
38
31
|
class ClarifyClient {
|
|
39
32
|
/** Resource for managing records */
|
|
40
33
|
records;
|
|
41
|
-
/** Resource for managing messages */
|
|
42
|
-
messages;
|
|
43
|
-
/** Resource for managing tasks */
|
|
44
|
-
tasks;
|
|
45
34
|
config;
|
|
46
35
|
httpClient;
|
|
47
36
|
/**
|
|
@@ -54,8 +43,6 @@ class ClarifyClient {
|
|
|
54
43
|
this.config = this.resolveConfig(config);
|
|
55
44
|
this.httpClient = new http_client_js_1.HttpClient(this.config);
|
|
56
45
|
this.records = new records_js_1.RecordsResource(this.httpClient, this.config);
|
|
57
|
-
this.messages = new messages_js_1.MessagesResource(this.httpClient, this.config);
|
|
58
|
-
this.tasks = new tasks_js_1.TasksResource(this.httpClient, this.config);
|
|
59
46
|
}
|
|
60
47
|
/**
|
|
61
48
|
* 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,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAC3D,0DAAmD;AACnD,uDAAyD;AAEzD,+CAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,aAAa;IACxB,oCAAoC;IAC3B,OAAO,CAAkB;IAEjB,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;IACnE,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAA2B;QAC/C,MAAM,MAAM,GAA6B,EAAE,CAAC;QAE5C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAClD,CAAC;QAED,IAAI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Y;IAQpB;;OAEG;YACW,gBAAgB;IAiC9B;;OAEG;YACW,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;IAezD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;YACW,gBAAgB;IAiC9B;;OAEG;YACW,cAAc;IAgD5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -53,8 +53,8 @@ class HttpClient {
|
|
|
53
53
|
*/
|
|
54
54
|
buildHeaders() {
|
|
55
55
|
return {
|
|
56
|
-
'Content-Type': 'application/
|
|
57
|
-
Accept: 'application/
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
Accept: 'application/json',
|
|
58
58
|
Authorization: `api-key ${this.config.apiKey}`,
|
|
59
59
|
};
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../../src/http/http-client.ts"],"names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
|
|
|
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, } from './types/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';
|
|
5
5
|
export { RecordsResource } from './resources/records.js';
|
|
6
|
-
export { RelationshipsResource } from './resources/relationships.js';
|
|
7
|
-
export { MessagesResource, type MessageAttributes } from './resources/messages.js';
|
|
8
|
-
export { TasksResource, TaskStatus, TaskPriority, type TaskAttributes, } from './resources/tasks.js';
|
|
9
6
|
//# 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,
|
|
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"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
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; } });
|
|
@@ -14,12 +14,4 @@ Object.defineProperty(exports, "ClarifyNetworkError", { enumerable: true, get: f
|
|
|
14
14
|
// Resource exports for advanced usage
|
|
15
15
|
var records_js_1 = require("./resources/records.js");
|
|
16
16
|
Object.defineProperty(exports, "RecordsResource", { enumerable: true, get: function () { return records_js_1.RecordsResource; } });
|
|
17
|
-
var relationships_js_1 = require("./resources/relationships.js");
|
|
18
|
-
Object.defineProperty(exports, "RelationshipsResource", { enumerable: true, get: function () { return relationships_js_1.RelationshipsResource; } });
|
|
19
|
-
var messages_js_1 = require("./resources/messages.js");
|
|
20
|
-
Object.defineProperty(exports, "MessagesResource", { enumerable: true, get: function () { return messages_js_1.MessagesResource; } });
|
|
21
|
-
var tasks_js_1 = require("./resources/tasks.js");
|
|
22
|
-
Object.defineProperty(exports, "TasksResource", { enumerable: true, get: function () { return tasks_js_1.TasksResource; } });
|
|
23
|
-
Object.defineProperty(exports, "TaskStatus", { enumerable: true, get: function () { return tasks_js_1.TaskStatus; } });
|
|
24
|
-
Object.defineProperty(exports, "TaskPriority", { enumerable: true, get: function () { return tasks_js_1.TaskPriority; } });
|
|
25
17
|
//# 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;AAwBrB,sCAAsC;AACtC,qDAAyD;AAAhD,6GAAA,eAAe,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-resource.js","sourceRoot":"","sources":["../../../src/resources/base-resource.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAsB,YAAY;IACb,UAAU,CAAa;IACvB,MAAM,CAAiB;IAE1C,YAAY,UAAsB,EAAE,MAAsB;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAc,QAAQ;QACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"base-resource.js","sourceRoot":"","sources":["../../../src/resources/base-resource.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAsB,YAAY;IACb,UAAU,CAAa;IACvB,MAAM,CAAiB;IAE1C,YAAY,UAAsB,EAAE,MAAsB;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAc,QAAQ;QACpB,OAAO,kBAAkB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACnD,CAAC;CACF;AAfD,oCAeC"}
|
|
@@ -1,157 +1,132 @@
|
|
|
1
1
|
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GetRecordOptions, ListResponse, ResolvedConfig, ResourceCreate, ResourceUpdate, SingleResponse, UpdateRecordOptions } from '../types/index.js';
|
|
3
3
|
import { BaseResource } from './base-resource.js';
|
|
4
|
-
import { RelationshipsResource } from './relationships.js';
|
|
5
4
|
/**
|
|
6
5
|
* Manages CRUD operations for records.
|
|
7
6
|
*/
|
|
8
7
|
export declare class RecordsResource extends BaseResource {
|
|
9
|
-
/** Sub-resource for managing record relationships */
|
|
10
|
-
readonly relationships: RelationshipsResource;
|
|
11
8
|
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
12
9
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
16
|
-
* @param options - Pagination, filter, and sort options
|
|
17
|
-
* @returns Paginated list of records
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const companies = await clarify.records.list('company', {
|
|
22
|
-
* page: { limit: 20 },
|
|
23
|
-
* filter: { industry: 'technology' },
|
|
24
|
-
* sort: { field: 'name', direction: 'asc' },
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
10
|
+
* Gets the base path for record operations on a specific entity.
|
|
27
11
|
*/
|
|
28
|
-
|
|
12
|
+
private getEntityPath;
|
|
29
13
|
/**
|
|
30
|
-
*
|
|
14
|
+
* Retrieves a single record by ID.
|
|
31
15
|
*
|
|
32
|
-
* @param entity - The entity type
|
|
16
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
33
17
|
* @param id - The record ID
|
|
34
|
-
* @
|
|
18
|
+
* @param options - Optional parameters including relationships to include
|
|
19
|
+
* @returns The record wrapped in a JSON:API response
|
|
35
20
|
*
|
|
36
21
|
* @example
|
|
37
22
|
* ```typescript
|
|
38
|
-
* const
|
|
39
|
-
* console.log(
|
|
23
|
+
* const response = await client.records.get('company', 'abc123');
|
|
24
|
+
* console.log(response.data.attributes.name);
|
|
25
|
+
*
|
|
26
|
+
* // With included relationships
|
|
27
|
+
* const response = await client.records.get('deal', 'xyz789', {
|
|
28
|
+
* include: ['company', 'person']
|
|
29
|
+
* });
|
|
40
30
|
* ```
|
|
41
31
|
*/
|
|
42
|
-
get<T = Record<string, unknown>>(entity: string, id: string): Promise<SingleResponse<T>>;
|
|
32
|
+
get<T = Record<string, unknown>>(entity: string, id: string, options?: GetRecordOptions): Promise<SingleResponse<T>>;
|
|
43
33
|
/**
|
|
44
|
-
* Creates a
|
|
34
|
+
* Creates a single record.
|
|
45
35
|
*
|
|
46
|
-
* @param entity - The entity type
|
|
47
|
-
* @param
|
|
48
|
-
* @returns The created record
|
|
36
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
37
|
+
* @param attributes - The record attributes to create
|
|
38
|
+
* @returns The created record wrapped in a JSON:API response
|
|
49
39
|
*
|
|
50
40
|
* @example
|
|
51
41
|
* ```typescript
|
|
52
|
-
* const
|
|
53
|
-
*
|
|
54
|
-
*
|
|
42
|
+
* const response = await client.records.create('company', {
|
|
43
|
+
* name: 'Acme Corp',
|
|
44
|
+
* website: 'https://acme.com'
|
|
55
45
|
* });
|
|
46
|
+
* console.log(response.data.id);
|
|
56
47
|
* ```
|
|
57
48
|
*/
|
|
58
|
-
create<T = Record<string, unknown>>(entity: string,
|
|
49
|
+
create<T = Record<string, unknown>>(entity: string, attributes: T): Promise<SingleResponse<T>>;
|
|
59
50
|
/**
|
|
60
|
-
*
|
|
51
|
+
* Creates multiple records in bulk.
|
|
61
52
|
*
|
|
62
|
-
* @param entity - The entity type
|
|
63
|
-
* @param
|
|
64
|
-
* @
|
|
65
|
-
* @returns The updated record
|
|
53
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
54
|
+
* @param records - Array of record create objects with type and attributes
|
|
55
|
+
* @returns The created records wrapped in a JSON:API list response
|
|
66
56
|
*
|
|
67
57
|
* @example
|
|
68
58
|
* ```typescript
|
|
69
|
-
* const
|
|
70
|
-
* type: 'company',
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
59
|
+
* const response = await client.records.createBulk('company', [
|
|
60
|
+
* { type: 'company', attributes: { name: 'Acme Corp' } },
|
|
61
|
+
* { type: 'company', attributes: { name: 'Widget Inc' } }
|
|
62
|
+
* ]);
|
|
63
|
+
* console.log(response.data.length);
|
|
74
64
|
* ```
|
|
75
65
|
*/
|
|
76
|
-
|
|
66
|
+
createBulk<T = Record<string, unknown>>(entity: string, records: ResourceCreate<T>[]): Promise<ListResponse<T>>;
|
|
77
67
|
/**
|
|
78
|
-
*
|
|
68
|
+
* Updates a single record.
|
|
79
69
|
*
|
|
80
|
-
* @param entity - The entity type
|
|
70
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
81
71
|
* @param id - The record ID
|
|
72
|
+
* @param attributes - The attributes to update
|
|
73
|
+
* @param options - Optional update options including field operation rules
|
|
74
|
+
* @returns The updated record wrapped in a JSON:API response
|
|
82
75
|
*
|
|
83
76
|
* @example
|
|
84
77
|
* ```typescript
|
|
85
|
-
* await
|
|
78
|
+
* const response = await client.records.update('company', 'abc123', {
|
|
79
|
+
* name: 'Acme Corporation'
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // With field operation rules (e.g., append to array field)
|
|
83
|
+
* const response = await client.records.update('deal', 'xyz789',
|
|
84
|
+
* { tags: ['new-tag'] },
|
|
85
|
+
* { meta: { tags: { array: 'append' } } }
|
|
86
|
+
* );
|
|
86
87
|
* ```
|
|
87
88
|
*/
|
|
88
|
-
|
|
89
|
+
update<T = Record<string, unknown>>(entity: string, id: string, attributes: Partial<T>, options?: UpdateRecordOptions): Promise<SingleResponse<T>>;
|
|
89
90
|
/**
|
|
90
|
-
*
|
|
91
|
+
* Updates multiple records in bulk.
|
|
91
92
|
*
|
|
92
|
-
* @param entity - The entity type
|
|
93
|
-
* @param
|
|
94
|
-
* @
|
|
93
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
94
|
+
* @param records - Array of record update objects with type, id, and attributes
|
|
95
|
+
* @param options - Optional update options including field operation rules
|
|
96
|
+
* @returns The updated records wrapped in a JSON:API list response
|
|
95
97
|
*
|
|
96
98
|
* @example
|
|
97
99
|
* ```typescript
|
|
98
|
-
* const
|
|
99
|
-
* { type: 'company', attributes: {
|
|
100
|
-
* { type: 'company', attributes: {
|
|
100
|
+
* const response = await client.records.updateBulk('company', [
|
|
101
|
+
* { type: 'company', id: 'abc123', attributes: { status: 'active' } },
|
|
102
|
+
* { type: 'company', id: 'def456', attributes: { status: 'active' } }
|
|
101
103
|
* ]);
|
|
102
104
|
* ```
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
updateBulk<T = Record<string, unknown>>(entity: string, records: ResourceUpdate<T>[], options?: UpdateRecordOptions): Promise<ListResponse<T>>;
|
|
105
107
|
/**
|
|
106
|
-
*
|
|
108
|
+
* Deletes a single record.
|
|
107
109
|
*
|
|
108
|
-
* @param entity - The entity type
|
|
109
|
-
* @param
|
|
110
|
-
* @returns The updated records
|
|
110
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
111
|
+
* @param id - The record ID to delete
|
|
111
112
|
*
|
|
112
113
|
* @example
|
|
113
114
|
* ```typescript
|
|
114
|
-
*
|
|
115
|
-
* { type: 'company', id: 'id-1', attributes: { industry: 'tech' } },
|
|
116
|
-
* { type: 'company', id: 'id-2', attributes: { industry: 'finance' } },
|
|
117
|
-
* ]);
|
|
115
|
+
* await client.records.delete('company', 'abc123');
|
|
118
116
|
* ```
|
|
119
117
|
*/
|
|
120
|
-
|
|
118
|
+
delete(entity: string, id: string): Promise<void>;
|
|
121
119
|
/**
|
|
122
120
|
* Deletes multiple records in bulk.
|
|
123
121
|
*
|
|
124
|
-
* @param entity - The entity type
|
|
122
|
+
* @param entity - The entity type (e.g., 'company', 'person', 'deal')
|
|
125
123
|
* @param ids - Array of record IDs to delete
|
|
126
124
|
*
|
|
127
125
|
* @example
|
|
128
126
|
* ```typescript
|
|
129
|
-
* await
|
|
127
|
+
* await client.records.deleteBulk('company', ['abc123', 'def456']);
|
|
130
128
|
* ```
|
|
131
129
|
*/
|
|
132
130
|
deleteBulk(entity: string, ids: string[]): Promise<void>;
|
|
133
|
-
/**
|
|
134
|
-
* Async iterator for paginating through all records.
|
|
135
|
-
*
|
|
136
|
-
* @param entity - The entity type
|
|
137
|
-
* @param options - Filter and sort options (pagination is handled automatically)
|
|
138
|
-
* @yields Individual records
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```typescript
|
|
142
|
-
* for await (const company of clarify.records.iterate('company')) {
|
|
143
|
-
* console.log(company.attributes.name);
|
|
144
|
-
* }
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
iterate<T = Record<string, unknown>>(entity: string, options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
|
|
148
|
-
/**
|
|
149
|
-
* Builds query parameters from list options.
|
|
150
|
-
*/
|
|
151
|
-
private buildListQuery;
|
|
152
|
-
/**
|
|
153
|
-
* Extracts the cursor from a pagination URL.
|
|
154
|
-
*/
|
|
155
|
-
private extractCursor;
|
|
156
131
|
}
|
|
157
132
|
//# sourceMappingURL=records.d.ts.map
|
|
@@ -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,
|
|
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,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;;;;;;;;;OAkBG;IACG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAc7B;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,U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