clivly 0.23.1 → 0.24.0-next.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.
Files changed (103) hide show
  1. package/README.md +28 -0
  2. package/{adapter-B4v4dwgD.d.mts → adapter--YV7du3i.d.cts} +1 -1
  3. package/{adapter-BK3gsby5.d.cts → adapter-DD3K3dCW.d.mts} +1 -1
  4. package/{auth-adapter-BIa-ZyVV.d.mts → auth-adapter-C17dzlzF.d.cts} +1 -1
  5. package/{auth-adapter-DwtMJb7D.d.cts → auth-adapter-CizFv7oU.d.mts} +1 -1
  6. package/auth-better-auth.d.cts +1 -1
  7. package/auth-better-auth.d.mts +1 -1
  8. package/auth-clerk.d.cts +1 -1
  9. package/auth-clerk.d.mts +1 -1
  10. package/auth-supabase.cjs +121 -0
  11. package/auth-supabase.d.cts +23 -0
  12. package/auth-supabase.d.mts +23 -0
  13. package/auth-supabase.mjs +119 -0
  14. package/auth-workos.d.cts +1 -1
  15. package/auth-workos.d.mts +1 -1
  16. package/core-adapter.d.cts +1 -1
  17. package/core-adapter.d.mts +1 -1
  18. package/core-auth-adapter.d.cts +1 -1
  19. package/core-auth-adapter.d.mts +1 -1
  20. package/core-mapping-score.d.cts +1 -0
  21. package/core-sync-engine.cjs +1 -1
  22. package/core-sync-engine.mjs +1 -1
  23. package/core-types.cjs +5 -1
  24. package/core-types.d.cts +2 -2
  25. package/core-types.d.mts +2 -2
  26. package/core-types.mjs +1 -1
  27. package/core-view-compiler.cjs +1 -1
  28. package/core-view-compiler.mjs +1 -1
  29. package/core.cjs +9 -5
  30. package/core.d.cts +6 -6
  31. package/core.d.mts +6 -6
  32. package/core.mjs +6 -6
  33. package/discover-BZIPXl23.cjs +200 -0
  34. package/discover-CFIi43Qn.mjs +195 -0
  35. package/drizzle.cjs +1 -1
  36. package/drizzle.d.cts +2 -2
  37. package/drizzle.d.mts +2 -2
  38. package/drizzle.mjs +1 -1
  39. package/executor-CJEWurjZ.mjs +23 -0
  40. package/executor-CU-jRgpC.cjs +40 -0
  41. package/index-CZkp8TV4.d.cts +108 -0
  42. package/index-Cnrz4ywf.d.mts +108 -0
  43. package/{index-Bh7o2J7K.d.mts → index-DOoX2GgI.d.mts} +3 -3
  44. package/{index-DRRTE5IJ.d.cts → index-uFDiQEjj.d.cts} +231 -5
  45. package/index.cjs +903 -30
  46. package/index.d.cts +27 -0
  47. package/index.d.mts +26 -0
  48. package/index.mjs +901 -28
  49. package/{internal-CdfVkh4O.d.mts → internal-D_2q2BOB.d.mts} +1 -1
  50. package/internal-adapter.d.cts +1 -1
  51. package/internal-adapter.d.mts +1 -1
  52. package/internal-auth-adapter.d.cts +1 -1
  53. package/internal-auth-adapter.d.mts +1 -1
  54. package/internal-sync-engine.cjs +1 -1
  55. package/internal-sync-engine.mjs +1 -1
  56. package/internal-types.cjs +5 -1
  57. package/internal-types.d.cts +2 -2
  58. package/internal-types.d.mts +2 -2
  59. package/internal-types.mjs +1 -1
  60. package/internal-view-compiler.cjs +1 -1
  61. package/internal-view-compiler.mjs +1 -1
  62. package/internal.cjs +9 -5
  63. package/internal.d.cts +5 -6
  64. package/internal.d.mts +6 -6
  65. package/internal.mjs +6 -6
  66. package/introspector-BwYgHGcS.cjs +363 -0
  67. package/introspector-Bz52xOUr.mjs +334 -0
  68. package/{namespace-probe-JuHriruA.d.mts → namespace-probe--GvxJ06J.d.mts} +8 -1
  69. package/package.json +31 -1
  70. package/projection-guard-7AMY0aCk.mjs +389 -0
  71. package/projection-guard-D8VUhCz7.cjs +508 -0
  72. package/{projection-sql-DQQdjw9I.mjs → projection-sql-2joBkLz2.mjs} +13 -3
  73. package/{projection-sql-BkrHR2ea.cjs → projection-sql-DS5sVTY-.cjs} +18 -2
  74. package/sdk-Bzkr24NW.cjs +207 -0
  75. package/sdk-D2WwGBzk.mjs +178 -0
  76. package/sdk.cjs +8 -6
  77. package/sdk.d.cts +7 -1
  78. package/sdk.d.mts +7 -1
  79. package/sdk.mjs +3 -2
  80. package/sql.cjs +13 -0
  81. package/sql.d.cts +2 -0
  82. package/sql.d.mts +2 -0
  83. package/sql.mjs +4 -0
  84. package/{sdk-BkMDOfCk.mjs → src-Dq2nY1Sj.mjs} +36 -495
  85. package/{sdk-BOarpe5I.cjs → src-X0-yIA3O.cjs} +63 -546
  86. package/supabase.cjs +255 -0
  87. package/supabase.d.cts +19 -0
  88. package/supabase.d.mts +19 -0
  89. package/supabase.mjs +254 -0
  90. package/{sync-engine-yFLEyId3.mjs → sync-engine-D0mJUeqP.mjs} +1 -1
  91. package/{sync-engine-DNSoZeo0.cjs → sync-engine-hU041kXO.cjs} +1 -1
  92. package/types-KMH5D5Lg.mjs +32 -0
  93. package/{namespace-probe-CcL6Wj8E.d.cts → types-UR-tT4c1.d.cts} +52 -45
  94. package/{types-BBfwsDxe.d.cts → types-f-Vcv-pl.d.cts} +18 -2
  95. package/{types-BBfwsDxe.d.mts → types-f-Vcv-pl.d.mts} +18 -2
  96. package/types-kR1kUlmz.cjs +67 -0
  97. package/{view-compiler-CSHSqZl7.mjs → view-compiler-BhKiezRH.mjs} +1 -1
  98. package/{view-compiler-NqiortOA.cjs → view-compiler-DgZadq1F.cjs} +1 -1
  99. package/vite.d.cts +1 -1
  100. package/vite.d.mts +1 -1
  101. package/internal-D7qVRIFb.d.cts +0 -228
  102. package/types-8KSw2AWg.mjs +0 -8
  103. package/types-B8m39L1s.cjs +0 -19
