@contractspec/lib.feature-flags 0.0.0-canary-20260113162409
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/LICENSE +21 -0
- package/README.md +173 -0
- package/dist/contracts/index.d.ts +1010 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +908 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/src/app-config/lifecycle.d.ts +1 -0
- package/dist/contracts/src/app-config/runtime.d.ts +13 -0
- package/dist/contracts/src/app-config/spec.d.ts +9 -0
- package/dist/contracts/src/app-config/validation.d.ts +8 -0
- package/dist/contracts/src/capabilities/capabilities.d.ts +33 -0
- package/dist/contracts/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/contracts/src/capabilities/index.d.ts +2 -0
- package/dist/contracts/src/capabilities/openbanking.d.ts +1 -0
- package/dist/contracts/src/client/index.d.ts +1 -0
- package/dist/contracts/src/client/react/drivers/rn-reusables.d.ts +1 -0
- package/dist/contracts/src/client/react/drivers/shadcn.d.ts +1 -0
- package/dist/contracts/src/client/react/feature-render.d.ts +3 -0
- package/dist/contracts/src/client/react/form-render.d.ts +4 -0
- package/dist/contracts/src/client/react/index.d.ts +4 -0
- package/dist/contracts/src/contract-registry/index.d.ts +2 -0
- package/dist/contracts/src/contract-registry/schemas.d.ts +2 -0
- package/dist/contracts/src/contract-registry/types.d.ts +1 -0
- package/dist/contracts/src/data-views/index.d.ts +3 -0
- package/dist/contracts/src/data-views/registry.d.ts +2 -0
- package/dist/contracts/src/data-views/spec.d.ts +2 -0
- package/dist/contracts/src/data-views/types.d.ts +2 -0
- package/dist/contracts/src/docs/accessibility_wcag_compliance_specs.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/index.d.ts +25 -0
- package/dist/contracts/src/docs/presentations.d.ts +2 -0
- package/dist/contracts/src/docs/registry.d.ts +10 -0
- package/dist/contracts/src/docs/registry.d.ts.map +1 -0
- package/dist/contracts/src/docs/tech/auth/better-auth-nextjs.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/contracts/README.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/contracts/openapi-export.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/contracts/openapi-import.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/lifecycle-stage-system.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/llm/llm-integration.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/mcp-endpoints.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/presentation-runtime.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/schema/README.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/learning-events.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/learning-journeys.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/platform-admin-panel.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/project-access-teams.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/project-routing.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/team-invitations.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/workspace-ops.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/studio/workspaces.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/telemetry-ingest.docblock.d.ts +1 -0
- package/dist/contracts/src/docs/tech/vscode-extension.docblock.d.ts +1 -0
- package/dist/contracts/src/events.d.ts +25 -0
- package/dist/contracts/src/events.d.ts.map +1 -0
- package/dist/contracts/src/examples/index.d.ts +4 -0
- package/dist/contracts/src/examples/registry.d.ts +2 -0
- package/dist/contracts/src/examples/schema.d.ts +2 -0
- package/dist/contracts/src/examples/types.d.ts +3 -0
- package/dist/contracts/src/examples/validation.d.ts +1 -0
- package/dist/contracts/src/experiments/evaluator.d.ts +2 -0
- package/dist/contracts/src/experiments/spec-resolver.d.ts +4 -0
- package/dist/contracts/src/experiments/spec.d.ts +13 -0
- package/dist/contracts/src/experiments/spec.d.ts.map +1 -0
- package/dist/contracts/src/features/index.d.ts +4 -0
- package/dist/contracts/src/features/install.d.ts +6 -0
- package/dist/contracts/src/features/registry.d.ts +2 -0
- package/dist/contracts/src/features/types.d.ts +86 -0
- package/dist/contracts/src/features/types.d.ts.map +1 -0
- package/dist/contracts/src/features/validation.d.ts +2 -0
- package/dist/contracts/src/forms/forms.d.ts +3 -0
- package/dist/contracts/src/forms/index.d.ts +1 -0
- package/dist/contracts/src/index.d.ts +51 -0
- package/dist/contracts/src/install.d.ts +7 -0
- package/dist/contracts/src/integrations/connection.d.ts +1 -0
- package/dist/contracts/src/integrations/index.d.ts +6 -0
- package/dist/contracts/src/integrations/openbanking/contracts/accounts.d.ts +4 -0
- package/dist/contracts/src/integrations/openbanking/contracts/balances.d.ts +4 -0
- package/dist/contracts/src/integrations/openbanking/contracts/index.d.ts +5 -0
- package/dist/contracts/src/integrations/openbanking/contracts/transactions.d.ts +4 -0
- package/dist/contracts/src/integrations/openbanking/guards.d.ts +1 -0
- package/dist/contracts/src/integrations/openbanking/models.d.ts +1 -0
- package/dist/contracts/src/integrations/openbanking/openbanking.feature.d.ts +1 -0
- package/dist/contracts/src/integrations/operations.d.ts +4 -0
- package/dist/contracts/src/integrations/providers/elevenlabs.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/gcs-storage.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/gmail.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/google-calendar.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/index.d.ts +11 -0
- package/dist/contracts/src/integrations/providers/mistral.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/postmark.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/powens.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/qdrant.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/registry.d.ts +1 -0
- package/dist/contracts/src/integrations/providers/stripe.d.ts +2 -0
- package/dist/contracts/src/integrations/providers/twilio-sms.d.ts +2 -0
- package/dist/contracts/src/integrations/spec.d.ts +3 -0
- package/dist/contracts/src/jsonschema.d.ts +4 -0
- package/dist/contracts/src/knowledge/index.d.ts +2 -0
- package/dist/contracts/src/knowledge/operations.d.ts +4 -0
- package/dist/contracts/src/knowledge/spaces/email-threads.d.ts +1 -0
- package/dist/contracts/src/knowledge/spaces/financial-docs.d.ts +1 -0
- package/dist/contracts/src/knowledge/spaces/financial-overview.d.ts +1 -0
- package/dist/contracts/src/knowledge/spaces/index.d.ts +6 -0
- package/dist/contracts/src/knowledge/spaces/product-canon.d.ts +1 -0
- package/dist/contracts/src/knowledge/spaces/support-faq.d.ts +1 -0
- package/dist/contracts/src/knowledge/spaces/uploaded-docs.d.ts +1 -0
- package/dist/contracts/src/knowledge/spec.d.ts +3 -0
- package/dist/contracts/src/llm/exporters.d.ts +7 -0
- package/dist/contracts/src/llm/index.d.ts +3 -0
- package/dist/contracts/src/llm/prompts.d.ts +2 -0
- package/dist/contracts/src/llm/types.d.ts +5 -0
- package/dist/contracts/src/migrations.d.ts +1 -0
- package/dist/contracts/src/model-registry.d.ts +1 -0
- package/dist/contracts/src/onboarding-base.d.ts +2 -0
- package/dist/contracts/src/openapi.d.ts +1 -0
- package/dist/contracts/src/operations/index.d.ts +2 -0
- package/dist/contracts/src/operations/operation.d.ts +170 -0
- package/dist/contracts/src/operations/operation.d.ts.map +1 -0
- package/dist/contracts/src/operations/registry.d.ts +6 -0
- package/dist/contracts/src/ownership.d.ts +61 -0
- package/dist/contracts/src/ownership.d.ts.map +1 -0
- package/dist/contracts/src/policy/engine.d.ts +3 -0
- package/dist/contracts/src/policy/index.d.ts +4 -0
- package/dist/contracts/src/policy/opa-adapter.d.ts +3 -0
- package/dist/contracts/src/policy/registry.d.ts +2 -0
- package/dist/contracts/src/policy/spec.d.ts +11 -0
- package/dist/contracts/src/policy/spec.d.ts.map +1 -0
- package/dist/contracts/src/presentations/index.d.ts +3 -0
- package/dist/contracts/src/presentations/presentations.d.ts +9 -0
- package/dist/contracts/src/presentations/presentations.d.ts.map +1 -0
- package/dist/contracts/src/presentations/registry.d.ts +2 -0
- package/dist/contracts/src/presentations/transform-engine.d.ts +2 -0
- package/dist/contracts/src/prompt.d.ts +2 -0
- package/dist/contracts/src/promptRegistry.d.ts +2 -0
- package/dist/contracts/src/regenerator/adapters.d.ts +1 -0
- package/dist/contracts/src/regenerator/executor.d.ts +1 -0
- package/dist/contracts/src/regenerator/index.d.ts +6 -0
- package/dist/contracts/src/regenerator/service.d.ts +2 -0
- package/dist/contracts/src/regenerator/sinks.d.ts +2 -0
- package/dist/contracts/src/regenerator/types.d.ts +3 -0
- package/dist/contracts/src/regenerator/utils.d.ts +1 -0
- package/dist/contracts/src/registry-utils.d.ts +1 -0
- package/dist/contracts/src/registry.d.ts +3 -0
- package/dist/contracts/src/resources.d.ts +19 -0
- package/dist/contracts/src/resources.d.ts.map +1 -0
- package/dist/contracts/src/schema-to-markdown.d.ts +1 -0
- package/dist/contracts/src/server/graphql-pothos.d.ts +7 -0
- package/dist/contracts/src/server/index.d.ts +7 -0
- package/dist/contracts/src/server/mcp/createMcpServer.d.ts +5 -0
- package/dist/contracts/src/server/mcp/mcpTypes.d.ts +2 -0
- package/dist/contracts/src/server/provider-mcp.d.ts +1 -0
- package/dist/contracts/src/server/rest-elysia.d.ts +3 -0
- package/dist/contracts/src/server/rest-express.d.ts +3 -0
- package/dist/contracts/src/server/rest-generic.d.ts +2 -0
- package/dist/contracts/src/server/rest-next-app.d.ts +3 -0
- package/dist/contracts/src/server/rest-next-pages.d.ts +3 -0
- package/dist/contracts/src/telemetry/anomaly.d.ts +2 -0
- package/dist/contracts/src/telemetry/index.d.ts +3 -0
- package/dist/contracts/src/telemetry/spec.d.ts +2 -0
- package/dist/contracts/src/telemetry/tracker.d.ts +2 -0
- package/dist/contracts/src/tests/index.d.ts +2 -0
- package/dist/contracts/src/tests/runner.d.ts +3 -0
- package/dist/contracts/src/tests/spec.d.ts +11 -0
- package/dist/contracts/src/tests/spec.d.ts.map +1 -0
- package/dist/contracts/src/themes.d.ts +2 -0
- package/dist/contracts/src/types.d.ts +5 -0
- package/dist/contracts/src/workflow/adapters/db-adapter.d.ts +1 -0
- package/dist/contracts/src/workflow/adapters/file-adapter.d.ts +1 -0
- package/dist/contracts/src/workflow/adapters/index.d.ts +3 -0
- package/dist/contracts/src/workflow/adapters/memory-store.d.ts +1 -0
- package/dist/contracts/src/workflow/index.d.ts +5 -0
- package/dist/contracts/src/workflow/overview.docblock.d.ts +1 -0
- package/dist/contracts/src/workflow/runner.d.ts +5 -0
- package/dist/contracts/src/workflow/spec.d.ts +5 -0
- package/dist/contracts/src/workflow/state.d.ts +1 -0
- package/dist/contracts/src/workflow/validation.d.ts +3 -0
- package/dist/contracts/src/workspace-config/contractsrc-schema.d.ts +1 -0
- package/dist/contracts/src/workspace-config/index.d.ts +1 -0
- package/dist/contracts/src/workspace-config/workspace-config.docblock.d.ts +1 -0
- package/dist/docs/feature-flags.docblock.d.ts +1 -0
- package/dist/docs/feature-flags.docblock.js +76 -0
- package/dist/docs/feature-flags.docblock.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/entities/index.d.ts +201 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +325 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/evaluation/index.d.ts +163 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +221 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/events.d.ts +628 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +536 -0
- package/dist/events.js.map +1 -0
- package/dist/feature-flags.capability.d.ts +9 -0
- package/dist/feature-flags.capability.d.ts.map +1 -0
- package/dist/feature-flags.capability.js +25 -0
- package/dist/feature-flags.capability.js.map +1 -0
- package/dist/feature-flags.feature.d.ts +12 -0
- package/dist/feature-flags.feature.d.ts.map +1 -0
- package/dist/feature-flags.feature.js +148 -0
- package/dist/feature-flags.feature.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/schema/src/EnumType.d.ts +36 -0
- package/dist/schema/src/EnumType.d.ts.map +1 -0
- package/dist/schema/src/FieldType.d.ts +30 -0
- package/dist/schema/src/FieldType.d.ts.map +1 -0
- package/dist/schema/src/GraphQLSchemaType.d.ts +2 -0
- package/dist/schema/src/JsonSchemaType.d.ts +2 -0
- package/dist/schema/src/ScalarTypeEnum.d.ts +1 -0
- package/dist/schema/src/SchemaModel.d.ts +70 -0
- package/dist/schema/src/SchemaModel.d.ts.map +1 -0
- package/dist/schema/src/SchemaModelType.d.ts +38 -0
- package/dist/schema/src/SchemaModelType.d.ts.map +1 -0
- package/dist/schema/src/ZodSchemaType.d.ts +2 -0
- package/dist/schema/src/entity/defineEntity.d.ts +1 -0
- package/dist/schema/src/entity/generator.d.ts +1 -0
- package/dist/schema/src/entity/index.d.ts +3 -0
- package/dist/schema/src/entity/types.d.ts +146 -0
- package/dist/schema/src/entity/types.d.ts.map +1 -0
- package/dist/schema/src/index.d.ts +10 -0
- package/package.json +74 -0
package/dist/events.js
ADDED
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
2
|
+
import { defineEvent } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/events.ts
|
|
5
|
+
const FlagCreatedPayload = defineSchemaModel({
|
|
6
|
+
name: "FlagCreatedEventPayload",
|
|
7
|
+
description: "Payload when a feature flag is created",
|
|
8
|
+
fields: {
|
|
9
|
+
flagId: {
|
|
10
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
11
|
+
isOptional: false
|
|
12
|
+
},
|
|
13
|
+
key: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
status: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
orgId: {
|
|
26
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
+
isOptional: true
|
|
28
|
+
},
|
|
29
|
+
createdBy: {
|
|
30
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
31
|
+
isOptional: true
|
|
32
|
+
},
|
|
33
|
+
createdAt: {
|
|
34
|
+
type: ScalarTypeEnum.DateTime(),
|
|
35
|
+
isOptional: false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const FlagUpdatedPayload = defineSchemaModel({
|
|
40
|
+
name: "FlagUpdatedEventPayload",
|
|
41
|
+
description: "Payload when a feature flag is updated",
|
|
42
|
+
fields: {
|
|
43
|
+
flagId: {
|
|
44
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
45
|
+
isOptional: false
|
|
46
|
+
},
|
|
47
|
+
key: {
|
|
48
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
49
|
+
isOptional: false
|
|
50
|
+
},
|
|
51
|
+
changes: {
|
|
52
|
+
type: ScalarTypeEnum.JSON(),
|
|
53
|
+
isOptional: false
|
|
54
|
+
},
|
|
55
|
+
updatedBy: {
|
|
56
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
57
|
+
isOptional: true
|
|
58
|
+
},
|
|
59
|
+
updatedAt: {
|
|
60
|
+
type: ScalarTypeEnum.DateTime(),
|
|
61
|
+
isOptional: false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const FlagDeletedPayload = defineSchemaModel({
|
|
66
|
+
name: "FlagDeletedEventPayload",
|
|
67
|
+
description: "Payload when a feature flag is deleted",
|
|
68
|
+
fields: {
|
|
69
|
+
flagId: {
|
|
70
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
71
|
+
isOptional: false
|
|
72
|
+
},
|
|
73
|
+
key: {
|
|
74
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
75
|
+
isOptional: false
|
|
76
|
+
},
|
|
77
|
+
deletedBy: {
|
|
78
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
79
|
+
isOptional: true
|
|
80
|
+
},
|
|
81
|
+
deletedAt: {
|
|
82
|
+
type: ScalarTypeEnum.DateTime(),
|
|
83
|
+
isOptional: false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const FlagToggledPayload = defineSchemaModel({
|
|
88
|
+
name: "FlagToggledEventPayload",
|
|
89
|
+
description: "Payload when a feature flag status is toggled",
|
|
90
|
+
fields: {
|
|
91
|
+
flagId: {
|
|
92
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
93
|
+
isOptional: false
|
|
94
|
+
},
|
|
95
|
+
key: {
|
|
96
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
97
|
+
isOptional: false
|
|
98
|
+
},
|
|
99
|
+
previousStatus: {
|
|
100
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
101
|
+
isOptional: false
|
|
102
|
+
},
|
|
103
|
+
newStatus: {
|
|
104
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
105
|
+
isOptional: false
|
|
106
|
+
},
|
|
107
|
+
toggledBy: {
|
|
108
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
109
|
+
isOptional: true
|
|
110
|
+
},
|
|
111
|
+
toggledAt: {
|
|
112
|
+
type: ScalarTypeEnum.DateTime(),
|
|
113
|
+
isOptional: false
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const RuleCreatedPayload = defineSchemaModel({
|
|
118
|
+
name: "RuleCreatedEventPayload",
|
|
119
|
+
description: "Payload when a targeting rule is created",
|
|
120
|
+
fields: {
|
|
121
|
+
ruleId: {
|
|
122
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
123
|
+
isOptional: false
|
|
124
|
+
},
|
|
125
|
+
flagId: {
|
|
126
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
127
|
+
isOptional: false
|
|
128
|
+
},
|
|
129
|
+
flagKey: {
|
|
130
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
131
|
+
isOptional: false
|
|
132
|
+
},
|
|
133
|
+
attribute: {
|
|
134
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
135
|
+
isOptional: false
|
|
136
|
+
},
|
|
137
|
+
operator: {
|
|
138
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
139
|
+
isOptional: false
|
|
140
|
+
},
|
|
141
|
+
createdAt: {
|
|
142
|
+
type: ScalarTypeEnum.DateTime(),
|
|
143
|
+
isOptional: false
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const RuleDeletedPayload = defineSchemaModel({
|
|
148
|
+
name: "RuleDeletedEventPayload",
|
|
149
|
+
description: "Payload when a targeting rule is deleted",
|
|
150
|
+
fields: {
|
|
151
|
+
ruleId: {
|
|
152
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
153
|
+
isOptional: false
|
|
154
|
+
},
|
|
155
|
+
flagId: {
|
|
156
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
157
|
+
isOptional: false
|
|
158
|
+
},
|
|
159
|
+
flagKey: {
|
|
160
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
161
|
+
isOptional: false
|
|
162
|
+
},
|
|
163
|
+
deletedAt: {
|
|
164
|
+
type: ScalarTypeEnum.DateTime(),
|
|
165
|
+
isOptional: false
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
const ExperimentCreatedPayload = defineSchemaModel({
|
|
170
|
+
name: "ExperimentCreatedEventPayload",
|
|
171
|
+
description: "Payload when an experiment is created",
|
|
172
|
+
fields: {
|
|
173
|
+
experimentId: {
|
|
174
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
175
|
+
isOptional: false
|
|
176
|
+
},
|
|
177
|
+
key: {
|
|
178
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
179
|
+
isOptional: false
|
|
180
|
+
},
|
|
181
|
+
name: {
|
|
182
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
183
|
+
isOptional: false
|
|
184
|
+
},
|
|
185
|
+
flagId: {
|
|
186
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
187
|
+
isOptional: false
|
|
188
|
+
},
|
|
189
|
+
variants: {
|
|
190
|
+
type: ScalarTypeEnum.JSON(),
|
|
191
|
+
isOptional: false
|
|
192
|
+
},
|
|
193
|
+
createdBy: {
|
|
194
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
195
|
+
isOptional: true
|
|
196
|
+
},
|
|
197
|
+
createdAt: {
|
|
198
|
+
type: ScalarTypeEnum.DateTime(),
|
|
199
|
+
isOptional: false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
const ExperimentStartedPayload = defineSchemaModel({
|
|
204
|
+
name: "ExperimentStartedEventPayload",
|
|
205
|
+
description: "Payload when an experiment starts",
|
|
206
|
+
fields: {
|
|
207
|
+
experimentId: {
|
|
208
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
209
|
+
isOptional: false
|
|
210
|
+
},
|
|
211
|
+
key: {
|
|
212
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
213
|
+
isOptional: false
|
|
214
|
+
},
|
|
215
|
+
flagId: {
|
|
216
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
217
|
+
isOptional: false
|
|
218
|
+
},
|
|
219
|
+
variants: {
|
|
220
|
+
type: ScalarTypeEnum.JSON(),
|
|
221
|
+
isOptional: false
|
|
222
|
+
},
|
|
223
|
+
audiencePercentage: {
|
|
224
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
225
|
+
isOptional: false
|
|
226
|
+
},
|
|
227
|
+
startedBy: {
|
|
228
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
229
|
+
isOptional: true
|
|
230
|
+
},
|
|
231
|
+
startedAt: {
|
|
232
|
+
type: ScalarTypeEnum.DateTime(),
|
|
233
|
+
isOptional: false
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const ExperimentStoppedPayload = defineSchemaModel({
|
|
238
|
+
name: "ExperimentStoppedEventPayload",
|
|
239
|
+
description: "Payload when an experiment stops",
|
|
240
|
+
fields: {
|
|
241
|
+
experimentId: {
|
|
242
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
243
|
+
isOptional: false
|
|
244
|
+
},
|
|
245
|
+
key: {
|
|
246
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
247
|
+
isOptional: false
|
|
248
|
+
},
|
|
249
|
+
reason: {
|
|
250
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
251
|
+
isOptional: false
|
|
252
|
+
},
|
|
253
|
+
winningVariant: {
|
|
254
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
255
|
+
isOptional: true
|
|
256
|
+
},
|
|
257
|
+
stoppedBy: {
|
|
258
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
259
|
+
isOptional: true
|
|
260
|
+
},
|
|
261
|
+
stoppedAt: {
|
|
262
|
+
type: ScalarTypeEnum.DateTime(),
|
|
263
|
+
isOptional: false
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
const FlagEvaluatedPayload = defineSchemaModel({
|
|
268
|
+
name: "FlagEvaluatedEventPayload",
|
|
269
|
+
description: "Payload when a flag is evaluated (for analytics)",
|
|
270
|
+
fields: {
|
|
271
|
+
flagId: {
|
|
272
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
273
|
+
isOptional: false
|
|
274
|
+
},
|
|
275
|
+
flagKey: {
|
|
276
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
277
|
+
isOptional: false
|
|
278
|
+
},
|
|
279
|
+
subjectType: {
|
|
280
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
281
|
+
isOptional: false
|
|
282
|
+
},
|
|
283
|
+
subjectId: {
|
|
284
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
285
|
+
isOptional: false
|
|
286
|
+
},
|
|
287
|
+
result: {
|
|
288
|
+
type: ScalarTypeEnum.Boolean(),
|
|
289
|
+
isOptional: false
|
|
290
|
+
},
|
|
291
|
+
variant: {
|
|
292
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
293
|
+
isOptional: true
|
|
294
|
+
},
|
|
295
|
+
reason: {
|
|
296
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
297
|
+
isOptional: false
|
|
298
|
+
},
|
|
299
|
+
evaluatedAt: {
|
|
300
|
+
type: ScalarTypeEnum.DateTime(),
|
|
301
|
+
isOptional: false
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
const VariantAssignedPayload = defineSchemaModel({
|
|
306
|
+
name: "VariantAssignedEventPayload",
|
|
307
|
+
description: "Payload when a subject is assigned to an experiment variant",
|
|
308
|
+
fields: {
|
|
309
|
+
experimentId: {
|
|
310
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
311
|
+
isOptional: false
|
|
312
|
+
},
|
|
313
|
+
experimentKey: {
|
|
314
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
315
|
+
isOptional: false
|
|
316
|
+
},
|
|
317
|
+
subjectType: {
|
|
318
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
319
|
+
isOptional: false
|
|
320
|
+
},
|
|
321
|
+
subjectId: {
|
|
322
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
323
|
+
isOptional: false
|
|
324
|
+
},
|
|
325
|
+
variant: {
|
|
326
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
327
|
+
isOptional: false
|
|
328
|
+
},
|
|
329
|
+
bucket: {
|
|
330
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
331
|
+
isOptional: false
|
|
332
|
+
},
|
|
333
|
+
assignedAt: {
|
|
334
|
+
type: ScalarTypeEnum.DateTime(),
|
|
335
|
+
isOptional: false
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
/**
|
|
340
|
+
* Emitted when a feature flag is created.
|
|
341
|
+
*/
|
|
342
|
+
const FlagCreatedEvent = defineEvent({
|
|
343
|
+
meta: {
|
|
344
|
+
key: "flag.created",
|
|
345
|
+
version: "1.0.0",
|
|
346
|
+
description: "A feature flag has been created.",
|
|
347
|
+
stability: "stable",
|
|
348
|
+
owners: ["@platform.feature-flags"],
|
|
349
|
+
tags: ["feature-flags", "create"]
|
|
350
|
+
},
|
|
351
|
+
payload: FlagCreatedPayload
|
|
352
|
+
});
|
|
353
|
+
/**
|
|
354
|
+
* Emitted when a feature flag is updated.
|
|
355
|
+
*/
|
|
356
|
+
const FlagUpdatedEvent = defineEvent({
|
|
357
|
+
meta: {
|
|
358
|
+
key: "flag.updated",
|
|
359
|
+
version: "1.0.0",
|
|
360
|
+
description: "A feature flag has been updated.",
|
|
361
|
+
stability: "stable",
|
|
362
|
+
owners: ["@platform.feature-flags"],
|
|
363
|
+
tags: ["feature-flags", "update"]
|
|
364
|
+
},
|
|
365
|
+
payload: FlagUpdatedPayload
|
|
366
|
+
});
|
|
367
|
+
/**
|
|
368
|
+
* Emitted when a feature flag is deleted.
|
|
369
|
+
*/
|
|
370
|
+
const FlagDeletedEvent = defineEvent({
|
|
371
|
+
meta: {
|
|
372
|
+
key: "flag.deleted",
|
|
373
|
+
version: "1.0.0",
|
|
374
|
+
description: "A feature flag has been deleted.",
|
|
375
|
+
stability: "stable",
|
|
376
|
+
owners: ["@platform.feature-flags"],
|
|
377
|
+
tags: ["feature-flags", "delete"]
|
|
378
|
+
},
|
|
379
|
+
payload: FlagDeletedPayload
|
|
380
|
+
});
|
|
381
|
+
/**
|
|
382
|
+
* Emitted when a feature flag status is toggled.
|
|
383
|
+
*/
|
|
384
|
+
const FlagToggledEvent = defineEvent({
|
|
385
|
+
meta: {
|
|
386
|
+
key: "flag.toggled",
|
|
387
|
+
version: "1.0.0",
|
|
388
|
+
description: "A feature flag status has been toggled.",
|
|
389
|
+
stability: "stable",
|
|
390
|
+
owners: ["@platform.feature-flags"],
|
|
391
|
+
tags: ["feature-flags", "toggle"]
|
|
392
|
+
},
|
|
393
|
+
payload: FlagToggledPayload
|
|
394
|
+
});
|
|
395
|
+
/**
|
|
396
|
+
* Emitted when a targeting rule is created.
|
|
397
|
+
*/
|
|
398
|
+
const RuleCreatedEvent = defineEvent({
|
|
399
|
+
meta: {
|
|
400
|
+
key: "flag.rule_created",
|
|
401
|
+
version: "1.0.0",
|
|
402
|
+
description: "A targeting rule has been created.",
|
|
403
|
+
stability: "stable",
|
|
404
|
+
owners: ["@platform.feature-flags"],
|
|
405
|
+
tags: [
|
|
406
|
+
"feature-flags",
|
|
407
|
+
"rule",
|
|
408
|
+
"create"
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
payload: RuleCreatedPayload
|
|
412
|
+
});
|
|
413
|
+
/**
|
|
414
|
+
* Emitted when a targeting rule is deleted.
|
|
415
|
+
*/
|
|
416
|
+
const RuleDeletedEvent = defineEvent({
|
|
417
|
+
meta: {
|
|
418
|
+
key: "flag.rule_deleted",
|
|
419
|
+
version: "1.0.0",
|
|
420
|
+
description: "A targeting rule has been deleted.",
|
|
421
|
+
stability: "stable",
|
|
422
|
+
owners: ["@platform.feature-flags"],
|
|
423
|
+
tags: [
|
|
424
|
+
"feature-flags",
|
|
425
|
+
"rule",
|
|
426
|
+
"delete"
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
payload: RuleDeletedPayload
|
|
430
|
+
});
|
|
431
|
+
/**
|
|
432
|
+
* Emitted when an experiment is created.
|
|
433
|
+
*/
|
|
434
|
+
const ExperimentCreatedEvent = defineEvent({
|
|
435
|
+
meta: {
|
|
436
|
+
key: "experiment.created",
|
|
437
|
+
version: "1.0.0",
|
|
438
|
+
description: "An experiment has been created.",
|
|
439
|
+
stability: "stable",
|
|
440
|
+
owners: ["@platform.feature-flags"],
|
|
441
|
+
tags: [
|
|
442
|
+
"feature-flags",
|
|
443
|
+
"experiment",
|
|
444
|
+
"create"
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
payload: ExperimentCreatedPayload
|
|
448
|
+
});
|
|
449
|
+
/**
|
|
450
|
+
* Emitted when an experiment starts.
|
|
451
|
+
*/
|
|
452
|
+
const ExperimentStartedEvent = defineEvent({
|
|
453
|
+
meta: {
|
|
454
|
+
key: "experiment.started",
|
|
455
|
+
version: "1.0.0",
|
|
456
|
+
description: "An experiment has started.",
|
|
457
|
+
stability: "stable",
|
|
458
|
+
owners: ["@platform.feature-flags"],
|
|
459
|
+
tags: [
|
|
460
|
+
"feature-flags",
|
|
461
|
+
"experiment",
|
|
462
|
+
"start"
|
|
463
|
+
]
|
|
464
|
+
},
|
|
465
|
+
payload: ExperimentStartedPayload
|
|
466
|
+
});
|
|
467
|
+
/**
|
|
468
|
+
* Emitted when an experiment stops.
|
|
469
|
+
*/
|
|
470
|
+
const ExperimentStoppedEvent = defineEvent({
|
|
471
|
+
meta: {
|
|
472
|
+
key: "experiment.stopped",
|
|
473
|
+
version: "1.0.0",
|
|
474
|
+
description: "An experiment has stopped.",
|
|
475
|
+
stability: "stable",
|
|
476
|
+
owners: ["@platform.feature-flags"],
|
|
477
|
+
tags: [
|
|
478
|
+
"feature-flags",
|
|
479
|
+
"experiment",
|
|
480
|
+
"stop"
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
payload: ExperimentStoppedPayload
|
|
484
|
+
});
|
|
485
|
+
/**
|
|
486
|
+
* Emitted when a flag is evaluated (for analytics).
|
|
487
|
+
*/
|
|
488
|
+
const FlagEvaluatedEvent = defineEvent({
|
|
489
|
+
meta: {
|
|
490
|
+
key: "flag.evaluated",
|
|
491
|
+
version: "1.0.0",
|
|
492
|
+
description: "A feature flag has been evaluated.",
|
|
493
|
+
stability: "stable",
|
|
494
|
+
owners: ["@platform.feature-flags"],
|
|
495
|
+
tags: ["feature-flags", "evaluate"]
|
|
496
|
+
},
|
|
497
|
+
payload: FlagEvaluatedPayload
|
|
498
|
+
});
|
|
499
|
+
/**
|
|
500
|
+
* Emitted when a subject is assigned to an experiment variant.
|
|
501
|
+
*/
|
|
502
|
+
const VariantAssignedEvent = defineEvent({
|
|
503
|
+
meta: {
|
|
504
|
+
key: "experiment.variant_assigned",
|
|
505
|
+
version: "1.0.0",
|
|
506
|
+
description: "A subject has been assigned to an experiment variant.",
|
|
507
|
+
stability: "stable",
|
|
508
|
+
owners: ["@platform.feature-flags"],
|
|
509
|
+
tags: [
|
|
510
|
+
"feature-flags",
|
|
511
|
+
"experiment",
|
|
512
|
+
"variant"
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
payload: VariantAssignedPayload
|
|
516
|
+
});
|
|
517
|
+
/**
|
|
518
|
+
* All feature flag events.
|
|
519
|
+
*/
|
|
520
|
+
const FeatureFlagEvents = {
|
|
521
|
+
FlagCreatedEvent,
|
|
522
|
+
FlagUpdatedEvent,
|
|
523
|
+
FlagDeletedEvent,
|
|
524
|
+
FlagToggledEvent,
|
|
525
|
+
RuleCreatedEvent,
|
|
526
|
+
RuleDeletedEvent,
|
|
527
|
+
ExperimentCreatedEvent,
|
|
528
|
+
ExperimentStartedEvent,
|
|
529
|
+
ExperimentStoppedEvent,
|
|
530
|
+
FlagEvaluatedEvent,
|
|
531
|
+
VariantAssignedEvent
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
//#endregion
|
|
535
|
+
export { ExperimentCreatedEvent, ExperimentStartedEvent, ExperimentStoppedEvent, FeatureFlagEvents, FlagCreatedEvent, FlagDeletedEvent, FlagEvaluatedEvent, FlagToggledEvent, FlagUpdatedEvent, RuleCreatedEvent, RuleDeletedEvent, VariantAssignedEvent };
|
|
536
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst FlagCreatedPayload = defineSchemaModel({\n name: 'FlagCreatedEventPayload',\n description: 'Payload when a feature flag is created',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FlagUpdatedPayload = defineSchemaModel({\n name: 'FlagUpdatedEventPayload',\n description: 'Payload when a feature flag is updated',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changes: { type: ScalarTypeEnum.JSON(), isOptional: false },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FlagDeletedPayload = defineSchemaModel({\n name: 'FlagDeletedEventPayload',\n description: 'Payload when a feature flag is deleted',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FlagToggledPayload = defineSchemaModel({\n name: 'FlagToggledEventPayload',\n description: 'Payload when a feature flag status is toggled',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toggledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n toggledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst RuleCreatedPayload = defineSchemaModel({\n name: 'RuleCreatedEventPayload',\n description: 'Payload when a targeting rule is created',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n attribute: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n operator: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst RuleDeletedPayload = defineSchemaModel({\n name: 'RuleDeletedEventPayload',\n description: 'Payload when a targeting rule is deleted',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ExperimentCreatedPayload = defineSchemaModel({\n name: 'ExperimentCreatedEventPayload',\n description: 'Payload when an experiment is created',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ExperimentStartedPayload = defineSchemaModel({\n name: 'ExperimentStartedEventPayload',\n description: 'Payload when an experiment starts',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n audiencePercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n startedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ExperimentStoppedPayload = defineSchemaModel({\n name: 'ExperimentStoppedEventPayload',\n description: 'Payload when an experiment stops',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n winningVariant: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n stoppedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n stoppedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst FlagEvaluatedPayload = defineSchemaModel({\n name: 'FlagEvaluatedEventPayload',\n description: 'Payload when a flag is evaluated (for analytics)',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n result: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n variant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n evaluatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst VariantAssignedPayload = defineSchemaModel({\n name: 'VariantAssignedEventPayload',\n description: 'Payload when a subject is assigned to an experiment variant',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n experimentKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variant: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n bucket: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n assignedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a feature flag is created.\n */\nexport const FlagCreatedEvent = defineEvent({\n meta: {\n key: 'flag.created',\n version: '1.0.0',\n description: 'A feature flag has been created.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'create'],\n },\n payload: FlagCreatedPayload,\n});\n\n/**\n * Emitted when a feature flag is updated.\n */\nexport const FlagUpdatedEvent = defineEvent({\n meta: {\n key: 'flag.updated',\n version: '1.0.0',\n description: 'A feature flag has been updated.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'update'],\n },\n payload: FlagUpdatedPayload,\n});\n\n/**\n * Emitted when a feature flag is deleted.\n */\nexport const FlagDeletedEvent = defineEvent({\n meta: {\n key: 'flag.deleted',\n version: '1.0.0',\n description: 'A feature flag has been deleted.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'delete'],\n },\n payload: FlagDeletedPayload,\n});\n\n/**\n * Emitted when a feature flag status is toggled.\n */\nexport const FlagToggledEvent = defineEvent({\n meta: {\n key: 'flag.toggled',\n version: '1.0.0',\n description: 'A feature flag status has been toggled.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'toggle'],\n },\n payload: FlagToggledPayload,\n});\n\n/**\n * Emitted when a targeting rule is created.\n */\nexport const RuleCreatedEvent = defineEvent({\n meta: {\n key: 'flag.rule_created',\n version: '1.0.0',\n description: 'A targeting rule has been created.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'rule', 'create'],\n },\n payload: RuleCreatedPayload,\n});\n\n/**\n * Emitted when a targeting rule is deleted.\n */\nexport const RuleDeletedEvent = defineEvent({\n meta: {\n key: 'flag.rule_deleted',\n version: '1.0.0',\n description: 'A targeting rule has been deleted.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'rule', 'delete'],\n },\n payload: RuleDeletedPayload,\n});\n\n/**\n * Emitted when an experiment is created.\n */\nexport const ExperimentCreatedEvent = defineEvent({\n meta: {\n key: 'experiment.created',\n version: '1.0.0',\n description: 'An experiment has been created.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiment', 'create'],\n },\n payload: ExperimentCreatedPayload,\n});\n\n/**\n * Emitted when an experiment starts.\n */\nexport const ExperimentStartedEvent = defineEvent({\n meta: {\n key: 'experiment.started',\n version: '1.0.0',\n description: 'An experiment has started.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiment', 'start'],\n },\n payload: ExperimentStartedPayload,\n});\n\n/**\n * Emitted when an experiment stops.\n */\nexport const ExperimentStoppedEvent = defineEvent({\n meta: {\n key: 'experiment.stopped',\n version: '1.0.0',\n description: 'An experiment has stopped.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiment', 'stop'],\n },\n payload: ExperimentStoppedPayload,\n});\n\n/**\n * Emitted when a flag is evaluated (for analytics).\n */\nexport const FlagEvaluatedEvent = defineEvent({\n meta: {\n key: 'flag.evaluated',\n version: '1.0.0',\n description: 'A feature flag has been evaluated.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'evaluate'],\n },\n payload: FlagEvaluatedPayload,\n});\n\n/**\n * Emitted when a subject is assigned to an experiment variant.\n */\nexport const VariantAssignedEvent = defineEvent({\n meta: {\n key: 'experiment.variant_assigned',\n version: '1.0.0',\n description: 'A subject has been assigned to an experiment variant.',\n stability: 'stable',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiment', 'variant'],\n },\n payload: VariantAssignedPayload,\n});\n\n/**\n * All feature flag events.\n */\nexport const FeatureFlagEvents = {\n FlagCreatedEvent,\n FlagUpdatedEvent,\n FlagDeletedEvent,\n FlagToggledEvent,\n RuleCreatedEvent,\n RuleDeletedEvent,\n ExperimentCreatedEvent,\n ExperimentStartedEvent,\n ExperimentStoppedEvent,\n FlagEvaluatedEvent,\n VariantAssignedEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,qBAAqB,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC3D,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YA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AS;EAC1C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAc;GAAS;EAChD;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAc;GAAQ;EAC/C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAc;GAAO;EAC9C;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,qBAAqB,YAAY;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM,CAAC,iBAAiB,WAAW;EACpC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAc;GAAU;EACjD;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CapabilitySpec } from "./contracts/src/capabilities/capabilities.js";
|
|
2
|
+
import "./contracts/src/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/feature-flags.capability.d.ts
|
|
5
|
+
declare const FeatureFlagsCapability: CapabilitySpec;
|
|
6
|
+
declare const ExperimentsCapability: CapabilitySpec;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ExperimentsCapability, FeatureFlagsCapability };
|
|
9
|
+
//# sourceMappingURL=feature-flags.capability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.capability.d.ts","names":[],"sources":["../src/feature-flags.capability.ts"],"sourcesContent":[],"mappings":";;;;cAEa,wBAUX;cAEW,uBAUX"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StabilityEnum, defineCapability } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/feature-flags.capability.ts
|
|
4
|
+
const FeatureFlagsCapability = defineCapability({ meta: {
|
|
5
|
+
key: "feature-flags",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "api",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "Feature flag management and evaluation",
|
|
10
|
+
owners: ["@platform.featureflags"],
|
|
11
|
+
tags: ["feature-flags", "configuration"]
|
|
12
|
+
} });
|
|
13
|
+
const ExperimentsCapability = defineCapability({ meta: {
|
|
14
|
+
key: "experiments",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
kind: "api",
|
|
17
|
+
stability: StabilityEnum.Experimental,
|
|
18
|
+
description: "A/B testing and experimentation platform",
|
|
19
|
+
owners: ["@platform.featureflags"],
|
|
20
|
+
tags: ["experiments", "ab-testing"]
|
|
21
|
+
} });
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ExperimentsCapability, FeatureFlagsCapability };
|
|
25
|
+
//# sourceMappingURL=feature-flags.capability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.capability.js","names":[],"sources":["../src/feature-flags.capability.ts"],"sourcesContent":["import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';\n\nexport const FeatureFlagsCapability = defineCapability({\n meta: {\n key: 'feature-flags',\n version: '1.0.0',\n kind: 'api',\n stability: StabilityEnum.Experimental,\n description: 'Feature flag management and evaluation',\n owners: ['@platform.featureflags'],\n tags: ['feature-flags', 'configuration'],\n },\n});\n\nexport const ExperimentsCapability = defineCapability({\n meta: {\n key: 'experiments',\n version: '1.0.0',\n kind: 'api',\n stability: StabilityEnum.Experimental,\n description: 'A/B testing and experimentation platform',\n owners: ['@platform.featureflags'],\n tags: ['experiments', 'ab-testing'],\n },\n});\n"],"mappings":";;;AAEA,MAAa,yBAAyB,iBAAiB,EACrD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,yBAAyB;CAClC,MAAM,CAAC,iBAAiB,gBAAgB;CACzC,EACF,CAAC;AAEF,MAAa,wBAAwB,iBAAiB,EACpD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,yBAAyB;CAClC,MAAM,CAAC,eAAe,aAAa;CACpC,EACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FeatureModuleSpec } from "./contracts/src/features/types.js";
|
|
2
|
+
import "./contracts/src/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/feature-flags.feature.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Feature Flags feature module that bundles flag management,
|
|
7
|
+
* targeting rules, and A/B experiment capabilities.
|
|
8
|
+
*/
|
|
9
|
+
declare const FeatureFlagsFeature: FeatureModuleSpec;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FeatureFlagsFeature };
|
|
12
|
+
//# sourceMappingURL=feature-flags.feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.feature.d.ts","names":[],"sources":["../src/feature-flags.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAWa,cAAA,mBAoEX,EAAA,iBAAA"}
|