Skip to content

Commit

Permalink
Merge pull request #5 from DevoInc/feature/add-application-param-in-a…
Browse files Browse the repository at this point in the history
…ddPragmas-function

Feature/add application param in add pragmas function
  • Loading branch information
adrianfega authored Jul 17, 2023
2 parents 5611987 + faec7e2 commit c877cc8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devoinc/applications-data-library",
"version": "2.0.2",
"version": "2.0.3",
"description": "Devo Applications Data Library",
"author": "Devo [email protected]",
"private": false,
Expand Down
4 changes: 4 additions & 0 deletions src/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 2.0.3

Add pragma "application" in the queries

## 2.0.2

updated dependencies to fixed vulnerabilities:
Expand Down
4 changes: 2 additions & 2 deletions src/requests/RequestApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class RequestApi extends Request {
this.stream = this.client.stream(
{
query: this.query
? addPragmas(this.query, this.componentId, this.vault)
? addPragmas(this.query, this.componentId, this.vault, this.application)
: null,
queryId: this.queryId ? this.queryId : null,
timestamp: moment().valueOf(),
Expand Down Expand Up @@ -162,7 +162,7 @@ export class RequestApi extends Request {
return {
from: this.dates.from / 1000,
to: this.dates.to / 1000,
query: this.query ? addPragmas(this.query, this.componentId) : null,
query: this.query ? addPragmas(this.query, this.componentId, null, this.application) : null,
queryId: this.queryId ? this.queryId : null,
limit: this.limit ? this.limit : null,
mode: { type: this.serrea_format },
Expand Down
6 changes: 3 additions & 3 deletions src/utils/request.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import user from '../utils/user';

export function addPragmas (query, componentId, vault) {
export function addPragmas (query, componentId, vault, application) {
let env = window.location.hostname.split('.')[0];
let clone = env.split('pre')[1];
let queryApp = application ? application : baseWeb.pageManager.currentPage;
return `${query}
pragma proc.vault.name: "${vault || user.getVault().name}"
pragma comment.application: "${baseWeb.pageManager.currentPage}"
pragma comment.application: "${queryApp}"
pragma comment.component: "${componentId || ''}"
pragma comment.user: "${user.getName()}"
pragma comment.email: "${user.getEmail()}"
Expand All @@ -15,7 +16,6 @@ export function addPragmas (query, componentId, vault) {
pragma comment.source: ${JSON.stringify(query)}
${lt.app ? `pragma comment.free:"${lt.app.appId}"` : ''}
`.trim().replace(/^\s*\n/gm, '');

}


Expand Down

0 comments on commit c877cc8

Please sign in to comment.