package/core.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import { A as TaskStatus, C as PipelineStageConfig, D as TaskEntityType, E as Task, F as ValueInterval, I as isClosedStageType, L as ContactSegment, M as UpdateContactInput, N as UpdateDealInput, O as TaskFilters, P as UpdateTaskInput, R as contactSegmentSchema, S as PipelineKind, T as StageType, _ as Note, a as Contact, b as PageRequest, c as ContactStatus, d as CreateContactInput, f as CreateDealInput, g as DealStage, h as Deal, i as CompanyFilters, j as UpdateCompanyInput, k as TaskPriority, l as CreateActivityInput, m as CrmRole, n as ActivityType, o as ContactFilters, p as CreateTaskInput, r as Company, s as ContactSource, t as Activity, u as CreateCompanyInput, v as OPEN_STAGE_TYPE, w as RecordSource, x as PipelineConfig, y as Page } from "./types-BBfwsDxe.mjs";
2
- import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-BIa-ZyVV.mjs";
3
- import { t as CRMAdapter } from "./adapter-B4v4dwgD.mjs";
1
+ import { A as TaskFilters, B as isContactStatus, C as PipelineConfig, D as StageType, E as RecordSource, F as UpdateDealInput, H as contactSegmentSchema, I as UpdateTaskInput, L as VENDOR_STATUS, M as TaskStatus, N as UpdateCompanyInput, O as Task, P as UpdateContactInput, R as ValueInterval, S as PageRequest, T as PipelineStageConfig, V as ContactSegment, _ as DealStage, a as CompanyFilters, b as OPEN_STAGE_TYPE, c as ContactSource, d as CreateCompanyInput, f as CreateContactInput, g as Deal, h as CrmRole, i as Company, j as TaskPriority, k as TaskEntityType, l as ContactStatus, m as CreateTaskInput, n as ActivityType, o as Contact, p as CreateDealInput, r as CONTACT_STATUSES, s as ContactFilters, t as Activity, u as CreateActivityInput, v as LIFECYCLE_STATUSES, w as PipelineKind, x as Page, y as Note, z as isClosedStageType } from "./types-f-Vcv-pl.mjs";
2
+ import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-CizFv7oU.mjs";
3
+ import { t as CRMAdapter } from "./adapter-DD3K3dCW.mjs";
4
4
  import { A as relationshipsSchema, B as identityRefs, D as missingRequiredFields, E as filterSchema, F as ProjectionFieldBinding, I as ProjectionIdentity, L as ProjectionJoin, M as validateEntitiesConfig, N as BASE_REF, O as projectionFields, P as PROJECTION_KEY_PATTERN, R as ProjectionMapping, S as RelationshipsMap, T as entitiesConfigSchema, V as projectionSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipSpec, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as requiredFieldsFor, k as relationshipSchema, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, p as DiscoveredColumnMeta, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as defineClivlyConfig, x as RelationshipVia, y as REQUIRED_FIELDS, z as ProjectionRef } from "./entity-config-CXpGowQa.mjs";
5
5
  import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-KHUlnC7A.mjs";
6
6
  import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-wAe-p1rG.mjs";
7
7
  import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CSNhmCY2.mjs";
8
8
  import { c as SyncAction, f as isRemovalAction, g as runSync, h as resolveActions, l as SyncResult, m as reconcile, n as MirrorRecord, o as ResolvedMembership, r as PersistAction, s as SourceRow, t as EntitySyncResult, u as SyncStore } from "./sync-engine-UNORma7f.mjs";
