Skip to content

Commit 2f86160

Browse files
authored
Merge branch 'FusionAuth:main' into add-timeout
2 parents abb930f + e93e2ef commit 2f86160

9 files changed

+4238
-3873
lines changed

Diff for: .github/workflows/deploy.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Run locally with act:
2+
#
3+
# act pull_request [--input command=[command]] \
4+
# --platform fusionauth-builder=[ecr-repo-name]/fusionauth-builder:latest] \
5+
# --workflows ./.github/workflows/release.yaml \
6+
# --env-file <(aws configure export-credentials --profile [aws-profile] --format env)
7+
8+
name: Deploy
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
branches:
16+
- main
17+
workflow_dispatch:
18+
inputs:
19+
command:
20+
type: choice
21+
options:
22+
- build # build only
23+
- publish # build & publish to npmjs
24+
- release # build & release to svn
25+
default: build
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
build:
32+
if: |
33+
github.event_name == 'pull_request' ||
34+
github.event_name == 'push' ||
35+
github.event_name == 'workflow_dispatch' && inputs.command == 'build'
36+
runs-on: fusionauth-builder
37+
steps:
38+
- name: checkout
39+
uses: actions/checkout@v4
40+
41+
- name: compile
42+
shell: bash -l {0}
43+
run: sb compile
44+
45+
deploy:
46+
if: |
47+
github.event_name == 'workflow_dispatch' &&
48+
(inputs.command == 'release' || inputs.command == 'publish')
49+
runs-on: fusionauth-builder
50+
steps:
51+
- name: checkout
52+
uses: actions/checkout@v4
53+
54+
- name: set aws credentials
55+
uses: aws-actions/configure-aws-credentials@v4
56+
with:
57+
role-to-assume: arn:aws:iam::752443094709:role/github-actions
58+
role-session-name: aws-auth-action
59+
aws-region: us-west-2
60+
61+
- name: get secret
62+
run: |
63+
while IFS=$'\t' read -r key value; do
64+
echo "::add-mask::${value}"
65+
echo "${key}=${value}" >> $GITHUB_ENV
66+
done < <(aws secretsmanager get-secret-value \
67+
--region us-west-2 \
68+
--secret-id platform/npmjs \
69+
--query SecretString \
70+
--output text | \
71+
jq -r 'to_entries[] | [.key, .value] | @tsv')
72+
73+
- name: create npmrc
74+
run: |
75+
echo "color=false" > ~/.npmrc
76+
echo "//registry.npmjs.org/:_authToken=${{ env.API_KEY }}" >> ~/.npmrc
77+
chmod 600 ~/.npmrc
78+
79+
- name: release to svn
80+
if: inputs.command == 'release'
81+
shell: bash -l {0}
82+
run: sb release
83+
84+
- name: publish to npmjs
85+
if: inputs.command == 'publish'
86+
shell: bash -l {0}
87+
run: sb publish

Diff for: .github/workflows/release.yml

-75
This file was deleted.

Diff for: README.md

+8
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ Bug reports and pull requests are welcome on GitHub.
4040

