@eide/foir-cli 0.1.40 → 0.1.42

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/cli.js CHANGED
@@ -1871,6 +1871,11 @@ export interface FlexibleFieldDef extends BaseFieldDef {
1871
1871
  type: 'flexible';
1872
1872
  }
1873
1873
 
1874
+ /** Field def for inline model types (type is the model's key, e.g. 'seo', 'hero-banner') */
1875
+ export interface InlineModelFieldDef extends BaseFieldDef {
1876
+ type: string;
1877
+ }
1878
+
1874
1879
  export type FieldDef =
1875
1880
  | TextFieldDef
1876
1881
  | NumberFieldDef
@@ -1886,7 +1891,8 @@ export type FieldDef =
1886
1891
  | ReferenceFieldDef
1887
1892
  | ListFieldDef
1888
1893
  | JsonFieldDef
1889
- | FlexibleFieldDef;
1894
+ | FlexibleFieldDef
1895
+ | InlineModelFieldDef;
1890
1896
  `;
1891
1897
  }
1892
1898
 
@@ -121,6 +121,7 @@ type InstallExtensionInput = {
121
121
  operationBaseUrl?: InputMaybe<Scalars['String']['input']>;
122
122
  operations?: InputMaybe<Array<InstallExtensionOperationInput>>;
123
123
  placements?: InputMaybe<Array<InstallExtensionPlacementInput>>;
124
+ segments?: InputMaybe<Array<InstallExtensionSegmentInput>>;
124
125
  };
125
126
  type InstallExtensionModelInput = {
126
127
  category?: InputMaybe<Scalars['String']['input']>;
@@ -140,6 +141,8 @@ type InstallExtensionOperationInput = {
140
141
  endpoint: Scalars['String']['input'];
141
142
  key: Scalars['String']['input'];
142
143
  name: Scalars['String']['input'];
144
+ precondition?: InputMaybe<OperationPreconditionInput>;
145
+ quotas?: InputMaybe<Array<OperationQuotaInput>>;
143
146
  retryPolicy?: InputMaybe<RetryPolicyInput>;
144
147
  timeoutMs?: InputMaybe<Scalars['Int']['input']>;
145
148
  touchPoints?: InputMaybe<Array<Scalars['String']['input']>>;
@@ -153,6 +156,14 @@ type InstallExtensionPlacementInput = {
153
156
  type: Scalars['String']['input'];
154
157
  url: Scalars['String']['input'];
155
158
  };
159
+ type InstallExtensionSegmentInput = {
160
+ description?: InputMaybe<Scalars['String']['input']>;
161
+ evaluationMode?: InputMaybe<Scalars['String']['input']>;
162
+ isActive?: InputMaybe<Scalars['Boolean']['input']>;
163
+ key: Scalars['String']['input'];
164
+ name: Scalars['String']['input'];
165
+ rules: Scalars['JSON']['input'];
166
+ };
156
167
  /** Model configuration options */
157
168
  type ModelConfigInput = {
158
169
  customerScoped?: InputMaybe<Scalars['Boolean']['input']>;
@@ -161,6 +172,28 @@ type ModelConfigInput = {
161
172
  variants?: InputMaybe<Scalars['Boolean']['input']>;
162
173
  versioning?: InputMaybe<Scalars['Boolean']['input']>;
163
174
  };
175
+ /** Pre-execution guard input for operation create/update */
176
+ type OperationPreconditionInput = {
177
+ /** Custom error message when precondition fails */
178
+ message?: InputMaybe<Scalars['String']['input']>;
179
+ /** Rule expression (RuleExpression as JSON) — must evaluate to true */
180
+ rule?: InputMaybe<Scalars['JSON']['input']>;
181
+ /** Segment key — customer must be a member to execute */
182
+ segmentKey?: InputMaybe<Scalars['String']['input']>;
183
+ };
184
+ /** Quota rule input for operation create/update */
185
+ type OperationQuotaInput = {
186
+ /** Optional condition expression (RuleExpression as JSON) */
187
+ condition?: InputMaybe<Scalars['JSON']['input']>;
188
+ /** Duration window in seconds */
189
+ duration: Scalars['Int']['input'];
190
+ /** Max points per duration window (0 = unlimited) */
191
+ points: Scalars['Int']['input'];
192
+ /** Scope for quota tracking: customer, user, or tenant */
193
+ scope: Scalars['String']['input'];
194
+ /** Segment key to match (null = default/fallback rule) */
195
+ segmentKey?: InputMaybe<Scalars['String']['input']>;
196
+ };
164
197
  /** Retry policy for operations */
165
198
  type RetryPolicyInput = {
166
199
  backoffMs: Scalars['Int']['input'];
@@ -192,4 +225,4 @@ type ValidationRuleInput = {
192
225
  value?: InputMaybe<Scalars['JSON']['input']>;
193
226
  };
194
227
 
195
- export type { CreateHookInput as C, FieldDefinitionInput as F, HookFilterInput as H, InstallExtensionInput as I, UpdateHookInput as U, InstallExtensionModelInput as a, InstallExtensionOperationInput as b, InstallExtensionAuthProviderInput as c, InstallExtensionCustomerProfileSchemaInput as d, InstallExtensionPlacementInput as e, HookEvent as f, CreateModelInput as g, CreateRecordInput as h };
228
+ export type { CreateHookInput as C, FieldDefinitionInput as F, HookFilterInput as H, InstallExtensionInput as I, UpdateHookInput as U, InstallExtensionModelInput as a, InstallExtensionOperationInput as b, InstallExtensionSegmentInput as c, InstallExtensionAuthProviderInput as d, InstallExtensionCustomerProfileSchemaInput as e, InstallExtensionPlacementInput as f, HookEvent as g, CreateModelInput as h, CreateRecordInput as i };
@@ -1,5 +1,5 @@
1
- import { I as InstallExtensionInput, F as FieldDefinitionInput, a as InstallExtensionModelInput, b as InstallExtensionOperationInput } from '../generated-CPsQ9jfu.js';
2
- export { c as InstallExtensionAuthProviderInput, d as InstallExtensionCustomerProfileSchemaInput, e as InstallExtensionPlacementInput } from '../generated-CPsQ9jfu.js';
1
+ import { I as InstallExtensionInput, F as FieldDefinitionInput, a as InstallExtensionModelInput, b as InstallExtensionOperationInput, c as InstallExtensionSegmentInput } from '../generated-xEC9Cfzw.js';
2
+ export { d as InstallExtensionAuthProviderInput, e as InstallExtensionCustomerProfileSchemaInput, f as InstallExtensionPlacementInput } from '../generated-xEC9Cfzw.js';
3
3
 
4
4
  /**
5
5
  * Extension configuration helpers.
@@ -83,5 +83,18 @@ declare function defineField(field: FieldDefinitionInput): FieldDefinitionInput;
83
83
  * ```
