Compare commits

..

1 Commits

Author SHA1 Message Date
Rainer Killinger
86004881b0 fix: update node-glob dependency 2026-01-05 10:44:02 +01:00
14 changed files with 115 additions and 207 deletions

View File

@@ -0,0 +1,8 @@
---
"@openstapps/projectmanagement": patch
"@openstapps/core-tools": patch
"@openstapps/easy-ast": patch
"@openstapps/app": patch
---
Updated node-glob dependency

View File

@@ -106,9 +106,6 @@
"entry": [
"src/cli.ts"
],
"loader": {
".groovy": "text"
},
"sourcemap": true,
"clean": true,
"target": "es2022",

View File

@@ -1,65 +0,0 @@
void traverse(def a, def b, ArrayList path, HashMap result) {
if (a instanceof Map && b instanceof Map) {
for (key in a.keySet()) {
path.add(key);
traverse(a.get(key), b.get(key), path, result);
path.remove(path.size() - 1);
}
} else if (a instanceof List && b instanceof List) {
int la = a.size();
int lb = b.size();
int max = la > lb ? la : lb;
for (int i = 0; i < max; i++) {
path.add(i);
if (i < la && i < lb) {
traverse(a[i], b[i], path, result);
} else if (i >= la) {
result.added.add(path.toArray());
} else {
result.removed.add(path.toArray());
}
path.remove(path.size() - 1);
}
} else if (a == null && b != null) {
result.removed.add(path.toArray());
} else if (a != null && b == null) {
result.added.add(path.toArray());
} else if (!a.equals(b)) {
result.changed.add(path.toArray());
}
}
def to;
def from;
for (state in states) {
if (state.index.equals(params.newIndex)) {
to = state.doc;
} else {
from = state.doc;
}
}
HashMap result = [
'added': [],
'removed': [],
'changed': []
];
traverse(to, from, new ArrayList(), result);
if (to == null && from != null) {
result.status = 'removed';
} else if (to != null && from == null) {
result.status = 'added';
} else if (
result.added.size() == 0 &&
result.removed.size() == 0 &&
result.changed.size() == 0
) {
result.status = 'unchanged';
} else {
result.status = 'changed';
}
return result;

View File

