infra-kit 0.1.51 → 0.1.52

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.
@@ -14,41 +14,44 @@ import type {
14
14
  * @param config - Jira configuration (baseUrl, token, projectId)
15
15
  * @returns Result containing created version or error
16
16
  */
17
- export async function createJiraVersion(
17
+ export const createJiraVersion = async (
18
18
  params: CreateJiraVersionParams,
19
19
  config: JiraConfig,
20
- ): Promise<CreateJiraVersionResult> {
20
+ ): Promise<CreateJiraVersionResult> => {
21
21
  try {
22
- const { baseUrl, token, projectId } = config
22
+ const { baseUrl, token, email, projectId } = config
23
23
 
24
24
  // Use current date if not provided
25
- const releaseDate =
26
- params.releaseDate || new Date().toISOString().split('T')[0]
25
+ // const releaseDate =
26
+ // params.releaseDate || new Date().toISOString().split('T')[0] // 2025-12-06
27
27
 
28
28
  // Prepare request body
29
29
  const requestBody = {
30
30
  name: params.name,
31
31
  projectId: params.projectId || projectId,
32
- description: params.description || `Release version ${params.name}`,
33
- releaseDate,
32
+ description: params.description || '',
33
+ // releaseDate,
34
34
  released: params.released ?? true,
35
35
  archived: params.archived ?? false,
36
36
  }
37
37
 
38
- logger.info(
39
- { version: params.name, projectId: requestBody.projectId },
40
- 'Creating Jira version',
41
- )
38
+ // logger.info(
39
+ // { version: params.name, projectId: requestBody.projectId },
40
+ // 'Creating Jira version',
41
+ // )
42
42
 
43
43
  // Make API request
44
44
  const url = `${baseUrl}/rest/api/3/version`
45
45
 
46
+ // Create Basic auth credentials
47
+ const credentials = btoa(`${email}:${token}`)
48
+
46
49
  const response = await fetch(url, {
47
50
  method: 'POST',
48
51
  headers: {
49
52
  Accept: 'application/json',
50
53
  'Content-Type': 'application/json',
51
- Authorization: `Bearer ${token}`,
54
+ Authorization: `Basic ${credentials}`,
52
55
  },
53
56
  body: JSON.stringify(requestBody),
54
57
  })
@@ -72,10 +75,10 @@ export async function createJiraVersion(
72
75
 
73
76
  const version = (await response.json()) as JiraVersion
74
77
 
75
- logger.info(
76
- { versionId: version.id, versionName: version.name },
77
- 'Successfully created Jira version',
78
- )
78
+ // logger.info(
79
+ // { versionId: version.id, versionName: version.name },
80
+ // 'Successfully created Jira version',
81
+ // )
79
82
 
80
83
  return {
81
84
  success: true,
@@ -95,18 +98,19 @@ export async function createJiraVersion(
95
98
  * Loads Jira configuration from environment variables
96
99
  * @returns Jira config if all required env vars are present, null otherwise
97
100
  */
98
- export function loadJiraConfig(): JiraConfig | null {
101
+ export const loadJiraConfig = (): JiraConfig | null => {
99
102
  const baseUrl = process.env.JIRA_BASE_URL
100
103
  const token = process.env.JIRA_TOKEN || process.env.JIRA_API_TOKEN
101
104
  const projectIdStr = process.env.JIRA_PROJECT_ID
102
105
  const email = process.env.JIRA_EMAIL
103
106
 
104
- if (!baseUrl || !token || !projectIdStr) {
107
+ if (!baseUrl || !token || !projectIdStr || !email) {
105
108
  logger.debug(
106
109
  {
107
110
  hasBaseUrl: !!baseUrl,
108
111
  hasToken: !!token,
109
112
  hasProjectId: !!projectIdStr,
113
+ hasEmail: !!email,
110
114
  },
111
115
  'Jira configuration incomplete, skipping Jira integration',
112
116
  )
@@ -48,7 +48,7 @@ export interface JiraConfig {
48
48
  /** Jira project ID */
49
49
  projectId: number
50
50
  /** Email associated with Jira account (for Basic Auth) */
51
- email?: string
51
+ email: string
52
52
  }
53
53
 
54
54
  export interface CreateJiraVersionResult {