exponential-sdk 1.10.0 → 1.12.0

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/index.js CHANGED
@@ -169,6 +169,271 @@ var ActionCommentsApi = class {
169
169
  }
170
170
  };
171
171
 
172
+ // src/featureComments.ts
173
+ var FeatureCommentsApi = class {
174
+ constructor(client) {
175
+ this.client = client;
176
+ }
177
+ async list(featureId) {
178
+ return await this.client.product.featureComment.list.query({
179
+ featureId
180
+ });
181
+ }
182
+ async create(input) {
183
+ return await this.client.product.featureComment.create.mutate(
184
+ input
185
+ );
186
+ }
187
+ /** Reply to an existing comment. Replies to replies still hang off the root. */
188
+ async reply(input) {
189
+ return await this.client.product.featureComment.reply.mutate(
190
+ input
191
+ );
192
+ }
193
+ async update(input) {
194
+ return await this.client.product.featureComment.update.mutate(
195
+ input
196
+ );
197
+ }
198
+ async delete(commentId) {
199
+ return await this.client.product.featureComment.delete.mutate({
200
+ commentId
201
+ });
202
+ }
203
+ /** Mark an anchored thread resolved. Only anchored threads have a threadId. */
204
+ async resolve(input) {
205
+ return await this.client.product.featureComment.resolve.mutate(
206
+ input
207
+ );
208
+ }
209
+ async unresolve(input) {
210
+ return await this.client.product.featureComment.unresolve.mutate(
211
+ input
212
+ );
213
+ }
214
+ };
215
+
216
+ // src/pageComments.ts
217
+ var PageCommentsApi = class {
218
+ constructor(client) {
219
+ this.client = client;
220
+ }
221
+ async list(pageId) {
222
+ return await this.client.pageComment.list.query({ pageId });
223
+ }
224
+ async create(input) {
225
+ return await this.client.pageComment.create.mutate(input);
226
+ }
227
+ async update(input) {
228
+ return await this.client.pageComment.update.mutate(input);
229
+ }
230
+ async delete(commentId) {
231
+ return await this.client.pageComment.delete.mutate({
232
+ commentId
233
+ });
234
+ }
235
+ };
236
+
237
+ // src/goalComments.ts
238
+ var GoalCommentsApi = class {
239
+ constructor(client) {
240
+ this.client = client;
241
+ }
242
+ async list(goalId) {
243
+ return await this.client.goalComment.getComments.query({
244
+ goalId
245
+ });
246
+ }
247
+ async add(input) {
248
+ return await this.client.goalComment.addComment.mutate(input);
249
+ }
250
+ async update(input) {
251
+ return await this.client.goalComment.updateComment.mutate(
252
+ input
253
+ );
254
+ }
255
+ async delete(commentId) {
256
+ return await this.client.goalComment.deleteComment.mutate({
257
+ commentId
258
+ });
259
+ }
260
+ };
261
+
262
+ // src/goals.ts
263
+ var GoalsApi = class {
264
+ constructor(client, keyResults) {
265
+ this.client = client;
266
+ this.keyResults = keyResults;
267
+ }
268
+ /**
269
+ * List objectives. Pass `workspaceId` for the workspace-wide list (every
270
+ * member's), omit it for your own. Includes each objective's linked
271
+ * `projects`, which is the join that maps day-to-day work back to an OKR:
272
+ * every action carries a `projectId`.
273
+ *
274
+ * `period` and `status` are sent to the server *and* re-applied here. The
275
+ * server grew those filters recently; against an instance that predates them
276
+ * zod strips the unknown keys and hands back **every** objective — a filter
277
+ * that silently matches everything is worse than one that errors. Re-applying
278
+ * is a no-op once the server has done the work. Same reasoning as the
279
+ * client-side `branchName`/`prUrl` filters in `tickets.ts`.
280
+ */
281
+ async list(options = {}) {
282
+ const goals = await this.client.goal.getAllMyGoals.query(options);
283
+ return goals.filter(
284
+ (g) => (options.period === void 0 || g.period === options.period) && (options.status === void 0 || g.status === options.status)
285
+ );
286
+ }
287
+ /**
288
+ * The same objectives nested parent → child (up to 5 levels), each with its
289
+ * projects and key results. One call for the whole annual → quarterly cascade.
290
+ */
291
+ async tree(options = {}) {
292
+ return await this.client.goal.getGoalTree.query(
293
+ options
294
+ );
295
+ }
296
+ async get(id) {
297
+ return await this.client.goal.getById.query({ id });
298
+ }
299
+ /** Objectives linked to a given project. */
300
+ async listByProject(projectId) {
301
+ return await this.client.goal.getProjectGoals.query({ projectId });
302
+ }
303
+ async create(input) {
304
+ return await this.client.goal.createGoal.mutate(input);
305
+ }
306
+ /**
307
+ * Partial update — see {@link GoalUpdateInput}. Fields you omit are left
308
+ * alone; pass an explicit `null` to clear one.
309
+ */
310
+ async update(input) {
311
+ return await this.client.goal.updateGoal.mutate(input);
312
+ }
313
+ /**
314
+ * Status-only write. Never touches another field, and is the only path that
315
+ * accepts `on-hold`. Moving an objective to `completed` also records a
316
+ * workspace milestone.
317
+ */
318
+ async setStatus(input) {
319
+ return await this.client.goal.updateGoalStatus.mutate(input);
320
+ }
321
+ /**
322
+ * Re-parent an objective, or detach it with `parentGoalId: null`. Writes only
323
+ * `parentGoalId`, and validates the no-self / no-cycle / depth-5 rules.
324
+ */
325
+ async setParent(input) {
326
+ return await this.client.goal.setParent.mutate(input);
327
+ }
328
+ async delete(id) {
329
+ return await this.client.goal.deleteGoal.mutate({ id });
330
+ }
331
+ /** The conventional period strings (quarters, halves, annual) for this year and next. */
332
+ async periods() {
333
+ return await this.client.okr.getPeriods.query();
334
+ }
335
+ /** Aggregate objective/key-result counts and average progress. */
336
+ async stats(options = {}) {
337
+ return await this.client.okr.getStats.query(options);
338
+ }
339
+ };
340
+
341
+ // src/keyResults.ts
342
+ var KeyResultsApi = class {
343
+ constructor(client) {
344
+ this.client = client;
345
+ }
346
+ /**
347
+ * List key results. Pass `workspaceId` for the workspace-wide list (every
348
+ * member's), omit it for your own.
349
+ *
350
+ * ⚠️ Workspace scoping here depends on a server-side fix to `okr.getAll`,
351
+ * which previously accepted a `workspaceId` while still filtering on the
352
+ * caller's `userId` — so against an older instance this returns only your own
353
+ * key results, or `[]`, rather than the workspace's. Unlike the filters in
354
+ * `goals.list()` that cannot be repaired here: the other members' rows never
355
+ * reach the client. {@link KeyResultsApi.byObjective} is workspace-correct on
356
+ * every server version and is the safer read when that matters.
357
+ */
358
+ async list(options = {}) {
359
+ return await this.client.okr.getAll.query(options);
360
+ }
361
+ /**
362
+ * Objectives with their key results nested — the richest OKR read, and the
363
+ * one to reach for when rendering "here is the quarter".
364
+ */
365
+ async byObjective(options = {}) {
366
+ return await this.client.okr.getByObjective.query(
367
+ options
368
+ );
369
+ }
370
+ async get(id) {
371
+ return await this.client.okr.getById.query({ id });
372
+ }
373
+ /**
374
+ * Create a key result on an objective.
375
+ *
376
+ * When `workspaceId` is omitted it is resolved from the objective first,
377
+ * rather than left to the server. `okr.create` writes the input through as-is
378
+ * on older instances, so an absent workspace persists as `null` — and a key
379
+ * result with no workspace is invisible to every workspace-scoped read and
380
+ * unwritable by teammates once owner-OR-member authz applies. That is the
381
+ * same orphaning that has already cost a goal; one extra read on a mutation
382
+ * is a cheap way not to repeat it.
383
+ */
384
+ async create(input) {
385
+ let workspaceId = input.workspaceId;
386
+ if (workspaceId === void 0) {
387
+ const goal = await this.client.goal.getById.query({
388
+ id: input.goalId
389
+ });
390
+ workspaceId = goal.workspaceId ?? void 0;
391
+ }
392
+ return await this.client.okr.create.mutate({
393
+ ...input,
394
+ workspaceId
395
+ });
396
+ }
397
+ async update(input) {
398
+ return await this.client.okr.update.mutate(input);
399
+ }
400
+ /**
401
+ * Record a progress check-in. The server derives the new status from where
402
+ * `value` lands between `startValue` and `targetValue`, so a check-in both
403
+ * moves the number and re-colours the key result.
404
+ */
405
+ async checkIn(input) {
406
+ return await this.client.okr.checkIn.mutate({
407
+ keyResultId: input.id,
408
+ newValue: input.value,
409
+ notes: input.note
410
+ });
411
+ }
412
+ async delete(id) {
413
+ return await this.client.okr.delete.mutate({ id });
414
+ }
415
+ /** Link a project to a key result as executing work. Idempotent. */
416
+ async linkProject(input) {
417
+ return await this.client.okr.linkProject.mutate(input);
418
+ }
419
+ async unlinkProject(input) {
420
+ return await this.client.okr.unlinkProject.mutate(input);
421
+ }
422
+ /**
423
+ * Link a feature to a key result as executing work. Idempotent. The feature's
424
+ * product must live in the key result's workspace. A feature with no
425
+ * objective alignment inherits the key result's objective; one that already
426
+ * has an objective is never overwritten.
427
+ */
428
+ async linkFeature(input) {
429
+ return await this.client.okr.linkFeature.mutate(input);
430
+ }
431
+ /** Removes only the link row — never the feature's objective alignment. */
432
+ async unlinkFeature(input) {
433
+ return await this.client.okr.unlinkFeature.mutate(input);
434
+ }
435
+ };
436
+
172
437
  // src/projects.ts
