@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.
Files changed (131) hide show
  1. package/dist/cjs/client.d.ts +54 -0
  2. package/dist/cjs/client.d.ts.map +1 -0
  3. package/dist/cjs/client.js +88 -0
  4. package/dist/cjs/client.js.map +1 -0
  5. package/dist/cjs/errors/api-error.d.ts +59 -0
  6. package/dist/cjs/errors/api-error.d.ts.map +1 -0
  7. package/dist/cjs/errors/api-error.js +104 -0
  8. package/dist/cjs/errors/api-error.js.map +1 -0
  9. package/dist/cjs/errors/index.d.ts +3 -0
  10. package/dist/cjs/errors/index.d.ts.map +1 -0
  11. package/dist/cjs/errors/index.js +10 -0
  12. package/dist/cjs/errors/index.js.map +1 -0
  13. package/dist/cjs/http/http-client.d.ts +46 -0
  14. package/dist/cjs/http/http-client.d.ts.map +1 -0
  15. package/dist/cjs/http/http-client.js +145 -0
  16. package/dist/cjs/http/http-client.js.map +1 -0
  17. package/dist/cjs/index.d.ts +9 -0
  18. package/dist/cjs/index.d.ts.map +1 -0
  19. package/dist/cjs/index.js +25 -0
  20. package/dist/cjs/index.js.map +1 -0
  21. package/dist/cjs/resources/base-resource.d.ts +15 -0
  22. package/dist/cjs/resources/base-resource.d.ts.map +1 -0
  23. package/dist/cjs/resources/base-resource.js +22 -0
  24. package/dist/cjs/resources/base-resource.js.map +1 -0
  25. package/dist/cjs/resources/messages.d.ts +105 -0
  26. package/dist/cjs/resources/messages.d.ts.map +1 -0
  27. package/dist/cjs/resources/messages.js +166 -0
  28. package/dist/cjs/resources/messages.js.map +1 -0
  29. package/dist/cjs/resources/records.d.ts +157 -0
  30. package/dist/cjs/resources/records.d.ts.map +1 -0
  31. package/dist/cjs/resources/records.js +264 -0
  32. package/dist/cjs/resources/records.js.map +1 -0
  33. package/dist/cjs/resources/relationships.d.ts +96 -0
  34. package/dist/cjs/resources/relationships.d.ts.map +1 -0
  35. package/dist/cjs/resources/relationships.js +157 -0
  36. package/dist/cjs/resources/relationships.js.map +1 -0
  37. package/dist/cjs/resources/tasks.d.ts +141 -0
  38. package/dist/cjs/resources/tasks.d.ts.map +1 -0
  39. package/dist/cjs/resources/tasks.js +211 -0
  40. package/dist/cjs/resources/tasks.js.map +1 -0
  41. package/dist/cjs/types/common.d.ts +126 -0
  42. package/dist/cjs/types/common.d.ts.map +1 -0
  43. package/dist/cjs/types/common.js +3 -0
  44. package/dist/cjs/types/common.js.map +1 -0
  45. package/dist/cjs/types/config.d.ts +36 -0
  46. package/dist/cjs/types/config.d.ts.map +1 -0
  47. package/dist/cjs/types/config.js +11 -0
  48. package/dist/cjs/types/config.js.map +1 -0
  49. package/dist/cjs/types/index.d.ts +4 -0
  50. package/dist/cjs/types/index.d.ts.map +1 -0
  51. package/dist/cjs/types/index.js +6 -0
  52. package/dist/cjs/types/index.js.map +1 -0
  53. package/dist/esm/client.d.ts +54 -0
  54. package/dist/esm/client.d.ts.map +1 -0
  55. package/dist/esm/client.js +88 -0
  56. package/dist/esm/client.js.map +1 -0
  57. package/dist/esm/errors/api-error.d.ts +59 -0
  58. package/dist/esm/errors/api-error.d.ts.map +1 -0
  59. package/dist/esm/errors/api-error.js +104 -0
  60. package/dist/esm/errors/api-error.js.map +1 -0
  61. package/dist/esm/errors/index.d.ts +3 -0
  62. package/dist/esm/errors/index.d.ts.map +1 -0
  63. package/dist/esm/errors/index.js +10 -0
  64. package/dist/esm/errors/index.js.map +1 -0
  65. package/dist/esm/http/http-client.d.ts +46 -0
  66. package/dist/esm/http/http-client.d.ts.map +1 -0
  67. package/dist/esm/http/http-client.js +145 -0
  68. package/dist/esm/http/http-client.js.map +1 -0
  69. package/dist/esm/index.d.ts +9 -0
  70. package/dist/esm/index.d.ts.map +1 -0
  71. package/dist/esm/index.js +25 -0
  72. package/dist/esm/index.js.map +1 -0
  73. package/dist/esm/resources/base-resource.d.ts +15 -0
  74. package/dist/esm/resources/base-resource.d.ts.map +1 -0
  75. package/dist/esm/resources/base-resource.js +22 -0
  76. package/dist/esm/resources/base-resource.js.map +1 -0
  77. package/dist/esm/resources/messages.d.ts +105 -0
  78. package/dist/esm/resources/messages.d.ts.map +1 -0
  79. package/dist/esm/resources/messages.js +166 -0
  80. package/dist/esm/resources/messages.js.map +1 -0
  81. package/dist/esm/resources/records.d.ts +157 -0
  82. package/dist/esm/resources/records.d.ts.map +1 -0
  83. package/dist/esm/resources/records.js +264 -0
  84. package/dist/esm/resources/records.js.map +1 -0
  85. package/dist/esm/resources/relationships.d.ts +96 -0
  86. package/dist/esm/resources/relationships.d.ts.map +1 -0
  87. package/dist/esm/resources/relationships.js +157 -0
  88. package/dist/esm/resources/relationships.js.map +1 -0
  89. package/dist/esm/resources/tasks.d.ts +141 -0
  90. package/dist/esm/resources/tasks.d.ts.map +1 -0
  91. package/dist/esm/resources/tasks.js +211 -0
  92. package/dist/esm/resources/tasks.js.map +1 -0
  93. package/dist/esm/types/common.d.ts +126 -0
  94. package/dist/esm/types/common.d.ts.map +1 -0
  95. package/dist/esm/types/common.js +3 -0
  96. package/dist/esm/types/common.js.map +1 -0
  97. package/dist/esm/types/config.d.ts +36 -0
  98. package/dist/esm/types/config.d.ts.map +1 -0
  99. package/dist/esm/types/config.js +11 -0
  100. package/dist/esm/types/config.js.map +1 -0
  101. package/dist/esm/types/index.d.ts +4 -0
  102. package/dist/esm/types/index.d.ts.map +1 -0
  103. package/dist/esm/types/index.js +6 -0
  104. package/dist/esm/types/index.js.map +1 -0
  105. package/dist/types/client.d.ts +54 -0
  106. package/dist/types/client.d.ts.map +1 -0
  107. package/dist/types/errors/api-error.d.ts +59 -0
  108. package/dist/types/errors/api-error.d.ts.map +1 -0
  109. package/dist/types/errors/index.d.ts +3 -0
  110. package/dist/types/errors/index.d.ts.map +1 -0
  111. package/dist/types/http/http-client.d.ts +46 -0
  112. package/dist/types/http/http-client.d.ts.map +1 -0
  113. package/dist/types/index.d.ts +9 -0
  114. package/dist/types/index.d.ts.map +1 -0
  115. package/dist/types/resources/base-resource.d.ts +15 -0
  116. package/dist/types/resources/base-resource.d.ts.map +1 -0
  117. package/dist/types/resources/messages.d.ts +105 -0
  118. package/dist/types/resources/messages.d.ts.map +1 -0
  119. package/dist/types/resources/records.d.ts +157 -0
  120. package/dist/types/resources/records.d.ts.map +1 -0
  121. package/dist/types/resources/relationships.d.ts +96 -0
  122. package/dist/types/resources/relationships.d.ts.map +1 -0
  123. package/dist/types/resources/tasks.d.ts +141 -0
  124. package/dist/types/resources/tasks.d.ts.map +1 -0
  125. package/dist/types/types/common.d.ts +126 -0
  126. package/dist/types/types/common.d.ts.map +1 -0
  127. package/dist/types/types/config.d.ts +36 -0
  128. package/dist/types/types/config.d.ts.map +1 -0
  129. package/dist/types/types/index.d.ts +4 -0
  130. package/dist/types/types/index.d.ts.map +1 -0
  131. package/package.json +68 -0
