Skip to content

Commit ad40e10

Browse files
committed
Merge branch 'master' into feature/issue-triage
# Conflicts: # .github/ISSUE_TEMPLATE/bug_report.md
2 parents 1cc470d + 7ed2723 commit ad40e10

34 files changed

+524
-780
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[FAQ](https://developers.line.biz/en/faq/) page for more
55
information on LINE bots and the Messaging API
66
- Make sure your issue is **related to** the Node.js SDK.
7-
- For general queries about LINE bots, post a question to [LINE developers community](https://www.line-community.me/questions) website.
87
- Note that we don't provide technical support
98

109
## When creating an issue

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ about: Use this template to report bugs in the line-bot-sdk-nodejs
44
title: 'Bug Report'
55
---
66

7-
<!--
8-
## Before Creating an Issue
9-
- Please check our [developer documentation](https://developers.line.biz/en/docs/) and [FAQ](https://developers.line.biz/en/faq/tags/messaging-api/) for more information on the Messaging API
10-
- Make sure the issue you are reporting isn't already addressed in the documentation or existing issues.
11-
## When Creating an Issue
12-
- Provide detailed information about the issue you experienced with the SDK using the template below.
13-
-->
7+
## Bug Report
8+
<!-- First of all: Have you checked the docs https://developers.line.biz/en/docs/messaging-api/overview/, Q&A page https://developers.line.biz/en/faq/, https://www.line-community.me/questions, GitHub issues whether someone else has already reported your issue? -->
149

1510
## System Information
1611
- OS: [e.g. Ubuntu]

.github/workflows/deploy-doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
issues: write
1818
steps:
1919
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
20+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2121
with:
2222
node-version: 18
2323

.github/workflows/generate-code.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Generate OpenAPI based code
22

33
on:
4-
workflow_dispatch:
5-
pull_request:
64
push:
75
branches:
8-
- master
6+
- 'master'
7+
pull_request:
8+
merge_group:
9+
workflow_dispatch:
910

1011
jobs:
1112
tests:
@@ -21,12 +22,12 @@ jobs:
2122
submodules: recursive
2223
- name: Update submodules
2324
run: git submodule update --remote --recursive
24-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
25+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2526
id: setup_node_id
2627
with:
2728
node-version: 18
2829
- name: Set up Java
29-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
30+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3031
with:
3132
distribution: 'temurin'
3233
java-version: 17
@@ -47,15 +48,24 @@ jobs:
4748
4849
echo "DIFF_IS_EMPTY=$([[ -z "$diff_excluding_submodule" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
4950
echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
50-
## Run if diff exists and pull request, and make CI status failure (but allow renovate bot)
51-
- if: ${{ github.event_name == 'pull_request' && env.DIFF_IS_EMPTY != 'true' && github.actor != 'renovate[bot]' }}
51+
## Run if diff exists and pull request or merge queue, and make CI status failure (but allow renovate bot)
52+
- if: >-
53+
${{
54+
(github.event_name == 'pull_request' || github.event_name == 'merge_group')
55+
&& env.DIFF_IS_EMPTY != 'true'
56+
&& github.actor != 'renovate[bot]'
57+
}}
5258
run: |
5359
echo "There are changes in the generated codes. Please run 'generate-code.py' and commit the changes." >&2
5460
echo "The files with differences are as follows." >&2
5561
echo "$(git --no-pager diff --name-only HEAD)" >&2
5662
exit 1
57-
## Run if diff exists and event is not pull request, and make PR
58-
- if: ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
63+
## Run if diff exists and event is push or workflow_dispatch, make PR
64+
- if: >-
65+
${{
66+
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
67+
&& env.DIFF_IS_EMPTY != 'true'
68+
}}
5969
run: |
6070
# Determine Change Type via Submodule Script. This scripts read current uncommited changes.
6171
CHANGE_TYPE=$(npx zx ./line-openapi/tools/determine-change-type.mjs)

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2020
# Setup .npmrc file to publish to GitHub Packages
21-
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
21+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2222
with:
2323
node-version: 18
2424
registry-url: 'https://registry.npmjs.org'

.github/workflows/test.yml

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
pull_request:
66
merge_group:
7+
workflow_dispatch:
78

89
jobs:
910
build:
@@ -13,57 +14,61 @@ jobs:
1314
strategy:
1415
matrix:
1516
# https://nodejs.org/en/about/releases/
16-
node: [ '18', '20', '20.12.2', '22' ]
17+
node:
18+
- '18'
19+
- '20'
20+
- '20.12.2'
21+
- '22'
1722
fail-fast: false
1823

1924
name: Node.js ${{ matrix.node }}
2025

2126
steps:
22-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23-
with:
24-
submodules: true
25-
- name: actions/setup-java@v3
26-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
27-
with:
28-
distribution: 'temurin'
29-
java-version: 17
30-
architecture: x64
31-
- name: Setup Node.js
32-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
33-
with:
34-
node-version: ${{ matrix.node }}
35-
cache: 'npm'
36-
- name: Install Dependency
37-
run: npm ci
38-
- name: Test generator
39-
run: cd generator; mvn package; cd ..
40-
- name: Generate code
41-
run: |
42-
python3 generate-code.py
43-
- name: Test Project
44-
run: export NODE_OPTIONS=--max-old-space-size=6144; npm test
45-
- name: Test building apidocs
46-
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run apidocs
47-
- name: Test building docs
48-
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
49-
- name: Test building examples (CJS)
50-
run: |
51-
cd examples/echo-bot-ts-cjs
52-
npm run build-sdk
53-
npm install
54-
npm run build
55-
cd -
56-
- name: Test building examples (ESM)
57-
run: |
58-
cd examples/echo-bot-ts-esm
59-
npm run build-sdk
60-
npm install
61-
npm run build
62-
cd -
63-
- name: publint
64-
run: npx publint
65-
- name: validate package
66-
run: npx @arethetypeswrong/cli $(npm pack)
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
submodules: true
30+
- name: Set up Java
31+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
32+
with:
33+
distribution: 'temurin'
34+
java-version: 17
35+
architecture: x64
36+
- name: Setup Node.js
37+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
38+
with:
39+
node-version: ${{ matrix.node }}
40+
cache: 'npm'
41+
- name: Install Dependency
42+
run: npm ci
43+
- name: Test generator
44+
run: cd generator; mvn package; cd ..
45+
- name: Generate code
46+
run: |
47+
python3 generate-code.py
48+
- name: Test Project
49+
run: export NODE_OPTIONS=--max-old-space-size=6144; npm test
50+
- name: Test building apidocs
51+
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run apidocs
52+
- name: Test building docs
53+
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
54+
- name: Test building examples (CJS)
55+
run: |
56+
cd examples/echo-bot-ts-cjs
57+
npm run build-sdk
58+
npm install
59+
npm run build
60+
cd -
61+
- name: Test building examples (ESM)
62+
run: |
63+
cd examples/echo-bot-ts-esm
64+
npm run build-sdk
65+
npm install
66+
npm run build
67+
cd -
68+
- name: publint
69+
run: npx publint
70+
- name: validate package
71+
run: npx @arethetypeswrong/cli $(npm pack)
6772

6873
pinact:
6974
runs-on: ubuntu-latest

docs/guide/client.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,11 @@ stream.on('error', (err) => {
128128

129129
You can check which method returns `Promise` or `ReadableStream` in the API
130130
reference of [`Client`](../apidocs/globals.md). For type signatures of the
131-
errors above, please refer to [Exceptions](../apidocs/globals.md).
131+
errors above, please refer to below.
132+
133+
- [HTTPError](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/HTTPError.html)
134+
- [HTTPFetchError](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/HTTPFetchError.html)
135+
- [JSONParseError](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/JSONParseError.html)
136+
- [ReadError](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/ReadError.html)
137+
- [RequestError](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/RequestError.html)
138+
- [SignatureValidationFailed](https://line.github.io/line-bot-sdk-nodejs/apidocs/classes/SignatureValidationFailed.html)

examples/rich-menu/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const richMenuObjectA = () => ({
3030
},
3131
action: {
3232
type: "uri",
33-
uri: "https://www.line-community.me/"
33+
uri: "https://developers.line.biz/"
3434
}
3535
},
3636
{
@@ -80,7 +80,7 @@ const richMenuObjectB = () => ({
8080
},
8181
action: {
8282
type: "uri",
83-
uri: "https://www.line-community.me/"
83+
uri: "https://developers.line.biz/"
8484
}
8585
}
8686
]

generator/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,24 @@
135135
<dependency>
136136
<groupId>io.pebbletemplates</groupId>
137137
<artifactId>pebble</artifactId>
138-
<version>3.2.3</version>
138+
<version>3.2.4</version>
139139
</dependency>
140140
<dependency>
141141
<groupId>org.junit.jupiter</groupId>
142142
<artifactId>junit-jupiter-api</artifactId>
143-
<version>5.12.1</version>
143+
<version>5.12.2</version>
144144
<scope>test</scope>
145145
</dependency>
146146
<dependency>
147147
<groupId>org.junit.jupiter</groupId>
148148
<artifactId>junit-jupiter-engine</artifactId>
149-
<version>5.12.1</version>
149+
<version>5.12.2</version>
150150
<scope>test</scope>
151151
</dependency>
152152
</dependencies>
153153
<properties>
154154
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
155-
<openapi-generator-version>7.12.0</openapi-generator-version>
155+
<openapi-generator-version>7.13.0</openapi-generator-version>
156156
<maven-plugin-version>1.0.0</maven-plugin-version>
157157
</properties>
158158
</project>

generator/src/main/resources/line-bot-sdk-nodejs-generator/api-single.pebble

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as Types from "../../types.js";
1111
import {ensureJSON} from "../../utils.js";
1212
import {Readable} from "node:stream";
1313

14-
import HTTPFetchClient, { convertResponseToReadable } from "../../http-fetch.js";
14+
import HTTPFetchClient, { convertResponseToReadable, mergeHeaders } from "../../http-fetch.js";
1515

1616
// ===============================================
1717
// This file is autogenerated - Please do not edit
@@ -22,7 +22,7 @@ interface httpClientConfig {
2222
{% if authMethods != null -%}
2323
channelAccessToken: string;
2424
{% endif -%}
25-
// TODO support defaultHeaders?
25+
defaultHeaders?: Record<string, string>;
2626
}
2727

2828

@@ -31,28 +31,20 @@ export class {{operations.classname}} {
3131

3232
constructor(config: httpClientConfig) {
3333
const baseURL = config.baseURL || '{{endpoint(operations.classname)}}';
34+
const defaultHeaders = mergeHeaders(
35+
config.defaultHeaders,
36+
{% if authMethods != null -%}
37+
{ Authorization: "Bearer " + config.channelAccessToken }
38+
{% else -%}
39+
{}
40+
{% endif -%}
41+
);
3442
this.httpClient = new HTTPFetchClient({
35-
defaultHeaders: {
36-
{% if authMethods != null -%}
37-
Authorization: "Bearer " + config.channelAccessToken,
38-
{% endif -%}
39-
},
43+
defaultHeaders: defaultHeaders,
4044
baseURL: baseURL,
4145
});
4246
}
4347

44-
private async parseHTTPResponse(response: Response) {
45-
const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
46-
let resBody: Record<string, any> = {
47-
...await response.json(),
48-
};
49-
if (response.headers.get(LINE_REQUEST_ID_HTTP_HEADER_NAME)) {
50-
resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] =
51-
response.headers.get(LINE_REQUEST_ID_HTTP_HEADER_NAME);
52-
}
53-
return resBody;
54-
}
55-
5648
{% for op in operations.operation -%}
5749
/**
5850
* {{op.notes}}

0 commit comments

Comments
 (0)