@monokle/synchronizer
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -52,3 +52,9 @@ import { SuppressionStatus } from '@monokle/types'; | ||
fingerprint: string; | ||
description: string; | ||
locations: string; | ||
status: SuppressionStatus; | ||
justification: string; | ||
expiresAt: string; | ||
updatedAt: string; | ||
createdAt: string; | ||
isUnderReview: boolean; | ||
@@ -59,2 +65,3 @@ isAccepted: boolean; | ||
isDeleted: boolean; | ||
repositoryId: string; | ||
}; | ||
@@ -84,2 +91,46 @@ export declare type ApiSuppressionsData = { | ||
}; | ||
export declare type ApiProjectPermissions = { | ||
project: { | ||
view: boolean; | ||
update: boolean; | ||
delete: boolean; | ||
}; | ||
members: { | ||
view: boolean; | ||
update: boolean; | ||
delete: boolean; | ||
}; | ||
repositories: { | ||
read: boolean; | ||
write: boolean; | ||
}; | ||
}; | ||
export declare type ApiProjectPermissionsData = { | ||
data: { | ||
getProject: { | ||
permissions: ApiProjectPermissions; | ||
}; | ||
}; | ||
}; | ||
export declare type ApiProjectDetailsData = { | ||
data: { | ||
getProject: { | ||
id: number; | ||
slug: string; | ||
name: string; | ||
projectRepository: ApiUserProjectRepo; | ||
permissions: ApiProjectPermissions; | ||
policy: { | ||
id: string; | ||
updatedAt: string; | ||
}; | ||
}; | ||
}; | ||
}; | ||
export declare type getProjectDetailsInput = { | ||
slug: string; | ||
owner: string; | ||
name: string; | ||
provider: string; | ||
}; | ||
export declare class ApiHandler { | ||
@@ -95,5 +146,8 @@ private _apiUrl; | ||
getProject(slug: string, tokenInfo: TokenInfo): Promise<ApiProjectData | undefined>; | ||
getProjectPermissions(slug: string, tokenInfo: TokenInfo): Promise<ApiProjectPermissionsData | undefined>; | ||
getProjectDetails(input: getProjectDetailsInput, tokenInfo: TokenInfo): Promise<ApiProjectDetailsData | undefined>; | ||
getPolicy(slug: string, tokenInfo: TokenInfo): Promise<ApiPolicyData | undefined>; | ||
getSuppressions(repositoryId: string, tokenInfo: TokenInfo): Promise<ApiSuppressionsData | undefined>; | ||
getSuppressions(repositoryId: string, tokenInfo: TokenInfo, from?: string): Promise<ApiSuppressionsData | undefined>; | ||
getRepoId(projectSlug: string, repoOwner: string, repoName: string, tokenInfo: TokenInfo): Promise<ApiRepoIdData | undefined>; | ||
toggleSuppression(fingerprint: string, repoId: string, description: string, tokenInfo: TokenInfo): Promise<ApiSuppressionsData | undefined>; | ||
generateDeepLink(path: string): string; | ||
@@ -100,0 +154,0 @@ queryApi<OUT>(query: string, tokenInfo: TokenInfo, variables?: {}): Promise<OUT | undefined>; |
@@ -61,2 +61,60 @@ "use strict"; | ||
`; | ||
const getProjectPermissionsQuery = ` | ||
query getProjectPermissions($slug: String!) { | ||
getProject(input: { slug: $slug }) { | ||
permissions { | ||
project { | ||
view | ||
update | ||
delete | ||
} | ||
members { | ||
view | ||
update | ||
delete | ||
} | ||
repositories { | ||
read | ||
write | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
const getProjectDetailsQuery = ` | ||
query getProjectDetails($slug: String!, $owner: String!, $name: String!, $provider: String!) { | ||
getProject(input: { slug: $slug }) { | ||
id | ||
name | ||
slug | ||
projectRepository: repository(input: { owner: $owner, name: $name, provider: $provider }) { | ||
id | ||
projectId | ||
provider | ||
owner | ||
name | ||
} | ||
permissions { | ||
project { | ||
view | ||
update | ||
delete | ||
} | ||
members { | ||
view | ||
update | ||
delete | ||
} | ||
repositories { | ||
read | ||
write | ||
} | ||
} | ||
policy { | ||
id | ||
updatedAt | ||
} | ||
} | ||
} | ||
`; | ||
const getPolicyQuery = ` | ||
@@ -76,7 +134,9 @@ query getPolicy($slug: String!) { | ||
query getSuppressions( | ||
$repositoryId: ID! | ||
$repositoryId: ID!, | ||
$from: String | ||
) { | ||
getSuppressions( | ||
input: { | ||
repositoryId: $repositoryId | ||
repositoryId: $repositoryId, | ||
from: $from | ||
} | ||
@@ -88,3 +148,9 @@ ) { | ||
fingerprint | ||
description | ||
location | ||
status | ||
justification | ||
expiresAt | ||
updatedAt | ||
createdAt | ||
isUnderReview | ||
@@ -95,2 +161,3 @@ isAccepted | ||
isDeleted | ||
repositoryId | ||
} | ||
@@ -109,2 +176,25 @@ } | ||
`; | ||
const toggleSuppressionMutation = ` | ||
mutation toggleSuppression($fingerprint: String!, $repoId: ID!, $description: String!) { | ||
toggleSuppression( | ||
input: {fingerprint: $fingerprint, repository: $repoId, description: $description, skipReview: true} | ||
) { | ||
id | ||
fingerprint | ||
description | ||
location | ||
status | ||
justification | ||
expiresAt | ||
updatedAt | ||
createdAt | ||
isUnderReview | ||
isAccepted | ||
isRejected | ||
isExpired | ||
isDeleted | ||
repositoryId | ||
} | ||
} | ||
`; | ||
class ApiHandler { | ||
@@ -147,2 +237,12 @@ constructor(_apiUrlOrOriginConfig = constants_js_1.DEFAULT_API_URL, clientConfig) { | ||
} | ||
getProjectPermissions(slug, tokenInfo) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queryApi(getProjectPermissionsQuery, tokenInfo, { slug }); | ||
}); | ||
} | ||
getProjectDetails(input, tokenInfo) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queryApi(getProjectDetailsQuery, tokenInfo, input); | ||
}); | ||
} | ||
getPolicy(slug, tokenInfo) { | ||
@@ -153,5 +253,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
getSuppressions(repositoryId, tokenInfo) { | ||
getSuppressions(repositoryId, tokenInfo, from) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queryApi(getSuppressionsQuery, tokenInfo, { repositoryId }); | ||
return this.queryApi(getSuppressionsQuery, tokenInfo, { repositoryId, from }); | ||
}); | ||
@@ -164,2 +264,7 @@ } | ||
} | ||
toggleSuppression(fingerprint, repoId, description, tokenInfo) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queryApi(toggleSuppressionMutation, tokenInfo, { fingerprint, repoId, description }); | ||
}); | ||
} | ||
generateDeepLink(path) { | ||
@@ -166,0 +271,0 @@ var _a; |
@@ -13,3 +13,4 @@ import envPaths from 'env-paths'; | ||
protected writeStoreData(file: string, data: string): Promise<void>; | ||
protected parseData(data: string): any; | ||
} | ||
export declare function getDefaultStorageConfigPaths(suffix?: string): envPaths.Paths; |
@@ -58,3 +58,3 @@ "use strict"; | ||
const data = (0, fs_1.readFileSync)(file, 'utf8'); | ||
const config = (0, yaml_1.parse)(data); | ||
const config = this.parseData(data); | ||
return config; | ||
@@ -73,3 +73,3 @@ } | ||
const data = yield (0, promises_1.readFile)(file, 'utf8'); | ||
const config = (0, yaml_1.parse)(data); | ||
const config = this.parseData(data); | ||
return config; | ||
@@ -94,2 +94,5 @@ } | ||
} | ||
parseData(data) { | ||
return (0, yaml_1.parse)(data); | ||
} | ||
} | ||
@@ -96,0 +99,0 @@ exports.StorageHandler = StorageHandler; |
@@ -7,2 +7,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './handlers/storageHandlerAuth.js'; | ||
export * from './handlers/storageHandlerJsonCache.js'; | ||
export * from './handlers/storageHandlerPolicy.js'; | ||
@@ -13,2 +14,3 @@ export * from './models/user.js'; | ||
export * from './utils/synchronizer.js'; | ||
export * from './utils/projectSynchronizer.js'; | ||
export * from './constants.js'; | ||
@@ -21,1 +23,2 @@ export * from './createDefaultMonokleAuthenticator.js'; | ||
export * from './createMonokleSynchronizer.js'; | ||
export * from './createMonokleProjectSynchronizer.js'; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./handlers/storageHandlerAuth.js"), exports); | ||
__exportStar(require("./handlers/storageHandlerJsonCache.js"), exports); | ||
__exportStar(require("./handlers/storageHandlerPolicy.js"), exports); | ||
@@ -29,2 +30,3 @@ __exportStar(require("./models/user.js"), exports); | ||
__exportStar(require("./utils/synchronizer.js"), exports); | ||
__exportStar(require("./utils/projectSynchronizer.js"), exports); | ||
__exportStar(require("./constants.js"), exports); | ||
@@ -37,1 +39,2 @@ __exportStar(require("./createDefaultMonokleAuthenticator.js"), exports); | ||
__exportStar(require("./createMonokleSynchronizer.js"), exports); | ||
__exportStar(require("./createMonokleProjectSynchronizer.js"), exports); |
@@ -30,2 +30,5 @@ /// <reference types="node" /> | ||
}; | ||
/** | ||
* @deprecated ProjectSynchronizer should be used instead if possible. | ||
*/ | ||
export declare class Synchronizer extends EventEmitter { | ||
@@ -32,0 +35,0 @@ private _storageHandler; |
@@ -18,2 +18,5 @@ "use strict"; | ||
const events_1 = require("events"); | ||
/** | ||
* @deprecated ProjectSynchronizer should be used instead if possible. | ||
*/ | ||
class Synchronizer extends events_1.EventEmitter { | ||
@@ -20,0 +23,0 @@ constructor(_storageHandler, _apiHandler, _gitHandler) { |
@@ -52,3 +52,9 @@ import { SuppressionStatus } from '@monokle/types'; | ||
fingerprint: string; | ||
description: string; | ||
locations: string; | ||
status: SuppressionStatus; | ||
justification: string; | ||
expiresAt: string; | ||
updatedAt: string; | ||
createdAt: string; | ||
isUnderReview: boolean; | ||
@@ -59,2 +65,3 @@ isAccepted: boolean; | ||
isDeleted: boolean; | ||
repositoryId: string; | ||
}; | ||
@@ -84,2 +91,46 @@ export declare type ApiSuppressionsData = { | ||
}; | ||
export declare type ApiProjectPermissions = { | ||
project: { | ||
view: boolean; | ||
update: boolean; | ||
delete: boolean; | ||
}; | ||
members: { | ||
view: boolean; | ||
update: boolean; | ||
delete: boolean; | ||
}; | ||
repositories: { | ||
read: boolean; | ||
write: boolean; | ||
}; | ||
}; | ||
export declare type ApiProjectPermissionsData = { | ||
data: { | ||
getProject: { | ||
permissions: ApiProjectPermissions; | ||
}; | ||
}; | ||
}; | ||
export declare type ApiProjectDetailsData = { | ||
data: { | ||
getProject: { | ||
id: number; | ||
slug: string; | ||
name: string; | ||
projectRepository: ApiUserProjectRepo; | ||
permissions: ApiProjectPermissions; | ||
policy: { | ||
id: string; | ||
updatedAt: string; | ||
}; | ||
}; | ||
}; | ||
}; | ||
export declare type getProjectDetailsInput = { | ||
slug: string; | ||
owner: string; | ||
name: string; | ||
provider: string; | ||
}; | ||
export declare class ApiHandler { | ||
@@ -95,5 +146,8 @@ private _apiUrl; | ||
getProject(slug: string, tokenInfo: TokenInfo): Promise<ApiProjectData | undefined>; | ||
getProjectPermissions(slug: string, tokenInfo: TokenInfo): Promise<ApiProjectPermissionsData | undefined>; | ||
getProjectDetails(input: getProjectDetailsInput, tokenInfo: TokenInfo): Promise<ApiProjectDetailsData | undefined>; | ||
getPolicy(slug: string, tokenInfo: TokenInfo): Promise<ApiPolicyData | undefined>; | ||
getSuppressions(repositoryId: string, tokenInfo: TokenInfo): Promise<ApiSuppressionsData | undefined>; | ||
getSuppressions(repositoryId: string, tokenInfo: TokenInfo, from?: string): Promise<ApiSuppressionsData | undefined>; | ||
getRepoId(projectSlug: string, repoOwner: string, repoName: string, tokenInfo: TokenInfo): Promise<ApiRepoIdData | undefined>; | ||
toggleSuppression(fingerprint: string, repoId: string, description: string, tokenInfo: TokenInfo): Promise<ApiSuppressionsData | undefined>; | ||
generateDeepLink(path: string): string; | ||
@@ -100,0 +154,0 @@ queryApi<OUT>(query: string, tokenInfo: TokenInfo, variables?: {}): Promise<OUT | undefined>; |
@@ -46,2 +46,60 @@ import normalizeUrl from 'normalize-url'; | ||
`; | ||
const getProjectPermissionsQuery = ` | ||
query getProjectPermissions($slug: String!) { | ||
getProject(input: { slug: $slug }) { | ||
permissions { | ||
project { | ||
view | ||
update | ||
delete | ||
} | ||
members { | ||
view | ||
update | ||
delete | ||
} | ||
repositories { | ||
read | ||
write | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
const getProjectDetailsQuery = ` | ||
query getProjectDetails($slug: String!, $owner: String!, $name: String!, $provider: String!) { | ||
getProject(input: { slug: $slug }) { | ||
id | ||
name | ||
slug | ||
projectRepository: repository(input: { owner: $owner, name: $name, provider: $provider }) { | ||
id | ||
projectId | ||
provider | ||
owner | ||
name | ||
} | ||
permissions { | ||
project { | ||
view | ||
update | ||
delete | ||
} | ||
members { | ||
view | ||
update | ||
delete | ||
} | ||
repositories { | ||
read | ||
write | ||
} | ||
} | ||
policy { | ||
id | ||
updatedAt | ||
} | ||
} | ||
} | ||
`; | ||
const getPolicyQuery = ` | ||
@@ -61,7 +119,9 @@ query getPolicy($slug: String!) { | ||
query getSuppressions( | ||
$repositoryId: ID! | ||
$repositoryId: ID!, | ||
$from: String | ||
) { | ||
getSuppressions( | ||
input: { | ||
repositoryId: $repositoryId | ||
repositoryId: $repositoryId, | ||
from: $from | ||
} | ||
@@ -73,3 +133,9 @@ ) { | ||
fingerprint | ||
description | ||
location | ||
status | ||
justification | ||
expiresAt | ||
updatedAt | ||
createdAt | ||
isUnderReview | ||
@@ -80,2 +146,3 @@ isAccepted | ||
isDeleted | ||
repositoryId | ||
} | ||
@@ -94,2 +161,25 @@ } | ||
`; | ||
const toggleSuppressionMutation = ` | ||
mutation toggleSuppression($fingerprint: String!, $repoId: ID!, $description: String!) { | ||
toggleSuppression( | ||
input: {fingerprint: $fingerprint, repository: $repoId, description: $description, skipReview: true} | ||
) { | ||
id | ||
fingerprint | ||
description | ||
location | ||
status | ||
justification | ||
expiresAt | ||
updatedAt | ||
createdAt | ||
isUnderReview | ||
isAccepted | ||
isRejected | ||
isExpired | ||
isDeleted | ||
repositoryId | ||
} | ||
} | ||
`; | ||
export class ApiHandler { | ||
@@ -131,7 +221,13 @@ _apiUrl; | ||
} | ||
async getProjectPermissions(slug, tokenInfo) { | ||
return this.queryApi(getProjectPermissionsQuery, tokenInfo, { slug }); | ||
} | ||
async getProjectDetails(input, tokenInfo) { | ||
return this.queryApi(getProjectDetailsQuery, tokenInfo, input); | ||
} | ||
async getPolicy(slug, tokenInfo) { | ||
return this.queryApi(getPolicyQuery, tokenInfo, { slug }); | ||
} | ||
async getSuppressions(repositoryId, tokenInfo) { | ||
return this.queryApi(getSuppressionsQuery, tokenInfo, { repositoryId }); | ||
async getSuppressions(repositoryId, tokenInfo, from) { | ||
return this.queryApi(getSuppressionsQuery, tokenInfo, { repositoryId, from }); | ||
} | ||
@@ -141,2 +237,5 @@ async getRepoId(projectSlug, repoOwner, repoName, tokenInfo) { | ||
} | ||
async toggleSuppression(fingerprint, repoId, description, tokenInfo) { | ||
return this.queryApi(toggleSuppressionMutation, tokenInfo, { fingerprint, repoId, description }); | ||
} | ||
generateDeepLink(path) { | ||
@@ -143,0 +242,0 @@ let appUrl = this._originConfig?.origin; |
@@ -13,3 +13,4 @@ import envPaths from 'env-paths'; | ||
protected writeStoreData(file: string, data: string): Promise<void>; | ||
protected parseData(data: string): any; | ||
} | ||
export declare function getDefaultStorageConfigPaths(suffix?: string): envPaths.Paths; |
@@ -38,3 +38,3 @@ import envPaths from 'env-paths'; | ||
const data = readFileSync(file, 'utf8'); | ||
const config = parse(data); | ||
const config = this.parseData(data); | ||
return config; | ||
@@ -52,3 +52,3 @@ } | ||
const data = await readFile(file, 'utf8'); | ||
const config = parse(data); | ||
const config = this.parseData(data); | ||
return config; | ||
@@ -70,2 +70,5 @@ } | ||
} | ||
parseData(data) { | ||
return parse(data); | ||
} | ||
} | ||
@@ -72,0 +75,0 @@ export function getDefaultStorageConfigPaths(suffix = '') { |
@@ -7,2 +7,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './handlers/storageHandlerAuth.js'; | ||
export * from './handlers/storageHandlerJsonCache.js'; | ||
export * from './handlers/storageHandlerPolicy.js'; | ||
@@ -13,2 +14,3 @@ export * from './models/user.js'; | ||
export * from './utils/synchronizer.js'; | ||
export * from './utils/projectSynchronizer.js'; | ||
export * from './constants.js'; | ||
@@ -21,1 +23,2 @@ export * from './createDefaultMonokleAuthenticator.js'; | ||
export * from './createMonokleSynchronizer.js'; | ||
export * from './createMonokleProjectSynchronizer.js'; |
@@ -7,2 +7,3 @@ export * from './handlers/apiHandler.js'; | ||
export * from './handlers/storageHandlerAuth.js'; | ||
export * from './handlers/storageHandlerJsonCache.js'; | ||
export * from './handlers/storageHandlerPolicy.js'; | ||
@@ -13,2 +14,3 @@ export * from './models/user.js'; | ||
export * from './utils/synchronizer.js'; | ||
export * from './utils/projectSynchronizer.js'; | ||
export * from './constants.js'; | ||
@@ -21,1 +23,2 @@ export * from './createDefaultMonokleAuthenticator.js'; | ||
export * from './createMonokleSynchronizer.js'; | ||
export * from './createMonokleProjectSynchronizer.js'; |
@@ -30,2 +30,5 @@ /// <reference types="node" /> | ||
}; | ||
/** | ||
* @deprecated ProjectSynchronizer should be used instead if possible. | ||
*/ | ||
export declare class Synchronizer extends EventEmitter { | ||
@@ -32,0 +35,0 @@ private _storageHandler; |
import slugify from 'slugify'; | ||
import { EventEmitter } from 'events'; | ||
/** | ||
* @deprecated ProjectSynchronizer should be used instead if possible. | ||
*/ | ||
export class Synchronizer extends EventEmitter { | ||
@@ -4,0 +7,0 @@ _storageHandler; |
{ | ||
"name": "@monokle/synchronizer", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "Monokle Cloud synchronizer", | ||
@@ -5,0 +5,0 @@ "author": "Kubeshop", |
290299
102
6397
7