4141
This code is available as open source under the terms of the [Apache v2.0 License](https://opensource.org/licenses/Apache-2.0).
4242

43+
44+
## Upgrade Policy
45+
46+
This library is built automatically to keep track of the FusionAuth API, and may also receive updates with bug fixes, security patches, tests, code samples, or documentation changes.
47+
48+
These releases may also update dependencies, language engines, and operating systems, as we\'ll follow the deprecation and sunsetting policies of the underlying technologies that it uses.
49+
50+
This means that after a dependency (e.g. language, framework, or operating system) is deprecated by its maintainer, this library will also be deprecated by us, and will eventually be updated to use a newer version.

Diff for: build.savant

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2023, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2024, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* language governing permissions and limitations under the License.
1515
*/
1616

17-
project(group: "io.fusionauth", name: "fusionauth-typescript-client", version: "1.49.0", licenses: ["ApacheV2_0"]) {
17+
project(group: "io.fusionauth", name: "fusionauth-typescript-client", version: "1.51.1", licenses: ["ApacheV2_0"]) {
1818
workflow {
1919
fetch {
2020
cache()
@@ -37,7 +37,7 @@ project(group: "io.fusionauth", name: "fusionauth-typescript-client", version: "
3737
}
3838

3939
// Plugins
40-
file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.6")
40+
file = loadPlugin(id: "org.savantbuild.plugin:file:2.0.0-RC.7")
4141
idea = loadPlugin(id: "org.savantbuild.plugin:idea:2.0.0-RC.7")
4242
release = loadPlugin(id: "org.savantbuild.plugin:release-git:2.0.0-RC.6")
4343

Diff for: package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fusionauth/typescript-client",
3-
"version": "1.49.0",
3+
"version": "1.51.1",
44
"description": "A typescript implementation of the FusionAuth client.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",

Diff for: src/DefaultRESTClient.ts

+52-44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2020, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2024, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
1414
* language governing permissions and limitations under the License.
1515
*/
1616

17-
import IRESTClient, {ErrorResponseHandler, ResponseHandler} from "./IRESTClient";
17+
import IRESTClient, { ErrorResponseHandler, ResponseHandler } from "./IRESTClient";
1818
import ClientResponse from "./ClientResponse";
19-
import fetch, {BodyInit, RequestCredentials, Response} from 'node-fetch';
20-
import {URLSearchParams} from "url";
19+
import fetch, { BodyInit, RequestCredentials, Response } from 'node-fetch';
20+
import { URLSearchParams } from "url";
2121

2222
/**
2323
* @author Brett P
@@ -37,6 +37,42 @@ export default class DefaultRESTClient<RT, ERT> implements IRESTClient<RT, ERT>
3737
constructor(public host: string) {
3838
}
3939

40+
/**
41+
* A function that returns the JSON form of the response text.
42+
*
43+
* @param response
44+
* @constructor
45+
*/
46+
static async JSONResponseHandler<RT>(response: Response): Promise<ClientResponse<RT>> {
47+
let clientResponse = new ClientResponse<RT>();
48+
49+
clientResponse.statusCode = response.status;
50+
let type = response.headers.get("content-type");
51+
if (type && type.startsWith("application/json")) {
52+
clientResponse.response = await response.json();
53+
}
54+
55+
return clientResponse;
56+
}
57+
58+
/**
59+
* A function that returns the JSON form of the response text.
60+
*
61+
* @param response
62+
* @constructor
63+
*/
64+
static async ErrorJSONResponseHandler<ERT>(response: Response): Promise<ClientResponse<ERT>> {
65+
let clientResponse = new ClientResponse<ERT>();
66+
67+
clientResponse.statusCode = response.status;
68+
let type = response.headers.get("content-type");
69+
if (type && type.startsWith("application/json")) {
70+
clientResponse.exception = await response.json();
71+
}
72+
73+
return clientResponse;
74+
}
75+
4076
/**
4177
* Sets the authorization header using a key
4278
*
@@ -86,7 +122,7 @@ export default class DefaultRESTClient<RT, ERT> implements IRESTClient<RT, ERT>
86122
if (body) {
87123
body.forEach((value, name, searchParams) => {
88124
if (value && value.length > 0 && value != "null" && value != "undefined") {
89-
body2.set(name,value);
125+
body2.set(name, value);
90126
}
91127
});
92128
body = body2;
@@ -208,47 +244,19 @@ export default class DefaultRESTClient<RT, ERT> implements IRESTClient<RT, ERT>
208244
}
209245

210246
private getQueryString() {
211-
var queryString = '';
212-
for (let key in this.parameters) {
247+
let queryString = '';
248+
const appendParam = (key: string, param: string) => {
213249
queryString += (queryString.length === 0) ? '?' : '&';
214-
queryString += key + '=' + encodeURIComponent(this.parameters[key]);
250+
queryString += encodeURIComponent(key) + '=' + encodeURIComponent(param);
215251
}
216-
return queryString;
217-
}
218-
219-
/**
220-
* A function that returns the JSON form of the response text.
221-
*
222-
* @param response
223-
* @constructor
224-
*/
225-
static async JSONResponseHandler<RT>(response: Response): Promise<ClientResponse<RT>> {
226-
let clientResponse = new ClientResponse<RT>();
227-
228-
clientResponse.statusCode = response.status;
229-
let type = response.headers.get("content-type");
230-
if (type && type.startsWith("application/json")) {
231-
clientResponse.response = await response.json();
232-
}
233-
234-
return clientResponse;
235-
}
236-
237-
/**
238-
* A function that returns the JSON form of the response text.
239-
*
240-
* @param response
241-
* @constructor
242-
*/
243-
static async ErrorJSONResponseHandler<ERT>(response: Response): Promise<ClientResponse<ERT>> {
244-
let clientResponse = new ClientResponse<ERT>();
245-
246-
clientResponse.statusCode = response.status;
247-
let type = response.headers.get("content-type");
248-
if (type && type.startsWith("application/json")) {
249-
clientResponse.exception = await response.json();
252+
for (let key in this.parameters) {
253+
const value = this.parameters[key];
254+
if (Array.isArray(value)) {
255+
value.forEach(val => appendParam(key, val))
256+
} else {
257+
appendParam(key, value);
258+
}
250259
}
251-
252-
return clientResponse;
260+
return queryString;
253261
}
254262
}

0 commit comments

Comments
 (0)