9
- import { _ as PerSeatValueSource, a as matchesCondition, c as HostOwnedCompanyField, d as hostOwnedFieldMessage, f as isHostOwned, g as MappedAmountValueSource, h as DealValueSource, i as evaluateStage, l as HostOwnedContactField, m as rejectedContactFields, n as ConditionOp, o as slugify, p as rejectedCompanyFields, r as EvaluableRule, s as toObjectTypeSlug, t as Condition, u as SourcedRecord, v as computeDealValue } from "./internal-CdfVkh4O.mjs";
10
- import { C as StepProblem, S as StepId, _ as IntegrationFacts, a as validateProjection, b as IntegrationStep, c as compileProjectionFrom, d as compileProjectionPreview, f as compileProjectionSelect, g as ConnectionLiveness, h as joinFansOut, i as primaryKeyColumns, l as compileProjectionIdentity, m as fanOutJoins, n as coversUniqueKey, o as validateProjectionFilter, p as quoteIdent, r as hasRichMeta, s as PREVIEW_MAX_ROWS, t as columnMetaFor, u as compileProjectionJoins, v as IntegrationState, w as StepState, x as NextAction, y as IntegrationStatus } from "./index-Bh7o2J7K.mjs";
11
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompanyFilters, type CompileOptions, type CompiledView, type Condition, type ConditionOp, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactSegment, type ContactSource, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DealValueSource, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type EvaluableRule, type ExplainResult, type FilterExpr, type FilterValue, type HostOwnedCompanyField, type HostOwnedContactField, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MappedAmountValueSource, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, type Page, type PageRequest, type PerSeatValueSource, type PersistAction, type PipelineConfig, type PipelineKind, type PipelineStageConfig, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, REQUIRED_FIELDS, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type ResolvedMembership, type SourceRow, type SourcedRecord, type StageType, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateCompanyInput, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, type ValueInterval, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
9
+ import { _ as PerSeatValueSource, a as matchesCondition, c as HostOwnedCompanyField, d as hostOwnedFieldMessage, f as isHostOwned, g as MappedAmountValueSource, h as DealValueSource, i as evaluateStage, l as HostOwnedContactField, m as rejectedContactFields, n as ConditionOp, o as slugify, p as rejectedCompanyFields, r as EvaluableRule, s as toObjectTypeSlug, t as Condition, u as SourcedRecord, v as computeDealValue } from "./internal-D_2q2BOB.mjs";
10
+ import { C as StepProblem, S as StepId, _ as IntegrationFacts, a as validateProjection, b as IntegrationStep, c as compileProjectionFrom, d as compileProjectionPreview, f as compileProjectionSelect, g as ConnectionLiveness, h as joinFansOut, i as primaryKeyColumns, l as compileProjectionIdentity, m as fanOutJoins, n as coversUniqueKey, o as validateProjectionFilter, p as quoteIdent, r as hasRichMeta, s as PREVIEW_MAX_ROWS, t as columnMetaFor, u as compileProjectionJoins, v as IntegrationState, w as StepState, x as NextAction, y as IntegrationStatus } from "./index-DOoX2GgI.mjs";
11
+ export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, CONTACT_STATUSES, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompanyFilters, type CompileOptions, type CompiledView, type Condition, type ConditionOp, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactSegment, type ContactSource, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DealValueSource, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type EvaluableRule, type ExplainResult, type FilterExpr, type FilterValue, type HostOwnedCompanyField, type HostOwnedContactField, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, LIFECYCLE_STATUSES, MATERIALIZING_CONCEPTS, type MappedAmountValueSource, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, type Page, type PageRequest, type PerSeatValueSource, type PersistAction, type PipelineConfig, type PipelineKind, type PipelineStageConfig, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, REQUIRED_FIELDS, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type ResolvedMembership, type SourceRow, type SourcedRecord, type StageType, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateCompanyInput, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, VENDOR_STATUS, type ValueInterval, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isContactStatus, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
package/core.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { i as projectionSchema, n as PROJECTION_KEY_PATTERN, r as identityRefs, t as BASE_REF } from "./projection-CzBI2NL8.mjs";
2
+ import { a as compileProjectionPreview, i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, r as compileProjectionIdentity, s as quoteIdent, t as PREVIEW_MAX_ROWS } from "./projection-sql-2joBkLz2.mjs";
2
3
  import { C as hasRichMeta, S as coversUniqueKey, _ as validateProjection, a as MATERIALIZING_CONCEPTS, b as joinFansOut, c as defineClivlyConfig, d as missingRequiredFields, f as projectionFields, g as validateEntitiesConfig, h as requiredFieldsFor, i as ClivlyConfigError, l as entitiesConfigSchema, m as relationshipsSchema, n as CRM_CONCEPTS, o as REQUIRED_FIELDS, p as relationshipSchema, t as CANONICAL_FIELDS, u as filterSchema, v as validateProjectionFilter, w as primaryKeyColumns, x as columnMetaFor, y as fanOutJoins } from "./entity-config-CI5CGfaN.mjs";
3
- import { n as mappingsToEntitiesConfig } from "./mappings-config-Opw7ZM6Y.mjs";
4
4
  import { t as authCustom } from "./auth-adapter-u91PByaw.mjs";
5
5
  import { a as hostOwnedFieldMessage, c as rejectedContactFields, i as toObjectTypeSlug, l as computeDealValue, n as matchesCondition, o as isHostOwned, r as slugify, s as rejectedCompanyFields, t as evaluateStage, u as contactSegmentSchema } from "./internal-BAw1MCMV.mjs";
6
6
  import { n as buildRelationships, r as relationshipViaSignature, t as buildFilterFromDiscriminator } from "./mapping-form-C7kDMWzp.mjs";
7
- import { a as compileProjectionPreview, i as compileProjectionJoins, n as compileProjectionFrom, o as compileProjectionSelect, r as compileProjectionIdentity, s as quoteIdent, t as PREVIEW_MAX_ROWS } from "./projection-sql-DQQdjw9I.mjs";
8
- import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CSHSqZl7.mjs";
9
- import { a as resolveActions, i as reconcile, n as isRemovalAction, o as runSync } from "./sync-engine-yFLEyId3.mjs";
10
- import { n as isClosedStageType, t as OPEN_STAGE_TYPE } from "./types-8KSw2AWg.mjs";
7
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-Opw7ZM6Y.mjs";
8
+ import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-BhKiezRH.mjs";
9
+ import { a as resolveActions, i as reconcile, n as isRemovalAction, o as runSync } from "./sync-engine-D0mJUeqP.mjs";
10
+ import { a as isClosedStageType, i as VENDOR_STATUS, n as LIFECYCLE_STATUSES, o as isContactStatus, r as OPEN_STAGE_TYPE, t as CONTACT_STATUSES } from "./types-KMH5D5Lg.mjs";
11
11
  import { t as warnDeprecatedSubpath } from "./deprecate-subpath-CK37DKXH.mjs";
