@clivly/core 0.9.1 → 0.9.2

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,4 +1,4 @@
1
- import { t as CANONICAL_FIELDS } from "./entity-config-8Fgr6IOH.mjs";
1
+ import { t as CANONICAL_FIELDS } from "./entity-config-DFJ8L9jm.mjs";
2
2
  //#region src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -121,5 +121,28 @@ function mappingsToEntitiesConfig(rows) {
121
121
  for (const { row, key } of assigned) entities[key] = buildEntity(row, refIndex);
122
122
  return { entities };
123
123
  }
124
+ const CUSTOM_CONCEPT = "custom";
125
+ function entitiesToMappings(config) {
126
+ const rows = [];
127
+ for (const [entityKey, entity] of Object.entries(config.entities)) {
128
+ const row = {
129
+ entityKey,
130
+ sourceTable: entity.projection?.baseTable ?? entity.source,
131
+ targetConcept: entity.concept,
132
+ role: entity.role ?? DEFAULT_ROLE,
133
+ fieldMap: entity.projection ? {} : entity.fields
134
+ };
135
+ if (entity.filter) row.filter = entity.filter;
136
+ if (entity.relationships) row.relationships = entity.relationships;
137
+ if (entity.projection) row.projection = entity.projection;
138
+ if (entity.concept === CUSTOM_CONCEPT) {
139
+ row.objectTypeSlug = entityKey;
140
+ if (entity.objectType) row.objectType = entity.objectType;
141
+ }
142
+ if (entity.targetObjectTypeId) row.targetObjectTypeId = entity.targetObjectTypeId;
143
+ rows.push(row);
144
+ }
145
+ return rows;
146
+ }
124
147
  //#endregion
125
- export { mappingsToEntitiesConfig };
148
+ export { entitiesToMappings, mappingsToEntitiesConfig };
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-CLxI8dVb.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.cjs";
2
2
  import { CompileOptions, CompiledView } from "./view-compiler.cjs";
3
3
  //#region src/sync-engine.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-CLxI8dVb.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.mjs";
2
2
  import { CompileOptions, CompiledView } from "./view-compiler.mjs";
3
3
  //#region src/sync-engine.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-CLxI8dVb.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.cjs";
2
2
  //#region src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-CLxI8dVb.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.mjs";
2
2
  //#region src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/core",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "ORM/auth-agnostic CRM adapter contracts and shared domain types for Clivly.",