@@ -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,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,CAAC,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,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AG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":""}
@@ -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,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CONFIG = void 0;
4
+ /**
5
+ * Default configuration values.
6
+ */
7
+ exports.DEFAULT_CONFIG = {
8
+ timeout: 30000,
9
+ retries: 3,
10
+ };
11
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":";;;AAmCA;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,CAAC;CACF,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"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CONFIG = void 0;
4
+ var config_js_1 = require("./config.js");
5
+ Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return config_js_1.DEFAULT_CONFIG; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAKA,yCAA6C;AAApC,2GAAA,cAAc,OAAA"}
@@ -0,0 +1,54 @@
1
+ import { MessagesResource } from './resources/messages.js';
2
+ import { RecordsResource } from './resources/records.js';
3
+ import { TasksResource } from './resources/tasks.js';
4
+ import type { ClarifyClientConfig } from './types/index.js';
5
+ /**
6
+ * The main client for interacting with the Clarify API.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { ClarifyClient } from '@clarify/sdk';
11
+ *
12
+ * const clarify = new ClarifyClient({
13
+ * baseUrl: 'https://api.clarify.ai',
14
+ * apiKey: 'clrfy_sk_...',
15
+ * workspace: 'my-workspace',
16
+ * });
17
+ *
18
+ * // List companies
19
+ * const companies = await clarify.records.list('company');
20
+ *
21
+ * // Create a new company
22
+ * const company = await clarify.records.create('company', {
23
+ * type: 'company',
24
+ * attributes: { name: 'Acme Inc.' },
25
+ * });
26
+ *
27
+ * // Iterate through all records
28
+ * for await (const company of clarify.records.iterate('company')) {
29
+ * console.log(company.attributes.name);
30
+ * }
31
+ * ```
32
+ */
33
+ export declare class ClarifyClient {
34
+ /** Resource for managing records */
35
+ readonly records: RecordsResource;
36
+ /** Resource for managing messages */
37
+ readonly messages: MessagesResource;
38
+ /** Resource for managing tasks */
39
+ readonly tasks: TasksResource;
40
+ private readonly config;
41
+ private readonly httpClient;
42
+ /**
43
+ * Creates a new Clarify client instance.
44
+ *
45
+ * @param config - Client configuration
46
+ * @throws {ClarifyValidationError} If required configuration is missing
47
+ */
48
+ constructor(config: ClarifyClientConfig);
49
+ /**
50
+ * Resolves configuration with defaults and validates required fields.
51
+ */
52
+ private resolveConfig;
53
+ }
54
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,aAAa;IACxB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IAEpC,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,MAAM,EAAE,mBAAmB;IASvC;;OAEG;IACH,OAAO,CAAC,aAAa;CA+BtB"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Base error class for all Clarify SDK errors.
3
+ */
4
+ export declare class ClarifyError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /**
8
+ * Error details from the API response.
9
+ */
10
+ export interface ApiErrorDetail {
11
+ code?: string;
12
+ title?: string;
13
+ detail?: string;
14
+ source?: {
15
+ pointer?: string;
16
+ parameter?: string;
17
+ };
18
+ }
19
+ /**
20
+ * Error thrown when the API returns an error response.
21
+ */
22
+ export declare class ClarifyApiError extends ClarifyError {
23
+ /** HTTP status code */
24
+ readonly status: number;
25
+ /** Error details from the API response */
26
+ readonly errors: ApiErrorDetail[];
27
+ /** Original response body */
28
+ readonly body: unknown;
29
+ constructor(message: string, status: number, errors?: ApiErrorDetail[], body?: unknown);
30
+ /**
31
+ * Creates an ApiError from an HTTP response.
32
+ */
33
+ static fromResponse(response: Response): Promise<ClarifyApiError>;
34
+ }
35
+ /**
36
+ * Error thrown when input validation fails.
37
+ */
38
+ export declare class ClarifyValidationError extends ClarifyError {
39
+ /** Validation error details */
40
+ readonly details: Record<string, string[]>;
41
+ constructor(message: string, details?: Record<string, string[]>);
42
+ }
43
+ /**
44
+ * Error thrown when a request times out.
45
+ */
46
+ export declare class ClarifyTimeoutError extends ClarifyError {
47
+ /** Timeout duration in milliseconds */
48
+ readonly timeout: number;
49
+ constructor(timeout: number);
50
+ }
51
+ /**
52
+ * Error thrown when a network error occurs.
53
+ */
54
+ export declare class ClarifyNetworkError extends ClarifyError {
55
+ /** Original error that caused the network failure */
56
+ readonly cause: Error;
57
+ constructor(message: string, cause: Error);
58
+ }
59
+ //# sourceMappingURL=api-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../../src/errors/api-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH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E,MAAM,EAAE,KAAK,EAAE,KAAK;CAK1C"}
@@ -0,0 +1,3 @@
1
+ export { ClarifyError, ClarifyApiError, ClarifyValidationError, ClarifyTimeoutError, ClarifyNetworkError, } from './api-error.js';
2
+ export type { ApiErrorDetail } from './api-error.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { HttpMethod, ResolvedConfig } from '../types/index.js';
2
+ /**
3
+ * Request options for the HTTP client.
4
+ */
5
+ export interface HttpRequestOptions {
6
+ method: HttpMethod;
7
+ path: string;
8
+ body?: unknown;
9
+ query?: Record<string, string | number | boolean | string[] | undefined>;
10
+ }
11
+ /**
12
+ * HTTP client with retry logic and timeout handling.
13
+ */
14
+ export declare class HttpClient {
15
+ private readonly config;
16
+ constructor(config: ResolvedConfig);
17
+ /**
18
+ * Makes an HTTP request to the Clarify API.
19
+ */
20
+ request<T>(options: HttpRequestOptions): Promise<T>;
21
+ /**
22
+ * Builds the full URL including query parameters.
23
+ */
24
+ private buildUrl;
25
+ /**
26
+ * Builds the request headers.
27
+ */
28
+ private buildHeaders;
29
+ /**
30
+ * Executes a request with retry logic for transient failures.
31
+ */
32
+ private executeWithRetry;
33
+ /**
34
+ * Executes a single HTTP request with timeout.
35
+ */
36
+ private executeRequest;
37
+ /**
38
+ * Calculates exponential backoff delay with jitter.
39
+ */
40
+ private calculateBackoff;
41
+ /**
42
+ * Sleeps for the specified duration.
43
+ */
44
+ private sleep;
45
+ }
46
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +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;IAezD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;YACW,gBAAgB;IAiC9B;;OAEG;YACW,cAAc;IA6C5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
@@ -0,0 +1,9 @@
1
+ export { ClarifyClient } from './client.js';
2
+ export { ClarifyError, ClarifyApiError, ClarifyValidationError, ClarifyTimeoutError, ClarifyNetworkError, } from './errors/index.js';
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';
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
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,GACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EACL,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { HttpClient } from '../http/http-client.js';
2
+ import type { ResolvedConfig } from '../types/index.js';
3
+ /**
4
+ * Base class for API resources providing access to the HTTP client and configuration.
5
+ */
6
+ export declare abstract class BaseResource {
7
+ protected readonly httpClient: HttpClient;
8
+ protected readonly config: ResolvedConfig;
9
+ constructor(httpClient: HttpClient, config: ResolvedConfig);
10
+ /**
11
+ * Gets the workspace-prefixed base path for API endpoints.
12
+ */
13
+ protected get basePath(): string;
14
+ }
15
+ //# sourceMappingURL=base-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-resource.d.ts","sourceRoot":"","sources":["../../../src/resources/base-resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;gBAE9B,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAK1D;;OAEG;IACH,SAAS,KAAK,QAAQ,IAAI,MAAM,CAE/B;CACF"}
@@ -0,0 +1,105 @@
1
+ import type { HttpClient } from '../http/http-client.js';
2
+ import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceCreate, SingleResponse } from '../types/index.js';
3
+ import { BaseResource } from './base-resource.js';
4
+ /**
5
+ * Message attributes.
6
+ */
7
+ export interface MessageAttributes {
8
+ subject?: string;
9
+ body?: string;
10
+ from?: string;
11
+ to?: string[];
12
+ cc?: string[];
13
+ bcc?: string[];
14
+ sent_at?: string;
15
+ received_at?: string;
16
+ [key: string]: unknown;
17
+ }
18
+ /**
19
+ * Manages messages in the Clarify platform.
20
+ */
21
+ export declare class MessagesResource extends BaseResource {
22
+ constructor(httpClient: HttpClient, config: ResolvedConfig);
23
+ /**
24
+ * Lists messages.
25
+ *
26
+ * @param options - Pagination, filter, and sort options
27
+ * @returns Paginated list of messages
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const messages = await clarify.messages.list({
32
+ * page: { limit: 20 },
33
+ * filter: { from: 'user@example.com' },
34
+ * });
35
+ * ```
36
+ */
37
+ list<T extends MessageAttributes = MessageAttributes>(options?: ListOptions): Promise<ListResponse<T>>;
38
+ /**
39
+ * Gets a single message by ID.
40
+ *
41
+ * @param id - The message ID
42
+ * @returns The message
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const message = await clarify.messages.get('message-id');
47
+ * console.log(message.data.attributes.subject);
48
+ * ```
49
+ */
50
+ get<T extends MessageAttributes = MessageAttributes>(id: string): Promise<SingleResponse<T>>;
51
+ /**
52
+ * Creates a new message.
53
+ *
54
+ * @param data - The message data to create
55
+ * @returns The created message
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const message = await clarify.messages.create({
60
+ * type: 'message',
61
+ * attributes: {
62
+ * subject: 'Hello',
63
+ * body: 'Message content',
64
+ * from: 'sender@example.com',
65
+ * to: ['recipient@example.com'],
66
+ * },
67
+ * });
68
+ * ```
69
+ */
70
+ create<T extends MessageAttributes = MessageAttributes>(data: ResourceCreate<T>): Promise<SingleResponse<T>>;
71
+ /**
72
+ * Deletes a message.
73
+ *
74
+ * @param id - The message ID
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * await clarify.messages.delete('message-id');
79
+ * ```
80
+ */
81
+ delete(id: string): Promise<void>;
82
+ /**
83
+ * Async iterator for paginating through all messages.
84
+ *
85
+ * @param options - Filter and sort options (pagination is handled automatically)
86
+ * @yields Individual messages
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * for await (const message of clarify.messages.iterate()) {
91
+ * console.log(message.attributes.subject);
92
+ * }
93
+ * ```
94
+ */
95
+ iterate<T extends MessageAttributes = MessageAttributes>(options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
96
+ /**
97
+ * Builds query parameters from list options.
98
+ */
99
+ private buildListQuery;
100
+ /**
101
+ * Extracts the cursor from a pagination URL.
102
+ */
103
+ private extractCursor;
104
+ }
105
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/resources/messages.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,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EA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