12
12
  // src/core.ts
13
13
  warnDeprecatedSubpath("clivly/core", "clivly/sdk", "Import \"defineClivlyConfig\" and its config types from \"clivly/sdk\"; import everything else from \"clivly/internal\" (no stability guarantee — see STABILITY.md).");
14
- export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, REQUIRED_FIELDS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
14
+ export { BASE_REF, CANONICAL_FIELDS, CONTACT_STATUSES, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, LIFECYCLE_STATUSES, MATERIALIZING_CONCEPTS, OPEN_STAGE_TYPE, PREVIEW_MAX_ROWS, PROJECTION_KEY_PATTERN, REQUIRED_FIELDS, VENDOR_STATUS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, compileProjectionFrom, compileProjectionIdentity, compileProjectionJoins, compileProjectionPreview, compileProjectionSelect, computeDealValue, contactSegmentSchema, coversUniqueKey, defineClivlyConfig, entitiesConfigSchema, evaluateStage, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, hostOwnedFieldMessage, identityRefs, isClosedStageType, isContactStatus, isHostOwned, isRemovalAction, joinFansOut, mappingsToEntitiesConfig, matchesCondition, missingRequiredFields, primaryKeyColumns, projectionFields, projectionSchema, quoteIdent, reconcile, rejectedCompanyFields, rejectedContactFields, relationshipSchema, relationshipViaSignature, relationshipsSchema, requiredFieldsFor, resolveActions, runSync, slugify, toObjectTypeSlug, validateEntitiesConfig, validateProjection, validateProjectionFilter };
@@ -0,0 +1,200 @@
1
+ const require_projection_guard = require("./projection-guard-D8VUhCz7.cjs");
2
+ // ../sdk/src/sql/postgres-introspection.ts
3
+ /**
4
+ * POSTGRES-ONLY introspection SQL. Kept apart from `discover.ts` so a MySQL
5
+ * dialect can supply its own strings without touching the assembly logic.
6
+ */
7
+ const PG_CURRENT_SCHEMA_SQL = "select current_schema() as schema_name";
8
+ /** Base tables and their columns, in declaration order. `$1` = text[] schemas. */
9
+ const PG_COLUMNS_SQL = `
10
+ select c.table_schema as schema_name,
11
+ c.table_name as table_name,
12
+ c.column_name as column_name,
13
+ c.data_type as data_type,
14
+ c.udt_name as udt_name,
15
+ c.character_maximum_length as char_length,
16
+ c.is_nullable as is_nullable
17
+ from information_schema.columns c
18
+ join information_schema.tables t
19
+ on t.table_schema = c.table_schema
20
+ and t.table_name = c.table_name
21
+ and t.table_type = 'BASE TABLE'
22
+ where c.table_schema = any($1::text[])
23
+ order by c.table_schema, c.table_name, c.ordinal_position`;
24
+ /**
25
+ * Every full (non-partial, non-expression) unique index, which covers primary
26
+ * keys and unique constraints alike. Columns come back in key order.
27
+ */
28
+ const PG_UNIQUE_KEYS_SQL = `
29
+ select n.nspname as schema_name,
30
+ t.relname as table_name,
31
+ i.indisprimary as is_primary,
32
+ (select array_agg(a.attname::text order by k.ord)
33
+ from unnest(i.indkey::int2[]) with ordinality as k(attnum, ord)
34
+ join pg_attribute a on a.attrelid = t.oid and a.attnum = k.attnum) as columns
35
+ from pg_index i
36
+ join pg_class t on t.oid = i.indrelid
37
+ join pg_namespace n on n.oid = t.relnamespace
38
+ where n.nspname = any($1::text[])
39
+ and i.indisunique
40
+ and i.indpred is null
41
+ and i.indexprs is null
42
+ order by n.nspname, t.relname, i.indisprimary desc, i.indexrelid`;
43
+ /** Foreign keys, one row per constraint with both column lists in key order. */
44
+ const PG_FOREIGN_KEYS_SQL = `
45
+ select n.nspname as schema_name,
46
+ t.relname as table_name,
47
+ fn.nspname as foreign_schema,
48
+ ft.relname as foreign_table,
49
+ (select array_agg(a.attname::text order by k.ord)
50
+ from unnest(c.conkey) with ordinality as k(attnum, ord)
51
+ join pg_attribute a on a.attrelid = c.conrelid and a.attnum = k.attnum) as columns,
52
+ (select array_agg(a.attname::text order by k.ord)
53
+ from unnest(c.confkey) with ordinality as k(attnum, ord)
54
+ join pg_attribute a on a.attrelid = c.confrelid and a.attnum = k.attnum) as foreign_columns
55
+ from pg_constraint c
56
+ join pg_class t on t.oid = c.conrelid
57
+ join pg_namespace n on n.oid = t.relnamespace
58
+ join pg_class ft on ft.oid = c.confrelid
59
+ join pg_namespace fn on fn.oid = ft.relnamespace
60
+ where c.contype = 'f'
61
+ and n.nspname = any($1::text[])`;
62
+ // ../sdk/src/sql/discover.ts
63
+ const [AUTH_SCHEMA = "auth", AUTH_USERS_NAME = "users"] = require_projection_guard.AUTH_USERS_TABLE.split(".");
64
+ /** The app-ID store Clivly itself writes; never a host business table. */
65
+ const APP_ID_TABLE = "crm_clivly_app";
66
+ const key = (schema, name) => `${schema}\0${name}`;
67
+ const asString = (value) => String(value);
68
+ const asStrings = (value) => Array.isArray(value) ? value.map(asString) : [];
69
+ const LEADING_UNDERSCORE = /^_/;
70
+ /**
71
+ * Normalise information_schema's type names to the vocabulary Drizzle's
72
+ * `getSQLType()` emits, so core's type checks (e.g. the text-typed composite
73
+ * identity guard) treat both discovery paths the same.
74
+ */
75
+ function columnType(row) {
76
+ const dataType = asString(row.data_type);
77
+ const udt = asString(row.udt_name);
78
+ const length = row.char_length === null || row.char_length === void 0 ? "" : `(${asString(row.char_length)})`;
79
+ switch (dataType) {
80
+ case "character varying": return `varchar${length}`;
81
+ case "character": return `char${length}`;
82
+ case "USER-DEFINED": return udt;
83
+ case "ARRAY": return `${udt.replace(LEADING_UNDERSCORE, "")}[]`;
84
+ default: return dataType;
85
+ }
86
+ }
87
+ function makeScope(defaultSchema, requested, includeAuth) {
88
+ const allowedAuth = new Set(require_projection_guard.AUTH_USERS_COLUMNS);
89
+ return {
90
+ allowedAuth,
91
+ defaultSchema,
92
+ qualified: ({ schema, name }) => schema === defaultSchema ? name : `${schema}.${name}`,
93
+ visible(schema, name) {
94
+ if (name === APP_ID_TABLE) return false;
95
+ if (schema === AUTH_SCHEMA) return includeAuth && name === AUTH_USERS_NAME;
96
+ return requested.includes(schema);
97
+ },
98
+ columnAllowed: (schema, column) => schema !== AUTH_SCHEMA || allowedAuth.has(column)
99
+ };
100
+ }
101
+ function collectForeignKeys(rows, scope) {
102
+ const byColumn = /* @__PURE__ */ new Map();
103
+ for (const row of rows) {
104
+ const schema = asString(row.schema_name);
105
+ const name = asString(row.table_name);
106
+ const foreign = {
107
+ schema: asString(row.foreign_schema),
108
+ name: asString(row.foreign_table)
109
+ };
110
+ if (!(scope.visible(schema, name) && scope.visible(foreign.schema, foreign.name))) continue;
111
+ const foreignColumns = asStrings(row.foreign_columns);
112
+ asStrings(row.columns).forEach((column, index) => {
113
+ const foreignColumn = foreignColumns[index];
114
+ if (foreignColumn && scope.columnAllowed(foreign.schema, foreignColumn)) byColumn.set(`${key(schema, name)}\0${column}`, {
115
+ table: scope.qualified(foreign),
116
+ column: foreignColumn
117
+ });
118
+ });
119
+ }
120
+ return byColumn;
121
+ }
122
+ function keyId(columns) {
123
+ return [...columns].sort().join("\0");
124
+ }
125
+ function collectUniqueKeys(rows, scope) {
126
+ const byTable = /* @__PURE__ */ new Map();
127
+ const primary = /* @__PURE__ */ new Set();
128
+ for (const row of rows) {
129
+ const schema = asString(row.schema_name);
130
+ const name = asString(row.table_name);
131
+ const columns = asStrings(row.columns);
132
+ if (!(scope.visible(schema, name) && columns.length > 0 && columns.every((c) => scope.columnAllowed(schema, c)))) continue;
133
+ const tableKey = key(schema, name);
134
+ const list = byTable.get(tableKey) ?? [];
135
+ if (!list.some((existing) => keyId(existing) === keyId(columns))) list.push(columns);
136
+ byTable.set(tableKey, list);
137
+ if (row.is_primary === true) for (const column of columns) primary.add(`${tableKey}\0${column}`);
138
+ }
139
+ return {
140
+ byTable,
141
+ primary
142
+ };
143
+ }
144
+ /**
145
+ * The raw-SQL twin of `discoverFromDrizzle`: reads Postgres catalogs and
146
+ * returns the same `DiscoveredSchemaTable[]` shape. Names are unqualified in
147
+ * the default schema and `schema.table` elsewhere. `auth.users` is reported
148
+ * with only its allowlisted columns; every other `auth.*` table is omitted.
149
+ */
150
+ async function discoverFromSql(executor, opts = {}) {
151
+ const [current] = await executor.query(PG_CURRENT_SCHEMA_SQL);
152
+ const defaultSchema = asString(current?.schema_name ?? "public");
153
+ const requested = opts.schemas ?? [defaultSchema];
154
+ const schemas = [.../* @__PURE__ */ new Set([...requested, AUTH_SCHEMA])];
155
+ const [columnRows, uniqueRows, fkRows] = await Promise.all([
156
+ executor.query(PG_COLUMNS_SQL, [schemas]),
157
+ executor.query(PG_UNIQUE_KEYS_SQL, [schemas]),
158
+ executor.query(PG_FOREIGN_KEYS_SQL, [schemas])
159
+ ]);
160
+ const authExists = columnRows.some((row) => row.schema_name === AUTH_SCHEMA && row.table_name === AUTH_USERS_NAME);
161
+ const scope = makeScope(defaultSchema, requested, (opts.includeAuthUsers ?? true) && authExists);
162
+ const fkByColumn = collectForeignKeys(fkRows, scope);
163
+ const { byTable, primary } = collectUniqueKeys(uniqueRows, scope);
164
+ const tables = /* @__PURE__ */ new Map();
165
+ for (const row of columnRows) {
166
+ const schema = asString(row.schema_name);
167
+ const name = asString(row.table_name);
168
+ const column = asString(row.column_name);
169
+ if (!(scope.visible(schema, name) && scope.columnAllowed(schema, column))) continue;
170
+ const tableKey = key(schema, name);
171
+ const table = tables.get(tableKey) ?? {
172
+ name: scope.qualified({
173
+ schema,
174
+ name
175
+ }),
176
+ columns: [],
177
+ columnsMeta: [],
178
+ uniqueConstraints: byTable.get(tableKey) ?? []
179
+ };
180
+ tables.set(tableKey, table);
181
+ const references = fkByColumn.get(`${tableKey}\0${column}`);
182
+ const meta = {
183
+ name: column,
184
+ type: columnType(row),
185
+ nullable: row.is_nullable === "YES",
186
+ isPrimaryKey: primary.has(`${tableKey}\0${column}`),
187
+ isForeignKey: references !== void 0,
188
+ ...references ? { references } : {}
189
+ };
190
+ table.columns.push(column);
191
+ table.columnsMeta?.push(meta);
192
+ }
193
+ return [...tables.values()];
194
+ }
195
+ Object.defineProperty(exports, "discoverFromSql", {
196
+ enumerable: true,
197
+ get: function() {
198
+ return discoverFromSql;
199
+ }
200
+ });
@@ -0,0 +1,195 @@
1
+ import { g as AUTH_USERS_COLUMNS, v as AUTH_USERS_TABLE } from "./projection-guard-7AMY0aCk.mjs";
2
+ // ../sdk/src/sql/postgres-introspection.ts
3
+ /**
4
+ * POSTGRES-ONLY introspection SQL. Kept apart from `discover.ts` so a MySQL
5
+ * dialect can supply its own strings without touching the assembly logic.
6
+ */
7
+ const PG_CURRENT_SCHEMA_SQL = "select current_schema() as schema_name";
8
+ /** Base tables and their columns, in declaration order. `$1` = text[] schemas. */
9
+ const PG_COLUMNS_SQL = `
10
+ select c.table_schema as schema_name,
11
+ c.table_name as table_name,
12
+ c.column_name as column_name,
13
+ c.data_type as data_type,
14
+ c.udt_name as udt_name,
15
+ c.character_maximum_length as char_length,
16
+ c.is_nullable as is_nullable
17
+ from information_schema.columns c
18
+ join information_schema.tables t
19
+ on t.table_schema = c.table_schema
20
+ and t.table_name = c.table_name
21
+ and t.table_type = 'BASE TABLE'
22
+ where c.table_schema = any($1::text[])
23
+ order by c.table_schema, c.table_name, c.ordinal_position`;
24
+ /**
25
+ * Every full (non-partial, non-expression) unique index, which covers primary
26
+ * keys and unique constraints alike. Columns come back in key order.
27
+ */
28
+ const PG_UNIQUE_KEYS_SQL = `
29
+ select n.nspname as schema_name,
30
+ t.relname as table_name,
31
+ i.indisprimary as is_primary,
32
+ (select array_agg(a.attname::text order by k.ord)
33
+ from unnest(i.indkey::int2[]) with ordinality as k(attnum, ord)
34
+ join pg_attribute a on a.attrelid = t.oid and a.attnum = k.attnum) as columns
35
+ from pg_index i
36
+ join pg_class t on t.oid = i.indrelid
37
+ join pg_namespace n on n.oid = t.relnamespace
38
+ where n.nspname = any($1::text[])
39
+ and i.indisunique
40
+ and i.indpred is null
41
+ and i.indexprs is null
42
+ order by n.nspname, t.relname, i.indisprimary desc, i.indexrelid`;
43
+ /** Foreign keys, one row per constraint with both column lists in key order. */
44
+ const PG_FOREIGN_KEYS_SQL = `
45
+ select n.nspname as schema_name,
46
+ t.relname as table_name,
47
+ fn.nspname as foreign_schema,
48
+ ft.relname as foreign_table,
49
+ (select array_agg(a.attname::text order by k.ord)
50
+ from unnest(c.conkey) with ordinality as k(attnum, ord)
51
+ join pg_attribute a on a.attrelid = c.conrelid and a.attnum = k.attnum) as columns,
52
+ (select array_agg(a.attname::text order by k.ord)
53
+ from unnest(c.confkey) with ordinality as k(attnum, ord)
54
+ join pg_attribute a on a.attrelid = c.confrelid and a.attnum = k.attnum) as foreign_columns
55
+ from pg_constraint c
56
+ join pg_class t on t.oid = c.conrelid
57
+ join pg_namespace n on n.oid = t.relnamespace
58
+ join pg_class ft on ft.oid = c.confrelid
59
+ join pg_namespace fn on fn.oid = ft.relnamespace
60
+ where c.contype = 'f'
61
+ and n.nspname = any($1::text[])`;
62
+ // ../sdk/src/sql/discover.ts
63
+ const [AUTH_SCHEMA = "auth", AUTH_USERS_NAME = "users"] = AUTH_USERS_TABLE.split(".");
64
+ /** The app-ID store Clivly itself writes; never a host business table. */
65
+ const APP_ID_TABLE = "crm_clivly_app";
66
+ const key = (schema, name) => `${schema}\0${name}`;
67
+ const asString = (value) => String(value);
68
+ const asStrings = (value) => Array.isArray(value) ? value.map(asString) : [];
69
+ const LEADING_UNDERSCORE = /^_/;
70
+ /**
71
+ * Normalise information_schema's type names to the vocabulary Drizzle's
72
+ * `getSQLType()` emits, so core's type checks (e.g. the text-typed composite
73
+ * identity guard) treat both discovery paths the same.
74
+ */
75
+ function columnType(row) {
76
+ const dataType = asString(row.data_type);
77
+ const udt = asString(row.udt_name);
78
+ const length = row.char_length === null || row.char_length === void 0 ? "" : `(${asString(row.char_length)})`;
79
+ switch (dataType) {
80
+ case "character varying": return `varchar${length}`;
81
+ case "character": return `char${length}`;
82
+ case "USER-DEFINED": return udt;
83
+ case "ARRAY": return `${udt.replace(LEADING_UNDERSCORE, "")}[]`;
84
+ default: return dataType;
85
+ }
86
+ }
87
+ function makeScope(defaultSchema, requested, includeAuth) {
88
+ const allowedAuth = new Set(AUTH_USERS_COLUMNS);
89
+ return {
90
+ allowedAuth,
91
+ defaultSchema,
92
+ qualified: ({ schema, name }) => schema === defaultSchema ? name : `${schema}.${name}`,
93
+ visible(schema, name) {
94
+ if (name === APP_ID_TABLE) return false;
95
+ if (schema === AUTH_SCHEMA) return includeAuth && name === AUTH_USERS_NAME;
96
+ return requested.includes(schema);
97
+ },
98
+ columnAllowed: (schema, column) => schema !== AUTH_SCHEMA || allowedAuth.has(column)
99
+ };
100
+ }
101
+ function collectForeignKeys(rows, scope) {
102
+ const byColumn = /* @__PURE__ */ new Map();
103
+ for (const row of rows) {
104
+ const schema = asString(row.schema_name);
105
+ const name = asString(row.table_name);
106
+ const foreign = {
107
+ schema: asString(row.foreign_schema),
108
+ name: asString(row.foreign_table)
109
+ };
110
+ if (!(scope.visible(schema, name) && scope.visible(foreign.schema, foreign.name))) continue;
111
+ const foreignColumns = asStrings(row.foreign_columns);
112
+ asStrings(row.columns).forEach((column, index) => {
113
+ const foreignColumn = foreignColumns[index];
114
+ if (foreignColumn && scope.columnAllowed(foreign.schema, foreignColumn)) byColumn.set(`${key(schema, name)}\0${column}`, {
115
+ table: scope.qualified(foreign),
116
+ column: foreignColumn
117
+ });
118
+ });
119
+ }
120
+ return byColumn;
121
+ }
122
+ function keyId(columns) {
123
+ return [...columns].sort().join("\0");
124
+ }
125
+ function collectUniqueKeys(rows, scope) {
126
+ const byTable = /* @__PURE__ */ new Map();
127
+ const primary = /* @__PURE__ */ new Set();
128
+ for (const row of rows) {
129
+ const schema = asString(row.schema_name);
130
+ const name = asString(row.table_name);
131
+ const columns = asStrings(row.columns);
132
+ if (!(scope.visible(schema, name) && columns.length > 0 && columns.every((c) => scope.columnAllowed(schema, c)))) continue;
133
+ const tableKey = key(schema, name);
134
+ const list = byTable.get(tableKey) ?? [];
135
+ if (!list.some((existing) => keyId(existing) === keyId(columns))) list.push(columns);
136
+ byTable.set(tableKey, list);
137
+ if (row.is_primary === true) for (const column of columns) primary.add(`${tableKey}\0${column}`);
138
+ }
139
+ return {
140
+ byTable,
141
+ primary
142
+ };
143
+ }
144
+ /**
145
+ * The raw-SQL twin of `discoverFromDrizzle`: reads Postgres catalogs and
146
+ * returns the same `DiscoveredSchemaTable[]` shape. Names are unqualified in
147
+ * the default schema and `schema.table` elsewhere. `auth.users` is reported
148
+ * with only its allowlisted columns; every other `auth.*` table is omitted.
149
+ */
150
+ async function discoverFromSql(executor, opts = {}) {
151
+ const [current] = await executor.query(PG_CURRENT_SCHEMA_SQL);
152
+ const defaultSchema = asString(current?.schema_name ?? "public");
153
+ const requested = opts.schemas ?? [defaultSchema];
154
+ const schemas = [.../* @__PURE__ */ new Set([...requested, AUTH_SCHEMA])];
155
+ const [columnRows, uniqueRows, fkRows] = await Promise.all([
156
+ executor.query(PG_COLUMNS_SQL, [schemas]),
157
+ executor.query(PG_UNIQUE_KEYS_SQL, [schemas]),
158
+ executor.query(PG_FOREIGN_KEYS_SQL, [schemas])
159
+ ]);
160
+ const authExists = columnRows.some((row) => row.schema_name === AUTH_SCHEMA && row.table_name === AUTH_USERS_NAME);
161
+ const scope = makeScope(defaultSchema, requested, (opts.includeAuthUsers ?? true) && authExists);
162
+ const fkByColumn = collectForeignKeys(fkRows, scope);
163
+ const { byTable, primary } = collectUniqueKeys(uniqueRows, scope);
164
+ const tables = /* @__PURE__ */ new Map();
165
+ for (const row of columnRows) {
166
+ const schema = asString(row.schema_name);
167
+ const name = asString(row.table_name);
168
+ const column = asString(row.column_name);
169
+ if (!(scope.visible(schema, name) && scope.columnAllowed(schema, column))) continue;
170
+ const tableKey = key(schema, name);
171
+ const table = tables.get(tableKey) ?? {
172
+ name: scope.qualified({
173
+ schema,
174
+ name
175
+ }),
176
+ columns: [],
177
+ columnsMeta: [],
178
+ uniqueConstraints: byTable.get(tableKey) ?? []
179
+ };
180
+ tables.set(tableKey, table);
181
+ const references = fkByColumn.get(`${tableKey}\0${column}`);
182
+ const meta = {
183
+ name: column,
184
+ type: columnType(row),
185
+ nullable: row.is_nullable === "YES",
186
+ isPrimaryKey: primary.has(`${tableKey}\0${column}`),
187
+ isForeignKey: references !== void 0,
188
+ ...references ? { references } : {}
189
+ };
190
+ table.columns.push(column);
191
+ table.columnsMeta?.push(meta);
192
+ }
193
+ return [...tables.values()];
194
+ }
195
+ export { discoverFromSql as t };
package/drizzle.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_drizzle = require("./drizzle-C0bfX-6a.cjs");
3
3
  const require_drizzle_meta = require("./drizzle-meta-BPnRLpsB.cjs");
