@shipfox/api-integration-linear-dto 12.2.0 → 15.0.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +19 -0
- package/dist/event-catalog.d.ts +23 -0
- package/dist/event-catalog.d.ts.map +1 -0
- package/dist/event-catalog.js +48 -0
- package/dist/event-catalog.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/event-catalog.test.ts +20 -0
- package/src/event-catalog.ts +65 -0
- package/src/index.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-integration-linear-dto",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "^4.4.3",
|
|
22
|
-
"@shipfox/api-integration-core-dto": "
|
|
22
|
+
"@shipfox/api-integration-core-dto": "15.0.0"
|
|
23
23
|
},
|
|
24
24
|
"imports": {
|
|
25
25
|
"#*": "./dist/*"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {linearEventCatalog, linearWebhookEventNames} from './index.js';
|
|
2
|
+
|
|
3
|
+
describe('linearEventCatalog', () => {
|
|
4
|
+
it('lists exactly the event names the webhook handler accepts', () => {
|
|
5
|
+
expect(linearEventCatalog.events.map((event) => event.name)).toEqual([
|
|
6
|
+
...linearWebhookEventNames,
|
|
7
|
+
]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('covers every supported resource type and action pair', () => {
|
|
11
|
+
const names = linearEventCatalog.events.map((event) => event.name);
|
|
12
|
+
for (const name of [
|
|
13
|
+
'Issue.create',
|
|
14
|
+
'IssueLabel.update',
|
|
15
|
+
'Cycle.remove',
|
|
16
|
+
'agentSession.created',
|
|
17
|
+
])
|
|
18
|
+
expect(names).toContain(name);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type {IntegrationEventCatalog} from '@shipfox/api-integration-core-dto';
|
|
2
|
+
import {
|
|
3
|
+
linearAgentSessionWebhookEventNames,
|
|
4
|
+
linearWebhookActions,
|
|
5
|
+
linearWebhookResourceTypes,
|
|
6
|
+
} from './schemas/index.js';
|
|
7
|
+
|
|
8
|
+
const linearWebhookDocsUrl = 'https://linear.app/developers/webhooks';
|
|
9
|
+
const linearAgentInteractionDocsUrl = 'https://linear.app/developers/agent-interaction';
|
|
10
|
+
|
|
11
|
+
const resourceLabels = {
|
|
12
|
+
Issue: 'issue',
|
|
13
|
+
Comment: 'comment',
|
|
14
|
+
IssueLabel: 'issue label',
|
|
15
|
+
Project: 'project',
|
|
16
|
+
Cycle: 'cycle',
|
|
17
|
+
} as const satisfies Record<(typeof linearWebhookResourceTypes)[number], string>;
|
|
18
|
+
|
|
19
|
+
const dataEventSummaryByAction = {
|
|
20
|
+
create: 'is created.',
|
|
21
|
+
update: 'changes.',
|
|
22
|
+
remove: 'is removed.',
|
|
23
|
+
} as const satisfies Record<(typeof linearWebhookActions)[number], string>;
|
|
24
|
+
|
|
25
|
+
const agentSessionDetails = {
|
|
26
|
+
'agentSession.created': {
|
|
27
|
+
summary: 'A Linear agent session is created.',
|
|
28
|
+
emittedWhen: 'Linear creates an agent session after a user mentions or delegates to the app.',
|
|
29
|
+
},
|
|
30
|
+
'agentSession.prompted': {
|
|
31
|
+
summary: 'A user adds a prompt to a Linear agent session.',
|
|
32
|
+
emittedWhen: 'Linear sends an AgentSessionEvent webhook with the prompted action.',
|
|
33
|
+
},
|
|
34
|
+
} as const satisfies Record<
|
|
35
|
+
(typeof linearAgentSessionWebhookEventNames)[number],
|
|
36
|
+
{
|
|
37
|
+
summary: string;
|
|
38
|
+
emittedWhen: string;
|
|
39
|
+
}
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
export const linearEventCatalog = {
|
|
43
|
+
provider: 'Linear',
|
|
44
|
+
events: [
|
|
45
|
+
...linearWebhookResourceTypes.flatMap((type) =>
|
|
46
|
+
linearWebhookActions.map((action) => ({
|
|
47
|
+
name: `${type}.${action}`,
|
|
48
|
+
summary: dataEventSummary(resourceLabels[type], action),
|
|
49
|
+
emittedWhen: `Linear sends a webhook for ${type} with the ${action} action.`,
|
|
50
|
+
payloadKind: 'raw-provider' as const,
|
|
51
|
+
payloadDocUrl: linearWebhookDocsUrl,
|
|
52
|
+
})),
|
|
53
|
+
),
|
|
54
|
+
...linearAgentSessionWebhookEventNames.map((name) => ({
|
|
55
|
+
name,
|
|
56
|
+
...agentSessionDetails[name],
|
|
57
|
+
payloadKind: 'raw-provider' as const,
|
|
58
|
+
payloadDocUrl: linearAgentInteractionDocsUrl,
|
|
59
|
+
})),
|
|
60
|
+
],
|
|
61
|
+
} as const satisfies IntegrationEventCatalog;
|
|
62
|
+
|
|
63
|
+
function dataEventSummary(resource: string, action: (typeof linearWebhookActions)[number]): string {
|
|
64
|
+
return `A Linear ${resource} ${dataEventSummaryByAction[action]}`;
|
|
65
|
+
}
|
package/src/index.ts
CHANGED