84
84
  */
85
85
  declare function defineOperation(operation: InstallExtensionOperationInput): InstallExtensionOperationInput;
86
+ /**
87
+ * Define a segment with type safety.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const proSegment = defineSegment({
92
+ * key: 'pro',
93
+ * name: 'Pro',
94
+ * rules: { type: 'condition', ... },
95
+ * });
96
+ * ```
97
+ */
98
+ declare function defineSegment(segment: InstallExtensionSegmentInput): InstallExtensionSegmentInput;
86
99
 
87
- export { FieldDefinitionInput, InstallExtensionInput, InstallExtensionModelInput, InstallExtensionOperationInput, defineExtension, defineField, defineModel, defineOperation };
100
+ export { FieldDefinitionInput, InstallExtensionInput, InstallExtensionModelInput, InstallExtensionOperationInput, InstallExtensionSegmentInput, defineExtension, defineField, defineModel, defineOperation, defineSegment };
@@ -11,9 +11,13 @@ function defineField(field) {
11
11
  function defineOperation(operation) {
12
12
  return operation;
13
13
  }
14
+ function defineSegment(segment) {
15
+ return segment;
16
+ }
14
17
  export {
15
18
  defineExtension,
16
19
  defineField,
17
20
  defineModel,
18
- defineOperation
21
+ defineOperation,
22
+ defineSegment
19
23
  };
@@ -1,5 +1,5 @@
1
- import { C as CreateHookInput, H as HookFilterInput } from '../generated-CPsQ9jfu.js';
2
- export { f as HookEvent, U as UpdateHookInput } from '../generated-CPsQ9jfu.js';
1
+ import { C as CreateHookInput, H as HookFilterInput } from '../generated-xEC9Cfzw.js';
2
+ export { g as HookEvent, U as UpdateHookInput } from '../generated-xEC9Cfzw.js';
3
3
 
4
4
  /**
5
5
  * Hook configuration helpers.
@@ -1,4 +1,4 @@
1
- import { F as FieldDefinitionInput, g as CreateModelInput, h as CreateRecordInput } from '../generated-CPsQ9jfu.js';
1
+ import { F as FieldDefinitionInput, h as CreateModelInput, i as CreateRecordInput } from '../generated-xEC9Cfzw.js';
2
2
 
3
3
  /**
4
4
  * Model and record seed configuration helpers.
@@ -4405,6 +4405,7 @@ input InstallExtensionInput {
4405
4405
  placements: [InstallExtensionPlacementInput!]
4406
4406
  models: [InstallExtensionModelInput!]
4407
4407
  operations: [InstallExtensionOperationInput!]
4408
+ segments: [InstallExtensionSegmentInput!]
4408
4409
  authProviders: [InstallExtensionAuthProviderInput!]
4409
4410
  customerProfileSchema: InstallExtensionCustomerProfileSchemaInput
4410
4411
 
@@ -4457,6 +4458,17 @@ input InstallExtensionOperationInput {
4457
4458
  retryPolicy: RetryPolicyInput
4458
4459
  timeoutMs: Int
4459
4460
  touchPoints: [String!]
4461
+ precondition: OperationPreconditionInput
4462
+ quotas: [OperationQuotaInput!]
4463
+ }
4464
+
4465
+ input InstallExtensionSegmentInput {
4466
+ key: String!
4467
+ name: String!
4468
+ description: String
4469
+ rules: JSON!
4470
+ evaluationMode: String
4471
+ isActive: Boolean
4460
4472
  }
4461
4473
 
4462
4474
  input InstallExtensionAuthProviderInput {
@@ -4498,6 +4510,8 @@ type InstallExtensionResult {
4498
4510
  modelsUpdated: Int!
4499
4511
  operationsCreated: Int!
4500
4512
  operationsUpdated: Int!
4513
+ segmentsCreated: Int!
4514
+ segmentsUpdated: Int!
4501
4515
  isUpdate: Boolean!
4502
4516
  }
4503
4517
 
@@ -4580,6 +4594,9 @@ type Operation {
4580
4594
 
4581
4595
  """Quota rules for rate-limiting operation executions per scope."""
4582
4596
  quotas: [JSON!]
4597
+
4598
+ """Pre-execution guard: segment and/or rule that must match."""
4599
+ precondition: JSON
4583
4600
  systemVersion: Int
4584
4601
  createdAt: DateTime!
4585
4602
  updatedAt: DateTime!
@@ -4764,6 +4781,18 @@ input OperationQuotaInput {
4764
4781
  condition: JSON
4765
4782
  }
4766
4783
 
4784
+ """Pre-execution guard input for operation create/update"""
4785
+ input OperationPreconditionInput {
4786
+ """Segment key — customer must be a member to execute"""
4787
+ segmentKey: String
4788
+
4789
+ """Rule expression (RuleExpression as JSON) — must evaluate to true"""
4790
+ rule: JSON
4791
+
4792
+ """Custom error message when precondition fails"""
4793
+ message: String
4794
+ }
4795
+
4767
4796
  input ExecuteOperationInput {
4768
4797
  """Operation key to execute"""
4769
4798
  operationKey: String!
@@ -4825,6 +4854,7 @@ input CreateOperationInput {
4825
4854
  allowedRoles: [String!]
4826
4855
  streamConfig: OperationStreamConfigInput
4827
4856
  quotas: [OperationQuotaInput!]
4857
+ precondition: OperationPreconditionInput
4828
4858
  }
4829
4859
 
4830
4860
  input UpdateOperationInput {
@@ -4844,6 +4874,7 @@ input UpdateOperationInput {
4844
4874
  allowedRoles: [String!]
4845
4875
  streamConfig: OperationStreamConfigInput
4846
4876
  quotas: [OperationQuotaInput!]
4877
+ precondition: OperationPreconditionInput
4847
4878
  }
4848
4879
 
4849
4880
  """Platform events that can trigger hooks."""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -69,8 +69,8 @@
69
69
  "tsx": "^4.20.0",
70
70
  "typescript": "5.9.2",
71
71
  "vitest": "^3.2.4",
72
- "@eide/command-registry": "0.1.0",
73
- "@foir/platform": "1.0.0"
72
+ "@foir/platform": "1.0.0",
73
+ "@eide/command-registry": "0.1.0"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=18.0.0"