173
438
  var ProjectsApi = class {
174
439
  constructor(client) {
@@ -191,6 +456,17 @@ var WorkspacesApi = class {
191
456
  async list() {
192
457
  return await this.client.workspace.list.query();
193
458
  }
459
+ /**
460
+ * Everyone who belongs to a workspace — direct members plus anyone with
461
+ * access through a linked team. This is the lookup that makes mentions
462
+ * possible from outside the app: match a name or email here, then drop the
463
+ * row's `mentionSyntax` into a comment body.
464
+ */
465
+ async listMembers(workspaceId) {
466
+ return await this.client.workspace.listMembers.query({
467
+ workspaceId
468
+ });
469
+ }
194
470
  };
195
471
 
196
472
  // src/contacts.ts
@@ -323,6 +599,11 @@ var TicketsApi = class {
323
599
  input
324
600
  );
325
601
  }
602
+ async updateComment(input) {
603
+ return await this.client.product.ticket.updateComment.mutate(
604
+ input
605
+ );
606
+ }
326
607
  async deleteComment(id) {
327
608
  return await this.client.product.ticket.deleteComment.mutate({
328
609
  id
@@ -693,6 +974,11 @@ var ExponentialClient = class {
693
974
  this.client = createClient(this.config);
694
975
  this.actions = new ActionsApi(this.client);
695
976
  this.actionComments = new ActionCommentsApi(this.client);
977
+ this.featureComments = new FeatureCommentsApi(this.client);
978
+ this.pageComments = new PageCommentsApi(this.client);
979
+ this.goalComments = new GoalCommentsApi(this.client);
980
+ this.keyResults = new KeyResultsApi(this.client);
981
+ this.goals = new GoalsApi(this.client, this.keyResults);
696
982
  this.projects = new ProjectsApi(this.client);
697
983
  this.workspaces = new WorkspacesApi(this.client);
698
984
  this.contacts = new ContactsApi(this.client);
@@ -713,6 +999,12 @@ var ExponentialClient = class {
713
999
  client;
714
1000
  actions;
715
1001
  actionComments;
1002
+ featureComments;
1003
+ pageComments;
1004
+ goalComments;
1005
+ goals;
1006
+ /** Same instance as `goals.keyResults`. */
1007
+ keyResults;
716
1008
  projects;
717
1009
  workspaces;
718
1010
  contacts;