lalph 0.1.99 → 0.1.100

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/cli.mjs CHANGED
@@ -137805,7 +137805,8 @@ var State = class extends Class("State")({
137805
137805
  }) {};
137806
137806
  var Issue = class extends Class("Issue")({
137807
137807
  id: String$1,
137808
- identifier: String$1
137808
+ identifier: String$1,
137809
+ state: State
137809
137810
  }) {};
137810
137811
  var InverseRelationsNode = class extends Class("InverseRelationsNode")({
137811
137812
  id: String$1,
@@ -137824,7 +137825,10 @@ var IssuesNode = class extends Class("IssuesNode")({
137824
137825
  labelIds: Array$1(String$1),
137825
137826
  inverseRelations: InverseRelations,
137826
137827
  completedAt: NullOr(DateTimeUtc)
137827
- }) {};
137828
+ }) {
137829
+ blockedBy = this.inverseRelations.nodes.filter((relation) => relation.type === "blocks" && incompleteStates.has(relation.issue.state.type));
137830
+ };
137831
+ const incompleteStates = new Set(["unstarted", "started"]);
137828
137832
  const LinearIssueData = Struct({ issue: IssuesNode });
137829
137833
  var Issues = class extends Class("Issues")({ nodes: Array$1(IssuesNode) }) {};
137830
137834
  var LinearIssuesData = class extends Class("LinearIssuesData")({ issues: Issues }) {};
@@ -137937,19 +137941,16 @@ const LinearIssueSource = effect(IssueSource, gen(function* () {
137937
137941
  const completedAt = issue.completedAt;
137938
137942
  if (!completedAt) return true;
137939
137943
  return isGreaterThanOrEqualTo$1(completedAt, threeDaysAgo);
137940
- }), map$10((issue) => {
137941
- const blocks = issue.inverseRelations.nodes.filter((r) => r.type === "blocks");
137942
- return new PrdIssue({
137943
- id: issue.identifier,
137944
- title: issue.title,
137945
- description: issue.description ?? "",
137946
- priority: issue.priority,
137947
- estimate: issue.estimate ?? null,
137948
- state: linearStateToPrdState(issue.state),
137949
- blockedBy: blocks.map((r) => r.issue.identifier),
137950
- autoMerge: autoMergeLabelId.pipe(map$12((labelId$1) => issue.labelIds.includes(labelId$1)), getOrElse(() => false))
137951
- });
137952
- }));
137944
+ }), map$10((issue) => new PrdIssue({
137945
+ id: issue.identifier,
137946
+ title: issue.title,
137947
+ description: issue.description ?? "",
137948
+ priority: issue.priority,
137949
+ estimate: issue.estimate ?? null,
137950
+ state: linearStateToPrdState(issue.state),
137951
+ blockedBy: issue.blockedBy.map((r) => r.issue.identifier),
137952
+ autoMerge: autoMergeLabelId.pipe(map$12((labelId$1) => issue.labelIds.includes(labelId$1)), getOrElse(() => false))
137953
+ })));
137953
137954
  }));
