@stackone/olap 3.3.0 → 3.4.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.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ILogger } from "@stackone/logger";
2
2
  import { Producer } from "@platformatic/kafka";
3
+ import { z } from "zod";
3
4
  import { Storage } from "@stackone/storage";
4
5
 
5
6
  //#region \0rolldown/runtime.js
@@ -493,6 +494,103 @@ type PlatformResult = {
493
494
  endTime?: Date;
494
495
  };
495
496
  //#endregion
497
+ //#region src/logs/queryConditions.d.ts
498
+ declare const LOG_QUERY_COLUMNS: {
499
+ readonly account_secure_id: 'accountSecureId';
500
+ readonly connector_key: 'connectorKey';
501
+ readonly connector_version: 'connectorVersion';
502
+ readonly connector_owner: 'connectorOwner';
503
+ readonly connector_profile_id: 'connectorProfileId';
504
+ readonly action_id: 'actionId';
505
+ readonly action_run_id: 'actionRunId';
506
+ readonly action_type: 'actionType';
507
+ readonly source_type: 'sourceType';
508
+ readonly source_id: 'sourceId';
509
+ readonly mode: 'mode';
510
+ readonly origin_owner_id: 'originOwnerId';
511
+ readonly origin_owner_name: 'originOwnerName';
512
+ readonly auth_type: 'authType';
513
+ readonly auth_id: 'authId';
514
+ readonly user_agent: 'userAgent';
515
+ readonly ip_address: 'ipAddress';
516
+ readonly session_id: 'sessionId';
517
+ readonly agent_id: 'agentId';
518
+ readonly transport_type: 'transportType';
519
+ readonly stream_type: 'streamType';
520
+ readonly http_method: 'httpMethod';
521
+ readonly service: 'service';
522
+ readonly resource: 'resource';
523
+ readonly risk_level: 'riskLevel';
524
+ readonly policy_result: 'policyResult';
525
+ readonly success: 'success';
526
+ readonly is_background: 'isBackground';
527
+ readonly status_code: 'statusCode';
528
+ readonly duration_ms: 'durationMs';
529
+ readonly log_id: 'logId';
530
+ readonly request_id: 'requestId';
531
+ readonly session_auth_id: "if(authType = 'SESSION_TOKEN', authId, NULL)";
532
+ };
533
+ type LogQueryField = keyof typeof LOG_QUERY_COLUMNS;
534
+ declare const LOG_QUERY_FIELDS: LogQueryField[];
535
+ declare const LOG_QUERY_OPERATORS: readonly ['eq', 'ne', 'gt', 'gte', 'lt', 'lte'];
536
+ type LogQueryOperator = (typeof LOG_QUERY_OPERATORS)[number];
537
+ declare const CONDITION_SCHEMA: z.ZodObject<{
538
+ field: z.ZodEnum<{
539
+ account_secure_id: "account_secure_id";
540
+ action_id: "action_id";
541
+ action_run_id: "action_run_id";
542
+ action_type: "action_type";
543
+ agent_id: "agent_id";
544
+ auth_id: "auth_id";
545
+ auth_type: "auth_type";
546
+ connector_key: "connector_key";
547
+ connector_owner: "connector_owner";
548
+ connector_profile_id: "connector_profile_id";
549
+ connector_version: "connector_version";
550
+ duration_ms: "duration_ms";
551
+ http_method: "http_method";
552
+ ip_address: "ip_address";
553
+ is_background: "is_background";
554
+ log_id: "log_id";
555
+ mode: "mode";
556
+ origin_owner_id: "origin_owner_id";
557
+ origin_owner_name: "origin_owner_name";
558
+ policy_result: "policy_result";
559
+ request_id: "request_id";
560
+ resource: "resource";
561
+ risk_level: "risk_level";
562
+ service: "service";
563
+ session_auth_id: "session_auth_id";
564
+ session_id: "session_id";
565
+ source_id: "source_id";
566
+ source_type: "source_type";
567
+ status_code: "status_code";
568
+ stream_type: "stream_type";
569
+ success: "success";
570
+ transport_type: "transport_type";
571
+ user_agent: "user_agent";
572
+ }>;
573
+ operator: z.ZodEnum<{
574
+ eq: "eq";
575
+ gt: "gt";
576
+ gte: "gte";
577
+ lt: "lt";
578
+ lte: "lte";
579
+ ne: "ne";
580
+ }>;
581
+ values: z.ZodArray<z.ZodString>;
582
+ }, z.core.$strip>;
583
+ type LogQueryCondition = z.infer<typeof CONDITION_SCHEMA>;
584
+ declare class InvalidLogQueryConditionsError extends Error {
585
+ readonly issues: {
586
+ path: (string | number)[];
587
+ message: string;
588
+ }[];
589
+ readonly cause: z.ZodError;
590
+ constructor(error: z.ZodError);
591
+ }
592
+ declare const parseLogQueryConditions: (conditions?: unknown) => LogQueryCondition[];
593
+ //#endregion
496
594
  //#region src/logs/types.d.ts