4
4
  const require_projection = require("./projection-w4Z6vSL2.cjs");
5
- const require_projection_sql = require("./projection-sql-BkrHR2ea.cjs");
5
+ const require_projection_sql = require("./projection-sql-DS5sVTY-.cjs");
6
6
  let drizzle_orm = require("drizzle-orm");
7
7
  // ../sdk/src/drizzle-projection.ts
8
8
  /** `<ref>.<column>` — the token `fields` carries and cloud-ingest reads. */
package/drizzle.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { R as ProjectionMapping, z as ProjectionRef } from "./entity-config-CXpGowQa.cjs";
2
- import { n as AppIdStore, t as NamespaceIntrospector, x as SyncSource } from "./namespace-probe-CcL6Wj8E.cjs";
2
+ import { C as NamespaceIntrospector, b as SyncSource, t as AppIdStore } from "./types-UR-tT4c1.cjs";
3
3
  import { n as buildUniqueConstraints, r as discoverFromDrizzle } from "./drizzle-BNHGQXiY.cjs";
4
- import "./index-DRRTE5IJ.cjs";
4
+ import "./index-uFDiQEjj.cjs";
5
5
  import { Table } from "drizzle-orm";
6
6
  /**
7
7
  * Build a `SyncSource` that actually executes a projection's joins.
package/drizzle.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { R as ProjectionMapping, z as ProjectionRef } from "./entity-config-CXpGowQa.mjs";
2
- import { n as AppIdStore, t as NamespaceIntrospector, x as SyncSource } from "./namespace-probe-JuHriruA.mjs";
2
+ import { n as AppIdStore, t as NamespaceIntrospector, x as SyncSource } from "./namespace-probe--GvxJ06J.mjs";
3
3
  import { n as buildUniqueConstraints, r as discoverFromDrizzle } from "./drizzle-DFe7ILmd.mjs";
4
- import "./index-Bh7o2J7K.mjs";
4
+ import "./index-DOoX2GgI.mjs";
5
5
  import { Table } from "drizzle-orm";
6
6
  /**
7
7
  * Build a `SyncSource` that actually executes a projection's joins.
package/drizzle.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-CZuOzIu4.mjs";
2
2
  import { t as DRIZZLE_META } from "./drizzle-meta-D00lFvAk.mjs";
3
3
  import { t as BASE_REF } from "./projection-CzBI2NL8.mjs";
4
- import { a as compileProjectionPreview, i as compileProjectionJoins, n as compileProjectionFrom, r as compileProjectionIdentity, s as quoteIdent } from "./projection-sql-DQQdjw9I.mjs";
4
+ import { a as compileProjectionPreview, i as compileProjectionJoins, n as compileProjectionFrom, r as compileProjectionIdentity, s as quoteIdent } from "./projection-sql-2joBkLz2.mjs";
5
5
  import { asc, getTableColumns, getTableName, sql } from "drizzle-orm";
6
6
  // ../sdk/src/drizzle-projection.ts
7
7
  /** `<ref>.<column>` — the token `fields` carries and cloud-ingest reads. */