137954
137955
  return IssueSource.of({
137955
137956
  issues,
@@ -137997,7 +137998,7 @@ const LinearIssueSource = effect(IssueSource, gen(function* () {
137997
137998
  const blockerIssueId = identifierMap.get(identifier$1);
137998
137999
  return blockerIssueId ? [blockerIssueId] : [];
137999
138000
  });
138000
- const existingBlockers = (yield* linear.issueById(issueId)).inverseRelations.nodes.filter((r) => r.type === "blocks");
138001
+ const existingBlockers = (yield* linear.issueById(issueId)).blockedBy;
138001
138002
  const toAdd = blockedBy.filter((blockerIssueId) => !existingBlockers.some((b) => b.issue.id === blockerIssueId));
138002
138003
  const toRemove = existingBlockers.filter((relation) => !blockedBy.includes(relation.issue.id));
138003
138004
  if (toAdd.length === 0 && toRemove.length === 0) return;
@@ -138126,6 +138127,11 @@ const issueQueryFields = `
138126
138127
  issue {
138127
138128
  id
138128
138129
  identifier
138130
+ state {
138131
+ id
138132
+ name
138133
+ type
138134
+ }
138129
138135
  }
138130
138136
  }
138131
138137
  }
@@ -145579,7 +145585,7 @@ const commandSource = make$28("source").pipe(withDescription("Select the issue s
145579
145585
 
145580
145586
  //#endregion
145581
145587
  //#region package.json
145582
- var version = "0.1.99";
145588
+ var version = "0.1.100";
145583
145589
 
145584
145590
  //#endregion
145585
145591
  //#region src/Tracing.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.1.99",
4
+ "version": "0.1.100",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
package/src/Linear.ts CHANGED
@@ -239,24 +239,22 @@ export const LinearIssueSource = Layer.effect(
239
239
  if (!completedAt) return true
240
240
  return DateTime.isGreaterThanOrEqualTo(completedAt, threeDaysAgo)
241
241
  }),
242
- Array.map((issue) => {
243
- const blocks = issue.inverseRelations.nodes.filter(
244
- (r) => r.type === "blocks",
245
- )
246
- return new PrdIssue({
247
- id: issue.identifier,
248
- title: issue.title,
249
- description: issue.description ?? "",
250
- priority: issue.priority,
251
- estimate: issue.estimate ?? null,
252
- state: linearStateToPrdState(issue.state),
253
- blockedBy: blocks.map((r) => r.issue.identifier),
254
- autoMerge: autoMergeLabelId.pipe(
255
- Option.map((labelId) => issue.labelIds.includes(labelId)),
256
- Option.getOrElse(() => false),
257
- ),
258
- })
259
- }),
242
+ Array.map(
243
+ (issue) =>
244
+ new PrdIssue({
245
+ id: issue.identifier,
246
+ title: issue.title,
247
+ description: issue.description ?? "",
248
+ priority: issue.priority,
249
+ estimate: issue.estimate ?? null,
250
+ state: linearStateToPrdState(issue.state),
251
+ blockedBy: issue.blockedBy.map((r) => r.issue.identifier),
252
+ autoMerge: autoMergeLabelId.pipe(
253
+ Option.map((labelId) => issue.labelIds.includes(labelId)),
254
+ Option.getOrElse(() => false),
255
+ ),
256
+ }),
257
+ ),
260
258
  )
261
259
  }),
262
260
  )
@@ -335,9 +333,7 @@ export const LinearIssueSource = Layer.effect(
335
333
  })
336
334
 
337
335
  const linearIssue = yield* linear.issueById(issueId)
338
- const existingBlockers = linearIssue.inverseRelations.nodes.filter(
339
- (r) => r.type === "blocks",
340
- )
336
+ const existingBlockers = linearIssue.blockedBy
341
337
 
342
338
  const toAdd = blockedBy.filter(
343
339
  (blockerIssueId) =>
@@ -547,6 +543,11 @@ const issueQueryFields = `
547
543
  issue {
548
544
  id
549
545
  identifier
546
+ state {
547
+ id
548
+ name
549
+ type
550
+ }
550
551
  }
551
552
  }
552
553
  }
@@ -19,6 +19,7 @@ export class State extends S.Class<State>("State")({
19
19
  export class Issue extends S.Class<Issue>("Issue")({
20
20
  id: S.String,
21
21
  identifier: S.String,
22
+ state: State,
22
23
  }) {}
23
24
 
24
25
  export class InverseRelationsNode extends S.Class<InverseRelationsNode>(
@@ -46,7 +47,14 @@ export class IssuesNode extends S.Class<IssuesNode>("IssuesNode")({
46
47
  labelIds: S.Array(S.String),
47
48
  inverseRelations: InverseRelations,
48
49
  completedAt: S.NullOr(S.DateTimeUtc),
49
- }) {}
50
+ }) {
51
+ readonly blockedBy = this.inverseRelations.nodes.filter(
52
+ (relation) =>
53
+ relation.type === "blocks" &&
54
+ incompleteStates.has(relation.issue.state.type),
55
+ )
56
+ }
57
+ const incompleteStates = new Set<Type>(["unstarted", "started"])
50
58
 
51
59
  export const LinearIssueData = S.Struct({
52
60
  issue: IssuesNode,