@knpkv/jira-api-client 1.0.1 → 1.1.1
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/CHANGELOG.md +16 -0
- package/dist/JiraApiClient.d.ts +4 -4
- package/dist/JiraApiClient.d.ts.map +1 -1
- package/dist/JiraApiClient.js.map +1 -1
- package/dist/JiraApiConfig.d.ts +2 -2
- package/dist/JiraApiConfig.d.ts.map +1 -1
- package/dist/JiraApiConfig.js.map +1 -1
- package/dist/generated/JiraApi.d.ts.map +1 -1
- package/dist/generated/JiraApi.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/JiraApiClient.ts +7 -7
- package/src/JiraApiConfig.ts +2 -2
- package/src/index.ts +2 -2
- package/test/JiraApiClient.test.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
export { JiraApiClient, type
|
|
7
|
-
export { JiraApiConfig, type
|
|
6
|
+
export { JiraApiClient, type JiraApiClientContract, layer, make, type UploadAttachmentInput } from "./JiraApiClient.js";
|
|
7
|
+
export { JiraApiConfig, type JiraApiConfigContract } from "./JiraApiConfig.js";
|
|
8
8
|
export * as JiraApi from "./generated/JiraApi.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAEvH,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAA8B,KAAK,EAAE,IAAI,EAA8B,MAAM,oBAAoB,CAAA;AAEvH,OAAO,EAAE,aAAa,EAA8B,MAAM,oBAAoB,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knpkv/jira-api-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Effect-based Jira Cloud REST API v3 client",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "knpkv",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"effect": "4.0.0-
|
|
42
|
+
"effect": "4.0.0-rc.109"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@effect/openapi-generator": "4.0.0-
|
|
46
|
-
"@effect/platform-node": "4.0.0-
|
|
47
|
-
"@effect/vitest": "4.0.0-
|
|
45
|
+
"@effect/openapi-generator": "4.0.0-rc.109",
|
|
46
|
+
"@effect/platform-node": "4.0.0-rc.109",
|
|
47
|
+
"@effect/vitest": "4.0.0-rc.109",
|
|
48
48
|
"@types/node": "latest",
|
|
49
|
-
"effect": "4.0.0-
|
|
50
|
-
"prettier": "^3.9.
|
|
51
|
-
"tsx": "^4.23.
|
|
52
|
-
"typescript": "
|
|
49
|
+
"effect": "4.0.0-rc.109",
|
|
50
|
+
"prettier": "^3.9.6",
|
|
51
|
+
"tsx": "^4.23.12",
|
|
52
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
53
53
|
"vitest": "^4.1.10"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
package/src/JiraApiClient.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type * as HttpClientError from "effect/unstable/http/HttpClientError"
|
|
|
19
19
|
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
|
|
20
20
|
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
|
|
21
21
|
import * as Generated from "./generated/JiraApi.js"
|
|
22
|
-
import { JiraApiConfig, type
|
|
22
|
+
import { JiraApiConfig, type JiraApiConfigContract } from "./JiraApiConfig.js"
|
|
23
23
|
|
|
24
24
|
export interface UploadAttachmentInput {
|
|
25
25
|
readonly bytes: Uint8Array
|
|
@@ -27,26 +27,26 @@ export interface UploadAttachmentInput {
|
|
|
27
27
|
readonly mediaType?: string | undefined
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export interface
|
|
30
|
+
export interface JiraApiClientContract extends Generated.JiraApi {
|
|
31
31
|
readonly uploadAttachment: (
|
|
32
32
|
issueIdOrKey: string,
|
|
33
33
|
input: UploadAttachmentInput
|
|
34
34
|
) => Effect.Effect<Generated.AddAttachment200, HttpClientError.HttpClientError | SchemaError>
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const authorizationHeader = (config:
|
|
37
|
+
const authorizationHeader = (config: JiraApiConfigContract): string =>
|
|
38
38
|
config.auth.type === "basic"
|
|
39
39
|
? `Basic ${Encoding.encodeBase64(`${config.auth.email}:${Redacted.value(config.auth.apiToken)}`)}`
|
|
40
40
|
: `Bearer ${Redacted.value(config.auth.accessToken)}`
|
|
41
41
|
|
|
42
|
-
const apiBaseUrl = (config:
|
|
42
|
+
const apiBaseUrl = (config: JiraApiConfigContract): string =>
|
|
43
43
|
config.auth.type === "oauth2"
|
|
44
44
|
? `https://api.atlassian.com/ex/jira/${config.auth.cloudId}`
|
|
45
45
|
: config.baseUrl
|
|
46
46
|
|
|
47
47
|
export const make = (
|
|
48
48
|
httpClient: HttpClient.HttpClient,
|
|
49
|
-
config:
|
|
49
|
+
config: JiraApiConfigContract
|
|
50
50
|
): Generated.JiraApi =>
|
|
51
51
|
Generated.make(httpClient.pipe(
|
|
52
52
|
HttpClient.mapRequest(flow(
|
|
@@ -57,7 +57,7 @@ export const make = (
|
|
|
57
57
|
))
|
|
58
58
|
|
|
59
59
|
const makeUploadAttachment =
|
|
60
|
-
(api: Generated.JiraApi):
|
|
60
|
+
(api: Generated.JiraApi): JiraApiClientContract["uploadAttachment"] => (issueIdOrKey, input) => {
|
|
61
61
|
const buffer = new ArrayBuffer(input.bytes.byteLength)
|
|
62
62
|
new Uint8Array(buffer).set(input.bytes)
|
|
63
63
|
const form = new FormData()
|
|
@@ -77,7 +77,7 @@ const makeUploadAttachment =
|
|
|
77
77
|
)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export class JiraApiClient extends Context.Service<JiraApiClient,
|
|
80
|
+
export class JiraApiClient extends Context.Service<JiraApiClient, JiraApiClientContract>()(
|
|
81
81
|
"@knpkv/jira-api-client/JiraApiClient"
|
|
82
82
|
) {
|
|
83
83
|
static readonly layer: Layer.Layer<
|
package/src/JiraApiConfig.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type * as Redacted from "effect/Redacted"
|
|
|
18
18
|
*
|
|
19
19
|
* @category Config
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface JiraApiConfigContract {
|
|
22
22
|
readonly baseUrl: string
|
|
23
23
|
readonly auth:
|
|
24
24
|
| { readonly type: "basic"; readonly email: string; readonly apiToken: Redacted.Redacted<string> }
|
|
@@ -46,6 +46,6 @@ export interface JiraApiConfigShape {
|
|
|
46
46
|
*
|
|
47
47
|
* @category Config
|
|
48
48
|
*/
|
|
49
|
-
export class JiraApiConfig extends Context.Service<JiraApiConfig,
|
|
49
|
+
export class JiraApiConfig extends Context.Service<JiraApiConfig, JiraApiConfigContract>()(
|
|
50
50
|
"@knpkv/jira-api-client/JiraApiConfig"
|
|
51
51
|
) {}
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export { JiraApiClient, type
|
|
7
|
+
export { JiraApiClient, type JiraApiClientContract, layer, make, type UploadAttachmentInput } from "./JiraApiClient.js"
|
|
8
8
|
|
|
9
|
-
export { JiraApiConfig, type
|
|
9
|
+
export { JiraApiConfig, type JiraApiConfigContract } from "./JiraApiConfig.js"
|
|
10
10
|
|
|
11
11
|
export * as JiraApi from "./generated/JiraApi.js"
|
|
@@ -5,10 +5,10 @@ import * as Redacted from "effect/Redacted"
|
|
|
5
5
|
import * as HttpClient from "effect/unstable/http/HttpClient"
|
|
6
6
|
import type * as HttpClientRequest from "effect/unstable/http/HttpClientRequest"
|
|
7
7
|
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse"
|
|
8
|
-
import { JiraApiClient, JiraApiConfig, type
|
|
8
|
+
import { JiraApiClient, JiraApiConfig, type JiraApiConfigContract } from "../src/index.js"
|
|
9
9
|
|
|
10
10
|
const clientLayer = (
|
|
11
|
-
config:
|
|
11
|
+
config: JiraApiConfigContract,
|
|
12
12
|
response: { readonly status: number; readonly body?: unknown },
|
|
13
13
|
requests: Array<HttpClientRequest.HttpClientRequest>
|
|
14
14
|
) =>
|
|
@@ -31,7 +31,7 @@ const clientLayer = (
|
|
|
31
31
|
))
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
const basicConfig:
|
|
34
|
+
const basicConfig: JiraApiConfigContract = {
|
|
35
35
|
baseUrl: "https://jira.test",
|
|
36
36
|
auth: {
|
|
37
37
|
type: "basic",
|