@stackone/olap 1.72.0 → 1.72.1
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.cjs +7 -3
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -287,6 +287,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
287
287
|
AND ({sourceType:Array(String)} = [] OR sourceType IN {sourceType:Array(String)})
|
|
288
288
|
AND ({sourceId:Array(String)} = [] OR sourceId IN {sourceId:Array(String)})
|
|
289
289
|
AND ({sourceValue:Array(String)} = [] OR sourceValue IN {sourceValue:Array(String)})
|
|
290
|
+
AND ({authType:Array(String)} = [] OR authType IN {authType:Array(String)})
|
|
291
|
+
AND ({authId:Array(String)} = [] OR authId IN {authId:Array(String)})
|
|
290
292
|
AND ({mode:Array(String)} = [] OR mode IN {mode:Array(String)})
|
|
291
293
|
AND ({httpMethod:Array(String)} = [] OR httpMethod IN {httpMethod:Array(String)})
|
|
292
294
|
AND ({originOwnerId:Array(String)} = [] OR originOwnerId IN {originOwnerId:Array(String)})
|
|
@@ -315,6 +317,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
315
317
|
AND ({sourceType:Array(String)} = [] OR sourceType IN {sourceType:Array(String)})
|
|
316
318
|
AND ({sourceId:Array(String)} = [] OR sourceId IN {sourceId:Array(String)})
|
|
317
319
|
AND ({sourceValue:Array(String)} = [] OR sourceValue IN {sourceValue:Array(String)})
|
|
320
|
+
AND ({authType:Array(String)} = [] OR authType IN {authType:Array(String)})
|
|
321
|
+
AND ({authId:Array(String)} = [] OR authId IN {authId:Array(String)})
|
|
318
322
|
AND ({mode:Array(String)} = [] OR mode IN {mode:Array(String)})
|
|
319
323
|
AND ({httpMethod:Array(String)} = [] OR httpMethod IN {httpMethod:Array(String)})
|
|
320
324
|
AND ({originOwnerId:Array(String)} = [] OR originOwnerId IN {originOwnerId:Array(String)})
|
|
@@ -448,7 +452,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
448
452
|
${buildActionsFilters()}
|
|
449
453
|
AND ({startTime:Nullable(DateTime64(3))} IS NULL OR eventTime >= {startTime:Nullable(DateTime64(3))})
|
|
450
454
|
AND ({endTime:Nullable(DateTime64(3))} IS NULL OR eventTime <= {endTime:Nullable(DateTime64(3))})
|
|
451
|
-
`}function buildCombinedSourceSql(e){let t=[shouldIncludeUnified(e)?buildUnifiedSelect():void 0,shouldIncludeActions(e)?buildActionsSelect():void 0].filter(e=>e!==void 0);return t.length===0?`${buildUnifiedSelect()} AND 1 = 0`:t.join(` UNION ALL `)}function buildCommonLogParams(e){return{organizationId:toArray(e.organizationId),projectSecureId:toArray(e.projectSecureId),accountSecureId:toArray(e.accountSecureId),connectorKey:toArray(e.connectorKey),connectorVersion:toArray(e.connectorVersion),connectorOwner:toArray(e.connectorOwner),connectorProfileId:toArray(e.connectorProfileId),sourceType:toArray(e.sourceType),sourceId:toArray(e.sourceId),sourceValue:toArray(e.sourceValue),mode:toArray(e.mode),httpMethod:toArray(e.httpMethod),originOwnerId:toArray(e.originOwnerId),originOwnerName:toArray(e.originOwnerName),statusCode:toInt16Filter(e.statusCode).values,isBackground:e.isBackground===void 0?null:+!!e.isBackground,success:e.success===void 0?null:+!!e.success,startTime:toClickHouseDate(e.startTime),endTime:toClickHouseDate(e.endTime),logId:toArray(e.logId),requestId:toArray(e.requestId),resource:toArray(e.resource),service:toArray(e.service),subResource:toArray(e.subResource),childResource:toArray(e.childResource),action:toArray(e.action),actionRunId:toArray(e.actionRunId),actionId:toArray(e.actionId),actionType:toArray(e.actionType),category:toArray(e.category),path:toArray(untypedFilter(e,`path`)),accountId:toArray(untypedFilter(e,`accountId`)),riskLevel:toArray(untypedFilter(e,`riskLevel`)),status:toInt16Filter(untypedFilter(e,`status`)).values}}function buildCombinedLogsQuery(e){let{limit:t,offset:n}=buildPaginationParams(e.pageNumber,e.pageSize),r=sanitizeOrderBy(e.orderBy,b,`eventTime`),i=sanitizeOrderDirection(e.orderDirection);return{sql:`
|
|
455
|
+
`}function buildCombinedSourceSql(e){let t=[shouldIncludeUnified(e)?buildUnifiedSelect():void 0,shouldIncludeActions(e)?buildActionsSelect():void 0].filter(e=>e!==void 0);return t.length===0?`${buildUnifiedSelect()} AND 1 = 0`:t.join(` UNION ALL `)}function buildCommonLogParams(e){return{organizationId:toArray(e.organizationId),projectSecureId:toArray(e.projectSecureId),accountSecureId:toArray(e.accountSecureId),connectorKey:toArray(e.connectorKey),connectorVersion:toArray(e.connectorVersion),connectorOwner:toArray(e.connectorOwner),connectorProfileId:toArray(e.connectorProfileId),sourceType:toArray(e.sourceType),sourceId:toArray(e.sourceId),sourceValue:toArray(e.sourceValue),authType:toArray(e.authType),authId:toArray(e.authId),mode:toArray(e.mode),httpMethod:toArray(e.httpMethod),originOwnerId:toArray(e.originOwnerId),originOwnerName:toArray(e.originOwnerName),statusCode:toInt16Filter(e.statusCode).values,isBackground:e.isBackground===void 0?null:+!!e.isBackground,success:e.success===void 0?null:+!!e.success,startTime:toClickHouseDate(e.startTime),endTime:toClickHouseDate(e.endTime),logId:toArray(e.logId),requestId:toArray(e.requestId),resource:toArray(e.resource),service:toArray(e.service),subResource:toArray(e.subResource),childResource:toArray(e.childResource),action:toArray(e.action),actionRunId:toArray(e.actionRunId),actionId:toArray(e.actionId),actionType:toArray(e.actionType),category:toArray(e.category),path:toArray(untypedFilter(e,`path`)),accountId:toArray(untypedFilter(e,`accountId`)),riskLevel:toArray(untypedFilter(e,`riskLevel`)),status:toInt16Filter(untypedFilter(e,`status`)).values}}function buildCombinedLogsQuery(e){let{limit:t,offset:n}=buildPaginationParams(e.pageNumber,e.pageSize),r=sanitizeOrderBy(e.orderBy,b,`eventTime`),i=sanitizeOrderDirection(e.orderDirection);return{sql:`
|
|
452
456
|
WITH combined AS (
|
|
453
457
|
${buildCombinedSourceSql(e)}
|
|
454
458
|
)
|
|
@@ -470,7 +474,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
470
474
|
${buildActionsFilters()}
|
|
471
475
|
AND ({startTime:Nullable(DateTime64(3))} IS NULL OR eventTime >= {startTime:Nullable(DateTime64(3))})
|
|
472
476
|
AND ({endTime:Nullable(DateTime64(3))} IS NULL OR eventTime <= {endTime:Nullable(DateTime64(3))})
|
|
473
|
-
`),{sql:t.length>0?`SELECT sum(cnt) as total FROM (${t.join(` UNION ALL `)})`:`SELECT 0 as total`,params:buildCommonLogParams(e)}}registerQuery({id:`project_logs.json`,buildQuery:buildCombinedLogsQuery,buildCountQuery:buildCombinedLogsCountQuery});const x={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,isBackground:`isBackground`},S=new Set([`connectorKey`,`actionType`,`mode`,`service`,`resource`,`actionId`,`httpMethod`,`accountSecureId`,`sourceType`,`originOwnerId`,`sourceId`]);function buildDimensionsQuery(e){let t=toCsvArray(e.dimensions).map(s.snakeToCamel),n=e.maxValues??100,r=t.filter(e=>Object.prototype.hasOwnProperty.call(x,e));if(r.length===0)return{sql:`SELECT 1 WHERE 0`,params:{}};let i=buildCombinedSourceSql(e);return{sql:r.map(e=>{let t=x[e];return`
|
|
477
|
+
`),{sql:t.length>0?`SELECT sum(cnt) as total FROM (${t.join(` UNION ALL `)})`:`SELECT 0 as total`,params:buildCommonLogParams(e)}}registerQuery({id:`project_logs.json`,buildQuery:buildCombinedLogsQuery,buildCountQuery:buildCombinedLogsCountQuery});const x={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,authType:`authType`,authId:`authId`,isBackground:`isBackground`},S=new Set([`connectorKey`,`actionType`,`mode`,`service`,`resource`,`actionId`,`httpMethod`,`accountSecureId`,`sourceType`,`originOwnerId`,`sourceId`,`authType`,`authId`]);function buildDimensionsQuery(e){let t=toCsvArray(e.dimensions).map(s.snakeToCamel),n=e.maxValues??100,r=t.filter(e=>Object.prototype.hasOwnProperty.call(x,e));if(r.length===0)return{sql:`SELECT 1 WHERE 0`,params:{}};let i=buildCombinedSourceSql(e);return{sql:r.map(e=>{let t=x[e];return`
|
|
474
478
|
SELECT
|
|
475
479
|
'${e}' as dimension,
|
|
476
480
|
arrayReverseSort(
|
|
@@ -500,7 +504,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
500
504
|
WHERE ${t} IN {entityIds:Array(String)}
|
|
501
505
|
ORDER BY eventTime DESC
|
|
502
506
|
LIMIT 1 BY ${t}
|
|
503
|
-
`,r=toArray(e.entities?.ids),i=buildCommonLogParams(e);return{sql:n,params:{...i,...narrowScanFilter(i,t,r),entityIds:r}}};registerQuery({id:`project_last_logs.json`,buildQuery:buildLastLogsQuery});const C={Action:`action`,Step:`step`,Unified:`unified`,Provider:`provider`,Platform:`platform`},emptyQueryResult=()=>({logs:[],total:0,pageNumber:1,pageSize:0}),w={StartTime:`startTime`,EndTime:`endTime`,EventTime:`eventTime`,DurationMs:`durationMs`},T={Asc:`asc`,Desc:`desc`},E={Minute:`minute`,Hour:`hour`,Day:`day`,Week:`week`,Month:`month`,None:`none`},D={ConnectorKey:`connectorKey`,Success:`success`,ActionType:`actionType`,Mode:`mode`,Service:`service`,Resource:`resource`,ActionId:`actionId`,HttpMethod:`httpMethod`,AccountSecureId:`accountSecureId`,SourceType:`sourceType`,StatusCode:`statusCode`,OriginOwnerId:`originOwnerId`,SourceId:`sourceId`,IsBackground:`isBackground`},O={actions:[`external`],steps:[`external`],unified_requests:[`external`],provider_requests:[`external`],platform:[`internal`]},isPlatformLog=e=>typeof e==`object`&&!!e&&`logType`in e&&e.logType===C.Platform,k={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,isBackground:`isBackground`},A={minute:`toStartOfMinute`,hour:`toStartOfHour`,day:`toStartOfDay`,week:`toStartOfWeek`,month:`toStartOfMonth`},j={minute:60,hour:3600,day:86400,week:604800,month:2592e3};function buildTimeBucket(e,t){let n=Object.prototype.hasOwnProperty.call(A,e)?A[e]:`toStartOfHour`;if(t<=1)return`${n}(eventTime)`;let r=t*(Object.prototype.hasOwnProperty.call(j,e)?j[e]:3600);return`toDateTime(intDiv(toUnixTimestamp(${n}(eventTime)), ${r}) * ${r})`}function buildAggregationQuery(e){let t=toCsvArray(e.dimensions).map(s.snakeToCamel),n=e.intervalType??`hour`,r=Math.floor(Number(e.intervalPeriod??1)),i=Number.isFinite(r)&&r>0?r:1,a=t.filter(e=>Object.prototype.hasOwnProperty.call(k,e)).map(e=>k[e]),o=n===E.None?void 0:buildTimeBucket(n,i),c=[...o?[`${o} as startTime`]:[],`count() as count`,...a].join(`, `),l=[...o?[`startTime`]:[],...a],u=l.length>0?`GROUP BY ${l.join(`, `)}`:``,d=o?`ORDER BY startTime ASC`:``;return{sql:`
|
|
507
|
+
`,r=toArray(e.entities?.ids),i=buildCommonLogParams(e);return{sql:n,params:{...i,...narrowScanFilter(i,t,r),entityIds:r}}};registerQuery({id:`project_last_logs.json`,buildQuery:buildLastLogsQuery});const C={Action:`action`,Step:`step`,Unified:`unified`,Provider:`provider`,Platform:`platform`},emptyQueryResult=()=>({logs:[],total:0,pageNumber:1,pageSize:0}),w={StartTime:`startTime`,EndTime:`endTime`,EventTime:`eventTime`,DurationMs:`durationMs`},T={Asc:`asc`,Desc:`desc`},E={Minute:`minute`,Hour:`hour`,Day:`day`,Week:`week`,Month:`month`,None:`none`},D={ConnectorKey:`connectorKey`,Success:`success`,ActionType:`actionType`,Mode:`mode`,Service:`service`,Resource:`resource`,ActionId:`actionId`,HttpMethod:`httpMethod`,AccountSecureId:`accountSecureId`,SourceType:`sourceType`,StatusCode:`statusCode`,OriginOwnerId:`originOwnerId`,SourceId:`sourceId`,AuthType:`authType`,AuthId:`authId`,IsBackground:`isBackground`},O={actions:[`external`],steps:[`external`],unified_requests:[`external`],provider_requests:[`external`],platform:[`internal`]},isPlatformLog=e=>typeof e==`object`&&!!e&&`logType`in e&&e.logType===C.Platform,k={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,authType:`authType`,authId:`authId`,isBackground:`isBackground`},A={minute:`toStartOfMinute`,hour:`toStartOfHour`,day:`toStartOfDay`,week:`toStartOfWeek`,month:`toStartOfMonth`},j={minute:60,hour:3600,day:86400,week:604800,month:2592e3};function buildTimeBucket(e,t){let n=Object.prototype.hasOwnProperty.call(A,e)?A[e]:`toStartOfHour`;if(t<=1)return`${n}(eventTime)`;let r=t*(Object.prototype.hasOwnProperty.call(j,e)?j[e]:3600);return`toDateTime(intDiv(toUnixTimestamp(${n}(eventTime)), ${r}) * ${r})`}function buildAggregationQuery(e){let t=toCsvArray(e.dimensions).map(s.snakeToCamel),n=e.intervalType??`hour`,r=Math.floor(Number(e.intervalPeriod??1)),i=Number.isFinite(r)&&r>0?r:1,a=t.filter(e=>Object.prototype.hasOwnProperty.call(k,e)).map(e=>k[e]),o=n===E.None?void 0:buildTimeBucket(n,i),c=[...o?[`${o} as startTime`]:[],`count() as count`,...a].join(`, `),l=[...o?[`startTime`]:[],...a],u=l.length>0?`GROUP BY ${l.join(`, `)}`:``,d=o?`ORDER BY startTime ASC`:``;return{sql:`
|
|
504
508
|
WITH combined AS (
|
|
505
509
|
${buildCombinedSourceSql(e)}
|
|
506
510
|
)
|
package/dist/index.d.cts
CHANGED
|
@@ -656,6 +656,8 @@ declare const Dimension: {
|
|
|
656
656
|
readonly StatusCode: "statusCode";
|
|
657
657
|
readonly OriginOwnerId: "originOwnerId";
|
|
658
658
|
readonly SourceId: "sourceId";
|
|
659
|
+
readonly AuthType: "authType";
|
|
660
|
+
readonly AuthId: "authId";
|
|
659
661
|
readonly IsBackground: "isBackground";
|
|
660
662
|
};
|
|
661
663
|
type Dimension = (typeof Dimension)[keyof typeof Dimension];
|
package/dist/index.d.mts
CHANGED
|
@@ -655,6 +655,8 @@ declare const Dimension: {
|
|
|
655
655
|
readonly StatusCode: "statusCode";
|
|
656
656
|
readonly OriginOwnerId: "originOwnerId";
|
|
657
657
|
readonly SourceId: "sourceId";
|
|
658
|
+
readonly AuthType: "authType";
|
|
659
|
+
readonly AuthId: "authId";
|
|
658
660
|
readonly IsBackground: "isBackground";
|
|
659
661
|
};
|
|
660
662
|
type Dimension = (typeof Dimension)[keyof typeof Dimension];
|
package/dist/index.mjs
CHANGED
|
@@ -287,6 +287,8 @@ import{t as e}from"./chunk-BhWHdk3m.mjs";import{createClient as t}from"@clickhou
|
|
|
287
287
|
AND ({sourceType:Array(String)} = [] OR sourceType IN {sourceType:Array(String)})
|
|
288
288
|
AND ({sourceId:Array(String)} = [] OR sourceId IN {sourceId:Array(String)})
|
|
289
289
|
AND ({sourceValue:Array(String)} = [] OR sourceValue IN {sourceValue:Array(String)})
|
|
290
|
+
AND ({authType:Array(String)} = [] OR authType IN {authType:Array(String)})
|
|
291
|
+
AND ({authId:Array(String)} = [] OR authId IN {authId:Array(String)})
|
|
290
292
|
AND ({mode:Array(String)} = [] OR mode IN {mode:Array(String)})
|
|
291
293
|
AND ({httpMethod:Array(String)} = [] OR httpMethod IN {httpMethod:Array(String)})
|
|
292
294
|
AND ({originOwnerId:Array(String)} = [] OR originOwnerId IN {originOwnerId:Array(String)})
|
|
@@ -315,6 +317,8 @@ import{t as e}from"./chunk-BhWHdk3m.mjs";import{createClient as t}from"@clickhou
|
|
|
315
317
|
AND ({sourceType:Array(String)} = [] OR sourceType IN {sourceType:Array(String)})
|
|
316
318
|
AND ({sourceId:Array(String)} = [] OR sourceId IN {sourceId:Array(String)})
|
|
317
319
|
AND ({sourceValue:Array(String)} = [] OR sourceValue IN {sourceValue:Array(String)})
|
|
320
|
+
AND ({authType:Array(String)} = [] OR authType IN {authType:Array(String)})
|
|
321
|
+
AND ({authId:Array(String)} = [] OR authId IN {authId:Array(String)})
|
|
318
322
|
AND ({mode:Array(String)} = [] OR mode IN {mode:Array(String)})
|
|
319
323
|
AND ({httpMethod:Array(String)} = [] OR httpMethod IN {httpMethod:Array(String)})
|
|
320
324
|
AND ({originOwnerId:Array(String)} = [] OR originOwnerId IN {originOwnerId:Array(String)})
|
|
@@ -448,7 +452,7 @@ import{t as e}from"./chunk-BhWHdk3m.mjs";import{createClient as t}from"@clickhou
|
|
|
448
452
|
${buildActionsFilters()}
|
|
449
453
|
AND ({startTime:Nullable(DateTime64(3))} IS NULL OR eventTime >= {startTime:Nullable(DateTime64(3))})
|
|
450
454
|
AND ({endTime:Nullable(DateTime64(3))} IS NULL OR eventTime <= {endTime:Nullable(DateTime64(3))})
|
|
451
|
-
`}function buildCombinedSourceSql(e){let t=[shouldIncludeUnified(e)?buildUnifiedSelect():void 0,shouldIncludeActions(e)?buildActionsSelect():void 0].filter(e=>e!==void 0);return t.length===0?`${buildUnifiedSelect()} AND 1 = 0`:t.join(` UNION ALL `)}function buildCommonLogParams(e){return{organizationId:toArray(e.organizationId),projectSecureId:toArray(e.projectSecureId),accountSecureId:toArray(e.accountSecureId),connectorKey:toArray(e.connectorKey),connectorVersion:toArray(e.connectorVersion),connectorOwner:toArray(e.connectorOwner),connectorProfileId:toArray(e.connectorProfileId),sourceType:toArray(e.sourceType),sourceId:toArray(e.sourceId),sourceValue:toArray(e.sourceValue),mode:toArray(e.mode),httpMethod:toArray(e.httpMethod),originOwnerId:toArray(e.originOwnerId),originOwnerName:toArray(e.originOwnerName),statusCode:toInt16Filter(e.statusCode).values,isBackground:e.isBackground===void 0?null:+!!e.isBackground,success:e.success===void 0?null:+!!e.success,startTime:toClickHouseDate(e.startTime),endTime:toClickHouseDate(e.endTime),logId:toArray(e.logId),requestId:toArray(e.requestId),resource:toArray(e.resource),service:toArray(e.service),subResource:toArray(e.subResource),childResource:toArray(e.childResource),action:toArray(e.action),actionRunId:toArray(e.actionRunId),actionId:toArray(e.actionId),actionType:toArray(e.actionType),category:toArray(e.category),path:toArray(untypedFilter(e,`path`)),accountId:toArray(untypedFilter(e,`accountId`)),riskLevel:toArray(untypedFilter(e,`riskLevel`)),status:toInt16Filter(untypedFilter(e,`status`)).values}}function buildCombinedLogsQuery(e){let{limit:t,offset:n}=buildPaginationParams(e.pageNumber,e.pageSize),r=sanitizeOrderBy(e.orderBy,le,`eventTime`),i=sanitizeOrderDirection(e.orderDirection);return{sql:`
|
|
455
|
+
`}function buildCombinedSourceSql(e){let t=[shouldIncludeUnified(e)?buildUnifiedSelect():void 0,shouldIncludeActions(e)?buildActionsSelect():void 0].filter(e=>e!==void 0);return t.length===0?`${buildUnifiedSelect()} AND 1 = 0`:t.join(` UNION ALL `)}function buildCommonLogParams(e){return{organizationId:toArray(e.organizationId),projectSecureId:toArray(e.projectSecureId),accountSecureId:toArray(e.accountSecureId),connectorKey:toArray(e.connectorKey),connectorVersion:toArray(e.connectorVersion),connectorOwner:toArray(e.connectorOwner),connectorProfileId:toArray(e.connectorProfileId),sourceType:toArray(e.sourceType),sourceId:toArray(e.sourceId),sourceValue:toArray(e.sourceValue),authType:toArray(e.authType),authId:toArray(e.authId),mode:toArray(e.mode),httpMethod:toArray(e.httpMethod),originOwnerId:toArray(e.originOwnerId),originOwnerName:toArray(e.originOwnerName),statusCode:toInt16Filter(e.statusCode).values,isBackground:e.isBackground===void 0?null:+!!e.isBackground,success:e.success===void 0?null:+!!e.success,startTime:toClickHouseDate(e.startTime),endTime:toClickHouseDate(e.endTime),logId:toArray(e.logId),requestId:toArray(e.requestId),resource:toArray(e.resource),service:toArray(e.service),subResource:toArray(e.subResource),childResource:toArray(e.childResource),action:toArray(e.action),actionRunId:toArray(e.actionRunId),actionId:toArray(e.actionId),actionType:toArray(e.actionType),category:toArray(e.category),path:toArray(untypedFilter(e,`path`)),accountId:toArray(untypedFilter(e,`accountId`)),riskLevel:toArray(untypedFilter(e,`riskLevel`)),status:toInt16Filter(untypedFilter(e,`status`)).values}}function buildCombinedLogsQuery(e){let{limit:t,offset:n}=buildPaginationParams(e.pageNumber,e.pageSize),r=sanitizeOrderBy(e.orderBy,le,`eventTime`),i=sanitizeOrderDirection(e.orderDirection);return{sql:`
|
|
452
456
|
WITH combined AS (
|
|
453
457
|
${buildCombinedSourceSql(e)}
|
|
454
458
|
)
|
|
@@ -470,7 +474,7 @@ import{t as e}from"./chunk-BhWHdk3m.mjs";import{createClient as t}from"@clickhou
|
|
|
470
474
|
${buildActionsFilters()}
|
|
471
475
|
AND ({startTime:Nullable(DateTime64(3))} IS NULL OR eventTime >= {startTime:Nullable(DateTime64(3))})
|
|
472
476
|
AND ({endTime:Nullable(DateTime64(3))} IS NULL OR eventTime <= {endTime:Nullable(DateTime64(3))})
|
|
473
|
-
`),{sql:t.length>0?`SELECT sum(cnt) as total FROM (${t.join(` UNION ALL `)})`:`SELECT 0 as total`,params:buildCommonLogParams(e)}}registerQuery({id:`project_logs.json`,buildQuery:buildCombinedLogsQuery,buildCountQuery:buildCombinedLogsCountQuery});const T={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,isBackground:`isBackground`},E=new Set([`connectorKey`,`actionType`,`mode`,`service`,`resource`,`actionId`,`httpMethod`,`accountSecureId`,`sourceType`,`originOwnerId`,`sourceId`]);function buildDimensionsQuery(e){let t=toCsvArray(e.dimensions).map(u),n=e.maxValues??100,r=t.filter(e=>Object.prototype.hasOwnProperty.call(T,e));if(r.length===0)return{sql:`SELECT 1 WHERE 0`,params:{}};let i=buildCombinedSourceSql(e);return{sql:r.map(e=>{let t=T[e];return`
|
|
477
|
+
`),{sql:t.length>0?`SELECT sum(cnt) as total FROM (${t.join(` UNION ALL `)})`:`SELECT 0 as total`,params:buildCommonLogParams(e)}}registerQuery({id:`project_logs.json`,buildQuery:buildCombinedLogsQuery,buildCountQuery:buildCombinedLogsCountQuery});const T={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,authType:`authType`,authId:`authId`,isBackground:`isBackground`},E=new Set([`connectorKey`,`actionType`,`mode`,`service`,`resource`,`actionId`,`httpMethod`,`accountSecureId`,`sourceType`,`originOwnerId`,`sourceId`,`authType`,`authId`]);function buildDimensionsQuery(e){let t=toCsvArray(e.dimensions).map(u),n=e.maxValues??100,r=t.filter(e=>Object.prototype.hasOwnProperty.call(T,e));if(r.length===0)return{sql:`SELECT 1 WHERE 0`,params:{}};let i=buildCombinedSourceSql(e);return{sql:r.map(e=>{let t=T[e];return`
|
|
474
478
|
SELECT
|
|
475
479
|
'${e}' as dimension,
|
|
476
480
|
arrayReverseSort(
|
|
@@ -500,7 +504,7 @@ import{t as e}from"./chunk-BhWHdk3m.mjs";import{createClient as t}from"@clickhou
|
|
|
500
504
|
WHERE ${t} IN {entityIds:Array(String)}
|
|
501
505
|
ORDER BY eventTime DESC
|
|
502
506
|
LIMIT 1 BY ${t}
|
|
503
|
-
`,r=toArray(e.entities?.ids),i=buildCommonLogParams(e);return{sql:n,params:{...i,...narrowScanFilter(i,t,r),entityIds:r}}};registerQuery({id:`project_last_logs.json`,buildQuery:buildLastLogsQuery});const D={Action:`action`,Step:`step`,Unified:`unified`,Provider:`provider`,Platform:`platform`},emptyQueryResult=()=>({logs:[],total:0,pageNumber:1,pageSize:0}),fe={StartTime:`startTime`,EndTime:`endTime`,EventTime:`eventTime`,DurationMs:`durationMs`},pe={Asc:`asc`,Desc:`desc`},O={Minute:`minute`,Hour:`hour`,Day:`day`,Week:`week`,Month:`month`,None:`none`},me={ConnectorKey:`connectorKey`,Success:`success`,ActionType:`actionType`,Mode:`mode`,Service:`service`,Resource:`resource`,ActionId:`actionId`,HttpMethod:`httpMethod`,AccountSecureId:`accountSecureId`,SourceType:`sourceType`,StatusCode:`statusCode`,OriginOwnerId:`originOwnerId`,SourceId:`sourceId`,IsBackground:`isBackground`},k={actions:[`external`],steps:[`external`],unified_requests:[`external`],provider_requests:[`external`],platform:[`internal`]},isPlatformLog=e=>typeof e==`object`&&!!e&&`logType`in e&&e.logType===D.Platform,A={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,isBackground:`isBackground`},j={minute:`toStartOfMinute`,hour:`toStartOfHour`,day:`toStartOfDay`,week:`toStartOfWeek`,month:`toStartOfMonth`},M={minute:60,hour:3600,day:86400,week:604800,month:2592e3};function buildTimeBucket(e,t){let n=Object.prototype.hasOwnProperty.call(j,e)?j[e]:`toStartOfHour`;if(t<=1)return`${n}(eventTime)`;let r=t*(Object.prototype.hasOwnProperty.call(M,e)?M[e]:3600);return`toDateTime(intDiv(toUnixTimestamp(${n}(eventTime)), ${r}) * ${r})`}function buildAggregationQuery(e){let t=toCsvArray(e.dimensions).map(u),n=e.intervalType??`hour`,r=Math.floor(Number(e.intervalPeriod??1)),i=Number.isFinite(r)&&r>0?r:1,a=t.filter(e=>Object.prototype.hasOwnProperty.call(A,e)).map(e=>A[e]),o=n===O.None?void 0:buildTimeBucket(n,i),s=[...o?[`${o} as startTime`]:[],`count() as count`,...a].join(`, `),c=[...o?[`startTime`]:[],...a],l=c.length>0?`GROUP BY ${c.join(`, `)}`:``,d=o?`ORDER BY startTime ASC`:``;return{sql:`
|
|
507
|
+
`,r=toArray(e.entities?.ids),i=buildCommonLogParams(e);return{sql:n,params:{...i,...narrowScanFilter(i,t,r),entityIds:r}}};registerQuery({id:`project_last_logs.json`,buildQuery:buildLastLogsQuery});const D={Action:`action`,Step:`step`,Unified:`unified`,Provider:`provider`,Platform:`platform`},emptyQueryResult=()=>({logs:[],total:0,pageNumber:1,pageSize:0}),fe={StartTime:`startTime`,EndTime:`endTime`,EventTime:`eventTime`,DurationMs:`durationMs`},pe={Asc:`asc`,Desc:`desc`},O={Minute:`minute`,Hour:`hour`,Day:`day`,Week:`week`,Month:`month`,None:`none`},me={ConnectorKey:`connectorKey`,Success:`success`,ActionType:`actionType`,Mode:`mode`,Service:`service`,Resource:`resource`,ActionId:`actionId`,HttpMethod:`httpMethod`,AccountSecureId:`accountSecureId`,SourceType:`sourceType`,StatusCode:`statusCode`,OriginOwnerId:`originOwnerId`,SourceId:`sourceId`,AuthType:`authType`,AuthId:`authId`,IsBackground:`isBackground`},k={actions:[`external`],steps:[`external`],unified_requests:[`external`],provider_requests:[`external`],platform:[`internal`]},isPlatformLog=e=>typeof e==`object`&&!!e&&`logType`in e&&e.logType===D.Platform,A={connectorKey:`connectorKey`,success:`success`,actionType:`actionType`,mode:`mode`,service:`service`,resource:`resource`,actionId:`actionId`,httpMethod:`httpMethod`,accountSecureId:`accountSecureId`,sourceType:`sourceType`,statusCode:`statusCode`,originOwnerId:`originOwnerId`,sourceId:`sourceId`,authType:`authType`,authId:`authId`,isBackground:`isBackground`},j={minute:`toStartOfMinute`,hour:`toStartOfHour`,day:`toStartOfDay`,week:`toStartOfWeek`,month:`toStartOfMonth`},M={minute:60,hour:3600,day:86400,week:604800,month:2592e3};function buildTimeBucket(e,t){let n=Object.prototype.hasOwnProperty.call(j,e)?j[e]:`toStartOfHour`;if(t<=1)return`${n}(eventTime)`;let r=t*(Object.prototype.hasOwnProperty.call(M,e)?M[e]:3600);return`toDateTime(intDiv(toUnixTimestamp(${n}(eventTime)), ${r}) * ${r})`}function buildAggregationQuery(e){let t=toCsvArray(e.dimensions).map(u),n=e.intervalType??`hour`,r=Math.floor(Number(e.intervalPeriod??1)),i=Number.isFinite(r)&&r>0?r:1,a=t.filter(e=>Object.prototype.hasOwnProperty.call(A,e)).map(e=>A[e]),o=n===O.None?void 0:buildTimeBucket(n,i),s=[...o?[`${o} as startTime`]:[],`count() as count`,...a].join(`, `),c=[...o?[`startTime`]:[],...a],l=c.length>0?`GROUP BY ${c.join(`, `)}`:``,d=o?`ORDER BY startTime ASC`:``;return{sql:`
|
|
504
508
|
WITH combined AS (
|
|
505
509
|
${buildCombinedSourceSql(e)}
|
|
506
510
|
)
|