@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.
Files changed (97) hide show
  1. package/README.md +104 -0
  2. package/dist/cjs/client.d.ts +0 -11
  3. package/dist/cjs/client.d.ts.map +1 -1
  4. package/dist/cjs/client.js +0 -13
  5. package/dist/cjs/client.js.map +1 -1
  6. package/dist/cjs/http/http-client.d.ts.map +1 -1
  7. package/dist/cjs/http/http-client.js +2 -2
  8. package/dist/cjs/http/http-client.js.map +1 -1
  9. package/dist/cjs/index.d.ts +1 -4
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +1 -9
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/resources/base-resource.js +1 -1
  14. package/dist/cjs/resources/base-resource.js.map +1 -1
  15. package/dist/cjs/resources/records.d.ts +65 -90
  16. package/dist/cjs/resources/records.d.ts.map +1 -1
  17. package/dist/cjs/resources/records.js +111 -165
  18. package/dist/cjs/resources/records.js.map +1 -1
  19. package/dist/cjs/types/common.d.ts +28 -0
  20. package/dist/cjs/types/common.d.ts.map +1 -1
  21. package/dist/cjs/types/config.d.ts +4 -4
  22. package/dist/cjs/types/config.d.ts.map +1 -1
  23. package/dist/cjs/types/config.js +2 -2
  24. package/dist/cjs/types/config.js.map +1 -1
  25. package/dist/cjs/types/index.d.ts +2 -2
  26. package/dist/cjs/types/index.d.ts.map +1 -1
  27. package/dist/cjs/types/index.js.map +1 -1
  28. package/dist/esm/client.d.ts +0 -11
  29. package/dist/esm/client.d.ts.map +1 -1
  30. package/dist/esm/client.js +0 -13
  31. package/dist/esm/client.js.map +1 -1
  32. package/dist/esm/http/http-client.d.ts.map +1 -1
  33. package/dist/esm/http/http-client.js +2 -2
  34. package/dist/esm/http/http-client.js.map +1 -1
  35. package/dist/esm/index.d.ts +1 -4
  36. package/dist/esm/index.d.ts.map +1 -1
  37. package/dist/esm/index.js +1 -9
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/resources/base-resource.js +1 -1
  40. package/dist/esm/resources/base-resource.js.map +1 -1
  41. package/dist/esm/resources/records.d.ts +65 -90
  42. package/dist/esm/resources/records.d.ts.map +1 -1
  43. package/dist/esm/resources/records.js +111 -165
  44. package/dist/esm/resources/records.js.map +1 -1
  45. package/dist/esm/types/common.d.ts +28 -0
  46. package/dist/esm/types/common.d.ts.map +1 -1
  47. package/dist/esm/types/config.d.ts +4 -4
  48. package/dist/esm/types/config.d.ts.map +1 -1
  49. package/dist/esm/types/config.js +2 -2
  50. package/dist/esm/types/config.js.map +1 -1
  51. package/dist/esm/types/index.d.ts +2 -2
  52. package/dist/esm/types/index.d.ts.map +1 -1
  53. package/dist/esm/types/index.js.map +1 -1
  54. package/dist/types/client.d.ts +0 -11
  55. package/dist/types/client.d.ts.map +1 -1
  56. package/dist/types/http/http-client.d.ts.map +1 -1
  57. package/dist/types/index.d.ts +1 -4
  58. package/dist/types/index.d.ts.map +1 -1
  59. package/dist/types/resources/records.d.ts +65 -90
  60. package/dist/types/resources/records.d.ts.map +1 -1
  61. package/dist/types/types/common.d.ts +28 -0
  62. package/dist/types/types/common.d.ts.map +1 -1
  63. package/dist/types/types/config.d.ts +4 -4
  64. package/dist/types/types/config.d.ts.map +1 -1
  65. package/dist/types/types/index.d.ts +2 -2
  66. package/dist/types/types/index.d.ts.map +1 -1
  67. package/package.json +37 -37
  68. package/dist/cjs/resources/messages.d.ts +0 -105
  69. package/dist/cjs/resources/messages.d.ts.map +0 -1
  70. package/dist/cjs/resources/messages.js +0 -166
  71. package/dist/cjs/resources/messages.js.map +0 -1
  72. package/dist/cjs/resources/relationships.d.ts +0 -96
  73. package/dist/cjs/resources/relationships.d.ts.map +0 -1
  74. package/dist/cjs/resources/relationships.js +0 -157
  75. package/dist/cjs/resources/relationships.js.map +0 -1
  76. package/dist/cjs/resources/tasks.d.ts +0 -141
  77. package/dist/cjs/resources/tasks.d.ts.map +0 -1
  78. package/dist/cjs/resources/tasks.js +0 -211
  79. package/dist/cjs/resources/tasks.js.map +0 -1
  80. package/dist/esm/resources/messages.d.ts +0 -105
  81. package/dist/esm/resources/messages.d.ts.map +0 -1
  82. package/dist/esm/resources/messages.js +0 -166
  83. package/dist/esm/resources/messages.js.map +0 -1
  84. package/dist/esm/resources/relationships.d.ts +0 -96
  85. package/dist/esm/resources/relationships.d.ts.map +0 -1
  86. package/dist/esm/resources/relationships.js +0 -157
  87. package/dist/esm/resources/relationships.js.map +0 -1
  88. package/dist/esm/resources/tasks.d.ts +0 -141
  89. package/dist/esm/resources/tasks.d.ts.map +0 -1
  90. package/dist/esm/resources/tasks.js +0 -211
  91. package/dist/esm/resources/tasks.js.map +0 -1
  92. package/dist/types/resources/messages.d.ts +0 -105
  93. package/dist/types/resources/messages.d.ts.map +0 -1
  94. package/dist/types/resources/relationships.d.ts +0 -96
  95. package/dist/types/resources/relationships.d.ts.map +0 -1
  96. package/dist/types/resources/tasks.d.ts +0 -141
  97. package/dist/types/resources/tasks.d.ts.map +0 -1
@@ -1,96 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU3B;;;;;;;;;;;;;;;;OAgBG;IACG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,EAAE,GAC5B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU3B;;;;;;;;;;;;;;OAcG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,EAAE,GAC5B,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;;;;;;;;;;;;OAeG;IACI,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,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"}
@@ -1,141 +0,0 @@
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
- /**
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
@@ -1 +0,0 @@
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,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,UAAU,gBAAgB;IAC1B,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EAClD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU3B;;;;;;;;;;;OAWG;IACG,GAAG,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACjD,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAO7B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACpD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAU7B;;;;;;;;;;;;;;;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"}