@forge/api
Advanced tools
Comparing version 0.0.0-experimental-788b6d9 to 0.0.0-experimental-819498d
148
CHANGELOG.md
# @forge/api | ||
## 0.0.0-experimental-788b6d9 | ||
## 0.0.0-experimental-819498d | ||
### Minor Changes | ||
- 2ede277: Add new getWebTriggerUrl runtime API method | ||
- 78effb2: Remove engines.node declaration | ||
### Patch Changes | ||
- b0ae6aa: Fix properties onConfluenceSpace for personal spaces | ||
- Updated dependencies [78effb2] | ||
- Updated dependencies [9b496aa] | ||
- @forge/storage@0.0.0-experimental-819498d | ||
## 1.2.0-next.2 | ||
### Patch Changes | ||
- Updated dependencies [9b496aa] | ||
- @forge/storage@1.0.3-next.0 | ||
## 1.2.0-next.1 | ||
### Minor Changes | ||
- 2ede277: Add new getWebTriggerUrl runtime API method | ||
## 1.1.1-next.0 | ||
### Patch Changes | ||
- b0ae6aa: Fix properties onConfluenceSpace for personal spaces | ||
## 1.1.0 | ||
### Minor Changes | ||
- 2136fd7: Adds reportPersonalData method to forge help apps comply with GDPR | ||
- ba442a3: Add requestGraph method to fetch api. | ||
### Patch Changes | ||
- Updated dependencies [c7c6de2] | ||
- @forge/storage@1.0.2 | ||
## 1.1.0-next.2 | ||
### Patch Changes | ||
- Updated dependencies [c7c6de2] | ||
- @forge/storage@1.0.2-next.0 | ||
## 1.1.0-next.1 | ||
### Minor Changes | ||
- ba442a3: Add requestGraph method to fetch api. | ||
## 1.1.0-next.0 | ||
### Minor Changes | ||
- 2136fd7: Adds reportPersonalData method to forge help apps comply with GDPR | ||
## 1.0.1 | ||
### Patch Changes | ||
- Updated dependencies [c0e9085] | ||
- @forge/storage@1.0.1 | ||
## 1.0.1-next.0 | ||
### Patch Changes | ||
- Updated dependencies [c0e9085] | ||
- @forge/storage@1.0.1-next.0 | ||
## 1.0.0 | ||
### Major Changes | ||
- 1daf2c5: Forge packages to 1.0.0 for upcoming platform GA 🎉 | ||
### Patch Changes | ||
- Updated dependencies [1daf2c5] | ||
- @forge/storage@1.0.0 | ||
## 1.0.0-next.0 | ||
### Major Changes | ||
- 1daf2c5: Forge is now generally available 🎉 | ||
### Patch Changes | ||
- Updated dependencies [1daf2c5] | ||
- @forge/storage@1.0.0-next.0 | ||
## 0.7.0 | ||
### Minor Changes | ||
- 843a703: Add forge-storage library | ||
### Patch Changes | ||
- Updated dependencies [843a703] | ||
- @forge/storage@0.0.2 | ||
## 0.7.0-next.0 | ||
### Minor Changes | ||
- 843a703: Add forge-storage library | ||
### Patch Changes | ||
- Updated dependencies [843a703] | ||
- @forge/storage@0.0.2-next.0 | ||
## 0.6.1 | ||
### Patch Changes | ||
- b41cc4c: Fix exported content | ||
- 5b666a5: Fix published content | ||
- 6f786cf: Fixing falsey values in storage api | ||
## 0.6.1-next.2 | ||
### Patch Changes | ||
- 5b666a5: Fix published content | ||
## 0.6.1-next.1 | ||
### Patch Changes | ||
- b41cc4c: Fix exported content | ||
## 0.6.1-next.0 | ||
### Patch Changes | ||
- 6f786cf: Fixing falsey values in storage api | ||
## 0.6.0 | ||
@@ -6,0 +152,0 @@ |
@@ -6,2 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "transformResponse", { enumerable: true, get: function () { return polyfill_response_1.transformResponse; } }); | ||
const wrapRequestGraph = (requestGraphApi) => (query, variables) => requestGraphApi('/graphql', { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify(Object.assign({ query }, (variables ? { variables } : {}))) | ||
}); | ||
exports.wrapFetchApiMethods = (api, wrapFetch) => { | ||
@@ -14,9 +19,11 @@ return { | ||
requestJira: wrapFetch(api.asUser().requestJira), | ||
requestConfluence: wrapFetch(api.asUser().requestConfluence) | ||
requestConfluence: wrapFetch(api.asUser().requestConfluence), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asUser().requestGraph)) | ||
}), | ||
asApp: () => ({ | ||
requestJira: wrapFetch(api.asApp().requestJira), | ||
requestConfluence: wrapFetch(api.asApp().requestConfluence) | ||
requestConfluence: wrapFetch(api.asApp().requestConfluence), | ||
requestGraph: wrapRequestGraph(wrapFetch(api.asApp().requestGraph)) | ||
}) | ||
}; | ||
}; |
import { RequestInit, Response } from 'node-fetch'; | ||
import { QueryApi } from './storage'; | ||
import { webTrigger } from './webTrigger'; | ||
import { QueryApi } from '@forge/storage'; | ||
export declare type APIResponse = Pick<Response, 'json' | 'text' | 'arrayBuffer' | 'ok' | 'status' | 'statusText' | 'headers'>; | ||
@@ -10,2 +11,5 @@ export declare type FetchMethod = (url: string, init?: RequestInit) => Promise<APIResponse>; | ||
} | ||
export interface GraphQLFetchMethods { | ||
requestGraph: (query: string, variables?: any) => Promise<APIResponse>; | ||
} | ||
export interface StorageMethods { | ||
@@ -31,4 +35,4 @@ get: (key: string) => Promise<any>; | ||
export interface FetchAPI extends FetchMethods { | ||
asUser(): FetchMethods; | ||
asApp(): FetchMethods; | ||
asUser(): FetchMethods & GraphQLFetchMethods; | ||
asApp(): FetchMethods & GraphQLFetchMethods; | ||
fetch: FetchMethod; | ||
@@ -39,4 +43,4 @@ } | ||
} | ||
declare const asUser: () => FetchMethods; | ||
declare const asApp: () => FetchMethods; | ||
declare const asUser: () => FetchMethods & GraphQLFetchMethods; | ||
declare const asApp: () => FetchMethods & GraphQLFetchMethods; | ||
declare const fetch: FetchMethod; | ||
@@ -49,6 +53,9 @@ declare const requestJira: FetchMethod; | ||
declare const API: ForgeAPI; | ||
export declare const privacy: { | ||
reportPersonalData: (accounts: import("./privacy").Account[]) => Promise<import("./privacy").AccountUpdate[]>; | ||
}; | ||
export default API; | ||
export { asUser, asApp, fetch, requestJira, requestConfluence, store, storage, properties }; | ||
export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, Value } from './storage/storage-adapter'; | ||
export { startsWith } from './storage/conditions'; | ||
export { asUser, asApp, fetch, requestJira, requestConfluence, store, storage, properties, webTrigger }; | ||
export { QueryBuilder, QueryApi, Condition, ListResult, Predicate, Result, Value } from '@forge/storage'; | ||
export { startsWith } from '@forge/storage'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.properties = exports.storage = exports.store = exports.requestConfluence = exports.requestJira = exports.fetch = exports.asApp = exports.asUser = void 0; | ||
exports.webTrigger = exports.properties = exports.storage = exports.store = exports.requestConfluence = exports.requestJira = exports.fetch = exports.asApp = exports.asUser = exports.privacy = void 0; | ||
const api_1 = require("./api"); | ||
const properties_1 = require("./properties"); | ||
const storage_1 = require("./storage"); | ||
const privacy_1 = require("./privacy"); | ||
const webTrigger_1 = require("./webTrigger"); | ||
Object.defineProperty(exports, "webTrigger", { enumerable: true, get: function () { return webTrigger_1.webTrigger; } }); | ||
const storage_1 = require("@forge/storage"); | ||
function withDeprecatedMessage(method, message) { | ||
@@ -35,3 +38,3 @@ const wrappedMethod = (...args) => { | ||
exports.store = store; | ||
const storage = storage_1.storageApi; | ||
const storage = storage_1.getStorageInstanceWithQuery(new storage_1.GlobalStorage(global.api.__getAppAri, global.api.asApp().__requestAtlassian)); | ||
exports.storage = storage; | ||
@@ -41,4 +44,7 @@ const properties = properties_1.propertiesApi; | ||
const API = Object.assign(Object.assign({}, FetchAPI), { store: Object.assign({}, store) }); | ||
exports.privacy = { | ||
reportPersonalData: privacy_1.createReportPersonalData(global.api.asApp().__requestAtlassian) | ||
}; | ||
exports.default = API; | ||
var conditions_1 = require("./storage/conditions"); | ||
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return conditions_1.startsWith; } }); | ||
var storage_2 = require("@forge/storage"); | ||
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return storage_2.startsWith; } }); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const product_scoped_storage_1 = require("./product-scoped-storage"); | ||
const errors_1 = require("../errors"); | ||
const storage_1 = require("@forge/storage"); | ||
class ConfluenceVersionedStorage extends product_scoped_storage_1.ProductScopedStorage { | ||
@@ -11,3 +11,3 @@ async versionedSet(key, value) { | ||
if (!versionResponse.ok && versionResponse.status !== 404) { | ||
throw errors_1.APIError.forStatus(versionResponse.status); | ||
throw storage_1.APIError.forStatus(versionResponse.status); | ||
} | ||
@@ -14,0 +14,0 @@ const updatedVersionNumber = await this.getUpdatedVersion(versionResponse); |
@@ -9,14 +9,8 @@ "use strict"; | ||
const confluence_space_1 = require("./confluence-space"); | ||
const sanitizedKey = (input) => { | ||
const regex = /^[A-Za-z0-9_\-]+$/; | ||
if (!regex.test(input)) { | ||
throw new Error('Invalid context/property key'); | ||
} | ||
return input; | ||
}; | ||
const sanitized_key_1 = require("./sanitized-key"); | ||
const getPropertiesInstance = (adapter) => { | ||
const storage = { | ||
get: (key) => adapter.get(sanitizedKey(key)), | ||
set: (key, value) => adapter.set(sanitizedKey(key), value), | ||
delete: (key) => adapter.delete(sanitizedKey(key)) | ||
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)) | ||
}; | ||
@@ -26,6 +20,6 @@ return storage; | ||
exports.propertiesApi = { | ||
onJiraIssue: (issueKey) => getPropertiesInstance(new jira_issue_1.JiraIssueStorage(sanitizedKey(issueKey), index_1.asApp().requestJira)), | ||
onJiraProject: (projectKey) => getPropertiesInstance(new jira_project_1.JiraProjectStorage(sanitizedKey(projectKey), index_1.asApp().requestJira)), | ||
onConfluencePage: (pageId) => getPropertiesInstance(new confluence_page_1.ConfluencePageStorage(sanitizedKey(pageId), index_1.asApp().requestConfluence)), | ||
onConfluenceSpace: (spaceId) => getPropertiesInstance(new confluence_space_1.ConfluenceSpaceStorage(sanitizedKey(spaceId), index_1.asApp().requestConfluence)) | ||
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)) | ||
}; |
@@ -11,3 +11,3 @@ import { StorageAdapter } from './storage-adapter'; | ||
protected buildSetRequestOptions(requestBody: any, requestMethod: 'PUT' | 'POST'): { | ||
method: "PUT" | "POST"; | ||
method: "POST" | "PUT"; | ||
body: string; | ||
@@ -14,0 +14,0 @@ headers: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ProductScopedStorage = void 0; | ||
const errors_1 = require("../errors"); | ||
const storage_1 = require("@forge/storage"); | ||
class ProductScopedStorage { | ||
@@ -16,3 +16,3 @@ constructor(storageApiPath, apiClient) { | ||
} | ||
throw errors_1.APIError.forStatus(response.status); | ||
throw storage_1.APIError.forStatus(response.status); | ||
} | ||
@@ -25,3 +25,3 @@ const { value } = await response.json(); | ||
if (!response.ok) { | ||
throw errors_1.APIError.forStatus(response.status); | ||
throw storage_1.APIError.forStatus(response.status); | ||
} | ||
@@ -32,3 +32,3 @@ } | ||
if (!response.ok) { | ||
throw errors_1.APIError.forStatus(response.status); | ||
throw storage_1.APIError.forStatus(response.status); | ||
} | ||
@@ -35,0 +35,0 @@ } |
{ | ||
"name": "@forge/api", | ||
"version": "0.0.0-experimental-788b6d9", | ||
"version": "0.0.0-experimental-819498d", | ||
"description": "Forge API methods", | ||
@@ -9,3 +9,2 @@ "author": "Atlassian", | ||
"types": "out/index.d.ts", | ||
"files": ["out"], | ||
"scripts": { | ||
@@ -16,5 +15,2 @@ "build": "yarn run clean && yarn run compile", | ||
}, | ||
"engines": { | ||
"node": "^12" | ||
}, | ||
"devDependencies": { | ||
@@ -24,2 +20,3 @@ "@types/node": "^12.12.63" | ||
"dependencies": { | ||
"@forge/storage": "^0.0.0-experimental-819498d", | ||
"@types/node-fetch": "^2.5.7", | ||
@@ -26,0 +23,0 @@ "node-fetch": "^2.6.1" |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16538
2
33609
3
45
423
2
+ Added@forge/storage@0.0.0-experimental-f85f9b1(transitive)