Skip to content

Commit

Permalink
Merge pull request #192 from bitovi/TR-118-Teams-List
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidNic11 authored Oct 16, 2024
2 parents d0bf2de + 554269e commit d774559
Show file tree
Hide file tree
Showing 39 changed files with 1,538 additions and 719 deletions.
56 changes: 52 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@atlaskit/textfield": "^6.5.2",
"@atlaskit/toggle": "^13.4.4",
"@atlaskit/tokens": "^2.0.0",
"@atlaskit/tooltip": "^18.8.3",
"@rollup/plugin-babel": "^6.0.4",
"@tailwindcss/container-queries": "^0.1.1",
"@tanstack/react-query": "^5.56.2",
Expand Down
63 changes: 27 additions & 36 deletions public/jira-oidc-helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
/**
* this module creates the jira oidc helpers object from all the helper functions in the jira-oidc-helpers folder.
*/
import {
Config,
FieldsRequest,
RequestHelper,
} from "./types";
import { Config, FieldsRequest, RequestHelper } from "./types";
import { RequestHelperResponse, JtrEnv } from "../shared/types";
import {
saveInformationToLocalStorage,
clearAuthFromLocalStorage,
fetchFromLocalStorage
} from "./storage";
import { saveInformationToLocalStorage, clearAuthFromLocalStorage, fetchFromLocalStorage } from "./storage";
import {
fetchAuthorizationCode,
refreshAccessToken,
fetchAccessTokenWithAuthCode,
getAccessToken,
hasAccessToken,
hasValidAccessToken
hasValidAccessToken,
} from "./auth";
import {
fetchAccessibleResources,
Expand All @@ -43,7 +35,7 @@ import { fetchJiraFields, makeFieldsRequest } from "./fields";
import { _cachedServerInfoPromise, getServerInfo } from "./serverInfo.js";
import { makeDeepChildrenLoaderUsingNamedFields } from "./makeDeepChildrenLoaderUsingNamedFields";

export { nativeFetchJSON } from './fetch'
export { nativeFetchJSON } from "./fetch";

// TODO move this into main module
declare global {
Expand All @@ -55,16 +47,18 @@ declare global {
}
}

export type Jira = ReturnType<typeof createJiraHelpers>;

export default function createJiraHelpers(
{ JIRA_CLIENT_ID, JIRA_SCOPE, JIRA_CALLBACK_URL, JIRA_API_URL, JIRA_APP_KEY } = window.env,
requestHelper: RequestHelper,
host: "jira" | "hosted",
host: "jira" | "hosted"
) {
// TODO currently fieldsRequest has to be defined and passed to other functions before it's
// assigned, feels like there should be a better way to do it than this, but a setter function
// was quickest solution i could come up with. Should revisit at some point.
let fieldsRequest: FieldsRequest
const setFieldsRequest = (req: FieldsRequest) => fieldsRequest = req
let fieldsRequest: FieldsRequest;
const setFieldsRequest = (req: FieldsRequest) => (fieldsRequest = req);

const config: Config = {
env: { JIRA_CLIENT_ID, JIRA_SCOPE, JIRA_CALLBACK_URL, JIRA_API_URL, JIRA_APP_KEY },
Expand All @@ -88,25 +82,20 @@ export default function createJiraHelpers(
fetchJiraIssue: fetchJiraIssue(config),
editJiraIssueWithNamedFields: editJiraIssueWithNamedFields(config),
fetchJiraIssuesWithJQL: fetchJiraIssuesWithJQL(config),
fetchJiraIssuesWithJQLWithNamedFields:
fetchJiraIssuesWithJQLWithNamedFields(config),
fetchJiraIssuesWithJQLWithNamedFields: fetchJiraIssuesWithJQLWithNamedFields(config),
fetchAllJiraIssuesWithJQL: fetchAllJiraIssuesWithJQL(config),
fetchAllJiraIssuesWithJQLUsingNamedFields:
fetchAllJiraIssuesWithJQLUsingNamedFields(config),
fetchAllJiraIssuesWithJQLUsingNamedFields: fetchAllJiraIssuesWithJQLUsingNamedFields(config),
fetchJiraChangelog: fetchJiraChangelog(config),
isChangelogComplete,
fetchRemainingChangelogsForIssues:
fetchRemainingChangelogsForIssues(config),
fetchRemainingChangelogsForIssue:
fetchRemainingChangelogsForIssue(config),
fetchAllJiraIssuesWithJQLAndFetchAllChangelog:
fetchAllJiraIssuesWithJQLAndFetchAllChangelog(config),
fetchRemainingChangelogsForIssues: fetchRemainingChangelogsForIssues(config),
fetchRemainingChangelogsForIssue: fetchRemainingChangelogsForIssue(config),
fetchAllJiraIssuesWithJQLAndFetchAllChangelog: fetchAllJiraIssuesWithJQLAndFetchAllChangelog(config),
fetchAllJiraIssuesWithJQLAndFetchAllChangelogUsingNamedFields:
fetchAllJiraIssuesWithJQLAndFetchAllChangelogUsingNamedFields(config),
fetchAllJiraIssuesAndDeepChildrenWithJQLAndFetchAllChangelogUsingNamedFields:
makeDeep(fetchAllJiraIssuesWithJQLAndFetchAllChangelog(config)),
fetchAllJiraIssuesAndDeepChildrenWithJQLUsingNamedFields:
makeDeep(fetchAllJiraIssuesWithJQL(config)),
fetchAllJiraIssuesAndDeepChildrenWithJQLAndFetchAllChangelogUsingNamedFields: makeDeep(
fetchAllJiraIssuesWithJQLAndFetchAllChangelog(config)
),
fetchAllJiraIssuesAndDeepChildrenWithJQLUsingNamedFields: makeDeep(fetchAllJiraIssuesWithJQL(config)),
fetchChildrenResponses: fetchChildrenResponses(config),
fetchDeepChildren: fetchDeepChildren(config),
fetchJiraFields: fetchJiraFields(config),
Expand All @@ -119,13 +108,15 @@ export default function createJiraHelpers(
requester: requestHelper,
};

makeFieldsRequest(config, setFieldsRequest)
makeFieldsRequest(config, setFieldsRequest);

jiraHelpers.fetchAllJiraIssuesAndDeepChildrenWithJQLUsingNamedFields =
makeDeep(jiraHelpers.fetchAllJiraIssuesWithJQL.bind(jiraHelpers));
jiraHelpers.fetchAllJiraIssuesAndDeepChildrenWithJQLUsingNamedFields = makeDeep(
jiraHelpers.fetchAllJiraIssuesWithJQL.bind(jiraHelpers)
);

jiraHelpers.fetchAllJiraIssuesAndDeepChildrenWithJQLAndFetchAllChangelogUsingNamedFields =
makeDeep(jiraHelpers.fetchAllJiraIssuesWithJQLAndFetchAllChangelog.bind(jiraHelpers));
jiraHelpers.fetchAllJiraIssuesAndDeepChildrenWithJQLAndFetchAllChangelogUsingNamedFields = makeDeep(
jiraHelpers.fetchAllJiraIssuesWithJQLAndFetchAllChangelog.bind(jiraHelpers)
);

return jiraHelpers
};
return jiraHelpers;
}
Loading

0 comments on commit d774559

Please sign in to comment.