Skip to content

Commit f008170

Browse files
committed
Update biome schema to match installed version
1 parent 3147389 commit f008170

32 files changed

+3522
-13
lines changed

bin/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import config from 'painless-config'
66

77
const { get } = lodash
88

9-
import providers from '../providers/index.ts'
9+
import providers from '../providers/index.js'
1010

1111
/**
1212
* Loads the given factory for the indicated namespace. The namespace can be a subcomponent

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.4.9/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.4.11/schema.json",
33
"files": {
44
"includes": [
55
"**",

business/summarizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @typedef {import('../lib/entityCoordinates')} EntityCoordinates
88
*/
99

10-
import summarizers from '../providers/summary/index.ts'
10+
import summarizers from '../providers/summary/index.js'
1111

1212
/**
1313
* Service for summarizing tool output data.

providers/index.d.ts

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license.
2+
// SPDX-License-Identifier: MIT
3+
4+
import type { ICache } from './caching/index.js'
5+
import type { Logger } from './logging/index.js'
6+
7+
/** Factory function that creates a provider instance */
8+
export type ProviderFactory<T = any> = (options?: any) => T
9+
10+
/** Provider configuration for logging */
11+
export interface LoggingProviders {
12+
winston: ProviderFactory<Logger>
13+
}
14+
15+
/** Provider configuration for definition stores */
16+
export interface DefinitionProviders {
17+
azure: ProviderFactory
18+
file: ProviderFactory
19+
mongo: ProviderFactory
20+
mongoTrimmed: ProviderFactory
21+
dispatch: ProviderFactory
22+
}
23+
24+
/** Provider configuration for attachment stores */
25+
export interface AttachmentProviders {
26+
azure: ProviderFactory
27+
file: ProviderFactory
28+
}
29+
30+
/** Provider configuration for search providers */
31+
export interface SearchProviders {
32+
azure: ProviderFactory
33+
memory: ProviderFactory
34+
}
35+
36+
/** Provider configuration for caching providers */
37+
export interface CachingProviders {
38+
redis: ProviderFactory<ICache>
39+
memory: ProviderFactory<ICache>
40+
}
41+
42+
/** Provider configuration for authentication */
43+
export interface AuthProviders {
44+
github: ProviderFactory
45+
}
46+
47+
/** Paired queue factories used by recompute handlers */
48+
export interface RecomputeQueueFactories<T = any> {
49+
upgrade: ProviderFactory<T>
50+
compute: ProviderFactory<T>
51+
}
52+
53+
/** Provider configuration for upgrade queue */
54+
export interface UpgradeQueueProviders {
55+
azure: RecomputeQueueFactories
56+
memory: RecomputeQueueFactories
57+
}
58+
59+
/** Provider configuration for upgrade service */
60+
export interface UpgradeServiceProviders {
61+
onDemand: ProviderFactory
62+
/** @deprecated TODO: remove in favor of onDemand */
63+
versionCheck: ProviderFactory
64+
delayed: ProviderFactory
65+
/** @deprecated TODO: remove in favor of delayed */
66+
upgradeQueue: ProviderFactory
67+
}
68+
69+
/** Provider configuration for upgrade */
70+
export interface UpgradeProviders {
71+
queue: UpgradeQueueProviders
72+
service: UpgradeServiceProviders
73+
}
74+
75+
/** Provider configuration for curation queue */
76+
export interface CurationQueueProviders {
77+
azure: ProviderFactory
78+
memory: ProviderFactory
79+
}
80+
81+
/** Provider configuration for curation service */
82+
export interface CurationServiceProviders {
83+
github: ProviderFactory
84+
}
85+
86+
/** Provider configuration for curation store */
87+
export interface CurationStoreProviders {
88+
memory: ProviderFactory
89+
mongo: ProviderFactory
90+
}
91+
92+
/** Provider configuration for curation */
93+
export interface CurationProviders {
94+
queue: CurationQueueProviders
95+
service: CurationServiceProviders
96+
store: CurationStoreProviders
97+
}
98+
99+
/** Provider configuration for harvest queue */
100+
export interface HarvestQueueProviders {
101+
azure: ProviderFactory
102+
memory: ProviderFactory
103+
}
104+
105+
/** Provider configuration for harvest service */
106+
export interface HarvestServiceProviders {
107+
crawler: ProviderFactory
108+
crawlerQueue: ProviderFactory
109+
}
110+
111+
/** Provider configuration for harvest store */
112+
export interface HarvestStoreProviders {
113+
azure: ProviderFactory
114+
file: ProviderFactory
115+
}
116+
117+
/** Provider configuration for harvest */
118+
export interface HarvestProviders {
119+
queue: HarvestQueueProviders
120+
service: HarvestServiceProviders
121+
store: HarvestStoreProviders
122+
}
123+
124+
/** Central provider registry containing all provider factories */
125+
export interface Providers {
126+
logging: LoggingProviders
127+
definition: DefinitionProviders
128+
attachment: AttachmentProviders
129+
search: SearchProviders
130+
caching: CachingProviders
131+
auth: AuthProviders
132+
upgrade: UpgradeProviders
133+
curation: CurationProviders
134+
harvest: HarvestProviders
135+
}
136+
137+
declare const providers: Providers
138+
139+
export default providers

