@happyvertical/smrt-core 0.54.2 → 0.54.3
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/AGENTS.md +6 -1
- package/README.md +8 -0
- package/agents/change-feed.md +7 -12
- package/agents/generators.md +13 -0
- package/agents/object-runtime.md +8 -0
- package/agents/schema-paths.md +14 -0
- package/dist/audit-context.d.ts +4 -0
- package/dist/audit-context.d.ts.map +1 -0
- package/dist/audit-context.js +16 -0
- package/dist/audit-context.js.map +1 -0
- package/dist/audit.d.ts +34 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +63 -0
- package/dist/audit.js.map +1 -0
- package/dist/browser.d.ts +2 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +4 -3
- package/dist/cascade.d.ts +1 -1
- package/dist/cascade.d.ts.map +1 -1
- package/dist/cascade.js +10 -7
- package/dist/cascade.js.map +1 -1
- package/dist/change-feed.js +1 -1
- package/dist/collection.d.ts +9 -2
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +59 -4
- package/dist/collection.js.map +1 -1
- package/dist/embedded-write-queue.d.ts +2 -0
- package/dist/embedded-write-queue.d.ts.map +1 -1
- package/dist/embedded-write-queue.js +12 -5
- package/dist/embedded-write-queue.js.map +1 -1
- package/dist/generators/changes-route.js +1 -1
- package/dist/generators/mcp-runtime-template.d.ts +2 -0
- package/dist/generators/mcp-runtime-template.d.ts.map +1 -1
- package/dist/generators/mcp-runtime-template.js +18 -16
- package/dist/generators/mcp-runtime-template.js.map +1 -1
- package/dist/generators/mcp-tool-name.d.ts +6 -0
- package/dist/generators/mcp-tool-name.d.ts.map +1 -1
- package/dist/generators/mcp-tool-name.js.map +1 -1
- package/dist/generators/mcp.d.ts +34 -1
- package/dist/generators/mcp.d.ts.map +1 -1
- package/dist/generators/mcp.js +148 -110
- package/dist/generators/mcp.js.map +1 -1
- package/dist/generators/rest.d.ts.map +1 -1
- package/dist/generators/rest.js +16 -7
- package/dist/generators/rest.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/junction.d.ts +29 -10
- package/dist/junction.d.ts.map +1 -1
- package/dist/junction.js +31 -12
- package/dist/junction.js.map +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/knowledge.js.map +1 -1
- package/dist/manifest/manifest-loader.d.ts.map +1 -1
- package/dist/manifest/manifest-loader.js +1 -1
- package/dist/manifest/manifest-loader.js.map +1 -1
- package/dist/manifest/static-manifest.d.ts.map +1 -1
- package/dist/manifest/static-manifest.js +106 -9
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.d.ts +8 -0
- package/dist/manifest/store.d.ts.map +1 -1
- package/dist/manifest/store.js +12 -2
- package/dist/manifest/store.js.map +1 -1
- package/dist/manifest.json +119 -9
- package/dist/migrations/differ.d.ts +3 -3
- package/dist/migrations/differ.d.ts.map +1 -1
- package/dist/migrations/differ.js +8 -4
- package/dist/migrations/differ.js.map +1 -1
- package/dist/object.d.ts +1 -0
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +19 -7
- package/dist/object.js.map +1 -1
- package/dist/registry/class-registration.d.ts.map +1 -1
- package/dist/registry/class-registration.js +75 -10
- package/dist/registry/class-registration.js.map +1 -1
- package/dist/registry/collection-resolution.d.ts +2 -2
- package/dist/registry/collection-resolution.d.ts.map +1 -1
- package/dist/registry/collection-resolution.js +2 -1
- package/dist/registry/collection-resolution.js.map +1 -1
- package/dist/registry/collision-policy.d.ts +8 -0
- package/dist/registry/collision-policy.d.ts.map +1 -1
- package/dist/registry/collision-policy.js +2 -2
- package/dist/registry/collision-policy.js.map +1 -1
- package/dist/registry/framework-base-classes.d.ts.map +1 -1
- package/dist/registry/framework-base-classes.js +2 -1
- package/dist/registry/framework-base-classes.js.map +1 -1
- package/dist/registry/schema-builder.d.ts.map +1 -1
- package/dist/registry/schema-builder.js +33 -4
- package/dist/registry/schema-builder.js.map +1 -1
- package/dist/registry/shared-state.d.ts +6 -0
- package/dist/registry/shared-state.d.ts.map +1 -1
- package/dist/registry/shared-state.js +12 -1
- package/dist/registry/shared-state.js.map +1 -1
- package/dist/registry/types.d.ts +7 -1
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry.d.ts +7 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +25 -3
- package/dist/registry.js.map +1 -1
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +5 -1
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/scanner/types.d.ts +8 -0
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/scanner/types.js.map +1 -1
- package/dist/schema/ddl/duckdb-strategy.d.ts.map +1 -1
- package/dist/schema/ddl/duckdb-strategy.js +1 -0
- package/dist/schema/ddl/duckdb-strategy.js.map +1 -1
- package/dist/schema/ddl/null-equal-index.d.ts.map +1 -1
- package/dist/schema/ddl/null-equal-index.js +4 -2
- package/dist/schema/ddl/null-equal-index.js.map +1 -1
- package/dist/schema/generator.d.ts +3 -0
- package/dist/schema/generator.d.ts.map +1 -1
- package/dist/schema/generator.js +38 -0
- package/dist/schema/generator.js.map +1 -1
- package/dist/smrt-knowledge.json +74 -20
- package/dist/sync/apply.d.ts +2 -0
- package/dist/sync/apply.d.ts.map +1 -1
- package/dist/sync/apply.js +7 -3
- package/dist/sync/apply.js.map +1 -1
- package/dist/utils/scanner-module.d.ts +9 -0
- package/dist/utils/scanner-module.d.ts.map +1 -1
- package/dist/vite-plugin/index.d.ts +14 -0
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +58 -18
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/package-stamp.d.ts +41 -0
- package/dist/vite-plugin/package-stamp.d.ts.map +1 -0
- package/dist/vite-plugin/package-stamp.js +33 -0
- package/dist/vite-plugin/package-stamp.js.map +1 -0
- package/dist/vite-plugin/sveltekit-generator.js +5 -3
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/dist/vite-plugin/sync-apply-route.d.ts.map +1 -1
- package/dist/vite-plugin/sync-apply-route.js +10 -0
- package/dist/vite-plugin/sync-apply-route.js.map +1 -1
- package/dist/vite-plugin.js +2 -2
- package/package.json +10 -10
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EACL,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACr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,CAAC;AAEvD,cAAc,iBAAiB,CAAC;AAGhC,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EACL,KAAK,EACL,cAAc,EACd,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,EACL,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EACZ,2BAA2B,EAC3B,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,22 +4,21 @@ import { MetricsAdapter } from "./adapters/metrics.js";
|
|
|
4
4
|
import { PubSubAdapter } from "./adapters/pubsub.js";
|
|
5
5
|
import "./adapters/index.js";
|
|
6
6
|
import { classifyDatabaseError, classifyDialectMessage, isAbortedTransactionError, isDeterministicDatabaseError, isNotNullViolationError, isTransientDatabaseError, isUniqueViolationError } from "./db-errors.js";
|
|
7
|
+
import { isEmbeddedDatabase, isPostgresDatabase, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue, withEmbeddedWriteTransaction } from "./embedded-write-queue.js";
|
|
7
8
|
import { AIError, ConfigurationError, DatabaseError, ErrorUtils, FilesystemError, NetworkError, RunOnceClaimError, RuntimeError, SmrtError, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils } from "./errors.js";
|
|
8
9
|
import { IN_LIST_CHUNK_SIZE, chunkArray } from "./utils/chunk.js";
|
|
9
10
|
import { toSnakeCase } from "./utils/naming.js";
|
|
10
11
|
import { buildCascadePlan, cascadeReferencesTo, normalizeOnDelete, runCascadeDelete } from "./cascade.js";
|
|
12
|
+
import { applyOneToManyChildAccessors, childAccessorName } from "./child-accessors.js";
|
|
11
13
|
import { CHANGE_FEED_CREDENTIAL_TABLES, declareChangeFeedSensitiveTable, getChangeFeedSensitiveTables, isChangeFeedSensitiveTable } from "./change-feed-sensitivity.js";
|
|
12
14
|
import { CACHE_INVALIDATION_CHANNEL, broadcastCacheInvalidation, ensureCacheInvalidationListener, getCacheGeneration, invalidateCollectionCache, resetCollectionCache, resolveDbCacheKey, stopCacheInvalidationListeners } from "./collection-cache.js";
|
|
13
15
|
import { CHANGE_SIGNAL_CHANNEL, resetChangeSignals, stopChangeSignalListeners, subscribeToChangeSignals } from "./change-signals.js";
|
|
14
16
|
import { isTenantScopedClassResolved, resolveDispatchTenantId, resolveDispatchTenantScope, setDispatchTenantResolver, setTenantScopedClassResolver } from "./dispatch/tenant-resolver.js";
|
|
15
|
-
import { isEmbeddedDatabase, isPostgresDatabase, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue, withEmbeddedWriteTransaction } from "./embedded-write-queue.js";
|
|
16
17
|
import { GlobalInterceptors, createInterceptorContext, resolveGetStringFilter } from "./interceptors.js";
|
|
17
18
|
import { detectEngine, generateDDLForEngine } from "./schema/ddl/index.js";
|
|
18
19
|
import { RUN_ONCE_CLAIMS_TABLE, SMRT_SCHEMA_VERSION } from "./system/schema.js";
|
|
19
20
|
import { SYSTEM_TABLE_NAMES, getSystemTableShapes } from "./schema/system-table-shapes.js";
|
|
20
21
|
import { CHANGE_FEED_INTERCEPTOR_NAME, CHANGE_FEED_TABLE, DEFAULT_CHANGES_LIMIT, MAX_CHANGES_LIMIT, appendChange, appendChanges, bumpChangeFeed, drainChangeFeed, ensureChangeFeedTable, getChangesSince, getTableVersion, getTenantScopedChangesSince, pruneChangeFeed, registerChangeFeedWriter, resetChangeFeedWarnings, unregisterChangeFeedWriter } from "./change-feed.js";
|
|
21
|
-
import { filterVisibleChangeFeedEntries, getAuthorizedChangesSince, getAuthorizedTenantScopedChangesSince, hasChangeFeedEntryVisibilityHook, hasChangeFeedTableAuthorizerHook, isChangeFeedDenyAll, isChangeFeedEntryVisible, resolveAuthorizedChangeFeedTables, setChangeFeedAuthorizer, setChangeFeedEntryVisibility } from "./change-feed-authz.js";
|
|
22
|
-
import { applyOneToManyChildAccessors, childAccessorName } from "./child-accessors.js";
|
|
23
22
|
import { config } from "./config.js";
|
|
24
23
|
import { executeDecision } from "./decisions.js";
|
|
25
24
|
import { importOptionalDependency, registerOptionalDependency } from "./lazy-external.js";
|
|
@@ -34,6 +33,8 @@ import { DEFAULT_EMBEDDING_CONFIG, EmbeddingProvider } from "./embeddings/provid
|
|
|
34
33
|
import { CosineSimilarity } from "./embeddings/similarity.js";
|
|
35
34
|
import { EmbeddingStorage } from "./embeddings/storage.js";
|
|
36
35
|
import { DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, MAX_LIST_LIMIT, QueryBoundsError, QueryOrderByError, buildDefaultListOrderBy, resolveListLimit, resolveListOffset } from "./query-bounds.js";
|
|
36
|
+
import { resetVerifiedTables } from "./table-cache.js";
|
|
37
|
+
import { DEFAULT_FACET_LIMIT, EmbeddingUnavailableError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, SmrtCollection } from "./collection.js";
|
|
37
38
|
import { applyPendingDecoratorRegistrations, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator } from "./decorators/compatibility.js";
|
|
38
39
|
import { clone, getAdapterInfo, isValid, parse, safeParse, safeStringify, stringify } from "./utils/json.js";
|
|
39
40
|
import { assertScopedPackageName, createQualifiedName, getClassName, getPackageFromQualifiedName, isFromPackage, isQualifiedName, isScopedPackageName, isType, parseQualifiedName, qualifiedNamesEqual } from "./utils/qualified-names.js";
|
|
@@ -45,14 +46,15 @@ import { ManifestManager } from "./manifest/manager.js";
|
|
|
45
46
|
import { discoverManifestEntry, findManifestEntryByQualifiedName, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync } from "./manifest/manifest-loader.js";
|
|
46
47
|
import { ContentHasher } from "./embeddings/hash.js";
|
|
47
48
|
import { POSTGRES_REVISION_GUARD_EXPRESSION, postgresRevisionCandidates, postgresRevisionCondition } from "./revision-guard.js";
|
|
48
|
-
import { resetVerifiedTables } from "./table-cache.js";
|
|
49
49
|
import { executeToolCall, executeToolCalls, formatToolResults, validateToolCall } from "./tools/tool-executor.js";
|
|
50
50
|
import { SmrtObject } from "./object.js";
|
|
51
51
|
import { isFrameworkBaseClass } from "./registry/framework-base-classes.js";
|
|
52
52
|
import { isDatabaseInterface, resolveDatabase } from "./database.js";
|
|
53
53
|
import { SMRT_COLLECTION_BASE_NAMES, isSmrtCollectionExtendsName } from "./registry/collection-resolution.js";
|
|
54
54
|
import { ObjectRegistry, smrt } from "./registry.js";
|
|
55
|
-
import {
|
|
55
|
+
import { auditChanges, auditSnapshot, getActiveAuditOptions, isAudited, requireAuditOptions, writeAudit } from "./audit.js";
|
|
56
|
+
import { withAuditContext } from "./audit-context.js";
|
|
57
|
+
import { filterVisibleChangeFeedEntries, getAuthorizedChangesSince, getAuthorizedTenantScopedChangesSince, hasChangeFeedEntryVisibilityHook, hasChangeFeedTableAuthorizerHook, isChangeFeedDenyAll, isChangeFeedEntryVisible, resolveAuthorizedChangeFeedTables, setChangeFeedAuthorizer, setChangeFeedEntryVisibility } from "./change-feed-authz.js";
|
|
56
58
|
import { executeCollectionReadPlan } from "./collection-read-plan.js";
|
|
57
59
|
import { DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, DataQueryValidationError, MAX_DATA_QUERY_CURSOR_LENGTH, MAX_DATA_QUERY_FACETS, MAX_DATA_QUERY_FILTERS, MAX_DATA_QUERY_FILTER_DEPTH, MAX_DATA_QUERY_IN_VALUES, MAX_DATA_QUERY_OFFSET, MAX_DATA_QUERY_PAGE_LIMIT, MAX_DATA_QUERY_REQUEST_BYTES, MAX_DATA_QUERY_RESULT_BYTES, MAX_DATA_QUERY_WARNINGS, canonicalizeDataQuery, createDataQueryFingerprint, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema } from "./data-query.js";
|
|
58
60
|
import { crossPackageRef, field, foreignKey, manyToMany, meta, method, oneToMany } from "./decorators/index.js";
|
|
@@ -75,7 +77,7 @@ import { APIGenerator, computeRuntimeWebManifestHash, createRestServer, startRes
|
|
|
75
77
|
import { generateOpenAPISpec, setupSwaggerUI } from "./generators/swagger.js";
|
|
76
78
|
import "./generators/index.js";
|
|
77
79
|
import { SmrtHierarchical } from "./hierarchical.js";
|
|
78
|
-
import { SmrtJunction } from "./junction.js";
|
|
80
|
+
import { SmrtJunction, SmrtJunctionBase } from "./junction.js";
|
|
79
81
|
import { resolveFileKnowledgeConfig } from "./knowledge-config.js";
|
|
80
82
|
import { discoverScopedPackageDirectories, readPackageAgentDoc } from "./knowledge-discovery.js";
|
|
81
83
|
import { buildKnowledgeGraph, checkKnowledgeGraphFreshness, discoverKnowledgeArtifactPaths, stableStringify } from "./knowledge-graph.js";
|
|
@@ -103,4 +105,4 @@ import "./system/index.js";
|
|
|
103
105
|
import { getTestDatabase } from "./testing/database.js";
|
|
104
106
|
import "./tools/index.js";
|
|
105
107
|
import { smrtPlugin } from "./vite-plugin/index.js";
|
|
106
|
-
export { AGENT_SURFACE_HASH_PREFIX, AIError, APIGenerator, AiUsageCollector, AiUsagePersistenceHandler, BOOTED_PROVENANCE, CACHE_INVALIDATION_CHANNEL, CHANGE_FEED_CREDENTIAL_TABLES, CHANGE_FEED_INTERCEPTOR_NAME, CHANGE_FEED_TABLE, CHANGE_SIGNAL_CHANNEL, CRUD_OPERATIONS, ConfigurationError, ContentHasher, CosineSimilarity, DEFAULT_AI_COST_RATES, DEFAULT_CHANGES_LIMIT, DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, DEFAULT_EMBEDDING_CONFIG, DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, DEFAULT_FACET_LIMIT, DEFAULT_LEARNING_CONFIG, DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, DEFAULT_POSTGRES_TIMEOUTS, DEFAULT_RETENTION_POLICY, DIAGNOSTICS_DEFAULT_LIMIT, DataQueryValidationError, DatabaseError, Dispatch, DispatchBus, DispatchCollection, DispatchSubscription, DispatchSubscriptionCollection, EmbeddingProvider, EmbeddingStorage, EmbeddingUnavailableError, ErrorUtils, FilesystemError, GlobalInterceptors, IN_LIST_CHUNK_SIZE, LearningMemory, LiveSchemaParityError, MAX_CHANGES_LIMIT, MAX_DATA_QUERY_CURSOR_LENGTH, MAX_DATA_QUERY_FACETS, MAX_DATA_QUERY_FILTERS, MAX_DATA_QUERY_FILTER_DEPTH, MAX_DATA_QUERY_IN_VALUES, MAX_DATA_QUERY_OFFSET, MAX_DATA_QUERY_PAGE_LIMIT, MAX_DATA_QUERY_REQUEST_BYTES, MAX_DATA_QUERY_RESULT_BYTES, MAX_DATA_QUERY_WARNINGS, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_LIST_LIMIT, MAX_STI_READ_SCOPE_TYPES, MAX_SYNC_APPLY_BATCH_SIZE, MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, MODULE_DOC_HASH_PREFIX, ManifestBuilder, ManifestGenerator, ManifestManager, MetricsAdapter, NetworkError, ObjectRegistry, PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, POSTGRES_REVISION_GUARD_EXPRESSION, POSTGRES_TIMEOUT_ENV_VARS, PRIVATE_READ_CACHE_CONTROL, PubSubAdapter, QueryBoundsError, QueryOrderByError, RUN_ONCE_CLAIMS_TABLE, RunOnceClaimError, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, SMRT_SCHEMA_VERSION, SYNC_APPLY_ROUTE_SEGMENTS, SYNC_APPLY_UUID_PATTERN, SYSTEM_DIAGNOSTICS_TABLES, SYSTEM_TABLE_NAMES, SchemaComparer, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtMCPServer, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, appendChange, appendChanges, applyOneToManyChildAccessors, applyPendingDecoratorRegistrations, applyPostgresPermissions, applyPostgresRuntimeTimeouts, applySyncWritablePolicy, assertPlainJson, assertPostgresSystemTimestampsCurrent, assertScopedPackageName, broadcastCacheInvalidation, buildCascadePlan, buildChangeEventStream, buildCustomActionInputSchema, buildCustomActionInvocationArgs, buildDefaultListOrderBy, buildDomainKnowledgeManifest, buildKnowledgeGraph, bumpChangeFeed, canonicalReadRepresentation, canonicalizeDataQuery, cascadeReferencesTo, changeEventSubscribersAtCapacity, checkKnowledgeGraphFreshness, checkLiveSchemaParity, childAccessorName, chunkArray, classifyDatabaseError, classifyDialectMessage, classifyMethodWireability, classifyParameterWireability, clearRetentionTasks, clone, coerceCustomActionArgument, collectForeignKeyOrphanCounts, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, config, convertTypeToJsonSchema, createClassNamePredicate, createDataQueryFingerprint, createDispatchBus, createFilesystemAdapter, createGeneratedCollectionAccess, createInterceptorContext, createMCPServer, createManifestClassNamePredicate, createQualifiedName, createRestServer, createSmrtClient, createSmrtServer, crossPackageRef, customActionParameterInputName, declareChangeFeedSensitiveTable, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, deriveRunOnceClaimKey, detectEngine, digestRunOnceContent, discoverKnowledgeArtifactPaths, discoverManifestEntry, discoverScopedPackageDirectories, drainChangeFeed, ensureBootstrapSystemTableCompatibility, ensureCacheInvalidationListener, ensureChangeFeedTable, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, eventStreamCapacityExceededResponse, executeCollectionReadPlan, executeDecision, executeToolCall, executeToolCalls, field, filterVisibleChangeFeedEntries, findManifestEntryByQualifiedName, foreignKey, formatToolResults, generateDDLForEngine, generateOpenAPISpec, generateSchemaDiff, generateToolFromMethod, generateToolManifest, getAdapterInfo, getAuthorizedChangesSince, getAuthorizedTenantScopedChangesSince, getCacheGeneration, getChangeFeedSensitiveTables, getChangesSince, getClassConfigResolvers, getClassName, getConfigResolver, getDatabaseEngine, getManifest, getPackageFromQualifiedName, getRetentionTasks, getSQLFromDiff, getSystemTableShapes, getTableVersion, getTenantScopedChangesSince, getTestDatabase, handlePlaybookPreflightRoute, hasActionableChanges, hasChangeFeedEntryVisibilityHook, hasChangeFeedTableAuthorizerHook, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, importOptionalDependency, invalidateCollectionCache, isAbortedTransactionError, isAdvisoryOnlyChange, isApiActionEnabledForObject, isChangeFeedDenyAll, isChangeFeedEntryVisible, isChangeFeedSensitiveTable, isCrudOperation, isCrudToolAction, isDatabaseInterface, isDeterministicDatabaseError, isEmbeddedDatabase, isFrameworkBaseClass, isFromPackage, isLazyConfigSentinel, isManualOrAdvisoryChange, isNotNullViolationError, isPostgresDatabase, isQualifiedName, isRestActionRoutable, isRestRoutePublic, isScopedPackageName, isSmrtCollectionExtendsName, isStaleWrite, isTenantScopedClassResolved, isTransientDatabaseError, isType, isUniqueViolationError, isValid, listConfigResolvers, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync, manifest, manyToMany, meta, method, migratePostgresSystemTimestamps, normalizeCustomActionFailure, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema, normalizeEventsMaxSubscribers, normalizeOnDelete, normalizeTypedHttpError, oneToMany, parse, parseQualifiedName, parseSyncApplyBatch, payloadMatchesRow, planForeignKeyCreation, planPostgresPermissions, planPostgresSystemTimestampMigrations, postgresRevisionCandidates, postgresRevisionCondition, processSyncApplyBatch, pruneAiUsage, pruneChangeFeed, pruneExpiredContexts, pruneRunOnceClaims, publishArtifactFiles, publishAtomicArtifact, qualifiedNamesEqual, queryStringDecoderFor, readAgentModuleDocs, readDispatchHealth, readJobHealth, readMethodDecoratorConfig, readMigrationStatus, readPackageAgentDoc, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics, registerChangeFeedWriter, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator, registerConfigResolver, registerFilesystemAdapterFactory, registerOptionalDependency, registerRetentionTask, resetChangeFeedWarnings, resetChangeSignals, resetCollectionCache, resetConfigResolvers, resetVerifiedTables, resolveAgentModuleDocPaths, resolveApiMethodExposure, resolveAuthorizedChangeFeedTables, resolveCustomActionMetadata, resolveDatabase, resolveDbCacheKey, resolveDeclaredScopeMismatch, resolveDispatchTenantId, resolveDispatchTenantScope, resolveEffectiveActionMetadata, resolveExistingRunOnceClaim, resolveFileKnowledgeConfig, resolveGetStringFilter, resolveLazyConfig, resolveListLimit, resolveListOffset, resolveMCPToolListCacheHint, resolvePostgresTimeouts, resolveReadCacheControl, resolveRegisteredObjectName, resolveTenantEtagDiscriminator, restFieldReadPermissions, restMethodForApiAction, runCascadeDelete, runOnce, runRetentionSweep, runWithTenantGate, safeParse, safeStringify, sanitizeMessagePaths, setChangeFeedAuthorizer, setChangeFeedEntryVisibility, setDispatchTenantResolver, setTenantEntryPointRunner, setTenantScopedClassResolver, setupSwaggerUI, shouldIncludeMethod, signalVisibleToTenant, smrt, smrtPlugin, smrt as smrtRegistry, snapshotRegistry, sortMCPTools, stableStringify, startRestServer, staticManifest, stopCacheInvalidationListeners, stopChangeSignalListeners, stringify, subscribeToChangeSignals, tableExists, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber, toSnakeCase, tryReserveChangeEventSubscriberSlot, unregisterChangeFeedWriter, unregisterConfigResolver, unregisterRetentionTask, usesEmbeddedRevisionFallback, validatePostgresPermissionContract, validateSyncApplyItem, validateToolCall, versionConditionalResponse, warnIfSharedCacheNeutralized, withEmbeddedWriteQueue, withEmbeddedWriteTransaction };
|
|
108
|
+
export { AGENT_SURFACE_HASH_PREFIX, AIError, APIGenerator, AiUsageCollector, AiUsagePersistenceHandler, BOOTED_PROVENANCE, CACHE_INVALIDATION_CHANNEL, CHANGE_FEED_CREDENTIAL_TABLES, CHANGE_FEED_INTERCEPTOR_NAME, CHANGE_FEED_TABLE, CHANGE_SIGNAL_CHANNEL, CRUD_OPERATIONS, ConfigurationError, ContentHasher, CosineSimilarity, DEFAULT_AI_COST_RATES, DEFAULT_CHANGES_LIMIT, DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, DEFAULT_EMBEDDING_CONFIG, DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, DEFAULT_FACET_LIMIT, DEFAULT_LEARNING_CONFIG, DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, DEFAULT_POSTGRES_TIMEOUTS, DEFAULT_RETENTION_POLICY, DIAGNOSTICS_DEFAULT_LIMIT, DataQueryValidationError, DatabaseError, Dispatch, DispatchBus, DispatchCollection, DispatchSubscription, DispatchSubscriptionCollection, EmbeddingProvider, EmbeddingStorage, EmbeddingUnavailableError, ErrorUtils, FilesystemError, GlobalInterceptors, IN_LIST_CHUNK_SIZE, LearningMemory, LiveSchemaParityError, MAX_CHANGES_LIMIT, MAX_DATA_QUERY_CURSOR_LENGTH, MAX_DATA_QUERY_FACETS, MAX_DATA_QUERY_FILTERS, MAX_DATA_QUERY_FILTER_DEPTH, MAX_DATA_QUERY_IN_VALUES, MAX_DATA_QUERY_OFFSET, MAX_DATA_QUERY_PAGE_LIMIT, MAX_DATA_QUERY_REQUEST_BYTES, MAX_DATA_QUERY_RESULT_BYTES, MAX_DATA_QUERY_WARNINGS, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_LIST_LIMIT, MAX_STI_READ_SCOPE_TYPES, MAX_SYNC_APPLY_BATCH_SIZE, MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, MODULE_DOC_HASH_PREFIX, ManifestBuilder, ManifestGenerator, ManifestManager, MetricsAdapter, NetworkError, ObjectRegistry, PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, POSTGRES_REVISION_GUARD_EXPRESSION, POSTGRES_TIMEOUT_ENV_VARS, PRIVATE_READ_CACHE_CONTROL, PubSubAdapter, QueryBoundsError, QueryOrderByError, RUN_ONCE_CLAIMS_TABLE, RunOnceClaimError, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, SMRT_SCHEMA_VERSION, SYNC_APPLY_ROUTE_SEGMENTS, SYNC_APPLY_UUID_PATTERN, SYSTEM_DIAGNOSTICS_TABLES, SYSTEM_TABLE_NAMES, SchemaComparer, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtJunctionBase, SmrtMCPServer, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, appendChange, appendChanges, applyOneToManyChildAccessors, applyPendingDecoratorRegistrations, applyPostgresPermissions, applyPostgresRuntimeTimeouts, applySyncWritablePolicy, assertPlainJson, assertPostgresSystemTimestampsCurrent, assertScopedPackageName, auditChanges, auditSnapshot, broadcastCacheInvalidation, buildCascadePlan, buildChangeEventStream, buildCustomActionInputSchema, buildCustomActionInvocationArgs, buildDefaultListOrderBy, buildDomainKnowledgeManifest, buildKnowledgeGraph, bumpChangeFeed, canonicalReadRepresentation, canonicalizeDataQuery, cascadeReferencesTo, changeEventSubscribersAtCapacity, checkKnowledgeGraphFreshness, checkLiveSchemaParity, childAccessorName, chunkArray, classifyDatabaseError, classifyDialectMessage, classifyMethodWireability, classifyParameterWireability, clearRetentionTasks, clone, coerceCustomActionArgument, collectForeignKeyOrphanCounts, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, config, convertTypeToJsonSchema, createClassNamePredicate, createDataQueryFingerprint, createDispatchBus, createFilesystemAdapter, createGeneratedCollectionAccess, createInterceptorContext, createMCPServer, createManifestClassNamePredicate, createQualifiedName, createRestServer, createSmrtClient, createSmrtServer, crossPackageRef, customActionParameterInputName, declareChangeFeedSensitiveTable, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, deriveRunOnceClaimKey, detectEngine, digestRunOnceContent, discoverKnowledgeArtifactPaths, discoverManifestEntry, discoverScopedPackageDirectories, drainChangeFeed, ensureBootstrapSystemTableCompatibility, ensureCacheInvalidationListener, ensureChangeFeedTable, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, eventStreamCapacityExceededResponse, executeCollectionReadPlan, executeDecision, executeToolCall, executeToolCalls, field, filterVisibleChangeFeedEntries, findManifestEntryByQualifiedName, foreignKey, formatToolResults, generateDDLForEngine, generateOpenAPISpec, generateSchemaDiff, generateToolFromMethod, generateToolManifest, getActiveAuditOptions, getAdapterInfo, getAuthorizedChangesSince, getAuthorizedTenantScopedChangesSince, getCacheGeneration, getChangeFeedSensitiveTables, getChangesSince, getClassConfigResolvers, getClassName, getConfigResolver, getDatabaseEngine, getManifest, getPackageFromQualifiedName, getRetentionTasks, getSQLFromDiff, getSystemTableShapes, getTableVersion, getTenantScopedChangesSince, getTestDatabase, handlePlaybookPreflightRoute, hasActionableChanges, hasChangeFeedEntryVisibilityHook, hasChangeFeedTableAuthorizerHook, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, importOptionalDependency, invalidateCollectionCache, isAbortedTransactionError, isAdvisoryOnlyChange, isApiActionEnabledForObject, isAudited, isChangeFeedDenyAll, isChangeFeedEntryVisible, isChangeFeedSensitiveTable, isCrudOperation, isCrudToolAction, isDatabaseInterface, isDeterministicDatabaseError, isEmbeddedDatabase, isFrameworkBaseClass, isFromPackage, isLazyConfigSentinel, isManualOrAdvisoryChange, isNotNullViolationError, isPostgresDatabase, isQualifiedName, isRestActionRoutable, isRestRoutePublic, isScopedPackageName, isSmrtCollectionExtendsName, isStaleWrite, isTenantScopedClassResolved, isTransientDatabaseError, isType, isUniqueViolationError, isValid, listConfigResolvers, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync, manifest, manyToMany, meta, method, migratePostgresSystemTimestamps, normalizeCustomActionFailure, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema, normalizeEventsMaxSubscribers, normalizeOnDelete, normalizeTypedHttpError, oneToMany, parse, parseQualifiedName, parseSyncApplyBatch, payloadMatchesRow, planForeignKeyCreation, planPostgresPermissions, planPostgresSystemTimestampMigrations, postgresRevisionCandidates, postgresRevisionCondition, processSyncApplyBatch, pruneAiUsage, pruneChangeFeed, pruneExpiredContexts, pruneRunOnceClaims, publishArtifactFiles, publishAtomicArtifact, qualifiedNamesEqual, queryStringDecoderFor, readAgentModuleDocs, readDispatchHealth, readJobHealth, readMethodDecoratorConfig, readMigrationStatus, readPackageAgentDoc, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics, registerChangeFeedWriter, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator, registerConfigResolver, registerFilesystemAdapterFactory, registerOptionalDependency, registerRetentionTask, requireAuditOptions, resetChangeFeedWarnings, resetChangeSignals, resetCollectionCache, resetConfigResolvers, resetVerifiedTables, resolveAgentModuleDocPaths, resolveApiMethodExposure, resolveAuthorizedChangeFeedTables, resolveCustomActionMetadata, resolveDatabase, resolveDbCacheKey, resolveDeclaredScopeMismatch, resolveDispatchTenantId, resolveDispatchTenantScope, resolveEffectiveActionMetadata, resolveExistingRunOnceClaim, resolveFileKnowledgeConfig, resolveGetStringFilter, resolveLazyConfig, resolveListLimit, resolveListOffset, resolveMCPToolListCacheHint, resolvePostgresTimeouts, resolveReadCacheControl, resolveRegisteredObjectName, resolveTenantEtagDiscriminator, restFieldReadPermissions, restMethodForApiAction, runCascadeDelete, runOnce, runRetentionSweep, runWithTenantGate, safeParse, safeStringify, sanitizeMessagePaths, setChangeFeedAuthorizer, setChangeFeedEntryVisibility, setDispatchTenantResolver, setTenantEntryPointRunner, setTenantScopedClassResolver, setupSwaggerUI, shouldIncludeMethod, signalVisibleToTenant, smrt, smrtPlugin, smrt as smrtRegistry, snapshotRegistry, sortMCPTools, stableStringify, startRestServer, staticManifest, stopCacheInvalidationListeners, stopChangeSignalListeners, stringify, subscribeToChangeSignals, tableExists, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber, toSnakeCase, tryReserveChangeEventSubscriberSlot, unregisterChangeFeedWriter, unregisterConfigResolver, unregisterRetentionTask, usesEmbeddedRevisionFallback, validatePostgresPermissionContract, validateSyncApplyItem, validateToolCall, versionConditionalResponse, warnIfSharedCacheNeutralized, withAuditContext, withEmbeddedWriteQueue, withEmbeddedWriteTransaction, writeAudit };
|
package/dist/junction.d.ts
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* Each subclass declares `leftField` / `rightField` (camelCase) and optionally
|
|
17
17
|
* overrides `sortField` (defaults to `'sortOrder'`; set `null` to disable ORDER BY).
|
|
18
18
|
*
|
|
19
|
-
* Polymorphic
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* Polymorphic collections with a composite left key extend `SmrtJunctionBase`
|
|
20
|
+
* and declare their own owner methods — see `AssetAssociationCollection`.
|
|
21
|
+
* `SmrtJunction` retains the single-left-ID method contract.
|
|
22
22
|
*
|
|
23
23
|
* @typeParam TItem - The junction row class (extends `SmrtObject`)
|
|
24
24
|
*/
|
|
@@ -44,7 +44,16 @@ export type JunctionFilterOptions = Record<string, unknown> & {
|
|
|
44
44
|
limit?: number;
|
|
45
45
|
offset?: number;
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Shared junction collection identity, ordering, and single-right-ID reads.
|
|
49
|
+
*
|
|
50
|
+
* Composite-owner collections extend this base and declare their own owner
|
|
51
|
+
* methods. Single-owner collections extend `SmrtJunction` instead. This base
|
|
52
|
+
* intentionally has no left-owner methods with an incompatible call shape.
|
|
53
|
+
*
|
|
54
|
+
* @typeParam TItem - The junction row class.
|
|
55
|
+
*/
|
|
56
|
+
export declare abstract class SmrtJunctionBase<TItem extends SmrtObject> extends SmrtCollection<TItem> {
|
|
48
57
|
/**
|
|
49
58
|
* Internal marker used by `SmrtCollection.create` to detect that this
|
|
50
59
|
* subclass is a junction and apply a registration-presence guard. Static
|
|
@@ -52,8 +61,6 @@ export declare abstract class SmrtJunction<TItem extends SmrtObject> extends Smr
|
|
|
52
61
|
* Don't rename or remove without also updating the guard.
|
|
53
62
|
*/
|
|
54
63
|
static readonly _isJunctionBase: true;
|
|
55
|
-
/** Field name (camelCase) holding the "left" foreign key, e.g. `'contentId'`. */
|
|
56
|
-
protected abstract leftField: string;
|
|
57
64
|
/** Field name (camelCase) holding the "right" foreign key, e.g. `'assetId'`. */
|
|
58
65
|
protected abstract rightField: string;
|
|
59
66
|
/**
|
|
@@ -80,15 +87,27 @@ export declare abstract class SmrtJunction<TItem extends SmrtObject> extends Smr
|
|
|
80
87
|
*/
|
|
81
88
|
protected positionField: string | null;
|
|
82
89
|
/**
|
|
83
|
-
* Return junction rows where the
|
|
90
|
+
* Return junction rows where the right FK matches `rightId`, narrowed by
|
|
84
91
|
* optional additional WHERE filters. Ordered ASC by `sortField` if set.
|
|
85
92
|
*/
|
|
86
|
-
|
|
93
|
+
byRight(rightId: string, opts?: JunctionFilterOptions): Promise<TItem[]>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Junction collection with one left ID and one right ID.
|
|
97
|
+
*
|
|
98
|
+
* Existing subclasses retain their named method parameters and persistence
|
|
99
|
+
* behavior. Use `SmrtJunctionBase` for a collection with a composite owner.
|
|
100
|
+
*
|
|
101
|
+
* @typeParam TItem - The junction row class.
|
|
102
|
+
*/
|
|
103
|
+
export declare abstract class SmrtJunction<TItem extends SmrtObject> extends SmrtJunctionBase<TItem> {
|
|
104
|
+
/** Field name (camelCase) holding the "left" foreign key, e.g. `'contentId'`. */
|
|
105
|
+
protected abstract leftField: string;
|
|
87
106
|
/**
|
|
88
|
-
* Return junction rows where the
|
|
107
|
+
* Return junction rows where the left FK matches `leftId`, narrowed by
|
|
89
108
|
* optional additional WHERE filters. Ordered ASC by `sortField` if set.
|
|
90
109
|
*/
|
|
91
|
-
|
|
110
|
+
byLeft(leftId: string, opts?: JunctionFilterOptions): Promise<TItem[]>;
|
|
92
111
|
/**
|
|
93
112
|
* Create a new junction row linking `leftId` ↔ `rightId`.
|
|
94
113
|
*
|
package/dist/junction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"junction.d.ts","sourceRoot":"","sources":["../src/junction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CA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GG;IACG,OAAO,CACX,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;CAWpB;AAED;;;;;;;GAOG;AACH,8BAAsB,YAAY,CAChC,KAAK,SAAS,UAAU,CACxB,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IAC/B,iFAAiF;IACjF,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;IAenB;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,KAAK,CAAC;IAWjB;;;;OAIG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,IAAI,CAAC;IAkBhB;;;;;;;;;;;;;OAaG;IACG,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,IAAI,CAAC;CAuDjB"}
|
package/dist/junction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalInterceptors } from "./interceptors.js";
|
|
2
|
-
import { SmrtObject } from "./object.js";
|
|
3
2
|
import { SmrtCollection } from "./collection.js";
|
|
3
|
+
import { SmrtObject } from "./object.js";
|
|
4
4
|
//#region src/junction.ts
|
|
5
5
|
/**
|
|
6
6
|
* SmrtJunction — base class for two-sided junction (many-to-many) collections.
|
|
@@ -20,16 +20,25 @@ import { SmrtCollection } from "./collection.js";
|
|
|
20
20
|
* Each subclass declares `leftField` / `rightField` (camelCase) and optionally
|
|
21
21
|
* overrides `sortField` (defaults to `'sortOrder'`; set `null` to disable ORDER BY).
|
|
22
22
|
*
|
|
23
|
-
* Polymorphic
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Polymorphic collections with a composite left key extend `SmrtJunctionBase`
|
|
24
|
+
* and declare their own owner methods — see `AssetAssociationCollection`.
|
|
25
|
+
* `SmrtJunction` retains the single-left-ID method contract.
|
|
26
26
|
*
|
|
27
27
|
* @typeParam TItem - The junction row class (extends `SmrtObject`)
|
|
28
28
|
*/
|
|
29
29
|
function camelToSnake(name) {
|
|
30
30
|
return name.replace(/[A-Z]/g, (m) => `_${m.toLowerCase()}`);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Shared junction collection identity, ordering, and single-right-ID reads.
|
|
34
|
+
*
|
|
35
|
+
* Composite-owner collections extend this base and declare their own owner
|
|
36
|
+
* methods. Single-owner collections extend `SmrtJunction` instead. This base
|
|
37
|
+
* intentionally has no left-owner methods with an incompatible call shape.
|
|
38
|
+
*
|
|
39
|
+
* @typeParam TItem - The junction row class.
|
|
40
|
+
*/
|
|
41
|
+
var SmrtJunctionBase = class extends SmrtCollection {
|
|
33
42
|
/**
|
|
34
43
|
* Internal marker used by `SmrtCollection.create` to detect that this
|
|
35
44
|
* subclass is a junction and apply a registration-presence guard. Static
|
|
@@ -61,31 +70,41 @@ var SmrtJunction = class SmrtJunction extends SmrtCollection {
|
|
|
61
70
|
*/
|
|
62
71
|
positionField = "sortOrder";
|
|
63
72
|
/**
|
|
64
|
-
* Return junction rows where the
|
|
73
|
+
* Return junction rows where the right FK matches `rightId`, narrowed by
|
|
65
74
|
* optional additional WHERE filters. Ordered ASC by `sortField` if set.
|
|
66
75
|
*/
|
|
67
|
-
async
|
|
76
|
+
async byRight(rightId, opts = {}) {
|
|
68
77
|
const { limit, offset, ...where } = opts;
|
|
69
78
|
return await this.list({
|
|
70
79
|
where: {
|
|
71
80
|
...where,
|
|
72
|
-
[this.
|
|
81
|
+
[this.rightField]: rightId
|
|
73
82
|
},
|
|
74
83
|
limit,
|
|
75
84
|
offset,
|
|
76
85
|
...this.sortField ? { orderBy: `${camelToSnake(this.sortField)} ASC` } : {}
|
|
77
86
|
});
|
|
78
87
|
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Junction collection with one left ID and one right ID.
|
|
91
|
+
*
|
|
92
|
+
* Existing subclasses retain their named method parameters and persistence
|
|
93
|
+
* behavior. Use `SmrtJunctionBase` for a collection with a composite owner.
|
|
94
|
+
*
|
|
95
|
+
* @typeParam TItem - The junction row class.
|
|
96
|
+
*/
|
|
97
|
+
var SmrtJunction = class SmrtJunction extends SmrtJunctionBase {
|
|
79
98
|
/**
|
|
80
|
-
* Return junction rows where the
|
|
99
|
+
* Return junction rows where the left FK matches `leftId`, narrowed by
|
|
81
100
|
* optional additional WHERE filters. Ordered ASC by `sortField` if set.
|
|
82
101
|
*/
|
|
83
|
-
async
|
|
102
|
+
async byLeft(leftId, opts = {}) {
|
|
84
103
|
const { limit, offset, ...where } = opts;
|
|
85
104
|
return await this.list({
|
|
86
105
|
where: {
|
|
87
106
|
...where,
|
|
88
|
-
[this.
|
|
107
|
+
[this.leftField]: leftId
|
|
89
108
|
},
|
|
90
109
|
limit,
|
|
91
110
|
offset,
|
|
@@ -179,6 +198,6 @@ var SmrtJunction = class SmrtJunction extends SmrtCollection {
|
|
|
179
198
|
}
|
|
180
199
|
};
|
|
181
200
|
//#endregion
|
|
182
|
-
export { SmrtJunction };
|
|
201
|
+
export { SmrtJunction, SmrtJunctionBase };
|
|
183
202
|
|
|
184
203
|
//# sourceMappingURL=junction.js.map
|
package/dist/junction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"junction.js","names":[],"sources":["../src/junction.ts"],"sourcesContent":["/**\n * SmrtJunction — base class for two-sided junction (many-to-many) collections.\n *\n * A junction collection manages rows that link a \"left\" entity to a \"right\" entity,\n * typically with discriminator fields (relationship/role) and an optional sortOrder.\n * Examples in the monorepo:\n *\n * | Subclass | Left field | Right field | Discriminator |\n * |--------------------------------|---------------|-------------|-----------------|\n * | ContentAssetCollection | contentId | assetId | relationship |\n * | PerformerOwnedAssetCollection | performerId | assetId | role |\n * | PlaceAssetCollection | placeId | assetId | relationship |\n * | EventParticipantCollection | eventId | profileId | role |\n * | FactContentCollection | factId | contentId | relationship |\n *\n * Each subclass declares `leftField` / `rightField` (camelCase) and optionally\n * overrides `sortField` (defaults to `'sortOrder'`; set `null` to disable ORDER BY).\n *\n * Polymorphic subclasses (where \"left\" or \"right\" is a composite key like\n * `metaType + metaId`) may override `byLeft` / `byRight` / `attach` / `detach`\n * with diverging signatures — see `AssetAssociationCollection` for a reference.\n *\n * @typeParam TItem - The junction row class (extends `SmrtObject`)\n */\n\nimport { SmrtCollection, type SmrtCreateInput } from './collection';\nimport { GlobalInterceptors } from './interceptors';\nimport { SmrtObject } from './object';\n\n/**\n * Options passed to `attach` / `setLinks` — written into the created junction row.\n *\n * Common keys: `relationship`, `role`, `sortOrder`, `tenantId`.\n * Subclass-specific keys (e.g. `placement`, `groupId` on EventParticipant) pass through.\n * Keys must match actual camelCase column names on the junction model; unknown\n * keys are rejected by `SmrtCollection.create`'s WHERE/field validation.\n */\nexport type JunctionAttachOptions = Record<string, unknown>;\n\n/**\n * Options passed to `byLeft` / `byRight` / `detach`.\n *\n * `limit` and `offset` bound reads made through `byLeft` / `byRight`; all\n * remaining keys are additional WHERE filters narrowing the operation. Keys\n * must match camelCase column names.\n */\nexport type JunctionFilterOptions = Record<string, unknown> & {\n limit?: number;\n offset?: number;\n};\n\nfunction camelToSnake(name: string): string {\n return name.replace(/[A-Z]/g, (m) => `_${m.toLowerCase()}`);\n}\n\nexport abstract class SmrtJunction<\n TItem extends SmrtObject,\n> extends SmrtCollection<TItem> {\n /**\n * Internal marker used by `SmrtCollection.create` to detect that this\n * subclass is a junction and apply a registration-presence guard. Static\n * property is inherited by all subclasses via the constructor chain.\n * Don't rename or remove without also updating the guard.\n */\n static readonly _isJunctionBase = true as const;\n\n /** Field name (camelCase) holding the \"left\" foreign key, e.g. `'contentId'`. */\n protected abstract leftField: string;\n\n /** Field name (camelCase) holding the \"right\" foreign key, e.g. `'assetId'`. */\n protected abstract rightField: string;\n\n /**\n * Field name (camelCase) used to ORDER BY when calling `byLeft` / `byRight`.\n * Defaults to `'sortOrder'`. Set to `null` to omit ORDER BY entirely.\n *\n * Independent from `positionField` — `sortField` is a *query* concern\n * (how rows are ordered when read), while `positionField` is a *write*\n * concern (what column `setLinks` auto-assigns to). Tables that order\n * by a non-position field (e.g. `'createdAt'`) should set `sortField`\n * accordingly and leave `positionField` set to `null` or its dedicated\n * position column name.\n */\n protected sortField: string | null = 'sortOrder';\n\n /**\n * Field name (camelCase) that `setLinks` auto-assigns the array index\n * to when the caller doesn't supply a value. Defaults to `'sortOrder'`.\n * Set to `null` for tables without a dedicated position column (e.g.\n * pure-key junctions, or tables ordered by timestamps).\n *\n * Writing the array index into a non-position field — like `createdAt`\n * or `placement` — would corrupt data. Subclasses without a numeric\n * position column MUST set this to `null`.\n */\n protected positionField: string | null = 'sortOrder';\n\n /**\n * Return junction rows where the left FK matches `leftId`, narrowed by\n * optional additional WHERE filters. Ordered ASC by `sortField` if set.\n */\n async byLeft(\n leftId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<TItem[]> {\n const { limit, offset, ...where } = opts;\n return (await this.list({\n // Spread opts FIRST so the fixed key always wins — prevents a\n // caller-supplied `{ [leftField]: otherId }` from retargeting the\n // query when opts is forwarded from untrusted input.\n where: { ...where, [this.leftField]: leftId },\n limit,\n offset,\n ...(this.sortField\n ? { orderBy: `${camelToSnake(this.sortField)} ASC` }\n : {}),\n })) as TItem[];\n }\n\n /**\n * Return junction rows where the right FK matches `rightId`, narrowed by\n * optional additional WHERE filters. Ordered ASC by `sortField` if set.\n */\n async byRight(\n rightId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<TItem[]> {\n const { limit, offset, ...where } = opts;\n return (await this.list({\n where: { ...where, [this.rightField]: rightId },\n limit,\n offset,\n ...(this.sortField\n ? { orderBy: `${camelToSnake(this.sortField)} ASC` }\n : {}),\n })) as TItem[];\n }\n\n /**\n * Create a new junction row linking `leftId` ↔ `rightId`.\n *\n * Goes through `SmrtCollection.create` which performs an upsert keyed on\n * the model's `@smrt({ conflictColumns })`. Duplicates on the conflict key\n * resolve to an UPDATE that rewrites every column — including the row's\n * `id` and any timestamp columns — to the new instance's values. For most\n * junctions that's fine: callers identify rows by (left, right, discriminator),\n * not by junction-row-id, so id rewrites are invisible.\n *\n * If your junction table is externally addressable by id (e.g. its rows\n * are exposed under `/api/v1/<table>/[id]`), override this method with a\n * find-or-create check to preserve id stability across duplicate calls.\n * See `ContentReferences.attach` for an example.\n *\n * @param opts - Extra fields to write into the row (e.g. `{ relationship, sortOrder, tenantId }`)\n */\n async attach(\n leftId: string,\n rightId: string,\n opts: JunctionAttachOptions = {},\n ): Promise<TItem> {\n return (await this.create({\n // Spread opts FIRST so the fixed key fields always win — prevents\n // a caller-supplied `{ [leftField]: otherId }` from retargeting\n // the write when opts is forwarded from untrusted input.\n ...opts,\n [this.leftField]: leftId,\n [this.rightField]: rightId,\n } as SmrtCreateInput<TItem>)) as TItem;\n }\n\n /**\n * Delete all junction rows matching `leftId` + `rightId` (+ optional filter `opts`).\n *\n * @param opts - Additional WHERE filters (e.g. `{ relationship: 'thumbnail' }`)\n */\n async detach(\n leftId: string,\n rightId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<void> {\n // Read bounds never narrow the mutation snapshot.\n const filters = { ...opts };\n delete filters.limit;\n delete filters.offset;\n const links = (await this.list({\n where: {\n ...filters,\n [this.leftField]: leftId,\n [this.rightField]: rightId,\n },\n })) as TItem[];\n if (await SmrtObject.tryJunctionBatch(links, [])) return;\n for (const link of links) {\n await (link as unknown as { delete(): Promise<void> }).delete();\n }\n }\n\n /**\n * Replace the full set of right-side rows for a `leftId`, scoped by `opts`.\n *\n * Behavior:\n * 1. Snapshots and deletes existing rows matching `{ leftField: leftId, ...opts }`.\n * 2. Creates a new row for each `rightId`, spreading `opts` into the row data.\n * 3. If `positionField` is set and `opts` doesn't specify it, assigns the array index.\n *\n * Compatible models use grouped persistence while preserving delete/create\n * identity and feed semantics. Unsupported hooks, overrides, shapes, or batch\n * bounds retain the sequential path; see agents/object-runtime.md.\n * Not transactional — partial failure leaves the table in a mixed state.\n * For atomic replaces, wrap the call in your own DB transaction.\n */\n async setLinks(\n leftId: string,\n rightIds: string[],\n opts: JunctionAttachOptions = {},\n ): Promise<void> {\n // Strip the right-side key from snapshot opts — leaving it in would\n // narrow the delete to one specific right id, but `setLinks` is\n // contractually \"replace the full set of right rows for leftId\n // within the opts scope\". A rightField filter contradicts that.\n const snapshotOpts: JunctionAttachOptions = { ...opts };\n delete snapshotOpts[this.rightField];\n\n const existing = (await this.list({\n where: { ...snapshotOpts, [this.leftField]: leftId },\n })) as TItem[];\n // Custom create/attach implementations remain authoritative. No opt-in is\n // inferred from a method name, class name, or interceptor registration name.\n if (\n SmrtObject.hasBaseJunctionLifecycle(this._itemClass.prototype) &&\n GlobalInterceptors.supportsBulkMutation(\n this.getResolvedItemClassName(),\n ) &&\n new Set(rightIds).size === rightIds.length &&\n this.attach === SmrtJunction.prototype.attach &&\n SmrtCollection.hasBaseCreateLifecycle(this) &&\n rightIds.length + existing.length <= 100 &&\n !Object.keys(opts).some(\n (key) =>\n key.startsWith('_') || ['db', 'ai', 'id', 'slug'].includes(key),\n )\n ) {\n const added: TItem[] = [];\n for (let i = 0; i < rightIds.length; i++) {\n added.push(\n (await this.createUnsaved({\n ...opts,\n ...(this.positionField && opts[this.positionField] === undefined\n ? { [this.positionField]: i }\n : {}),\n [this.leftField]: leftId,\n [this.rightField]: rightIds[i],\n } as SmrtCreateInput<TItem>)) as TItem,\n );\n }\n if (await SmrtObject.tryJunctionBatch(existing, added)) return;\n }\n for (const link of existing) {\n await (link as unknown as { delete(): Promise<void> }).delete();\n }\n\n const positionKey = this.positionField;\n for (let i = 0; i < rightIds.length; i++) {\n const rowOpts: JunctionAttachOptions = { ...opts };\n if (positionKey && rowOpts[positionKey] === undefined) {\n rowOpts[positionKey] = i;\n }\n await this.attach(leftId, rightIds[i], rowOpts);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAS,aAAa,MAAsB;CAC1C,OAAO,KAAK,QAAQ,WAAW,MAAM,IAAI,EAAE,YAAY,GAAG;AAC5D;AAEA,IAAsB,eAAtB,MAAsB,qBAEZ,eAAsB;;;;;;;CAO9B,OAAgB,kBAAkB;;;;;;;;;;;;CAmBlC,YAAqC;;;;;;;;;;;CAYrC,gBAAyC;;;;;CAMzC,MAAM,OACJ,QACA,OAA8B,CAAC,GACb;EAClB,MAAM,EAAE,OAAO,QAAQ,GAAG,UAAU;EACpC,OAAQ,MAAM,KAAK,KAAK;GAItB,OAAO;IAAE,GAAG;KAAQ,KAAK,YAAY;GAAO;GAC5C;GACA;GACA,GAAI,KAAK,YACL,EAAE,SAAS,GAAG,aAAa,KAAK,SAAS,EAAE,MAAM,IACjD,CAAC;EACP,CAAC;CACH;;;;;CAMA,MAAM,QACJ,SACA,OAA8B,CAAC,GACb;EAClB,MAAM,EAAE,OAAO,QAAQ,GAAG,UAAU;EACpC,OAAQ,MAAM,KAAK,KAAK;GACtB,OAAO;IAAE,GAAG;KAAQ,KAAK,aAAa;GAAQ;GAC9C;GACA;GACA,GAAI,KAAK,YACL,EAAE,SAAS,GAAG,aAAa,KAAK,SAAS,EAAE,MAAM,IACjD,CAAC;EACP,CAAC;CACH;;;;;;;;;;;;;;;;;;CAmBA,MAAM,OACJ,QACA,SACA,OAA8B,CAAC,GACf;EAChB,OAAQ,MAAM,KAAK,OAAO;GAIxB,GAAG;IACF,KAAK,YAAY;IACjB,KAAK,aAAa;EACrB,CAA2B;CAC7B;;;;;;CAOA,MAAM,OACJ,QACA,SACA,OAA8B,CAAC,GAChB;EAEf,MAAM,UAAU,EAAE,GA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O,KAAgD,OAAO;EAGhE,MAAM,cAAc,KAAK;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;GACxC,MAAM,UAAiC,EAAE,GAAG,KAAK;GACjD,IAAI,eAAe,QAAQ,iBAAiB,KAAA,GAC1C,QAAQ,eAAe;GAEzB,MAAM,KAAK,OAAO,QAAQ,SAAS,IAAI,OAAO;EAChD;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"junction.js","names":[],"sources":["../src/junction.ts"],"sourcesContent":["/**\n * SmrtJunction — base class for two-sided junction (many-to-many) collections.\n *\n * A junction collection manages rows that link a \"left\" entity to a \"right\" entity,\n * typically with discriminator fields (relationship/role) and an optional sortOrder.\n * Examples in the monorepo:\n *\n * | Subclass | Left field | Right field | Discriminator |\n * |--------------------------------|---------------|-------------|-----------------|\n * | ContentAssetCollection | contentId | assetId | relationship |\n * | PerformerOwnedAssetCollection | performerId | assetId | role |\n * | PlaceAssetCollection | placeId | assetId | relationship |\n * | EventParticipantCollection | eventId | profileId | role |\n * | FactContentCollection | factId | contentId | relationship |\n *\n * Each subclass declares `leftField` / `rightField` (camelCase) and optionally\n * overrides `sortField` (defaults to `'sortOrder'`; set `null` to disable ORDER BY).\n *\n * Polymorphic collections with a composite left key extend `SmrtJunctionBase`\n * and declare their own owner methods — see `AssetAssociationCollection`.\n * `SmrtJunction` retains the single-left-ID method contract.\n *\n * @typeParam TItem - The junction row class (extends `SmrtObject`)\n */\n\nimport { SmrtCollection, type SmrtCreateInput } from './collection';\nimport { GlobalInterceptors } from './interceptors';\nimport { SmrtObject } from './object';\n\n/**\n * Options passed to `attach` / `setLinks` — written into the created junction row.\n *\n * Common keys: `relationship`, `role`, `sortOrder`, `tenantId`.\n * Subclass-specific keys (e.g. `placement`, `groupId` on EventParticipant) pass through.\n * Keys must match actual camelCase column names on the junction model; unknown\n * keys are rejected by `SmrtCollection.create`'s WHERE/field validation.\n */\nexport type JunctionAttachOptions = Record<string, unknown>;\n\n/**\n * Options passed to `byLeft` / `byRight` / `detach`.\n *\n * `limit` and `offset` bound reads made through `byLeft` / `byRight`; all\n * remaining keys are additional WHERE filters narrowing the operation. Keys\n * must match camelCase column names.\n */\nexport type JunctionFilterOptions = Record<string, unknown> & {\n limit?: number;\n offset?: number;\n};\n\nfunction camelToSnake(name: string): string {\n return name.replace(/[A-Z]/g, (m) => `_${m.toLowerCase()}`);\n}\n\n/**\n * Shared junction collection identity, ordering, and single-right-ID reads.\n *\n * Composite-owner collections extend this base and declare their own owner\n * methods. Single-owner collections extend `SmrtJunction` instead. This base\n * intentionally has no left-owner methods with an incompatible call shape.\n *\n * @typeParam TItem - The junction row class.\n */\nexport abstract class SmrtJunctionBase<\n TItem extends SmrtObject,\n> extends SmrtCollection<TItem> {\n /**\n * Internal marker used by `SmrtCollection.create` to detect that this\n * subclass is a junction and apply a registration-presence guard. Static\n * property is inherited by all subclasses via the constructor chain.\n * Don't rename or remove without also updating the guard.\n */\n static readonly _isJunctionBase = true as const;\n\n /** Field name (camelCase) holding the \"right\" foreign key, e.g. `'assetId'`. */\n protected abstract rightField: string;\n\n /**\n * Field name (camelCase) used to ORDER BY when calling `byLeft` / `byRight`.\n * Defaults to `'sortOrder'`. Set to `null` to omit ORDER BY entirely.\n *\n * Independent from `positionField` — `sortField` is a *query* concern\n * (how rows are ordered when read), while `positionField` is a *write*\n * concern (what column `setLinks` auto-assigns to). Tables that order\n * by a non-position field (e.g. `'createdAt'`) should set `sortField`\n * accordingly and leave `positionField` set to `null` or its dedicated\n * position column name.\n */\n protected sortField: string | null = 'sortOrder';\n\n /**\n * Field name (camelCase) that `setLinks` auto-assigns the array index\n * to when the caller doesn't supply a value. Defaults to `'sortOrder'`.\n * Set to `null` for tables without a dedicated position column (e.g.\n * pure-key junctions, or tables ordered by timestamps).\n *\n * Writing the array index into a non-position field — like `createdAt`\n * or `placement` — would corrupt data. Subclasses without a numeric\n * position column MUST set this to `null`.\n */\n protected positionField: string | null = 'sortOrder';\n\n /**\n * Return junction rows where the right FK matches `rightId`, narrowed by\n * optional additional WHERE filters. Ordered ASC by `sortField` if set.\n */\n async byRight(\n rightId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<TItem[]> {\n const { limit, offset, ...where } = opts;\n return (await this.list({\n where: { ...where, [this.rightField]: rightId },\n limit,\n offset,\n ...(this.sortField\n ? { orderBy: `${camelToSnake(this.sortField)} ASC` }\n : {}),\n })) as TItem[];\n }\n}\n\n/**\n * Junction collection with one left ID and one right ID.\n *\n * Existing subclasses retain their named method parameters and persistence\n * behavior. Use `SmrtJunctionBase` for a collection with a composite owner.\n *\n * @typeParam TItem - The junction row class.\n */\nexport abstract class SmrtJunction<\n TItem extends SmrtObject,\n> extends SmrtJunctionBase<TItem> {\n /** Field name (camelCase) holding the \"left\" foreign key, e.g. `'contentId'`. */\n protected abstract leftField: string;\n\n /**\n * Return junction rows where the left FK matches `leftId`, narrowed by\n * optional additional WHERE filters. Ordered ASC by `sortField` if set.\n */\n async byLeft(\n leftId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<TItem[]> {\n const { limit, offset, ...where } = opts;\n return (await this.list({\n // Spread opts FIRST so the fixed key always wins — prevents a\n // caller-supplied `{ [leftField]: otherId }` from retargeting the\n // query when opts is forwarded from untrusted input.\n where: { ...where, [this.leftField]: leftId },\n limit,\n offset,\n ...(this.sortField\n ? { orderBy: `${camelToSnake(this.sortField)} ASC` }\n : {}),\n })) as TItem[];\n }\n\n /**\n * Create a new junction row linking `leftId` ↔ `rightId`.\n *\n * Goes through `SmrtCollection.create` which performs an upsert keyed on\n * the model's `@smrt({ conflictColumns })`. Duplicates on the conflict key\n * resolve to an UPDATE that rewrites every column — including the row's\n * `id` and any timestamp columns — to the new instance's values. For most\n * junctions that's fine: callers identify rows by (left, right, discriminator),\n * not by junction-row-id, so id rewrites are invisible.\n *\n * If your junction table is externally addressable by id (e.g. its rows\n * are exposed under `/api/v1/<table>/[id]`), override this method with a\n * find-or-create check to preserve id stability across duplicate calls.\n * See `ContentReferences.attach` for an example.\n *\n * @param opts - Extra fields to write into the row (e.g. `{ relationship, sortOrder, tenantId }`)\n */\n async attach(\n leftId: string,\n rightId: string,\n opts: JunctionAttachOptions = {},\n ): Promise<TItem> {\n return (await this.create({\n // Spread opts FIRST so the fixed key fields always win — prevents\n // a caller-supplied `{ [leftField]: otherId }` from retargeting\n // the write when opts is forwarded from untrusted input.\n ...opts,\n [this.leftField]: leftId,\n [this.rightField]: rightId,\n } as SmrtCreateInput<TItem>)) as TItem;\n }\n\n /**\n * Delete all junction rows matching `leftId` + `rightId` (+ optional filter `opts`).\n *\n * @param opts - Additional WHERE filters (e.g. `{ relationship: 'thumbnail' }`)\n */\n async detach(\n leftId: string,\n rightId: string,\n opts: JunctionFilterOptions = {},\n ): Promise<void> {\n // Read bounds never narrow the mutation snapshot.\n const filters = { ...opts };\n delete filters.limit;\n delete filters.offset;\n const links = (await this.list({\n where: {\n ...filters,\n [this.leftField]: leftId,\n [this.rightField]: rightId,\n },\n })) as TItem[];\n if (await SmrtObject.tryJunctionBatch(links, [])) return;\n for (const link of links) {\n await (link as unknown as { delete(): Promise<void> }).delete();\n }\n }\n\n /**\n * Replace the full set of right-side rows for a `leftId`, scoped by `opts`.\n *\n * Behavior:\n * 1. Snapshots and deletes existing rows matching `{ leftField: leftId, ...opts }`.\n * 2. Creates a new row for each `rightId`, spreading `opts` into the row data.\n * 3. If `positionField` is set and `opts` doesn't specify it, assigns the array index.\n *\n * Compatible models use grouped persistence while preserving delete/create\n * identity and feed semantics. Unsupported hooks, overrides, shapes, or batch\n * bounds retain the sequential path; see agents/object-runtime.md.\n * Not transactional — partial failure leaves the table in a mixed state.\n * For atomic replaces, wrap the call in your own DB transaction.\n */\n async setLinks(\n leftId: string,\n rightIds: string[],\n opts: JunctionAttachOptions = {},\n ): Promise<void> {\n // Strip the right-side key from snapshot opts — leaving it in would\n // narrow the delete to one specific right id, but `setLinks` is\n // contractually \"replace the full set of right rows for leftId\n // within the opts scope\". A rightField filter contradicts that.\n const snapshotOpts: JunctionAttachOptions = { ...opts };\n delete snapshotOpts[this.rightField];\n\n const existing = (await this.list({\n where: { ...snapshotOpts, [this.leftField]: leftId },\n })) as TItem[];\n // Custom create/attach implementations remain authoritative. No opt-in is\n // inferred from a method name, class name, or interceptor registration name.\n if (\n SmrtObject.hasBaseJunctionLifecycle(this._itemClass.prototype) &&\n GlobalInterceptors.supportsBulkMutation(\n this.getResolvedItemClassName(),\n ) &&\n new Set(rightIds).size === rightIds.length &&\n this.attach === SmrtJunction.prototype.attach &&\n SmrtCollection.hasBaseCreateLifecycle(this) &&\n rightIds.length + existing.length <= 100 &&\n !Object.keys(opts).some(\n (key) =>\n key.startsWith('_') || ['db', 'ai', 'id', 'slug'].includes(key),\n )\n ) {\n const added: TItem[] = [];\n for (let i = 0; i < rightIds.length; i++) {\n added.push(\n (await this.createUnsaved({\n ...opts,\n ...(this.positionField && opts[this.positionField] === undefined\n ? { [this.positionField]: i }\n : {}),\n [this.leftField]: leftId,\n [this.rightField]: rightIds[i],\n } as SmrtCreateInput<TItem>)) as TItem,\n );\n }\n if (await SmrtObject.tryJunctionBatch(existing, added)) return;\n }\n for (const link of existing) {\n await (link as unknown as { delete(): Promise<void> }).delete();\n }\n\n const positionKey = this.positionField;\n for (let i = 0; i < rightIds.length; i++) {\n const rowOpts: JunctionAttachOptions = { ...opts };\n if (positionKey && rowOpts[positionKey] === undefined) {\n rowOpts[positionKey] = i;\n }\n await this.attach(leftId, rightIds[i], rowOpts);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAS,aAAa,MAAsB;CAC1C,OAAO,KAAK,QAAQ,WAAW,MAAM,IAAI,EAAE,YAAY,GAAG;AAC5D;;;;;;;;;;AAWA,IAAsB,mBAAtB,cAEU,eAAsB;;;;;;;CAO9B,OAAgB,kBAAkB;;;;;;;;;;;;CAgBlC,YAAqC;;;;;;;;;;;CAYrC,gBAAyC;;;;;CAMzC,MAAM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AO,aAAa,KAAK;EAEzB,MAAM,WAAY,MAAM,KAAK,KAAK,EAChC,OAAO;GAAE,GAAG;IAAe,KAAK,YAAY;EAAO,EACrD,CAAC;EAGD,IACE,WAAW,yBAAyB,KAAK,WAAW,SAAS,KAC7D,mBAAmB,qBACjB,KAAK,yBAAyB,CAChC,KACA,IAAI,IAAI,QAAQ,CAAC,CAAC,SAAS,SAAS,UACpC,KAAK,WAAW,aAAa,UAAU,UACvC,eAAe,uBAAuB,IAAI,KAC1C,SAAS,SAAS,SAAS,UAAU,OACrC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,MAChB,QACC,IAAI,WAAW,GAAG,KAAK;GAAC;GAAM;GAAM;GAAM;EAAM,CAAC,CAAC,SAAS,GAAG,CAClE,GACA;GACA,MAAM,QAAiB,CAAC;GACxB,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,MAAM,KACH,MAAM,KAAK,cAAc;IACxB,GAAG;IACH,GAAI,KAAK,iBAAiB,KAAK,KAAK,mBAAmB,KAAA,IACnD,GAAG,KAAK,gBAAgB,EAAE,IAC1B,CAAC;KACJ,KAAK,YAAY;KACjB,KAAK,aAAa,SAAS;GAC9B,CAA2B,CAC7B;GAEF,IAAI,MAAM,WAAW,iBAAiB,UAAU,KAAK,GAAG;EAC1D;EACA,KAAK,MAAM,QAAQ,UACjB,MAAO,KAAgD,OAAO;EAGhE,MAAM,cAAc,KAAK;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;GACxC,MAAM,UAAiC,EAAE,GAAG,KAAK;GACjD,IAAI,eAAe,QAAQ,iBAAiB,KAAA,GAC1C,QAAQ,eAAe;GAEzB,MAAM,KAAK,OAAO,QAAQ,SAAS,IAAI,OAAO;EAChD;CACF;AACF"}
|
package/dist/knowledge.js
CHANGED
|
@@ -626,7 +626,7 @@ function relationshipFeatures(object, fields) {
|
|
|
626
626
|
if (field.type === "oneToMany") features.add("oneToMany");
|
|
627
627
|
if (field.type === "manyToMany") features.add("manyToMany");
|
|
628
628
|
}
|
|
629
|
-
if (object.extends === "SmrtJunction") features.add("SmrtJunction");
|
|
629
|
+
if (object.extends === "SmrtJunction" || object.extends === "SmrtJunctionBase") features.add("SmrtJunction");
|
|
630
630
|
if (object.extends === "SmrtHierarchical") features.add("SmrtHierarchical");
|
|
631
631
|
if (object.extends === "SmrtPolymorphicAssociation" || fields.some((field) => field.name === "metaType") || fields.some((field) => field.name === "metaId")) features.add("SmrtPolymorphicAssociation");
|
|
632
632
|
if (Object.keys(object.schema?.columns ?? {}).some((name) => object.schema?.columns[name]?.type === "UUID")) features.add("uuidColumns");
|