@getclarify/nodejs-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client.d.ts +54 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/client.js +88 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/errors/api-error.d.ts +59 -0
- package/dist/cjs/errors/api-error.d.ts.map +1 -0
- package/dist/cjs/errors/api-error.js +104 -0
- package/dist/cjs/errors/api-error.js.map +1 -0
- package/dist/cjs/errors/index.d.ts +3 -0
- package/dist/cjs/errors/index.d.ts.map +1 -0
- package/dist/cjs/errors/index.js +10 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/http/http-client.d.ts +46 -0
- package/dist/cjs/http/http-client.d.ts.map +1 -0
- package/dist/cjs/http/http-client.js +145 -0
- package/dist/cjs/http/http-client.js.map +1 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/resources/base-resource.d.ts +15 -0
- package/dist/cjs/resources/base-resource.d.ts.map +1 -0
- package/dist/cjs/resources/base-resource.js +22 -0
- package/dist/cjs/resources/base-resource.js.map +1 -0
- package/dist/cjs/resources/messages.d.ts +105 -0
- package/dist/cjs/resources/messages.d.ts.map +1 -0
- package/dist/cjs/resources/messages.js +166 -0
- package/dist/cjs/resources/messages.js.map +1 -0
- package/dist/cjs/resources/records.d.ts +157 -0
- package/dist/cjs/resources/records.d.ts.map +1 -0
- package/dist/cjs/resources/records.js +264 -0
- package/dist/cjs/resources/records.js.map +1 -0
- package/dist/cjs/resources/relationships.d.ts +96 -0
- package/dist/cjs/resources/relationships.d.ts.map +1 -0
- package/dist/cjs/resources/relationships.js +157 -0
- package/dist/cjs/resources/relationships.js.map +1 -0
- package/dist/cjs/resources/tasks.d.ts +141 -0
- package/dist/cjs/resources/tasks.d.ts.map +1 -0
- package/dist/cjs/resources/tasks.js +211 -0
- package/dist/cjs/resources/tasks.js.map +1 -0
- package/dist/cjs/types/common.d.ts +126 -0
- package/dist/cjs/types/common.d.ts.map +1 -0
- package/dist/cjs/types/common.js +3 -0
- package/dist/cjs/types/common.js.map +1 -0
- package/dist/cjs/types/config.d.ts +36 -0
- package/dist/cjs/types/config.d.ts.map +1 -0
- package/dist/cjs/types/config.js +11 -0
- package/dist/cjs/types/config.js.map +1 -0
- package/dist/cjs/types/index.d.ts +4 -0
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/index.js +6 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/client.d.ts +54 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +88 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/errors/api-error.d.ts +59 -0
- package/dist/esm/errors/api-error.d.ts.map +1 -0
- package/dist/esm/errors/api-error.js +104 -0
- package/dist/esm/errors/api-error.js.map +1 -0
- package/dist/esm/errors/index.d.ts +3 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/errors/index.js +10 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/http/http-client.d.ts +46 -0
- package/dist/esm/http/http-client.d.ts.map +1 -0
- package/dist/esm/http/http-client.js +145 -0
- package/dist/esm/http/http-client.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +25 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/resources/base-resource.d.ts +15 -0
- package/dist/esm/resources/base-resource.d.ts.map +1 -0
- package/dist/esm/resources/base-resource.js +22 -0
- package/dist/esm/resources/base-resource.js.map +1 -0
- package/dist/esm/resources/messages.d.ts +105 -0
- package/dist/esm/resources/messages.d.ts.map +1 -0
- package/dist/esm/resources/messages.js +166 -0
- package/dist/esm/resources/messages.js.map +1 -0
- package/dist/esm/resources/records.d.ts +157 -0
- package/dist/esm/resources/records.d.ts.map +1 -0
- package/dist/esm/resources/records.js +264 -0
- package/dist/esm/resources/records.js.map +1 -0
- package/dist/esm/resources/relationships.d.ts +96 -0
- package/dist/esm/resources/relationships.d.ts.map +1 -0
- package/dist/esm/resources/relationships.js +157 -0
- package/dist/esm/resources/relationships.js.map +1 -0
- package/dist/esm/resources/tasks.d.ts +141 -0
- package/dist/esm/resources/tasks.d.ts.map +1 -0
- package/dist/esm/resources/tasks.js +211 -0
- package/dist/esm/resources/tasks.js.map +1 -0
- package/dist/esm/types/common.d.ts +126 -0
- package/dist/esm/types/common.d.ts.map +1 -0
- package/dist/esm/types/common.js +3 -0
- package/dist/esm/types/common.js.map +1 -0
- package/dist/esm/types/config.d.ts +36 -0
- package/dist/esm/types/config.d.ts.map +1 -0
- package/dist/esm/types/config.js +11 -0
- package/dist/esm/types/config.js.map +1 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +6 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/types/client.d.ts +54 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/errors/api-error.d.ts +59 -0
- package/dist/types/errors/api-error.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +3 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/http/http-client.d.ts +46 -0
- package/dist/types/http/http-client.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/resources/base-resource.d.ts +15 -0
- package/dist/types/resources/base-resource.d.ts.map +1 -0
- package/dist/types/resources/messages.d.ts +105 -0
- package/dist/types/resources/messages.d.ts.map +1 -0
- package/dist/types/resources/records.d.ts +157 -0
- package/dist/types/resources/records.d.ts.map +1 -0
- package/dist/types/resources/relationships.d.ts +96 -0
- package/dist/types/resources/relationships.d.ts.map +1 -0
- package/dist/types/resources/tasks.d.ts +141 -0
- package/dist/types/resources/tasks.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +126 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +36 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
+
import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceCreate, ResourceUpdate, SingleResponse } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
import { RelationshipsResource } from './relationships.js';
|
|
5
|
+
/**
|
|
6
|
+
* Manages CRUD operations for records.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RecordsResource extends BaseResource {
|
|
9
|
+
/** Sub-resource for managing record relationships */
|
|
10
|
+
readonly relationships: RelationshipsResource;
|
|
11
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Lists records of a given entity type.
|
|
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
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
list<T = Record<string, unknown>>(entity: string, options?: ListOptions): Promise<ListResponse<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* Gets a single record by ID.
|
|
31
|
+
*
|
|
32
|
+
* @param entity - The entity type
|
|
33
|
+
* @param id - The record ID
|
|
34
|
+
* @returns The record
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const company = await clarify.records.get('company', 'company-id');
|
|
39
|
+
* console.log(company.data.attributes.name);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
get<T = Record<string, unknown>>(entity: string, id: string): Promise<SingleResponse<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new record.
|
|
45
|
+
*
|
|
46
|
+
* @param entity - The entity type
|
|
47
|
+
* @param data - The resource data to create
|
|
48
|
+
* @returns The created record
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const company = await clarify.records.create('company', {
|
|
53
|
+
* type: 'company',
|
|
54
|
+
* attributes: { name: 'Acme Inc.', industry: 'technology' },
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
create<T = Record<string, unknown>>(entity: string, data: ResourceCreate<T>): Promise<SingleResponse<T>>;
|
|
59
|
+
/**
|
|
60
|
+
* Updates an existing record.
|
|
61
|
+
*
|
|
62
|
+
* @param entity - The entity type
|
|
63
|
+
* @param id - The record ID
|
|
64
|
+
* @param data - The resource data to update
|
|
65
|
+
* @returns The updated record
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const company = await clarify.records.update('company', 'company-id', {
|
|
70
|
+
* type: 'company',
|
|
71
|
+
* id: 'company-id',
|
|
72
|
+
* attributes: { industry: 'software' },
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
update<T = Record<string, unknown>>(entity: string, id: string, data: ResourceUpdate<T>): Promise<SingleResponse<T>>;
|
|
77
|
+
/**
|
|
78
|
+
* Deletes a record.
|
|
79
|
+
*
|
|
80
|
+
* @param entity - The entity type
|
|
81
|
+
* @param id - The record ID
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* await clarify.records.delete('company', 'company-id');
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
delete(entity: string, id: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Creates multiple records in bulk.
|
|
91
|
+
*
|
|
92
|
+
* @param entity - The entity type
|
|
93
|
+
* @param data - Array of resources to create
|
|
94
|
+
* @returns The created records
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const companies = await clarify.records.createBulk('company', [
|
|
99
|
+
* { type: 'company', attributes: { name: 'Acme Inc.' } },
|
|
100
|
+
* { type: 'company', attributes: { name: 'Globex Corp.' } },
|
|
101
|
+
* ]);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
createBulk<T = Record<string, unknown>>(entity: string, data: ResourceCreate<T>[]): Promise<ListResponse<T>>;
|
|
105
|
+
/**
|
|
106
|
+
* Updates multiple records in bulk.
|
|
107
|
+
*
|
|
108
|
+
* @param entity - The entity type
|
|
109
|
+
* @param data - Array of resources to update
|
|
110
|
+
* @returns The updated records
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const companies = await clarify.records.updateBulk('company', [
|
|
115
|
+
* { type: 'company', id: 'id-1', attributes: { industry: 'tech' } },
|
|
116
|
+
* { type: 'company', id: 'id-2', attributes: { industry: 'finance' } },
|
|
117
|
+
* ]);
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
updateBulk<T = Record<string, unknown>>(entity: string, data: ResourceUpdate<T>[]): Promise<ListResponse<T>>;
|
|
121
|
+
/**
|
|
122
|
+
* Deletes multiple records in bulk.
|
|
123
|
+
*
|
|
124
|
+
* @param entity - The entity type
|
|
125
|
+
* @param ids - Array of record IDs to delete
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* await clarify.records.deleteBulk('company', ['id-1', 'id-2', 'id-3']);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
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
|
+
}
|
|
157
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +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,EAKV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,qDAAqD;IACrD,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;gBAElC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAK1D;;;;;;;;;;;;;;;OAeG;IACG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M,EACd,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,GACxB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU3B;;;;;;;;;;OAUG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9D;;;;;;;;;;;;;OAaG;IACI,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAClC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAkB/C;;OAEG;IACH,OAAO,CAAC,cAAc;IAgCtB;;OAEG;IACH,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
+
import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceIdentifier } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
/**
|
|
5
|
+
* Request body for adding relationships.
|
|
6
|
+
*/
|
|
7
|
+
export interface AddRelationshipsBody {
|
|
8
|
+
data: ResourceIdentifier[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Request body for removing relationships.
|
|
12
|
+
*/
|
|
13
|
+
export interface RemoveRelationshipsBody {
|
|
14
|
+
data: ResourceIdentifier[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Manages relationships between records.
|
|
18
|
+
*/
|
|
19
|
+
export declare class RelationshipsResource extends BaseResource {
|
|
20
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
21
|
+
/**
|
|
22
|
+
* Lists related records for a given record and relationship.
|
|
23
|
+
*
|
|
24
|
+
* @param entity - The entity type of the source record
|
|
25
|
+
* @param recordId - The ID of the source record
|
|
26
|
+
* @param relationship - The name of the relationship
|
|
27
|
+
* @param options - Pagination and filter options
|
|
28
|
+
* @returns Paginated list of related records
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const people = await clarify.records.relationships.list('company', 'company-id', 'people');
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
list<T = Record<string, unknown>>(entity: string, recordId: string, relationship: string, options?: ListOptions): Promise<ListResponse<T>>;
|
|
36
|
+
/**
|
|
37
|
+
* Adds relationships between a source record and target records.
|
|
38
|
+
*
|
|
39
|
+
* @param entity - The entity type of the source record
|
|
40
|
+
* @param recordId - The ID of the source record
|
|
41
|
+
* @param relationship - The name of the relationship
|
|
42
|
+
* @param targets - Array of resource identifiers to add
|
|
43
|
+
* @returns The updated list of related records
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* await clarify.records.relationships.add('company', 'company-id', 'people', [
|
|
48
|
+
* { type: 'person', id: 'person-id-1' },
|
|
49
|
+
* { type: 'person', id: 'person-id-2' },
|
|
50
|
+
* ]);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
add<T = Record<string, unknown>>(entity: string, recordId: string, relationship: string, targets: ResourceIdentifier[]): Promise<ListResponse<T>>;
|
|
54
|
+
/**
|
|
55
|
+
* Removes relationships between a source record and target records.
|
|
56
|
+
*
|
|
57
|
+
* @param entity - The entity type of the source record
|
|
58
|
+
* @param recordId - The ID of the source record
|
|
59
|
+
* @param relationship - The name of the relationship
|
|
60
|
+
* @param targets - Array of resource identifiers to remove
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* await clarify.records.relationships.remove('company', 'company-id', 'people', [
|
|
65
|
+
* { type: 'person', id: 'person-id-1' },
|
|
66
|
+
* ]);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
remove(entity: string, recordId: string, relationship: string, targets: ResourceIdentifier[]): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Async iterator for paginating through all related records.
|
|
72
|
+
*
|
|
73
|
+
* @param entity - The entity type of the source record
|
|
74
|
+
* @param recordId - The ID of the source record
|
|
75
|
+
* @param relationship - The name of the relationship
|
|
76
|
+
* @param options - Filter and sort options (pagination is handled automatically)
|
|
77
|
+
* @yields Individual related records
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* for await (const person of clarify.records.relationships.iterate('company', 'company-id', 'people')) {
|
|
82
|
+
* console.log(person.attributes.name);
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
iterate<T = Record<string, unknown>>(entity: string, recordId: string, relationship: string, options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
|
|
87
|
+
/**
|
|
88
|
+
* Builds query parameters from list options.
|
|
89
|
+
*/
|
|
90
|
+
private buildListQuery;
|
|
91
|
+
/**
|
|
92
|
+
* Extracts the cursor from a pagination URL.
|
|
93
|
+
*/
|
|
94
|
+
private extractCursor;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../../src/resources/relationships.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,EAAE,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
2
|
+
import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceCreate, ResourceUpdate, SingleResponse } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
/**
|
|
5
|
+
* Task status values.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TaskStatus {
|
|
8
|
+
Pending = "pending",
|
|
9
|
+
InProgress = "in_progress",
|
|
10
|
+
Completed = "completed",
|
|
11
|
+
Cancelled = "cancelled"
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Task priority values.
|
|
15
|
+
*/
|
|
16
|
+
export declare enum TaskPriority {
|
|
17
|
+
Low = "low",
|
|
18
|
+
Medium = "medium",
|
|
19
|
+
High = "high",
|
|
20
|
+
Urgent = "urgent"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Task attributes.
|
|
24
|
+
*/
|
|
25
|
+
export interface TaskAttributes {
|
|
26
|
+
title?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
status?: TaskStatus;
|
|
29
|
+
priority?: TaskPriority;
|
|
30
|
+
due_date?: string;
|
|
31
|
+
assignee_id?: string;
|
|
32
|
+
record_id?: string;
|
|
33
|
+
record_type?: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Manages tasks in the Clarify platform.
|
|
38
|
+
*/
|
|
39
|
+
export declare class TasksResource extends BaseResource {
|
|
40
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Lists tasks.
|
|
43
|
+
*
|
|
44
|
+
* @param options - Pagination, filter, and sort options
|
|
45
|
+
* @returns Paginated list of tasks
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const tasks = await clarify.tasks.list({
|
|
50
|
+
* page: { limit: 20 },
|
|
51
|
+
* filter: { status: 'pending', assignee_id: 'user-id' },
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
list<T extends TaskAttributes = TaskAttributes>(options?: ListOptions): Promise<ListResponse<T>>;
|
|
56
|
+
/**
|
|
57
|
+
* Gets a single task by ID.
|
|
58
|
+
*
|
|
59
|
+
* @param id - The task ID
|
|
60
|
+
* @returns The task
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const task = await clarify.tasks.get('task-id');
|
|
65
|
+
* console.log(task.data.attributes.title);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
get<T extends TaskAttributes = TaskAttributes>(id: string): Promise<SingleResponse<T>>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new task.
|
|
71
|
+
*
|
|
72
|
+
* @param data - The task data to create
|
|
73
|
+
* @returns The created task
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const task = await clarify.tasks.create({
|
|
78
|
+
* type: 'task',
|
|
79
|
+
* attributes: {
|
|
80
|
+
* title: 'Follow up with client',
|
|
81
|
+
* description: 'Schedule a demo call',
|
|
82
|
+
* status: TaskStatus.Pending,
|
|
83
|
+
* priority: TaskPriority.High,
|
|
84
|
+
* due_date: '2024-12-31',
|
|
85
|
+
* },
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
create<T extends TaskAttributes = TaskAttributes>(data: ResourceCreate<T>): Promise<SingleResponse<T>>;
|
|
90
|
+
/**
|
|
91
|
+
* Updates an existing task.
|
|
92
|
+
*
|
|
93
|
+
* @param id - The task ID
|
|
94
|
+
* @param data - The task data to update
|
|
95
|
+
* @returns The updated task
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const task = await clarify.tasks.update('task-id', {
|
|
100
|
+
* type: 'task',
|
|
101
|
+
* id: 'task-id',
|
|
102
|
+
* attributes: { status: TaskStatus.Completed },
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
update<T extends TaskAttributes = TaskAttributes>(id: string, data: ResourceUpdate<T>): Promise<SingleResponse<T>>;
|
|
107
|
+
/**
|
|
108
|
+
* Deletes a task.
|
|
109
|
+
*
|
|
110
|
+
* @param id - The task ID
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* await clarify.tasks.delete('task-id');
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
delete(id: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Async iterator for paginating through all tasks.
|
|
120
|
+
*
|
|
121
|
+
* @param options - Filter and sort options (pagination is handled automatically)
|
|
122
|
+
* @yields Individual tasks
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* for await (const task of clarify.tasks.iterate({ filter: { status: 'pending' } })) {
|
|
127
|
+
* console.log(task.attributes.title);
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
iterate<T extends TaskAttributes = TaskAttributes>(options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Builds query parameters from list options.
|
|
134
|
+
*/
|
|
135
|
+
private buildListQuery;
|
|
136
|
+
/**
|
|
137
|
+
* Extracts the cursor from a pagination URL.
|
|
138
|
+
*/
|
|
139
|
+
private extractCursor;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/resources/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EAEf,MAAM,mBA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;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACpD,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAU7B;;;;;;;;;OASG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvC;;;;;;;;;;;;OAYG;IACI,OAAO,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACtD,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAClC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAiB/C;;OAEG;IACH,OAAO,CAAC,cAAc;IAgCtB;;OAEG;IACH,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON:API resource identifier.
|
|
3
|
+
*/
|
|
4
|
+
export interface ResourceIdentifier {
|
|
5
|
+
type: string;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* JSON:API resource object with attributes.
|
|
10
|
+
*/
|
|
11
|
+
export interface Resource<T = Record<string, unknown>> {
|
|
12
|
+
type: string;
|
|
13
|
+
id: string;
|
|
14
|
+
attributes: T;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* JSON:API resource for creation (no id required).
|
|
18
|
+
*/
|
|
19
|
+
export interface ResourceCreate<T = Record<string, unknown>> {
|
|
20
|
+
type: string;
|
|
21
|
+
attributes: T;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* JSON:API resource for update.
|
|
25
|
+
*/
|
|
26
|
+
export interface ResourceUpdate<T = Record<string, unknown>> {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
attributes: Partial<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* JSON:API single resource response.
|
|
33
|
+
*/
|
|
34
|
+
export interface SingleResponse<T = Record<string, unknown>> {
|
|
35
|
+
data: Resource<T>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* JSON:API paginated list response.
|
|
39
|
+
*/
|
|
40
|
+
export interface ListResponse<T = Record<string, unknown>> {
|
|
41
|
+
data: Resource<T>[];
|
|
42
|
+
links?: PaginationLinks;
|
|
43
|
+
meta?: PaginationMeta;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* JSON:API pagination links.
|
|
47
|
+
*/
|
|
48
|
+
export interface PaginationLinks {
|
|
49
|
+
first?: string;
|
|
50
|
+
last?: string;
|
|
51
|
+
prev?: string;
|
|
52
|
+
next?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* JSON:API pagination metadata.
|
|
56
|
+
*/
|
|
57
|
+
export interface PaginationMeta {
|
|
58
|
+
total_records?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Pagination options for list requests.
|
|
62
|
+
*/
|
|
63
|
+
export interface PaginationOptions {
|
|
64
|
+
/** Page cursor for cursor-based pagination */
|
|
65
|
+
cursor?: string;
|
|
66
|
+
/** Maximum number of records to return (default: 20, max: 100) */
|
|
67
|
+
limit?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Filter options for list requests.
|
|
71
|
+
*/
|
|
72
|
+
export interface FilterOptions {
|
|
73
|
+
[key: string]: string | number | boolean | string[] | undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Sort options for list requests.
|
|
77
|
+
*/
|
|
78
|
+
export interface SortOptions {
|
|
79
|
+
/** Field to sort by */
|
|
80
|
+
field: string;
|
|
81
|
+
/** Sort direction */
|
|
82
|
+
direction: 'asc' | 'desc';
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Common list request options.
|
|
86
|
+
*/
|
|
87
|
+
export interface ListOptions {
|
|
88
|
+
page?: PaginationOptions;
|
|
89
|
+
filter?: FilterOptions;
|
|
90
|
+
sort?: SortOptions | SortOptions[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Request body for creating a single resource.
|
|
94
|
+
*/
|
|
95
|
+
export interface CreateBody<T = Record<string, unknown>> {
|
|
96
|
+
data: ResourceCreate<T>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Request body for updating a single resource.
|
|
100
|
+
*/
|
|
101
|
+
export interface UpdateBody<T = Record<string, unknown>> {
|
|
102
|
+
data: ResourceUpdate<T>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Request body for bulk create operations.
|
|
106
|
+
*/
|
|
107
|
+
export interface BulkCreateBody<T = Record<string, unknown>> {
|
|
108
|
+
data: ResourceCreate<T>[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Request body for bulk update operations.
|
|
112
|
+
*/
|
|
113
|
+
export interface BulkUpdateBody<T = Record<string, unknown>> {
|
|
114
|
+
data: ResourceUpdate<T>[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Request body for bulk delete operations.
|
|
118
|
+
*/
|
|
119
|
+
export interface BulkDeleteBody {
|
|
120
|
+
data: ResourceIdentifier[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* HTTP methods supported by the SDK.
|
|
124
|
+
*/
|
|
125
|
+
export type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
126
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +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,CA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AAO,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for the Clarify SDK client.
|
|
3
|
+
*/
|
|
4
|
+
export interface ClarifyClientConfig {
|
|
5
|
+
/** Base URL for the Clarify API (e.g., 'https://api.clarify.ai') */
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
/** API key for authentication (format: 'clrfy_sk_...') */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** Workspace slug for API calls */
|
|
10
|
+
workspace: string;
|
|
11
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
12
|
+
timeout?: number;
|
|
13
|
+
/** Number of retry attempts for failed requests (default: 3) */
|
|
14
|
+
retries?: number;
|
|
15
|
+
/** Custom fetch implementation (default: global fetch) */
|
|
16
|
+
fetch?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Internal resolved configuration with all defaults applied.
|
|
20
|
+
*/
|
|
21
|
+
export interface ResolvedConfig {
|
|
22
|
+
baseUrl: string;
|
|
23
|
+
apiKey: string;
|
|
24
|
+
workspace: string;
|
|
25
|
+
timeout: number;
|
|
26
|
+
retries: number;
|
|
27
|
+
fetch: typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Default configuration values.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_CONFIG: {
|
|
33
|
+
readonly timeout: 30000;
|
|
34
|
+
readonly retries: 3;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAEhB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IAEf,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ClarifyClientConfig, ResolvedConfig, } from './config.js';
|
|
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, } from './common.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,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,GACX,MAAM,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getclarify/nodejs-sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org/"
|
|
8
|
+
},
|
|
9
|
+
"description": "JavaScript/TypeScript SDK for Clarify platform",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"module": "./dist/esm/index.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./dist/esm/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"default": "./dist/cjs/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "npm run build:esm && npm run build:cjs && npm run build:types",
|
|
30
|
+
"build:esm": "tsc -p tsconfig.build.json --module NodeNext --moduleResolution NodeNext --outDir dist/esm",
|
|
31
|
+
"build:cjs": "tsc -p tsconfig.build.json --module CommonJS --moduleResolution Node --outDir dist/cjs",
|
|
32
|
+
"build:types": "tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist/types",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
35
|
+
"lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:watch": "vitest --watch",
|
|
38
|
+
"test:cov": "vitest run --coverage",
|
|
39
|
+
"tsc": "tsc --noEmit",
|
|
40
|
+
"tsc:watch": "tsc --noEmit --watch"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@vitest/coverage-v8": "^3.1.2",
|
|
44
|
+
"eslint": "^8.57.0",
|
|
45
|
+
"eslint-config-prettier": "^10.1.8",
|
|
46
|
+
"prettier": "^3.7.4",
|
|
47
|
+
"typescript": "^5.9.3",
|
|
48
|
+
"typescript-eslint": "^8.47.0",
|
|
49
|
+
"vite": "^7.3.1",
|
|
50
|
+
"vitest": "^3.0.8"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"clarify",
|
|
57
|
+
"crm",
|
|
58
|
+
"sdk",
|
|
59
|
+
"api",
|
|
60
|
+
"client"
|
|
61
|
+
],
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/clarify/clarify.git",
|
|
66
|
+
"directory": "packages/sdk/js"
|
|
67
|
+
}
|
|
68
|
+
}
|