@mastra/factory 0.29.0-alpha.3 → 0.29.0-alpha.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 +123 -64
- package/dist/boards/board-events.d.ts +89 -9
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/board-events.js +176 -13
- package/dist/boards/board-events.js.map +1 -1
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +14 -1
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/busy-card.d.ts +11 -0
- package/dist/boards/busy-card.d.ts.map +1 -0
- package/dist/boards/busy-card.js +15 -0
- package/dist/boards/busy-card.js.map +1 -0
- package/dist/boards/card-facts.d.ts.map +1 -1
- package/dist/boards/card-facts.js +18 -4
- package/dist/boards/card-facts.js.map +1 -1
- package/dist/boards/index.d.ts +2 -1
- package/dist/boards/index.d.ts.map +1 -1
- package/dist/boards/index.js +3 -2
- package/dist/boards/intake-dry-run.d.ts +109 -0
- package/dist/boards/intake-dry-run.d.ts.map +1 -0
- package/dist/boards/intake-dry-run.js +158 -0
- package/dist/boards/intake-dry-run.js.map +1 -0
- package/dist/boards/intake-lookup.d.ts +32 -0
- package/dist/boards/intake-lookup.d.ts.map +1 -0
- package/dist/boards/intake-lookup.js +12 -0
- package/dist/boards/intake-lookup.js.map +1 -0
- package/dist/boards/intake-order.d.ts +32 -0
- package/dist/boards/intake-order.d.ts.map +1 -0
- package/dist/boards/intake-order.js +60 -0
- package/dist/boards/intake-order.js.map +1 -0
- package/dist/boards/intake-routing.d.ts +246 -35
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +437 -52
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/reroute.d.ts +7 -3
- package/dist/boards/reroute.d.ts.map +1 -1
- package/dist/boards/reroute.js +21 -4
- package/dist/boards/reroute.js.map +1 -1
- package/dist/boards/semantics.d.ts +8 -28
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +7 -39
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/work-routes.d.ts +31 -11
- package/dist/boards/work-routes.d.ts.map +1 -1
- package/dist/boards/work-routes.js +104 -20
- package/dist/boards/work-routes.js.map +1 -1
- package/dist/factory.d.ts +27 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +32 -18
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/integrations/base.d.ts +9 -0
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/dependabot/rules.d.ts.map +1 -1
- package/dist/integrations/dependabot/rules.js +2 -6
- package/dist/integrations/dependabot/rules.js.map +1 -1
- package/dist/integrations/github/commits.d.ts +0 -21
- package/dist/integrations/github/commits.d.ts.map +1 -1
- package/dist/integrations/github/commits.js +1 -24
- package/dist/integrations/github/commits.js.map +1 -1
- package/dist/integrations/github/default-rules.d.ts +22 -1
- package/dist/integrations/github/default-rules.d.ts.map +1 -1
- package/dist/integrations/github/default-rules.js +23 -5
- package/dist/integrations/github/default-rules.js.map +1 -1
- package/dist/integrations/github/intake-lookup.d.ts +16 -0
- package/dist/integrations/github/intake-lookup.d.ts.map +1 -0
- package/dist/integrations/github/intake-lookup.js +76 -0
- package/dist/integrations/github/intake-lookup.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +20 -6
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +23 -12
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/review-status-reporter.js +1 -1
- package/dist/integrations/github/routes.d.ts +1 -11
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +20 -517
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +12 -1
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +275 -38
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +30 -4
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/default-rules.js +19 -3
- package/dist/integrations/gitlab/default-rules.js.map +1 -1
- package/dist/integrations/gitlab/discovery.d.ts +1 -1
- package/dist/integrations/gitlab/discovery.js +1 -1
- package/dist/integrations/gitlab/discovery.js.map +1 -1
- package/dist/integrations/gitlab/intake-lookup.d.ts +17 -0
- package/dist/integrations/gitlab/intake-lookup.d.ts.map +1 -0
- package/dist/integrations/gitlab/intake-lookup.js +85 -0
- package/dist/integrations/gitlab/intake-lookup.js.map +1 -0
- package/dist/integrations/gitlab/integration.d.ts +5 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -1
- package/dist/integrations/gitlab/integration.js +21 -2
- package/dist/integrations/gitlab/integration.js.map +1 -1
- package/dist/integrations/gitlab/routes.d.ts +0 -2
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +49 -165
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts +20 -0
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +128 -19
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/incidentio/routes.d.ts +5 -5
- package/dist/integrations/incidentio/routes.d.ts.map +1 -1
- package/dist/integrations/incidentio/routes.js +3 -59
- package/dist/integrations/incidentio/routes.js.map +1 -1
- package/dist/integrations/incidentio/rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/rules.js +15 -9
- package/dist/integrations/incidentio/rules.js.map +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/jira/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/routes.d.ts +2 -2
- package/dist/integrations/jira/routes.d.ts.map +1 -1
- package/dist/integrations/jira/routes.js +0 -68
- package/dist/integrations/jira/routes.js.map +1 -1
- package/dist/integrations/jira/rules.d.ts.map +1 -1
- package/dist/integrations/jira/rules.js +13 -7
- package/dist/integrations/jira/rules.js.map +1 -1
- package/dist/integrations/linear/routes.d.ts +2 -2
- package/dist/integrations/linear/routes.d.ts.map +1 -1
- package/dist/integrations/linear/routes.js +0 -83
- package/dist/integrations/linear/routes.js.map +1 -1
- package/dist/integrations/linear/rules.d.ts.map +1 -1
- package/dist/integrations/linear/rules.js +14 -7
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +9 -1
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +6 -6
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +23 -6
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/routes.d.ts +2 -2
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
- package/dist/integrations/platform/jira/routes.js +0 -69
- package/dist/integrations/platform/jira/routes.js.map +1 -1
- package/dist/integrations/pull-request-head.d.ts +1 -1
- package/dist/integrations/pull-request-head.d.ts.map +1 -1
- package/dist/integrations/pull-request-head.js +5 -0
- package/dist/integrations/pull-request-head.js.map +1 -1
- package/dist/integrations/vanta/rules.d.ts.map +1 -1
- package/dist/integrations/vanta/rules.js +2 -6
- package/dist/integrations/vanta/rules.js.map +1 -1
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/routes/automation-runs.d.ts +0 -2
- package/dist/routes/automation-runs.d.ts.map +1 -1
- package/dist/routes/automation-runs.js +2 -6
- package/dist/routes/automation-runs.js.map +1 -1
- package/dist/routes/board-snapshot.d.ts +8 -1
- package/dist/routes/board-snapshot.d.ts.map +1 -1
- package/dist/routes/board-snapshot.js +33 -7
- package/dist/routes/board-snapshot.js.map +1 -1
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/config.d.ts +6 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +5 -2
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +1258 -5
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +588 -17
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/fs.d.ts +10 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/dist/routes/fs.js +184 -11
- package/dist/routes/fs.js.map +1 -1
- package/dist/routes/intake-check.d.ts +92 -0
- package/dist/routes/intake-check.d.ts.map +1 -0
- package/dist/routes/intake-check.js +322 -0
- package/dist/routes/intake-check.js.map +1 -0
- package/dist/routes/intake-routes.d.ts +10 -2
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +292 -11
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/mastra-gateway.d.ts.map +1 -1
- package/dist/routes/mastra-gateway.js +3 -2
- package/dist/routes/mastra-gateway.js.map +1 -1
- package/dist/routes/project-sessions.d.ts +49 -0
- package/dist/routes/project-sessions.d.ts.map +1 -0
- package/dist/routes/project-sessions.js +93 -0
- package/dist/routes/project-sessions.js.map +1 -0
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +4 -17
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/run-queue.d.ts +6 -6
- package/dist/routes/run-queue.d.ts.map +1 -1
- package/dist/routes/run-queue.js +28 -8
- package/dist/routes/run-queue.js.map +1 -1
- package/dist/routes/session-rows.d.ts +30 -0
- package/dist/routes/session-rows.d.ts.map +1 -0
- package/dist/routes/session-rows.js +98 -0
- package/dist/routes/session-rows.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +4 -8
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +8 -106
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/surface.d.ts +13 -3
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +25 -38
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/work-item-starters.d.ts +1 -0
- package/dist/routes/work-item-starters.d.ts.map +1 -1
- package/dist/routes/work-item-starters.js +14 -2
- package/dist/routes/work-item-starters.js.map +1 -1
- package/dist/routes/work-items.d.ts +13 -0
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +87 -34
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/dispatch-errors.js +1 -1
- package/dist/rules/dispatch-errors.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +39 -7
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +362 -127
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.d.ts +69 -1
- package/dist/rules/event-rules.d.ts.map +1 -1
- package/dist/rules/event-rules.js +151 -5
- package/dist/rules/event-rules.js.map +1 -1
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +1 -6
- package/dist/rules/processor.js.map +1 -1
- package/dist/rules/review-source-tool.js +1 -1
- package/dist/rules/rule-group.d.ts +18 -1
- package/dist/rules/rule-group.d.ts.map +1 -1
- package/dist/rules/rule-group.js +52 -8
- package/dist/rules/rule-group.js.map +1 -1
- package/dist/rules/run-bearing.d.ts +8 -0
- package/dist/rules/run-bearing.d.ts.map +1 -0
- package/dist/rules/run-bearing.js +11 -0
- package/dist/rules/run-bearing.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +2 -3
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +27 -35
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/tools.js +2 -1
- package/dist/rules/tools.js.map +1 -1
- package/dist/rules/transition-service.d.ts +16 -0
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +34 -12
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +18 -5
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +2 -1
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/update-fold.d.ts +32 -0
- package/dist/rules/update-fold.d.ts.map +1 -0
- package/dist/rules/update-fold.js +60 -0
- package/dist/rules/update-fold.js.map +1 -0
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +54 -6
- package/dist/rules/validation.js.map +1 -1
- package/dist/session/resource-migration.d.ts.map +1 -1
- package/dist/session/resource-migration.js +2 -3
- package/dist/session/resource-migration.js.map +1 -1
- package/dist/session/run-audit.d.ts +9 -0
- package/dist/session/run-audit.d.ts.map +1 -1
- package/dist/session/run-audit.js +9 -1
- package/dist/session/run-audit.js.map +1 -1
- package/dist/session/self-review-gate.d.ts +26 -2
- package/dist/session/self-review-gate.d.ts.map +1 -1
- package/dist/session/self-review-gate.js +60 -10
- package/dist/session/self-review-gate.js.map +1 -1
- package/dist/session/session-row-query.d.ts +25 -0
- package/dist/session/session-row-query.d.ts.map +1 -0
- package/dist/session/session-row-query.js +47 -0
- package/dist/session/session-row-query.js.map +1 -0
- package/dist/session/session-row-status.d.ts +16 -0
- package/dist/session/session-row-status.d.ts.map +1 -0
- package/dist/session/session-row-status.js +14 -0
- package/dist/session/session-row-status.js.map +1 -0
- package/dist/session/session-row-view.d.ts +14 -0
- package/dist/session/session-row-view.d.ts.map +1 -0
- package/dist/session/session-row-view.js +125 -0
- package/dist/session/session-row-view.js.map +1 -0
- package/dist/session/session-rows.d.ts +46 -0
- package/dist/session/session-rows.d.ts.map +1 -0
- package/dist/session/session-rows.js +232 -0
- package/dist/session/session-rows.js.map +1 -0
- package/dist/session/session-threads.d.ts.map +1 -1
- package/dist/session/session-threads.js +1 -0
- package/dist/session/session-threads.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +14 -7
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +10 -2
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/session/work-item-repository.d.ts +44 -0
- package/dist/session/work-item-repository.d.ts.map +1 -1
- package/dist/session/work-item-repository.js +80 -1
- package/dist/session/work-item-repository.js.map +1 -1
- package/dist/session/work-item-state-processor.d.ts.map +1 -1
- package/dist/session/work-item-state-processor.js +44 -8
- package/dist/session/work-item-state-processor.js.map +1 -1
- package/dist/storage/domains/audit/actions.d.ts +2 -1
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +3 -1
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +162 -14
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +415 -41
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts +6 -0
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +93 -3
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/intake/base.d.ts +11 -10
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +30 -65
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/integrations/base.d.ts +0 -2
- package/dist/storage/domains/integrations/base.d.ts.map +1 -1
- package/dist/storage/domains/integrations/base.js +0 -6
- package/dist/storage/domains/integrations/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +19 -22
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/source-control/base.d.ts +0 -10
- package/dist/storage/domains/source-control/base.d.ts.map +1 -1
- package/dist/storage/domains/source-control/base.js +6 -21
- package/dist/storage/domains/source-control/base.js.map +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/source-control/inmemory.js +1 -6
- package/dist/storage/domains/source-control/inmemory.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +49 -53
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +152 -156
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/cards.d.ts +3 -2
- package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
- package/dist/storage/domains/work-items/cards.js +4 -2
- package/dist/storage/domains/work-items/cards.js.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.d.ts +12 -3
- package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.js +12 -3
- package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
- package/dist/storage/legacy-collections.d.ts +9 -0
- package/dist/storage/legacy-collections.d.ts.map +1 -0
- package/dist/storage/legacy-collections.js +17 -0
- package/dist/storage/legacy-collections.js.map +1 -0
- package/dist/storage/probed-list.d.ts +11 -0
- package/dist/storage/probed-list.d.ts.map +1 -0
- package/dist/storage/probed-list.js +52 -0
- package/dist/storage/probed-list.js.map +1 -0
- package/dist/tools/audit-events-tool.d.ts +2 -2
- package/dist/tools/read-tools.d.ts +0 -3
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +4 -42
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/session-tools.d.ts.map +1 -1
- package/dist/tools/session-tools.js +5 -9
- package/dist/tools/session-tools.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts +3 -0
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +8 -4
- package/dist/tools/work-item-tools.js.map +1 -1
- package/dist/work-item-branch.d.ts +4 -0
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +7 -1
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/card-context-sessions.d.ts +50 -0
- package/dist/work-items/card-context-sessions.d.ts.map +1 -0
- package/dist/work-items/card-context-sessions.js +84 -0
- package/dist/work-items/card-context-sessions.js.map +1 -0
- package/dist/work-items/change-requests.d.ts +87 -0
- package/dist/work-items/change-requests.d.ts.map +1 -0
- package/dist/work-items/change-requests.js +134 -0
- package/dist/work-items/change-requests.js.map +1 -0
- package/dist/work-items/create-work-item.d.ts +7 -2
- package/dist/work-items/create-work-item.d.ts.map +1 -1
- package/dist/work-items/create-work-item.js +44 -13
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/work-items/list-related-cards.d.ts.map +1 -1
- package/dist/work-items/list-related-cards.js +1 -1
- package/dist/work-items/list-related-cards.js.map +1 -1
- package/dist/work-items/providers/github.d.ts.map +1 -1
- package/dist/work-items/providers/github.js +1 -0
- package/dist/work-items/providers/github.js.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +1 -3
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +2 -2
- package/factory-skills/factory-build/SKILL.md +1 -1
- package/factory-skills/factory-plan/SKILL.md +5 -3
- package/factory-skills/factory-self-review/SKILL.md +2 -0
- package/factory-skills/factory-triage/SKILL.md +1 -1
- package/package.json +10 -10
- package/dist/session/filesystem-capture.d.ts +0 -50
- package/dist/session/filesystem-capture.d.ts.map +0 -1
- package/dist/session/filesystem-capture.js +0 -229
- package/dist/session/filesystem-capture.js.map +0 -1
- package/dist/storage/domains/filesystem/base.d.ts +0 -30
- package/dist/storage/domains/filesystem/base.d.ts.map +0 -1
- package/dist/storage/domains/filesystem/base.js +0 -78
- package/dist/storage/domains/filesystem/base.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IntakeItemLookup } from '../../boards/intake-lookup.js';
|
|
2
|
+
import type { SourceControlStorageHandle } from '../../storage/domains/source-control/base.js';
|
|
3
|
+
import type { GithubIssueFetcher, GithubPullRequestFetcher, GithubRulesIntegration } from './rules.js';
|
|
4
|
+
export interface GithubIntakeLookupDeps extends Pick<GithubRulesIntegration, 'getRepositoryCollaboratorPermission'> {
|
|
5
|
+
sourceControl(): SourceControlStorageHandle;
|
|
6
|
+
fetchIssueState: GithubIssueFetcher;
|
|
7
|
+
fetchPullRequestState: GithubPullRequestFetcher;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads a GitHub issue or pull request for the intake tester, only from a repository linked to the
|
|
11
|
+
* project and only through that link's installation. It builds the facts the webhook arrival would
|
|
12
|
+
* carry, with author trust from the author's repository access. Factory's own pull requests aren't
|
|
13
|
+
* recognized as Factory-authored here; they already have cards, which the tester reads first.
|
|
14
|
+
*/
|
|
15
|
+
export declare function githubIntakeLookup(deps: GithubIntakeLookupDeps): IntakeItemLookup;
|
|
16
|
+
//# sourceMappingURL=intake-lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake-lookup.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/intake-lookup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAKvG,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,qCAAqC,CAAC;IACjH,aAAa,IAAI,0BAA0B,CAAC;IAC5C,eAAe,EAAE,kBAAkB,CAAC;IACpC,qBAAqB,EAAE,wBAAwB,CAAC;CACjD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,gBAAgB,CAgEjF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cardRuleFacts } from "../../boards/card-facts.js";
|
|
2
|
+
import { externalSourceForWorkItem } from "../../rules/types.js";
|
|
3
|
+
import { trustedCollaborator } from "./rules.js";
|
|
4
|
+
// src/integrations/github/intake-lookup.ts
|
|
5
|
+
const GITHUB_ITEM_URL = /^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/]+)\/(issues|pull)\/(\d+)(?:[/?#].*)?$/i;
|
|
6
|
+
/**
|
|
7
|
+
* Reads a GitHub issue or pull request for the intake tester, only from a repository linked to the
|
|
8
|
+
* project and only through that link's installation. It builds the facts the webhook arrival would
|
|
9
|
+
* carry, with author trust from the author's repository access. Factory's own pull requests aren't
|
|
10
|
+
* recognized as Factory-authored here; they already have cards, which the tester reads first.
|
|
11
|
+
*/
|
|
12
|
+
function githubIntakeLookup(deps) {
|
|
13
|
+
return { async lookup(scope, url) {
|
|
14
|
+
const match = GITHUB_ITEM_URL.exec(url.trim());
|
|
15
|
+
if (!match) return void 0;
|
|
16
|
+
const slug = `${match[1]}/${match[2]}`.toLowerCase();
|
|
17
|
+
const number = Number(match[4]);
|
|
18
|
+
const linked = (await deps.sourceControl().connections.listWithRepositories({
|
|
19
|
+
orgId: scope.orgId,
|
|
20
|
+
factoryProjectIds: [scope.factoryProjectId]
|
|
21
|
+
})).flatMap((connection) => connection.repositories.map((link) => ({
|
|
22
|
+
installation: connection.installation,
|
|
23
|
+
repository: link.repository
|
|
24
|
+
}))).find(({ repository }) => repository?.slug.toLowerCase() === slug);
|
|
25
|
+
if (!linked?.repository) return { status: "not_linked" };
|
|
26
|
+
const installationId = Number(linked.installation.externalId);
|
|
27
|
+
const repository = linked.repository.slug;
|
|
28
|
+
const read = {
|
|
29
|
+
installationId,
|
|
30
|
+
repository,
|
|
31
|
+
number
|
|
32
|
+
};
|
|
33
|
+
const issue = match[3]?.toLowerCase() === "issues" ? await deps.fetchIssueState(read) : void 0;
|
|
34
|
+
const asPullRequest = issue ? void 0 : await deps.fetchPullRequestState(read);
|
|
35
|
+
const item = issue ?? asPullRequest;
|
|
36
|
+
if (!item) return { status: "not_found" };
|
|
37
|
+
const author = item.author;
|
|
38
|
+
const trusted = author ? await trustedCollaborator(deps, {
|
|
39
|
+
installationId,
|
|
40
|
+
repository,
|
|
41
|
+
login: author
|
|
42
|
+
}).catch(() => false) : false;
|
|
43
|
+
const kind = asPullRequest ? "github-pr" : "github-issue";
|
|
44
|
+
const metadata = {
|
|
45
|
+
githubRepositoryId: Number(linked.repository.externalId),
|
|
46
|
+
...asPullRequest ? { githubPullRequestNumber: number } : { githubIssueNumber: number },
|
|
47
|
+
...item.createdAt ? { sourceCreatedAt: item.createdAt } : {},
|
|
48
|
+
...author ? { author } : {},
|
|
49
|
+
state: item.state,
|
|
50
|
+
authorTrusted: trusted,
|
|
51
|
+
assignees: item.assignees ?? [],
|
|
52
|
+
labels: item.labels ?? [],
|
|
53
|
+
...asPullRequest ? {
|
|
54
|
+
draft: asPullRequest.draft,
|
|
55
|
+
merged: asPullRequest.merged,
|
|
56
|
+
requestedReviewers: asPullRequest.requestedReviewers ?? [],
|
|
57
|
+
headBranch: asPullRequest.headBranch,
|
|
58
|
+
baseBranch: asPullRequest.baseBranch
|
|
59
|
+
} : {}
|
|
60
|
+
};
|
|
61
|
+
const sourceKey = `github:${linked.repository.externalId}:${asPullRequest ? "pull-request" : "issue"}:${number}`;
|
|
62
|
+
return {
|
|
63
|
+
status: "found",
|
|
64
|
+
title: item.title,
|
|
65
|
+
url: item.url,
|
|
66
|
+
facts: cardRuleFacts({
|
|
67
|
+
title: item.title,
|
|
68
|
+
metadata,
|
|
69
|
+
externalSource: externalSourceForWorkItem(kind, sourceKey, item.url)
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
} };
|
|
73
|
+
}
|
|
74
|
+
export { githubIntakeLookup };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=intake-lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake-lookup.js","names":[],"sources":["../../../src/integrations/github/intake-lookup.ts"],"sourcesContent":["import { cardRuleFacts } from '../../boards/card-facts.js';\nimport type { IntakeItemLookup } from '../../boards/intake-lookup.js';\nimport { externalSourceForWorkItem } from '../../rules/types.js';\nimport type { SourceControlStorageHandle } from '../../storage/domains/source-control/base.js';\nimport type { GithubIssueFetcher, GithubPullRequestFetcher, GithubRulesIntegration } from './rules.js';\nimport { trustedCollaborator } from './rules.js';\n\nconst GITHUB_ITEM_URL = /^https?:\\/\\/(?:www\\.)?github\\.com\\/([^/]+)\\/([^/]+)\\/(issues|pull)\\/(\\d+)(?:[/?#].*)?$/i;\n\nexport interface GithubIntakeLookupDeps extends Pick<GithubRulesIntegration, 'getRepositoryCollaboratorPermission'> {\n sourceControl(): SourceControlStorageHandle;\n fetchIssueState: GithubIssueFetcher;\n fetchPullRequestState: GithubPullRequestFetcher;\n}\n\n/**\n * Reads a GitHub issue or pull request for the intake tester, only from a repository linked to the\n * project and only through that link's installation. It builds the facts the webhook arrival would\n * carry, with author trust from the author's repository access. Factory's own pull requests aren't\n * recognized as Factory-authored here; they already have cards, which the tester reads first.\n */\nexport function githubIntakeLookup(deps: GithubIntakeLookupDeps): IntakeItemLookup {\n return {\n async lookup(scope, url) {\n const match = GITHUB_ITEM_URL.exec(url.trim());\n if (!match) return undefined;\n const slug = `${match[1]}/${match[2]}`.toLowerCase();\n const number = Number(match[4]);\n const connections = await deps.sourceControl().connections.listWithRepositories({\n orgId: scope.orgId,\n factoryProjectIds: [scope.factoryProjectId],\n });\n const linked = connections\n .flatMap(connection =>\n connection.repositories.map(link => ({ installation: connection.installation, repository: link.repository })),\n )\n .find(({ repository }) => repository?.slug.toLowerCase() === slug);\n if (!linked?.repository) return { status: 'not_linked' };\n const installationId = Number(linked.installation.externalId);\n const repository = linked.repository.slug;\n const read = { installationId, repository, number };\n\n // An issue URL can name a pull request; GitHub redirects it, and the issue read refuses it.\n const issue = match[3]?.toLowerCase() === 'issues' ? await deps.fetchIssueState(read) : undefined;\n const asPullRequest = issue ? undefined : await deps.fetchPullRequestState(read);\n const item = issue ?? asPullRequest;\n if (!item) return { status: 'not_found' };\n\n const author = item.author;\n const trusted = author\n ? await trustedCollaborator(deps, { installationId, repository, login: author }).catch(() => false)\n : false;\n const kind = asPullRequest ? 'github-pr' : 'github-issue';\n const metadata: Record<string, unknown> = {\n githubRepositoryId: Number(linked.repository.externalId),\n ...(asPullRequest ? { githubPullRequestNumber: number } : { githubIssueNumber: number }),\n ...(item.createdAt ? { sourceCreatedAt: item.createdAt } : {}),\n ...(author ? { author } : {}),\n state: item.state,\n authorTrusted: trusted,\n assignees: item.assignees ?? [],\n labels: item.labels ?? [],\n ...(asPullRequest\n ? {\n draft: asPullRequest.draft,\n merged: asPullRequest.merged,\n requestedReviewers: asPullRequest.requestedReviewers ?? [],\n headBranch: asPullRequest.headBranch,\n baseBranch: asPullRequest.baseBranch,\n }\n : {}),\n };\n const sourceKey = `github:${linked.repository.externalId}:${asPullRequest ? 'pull-request' : 'issue'}:${number}`;\n return {\n status: 'found',\n title: item.title,\n url: item.url,\n facts: cardRuleFacts({\n title: item.title,\n metadata,\n externalSource: externalSourceForWorkItem(kind, sourceKey, item.url),\n }),\n };\n },\n };\n}\n"],"mappings":";;;;AAOA,MAAM,kBAAkB;;;;;;;AAcxB,SAAgB,mBAAmB,MAAgD;CACjF,OAAO,EACL,MAAM,OAAO,OAAO,KAAK;EACvB,MAAM,QAAQ,gBAAgB,KAAK,IAAI,KAAK,CAAC;EAC7C,IAAI,CAAC,OAAO,OAAO,KAAA;EACnB,MAAM,OAAO,GAAG,MAAM,GAAG,GAAG,MAAM,KAAK,YAAY;EACnD,MAAM,SAAS,OAAO,MAAM,EAAE;EAK9B,MAAM,UAAS,MAJW,KAAK,cAAc,CAAC,CAAC,YAAY,qBAAqB;GAC9E,OAAO,MAAM;GACb,mBAAmB,CAAC,MAAM,gBAAgB;EAC5C,CAAC,EAAA,CAEE,SAAQ,eACP,WAAW,aAAa,KAAI,UAAS;GAAE,cAAc,WAAW;GAAc,YAAY,KAAK;EAAW,EAAE,CAC9G,CAAC,CACA,MAAM,EAAE,iBAAiB,YAAY,KAAK,YAAY,MAAM,I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Z;IACA,gBAAgB,0BAA0B,MAAM,WAAW,KAAK,GAAG;GACrE,CAAC;EACH;CACF,EACF;AACF"}
|
|
@@ -26,6 +26,7 @@ import type { RequestContext } from '@mastra/core/request-context';
|
|
|
26
26
|
import type { ApiRoute } from '@mastra/core/server';
|
|
27
27
|
import type { MastraWorker } from '@mastra/core/worker';
|
|
28
28
|
import { Octokit } from '@octokit/rest';
|
|
29
|
+
import type { IntakeItemLookup } from '../../boards/intake-lookup.js';
|
|
29
30
|
import type { Intake } from '../../capabilities/intake.js';
|
|
30
31
|
import type { VersionControl } from '../../capabilities/version-control.js';
|
|
31
32
|
import type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../base.js';
|
|
@@ -55,7 +56,20 @@ export interface RepoSummary {
|
|
|
55
56
|
defaultBranch: string;
|
|
56
57
|
private: boolean;
|
|
57
58
|
installationId: number;
|
|
59
|
+
/** When the repository last received a push, for "most recent first" ordering. */
|
|
60
|
+
pushedAt?: string | null;
|
|
58
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Narrows a repository listing: `query` keeps names containing it, `limit`
|
|
64
|
+
* returns only that many, most recently pushed first. `fresh` skips caches.
|
|
65
|
+
*/
|
|
66
|
+
export interface RepoListOptions {
|
|
67
|
+
fresh?: boolean;
|
|
68
|
+
query?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
}
|
|
71
|
+
/** Repositories whose full name contains `query`, most recently pushed first, at most `limit`. */
|
|
72
|
+
export declare function narrowRepos(repos: RepoSummary[], query?: string, limit?: number): RepoSummary[];
|
|
59
73
|
export interface GithubTriageCommentUpsertInput {
|
|
60
74
|
installationId: number;
|
|
61
75
|
repository: string;
|
|
@@ -124,6 +138,7 @@ export declare class GithubIntegration implements FactoryIntegration {
|
|
|
124
138
|
/** Stable integration identifier (see `../factory-integration.ts`). */
|
|
125
139
|
readonly id = "github";
|
|
126
140
|
get rules(): GithubEventRules;
|
|
141
|
+
readonly intakeLookup: IntakeItemLookup;
|
|
127
142
|
readonly intake: Intake;
|
|
128
143
|
readonly versionControl: VersionControl;
|
|
129
144
|
/**
|
|
@@ -168,12 +183,11 @@ export declare class GithubIntegration implements FactoryIntegration {
|
|
|
168
183
|
*/
|
|
169
184
|
listUserInstallations(userToken: string): Promise<UserInstallation[]>;
|
|
170
185
|
/**
|
|
171
|
-
* List repos accessible to an installation (paginated)
|
|
172
|
-
* GitHub directly, so `fresh` has nothing to
|
|
186
|
+
* List repos accessible to an installation (paginated), narrowed by
|
|
187
|
+
* `query`/`limit`. Always reads GitHub directly, so `fresh` has nothing to
|
|
188
|
+
* bypass here.
|
|
173
189
|
*/
|
|
174
|
-
listInstallationRepos(installationId: number,
|
|
175
|
-
fresh?: boolean;
|
|
176
|
-
}): Promise<RepoSummary[]>;
|
|
190
|
+
listInstallationRepos(installationId: number, options?: RepoListOptions): Promise<RepoSummary[]>;
|
|
177
191
|
/**
|
|
178
192
|
* The authenticated user's permission level on a repo, through the
|
|
179
193
|
* installation. `undefined` when the repo/user is not accessible.
|
|
@@ -213,7 +227,7 @@ export declare class GithubIntegration implements FactoryIntegration {
|
|
|
213
227
|
/**
|
|
214
228
|
* The integration's HTTP surface: the `/web/github/*` + `/auth/github/*`
|
|
215
229
|
* Mastra `apiRoutes` (webhook handler, install/OAuth flow, project +
|
|
216
|
-
*
|
|
230
|
+
* commit/push/PR operations). The factory folds these into the server's
|
|
217
231
|
* `apiRoutes` when the feature is ready. Handlers operate on this instance.
|
|
218
232
|
*/
|
|
219
233
|
routes(ctx: IntegrationContext): ApiRoute[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EA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c,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CA2B3C;IAED;;;OAGG;IACG,mBAAmB,CAAC,KAAK,EAAE;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAgC3D;IAED;;;OAGG;IACG,0BAA0B,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAoChH;IAED,YAAY,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,EAAE,cAAc,CAAA;KAAE,GAAG,gBAAgB,CAErF;IAEK,gBAAgB,CAAC,EACrB,WAAW,EACX,cAAc,GACf,EAAE,UAAU,CAAC,WAAW,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpF;IAED,sEAAsE;IACtE,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKrC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveGithubRules } from "./default-rules.js";
|
|
2
|
+
import { githubIntakeLookup } from "./intake-lookup.js";
|
|
2
3
|
import { attachGithubIssueReconciler } from "./issue-reconciler.js";
|
|
3
4
|
import { GithubReconcileWorker } from "./reconcile-worker.js";
|
|
4
5
|
import { reconcileInterval, reconciliationEnabled } from "./reconciliation-config.js";
|
|
@@ -27,6 +28,11 @@ function normalizePrivateKey(raw) {
|
|
|
27
28
|
const body = flattened[2].replace(/\s+/g, "");
|
|
28
29
|
return `${flattened[1]}\n${body.match(/.{1,64}/g).join("\n")}\n${flattened[3]}\n`;
|
|
29
30
|
}
|
|
31
|
+
/** Repositories whose full name contains `query`, most recently pushed first, at most `limit`. */
|
|
32
|
+
function narrowRepos(repos, query = "", limit) {
|
|
33
|
+
const needle = query.trim().toLowerCase();
|
|
34
|
+
return repos.filter((repo) => repo.fullName.toLowerCase().includes(needle)).sort((a, b) => (b.pushedAt ?? "").localeCompare(a.pushedAt ?? "")).slice(0, limit);
|
|
35
|
+
}
|
|
30
36
|
/**
|
|
31
37
|
* How long a collaborator permission lookup may be reused. The reconcile
|
|
32
38
|
* sweep re-stamps every open card's author and webhook gating checks every
|
|
@@ -62,6 +68,12 @@ var GithubIntegration = class {
|
|
|
62
68
|
get rules() {
|
|
63
69
|
return this.#rules;
|
|
64
70
|
}
|
|
71
|
+
intakeLookup = githubIntakeLookup({
|
|
72
|
+
sourceControl: () => this.sourceControlStorage,
|
|
73
|
+
fetchIssueState: (input) => this.fetchIssueState(input),
|
|
74
|
+
fetchPullRequestState: (input) => this.fetchPullRequestState(input),
|
|
75
|
+
getRepositoryCollaboratorPermission: (installationId, repository, login) => this.getRepositoryCollaboratorPermission(installationId, repository, login)
|
|
76
|
+
});
|
|
65
77
|
intake = {
|
|
66
78
|
resolveIntakeDispatch: (input) => this.#resolveIntakeDispatch(input),
|
|
67
79
|
listSources: async ({ orgId }) => {
|
|
@@ -418,20 +430,23 @@ var GithubIntegration = class {
|
|
|
418
430
|
}));
|
|
419
431
|
}
|
|
420
432
|
/**
|
|
421
|
-
* List repos accessible to an installation (paginated)
|
|
422
|
-
* GitHub directly, so `fresh` has nothing to
|
|
433
|
+
* List repos accessible to an installation (paginated), narrowed by
|
|
434
|
+
* `query`/`limit`. Always reads GitHub directly, so `fresh` has nothing to
|
|
435
|
+
* bypass here.
|
|
423
436
|
*/
|
|
424
|
-
async listInstallationRepos(installationId,
|
|
437
|
+
async listInstallationRepos(installationId, options) {
|
|
425
438
|
const octokit = this.getInstallationOctokit(installationId);
|
|
426
|
-
|
|
439
|
+
const summaries = (await octokit.paginate(octokit.apps.listReposAccessibleToInstallation, { per_page: 100 })).map((repo) => ({
|
|
427
440
|
id: repo.id,
|
|
428
441
|
fullName: repo.full_name,
|
|
429
442
|
name: repo.name,
|
|
430
443
|
owner: repo.owner.login,
|
|
431
444
|
defaultBranch: repo.default_branch,
|
|
432
445
|
private: repo.private,
|
|
433
|
-
installationId
|
|
446
|
+
installationId,
|
|
447
|
+
pushedAt: repo.pushed_at ?? null
|
|
434
448
|
}));
|
|
449
|
+
return options?.query || options?.limit ? narrowRepos(summaries, options.query, options.limit) : summaries;
|
|
435
450
|
}
|
|
436
451
|
/**
|
|
437
452
|
* The authenticated user's permission level on a repo, through the
|
|
@@ -1068,7 +1083,7 @@ var GithubIntegration = class {
|
|
|
1068
1083
|
/**
|
|
1069
1084
|
* The integration's HTTP surface: the `/web/github/*` + `/auth/github/*`
|
|
1070
1085
|
* Mastra `apiRoutes` (webhook handler, install/OAuth flow, project +
|
|
1071
|
-
*
|
|
1086
|
+
* commit/push/PR operations). The factory folds these into the server's
|
|
1072
1087
|
* `apiRoutes` when the feature is ready. Handlers operate on this instance.
|
|
1073
1088
|
*/
|
|
1074
1089
|
routes(ctx) {
|
|
@@ -1079,17 +1094,13 @@ var GithubIntegration = class {
|
|
|
1079
1094
|
github: this,
|
|
1080
1095
|
auth: ctx.auth,
|
|
1081
1096
|
sandbox: ctx.sandbox,
|
|
1082
|
-
...ctx.users ? { users: ctx.users } : {},
|
|
1083
1097
|
storage: ctx.factoryStorage,
|
|
1084
1098
|
stateSigner: ctx.stateSigner,
|
|
1085
1099
|
baseUrl: ctx.baseUrl,
|
|
1086
1100
|
controller: ctx.controller,
|
|
1087
|
-
memorySettings: ctx.storage.memorySettings,
|
|
1088
1101
|
emitAudit: ctx.hooks?.emitAudit,
|
|
1089
1102
|
projects: ctx.storage.projects,
|
|
1090
|
-
ingestFactoryEvent
|
|
1091
|
-
sessionRetirement: ctx.sessionRetirement,
|
|
1092
|
-
...ctx.workItems ? { workItems: ctx.workItems } : {}
|
|
1103
|
+
ingestFactoryEvent
|
|
1093
1104
|
});
|
|
1094
1105
|
}
|
|
1095
1106
|
/**
|
|
@@ -1415,6 +1426,6 @@ function parseGithubExternalTarget(externalId) {
|
|
|
1415
1426
|
issueId: String(issueId)
|
|
1416
1427
|
} : null;
|
|
1417
1428
|
}
|
|
1418
|
-
export { GithubIntegration, LIST_PAGE_SIZE, normalizePrivateKey };
|
|
1429
|
+
export { GithubIntegration, LIST_PAGE_SIZE, narrowRepos, normalizePrivateKey };
|
|
1419
1430
|
|
|
1420
1431
|
//# sourceMappingURL=integration.js.map
|