renovate 42.6.2 → 42.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105,6 +105,7 @@
105
105
  "contentful-rich-text": "https://github.com/contentful/rich-text",
106
106
  "cspell": "https://github.com/streetsidesoftware/cspell",
107
107
  "datadog-browser-sdk": "https://github.com/DataDog/browser-sdk",
108
+ "datafusion": "https://github.com/apache/datafusion",
108
109
  "datatables-net": [
109
110
  "https://github.com/DataTables/Dist-DataTables",
110
111
  "https://github.com/DataTables/Dist-DataTables-Bootstrap",
@@ -27,7 +27,8 @@ class BbsPrCache {
27
27
  repoCache.platform.bitbucketServer ??= {};
28
28
  let pullRequestCache = repoCache.platform.bitbucketServer
29
29
  .pullRequestsCache;
30
- if (pullRequestCache?.author !== author) {
30
+ if ((0, is_1.isNullOrUndefined)(pullRequestCache) ||
31
+ pullRequestCache.author !== author) {
31
32
  pullRequestCache = {
32
33
  items: {},
33
34
  updatedDate: null,
@@ -1 +1 @@
1
- {"version":3,"file":"pr-cache.js","sourceRoot":"","sources":["../../../../lib/modules/platform/bitbucket-server/pr-cache.ts"],"names":[],"mappings":";;;;AAAA,yCAA4C;AAC5C,mCAAgC;AAChC,iCAAiC;AACjC,4CAAyC;AACzC,6EAAuD;AACvD,+DAA0D;AAE1D,2CAAmD;AAEnD,mCAAiC;AAEjC,MAAa,UAAU;IAKX;IACA;IACS;IACT;IAPF,KAAK,CAAiB;IACtB,KAAK,GAAY,EAAE,CAAC;IAE5B,YACU,UAAkB,EAClB,IAAY,EACH,cAAuB,EAChC,MAAqB;QAHrB,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACH,mBAAc,GAAd,cAAc,CAAS;QAChC,WAAM,GAAN,MAAM,CAAe;QAE7B,MAAM,SAAS,GAAG,IAAA,qBAAQ,GAAE,CAAC;QAC7B,SAAS,CAAC,QAAQ,KAAK,EAAE,CAAC;QAC1B,SAAS,CA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CAAC;YACzD,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,IAAI,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACK,WAAW;QACjB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;CACF;AAvKD,gCAuKC","sourcesContent":["import { isString } from '@sindresorhus/is';\nimport { dequal } from 'dequal';\nimport { DateTime } from 'luxon';\nimport { logger } from '../../../logger';\nimport * as memCache from '../../../util/cache/memory';\nimport { getCache } from '../../../util/cache/repository';\nimport type { BitbucketServerHttp } from '../../../util/http/bitbucket-server';\nimport { getQueryString } from '../../../util/url';\nimport type { BbsPr, BbsPrCacheData, BbsRestPr } from './types';\nimport { prInfo } from './utils';\n\nexport class BbsPrCache {\n private cache: BbsPrCacheData;\n private items: BbsPr[] = [];\n\n private constructor(\n private projectKey: string,\n private repo: string,\n private readonly ignorePrAuthor: boolean,\n private author: string | null,\n ) {\n const repoCache = getCache();\n repoCache.platform ??= {};\n repoCache.platform.bitbucketServer ??= {};\n let pullRequestCache = repoCache.platform.bitbucketServer\n .pullRequestsCache as BbsPrCacheData;\n if (pullRequestCache?.author !== author) {\n pullRequestCache = {\n items: {},\n updatedDate: null,\n author,\n };\n }\n repoCache.platform.bitbucketServer.pullRequestsCache = pullRequestCache;\n this.cache = pullRequestCache;\n this.updateItems();\n }\n\n private static async init(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string | null,\n ): Promise<BbsPrCache> {\n const res = new BbsPrCache(projectKey, repo, ignorePrAuthor, author);\n const isSynced = memCache.get<true | undefined>('bbs-pr-cache-synced');\n\n if (!isSynced) {\n await res.sync(http);\n memCache.set('bbs-pr-cache-synced', true);\n }\n\n return res;\n }\n\n private getPrs(): BbsPr[] {\n return this.items;\n }\n\n static async getPrs(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string,\n ): Promise<BbsPr[]> {\n const prCache = await BbsPrCache.init(\n http,\n projectKey,\n repo,\n ignorePrAuthor,\n author,\n );\n return prCache.getPrs();\n }\n\n private setPr(item: BbsPr): void {\n this.cache.items[item.number] = item;\n this.updateItems();\n }\n\n static async setPr(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string,\n item: BbsPr,\n ): Promise<void> {\n const prCache = await BbsPrCache.init(\n http,\n projectKey,\n repo,\n ignorePrAuthor,\n author,\n );\n prCache.setPr(item);\n }\n\n private reconcile(rawItems: BbsRestPr[]): boolean {\n logger.debug('reconciled');\n const { items } = this.cache;\n let { updatedDate } = this.cache;\n const cacheTime = updatedDate ? DateTime.fromMillis(updatedDate) : null;\n\n let needNextPage = true;\n\n for (const rawItem of rawItems) {\n const id = rawItem.id;\n\n const newItem = prInfo(rawItem);\n\n const oldItem = items[id];\n if (dequal(oldItem, newItem)) {\n needNextPage = false;\n continue;\n }\n\n items[id] = newItem;\n\n const itemTime = DateTime.fromMillis(rawItem.updatedDate);\n if (!cacheTime || itemTime > cacheTime) {\n updatedDate = rawItem.updatedDate;\n }\n }\n\n this.cache.updatedDate = updatedDate;\n\n return needNextPage;\n }\n\n private async sync(http: BitbucketServerHttp): Promise<BbsPrCache> {\n const searchParams: Record<string, string> = {\n state: 'ALL',\n limit: this.items.length ? '20' : '100',\n };\n if (!this.ignorePrAuthor && isString(this.author)) {\n searchParams['role.1'] = 'AUTHOR';\n searchParams['username.1'] = this.author;\n }\n let query: string | null = getQueryString(searchParams);\n\n while (query) {\n const res = await http.getJsonUnchecked<{\n nextPageStart: string;\n values: BbsRestPr[];\n }>(\n `./rest/api/1.0/projects/${this.projectKey}/repos/${this.repo}/pull-requests?${query}`,\n {\n memCache: false,\n },\n );\n\n const needNextPage = this.reconcile(res.body.values);\n if (!needNextPage) {\n break;\n }\n\n if (res.body.nextPageStart) {\n searchParams.start = res.body.nextPageStart.toString();\n } else {\n query = null;\n }\n }\n\n this.updateItems();\n\n return this;\n }\n\n /**\n * Ensure the pr cache starts with the most recent PRs.\n * JavaScript ensures that the cache is sorted by PR number.\n */\n private updateItems(): void {\n this.items = Object.values(this.cache.items).reverse();\n }\n}\n"]}
1
+ {"version":3,"file":"pr-cache.js","sourceRoot":"","sources":["../../../../lib/modules/platform/bitbucket-server/pr-cache.ts"],"names":[],"mappings":";;;;AAAA,yCAA+D;AAC/D,mCAAgC;AAChC,iCAAiC;AACjC,4CAAyC;AACzC,6EAAuD;AACvD,+DAA0D;AAE1D,2CAAmD;AAEnD,mCAAiC;AAEjC,MAAa,UAAU;IAKX;IACA;IACS;IACT;IAPF,KAAK,CAAiB;IACtB,KAAK,GAAY,EAAE,CAAC;IAE5B,YACU,UAAkB,EAClB,IAAY,EACH,cAAuB,EAChC,MAAqB;QAHrB,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACH,mBAAc,GAAd,cAAc,CAAS;QAChC,WAAM,GAAN,MAAM,CAAe;QAE7B,MAAM,SAAS,GAAG,IAAA,qBAAQ,GAAE,CAAC;QAC7B,SAAS,CAAC,QAAQ,KAAK,EAAE,CAAC;QAC1B,SAAS,CAAC,QAAQ,CAAC,eAAe,KAAK,EAAE,CAAC;QAC1C,IAAI,gBAAgB,GAAG,SAAS,CAAC,QAAQ,CAAC,eAAe;aACtD,iBAAmC,CAAC;QACvC,IACE,IAAA,sBAAiB,EAAC,gBAAgB,CAAC;YACnC,gBAAgB,CAAC,MAAM,KAAK,MAAM,EAClC,CAAC;YACD,gBAAgB,GAAG;gBACjB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,IAAI;gBACjB,MAAM;aACP,CAAC;QACJ,CAAC;QACD,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,iBAAiB,GAAG,gB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rUndefined, isString } from '@sindresorhus/is';\nimport { dequal } from 'dequal';\nimport { DateTime } from 'luxon';\nimport { logger } from '../../../logger';\nimport * as memCache from '../../../util/cache/memory';\nimport { getCache } from '../../../util/cache/repository';\nimport type { BitbucketServerHttp } from '../../../util/http/bitbucket-server';\nimport { getQueryString } from '../../../util/url';\nimport type { BbsPr, BbsPrCacheData, BbsRestPr } from './types';\nimport { prInfo } from './utils';\n\nexport class BbsPrCache {\n private cache: BbsPrCacheData;\n private items: BbsPr[] = [];\n\n private constructor(\n private projectKey: string,\n private repo: string,\n private readonly ignorePrAuthor: boolean,\n private author: string | null,\n ) {\n const repoCache = getCache();\n repoCache.platform ??= {};\n repoCache.platform.bitbucketServer ??= {};\n let pullRequestCache = repoCache.platform.bitbucketServer\n .pullRequestsCache as BbsPrCacheData;\n if (\n isNullOrUndefined(pullRequestCache) ||\n pullRequestCache.author !== author\n ) {\n pullRequestCache = {\n items: {},\n updatedDate: null,\n author,\n };\n }\n repoCache.platform.bitbucketServer.pullRequestsCache = pullRequestCache;\n this.cache = pullRequestCache;\n this.updateItems();\n }\n\n private static async init(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string | null,\n ): Promise<BbsPrCache> {\n const res = new BbsPrCache(projectKey, repo, ignorePrAuthor, author);\n const isSynced = memCache.get<true | undefined>('bbs-pr-cache-synced');\n\n if (!isSynced) {\n await res.sync(http);\n memCache.set('bbs-pr-cache-synced', true);\n }\n\n return res;\n }\n\n private getPrs(): BbsPr[] {\n return this.items;\n }\n\n static async getPrs(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string,\n ): Promise<BbsPr[]> {\n const prCache = await BbsPrCache.init(\n http,\n projectKey,\n repo,\n ignorePrAuthor,\n author,\n );\n return prCache.getPrs();\n }\n\n private setPr(item: BbsPr): void {\n this.cache.items[item.number] = item;\n this.updateItems();\n }\n\n static async setPr(\n http: BitbucketServerHttp,\n projectKey: string,\n repo: string,\n ignorePrAuthor: boolean,\n author: string,\n item: BbsPr,\n ): Promise<void> {\n const prCache = await BbsPrCache.init(\n http,\n projectKey,\n repo,\n ignorePrAuthor,\n author,\n );\n prCache.setPr(item);\n }\n\n private reconcile(rawItems: BbsRestPr[]): boolean {\n logger.debug('reconciled');\n const { items } = this.cache;\n let { updatedDate } = this.cache;\n const cacheTime = updatedDate ? DateTime.fromMillis(updatedDate) : null;\n\n let needNextPage = true;\n\n for (const rawItem of rawItems) {\n const id = rawItem.id;\n\n const newItem = prInfo(rawItem);\n\n const oldItem = items[id];\n if (dequal(oldItem, newItem)) {\n needNextPage = false;\n continue;\n }\n\n items[id] = newItem;\n\n const itemTime = DateTime.fromMillis(rawItem.updatedDate);\n if (!cacheTime || itemTime > cacheTime) {\n updatedDate = rawItem.updatedDate;\n }\n }\n\n this.cache.updatedDate = updatedDate;\n\n return needNextPage;\n }\n\n private async sync(http: BitbucketServerHttp): Promise<BbsPrCache> {\n const searchParams: Record<string, string> = {\n state: 'ALL',\n limit: this.items.length ? '20' : '100',\n };\n if (!this.ignorePrAuthor && isString(this.author)) {\n searchParams['role.1'] = 'AUTHOR';\n searchParams['username.1'] = this.author;\n }\n let query: string | null = getQueryString(searchParams);\n\n while (query) {\n const res = await http.getJsonUnchecked<{\n nextPageStart: string;\n values: BbsRestPr[];\n }>(\n `./rest/api/1.0/projects/${this.projectKey}/repos/${this.repo}/pull-requests?${query}`,\n {\n memCache: false,\n },\n );\n\n const needNextPage = this.reconcile(res.body.values);\n if (!needNextPage) {\n break;\n }\n\n if (res.body.nextPageStart) {\n searchParams.start = res.body.nextPageStart.toString();\n } else {\n query = null;\n }\n }\n\n this.updateItems();\n\n return this;\n }\n\n /**\n * Ensure the pr cache starts with the most recent PRs.\n * JavaScript ensures that the cache is sorted by PR number.\n */\n private updateItems(): void {\n this.items = Object.values(this.cache.items).reverse();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "renovate",
3
3
  "description": "Automated dependency updates. Flexible so you don't need to be.",
4
- "version": "42.6.2",
4
+ "version": "42.7.0",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -217,7 +217,7 @@
217
217
  },
218
218
  "devDependencies": {
219
219
  "@containerbase/eslint-plugin": "1.1.18",
220
- "@containerbase/semantic-release-pnpm": "1.3.3",
220
+ "@containerbase/semantic-release-pnpm": "1.3.4",
221
221
  "@eslint/js": "9.39.1",
222
222
  "@hyrious/marshal": "0.3.3",
223
223
  "@ls-lint/ls-lint": "2.3.1",
@@ -1,7 +1,7 @@
1
1
  {
2
- "title": "JSON schema for Renovate 42.6.2 config files (https://renovatebot.com/)",
2
+ "title": "JSON schema for Renovate 42.7.0 config files (https://renovatebot.com/)",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
- "x-renovate-version": "42.6.2",
4
+ "x-renovate-version": "42.7.0",
5
5
  "allowComments": true,
6
6
  "type": "object",
7
7
  "properties": {