@@ -47,7 +47,6 @@ import {
import {noUndefined} from './util/no-undefined.js';
import {retryCatch, RetryOptions} from './util/retry.js';
import {Feature, Point, Polygon} from 'geojson';
import indexDiffScript from './diff-index.groovy';
/**
* A database interface for elasticsearch
@@ -240,42 +239,6 @@ export class Elasticsearch implements Database {
.then(it => Object.entries(it).map(([name]) => name))
.catch(() => [] as string[]);
if (activeIndices.length <= 1) {
const result = await this.client.transform.previewTransform({
source: {
index: [...activeIndices, index],
query: {match_all: {}},
},
dest: {index: 'compare'},
pivot: {
group_by: {
uid: {terms: {field: 'uid.raw'}},
},
aggregations: {
compare: {
scripted_metric: {
map_script: `
state.index = doc['_index'];
state.doc = params['_source'];`,
combine_script: `
state.index = state.index[0];
return state;
`,
reduce_script: {
source: indexDiffScript,
params: {
newIndex: index,
},
},
},
},
},
},
});
console.log(JSON.stringify(result.preview, null, 2))
}
await this.client.indices.updateAliases({
actions: [
{

View File

@@ -1,26 +0,0 @@
// initialize the sort value with the maximum
double price = Double.MAX_VALUE;
// if we have any offers
if (params._source.containsKey(params.field)) {
// iterate through all offers
for (offer in params._source[params.field]) {
// if this offer contains a role specific price
if (offer.containsKey('prices') && offer.prices.containsKey(params.universityRole)) {
// if the role specific price is smaller than the cheapest we found
if (offer.prices[params.universityRole] < price) {
// set the role specific price as cheapest for now
price = offer.prices[params.universityRole];
}
} else { // we have no role specific price for our role in this offer
// if the default price of this offer is lower than the cheapest we found
if (offer.price < price) {
// set this price as the cheapest
price = offer.price;
}
}
}
}
// return cheapest price for our role
return price;

View File

@@ -13,8 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SortOptions} from '@elastic/elasticsearch/lib/api/types.js';
import {SCPriceSort} from '@openstapps/core';
import priceSortScript from './price-sort.groovy';
import {SCPriceSort, SCSportCoursePriceGroup, SCThingsField} from '@openstapps/core';
/**
* Converts a price sort to elasticsearch syntax
@@ -24,11 +23,47 @@ export function buildPriceSort(sort: SCPriceSort): SortOptions {
return {
_script: {
order: sort.order,
script: {
source: priceSortScript,
params: sort.arguments,
},
script: buildPriceSortScript(sort.arguments.universityRole, sort.arguments.field),
type: 'number' as const,
},
};
}
/**
* Provides a script for sorting search results by prices
* @param universityRole User group which consumes university services
* @param field Field in which wanted offers with prices are located
*/
export function buildPriceSortScript(
universityRole: keyof SCSportCoursePriceGroup,
field: SCThingsField,
): string {
return `
// initialize the sort value with the maximum
double price = Double.MAX_VALUE;
// if we have any offers
if (params._source.containsKey('${field}')) {
// iterate through all offers
for (offer in params._source.${field}) {
// if this offer contains a role specific price
if (offer.containsKey('prices') && offer.prices.containsKey('${universityRole}')) {
// if the role specific price is smaller than the cheapest we found
if (offer.prices.${universityRole} < price) {
// set the role specific price as cheapest for now
price = offer.prices.${universityRole};
}
} else { // we have no role specific price for our role in this offer
// if the default price of this offer is lower than the cheapest we found
if (offer.price < price) {
// set this price as the cheapest
price = offer.price;
}
}
}
}
// return cheapest price for our role
return price;
`;
}

View File

@@ -1,6 +0,0 @@
declare module '*.groovy' {
const content: string;
export default content;
}
export {};

View File

@@ -43,7 +43,7 @@
"@openstapps/logger": "workspace:*",
"commander": "10.0.0",
"date-fns": "3.6.0",
"glob": "10.3.10",
"glob": "10.5.0",
"mustache": "4.2.0"
},
"devDependencies": {

0
examples/minimal-connector/app.js Executable file → Normal file
View File

View File

@@ -159,7 +159,7 @@
"eslint-plugin-unicorn": "51.0.1",
"fast-deep-equal": "3.1.3",
"fontkit": "2.0.2",
"glob": "10.3.10",
"glob": "10.5.0",
"http-server": "14.1.1",
"is-docker": "2.2.1",
"jasmine-core": "5.1.2",

View File

@@ -34,7 +34,7 @@
"@changesets/cli": "2.26.1",
"deepmerge": "4.3.1",
"dotenv-cli": "7.2.1",
"glob": "10.3.10",
"glob": "10.5.0",
"http-server": "14.1.1",
"junit-report-merger": "6.0.3",
"merge-cobertura": "1.0.1",

View File

@@ -55,7 +55,7 @@
"del": "6.1.1",
"flatted": "3.2.7",
"fs-extra": "10.1.0",
"glob": "10.3.10",
"glob": "10.5.0",
"got": "12.6.0",
"humanize-string": "3.0.0",
"json-schema": "0.4.0",

View File

@@ -25,7 +25,7 @@
"dependencies": {
"@openstapps/collection-utils": "workspace:*",
"@openstapps/logger": "workspace:*",
"glob": "10.3.10",
"glob": "10.5.0",
"typescript": "5.4.2"
},
"devDependencies": {

120
pnpm-lock.yaml generated
View File

@@ -23,8 +23,8 @@ importers:
specifier: 7.2.1
version: 7.2.1
glob:
specifier: 10.3.10
version: 10.3.10
specifier: 10.5.0
version: 10.5.0
http-server:
specifier: 14.1.1
version: 14.1.1
@@ -451,8 +451,8 @@ importers:
specifier: 3.6.0
version: 3.6.0
glob:
specifier: 10.3.10
version: 10.3.10
specifier: 10.5.0
version: 10.5.0
mustache:
specifier: 4.2.0
version: 4.2.0
@@ -1029,8 +1029,8 @@ importers:
specifier: 2.0.2
version: 2.0.2
glob:
specifier: 10.3.10
version: 10.3.10
specifier: 10.5.0
version: 10.5.0
http-server:
specifier: 14.1.1
version: 14.1.1
@@ -1650,8 +1650,8 @@ importers:
specifier: 10.1.0
version: 10.1.0
glob:
specifier: 10.3.10
version: 10.3.10
specifier: 10.5.0
version: 10.5.0
got:
specifier: 12.6.0
version: 12.6.0
@@ -1768,8 +1768,8 @@ importers:
specifier: workspace:*
version: link:../logger
glob:
specifier: 10.3.10
version: 10.3.10
specifier: 10.5.0
version: 10.5.0
typescript:
specifier: 5.4.2
version: 5.4.2
@@ -6471,6 +6471,15 @@ packages:
supports-color:
optional: true
debug@4.4.3:
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
debuglog@1.0.1:
resolution: {integrity: sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==}
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
@@ -7406,13 +7415,8 @@ packages:
glob-to-regexp@0.4.1:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
glob@10.3.10:
resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==}
engines: {node: '>=16 || 14 >=14.17'}
hasBin: true
glob@10.4.5:
resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
glob@10.5.0:
resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==}
hasBin: true
glob@11.0.3:
@@ -7615,6 +7619,10 @@ packages:
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
engines: {node: '>= 0.8'}
http-errors@2.0.1:
resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}
engines: {node: '>= 0.8'}
http-parser-js@0.5.10:
resolution: {integrity: sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==}
@@ -8126,10 +8134,6 @@ packages:
resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==}
engines: {node: '>=8'}
jackspeak@2.3.6:
resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==}
engines: {node: '>=14'}
jackspeak@3.4.3:
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
@@ -8817,9 +8821,9 @@ packages:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
mime-types@3.0.1:
resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==}
engines: {node: '>= 0.6'}
mime-types@3.0.2:
resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==}
engines: {node: '>=18'}
mime@1.6.0:
resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
@@ -10326,8 +10330,8 @@ packages:
resolution: {integrity: sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==}
engines: {node: '>= 0.8.0'}
send@1.2.0:
resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}
send@1.2.1:
resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==}
engines: {node: '>= 18'}
serialize-javascript@6.0.2:
@@ -14018,7 +14022,7 @@ snapshots:
fancy-log: 2.0.0
fast-glob: 3.3.3
fs-extra: 11.3.1
glob: 10.3.10
glob: 10.5.0
handlebars: 4.7.8
html-entities: 2.6.0
i18next: 23.16.8
@@ -14061,7 +14065,7 @@ snapshots:
object-assign: 4.1.1
open: 8.4.0
proxy-middleware: 0.15.0
send: 1.2.0
send: 1.2.1
serve-index: 1.9.1
transitivePeerDependencies:
- supports-color
@@ -14708,7 +14712,7 @@ snapshots:
dependencies:
'@ionic/utils-object': 2.1.6
'@ionic/utils-terminal': 2.3.4
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
signal-exit: 3.0.7
tree-kill: 1.2.2
tslib: 2.6.2
@@ -14728,7 +14732,7 @@ snapshots:
'@ionic/utils-stream@3.1.6':
dependencies:
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
tslib: 2.6.2
transitivePeerDependencies:
- supports-color
@@ -14769,7 +14773,7 @@ snapshots:
'@ionic/utils-terminal@2.3.4':
dependencies:
'@types/slice-ansi': 4.0.0
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
signal-exit: 3.0.7
slice-ansi: 4.0.0
string-width: 4.2.3
@@ -15058,7 +15062,7 @@ snapshots:
'@npmcli/package-json@5.2.1':
dependencies:
'@npmcli/git': 5.0.8
glob: 10.3.10
glob: 10.5.0
hosted-git-info: 7.0.2
json-parse-even-better-errors: 3.0.2
normalize-package-data: 6.0.2
@@ -16613,7 +16617,7 @@ snapshots:
dependencies:
'@npmcli/fs': 3.1.1
fs-minipass: 3.0.3
glob: 10.3.10
glob: 10.5.0
lru-cache: 10.4.3
minipass: 7.1.2
minipass-collect: 2.0.1
@@ -17606,6 +17610,10 @@ snapshots:
optionalDependencies:
supports-color: 8.1.1
debug@4.4.3:
dependencies:
ms: 2.1.3
debuglog@1.0.1: {}
decache@4.6.2:
@@ -18731,7 +18739,7 @@ snapshots:
dependencies:
basic-ftp: 5.0.5
data-uri-to-buffer: 6.0.2
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
transitivePeerDependencies:
- supports-color
@@ -18783,15 +18791,7 @@ snapshots:
glob-to-regexp@0.4.1: {}
glob@10.3.10:
dependencies:
foreground-child: 3.3.1
jackspeak: 2.3.6
minimatch: 9.0.5
minipass: 7.1.2
path-scurry: 1.11.1
glob@10.4.5:
glob@10.5.0:
dependencies:
foreground-child: 3.3.1
jackspeak: 3.4.3
@@ -19033,6 +19033,14 @@ snapshots:
statuses: 2.0.1
toidentifier: 1.0.1
http-errors@2.0.1:
dependencies:
depd: 2.0.0
inherits: 2.0.4
setprototypeof: 1.2.0
statuses: 2.0.2
toidentifier: 1.0.1
http-parser-js@0.5.10: {}
http-proxy-agent@7.0.2:
@@ -19558,12 +19566,6 @@ snapshots:
html-escaper: 2.0.2
istanbul-lib-report: 3.0.1
jackspeak@2.3.6:
dependencies:
'@isaacs/cliui': 8.0.2
optionalDependencies:
'@pkgjs/parseargs': 0.11.0
jackspeak@3.4.3:
dependencies:
'@isaacs/cliui': 8.0.2
@@ -20470,7 +20472,7 @@ snapshots:
dependencies:
mime-db: 1.52.0
mime-types@3.0.1:
mime-types@3.0.2:
dependencies:
mime-db: 1.54.0
@@ -20842,7 +20844,7 @@ snapshots:
dependencies:
env-paths: 2.2.1
exponential-backoff: 3.1.2
glob: 10.3.10
glob: 10.5.0
graceful-fs: 4.2.11
make-fetch-happen: 13.0.1
nopt: 7.2.1
@@ -21883,7 +21885,7 @@ snapshots:
rimraf@5.0.0:
dependencies:
glob: 10.3.10
glob: 10.5.0
rimraf@6.0.1:
dependencies:
@@ -22101,15 +22103,15 @@ snapshots:
transitivePeerDependencies:
- supports-color
send@1.2.0:
send@1.2.1:
dependencies:
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
encodeurl: 2.0.0
escape-html: 1.0.3
etag: 1.8.1
fresh: 2.0.0
http-errors: 2.0.0
mime-types: 3.0.1
http-errors: 2.0.1
mime-types: 3.0.2
ms: 2.1.3
on-finished: 2.4.1
range-parser: 1.2.1
@@ -22761,7 +22763,7 @@ snapshots:
dependencies:
'@jridgewell/gen-mapping': 0.3.8
commander: 4.1.1
glob: 10.3.10
glob: 10.5.0
lines-and-columns: 1.2.4
mz: 2.7.0
pirates: 4.0.7
@@ -22991,7 +22993,7 @@ snapshots:
test-exclude@7.0.1:
dependencies:
'@istanbuljs/schema': 0.1.3
glob: 10.4.5
glob: 10.5.0
minimatch: 9.0.5
text-decoder@1.2.3:
@@ -23217,7 +23219,7 @@ snapshots:
tuf-js@2.2.1:
dependencies:
'@tufjs/models': 2.0.1
debug: 4.4.1(supports-color@8.1.1)
debug: 4.4.3
make-fetch-happen: 13.0.1
transitivePeerDependencies:
- supports-color