@getclarify/nodejs-sdk 0.0.3 → 0.0.5
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 +24 -24
- package/dist/cjs/client.d.ts +6 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +7 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/json-api/link.d.ts +40 -0
- package/dist/cjs/json-api/link.d.ts.map +1 -0
- package/dist/cjs/json-api/link.js +68 -0
- package/dist/cjs/json-api/link.js.map +1 -0
- package/dist/cjs/resources/resources.d.ts +208 -0
- package/dist/cjs/resources/resources.d.ts.map +1 -0
- package/dist/cjs/resources/resources.js +172 -0
- package/dist/cjs/resources/resources.js.map +1 -0
- package/dist/cjs/types/config.d.ts +2 -2
- package/dist/cjs/types/config.d.ts.map +1 -1
- package/dist/cjs/types/config.js +1 -1
- package/dist/cjs/types/config.js.map +1 -1
- package/dist/esm/client.d.ts +6 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +7 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/json-api/link.d.ts +40 -0
- package/dist/esm/json-api/link.d.ts.map +1 -0
- package/dist/esm/json-api/link.js +68 -0
- package/dist/esm/json-api/link.js.map +1 -0
- package/dist/esm/resources/resources.d.ts +208 -0
- package/dist/esm/resources/resources.d.ts.map +1 -0
- package/dist/esm/resources/resources.js +172 -0
- package/dist/esm/resources/resources.js.map +1 -0
- package/dist/esm/types/config.d.ts +2 -2
- package/dist/esm/types/config.d.ts.map +1 -1
- package/dist/esm/types/config.js +1 -1
- package/dist/esm/types/config.js.map +1 -1
- package/dist/types/client.d.ts +6 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/json-api/link.d.ts +40 -0
- package/dist/types/json-api/link.d.ts.map +1 -0
- package/dist/types/resources/resources.d.ts +208 -0
- package/dist/types/resources/resources.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +2 -2
- package/dist/types/types/config.d.ts.map +1 -1
- package/package.json +34 -38
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourcesResource = void 0;
|
|
4
|
+
const link_js_1 = require("../json-api/link.js");
|
|
5
|
+
const base_resource_js_1 = require("./base-resource.js");
|
|
6
|
+
/**
|
|
7
|
+
* Manages read and create operations for resources
|
|
8
|
+
* (objects accessed via the `/resources` endpoints).
|
|
9
|
+
*
|
|
10
|
+
* Responses include a `relationships` map with fully resolved related records.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // List meetings with attendees included
|
|
15
|
+
* const response = await clarify.resources.list({
|
|
16
|
+
* type: 'meeting',
|
|
17
|
+
* include: ['users', 'people'],
|
|
18
|
+
* filter: { 'meeting.users._id': currentUserId },
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* const firstMeetingUsers = response.data[0].relationships.users.data;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
class ResourcesResource extends base_resource_js_1.BaseResource {
|
|
25
|
+
constructor(httpClient, config) {
|
|
26
|
+
super(httpClient, config);
|
|
27
|
+
}
|
|
28
|
+
getEntityPath(type) {
|
|
29
|
+
return `${this.basePath}/objects/${type}/resources`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves a single resource by ID.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const response = await clarify.resources.get({
|
|
37
|
+
* type: 'meeting',
|
|
38
|
+
* id: 'abc123',
|
|
39
|
+
* include: ['users', 'people'],
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* const attendees = response.data.relationships.users.data;
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
async get(params) {
|
|
46
|
+
const query = {};
|
|
47
|
+
if (params.include && params.include.length > 0) {
|
|
48
|
+
query.include = params.include.join(',');
|
|
49
|
+
}
|
|
50
|
+
const raw = await this.httpClient.request({
|
|
51
|
+
method: 'GET',
|
|
52
|
+
path: `${this.getEntityPath(params.type)}/${params.id}`,
|
|
53
|
+
query,
|
|
54
|
+
});
|
|
55
|
+
return (0, link_js_1.linkJsonApi)(raw);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Lists resources with optional filtering, includes, and pagination.
|
|
59
|
+
*
|
|
60
|
+
* Filters support simple equality as well as operator-based filtering:
|
|
61
|
+
* - Simple: `{ name: 'Acme' }` → `filter[name]=Acme`
|
|
62
|
+
* - Operator: `{ amount: { 'Is greater than': '100' } }` → `filter[amount][Is greater than]=100`
|
|
63
|
+
* - Nested path: `{ 'meeting.users._id': userId }` → `filter[meeting.users._id]=userId`
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const response = await clarify.resources.list({
|
|
68
|
+
* type: 'meeting',
|
|
69
|
+
* include: ['users'],
|
|
70
|
+
* filter: {
|
|
71
|
+
* 'meeting.users._id': currentUserId,
|
|
72
|
+
* start: { 'Is on or after': new Date().toISOString() },
|
|
73
|
+
* },
|
|
74
|
+
* sortOrder: { column: 'start', dir: 'ASC' },
|
|
75
|
+
* page: { limit: 50 },
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
async list(params) {
|
|
80
|
+
const query = {};
|
|
81
|
+
if (params.include && params.include.length > 0) {
|
|
82
|
+
query.include = params.include.join(',');
|
|
83
|
+
}
|
|
84
|
+
if (params.page?.offset !== undefined) {
|
|
85
|
+
query['page[offset]'] = params.page.offset;
|
|
86
|
+
}
|
|
87
|
+
if (params.page?.limit !== undefined) {
|
|
88
|
+
query['page[limit]'] = params.page.limit;
|
|
89
|
+
}
|
|
90
|
+
if (params.sortOrder) {
|
|
91
|
+
query['sortOrder[column]'] = params.sortOrder.column;
|
|
92
|
+
query['sortOrder[dir]'] = params.sortOrder.dir;
|
|
93
|
+
}
|
|
94
|
+
if (params.filter) {
|
|
95
|
+
for (const [key, value] of Object.entries(params.filter)) {
|
|
96
|
+
if (typeof value === 'string') {
|
|
97
|
+
query[`filter[${key}]`] = value;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
for (const [op, opValue] of Object.entries(value)) {
|
|
101
|
+
query[`filter[${key}][${op}]`] = opValue;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const raw = await this.httpClient.request({
|
|
107
|
+
method: 'GET',
|
|
108
|
+
path: this.getEntityPath(params.type),
|
|
109
|
+
query,
|
|
110
|
+
});
|
|
111
|
+
return (0, link_js_1.linkJsonApi)(raw);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Creates a new resource, optionally setting relationships at the same time.
|
|
115
|
+
*
|
|
116
|
+
* To-one and to-many relationships are both supported via `relationships`:
|
|
117
|
+
* - To-one: `{ data: { type: 'user', id: 'u-123' } }`
|
|
118
|
+
* - To-many: `{ data: [{ type: 'person', id: 'p-1' }, { type: 'person', id: 'p-2' }] }`
|
|
119
|
+
* - Clear to-one: `{ data: null }`
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* // Create a meeting and immediately set its attendees
|
|
124
|
+
* const response = await clarify.resources.create({
|
|
125
|
+
* type: 'meeting',
|
|
126
|
+
* attributes: {
|
|
127
|
+
* title: 'Team standup',
|
|
128
|
+
* start: new Date().toISOString(),
|
|
129
|
+
* },
|
|
130
|
+
* relationships: {
|
|
131
|
+
* users: { data: [{ type: 'user', id: 'u-1' }, { type: 'user', id: 'u-2' }] },
|
|
132
|
+
* people: { data: [{ type: 'person', id: 'p-1' }] },
|
|
133
|
+
* },
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
async create(params) {
|
|
138
|
+
const raw = await this.httpClient.request({
|
|
139
|
+
method: 'POST',
|
|
140
|
+
path: this.getEntityPath(params.type),
|
|
141
|
+
body: {
|
|
142
|
+
data: {
|
|
143
|
+
type: params.type,
|
|
144
|
+
attributes: params.attributes,
|
|
145
|
+
...(params.relationships
|
|
146
|
+
? { relationships: params.relationships }
|
|
147
|
+
: undefined),
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
return (0, link_js_1.linkJsonApi)(raw);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Deletes a resource by ID.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* await clarify.resources.delete({ type: 'meeting', id: 'abc123' });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
async delete(params) {
|
|
162
|
+
// The /resources endpoint does not yet expose a DELETE route, so we
|
|
163
|
+
// delegate to the equivalent /records path. This is a convenience shim —
|
|
164
|
+
// the resources API should eventually support deletion directly.
|
|
165
|
+
await this.httpClient.request({
|
|
166
|
+
method: 'DELETE',
|
|
167
|
+
path: `${this.basePath}/objects/${params.type}/records/${params.id}`,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.ResourcesResource = ResourcesResource;
|
|
172
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/resources/resources.ts"],"names":[],"mappings":";;;AACA,iDAAwE;AAOxE,yDAAkD;AA8HlD;;;;;;;;;;;;;;;;;GAiB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,IAAI,CAAC,UAAU,CAAC,OAAO,CAAkB;YACzD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YACrC,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,GAAG,CAAC,MAAM,CAAC,aAAa;wBACtB,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE;wBACzC,CAAC,CAAC,SAAS,CAAC;iBACf;aACF;SACF,CAAC,CAAC;QAEH,OAAO,IAAA,qBAAW,EAAC,GAAG,CAAyC,CAAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,oEAAoE;QACpE,yEAAyE;QACzE,iEAAiE;QACjE,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAwB;YACnD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,YAAY,MAAM,CAAC,IAAI,YAAY,MAAM,CAAC,EAAE,EAAE;SACrE,CAAC,CAAC;IACL,CAAC;CACF;AA1KD,8CA0KC"}
|
|
@@ -8,7 +8,7 @@ export interface ClarifyClientConfig {
|
|
|
8
8
|
apiKey: string;
|
|
9
9
|
/** Workspace slug for API calls */
|
|
10
10
|
workspace: string;
|
|
11
|
-
/** Request timeout in milliseconds (default:
|
|
11
|
+
/** Request timeout in milliseconds (default: 20000) */
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** Number of retry attempts for failed requests (default: 1) */
|
|
14
14
|
retries?: number;
|
|
@@ -30,7 +30,7 @@ export interface ResolvedConfig {
|
|
|
30
30
|
* Default configuration values.
|
|
31
31
|
*/
|
|
32
32
|
export declare const DEFAULT_CONFIG: {
|
|
33
|
-
readonly timeout:
|
|
33
|
+
readonly timeout: 20000;
|
|
34
34
|
readonly retries: 1;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
package/dist/esm/types/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":";;;AAmCA;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,
|
|
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"}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RecordsResource } from './resources/records.js';
|
|
2
|
+
import { ResourcesResource } from './resources/resources.js';
|
|
2
3
|
import type { ClarifyClientConfig } from './types/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* The main client for interacting with the Clarify API.
|
|
@@ -26,6 +27,11 @@ import type { ClarifyClientConfig } from './types/index.js';
|
|
|
26
27
|
export declare class ClarifyClient {
|
|
27
28
|
/** Resource for managing records */
|
|
28
29
|
readonly records: RecordsResource;
|
|
30
|
+
/**
|
|
31
|
+
* Resource for querying and creating resources via the `/resources` endpoints.
|
|
32
|
+
* Responses include a `relationships` map with fully resolved related records.
|
|
33
|
+
*/
|
|
34
|
+
readonly resources: ResourcesResource;
|
|
29
35
|
private readonly config;
|
|
30
36
|
private readonly httpClient;
|
|
31
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,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;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;IACxB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAEtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,MAAM,EAAE,mBAAmB;IAQvC;;OAEG;IACH,OAAO,CAAC,aAAa;CA4BtB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { ClarifyError, ClarifyApiError, ClarifyValidationError, ClarifyTimeoutEr
|
|
|
3
3
|
export type { ApiErrorDetail } from './errors/index.js';
|
|
4
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 { ResourcesResource, type ResourceLinked, type SingleResourceResponse, type ListResourceResponse, type SortDirection, type ResourceGetParams, type ResourceListParams, type ResourceRelationshipInput, type ResourceRelationshipsInput, type ResourceCreateParams, type ResourceDeleteParams, } from './resources/resources.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal representation of a resource that may have relationships
|
|
3
|
+
* either as raw refs (before linking) or as full resources (after linking).
|
|
4
|
+
*/
|
|
5
|
+
interface AnyResource {
|
|
6
|
+
type: string;
|
|
7
|
+
id: string;
|
|
8
|
+
attributes: Record<string, unknown>;
|
|
9
|
+
relationships?: Record<string, {
|
|
10
|
+
data: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Minimal shape of a raw JSON:API document as returned by the API,
|
|
15
|
+
* before relationship references are resolved.
|
|
16
|
+
*/
|
|
17
|
+
export interface JsonApiDocument {
|
|
18
|
+
data: AnyResource | AnyResource[];
|
|
19
|
+
included?: AnyResource[];
|
|
20
|
+
meta?: Record<string, unknown>;
|
|
21
|
+
links?: Record<string, string | undefined>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolves relationship references in a JSON:API document by replacing
|
|
25
|
+
* `{ type, id }` stubs with the full resource objects from `included`.
|
|
26
|
+
*
|
|
27
|
+
* The function operates on a deep clone of the document so the original
|
|
28
|
+
* is never mutated.
|
|
29
|
+
*
|
|
30
|
+
* @throws {Error} If a referenced resource is not present in `included`
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const linked = linkJsonApi(response);
|
|
35
|
+
* // linked.data.relationships.company.data now contains the full company object
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function linkJsonApi<T extends JsonApiDocument>(doc: T): T;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/json-api/link.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC5C;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAuBhE"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
+
import type { PaginationLinks, PaginationMeta, ResolvedConfig, ResourceIdentifier } from '../types/index.js';
|
|
3
|
+
import { BaseResource } from './base-resource.js';
|
|
4
|
+
/**
|
|
5
|
+
* A resource with fully resolved inline relationships.
|
|
6
|
+
* Each entry in `relationships` holds the complete resource object(s),
|
|
7
|
+
* not bare `{ type, id }` references.
|
|
8
|
+
*/
|
|
9
|
+
export interface ResourceLinked<T = Record<string, unknown>> {
|
|
10
|
+
type: string;
|
|
11
|
+
id: string;
|
|
12
|
+
attributes: T;
|
|
13
|
+
relationships: Record<string, {
|
|
14
|
+
data: ResourceLinked | ResourceLinked[] | null;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Single resource response from the resources endpoint.
|
|
19
|
+
*/
|
|
20
|
+
export interface SingleResourceResponse<T = Record<string, unknown>> {
|
|
21
|
+
data: ResourceLinked<T>;
|
|
22
|
+
included?: ResourceLinked[];
|
|
23
|
+
meta?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List resource response from the resources endpoint.
|
|
27
|
+
*/
|
|
28
|
+
export interface ListResourceResponse<T = Record<string, unknown>> {
|
|
29
|
+
data: ResourceLinked<T>[];
|
|
30
|
+
included?: ResourceLinked[];
|
|
31
|
+
links?: PaginationLinks;
|
|
32
|
+
meta?: PaginationMeta;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sort direction for resource list requests.
|
|
36
|
+
*/
|
|
37
|
+
export type SortDirection = 'ASC' | 'DESC';
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for retrieving a single resource.
|
|
40
|
+
*/
|
|
41
|
+
export interface ResourceGetParams {
|
|
42
|
+
/** The entity type (e.g., 'meeting', 'company') */
|
|
43
|
+
type: string;
|
|
44
|
+
/** The resource ID */
|
|
45
|
+
id: string;
|
|
46
|
+
/** Relationships to include in the response */
|
|
47
|
+
include?: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parameters for listing resources.
|
|
51
|
+
*
|
|
52
|
+
* Filters support simple equality as well as operator-based filtering:
|
|
53
|
+
* - Simple: `{ name: 'Acme' }` → `filter[name]=Acme`
|
|
54
|
+
* - Operator: `{ amount: { 'Is greater than': '100' } }` → `filter[amount][Is greater than]=100`
|
|
55
|
+
* - Nested path: `{ 'meeting.users._id': userId }` → `filter[meeting.users._id]=userId`
|
|
56
|
+
*/
|
|
57
|
+
export interface ResourceListParams {
|
|
58
|
+
/** The entity type (e.g., 'meeting', 'company') */
|
|
59
|
+
type: string;
|
|
60
|
+
/** Relationships to include in the response */
|
|
61
|
+
include?: string[];
|
|
62
|
+
/** Filter options */
|
|
63
|
+
filter?: Record<string, string | Record<string, string>>;
|
|
64
|
+
/** Sort order for the results */
|
|
65
|
+
sortOrder?: {
|
|
66
|
+
column: string;
|
|
67
|
+
dir: SortDirection;
|
|
68
|
+
};
|
|
69
|
+
/** Pagination options using offset/limit */
|
|
70
|
+
page?: {
|
|
71
|
+
offset?: number;
|
|
72
|
+
limit?: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A to-one or to-many relationship reference for use when creating a resource.
|
|
77
|
+
*
|
|
78
|
+
* - To-one: `{ data: { type: 'user', id: 'u-123' } }`
|
|
79
|
+
* - To-many: `{ data: [{ type: 'person', id: 'p-1' }, { type: 'person', id: 'p-2' }] }`
|
|
80
|
+
* - Clear to-one: `{ data: null }`
|
|
81
|
+
*/
|
|
82
|
+
export interface ResourceRelationshipInput {
|
|
83
|
+
data: ResourceIdentifier | ResourceIdentifier[] | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Map of relationship name → relationship input, passed to `resources.create()`.
|
|
87
|
+
*/
|
|
88
|
+
export type ResourceRelationshipsInput = Record<string, ResourceRelationshipInput>;
|
|
89
|
+
/**
|
|
90
|
+
* Parameters for creating a resource.
|
|
91
|
+
*/
|
|
92
|
+
export interface ResourceCreateParams<T = Record<string, unknown>> {
|
|
93
|
+
/** The entity type (e.g., 'meeting', 'company') */
|
|
94
|
+
type: string;
|
|
95
|
+
/** The resource attributes */
|
|
96
|
+
attributes: T;
|
|
97
|
+
/**
|
|
98
|
+
* Relationships to set on the new resource.
|
|
99
|
+
* - To-one: `{ data: { type: 'user', id: 'u-123' } }`
|
|
100
|
+
* - To-many: `{ data: [{ type: 'person', id: 'p-1' }, { type: 'person', id: 'p-2' }] }`
|
|
101
|
+
* - Clear to-one: `{ data: null }`
|
|
102
|
+
*/
|
|
103
|
+
relationships?: ResourceRelationshipsInput;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Parameters for deleting a resource.
|
|
107
|
+
*/
|
|
108
|
+
export interface ResourceDeleteParams {
|
|
109
|
+
/** The entity type (e.g., 'meeting', 'company') */
|
|
110
|
+
type: string;
|
|
111
|
+
/** The resource ID to delete */
|
|
112
|
+
id: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Manages read and create operations for resources
|
|
116
|
+
* (objects accessed via the `/resources` endpoints).
|
|
117
|
+
*
|
|
118
|
+
* Responses include a `relationships` map with fully resolved related records.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* // List meetings with attendees included
|
|
123
|
+
* const response = await clarify.resources.list({
|
|
124
|
+
* type: 'meeting',
|
|
125
|
+
* include: ['users', 'people'],
|
|
126
|
+
* filter: { 'meeting.users._id': currentUserId },
|
|
127
|
+
* });
|
|
128
|
+
*
|
|
129
|
+
* const firstMeetingUsers = response.data[0].relationships.users.data;
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export declare class ResourcesResource extends BaseResource {
|
|
133
|
+
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
134
|
+
private getEntityPath;
|
|
135
|
+
/**
|
|
136
|
+
* Retrieves a single resource by ID.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const response = await clarify.resources.get({
|
|
141
|
+
* type: 'meeting',
|
|
142
|
+
* id: 'abc123',
|
|
143
|
+
* include: ['users', 'people'],
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* const attendees = response.data.relationships.users.data;
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
get<T = Record<string, unknown>>(params: ResourceGetParams): Promise<SingleResourceResponse<T>>;
|
|
150
|
+
/**
|
|
151
|
+
* Lists resources with optional filtering, includes, and pagination.
|
|
152
|
+
*
|
|
153
|
+
* Filters support simple equality as well as operator-based filtering:
|
|
154
|
+
* - Simple: `{ name: 'Acme' }` → `filter[name]=Acme`
|
|
155
|
+
* - Operator: `{ amount: { 'Is greater than': '100' } }` → `filter[amount][Is greater than]=100`
|
|
156
|
+
* - Nested path: `{ 'meeting.users._id': userId }` → `filter[meeting.users._id]=userId`
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const response = await clarify.resources.list({
|
|
161
|
+
* type: 'meeting',
|
|
162
|
+
* include: ['users'],
|
|
163
|
+
* filter: {
|
|
164
|
+
* 'meeting.users._id': currentUserId,
|
|
165
|
+
* start: { 'Is on or after': new Date().toISOString() },
|
|
166
|
+
* },
|
|
167
|
+
* sortOrder: { column: 'start', dir: 'ASC' },
|
|
168
|
+
* page: { limit: 50 },
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
list<T = Record<string, unknown>>(params: ResourceListParams): Promise<ListResourceResponse<T>>;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a new resource, optionally setting relationships at the same time.
|
|
175
|
+
*
|
|
176
|
+
* To-one and to-many relationships are both supported via `relationships`:
|
|
177
|
+
* - To-one: `{ data: { type: 'user', id: 'u-123' } }`
|
|
178
|
+
* - To-many: `{ data: [{ type: 'person', id: 'p-1' }, { type: 'person', id: 'p-2' }] }`
|
|
179
|
+
* - Clear to-one: `{ data: null }`
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* // Create a meeting and immediately set its attendees
|
|
184
|
+
* const response = await clarify.resources.create({
|
|
185
|
+
* type: 'meeting',
|
|
186
|
+
* attributes: {
|
|
187
|
+
* title: 'Team standup',
|
|
188
|
+
* start: new Date().toISOString(),
|
|
189
|
+
* },
|
|
190
|
+
* relationships: {
|
|
191
|
+
* users: { data: [{ type: 'user', id: 'u-1' }, { type: 'user', id: 'u-2' }] },
|
|
192
|
+
* people: { data: [{ type: 'person', id: 'p-1' }] },
|
|
193
|
+
* },
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
create<T = Record<string, unknown>>(params: ResourceCreateParams<T>): Promise<SingleResourceResponse<T>>;
|
|
198
|
+
/**
|
|
199
|
+
* Deletes a resource by ID.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* await clarify.resources.delete({ type: 'meeting', id: 'abc123' });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
delete(params: ResourceDeleteParams): Promise<void>;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/resources/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;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,CAAC,CAAC;IACd,aAAa,EAAE,MAAM,CACnB,MAAM,EACN;QAAE,IAAI,EAAE,cAAc,GAAG,cAAc,EAAE,GAAG,IAAI,CAAA;KAAE,CACnD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/D,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,cAAc,EAAE,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;;;;OAKG;IACH,aAAa,CAAC,EAAE,0BAA0B,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D,OAAO,CAAC,aAAa;IAIrB;;;;;;;;;;;;;OAaG;IACG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAgBrC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IA4CnC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAkBrC;;;;;;;OAOG;IACG,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAS1D"}
|
|
@@ -8,7 +8,7 @@ export interface ClarifyClientConfig {
|
|
|
8
8
|
apiKey: string;
|
|
9
9
|
/** Workspace slug for API calls */
|
|
10
10
|
workspace: string;
|
|
11
|
-
/** Request timeout in milliseconds (default:
|
|
11
|
+
/** Request timeout in milliseconds (default: 20000) */
|
|
12
12
|
timeout?: number;
|
|
13
13
|
/** Number of retry attempts for failed requests (default: 1) */
|
|
14
14
|
retries?: number;
|
|
@@ -30,7 +30,7 @@ export interface ResolvedConfig {
|
|
|
30
30
|
* Default configuration values.
|
|
31
31
|
*/
|
|
32
32
|
export declare const DEFAULT_CONFIG: {
|
|
33
|
-
readonly timeout:
|
|
33
|
+
readonly timeout: 20000;
|
|
34
34
|
readonly retries: 1;
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getclarify/nodejs-sdk",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"private": false,
|
|
3
5
|
"description": "JavaScript/TypeScript SDK for Clarify platform",
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"node": ">=24"
|
|
6
|
+
"keywords": [
|
|
7
|
+
"api",
|
|
8
|
+
"clarify",
|
|
9
|
+
"client",
|
|
10
|
+
"crm",
|
|
11
|
+
"sdk"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/clarify/clarify.git",
|
|
17
|
+
"directory": "packages/sdk/js"
|
|
17
18
|
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"main": "./dist/cjs/index.js",
|
|
23
|
+
"module": "./dist/esm/index.js",
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
18
25
|
"exports": {
|
|
19
26
|
".": {
|
|
20
27
|
"import": {
|
|
@@ -27,42 +34,31 @@
|
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
},
|
|
30
|
-
"files": [
|
|
31
|
-
"dist"
|
|
32
|
-
],
|
|
33
|
-
"keywords": [
|
|
34
|
-
"api",
|
|
35
|
-
"clarify",
|
|
36
|
-
"client",
|
|
37
|
-
"crm",
|
|
38
|
-
"sdk"
|
|
39
|
-
],
|
|
40
|
-
"license": "MIT",
|
|
41
|
-
"main": "./dist/cjs/index.js",
|
|
42
|
-
"module": "./dist/esm/index.js",
|
|
43
|
-
"private": false,
|
|
44
37
|
"publishConfig": {
|
|
45
38
|
"access": "public",
|
|
46
39
|
"registry": "https://registry.npmjs.org/"
|
|
47
40
|
},
|
|
48
|
-
"repository": {
|
|
49
|
-
"type": "git",
|
|
50
|
-
"url": "https://github.com/clarify/clarify.git",
|
|
51
|
-
"directory": "packages/sdk/js"
|
|
52
|
-
},
|
|
53
41
|
"scripts": {
|
|
54
|
-
"build": "
|
|
55
|
-
"build:cjs": "tsc -p tsconfig.build.json --module
|
|
42
|
+
"build": "pnpm run build:esm && pnpm run build:cjs && pnpm run build:types",
|
|
43
|
+
"build:cjs": "tsc -p tsconfig.build.json --module Node16 --moduleResolution Node16 --outDir dist/cjs",
|
|
56
44
|
"build:esm": "tsc -p tsconfig.build.json --module NodeNext --moduleResolution NodeNext --outDir dist/esm",
|
|
57
45
|
"build:types": "tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist/types",
|
|
58
46
|
"clean": "rm -rf dist",
|
|
59
|
-
"lint": "
|
|
60
|
-
"lint:fix": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix",
|
|
47
|
+
"lint:oxlint": "NODE_OPTIONS='--disable-warning=MODULE_TYPELESS_PACKAGE_JSON' oxlint --no-error-on-unmatched-pattern .",
|
|
61
48
|
"test": "vitest run",
|
|
62
49
|
"test:cov": "vitest run --coverage",
|
|
63
50
|
"test:watch": "vitest --watch",
|
|
64
|
-
"tsc": "
|
|
51
|
+
"tsc": "tsgo --noEmit",
|
|
65
52
|
"tsc:watch": "tsc --noEmit --watch"
|
|
66
53
|
},
|
|
67
|
-
"
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^24.12.0",
|
|
56
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
57
|
+
"typescript": "^6.0.2",
|
|
58
|
+
"vite": "^8.0.16",
|
|
59
|
+
"vitest": "^4.1.8"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=24"
|
|
63
|
+
}
|
|
68
64
|
}
|