providers/index.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license.
2+
// SPDX-License-Identifier: MIT
3+
4+
import githubAuthConfig from '../middleware/githubConfig.ts'
5+
import memoryCaching from '../providers/caching/memory.ts'
6+
import redisConfig from '../providers/caching/redisConfig.ts'
7+
import curationAzureQueueConfig from '../providers/curation/azureQueueConfig.ts'
8+
import curationGithubConfig from '../providers/curation/githubConfig.ts'
9+
import curationMemoryStore from '../providers/curation/memoryStore.ts'
10+
import curationMongoConfig from '../providers/curation/mongoConfig.ts'
11+
import harvestAzureQueueConfig from '../providers/harvest/azureQueueConfig.ts'
12+
import crawlerConfig from '../providers/harvest/crawlerConfig.ts'
13+
import crawlerQueueConfig from '../providers/harvest/crawlerQueueConfig.ts'
14+
import winstonConfig from '../providers/logging/winstonConfig.ts'
15+
import memoryQueue from '../providers/queueing/memoryQueue.ts'
16+
import azureSearchConfig from '../providers/search/azureConfig.ts'
17+
import memorySearch from '../providers/search/memory.ts'
18+
import azblobConfig from '../providers/stores/azblobConfig.ts'
19+
import dispatchConfig from '../providers/stores/dispatchConfig.ts'
20+
import fileConfig from '../providers/stores/fileConfig.ts'
21+
import mongoConfig from '../providers/stores/mongoConfig.ts'
22+
import upgradeAzureQueueConfig from '../providers/upgrade/azureQueueConfig.js'
23+
import upgradeMemoryQueueConfig from '../providers/upgrade/memoryQueueConfig.js'
24+
import * as recomputeHandler from '../providers/upgrade/recomputeHandler.js'
25+
import listBasedFilterConfig from './harvest/throttling/listBasedFilterConfig.ts'
26+
27+
export default {
28+
logging: {
29+
winston: winstonConfig
30+
},
31+
definition: {
32+
azure: azblobConfig.definition,
33+
file: fileConfig.definition,
34+
mongo: mongoConfig.definitionPaged,
35+
mongoTrimmed: mongoConfig.definitionTrimmed,
36+
dispatch: dispatchConfig
37+
},
38+
attachment: {
39+
azure: azblobConfig.attachment,
40+
file: fileConfig.attachment
41+
},
42+
search: {
43+
azure: azureSearchConfig,
44+
memory: memorySearch
45+
},
46+
caching: {
47+
redis: redisConfig,
48+
memory: memoryCaching
49+
},
50+
auth: {
51+
github: githubAuthConfig
52+
},
53+
upgrade: {
54+
queue: {
55+
azure: upgradeAzureQueueConfig,
56+
memory: upgradeMemoryQueueConfig
57+
},
58+
service: {
59+
onDemand: recomputeHandler.defaultFactory,
60+
versionCheck: recomputeHandler.defaultFactory,
61+
delayed: recomputeHandler.delayedFactory,
62+
upgradeQueue: recomputeHandler.delayedFactory
63+
}
64+
},
65+
curation: {
66+
queue: {
67+
azure: curationAzureQueueConfig,
68+
memory: memoryQueue
69+
},
70+
service: { github: curationGithubConfig },
71+
store: {
72+
memory: curationMemoryStore,
73+
mongo: curationMongoConfig
74+
}
75+
},
76+
harvest: {
77+
queue: {
78+
azure: harvestAzureQueueConfig,
79+
memory: memoryQueue
80+
},
81+
service: {
82+
crawler: crawlerConfig,
83+
crawlerQueue: crawlerQueueConfig
84+
},
85+
store: {
86+
azure: azblobConfig.harvest,
87+
file: fileConfig.harvest
88+
},
89+
throttler: {
90+
filter: listBasedFilterConfig
91+
}
92+
}
93+
}

