@centrali-io/centrali-sdk 6.9.0 → 6.10.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.
- package/dist/index.d.ts +92 -12
- package/dist/index.js +50 -5
- package/package.json +1 -1
- package/src/managers/embed.ts +4 -4
- package/src/realtime/manager.ts +52 -0
- package/src/types/embed.ts +1 -9
- package/src/types/realtime.ts +74 -0
package/dist/index.d.ts
CHANGED
|
@@ -743,6 +743,39 @@ interface RealtimeOrchestrationRunEvent {
|
|
|
743
743
|
/** ISO timestamp when the event occurred */
|
|
744
744
|
timestamp: string;
|
|
745
745
|
}
|
|
746
|
+
/**
|
|
747
|
+
* Projection source tables for unified Event Log entries.
|
|
748
|
+
*/
|
|
749
|
+
type EventLogSourceTable = 'inbound_events' | 'record_change_log' | 'webhook_deliveries';
|
|
750
|
+
/**
|
|
751
|
+
* Unified Event Log entry from the realtime service (CEN-1302 Part B).
|
|
752
|
+
*
|
|
753
|
+
* Metadata only — mirrors the Tier-1 projection's metadata view. It carries no
|
|
754
|
+
* event payload/body; fetch full payloads via the Event Log query / get-event
|
|
755
|
+
* endpoints. Delivered on the opt-in `eventlog` stream.
|
|
756
|
+
*
|
|
757
|
+
* Matches: services/backend/realtime/internal/redis/message.go EventLogEntry
|
|
758
|
+
*/
|
|
759
|
+
interface RealtimeEventLogEntry {
|
|
760
|
+
/** Projection discriminator, e.g. "inbound.http_trigger", "record.created", "outbound.webhook_delivery" */
|
|
761
|
+
eventType: string;
|
|
762
|
+
/** Projection source table */
|
|
763
|
+
sourceTable: EventLogSourceTable;
|
|
764
|
+
/** Source row id (matches the projection's sourceId) */
|
|
765
|
+
sourceId: string;
|
|
766
|
+
/** Workspace slug */
|
|
767
|
+
workspaceSlug: string;
|
|
768
|
+
/** Lineage chain id; empty/absent when the source row has none */
|
|
769
|
+
correlationId?: string;
|
|
770
|
+
/** 0 = inbound (host clock), 1 = record/webhook (DB clock) */
|
|
771
|
+
clockTier: 0 | 1;
|
|
772
|
+
/** Dead-letter marker (outbound deliveries); false otherwise */
|
|
773
|
+
dlq: boolean;
|
|
774
|
+
/** Inbound trigger id for per-integration scoping; empty/absent otherwise */
|
|
775
|
+
triggerId?: string;
|
|
776
|
+
/** ISO timestamp when the source event occurred */
|
|
777
|
+
timestamp: string;
|
|
778
|
+
}
|
|
746
779
|
/**
|
|
747
780
|
* Close event payload from the realtime service.
|
|
748
781
|
*/
|
|
@@ -789,6 +822,21 @@ interface RealtimeSubscribeOptions {
|
|
|
789
822
|
orchestrationId?: string;
|
|
790
823
|
/** Filter orchestration events to a specific run ID */
|
|
791
824
|
runId?: string;
|
|
825
|
+
/**
|
|
826
|
+
* Streams to subscribe to (records / compute / orchestration / eventlog).
|
|
827
|
+
* Empty defaults to the legacy {records, compute, orchestration} set; the
|
|
828
|
+
* unified Event Log stream is opt-in. Prefer subscribeEventLog() over
|
|
829
|
+
* setting this directly. (CEN-1302 Part B)
|
|
830
|
+
*/
|
|
831
|
+
streams?: string[];
|
|
832
|
+
/** Event Log source-table filter (used with streams=['eventlog']) */
|
|
833
|
+
sources?: EventLogSourceTable[];
|
|
834
|
+
/** Event Log lineage-chain filter */
|
|
835
|
+
correlationId?: string;
|
|
836
|
+
/** Event Log inbound-trigger filter */
|
|
837
|
+
triggerId?: string;
|
|
838
|
+
/** Event Log dead-letter filter (true = DLQ only, false = non-DLQ only) */
|
|
839
|
+
dlq?: boolean;
|
|
792
840
|
/** Callback for record events */
|
|
793
841
|
onEvent: (event: RealtimeEvent) => void;
|
|
794
842
|
/** Callback for errors */
|
|
@@ -798,6 +846,29 @@ interface RealtimeSubscribeOptions {
|
|
|
798
846
|
/** Callback when disconnected */
|
|
799
847
|
onDisconnected?: (reason?: string) => void;
|
|
800
848
|
}
|
|
849
|
+
/**
|
|
850
|
+
* Options for subscribing to the unified Event Log stream (CEN-1302 Part B).
|
|
851
|
+
*/
|
|
852
|
+
interface EventLogSubscribeOptions {
|
|
853
|
+
/** Filter to these projection source tables. Empty = all sources */
|
|
854
|
+
sources?: EventLogSourceTable[];
|
|
855
|
+
/** Filter to these eventType discriminators (e.g. ["inbound.http_trigger"]). Empty = all */
|
|
856
|
+
eventTypes?: string[];
|
|
857
|
+
/** Filter to a single lineage chain */
|
|
858
|
+
correlationId?: string;
|
|
859
|
+
/** Filter to a single inbound trigger */
|
|
860
|
+
triggerId?: string;
|
|
861
|
+
/** Filter by dead-letter state (true = DLQ only, false = non-DLQ only) */
|
|
862
|
+
dlq?: boolean;
|
|
863
|
+
/** Callback for Event Log entries */
|
|
864
|
+
onEvent: (entry: RealtimeEventLogEntry) => void;
|
|
865
|
+
/** Callback for errors */
|
|
866
|
+
onError?: (error: RealtimeError) => void;
|
|
867
|
+
/** Callback when connected */
|
|
868
|
+
onConnected?: () => void;
|
|
869
|
+
/** Callback when disconnected */
|
|
870
|
+
onDisconnected?: (reason?: string) => void;
|
|
871
|
+
}
|
|
801
872
|
/**
|
|
802
873
|
* Realtime subscription handle returned by subscribe().
|
|
803
874
|
*/
|
|
@@ -2868,7 +2939,7 @@ interface AddAllowedDomainOptions {
|
|
|
2868
2939
|
/**
|
|
2869
2940
|
* Capabilities that can be encoded into an embed token.
|
|
2870
2941
|
*
|
|
2871
|
-
* - `events:read` — list + retrieve event-log rows
|
|
2942
|
+
* - `events:read` — list + retrieve the workspace's event-log rows.
|
|
2872
2943
|
* IAM unconditionally injects this on every minted token, so omitting
|
|
2873
2944
|
* `capabilities` is equivalent to `['events:read']`.
|
|
2874
2945
|
* - `events:replay` — allow the iframe to replay a failed delivery. The
|
|
@@ -2876,13 +2947,6 @@ interface AddAllowedDomainOptions {
|
|
|
2876
2947
|
*/
|
|
2877
2948
|
type EmbedCapability = 'events:read' | 'events:replay';
|
|
2878
2949
|
interface IssueEmbedTokenInput {
|
|
2879
|
-
/**
|
|
2880
|
-
* Tenant id the embed is allowed to read. Burned into the token claim;
|
|
2881
|
-
* the data-service auto-injects this as a filter on every query the
|
|
2882
|
-
* iframe makes. Centrali never interprets the bytes — treat it as
|
|
2883
|
-
* opaque (1-255 chars).
|
|
2884
|
-
*/
|
|
2885
|
-
tenantId: string;
|
|
2886
2950
|
/**
|
|
2887
2951
|
* Defaults to `['events:read']`. Pass `['events:read', 'events:replay']`
|
|
2888
2952
|
* to allow the iframe's "Replay" action. The issuing service account
|
|
@@ -2964,6 +3028,22 @@ declare class RealtimeManager {
|
|
|
2964
3028
|
* @returns Subscription handle with unsubscribe() method
|
|
2965
3029
|
*/
|
|
2966
3030
|
subscribe(options: RealtimeSubscribeOptions): RealtimeSubscription;
|
|
3031
|
+
/**
|
|
3032
|
+
* Subscribe to the unified Event Log stream (CEN-1302 Part B).
|
|
3033
|
+
*
|
|
3034
|
+
* Delivers metadata-only {@link RealtimeEventLogEntry} rows for the three
|
|
3035
|
+
* Tier-1 projection sources (inbound, record-change, outbound delivery) on
|
|
3036
|
+
* the opt-in `eventlog` stream — never mixed with raw record/compute/
|
|
3037
|
+
* orchestration events. Entries match the shape the Event Log console list
|
|
3038
|
+
* renders, so they can be prepended without translation.
|
|
3039
|
+
*
|
|
3040
|
+
* Like {@link subscribe}, this delivers only new entries after connect; load
|
|
3041
|
+
* the historical page via the Event Log query endpoint first, then prepend.
|
|
3042
|
+
*
|
|
3043
|
+
* @param options - Event Log subscription options
|
|
3044
|
+
* @returns Subscription handle with unsubscribe()
|
|
3045
|
+
*/
|
|
3046
|
+
subscribeEventLog(options: EventLogSubscribeOptions): RealtimeSubscription;
|
|
2967
3047
|
}
|
|
2968
3048
|
|
|
2969
3049
|
declare class OrchestrationsManager {
|
|
@@ -5280,12 +5360,12 @@ interface EmbedManagerOptions {
|
|
|
5280
5360
|
* @example
|
|
5281
5361
|
* ```ts
|
|
5282
5362
|
* const { token, sessionId, expiresAt } = await client.embed.eventLog.issueToken({
|
|
5283
|
-
* tenantId: customerOrgId,
|
|
5284
5363
|
* capabilities: ['events:read', 'events:replay'],
|
|
5285
5364
|
* ttlSeconds: 900,
|
|
5286
5365
|
* });
|
|
5287
5366
|
*
|
|
5288
|
-
* //
|
|
5367
|
+
* // The token is workspace-scoped (it exposes the whole workspace's event
|
|
5368
|
+
* // log), so render it only in your own internal/admin tooling.
|
|
5289
5369
|
* // <iframe src={`https://embed.centrali.io/v1/event-log#token=${token}&o=${origin}`} />
|
|
5290
5370
|
*
|
|
5291
5371
|
* // On user logout:
|
|
@@ -5314,7 +5394,7 @@ declare class EventLogEmbed {
|
|
|
5314
5394
|
* Mint a short-lived `ev_…` embed token. Hand the result to your
|
|
5315
5395
|
* frontend and drop it into the iframe URL fragment as `#token=…&o=…`.
|
|
5316
5396
|
*/
|
|
5317
|
-
issueToken(input
|
|
5397
|
+
issueToken(input?: IssueEmbedTokenInput): Promise<IssueEmbedTokenResult>;
|
|
5318
5398
|
/**
|
|
5319
5399
|
* Revoke an embed session (typically tied to your user's logout).
|
|
5320
5400
|
* Every embed token carrying this `sessionId` is rejected by
|
|
@@ -6282,4 +6362,4 @@ declare class CentraliSDK {
|
|
|
6282
6362
|
checkAuthorization(options: CheckAuthorizationOptions): Promise<ApiResponse<AuthorizationResult>>;
|
|
6283
6363
|
}
|
|
6284
6364
|
|
|
6285
|
-
export { type AcceptSuggestionResult, type AddAllowedDomainOptions, type AllowedDomain, type AllowedDomainsListResponse, AllowedDomainsManager, type AnomalyAnalysisResult, type AnomalyDetectionData, type AnomalyEventType, type AnomalyInsight, type AnomalyInsightData, AnomalyInsightsManager, type ApiResponse, type ArrayPropertyDefinition, AuditLogManager, type AuthorizationResult, type BasePropertyDefinition, type BatchScanResult, type BatchScanStatus, type BooleanPropertyDefinition, type BulkOperationResult, CANONICAL_OPERATORS, type CanonicalOperator, CentraliError, CentraliSDK, type CentraliSDKOptions, type CheckAuthorizationOptions, CollectionsManager, type ComputeEventType, type ComputeFunction, ComputeFunctionsManager, type ComputeJobStatus, type ComputeJobStatusResponse, type ConditionOperator, type CreateComputeFunctionInput, type CreateOrchestrationInput, type CreateSmartQueryInput, type CreateStructureInput, type CreateTriggerInput, type CreateWebhookSubscriptionInput, type DateTimePropertyDefinition, type DateWindowOption, type DeleteRecordOptions, type EmbedCapability, EmbedManager, type EndpointResponse, EventLogEmbed, type ExecuteSavedQueryValues, type ExecuteSmartQueryOptions, type ExpandOptions, type FieldCondition, type FieldConditionMap, type FileMetadata, FilesManager, type FilterOperators, type FilterValue, type FunctionMemoryUsage, type FunctionRun, type FunctionRunError, type FunctionRunExecutionSource, type FunctionRunStatus, FunctionRunsManager, type FunctionTrigger, type GetRecordOptions, type IncludeClause, type InsightSeverity, type InsightStatus, type InsightType, type InsightsSummary, type InvokeEndpointOptions, type InvokeTriggerOptions, type IssueEmbedTokenInput, type IssueEmbedTokenResult, JOINS_MAX_LENGTH, type JoinClause, type JoinType, type LegacyTranslateOptions, type LegacyTranslateResult, type LegacyTranslateWarning, type ListAllTriggersOptions, type ListCollectionsOptions, type ListComputeFunctionsOptions, type ListFunctionRunsOptions, type ListInsightsOptions, type ListOrchestrationRunsOptions, type ListOrchestrationsOptions, type ListSmartQueryOptions, type ListStructuresOptions, type ListValidationSuggestionsOptions, type ListWebhookDeliveriesOptions, type NumberPropertyDefinition, OPERATOR_METADATA, type ObjectPropertyDefinition, type OperatorMeta, type OperatorTypeApplicability, type OperatorValueShape, type Orchestration, type OrchestrationCaseEvaluation, type OrchestrationCondition, type OrchestrationConditionEvaluation, type OrchestrationDecisionCase, type OrchestrationDecisionResult, type OrchestrationDelayConfig, type OrchestrationEventType, type OrchestrationFailureReason, type OrchestrationOnFailure, type OrchestrationOnSuccess, type OrchestrationRetryConfig, type OrchestrationRun, type OrchestrationRunStatus, type OrchestrationRunStep, OrchestrationRunsManager, type OrchestrationScheduleType, type OrchestrationStatus, type OrchestrationStep, type OrchestrationStepError, type OrchestrationStepStatus, type OrchestrationStepType, type OrchestrationTrigger, type OrchestrationTriggerMetadata, type OrchestrationTriggerType, OrchestrationsManager, type PageClause, type PaginatedResponse, type ParsedUrlQuery, type PropertyDefinition, type PropertyType, type QueryDefinition, type QueryError, type QueryErrorCode, type QueryExecutionMode, type QueryHttpError, type QueryHttpErrorCode, QueryManager, type QueryRecordOptions, type QueryResult, type QueryResultMeta, type QueryValidateOptions, type QueryVariableDefinition, RECORDS_PAGE_DEFAULT_LIMIT, RECORDS_PAGE_MAX_LIMIT, type RealtimeAnomalyDetectionEvent, type RealtimeAnomalyInsightEvent, type RealtimeCloseEvent, type RealtimeError, type RealtimeEvent, type RealtimeEventType, type RealtimeFunctionRunEvent, RealtimeManager, type RealtimeOrchestrationRunEvent, type RealtimeRecordEvent, type RealtimeSubscribeOptions, type RealtimeSubscription, type RealtimeValidationBatchEvent, type RealtimeValidationSuggestionEvent, type RecordEventType, RecordEvents, type RecordTtlOptions, RecordsManager, type ReferencePropertyDefinition, type ResourceCategory, type RevokeEmbedSessionInput, type RevokeEmbedSessionResult, type SavedQueryDefinition, type SavedQueryScalarBinding, type ScalarValue, type SchemaDiscoveryMode, type SearchHit, type SearchOptions, type SearchResponse, type SelectClause, SmartQueriesManager, type SmartQuery, type SmartQueryDefinition, type SmartQueryExecuteResult, type SmartQueryFieldCondition, type SmartQueryJoin, type SmartQuerySort, type SmartQueryWhereClause, type SortClause, type StepEncryptedParam, type StringPropertyDefinition, type Structure, StructuresManager, type TestComputeFunctionInput, type TestComputeFunctionResult, type TestSmartQueryInput, type TextSearchClause, type TriggerExecutionType, type TriggerHealthMetrics, type TriggerHealthStatus, type TriggerInvokeResponse, type TriggerOrchestrationRunOptions, type TriggerScanOptions, type TriggerWithHealth, TriggersManager, type UpdateComputeFunctionInput, type UpdateOrchestrationInput, type UpdateSmartQueryInput, type UpdateStructureInput, type UpdateTriggerInput, type UpdateWebhookSubscriptionInput, type UrlParserOptions, type ValidateStructureInput, type ValidationBatchData, type ValidationEventType, type ValidationIssueType, ValidationManager, type ValidationResult, type ValidationSuggestion, type ValidationSuggestionData, type ValidationSuggestionStatus, type ValidationSummary, type VariableType, type WaitForScanOptions, type WebhookCancelResponse, type WebhookDeliveriesListMeta, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookDeliverySummary, type WebhookPayloadVersions, type WebhookReplayResponse, type WebhookSubscription, WebhookSubscriptionsManager, type WhereExpression, fetchClientToken, getAllowedDomainsApiPath, getAnomalyAnalysisTriggerApiPath, getAnomalyInsightAcknowledgeApiPath, getAnomalyInsightDismissApiPath, getAnomalyInsightsApiPath, getAnomalyInsightsBulkAcknowledgeApiPath, getAnomalyInsightsSummaryApiPath, getApiUrl, getAuthUrl, getCollectionBySlugApiPath, getCollectionInsightsApiPath, getCollectionValidateApiPath, getCollectionsApiPath, getComputeFunctionTestApiPath, getComputeFunctionsApiPath, getComputeJobStatusApiPath, getEndpointApiPath, getFileUploadApiPath, getFilesCanonicalApiPath, getFunctionRunsApiPath, getFunctionRunsByFunctionApiPath, getFunctionRunsByTriggerApiPath, getFunctionTriggerExecuteApiPath, getFunctionTriggerPauseApiPath, getFunctionTriggerResumeApiPath, getFunctionTriggersApiPath, getOrchestrationRunStepsApiPath, getOrchestrationRunsApiPath, getOrchestrationRunsCanonicalApiPath, getOrchestrationsApiPath, getRealtimeUrl, getRecordApiPath, getSavedQueryCanonicalByIdPath, getSavedQueryCanonicalCollectionPath, getSavedQueryCanonicalExecutePath, getSavedQueryCanonicalTestPath, getSearchApiPath, getSmartQueriesApiPath, getSmartQueriesStructureApiPath, getSmartQueryByNameApiPath, getSmartQueryExecuteApiPath, getSmartQueryTestApiPath, getStructureBySlugApiPath, getStructureInsightsApiPath, getStructureValidateApiPath, getStructuresApiPath, getValidationBulkAcceptApiPath, getValidationBulkRejectApiPath, getValidationPendingCountApiPath, getValidationRecordSuggestionsApiPath, getValidationScanApiPath, getValidationSuggestionAcceptApiPath, getValidationSuggestionRejectApiPath, getValidationSuggestionsApiPath, getValidationSummaryApiPath, getWebhookDeliveryCancelApiPath, getWebhookDeliveryRetryApiPath, getWebhookPayloadVersionsApiPath, getWebhookSubscriptionDeliveriesApiPath, getWebhookSubscriptionRotateSecretApiPath, getWebhookSubscriptionsApiPath, isCentraliError, operatorsForFieldType };
|
|
6365
|
+
export { type AcceptSuggestionResult, type AddAllowedDomainOptions, type AllowedDomain, type AllowedDomainsListResponse, AllowedDomainsManager, type AnomalyAnalysisResult, type AnomalyDetectionData, type AnomalyEventType, type AnomalyInsight, type AnomalyInsightData, AnomalyInsightsManager, type ApiResponse, type ArrayPropertyDefinition, AuditLogManager, type AuthorizationResult, type BasePropertyDefinition, type BatchScanResult, type BatchScanStatus, type BooleanPropertyDefinition, type BulkOperationResult, CANONICAL_OPERATORS, type CanonicalOperator, CentraliError, CentraliSDK, type CentraliSDKOptions, type CheckAuthorizationOptions, CollectionsManager, type ComputeEventType, type ComputeFunction, ComputeFunctionsManager, type ComputeJobStatus, type ComputeJobStatusResponse, type ConditionOperator, type CreateComputeFunctionInput, type CreateOrchestrationInput, type CreateSmartQueryInput, type CreateStructureInput, type CreateTriggerInput, type CreateWebhookSubscriptionInput, type DateTimePropertyDefinition, type DateWindowOption, type DeleteRecordOptions, type EmbedCapability, EmbedManager, type EndpointResponse, EventLogEmbed, type EventLogSourceTable, type EventLogSubscribeOptions, type ExecuteSavedQueryValues, type ExecuteSmartQueryOptions, type ExpandOptions, type FieldCondition, type FieldConditionMap, type FileMetadata, FilesManager, type FilterOperators, type FilterValue, type FunctionMemoryUsage, type FunctionRun, type FunctionRunError, type FunctionRunExecutionSource, type FunctionRunStatus, FunctionRunsManager, type FunctionTrigger, type GetRecordOptions, type IncludeClause, type InsightSeverity, type InsightStatus, type InsightType, type InsightsSummary, type InvokeEndpointOptions, type InvokeTriggerOptions, type IssueEmbedTokenInput, type IssueEmbedTokenResult, JOINS_MAX_LENGTH, type JoinClause, type JoinType, type LegacyTranslateOptions, type LegacyTranslateResult, type LegacyTranslateWarning, type ListAllTriggersOptions, type ListCollectionsOptions, type ListComputeFunctionsOptions, type ListFunctionRunsOptions, type ListInsightsOptions, type ListOrchestrationRunsOptions, type ListOrchestrationsOptions, type ListSmartQueryOptions, type ListStructuresOptions, type ListValidationSuggestionsOptions, type ListWebhookDeliveriesOptions, type NumberPropertyDefinition, OPERATOR_METADATA, type ObjectPropertyDefinition, type OperatorMeta, type OperatorTypeApplicability, type OperatorValueShape, type Orchestration, type OrchestrationCaseEvaluation, type OrchestrationCondition, type OrchestrationConditionEvaluation, type OrchestrationDecisionCase, type OrchestrationDecisionResult, type OrchestrationDelayConfig, type OrchestrationEventType, type OrchestrationFailureReason, type OrchestrationOnFailure, type OrchestrationOnSuccess, type OrchestrationRetryConfig, type OrchestrationRun, type OrchestrationRunStatus, type OrchestrationRunStep, OrchestrationRunsManager, type OrchestrationScheduleType, type OrchestrationStatus, type OrchestrationStep, type OrchestrationStepError, type OrchestrationStepStatus, type OrchestrationStepType, type OrchestrationTrigger, type OrchestrationTriggerMetadata, type OrchestrationTriggerType, OrchestrationsManager, type PageClause, type PaginatedResponse, type ParsedUrlQuery, type PropertyDefinition, type PropertyType, type QueryDefinition, type QueryError, type QueryErrorCode, type QueryExecutionMode, type QueryHttpError, type QueryHttpErrorCode, QueryManager, type QueryRecordOptions, type QueryResult, type QueryResultMeta, type QueryValidateOptions, type QueryVariableDefinition, RECORDS_PAGE_DEFAULT_LIMIT, RECORDS_PAGE_MAX_LIMIT, type RealtimeAnomalyDetectionEvent, type RealtimeAnomalyInsightEvent, type RealtimeCloseEvent, type RealtimeError, type RealtimeEvent, type RealtimeEventLogEntry, type RealtimeEventType, type RealtimeFunctionRunEvent, RealtimeManager, type RealtimeOrchestrationRunEvent, type RealtimeRecordEvent, type RealtimeSubscribeOptions, type RealtimeSubscription, type RealtimeValidationBatchEvent, type RealtimeValidationSuggestionEvent, type RecordEventType, RecordEvents, type RecordTtlOptions, RecordsManager, type ReferencePropertyDefinition, type ResourceCategory, type RevokeEmbedSessionInput, type RevokeEmbedSessionResult, type SavedQueryDefinition, type SavedQueryScalarBinding, type ScalarValue, type SchemaDiscoveryMode, type SearchHit, type SearchOptions, type SearchResponse, type SelectClause, SmartQueriesManager, type SmartQuery, type SmartQueryDefinition, type SmartQueryExecuteResult, type SmartQueryFieldCondition, type SmartQueryJoin, type SmartQuerySort, type SmartQueryWhereClause, type SortClause, type StepEncryptedParam, type StringPropertyDefinition, type Structure, StructuresManager, type TestComputeFunctionInput, type TestComputeFunctionResult, type TestSmartQueryInput, type TextSearchClause, type TriggerExecutionType, type TriggerHealthMetrics, type TriggerHealthStatus, type TriggerInvokeResponse, type TriggerOrchestrationRunOptions, type TriggerScanOptions, type TriggerWithHealth, TriggersManager, type UpdateComputeFunctionInput, type UpdateOrchestrationInput, type UpdateSmartQueryInput, type UpdateStructureInput, type UpdateTriggerInput, type UpdateWebhookSubscriptionInput, type UrlParserOptions, type ValidateStructureInput, type ValidationBatchData, type ValidationEventType, type ValidationIssueType, ValidationManager, type ValidationResult, type ValidationSuggestion, type ValidationSuggestionData, type ValidationSuggestionStatus, type ValidationSummary, type VariableType, type WaitForScanOptions, type WebhookCancelResponse, type WebhookDeliveriesListMeta, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookDeliverySummary, type WebhookPayloadVersions, type WebhookReplayResponse, type WebhookSubscription, WebhookSubscriptionsManager, type WhereExpression, fetchClientToken, getAllowedDomainsApiPath, getAnomalyAnalysisTriggerApiPath, getAnomalyInsightAcknowledgeApiPath, getAnomalyInsightDismissApiPath, getAnomalyInsightsApiPath, getAnomalyInsightsBulkAcknowledgeApiPath, getAnomalyInsightsSummaryApiPath, getApiUrl, getAuthUrl, getCollectionBySlugApiPath, getCollectionInsightsApiPath, getCollectionValidateApiPath, getCollectionsApiPath, getComputeFunctionTestApiPath, getComputeFunctionsApiPath, getComputeJobStatusApiPath, getEndpointApiPath, getFileUploadApiPath, getFilesCanonicalApiPath, getFunctionRunsApiPath, getFunctionRunsByFunctionApiPath, getFunctionRunsByTriggerApiPath, getFunctionTriggerExecuteApiPath, getFunctionTriggerPauseApiPath, getFunctionTriggerResumeApiPath, getFunctionTriggersApiPath, getOrchestrationRunStepsApiPath, getOrchestrationRunsApiPath, getOrchestrationRunsCanonicalApiPath, getOrchestrationsApiPath, getRealtimeUrl, getRecordApiPath, getSavedQueryCanonicalByIdPath, getSavedQueryCanonicalCollectionPath, getSavedQueryCanonicalExecutePath, getSavedQueryCanonicalTestPath, getSearchApiPath, getSmartQueriesApiPath, getSmartQueriesStructureApiPath, getSmartQueryByNameApiPath, getSmartQueryExecuteApiPath, getSmartQueryTestApiPath, getStructureBySlugApiPath, getStructureInsightsApiPath, getStructureValidateApiPath, getStructuresApiPath, getValidationBulkAcceptApiPath, getValidationBulkRejectApiPath, getValidationPendingCountApiPath, getValidationRecordSuggestionsApiPath, getValidationScanApiPath, getValidationSuggestionAcceptApiPath, getValidationSuggestionRejectApiPath, getValidationSuggestionsApiPath, getValidationSummaryApiPath, getWebhookDeliveryCancelApiPath, getWebhookDeliveryRetryApiPath, getWebhookPayloadVersionsApiPath, getWebhookSubscriptionDeliveriesApiPath, getWebhookSubscriptionRotateSecretApiPath, getWebhookSubscriptionsApiPath, isCentraliError, operatorsForFieldType };
|
package/dist/index.js
CHANGED
|
@@ -619,7 +619,7 @@ var RealtimeManager = class {
|
|
|
619
619
|
let reconnectAttempt = 0;
|
|
620
620
|
let reconnectTimeout = null;
|
|
621
621
|
const connect = () => __async(this, null, function* () {
|
|
622
|
-
var _a, _b, _c, _d, _e;
|
|
622
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
623
623
|
if (unsubscribed) {
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
@@ -664,6 +664,21 @@ var RealtimeManager = class {
|
|
|
664
664
|
if (options.runId) {
|
|
665
665
|
url.searchParams.set("runId", options.runId);
|
|
666
666
|
}
|
|
667
|
+
if ((_e = options.streams) == null ? void 0 : _e.length) {
|
|
668
|
+
url.searchParams.set("streams", options.streams.join(","));
|
|
669
|
+
}
|
|
670
|
+
if ((_f = options.sources) == null ? void 0 : _f.length) {
|
|
671
|
+
url.searchParams.set("sources", options.sources.join(","));
|
|
672
|
+
}
|
|
673
|
+
if (options.correlationId) {
|
|
674
|
+
url.searchParams.set("correlationId", options.correlationId);
|
|
675
|
+
}
|
|
676
|
+
if (options.triggerId) {
|
|
677
|
+
url.searchParams.set("triggerId", options.triggerId);
|
|
678
|
+
}
|
|
679
|
+
if (options.dlq !== void 0) {
|
|
680
|
+
url.searchParams.set("dlq", String(options.dlq));
|
|
681
|
+
}
|
|
667
682
|
eventSource = new EventSourceImpl(url.toString());
|
|
668
683
|
eventSource.onopen = () => {
|
|
669
684
|
var _a2;
|
|
@@ -720,7 +735,7 @@ var RealtimeManager = class {
|
|
|
720
735
|
scheduleReconnect();
|
|
721
736
|
};
|
|
722
737
|
} catch (err) {
|
|
723
|
-
(
|
|
738
|
+
(_g = options.onError) == null ? void 0 : _g.call(options, {
|
|
724
739
|
code: "CONNECTION_ERROR",
|
|
725
740
|
message: `Failed to connect: ${err}`,
|
|
726
741
|
recoverable: true
|
|
@@ -770,6 +785,36 @@ var RealtimeManager = class {
|
|
|
770
785
|
}
|
|
771
786
|
};
|
|
772
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* Subscribe to the unified Event Log stream (CEN-1302 Part B).
|
|
790
|
+
*
|
|
791
|
+
* Delivers metadata-only {@link RealtimeEventLogEntry} rows for the three
|
|
792
|
+
* Tier-1 projection sources (inbound, record-change, outbound delivery) on
|
|
793
|
+
* the opt-in `eventlog` stream — never mixed with raw record/compute/
|
|
794
|
+
* orchestration events. Entries match the shape the Event Log console list
|
|
795
|
+
* renders, so they can be prepended without translation.
|
|
796
|
+
*
|
|
797
|
+
* Like {@link subscribe}, this delivers only new entries after connect; load
|
|
798
|
+
* the historical page via the Event Log query endpoint first, then prepend.
|
|
799
|
+
*
|
|
800
|
+
* @param options - Event Log subscription options
|
|
801
|
+
* @returns Subscription handle with unsubscribe()
|
|
802
|
+
*/
|
|
803
|
+
subscribeEventLog(options) {
|
|
804
|
+
return this.subscribe({
|
|
805
|
+
streams: ["eventlog"],
|
|
806
|
+
sources: options.sources,
|
|
807
|
+
// eventType filtering reuses the shared `events` query param server-side.
|
|
808
|
+
events: options.eventTypes,
|
|
809
|
+
correlationId: options.correlationId,
|
|
810
|
+
triggerId: options.triggerId,
|
|
811
|
+
dlq: options.dlq,
|
|
812
|
+
onEvent: (event) => options.onEvent(event),
|
|
813
|
+
onError: options.onError,
|
|
814
|
+
onConnected: options.onConnected,
|
|
815
|
+
onDisconnected: options.onDisconnected
|
|
816
|
+
});
|
|
817
|
+
}
|
|
773
818
|
};
|
|
774
819
|
|
|
775
820
|
// src/managers/orchestrations.ts
|
|
@@ -8065,8 +8110,8 @@ var EventLogEmbed = class {
|
|
|
8065
8110
|
* Mint a short-lived `ev_…` embed token. Hand the result to your
|
|
8066
8111
|
* frontend and drop it into the iframe URL fragment as `#token=…&o=…`.
|
|
8067
8112
|
*/
|
|
8068
|
-
issueToken(
|
|
8069
|
-
return __async(this,
|
|
8113
|
+
issueToken() {
|
|
8114
|
+
return __async(this, arguments, function* (input = {}) {
|
|
8070
8115
|
const path = `/workspace/${this.workspaceId}/embed/event-log/issue-token`;
|
|
8071
8116
|
return this.postWithIamToken(path, this.serializeIssueBody(input));
|
|
8072
8117
|
});
|
|
@@ -8083,7 +8128,7 @@ var EventLogEmbed = class {
|
|
|
8083
8128
|
});
|
|
8084
8129
|
}
|
|
8085
8130
|
serializeIssueBody(input) {
|
|
8086
|
-
const body = {
|
|
8131
|
+
const body = {};
|
|
8087
8132
|
if (input.capabilities) body.capabilities = input.capabilities;
|
|
8088
8133
|
if (input.sessionId) body.sessionId = input.sessionId;
|
|
8089
8134
|
if (input.ttlSeconds !== void 0) body.ttlSeconds = input.ttlSeconds;
|
package/package.json
CHANGED
package/src/managers/embed.ts
CHANGED
|
@@ -47,12 +47,12 @@ interface EmbedManagerOptions {
|
|
|
47
47
|
* @example
|
|
48
48
|
* ```ts
|
|
49
49
|
* const { token, sessionId, expiresAt } = await client.embed.eventLog.issueToken({
|
|
50
|
-
* tenantId: customerOrgId,
|
|
51
50
|
* capabilities: ['events:read', 'events:replay'],
|
|
52
51
|
* ttlSeconds: 900,
|
|
53
52
|
* });
|
|
54
53
|
*
|
|
55
|
-
* //
|
|
54
|
+
* // The token is workspace-scoped (it exposes the whole workspace's event
|
|
55
|
+
* // log), so render it only in your own internal/admin tooling.
|
|
56
56
|
* // <iframe src={`https://embed.centrali.io/v1/event-log#token=${token}&o=${origin}`} />
|
|
57
57
|
*
|
|
58
58
|
* // On user logout:
|
|
@@ -107,7 +107,7 @@ export class EventLogEmbed {
|
|
|
107
107
|
* Mint a short-lived `ev_…` embed token. Hand the result to your
|
|
108
108
|
* frontend and drop it into the iframe URL fragment as `#token=…&o=…`.
|
|
109
109
|
*/
|
|
110
|
-
public async issueToken(input: IssueEmbedTokenInput): Promise<IssueEmbedTokenResult> {
|
|
110
|
+
public async issueToken(input: IssueEmbedTokenInput = {}): Promise<IssueEmbedTokenResult> {
|
|
111
111
|
const path = `/workspace/${this.workspaceId}/embed/event-log/issue-token`;
|
|
112
112
|
return this.postWithIamToken<IssueEmbedTokenResult>(path, this.serializeIssueBody(input));
|
|
113
113
|
}
|
|
@@ -123,7 +123,7 @@ export class EventLogEmbed {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
private serializeIssueBody(input: IssueEmbedTokenInput): Record<string, unknown> {
|
|
126
|
-
const body: Record<string, unknown> = {
|
|
126
|
+
const body: Record<string, unknown> = {};
|
|
127
127
|
if (input.capabilities) body.capabilities = input.capabilities;
|
|
128
128
|
if (input.sessionId) body.sessionId = input.sessionId;
|
|
129
129
|
if (input.ttlSeconds !== undefined) body.ttlSeconds = input.ttlSeconds;
|
package/src/realtime/manager.ts
CHANGED
|
@@ -6,6 +6,9 @@ import type {
|
|
|
6
6
|
RealtimeSubscription,
|
|
7
7
|
RealtimeRecordEvent,
|
|
8
8
|
RealtimeCloseEvent,
|
|
9
|
+
EventLogSubscribeOptions,
|
|
10
|
+
RealtimeEventLogEntry,
|
|
11
|
+
RealtimeEvent,
|
|
9
12
|
} from '../types/realtime';
|
|
10
13
|
|
|
11
14
|
// Use native EventSource in browser, polyfill in Node.js
|
|
@@ -158,6 +161,23 @@ export class RealtimeManager {
|
|
|
158
161
|
url.searchParams.set('runId', options.runId);
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
// Add stream selection + Event Log filters (CEN-1302 Part B)
|
|
165
|
+
if (options.streams?.length) {
|
|
166
|
+
url.searchParams.set('streams', options.streams.join(','));
|
|
167
|
+
}
|
|
168
|
+
if (options.sources?.length) {
|
|
169
|
+
url.searchParams.set('sources', options.sources.join(','));
|
|
170
|
+
}
|
|
171
|
+
if (options.correlationId) {
|
|
172
|
+
url.searchParams.set('correlationId', options.correlationId);
|
|
173
|
+
}
|
|
174
|
+
if (options.triggerId) {
|
|
175
|
+
url.searchParams.set('triggerId', options.triggerId);
|
|
176
|
+
}
|
|
177
|
+
if (options.dlq !== undefined) {
|
|
178
|
+
url.searchParams.set('dlq', String(options.dlq));
|
|
179
|
+
}
|
|
180
|
+
|
|
161
181
|
// Create EventSource (uses polyfill in Node.js)
|
|
162
182
|
eventSource = new EventSourceImpl(url.toString());
|
|
163
183
|
|
|
@@ -289,4 +309,36 @@ export class RealtimeManager {
|
|
|
289
309
|
},
|
|
290
310
|
};
|
|
291
311
|
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Subscribe to the unified Event Log stream (CEN-1302 Part B).
|
|
315
|
+
*
|
|
316
|
+
* Delivers metadata-only {@link RealtimeEventLogEntry} rows for the three
|
|
317
|
+
* Tier-1 projection sources (inbound, record-change, outbound delivery) on
|
|
318
|
+
* the opt-in `eventlog` stream — never mixed with raw record/compute/
|
|
319
|
+
* orchestration events. Entries match the shape the Event Log console list
|
|
320
|
+
* renders, so they can be prepended without translation.
|
|
321
|
+
*
|
|
322
|
+
* Like {@link subscribe}, this delivers only new entries after connect; load
|
|
323
|
+
* the historical page via the Event Log query endpoint first, then prepend.
|
|
324
|
+
*
|
|
325
|
+
* @param options - Event Log subscription options
|
|
326
|
+
* @returns Subscription handle with unsubscribe()
|
|
327
|
+
*/
|
|
328
|
+
public subscribeEventLog(options: EventLogSubscribeOptions): RealtimeSubscription {
|
|
329
|
+
return this.subscribe({
|
|
330
|
+
streams: ['eventlog'],
|
|
331
|
+
sources: options.sources,
|
|
332
|
+
// eventType filtering reuses the shared `events` query param server-side.
|
|
333
|
+
events: options.eventTypes as RealtimeSubscribeOptions['events'],
|
|
334
|
+
correlationId: options.correlationId,
|
|
335
|
+
triggerId: options.triggerId,
|
|
336
|
+
dlq: options.dlq,
|
|
337
|
+
onEvent: (event: RealtimeEvent) =>
|
|
338
|
+
options.onEvent(event as unknown as RealtimeEventLogEntry),
|
|
339
|
+
onError: options.onError,
|
|
340
|
+
onConnected: options.onConnected,
|
|
341
|
+
onDisconnected: options.onDisconnected,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
292
344
|
}
|
package/src/types/embed.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Capabilities that can be encoded into an embed token.
|
|
11
11
|
*
|
|
12
|
-
* - `events:read` — list + retrieve event-log rows
|
|
12
|
+
* - `events:read` — list + retrieve the workspace's event-log rows.
|
|
13
13
|
* IAM unconditionally injects this on every minted token, so omitting
|
|
14
14
|
* `capabilities` is equivalent to `['events:read']`.
|
|
15
15
|
* - `events:replay` — allow the iframe to replay a failed delivery. The
|
|
@@ -18,14 +18,6 @@
|
|
|
18
18
|
export type EmbedCapability = 'events:read' | 'events:replay';
|
|
19
19
|
|
|
20
20
|
export interface IssueEmbedTokenInput {
|
|
21
|
-
/**
|
|
22
|
-
* Tenant id the embed is allowed to read. Burned into the token claim;
|
|
23
|
-
* the data-service auto-injects this as a filter on every query the
|
|
24
|
-
* iframe makes. Centrali never interprets the bytes — treat it as
|
|
25
|
-
* opaque (1-255 chars).
|
|
26
|
-
*/
|
|
27
|
-
tenantId: string;
|
|
28
|
-
|
|
29
21
|
/**
|
|
30
22
|
* Defaults to `['events:read']`. Pass `['events:read', 'events:replay']`
|
|
31
23
|
* to allow the iframe's "Replay" action. The issuing service account
|
package/src/types/realtime.ts
CHANGED
|
@@ -332,6 +332,41 @@ export interface RealtimeOrchestrationRunEvent {
|
|
|
332
332
|
timestamp: string;
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Projection source tables for unified Event Log entries.
|
|
337
|
+
*/
|
|
338
|
+
export type EventLogSourceTable = 'inbound_events' | 'record_change_log' | 'webhook_deliveries';
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Unified Event Log entry from the realtime service (CEN-1302 Part B).
|
|
342
|
+
*
|
|
343
|
+
* Metadata only — mirrors the Tier-1 projection's metadata view. It carries no
|
|
344
|
+
* event payload/body; fetch full payloads via the Event Log query / get-event
|
|
345
|
+
* endpoints. Delivered on the opt-in `eventlog` stream.
|
|
346
|
+
*
|
|
347
|
+
* Matches: services/backend/realtime/internal/redis/message.go EventLogEntry
|
|
348
|
+
*/
|
|
349
|
+
export interface RealtimeEventLogEntry {
|
|
350
|
+
/** Projection discriminator, e.g. "inbound.http_trigger", "record.created", "outbound.webhook_delivery" */
|
|
351
|
+
eventType: string;
|
|
352
|
+
/** Projection source table */
|
|
353
|
+
sourceTable: EventLogSourceTable;
|
|
354
|
+
/** Source row id (matches the projection's sourceId) */
|
|
355
|
+
sourceId: string;
|
|
356
|
+
/** Workspace slug */
|
|
357
|
+
workspaceSlug: string;
|
|
358
|
+
/** Lineage chain id; empty/absent when the source row has none */
|
|
359
|
+
correlationId?: string;
|
|
360
|
+
/** 0 = inbound (host clock), 1 = record/webhook (DB clock) */
|
|
361
|
+
clockTier: 0 | 1;
|
|
362
|
+
/** Dead-letter marker (outbound deliveries); false otherwise */
|
|
363
|
+
dlq: boolean;
|
|
364
|
+
/** Inbound trigger id for per-integration scoping; empty/absent otherwise */
|
|
365
|
+
triggerId?: string;
|
|
366
|
+
/** ISO timestamp when the source event occurred */
|
|
367
|
+
timestamp: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
335
370
|
/**
|
|
336
371
|
* Close event payload from the realtime service.
|
|
337
372
|
*/
|
|
@@ -381,6 +416,21 @@ export interface RealtimeSubscribeOptions {
|
|
|
381
416
|
orchestrationId?: string;
|
|
382
417
|
/** Filter orchestration events to a specific run ID */
|
|
383
418
|
runId?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Streams to subscribe to (records / compute / orchestration / eventlog).
|
|
421
|
+
* Empty defaults to the legacy {records, compute, orchestration} set; the
|
|
422
|
+
* unified Event Log stream is opt-in. Prefer subscribeEventLog() over
|
|
423
|
+
* setting this directly. (CEN-1302 Part B)
|
|
424
|
+
*/
|
|
425
|
+
streams?: string[];
|
|
426
|
+
/** Event Log source-table filter (used with streams=['eventlog']) */
|
|
427
|
+
sources?: EventLogSourceTable[];
|
|
428
|
+
/** Event Log lineage-chain filter */
|
|
429
|
+
correlationId?: string;
|
|
430
|
+
/** Event Log inbound-trigger filter */
|
|
431
|
+
triggerId?: string;
|
|
432
|
+
/** Event Log dead-letter filter (true = DLQ only, false = non-DLQ only) */
|
|
433
|
+
dlq?: boolean;
|
|
384
434
|
/** Callback for record events */
|
|
385
435
|
onEvent: (event: RealtimeEvent) => void;
|
|
386
436
|
/** Callback for errors */
|
|
@@ -391,6 +441,30 @@ export interface RealtimeSubscribeOptions {
|
|
|
391
441
|
onDisconnected?: (reason?: string) => void;
|
|
392
442
|
}
|
|
393
443
|
|
|
444
|
+
/**
|
|
445
|
+
* Options for subscribing to the unified Event Log stream (CEN-1302 Part B).
|
|
446
|
+
*/
|
|
447
|
+
export interface EventLogSubscribeOptions {
|
|
448
|
+
/** Filter to these projection source tables. Empty = all sources */
|
|
449
|
+
sources?: EventLogSourceTable[];
|
|
450
|
+
/** Filter to these eventType discriminators (e.g. ["inbound.http_trigger"]). Empty = all */
|
|
451
|
+
eventTypes?: string[];
|
|
452
|
+
/** Filter to a single lineage chain */
|
|
453
|
+
correlationId?: string;
|
|
454
|
+
/** Filter to a single inbound trigger */
|
|
455
|
+
triggerId?: string;
|
|
456
|
+
/** Filter by dead-letter state (true = DLQ only, false = non-DLQ only) */
|
|
457
|
+
dlq?: boolean;
|
|
458
|
+
/** Callback for Event Log entries */
|
|
459
|
+
onEvent: (entry: RealtimeEventLogEntry) => void;
|
|
460
|
+
/** Callback for errors */
|
|
461
|
+
onError?: (error: RealtimeError) => void;
|
|
462
|
+
/** Callback when connected */
|
|
463
|
+
onConnected?: () => void;
|
|
464
|
+
/** Callback when disconnected */
|
|
465
|
+
onDisconnected?: (reason?: string) => void;
|
|
466
|
+
}
|
|
467
|
+
|
|
394
468
|
/**
|
|
395
469
|
* Realtime subscription handle returned by subscribe().
|
|
396
470
|
*/
|