@forge/api
Advanced tools
Comparing version 0.0.0-experimental-64caa5a to 0.0.0-experimental-72f4150
157
CHANGELOG.md
# @forge/api | ||
## 0.0.0-experimental-64caa5a | ||
## 0.0.0-experimental-72f4150 | ||
### Patch Changes | ||
- a5cbdf6: Add NodeJS runtime support for Events API | ||
- a5cbdf6: Added capabilities for enabling Custom entities | ||
- Updated dependencies [a5cbdf6] | ||
- Updated dependencies [a5cbdf6] | ||
- @forge/egress@0.0.0-experimental-72f4150 | ||
- @forge/storage@0.0.0-experimental-72f4150 | ||
## 2.10.1-next.1 | ||
### Patch Changes | ||
- Updated dependencies [aa193085] | ||
- @forge/egress@1.1.2-next.0 | ||
## 2.10.1-next.0 | ||
### Patch Changes | ||
- dfab69c: Add NodeJS runtime support for Events API | ||
## 2.10.0 | ||
### Minor Changes | ||
- e0e3587: Add NodeJS runtime support for Storage API | ||
### Patch Changes | ||
- 37f48c5: Fix contextAri for nodejs runtime | ||
- ca8551d: Fix proxy fetch not respecting requestInit options | ||
## 2.10.0-next.2 | ||
### Patch Changes | ||
- 37f48c5: Fix contextAri for nodejs runtime | ||
## 2.10.0-next.1 | ||
### Minor Changes | ||
- e0e3587a: Add NodeJS runtime support for Storage API | ||
## 2.9.2-next.0 | ||
### Patch Changes | ||
- ca8551dd: Fix proxy fetch not respecting requestInit options | ||
## 2.9.1 | ||
### Patch Changes | ||
- 73b929a: Export routeFromAbsolute | ||
- 8d0dc10: Use a single global to pass information from the runtime | ||
- 7a4fa35: Support internet egress calls in the new runtime | ||
## 2.9.1-next.2 | ||
### Patch Changes | ||
- 8d0dc104: Use a single global to pass information from the runtime | ||
## 2.9.1-next.1 | ||
### Patch Changes | ||
- 73b929a: Export routeFromAbsolute | ||
## 2.9.1-next.0 | ||
### Patch Changes | ||
- 7a4fa35: Support internet egress calls in the new runtime | ||
## 2.9.0 | ||
### Minor Changes | ||
- e5dd325: support for requestBitbucket | ||
## 2.9.0-next.0 | ||
### Minor Changes | ||
- e5dd325d: support for requestBitbucket | ||
## 2.8.1 | ||
### Patch Changes | ||
- 8e2a5a6: Update node-fetch version | ||
- Updated dependencies [8e2a5a6] | ||
- @forge/storage@1.3.1 | ||
## 2.8.1-next.0 | ||
### Patch Changes | ||
- 8e2a5a6: Update node-fetch version | ||
- Updated dependencies [8e2a5a6] | ||
- @forge/storage@1.3.1-next.0 | ||
## 2.8.0 | ||
### Minor Changes | ||
- 95913f6: Call product APIs via proxy on Node runtime | ||
## 2.8.0-next.0 | ||
### Minor Changes | ||
- 95913f6: Call product APIs via proxy on Node runtime | ||
## 2.7.0 | ||
### Minor Changes | ||
- b3ee297: Unblock valid property API keys and handled error propagation | ||
### Patch Changes | ||
- Updated dependencies [3c3c42b] | ||
- @forge/storage@1.3.0 | ||
## 2.7.0-next.0 | ||
### Minor Changes | ||
- b3ee2973: Unblock valid property API keys and handled error propagation | ||
### Patch Changes | ||
- Updated dependencies [3c3c42b9] | ||
- @forge/storage@1.3.0-next.0 | ||
## 2.6.1 | ||
### Patch Changes | ||
- Updated dependencies [21e392d] | ||
- @forge/storage@1.2.0 | ||
## 2.6.1-next.0 | ||
### Patch Changes | ||
- Updated dependencies [21e392d] | ||
- @forge/storage@1.2.0-next.0 | ||
## 2.6.0 | ||
### Minor Changes | ||
- 8571c05: Add support for multiple accounts in external authentication | ||
@@ -8,0 +163,0 @@ |
import { RequestInfo, RequestInit } from 'node-fetch'; | ||
import { FetchAPI } from '..'; | ||
export { transformResponse } from './polyfill-response'; | ||
export declare type FetchWrapper = (fetchApi: Function) => (url: RequestInfo, init?: RequestInit) => any; | ||
import { FetchAPI, FetchMethod, RequestProductMethod, FetchMethodAllowingRoute, APIResponse } from '..'; | ||
export declare type FetchWrapper = (fetchApi: Function) => (url: RequestInfo, init?: RequestInit) => Promise<APIResponse>; | ||
export declare const wrapRequestGraph: (requestGraphApi: FetchMethod) => (query: string, variables?: any, headers?: {}) => Promise<APIResponse>; | ||
export declare const wrapRequestProduct: (x: FetchMethod) => RequestProductMethod; | ||
export declare const wrapWithRouteUnwrapper: (x: FetchMethod) => FetchMethodAllowingRoute; | ||
export declare const wrapFetchApiMethods: (api: any, wrapFetch: FetchWrapper) => FetchAPI; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapFetchApiMethods = void 0; | ||
var polyfill_response_1 = require("./polyfill-response"); | ||
Object.defineProperty(exports, "transformResponse", { enumerable: true, get: function () { return polyfill_response_1.transformResponse; } }); | ||
exports.wrapFetchApiMethods = exports.wrapWithRouteUnwrapper = exports.wrapRequestProduct = exports.wrapRequestGraph = void 0; | ||
const safeUrl_1 = require("../safeUrl"); | ||
@@ -12,22 +10,27 @@ const wrapRequestGraph = (requestGraphApi) => (query, variables, headers = {}) => requestGraphApi('/graphql', { | ||
}); | ||
exports.wrapRequestGraph = wrapRequestGraph; | ||
const wrapRequestProduct = (requestProduct) => (path, init) => { | ||
const safeUrl = safeUrl_1.requireSafeUrl(path); | ||
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path); | ||
return requestProduct(safeUrl.value, init); | ||
}; | ||
exports.wrapRequestProduct = wrapRequestProduct; | ||
const wrapWithRouteUnwrapper = (fetch) => (path, init) => { | ||
const stringPath = safeUrl_1.isRoute(path) ? path.value : path; | ||
const stringPath = (0, safeUrl_1.isRoute)(path) ? path.value : path; | ||
return fetch(stringPath, init); | ||
}; | ||
exports.wrapFetchApiMethods = (api, wrapFetch) => { | ||
exports.wrapWithRouteUnwrapper = wrapWithRouteUnwrapper; | ||
const wrapFetchApiMethods = (api, wrapFetch) => { | ||
return { | ||
fetch: wrapWithRouteUnwrapper(wrapFetch(api.fetch)), | ||
requestJira: wrapRequestProduct(wrapFetch(api.requestJira)), | ||
requestConfluence: wrapRequestProduct(wrapFetch(api.requestConfluence)), | ||
fetch: (0, exports.wrapWithRouteUnwrapper)(wrapFetch(api.fetch)), | ||
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.requestJira)), | ||
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.requestConfluence)), | ||
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.requestBitbucket)), | ||
asUser: () => ({ | ||
requestJira: wrapRequestProduct(wrapFetch(api.asUser().requestJira)), | ||
requestConfluence: wrapRequestProduct(wrapFetch(api.asUser().requestConfluence)), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asUser().requestGraph)), | ||
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestJira)), | ||
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestConfluence)), | ||
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestBitbucket)), | ||
requestGraph: (0, exports.wrapRequestGraph)(wrapFetch(api.asUser().requestGraph)), | ||
withProvider: (provider, remoteName, tokenId) => { | ||
const { hasCredentials, requestCredentials, listCredentials, fetch: withProviderFetch } = api.asUser().withProvider(provider, remoteName, tokenId); | ||
const wrappedRequestRemote = wrapWithRouteUnwrapper(wrapFetch(withProviderFetch)); | ||
const wrappedRequestRemote = (0, exports.wrapWithRouteUnwrapper)(wrapFetch(withProviderFetch)); | ||
return { | ||
@@ -42,7 +45,9 @@ hasCredentials, | ||
asApp: () => ({ | ||
requestJira: wrapRequestProduct(wrapFetch(api.asApp().requestJira)), | ||
requestConfluence: wrapRequestProduct(wrapFetch(api.asApp().requestConfluence)), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asApp().requestGraph)) | ||
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestJira)), | ||
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestConfluence)), | ||
requestGraph: (0, exports.wrapRequestGraph)(wrapFetch(api.asApp().requestGraph)), | ||
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestBitbucket)) | ||
}) | ||
}; | ||
}; | ||
exports.wrapFetchApiMethods = wrapFetchApiMethods; |
@@ -5,5 +5,6 @@ "use strict"; | ||
const node_fetch_1 = require("node-fetch"); | ||
exports.transformResponse = (fetchApi) => async (url, init) => { | ||
const transformResponse = (fetchApi) => async (url, init) => { | ||
const response = await fetchApi(url, init); | ||
return Object.assign(Object.assign({}, response), { headers: new node_fetch_1.Headers(response.headers) }); | ||
}; | ||
exports.transformResponse = transformResponse; |
export declare const authorize: () => { | ||
readonly onJira: (projectPermissionsInput: import("@forge/auth/out/jira").ProjectPermission[]) => Promise<import("@forge/auth/out/jira").ProjectPermissionResponse[]>; | ||
readonly onJiraProject: (projects: string | number | (string | number)[]) => Record<string, import("@forge/auth/out/types").PermissionCheck>; | ||
readonly onJiraIssue: (issues: string | number | (string | number)[]) => Record<string, import("@forge/auth/out/types").PermissionCheck>; | ||
readonly onConfluenceContent: (contentId: string | number) => Record<string, import("@forge/auth/out/types").PermissionCheck>; | ||
readonly onJira: (projectPermissionsInput: import("packages/forge-auth/out/jira").ProjectPermission[]) => Promise<import("packages/forge-auth/out/jira").ProjectPermissionResponse[]>; | ||
readonly onJiraProject: (projects: import("packages/forge-auth/out/jira").Id | import("packages/forge-auth/out/jira").Id[]) => Record<string, import("packages/forge-auth/out/types").PermissionCheck>; | ||
readonly onJiraIssue: (issues: import("packages/forge-auth/out/jira").Id | import("packages/forge-auth/out/jira").Id[]) => Record<string, import("packages/forge-auth/out/types").PermissionCheck>; | ||
readonly onConfluenceContent: (contentId: string | number) => Record<string, import("packages/forge-auth/out/types").PermissionCheck>; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,10 +6,10 @@ "use strict"; | ||
const api = global.api; | ||
exports.authorize = () => { | ||
const authorize = () => { | ||
if (!process.env.__CURRENT_USER_ACCOUNT_ID) | ||
throw new Error(`Couldn’t find the accountId of the invoking user. This API can only be used inside user-invoked modules.`); | ||
const accountId = process.env.__CURRENT_USER_ACCOUNT_ID; | ||
return Object.assign(Object.assign({}, auth_1.authorizeConfluenceWithFetch(async (path, opts) => { | ||
return Object.assign(Object.assign({}, (0, auth_1.authorizeConfluenceWithFetch)(async (path, opts) => { | ||
const res = await api.asUser().requestConfluence(path, opts); | ||
return res.json(); | ||
}, accountId)), auth_1.authorizeJiraWithFetch(async (path, opts) => { | ||
}, accountId)), (0, auth_1.authorizeJiraWithFetch)(async (path, opts) => { | ||
const res = await api.asUser().requestJira(path, opts); | ||
@@ -19,1 +19,2 @@ return res.json(); | ||
}; | ||
exports.authorize = authorize; |
import { RequestInit, Response } from 'node-fetch'; | ||
import { QueryApi } from '@forge/storage'; | ||
import { QueryApi, EntityStorageApi, CustomEntityInput } from '@forge/storage'; | ||
import { authorize } from './authorization'; | ||
import { Route } from './safeUrl'; | ||
import { webTrigger } from './webTrigger'; | ||
import { createRequestStargateAsApp } from './runtime/fetch-and-storage'; | ||
export declare type APIResponse = Pick<Response, 'json' | 'text' | 'arrayBuffer' | 'ok' | 'status' | 'statusText' | 'headers'>; | ||
@@ -14,2 +15,3 @@ export declare type FetchMethod = (url: string, init?: RequestInit) => Promise<APIResponse>; | ||
requestConfluence: RequestProductMethod; | ||
requestBitbucket: RequestProductMethod; | ||
} | ||
@@ -32,2 +34,3 @@ export interface GraphQLFetchMethods { | ||
delete: (key: string) => Promise<void>; | ||
upsertCustomEntities(schemas: CustomEntityInput[]): Promise<void>; | ||
} | ||
@@ -40,3 +43,3 @@ export interface PropertiesAPI { | ||
} | ||
export interface StorageAPI extends StorageMethods, QueryApi { | ||
export interface StorageAPI extends StorageMethods, QueryApi, EntityStorageApi { | ||
} | ||
@@ -67,4 +70,15 @@ export interface ForgeStorageAPI extends StorageAPI { | ||
declare const requestConfluence: RequestProductMethod; | ||
declare const requestBitbucket: RequestProductMethod; | ||
declare const store: PropertiesAPI; | ||
declare const storage: ForgeStorageAPI; | ||
declare const storage: { | ||
get: (key: string) => Promise<any>; | ||
set: (key: string, value: any) => Promise<void>; | ||
delete: (key: string) => Promise<void>; | ||
getSecret: (key: string) => Promise<any>; | ||
setSecret: (key: string, value: any) => Promise<void>; | ||
deleteSecret: (key: string) => Promise<void>; | ||
query: () => import("packages/forge-storage/out/query-api").DefaultQueryBuilder; | ||
entity: (entityName: string) => import("packages/forge-storage/out/entity-storage").EntityStorageBuilder; | ||
upsertCustomEntities: (schemas: CustomEntityInput[]) => Promise<void>; | ||
}; | ||
declare const properties: PropertiesAPI; | ||
@@ -76,6 +90,6 @@ declare const API: ForgeAPI; | ||
export default API; | ||
export { asUser, asApp, authorize, fetch, requestJira, requestConfluence, store, storage, properties, webTrigger }; | ||
export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, Value } from '@forge/storage'; | ||
export { startsWith } from '@forge/storage'; | ||
export { route, assumeTrustedRoute, Route } from './safeUrl'; | ||
export { asUser, asApp, authorize, fetch, requestJira, requestConfluence, requestBitbucket, store, storage, properties, webTrigger, createRequestStargateAsApp }; | ||
export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, Value, WherePredicate, FilterPredicate, startsWith, WhereConditions, FilterConditions } from '@forge/storage'; | ||
export { route, assumeTrustedRoute, routeFromAbsolute, Route } from './safeUrl'; | ||
export { ForgeRuntime, getRuntime } from './api/runtime'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.webTrigger = exports.properties = exports.storage = exports.store = exports.requestConfluence = exports.requestJira = exports.fetch = exports.authorize = exports.asApp = exports.asUser = exports.privacy = void 0; | ||
exports.getRuntime = exports.routeFromAbsolute = exports.assumeTrustedRoute = exports.route = exports.FilterConditions = exports.WhereConditions = exports.startsWith = exports.createRequestStargateAsApp = exports.webTrigger = exports.properties = exports.storage = exports.store = exports.requestBitbucket = exports.requestConfluence = exports.requestJira = exports.fetch = exports.authorize = exports.asApp = exports.asUser = exports.privacy = void 0; | ||
const storage_1 = require("@forge/storage"); | ||
const api_1 = require("./api"); | ||
const authorization_1 = require("./authorization"); | ||
@@ -12,2 +12,4 @@ Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorization_1.authorize; } }); | ||
Object.defineProperty(exports, "webTrigger", { enumerable: true, get: function () { return webTrigger_1.webTrigger; } }); | ||
const fetch_and_storage_1 = require("./runtime/fetch-and-storage"); | ||
Object.defineProperty(exports, "createRequestStargateAsApp", { enumerable: true, get: function () { return fetch_and_storage_1.createRequestStargateAsApp; } }); | ||
function withDeprecatedMessage(method, message) { | ||
@@ -20,13 +22,15 @@ const wrappedMethod = (...args) => { | ||
} | ||
const FetchAPI = api_1.wrapFetchApiMethods(global.api, api_1.transformResponse); | ||
const asUser = FetchAPI.asUser; | ||
const fetchAPI = (0, fetch_and_storage_1.getFetchAPI)(); | ||
const asUser = fetchAPI.asUser; | ||
exports.asUser = asUser; | ||
const asApp = FetchAPI.asApp; | ||
const asApp = fetchAPI.asApp; | ||
exports.asApp = asApp; | ||
const fetch = FetchAPI.fetch; | ||
const fetch = fetchAPI.fetch; | ||
exports.fetch = fetch; | ||
const requestJira = FetchAPI.requestJira; | ||
const requestJira = fetchAPI.requestJira; | ||
exports.requestJira = requestJira; | ||
const requestConfluence = FetchAPI.requestConfluence; | ||
const requestConfluence = fetchAPI.requestConfluence; | ||
exports.requestConfluence = requestConfluence; | ||
const requestBitbucket = fetchAPI.requestBitbucket; | ||
exports.requestBitbucket = requestBitbucket; | ||
const deprecatedPropertiesApi = Object.entries(properties_1.propertiesApi) | ||
@@ -42,9 +46,9 @@ .map(([name, method]) => { | ||
exports.store = store; | ||
const storage = storage_1.getStorageInstanceWithQuery(new storage_1.GlobalStorage(global.api.__getAppAri, global.api.asApp().__requestAtlassian)); | ||
const storage = (0, storage_1.getStorageInstanceWithQuery)(new storage_1.GlobalStorage(fetch_and_storage_1.getContextAri, (0, fetch_and_storage_1.createRequestStargateAsApp)())); | ||
exports.storage = storage; | ||
const properties = properties_1.propertiesApi; | ||
exports.properties = properties; | ||
const API = Object.assign(Object.assign({}, FetchAPI), { store: Object.assign({}, store) }); | ||
const API = Object.assign(Object.assign({}, fetchAPI), { store: Object.assign({}, store) }); | ||
exports.privacy = { | ||
reportPersonalData: privacy_1.createReportPersonalData(global.api.asApp().__requestAtlassian) | ||
reportPersonalData: (0, privacy_1.createReportPersonalData)((_a = global.api) === null || _a === void 0 ? void 0 : _a.asApp().__requestAtlassian) | ||
}; | ||
@@ -54,4 +58,9 @@ exports.default = API; | ||
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return storage_2.startsWith; } }); | ||
Object.defineProperty(exports, "WhereConditions", { enumerable: true, get: function () { return storage_2.WhereConditions; } }); | ||
Object.defineProperty(exports, "FilterConditions", { enumerable: true, get: function () { return storage_2.FilterConditions; } }); | ||
var safeUrl_1 = require("./safeUrl"); | ||
Object.defineProperty(exports, "route", { enumerable: true, get: function () { return safeUrl_1.route; } }); | ||
Object.defineProperty(exports, "assumeTrustedRoute", { enumerable: true, get: function () { return safeUrl_1.assumeTrustedRoute; } }); | ||
Object.defineProperty(exports, "routeFromAbsolute", { enumerable: true, get: function () { return safeUrl_1.routeFromAbsolute; } }); | ||
var runtime_1 = require("./api/runtime"); | ||
Object.defineProperty(exports, "getRuntime", { enumerable: true, get: function () { return runtime_1.getRuntime; } }); |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.LIMIT = 90; | ||
exports.createReportPersonalData = (requestAtlassian) => { | ||
const createReportPersonalData = (requestAtlassian) => { | ||
return function fetchUpdates(accounts) { | ||
@@ -28,1 +28,2 @@ if (accounts.length === 0) { | ||
}; | ||
exports.createReportPersonalData = createReportPersonalData; |
@@ -8,3 +8,3 @@ "use strict"; | ||
constructor(pageId, apiClient) { | ||
const storageApiPath = (key) => safeUrl_1.route `/wiki/rest/api/content/${pageId}/property/${key}`; | ||
const storageApiPath = (key) => (0, safeUrl_1.route) `/wiki/rest/api/content/${pageId}/property/${key}`; | ||
super(storageApiPath, apiClient); | ||
@@ -11,0 +11,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
constructor(spaceId, apiClient) { | ||
const storageApiPath = (key) => safeUrl_1.route `/wiki/rest/api/space/${spaceId}/property/${key}`; | ||
const storageApiPath = (key) => (0, safeUrl_1.route) `/wiki/rest/api/space/${spaceId}/property/${key}`; | ||
super(storageApiPath, apiClient); | ||
@@ -11,0 +11,0 @@ } |
@@ -12,5 +12,5 @@ "use strict"; | ||
const storage = { | ||
get: (key) => adapter.get(sanitized_key_1.sanitizedKey(key)), | ||
set: (key, value) => adapter.set(sanitized_key_1.sanitizedKey(key), value), | ||
delete: (key) => adapter.delete(sanitized_key_1.sanitizedKey(key)) | ||
get: (key) => adapter.get((0, sanitized_key_1.sanitizedKey)(key)), | ||
set: (key, value) => adapter.set((0, sanitized_key_1.sanitizedKey)(key), value), | ||
delete: (key) => adapter.delete((0, sanitized_key_1.sanitizedKey)(key)) | ||
}; | ||
@@ -20,6 +20,6 @@ return storage; | ||
exports.propertiesApi = { | ||
onJiraIssue: (issueKey) => getPropertiesInstance(new jira_issue_1.JiraIssueStorage(sanitized_key_1.sanitizedKey(issueKey), index_1.asApp().requestJira)), | ||
onJiraProject: (projectKey) => getPropertiesInstance(new jira_project_1.JiraProjectStorage(sanitized_key_1.sanitizedKey(projectKey), index_1.asApp().requestJira)), | ||
onConfluencePage: (pageId) => getPropertiesInstance(new confluence_page_1.ConfluencePageStorage(sanitized_key_1.sanitizedKey(pageId), index_1.asApp().requestConfluence)), | ||
onConfluenceSpace: (spaceId) => getPropertiesInstance(new confluence_space_1.ConfluenceSpaceStorage(sanitized_key_1.sanitizedKey(spaceId), index_1.asApp().requestConfluence)) | ||
onJiraIssue: (issueKey) => getPropertiesInstance(new jira_issue_1.JiraIssueStorage((0, sanitized_key_1.sanitizedKey)(issueKey), (0, index_1.asApp)().requestJira)), | ||
onJiraProject: (projectKey) => getPropertiesInstance(new jira_project_1.JiraProjectStorage(projectKey, (0, index_1.asApp)().requestJira)), | ||
onConfluencePage: (pageId) => getPropertiesInstance(new confluence_page_1.ConfluencePageStorage((0, sanitized_key_1.sanitizedKey)(pageId), (0, index_1.asApp)().requestConfluence)), | ||
onConfluenceSpace: (spaceId) => getPropertiesInstance(new confluence_space_1.ConfluenceSpaceStorage((0, sanitized_key_1.sanitizedKey)(spaceId), (0, index_1.asApp)().requestConfluence)) | ||
}; |
@@ -8,3 +8,3 @@ "use strict"; | ||
constructor(issueKey, apiClient) { | ||
const storageApiPath = (key) => safeUrl_1.route `/rest/api/3/issue/${issueKey}/properties/${key}`; | ||
const storageApiPath = (key) => (0, safeUrl_1.route) `/rest/api/3/issue/${issueKey}/properties/${key}`; | ||
super(storageApiPath, apiClient); | ||
@@ -11,0 +11,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
constructor(projectKey, apiClient) { | ||
const storageApiPath = (key) => safeUrl_1.route `/rest/api/3/project/${projectKey}/properties/${key}`; | ||
const storageApiPath = (key) => (0, safeUrl_1.route) `/rest/api/3/project/${projectKey}/properties/${key}`; | ||
super(storageApiPath, apiClient); | ||
@@ -11,0 +11,0 @@ } |
@@ -12,3 +12,3 @@ import { StorageAdapter } from './storage-adapter'; | ||
protected buildSetRequestOptions(requestBody: any, requestMethod: 'PUT' | 'POST'): { | ||
method: "POST" | "PUT"; | ||
method: "PUT" | "POST"; | ||
body: string; | ||
@@ -15,0 +15,0 @@ headers: { |
@@ -13,3 +13,3 @@ "use strict"; | ||
if (!response.ok) { | ||
if (/400|401|403|404/.test(response.status.toString())) { | ||
if (/403|404/.test(response.status.toString())) { | ||
return undefined; | ||
@@ -16,0 +16,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sanitizedKey = void 0; | ||
exports.sanitizedKey = (input) => { | ||
const regex = /^(~)?[A-Za-z0-9_\-]+$/; | ||
const sanitizedKey = (input) => { | ||
const regex = /^(~)?[A-Za-z0-9_\-\.]+$/; | ||
if (!regex.test(input)) { | ||
@@ -11,1 +11,2 @@ throw new Error('Invalid context/property key'); | ||
}; | ||
exports.sanitizedKey = sanitizedKey; |
@@ -5,2 +5,3 @@ export declare type Route = { | ||
export declare function isRoute(x: unknown): x is Route; | ||
export declare function routeFromAbsolute(absolutePath: string): Route; | ||
export declare function route(path: TemplateStringsArray, ...parameters: (string | number | URLSearchParams | Route)[]): Route; | ||
@@ -7,0 +8,0 @@ export declare function requireSafeUrl(url: unknown): Route; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assumeTrustedRoute = exports.requireSafeUrl = exports.route = exports.isRoute = void 0; | ||
exports.assumeTrustedRoute = exports.requireSafeUrl = exports.route = exports.routeFromAbsolute = exports.isRoute = void 0; | ||
class ReadonlyRoute { | ||
@@ -19,2 +19,7 @@ constructor(value_) { | ||
exports.isRoute = isRoute; | ||
function routeFromAbsolute(absolutePath) { | ||
const absoluteURL = new URL(absolutePath); | ||
return assumeTrustedRoute(`${absoluteURL.pathname}${absoluteURL.search}`); | ||
} | ||
exports.routeFromAbsolute = routeFromAbsolute; | ||
function route(path, ...parameters) { | ||
@@ -21,0 +26,0 @@ let fullPath = ''; |
{ | ||
"name": "@forge/api", | ||
"version": "0.0.0-experimental-64caa5a", | ||
"version": "0.0.0-experimental-72f4150", | ||
"description": "Forge API methods", | ||
@@ -19,6 +19,7 @@ "author": "Atlassian", | ||
"@forge/auth": "^0.0.1", | ||
"@forge/storage": "^1.1.0", | ||
"@forge/egress": "^0.0.0-experimental-72f4150", | ||
"@forge/storage": "^0.0.0-experimental-72f4150", | ||
"@types/node-fetch": "^2.5.7", | ||
"node-fetch": "^2.6.1" | ||
"node-fetch": "2.6.7" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58045
63
709
5
+ Added@forge/egress@0.0.0-experimental-e976d58(transitive)
+ Added@forge/storage@0.0.0-experimental-f85f9b1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addednode-fetch@2.6.7(transitive)
- Removed@forge/storage@1.7.2(transitive)
- Removednode-fetch@2.7.0(transitive)
Updatednode-fetch@2.6.7