@flagshark/core 1.0.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.
- package/dist/detection/config-adapter.d.ts +16 -0
- package/dist/detection/config-adapter.d.ts.map +1 -0
- package/dist/detection/config-adapter.js +60 -0
- package/dist/detection/config-adapter.js.map +1 -0
- package/dist/detection/detectors/cpp.d.ts +17 -0
- package/dist/detection/detectors/cpp.d.ts.map +1 -0
- package/dist/detection/detectors/cpp.js +113 -0
- package/dist/detection/detectors/cpp.js.map +1 -0
- package/dist/detection/detectors/csharp.d.ts +17 -0
- package/dist/detection/detectors/csharp.d.ts.map +1 -0
- package/dist/detection/detectors/csharp.js +258 -0
- package/dist/detection/detectors/csharp.js.map +1 -0
- package/dist/detection/detectors/go.d.ts +17 -0
- package/dist/detection/detectors/go.d.ts.map +1 -0
- package/dist/detection/detectors/go.js +319 -0
- package/dist/detection/detectors/go.js.map +1 -0
- package/dist/detection/detectors/index.d.ts +14 -0
- package/dist/detection/detectors/index.d.ts.map +1 -0
- package/dist/detection/detectors/index.js +14 -0
- package/dist/detection/detectors/index.js.map +1 -0
- package/dist/detection/detectors/java.d.ts +17 -0
- package/dist/detection/detectors/java.d.ts.map +1 -0
- package/dist/detection/detectors/java.js +264 -0
- package/dist/detection/detectors/java.js.map +1 -0
- package/dist/detection/detectors/javascript.d.ts +18 -0
- package/dist/detection/detectors/javascript.d.ts.map +1 -0
- package/dist/detection/detectors/javascript.js +32 -0
- package/dist/detection/detectors/javascript.js.map +1 -0
- package/dist/detection/detectors/kotlin.d.ts +17 -0
- package/dist/detection/detectors/kotlin.d.ts.map +1 -0
- package/dist/detection/detectors/kotlin.js +210 -0
- package/dist/detection/detectors/kotlin.js.map +1 -0
- package/dist/detection/detectors/objectivec.d.ts +17 -0
- package/dist/detection/detectors/objectivec.d.ts.map +1 -0
- package/dist/detection/detectors/objectivec.js +244 -0
- package/dist/detection/detectors/objectivec.js.map +1 -0
- package/dist/detection/detectors/php.d.ts +17 -0
- package/dist/detection/detectors/php.d.ts.map +1 -0
- package/dist/detection/detectors/php.js +210 -0
- package/dist/detection/detectors/php.js.map +1 -0
- package/dist/detection/detectors/python.d.ts +17 -0
- package/dist/detection/detectors/python.d.ts.map +1 -0
- package/dist/detection/detectors/python.js +284 -0
- package/dist/detection/detectors/python.js.map +1 -0
- package/dist/detection/detectors/ruby.d.ts +17 -0
- package/dist/detection/detectors/ruby.d.ts.map +1 -0
- package/dist/detection/detectors/ruby.js +259 -0
- package/dist/detection/detectors/ruby.js.map +1 -0
- package/dist/detection/detectors/rust.d.ts +17 -0
- package/dist/detection/detectors/rust.d.ts.map +1 -0
- package/dist/detection/detectors/rust.js +159 -0
- package/dist/detection/detectors/rust.js.map +1 -0
- package/dist/detection/detectors/swift.d.ts +17 -0
- package/dist/detection/detectors/swift.d.ts.map +1 -0
- package/dist/detection/detectors/swift.js +229 -0
- package/dist/detection/detectors/swift.js.map +1 -0
- package/dist/detection/detectors/typescript.d.ts +17 -0
- package/dist/detection/detectors/typescript.d.ts.map +1 -0
- package/dist/detection/detectors/typescript.js +350 -0
- package/dist/detection/detectors/typescript.js.map +1 -0
- package/dist/detection/feature-flag.d.ts +16 -0
- package/dist/detection/feature-flag.d.ts.map +1 -0
- package/dist/detection/feature-flag.js +2 -0
- package/dist/detection/feature-flag.js.map +1 -0
- package/dist/detection/helpers.d.ts +51 -0
- package/dist/detection/helpers.d.ts.map +1 -0
- package/dist/detection/helpers.js +266 -0
- package/dist/detection/helpers.js.map +1 -0
- package/dist/detection/index.d.ts +19 -0
- package/dist/detection/index.d.ts.map +1 -0
- package/dist/detection/index.js +53 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/detection/interface.d.ts +76 -0
- package/dist/detection/interface.d.ts.map +1 -0
- package/dist/detection/interface.js +25 -0
- package/dist/detection/interface.js.map +1 -0
- package/dist/detection/polyglot-analyzer.d.ts +83 -0
- package/dist/detection/polyglot-analyzer.d.ts.map +1 -0
- package/dist/detection/polyglot-analyzer.js +245 -0
- package/dist/detection/polyglot-analyzer.js.map +1 -0
- package/dist/detection/registry.d.ts +31 -0
- package/dist/detection/registry.d.ts.map +1 -0
- package/dist/detection/registry.js +68 -0
- package/dist/detection/registry.js.map +1 -0
- package/dist/detection/yaml-config.d.ts +333 -0
- package/dist/detection/yaml-config.d.ts.map +1 -0
- package/dist/detection/yaml-config.js +215 -0
- package/dist/detection/yaml-config.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/scan-repo.d.ts +67 -0
- package/dist/scan-repo.d.ts.map +1 -0
- package/dist/scan-repo.js +55 -0
- package/dist/scan-repo.js.map +1 -0
- package/dist/scanner.d.ts +18 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +108 -0
- package/dist/scanner.js.map +1 -0
- package/dist/staleness.d.ts +30 -0
- package/dist/staleness.d.ts.map +1 -0
- package/dist/staleness.js +217 -0
- package/dist/staleness.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP language feature flag detector.
|
|
3
|
+
* Ported from Go: internal/languages/php/detector.go
|
|
4
|
+
*/
|
|
5
|
+
import { detectFlagsWithRegex } from '../helpers.js';
|
|
6
|
+
import { Languages } from '../interface.js';
|
|
7
|
+
export class PHPDetector {
|
|
8
|
+
providers;
|
|
9
|
+
constructor(providers) {
|
|
10
|
+
this.providers = providers ?? defaultPHPProviders();
|
|
11
|
+
}
|
|
12
|
+
language() {
|
|
13
|
+
return Languages.PHP;
|
|
14
|
+
}
|
|
15
|
+
fileExtensions() {
|
|
16
|
+
return ['.php', '.phtml', '.php3', '.php4', '.php5', '.phps'];
|
|
17
|
+
}
|
|
18
|
+
supportsFile(filename) {
|
|
19
|
+
const ext = filename.toLowerCase().split('.').pop();
|
|
20
|
+
return ['php', 'phtml', 'php3', 'php4', 'php5', 'phps'].includes(ext ?? '');
|
|
21
|
+
}
|
|
22
|
+
detectFlags(filename, content) {
|
|
23
|
+
return detectFlagsWithRegex(filename, content, this.language(), this.providers);
|
|
24
|
+
}
|
|
25
|
+
getProviders() {
|
|
26
|
+
return this.providers;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function defaultPHPProviders() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
name: 'LaunchDarkly PHP SDK',
|
|
33
|
+
importPattern: 'LaunchDarkly\\',
|
|
34
|
+
description: 'LaunchDarkly PHP SDK',
|
|
35
|
+
enabled: true,
|
|
36
|
+
methods: [
|
|
37
|
+
{
|
|
38
|
+
name: 'variation',
|
|
39
|
+
flagKeyIndex: 0,
|
|
40
|
+
examples: ['$client->variation("flag-key", $context, false)'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'boolVariation',
|
|
44
|
+
flagKeyIndex: 0,
|
|
45
|
+
examples: ['$client->boolVariation("flag-key", $context, false)'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'stringVariation',
|
|
49
|
+
flagKeyIndex: 0,
|
|
50
|
+
examples: ['$client->stringVariation("flag-key", $context, "default")'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'intVariation',
|
|
54
|
+
flagKeyIndex: 0,
|
|
55
|
+
examples: ['$client->intVariation("flag-key", $context, 0)'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'floatVariation',
|
|
59
|
+
flagKeyIndex: 0,
|
|
60
|
+
examples: ['$client->floatVariation("flag-key", $context, 0.0)'],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'jsonVariation',
|
|
64
|
+
flagKeyIndex: 0,
|
|
65
|
+
examples: ['$client->jsonVariation("flag-key", $context, [])'],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Unleash PHP SDK',
|
|
71
|
+
importPattern: 'Unleash\\Client',
|
|
72
|
+
description: 'Unleash PHP SDK',
|
|
73
|
+
enabled: true,
|
|
74
|
+
methods: [
|
|
75
|
+
{ name: 'isEnabled', flagKeyIndex: 0, examples: ['$unleash->isEnabled("feature-toggle")'] },
|
|
76
|
+
{
|
|
77
|
+
name: 'getVariant',
|
|
78
|
+
flagKeyIndex: 0,
|
|
79
|
+
examples: ['$unleash->getVariant("feature-toggle")'],
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Split.io PHP SDK',
|
|
85
|
+
importPattern: 'SplitIO\\',
|
|
86
|
+
description: 'Split.io PHP SDK',
|
|
87
|
+
enabled: true,
|
|
88
|
+
methods: [
|
|
89
|
+
{
|
|
90
|
+
name: 'getTreatment',
|
|
91
|
+
flagKeyIndex: 1,
|
|
92
|
+
examples: ['$client->getTreatment($key, "split-name")'],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'getTreatments',
|
|
96
|
+
flagKeyIndex: 1,
|
|
97
|
+
examples: ['$client->getTreatments($key, ["split1", "split2"])'],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'Flagsmith PHP SDK',
|
|
103
|
+
importPattern: 'Flagsmith\\',
|
|
104
|
+
description: 'Flagsmith PHP SDK',
|
|
105
|
+
enabled: true,
|
|
106
|
+
methods: [
|
|
107
|
+
{
|
|
108
|
+
name: 'isFeatureEnabled',
|
|
109
|
+
flagKeyIndex: 0,
|
|
110
|
+
examples: ['$flags->isFeatureEnabled("feature-name")'],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'getFeatureValue',
|
|
114
|
+
flagKeyIndex: 0,
|
|
115
|
+
examples: ['$flags->getFeatureValue("feature-name")'],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'ConfigCat PHP SDK',
|
|
121
|
+
importPattern: 'ConfigCat\\',
|
|
122
|
+
description: 'ConfigCat PHP SDK',
|
|
123
|
+
enabled: true,
|
|
124
|
+
methods: [
|
|
125
|
+
{ name: 'getValue', flagKeyIndex: 0, examples: ['$client->getValue("flag-key", false)'] },
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'Statsig PHP SDK',
|
|
130
|
+
importPattern: 'Statsig\\',
|
|
131
|
+
description: 'Statsig PHP SDK',
|
|
132
|
+
enabled: true,
|
|
133
|
+
methods: [
|
|
134
|
+
{
|
|
135
|
+
name: 'checkGate',
|
|
136
|
+
flagKeyIndex: 1,
|
|
137
|
+
examples: ['Statsig::checkGate($user, "gate-name")'],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'getExperiment',
|
|
141
|
+
flagKeyIndex: 1,
|
|
142
|
+
examples: ['Statsig::getExperiment($user, "experiment-name")'],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'getConfig',
|
|
146
|
+
flagKeyIndex: 1,
|
|
147
|
+
examples: ['Statsig::getConfig($user, "config-name")'],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'GrowthBook PHP SDK',
|
|
153
|
+
importPattern: 'Growthbook\\',
|
|
154
|
+
description: 'GrowthBook PHP SDK',
|
|
155
|
+
enabled: true,
|
|
156
|
+
methods: [
|
|
157
|
+
{ name: 'isOn', flagKeyIndex: 0, examples: ['$gb->isOn("feature-key")'] },
|
|
158
|
+
{
|
|
159
|
+
name: 'getFeatureValue',
|
|
160
|
+
flagKeyIndex: 0,
|
|
161
|
+
examples: ['$gb->getFeatureValue("feature-key", $fallbackValue)'],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'PostHog PHP SDK',
|
|
167
|
+
importPattern: 'PostHog\\',
|
|
168
|
+
description: 'PostHog PHP SDK',
|
|
169
|
+
enabled: true,
|
|
170
|
+
methods: [
|
|
171
|
+
{
|
|
172
|
+
name: 'isFeatureEnabled',
|
|
173
|
+
flagKeyIndex: 0,
|
|
174
|
+
examples: ['PostHog::isFeatureEnabled("flag-key", $distinctId)'],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'getFeatureFlag',
|
|
178
|
+
flagKeyIndex: 0,
|
|
179
|
+
examples: ['PostHog::getFeatureFlag("flag-key", $distinctId)'],
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'Laravel Pennant',
|
|
185
|
+
importPattern: 'Laravel\\Pennant',
|
|
186
|
+
description: 'Laravel Pennant feature flags',
|
|
187
|
+
enabled: true,
|
|
188
|
+
methods: [
|
|
189
|
+
{ name: 'active', flagKeyIndex: 0, examples: ['Feature::active("feature-name")'] },
|
|
190
|
+
{ name: 'inactive', flagKeyIndex: 0, examples: ['Feature::inactive("feature-name")'] },
|
|
191
|
+
{ name: 'value', flagKeyIndex: 0, examples: ['Feature::value("feature-name")'] },
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'Custom Feature Flags',
|
|
196
|
+
description: 'Common custom PHP feature flag patterns',
|
|
197
|
+
enabled: true,
|
|
198
|
+
methods: [
|
|
199
|
+
{
|
|
200
|
+
name: 'isFeatureEnabled',
|
|
201
|
+
flagKeyIndex: 0,
|
|
202
|
+
examples: ['isFeatureEnabled("feature-name")'],
|
|
203
|
+
},
|
|
204
|
+
{ name: 'feature_enabled', flagKeyIndex: 0, examples: ['feature_enabled("feature-name")'] },
|
|
205
|
+
{ name: 'hasFeature', flagKeyIndex: 0, examples: ['hasFeature("feature-name")'] },
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,4BAA4B,CAAC,EAAE;aAClF;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python language feature flag detector.
|
|
3
|
+
* Ported from Go: internal/languages/python/detector.go
|
|
4
|
+
*/
|
|
5
|
+
import type { FeatureFlag } from '../feature-flag.js';
|
|
6
|
+
import type { FeatureFlagProvider, Language, LanguageDetector } from '../interface.js';
|
|
7
|
+
export declare class PythonDetector implements LanguageDetector {
|
|
8
|
+
private readonly providers;
|
|
9
|
+
constructor(providers?: FeatureFlagProvider[]);
|
|
10
|
+
language(): Language;
|
|
11
|
+
fileExtensions(): string[];
|
|
12
|
+
supportsFile(filename: string): boolean;
|
|
13
|
+
detectFlags(filename: string, content: string): FeatureFlag[];
|
|
14
|
+
getProviders(): FeatureFlagProvider[];
|
|
15
|
+
}
|
|
16
|
+
export declare function defaultPythonProviders(): FeatureFlagProvider[];
|
|
17
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/detection/detectors/python.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEtF,qBAAa,cAAe,YAAW,gBAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuB;gBAErC,SAAS,CAAC,EAAE,mBAAmB,EAAE;IAI7C,QAAQ,IAAI,QAAQ;IAIpB,cAAc,IAAI,MAAM,EAAE;IAI1B,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKvC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAI7D,YAAY,IAAI,mBAAmB,EAAE;CAGtC;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,EAAE,CA8P9D"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python language feature flag detector.
|
|
3
|
+
* Ported from Go: internal/languages/python/detector.go
|
|
4
|
+
*/
|
|
5
|
+
import { detectFlagsWithRegex } from '../helpers.js';
|
|
6
|
+
import { Languages } from '../interface.js';
|
|
7
|
+
export class PythonDetector {
|
|
8
|
+
providers;
|
|
9
|
+
constructor(providers) {
|
|
10
|
+
this.providers = providers ?? defaultPythonProviders();
|
|
11
|
+
}
|
|
12
|
+
language() {
|
|
13
|
+
return Languages.Python;
|
|
14
|
+
}
|
|
15
|
+
fileExtensions() {
|
|
16
|
+
return ['.py', '.pyw', '.pyx', '.pyi'];
|
|
17
|
+
}
|
|
18
|
+
supportsFile(filename) {
|
|
19
|
+
const ext = filename.toLowerCase().split('.').pop();
|
|
20
|
+
return ['py', 'pyw', 'pyx', 'pyi'].includes(ext ?? '');
|
|
21
|
+
}
|
|
22
|
+
detectFlags(filename, content) {
|
|
23
|
+
return detectFlagsWithRegex(filename, content, this.language(), this.providers);
|
|
24
|
+
}
|
|
25
|
+
getProviders() {
|
|
26
|
+
return this.providers;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function defaultPythonProviders() {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
name: 'LaunchDarkly Python SDK',
|
|
33
|
+
importPattern: 'ldclient',
|
|
34
|
+
description: 'LaunchDarkly Python SDK',
|
|
35
|
+
enabled: true,
|
|
36
|
+
methods: [
|
|
37
|
+
{
|
|
38
|
+
name: 'variation',
|
|
39
|
+
flagKeyIndex: 0,
|
|
40
|
+
examples: ['client.variation("flag-key", user, default_value)'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'bool_variation',
|
|
44
|
+
flagKeyIndex: 0,
|
|
45
|
+
examples: ['client.bool_variation("flag-key", user, False)'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Unleash Python SDK',
|
|
51
|
+
importPattern: 'UnleashClient',
|
|
52
|
+
description: 'Unleash Python SDK',
|
|
53
|
+
enabled: true,
|
|
54
|
+
methods: [
|
|
55
|
+
{ name: 'is_enabled', flagKeyIndex: 0, examples: ['unleash.is_enabled("feature-toggle")'] },
|
|
56
|
+
{
|
|
57
|
+
name: 'get_variant',
|
|
58
|
+
flagKeyIndex: 0,
|
|
59
|
+
examples: ['unleash.get_variant("feature-toggle")'],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Split.io Python SDK',
|
|
65
|
+
importPattern: 'splitio',
|
|
66
|
+
description: 'Split.io Python SDK',
|
|
67
|
+
enabled: true,
|
|
68
|
+
methods: [
|
|
69
|
+
{
|
|
70
|
+
name: 'get_treatment',
|
|
71
|
+
flagKeyIndex: 1,
|
|
72
|
+
examples: ['client.get_treatment(key, "split-name")'],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Flipt Python SDK',
|
|
78
|
+
importPattern: 'flipt',
|
|
79
|
+
description: 'Flipt Python SDK',
|
|
80
|
+
enabled: true,
|
|
81
|
+
methods: [
|
|
82
|
+
{
|
|
83
|
+
name: 'evaluate_boolean',
|
|
84
|
+
flagKeyIndex: 0,
|
|
85
|
+
examples: ['flipt.evaluate_boolean("flag-key", entity_id)'],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'evaluate_variant',
|
|
89
|
+
flagKeyIndex: 0,
|
|
90
|
+
examples: ['flipt.evaluate_variant("flag-key", entity_id)'],
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'Django Feature Flags',
|
|
96
|
+
importPattern: 'django_feature_flags',
|
|
97
|
+
description: 'Django feature flags',
|
|
98
|
+
enabled: true,
|
|
99
|
+
methods: [
|
|
100
|
+
{ name: 'flag_enabled', flagKeyIndex: 0, examples: ['flag_enabled("feature-name")'] },
|
|
101
|
+
{ name: 'flag_disabled', flagKeyIndex: 0, examples: ['flag_disabled("feature-name")'] },
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'Optimizely Python SDK',
|
|
106
|
+
importPattern: 'optimizely',
|
|
107
|
+
description: 'Optimizely Feature Experimentation Python SDK',
|
|
108
|
+
enabled: true,
|
|
109
|
+
methods: [
|
|
110
|
+
{ name: 'decide', flagKeyIndex: 0, examples: ['user.decide("flag-key", options)'] },
|
|
111
|
+
{
|
|
112
|
+
name: 'decide_for_keys',
|
|
113
|
+
flagKeyIndex: 0,
|
|
114
|
+
examples: ['user.decide_for_keys(["flag-key-1", "flag-key-2"], options)'],
|
|
115
|
+
},
|
|
116
|
+
{ name: 'decide_all', flagKeyIndex: 0, examples: ['user.decide_all(options)'] },
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'Flagsmith Python SDK',
|
|
121
|
+
importPattern: 'flagsmith',
|
|
122
|
+
description: 'Flagsmith Python SDK',
|
|
123
|
+
enabled: true,
|
|
124
|
+
methods: [
|
|
125
|
+
{
|
|
126
|
+
name: 'is_feature_enabled',
|
|
127
|
+
flagKeyIndex: 0,
|
|
128
|
+
examples: ['identity_flags.is_feature_enabled("feature-name")'],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'get_feature_value',
|
|
132
|
+
flagKeyIndex: 0,
|
|
133
|
+
examples: ['identity_flags.get_feature_value("feature-name")'],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'ConfigCat Python SDK',
|
|
139
|
+
importPattern: 'configcatclient',
|
|
140
|
+
description: 'ConfigCat Python SDK',
|
|
141
|
+
enabled: true,
|
|
142
|
+
methods: [
|
|
143
|
+
{
|
|
144
|
+
name: 'get_value',
|
|
145
|
+
flagKeyIndex: 0,
|
|
146
|
+
examples: ['client.get_value("flag-key", default_value)'],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'get_value_details',
|
|
150
|
+
flagKeyIndex: 0,
|
|
151
|
+
examples: ['client.get_value_details("flag-key", default_value)'],
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'Statsig Python SDK',
|
|
157
|
+
importPattern: 'statsig',
|
|
158
|
+
description: 'Statsig Python SDK',
|
|
159
|
+
enabled: true,
|
|
160
|
+
methods: [
|
|
161
|
+
{
|
|
162
|
+
name: 'check_gate',
|
|
163
|
+
flagKeyIndex: 1,
|
|
164
|
+
examples: ['statsig.check_gate(user, "gate-name")'],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'get_experiment',
|
|
168
|
+
flagKeyIndex: 1,
|
|
169
|
+
examples: ['statsig.get_experiment(user, "experiment-name")'],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'get_config',
|
|
173
|
+
flagKeyIndex: 1,
|
|
174
|
+
examples: ['statsig.get_config(user, "config-name")'],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'GrowthBook Python SDK',
|
|
180
|
+
importPattern: 'growthbook',
|
|
181
|
+
description: 'GrowthBook Python SDK',
|
|
182
|
+
enabled: true,
|
|
183
|
+
methods: [
|
|
184
|
+
{ name: 'is_on', flagKeyIndex: 0, examples: ['gb.is_on("feature-key")'] },
|
|
185
|
+
{
|
|
186
|
+
name: 'get_feature_value',
|
|
187
|
+
flagKeyIndex: 0,
|
|
188
|
+
examples: ['gb.get_feature_value("feature-key", fallback_value)'],
|
|
189
|
+
},
|
|
190
|
+
{ name: 'eval_feature', flagKeyIndex: 0, examples: ['gb.eval_feature("feature-key")'] },
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'DevCycle Python SDK',
|
|
195
|
+
importPattern: 'devcycle_python_sdk',
|
|
196
|
+
description: 'DevCycle Python SDK',
|
|
197
|
+
enabled: true,
|
|
198
|
+
methods: [
|
|
199
|
+
{
|
|
200
|
+
name: 'variable_value',
|
|
201
|
+
flagKeyIndex: 1,
|
|
202
|
+
examples: ['client.variable_value(user, "variable-key", default_value)'],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'variable',
|
|
206
|
+
flagKeyIndex: 1,
|
|
207
|
+
examples: ['client.variable(user, "variable-key", default_value)'],
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'Eppo Python SDK',
|
|
213
|
+
importPattern: 'eppo_client',
|
|
214
|
+
description: 'Eppo Python SDK',
|
|
215
|
+
enabled: true,
|
|
216
|
+
methods: [
|
|
217
|
+
{
|
|
218
|
+
name: 'get_boolean_assignment',
|
|
219
|
+
flagKeyIndex: 0,
|
|
220
|
+
examples: ['eppo_client.get_boolean_assignment("flag-key", subject_key, default_value)'],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'get_string_assignment',
|
|
224
|
+
flagKeyIndex: 0,
|
|
225
|
+
examples: ['eppo_client.get_string_assignment("flag-key", subject_key, default_value)'],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'get_numeric_assignment',
|
|
229
|
+
flagKeyIndex: 0,
|
|
230
|
+
examples: ['eppo_client.get_numeric_assignment("flag-key", subject_key, default_value)'],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'get_json_assignment',
|
|
234
|
+
flagKeyIndex: 0,
|
|
235
|
+
examples: ['eppo_client.get_json_assignment("flag-key", subject_key, default_value)'],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'PostHog Python SDK',
|
|
241
|
+
importPattern: 'posthog',
|
|
242
|
+
description: 'PostHog Python SDK',
|
|
243
|
+
enabled: true,
|
|
244
|
+
methods: [
|
|
245
|
+
{
|
|
246
|
+
name: 'feature_enabled',
|
|
247
|
+
flagKeyIndex: 0,
|
|
248
|
+
examples: ['posthog.feature_enabled("flag-key", distinct_id)'],
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'get_feature_flag',
|
|
252
|
+
flagKeyIndex: 0,
|
|
253
|
+
examples: ['posthog.get_feature_flag("flag-key", distinct_id)'],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'get_feature_flag_payload',
|
|
257
|
+
flagKeyIndex: 0,
|
|
258
|
+
examples: ['posthog.get_feature_flag_payload("flag-key", distinct_id)'],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'get_all_flags',
|
|
262
|
+
flagKeyIndex: 0,
|
|
263
|
+
examples: ['posthog.get_all_flags(distinct_id)'],
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'Custom Feature Flags',
|
|
269
|
+
description: 'Common custom Python feature flag patterns',
|
|
270
|
+
enabled: true,
|
|
271
|
+
methods: [
|
|
272
|
+
{
|
|
273
|
+
name: 'is_feature_enabled',
|
|
274
|
+
flagKeyIndex: 0,
|
|
275
|
+
examples: ['is_feature_enabled("feature-name")'],
|
|
276
|
+
},
|
|
277
|
+
{ name: 'feature_flag', flagKeyIndex: 0, examples: ['feature_flag("feature-name")'] },
|
|
278
|
+
{ name: 'has_feature', flagKeyIndex: 0, examples: ['has_feature("feature-name")'] },
|
|
279
|
+
{ name: 'check_feature', flagKeyIndex: 0, examples: ['check_feature("feature-name")'] },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
];
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +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OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,YAAY,EAAE,CAAC;oBACf,QAAQ,EAAE,CAAC,oCAAoC,CAAC;iBACjD;gBACD,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,8BAA8B,CAAC,EAAE;gBACrF,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,6BAA6B,CAAC,EAAE;gBACnF,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,+BAA+B,CAAC,EAAE;aACxF;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ruby language feature flag detector.
|
|
3
|
+
* Ported from Go: internal/languages/ruby/detector.go
|
|
4
|
+
*/
|
|
5
|
+
import type { FeatureFlag } from '../feature-flag.js';
|
|
6
|
+
import type { FeatureFlagProvider, Language, LanguageDetector } from '../interface.js';
|
|
7
|
+
export declare class RubyDetector implements LanguageDetector {
|
|
8
|
+
private readonly providers;
|
|
9
|
+
constructor(providers?: FeatureFlagProvider[]);
|
|
10
|
+
language(): Language;
|
|
11
|
+
fileExtensions(): string[];
|
|
12
|
+
supportsFile(filename: string): boolean;
|
|
13
|
+
detectFlags(filename: string, content: string): FeatureFlag[];
|
|
14
|
+
getProviders(): FeatureFlagProvider[];
|
|
15
|
+
}
|
|
16
|
+
export declare function defaultRubyProviders(): FeatureFlagProvider[];
|
|
17
|
+
//# sourceMappingURL=ruby.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../../src/detection/detectors/ruby.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEtF,qBAAa,YAAa,YAAW,gBAAgB;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuB;gBAErC,SAAS,CAAC,EAAE,mBAAmB,EAAE;IAI7C,QAAQ,IAAI,QAAQ;IAIpB,cAAc,IAAI,MAAM,EAAE;IAI1B,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAWvC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IAI7D,YAAY,IAAI,mBAAmB,EAAE;CAGtC;AAED,wBAAgB,oBAAoB,IAAI,mBAAmB,EAAE,CA+N5D"}
|