fimo 0.9.0 → 0.10.0-experimental.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.
@@ -1,9 +1,9 @@
1
1
  import { type ComponentPropsWithoutRef } from 'react';
2
2
  import { type FimoRichText, type FimoRichTextComponents } from '../lib/index.js';
3
3
  type RichTextProps = {
4
- value: FimoRichText;
4
+ value: FimoRichText | null | undefined;
5
5
  components?: FimoRichTextComponents;
6
6
  } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
7
- export declare function RichText({ value, components, ...props }: RichTextProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function RichText({ value, components, ...props }: RichTextProps): import("react/jsx-runtime").JSX.Element | null;
8
8
  export {};
9
9
  //# sourceMappingURL=RichText.d.ts.map
@@ -129,7 +129,9 @@ function renderNode(node, components, key) {
129
129
  return _jsx(Fragment, { children: children }, key);
130
130
  }
131
131
  export function RichText({ value, components, ...props }) {
132
- const source = value[FIMO_SOURCE];
133
- const { value: liveContent, ref } = useFimoLiveValue(value.content);
134
- return (_jsx("div", { ref: ref, ...props, "data-fimo-source": source, "data-fimo-richtext": "", children: renderNode(liveContent, components, 0) }));
132
+ const { value: liveContent, ref } = useFimoLiveValue(value?.content ?? null);
133
+ if (!value || !liveContent) {
134
+ return null;
135
+ }
136
+ return (_jsx("div", { ref: ref, ...props, "data-fimo-source": value[FIMO_SOURCE], "data-fimo-richtext": "", children: renderNode(liveContent, components, 0) }));
135
137
  }
@@ -40,7 +40,7 @@ export type ManyReferenceOps = {
40
40
  $contains?: string;
41
41
  $null?: boolean;
42
42
  };
43
- export type FilterFor<T> = [T] extends [FimoString | string] ? string | StringOps : [T] extends [FimoBoolean | boolean] ? boolean | BoolOps : [T] extends [FimoDate | Date] ? string | DateOps : [T] extends [number] ? number | NumberOps : [T] extends [FimoPolymorphicReference | null] ? never : [T] extends [FimoPolymorphicReference[]] ? never : [T] extends [FimoReference | null] ? string | null | ReferenceOps : [T] extends [FimoReference[]] ? string | ManyReferenceOps : [T] extends [FimoMedia | FimoMedia[]] ? NullOnlyOps : [T] extends [FimoRichText] ? string | StringOps : NullOnlyOps;
43
+ export type FilterFor<T> = [T] extends [FimoString | string] ? string | StringOps : [T] extends [FimoBoolean | boolean] ? boolean | BoolOps : [T] extends [FimoDate | Date] ? string | DateOps : [T] extends [number] ? number | NumberOps : [T] extends [FimoPolymorphicReference | null] ? never : [T] extends [FimoPolymorphicReference[]] ? never : [T] extends [FimoReference | null] ? string | null | ReferenceOps : [T] extends [FimoReference[]] ? string | ManyReferenceOps : [T] extends [FimoMedia | FimoMedia[]] ? NullOnlyOps : [NonNullable<T>] extends [FimoRichText] ? string | StringOps : NullOnlyOps;
44
44
  type BaseTopLevelWhere = {
45
45
  id?: string | StringOps;
46
46
  entryId?: string | StringOps;
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
2
  import { basename, join, resolve } from 'node:path';
3
- import { CONTENT_FIELD_NAME_PATTERN, CONTENT_FIELD_NAME_PATTERN_DESCRIPTION, CONTENT_TYPE_NAME_PATTERN, CONTENT_TYPE_NAME_PATTERN_DESCRIPTION, ContentFieldDefinitionSchema, FieldTypeSchema, MAX_STRUCTURED_CONTENT_DEPTH, RESERVED_CONTENT_FIELD_NAMES, walkContentFields, } from '@fimo/api-contracts';
3
+ import { CONTENT_FIELD_NAME_PATTERN, CONTENT_FIELD_NAME_PATTERN_DESCRIPTION, CONTENT_TYPE_NAME_PATTERN, CONTENT_TYPE_NAME_PATTERN_DESCRIPTION, ContentFieldDefinitionSchema, FieldTypeSchema, MAX_STRUCTURED_CONTENT_DEPTH, RESERVED_CONTENT_FIELD_NAMES, collectConditionProblems, walkContentFields, } from '@fimo/api-contracts';
4
4
  /**
5
5
  * Validate `src/schemas/*.json` locally against the same rules the API's
6
6
  * schema validator enforces (field types, reserved field names, required
@@ -127,6 +127,7 @@ export function validateSchemaFile(absolutePath, file, schemaUids = new Set()) {
127
127
  });
128
128
  return errors;
129
129
  }
130
+ const parsedFields = {};
130
131
  for (const [fieldName, definition] of Object.entries(fields)) {
131
132
  if (!CONTENT_FIELD_NAME_PATTERN.test(fieldName)) {
132
133
  errors.push({
@@ -181,6 +182,7 @@ export function validateSchemaFile(absolutePath, file, schemaUids = new Set()) {
181
182
  }
182
183
  continue;
183
184
  }
185
+ parsedFields[fieldName] = parsed.data;
184
186
  walkContentFields({ [fieldName]: parsed.data }, ({ field, path, structuredDepth, insideStructuredContent }) => {
185
187
  if (field.type === 'blocks' && structuredDepth >= MAX_STRUCTURED_CONTENT_DEPTH) {
186
188
  errors.push({
@@ -210,6 +212,10 @@ export function validateSchemaFile(absolutePath, file, schemaUids = new Set()) {
210
212
  });
211
213
  continue;
212
214
  }
215
+ const parsed = ContentFieldDefinitionSchema.safeParse(definition);
216
+ if (parsed.success) {
217
+ parsedFields[fieldName] = parsed.data;
218
+ }
213
219
  if (type === 'reference') {
214
220
  const { target, targets, many } = definition;
215
221
  if (targets !== undefined && target !== undefined) {
@@ -281,5 +287,8 @@ export function validateSchemaFile(absolutePath, file, schemaUids = new Set()) {
281
287
  }
282
288
  }
283
289
  }
290
+ for (const problem of collectConditionProblems(parsedFields)) {
291
+ errors.push({ rule: 'schemas/conditions', message: problem.message, file });
292
+ }
284
293
  return errors;
285
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo",
3
- "version": "0.9.0",
3
+ "version": "0.10.0-experimental.1",
4
4
  "description": "Fimo CLI - create, deploy, and manage Fimo projects",
5
5
  "bin": {
6
6
  "fimo": "dist/cli/index.js"
package/release.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "source": "npm",
3
- "apiUrl": "https://api.fimo.ai",
4
- "webUrl": "https://fimo.ai"
3
+ "apiUrl": "https://api.staging.fimo.team",
4
+ "webUrl": "https://staging.fimo.team"
5
5
  }
@@ -21,7 +21,7 @@
21
21
  "cmdk": "^1.1.1",
22
22
  "date-fns": "^4.1.0",
23
23
  "embla-carousel-react": "^8.6.0",
24
- "fimo": "0.9.0",
24
+ "fimo": "0.10.0-experimental.1",
25
25
  "input-otp": "^1.4.2",
26
26
  "isbot": "^5",
27
27
  "lucide-react": "^0.577.0",