@stackone/olap 1.71.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 +4 -2
- package/dist/index.d.mts +4 -2
- 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
|
@@ -182,7 +182,7 @@ interface IOlapClient {
|
|
|
182
182
|
getUnifiedLog(organizationId: string, projectSecureId: string, requestId: string, engine?: OlapEngine): Promise<UnifiedLog | undefined>;
|
|
183
183
|
getProviderLogs(organizationId: string, projectSecureId: string, query: ProviderQuery, engine?: OlapEngine): Promise<ProviderQueryResult>;
|
|
184
184
|
getProviderLog(organizationId: string, projectSecureId: string, requestId: string, id: string, engine?: OlapEngine): Promise<ProviderLog | undefined>;
|
|
185
|
-
getPlatformLogs(organizationId: string, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
185
|
+
getPlatformLogs(organizationId: string | undefined, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
186
186
|
getActionAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string): Promise<ActionAdvancedLog | undefined>;
|
|
187
187
|
getStepAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string, stepIndex: number): Promise<StepAdvancedLog | undefined>;
|
|
188
188
|
getUnifiedAdvancedLog(organizationId: string, projectSecureId: string, requestId: string): Promise<UnifiedAdvancedLog | undefined>;
|
|
@@ -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];
|
|
@@ -1039,7 +1041,7 @@ declare class OlapClient implements IOlapClient {
|
|
|
1039
1041
|
getUnifiedLogs(organizationId: string, projectSecureId: string, query: UnifiedQuery, engine?: OlapEngine): Promise<UnifiedQueryResult>;
|
|
1040
1042
|
getUnifiedLog(organizationId: string, projectSecureId: string, requestId: string, engine?: OlapEngine): Promise<UnifiedLog | undefined>;
|
|
1041
1043
|
getProviderLogs(organizationId: string, projectSecureId: string, query: ProviderQuery, engine?: OlapEngine): Promise<ProviderQueryResult>;
|
|
1042
|
-
getPlatformLogs(organizationId: string, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
1044
|
+
getPlatformLogs(organizationId: string | undefined, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
1043
1045
|
getProviderLog(organizationId: string, projectSecureId: string, requestId: string, id: string, engine?: OlapEngine): Promise<ProviderLog | undefined>;
|
|
1044
1046
|
getActionAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string): Promise<ActionAdvancedLog | undefined>;
|
|
1045
1047
|
getStepAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string, stepIndex: number): Promise<StepAdvancedLog | undefined>;
|
package/dist/index.d.mts
CHANGED
|
@@ -181,7 +181,7 @@ interface IOlapClient {
|
|
|
181
181
|
getUnifiedLog(organizationId: string, projectSecureId: string, requestId: string, engine?: OlapEngine): Promise<UnifiedLog | undefined>;
|
|
182
182
|
getProviderLogs(organizationId: string, projectSecureId: string, query: ProviderQuery, engine?: OlapEngine): Promise<ProviderQueryResult>;
|
|
183
183
|
getProviderLog(organizationId: string, projectSecureId: string, requestId: string, id: string, engine?: OlapEngine): Promise<ProviderLog | undefined>;
|
|
184
|
-
getPlatformLogs(organizationId: string, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
184
|
+
getPlatformLogs(organizationId: string | undefined, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
185
185
|
getActionAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string): Promise<ActionAdvancedLog | undefined>;
|
|
186
186
|
getStepAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string, stepIndex: number): Promise<StepAdvancedLog | undefined>;
|
|
187
187
|
getUnifiedAdvancedLog(organizationId: string, projectSecureId: string, requestId: string): Promise<UnifiedAdvancedLog | undefined>;
|
|
@@ -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];
|
|
@@ -1038,7 +1040,7 @@ declare class OlapClient implements IOlapClient {
|
|
|
1038
1040
|
getUnifiedLogs(organizationId: string, projectSecureId: string, query: UnifiedQuery, engine?: OlapEngine): Promise<UnifiedQueryResult>;
|
|
1039
1041
|
getUnifiedLog(organizationId: string, projectSecureId: string, requestId: string, engine?: OlapEngine): Promise<UnifiedLog | undefined>;
|
|
1040
1042
|
getProviderLogs(organizationId: string, projectSecureId: string, query: ProviderQuery, engine?: OlapEngine): Promise<ProviderQueryResult>;
|
|
1041
|
-
getPlatformLogs(organizationId: string, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
1043
|
+
getPlatformLogs(organizationId: string | undefined, query: PlatformQuery): Promise<PlatformQueryResult>;
|
|
1042
1044
|
getProviderLog(organizationId: string, projectSecureId: string, requestId: string, id: string, engine?: OlapEngine): Promise<ProviderLog | undefined>;
|
|
1043
1045
|
getActionAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string): Promise<ActionAdvancedLog | undefined>;
|
|
1044
1046
|
getStepAdvancedLog(organizationId: string, projectSecureId: string, actionRunId: string, stepIndex: number): Promise<StepAdvancedLog | undefined>;
|
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
|
)
|