@contractspec/lib.feature-flags 1.44.1 → 1.45.1
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 +13 -13
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/src/app-config/spec.d.ts +2 -1
- package/dist/contracts/src/capabilities/capabilities.d.ts +2 -3
- package/dist/contracts/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/contracts/src/data-views/registry.d.ts +2 -2
- 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/spec.d.ts +2 -1
- package/dist/contracts/src/experiments/spec.d.ts.map +1 -1
- package/dist/contracts/src/features/types.d.ts +6 -6
- package/dist/contracts/src/index.d.ts +2 -1
- package/dist/contracts/src/integrations/spec.d.ts +2 -1
- package/dist/contracts/src/knowledge/spec.d.ts +2 -1
- package/dist/contracts/src/operations/operation.d.ts +2 -2
- package/dist/contracts/src/operations/registry.d.ts +2 -2
- package/dist/contracts/src/ownership.d.ts +1 -1
- package/dist/contracts/src/policy/spec.d.ts +1 -1
- package/dist/contracts/src/server/mcp/createMcpServer.d.ts +1 -2
- package/dist/contracts/src/telemetry/spec.d.ts +2 -1
- package/dist/contracts/src/tests/spec.d.ts +1 -1
- package/dist/contracts/src/tests/spec.d.ts.map +1 -1
- package/dist/contracts/src/themes.d.ts +2 -1
- package/dist/contracts/src/workflow/spec.d.ts +2 -2
- package/dist/events.js +11 -11
- package/dist/events.js.map +1 -1
- package/dist/feature-flags.feature.js +28 -28
- package/dist/feature-flags.feature.js.map +1 -1
- package/package.json +5 -5
package/dist/contracts/index.js
CHANGED
|
@@ -498,7 +498,7 @@ const SuccessOutput = defineSchemaModel({
|
|
|
498
498
|
const CreateFlagContract = defineCommand({
|
|
499
499
|
meta: {
|
|
500
500
|
key: "flag.create",
|
|
501
|
-
version: 1,
|
|
501
|
+
version: "1.0.0",
|
|
502
502
|
stability: "stable",
|
|
503
503
|
owners: [...OWNERS],
|
|
504
504
|
tags: ["feature-flags", "create"],
|
|
@@ -524,7 +524,7 @@ const CreateFlagContract = defineCommand({
|
|
|
524
524
|
const UpdateFlagContract = defineCommand({
|
|
525
525
|
meta: {
|
|
526
526
|
key: "flag.update",
|
|
527
|
-
version: 1,
|
|
527
|
+
version: "1.0.0",
|
|
528
528
|
stability: "stable",
|
|
529
529
|
owners: [...OWNERS],
|
|
530
530
|
tags: ["feature-flags", "update"],
|
|
@@ -550,7 +550,7 @@ const UpdateFlagContract = defineCommand({
|
|
|
550
550
|
const DeleteFlagContract = defineCommand({
|
|
551
551
|
meta: {
|
|
552
552
|
key: "flag.delete",
|
|
553
|
-
version: 1,
|
|
553
|
+
version: "1.0.0",
|
|
554
554
|
stability: "stable",
|
|
555
555
|
owners: [...OWNERS],
|
|
556
556
|
tags: ["feature-flags", "delete"],
|
|
@@ -584,7 +584,7 @@ const DeleteFlagContract = defineCommand({
|
|
|
584
584
|
const ToggleFlagContract = defineCommand({
|
|
585
585
|
meta: {
|
|
586
586
|
key: "flag.toggle",
|
|
587
|
-
version: 1,
|
|
587
|
+
version: "1.0.0",
|
|
588
588
|
stability: "stable",
|
|
589
589
|
owners: [...OWNERS],
|
|
590
590
|
tags: ["feature-flags", "toggle"],
|
|
@@ -618,7 +618,7 @@ const ToggleFlagContract = defineCommand({
|
|
|
618
618
|
const GetFlagContract = defineQuery({
|
|
619
619
|
meta: {
|
|
620
620
|
key: "flag.get",
|
|
621
|
-
version: 1,
|
|
621
|
+
version: "1.0.0",
|
|
622
622
|
stability: "stable",
|
|
623
623
|
owners: [...OWNERS],
|
|
624
624
|
tags: ["feature-flags", "get"],
|
|
@@ -644,7 +644,7 @@ const GetFlagContract = defineQuery({
|
|
|
644
644
|
const ListFlagsContract = defineQuery({
|
|
645
645
|
meta: {
|
|
646
646
|
key: "flag.list",
|
|
647
|
-
version: 1,
|
|
647
|
+
version: "1.0.0",
|
|
648
648
|
stability: "stable",
|
|
649
649
|
owners: [...OWNERS],
|
|
650
650
|
tags: ["feature-flags", "list"],
|
|
@@ -664,7 +664,7 @@ const ListFlagsContract = defineQuery({
|
|
|
664
664
|
const EvaluateFlagContract = defineQuery({
|
|
665
665
|
meta: {
|
|
666
666
|
key: "flag.evaluate",
|
|
667
|
-
version: 1,
|
|
667
|
+
version: "1.0.0",
|
|
668
668
|
stability: "stable",
|
|
669
669
|
owners: [...OWNERS],
|
|
670
670
|
tags: ["feature-flags", "evaluate"],
|
|
@@ -690,7 +690,7 @@ const EvaluateFlagContract = defineQuery({
|
|
|
690
690
|
const CreateRuleContract = defineCommand({
|
|
691
691
|
meta: {
|
|
692
692
|
key: "flag.rule.create",
|
|
693
|
-
version: 1,
|
|
693
|
+
version: "1.0.0",
|
|
694
694
|
stability: "stable",
|
|
695
695
|
owners: [...OWNERS],
|
|
696
696
|
tags: [
|
|
@@ -728,7 +728,7 @@ const CreateRuleContract = defineCommand({
|
|
|
728
728
|
const DeleteRuleContract = defineCommand({
|
|
729
729
|
meta: {
|
|
730
730
|
key: "flag.rule.delete",
|
|
731
|
-
version: 1,
|
|
731
|
+
version: "1.0.0",
|
|
732
732
|
stability: "stable",
|
|
733
733
|
owners: [...OWNERS],
|
|
734
734
|
tags: [
|
|
@@ -758,7 +758,7 @@ const DeleteRuleContract = defineCommand({
|
|
|
758
758
|
const CreateExperimentContract = defineCommand({
|
|
759
759
|
meta: {
|
|
760
760
|
key: "experiment.create",
|
|
761
|
-
version: 1,
|
|
761
|
+
version: "1.0.0",
|
|
762
762
|
stability: "stable",
|
|
763
763
|
owners: [...OWNERS],
|
|
764
764
|
tags: [
|
|
@@ -802,7 +802,7 @@ const CreateExperimentContract = defineCommand({
|
|
|
802
802
|
const StartExperimentContract = defineCommand({
|
|
803
803
|
meta: {
|
|
804
804
|
key: "experiment.start",
|
|
805
|
-
version: 1,
|
|
805
|
+
version: "1.0.0",
|
|
806
806
|
stability: "stable",
|
|
807
807
|
owners: [...OWNERS],
|
|
808
808
|
tags: [
|
|
@@ -840,7 +840,7 @@ const StartExperimentContract = defineCommand({
|
|
|
840
840
|
const StopExperimentContract = defineCommand({
|
|
841
841
|
meta: {
|
|
842
842
|
key: "experiment.stop",
|
|
843
|
-
version: 1,
|
|
843
|
+
version: "1.0.0",
|
|
844
844
|
stability: "stable",
|
|
845
845
|
owners: [...OWNERS],
|
|
846
846
|
tags: [
|
|
@@ -878,7 +878,7 @@ const StopExperimentContract = defineCommand({
|
|
|
878
878
|
const GetExperimentContract = defineQuery({
|
|
879
879
|
meta: {
|
|
880
880
|
key: "experiment.get",
|
|
881
|
-
version: 1,
|
|
881
|
+
version: "1.0.0",
|
|
882
882
|
stability: "stable",
|
|
883
883
|
owners: [...OWNERS],
|
|
884
884
|
tags: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.feature-flags'] as const;\n\n// ============ Schema Models ============\n\nexport const FeatureFlagModel = defineSchemaModel({\n name: 'FeatureFlag',\n description: 'Represents a feature flag',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const TargetingRuleModel = defineSchemaModel({\n name: 'TargetingRule',\n description: 'Represents a targeting rule',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n attribute: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n operator: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.JSON(), isOptional: false },\n rolloutPercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n serveValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n serveVariant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const ExperimentModel = defineSchemaModel({\n name: 'Experiment',\n description: 'Represents an experiment',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n hypothesis: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n metrics: { type: ScalarTypeEnum.JSON(), isOptional: true },\n audiencePercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n endedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n winningVariant: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n results: { type: ScalarTypeEnum.JSON(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const EvaluationResultModel = defineSchemaModel({\n name: 'EvaluationResult',\n description: 'Result of flag evaluation',\n fields: {\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n variant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst CreateFlagInput = defineSchemaModel({\n name: 'CreateFlagInput',\n description: 'Input for creating a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst UpdateFlagInput = defineSchemaModel({\n name: 'UpdateFlagInput',\n description: 'Input for updating a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst DeleteFlagInput = defineSchemaModel({\n name: 'DeleteFlagInput',\n description: 'Input for deleting a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst ToggleFlagInput = defineSchemaModel({\n name: 'ToggleFlagInput',\n description: 'Input for toggling a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst GetFlagInput = defineSchemaModel({\n name: 'GetFlagInput',\n description: 'Input for getting a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst ListFlagsInput = defineSchemaModel({\n name: 'ListFlagsInput',\n description: 'Input for listing feature flags',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst ListFlagsOutput = defineSchemaModel({\n name: 'ListFlagsOutput',\n description: 'Output for listing feature flags',\n fields: {\n flags: { type: FeatureFlagModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst EvaluateFlagInput = defineSchemaModel({\n name: 'EvaluateFlagInput',\n description: 'Input for evaluating a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n context: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nconst CreateRuleInput = defineSchemaModel({\n name: 'CreateRuleInput',\n description: 'Input for creating a targeting rule',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n attribute: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n operator: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.JSON(), isOptional: false },\n rolloutPercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n serveValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n serveVariant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst DeleteRuleInput = defineSchemaModel({\n name: 'DeleteRuleInput',\n description: 'Input for deleting a targeting rule',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CreateExperimentInput = defineSchemaModel({\n name: 'CreateExperimentInput',\n description: 'Input for creating an experiment',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n hypothesis: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n metrics: { type: ScalarTypeEnum.JSON(), isOptional: true },\n audiencePercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n scheduledStartAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n scheduledEndAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst StartExperimentInput = defineSchemaModel({\n name: 'StartExperimentInput',\n description: 'Input for starting an experiment',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst StopExperimentInput = defineSchemaModel({\n name: 'StopExperimentInput',\n description: 'Input for stopping an experiment',\n fields: {\n experimentId: { 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 },\n});\n\nconst GetExperimentInput = defineSchemaModel({\n name: 'GetExperimentInput',\n description: 'Input for getting an experiment',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst SuccessOutput = defineSchemaModel({\n name: 'SuccessOutput',\n description: 'Generic success output',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Create a feature flag.\n */\nexport const CreateFlagContract = defineCommand({\n meta: {\n key: 'flag.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'create'],\n description: 'Create a new feature flag.',\n goal: 'Define a new feature flag for toggling features.',\n context: 'Called when setting up a new feature flag.',\n },\n io: {\n input: CreateFlagInput,\n output: FeatureFlagModel,\n errors: {\n KEY_ALREADY_EXISTS: {\n description: 'Flag key already exists',\n http: 409,\n gqlCode: 'FLAG_KEY_EXISTS',\n when: 'A flag with this key already exists',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a feature flag.\n */\nexport const UpdateFlagContract = defineCommand({\n meta: {\n key: 'flag.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'update'],\n description: 'Update an existing feature flag.',\n goal: 'Modify flag configuration.',\n context: 'Called when adjusting flag settings.',\n },\n io: {\n input: UpdateFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a feature flag.\n */\nexport const DeleteFlagContract = defineCommand({\n meta: {\n key: 'flag.delete',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'delete'],\n description: 'Delete a feature flag.',\n goal: 'Remove a feature flag and all its rules.',\n context: 'Called when a flag is no longer needed.',\n },\n io: {\n input: DeleteFlagInput,\n output: SuccessOutput,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n FLAG_HAS_ACTIVE_EXPERIMENT: {\n description: 'Flag has an active experiment',\n http: 409,\n gqlCode: 'FLAG_HAS_ACTIVE_EXPERIMENT',\n when: 'Cannot delete flag with running experiment',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Toggle a feature flag status.\n */\nexport const ToggleFlagContract = defineCommand({\n meta: {\n key: 'flag.toggle',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'toggle'],\n description: 'Toggle a feature flag status.',\n goal: 'Quickly enable or disable a feature.',\n context: 'Called when turning a feature on or off.',\n },\n io: {\n input: ToggleFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n INVALID_STATUS: {\n description: 'Invalid status value',\n http: 400,\n gqlCode: 'INVALID_STATUS',\n when: 'Status must be OFF, ON, or GRADUAL',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get a feature flag by key.\n */\nexport const GetFlagContract = defineQuery({\n meta: {\n key: 'flag.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'get'],\n description: 'Get a feature flag by key.',\n goal: 'Retrieve flag configuration.',\n context: 'Called to inspect flag details.',\n },\n io: {\n input: GetFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag key is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * List feature flags.\n */\nexport const ListFlagsContract = defineQuery({\n meta: {\n key: 'flag.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'list'],\n description: 'List all feature flags.',\n goal: 'View all configured flags.',\n context: 'Admin dashboard.',\n },\n io: {\n input: ListFlagsInput,\n output: ListFlagsOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Evaluate a feature flag.\n */\nexport const EvaluateFlagContract = defineQuery({\n meta: {\n key: 'flag.evaluate',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'evaluate'],\n description: 'Evaluate a feature flag for a given context.',\n goal: 'Determine if a feature should be enabled.',\n context: 'Called at runtime to check feature availability.',\n },\n io: {\n input: EvaluateFlagInput,\n output: EvaluationResultModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag key is invalid',\n },\n },\n },\n policy: {\n auth: 'anonymous',\n },\n});\n\n/**\n * Create a targeting rule.\n */\nexport const CreateRuleContract = defineCommand({\n meta: {\n key: 'flag.rule.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'rule', 'create'],\n description: 'Create a targeting rule for a flag.',\n goal: 'Add conditional targeting to a flag.',\n context: 'Called when setting up targeting.',\n },\n io: {\n input: CreateRuleInput,\n output: TargetingRuleModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n INVALID_OPERATOR: {\n description: 'Invalid operator',\n http: 400,\n gqlCode: 'INVALID_OPERATOR',\n when: 'Operator is not supported',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a targeting rule.\n */\nexport const DeleteRuleContract = defineCommand({\n meta: {\n key: 'flag.rule.delete',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'rule', 'delete'],\n description: 'Delete a targeting rule.',\n goal: 'Remove a targeting rule from a flag.',\n context: 'Called when removing targeting conditions.',\n },\n io: {\n input: DeleteRuleInput,\n output: SuccessOutput,\n errors: {\n RULE_NOT_FOUND: {\n description: 'Rule does not exist',\n http: 404,\n gqlCode: 'RULE_NOT_FOUND',\n when: 'Rule ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Create an experiment.\n */\nexport const CreateExperimentContract = defineCommand({\n meta: {\n key: 'experiment.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'create'],\n description: 'Create an A/B test experiment.',\n goal: 'Set up an experiment with variants.',\n context: 'Called when setting up A/B testing.',\n },\n io: {\n input: CreateExperimentInput,\n output: ExperimentModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n EXPERIMENT_KEY_EXISTS: {\n description: 'Experiment key already exists',\n http: 409,\n gqlCode: 'EXPERIMENT_KEY_EXISTS',\n when: 'An experiment with this key already exists',\n },\n INVALID_VARIANTS: {\n description: 'Invalid variant configuration',\n http: 400,\n gqlCode: 'INVALID_VARIANTS',\n when: 'Variant percentages must sum to 100',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Start an experiment.\n */\nexport const StartExperimentContract = defineCommand({\n meta: {\n key: 'experiment.start',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'start'],\n description: 'Start an experiment.',\n goal: 'Begin collecting data for an experiment.',\n context: 'Called when ready to run an A/B test.',\n },\n io: {\n input: StartExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n EXPERIMENT_ALREADY_RUNNING: {\n description: 'Experiment is already running',\n http: 409,\n gqlCode: 'EXPERIMENT_ALREADY_RUNNING',\n when: 'Cannot start an experiment that is already running',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Stop an experiment.\n */\nexport const StopExperimentContract = defineCommand({\n meta: {\n key: 'experiment.stop',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'stop'],\n description: 'Stop an experiment.',\n goal: 'End an experiment and optionally declare a winner.',\n context: 'Called when concluding an A/B test.',\n },\n io: {\n input: StopExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n EXPERIMENT_NOT_RUNNING: {\n description: 'Experiment is not running',\n http: 409,\n gqlCode: 'EXPERIMENT_NOT_RUNNING',\n when: 'Cannot stop an experiment that is not running',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get an experiment.\n */\nexport const GetExperimentContract = defineQuery({\n meta: {\n key: 'experiment.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'get'],\n description: 'Get experiment details.',\n goal: 'View experiment configuration and results.',\n context: 'Called to inspect experiment status.',\n },\n io: {\n input: GetExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,yBAAyB;AAIzC,MAAa,mBAAmB,kBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eA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AS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAiB;GAAc;GAAM;EAC5C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ,EACN,sBAAsB;GACpB,aAAa;GACb,MAAM;GACN,SAAS;GACT,MAAM;GACP,EACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.feature-flags'] as const;\n\n// ============ Schema Models ============\n\nexport const FeatureFlagModel = defineSchemaModel({\n name: 'FeatureFlag',\n description: 'Represents a feature flag',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const TargetingRuleModel = defineSchemaModel({\n name: 'TargetingRule',\n description: 'Represents a targeting rule',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n attribute: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n operator: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.JSON(), isOptional: false },\n rolloutPercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n serveValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n serveVariant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const ExperimentModel = defineSchemaModel({\n name: 'Experiment',\n description: 'Represents an experiment',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n hypothesis: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n metrics: { type: ScalarTypeEnum.JSON(), isOptional: true },\n audiencePercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n endedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n winningVariant: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n results: { type: ScalarTypeEnum.JSON(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const EvaluationResultModel = defineSchemaModel({\n name: 'EvaluationResult',\n description: 'Result of flag evaluation',\n fields: {\n enabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n variant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst CreateFlagInput = defineSchemaModel({\n name: 'CreateFlagInput',\n description: 'Input for creating a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst UpdateFlagInput = defineSchemaModel({\n name: 'UpdateFlagInput',\n description: 'Input for updating a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n defaultValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst DeleteFlagInput = defineSchemaModel({\n name: 'DeleteFlagInput',\n description: 'Input for deleting a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst ToggleFlagInput = defineSchemaModel({\n name: 'ToggleFlagInput',\n description: 'Input for toggling a feature flag',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst GetFlagInput = defineSchemaModel({\n name: 'GetFlagInput',\n description: 'Input for getting a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst ListFlagsInput = defineSchemaModel({\n name: 'ListFlagsInput',\n description: 'Input for listing feature flags',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n tags: { type: ScalarTypeEnum.JSON(), isOptional: true },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst ListFlagsOutput = defineSchemaModel({\n name: 'ListFlagsOutput',\n description: 'Output for listing feature flags',\n fields: {\n flags: { type: FeatureFlagModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst EvaluateFlagInput = defineSchemaModel({\n name: 'EvaluateFlagInput',\n description: 'Input for evaluating a feature flag',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n context: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nconst CreateRuleInput = defineSchemaModel({\n name: 'CreateRuleInput',\n description: 'Input for creating a targeting rule',\n fields: {\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n priority: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n attribute: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n operator: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n value: { type: ScalarTypeEnum.JSON(), isOptional: false },\n rolloutPercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n serveValue: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n serveVariant: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst DeleteRuleInput = defineSchemaModel({\n name: 'DeleteRuleInput',\n description: 'Input for deleting a targeting rule',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst CreateExperimentInput = defineSchemaModel({\n name: 'CreateExperimentInput',\n description: 'Input for creating an experiment',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n hypothesis: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n flagId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variants: { type: ScalarTypeEnum.JSON(), isOptional: false },\n metrics: { type: ScalarTypeEnum.JSON(), isOptional: true },\n audiencePercentage: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n scheduledStartAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n scheduledEndAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst StartExperimentInput = defineSchemaModel({\n name: 'StartExperimentInput',\n description: 'Input for starting an experiment',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst StopExperimentInput = defineSchemaModel({\n name: 'StopExperimentInput',\n description: 'Input for stopping an experiment',\n fields: {\n experimentId: { 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 },\n});\n\nconst GetExperimentInput = defineSchemaModel({\n name: 'GetExperimentInput',\n description: 'Input for getting an experiment',\n fields: {\n experimentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst SuccessOutput = defineSchemaModel({\n name: 'SuccessOutput',\n description: 'Generic success output',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Create a feature flag.\n */\nexport const CreateFlagContract = defineCommand({\n meta: {\n key: 'flag.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'create'],\n description: 'Create a new feature flag.',\n goal: 'Define a new feature flag for toggling features.',\n context: 'Called when setting up a new feature flag.',\n },\n io: {\n input: CreateFlagInput,\n output: FeatureFlagModel,\n errors: {\n KEY_ALREADY_EXISTS: {\n description: 'Flag key already exists',\n http: 409,\n gqlCode: 'FLAG_KEY_EXISTS',\n when: 'A flag with this key already exists',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a feature flag.\n */\nexport const UpdateFlagContract = defineCommand({\n meta: {\n key: 'flag.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'update'],\n description: 'Update an existing feature flag.',\n goal: 'Modify flag configuration.',\n context: 'Called when adjusting flag settings.',\n },\n io: {\n input: UpdateFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a feature flag.\n */\nexport const DeleteFlagContract = defineCommand({\n meta: {\n key: 'flag.delete',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'delete'],\n description: 'Delete a feature flag.',\n goal: 'Remove a feature flag and all its rules.',\n context: 'Called when a flag is no longer needed.',\n },\n io: {\n input: DeleteFlagInput,\n output: SuccessOutput,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n FLAG_HAS_ACTIVE_EXPERIMENT: {\n description: 'Flag has an active experiment',\n http: 409,\n gqlCode: 'FLAG_HAS_ACTIVE_EXPERIMENT',\n when: 'Cannot delete flag with running experiment',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Toggle a feature flag status.\n */\nexport const ToggleFlagContract = defineCommand({\n meta: {\n key: 'flag.toggle',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'toggle'],\n description: 'Toggle a feature flag status.',\n goal: 'Quickly enable or disable a feature.',\n context: 'Called when turning a feature on or off.',\n },\n io: {\n input: ToggleFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n INVALID_STATUS: {\n description: 'Invalid status value',\n http: 400,\n gqlCode: 'INVALID_STATUS',\n when: 'Status must be OFF, ON, or GRADUAL',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get a feature flag by key.\n */\nexport const GetFlagContract = defineQuery({\n meta: {\n key: 'flag.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'get'],\n description: 'Get a feature flag by key.',\n goal: 'Retrieve flag configuration.',\n context: 'Called to inspect flag details.',\n },\n io: {\n input: GetFlagInput,\n output: FeatureFlagModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag key is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * List feature flags.\n */\nexport const ListFlagsContract = defineQuery({\n meta: {\n key: 'flag.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'list'],\n description: 'List all feature flags.',\n goal: 'View all configured flags.',\n context: 'Admin dashboard.',\n },\n io: {\n input: ListFlagsInput,\n output: ListFlagsOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Evaluate a feature flag.\n */\nexport const EvaluateFlagContract = defineQuery({\n meta: {\n key: 'flag.evaluate',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'evaluate'],\n description: 'Evaluate a feature flag for a given context.',\n goal: 'Determine if a feature should be enabled.',\n context: 'Called at runtime to check feature availability.',\n },\n io: {\n input: EvaluateFlagInput,\n output: EvaluationResultModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag key is invalid',\n },\n },\n },\n policy: {\n auth: 'anonymous',\n },\n});\n\n/**\n * Create a targeting rule.\n */\nexport const CreateRuleContract = defineCommand({\n meta: {\n key: 'flag.rule.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'rule', 'create'],\n description: 'Create a targeting rule for a flag.',\n goal: 'Add conditional targeting to a flag.',\n context: 'Called when setting up targeting.',\n },\n io: {\n input: CreateRuleInput,\n output: TargetingRuleModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n INVALID_OPERATOR: {\n description: 'Invalid operator',\n http: 400,\n gqlCode: 'INVALID_OPERATOR',\n when: 'Operator is not supported',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a targeting rule.\n */\nexport const DeleteRuleContract = defineCommand({\n meta: {\n key: 'flag.rule.delete',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'rule', 'delete'],\n description: 'Delete a targeting rule.',\n goal: 'Remove a targeting rule from a flag.',\n context: 'Called when removing targeting conditions.',\n },\n io: {\n input: DeleteRuleInput,\n output: SuccessOutput,\n errors: {\n RULE_NOT_FOUND: {\n description: 'Rule does not exist',\n http: 404,\n gqlCode: 'RULE_NOT_FOUND',\n when: 'Rule ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Create an experiment.\n */\nexport const CreateExperimentContract = defineCommand({\n meta: {\n key: 'experiment.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'create'],\n description: 'Create an A/B test experiment.',\n goal: 'Set up an experiment with variants.',\n context: 'Called when setting up A/B testing.',\n },\n io: {\n input: CreateExperimentInput,\n output: ExperimentModel,\n errors: {\n FLAG_NOT_FOUND: {\n description: 'Flag does not exist',\n http: 404,\n gqlCode: 'FLAG_NOT_FOUND',\n when: 'Flag ID is invalid',\n },\n EXPERIMENT_KEY_EXISTS: {\n description: 'Experiment key already exists',\n http: 409,\n gqlCode: 'EXPERIMENT_KEY_EXISTS',\n when: 'An experiment with this key already exists',\n },\n INVALID_VARIANTS: {\n description: 'Invalid variant configuration',\n http: 400,\n gqlCode: 'INVALID_VARIANTS',\n when: 'Variant percentages must sum to 100',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Start an experiment.\n */\nexport const StartExperimentContract = defineCommand({\n meta: {\n key: 'experiment.start',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'start'],\n description: 'Start an experiment.',\n goal: 'Begin collecting data for an experiment.',\n context: 'Called when ready to run an A/B test.',\n },\n io: {\n input: StartExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n EXPERIMENT_ALREADY_RUNNING: {\n description: 'Experiment is already running',\n http: 409,\n gqlCode: 'EXPERIMENT_ALREADY_RUNNING',\n when: 'Cannot start an experiment that is already running',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Stop an experiment.\n */\nexport const StopExperimentContract = defineCommand({\n meta: {\n key: 'experiment.stop',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'stop'],\n description: 'Stop an experiment.',\n goal: 'End an experiment and optionally declare a winner.',\n context: 'Called when concluding an A/B test.',\n },\n io: {\n input: StopExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n EXPERIMENT_NOT_RUNNING: {\n description: 'Experiment is not running',\n http: 409,\n gqlCode: 'EXPERIMENT_NOT_RUNNING',\n when: 'Cannot stop an experiment that is not running',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get an experiment.\n */\nexport const GetExperimentContract = defineQuery({\n meta: {\n key: 'experiment.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['feature-flags', 'experiment', 'get'],\n description: 'Get experiment details.',\n goal: 'View experiment configuration and results.',\n context: 'Called to inspect experiment status.',\n },\n io: {\n input: GetExperimentInput,\n output: ExperimentModel,\n errors: {\n EXPERIMENT_NOT_FOUND: {\n description: 'Experiment does not exist',\n http: 404,\n gqlCode: 'EXPERIMENT_NOT_FOUND',\n when: 'Experiment ID is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,yBAAyB;AAIzC,MAAa,mBAAmB,kBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAC3D,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,MAAM;G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CACF,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import "../docs/registry.js";
|
|
2
1
|
import "../ownership.js";
|
|
3
2
|
|
|
4
3
|
//#region ../contracts/src/capabilities/capabilities.d.ts
|
|
5
4
|
type CapabilityKind = 'api' | 'event' | 'data' | 'ui' | 'integration';
|
|
6
5
|
interface CapabilityRequirement {
|
|
7
6
|
key: string;
|
|
8
|
-
version?:
|
|
7
|
+
version?: string;
|
|
9
8
|
kind?: CapabilityKind;
|
|
10
9
|
optional?: boolean;
|
|
11
10
|
reason?: string;
|
|
12
11
|
}
|
|
13
12
|
interface CapabilityRef {
|
|
14
13
|
key: string;
|
|
15
|
-
version:
|
|
14
|
+
version: string;
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
17
|
export { CapabilityKind, CapabilityRef, CapabilityRequirement };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","names":[],"sources":["../../../../../contracts/src/capabilities/capabilities.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","names":[],"sources":["../../../../../contracts/src/capabilities/capabilities.ts"],"sourcesContent":[],"mappings":";;;KAGY,cAAA;UAoBK,qBAAA;;;SAGR;;;;UAKQ,aAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
1
|
+
import "./spec.js";
|
|
2
|
+
import "../registry.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./types.js";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../ownership.js";
|
|
2
2
|
import "../policy/spec.js";
|
|
3
3
|
import "../telemetry/spec.js";
|
|
4
|
+
import "../registry.js";
|
|
4
5
|
|
|
5
6
|
//#region ../contracts/src/experiments/spec.d.ts
|
|
6
7
|
interface ExperimentRef {
|
|
7
8
|
key: string;
|
|
8
|
-
version?:
|
|
9
|
+
version?: string;
|
|
9
10
|
}
|
|
10
11
|
//#endregion
|
|
11
12
|
export { ExperimentRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../../contracts/src/experiments/spec.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../../contracts/src/experiments/spec.ts"],"sourcesContent":[],"mappings":";;;;;;UAOiB,aAAA;EAAA,GAAA,EAAA,MAAA"}
|
|
@@ -13,33 +13,33 @@ interface OpRef {
|
|
|
13
13
|
/** Operation key (OperationSpec.meta.key). */
|
|
14
14
|
key: string;
|
|
15
15
|
/** Operation version (OperationSpec.meta.version). */
|
|
16
|
-
version:
|
|
16
|
+
version: string;
|
|
17
17
|
}
|
|
18
18
|
interface EventRef {
|
|
19
19
|
/** Event key. */
|
|
20
20
|
key: string;
|
|
21
21
|
/** Event version. */
|
|
22
|
-
version:
|
|
22
|
+
version: string;
|
|
23
23
|
}
|
|
24
24
|
interface PresentationRef {
|
|
25
25
|
/** Presentation key. */
|
|
26
26
|
key: string;
|
|
27
27
|
/** Presentation version. */
|
|
28
|
-
version:
|
|
28
|
+
version: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Reference to a data view spec.
|
|
32
32
|
*/
|
|
33
33
|
interface DataViewRef {
|
|
34
34
|
key: string;
|
|
35
|
-
version:
|
|
35
|
+
version: string;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Reference to a form spec.
|
|
39
39
|
*/
|
|
40
40
|
interface FormRef {
|
|
41
41
|
key: string;
|
|
42
|
-
version:
|
|
42
|
+
version: string;
|
|
43
43
|
}
|
|
44
44
|
/** Group operations/events/presentations into an installable feature. */
|
|
45
45
|
interface FeatureModuleSpec {
|
|
@@ -67,7 +67,7 @@ interface FeatureModuleSpec {
|
|
|
67
67
|
/** Presentation key. */
|
|
68
68
|
key: string;
|
|
69
69
|
/** Presentation version. */
|
|
70
|
-
version:
|
|
70
|
+
version: string;
|
|
71
71
|
/** Required targets that must be supported by the descriptor. */
|
|
72
72
|
targets: PresentationTarget[];
|
|
73
73
|
}[];
|
|
@@ -34,7 +34,7 @@ interface EmitDeclRef {
|
|
|
34
34
|
}
|
|
35
35
|
interface EmitDeclInline {
|
|
36
36
|
key: string;
|
|
37
|
-
version:
|
|
37
|
+
version: string;
|
|
38
38
|
when: string;
|
|
39
39
|
payload: AnySchemaModel;
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ type EmitDecl = EmitDeclRef | EmitDeclInline;
|
|
|
46
46
|
interface TelemetryTrigger {
|
|
47
47
|
event: {
|
|
48
48
|
key: string;
|
|
49
|
-
version?:
|
|
49
|
+
version?: string;
|
|
50
50
|
};
|
|
51
51
|
properties?: (args: {
|
|
52
52
|
input: unknown;
|
|
@@ -39,7 +39,7 @@ declare const TagsEnum: {
|
|
|
39
39
|
type Tag = (typeof TagsEnum)[keyof typeof TagsEnum] | (string & {});
|
|
40
40
|
interface OwnerShipMeta {
|
|
41
41
|
/** Breaking changes => bump version */
|
|
42
|
-
version:
|
|
42
|
+
version: string;
|
|
43
43
|
/** Fully-qualified spec key (e.g., "sigil.beginSignup") */
|
|
44
44
|
key: string;
|
|
45
45
|
/** Human-friendly spec title (e.g., "Signup begin") */
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import "../ownership.js";
|
|
1
|
+
import "../ownership.js";
|
|
2
|
+
import "../registry.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../../contracts/src/tests/spec.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../../contracts/src/tests/spec.ts"],"sourcesContent":[],"mappings":";;;;UAiFiB,WAAA"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import "./ownership.js";
|
|
1
|
+
import "./ownership.js";
|
|
2
|
+
import "./registry.js";
|
package/dist/events.js
CHANGED
|
@@ -342,7 +342,7 @@ const VariantAssignedPayload = defineSchemaModel({
|
|
|
342
342
|
const FlagCreatedEvent = defineEvent({
|
|
343
343
|
meta: {
|
|
344
344
|
key: "flag.created",
|
|
345
|
-
version: 1,
|
|
345
|
+
version: "1.0.0",
|
|
346
346
|
description: "A feature flag has been created.",
|
|
347
347
|
stability: "stable",
|
|
348
348
|
owners: ["@platform.feature-flags"],
|
|
@@ -356,7 +356,7 @@ const FlagCreatedEvent = defineEvent({
|
|
|
356
356
|
const FlagUpdatedEvent = defineEvent({
|
|
357
357
|
meta: {
|
|
358
358
|
key: "flag.updated",
|
|
359
|
-
version: 1,
|
|
359
|
+
version: "1.0.0",
|
|
360
360
|
description: "A feature flag has been updated.",
|
|
361
361
|
stability: "stable",
|
|
362
362
|
owners: ["@platform.feature-flags"],
|
|
@@ -370,7 +370,7 @@ const FlagUpdatedEvent = defineEvent({
|
|
|
370
370
|
const FlagDeletedEvent = defineEvent({
|
|
371
371
|
meta: {
|
|
372
372
|
key: "flag.deleted",
|
|
373
|
-
version: 1,
|
|
373
|
+
version: "1.0.0",
|
|
374
374
|
description: "A feature flag has been deleted.",
|
|
375
375
|
stability: "stable",
|
|
376
376
|
owners: ["@platform.feature-flags"],
|
|
@@ -384,7 +384,7 @@ const FlagDeletedEvent = defineEvent({
|
|
|
384
384
|
const FlagToggledEvent = defineEvent({
|
|
385
385
|
meta: {
|
|
386
386
|
key: "flag.toggled",
|
|
387
|
-
version: 1,
|
|
387
|
+
version: "1.0.0",
|
|
388
388
|
description: "A feature flag status has been toggled.",
|
|
389
389
|
stability: "stable",
|
|
390
390
|
owners: ["@platform.feature-flags"],
|
|
@@ -398,7 +398,7 @@ const FlagToggledEvent = defineEvent({
|
|
|
398
398
|
const RuleCreatedEvent = defineEvent({
|
|
399
399
|
meta: {
|
|
400
400
|
key: "flag.rule_created",
|
|
401
|
-
version: 1,
|
|
401
|
+
version: "1.0.0",
|
|
402
402
|
description: "A targeting rule has been created.",
|
|
403
403
|
stability: "stable",
|
|
404
404
|
owners: ["@platform.feature-flags"],
|
|
@@ -416,7 +416,7 @@ const RuleCreatedEvent = defineEvent({
|
|
|
416
416
|
const RuleDeletedEvent = defineEvent({
|
|
417
417
|
meta: {
|
|
418
418
|
key: "flag.rule_deleted",
|
|
419
|
-
version: 1,
|
|
419
|
+
version: "1.0.0",
|
|
420
420
|
description: "A targeting rule has been deleted.",
|
|
421
421
|
stability: "stable",
|
|
422
422
|
owners: ["@platform.feature-flags"],
|
|
@@ -434,7 +434,7 @@ const RuleDeletedEvent = defineEvent({
|
|
|
434
434
|
const ExperimentCreatedEvent = defineEvent({
|
|
435
435
|
meta: {
|
|
436
436
|
key: "experiment.created",
|
|
437
|
-
version: 1,
|
|
437
|
+
version: "1.0.0",
|
|
438
438
|
description: "An experiment has been created.",
|
|
439
439
|
stability: "stable",
|
|
440
440
|
owners: ["@platform.feature-flags"],
|
|
@@ -452,7 +452,7 @@ const ExperimentCreatedEvent = defineEvent({
|
|
|
452
452
|
const ExperimentStartedEvent = defineEvent({
|
|
453
453
|
meta: {
|
|
454
454
|
key: "experiment.started",
|
|
455
|
-
version: 1,
|
|
455
|
+
version: "1.0.0",
|
|
456
456
|
description: "An experiment has started.",
|
|
457
457
|
stability: "stable",
|
|
458
458
|
owners: ["@platform.feature-flags"],
|
|
@@ -470,7 +470,7 @@ const ExperimentStartedEvent = defineEvent({
|
|
|
470
470
|
const ExperimentStoppedEvent = defineEvent({
|
|
471
471
|
meta: {
|
|
472
472
|
key: "experiment.stopped",
|
|
473
|
-
version: 1,
|
|
473
|
+
version: "1.0.0",
|
|
474
474
|
description: "An experiment has stopped.",
|
|
475
475
|
stability: "stable",
|
|
476
476
|
owners: ["@platform.feature-flags"],
|
|
@@ -488,7 +488,7 @@ const ExperimentStoppedEvent = defineEvent({
|
|
|
488
488
|
const FlagEvaluatedEvent = defineEvent({
|
|
489
489
|
meta: {
|
|
490
490
|
key: "flag.evaluated",
|
|
491
|
-
version: 1,
|
|
491
|
+
version: "1.0.0",
|
|
492
492
|
description: "A feature flag has been evaluated.",
|
|
493
493
|
stability: "stable",
|
|
494
494
|
owners: ["@platform.feature-flags"],
|
|
@@ -502,7 +502,7 @@ const FlagEvaluatedEvent = defineEvent({
|
|
|
502
502
|
const VariantAssignedEvent = defineEvent({
|
|
503
503
|
meta: {
|
|
504
504
|
key: "experiment.variant_assigned",
|
|
505
|
-
version: 1,
|
|
505
|
+
version: "1.0.0",
|
|
506
506
|
description: "A subject has been assigned to an experiment variant.",
|
|
507
507
|
stability: "stable",
|
|
508
508
|
owners: ["@platform.feature-flags"],
|
package/dist/events.js.map
CHANGED
|
@@ -1 +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,\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,\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,\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,\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,\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,\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,\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,\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,\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,\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,\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,qBAAq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CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
|
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,YAAY;GAAM;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;G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,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"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const FeatureFlagsFeature = {
|
|
7
7
|
meta: {
|
|
8
8
|
key: "feature-flags",
|
|
9
|
-
version: 1,
|
|
9
|
+
version: "1.0.0",
|
|
10
10
|
title: "Feature Flags",
|
|
11
11
|
description: "Feature flag management with targeting rules and A/B experiments",
|
|
12
12
|
domain: "platform",
|
|
@@ -21,101 +21,101 @@ const FeatureFlagsFeature = {
|
|
|
21
21
|
operations: [
|
|
22
22
|
{
|
|
23
23
|
key: "flag.create",
|
|
24
|
-
version: 1
|
|
24
|
+
version: "1.0.0"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
key: "flag.update",
|
|
28
|
-
version: 1
|
|
28
|
+
version: "1.0.0"
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
key: "flag.delete",
|
|
32
|
-
version: 1
|
|
32
|
+
version: "1.0.0"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
key: "flag.toggle",
|
|
36
|
-
version: 1
|
|
36
|
+
version: "1.0.0"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
key: "flag.get",
|
|
40
|
-
version: 1
|
|
40
|
+
version: "1.0.0"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
key: "flag.list",
|
|
44
|
-
version: 1
|
|
44
|
+
version: "1.0.0"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
key: "flag.evaluate",
|
|
48
|
-
version: 1
|
|
48
|
+
version: "1.0.0"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
key: "flag.rule.create",
|
|
52
|
-
version: 1
|
|
52
|
+
version: "1.0.0"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
key: "flag.rule.delete",
|
|
56
|
-
version: 1
|
|
56
|
+
version: "1.0.0"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
key: "experiment.create",
|
|
60
|
-
version: 1
|
|
60
|
+
version: "1.0.0"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
key: "experiment.start",
|
|
64
|
-
version: 1
|
|
64
|
+
version: "1.0.0"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
key: "experiment.stop",
|
|
68
|
-
version: 1
|
|
68
|
+
version: "1.0.0"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
key: "experiment.get",
|
|
72
|
-
version: 1
|
|
72
|
+
version: "1.0.0"
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
75
|
events: [
|
|
76
76
|
{
|
|
77
77
|
key: "flag.created",
|
|
78
|
-
version: 1
|
|
78
|
+
version: "1.0.0"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
key: "flag.updated",
|
|
82
|
-
version: 1
|
|
82
|
+
version: "1.0.0"
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
key: "flag.deleted",
|
|
86
|
-
version: 1
|
|
86
|
+
version: "1.0.0"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
key: "flag.toggled",
|
|
90
|
-
version: 1
|
|
90
|
+
version: "1.0.0"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
key: "flag.evaluated",
|
|
94
|
-
version: 1
|
|
94
|
+
version: "1.0.0"
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
key: "flag.rule_created",
|
|
98
|
-
version: 1
|
|
98
|
+
version: "1.0.0"
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
key: "flag.rule_deleted",
|
|
102
|
-
version: 1
|
|
102
|
+
version: "1.0.0"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
key: "experiment.created",
|
|
106
|
-
version: 1
|
|
106
|
+
version: "1.0.0"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
key: "experiment.started",
|
|
110
|
-
version: 1
|
|
110
|
+
version: "1.0.0"
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
key: "experiment.stopped",
|
|
114
|
-
version: 1
|
|
114
|
+
version: "1.0.0"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
key: "experiment.variant_assigned",
|
|
118
|
-
version: 1
|
|
118
|
+
version: "1.0.0"
|
|
119
119
|
}
|
|
120
120
|
],
|
|
121
121
|
presentations: [],
|
|
@@ -124,14 +124,14 @@ const FeatureFlagsFeature = {
|
|
|
124
124
|
capabilities: {
|
|
125
125
|
provides: [{
|
|
126
126
|
key: "feature-flags",
|
|
127
|
-
version: 1
|
|
127
|
+
version: "1.0.0"
|
|
128
128
|
}, {
|
|
129
129
|
key: "experiments",
|
|
130
|
-
version: 1
|
|
130
|
+
version: "1.0.0"
|
|
131
131
|
}],
|
|
132
132
|
requires: [{
|
|
133
133
|
key: "identity",
|
|
134
|
-
version: 1
|
|
134
|
+
version: "1.0.0"
|
|
135
135
|
}]
|
|
136
136
|
}
|
|
137
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.feature.js","names":["FeatureFlagsFeature: FeatureModuleSpec"],"sources":["../src/feature-flags.feature.ts"],"sourcesContent":["/**\n * Feature Flags Feature Module Specification\n *\n * Defines the feature module for feature flag and experiment management.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Feature Flags feature module that bundles flag management,\n * targeting rules, and A/B experiment capabilities.\n */\nexport const FeatureFlagsFeature: FeatureModuleSpec = {\n meta: {\n key: 'feature-flags',\n version: 1,\n title: 'Feature Flags',\n description:\n 'Feature flag management with targeting rules and A/B experiments',\n domain: 'platform',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiments', 'targeting'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Flag CRUD operations\n { key: 'flag.create', version: 1 },\n { key: 'flag.update', version: 1 },\n { key: 'flag.delete', version: 1 },\n { key: 'flag.toggle', version: 1 },\n { key: 'flag.get', version: 1 },\n { key: 'flag.list', version: 1 },\n { key: 'flag.evaluate', version: 1 },\n\n // Targeting rule operations\n { key: 'flag.rule.create', version: 1 },\n { key: 'flag.rule.delete', version: 1 },\n\n // Experiment operations\n { key: 'experiment.create', version: 1 },\n { key: 'experiment.start', version: 1 },\n { key: 'experiment.stop', version: 1 },\n { key: 'experiment.get', version: 1 },\n ],\n\n // Events emitted by this feature\n events: [\n // Flag events\n { key: 'flag.created', version: 1 },\n { key: 'flag.updated', version: 1 },\n { key: 'flag.deleted', version: 1 },\n { key: 'flag.toggled', version: 1 },\n { key: 'flag.evaluated', version: 1 },\n\n // Rule events\n { key: 'flag.rule_created', version: 1 },\n { key: 'flag.rule_deleted', version: 1 },\n\n // Experiment events\n { key: 'experiment.created', version: 1 },\n { key: 'experiment.started', version: 1 },\n { key: 'experiment.stopped', version: 1 },\n { key: 'experiment.variant_assigned', version: 1 },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'feature-flags', version: 1 },\n { key: 'experiments', version: 1 },\n ],\n requires: [{ key: 'identity', version: 1 }],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,sBAAyC;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAe;GAAY;EACnD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,KAAK;GAAe,SAAS;
|
|
1
|
+
{"version":3,"file":"feature-flags.feature.js","names":["FeatureFlagsFeature: FeatureModuleSpec"],"sources":["../src/feature-flags.feature.ts"],"sourcesContent":["/**\n * Feature Flags Feature Module Specification\n *\n * Defines the feature module for feature flag and experiment management.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Feature Flags feature module that bundles flag management,\n * targeting rules, and A/B experiment capabilities.\n */\nexport const FeatureFlagsFeature: FeatureModuleSpec = {\n meta: {\n key: 'feature-flags',\n version: '1.0.0',\n title: 'Feature Flags',\n description:\n 'Feature flag management with targeting rules and A/B experiments',\n domain: 'platform',\n owners: ['@platform.feature-flags'],\n tags: ['feature-flags', 'experiments', 'targeting'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Flag CRUD operations\n { key: 'flag.create', version: '1.0.0' },\n { key: 'flag.update', version: '1.0.0' },\n { key: 'flag.delete', version: '1.0.0' },\n { key: 'flag.toggle', version: '1.0.0' },\n { key: 'flag.get', version: '1.0.0' },\n { key: 'flag.list', version: '1.0.0' },\n { key: 'flag.evaluate', version: '1.0.0' },\n\n // Targeting rule operations\n { key: 'flag.rule.create', version: '1.0.0' },\n { key: 'flag.rule.delete', version: '1.0.0' },\n\n // Experiment operations\n { key: 'experiment.create', version: '1.0.0' },\n { key: 'experiment.start', version: '1.0.0' },\n { key: 'experiment.stop', version: '1.0.0' },\n { key: 'experiment.get', version: '1.0.0' },\n ],\n\n // Events emitted by this feature\n events: [\n // Flag events\n { key: 'flag.created', version: '1.0.0' },\n { key: 'flag.updated', version: '1.0.0' },\n { key: 'flag.deleted', version: '1.0.0' },\n { key: 'flag.toggled', version: '1.0.0' },\n { key: 'flag.evaluated', version: '1.0.0' },\n\n // Rule events\n { key: 'flag.rule_created', version: '1.0.0' },\n { key: 'flag.rule_deleted', version: '1.0.0' },\n\n // Experiment events\n { key: 'experiment.created', version: '1.0.0' },\n { key: 'experiment.started', version: '1.0.0' },\n { key: 'experiment.stopped', version: '1.0.0' },\n { key: 'experiment.variant_assigned', version: '1.0.0' },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'feature-flags', version: '1.0.0' },\n { key: 'experiments', version: '1.0.0' },\n ],\n requires: [{ key: 'identity', version: '1.0.0' }],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,sBAAyC;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAe;GAAY;EACnD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,KAAK;GAAe,SAAS;GAAS;EACxC;GAAE,KAAK;GAAe,SAAS;GAAS;EACxC;GAAE,KAAK;GAAe,SAAS;GAAS;EACxC;GAAE,KAAK;GAAe,SAAS;GAAS;EACxC;GAAE,KAAK;GAAY,SAAS;GAAS;EACrC;GAAE,KAAK;GAAa,SAAS;GAAS;EACtC;GAAE,KAAK;GAAiB,SAAS;GAAS;EAG1C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAG7C;GAAE,KAAK;GAAqB,SAAS;GAAS;EAC9C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAmB,SAAS;GAAS;EAC5C;GAAE,KAAK;GAAkB,SAAS;GAAS;EAC5C;CAGD,QAAQ;EAEN;GAAE,KAAK;GAAgB,SAAS;GAAS;EACzC;GAAE,KAAK;GAAgB,SAAS;GAAS;EACzC;GAAE,KAAK;GAAgB,SAAS;GAAS;EACzC;GAAE,KAAK;GAAgB,SAAS;GAAS;EACzC;GAAE,KAAK;GAAkB,SAAS;GAAS;EAG3C;GAAE,KAAK;GAAqB,SAAS;GAAS;EAC9C;GAAE,KAAK;GAAqB,SAAS;GAAS;EAG9C;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAA+B,SAAS;GAAS;EACzD;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAiB,SAAS;GAAS,EAC1C;GAAE,KAAK;GAAe,SAAS;GAAS,CACzC;EACD,UAAU,CAAC;GAAE,KAAK;GAAY,SAAS;GAAS,CAAC;EAClD;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.feature-flags",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.1",
|
|
4
4
|
"description": "Feature flags and experiments module for ContractSpec applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"lint:check": "eslint src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@contractspec/lib.schema": "1.
|
|
29
|
-
"@contractspec/lib.contracts": "1.
|
|
28
|
+
"@contractspec/lib.schema": "1.45.1",
|
|
29
|
+
"@contractspec/lib.contracts": "1.45.1",
|
|
30
30
|
"zod": "^4.1.13"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@contractspec/tool.typescript": "1.
|
|
34
|
-
"@contractspec/tool.tsdown": "1.
|
|
33
|
+
"@contractspec/tool.typescript": "1.45.1",
|
|
34
|
+
"@contractspec/tool.tsdown": "1.45.1",
|
|
35
35
|
"typescript": "^5.9.3"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|