GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs/src/plugins/changelog/tiers.js at main · epilot-dev/docs

Expand file tree

/

tiers.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
52 lines (44 loc) · 1.8 KB
/

tiers.js

Copy path

File metadata and controls

52 lines (44 loc) · 1.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Which changelog sections belong to the core API surface.
*
* The API list in redoc.config.js is the source of truth: an API is core unless it
* is marked `tier: 2` there. APIs that are not listed at all are not core either.
* Core entities and core events are always core.
*
* Sections of non-core APIs stay in the changelog, with a page of their own, but
* are left out of its default view and of the change type pages.
*/
/** "Customer Portal API", "customer-portal" and "/api/customer-portal" all become "customerportal". */
function apiKey(name) {
return name
.toLowerCase()
.replace(/[^a-z0-9]+/g, '')
.replace(/^svc/, '')
.replace(/v\d+$/, '')
.replace(/apis?$/, '');
}
/** The names a section heading can use for an API: its title, its spec file and its route. */
function specKeys(spec) {
const specFile = spec.specUrl
.split('/')
.pop()
.replace(/\.ya?ml$/, '');
const route = spec.routePath.split('/').pop();
return [spec.layout.title, specFile, route].map(apiKey);
}
const ENTITY_OR_EVENT = /^(Core (Entities|Events)|Event: .+|.+ Entity)$/;
/**
* @param {{ layout: { title: string }, routePath: string, specUrl: string, tier?: number }[]} specs
* @returns {(sectionName: string) => boolean} whether a section, named as in its `## date name` heading, is core
*/
function createCoreMatcher(specs) {
const tierByKey = new Map();
for (const spec of specs) {
for (const key of specKeys(spec)) tierByKey.set(key, spec.tier || 1);
}
const isCoreApi = (name) => tierByKey.get(apiKey(name)) === 1;
// A section can name several APIs ("Workflows Definition API, Workflows Execution API").
return (sectionName) =>
ENTITY_OR_EVENT.test(sectionName) || sectionName.split(',').some((name) => isCoreApi(name.trim()));
}
module.exports = { createCoreMatcher };
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.