-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathindex.ts
157 lines (148 loc) · 4.64 KB
/
index.ts
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import type { ComponentType, SVGProps } from 'react';
import { Category, EcosystemElement, Technology } from '../types';
import { ABTasty } from './abtasty';
import { AwsSSM } from './awsssm';
import { Bucket } from './bucket';
import { Bucketeer } from './bucketeer';
import { CloudBees } from './cloudbees';
import { ConfigCat } from './configcat';
import { DevCycle } from './devcycle';
import { EnvVar } from './env-var';
import { Flagd } from './flagd';
import { Flagsmith } from './flagsmith';
import { Flipt } from './flipt';
import { Goff } from './goff';
import { Harness } from './harness';
import { Kameleoon } from './kameleoon';
import { LaunchDarkly } from './launchdarkly';
import { PostHog } from './posthog';
import { Split } from './split';
import { Unleash } from './unleash';
import { Statsig } from './statsig';
import { FeatBit } from './featbit';
import { UserDefaults } from './user-defaults';
import { GrowthBook } from './growthbook';
import { MultiProvider } from './multi-provider';
import { Hypertune } from './hypertune';
import { Confidence } from './confidence';
import { ConfigBee } from './configbee';
import { Tggl } from './tggl';
import { OFREP } from './ofrep';
import { SDKS } from '../sdks';
const childTechnologyMap = SDKS.reduce(
(acc, sdk) => {
if (sdk.parentTechnology && !sdk.skipParentTechnologyProviders) {
const key = `${sdk.category}:${sdk.parentTechnology}`;
if (!acc[key]) {
acc[key] = [];
}
acc[key].push(sdk.technology);
}
return acc;
},
{} as Record<string, Technology[]>,
);
export const PROVIDERS: Provider[] = [
ABTasty,
AwsSSM,
Bucket,
Bucketeer,
CloudBees,
Confidence,
ConfigBee,
ConfigCat,
DevCycle,
EnvVar,
FeatBit,
Flagd,
Flagsmith,
Flipt,
Goff,
Harness,
Hypertune,
Kameleoon,
LaunchDarkly,
PostHog,
Split,
Statsig,
Unleash,
UserDefaults,
GrowthBook,
MultiProvider,
Tggl,
OFREP,
];
// Map of provider name to technology to child technologies
const PROVIDER_TECHNOLOGY_MAP = PROVIDERS.reduce(
(acc, provider) => {
const techMap: Record<string, string[]> = {};
provider.technologies.forEach(({ technology, parentTechnology }) => {
if (parentTechnology) {
if (!techMap[parentTechnology]) {
techMap[parentTechnology] = [];
}
techMap[parentTechnology].push(technology);
}
});
if (Object.keys(techMap).length > 0) {
acc[provider.name] = techMap;
}
return acc;
},
{} as Record<string, Record<string, string[]>>,
);
export const ECOSYSTEM_PROVIDERS: EcosystemElement[] = PROVIDERS.map((provider) => {
return provider.technologies.map(
({ category, href, technology, parentTechnology, vendorOfficial }): EcosystemElement => {
// Create a list of supported technologies for a provider, for example: a base Web Provider will power React / Angular SDKs.
// Filter out creating multiple entries for if a provider has a child provider for the base web provider.
const allTechnologies = [technology, parentTechnology].filter(Boolean);
const key = `${category[0]}:${technology}`;
if (childTechnologyMap[key]) {
allTechnologies.push(
...childTechnologyMap[key].filter((t) => {
return !PROVIDER_TECHNOLOGY_MAP[provider.name]?.[technology]?.includes(t);
}),
);
}
return {
vendor: provider.name,
title:
technology === 'JavaScript' || parentTechnology === 'JavaScript'
? `${provider.name} ${technology} ${category[0] === 'Client' ? 'Web' : 'Node.js'} Provider`
: `${provider.name} ${technology} ${category} Provider`,
description: !provider.description
? createDefaultDescription(provider.name, vendorOfficial)
: typeof provider.description === 'string'
? provider.description
: provider.description(vendorOfficial),
type: 'Provider',
logo: provider.logo,
href,
allTechnologies,
technology,
parentTechnology,
vendorOfficial,
category,
};
},
);
}).flat();
function createDefaultDescription(vendor: string, official: boolean): string {
return official
? `The official ${vendor} provider for OpenFeature`
: `A community-maintained ${vendor} provider for OpenFeature`;
}
export type Provider = {
name: string;
logo: ComponentType<SVGProps<SVGSVGElement>>;
technologies: Array<{
technology: Technology;
parentTechnology?: Technology;
vendorOfficial: boolean;
href: string;
category: Category[];
}>;
description?: string | ((vendorSupported: boolean) => string);
excludeFromLandingPage?: boolean;
};