Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@forge/api

Package Overview
Dependencies
Maintainers
8
Versions
360
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forge/api - npm Package Compare versions

Comparing version 0.0.0-experimental-3ab06ec to 0.0.0-experimental-4e6084f

out/properties/sanitized-key.d.ts

63

CHANGELOG.md
# @forge/api
## 0.0.0-experimental-3ab06ec
## 0.0.0-experimental-4e6084f
### Minor Changes
- 8e5fe0f: Remove engines.node declaration
### Patch Changes
- Updated dependencies [8e5fe0f]
- @forge/storage@0.0.0-experimental-4e6084f
## 1.2.0
### Minor Changes
- 2ede277: Add new getWebTriggerUrl runtime API method
### Patch Changes
- b0ae6aa: Fix properties onConfluenceSpace for personal spaces
- Updated dependencies [9b496aa]
- @forge/storage@1.0.3
## 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

@@ -10,0 +71,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))
})
};
};

14

out/index.d.ts
import { RequestInit, Response } from 'node-fetch';
import { webTrigger } from './webTrigger';
import { QueryApi } from '@forge/storage';

@@ -10,2 +11,5 @@ export declare type APIResponse = Pick<Response, 'json' | 'text' | 'arrayBuffer' | 'ok' | 'status' | 'statusText' | 'headers'>;

}
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;

@@ -53,5 +57,5 @@ declare const requestJira: FetchMethod;

export default API;
export { asUser, asApp, fetch, requestJira, requestConfluence, store, storage, properties };
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 = exports.privacy = 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 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");

@@ -8,0 +10,0 @@ function withDeprecatedMessage(method, message) {

@@ -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: {

{
"name": "@forge/api",
"version": "0.0.0-experimental-3ab06ec",
"version": "0.0.0-experimental-4e6084f",
"description": "Forge API methods",

@@ -14,5 +14,2 @@ "author": "Atlassian",

},
"engines": {
"node": "^12"
},
"devDependencies": {

@@ -22,3 +19,3 @@ "@types/node": "^12.12.63"

"dependencies": {
"@forge/storage": "^1.0.1",
"@forge/storage": "^0.0.0-experimental-4e6084f",
"@types/node-fetch": "^2.5.7",

@@ -25,0 +22,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc