@synap-core/types 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +1,49 @@
1
-
2
- 
3
- > @synap-core/types@1.5.0 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
4
- > tsup
5
-
6
- CLI Building entry: src/index.ts, src/documents/index.ts, src/entities/index.ts, src/events/index.ts, src/inbox/index.ts, src/preferences/index.ts, src/proposals/index.ts, src/realtime/index.ts, src/relations/index.ts, src/users/index.ts, src/views/index.ts, src/workspaces/index.ts
7
- CLI Using tsconfig: tsconfig.json
8
- CLI tsup v8.5.1
9
- CLI Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
10
- CLI Target: es2022
11
- CLI Cleaning output folder
12
- ESM Build start
13
- ESM dist/chunk-QAWJ6GM3.js 0 B
14
- ESM dist/chunk-IZA3UKBT.js 0 B
15
- ESM dist/chunk-2N5ZC5EB.js 0 B
16
- ESM dist/chunk-SAGFDFV4.js 0 B
17
- ESM dist/chunk-GX24H4PF.js 0 B
18
- ESM dist/chunk-BBMRDSWW.js 0 B
19
- ESM dist/chunk-X5L3VJJZ.js 0 B
20
- ESM dist/users/index.js 31.00 B
21
- ESM dist/relations/index.js 31.00 B
22
- ESM dist/index.js 22.84 KB
23
- ESM dist/workspaces/index.js 31.00 B
24
- ESM dist/views/index.js 642.00 B
25
- ESM dist/chunk-E4TRCFI3.js 3.94 KB
26
- ESM dist/entities/index.js 82.00 B
27
- ESM dist/documents/index.js 329.00 B
28
- ESM dist/chunk-57QVUVYZ.js 909.00 B
29
- ESM dist/events/index.js 405.00 B
30
- ESM dist/preferences/index.js 413.00 B
31
- ESM dist/inbox/index.js 31.00 B
32
- ESM dist/chunk-46DY5LY3.js 2.29 KB
33
- ESM dist/proposals/index.js 177.00 B
34
- ESM dist/chunk-K7W2L3GE.js 75.95 KB
35
- ESM dist/realtime/index.js 31.00 B
36
- ESM ⚡️ Build success in 141ms
37
- DTS Build start
38
- DTS ⚡️ Build success in 41815ms
39
- DTS dist/inbox/index.d.ts 13.00 B
40
- DTS dist/events/index.d.ts 4.12 KB
41
- DTS dist/realtime/index.d.ts 1.54 KB
42
- DTS dist/proposals/index.d.ts 22.09 KB
43
- DTS dist/relations/index.d.ts 6.55 KB
44
- DTS dist/workspaces/index.d.ts 16.68 KB
45
- DTS dist/preferences/index.d.ts 28.77 KB
46
- DTS dist/views/index.d.ts 18.46 KB
47
- DTS dist/index.d.ts 111.79 KB
48
- DTS dist/documents/index.d.ts 41.35 KB
49
- DTS dist/entities/index.d.ts 1.79 KB
50
- DTS dist/users/index.d.ts 23.96 KB
1
+
2
+ > @synap-core/types@1.5.0 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
3
+ > tsup
4
+
5
+ CLI Building entry: src/index.ts, src/documents/index.ts, src/events/index.ts, src/entities/index.ts, src/inbox/index.ts, src/preferences/index.ts, src/proposals/index.ts, src/realtime/index.ts, src/relations/index.ts, src/users/index.ts, src/views/index.ts, src/workspaces/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ ESM dist/chunk-QAWJ6GM3.js 0 B
13
+ ESM dist/chunk-2N5ZC5EB.js 0 B
14
+ ESM dist/chunk-IZA3UKBT.js 0 B
15
+ ESM dist/chunk-SAGFDFV4.js 0 B
16
+ ESM dist/chunk-BBMRDSWW.js 0 B
17
+ ESM dist/chunk-X5L3VJJZ.js 0 B
18
+ ESM dist/workspaces/index.js 31.00 B
19
+ ESM dist/chunk-GX24H4PF.js 0 B
20
+ ESM dist/relations/index.js 31.00 B
21
+ ESM dist/chunk-UB7K27KX.js 4.32 KB
22
+ ESM dist/index.js 22.84 KB
23
+ ESM dist/users/index.js 31.00 B
24
+ ESM dist/entities/index.js 82.00 B
25
+ ESM dist/chunk-57QVUVYZ.js 909.00 B
26
+ ESM dist/inbox/index.js 31.00 B
27
+ ESM dist/preferences/index.js 413.00 B
28
+ ESM dist/events/index.js 405.00 B
29
+ ESM dist/documents/index.js 329.00 B
30
+ ESM dist/chunk-VQJVKYGD.js 76.75 KB
31
+ ESM dist/proposals/index.js 177.00 B
32
+ ESM dist/views/index.js 642.00 B
33
+ ESM dist/chunk-46DY5LY3.js 2.29 KB
34
+ ESM dist/realtime/index.js 31.00 B
35
+ ESM ⚡️ Build success in 23ms
36
+ DTS Build start
37
+ DTS ⚡️ Build success in 20925ms
38
+ DTS dist/inbox/index.d.ts 13.00 B
39
+ DTS dist/events/index.d.ts 4.12 KB
40
+ DTS dist/realtime/index.d.ts 1.54 KB
41
+ DTS dist/proposals/index.d.ts 22.09 KB
42
+ DTS dist/relations/index.d.ts 6.55 KB
43
+ DTS dist/workspaces/index.d.ts 16.68 KB
44
+ DTS dist/preferences/index.d.ts 28.77 KB
45
+ DTS dist/views/index.d.ts 19.90 KB
46
+ DTS dist/index.d.ts 111.79 KB
47
+ DTS dist/documents/index.d.ts 38.31 KB
48
+ DTS dist/entities/index.d.ts 1.79 KB
49
+ DTS dist/users/index.d.ts 23.96 KB
@@ -50,7 +50,13 @@ var SortRuleSchema = z.object({
50
50
  direction: z.enum(["asc", "desc"])
51
51
  });
