@lssm/lib.feature-flags 0.0.0-canary-20251217083314 → 1.41.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/contracts/index.js +1 -910
- package/dist/docs/feature-flags.docblock.js +2 -21
- package/dist/docs/index.js +1 -1
- package/dist/entities/index.js +1 -325
- package/dist/evaluation/index.js +1 -220
- package/dist/events.js +1 -459
- package/dist/feature-flags.feature.js +1 -139
- package/dist/index.js +1 -8
- package/package.json +13 -14
- package/dist/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/contracts/dist/client/index.js +0 -5
- package/dist/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/contracts/dist/client/react/form-render.js +0 -4
- package/dist/contracts/dist/client/react/index.js +0 -4
- package/dist/contracts/dist/contract-registry/index.js +0 -1
- package/dist/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/contracts/dist/docs/index.js +0 -29
- package/dist/contracts/dist/docs/presentations.js +0 -71
- package/dist/contracts/dist/docs/registry.js +0 -44
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/contracts/dist/events.js +0 -10
- package/dist/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/contracts/dist/index.js +0 -71
- package/dist/contracts/dist/install.js +0 -2
- package/dist/contracts/dist/integrations/contracts.js +0 -377
- package/dist/contracts/dist/integrations/index.js +0 -18
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/contracts/dist/jsonschema.js +0 -1
- package/dist/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/contracts/dist/knowledge/index.js +0 -7
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/contracts/dist/llm/exporters.js +0 -19
- package/dist/contracts/dist/llm/index.js +0 -2
- package/dist/contracts/dist/llm/prompts.js +0 -1
- package/dist/contracts/dist/onboarding-base.js +0 -196
- package/dist/contracts/dist/openapi.js +0 -1
- package/dist/contracts/dist/ownership.js +0 -21
- package/dist/contracts/dist/presentations.js +0 -1
- package/dist/contracts/dist/presentations.v2.js +0 -11
- package/dist/contracts/dist/prompt.js +0 -1
- package/dist/contracts/dist/promptRegistry.js +0 -1
- package/dist/contracts/dist/regenerator/index.js +0 -1
- package/dist/contracts/dist/regenerator/service.js +0 -6
- package/dist/contracts/dist/registry.js +0 -2
- package/dist/contracts/dist/resources.js +0 -1
- package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/contracts/dist/schema/dist/index.js +0 -6
- package/dist/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/contracts/dist/server/index.js +0 -8
- package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/contracts/dist/server/rest-express.js +0 -1
- package/dist/contracts/dist/server/rest-generic.js +0 -1
- package/dist/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/contracts/dist/spec.js +0 -34
- package/dist/contracts/dist/telemetry/index.js +0 -1
- package/dist/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/contracts/dist/tests/index.js +0 -1
- package/dist/contracts/dist/tests/runner.js +0 -2
- package/dist/contracts/dist/workflow/index.js +0 -1
- package/dist/contracts/dist/workflow/runner.js +0 -1
- package/dist/contracts/index.d.ts +0 -1006
- package/dist/docs/feature-flags.docblock.d.ts +0 -1
- package/dist/docs/index.d.ts +0 -1
- package/dist/entities/index.d.ts +0 -200
- package/dist/evaluation/index.d.ts +0 -162
- package/dist/events.d.ts +0 -624
- package/dist/feature-flags.feature.d.ts +0 -11
- package/dist/index.d.ts +0 -6
- package/dist/schema/dist/EnumType.js +0 -2
- package/dist/schema/dist/FieldType.js +0 -49
- package/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/schema/dist/SchemaModel.js +0 -39
- package/dist/schema/dist/entity/defineEntity.js +0 -236
- package/dist/schema/dist/entity/index.js +0 -2
- package/dist/schema/dist/entity/types.js +0 -1
- package/dist/schema/dist/index.js +0 -6
package/dist/contracts/index.js
CHANGED
|
@@ -1,910 +1 @@
|
|
|
1
|
-
import { ScalarTypeEnum } from "../schema/dist/ScalarTypeEnum.js";
|
|
2
|
-
import { defineSchemaModel } from "../schema/dist/SchemaModel.js";
|
|
3
|
-
import "../schema/dist/index.js";
|
|
4
|
-
import { defineCommand, defineQuery } from "./dist/spec.js";
|
|
5
|
-
import "./dist/index.js";
|
|
6
|
-
|
|
7
|
-
//#region src/contracts/index.ts
|
|
8
|
-
const OWNERS = ["platform.feature-flags"];
|
|
9
|
-
const FeatureFlagModel = defineSchemaModel({
|
|
10
|
-
name: "FeatureFlag",
|
|
11
|
-
description: "Represents a feature flag",
|
|
12
|
-
fields: {
|
|
13
|
-
id: {
|
|
14
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
-
isOptional: false
|
|
16
|
-
},
|
|
17
|
-
key: {
|
|
18
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
-
isOptional: false
|
|
20
|
-
},
|
|
21
|
-
name: {
|
|
22
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
-
isOptional: false
|
|
24
|
-
},
|
|
25
|
-
description: {
|
|
26
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
-
isOptional: true
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
30
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
31
|
-
isOptional: false
|
|
32
|
-
},
|
|
33
|
-
defaultValue: {
|
|
34
|
-
type: ScalarTypeEnum.Boolean(),
|
|
35
|
-
isOptional: false
|
|
36
|
-
},
|
|
37
|
-
variants: {
|
|
38
|
-
type: ScalarTypeEnum.JSON(),
|
|
39
|
-
isOptional: true
|
|
40
|
-
},
|
|
41
|
-
orgId: {
|
|
42
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
43
|
-
isOptional: true
|
|
44
|
-
},
|
|
45
|
-
tags: {
|
|
46
|
-
type: ScalarTypeEnum.JSON(),
|
|
47
|
-
isOptional: true
|
|
48
|
-
},
|
|
49
|
-
createdAt: {
|
|
50
|
-
type: ScalarTypeEnum.DateTime(),
|
|
51
|
-
isOptional: false
|
|
52
|
-
},
|
|
53
|
-
updatedAt: {
|
|
54
|
-
type: ScalarTypeEnum.DateTime(),
|
|
55
|
-
isOptional: false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
const TargetingRuleModel = defineSchemaModel({
|
|
60
|
-
name: "TargetingRule",
|
|
61
|
-
description: "Represents a targeting rule",
|
|
62
|
-
fields: {
|
|
63
|
-
id: {
|
|
64
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
65
|
-
isOptional: false
|
|
66
|
-
},
|
|
67
|
-
flagId: {
|
|
68
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
69
|
-
isOptional: false
|
|
70
|
-
},
|
|
71
|
-
name: {
|
|
72
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
73
|
-
isOptional: true
|
|
74
|
-
},
|
|
75
|
-
priority: {
|
|
76
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
77
|
-
isOptional: false
|
|
78
|
-
},
|
|
79
|
-
enabled: {
|
|
80
|
-
type: ScalarTypeEnum.Boolean(),
|
|
81
|
-
isOptional: false
|
|
82
|
-
},
|
|
83
|
-
attribute: {
|
|
84
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
85
|
-
isOptional: false
|
|
86
|
-
},
|
|
87
|
-
operator: {
|
|
88
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
89
|
-
isOptional: false
|
|
90
|
-
},
|
|
91
|
-
value: {
|
|
92
|
-
type: ScalarTypeEnum.JSON(),
|
|
93
|
-
isOptional: false
|
|
94
|
-
},
|
|
95
|
-
rolloutPercentage: {
|
|
96
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
97
|
-
isOptional: true
|
|
98
|
-
},
|
|
99
|
-
serveValue: {
|
|
100
|
-
type: ScalarTypeEnum.Boolean(),
|
|
101
|
-
isOptional: true
|
|
102
|
-
},
|
|
103
|
-
serveVariant: {
|
|
104
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
105
|
-
isOptional: true
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const ExperimentModel = defineSchemaModel({
|
|
110
|
-
name: "Experiment",
|
|
111
|
-
description: "Represents an experiment",
|
|
112
|
-
fields: {
|
|
113
|
-
id: {
|
|
114
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
115
|
-
isOptional: false
|
|
116
|
-
},
|
|
117
|
-
key: {
|
|
118
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
119
|
-
isOptional: false
|
|
120
|
-
},
|
|
121
|
-
name: {
|
|
122
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
123
|
-
isOptional: false
|
|
124
|
-
},
|
|
125
|
-
description: {
|
|
126
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
127
|
-
isOptional: true
|
|
128
|
-
},
|
|
129
|
-
hypothesis: {
|
|
130
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
131
|
-
isOptional: true
|
|
132
|
-
},
|
|
133
|
-
flagId: {
|
|
134
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
135
|
-
isOptional: false
|
|
136
|
-
},
|
|
137
|
-
status: {
|
|
138
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
139
|
-
isOptional: false
|
|
140
|
-
},
|
|
141
|
-
variants: {
|
|
142
|
-
type: ScalarTypeEnum.JSON(),
|
|
143
|
-
isOptional: false
|
|
144
|
-
},
|
|
145
|
-
metrics: {
|
|
146
|
-
type: ScalarTypeEnum.JSON(),
|
|
147
|
-
isOptional: true
|
|
148
|
-
},
|
|
149
|
-
audiencePercentage: {
|
|
150
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
151
|
-
isOptional: false
|
|
152
|
-
},
|
|
153
|
-
startedAt: {
|
|
154
|
-
type: ScalarTypeEnum.DateTime(),
|
|
155
|
-
isOptional: true
|
|
156
|
-
},
|
|
157
|
-
endedAt: {
|
|
158
|
-
type: ScalarTypeEnum.DateTime(),
|
|
159
|
-
isOptional: true
|
|
160
|
-
},
|
|
161
|
-
winningVariant: {
|
|
162
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
163
|
-
isOptional: true
|
|
164
|
-
},
|
|
165
|
-
results: {
|
|
166
|
-
type: ScalarTypeEnum.JSON(),
|
|
167
|
-
isOptional: true
|
|
168
|
-
},
|
|
169
|
-
createdAt: {
|
|
170
|
-
type: ScalarTypeEnum.DateTime(),
|
|
171
|
-
isOptional: false
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
const EvaluationResultModel = defineSchemaModel({
|
|
176
|
-
name: "EvaluationResult",
|
|
177
|
-
description: "Result of flag evaluation",
|
|
178
|
-
fields: {
|
|
179
|
-
enabled: {
|
|
180
|
-
type: ScalarTypeEnum.Boolean(),
|
|
181
|
-
isOptional: false
|
|
182
|
-
},
|
|
183
|
-
variant: {
|
|
184
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
185
|
-
isOptional: true
|
|
186
|
-
},
|
|
187
|
-
reason: {
|
|
188
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
189
|
-
isOptional: false
|
|
190
|
-
},
|
|
191
|
-
ruleId: {
|
|
192
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
193
|
-
isOptional: true
|
|
194
|
-
},
|
|
195
|
-
experimentId: {
|
|
196
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
197
|
-
isOptional: true
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
const CreateFlagInput = defineSchemaModel({
|
|
202
|
-
name: "CreateFlagInput",
|
|
203
|
-
description: "Input for creating a feature flag",
|
|
204
|
-
fields: {
|
|
205
|
-
key: {
|
|
206
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
207
|
-
isOptional: false
|
|
208
|
-
},
|
|
209
|
-
name: {
|
|
210
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
211
|
-
isOptional: false
|
|
212
|
-
},
|
|
213
|
-
description: {
|
|
214
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
215
|
-
isOptional: true
|
|
216
|
-
},
|
|
217
|
-
defaultValue: {
|
|
218
|
-
type: ScalarTypeEnum.Boolean(),
|
|
219
|
-
isOptional: true
|
|
220
|
-
},
|
|
221
|
-
variants: {
|
|
222
|
-
type: ScalarTypeEnum.JSON(),
|
|
223
|
-
isOptional: true
|
|
224
|
-
},
|
|
225
|
-
orgId: {
|
|
226
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
227
|
-
isOptional: true
|
|
228
|
-
},
|
|
229
|
-
tags: {
|
|
230
|
-
type: ScalarTypeEnum.JSON(),
|
|
231
|
-
isOptional: true
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
const UpdateFlagInput = defineSchemaModel({
|
|
236
|
-
name: "UpdateFlagInput",
|
|
237
|
-
description: "Input for updating a feature flag",
|
|
238
|
-
fields: {
|
|
239
|
-
flagId: {
|
|
240
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
241
|
-
isOptional: false
|
|
242
|
-
},
|
|
243
|
-
name: {
|
|
244
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
245
|
-
isOptional: true
|
|
246
|
-
},
|
|
247
|
-
description: {
|
|
248
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
249
|
-
isOptional: true
|
|
250
|
-
},
|
|
251
|
-
defaultValue: {
|
|
252
|
-
type: ScalarTypeEnum.Boolean(),
|
|
253
|
-
isOptional: true
|
|
254
|
-
},
|
|
255
|
-
variants: {
|
|
256
|
-
type: ScalarTypeEnum.JSON(),
|
|
257
|
-
isOptional: true
|
|
258
|
-
},
|
|
259
|
-
tags: {
|
|
260
|
-
type: ScalarTypeEnum.JSON(),
|
|
261
|
-
isOptional: true
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
const DeleteFlagInput = defineSchemaModel({
|
|
266
|
-
name: "DeleteFlagInput",
|
|
267
|
-
description: "Input for deleting a feature flag",
|
|
268
|
-
fields: { flagId: {
|
|
269
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
270
|
-
isOptional: false
|
|
271
|
-
} }
|
|
272
|
-
});
|
|
273
|
-
const ToggleFlagInput = defineSchemaModel({
|
|
274
|
-
name: "ToggleFlagInput",
|
|
275
|
-
description: "Input for toggling a feature flag",
|
|
276
|
-
fields: {
|
|
277
|
-
flagId: {
|
|
278
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
279
|
-
isOptional: false
|
|
280
|
-
},
|
|
281
|
-
status: {
|
|
282
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
283
|
-
isOptional: false
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
const GetFlagInput = defineSchemaModel({
|
|
288
|
-
name: "GetFlagInput",
|
|
289
|
-
description: "Input for getting a feature flag",
|
|
290
|
-
fields: {
|
|
291
|
-
key: {
|
|
292
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
293
|
-
isOptional: false
|
|
294
|
-
},
|
|
295
|
-
orgId: {
|
|
296
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
297
|
-
isOptional: true
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
const ListFlagsInput = defineSchemaModel({
|
|
302
|
-
name: "ListFlagsInput",
|
|
303
|
-
description: "Input for listing feature flags",
|
|
304
|
-
fields: {
|
|
305
|
-
orgId: {
|
|
306
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
307
|
-
isOptional: true
|
|
308
|
-
},
|
|
309
|
-
status: {
|
|
310
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
311
|
-
isOptional: true
|
|
312
|
-
},
|
|
313
|
-
tags: {
|
|
314
|
-
type: ScalarTypeEnum.JSON(),
|
|
315
|
-
isOptional: true
|
|
316
|
-
},
|
|
317
|
-
limit: {
|
|
318
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
319
|
-
isOptional: true
|
|
320
|
-
},
|
|
321
|
-
offset: {
|
|
322
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
323
|
-
isOptional: true
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
const ListFlagsOutput = defineSchemaModel({
|
|
328
|
-
name: "ListFlagsOutput",
|
|
329
|
-
description: "Output for listing feature flags",
|
|
330
|
-
fields: {
|
|
331
|
-
flags: {
|
|
332
|
-
type: FeatureFlagModel,
|
|
333
|
-
isArray: true,
|
|
334
|
-
isOptional: false
|
|
335
|
-
},
|
|
336
|
-
total: {
|
|
337
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
338
|
-
isOptional: false
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
const EvaluateFlagInput = defineSchemaModel({
|
|
343
|
-
name: "EvaluateFlagInput",
|
|
344
|
-
description: "Input for evaluating a feature flag",
|
|
345
|
-
fields: {
|
|
346
|
-
key: {
|
|
347
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
348
|
-
isOptional: false
|
|
349
|
-
},
|
|
350
|
-
context: {
|
|
351
|
-
type: ScalarTypeEnum.JSON(),
|
|
352
|
-
isOptional: false
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
const CreateRuleInput = defineSchemaModel({
|
|
357
|
-
name: "CreateRuleInput",
|
|
358
|
-
description: "Input for creating a targeting rule",
|
|
359
|
-
fields: {
|
|
360
|
-
flagId: {
|
|
361
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
362
|
-
isOptional: false
|
|
363
|
-
},
|
|
364
|
-
name: {
|
|
365
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
366
|
-
isOptional: true
|
|
367
|
-
},
|
|
368
|
-
priority: {
|
|
369
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
370
|
-
isOptional: true
|
|
371
|
-
},
|
|
372
|
-
attribute: {
|
|
373
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
374
|
-
isOptional: false
|
|
375
|
-
},
|
|
376
|
-
operator: {
|
|
377
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
378
|
-
isOptional: false
|
|
379
|
-
},
|
|
380
|
-
value: {
|
|
381
|
-
type: ScalarTypeEnum.JSON(),
|
|
382
|
-
isOptional: false
|
|
383
|
-
},
|
|
384
|
-
rolloutPercentage: {
|
|
385
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
386
|
-
isOptional: true
|
|
387
|
-
},
|
|
388
|
-
serveValue: {
|
|
389
|
-
type: ScalarTypeEnum.Boolean(),
|
|
390
|
-
isOptional: true
|
|
391
|
-
},
|
|
392
|
-
serveVariant: {
|
|
393
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
394
|
-
isOptional: true
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
const DeleteRuleInput = defineSchemaModel({
|
|
399
|
-
name: "DeleteRuleInput",
|
|
400
|
-
description: "Input for deleting a targeting rule",
|
|
401
|
-
fields: { ruleId: {
|
|
402
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
403
|
-
isOptional: false
|
|
404
|
-
} }
|
|
405
|
-
});
|
|
406
|
-
const CreateExperimentInput = defineSchemaModel({
|
|
407
|
-
name: "CreateExperimentInput",
|
|
408
|
-
description: "Input for creating an experiment",
|
|
409
|
-
fields: {
|
|
410
|
-
key: {
|
|
411
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
412
|
-
isOptional: false
|
|
413
|
-
},
|
|
414
|
-
name: {
|
|
415
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
416
|
-
isOptional: false
|
|
417
|
-
},
|
|
418
|
-
description: {
|
|
419
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
420
|
-
isOptional: true
|
|
421
|
-
},
|
|
422
|
-
hypothesis: {
|
|
423
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
424
|
-
isOptional: true
|
|
425
|
-
},
|
|
426
|
-
flagId: {
|
|
427
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
428
|
-
isOptional: false
|
|
429
|
-
},
|
|
430
|
-
variants: {
|
|
431
|
-
type: ScalarTypeEnum.JSON(),
|
|
432
|
-
isOptional: false
|
|
433
|
-
},
|
|
434
|
-
metrics: {
|
|
435
|
-
type: ScalarTypeEnum.JSON(),
|
|
436
|
-
isOptional: true
|
|
437
|
-
},
|
|
438
|
-
audiencePercentage: {
|
|
439
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
440
|
-
isOptional: true
|
|
441
|
-
},
|
|
442
|
-
scheduledStartAt: {
|
|
443
|
-
type: ScalarTypeEnum.DateTime(),
|
|
444
|
-
isOptional: true
|
|
445
|
-
},
|
|
446
|
-
scheduledEndAt: {
|
|
447
|
-
type: ScalarTypeEnum.DateTime(),
|
|
448
|
-
isOptional: true
|
|
449
|
-
},
|
|
450
|
-
orgId: {
|
|
451
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
452
|
-
isOptional: true
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
const StartExperimentInput = defineSchemaModel({
|
|
457
|
-
name: "StartExperimentInput",
|
|
458
|
-
description: "Input for starting an experiment",
|
|
459
|
-
fields: { experimentId: {
|
|
460
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
461
|
-
isOptional: false
|
|
462
|
-
} }
|
|
463
|
-
});
|
|
464
|
-
const StopExperimentInput = defineSchemaModel({
|
|
465
|
-
name: "StopExperimentInput",
|
|
466
|
-
description: "Input for stopping an experiment",
|
|
467
|
-
fields: {
|
|
468
|
-
experimentId: {
|
|
469
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
470
|
-
isOptional: false
|
|
471
|
-
},
|
|
472
|
-
reason: {
|
|
473
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
474
|
-
isOptional: false
|
|
475
|
-
},
|
|
476
|
-
winningVariant: {
|
|
477
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
478
|
-
isOptional: true
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
const GetExperimentInput = defineSchemaModel({
|
|
483
|
-
name: "GetExperimentInput",
|
|
484
|
-
description: "Input for getting an experiment",
|
|
485
|
-
fields: { experimentId: {
|
|
486
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
487
|
-
isOptional: false
|
|
488
|
-
} }
|
|
489
|
-
});
|
|
490
|
-
const SuccessOutput = defineSchemaModel({
|
|
491
|
-
name: "SuccessOutput",
|
|
492
|
-
description: "Generic success output",
|
|
493
|
-
fields: { success: {
|
|
494
|
-
type: ScalarTypeEnum.Boolean(),
|
|
495
|
-
isOptional: false
|
|
496
|
-
} }
|
|
497
|
-
});
|
|
498
|
-
/**
|
|
499
|
-
* Create a feature flag.
|
|
500
|
-
*/
|
|
501
|
-
const CreateFlagContract = defineCommand({
|
|
502
|
-
meta: {
|
|
503
|
-
name: "flag.create",
|
|
504
|
-
version: 1,
|
|
505
|
-
stability: "stable",
|
|
506
|
-
owners: [...OWNERS],
|
|
507
|
-
tags: ["feature-flags", "create"],
|
|
508
|
-
description: "Create a new feature flag.",
|
|
509
|
-
goal: "Define a new feature flag for toggling features.",
|
|
510
|
-
context: "Called when setting up a new feature flag."
|
|
511
|
-
},
|
|
512
|
-
io: {
|
|
513
|
-
input: CreateFlagInput,
|
|
514
|
-
output: FeatureFlagModel,
|
|
515
|
-
errors: { KEY_ALREADY_EXISTS: {
|
|
516
|
-
description: "Flag key already exists",
|
|
517
|
-
http: 409,
|
|
518
|
-
gqlCode: "FLAG_KEY_EXISTS",
|
|
519
|
-
when: "A flag with this key already exists"
|
|
520
|
-
} }
|
|
521
|
-
},
|
|
522
|
-
policy: { auth: "admin" }
|
|
523
|
-
});
|
|
524
|
-
/**
|
|
525
|
-
* Update a feature flag.
|
|
526
|
-
*/
|
|
527
|
-
const UpdateFlagContract = defineCommand({
|
|
528
|
-
meta: {
|
|
529
|
-
name: "flag.update",
|
|
530
|
-
version: 1,
|
|
531
|
-
stability: "stable",
|
|
532
|
-
owners: [...OWNERS],
|
|
533
|
-
tags: ["feature-flags", "update"],
|
|
534
|
-
description: "Update an existing feature flag.",
|
|
535
|
-
goal: "Modify flag configuration.",
|
|
536
|
-
context: "Called when adjusting flag settings."
|
|
537
|
-
},
|
|
538
|
-
io: {
|
|
539
|
-
input: UpdateFlagInput,
|
|
540
|
-
output: FeatureFlagModel,
|
|
541
|
-
errors: { FLAG_NOT_FOUND: {
|
|
542
|
-
description: "Flag does not exist",
|
|
543
|
-
http: 404,
|
|
544
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
545
|
-
when: "Flag ID is invalid"
|
|
546
|
-
} }
|
|
547
|
-
},
|
|
548
|
-
policy: { auth: "admin" }
|
|
549
|
-
});
|
|
550
|
-
/**
|
|
551
|
-
* Delete a feature flag.
|
|
552
|
-
*/
|
|
553
|
-
const DeleteFlagContract = defineCommand({
|
|
554
|
-
meta: {
|
|
555
|
-
name: "flag.delete",
|
|
556
|
-
version: 1,
|
|
557
|
-
stability: "stable",
|
|
558
|
-
owners: [...OWNERS],
|
|
559
|
-
tags: ["feature-flags", "delete"],
|
|
560
|
-
description: "Delete a feature flag.",
|
|
561
|
-
goal: "Remove a feature flag and all its rules.",
|
|
562
|
-
context: "Called when a flag is no longer needed."
|
|
563
|
-
},
|
|
564
|
-
io: {
|
|
565
|
-
input: DeleteFlagInput,
|
|
566
|
-
output: SuccessOutput,
|
|
567
|
-
errors: {
|
|
568
|
-
FLAG_NOT_FOUND: {
|
|
569
|
-
description: "Flag does not exist",
|
|
570
|
-
http: 404,
|
|
571
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
572
|
-
when: "Flag ID is invalid"
|
|
573
|
-
},
|
|
574
|
-
FLAG_HAS_ACTIVE_EXPERIMENT: {
|
|
575
|
-
description: "Flag has an active experiment",
|
|
576
|
-
http: 409,
|
|
577
|
-
gqlCode: "FLAG_HAS_ACTIVE_EXPERIMENT",
|
|
578
|
-
when: "Cannot delete flag with running experiment"
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
policy: { auth: "admin" }
|
|
583
|
-
});
|
|
584
|
-
/**
|
|
585
|
-
* Toggle a feature flag status.
|
|
586
|
-
*/
|
|
587
|
-
const ToggleFlagContract = defineCommand({
|
|
588
|
-
meta: {
|
|
589
|
-
name: "flag.toggle",
|
|
590
|
-
version: 1,
|
|
591
|
-
stability: "stable",
|
|
592
|
-
owners: [...OWNERS],
|
|
593
|
-
tags: ["feature-flags", "toggle"],
|
|
594
|
-
description: "Toggle a feature flag status.",
|
|
595
|
-
goal: "Quickly enable or disable a feature.",
|
|
596
|
-
context: "Called when turning a feature on or off."
|
|
597
|
-
},
|
|
598
|
-
io: {
|
|
599
|
-
input: ToggleFlagInput,
|
|
600
|
-
output: FeatureFlagModel,
|
|
601
|
-
errors: {
|
|
602
|
-
FLAG_NOT_FOUND: {
|
|
603
|
-
description: "Flag does not exist",
|
|
604
|
-
http: 404,
|
|
605
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
606
|
-
when: "Flag ID is invalid"
|
|
607
|
-
},
|
|
608
|
-
INVALID_STATUS: {
|
|
609
|
-
description: "Invalid status value",
|
|
610
|
-
http: 400,
|
|
611
|
-
gqlCode: "INVALID_STATUS",
|
|
612
|
-
when: "Status must be OFF, ON, or GRADUAL"
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
policy: { auth: "admin" }
|
|
617
|
-
});
|
|
618
|
-
/**
|
|
619
|
-
* Get a feature flag by key.
|
|
620
|
-
*/
|
|
621
|
-
const GetFlagContract = defineQuery({
|
|
622
|
-
meta: {
|
|
623
|
-
name: "flag.get",
|
|
624
|
-
version: 1,
|
|
625
|
-
stability: "stable",
|
|
626
|
-
owners: [...OWNERS],
|
|
627
|
-
tags: ["feature-flags", "get"],
|
|
628
|
-
description: "Get a feature flag by key.",
|
|
629
|
-
goal: "Retrieve flag configuration.",
|
|
630
|
-
context: "Called to inspect flag details."
|
|
631
|
-
},
|
|
632
|
-
io: {
|
|
633
|
-
input: GetFlagInput,
|
|
634
|
-
output: FeatureFlagModel,
|
|
635
|
-
errors: { FLAG_NOT_FOUND: {
|
|
636
|
-
description: "Flag does not exist",
|
|
637
|
-
http: 404,
|
|
638
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
639
|
-
when: "Flag key is invalid"
|
|
640
|
-
} }
|
|
641
|
-
},
|
|
642
|
-
policy: { auth: "user" }
|
|
643
|
-
});
|
|
644
|
-
/**
|
|
645
|
-
* List feature flags.
|
|
646
|
-
*/
|
|
647
|
-
const ListFlagsContract = defineQuery({
|
|
648
|
-
meta: {
|
|
649
|
-
name: "flag.list",
|
|
650
|
-
version: 1,
|
|
651
|
-
stability: "stable",
|
|
652
|
-
owners: [...OWNERS],
|
|
653
|
-
tags: ["feature-flags", "list"],
|
|
654
|
-
description: "List all feature flags.",
|
|
655
|
-
goal: "View all configured flags.",
|
|
656
|
-
context: "Admin dashboard."
|
|
657
|
-
},
|
|
658
|
-
io: {
|
|
659
|
-
input: ListFlagsInput,
|
|
660
|
-
output: ListFlagsOutput
|
|
661
|
-
},
|
|
662
|
-
policy: { auth: "admin" }
|
|
663
|
-
});
|
|
664
|
-
/**
|
|
665
|
-
* Evaluate a feature flag.
|
|
666
|
-
*/
|
|
667
|
-
const EvaluateFlagContract = defineQuery({
|
|
668
|
-
meta: {
|
|
669
|
-
name: "flag.evaluate",
|
|
670
|
-
version: 1,
|
|
671
|
-
stability: "stable",
|
|
672
|
-
owners: [...OWNERS],
|
|
673
|
-
tags: ["feature-flags", "evaluate"],
|
|
674
|
-
description: "Evaluate a feature flag for a given context.",
|
|
675
|
-
goal: "Determine if a feature should be enabled.",
|
|
676
|
-
context: "Called at runtime to check feature availability."
|
|
677
|
-
},
|
|
678
|
-
io: {
|
|
679
|
-
input: EvaluateFlagInput,
|
|
680
|
-
output: EvaluationResultModel,
|
|
681
|
-
errors: { FLAG_NOT_FOUND: {
|
|
682
|
-
description: "Flag does not exist",
|
|
683
|
-
http: 404,
|
|
684
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
685
|
-
when: "Flag key is invalid"
|
|
686
|
-
} }
|
|
687
|
-
},
|
|
688
|
-
policy: { auth: "anonymous" }
|
|
689
|
-
});
|
|
690
|
-
/**
|
|
691
|
-
* Create a targeting rule.
|
|
692
|
-
*/
|
|
693
|
-
const CreateRuleContract = defineCommand({
|
|
694
|
-
meta: {
|
|
695
|
-
name: "flag.rule.create",
|
|
696
|
-
version: 1,
|
|
697
|
-
stability: "stable",
|
|
698
|
-
owners: [...OWNERS],
|
|
699
|
-
tags: [
|
|
700
|
-
"feature-flags",
|
|
701
|
-
"rule",
|
|
702
|
-
"create"
|
|
703
|
-
],
|
|
704
|
-
description: "Create a targeting rule for a flag.",
|
|
705
|
-
goal: "Add conditional targeting to a flag.",
|
|
706
|
-
context: "Called when setting up targeting."
|
|
707
|
-
},
|
|
708
|
-
io: {
|
|
709
|
-
input: CreateRuleInput,
|
|
710
|
-
output: TargetingRuleModel,
|
|
711
|
-
errors: {
|
|
712
|
-
FLAG_NOT_FOUND: {
|
|
713
|
-
description: "Flag does not exist",
|
|
714
|
-
http: 404,
|
|
715
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
716
|
-
when: "Flag ID is invalid"
|
|
717
|
-
},
|
|
718
|
-
INVALID_OPERATOR: {
|
|
719
|
-
description: "Invalid operator",
|
|
720
|
-
http: 400,
|
|
721
|
-
gqlCode: "INVALID_OPERATOR",
|
|
722
|
-
when: "Operator is not supported"
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
},
|
|
726
|
-
policy: { auth: "admin" }
|
|
727
|
-
});
|
|
728
|
-
/**
|
|
729
|
-
* Delete a targeting rule.
|
|
730
|
-
*/
|
|
731
|
-
const DeleteRuleContract = defineCommand({
|
|
732
|
-
meta: {
|
|
733
|
-
name: "flag.rule.delete",
|
|
734
|
-
version: 1,
|
|
735
|
-
stability: "stable",
|
|
736
|
-
owners: [...OWNERS],
|
|
737
|
-
tags: [
|
|
738
|
-
"feature-flags",
|
|
739
|
-
"rule",
|
|
740
|
-
"delete"
|
|
741
|
-
],
|
|
742
|
-
description: "Delete a targeting rule.",
|
|
743
|
-
goal: "Remove a targeting rule from a flag.",
|
|
744
|
-
context: "Called when removing targeting conditions."
|
|
745
|
-
},
|
|
746
|
-
io: {
|
|
747
|
-
input: DeleteRuleInput,
|
|
748
|
-
output: SuccessOutput,
|
|
749
|
-
errors: { RULE_NOT_FOUND: {
|
|
750
|
-
description: "Rule does not exist",
|
|
751
|
-
http: 404,
|
|
752
|
-
gqlCode: "RULE_NOT_FOUND",
|
|
753
|
-
when: "Rule ID is invalid"
|
|
754
|
-
} }
|
|
755
|
-
},
|
|
756
|
-
policy: { auth: "admin" }
|
|
757
|
-
});
|
|
758
|
-
/**
|
|
759
|
-
* Create an experiment.
|
|
760
|
-
*/
|
|
761
|
-
const CreateExperimentContract = defineCommand({
|
|
762
|
-
meta: {
|
|
763
|
-
name: "experiment.create",
|
|
764
|
-
version: 1,
|
|
765
|
-
stability: "stable",
|
|
766
|
-
owners: [...OWNERS],
|
|
767
|
-
tags: [
|
|
768
|
-
"feature-flags",
|
|
769
|
-
"experiment",
|
|
770
|
-
"create"
|
|
771
|
-
],
|
|
772
|
-
description: "Create an A/B test experiment.",
|
|
773
|
-
goal: "Set up an experiment with variants.",
|
|
774
|
-
context: "Called when setting up A/B testing."
|
|
775
|
-
},
|
|
776
|
-
io: {
|
|
777
|
-
input: CreateExperimentInput,
|
|
778
|
-
output: ExperimentModel,
|
|
779
|
-
errors: {
|
|
780
|
-
FLAG_NOT_FOUND: {
|
|
781
|
-
description: "Flag does not exist",
|
|
782
|
-
http: 404,
|
|
783
|
-
gqlCode: "FLAG_NOT_FOUND",
|
|
784
|
-
when: "Flag ID is invalid"
|
|
785
|
-
},
|
|
786
|
-
EXPERIMENT_KEY_EXISTS: {
|
|
787
|
-
description: "Experiment key already exists",
|
|
788
|
-
http: 409,
|
|
789
|
-
gqlCode: "EXPERIMENT_KEY_EXISTS",
|
|
790
|
-
when: "An experiment with this key already exists"
|
|
791
|
-
},
|
|
792
|
-
INVALID_VARIANTS: {
|
|
793
|
-
description: "Invalid variant configuration",
|
|
794
|
-
http: 400,
|
|
795
|
-
gqlCode: "INVALID_VARIANTS",
|
|
796
|
-
when: "Variant percentages must sum to 100"
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
},
|
|
800
|
-
policy: { auth: "admin" }
|
|
801
|
-
});
|
|
802
|
-
/**
|
|
803
|
-
* Start an experiment.
|
|
804
|
-
*/
|
|
805
|
-
const StartExperimentContract = defineCommand({
|
|
806
|
-
meta: {
|
|
807
|
-
name: "experiment.start",
|
|
808
|
-
version: 1,
|
|
809
|
-
stability: "stable",
|
|
810
|
-
owners: [...OWNERS],
|
|
811
|
-
tags: [
|
|
812
|
-
"feature-flags",
|
|
813
|
-
"experiment",
|
|
814
|
-
"start"
|
|
815
|
-
],
|
|
816
|
-
description: "Start an experiment.",
|
|
817
|
-
goal: "Begin collecting data for an experiment.",
|
|
818
|
-
context: "Called when ready to run an A/B test."
|
|
819
|
-
},
|
|
820
|
-
io: {
|
|
821
|
-
input: StartExperimentInput,
|
|
822
|
-
output: ExperimentModel,
|
|
823
|
-
errors: {
|
|
824
|
-
EXPERIMENT_NOT_FOUND: {
|
|
825
|
-
description: "Experiment does not exist",
|
|
826
|
-
http: 404,
|
|
827
|
-
gqlCode: "EXPERIMENT_NOT_FOUND",
|
|
828
|
-
when: "Experiment ID is invalid"
|
|
829
|
-
},
|
|
830
|
-
EXPERIMENT_ALREADY_RUNNING: {
|
|
831
|
-
description: "Experiment is already running",
|
|
832
|
-
http: 409,
|
|
833
|
-
gqlCode: "EXPERIMENT_ALREADY_RUNNING",
|
|
834
|
-
when: "Cannot start an experiment that is already running"
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
},
|
|
838
|
-
policy: { auth: "admin" }
|
|
839
|
-
});
|
|
840
|
-
/**
|
|
841
|
-
* Stop an experiment.
|
|
842
|
-
*/
|
|
843
|
-
const StopExperimentContract = defineCommand({
|
|
844
|
-
meta: {
|
|
845
|
-
name: "experiment.stop",
|
|
846
|
-
version: 1,
|
|
847
|
-
stability: "stable",
|
|
848
|
-
owners: [...OWNERS],
|
|
849
|
-
tags: [
|
|
850
|
-
"feature-flags",
|
|
851
|
-
"experiment",
|
|
852
|
-
"stop"
|
|
853
|
-
],
|
|
854
|
-
description: "Stop an experiment.",
|
|
855
|
-
goal: "End an experiment and optionally declare a winner.",
|
|
856
|
-
context: "Called when concluding an A/B test."
|
|
857
|
-
},
|
|
858
|
-
io: {
|
|
859
|
-
input: StopExperimentInput,
|
|
860
|
-
output: ExperimentModel,
|
|
861
|
-
errors: {
|
|
862
|
-
EXPERIMENT_NOT_FOUND: {
|
|
863
|
-
description: "Experiment does not exist",
|
|
864
|
-
http: 404,
|
|
865
|
-
gqlCode: "EXPERIMENT_NOT_FOUND",
|
|
866
|
-
when: "Experiment ID is invalid"
|
|
867
|
-
},
|
|
868
|
-
EXPERIMENT_NOT_RUNNING: {
|
|
869
|
-
description: "Experiment is not running",
|
|
870
|
-
http: 409,
|
|
871
|
-
gqlCode: "EXPERIMENT_NOT_RUNNING",
|
|
872
|
-
when: "Cannot stop an experiment that is not running"
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
},
|
|
876
|
-
policy: { auth: "admin" }
|
|
877
|
-
});
|
|
878
|
-
/**
|
|
879
|
-
* Get an experiment.
|
|
880
|
-
*/
|
|
881
|
-
const GetExperimentContract = defineQuery({
|
|
882
|
-
meta: {
|
|
883
|
-
name: "experiment.get",
|
|
884
|
-
version: 1,
|
|
885
|
-
stability: "stable",
|
|
886
|
-
owners: [...OWNERS],
|
|
887
|
-
tags: [
|
|
888
|
-
"feature-flags",
|
|
889
|
-
"experiment",
|
|
890
|
-
"get"
|
|
891
|
-
],
|
|
892
|
-
description: "Get experiment details.",
|
|
893
|
-
goal: "View experiment configuration and results.",
|
|
894
|
-
context: "Called to inspect experiment status."
|
|
895
|
-
},
|
|
896
|
-
io: {
|
|
897
|
-
input: GetExperimentInput,
|
|
898
|
-
output: ExperimentModel,
|
|
899
|
-
errors: { EXPERIMENT_NOT_FOUND: {
|
|
900
|
-
description: "Experiment does not exist",
|
|
901
|
-
http: 404,
|
|
902
|
-
gqlCode: "EXPERIMENT_NOT_FOUND",
|
|
903
|
-
when: "Experiment ID is invalid"
|
|
904
|
-
} }
|
|
905
|
-
},
|
|
906
|
-
policy: { auth: "user" }
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
//#endregion
|
|
910
|
-
export { CreateExperimentContract, CreateFlagContract, CreateRuleContract, DeleteFlagContract, DeleteRuleContract, EvaluateFlagContract, EvaluationResultModel, ExperimentModel, FeatureFlagModel, GetExperimentContract, GetFlagContract, ListFlagsContract, StartExperimentContract, StopExperimentContract, TargetingRuleModel, ToggleFlagContract, UpdateFlagContract };
|
|
1
|
+
import{ScalarTypeEnum as e,defineSchemaModel as t}from"@lssm/lib.schema";import{defineCommand as n,defineQuery as r}from"@lssm/lib.contracts";const i=[`platform.feature-flags`],a=t({name:`FeatureFlag`,description:`Represents a feature flag`,fields:{id:{type:e.String_unsecure(),isOptional:!1},key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},status:{type:e.String_unsecure(),isOptional:!1},defaultValue:{type:e.Boolean(),isOptional:!1},variants:{type:e.JSON(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.JSON(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1},updatedAt:{type:e.DateTime(),isOptional:!1}}}),o=t({name:`TargetingRule`,description:`Represents a targeting rule`,fields:{id:{type:e.String_unsecure(),isOptional:!1},flagId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},priority:{type:e.Int_unsecure(),isOptional:!1},enabled:{type:e.Boolean(),isOptional:!1},attribute:{type:e.String_unsecure(),isOptional:!1},operator:{type:e.String_unsecure(),isOptional:!1},value:{type:e.JSON(),isOptional:!1},rolloutPercentage:{type:e.Int_unsecure(),isOptional:!0},serveValue:{type:e.Boolean(),isOptional:!0},serveVariant:{type:e.String_unsecure(),isOptional:!0}}}),s=t({name:`Experiment`,description:`Represents an experiment`,fields:{id:{type:e.String_unsecure(),isOptional:!1},key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},hypothesis:{type:e.String_unsecure(),isOptional:!0},flagId:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},variants:{type:e.JSON(),isOptional:!1},metrics:{type:e.JSON(),isOptional:!0},audiencePercentage:{type:e.Int_unsecure(),isOptional:!1},startedAt:{type:e.DateTime(),isOptional:!0},endedAt:{type:e.DateTime(),isOptional:!0},winningVariant:{type:e.String_unsecure(),isOptional:!0},results:{type:e.JSON(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),c=t({name:`EvaluationResult`,description:`Result of flag evaluation`,fields:{enabled:{type:e.Boolean(),isOptional:!1},variant:{type:e.String_unsecure(),isOptional:!0},reason:{type:e.String_unsecure(),isOptional:!1},ruleId:{type:e.String_unsecure(),isOptional:!0},experimentId:{type:e.String_unsecure(),isOptional:!0}}}),l=t({name:`CreateFlagInput`,description:`Input for creating a feature flag`,fields:{key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},defaultValue:{type:e.Boolean(),isOptional:!0},variants:{type:e.JSON(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.JSON(),isOptional:!0}}}),u=t({name:`UpdateFlagInput`,description:`Input for updating a feature flag`,fields:{flagId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},description:{type:e.String_unsecure(),isOptional:!0},defaultValue:{type:e.Boolean(),isOptional:!0},variants:{type:e.JSON(),isOptional:!0},tags:{type:e.JSON(),isOptional:!0}}}),d=t({name:`DeleteFlagInput`,description:`Input for deleting a feature flag`,fields:{flagId:{type:e.String_unsecure(),isOptional:!1}}}),f=t({name:`ToggleFlagInput`,description:`Input for toggling a feature flag`,fields:{flagId:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1}}}),p=t({name:`GetFlagInput`,description:`Input for getting a feature flag`,fields:{key:{type:e.String_unsecure(),isOptional:!1},orgId:{type:e.String_unsecure(),isOptional:!0}}}),m=t({name:`ListFlagsInput`,description:`Input for listing feature flags`,fields:{orgId:{type:e.String_unsecure(),isOptional:!0},status:{type:e.String_unsecure(),isOptional:!0},tags:{type:e.JSON(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0},offset:{type:e.Int_unsecure(),isOptional:!0}}}),h=t({name:`ListFlagsOutput`,description:`Output for listing feature flags`,fields:{flags:{type:a,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1}}}),g=t({name:`EvaluateFlagInput`,description:`Input for evaluating a feature flag`,fields:{key:{type:e.String_unsecure(),isOptional:!1},context:{type:e.JSON(),isOptional:!1}}}),_=t({name:`CreateRuleInput`,description:`Input for creating a targeting rule`,fields:{flagId:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!0},priority:{type:e.Int_unsecure(),isOptional:!0},attribute:{type:e.String_unsecure(),isOptional:!1},operator:{type:e.String_unsecure(),isOptional:!1},value:{type:e.JSON(),isOptional:!1},rolloutPercentage:{type:e.Int_unsecure(),isOptional:!0},serveValue:{type:e.Boolean(),isOptional:!0},serveVariant:{type:e.String_unsecure(),isOptional:!0}}}),v=t({name:`DeleteRuleInput`,description:`Input for deleting a targeting rule`,fields:{ruleId:{type:e.String_unsecure(),isOptional:!1}}}),y=t({name:`CreateExperimentInput`,description:`Input for creating an experiment`,fields:{key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},hypothesis:{type:e.String_unsecure(),isOptional:!0},flagId:{type:e.String_unsecure(),isOptional:!1},variants:{type:e.JSON(),isOptional:!1},metrics:{type:e.JSON(),isOptional:!0},audiencePercentage:{type:e.Int_unsecure(),isOptional:!0},scheduledStartAt:{type:e.DateTime(),isOptional:!0},scheduledEndAt:{type:e.DateTime(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!0}}}),b=t({name:`StartExperimentInput`,description:`Input for starting an experiment`,fields:{experimentId:{type:e.String_unsecure(),isOptional:!1}}}),x=t({name:`StopExperimentInput`,description:`Input for stopping an experiment`,fields:{experimentId:{type:e.String_unsecure(),isOptional:!1},reason:{type:e.String_unsecure(),isOptional:!1},winningVariant:{type:e.String_unsecure(),isOptional:!0}}}),S=t({name:`GetExperimentInput`,description:`Input for getting an experiment`,fields:{experimentId:{type:e.String_unsecure(),isOptional:!1}}}),C=t({name:`SuccessOutput`,description:`Generic success output`,fields:{success:{type:e.Boolean(),isOptional:!1}}}),w=n({meta:{name:`flag.create`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`create`],description:`Create a new feature flag.`,goal:`Define a new feature flag for toggling features.`,context:`Called when setting up a new feature flag.`},io:{input:l,output:a,errors:{KEY_ALREADY_EXISTS:{description:`Flag key already exists`,http:409,gqlCode:`FLAG_KEY_EXISTS`,when:`A flag with this key already exists`}}},policy:{auth:`admin`}}),T=n({meta:{name:`flag.update`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`update`],description:`Update an existing feature flag.`,goal:`Modify flag configuration.`,context:`Called when adjusting flag settings.`},io:{input:u,output:a,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag ID is invalid`}}},policy:{auth:`admin`}}),E=n({meta:{name:`flag.delete`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`delete`],description:`Delete a feature flag.`,goal:`Remove a feature flag and all its rules.`,context:`Called when a flag is no longer needed.`},io:{input:d,output:C,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag ID is invalid`},FLAG_HAS_ACTIVE_EXPERIMENT:{description:`Flag has an active experiment`,http:409,gqlCode:`FLAG_HAS_ACTIVE_EXPERIMENT`,when:`Cannot delete flag with running experiment`}}},policy:{auth:`admin`}}),D=n({meta:{name:`flag.toggle`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`toggle`],description:`Toggle a feature flag status.`,goal:`Quickly enable or disable a feature.`,context:`Called when turning a feature on or off.`},io:{input:f,output:a,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag ID is invalid`},INVALID_STATUS:{description:`Invalid status value`,http:400,gqlCode:`INVALID_STATUS`,when:`Status must be OFF, ON, or GRADUAL`}}},policy:{auth:`admin`}}),O=r({meta:{name:`flag.get`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`get`],description:`Get a feature flag by key.`,goal:`Retrieve flag configuration.`,context:`Called to inspect flag details.`},io:{input:p,output:a,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag key is invalid`}}},policy:{auth:`user`}}),k=r({meta:{name:`flag.list`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`list`],description:`List all feature flags.`,goal:`View all configured flags.`,context:`Admin dashboard.`},io:{input:m,output:h},policy:{auth:`admin`}}),A=r({meta:{name:`flag.evaluate`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`evaluate`],description:`Evaluate a feature flag for a given context.`,goal:`Determine if a feature should be enabled.`,context:`Called at runtime to check feature availability.`},io:{input:g,output:c,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag key is invalid`}}},policy:{auth:`anonymous`}}),j=n({meta:{name:`flag.rule.create`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`rule`,`create`],description:`Create a targeting rule for a flag.`,goal:`Add conditional targeting to a flag.`,context:`Called when setting up targeting.`},io:{input:_,output:o,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag ID is invalid`},INVALID_OPERATOR:{description:`Invalid operator`,http:400,gqlCode:`INVALID_OPERATOR`,when:`Operator is not supported`}}},policy:{auth:`admin`}}),M=n({meta:{name:`flag.rule.delete`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`rule`,`delete`],description:`Delete a targeting rule.`,goal:`Remove a targeting rule from a flag.`,context:`Called when removing targeting conditions.`},io:{input:v,output:C,errors:{RULE_NOT_FOUND:{description:`Rule does not exist`,http:404,gqlCode:`RULE_NOT_FOUND`,when:`Rule ID is invalid`}}},policy:{auth:`admin`}}),N=n({meta:{name:`experiment.create`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`experiment`,`create`],description:`Create an A/B test experiment.`,goal:`Set up an experiment with variants.`,context:`Called when setting up A/B testing.`},io:{input:y,output:s,errors:{FLAG_NOT_FOUND:{description:`Flag does not exist`,http:404,gqlCode:`FLAG_NOT_FOUND`,when:`Flag ID is invalid`},EXPERIMENT_KEY_EXISTS:{description:`Experiment key already exists`,http:409,gqlCode:`EXPERIMENT_KEY_EXISTS`,when:`An experiment with this key already exists`},INVALID_VARIANTS:{description:`Invalid variant configuration`,http:400,gqlCode:`INVALID_VARIANTS`,when:`Variant percentages must sum to 100`}}},policy:{auth:`admin`}}),P=n({meta:{name:`experiment.start`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`experiment`,`start`],description:`Start an experiment.`,goal:`Begin collecting data for an experiment.`,context:`Called when ready to run an A/B test.`},io:{input:b,output:s,errors:{EXPERIMENT_NOT_FOUND:{description:`Experiment does not exist`,http:404,gqlCode:`EXPERIMENT_NOT_FOUND`,when:`Experiment ID is invalid`},EXPERIMENT_ALREADY_RUNNING:{description:`Experiment is already running`,http:409,gqlCode:`EXPERIMENT_ALREADY_RUNNING`,when:`Cannot start an experiment that is already running`}}},policy:{auth:`admin`}}),F=n({meta:{name:`experiment.stop`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`experiment`,`stop`],description:`Stop an experiment.`,goal:`End an experiment and optionally declare a winner.`,context:`Called when concluding an A/B test.`},io:{input:x,output:s,errors:{EXPERIMENT_NOT_FOUND:{description:`Experiment does not exist`,http:404,gqlCode:`EXPERIMENT_NOT_FOUND`,when:`Experiment ID is invalid`},EXPERIMENT_NOT_RUNNING:{description:`Experiment is not running`,http:409,gqlCode:`EXPERIMENT_NOT_RUNNING`,when:`Cannot stop an experiment that is not running`}}},policy:{auth:`admin`}}),I=r({meta:{name:`experiment.get`,version:1,stability:`stable`,owners:[...i],tags:[`feature-flags`,`experiment`,`get`],description:`Get experiment details.`,goal:`View experiment configuration and results.`,context:`Called to inspect experiment status.`},io:{input:S,output:s,errors:{EXPERIMENT_NOT_FOUND:{description:`Experiment does not exist`,http:404,gqlCode:`EXPERIMENT_NOT_FOUND`,when:`Experiment ID is invalid`}}},policy:{auth:`user`}});export{N as CreateExperimentContract,w as CreateFlagContract,j as CreateRuleContract,E as DeleteFlagContract,M as DeleteRuleContract,A as EvaluateFlagContract,c as EvaluationResultModel,s as ExperimentModel,a as FeatureFlagModel,I as GetExperimentContract,O as GetFlagContract,k as ListFlagsContract,P as StartExperimentContract,F as StopExperimentContract,o as TargetingRuleModel,D as ToggleFlagContract,T as UpdateFlagContract};
|