providers/summary/cdsource.d.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license.
2+
// SPDX-License-Identifier: MIT
3+
4+
import type EntityCoordinates from '../../lib/entityCoordinates.ts'
5+
import type { SummarizerOptions } from './index.js'
6+
7+
/** Harvested data structure for CdSource tool */
8+
export interface CdSourceHarvestedData {
9+
releaseDate?: string
10+
facets?: Record<string, string[]>
11+
[key: string]: unknown
12+
}
13+
14+
/** Result of CdSource summarization (partial Definition) */
15+
export interface CdSourceSummaryResult {
16+
described: {
17+
releaseDate?: string | null
18+
facets?: Record<string, string[]>
19+
}
20+
}
21+
22+
/**
23+
* CdSource summarizer class that processes harvested data from the ClearlyDefined
24+
* source tool. Extracts basic release date and facet information.
25+
*/
26+
export declare class CdSourceSummarizer {
27+
/** Options passed to the summarizer */
28+
options: SummarizerOptions
29+
30+
/**
31+
* Creates a new CdSourceSummarizer instance
32+
*
33+
* @param options - Configuration options for the summarizer
34+
*/
35+
constructor(options: SummarizerOptions)
36+
37+
/**
38+
* Summarize the raw information related to the given coordinates.
39+
*
40+
* @param coordinates - The entity for which we are summarizing
41+
* @param data - The set of raw tool outputs related to the identified entity
42+
* @returns A summary of the given raw information
43+
*/
44+
summarize(coordinates: EntityCoordinates, data: CdSourceHarvestedData): CdSourceSummaryResult
45+
}
46+
47+
/**
48+
* Factory function that creates a CdSourceSummarizer instance
49+
*
50+
* @param options - Configuration options for the summarizer
51+
* @returns A new CdSourceSummarizer instance
52+
*/
53+
declare function cdsourceSummarizerFactory(options?: SummarizerOptions): CdSourceSummarizer
54+
55+
export default cdsourceSummarizerFactory

providers/summary/cdsource.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) Microsoft Corporation and others. Licensed under the MIT license.
2+
// SPDX-License-Identifier: MIT
3+
4+
/**
5+
* @typedef {import('./index').SummarizerOptions} SummarizerOptions
6+
* @typedef {import('../../lib/entityCoordinates')} EntityCoordinates
7+
* @typedef {import('./cdsource').CdSourceHarvestedData} CdSourceHarvestedData
8+
* @typedef {import('./cdsource').CdSourceSummaryResult} CdSourceSummaryResult
9+
*/
10+
11+
import { extractDate } from '../../lib/utils.ts'
12+
13+
/**
14+
* CdSource summarizer class that processes harvested data from the ClearlyDefined
15+
* source tool. Extracts basic release date and facet information.
16+
* @class
17+
*/
18+
class CdSourceSummarizer {
19+
/**
20+
* Creates a new CdSourceSummarizer instance
21+
* @param {SummarizerOptions} options - Configuration options for the summarizer
22+
*/
23+
constructor(options) {
24+
this.options = options
25+
}
26+
27+
/**
28+
* Summarize the raw information related to the given coordinates.
29+
* @param {EntityCoordinates} _coordinates - The entity for which we are summarizing
30+
* @param {CdSourceHarvestedData} data - The set of raw tool outputs related to the identified entity
31+
* @returns {CdSourceSummaryResult} A summary of the given raw information
32+
*/
33+
summarize(_coordinates, data) {
34+
/** @type {CdSourceSummaryResult} */
35+
const result = { described: {} }
36+
result.described.releaseDate = extractDate(data.releaseDate)
37+
result.described.facets = data.facets
38+
return result
39+
}
40+
}
41+
42+
/**
43+
* Factory function that creates a CdSourceSummarizer instance
44+
* @param {SummarizerOptions} [options] - Configuration options for the summarizer
45+
* @returns {CdSourceSummarizer} A new CdSourceSummarizer instance
46+
*/
47+
export default options => new CdSourceSummarizer(options)

0 commit comments

Comments
 (0)