52
52
  var EntityQuerySchema = z.object({
53
+ /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
54
+ profileIds: z.array(z.string().uuid()).optional(),
55
+ /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
56
+ profileSlugs: z.array(z.string()).optional(),
57
+ /** @deprecated - Use profileSlugs instead, which is also deprecated */
53
58
  entityTypes: z.array(z.string()).optional(),
59
+ /** Specific entity IDs (for fixed sets) */
54
60
  entityIds: z.array(z.string().uuid()).optional(),
55
61
  filters: z.array(EntityFilterSchema).optional(),
56
62
  sorts: z.array(SortRuleSchema).optional(),
@@ -67,18 +67,15 @@ var documentVersions = pgTable(
67
67
  documentId: uuid("document_id").notNull().references(() => documents.id, { onDelete: "cascade" }),
68
68
  // Version info
69
69
  version: integer("version").notNull(),
70
- type: text("type").notNull().default("manual"),
71
- // 'manual' | 'checkpoint' | 'restore'
72
70
  content: text("content").notNull(),
73
- // Full content at this version
74
- // Change tracking
75
- delta: jsonb("delta"),
76
- // Operational Transform operations
71
+ // Full content at this version (snapshot)
72
+ // Author tracking
77
73
  author: text("author").notNull(),
78
- // 'user' | 'ai'
74
+ // 'user' | 'system'
79
75
  authorId: text("author_id").notNull(),
76
+ // User ID who created this version
80
77
  message: text("message"),
81
- // Commit message
78
+ // Optional commit message (for UI display in version history)
82
79
  // Timestamps
83
80
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
84
81
  },
@@ -351,11 +348,7 @@ var profiles = pgTable5(
351
348
  uiHints: jsonb5("ui_hints").default("{}").notNull(),
352
349
  // Scope (who can use this profile)
353
350
  scope: text5("scope", {
354
- enum: [
355
- "system" /* SYSTEM */,
356
- "workspace" /* WORKSPACE */,
357
- "user" /* USER */
358
- ]
351
+ enum: ["system" /* SYSTEM */, "workspace" /* WORKSPACE */, "user" /* USER */]
359
352
  }).notNull().default("workspace" /* WORKSPACE */),
360
353
  // Ownership (based on scope)
361
354
  userId: text5("user_id"),
@@ -1547,15 +1540,26 @@ var views = pgTable30("views", {
1547
1540
  // Metadata
1548
1541
  name: text30("name").notNull(),
1549
1542
  description: text30("description"),
1550
- // Configuration (structured columns for better querying and indexing)
1543
+ // NEW: Declared schema scope (stable anchor for deterministic defaults)
1544
+ scopeProfileIds: uuid26("scope_profile_ids").array().references(() => profiles.id, { onDelete: "cascade" }),
1545
+ // FK array to profiles
1546
+ scopeMode: text30("scope_mode"),
1547
+ // 'explicit' | 'observed' (optional)
1548
+ // NEW: Consolidated query (dynamic - filters/sorts/search)
1549
+ query: jsonb19("query").default("{}"),
1550
+ // EntityQuery: { filters, sorts, search, limit, offset, groupBy }
1551
+ // NEW: Render overrides (deltas from defaults only)
1552
+ config: jsonb19("config").default("{}"),
1553
+ // { hiddenColumns, visibleColumns, columnOrder, columnWidths, ... }
1554
+ // Legacy columns (kept for backward compatibility during migration)
1551
1555
  filter: jsonb19("filter").default("{}"),
1552
- // Dynamic filters
1556
+ // @deprecated - use query.filters
1553
1557
  sort: jsonb19("sort").default("{}"),
1554
- // Sort configuration
1558
+ // @deprecated - use query.sorts
1555
1559
  columns: jsonb19("columns").default("[]"),
1556
- // Column definitions
1560
+ // @deprecated - columns computed from profiles
1557
1561
  layoutConfig: jsonb19("layout_config").default("{}"),
1558
- // Layout-specific configuration
1562
+ // @deprecated - use config
1559
1563
  // Content reference (stores actual view data as JSON)
1560
1564
  documentId: uuid26("document_id").references(() => documents.id, {
1561
1565
  onDelete: "set null"
@@ -1565,6 +1569,13 @@ var views = pgTable30("views", {
1565
1569
  // For real-time collaboration
1566
1570
  thumbnailUrl: text30("thumbnail_url"),
1567
1571
  // Preview image
1572
+ // Optional: Schema snapshot cache (performance optimization)
1573
+ schemaSnapshot: jsonb19("schema_snapshot"),
1574
+ // Cached property info from scopeProfileIds
1575
+ snapshotUpdatedAt: timestamp30("snapshot_updated_at", {
1576
+ mode: "date",
1577
+ withTimezone: true
1578
+ }),
1568
1579
  // Quick-access metadata (for listings, thumbnails, search)
1569
1580
  metadata: jsonb19("metadata").default("{}").notNull(),
1570
1581
  // {
@@ -1572,7 +1583,7 @@ var views = pgTable30("views", {
1572
1583
  // entityCount: 10,
1573
1584
  // lastEditedBy: 'user-123',
1574
1585
  // bounds: { width: 1920, height: 1080 },
1575
- // viewConfig: { /* type-specific config */ }
1586
+ // // Legacy: viewConfig moved to query + config
1576
1587
  // }
1577
1588
  // Timestamps
1578
1589
  createdAt: timestamp30("created_at", { mode: "date", withTimezone: true }).defaultNow().notNull(),
@@ -2024,36 +2035,28 @@ var entityPropertyIndex = pgTable39(
2024
2035
  (table) => ({
2025
2036
  pk: primaryKey4({ columns: [table.entityId, table.propertyDefId] }),
2026
2037
  // Indexes for fast queries (one per value type)
2027
- propertyValueTextIdx: index22("entity_property_index_property_value_text_idx").on(
2028
- table.propertyDefId,
2029
- table.valueText
2030
- ),
2031
- propertyValueNumIdx: index22("entity_property_index_property_value_num_idx").on(
2032
- table.propertyDefId,
2033
- table.valueNum
2034
- ),
2035
- propertyValueBoolIdx: index22("entity_property_index_property_value_bool_idx").on(
2036
- table.propertyDefId,
2037
- table.valueBool
2038
- ),
2038
+ propertyValueTextIdx: index22(
2039
+ "entity_property_index_property_value_text_idx"
2040
+ ).on(table.propertyDefId, table.valueText),
2041
+ propertyValueNumIdx: index22(
2042
+ "entity_property_index_property_value_num_idx"
2043
+ ).on(table.propertyDefId, table.valueNum),
2044
+ propertyValueBoolIdx: index22(
2045
+ "entity_property_index_property_value_bool_idx"
2046
+ ).on(table.propertyDefId, table.valueBool),
2039
2047
  propertyValueTsIdx: index22("entity_property_index_property_value_ts_idx").on(
2040
2048
  table.propertyDefId,
2041
2049
  table.valueTs
2042
2050
  ),
2043
- propertyValueEntityIdx: index22("entity_property_index_property_value_entity_idx").on(
2044
- table.propertyDefId,
2045
- table.valueEntityId
2046
- ),
2051
+ propertyValueEntityIdx: index22(
2052
+ "entity_property_index_property_value_entity_idx"
2053
+ ).on(table.propertyDefId, table.valueEntityId),
2047
2054
  // Entity lookup (get all properties for an entity)
2048
2055
  entityIdx: index22("entity_property_index_entity_id_idx").on(table.entityId)
2049
2056
  })
2050
2057
  );
2051
- var insertEntityPropertyIndexSchema = createInsertSchema26(
2052
- entityPropertyIndex
2053
- );
2054
- var selectEntityPropertyIndexSchema = createSelectSchema26(
2055
- entityPropertyIndex
2056
- );
2058
+ var insertEntityPropertyIndexSchema = createInsertSchema26(entityPropertyIndex);
2059
+ var selectEntityPropertyIndexSchema = createSelectSchema26(entityPropertyIndex);
2057
2060
 
2058
2061
  export {
2059
2062
  insertDocumentVersionSchema,
@@ -425,23 +425,6 @@ declare const documentVersions: drizzle_orm_pg_core.PgTableWithColumns<{
425
425
  identity: undefined;
426
426
  generated: undefined;
427
427
  }, {}, {}>;
428
- type: drizzle_orm_pg_core.PgColumn<{
429
- name: "type";
430
- tableName: "document_versions";
431
- dataType: "string";
432
- columnType: "PgText";
433
- data: string;
434
- driverParam: string;
435
- notNull: true;
436
- hasDefault: true;
437
- isPrimaryKey: false;
438
- isAutoincrement: false;
439
- hasRuntimeDefault: false;
440
- enumValues: [string, ...string[]];
441
- baseColumn: never;
442
- identity: undefined;
443
- generated: undefined;
444
- }, {}, {}>;
445
428
  content: drizzle_orm_pg_core.PgColumn<{
446
429
  name: "content";
447
430
  tableName: "document_versions";
@@ -459,23 +442,6 @@ declare const documentVersions: drizzle_orm_pg_core.PgTableWithColumns<{
459
442
  identity: undefined;
460
443
  generated: undefined;
461
444
  }, {}, {}>;
462
- delta: drizzle_orm_pg_core.PgColumn<{
463
- name: "delta";
464
- tableName: "document_versions";
465
- dataType: "json";
466
- columnType: "PgJsonb";
467
- data: unknown;
468
- driverParam: unknown;
469
- notNull: false;
470
- hasDefault: false;
471
- isPrimaryKey: false;
472
- isAutoincrement: false;
473
- hasRuntimeDefault: false;
474
- enumValues: undefined;
475
- baseColumn: never;
476
- identity: undefined;
477
- generated: undefined;
478
- }, {}, {}>;
479
445
  author: drizzle_orm_pg_core.PgColumn<{
480
446
  name: "author";
481
447
  tableName: "document_versions";
@@ -751,23 +717,6 @@ declare const insertDocumentVersionSchema: drizzle_zod.BuildSchema<"insert", {
751
717
  identity: undefined;
752
718
  generated: undefined;
753
719
  }, {}, {}>;
754
- type: drizzle_orm_pg_core.PgColumn<{
755
- name: "type";
756
- tableName: "document_versions";
757
- dataType: "string";
758
- columnType: "PgText";
759
- data: string;
760
- driverParam: string;
761
- notNull: true;
762
- hasDefault: true;
763
- isPrimaryKey: false;
764
- isAutoincrement: false;
765
- hasRuntimeDefault: false;
766
- enumValues: [string, ...string[]];
767
- baseColumn: never;
768
- identity: undefined;
769
- generated: undefined;
770
- }, {}, {}>;
771
720
  content: drizzle_orm_pg_core.PgColumn<{
772
721
  name: "content";
773
722
  tableName: "document_versions";
@@ -785,23 +734,6 @@ declare const insertDocumentVersionSchema: drizzle_zod.BuildSchema<"insert", {
785
734
  identity: undefined;
786
735
  generated: undefined;
787
736
  }, {}, {}>;
788
- delta: drizzle_orm_pg_core.PgColumn<{
789
- name: "delta";
790
- tableName: "document_versions";
791
- dataType: "json";
792
- columnType: "PgJsonb";
793
- data: unknown;
794
- driverParam: unknown;
795
- notNull: false;
796
- hasDefault: false;
797
- isPrimaryKey: false;
798
- isAutoincrement: false;
799
- hasRuntimeDefault: false;
800
- enumValues: undefined;
801
- baseColumn: never;
802
- identity: undefined;
803
- generated: undefined;
804
- }, {}, {}>;
805
737
  author: drizzle_orm_pg_core.PgColumn<{
806
738
  name: "author";
807
739
  tableName: "document_versions";
@@ -926,23 +858,6 @@ declare const selectDocumentVersionSchema: drizzle_zod.BuildSchema<"select", {
926
858
  identity: undefined;
927
859
  generated: undefined;
928
860
  }, {}, {}>;
929
- type: drizzle_orm_pg_core.PgColumn<{
930
- name: "type";
931
- tableName: "document_versions";
932
- dataType: "string";
933
- columnType: "PgText";
934
- data: string;
935
- driverParam: string;
936
- notNull: true;
937
- hasDefault: true;
938
- isPrimaryKey: false;
939
- isAutoincrement: false;
940
- hasRuntimeDefault: false;
941
- enumValues: [string, ...string[]];
942
- baseColumn: never;
943
- identity: undefined;
944
- generated: undefined;
945
- }, {}, {}>;
946
861
  content: drizzle_orm_pg_core.PgColumn<{
947
862
  name: "content";
948
863
  tableName: "document_versions";
@@ -960,23 +875,6 @@ declare const selectDocumentVersionSchema: drizzle_zod.BuildSchema<"select", {
960
875
  identity: undefined;
961
876
  generated: undefined;
962
877
  }, {}, {}>;
963
- delta: drizzle_orm_pg_core.PgColumn<{
964
- name: "delta";
965
- tableName: "document_versions";
966
- dataType: "json";
967
- columnType: "PgJsonb";
968
- data: unknown;
969
- driverParam: unknown;
970
- notNull: false;
971
- hasDefault: false;
972
- isPrimaryKey: false;
973
- isAutoincrement: false;
974
- hasRuntimeDefault: false;
975
- enumValues: undefined;
976
- baseColumn: never;
977
- identity: undefined;
978
- generated: undefined;
979
- }, {}, {}>;
980
878
  author: drizzle_orm_pg_core.PgColumn<{
981
879
  name: "author";
982
880
  tableName: "document_versions";
@@ -4,7 +4,7 @@ import {
4
4
  insertDocumentVersionSchema,
5
5
  selectDocumentSessionSchema,
6
6
  selectDocumentVersionSchema
7
- } from "../chunk-K7W2L3GE.js";
7
+ } from "../chunk-VQJVKYGD.js";
8
8
  export {
9
9
  insertDocumentSessionSchema,
10
10
  insertDocumentVersionSchema,
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  parseViewContent,
14
14
  safeParseViewContent,
15
15
  validateContentCategoryForViewType
16
- } from "./chunk-E4TRCFI3.js";
16
+ } from "./chunk-UB7K27KX.js";
17
17
  import "./chunk-IZA3UKBT.js";
18
18
  import "./chunk-SAGFDFV4.js";
19
19
  import {
@@ -36,7 +36,7 @@ import {
36
36
  selectDocumentVersionSchema,
37
37
  selectProposalSchema,
38
38
  selectUserPreferenceSchema
39
- } from "./chunk-K7W2L3GE.js";
39
+ } from "./chunk-VQJVKYGD.js";
40
40
  import "./chunk-X5L3VJJZ.js";
41
41
 
42
42
  // src/templates/schemas.ts
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  insertUserPreferenceSchema,
9
9
  selectUserPreferenceSchema
10
- } from "../chunk-K7W2L3GE.js";
10
+ } from "../chunk-VQJVKYGD.js";
11
11
  export {
12
12
  CustomThemeSchema,
13
13
  GraphPreferencesSchema,
@@ -2,7 +2,7 @@ import "../chunk-BBMRDSWW.js";
2
2
  import {
3
3
  insertProposalSchema,
4
4
  selectProposalSchema
5
- } from "../chunk-K7W2L3GE.js";
5
+ } from "../chunk-VQJVKYGD.js";
6
6
  export {
7
7
  insertProposalSchema,
8
8
  selectProposalSchema
@@ -14,10 +14,16 @@ interface View {
14
14
  category: string;
15
15
  name: string;
16
16
  description: string | null;
17
+ scopeProfileIds: string[] | null;
18
+ scopeMode: "explicit" | "observed" | null;
19
+ query: Record<string, unknown>;
20
+ config: Record<string, unknown>;
21
+ schemaSnapshot: Record<string, unknown> | null;
22
+ snapshotUpdatedAt: Date | null;
17
23
  documentId: string | null;
18
24
  yjsRoomId: string | null;
19
25
  thumbnailUrl: string | null;
20
- metadata: Record<string, any>;
26
+ metadata: Record<string, unknown>;
21
27
  createdAt: Date;
22
28
  updatedAt: Date;
23
29
  }
@@ -54,11 +60,16 @@ interface SortRule {
54
60
  /**
55
61
  * Query definition for structured views
56
62
  * Defines which entities to show and how to filter them
63
+ *
64
+ * NOTE: profileIds/profileSlugs are now stored in views.scopeProfileIds
65
+ * This query structure only contains filters, sorts, search, pagination, and groupBy
57
66
  */
58
67
  interface EntityQuery {
59
- /** Profile slugs to include (preferred - dynamic profiles) */
68
+ /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
69
+ profileIds?: string[];
70
+ /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
60
71
  profileSlugs?: string[];
61
- /** Entity types to include (deprecated - use profileSlugs instead) */
72
+ /** @deprecated - Use profileSlugs instead, which is also deprecated */
62
73
  entityTypes?: string[];
63
74
  /** Specific entity IDs (for fixed sets) */
64
75
  entityIds?: string[];
@@ -197,8 +208,12 @@ declare function getContentCategoryForViewType(type: ViewType): ViewCategory;
197
208
 
198
209
  /**
199
210
  * Entity query schema
211
+ * NOTE: profileIds/profileSlugs/entityTypes are now stored in views.scopeProfileIds
212
+ * This schema only validates filters, sorts, search, pagination, and groupBy
200
213
  */
201
214
  declare const EntityQuerySchema: z.ZodObject<{
215
+ profileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
216
+ profileSlugs: z.ZodOptional<z.ZodArray<z.ZodString>>;
202
217
  entityTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
218
  entityIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
219
  filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -275,6 +290,8 @@ declare const RenderSettingsSchema: z.ZodObject<{
275
290
  declare const StructuredViewConfigSchema: z.ZodObject<{
276
291
  category: z.ZodLiteral<"structured">;
277
292
  query: z.ZodObject<{
293
+ profileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
294
+ profileSlugs: z.ZodOptional<z.ZodArray<z.ZodString>>;
278
295
  entityTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
279
296
  entityIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
280
297
  filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -345,6 +362,8 @@ declare const ViewContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
345
362
  version: z.ZodLiteral<1>;
346
363
  category: z.ZodLiteral<"structured">;
347
364
  query: z.ZodObject<{
365
+ profileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
+ profileSlugs: z.ZodOptional<z.ZodArray<z.ZodString>>;
348
367
  entityTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
349
368
  entityIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
350
369
  filters: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -433,6 +452,8 @@ declare function safeParseViewContent(raw: unknown): z.ZodSafeParseResult<{
433
452
  version: 1;
434
453
  category: "structured";
435
454
  query: {
455
+ profileIds?: string[] | undefined;
456
+ profileSlugs?: string[] | undefined;
436
457
  entityTypes?: string[] | undefined;
437
458
  entityIds?: string[] | undefined;
438
459
  filters?: {
@@ -585,12 +606,21 @@ interface CreateViewInput {
585
606
  type: ViewType;
586
607
  name: string;
587
608
  description?: string;
588
- config?: ViewConfig;
609
+ scopeProfileIds?: string[];
610
+ scopeMode?: "explicit" | "observed";
611
+ query?: EntityQuery;
612
+ config?: Record<string, unknown>;
613
+ initialContent?: unknown;
589
614
  }
590
615
  interface UpdateViewInput {
591
616
  name?: string;
592
617
  description?: string;
593
- config?: Partial<ViewConfig>;
618
+ scopeProfileIds?: string[];
619
+ scopeMode?: "explicit" | "observed";
620
+ query?: EntityQuery;
621
+ config?: Record<string, unknown>;
622
+ schemaSnapshot?: Record<string, unknown>;
623
+ snapshotUpdatedAt?: Date;
594
624
  }
595
625
 
596
626
  export { type CanvasViewConfig, type CanvasViewContent, type ColumnConfig, type ColumnDisplayConfig, type CreateViewInput, type EntityFilter, type EntityQuery, EntityQuerySchema, type FilterOperator, type FormattingRule, type KanbanColumn, type NewView, type RenderSettings, RenderSettingsSchema, type SortRule, type StructuredLayout, type StructuredViewConfig, StructuredViewConfigSchema, type StructuredViewContent, type UpdateViewInput, VIEW_TYPE_CATEGORIES, type View, type ViewCategory, type ViewConfig, type ViewContent, ViewContentSchema, type ViewMetadata, type ViewRenderConfig, type ViewType, getContentCategoryForViewType, getViewCategory, isCanvasContent, isStructuredContent, parseViewContent, safeParseViewContent, validateContentCategoryForViewType };
@@ -11,7 +11,7 @@ import {
11
11
  parseViewContent,
12
12
  safeParseViewContent,
13
13
  validateContentCategoryForViewType
14
- } from "../chunk-E4TRCFI3.js";
14
+ } from "../chunk-UB7K27KX.js";
15
15
  export {
16
16
  EntityQuerySchema,
17
17
  RenderSettingsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/types",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Shared TypeScript types and Zod schemas for the Synap platform",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -2,10 +2,10 @@
2
2
  * Entity Metadata Schemas
3
3
  *
4
4
  * REMOVED: These schemas have been removed in favor of the profile system.
5
- *
5
+ *
6
6
  * The old hardcoded entity type schemas (ENTITY_SCHEMAS) are no longer used.
7
7
  * Use profiles and properties instead for dynamic entity types.
8
- *
8
+ *
9
9
  * This file is kept empty for now to avoid breaking imports.
10
10
  * All entity type definitions are now handled by the profile system.
11
11
  */
@@ -61,7 +61,16 @@ export type NewEntity = Omit<
61
61
  * Entity update type (for updates)
62
62
  */
63
63
  export type UpdateEntity = Partial<
64
- Omit<Entity, "id" | "userId" | "type" | "profileId" | "createdAt" | "updatedAt" | "deletedAt">
64
+ Omit<
65
+ Entity,
66
+ | "id"
67
+ | "userId"
68
+ | "type"
69
+ | "profileId"
70
+ | "createdAt"
71
+ | "updatedAt"
72
+ | "deletedAt"
73
+ >
65
74
  > & {
66
75
  properties?: Record<string, unknown>; // Optional, validated against profile
67
76
  };
@@ -69,7 +78,7 @@ export type UpdateEntity = Partial<
69
78
  /**
70
79
  * @deprecated EntityType enum - Use profile slugs (strings) instead
71
80
  * Kept for backward compatibility during migration
72
- *
81
+ *
73
82
  * Note: EntityType is exported from schemas.ts, not here, to avoid conflicts
74
83
  */
75
84
  // EntityType is exported from schemas.ts
@@ -41,18 +41,31 @@ export type ViewType =
41
41
  // API Input Types
42
42
  // =============================================================================
43
43
 
44
- import type { ViewConfig } from "./config.js";
44
+ import type { EntityQuery } from "./query.js";
45
45
 
46
46
  export interface CreateViewInput {
47
47
  workspaceId?: string;
48
48
  type: ViewType;
49
49
  name: string;
50
50
  description?: string;
51
- config?: ViewConfig; // NEW: Replaces initialContent/tableConfig
51
+ // NEW: Scope profiles (required for structured views)
52
+ scopeProfileIds?: string[];
53
+ scopeMode?: "explicit" | "observed";
54
+ // NEW: Consolidated query
55
+ query?: EntityQuery;
56
+ // NEW: Render config (overrides only)
57
+ config?: Record<string, unknown>;
58
+ // Canvas views: initialContent (for whiteboard, mindmap)
59
+ initialContent?: unknown;
52
60
  }
53
61
 
54
62
  export interface UpdateViewInput {
55
63
  name?: string;
56
64
  description?: string;
57
- config?: Partial<ViewConfig>;
65
+ scopeProfileIds?: string[];
66
+ scopeMode?: "explicit" | "observed";
67
+ query?: EntityQuery;
68
+ config?: Record<string, unknown>;
69
+ schemaSnapshot?: Record<string, unknown>;
70
+ snapshotUpdatedAt?: Date;
58
71
  }
@@ -49,12 +49,18 @@ export interface SortRule {
49
49
  /**
50
50
  * Query definition for structured views
51
51
  * Defines which entities to show and how to filter them
52
+ *
53
+ * NOTE: profileIds/profileSlugs are now stored in views.scopeProfileIds
54
+ * This query structure only contains filters, sorts, search, pagination, and groupBy
52
55
  */
53
56
  export interface EntityQuery {
54
- /** Profile slugs to include (preferred - dynamic profiles) */
57
+ /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
58
+ profileIds?: string[];
59
+
60
+ /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
55
61
  profileSlugs?: string[];
56
-
57
- /** Entity types to include (deprecated - use profileSlugs instead) */
62
+
63
+ /** @deprecated - Use profileSlugs instead, which is also deprecated */
58
64
  entityTypes?: string[];
59
65
 
60
66
  /** Specific entity IDs (for fixed sets) */
@@ -14,6 +14,20 @@ export interface View {
14
14
  name: string;
15
15
  description: string | null;
16
16
 
17
+ // NEW: Scope profiles (declared schema scope for structured views)
18
+ scopeProfileIds: string[] | null;
19
+ scopeMode: "explicit" | "observed" | null;
20
+
21
+ // NEW: Consolidated query structure
22
+ query: Record<string, unknown>; // EntityQuery: { filters, sorts, search, limit, offset, groupBy }
23
+
24
+ // NEW: Render config (overrides only)
25
+ config: Record<string, unknown>; // { hiddenColumns, visibleColumns, columnOrder, columnWidths, ... }
26
+
27
+ // Optional: Schema snapshot cache (performance optimization)
28
+ schemaSnapshot: Record<string, unknown> | null;
29
+ snapshotUpdatedAt: Date | null;
30
+
17
31
  // Content references
18
32
  documentId: string | null;
19
33
 
@@ -21,8 +35,8 @@ export interface View {
21
35
  yjsRoomId: string | null;
22
36
  thumbnailUrl: string | null;
23
37
 
24
- // Config
25
- metadata: Record<string, any>;
38
+ // Metadata (for entity orders, etc.)
39
+ metadata: Record<string, unknown>;
26
40
 
27
41
  // Timestamps
28
42
  createdAt: Date;
@@ -42,9 +42,17 @@ const SortRuleSchema = z.object({
42
42
 
43
43
  /**
44
44
  * Entity query schema
45
+ * NOTE: profileIds/profileSlugs/entityTypes are now stored in views.scopeProfileIds
46
+ * This schema only validates filters, sorts, search, pagination, and groupBy
45
47
  */
46
48
  export const EntityQuerySchema = z.object({
49
+ /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
50
+ profileIds: z.array(z.string().uuid()).optional(),
51
+ /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
52
+ profileSlugs: z.array(z.string()).optional(),
53
+ /** @deprecated - Use profileSlugs instead, which is also deprecated */
47
54
  entityTypes: z.array(z.string()).optional(),
55
+ /** Specific entity IDs (for fixed sets) */
48
56
  entityIds: z.array(z.string().uuid()).optional(),
49
57
  filters: z.array(EntityFilterSchema).optional(),
50
58
  sorts: z.array(SortRuleSchema).optional(),