497
595
  declare const LogType: {
498
596
  readonly Action: 'action';
@@ -508,6 +606,7 @@ type AuthPair = {
508
606
  authId: string;
509
607
  };
510
608
  type Query = {
609
+ conditions?: readonly LogQueryCondition[];
511
610
  organizationId?: string | string[];
512
611
  projectSecureId?: string | string[];
513
612
  actionRunId?: string | string[];
@@ -821,7 +920,7 @@ type PlatformDimensionsQuery = Partial<PlatformQuery> & {
821
920
  dimensions: PlatformDimension[];
822
921
  maxValues?: number;
823
922
  };
824
- type SourceQuery = Omit<Partial<Query>, 'authPairs'>;
923
+ type SourceQuery = Omit<Partial<Query>, 'authPairs' | 'conditions'>;
825
924
  type ActionsCountQuery = {
826
925
  organizationId?: string;
827
926
  startTime: Date;
@@ -1042,6 +1141,11 @@ declare class InvalidAuthPairError extends Error {
1042
1141
  constructor(message: string);
1043
1142
  }
1044
1143
  //#endregion
1144
+ //#region src/logs/logsSink.d.ts
1145
+ declare class QueryClientNotConfiguredError extends Error {
1146
+ constructor();
1147
+ }
1148
+ //#endregion
1045
1149
  //#region src/datasets/types.d.ts
1046
1150
  type LogfireConfig = {
1047
1151
  token?: string;
@@ -1213,4 +1317,4 @@ declare class PolicySink implements IPolicySink {
1213
1317
  //#region src/utils/stepErrors.d.ts
1214
1318
  declare const hasErrorEntries: (errors: unknown) => boolean;
1215
1319
  //#endregion
1216
- export { type ActionAdvancedLog, type ActionInput, type ActionLog, type ActionResult, type ActionsCountQuery, type ActionsQuery, type ActionsQueryResult, type AdvancedLogMetadata, type AdvancedOptions, type AdvancedPiiScrubber, type AdvancedSinkConfig, type AggregateQuery, type AggregateResult, type AuthPair, AuthType, type AuthType as AuthTypeValue, type ClickHouseConfig, type CombinedLogType, DEFAULT_TOPIC_CLUSTER_MAP, type DatasetsOptions, type DatasetsSinkConfig, type DefenderContext, type DefenderLog, type DefenderOptions, type DefenderSinkConfig, Dimension, type Dimension as DimensionValues, type DimensionsQuery, type DimensionsResult, type FaultedPolicySet, type FieldLabelProvenance, type ILog, type IOlapClient, type IPolicySink, type InternalKafkaClientBuilder, type InternalKafkaClientConfig, IntervalType, type IntervalType as IntervalTypeValues, InvalidAuthPairError, type KafkaClientBuilder, type KafkaClientConfig, type KafkaClusterName, type LogEntities, LogType, type LogType as LogTypeValues, type LogfireConfig, type LogsOptions, OlapClient, OlapClientManager, type OlapOptions, type OlapSinkConfig, OrderBy, type OrderBy as OrderByValues, OrderDirection, type OrderDirection as OrderDirectionValues, type PlatformAdvancedLog, PlatformDimension, type PlatformDimension as PlatformDimensionValues, type PlatformDimensionsQuery, type PlatformInput, type PlatformLog, type PlatformQuery, type PlatformQueryResult, type PlatformResult, type PolicyContext, type PolicyLog, type PolicyObservation, type PolicyOptions, type PolicyRecord, type PolicyResult, PolicySink, type PolicySinkConfig, type ProviderAdvancedLog, type ProviderInput, type ProviderLog, type ProviderQuery, type ProviderQueryResult, type ProviderResult, type Query, type QueryResult, type SASLMechanism, type Source, type SourceQuery, type SourceResult, SourceType, type SourceType as SourceTypeValue, type StepAdvancedLog, type StepInput, type StepLog, type StepResult, type StepsQuery, type StepsQueryResult, StreamType, type StreamType as StreamTypeValue, type TopicClusterMap, TransportType, type TransportType as TransportTypeValue, type TruncationMode, type UnenforcedRedaction, type UnifiedAdvancedLog, type UnifiedInput, type UnifiedLog, type UnifiedQuery, type UnifiedQueryResult, type UnifiedResult, type WithheldReason, getPolicySink, hasErrorEntries };
1320
+ export { type ActionAdvancedLog, type ActionInput, type ActionLog, type ActionResult, type ActionsCountQuery, type ActionsQuery, type ActionsQueryResult, type AdvancedLogMetadata, type AdvancedOptions, type AdvancedPiiScrubber, type AdvancedSinkConfig, type AggregateQuery, type AggregateResult, type AuthPair, AuthType, type AuthType as AuthTypeValue, type ClickHouseConfig, type CombinedLogType, DEFAULT_TOPIC_CLUSTER_MAP, type DatasetsOptions, type DatasetsSinkConfig, type DefenderContext, type DefenderLog, type DefenderOptions, type DefenderSinkConfig, Dimension, type Dimension as DimensionValues, type DimensionsQuery, type DimensionsResult, type FaultedPolicySet, type FieldLabelProvenance, type ILog, type IOlapClient, type IPolicySink, type InternalKafkaClientBuilder, type InternalKafkaClientConfig, IntervalType, type IntervalType as IntervalTypeValues, InvalidAuthPairError, InvalidLogQueryConditionsError, type KafkaClientBuilder, type KafkaClientConfig, type KafkaClusterName, LOG_QUERY_FIELDS, LOG_QUERY_OPERATORS, type LogEntities, type LogQueryCondition, type LogQueryField, type LogQueryOperator, LogType, type LogType as LogTypeValues, type LogfireConfig, type LogsOptions, OlapClient, OlapClientManager, type OlapOptions, type OlapSinkConfig, OrderBy, type OrderBy as OrderByValues, OrderDirection, type OrderDirection as OrderDirectionValues, type PlatformAdvancedLog, PlatformDimension, type PlatformDimension as PlatformDimensionValues, type PlatformDimensionsQuery, type PlatformInput, type PlatformLog, type PlatformQuery, type PlatformQueryResult, type PlatformResult, type PolicyContext, type PolicyLog, type PolicyObservation, type PolicyOptions, type PolicyRecord, type PolicyResult, PolicySink, type PolicySinkConfig, type ProviderAdvancedLog, type ProviderInput, type ProviderLog, type ProviderQuery, type ProviderQueryResult, type ProviderResult, type Query, QueryClientNotConfiguredError, type QueryResult, type SASLMechanism, type Source, type SourceQuery, type SourceResult, SourceType, type SourceType as SourceTypeValue, type StepAdvancedLog, type StepInput, type StepLog, type StepResult, type StepsQuery, type StepsQueryResult, StreamType, type StreamType as StreamTypeValue, type TopicClusterMap, TransportType, type TransportType as TransportTypeValue, type TruncationMode, type UnenforcedRedaction, type UnifiedAdvancedLog, type UnifiedInput, type UnifiedLog, type UnifiedQuery, type UnifiedQueryResult, type UnifiedResult, type WithheldReason, getPolicySink, hasErrorEntries, parseLogQueryConditions };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { t as __name } from "./chunk-BhWHdk3m.mjs";
2
+ import { z } from "zod";
2
3
  import { Storage } from "@stackone/storage";
3
4
  import { ILogger } from "@stackone/logger";
4
5
  import { Producer } from "@platformatic/kafka";
@@ -492,6 +493,103 @@ type PlatformResult = {
492
493
  endTime?: Date;
493
494
  };
494
495
  //#endregion
496
+ //#region src/logs/queryConditions.d.ts
497
+ declare const LOG_QUERY_COLUMNS: {
498
+ readonly account_secure_id: 'accountSecureId';
499
+ readonly connector_key: 'connectorKey';
500
+ readonly connector_version: 'connectorVersion';
501
+ readonly connector_owner: 'connectorOwner';
502
+ readonly connector_profile_id: 'connectorProfileId';
503
+ readonly action_id: 'actionId';
504
+ readonly action_run_id: 'actionRunId';
505
+ readonly action_type: 'actionType';
506
+ readonly source_type: 'sourceType';
507
+ readonly source_id: 'sourceId';
508
+ readonly mode: 'mode';
509
+ readonly origin_owner_id: 'originOwnerId';
510
+ readonly origin_owner_name: 'originOwnerName';
511
+ readonly auth_type: 'authType';
512
+ readonly auth_id: 'authId';
513
+ readonly user_agent: 'userAgent';
514
+ readonly ip_address: 'ipAddress';
515
+ readonly session_id: 'sessionId';
516
+ readonly agent_id: 'agentId';
517
+ readonly transport_type: 'transportType';
518
+ readonly stream_type: 'streamType';
519
+ readonly http_method: 'httpMethod';
520
+ readonly service: 'service';
521
+ readonly resource: 'resource';
522
+ readonly risk_level: 'riskLevel';
523
+ readonly policy_result: 'policyResult';
524
+ readonly success: 'success';
525
+ readonly is_background: 'isBackground';
526
+ readonly status_code: 'statusCode';
527
+ readonly duration_ms: 'durationMs';
528
+ readonly log_id: 'logId';
529
+ readonly request_id: 'requestId';
530
+ readonly session_auth_id: "if(authType = 'SESSION_TOKEN', authId, NULL)";
531
+ };
532
+ type LogQueryField = keyof typeof LOG_QUERY_COLUMNS;
533
+ declare const LOG_QUERY_FIELDS: LogQueryField[];
534
+ declare const LOG_QUERY_OPERATORS: readonly ['eq', 'ne', 'gt', 'gte', 'lt', 'lte'];
535
+ type LogQueryOperator = (typeof LOG_QUERY_OPERATORS)[number];
536
+ declare const CONDITION_SCHEMA: z.ZodObject<{
537
+ field: z.ZodEnum<{
538
+ account_secure_id: "account_secure_id";
539
+ action_id: "action_id";
540
+ action_run_id: "action_run_id";
541
+ action_type: "action_type";
542
+ agent_id: "agent_id";
543
+ auth_id: "auth_id";
544
+ auth_type: "auth_type";
545
+ connector_key: "connector_key";
546
+ connector_owner: "connector_owner";
547
+ connector_profile_id: "connector_profile_id";
548
+ connector_version: "connector_version";
549
+ duration_ms: "duration_ms";
550
+ http_method: "http_method";
551
+ ip_address: "ip_address";
552
+ is_background: "is_background";
553
+ log_id: "log_id";
554
+ mode: "mode";
555
+ origin_owner_id: "origin_owner_id";
556
+ origin_owner_name: "origin_owner_name";
557
+ policy_result: "policy_result";
558
+ request_id: "request_id";
559
+ resource: "resource";
560
+ risk_level: "risk_level";
561
+ service: "service";
562
+ session_auth_id: "session_auth_id";
563
+ session_id: "session_id";
564
+ source_id: "source_id";
565
+ source_type: "source_type";
566
+ status_code: "status_code";
567
+ stream_type: "stream_type";
568
+ success: "success";
569
+ transport_type: "transport_type";
570
+ user_agent: "user_agent";
571
+ }>;
572
+ operator: z.ZodEnum<{
573
+ eq: "eq";
574
+ gt: "gt";
575
+ gte: "gte";
576
+ lt: "lt";
577
+ lte: "lte";
578
+ ne: "ne";
579
+ }>;
580
+ values: z.ZodArray<z.ZodString>;
581
+ }, z.core.$strip>;
582
+ type LogQueryCondition = z.infer<typeof CONDITION_SCHEMA>;
583
+ declare class InvalidLogQueryConditionsError extends Error {
584
+ readonly issues: {
585
+ path: (string | number)[];
586
+ message: string;
587
+ }[];
588
+ readonly cause: z.ZodError;
589
+ constructor(error: z.ZodError);
590
+ }
591
+ declare const parseLogQueryConditions: (conditions?: unknown) => LogQueryCondition[];
592
+ //#endregion
495
593
  //#region src/logs/types.d.ts
496
594
  declare const LogType: {
497
595
  readonly Action: 'action';
@@ -507,6 +605,7 @@ type AuthPair = {
507
605
  authId: string;
508
606
  };
509
607
  type Query = {
608
+ conditions?: readonly LogQueryCondition[];
510
609
  organizationId?: string | string[];
511
610
  projectSecureId?: string | string[];
512
611
  actionRunId?: string | string[];
@@ -820,7 +919,7 @@ type PlatformDimensionsQuery = Partial<PlatformQuery> & {
820
919
  dimensions: PlatformDimension[];
821
920
  maxValues?: number;
822
921
  };
823
- type SourceQuery = Omit<Partial<Query>, 'authPairs'>;
922
+ type SourceQuery = Omit<Partial<Query>, 'authPairs' | 'conditions'>;
824
923
  type ActionsCountQuery = {
825
924
  organizationId?: string;
826
925
  startTime: Date;
@@ -1041,6 +1140,11 @@ declare class InvalidAuthPairError extends Error {
1041
1140
  constructor(message: string);
1042
1141
  }
1043
1142
  //#endregion
1143
+ //#region src/logs/logsSink.d.ts
1144
+ declare class QueryClientNotConfiguredError extends Error {
1145
+ constructor();
1146
+ }
1147
+ //#endregion
1044
1148
  //#region src/datasets/types.d.ts
1045
1149
  type LogfireConfig = {
1046
1150
  token?: string;
@@ -1212,4 +1316,4 @@ declare class PolicySink implements IPolicySink {
1212
1316
  //#region src/utils/stepErrors.d.ts
1213
1317
  declare const hasErrorEntries: (errors: unknown) => boolean;
1214
1318
  //#endregion
1215
- export { type ActionAdvancedLog, type ActionInput, type ActionLog, type ActionResult, type ActionsCountQuery, type ActionsQuery, type ActionsQueryResult, type AdvancedLogMetadata, type AdvancedOptions, type AdvancedPiiScrubber, type AdvancedSinkConfig, type AggregateQuery, type AggregateResult, type AuthPair, AuthType, type AuthType as AuthTypeValue, type ClickHouseConfig, type CombinedLogType, DEFAULT_TOPIC_CLUSTER_MAP, type DatasetsOptions, type DatasetsSinkConfig, type DefenderContext, type DefenderLog, type DefenderOptions, type DefenderSinkConfig, Dimension, type Dimension as DimensionValues, type DimensionsQuery, type DimensionsResult, type FaultedPolicySet, type FieldLabelProvenance, type ILog, type IOlapClient, type IPolicySink, type InternalKafkaClientBuilder, type InternalKafkaClientConfig, IntervalType, type IntervalType as IntervalTypeValues, InvalidAuthPairError, type KafkaClientBuilder, type KafkaClientConfig, type KafkaClusterName, type LogEntities, LogType, type LogType as LogTypeValues, type LogfireConfig, type LogsOptions, OlapClient, OlapClientManager, type OlapOptions, type OlapSinkConfig, OrderBy, type OrderBy as OrderByValues, OrderDirection, type OrderDirection as OrderDirectionValues, type PlatformAdvancedLog, PlatformDimension, type PlatformDimension as PlatformDimensionValues, type PlatformDimensionsQuery, type PlatformInput, type PlatformLog, type PlatformQuery, type PlatformQueryResult, type PlatformResult, type PolicyContext, type PolicyLog, type PolicyObservation, type PolicyOptions, type PolicyRecord, type PolicyResult, PolicySink, type PolicySinkConfig, type ProviderAdvancedLog, type ProviderInput, type ProviderLog, type ProviderQuery, type ProviderQueryResult, type ProviderResult, type Query, type QueryResult, type SASLMechanism, type Source, type SourceQuery, type SourceResult, SourceType, type SourceType as SourceTypeValue, type StepAdvancedLog, type StepInput, type StepLog, type StepResult, type StepsQuery, type StepsQueryResult, StreamType, type StreamType as StreamTypeValue, type TopicClusterMap, TransportType, type TransportType as TransportTypeValue, type TruncationMode, type UnenforcedRedaction, type UnifiedAdvancedLog, type UnifiedInput, type UnifiedLog, type UnifiedQuery, type UnifiedQueryResult, type UnifiedResult, type WithheldReason, getPolicySink, hasErrorEntries };
1319
+ export { type ActionAdvancedLog, type ActionInput, type ActionLog, type ActionResult, type ActionsCountQuery, type ActionsQuery, type ActionsQueryResult, type AdvancedLogMetadata, type AdvancedOptions, type AdvancedPiiScrubber, type AdvancedSinkConfig, type AggregateQuery, type AggregateResult, type AuthPair, AuthType, type AuthType as AuthTypeValue, type ClickHouseConfig, type CombinedLogType, DEFAULT_TOPIC_CLUSTER_MAP, type DatasetsOptions, type DatasetsSinkConfig, type DefenderContext, type DefenderLog, type DefenderOptions, type DefenderSinkConfig, Dimension, type Dimension as DimensionValues, type DimensionsQuery, type DimensionsResult, type FaultedPolicySet, type FieldLabelProvenance, type ILog, type IOlapClient, type IPolicySink, type InternalKafkaClientBuilder, type InternalKafkaClientConfig, IntervalType, type IntervalType as IntervalTypeValues, InvalidAuthPairError, InvalidLogQueryConditionsError, type KafkaClientBuilder, type KafkaClientConfig, type KafkaClusterName, LOG_QUERY_FIELDS, LOG_QUERY_OPERATORS, type LogEntities, type LogQueryCondition, type LogQueryField, type LogQueryOperator, LogType, type LogType as LogTypeValues, type LogfireConfig, type LogsOptions, OlapClient, OlapClientManager, type OlapOptions, type OlapSinkConfig, OrderBy, type OrderBy as OrderByValues, OrderDirection, type OrderDirection as OrderDirectionValues, type PlatformAdvancedLog, PlatformDimension, type PlatformDimension as PlatformDimensionValues, type PlatformDimensionsQuery, type PlatformInput, type PlatformLog, type PlatformQuery, type PlatformQueryResult, type PlatformResult, type PolicyContext, type PolicyLog, type PolicyObservation, type PolicyOptions, type PolicyRecord, type PolicyResult, PolicySink, type PolicySinkConfig, type ProviderAdvancedLog, type ProviderInput, type ProviderLog, type ProviderQuery, type ProviderQueryResult, type ProviderResult, type Query, QueryClientNotConfiguredError, type QueryResult, type SASLMechanism, type Source, type SourceQuery, type SourceResult, SourceType, type SourceType as SourceTypeValue, type StepAdvancedLog, type StepInput, type StepLog, type StepResult, type StepsQuery, type StepsQueryResult, StreamType, type StreamType as StreamTypeValue, type TopicClusterMap, TransportType, type TransportType as TransportTypeValue, type TruncationMode, type UnenforcedRedaction, type UnifiedAdvancedLog, type UnifiedInput, type UnifiedLog, type UnifiedQuery, type UnifiedQueryResult, type UnifiedResult, type WithheldReason, getPolicySink, hasErrorEntries, parseLogQueryConditions };