@microsoft/sentinel-cli 0.1.0 → 0.2.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.js +987 -378
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_correlationService = __commonJS({
|
|
|
44
44
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
45
45
|
exports2.CorrelationService = void 0;
|
|
46
46
|
var crypto_1 = require("crypto");
|
|
47
|
-
var
|
|
47
|
+
var CorrelationService4 = class {
|
|
48
48
|
/**
|
|
49
49
|
* Creates a new correlation context with a unique ID for request tracking.
|
|
50
50
|
* @returns A UUID string to be used as a correlation ID in API requests and telemetry.
|
|
@@ -61,7 +61,7 @@ var require_correlationService = __commonJS({
|
|
|
61
61
|
return response?.headers?.["x-ms-correlation-request-id"];
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
exports2.CorrelationService =
|
|
64
|
+
exports2.CorrelationService = CorrelationService4;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -187,7 +187,7 @@ var require_requestService = __commonJS({
|
|
|
187
187
|
retryableStatusCodes: Object.freeze([429, 500, 502, 503, 504]),
|
|
188
188
|
retryableErrors: Object.freeze(["ECONNRESET", "ETIMEDOUT", "ENOTFOUND", "ECONNABORTED"])
|
|
189
189
|
});
|
|
190
|
-
var
|
|
190
|
+
var RequestService3 = class {
|
|
191
191
|
telemetry;
|
|
192
192
|
headerBuilder;
|
|
193
193
|
constructor(telemetry, headerBuilder) {
|
|
@@ -439,7 +439,7 @@ var require_requestService = __commonJS({
|
|
|
439
439
|
return urlObj.toString();
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
|
-
exports2.RequestService =
|
|
442
|
+
exports2.RequestService = RequestService3;
|
|
443
443
|
function getPathFromUrl(url) {
|
|
444
444
|
const urlObject = new URL(url);
|
|
445
445
|
return urlObject.pathname;
|
|
@@ -473,13 +473,61 @@ var require_client = __commonJS({
|
|
|
473
473
|
}
|
|
474
474
|
});
|
|
475
475
|
|
|
476
|
-
// ../../packages/common/dist/src/constants.js
|
|
476
|
+
// ../../packages/common/dist/src/constants/jobEventNames.js
|
|
477
|
+
var require_jobEventNames = __commonJS({
|
|
478
|
+
"../../packages/common/dist/src/constants/jobEventNames.js"(exports2) {
|
|
479
|
+
"use strict";
|
|
480
|
+
init_cjs_shims();
|
|
481
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
482
|
+
exports2.JobApiEvents = void 0;
|
|
483
|
+
exports2.JobApiEvents = {
|
|
484
|
+
LOAD_JOBS: "JobsPanel.Load.Jobs",
|
|
485
|
+
CREATE_JOB: "Jobs.Create.Job",
|
|
486
|
+
GET_JOB: "Jobs.Get.Job",
|
|
487
|
+
DELETE_JOB: "Jobs.Delete.Job"
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
// ../../packages/common/dist/src/constants/lakeEventNames.js
|
|
493
|
+
var require_lakeEventNames = __commonJS({
|
|
494
|
+
"../../packages/common/dist/src/constants/lakeEventNames.js"(exports2) {
|
|
495
|
+
"use strict";
|
|
496
|
+
init_cjs_shims();
|
|
497
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
498
|
+
exports2.LakeApiEvents = void 0;
|
|
499
|
+
exports2.LakeApiEvents = {
|
|
500
|
+
LOAD_TABLES: "LakeTablesPanel.Load.Tables",
|
|
501
|
+
LOAD_DATABASES: "LakeTablesPanel.Load.Databases"
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
// ../../packages/common/dist/src/constants/index.js
|
|
477
507
|
var require_constants = __commonJS({
|
|
478
|
-
"../../packages/common/dist/src/constants.js"(exports2) {
|
|
508
|
+
"../../packages/common/dist/src/constants/index.js"(exports2) {
|
|
479
509
|
"use strict";
|
|
480
510
|
init_cjs_shims();
|
|
511
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
512
|
+
if (k2 === void 0) k2 = k;
|
|
513
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
514
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
515
|
+
desc = { enumerable: true, get: function() {
|
|
516
|
+
return m[k];
|
|
517
|
+
} };
|
|
518
|
+
}
|
|
519
|
+
Object.defineProperty(o, k2, desc);
|
|
520
|
+
}) : (function(o, m, k, k2) {
|
|
521
|
+
if (k2 === void 0) k2 = k;
|
|
522
|
+
o[k2] = m[k];
|
|
523
|
+
}));
|
|
524
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
525
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
526
|
+
};
|
|
481
527
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
482
528
|
exports2.FulfillmentStatus = exports2.PackageManifestIdValues = exports2.PackageManifestTypes = exports2.CANCEL_DEPLOYMENT_REQUEST_TYPE = exports2.NEW_DEPLOYMENT_REQUEST_TYPE = void 0;
|
|
529
|
+
__exportStar(require_jobEventNames(), exports2);
|
|
530
|
+
__exportStar(require_lakeEventNames(), exports2);
|
|
483
531
|
exports2.NEW_DEPLOYMENT_REQUEST_TYPE = "NewDeploymentRequest";
|
|
484
532
|
exports2.CANCEL_DEPLOYMENT_REQUEST_TYPE = "CancelSubscription";
|
|
485
533
|
var PackageManifestTypes;
|
|
@@ -539,10 +587,10 @@ var require_securityPlatformEnvironment = __commonJS({
|
|
|
539
587
|
init_cjs_shims();
|
|
540
588
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
541
589
|
exports2.SecurityPlatformEnvironment = void 0;
|
|
542
|
-
var
|
|
543
|
-
(function(
|
|
544
|
-
|
|
545
|
-
})(
|
|
590
|
+
var SecurityPlatformEnvironment8;
|
|
591
|
+
(function(SecurityPlatformEnvironment9) {
|
|
592
|
+
SecurityPlatformEnvironment9["Production"] = "production";
|
|
593
|
+
})(SecurityPlatformEnvironment8 || (exports2.SecurityPlatformEnvironment = SecurityPlatformEnvironment8 = {}));
|
|
546
594
|
}
|
|
547
595
|
});
|
|
548
596
|
|
|
@@ -644,9 +692,9 @@ var require_api_env = __commonJS({
|
|
|
644
692
|
"use strict";
|
|
645
693
|
init_cjs_shims();
|
|
646
694
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
647
|
-
exports2.getApiEnv =
|
|
695
|
+
exports2.getApiEnv = getApiEnv8;
|
|
648
696
|
var helper_1 = require_helper();
|
|
649
|
-
function
|
|
697
|
+
function getApiEnv8(env) {
|
|
650
698
|
return (0, helper_1.getEnvironmentConfig)(env);
|
|
651
699
|
}
|
|
652
700
|
}
|
|
@@ -2690,6 +2738,15 @@ var require_jobResponse = __commonJS({
|
|
|
2690
2738
|
}
|
|
2691
2739
|
});
|
|
2692
2740
|
|
|
2741
|
+
// ../../packages/common/dist/src/models/jobs/listJobsResult.js
|
|
2742
|
+
var require_listJobsResult = __commonJS({
|
|
2743
|
+
"../../packages/common/dist/src/models/jobs/listJobsResult.js"(exports2) {
|
|
2744
|
+
"use strict";
|
|
2745
|
+
init_cjs_shims();
|
|
2746
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
|
|
2693
2750
|
// ../../packages/common/dist/src/models/jobs/index.js
|
|
2694
2751
|
var require_jobs = __commonJS({
|
|
2695
2752
|
"../../packages/common/dist/src/models/jobs/index.js"(exports2) {
|
|
@@ -2719,6 +2776,7 @@ var require_jobs = __commonJS({
|
|
|
2719
2776
|
__exportStar(require_repeatFrequency(), exports2);
|
|
2720
2777
|
__exportStar(require_jobTrigger(), exports2);
|
|
2721
2778
|
__exportStar(require_jobResponse(), exports2);
|
|
2779
|
+
__exportStar(require_listJobsResult(), exports2);
|
|
2722
2780
|
}
|
|
2723
2781
|
});
|
|
2724
2782
|
|
|
@@ -2844,6 +2902,228 @@ var require_models = __commonJS({
|
|
|
2844
2902
|
}
|
|
2845
2903
|
});
|
|
2846
2904
|
|
|
2905
|
+
// ../../packages/common/dist/src/services/jobs/jobApiClient.js
|
|
2906
|
+
var require_jobApiClient = __commonJS({
|
|
2907
|
+
"../../packages/common/dist/src/services/jobs/jobApiClient.js"(exports2) {
|
|
2908
|
+
"use strict";
|
|
2909
|
+
init_cjs_shims();
|
|
2910
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2911
|
+
exports2.JobApiClient = void 0;
|
|
2912
|
+
var sentinel_graph_job_1 = require_dist();
|
|
2913
|
+
var jobEventNames_1 = require_jobEventNames();
|
|
2914
|
+
var API_VERSION = "2023-09-30-preview";
|
|
2915
|
+
var JOB_PATHS = {
|
|
2916
|
+
JOBS: "/jobs"
|
|
2917
|
+
};
|
|
2918
|
+
var JobApiClient2 = class {
|
|
2919
|
+
requestService;
|
|
2920
|
+
baseUrl;
|
|
2921
|
+
constructor(options) {
|
|
2922
|
+
this.requestService = options.requestService;
|
|
2923
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
2924
|
+
}
|
|
2925
|
+
get jobsUrl() {
|
|
2926
|
+
return `${this.baseUrl}${JOB_PATHS.JOBS}`;
|
|
2927
|
+
}
|
|
2928
|
+
jobUrl(jobName) {
|
|
2929
|
+
return `${this.jobsUrl}/${encodeURIComponent(jobName)}`;
|
|
2930
|
+
}
|
|
2931
|
+
async createJob(jobName, payload, token, requestId) {
|
|
2932
|
+
if (!jobName?.trim()) {
|
|
2933
|
+
throw new Error("Job name is required");
|
|
2934
|
+
}
|
|
2935
|
+
return this.requestService.put({
|
|
2936
|
+
url: this.jobUrl(jobName),
|
|
2937
|
+
params: { "api-version": API_VERSION },
|
|
2938
|
+
eventName: jobEventNames_1.JobApiEvents.CREATE_JOB,
|
|
2939
|
+
body: JSON.stringify(payload),
|
|
2940
|
+
token,
|
|
2941
|
+
requestId
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
async getJob(jobName, token, requestId) {
|
|
2945
|
+
if (!jobName?.trim()) {
|
|
2946
|
+
throw new Error("Job name is required");
|
|
2947
|
+
}
|
|
2948
|
+
return this.requestService.get({
|
|
2949
|
+
url: this.jobUrl(jobName),
|
|
2950
|
+
params: { "api-version": API_VERSION },
|
|
2951
|
+
eventName: jobEventNames_1.JobApiEvents.GET_JOB,
|
|
2952
|
+
token,
|
|
2953
|
+
requestId
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
async deleteJob(jobName, token, requestId) {
|
|
2957
|
+
if (!jobName?.trim()) {
|
|
2958
|
+
throw new Error("Job name is required");
|
|
2959
|
+
}
|
|
2960
|
+
return this.requestService.delete({
|
|
2961
|
+
url: this.jobUrl(jobName),
|
|
2962
|
+
params: { "api-version": API_VERSION },
|
|
2963
|
+
eventName: jobEventNames_1.JobApiEvents.DELETE_JOB,
|
|
2964
|
+
token,
|
|
2965
|
+
requestId
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
async listJobs(token, requestId) {
|
|
2969
|
+
const jobs = [];
|
|
2970
|
+
let continuationToken = void 0;
|
|
2971
|
+
do {
|
|
2972
|
+
const params = { jobType: sentinel_graph_job_1.JobType.Notebook, "api-version": API_VERSION };
|
|
2973
|
+
if (continuationToken !== null && continuationToken !== void 0) {
|
|
2974
|
+
params.continuationToken = continuationToken;
|
|
2975
|
+
}
|
|
2976
|
+
const data = await this.requestService.get({
|
|
2977
|
+
url: this.jobsUrl,
|
|
2978
|
+
params,
|
|
2979
|
+
eventName: jobEventNames_1.JobApiEvents.LOAD_JOBS,
|
|
2980
|
+
token,
|
|
2981
|
+
requestId
|
|
2982
|
+
});
|
|
2983
|
+
if (data?.results) {
|
|
2984
|
+
const pageJobs = data.results.map((result) => {
|
|
2985
|
+
if (!result.jobDefinition.jobName) {
|
|
2986
|
+
return null;
|
|
2987
|
+
}
|
|
2988
|
+
return {
|
|
2989
|
+
jobName: result.jobDefinition.jobName,
|
|
2990
|
+
id: result.jobDefinition.jobDefinitionId,
|
|
2991
|
+
isDisabled: result.jobDefinition.isDisabled,
|
|
2992
|
+
jobType: result.jobDefinition.jobType
|
|
2993
|
+
};
|
|
2994
|
+
}).filter((job) => job !== null);
|
|
2995
|
+
jobs.push(...pageJobs);
|
|
2996
|
+
}
|
|
2997
|
+
continuationToken = data?.continuationToken ?? null;
|
|
2998
|
+
} while (continuationToken !== null);
|
|
2999
|
+
return jobs;
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
exports2.JobApiClient = JobApiClient2;
|
|
3003
|
+
}
|
|
3004
|
+
});
|
|
3005
|
+
|
|
3006
|
+
// ../../packages/common/dist/src/services/jobs/index.js
|
|
3007
|
+
var require_jobs2 = __commonJS({
|
|
3008
|
+
"../../packages/common/dist/src/services/jobs/index.js"(exports2) {
|
|
3009
|
+
"use strict";
|
|
3010
|
+
init_cjs_shims();
|
|
3011
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3012
|
+
exports2.JobApiClient = void 0;
|
|
3013
|
+
var jobApiClient_1 = require_jobApiClient();
|
|
3014
|
+
Object.defineProperty(exports2, "JobApiClient", { enumerable: true, get: function() {
|
|
3015
|
+
return jobApiClient_1.JobApiClient;
|
|
3016
|
+
} });
|
|
3017
|
+
}
|
|
3018
|
+
});
|
|
3019
|
+
|
|
3020
|
+
// ../../packages/common/dist/src/services/lake/lakeApiClient.js
|
|
3021
|
+
var require_lakeApiClient = __commonJS({
|
|
3022
|
+
"../../packages/common/dist/src/services/lake/lakeApiClient.js"(exports2) {
|
|
3023
|
+
"use strict";
|
|
3024
|
+
init_cjs_shims();
|
|
3025
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3026
|
+
exports2.LakeApiClient = void 0;
|
|
3027
|
+
exports2.isFederatedTable = isFederatedTable;
|
|
3028
|
+
exports2.getFederatedDatasourceKind = getFederatedDatasourceKind;
|
|
3029
|
+
var lakeEventNames_1 = require_lakeEventNames();
|
|
3030
|
+
var FEDERATED_TABLE_TYPE = "Federated";
|
|
3031
|
+
function isFederatedTable(table) {
|
|
3032
|
+
return table.tableType === FEDERATED_TABLE_TYPE;
|
|
3033
|
+
}
|
|
3034
|
+
function getFederatedDatasourceKind(table) {
|
|
3035
|
+
return table.fabricDetails?.federationDetails?.federatedDatasourceKind;
|
|
3036
|
+
}
|
|
3037
|
+
var API_VERSION = {
|
|
3038
|
+
DATABASES_API_VERSION: "2024-07-01",
|
|
3039
|
+
TABLES_API_VERSION: "2024-05-01-preview"
|
|
3040
|
+
};
|
|
3041
|
+
var LAKE_PATHS = {
|
|
3042
|
+
TABLES: "/lake/tables",
|
|
3043
|
+
DATABASES: "/lake/databases"
|
|
3044
|
+
};
|
|
3045
|
+
var LakeApiClient2 = class {
|
|
3046
|
+
requestService;
|
|
3047
|
+
telemetry;
|
|
3048
|
+
baseUrl;
|
|
3049
|
+
constructor(options) {
|
|
3050
|
+
this.requestService = options.requestService;
|
|
3051
|
+
this.telemetry = options.telemetry;
|
|
3052
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, "");
|
|
3053
|
+
}
|
|
3054
|
+
get tablesUrl() {
|
|
3055
|
+
return `${this.baseUrl}${LAKE_PATHS.TABLES}`;
|
|
3056
|
+
}
|
|
3057
|
+
get databasesUrl() {
|
|
3058
|
+
return `${this.baseUrl}${LAKE_PATHS.DATABASES}`;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* Fetches all lake tables. If a database is specified, fetches tables for that database only.
|
|
3062
|
+
*/
|
|
3063
|
+
async fetchLakeTables(accessToken, clientRequestId, database) {
|
|
3064
|
+
const span = this.telemetry.span(lakeEventNames_1.LakeApiEvents.LOAD_TABLES, { requestId: clientRequestId ?? "" });
|
|
3065
|
+
try {
|
|
3066
|
+
let url = this.tablesUrl;
|
|
3067
|
+
let params = database ? { databaseName: database.databaseName } : void 0;
|
|
3068
|
+
const tables = [];
|
|
3069
|
+
do {
|
|
3070
|
+
const response = await this.fetchTables(url, accessToken, clientRequestId, params);
|
|
3071
|
+
tables.push(...response.items);
|
|
3072
|
+
url = response.nextLink || null;
|
|
3073
|
+
params = void 0;
|
|
3074
|
+
} while (url);
|
|
3075
|
+
return tables;
|
|
3076
|
+
} finally {
|
|
3077
|
+
span.end();
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
async fetchDatabases(accessToken, clientRequestId) {
|
|
3081
|
+
const data = await this.requestService.get({
|
|
3082
|
+
url: this.databasesUrl,
|
|
3083
|
+
params: { "api-version": API_VERSION.DATABASES_API_VERSION },
|
|
3084
|
+
eventName: lakeEventNames_1.LakeApiEvents.LOAD_DATABASES,
|
|
3085
|
+
token: accessToken,
|
|
3086
|
+
requestId: clientRequestId
|
|
3087
|
+
});
|
|
3088
|
+
return data.value;
|
|
3089
|
+
}
|
|
3090
|
+
async fetchTables(url, accessToken, clientRequestId, params) {
|
|
3091
|
+
return this.requestService.get({
|
|
3092
|
+
url,
|
|
3093
|
+
params: {
|
|
3094
|
+
"api-version": API_VERSION.TABLES_API_VERSION,
|
|
3095
|
+
...params
|
|
3096
|
+
},
|
|
3097
|
+
eventName: lakeEventNames_1.LakeApiEvents.LOAD_TABLES,
|
|
3098
|
+
token: accessToken,
|
|
3099
|
+
requestId: clientRequestId
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
exports2.LakeApiClient = LakeApiClient2;
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
|
|
3107
|
+
// ../../packages/common/dist/src/services/lake/index.js
|
|
3108
|
+
var require_lake2 = __commonJS({
|
|
3109
|
+
"../../packages/common/dist/src/services/lake/index.js"(exports2) {
|
|
3110
|
+
"use strict";
|
|
3111
|
+
init_cjs_shims();
|
|
3112
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3113
|
+
exports2.getFederatedDatasourceKind = exports2.isFederatedTable = exports2.LakeApiClient = void 0;
|
|
3114
|
+
var lakeApiClient_1 = require_lakeApiClient();
|
|
3115
|
+
Object.defineProperty(exports2, "LakeApiClient", { enumerable: true, get: function() {
|
|
3116
|
+
return lakeApiClient_1.LakeApiClient;
|
|
3117
|
+
} });
|
|
3118
|
+
Object.defineProperty(exports2, "isFederatedTable", { enumerable: true, get: function() {
|
|
3119
|
+
return lakeApiClient_1.isFederatedTable;
|
|
3120
|
+
} });
|
|
3121
|
+
Object.defineProperty(exports2, "getFederatedDatasourceKind", { enumerable: true, get: function() {
|
|
3122
|
+
return lakeApiClient_1.getFederatedDatasourceKind;
|
|
3123
|
+
} });
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3126
|
+
|
|
2847
3127
|
// ../../packages/common/dist/src/services/httpService.js
|
|
2848
3128
|
var require_httpService = __commonJS({
|
|
2849
3129
|
"../../packages/common/dist/src/services/httpService.js"(exports2) {
|
|
@@ -2855,7 +3135,7 @@ var require_httpService = __commonJS({
|
|
|
2855
3135
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2856
3136
|
exports2.HttpService = void 0;
|
|
2857
3137
|
var axios_1 = __importDefault(require("axios"));
|
|
2858
|
-
var
|
|
3138
|
+
var HttpService = class {
|
|
2859
3139
|
httpInstance;
|
|
2860
3140
|
// Implement the interface
|
|
2861
3141
|
constructor(httpInstance) {
|
|
@@ -2920,7 +3200,7 @@ var require_httpService = __commonJS({
|
|
|
2920
3200
|
}
|
|
2921
3201
|
}
|
|
2922
3202
|
};
|
|
2923
|
-
exports2.HttpService =
|
|
3203
|
+
exports2.HttpService = HttpService;
|
|
2924
3204
|
}
|
|
2925
3205
|
});
|
|
2926
3206
|
|
|
@@ -2933,81 +3213,6 @@ var require_httpServiceInterface = __commonJS({
|
|
|
2933
3213
|
}
|
|
2934
3214
|
});
|
|
2935
3215
|
|
|
2936
|
-
// ../../packages/common/dist/src/services/jobService.js
|
|
2937
|
-
var require_jobService = __commonJS({
|
|
2938
|
-
"../../packages/common/dist/src/services/jobService.js"(exports2) {
|
|
2939
|
-
"use strict";
|
|
2940
|
-
init_cjs_shims();
|
|
2941
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2942
|
-
exports2.JobService = void 0;
|
|
2943
|
-
var JobService2 = class {
|
|
2944
|
-
env;
|
|
2945
|
-
region;
|
|
2946
|
-
httpInstance;
|
|
2947
|
-
API_VERSION = "2023-09-30-preview";
|
|
2948
|
-
constructor(env, region, httpInstance) {
|
|
2949
|
-
this.env = env;
|
|
2950
|
-
this.region = region;
|
|
2951
|
-
this.httpInstance = httpInstance;
|
|
2952
|
-
if (!env || !region) {
|
|
2953
|
-
throw new Error("Environment and region must be provided.");
|
|
2954
|
-
}
|
|
2955
|
-
if (!env.regions[region]) {
|
|
2956
|
-
throw new Error(`Region ${region} is not configured.`);
|
|
2957
|
-
}
|
|
2958
|
-
if (!httpInstance) {
|
|
2959
|
-
throw new Error("HTTP service instance must be provided.");
|
|
2960
|
-
}
|
|
2961
|
-
this.httpInstance = httpInstance;
|
|
2962
|
-
}
|
|
2963
|
-
async getHttpInstance() {
|
|
2964
|
-
return this.httpInstance;
|
|
2965
|
-
}
|
|
2966
|
-
getBaseUrl() {
|
|
2967
|
-
const regionConfig = this.env.regions[this.region];
|
|
2968
|
-
return regionConfig.gatewayEndpoint;
|
|
2969
|
-
}
|
|
2970
|
-
async createJob(jobName, payload) {
|
|
2971
|
-
if (!jobName?.trim()) {
|
|
2972
|
-
throw new Error("Job name is required");
|
|
2973
|
-
}
|
|
2974
|
-
const httpInstance = await this.getHttpInstance();
|
|
2975
|
-
const url = `${this.getBaseUrl()}jobs/${encodeURIComponent(jobName)}?api-version=${this.API_VERSION}`;
|
|
2976
|
-
const { data } = await httpInstance.put(url, payload);
|
|
2977
|
-
return data;
|
|
2978
|
-
}
|
|
2979
|
-
async getJob(jobName) {
|
|
2980
|
-
if (!jobName?.trim()) {
|
|
2981
|
-
throw new Error("Job name is required");
|
|
2982
|
-
}
|
|
2983
|
-
const httpInstance = await this.getHttpInstance();
|
|
2984
|
-
const url = `${this.getBaseUrl()}jobs/${encodeURIComponent(jobName)}?api-version=${this.API_VERSION}`;
|
|
2985
|
-
const { data } = await httpInstance.get(url);
|
|
2986
|
-
return data;
|
|
2987
|
-
}
|
|
2988
|
-
async deleteJob(jobName) {
|
|
2989
|
-
if (!jobName?.trim()) {
|
|
2990
|
-
throw new Error("Job name is required");
|
|
2991
|
-
}
|
|
2992
|
-
const httpInstance = await this.getHttpInstance();
|
|
2993
|
-
const url = `${this.getBaseUrl()}jobs/${encodeURIComponent(jobName)}?api-version=${this.API_VERSION}`;
|
|
2994
|
-
const { data } = await httpInstance.delete(url);
|
|
2995
|
-
return data;
|
|
2996
|
-
}
|
|
2997
|
-
};
|
|
2998
|
-
exports2.JobService = JobService2;
|
|
2999
|
-
}
|
|
3000
|
-
});
|
|
3001
|
-
|
|
3002
|
-
// ../../packages/common/dist/src/services/jobServiceInterface.js
|
|
3003
|
-
var require_jobServiceInterface = __commonJS({
|
|
3004
|
-
"../../packages/common/dist/src/services/jobServiceInterface.js"(exports2) {
|
|
3005
|
-
"use strict";
|
|
3006
|
-
init_cjs_shims();
|
|
3007
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3008
|
-
}
|
|
3009
|
-
});
|
|
3010
|
-
|
|
3011
3216
|
// ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/lib/common.js
|
|
3012
3217
|
var require_common2 = __commonJS({
|
|
3013
3218
|
"../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/lib/common.js"(exports2, module2) {
|
|
@@ -7056,10 +7261,10 @@ var require_services = __commonJS({
|
|
|
7056
7261
|
};
|
|
7057
7262
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7058
7263
|
__exportStar(require_httpConstants(), exports2);
|
|
7264
|
+
__exportStar(require_jobs2(), exports2);
|
|
7265
|
+
__exportStar(require_lake2(), exports2);
|
|
7059
7266
|
__exportStar(require_httpService(), exports2);
|
|
7060
7267
|
__exportStar(require_httpServiceInterface(), exports2);
|
|
7061
|
-
__exportStar(require_jobService(), exports2);
|
|
7062
|
-
__exportStar(require_jobServiceInterface(), exports2);
|
|
7063
7268
|
__exportStar(require_manifestProcessorService(), exports2);
|
|
7064
7269
|
__exportStar(require_manifestProcessorServiceInterface(), exports2);
|
|
7065
7270
|
__exportStar(require_packageService(), exports2);
|
|
@@ -7210,14 +7415,115 @@ function addCreateZipCommand(packageCommand) {
|
|
|
7210
7415
|
});
|
|
7211
7416
|
}
|
|
7212
7417
|
|
|
7213
|
-
// src/commands/
|
|
7418
|
+
// src/commands/lake/database.ts
|
|
7214
7419
|
init_cjs_shims();
|
|
7215
|
-
var
|
|
7420
|
+
var import_common9 = __toESM(require_src());
|
|
7216
7421
|
|
|
7217
|
-
// src/actions/
|
|
7422
|
+
// src/actions/lake/index.ts
|
|
7423
|
+
init_cjs_shims();
|
|
7424
|
+
|
|
7425
|
+
// src/actions/lake/listDatabases.ts
|
|
7218
7426
|
init_cjs_shims();
|
|
7219
|
-
var import_child_process = require("child_process");
|
|
7220
7427
|
var import_common3 = __toESM(require_src());
|
|
7428
|
+
async function listDatabases(databaseService, accessToken) {
|
|
7429
|
+
const requestId = import_common3.CorrelationService.createCorrelationContext();
|
|
7430
|
+
console.info("Fetching databases...");
|
|
7431
|
+
return databaseService.listDatabases(accessToken, requestId);
|
|
7432
|
+
}
|
|
7433
|
+
|
|
7434
|
+
// src/actions/lake/listTables.ts
|
|
7435
|
+
init_cjs_shims();
|
|
7436
|
+
var import_common4 = __toESM(require_src());
|
|
7437
|
+
async function listTables(tableService, accessToken, database) {
|
|
7438
|
+
const requestId = import_common4.CorrelationService.createCorrelationContext();
|
|
7439
|
+
const scope = database ? ` for database "${database.databaseName}"` : "";
|
|
7440
|
+
console.info(`Fetching lake tables${scope}...`);
|
|
7441
|
+
return tableService.listTables(accessToken, requestId, database);
|
|
7442
|
+
}
|
|
7443
|
+
|
|
7444
|
+
// src/services/lake/index.ts
|
|
7445
|
+
init_cjs_shims();
|
|
7446
|
+
|
|
7447
|
+
// src/services/lake/databaseService.ts
|
|
7448
|
+
init_cjs_shims();
|
|
7449
|
+
var DatabaseService = class {
|
|
7450
|
+
constructor(lakeApiClient) {
|
|
7451
|
+
this.lakeApiClient = lakeApiClient;
|
|
7452
|
+
}
|
|
7453
|
+
async listDatabases(accessToken, requestId) {
|
|
7454
|
+
return this.lakeApiClient.fetchDatabases(accessToken, requestId);
|
|
7455
|
+
}
|
|
7456
|
+
};
|
|
7457
|
+
|
|
7458
|
+
// src/services/lake/tableService.ts
|
|
7459
|
+
init_cjs_shims();
|
|
7460
|
+
var TableService = class {
|
|
7461
|
+
constructor(lakeApiClient) {
|
|
7462
|
+
this.lakeApiClient = lakeApiClient;
|
|
7463
|
+
}
|
|
7464
|
+
async listTables(accessToken, requestId, database) {
|
|
7465
|
+
return this.lakeApiClient.fetchLakeTables(accessToken, requestId, database);
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
|
|
7469
|
+
// src/services/lake/databaseLookup.ts
|
|
7470
|
+
init_cjs_shims();
|
|
7471
|
+
var SYSTEM_TABLES_DISPLAY_NAME = "System tables";
|
|
7472
|
+
var DEFAULT_DATABASE = { databaseName: "default" };
|
|
7473
|
+
async function lookupDatabase(options, lakeApiClient, accessToken) {
|
|
7474
|
+
if (options.databaseId) {
|
|
7475
|
+
if (options.databaseId === SYSTEM_TABLES_DISPLAY_NAME) {
|
|
7476
|
+
return DEFAULT_DATABASE;
|
|
7477
|
+
}
|
|
7478
|
+
return lookupDatabaseById(options.databaseId, lakeApiClient, accessToken);
|
|
7479
|
+
}
|
|
7480
|
+
if (options.databaseName) {
|
|
7481
|
+
if (options.databaseName === SYSTEM_TABLES_DISPLAY_NAME) {
|
|
7482
|
+
return DEFAULT_DATABASE;
|
|
7483
|
+
}
|
|
7484
|
+
return lookupDatabaseByName(options.databaseName, lakeApiClient, accessToken);
|
|
7485
|
+
}
|
|
7486
|
+
return void 0;
|
|
7487
|
+
}
|
|
7488
|
+
async function lookupDatabaseById(databaseId, lakeApiClient, accessToken) {
|
|
7489
|
+
const databaseService = new DatabaseService(lakeApiClient);
|
|
7490
|
+
const databases = await listDatabases(databaseService, accessToken);
|
|
7491
|
+
const match = databases.find((db) => db.databaseName === databaseId);
|
|
7492
|
+
if (!match) {
|
|
7493
|
+
console.error(
|
|
7494
|
+
`Error: database "${databaseId}" not found. Run "sentinel database list" to see available databases.`
|
|
7495
|
+
);
|
|
7496
|
+
process.exit(1);
|
|
7497
|
+
}
|
|
7498
|
+
return match;
|
|
7499
|
+
}
|
|
7500
|
+
async function lookupDatabaseByName(databaseName, lakeApiClient, accessToken) {
|
|
7501
|
+
const databaseService = new DatabaseService(lakeApiClient);
|
|
7502
|
+
const databases = await listDatabases(databaseService, accessToken);
|
|
7503
|
+
const match = databases.find((db) => db.sentinelWorkspace?.name === databaseName);
|
|
7504
|
+
if (!match) {
|
|
7505
|
+
console.error(
|
|
7506
|
+
`Error: database "${databaseName}" not found. Run "sentinel database list" to see available databases.`
|
|
7507
|
+
);
|
|
7508
|
+
process.exit(1);
|
|
7509
|
+
}
|
|
7510
|
+
return match;
|
|
7511
|
+
}
|
|
7512
|
+
|
|
7513
|
+
// src/services/getToken.ts
|
|
7514
|
+
init_cjs_shims();
|
|
7515
|
+
|
|
7516
|
+
// src/auth/constants.ts
|
|
7517
|
+
init_cjs_shims();
|
|
7518
|
+
|
|
7519
|
+
// src/auth/provider/TokenProviderFactory.ts
|
|
7520
|
+
init_cjs_shims();
|
|
7521
|
+
|
|
7522
|
+
// src/auth/provider/DeviceCodeTokenProvider.ts
|
|
7523
|
+
init_cjs_shims();
|
|
7524
|
+
|
|
7525
|
+
// src/services/msalAuth.ts
|
|
7526
|
+
init_cjs_shims();
|
|
7221
7527
|
|
|
7222
7528
|
// src/auth/msalInstance.ts
|
|
7223
7529
|
init_cjs_shims();
|
|
@@ -7241,8 +7547,8 @@ var PlatformType = /* @__PURE__ */ ((PlatformType2) => {
|
|
|
7241
7547
|
})(PlatformType || {});
|
|
7242
7548
|
async function createPersistence() {
|
|
7243
7549
|
const cacheFilePath = import_path.default.join(import_os.default.homedir(), ".nsdcli-cache.json");
|
|
7244
|
-
const
|
|
7245
|
-
switch (
|
|
7550
|
+
const platform4 = import_os.default.platform();
|
|
7551
|
+
switch (platform4) {
|
|
7246
7552
|
case "win32" /* Windows */:
|
|
7247
7553
|
return await import_msal_node_extensions.FilePersistenceWithDataProtection.create(cacheFilePath, import_msal_node_extensions.DataProtectionScope.CurrentUser);
|
|
7248
7554
|
case "darwin" /* MacOS */:
|
|
@@ -7251,7 +7557,7 @@ async function createPersistence() {
|
|
|
7251
7557
|
return await import_msal_node_extensions.LibSecretPersistence.create("nsdcli.service", "nsdcli.account", "nsdcli");
|
|
7252
7558
|
default:
|
|
7253
7559
|
throw new Error(
|
|
7254
|
-
`Unsupported platform: ${
|
|
7560
|
+
`Unsupported platform: ${platform4}. Supported platforms are: ${Object.values(PlatformType).join(", ")}`
|
|
7255
7561
|
);
|
|
7256
7562
|
}
|
|
7257
7563
|
}
|
|
@@ -7273,12 +7579,13 @@ async function getMsalConfig(environment, useCachePlugin = true, authorityOverri
|
|
|
7273
7579
|
cache: cachePlugin ? { cachePlugin } : void 0,
|
|
7274
7580
|
system: {
|
|
7275
7581
|
loggerOptions: {
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7582
|
+
// Suppress all MSAL internal logs from appearing in CLI output.
|
|
7583
|
+
// MSAL's Info/Verbose messages are library internals not useful to end users.
|
|
7584
|
+
// Only Warning and above are passed to this callback, and we intentionally
|
|
7585
|
+
// discard them to keep the CLI output clean.
|
|
7586
|
+
loggerCallback() {
|
|
7280
7587
|
},
|
|
7281
|
-
logLevel: import_msal_node.LogLevel.
|
|
7588
|
+
logLevel: import_msal_node.LogLevel.Warning,
|
|
7282
7589
|
piiLoggingEnabled: false
|
|
7283
7590
|
}
|
|
7284
7591
|
}
|
|
@@ -7302,54 +7609,50 @@ var getMsalInstance = async (env, authorityOverride) => {
|
|
|
7302
7609
|
return msalInstances.get(key);
|
|
7303
7610
|
};
|
|
7304
7611
|
|
|
7305
|
-
// src/
|
|
7306
|
-
var
|
|
7307
|
-
function openSystemBrowser(url) {
|
|
7308
|
-
return new Promise((resolve, reject) => {
|
|
7309
|
-
const command = process.platform === "darwin" ? "open" : "xdg-open";
|
|
7310
|
-
(0, import_child_process.execFile)(command, [url], (error) => {
|
|
7311
|
-
if (error) {
|
|
7312
|
-
reject(new Error(`Failed to open browser: ${error.message}`));
|
|
7313
|
-
} else {
|
|
7314
|
-
resolve();
|
|
7315
|
-
}
|
|
7316
|
-
});
|
|
7317
|
-
});
|
|
7318
|
-
}
|
|
7319
|
-
async function browserAuthLogin(scopes) {
|
|
7320
|
-
const msalInstance = await getMsalInstance(apiEnv);
|
|
7321
|
-
console.log("\u{1F510} Starting browser login. A browser window will open.");
|
|
7322
|
-
const result = await msalInstance.acquireTokenInteractive({
|
|
7323
|
-
scopes,
|
|
7324
|
-
openBrowser: openSystemBrowser,
|
|
7325
|
-
successTemplate: "<h1>Authentication successful</h1><p>You may close this tab and return to the terminal.</p>",
|
|
7326
|
-
errorTemplate: "<h1>Authentication failed</h1><p>{error}</p>"
|
|
7327
|
-
});
|
|
7328
|
-
if (!result?.accessToken) {
|
|
7329
|
-
throw new Error("Token acquisition failed: received null or empty token.");
|
|
7330
|
-
}
|
|
7331
|
-
console.log("\u{1F511} Token acquired successfully.");
|
|
7332
|
-
return result.accessToken;
|
|
7333
|
-
}
|
|
7612
|
+
// src/services/msalAuth.ts
|
|
7613
|
+
var import_common6 = __toESM(require_src());
|
|
7334
7614
|
|
|
7335
|
-
// src/actions/
|
|
7615
|
+
// src/actions/defaultLogin.ts
|
|
7336
7616
|
init_cjs_shims();
|
|
7337
|
-
var
|
|
7338
|
-
var
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7617
|
+
var import_identity = require("@azure/identity");
|
|
7618
|
+
var DefaultCredentialProvider = class _DefaultCredentialProvider {
|
|
7619
|
+
static instance;
|
|
7620
|
+
constructor() {
|
|
7621
|
+
}
|
|
7622
|
+
static getInstance() {
|
|
7623
|
+
if (!_DefaultCredentialProvider.instance) {
|
|
7624
|
+
_DefaultCredentialProvider.instance = new _DefaultCredentialProvider();
|
|
7625
|
+
}
|
|
7626
|
+
return _DefaultCredentialProvider.instance;
|
|
7627
|
+
}
|
|
7628
|
+
async getToken(scopes) {
|
|
7629
|
+
const credential = new import_identity.DefaultAzureCredential();
|
|
7630
|
+
const token = await credential.getToken(scopes);
|
|
7631
|
+
if (!token) {
|
|
7632
|
+
throw new Error("Failed to acquire token using DefaultAzureCredential.");
|
|
7633
|
+
}
|
|
7634
|
+
return token;
|
|
7635
|
+
}
|
|
7636
|
+
};
|
|
7637
|
+
|
|
7638
|
+
// src/actions/brokerLogin.ts
|
|
7639
|
+
init_cjs_shims();
|
|
7640
|
+
var import_common5 = __toESM(require_src());
|
|
7641
|
+
var import_fs = __toESM(require("fs"));
|
|
7642
|
+
var import_os2 = __toESM(require("os"));
|
|
7643
|
+
var import_path2 = __toESM(require("path"));
|
|
7644
|
+
var apiEnv = (0, import_common5.getApiEnv)(import_common5.SecurityPlatformEnvironment.Production);
|
|
7645
|
+
var SENTINEL_DIR = import_path2.default.join(import_os2.default.homedir(), ".sentinel");
|
|
7646
|
+
var BROKER_ACCOUNT_FILE = import_path2.default.join(SENTINEL_DIR, "broker-account.json");
|
|
7647
|
+
function saveBrokerAccount(account, authority) {
|
|
7648
|
+
import_fs.default.mkdirSync(SENTINEL_DIR, { recursive: true, mode: 448 });
|
|
7649
|
+
const session = { account, authority };
|
|
7650
|
+
const tempFile = `${BROKER_ACCOUNT_FILE}.tmp`;
|
|
7651
|
+
import_fs.default.writeFileSync(tempFile, JSON.stringify(session, null, 2), { encoding: "utf8", mode: 384 });
|
|
7652
|
+
import_fs.default.renameSync(tempFile, BROKER_ACCOUNT_FILE);
|
|
7653
|
+
}
|
|
7654
|
+
function loadBrokerAccount() {
|
|
7655
|
+
try {
|
|
7353
7656
|
if (import_fs.default.existsSync(BROKER_ACCOUNT_FILE)) {
|
|
7354
7657
|
const raw = import_fs.default.readFileSync(BROKER_ACCOUNT_FILE, "utf8");
|
|
7355
7658
|
const session = JSON.parse(raw);
|
|
@@ -7370,9 +7673,9 @@ function deleteBrokerAccount() {
|
|
|
7370
7673
|
}
|
|
7371
7674
|
}
|
|
7372
7675
|
async function brokerLogin(scopes, tenant) {
|
|
7373
|
-
const authorityOverride = tenant ? `${new URL(
|
|
7374
|
-
const authority = authorityOverride ??
|
|
7375
|
-
const msalInstance = await getMsalInstance(
|
|
7676
|
+
const authorityOverride = tenant ? `${new URL(apiEnv.aadEndpoint).origin}/${tenant}` : void 0;
|
|
7677
|
+
const authority = authorityOverride ?? apiEnv.aadEndpoint;
|
|
7678
|
+
const msalInstance = await getMsalInstance(apiEnv, authorityOverride);
|
|
7376
7679
|
const savedSession = loadBrokerAccount();
|
|
7377
7680
|
const accounts = await msalInstance.getTokenCache().getAllAccounts();
|
|
7378
7681
|
if (savedSession) {
|
|
@@ -7407,6 +7710,7 @@ async function brokerLogin(scopes, tenant) {
|
|
|
7407
7710
|
}
|
|
7408
7711
|
const result = await msalInstance.acquireTokenInteractive({
|
|
7409
7712
|
scopes,
|
|
7713
|
+
prompt: "select_account",
|
|
7410
7714
|
windowHandle: Buffer.alloc(0),
|
|
7411
7715
|
// headless / console window handle
|
|
7412
7716
|
openBrowser: async (_url) => {
|
|
@@ -7422,47 +7726,16 @@ async function brokerLogin(scopes, tenant) {
|
|
|
7422
7726
|
return result.accessToken;
|
|
7423
7727
|
}
|
|
7424
7728
|
|
|
7425
|
-
// src/actions/deviceCodeLogin.ts
|
|
7426
|
-
init_cjs_shims();
|
|
7427
|
-
|
|
7428
7729
|
// src/services/msalAuth.ts
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
// src/actions/defaultLogin.ts
|
|
7433
|
-
init_cjs_shims();
|
|
7434
|
-
var import_identity = require("@azure/identity");
|
|
7435
|
-
var DefaultCredentialProvider = class _DefaultCredentialProvider {
|
|
7436
|
-
static instance;
|
|
7437
|
-
constructor() {
|
|
7438
|
-
}
|
|
7439
|
-
static getInstance() {
|
|
7440
|
-
if (!_DefaultCredentialProvider.instance) {
|
|
7441
|
-
_DefaultCredentialProvider.instance = new _DefaultCredentialProvider();
|
|
7442
|
-
}
|
|
7443
|
-
return _DefaultCredentialProvider.instance;
|
|
7444
|
-
}
|
|
7445
|
-
async getToken(scopes) {
|
|
7446
|
-
const credential = new import_identity.DefaultAzureCredential();
|
|
7447
|
-
const token = await credential.getToken(scopes);
|
|
7448
|
-
if (!token) {
|
|
7449
|
-
throw new Error("Failed to acquire token using DefaultAzureCredential.");
|
|
7450
|
-
}
|
|
7451
|
-
return token;
|
|
7452
|
-
}
|
|
7453
|
-
};
|
|
7454
|
-
|
|
7455
|
-
// src/services/msalAuth.ts
|
|
7456
|
-
var import_os3 = __toESM(require("os"));
|
|
7457
|
-
var apiEnv3 = (0, import_common5.getApiEnv)(import_common5.SecurityPlatformEnvironment.Production);
|
|
7458
|
-
async function loginAndGetDeviceCodeToken(scopes = [apiEnv3.gatewayAuthResourceUri]) {
|
|
7730
|
+
var apiEnv2 = (0, import_common6.getApiEnv)(import_common6.SecurityPlatformEnvironment.Production);
|
|
7731
|
+
async function loginAndGetDeviceCodeToken(scopes = [apiEnv2.gatewayAuthResourceUri]) {
|
|
7459
7732
|
const deviceCodeRequest = {
|
|
7460
7733
|
scopes,
|
|
7461
7734
|
deviceCodeCallback: (response) => {
|
|
7462
7735
|
console.log(response.message);
|
|
7463
7736
|
}
|
|
7464
7737
|
};
|
|
7465
|
-
const msalInstance = await getMsalInstance(
|
|
7738
|
+
const msalInstance = await getMsalInstance(apiEnv2);
|
|
7466
7739
|
const result = await msalInstance.acquireTokenByDeviceCode(deviceCodeRequest);
|
|
7467
7740
|
if (!result || !result.accessToken) {
|
|
7468
7741
|
throw new Error("Failed to acquire access token.");
|
|
@@ -7472,7 +7745,7 @@ async function loginAndGetDeviceCodeToken(scopes = [apiEnv3.gatewayAuthResourceU
|
|
|
7472
7745
|
}
|
|
7473
7746
|
async function logout() {
|
|
7474
7747
|
try {
|
|
7475
|
-
const msalInstance = await getMsalInstance(
|
|
7748
|
+
const msalInstance = await getMsalInstance(apiEnv2);
|
|
7476
7749
|
const accounts = await msalInstance.getTokenCache().getAllAccounts();
|
|
7477
7750
|
if (accounts.length === 0) {
|
|
7478
7751
|
console.log("\u2139 No cached accounts.");
|
|
@@ -7487,15 +7760,35 @@ async function logout() {
|
|
|
7487
7760
|
deleteBrokerAccount();
|
|
7488
7761
|
}
|
|
7489
7762
|
}
|
|
7490
|
-
async function getAccessTokenFromCache(scopes = [
|
|
7763
|
+
async function getAccessTokenFromCache(scopes = [apiEnv2.gatewayAuthResourceUri]) {
|
|
7491
7764
|
if (process.env.CI) {
|
|
7492
7765
|
const defaultCredentialProvider = DefaultCredentialProvider.getInstance();
|
|
7493
7766
|
const token = await defaultCredentialProvider.getToken(scopes);
|
|
7494
7767
|
return token.token;
|
|
7495
7768
|
}
|
|
7496
|
-
const msalInstance = await getMsalInstance(apiEnv3);
|
|
7497
|
-
const accounts = await msalInstance.getTokenCache().getAllAccounts();
|
|
7498
7769
|
console.log("\u{1F510} Checking MSAL cache for tokens...");
|
|
7770
|
+
const savedSession = loadBrokerAccount();
|
|
7771
|
+
if (savedSession) {
|
|
7772
|
+
try {
|
|
7773
|
+
const sessionMsal = await getMsalInstance(apiEnv2, savedSession.authority);
|
|
7774
|
+
const response = await sessionMsal.acquireTokenSilent({
|
|
7775
|
+
account: savedSession.account,
|
|
7776
|
+
scopes,
|
|
7777
|
+
authority: savedSession.authority
|
|
7778
|
+
});
|
|
7779
|
+
if (response?.accessToken) {
|
|
7780
|
+
console.log("\u2705 Authenticated using MSAL cache");
|
|
7781
|
+
return response.accessToken;
|
|
7782
|
+
}
|
|
7783
|
+
console.warn("\u26A0\uFE0F Saved-session silent acquisition returned no token");
|
|
7784
|
+
deleteBrokerAccount();
|
|
7785
|
+
} catch {
|
|
7786
|
+
console.warn("\u26A0\uFE0F Saved-session silent acquisition failed, falling back to account enumeration");
|
|
7787
|
+
deleteBrokerAccount();
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
const msalInstance = await getMsalInstance(apiEnv2);
|
|
7791
|
+
const accounts = await msalInstance.getTokenCache().getAllAccounts();
|
|
7499
7792
|
if (accounts.length > 0) {
|
|
7500
7793
|
try {
|
|
7501
7794
|
const response = await msalInstance.acquireTokenSilent({
|
|
@@ -7511,51 +7804,437 @@ async function getAccessTokenFromCache(scopes = [apiEnv3.gatewayAuthResourceUri]
|
|
|
7511
7804
|
console.warn("\u26A0\uFE0F Silent token acquisition failed");
|
|
7512
7805
|
}
|
|
7513
7806
|
}
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7807
|
+
return "";
|
|
7808
|
+
}
|
|
7809
|
+
|
|
7810
|
+
// src/auth/provider/DeviceCodeTokenProvider.ts
|
|
7811
|
+
var DeviceCodeTokenProvider = class {
|
|
7812
|
+
options;
|
|
7813
|
+
env;
|
|
7814
|
+
constructor(env, options) {
|
|
7815
|
+
if (!env) {
|
|
7816
|
+
throw new Error("Environment cannot be null or undefined");
|
|
7817
|
+
}
|
|
7818
|
+
this.env = env;
|
|
7819
|
+
this.options = {
|
|
7820
|
+
...options,
|
|
7821
|
+
// overrides defaults if user provided values
|
|
7822
|
+
scopes: options?.scopes ?? [this.env.gatewayAuthResourceUri]
|
|
7823
|
+
};
|
|
7824
|
+
}
|
|
7825
|
+
async getAccessToken() {
|
|
7826
|
+
let token = await getAccessTokenFromCache(this.options?.scopes);
|
|
7827
|
+
if (token) {
|
|
7828
|
+
return token;
|
|
7829
|
+
}
|
|
7830
|
+
token = await loginAndGetDeviceCodeToken(this.options?.scopes);
|
|
7831
|
+
return token;
|
|
7832
|
+
}
|
|
7833
|
+
};
|
|
7834
|
+
|
|
7835
|
+
// src/auth/provider/ManagedIdentityTokenProvider.ts
|
|
7836
|
+
init_cjs_shims();
|
|
7837
|
+
var import_identity2 = require("@azure/identity");
|
|
7838
|
+
var ManagedIdentityTokenProvider = class {
|
|
7839
|
+
options;
|
|
7840
|
+
env;
|
|
7841
|
+
constructor(env, options) {
|
|
7842
|
+
if (!env) {
|
|
7843
|
+
throw new Error("Environment cannot be null or undefined");
|
|
7844
|
+
}
|
|
7845
|
+
if (!options?.uamiClientId) {
|
|
7846
|
+
throw new Error("UAMI clientId required for user-assigned managed identity");
|
|
7847
|
+
}
|
|
7848
|
+
this.env = env;
|
|
7849
|
+
this.options = {
|
|
7850
|
+
...options,
|
|
7851
|
+
// overrides defaults if user provided values
|
|
7852
|
+
scopes: options?.scopes ?? [env.gatewayAuthResourceUri]
|
|
7853
|
+
};
|
|
7854
|
+
}
|
|
7855
|
+
async getAccessToken() {
|
|
7856
|
+
const scopes = this.options?.scopes && this.options.scopes.length > 0 ? this.options.scopes : [this.env.gatewayAuthResourceUri];
|
|
7857
|
+
const credential = new import_identity2.ManagedIdentityCredential({
|
|
7858
|
+
clientId: this.options?.uamiClientId
|
|
7859
|
+
});
|
|
7860
|
+
const token = await credential.getToken(scopes);
|
|
7861
|
+
if (!token) {
|
|
7862
|
+
throw new Error("Failed to get token from Managed Identity");
|
|
7863
|
+
}
|
|
7864
|
+
return token.token;
|
|
7865
|
+
}
|
|
7866
|
+
};
|
|
7867
|
+
|
|
7868
|
+
// src/auth/provider/MsalCacheTokenProvider.ts
|
|
7869
|
+
init_cjs_shims();
|
|
7870
|
+
var MsalCacheTokenProvider = class {
|
|
7871
|
+
options;
|
|
7872
|
+
env;
|
|
7873
|
+
constructor(env, options) {
|
|
7874
|
+
if (!env) {
|
|
7875
|
+
throw new Error("Environment cannot be null or undefined");
|
|
7876
|
+
}
|
|
7877
|
+
this.env = env;
|
|
7878
|
+
this.options = {
|
|
7879
|
+
...options,
|
|
7880
|
+
scopes: options?.scopes?.length ? options.scopes : [this.env.gatewayAuthResourceUri]
|
|
7881
|
+
};
|
|
7882
|
+
}
|
|
7883
|
+
async getAccessToken() {
|
|
7884
|
+
const token = await getAccessTokenFromCache(this.options.scopes);
|
|
7885
|
+
if (!token) {
|
|
7886
|
+
throw new Error("No cached authentication token found. Please run `sentinel login` first.");
|
|
7887
|
+
}
|
|
7888
|
+
return token;
|
|
7889
|
+
}
|
|
7890
|
+
};
|
|
7891
|
+
|
|
7892
|
+
// src/auth/provider/TokenProviderFactory.ts
|
|
7893
|
+
var TokenProviderFactory = class {
|
|
7894
|
+
static createProvider(env, method, options) {
|
|
7895
|
+
switch (method) {
|
|
7896
|
+
case "device_code":
|
|
7897
|
+
return new DeviceCodeTokenProvider(env, options);
|
|
7898
|
+
case "managed_identity":
|
|
7899
|
+
if (!options) {
|
|
7900
|
+
throw new Error("UAMI clientId required for user-assigned managed identity");
|
|
7526
7901
|
}
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7902
|
+
return new ManagedIdentityTokenProvider(env, options);
|
|
7903
|
+
case "msal_cache":
|
|
7904
|
+
return new MsalCacheTokenProvider(env, options);
|
|
7905
|
+
default:
|
|
7906
|
+
throw new Error(`Unsupported token method: ${method}`);
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
};
|
|
7910
|
+
|
|
7911
|
+
// src/services/getToken.ts
|
|
7912
|
+
async function getToken(env, scopes, clientId) {
|
|
7913
|
+
let provider = null;
|
|
7914
|
+
const options = {
|
|
7915
|
+
uamiClientId: clientId,
|
|
7916
|
+
scopes
|
|
7917
|
+
};
|
|
7918
|
+
if (clientId) {
|
|
7919
|
+
provider = TokenProviderFactory.createProvider(env, "managed_identity" /* ManagedIdentity */, options);
|
|
7920
|
+
} else {
|
|
7921
|
+
provider = TokenProviderFactory.createProvider(env, "msal_cache" /* MsalCache */, options);
|
|
7922
|
+
}
|
|
7923
|
+
const token = await provider.getAccessToken();
|
|
7924
|
+
return token;
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
// src/client/lake/index.ts
|
|
7928
|
+
init_cjs_shims();
|
|
7929
|
+
var import_common8 = __toESM(require_src());
|
|
7930
|
+
|
|
7931
|
+
// src/utils/headerBuilder.ts
|
|
7932
|
+
init_cjs_shims();
|
|
7933
|
+
var import_common7 = __toESM(require_src());
|
|
7934
|
+
function buildApiHeaders(token, requestId, extra) {
|
|
7935
|
+
const base = {};
|
|
7936
|
+
if (requestId) {
|
|
7937
|
+
base[import_common7.HTTP_HEADER.REQUEST_ID] = requestId;
|
|
7938
|
+
}
|
|
7939
|
+
if (!extra || !(import_common7.HTTP_HEADER.CONTENT_TYPE in extra)) {
|
|
7940
|
+
base[import_common7.HTTP_HEADER.CONTENT_TYPE] = import_common7.HTTP_HEADER.APPLICATION_JSON;
|
|
7941
|
+
}
|
|
7942
|
+
if (token) {
|
|
7943
|
+
base[import_common7.HTTP_HEADER.AUTHORIZATION] = `${import_common7.HTTP_HEADER.BEARER_PREFIX}${token}`;
|
|
7944
|
+
}
|
|
7945
|
+
const merged = { ...base, ...extra || {} };
|
|
7946
|
+
return Object.fromEntries(
|
|
7947
|
+
Object.entries(merged).filter((entry) => entry[1] !== void 0)
|
|
7948
|
+
);
|
|
7949
|
+
}
|
|
7950
|
+
|
|
7951
|
+
// src/utils/noopTelemetry.ts
|
|
7952
|
+
init_cjs_shims();
|
|
7953
|
+
var noopSpan = {
|
|
7954
|
+
addAttributes: () => {
|
|
7955
|
+
},
|
|
7956
|
+
end: () => {
|
|
7957
|
+
},
|
|
7958
|
+
error: () => {
|
|
7959
|
+
}
|
|
7960
|
+
};
|
|
7961
|
+
var noopTelemetry = {
|
|
7962
|
+
span: () => noopSpan
|
|
7963
|
+
};
|
|
7964
|
+
|
|
7965
|
+
// src/client/lake/index.ts
|
|
7966
|
+
function createLakeApiClient(env) {
|
|
7967
|
+
const requestService = new import_common8.RequestService(noopTelemetry, buildApiHeaders);
|
|
7968
|
+
return new import_common8.LakeApiClient({
|
|
7969
|
+
requestService,
|
|
7970
|
+
telemetry: noopTelemetry,
|
|
7971
|
+
baseUrl: env.gatewayEndpoint
|
|
7972
|
+
});
|
|
7973
|
+
}
|
|
7974
|
+
|
|
7975
|
+
// src/utils/formatter/outputFormatter.ts
|
|
7976
|
+
init_cjs_shims();
|
|
7977
|
+
var COLUMN_SEPARATOR = " ";
|
|
7978
|
+
var HEADER_RULE_CHAR = "\u2500";
|
|
7979
|
+
var OutputFormatter = class {
|
|
7980
|
+
format;
|
|
7981
|
+
constructor(options = {}) {
|
|
7982
|
+
this.format = options.output ?? "table";
|
|
7983
|
+
}
|
|
7984
|
+
/**
|
|
7985
|
+
* Renders `rows` to stdout using the configured output format.
|
|
7986
|
+
*
|
|
7987
|
+
* @param rows - The data array to render.
|
|
7988
|
+
* @param columns - Column descriptors that define headers and value extractors.
|
|
7989
|
+
*/
|
|
7990
|
+
print(rows, columns) {
|
|
7991
|
+
if (this.format === "json") {
|
|
7992
|
+
this.printJson(rows, columns);
|
|
7993
|
+
} else {
|
|
7994
|
+
this.printTable(rows, columns);
|
|
7995
|
+
}
|
|
7996
|
+
}
|
|
7997
|
+
// ---------------------------------------------------------------------------
|
|
7998
|
+
// Table rendering
|
|
7999
|
+
// ---------------------------------------------------------------------------
|
|
8000
|
+
printTable(rows, columns) {
|
|
8001
|
+
if (rows.length === 0) {
|
|
8002
|
+
console.log("(no results)");
|
|
8003
|
+
return;
|
|
8004
|
+
}
|
|
8005
|
+
const widths = columns.map((col) => {
|
|
8006
|
+
const cellWidths = rows.map((row) => String(col.key(row) ?? "").length);
|
|
8007
|
+
return Math.max(col.header.length, ...cellWidths);
|
|
8008
|
+
});
|
|
8009
|
+
const header = columns.map((col, i) => col.header.padEnd(widths[i])).join(COLUMN_SEPARATOR);
|
|
8010
|
+
console.log(header);
|
|
8011
|
+
const rule = widths.map((w) => HEADER_RULE_CHAR.repeat(w)).join(COLUMN_SEPARATOR);
|
|
8012
|
+
console.log(rule);
|
|
8013
|
+
for (const row of rows) {
|
|
8014
|
+
const line = columns.map((col, i) => String(col.key(row) ?? "").padEnd(widths[i])).join(COLUMN_SEPARATOR);
|
|
8015
|
+
console.log(line);
|
|
7530
8016
|
}
|
|
7531
8017
|
}
|
|
8018
|
+
// ---------------------------------------------------------------------------
|
|
8019
|
+
// JSON rendering
|
|
8020
|
+
// ---------------------------------------------------------------------------
|
|
8021
|
+
printJson(rows, columns) {
|
|
8022
|
+
const records = rows.map((row) => {
|
|
8023
|
+
const record = {};
|
|
8024
|
+
for (const col of columns) {
|
|
8025
|
+
const key = col.jsonKey ?? col.header.toLowerCase();
|
|
8026
|
+
const value = col.key(row);
|
|
8027
|
+
record[key] = value ?? null;
|
|
8028
|
+
}
|
|
8029
|
+
return record;
|
|
8030
|
+
});
|
|
8031
|
+
console.log(JSON.stringify(records, null, 2));
|
|
8032
|
+
}
|
|
8033
|
+
};
|
|
8034
|
+
|
|
8035
|
+
// src/utils/error/handleApiError.ts
|
|
8036
|
+
init_cjs_shims();
|
|
8037
|
+
function hasStatusCode(e) {
|
|
8038
|
+
return e instanceof Error && "statusCode" in e && typeof e.statusCode === "number";
|
|
8039
|
+
}
|
|
8040
|
+
function hasResponseStatus(e) {
|
|
8041
|
+
return e instanceof Error && "response" in e && e.response != null && typeof e.response?.status === "number";
|
|
8042
|
+
}
|
|
8043
|
+
function getStatusInfo(error) {
|
|
8044
|
+
if (hasStatusCode(error)) {
|
|
8045
|
+
return ` (HTTP ${error.statusCode})`;
|
|
8046
|
+
}
|
|
8047
|
+
if (hasResponseStatus(error)) {
|
|
8048
|
+
return ` (HTTP ${error.response.status})`;
|
|
8049
|
+
}
|
|
7532
8050
|
return "";
|
|
7533
8051
|
}
|
|
8052
|
+
function handleApiError(context, error) {
|
|
8053
|
+
if (error instanceof Error) {
|
|
8054
|
+
console.error(`Error ${context}${getStatusInfo(error)}:`, error.message);
|
|
8055
|
+
if (process.env.DEBUG && error.stack) {
|
|
8056
|
+
console.error(error.stack);
|
|
8057
|
+
}
|
|
8058
|
+
} else {
|
|
8059
|
+
console.error(`Unknown error ${context}:`, error);
|
|
8060
|
+
}
|
|
8061
|
+
process.exit(1);
|
|
8062
|
+
}
|
|
8063
|
+
|
|
8064
|
+
// src/commands/lake/database.ts
|
|
8065
|
+
function addDatabaseCommand(databaseCommand) {
|
|
8066
|
+
databaseCommand.command("list").description("List all available databases").action(async () => {
|
|
8067
|
+
try {
|
|
8068
|
+
const apiEnv4 = (0, import_common9.getApiEnv)(import_common9.SecurityPlatformEnvironment.Production);
|
|
8069
|
+
const accessToken = await getToken(apiEnv4);
|
|
8070
|
+
const lakeApiClient = createLakeApiClient(apiEnv4);
|
|
8071
|
+
const databaseService = new DatabaseService(lakeApiClient);
|
|
8072
|
+
const databases = await listDatabases(databaseService, accessToken);
|
|
8073
|
+
const fmt = new OutputFormatter();
|
|
8074
|
+
fmt.print(databases, [
|
|
8075
|
+
{ header: "ID", key: (db) => db.databaseName === "default" ? "System tables" : db.databaseName },
|
|
8076
|
+
{
|
|
8077
|
+
header: "NAME",
|
|
8078
|
+
key: (db) => db.databaseName === "default" ? "System tables" : db.sentinelWorkspace?.name ?? ""
|
|
8079
|
+
}
|
|
8080
|
+
]);
|
|
8081
|
+
} catch (error) {
|
|
8082
|
+
handleApiError("listing databases", error);
|
|
8083
|
+
}
|
|
8084
|
+
});
|
|
8085
|
+
}
|
|
8086
|
+
|
|
8087
|
+
// src/commands/lake/lakeTables.ts
|
|
8088
|
+
init_cjs_shims();
|
|
8089
|
+
var import_common10 = __toESM(require_src());
|
|
8090
|
+
var TABLE_COLUMNS = [
|
|
8091
|
+
{ header: "TABLE", key: (t) => t.name ?? "" },
|
|
8092
|
+
{
|
|
8093
|
+
header: "DATABASE NAME",
|
|
8094
|
+
key: (t) => t.sgWorkspaceName === "default" ? SYSTEM_TABLES_DISPLAY_NAME : t.sgWorkspaceName ?? ""
|
|
8095
|
+
},
|
|
8096
|
+
{ header: "CATEGORY", key: (t) => t.category ?? "" }
|
|
8097
|
+
];
|
|
8098
|
+
function addLakeTableListCommand(tableCommand) {
|
|
8099
|
+
tableCommand.command("list").description("List lake tables").option("--database-id <databaseId>", "Database ID to fetch tables").option("--database-name <databaseName>", "Database name to fetch tables").action(async (options) => {
|
|
8100
|
+
validateOptions(options);
|
|
8101
|
+
try {
|
|
8102
|
+
const apiEnv4 = (0, import_common10.getApiEnv)(import_common10.SecurityPlatformEnvironment.Production);
|
|
8103
|
+
const accessToken = await getToken(apiEnv4);
|
|
8104
|
+
const lakeApiClient = createLakeApiClient(apiEnv4);
|
|
8105
|
+
const database = await lookupDatabase(options, lakeApiClient, accessToken);
|
|
8106
|
+
const tableService = new TableService(lakeApiClient);
|
|
8107
|
+
const tables = await listTables(tableService, accessToken, database);
|
|
8108
|
+
printTables(tables);
|
|
8109
|
+
} catch (error) {
|
|
8110
|
+
handleApiError("listing lake tables", error);
|
|
8111
|
+
}
|
|
8112
|
+
});
|
|
8113
|
+
}
|
|
8114
|
+
function validateOptions(options) {
|
|
8115
|
+
if (options.databaseId && options.databaseName) {
|
|
8116
|
+
console.error("Error: --database-id and --database-name are mutually exclusive. Provide only one.");
|
|
8117
|
+
process.exit(1);
|
|
8118
|
+
}
|
|
8119
|
+
}
|
|
8120
|
+
function printTables(tables) {
|
|
8121
|
+
const fmt = new OutputFormatter();
|
|
8122
|
+
fmt.print(tables, TABLE_COLUMNS);
|
|
8123
|
+
}
|
|
8124
|
+
|
|
8125
|
+
// src/commands/lake/lakeTableSchema.ts
|
|
8126
|
+
init_cjs_shims();
|
|
8127
|
+
var import_common11 = __toESM(require_src());
|
|
8128
|
+
var SCHEMA_COLUMNS = [
|
|
8129
|
+
{ header: "COLUMN", key: (col) => col.name },
|
|
8130
|
+
{ header: "TYPE", key: (col) => col.type }
|
|
8131
|
+
];
|
|
8132
|
+
function addLakeTableShowCommand(tableCommand) {
|
|
8133
|
+
tableCommand.command("show <tableName>").description("Show the schema of a lake table").option("--database-id <databaseId>", "Database ID to look up the table in").option("--database-name <databaseName>", "Database name to look up the table in").action(async (tableName, options) => {
|
|
8134
|
+
validateOptions2(options);
|
|
8135
|
+
try {
|
|
8136
|
+
const apiEnv4 = (0, import_common11.getApiEnv)(import_common11.SecurityPlatformEnvironment.Production);
|
|
8137
|
+
const accessToken = await getToken(apiEnv4);
|
|
8138
|
+
const lakeApiClient = createLakeApiClient(apiEnv4);
|
|
8139
|
+
const database = await lookupDatabase(options, lakeApiClient, accessToken) ?? DEFAULT_DATABASE;
|
|
8140
|
+
const tableService = new TableService(lakeApiClient);
|
|
8141
|
+
const tables = await listTables(tableService, accessToken, database);
|
|
8142
|
+
const table = findTable(tables, tableName);
|
|
8143
|
+
if (!table) {
|
|
8144
|
+
console.error(
|
|
8145
|
+
`Error: table "${tableName}" not found. Run "sentinel table list" to see available tables.`
|
|
8146
|
+
);
|
|
8147
|
+
process.exit(1);
|
|
8148
|
+
}
|
|
8149
|
+
printSchema(table);
|
|
8150
|
+
} catch (error) {
|
|
8151
|
+
handleApiError("showing lake table schema", error);
|
|
8152
|
+
}
|
|
8153
|
+
});
|
|
8154
|
+
}
|
|
8155
|
+
function validateOptions2(options) {
|
|
8156
|
+
if (options.databaseId && options.databaseName) {
|
|
8157
|
+
console.error("Error: --database-id and --database-name are mutually exclusive. Provide only one.");
|
|
8158
|
+
process.exit(1);
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
function findTable(tables, tableName) {
|
|
8162
|
+
const lowerName = tableName.toLowerCase();
|
|
8163
|
+
return tables.find((t) => t.name?.toLowerCase() === lowerName);
|
|
8164
|
+
}
|
|
8165
|
+
function printSchema(table) {
|
|
8166
|
+
const fmt = new OutputFormatter();
|
|
8167
|
+
fmt.print(table.schema, SCHEMA_COLUMNS);
|
|
8168
|
+
}
|
|
8169
|
+
|
|
8170
|
+
// src/commands/login.ts
|
|
8171
|
+
init_cjs_shims();
|
|
8172
|
+
var os4 = __toESM(require("os"));
|
|
8173
|
+
|
|
8174
|
+
// src/actions/authCodeLogin.ts
|
|
8175
|
+
init_cjs_shims();
|
|
8176
|
+
var import_child_process = require("child_process");
|
|
8177
|
+
var import_common12 = __toESM(require_src());
|
|
8178
|
+
var apiEnv3 = (0, import_common12.getApiEnv)(import_common12.SecurityPlatformEnvironment.Production);
|
|
8179
|
+
function openSystemBrowser(url) {
|
|
8180
|
+
return new Promise((resolve, reject) => {
|
|
8181
|
+
const command = process.platform === "darwin" ? "open" : "xdg-open";
|
|
8182
|
+
(0, import_child_process.execFile)(command, [url], (error) => {
|
|
8183
|
+
if (error) {
|
|
8184
|
+
reject(new Error(`Failed to open browser: ${error.message}`));
|
|
8185
|
+
} else {
|
|
8186
|
+
resolve();
|
|
8187
|
+
}
|
|
8188
|
+
});
|
|
8189
|
+
});
|
|
8190
|
+
}
|
|
8191
|
+
async function browserAuthLogin(scopes, tenant) {
|
|
8192
|
+
const authorityOverride = tenant ? `${new URL(apiEnv3.aadEndpoint).origin}/${encodeURIComponent(tenant)}` : void 0;
|
|
8193
|
+
const authority = authorityOverride ?? apiEnv3.aadEndpoint;
|
|
8194
|
+
const msalInstance = await getMsalInstance(apiEnv3, authorityOverride);
|
|
8195
|
+
console.log("\u{1F510} Starting browser login. A browser window will open.");
|
|
8196
|
+
const result = await msalInstance.acquireTokenInteractive({
|
|
8197
|
+
scopes,
|
|
8198
|
+
prompt: "select_account",
|
|
8199
|
+
openBrowser: openSystemBrowser,
|
|
8200
|
+
successTemplate: "<h1>Authentication successful</h1><p>You may close this tab and return to the terminal.</p>",
|
|
8201
|
+
errorTemplate: "<h1>Authentication failed</h1><p>{error}</p>"
|
|
8202
|
+
});
|
|
8203
|
+
if (!result?.accessToken) {
|
|
8204
|
+
throw new Error("Token acquisition failed: received null or empty token.");
|
|
8205
|
+
}
|
|
8206
|
+
if (result.account) {
|
|
8207
|
+
saveBrokerAccount(result.account, authority);
|
|
8208
|
+
}
|
|
8209
|
+
console.log("\u{1F511} Token acquired successfully.");
|
|
8210
|
+
return result.accessToken;
|
|
8211
|
+
}
|
|
7534
8212
|
|
|
7535
8213
|
// src/actions/deviceCodeLogin.ts
|
|
8214
|
+
init_cjs_shims();
|
|
7536
8215
|
async function login(scopes) {
|
|
7537
8216
|
await loginAndGetDeviceCodeToken(scopes);
|
|
7538
8217
|
}
|
|
7539
8218
|
|
|
7540
8219
|
// src/actions/managedIdentityLogin.ts
|
|
7541
8220
|
init_cjs_shims();
|
|
7542
|
-
var
|
|
8221
|
+
var import_identity3 = require("@azure/identity");
|
|
7543
8222
|
async function getTokenManagedIdentity(options) {
|
|
7544
8223
|
const { scope, clientId, objectId, resourceId, workload } = options;
|
|
7545
8224
|
let credential;
|
|
7546
8225
|
try {
|
|
7547
8226
|
if (workload) {
|
|
7548
8227
|
console.log("\u{1F510} Using WorkloadIdentityCredential...");
|
|
7549
|
-
credential = new
|
|
8228
|
+
credential = new import_identity3.WorkloadIdentityCredential();
|
|
7550
8229
|
} else if (clientId) {
|
|
7551
8230
|
console.log("\u{1F510} Using ManagedIdentityCredential with Client ID...");
|
|
7552
|
-
credential = new
|
|
8231
|
+
credential = new import_identity3.ManagedIdentityCredential(clientId);
|
|
7553
8232
|
} else if (objectId) {
|
|
7554
8233
|
console.log("\u{1F510} Using ManagedIdentityCredential with Object ID...");
|
|
7555
|
-
credential = new
|
|
8234
|
+
credential = new import_identity3.ManagedIdentityCredential({ objectId });
|
|
7556
8235
|
} else if (resourceId) {
|
|
7557
8236
|
console.log("\u{1F510} Using ManagedIdentityCredential with Resource ID...");
|
|
7558
|
-
credential = new
|
|
8237
|
+
credential = new import_identity3.ManagedIdentityCredential({ resourceId });
|
|
7559
8238
|
} else {
|
|
7560
8239
|
throw new Error("No managed identity parameters provided.");
|
|
7561
8240
|
}
|
|
@@ -7621,13 +8300,13 @@ function loginCommand(program2) {
|
|
|
7621
8300
|
} else {
|
|
7622
8301
|
console.log("\u{1F3E2} No tenant specified, using default authority.");
|
|
7623
8302
|
}
|
|
7624
|
-
if (
|
|
8303
|
+
if (os4.platform() === "win32" /* Windows */) {
|
|
7625
8304
|
console.log("\u{1FA9F} Authenticating via Windows Native Broker (WAM)...");
|
|
7626
8305
|
await (tenant ? brokerLogin(scope, tenant) : brokerLogin(scope));
|
|
7627
8306
|
console.log("\u2705 Logged in via Windows Native Broker.");
|
|
7628
8307
|
} else {
|
|
7629
8308
|
console.log("\u{1F310} Launching Browser Authentication (Auth Code Flow)...");
|
|
7630
|
-
await browserAuthLogin(scope);
|
|
8309
|
+
await browserAuthLogin(scope, tenant);
|
|
7631
8310
|
console.log("\u2705 Logged in using Browser Authentication.");
|
|
7632
8311
|
}
|
|
7633
8312
|
} catch (error) {
|
|
@@ -7657,12 +8336,12 @@ function logoutCommand(program2) {
|
|
|
7657
8336
|
|
|
7658
8337
|
// src/commands/publishJob.ts
|
|
7659
8338
|
init_cjs_shims();
|
|
7660
|
-
var
|
|
8339
|
+
var import_common15 = __toESM(require_src());
|
|
7661
8340
|
var import_path4 = __toESM(require("path"));
|
|
7662
8341
|
|
|
7663
8342
|
// src/actions/publishJob.ts
|
|
7664
8343
|
init_cjs_shims();
|
|
7665
|
-
var
|
|
8344
|
+
var import_common13 = __toESM(require_src());
|
|
7666
8345
|
var fs2 = __toESM(require("fs"));
|
|
7667
8346
|
var import_path3 = __toESM(require("path"));
|
|
7668
8347
|
var YAML = __toESM(require("yaml"));
|
|
@@ -7679,7 +8358,7 @@ function parseJobConfig(jobConfigPath) {
|
|
|
7679
8358
|
throw new Error(`Unsupported file extension: ${ext}`);
|
|
7680
8359
|
}
|
|
7681
8360
|
}
|
|
7682
|
-
async function publish(notebookPath, jobConfigPath,
|
|
8361
|
+
async function publish(notebookPath, jobConfigPath, jobClient, accessToken) {
|
|
7683
8362
|
if (!fs2.existsSync(notebookPath)) {
|
|
7684
8363
|
console.error(`File not found: ${notebookPath}`);
|
|
7685
8364
|
throw new Error(`File not found: ${notebookPath}`);
|
|
@@ -7688,182 +8367,40 @@ async function publish(notebookPath, jobConfigPath, jobService) {
|
|
|
7688
8367
|
console.error(`File not found: ${jobConfigPath}`);
|
|
7689
8368
|
throw new Error(`File not found: ${jobConfigPath}`);
|
|
7690
8369
|
}
|
|
8370
|
+
const requestId = import_common13.CorrelationService.createCorrelationContext();
|
|
7691
8371
|
const notebookBase64 = fs2.readFileSync(notebookPath).toString("base64");
|
|
7692
8372
|
const jobConfig = parseJobConfig(jobConfigPath);
|
|
7693
|
-
const payload = (0,
|
|
8373
|
+
const payload = (0, import_common13.buildCompleteJobPayload)(jobConfig, notebookBase64);
|
|
7694
8374
|
const jobName = jobConfig.jobName;
|
|
7695
|
-
await
|
|
8375
|
+
await jobClient.createJob(jobName, payload, accessToken, requestId);
|
|
7696
8376
|
return jobName;
|
|
7697
8377
|
}
|
|
7698
8378
|
|
|
7699
|
-
// src/
|
|
7700
|
-
init_cjs_shims();
|
|
7701
|
-
var import_common7 = __toESM(require_src());
|
|
7702
|
-
var import_axios = __toESM(require("axios"));
|
|
7703
|
-
|
|
7704
|
-
// src/services/getToken.ts
|
|
7705
|
-
init_cjs_shims();
|
|
7706
|
-
|
|
7707
|
-
// src/auth/constants.ts
|
|
7708
|
-
init_cjs_shims();
|
|
7709
|
-
|
|
7710
|
-
// src/auth/provider/TokenProviderFactory.ts
|
|
7711
|
-
init_cjs_shims();
|
|
7712
|
-
|
|
7713
|
-
// src/auth/provider/DeviceCodeTokenProvider.ts
|
|
7714
|
-
init_cjs_shims();
|
|
7715
|
-
var DeviceCodeTokenProvider = class {
|
|
7716
|
-
options;
|
|
7717
|
-
env;
|
|
7718
|
-
constructor(env, options) {
|
|
7719
|
-
if (!env) {
|
|
7720
|
-
throw new Error("Environment cannot be null or undefined");
|
|
7721
|
-
}
|
|
7722
|
-
this.env = env;
|
|
7723
|
-
this.options = {
|
|
7724
|
-
...options,
|
|
7725
|
-
// overrides defaults if user provided values
|
|
7726
|
-
scopes: options?.scopes ?? [this.env.gatewayAuthResourceUri]
|
|
7727
|
-
};
|
|
7728
|
-
}
|
|
7729
|
-
async getAccessToken() {
|
|
7730
|
-
let token = await getAccessTokenFromCache(this.options?.scopes);
|
|
7731
|
-
if (token) {
|
|
7732
|
-
return token;
|
|
7733
|
-
}
|
|
7734
|
-
token = await loginAndGetDeviceCodeToken(this.options?.scopes);
|
|
7735
|
-
return token;
|
|
7736
|
-
}
|
|
7737
|
-
};
|
|
7738
|
-
|
|
7739
|
-
// src/auth/provider/ManagedIdentityTokenProvider.ts
|
|
7740
|
-
init_cjs_shims();
|
|
7741
|
-
var import_identity3 = require("@azure/identity");
|
|
7742
|
-
var ManagedIdentityTokenProvider = class {
|
|
7743
|
-
options;
|
|
7744
|
-
env;
|
|
7745
|
-
constructor(env, options) {
|
|
7746
|
-
if (!env) {
|
|
7747
|
-
throw new Error("Environment cannot be null or undefined");
|
|
7748
|
-
}
|
|
7749
|
-
if (!options?.uamiClientId) {
|
|
7750
|
-
throw new Error("UAMI clientId required for user-assigned managed identity");
|
|
7751
|
-
}
|
|
7752
|
-
this.env = env;
|
|
7753
|
-
this.options = {
|
|
7754
|
-
...options,
|
|
7755
|
-
// overrides defaults if user provided values
|
|
7756
|
-
scopes: options?.scopes ?? [env.gatewayAuthResourceUri]
|
|
7757
|
-
};
|
|
7758
|
-
}
|
|
7759
|
-
async getAccessToken() {
|
|
7760
|
-
const scopes = this.options?.scopes && this.options.scopes.length > 0 ? this.options.scopes : [this.env.gatewayAuthResourceUri];
|
|
7761
|
-
const credential = new import_identity3.ManagedIdentityCredential({
|
|
7762
|
-
clientId: this.options?.uamiClientId
|
|
7763
|
-
});
|
|
7764
|
-
const token = await credential.getToken(scopes);
|
|
7765
|
-
if (!token) {
|
|
7766
|
-
throw new Error("Failed to get token from Managed Identity");
|
|
7767
|
-
}
|
|
7768
|
-
return token.token;
|
|
7769
|
-
}
|
|
7770
|
-
};
|
|
7771
|
-
|
|
7772
|
-
// src/auth/provider/MsalCacheTokenProvider.ts
|
|
8379
|
+
// src/client/jobs/index.ts
|
|
7773
8380
|
init_cjs_shims();
|
|
7774
|
-
var
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
this.env = env;
|
|
7782
|
-
this.options = {
|
|
7783
|
-
...options,
|
|
7784
|
-
scopes: options?.scopes?.length ? options.scopes : [this.env.gatewayAuthResourceUri]
|
|
7785
|
-
};
|
|
7786
|
-
}
|
|
7787
|
-
async getAccessToken() {
|
|
7788
|
-
const token = await getAccessTokenFromCache(this.options.scopes);
|
|
7789
|
-
if (!token) {
|
|
7790
|
-
throw new Error("No cached authentication token found. Please run `sentinel login` first.");
|
|
7791
|
-
}
|
|
7792
|
-
return token;
|
|
7793
|
-
}
|
|
7794
|
-
};
|
|
7795
|
-
|
|
7796
|
-
// src/auth/provider/TokenProviderFactory.ts
|
|
7797
|
-
var TokenProviderFactory = class {
|
|
7798
|
-
static createProvider(env, method, options) {
|
|
7799
|
-
switch (method) {
|
|
7800
|
-
case "device_code":
|
|
7801
|
-
return new DeviceCodeTokenProvider(env, options);
|
|
7802
|
-
case "managed_identity":
|
|
7803
|
-
if (!options) {
|
|
7804
|
-
throw new Error("UAMI clientId required for user-assigned managed identity");
|
|
7805
|
-
}
|
|
7806
|
-
return new ManagedIdentityTokenProvider(env, options);
|
|
7807
|
-
case "msal_cache":
|
|
7808
|
-
return new MsalCacheTokenProvider(env, options);
|
|
7809
|
-
default:
|
|
7810
|
-
throw new Error(`Unsupported token method: ${method}`);
|
|
7811
|
-
}
|
|
7812
|
-
}
|
|
7813
|
-
};
|
|
7814
|
-
|
|
7815
|
-
// src/services/getToken.ts
|
|
7816
|
-
async function getToken(env, scopes, clientId) {
|
|
7817
|
-
let provider = null;
|
|
7818
|
-
const options = {
|
|
7819
|
-
uamiClientId: clientId,
|
|
7820
|
-
scopes
|
|
7821
|
-
};
|
|
7822
|
-
if (clientId) {
|
|
7823
|
-
provider = TokenProviderFactory.createProvider(env, "managed_identity" /* ManagedIdentity */, options);
|
|
7824
|
-
} else {
|
|
7825
|
-
provider = TokenProviderFactory.createProvider(env, "msal_cache" /* MsalCache */, options);
|
|
7826
|
-
}
|
|
7827
|
-
const token = await provider.getAccessToken();
|
|
7828
|
-
return token;
|
|
7829
|
-
}
|
|
7830
|
-
|
|
7831
|
-
// src/utils/httpServiceUtils.ts
|
|
7832
|
-
async function getHttpService(env) {
|
|
7833
|
-
try {
|
|
7834
|
-
const accessToken = await getToken(env);
|
|
7835
|
-
return new import_common7.HttpService(
|
|
7836
|
-
import_axios.default.create({
|
|
7837
|
-
headers: {
|
|
7838
|
-
"Content-Type": "application/json",
|
|
7839
|
-
Authorization: `Bearer ${accessToken}`
|
|
7840
|
-
}
|
|
7841
|
-
})
|
|
7842
|
-
);
|
|
7843
|
-
} catch {
|
|
7844
|
-
throw new Error("Failed to retrieve access token");
|
|
7845
|
-
}
|
|
8381
|
+
var import_common14 = __toESM(require_src());
|
|
8382
|
+
function createJobApiClient(env, region) {
|
|
8383
|
+
const requestService = new import_common14.RequestService(noopTelemetry, buildApiHeaders);
|
|
8384
|
+
return new import_common14.JobApiClient({
|
|
8385
|
+
requestService,
|
|
8386
|
+
baseUrl: env.regions[region].gatewayEndpoint
|
|
8387
|
+
});
|
|
7846
8388
|
}
|
|
7847
8389
|
|
|
7848
8390
|
// src/commands/publishJob.ts
|
|
7849
8391
|
function addPublishCommand(jobCommand) {
|
|
7850
|
-
jobCommand.command("publish <notebookPath>").description("Publish a scheduled job.").option("-c, --config <path>", "Path to job YAML config").option("-r, --region <region>", "Target region (e.g. eastus2)",
|
|
8392
|
+
jobCommand.command("publish <notebookPath>").description("Publish a scheduled job.").option("-c, --config <path>", "Path to job YAML config").option("-r, --region <region>", "Target region (e.g. eastus2)", import_common15.Region.Global).action(async (notebookPath, options) => {
|
|
7851
8393
|
try {
|
|
7852
8394
|
const resolvedNotebookPath = import_path4.default.resolve(notebookPath);
|
|
7853
8395
|
const resolvedConfigPath = import_path4.default.resolve(options.config);
|
|
7854
|
-
const apiEnv4 = (0,
|
|
8396
|
+
const apiEnv4 = (0, import_common15.getApiEnv)(import_common15.SecurityPlatformEnvironment.Production);
|
|
7855
8397
|
const region = options.region;
|
|
7856
|
-
const
|
|
7857
|
-
const
|
|
7858
|
-
const result = await publish(resolvedNotebookPath, resolvedConfigPath,
|
|
8398
|
+
const accessToken = await getToken(apiEnv4);
|
|
8399
|
+
const jobApiClient = createJobApiClient(apiEnv4, region);
|
|
8400
|
+
const result = await publish(resolvedNotebookPath, resolvedConfigPath, jobApiClient, accessToken);
|
|
7859
8401
|
console.log("Published job:", result);
|
|
7860
8402
|
} catch (error) {
|
|
7861
|
-
|
|
7862
|
-
console.error("Publish Error:", error.message);
|
|
7863
|
-
} else {
|
|
7864
|
-
console.error("Unknown error in publish:", error);
|
|
7865
|
-
}
|
|
7866
|
-
process.exit(1);
|
|
8403
|
+
handleApiError("publishing job", error);
|
|
7867
8404
|
}
|
|
7868
8405
|
});
|
|
7869
8406
|
}
|
|
@@ -7876,17 +8413,76 @@ function addTokenCommand(program2) {
|
|
|
7876
8413
|
});
|
|
7877
8414
|
}
|
|
7878
8415
|
|
|
8416
|
+
// src/commands/updateCLI.ts
|
|
8417
|
+
init_cjs_shims();
|
|
8418
|
+
|
|
8419
|
+
// src/actions/updateCLI.ts
|
|
8420
|
+
init_cjs_shims();
|
|
8421
|
+
var import_axios = __toESM(require("axios"));
|
|
8422
|
+
var import_child_process2 = require("child_process");
|
|
8423
|
+
var os5 = __toESM(require("os"));
|
|
8424
|
+
var import_semver = __toESM(require("semver"));
|
|
8425
|
+
var PACKAGE_NAME = "@microsoft/sentinel-cli";
|
|
8426
|
+
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
8427
|
+
async function fetchLatestVersion() {
|
|
8428
|
+
const response = await import_axios.default.get(NPM_REGISTRY_URL, { timeout: 5e3 });
|
|
8429
|
+
return response.data.version;
|
|
8430
|
+
}
|
|
8431
|
+
function isNewerVersion(current, latest) {
|
|
8432
|
+
const c = import_semver.default.coerce(current);
|
|
8433
|
+
const l = import_semver.default.coerce(latest);
|
|
8434
|
+
if (!c || !l) {
|
|
8435
|
+
return false;
|
|
8436
|
+
}
|
|
8437
|
+
return import_semver.default.gt(l, c);
|
|
8438
|
+
}
|
|
8439
|
+
function runUpdateCommand(version) {
|
|
8440
|
+
const args = ["install", "-g", `${PACKAGE_NAME}@${version}`];
|
|
8441
|
+
(0, import_child_process2.execFileSync)("npm", args, { stdio: "inherit" });
|
|
8442
|
+
}
|
|
8443
|
+
async function checkAndUpdate(currentVersion) {
|
|
8444
|
+
console.log(`\u{1F50D} Current version: ${currentVersion}`);
|
|
8445
|
+
console.log("\u{1F310} Checking for latest version on npm...");
|
|
8446
|
+
const latestVersion = await fetchLatestVersion();
|
|
8447
|
+
if (!isNewerVersion(currentVersion, latestVersion)) {
|
|
8448
|
+
console.log(`\u2705 You are already on the latest version (${currentVersion}).`);
|
|
8449
|
+
return;
|
|
8450
|
+
}
|
|
8451
|
+
console.log(`\u{1F4E6} New version available: ${latestVersion}`);
|
|
8452
|
+
console.log(`\u2B06\uFE0F Updating from ${currentVersion} to ${latestVersion}...`);
|
|
8453
|
+
if (os5.platform() !== "win32") {
|
|
8454
|
+
console.log(
|
|
8455
|
+
"\u2139\uFE0F On macOS/Linux, you may need administrator privileges. If the update fails, try running with sudo."
|
|
8456
|
+
);
|
|
8457
|
+
}
|
|
8458
|
+
runUpdateCommand(latestVersion);
|
|
8459
|
+
console.log(`\u2705 Successfully updated to version ${latestVersion}.`);
|
|
8460
|
+
}
|
|
8461
|
+
|
|
8462
|
+
// src/commands/updateCLI.ts
|
|
8463
|
+
function addUpdateCliCommand(program2) {
|
|
8464
|
+
program2.command("update").description("Update the Sentinel CLI to the latest version").action(async () => {
|
|
8465
|
+
try {
|
|
8466
|
+
await checkAndUpdate("0.2.0");
|
|
8467
|
+
} catch (error) {
|
|
8468
|
+
console.error(`\u274C Update failed: ${error instanceof Error ? error.message : error}`);
|
|
8469
|
+
process.exitCode = 1;
|
|
8470
|
+
return;
|
|
8471
|
+
}
|
|
8472
|
+
});
|
|
8473
|
+
}
|
|
8474
|
+
|
|
7879
8475
|
// src/commands/validate.ts
|
|
7880
8476
|
init_cjs_shims();
|
|
7881
8477
|
|
|
7882
8478
|
// src/actions/validate.ts
|
|
7883
8479
|
init_cjs_shims();
|
|
7884
|
-
var
|
|
8480
|
+
var import_common16 = __toESM(require_src());
|
|
7885
8481
|
async function validateFromFile(filePath) {
|
|
7886
8482
|
if (!filePath || typeof filePath !== "string" || filePath.trim().length === 0) {
|
|
7887
8483
|
throw new Error("Invalid file path provided.");
|
|
7888
8484
|
}
|
|
7889
|
-
const manifestProcessorService = new
|
|
8485
|
+
const manifestProcessorService = new import_common16.ManifestProcessorService();
|
|
7890
8486
|
console.info("Starting validate process...");
|
|
7891
8487
|
await manifestProcessorService.validateManifest(filePath);
|
|
7892
8488
|
}
|
|
@@ -7916,12 +8512,25 @@ function registerCommands(program2) {
|
|
|
7916
8512
|
const packageCommand = program2.command("package").description("Manage packages");
|
|
7917
8513
|
addCreateZipCommand(packageCommand);
|
|
7918
8514
|
addValidateCommand(packageCommand);
|
|
8515
|
+
const databaseCommand = program2.command("database").description("Manage sentinel lake databases");
|
|
8516
|
+
addDatabaseCommand(databaseCommand);
|
|
8517
|
+
const tableCommand = program2.command("table").description("Manage sentinel lake tables");
|
|
8518
|
+
addLakeTableListCommand(tableCommand);
|
|
8519
|
+
addLakeTableShowCommand(tableCommand);
|
|
7919
8520
|
loginCommand(program2);
|
|
7920
8521
|
logoutCommand(program2);
|
|
7921
8522
|
addTokenCommand(program2);
|
|
8523
|
+
addUpdateCliCommand(program2);
|
|
7922
8524
|
}
|
|
7923
8525
|
|
|
7924
8526
|
// src/index.ts
|
|
7925
|
-
import_commander.program.name("sentinel").description("CLI
|
|
8527
|
+
import_commander.program.name("sentinel").description("Sentinel CLI \u2014 manage lake tables, databases, scheduled jobs, packages, and authentication").version("0.2.0");
|
|
7926
8528
|
registerCommands(import_commander.program);
|
|
7927
|
-
|
|
8529
|
+
(async () => {
|
|
8530
|
+
try {
|
|
8531
|
+
await import_commander.program.parseAsync(process.argv);
|
|
8532
|
+
process.exit(0);
|
|
8533
|
+
} catch {
|
|
8534
|
+
process.exit(1);
|
|
8535
|
+
}
|
|
8536
|
+
})();
|