@@ -0,0 +1,23 @@
1
+ // ../sdk/src/sql/executor.ts
2
+ /** Covers pg.Pool, pg.Client and PGlite. */
3
+ function pgExecutor(client) {
4
+ return { async query(text, params) {
5
+ return (await client.query(text, params ? [...params] : void 0)).rows;
6
+ } };
7
+ }
8
+ function postgresJsExecutor(sql) {
9
+ return { async query(text, params) {
10
+ return await sql.unsafe(text, params ? [...params] : void 0);
11
+ } };
12
+ }
13
+ /**
14
+ * The postgres.js factory is injected so the SDK takes no dependency on it.
15
+ * `prepare: false` keeps it working behind transaction-mode poolers.
16
+ */
17
+ function connectPostgresJs(url, postgres) {
18
+ return postgresJsExecutor(postgres(url, {
19
+ prepare: false,
20
+ max: 1
21
+ }));
22
+ }
23
+ export { pgExecutor as n, postgresJsExecutor as r, connectPostgresJs as t };
@@ -0,0 +1,40 @@
1
+ // ../sdk/src/sql/executor.ts
2
+ /** Covers pg.Pool, pg.Client and PGlite. */
3
+ function pgExecutor(client) {
4
+ return { async query(text, params) {
5
+ return (await client.query(text, params ? [...params] : void 0)).rows;
6
+ } };
7
+ }
8
+ function postgresJsExecutor(sql) {
9
+ return { async query(text, params) {
10
+ return await sql.unsafe(text, params ? [...params] : void 0);
11
+ } };
12
+ }
13
+ /**
14
+ * The postgres.js factory is injected so the SDK takes no dependency on it.
15
+ * `prepare: false` keeps it working behind transaction-mode poolers.
16
+ */
17
+ function connectPostgresJs(url, postgres) {
18
+ return postgresJsExecutor(postgres(url, {
19
+ prepare: false,
20
+ max: 1
21
+ }));
22
+ }
23
+ Object.defineProperty(exports, "connectPostgresJs", {
24
+ enumerable: true,
25
+ get: function() {
26
+ return connectPostgresJs;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, "pgExecutor", {
30
+ enumerable: true,
31
+ get: function() {
32
+ return pgExecutor;
33
+ }
34
+ });
35
+ Object.defineProperty(exports, "postgresJsExecutor", {
36
+ enumerable: true,
37
+ get: function() {
38
+ return postgresJsExecutor;
39
+ }
40
+ });