@intuned/runtime-dev 1.3.17-ws.0 → 1.3.18-dev.2
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/.babelrc +6 -0
- package/CHANGELOG.md +1 -1
- package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
- package/InterfaceTemplate/index.playwright.ts +1 -1
- package/bin/intuned +0 -0
- package/bin/intuned-interface +7 -0
- package/dist/commands/api/run.js +7 -11
- package/dist/commands/auth-sessions/load.js +2 -2
- package/dist/commands/auth-sessions/run-check.js +8 -8
- package/dist/commands/auth-sessions/run-create.js +6 -6
- package/dist/commands/build.js +2 -3
- package/dist/commands/common/browserUtils.d.ts +3 -3
- package/dist/commands/common/browserUtils.js +3 -4
- package/dist/commands/common/getFirstLineNumber.test.js +1 -2
- package/dist/commands/common/projectExclusions.js +1 -1
- package/dist/commands/common/tsNodeImport.d.ts +1 -1
- package/dist/commands/common/tsNodeImport.js +10 -2
- package/dist/commands/common/utils/fileUtils.js +1 -2
- package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
- package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
- package/dist/commands/common/utils/template.js +1 -2
- package/dist/commands/interface/run.js +23 -49
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -2
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +13 -9
- package/dist/commands/intuned-cli/commands/index.d.ts +2 -2
- package/dist/commands/intuned-cli/commands/index.js +15 -15
- package/dist/commands/intuned-cli/commands/{save.command.d.ts → provision.command.d.ts} +3 -3
- package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +8 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +2 -2
- package/dist/commands/intuned-cli/commands/types.d.ts +9 -1
- package/dist/commands/intuned-cli/commands/types.js +9 -5
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +30 -19
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +140 -77
- package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/api.js +6 -3
- package/dist/commands/intuned-cli/controller/authSession.d.ts +16 -16
- package/dist/commands/intuned-cli/controller/authSession.js +50 -39
- package/dist/commands/intuned-cli/controller/build.js +1 -2
- package/dist/commands/intuned-cli/controller/deploy.js +53 -12
- package/dist/commands/intuned-cli/controller/index.js +2 -3
- package/dist/commands/intuned-cli/controller/{save.d.ts → provision.d.ts} +5 -1
- package/dist/commands/intuned-cli/controller/provision.js +299 -0
- package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +45 -5
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +4 -3
- package/dist/commands/intuned-cli/helpers/api.js +4 -7
- package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/auth.js +24 -21
- package/dist/commands/intuned-cli/helpers/backend.js +12 -4
- package/dist/commands/intuned-cli/helpers/browser.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/browser.js +40 -5
- package/dist/commands/intuned-cli/helpers/context.js +2 -2
- package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.js +2 -2
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
- package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
- package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
- package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/wrapper.js +14 -4
- package/dist/commands/intuned-cli/main.js +1 -2
- package/dist/commands/intuned-cli/types.d.ts +41 -12
- package/dist/commands/intuned-cli/types.js +12 -2
- package/dist/commands/ts-check.js +1 -2
- package/dist/common/backendFunctions/getAuthSessionParameters.js +1 -1
- package/dist/common/binStartupScript.js +1 -2
- package/dist/common/browserTabs.d.ts +72 -0
- package/dist/common/browserTabs.js +74 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/contextStorageStateHelpers.d.ts +4 -3
- package/dist/common/contextStorageStateHelpers.js +4 -1
- package/dist/common/extension/extensionsHelpers.d.ts +1 -1
- package/dist/common/extension/types.d.ts +14 -7
- package/dist/common/formatZodError.d.ts +1 -1
- package/dist/common/intunedJson.d.ts +19 -14
- package/dist/common/intunedJson.js +4 -4
- package/dist/common/jwtTokenManager.js +10 -6
- package/dist/common/launchBrowser.d.ts +10 -0
- package/dist/common/launchBrowser.js +67 -7
- package/dist/common/playwrightContext.d.ts +5 -5
- package/dist/common/playwrightContext.js +24 -14
- package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
- package/dist/common/runApi/importUsingImportFunction.js +7 -7
- package/dist/common/runApi/index.d.ts +3 -6
- package/dist/common/runApi/index.js +28 -52
- package/dist/common/settingsSchema.d.ts +52 -45
- package/dist/common/settingsSchema.js +3 -3
- package/dist/common/setupContextHook.d.ts +1 -2
- package/dist/common/setupContextHook.js +2 -2
- package/dist/common/telemetry.js +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -7
- package/dist/runtime/downloadDirectory.js +2 -2
- package/dist/vendor/runtime-interface.d.ts +1 -0
- package/dist/vendor/runtime-interface.js +493 -0
- package/package.json +19 -11
- package/tsup.config.ts +12 -0
- package/WebTemplate.zip +0 -0
- package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/init.command.js +0 -13
- package/dist/commands/intuned-cli/commands/save.command.js +0 -42
- package/dist/commands/intuned-cli/controller/save.js +0 -357
- package/dist/common/runApi/errors.d.ts +0 -72
- package/dist/common/runApi/errors.js +0 -169
- package/dist/common/runApi/types.d.ts +0 -830
- package/dist/common/runApi/types.js +0 -73
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// ../packages/runtime-interface/dist/errors.js
|
|
30
|
+
var require_errors = __commonJS({
|
|
31
|
+
"../packages/runtime-interface/dist/errors.js"(exports2) {
|
|
32
|
+
"use strict";
|
|
33
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
34
|
+
exports2.ResultTooBigError = exports2.InternalInvalidInputError = exports2.AutomationError = exports2.MaxLevelsExceededError = exports2.AuthCheckFailedError = exports2.AuthCheckNotFoundError = exports2.AuthRequiredError = exports2.AbortedError = exports2.InvalidCheckError = exports2.InvalidApiError = exports2.ApiNotFoundError = exports2.RunAutomationError = exports2.runAutomationErrorCodes = exports2.resultTooBigErrorCode = exports2.internalInvalidInputErrorCode = exports2.automationError = exports2.maxLevelsExceededErrorCode = exports2.authCheckFailedErrorCode = exports2.authCheckNotFoundErrorCode = exports2.authRequiredErrorCode = exports2.abortedErrorCode = exports2.invalidCheckErrorCode = exports2.invalidApiErrorCode = exports2.apiNotFoundErrorCode = void 0;
|
|
35
|
+
exports2.apiNotFoundErrorCode = "APINotFoundError";
|
|
36
|
+
exports2.invalidApiErrorCode = "InvalidAPIError";
|
|
37
|
+
exports2.invalidCheckErrorCode = "InvalidCheckError";
|
|
38
|
+
exports2.abortedErrorCode = "AbortedError";
|
|
39
|
+
exports2.authRequiredErrorCode = "AuthRequiredError";
|
|
40
|
+
exports2.authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
|
|
41
|
+
exports2.authCheckFailedErrorCode = "AuthCheckFailedError";
|
|
42
|
+
exports2.maxLevelsExceededErrorCode = "MaxLevelsExceededError";
|
|
43
|
+
exports2.automationError = "AutomationError";
|
|
44
|
+
exports2.internalInvalidInputErrorCode = "InternalInvalidInputError";
|
|
45
|
+
exports2.resultTooBigErrorCode = "ResultTooBigError";
|
|
46
|
+
exports2.runAutomationErrorCodes = [
|
|
47
|
+
exports2.apiNotFoundErrorCode,
|
|
48
|
+
exports2.invalidApiErrorCode,
|
|
49
|
+
exports2.invalidCheckErrorCode,
|
|
50
|
+
exports2.abortedErrorCode,
|
|
51
|
+
exports2.authRequiredErrorCode,
|
|
52
|
+
exports2.authCheckNotFoundErrorCode,
|
|
53
|
+
exports2.authCheckFailedErrorCode,
|
|
54
|
+
exports2.maxLevelsExceededErrorCode,
|
|
55
|
+
exports2.automationError,
|
|
56
|
+
exports2.internalInvalidInputErrorCode,
|
|
57
|
+
exports2.resultTooBigErrorCode
|
|
58
|
+
];
|
|
59
|
+
var RunAutomationError = class {
|
|
60
|
+
constructor(code, message) {
|
|
61
|
+
this.code = code;
|
|
62
|
+
this.message = message;
|
|
63
|
+
}
|
|
64
|
+
get json() {
|
|
65
|
+
return {
|
|
66
|
+
code: this.code,
|
|
67
|
+
details: this.details,
|
|
68
|
+
cause: this.cause?.json
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports2.RunAutomationError = RunAutomationError;
|
|
73
|
+
var ApiNotFoundError = class extends RunAutomationError {
|
|
74
|
+
constructor(apiName) {
|
|
75
|
+
super(exports2.apiNotFoundErrorCode, `API ${apiName} not found`);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports2.ApiNotFoundError = ApiNotFoundError;
|
|
79
|
+
var InvalidApiError = class extends RunAutomationError {
|
|
80
|
+
constructor(message) {
|
|
81
|
+
super(exports2.invalidApiErrorCode, `API is invalid: ${message}`);
|
|
82
|
+
this.details = {
|
|
83
|
+
message
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports2.InvalidApiError = InvalidApiError;
|
|
88
|
+
var InvalidCheckError = class extends RunAutomationError {
|
|
89
|
+
constructor(message, cause) {
|
|
90
|
+
super(exports2.invalidCheckErrorCode, message);
|
|
91
|
+
this.cause = cause;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports2.InvalidCheckError = InvalidCheckError;
|
|
95
|
+
var AbortedError = class extends RunAutomationError {
|
|
96
|
+
constructor() {
|
|
97
|
+
super(exports2.abortedErrorCode, "Operation was aborted");
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports2.AbortedError = AbortedError;
|
|
101
|
+
var AuthRequiredError = class extends RunAutomationError {
|
|
102
|
+
constructor() {
|
|
103
|
+
super(exports2.authRequiredErrorCode, "AuthSessions are required");
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
exports2.AuthRequiredError = AuthRequiredError;
|
|
107
|
+
var AuthCheckNotFoundError = class extends RunAutomationError {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(exports2.authCheckNotFoundErrorCode, "AuthSession check not found");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
exports2.AuthCheckNotFoundError = AuthCheckNotFoundError;
|
|
113
|
+
var AuthCheckFailedError = class extends RunAutomationError {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(exports2.authCheckFailedErrorCode, "AuthSession check failed");
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports2.AuthCheckFailedError = AuthCheckFailedError;
|
|
119
|
+
var MaxLevelsExceededError = class extends RunAutomationError {
|
|
120
|
+
constructor(levels) {
|
|
121
|
+
super(exports2.maxLevelsExceededErrorCode, `Max levels exceeded. Only ${levels} levels are supported`);
|
|
122
|
+
this.details = { levels };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
exports2.MaxLevelsExceededError = MaxLevelsExceededError;
|
|
126
|
+
var AutomationError = class extends RunAutomationError {
|
|
127
|
+
constructor(error) {
|
|
128
|
+
super(exports2.automationError, `[${error?.name ?? error}] ${error?.message}`);
|
|
129
|
+
this.details = {
|
|
130
|
+
...error,
|
|
131
|
+
name: error?.name,
|
|
132
|
+
stack: error?.stack,
|
|
133
|
+
message: error?.message,
|
|
134
|
+
statusCode: error?.statusCode,
|
|
135
|
+
errorCode: error?.code
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports2.AutomationError = AutomationError;
|
|
140
|
+
var InternalInvalidInputError = class extends RunAutomationError {
|
|
141
|
+
constructor(message, details) {
|
|
142
|
+
super(exports2.internalInvalidInputErrorCode, message);
|
|
143
|
+
this.details = details;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
exports2.InternalInvalidInputError = InternalInvalidInputError;
|
|
147
|
+
var ResultTooBigError = class extends RunAutomationError {
|
|
148
|
+
constructor(sizeInBytes, maxSizeInBytes) {
|
|
149
|
+
super(exports2.resultTooBigErrorCode, `Automation result is too big. Size: ${Math.round(sizeInBytes / 1024 / 1024 * 100) / 100}MB, Max allowed: ${Math.round(maxSizeInBytes / 1024 / 1024 * 100) / 100}MB`);
|
|
150
|
+
this.details = { sizeInBytes, maxSizeInBytes };
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
exports2.ResultTooBigError = ResultTooBigError;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// ../packages/runtime-interface/dist/types.js
|
|
158
|
+
var require_types = __commonJS({
|
|
159
|
+
"../packages/runtime-interface/dist/types.js"(exports2) {
|
|
160
|
+
"use strict";
|
|
161
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
162
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
163
|
+
};
|
|
164
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
165
|
+
exports2.outputRunApiSchema = exports2.pongMessageSchema = exports2.doneMessageSchema = exports2.extendMessageSchema = exports2.runApiInputSchema = exports2.pingSchema = exports2.tokenUpdateSchema = exports2.abortRunApiSchema = exports2.startRunApiSchema = exports2.startRunApiParametersSchema = exports2.runApiParametersSchema = exports2.runApiRunOptionsSchema = exports2.runApiCdpRunOptionsSchema = exports2.runApiStandaloneRunOptionsSchema = exports2.runApiAuthSchema = exports2.runApiTracingSchema = exports2.runApiAutomationFunctionSchema = exports2.runApiSessionSchema = exports2.runApiStorageStateSchema = void 0;
|
|
166
|
+
exports2.runApiResultOkSchema = runApiResultOkSchema;
|
|
167
|
+
exports2.runApiResultWithSessionOkSchema = runApiResultWithSessionOkSchema;
|
|
168
|
+
var zod_1 = __importDefault(require("zod"));
|
|
169
|
+
exports2.runApiStorageStateSchema = zod_1.default.object({
|
|
170
|
+
cookies: zod_1.default.array(zod_1.default.object({
|
|
171
|
+
name: zod_1.default.string(),
|
|
172
|
+
value: zod_1.default.string(),
|
|
173
|
+
domain: zod_1.default.string(),
|
|
174
|
+
path: zod_1.default.string(),
|
|
175
|
+
expires: zod_1.default.number(),
|
|
176
|
+
httpOnly: zod_1.default.boolean(),
|
|
177
|
+
secure: zod_1.default.boolean(),
|
|
178
|
+
sameSite: zod_1.default.enum(["Strict", "Lax", "None"])
|
|
179
|
+
})),
|
|
180
|
+
origins: zod_1.default.array(zod_1.default.object({
|
|
181
|
+
origin: zod_1.default.string(),
|
|
182
|
+
localStorage: zod_1.default.array(zod_1.default.object({
|
|
183
|
+
name: zod_1.default.string(),
|
|
184
|
+
value: zod_1.default.string()
|
|
185
|
+
}))
|
|
186
|
+
})),
|
|
187
|
+
sessionStorage: zod_1.default.array(zod_1.default.object({
|
|
188
|
+
origin: zod_1.default.string(),
|
|
189
|
+
sessionStorage: zod_1.default.array(zod_1.default.object({
|
|
190
|
+
name: zod_1.default.string(),
|
|
191
|
+
value: zod_1.default.string()
|
|
192
|
+
}))
|
|
193
|
+
})).optional()
|
|
194
|
+
});
|
|
195
|
+
exports2.runApiSessionSchema = zod_1.default.discriminatedUnion("type", [
|
|
196
|
+
zod_1.default.object({
|
|
197
|
+
type: zod_1.default.literal("file"),
|
|
198
|
+
path: zod_1.default.string()
|
|
199
|
+
}),
|
|
200
|
+
zod_1.default.object({
|
|
201
|
+
type: zod_1.default.literal("state"),
|
|
202
|
+
state: exports2.runApiStorageStateSchema.nullable().optional()
|
|
203
|
+
})
|
|
204
|
+
]);
|
|
205
|
+
exports2.runApiAutomationFunctionSchema = zod_1.default.object({
|
|
206
|
+
name: zod_1.default.string(),
|
|
207
|
+
params: zod_1.default.any().optional()
|
|
208
|
+
});
|
|
209
|
+
exports2.runApiTracingSchema = zod_1.default.discriminatedUnion("enabled", [
|
|
210
|
+
zod_1.default.object({ enabled: zod_1.default.literal(false) }),
|
|
211
|
+
zod_1.default.object({ enabled: zod_1.default.literal(true), filePath: zod_1.default.string() })
|
|
212
|
+
]).optional().default({ enabled: false });
|
|
213
|
+
exports2.runApiAuthSchema = zod_1.default.object({
|
|
214
|
+
session: exports2.runApiSessionSchema,
|
|
215
|
+
parameters: zod_1.default.record(zod_1.default.any()).optional()
|
|
216
|
+
}).optional();
|
|
217
|
+
exports2.runApiStandaloneRunOptionsSchema = zod_1.default.object({
|
|
218
|
+
environment: zod_1.default.literal("standalone"),
|
|
219
|
+
headless: zod_1.default.boolean().default(true),
|
|
220
|
+
proxy: zod_1.default.object({
|
|
221
|
+
server: zod_1.default.string(),
|
|
222
|
+
username: zod_1.default.string(),
|
|
223
|
+
password: zod_1.default.string()
|
|
224
|
+
}).optional(),
|
|
225
|
+
ignoreHttpErrors: zod_1.default.boolean().optional()
|
|
226
|
+
});
|
|
227
|
+
exports2.runApiCdpRunOptionsSchema = zod_1.default.object({
|
|
228
|
+
environment: zod_1.default.literal("cdp"),
|
|
229
|
+
cdpAddress: zod_1.default.string(),
|
|
230
|
+
cdpTargetId: zod_1.default.string().optional(),
|
|
231
|
+
ignoreHttpErrors: zod_1.default.boolean().optional()
|
|
232
|
+
});
|
|
233
|
+
exports2.runApiRunOptionsSchema = zod_1.default.discriminatedUnion("environment", [
|
|
234
|
+
exports2.runApiStandaloneRunOptionsSchema,
|
|
235
|
+
exports2.runApiCdpRunOptionsSchema
|
|
236
|
+
]).default({ environment: "standalone", headless: true });
|
|
237
|
+
exports2.runApiParametersSchema = zod_1.default.object({
|
|
238
|
+
automationFunction: exports2.runApiAutomationFunctionSchema,
|
|
239
|
+
tracing: exports2.runApiTracingSchema,
|
|
240
|
+
auth: exports2.runApiAuthSchema,
|
|
241
|
+
runOptions: exports2.runApiRunOptionsSchema,
|
|
242
|
+
retrieveSession: zod_1.default.boolean().default(false)
|
|
243
|
+
});
|
|
244
|
+
function runApiResultOkSchema(resultSchema) {
|
|
245
|
+
return zod_1.default.object({
|
|
246
|
+
result: resultSchema,
|
|
247
|
+
extendedPayloads: zod_1.default.array(zod_1.default.object({
|
|
248
|
+
api: zod_1.default.string(),
|
|
249
|
+
parameters: zod_1.default.record(zod_1.default.any())
|
|
250
|
+
})).optional()
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function runApiResultWithSessionOkSchema(resultSchema) {
|
|
254
|
+
return runApiResultOkSchema(resultSchema).extend({
|
|
255
|
+
session: exports2.runApiStorageStateSchema
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
exports2.startRunApiParametersSchema = exports2.runApiParametersSchema.extend({
|
|
259
|
+
retrieveSession: zod_1.default.boolean(),
|
|
260
|
+
functionsToken: zod_1.default.string().optional(),
|
|
261
|
+
context: zod_1.default.object({
|
|
262
|
+
jobId: zod_1.default.string().optional(),
|
|
263
|
+
jobRunId: zod_1.default.string().optional(),
|
|
264
|
+
runId: zod_1.default.string().optional(),
|
|
265
|
+
authSessionId: zod_1.default.string().optional()
|
|
266
|
+
}).optional()
|
|
267
|
+
});
|
|
268
|
+
exports2.startRunApiSchema = zod_1.default.object({
|
|
269
|
+
type: zod_1.default.literal("start"),
|
|
270
|
+
parameters: exports2.startRunApiParametersSchema
|
|
271
|
+
});
|
|
272
|
+
exports2.abortRunApiSchema = zod_1.default.object({
|
|
273
|
+
type: zod_1.default.literal("abort"),
|
|
274
|
+
parameters: zod_1.default.object({}).optional()
|
|
275
|
+
});
|
|
276
|
+
exports2.tokenUpdateSchema = zod_1.default.object({
|
|
277
|
+
type: zod_1.default.literal("tokenUpdate"),
|
|
278
|
+
parameters: zod_1.default.object({
|
|
279
|
+
functionsToken: zod_1.default.string()
|
|
280
|
+
})
|
|
281
|
+
});
|
|
282
|
+
exports2.pingSchema = zod_1.default.object({
|
|
283
|
+
type: zod_1.default.literal("ping"),
|
|
284
|
+
parameters: zod_1.default.object({}).optional()
|
|
285
|
+
});
|
|
286
|
+
exports2.runApiInputSchema = zod_1.default.union([
|
|
287
|
+
exports2.startRunApiSchema,
|
|
288
|
+
exports2.abortRunApiSchema,
|
|
289
|
+
exports2.tokenUpdateSchema,
|
|
290
|
+
exports2.pingSchema
|
|
291
|
+
]);
|
|
292
|
+
exports2.extendMessageSchema = zod_1.default.object({ type: zod_1.default.literal("extend") });
|
|
293
|
+
exports2.doneMessageSchema = zod_1.default.object({
|
|
294
|
+
type: zod_1.default.literal("done"),
|
|
295
|
+
result: zod_1.default.any(),
|
|
296
|
+
success: zod_1.default.boolean()
|
|
297
|
+
});
|
|
298
|
+
exports2.pongMessageSchema = zod_1.default.object({
|
|
299
|
+
type: zod_1.default.literal("pong")
|
|
300
|
+
});
|
|
301
|
+
exports2.outputRunApiSchema = zod_1.default.union([
|
|
302
|
+
exports2.extendMessageSchema,
|
|
303
|
+
exports2.doneMessageSchema,
|
|
304
|
+
exports2.pongMessageSchema
|
|
305
|
+
]);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// ../packages/runtime-interface/dist/interfaceClient.js
|
|
310
|
+
var require_interfaceClient = __commonJS({
|
|
311
|
+
"../packages/runtime-interface/dist/interfaceClient.js"(exports2) {
|
|
312
|
+
"use strict";
|
|
313
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
314
|
+
if (k2 === void 0) k2 = k;
|
|
315
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
316
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
317
|
+
desc = { enumerable: true, get: function() {
|
|
318
|
+
return m[k];
|
|
319
|
+
} };
|
|
320
|
+
}
|
|
321
|
+
Object.defineProperty(o, k2, desc);
|
|
322
|
+
}) : (function(o, m, k, k2) {
|
|
323
|
+
if (k2 === void 0) k2 = k;
|
|
324
|
+
o[k2] = m[k];
|
|
325
|
+
}));
|
|
326
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
327
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
328
|
+
}) : function(o, v) {
|
|
329
|
+
o["default"] = v;
|
|
330
|
+
});
|
|
331
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
332
|
+
var ownKeys = function(o) {
|
|
333
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
334
|
+
var ar = [];
|
|
335
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
336
|
+
return ar;
|
|
337
|
+
};
|
|
338
|
+
return ownKeys(o);
|
|
339
|
+
};
|
|
340
|
+
return function(mod) {
|
|
341
|
+
if (mod && mod.__esModule) return mod;
|
|
342
|
+
var result = {};
|
|
343
|
+
if (mod != null) {
|
|
344
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
345
|
+
}
|
|
346
|
+
__setModuleDefault(result, mod);
|
|
347
|
+
return result;
|
|
348
|
+
};
|
|
349
|
+
})();
|
|
350
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
351
|
+
exports2.JSONLFileClient = exports2.TCPSocketClient = exports2.UnixSocketClient = exports2.SocketClient = void 0;
|
|
352
|
+
var fs = __importStar(require("fs-extra"));
|
|
353
|
+
var net = __importStar(require("net"));
|
|
354
|
+
var readline_1 = require("readline");
|
|
355
|
+
var promises_1 = require("timers/promises");
|
|
356
|
+
var SocketClient = class _SocketClient {
|
|
357
|
+
constructor(socket) {
|
|
358
|
+
this.socket = socket;
|
|
359
|
+
}
|
|
360
|
+
sendJSON(data) {
|
|
361
|
+
const dataToSend = JSON.stringify(data);
|
|
362
|
+
const length = Buffer.byteLength(dataToSend);
|
|
363
|
+
const buffer = Buffer.alloc(_SocketClient.LENGTH_HEADER_LENGTH + length);
|
|
364
|
+
buffer.writeUInt32BE(length, 0);
|
|
365
|
+
buffer.write(dataToSend, _SocketClient.LENGTH_HEADER_LENGTH);
|
|
366
|
+
this.socket.write(buffer);
|
|
367
|
+
}
|
|
368
|
+
async *receiveJSON() {
|
|
369
|
+
let buffer = Buffer.alloc(0);
|
|
370
|
+
const endPromise = new Promise((resolve, reject) => {
|
|
371
|
+
this.socket.once("end", () => {
|
|
372
|
+
resolve();
|
|
373
|
+
});
|
|
374
|
+
this.socket.once("error", reject);
|
|
375
|
+
});
|
|
376
|
+
while (true) {
|
|
377
|
+
const chunk = await Promise.race([
|
|
378
|
+
new Promise((resolve) => this.socket.once("data", (data2) => {
|
|
379
|
+
if (typeof data2 === "string") {
|
|
380
|
+
return resolve(Buffer.from(data2));
|
|
381
|
+
}
|
|
382
|
+
resolve(data2);
|
|
383
|
+
})),
|
|
384
|
+
endPromise
|
|
385
|
+
]);
|
|
386
|
+
if (!(chunk instanceof Buffer)) {
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
buffer = Buffer.concat([buffer, chunk]);
|
|
390
|
+
if (buffer.length < _SocketClient.LENGTH_HEADER_LENGTH) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
const length = buffer.readUInt32BE(0);
|
|
394
|
+
if (buffer.length < length + _SocketClient.LENGTH_HEADER_LENGTH) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
const data = buffer.subarray(_SocketClient.LENGTH_HEADER_LENGTH, length + _SocketClient.LENGTH_HEADER_LENGTH);
|
|
398
|
+
buffer = buffer.subarray(length + _SocketClient.LENGTH_HEADER_LENGTH);
|
|
399
|
+
yield JSON.parse(data.toString());
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
async close() {
|
|
403
|
+
this.socket.end();
|
|
404
|
+
await Promise.race([
|
|
405
|
+
new Promise((resolve) => this.socket.once("close", resolve)),
|
|
406
|
+
new Promise((resolve) => this.socket.once("error", resolve)),
|
|
407
|
+
(0, promises_1.setTimeout)(3e3)
|
|
408
|
+
]);
|
|
409
|
+
}
|
|
410
|
+
get closed() {
|
|
411
|
+
return this.socket.closed;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
exports2.SocketClient = SocketClient;
|
|
415
|
+
SocketClient.LENGTH_HEADER_LENGTH = 4;
|
|
416
|
+
var UnixSocketClient = class extends SocketClient {
|
|
417
|
+
constructor(path) {
|
|
418
|
+
super(net.createConnection(path));
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
exports2.UnixSocketClient = UnixSocketClient;
|
|
422
|
+
var TCPSocketClient = class extends SocketClient {
|
|
423
|
+
constructor(host, port) {
|
|
424
|
+
super(net.createConnection(port, host));
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
exports2.TCPSocketClient = TCPSocketClient;
|
|
428
|
+
var JSONLFileClient = class {
|
|
429
|
+
constructor(filePath) {
|
|
430
|
+
this.fileStream = fs.createReadStream(filePath, { encoding: "utf-8" });
|
|
431
|
+
}
|
|
432
|
+
sendJSON(data) {
|
|
433
|
+
console.log("Sending message", data);
|
|
434
|
+
}
|
|
435
|
+
async *receiveJSON() {
|
|
436
|
+
const rl = (0, readline_1.createInterface)({
|
|
437
|
+
input: this.fileStream,
|
|
438
|
+
crlfDelay: Infinity
|
|
439
|
+
});
|
|
440
|
+
for await (const line of rl) {
|
|
441
|
+
if (line.trim() === "") {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
yield JSON.parse(line);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async close() {
|
|
448
|
+
this.fileStream.close();
|
|
449
|
+
await Promise.race([
|
|
450
|
+
new Promise((resolve) => this.fileStream.once("close", resolve)),
|
|
451
|
+
new Promise((resolve) => this.fileStream.once("error", resolve)),
|
|
452
|
+
(0, promises_1.setTimeout)(3e3)
|
|
453
|
+
]);
|
|
454
|
+
}
|
|
455
|
+
get closed() {
|
|
456
|
+
return this.fileStream.closed;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
exports2.JSONLFileClient = JSONLFileClient;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// ../packages/runtime-interface/dist/index.js
|
|
464
|
+
var require_dist = __commonJS({
|
|
465
|
+
"../packages/runtime-interface/dist/index.js"(exports2) {
|
|
466
|
+
"use strict";
|
|
467
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
468
|
+
if (k2 === void 0) k2 = k;
|
|
469
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
470
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
471
|
+
desc = { enumerable: true, get: function() {
|
|
472
|
+
return m[k];
|
|
473
|
+
} };
|
|
474
|
+
}
|
|
475
|
+
Object.defineProperty(o, k2, desc);
|
|
476
|
+
}) : (function(o, m, k, k2) {
|
|
477
|
+
if (k2 === void 0) k2 = k;
|
|
478
|
+
o[k2] = m[k];
|
|
479
|
+
}));
|
|
480
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
481
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
482
|
+
};
|
|
483
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
484
|
+
__exportStar(require_errors(), exports2);
|
|
485
|
+
__exportStar(require_types(), exports2);
|
|
486
|
+
__exportStar(require_interfaceClient(), exports2);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// src/vendor/runtime-interface.ts
|
|
491
|
+
var runtime_interface_exports = {};
|
|
492
|
+
module.exports = __toCommonJS(runtime_interface_exports);
|
|
493
|
+
__reExport(runtime_interface_exports, __toESM(require_dist()), module.exports);
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.18-dev.2",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
|
+
"packageManager": "yarn@4.12.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
5
8
|
"exports": {
|
|
6
9
|
".": "./dist/index.js",
|
|
7
10
|
"./dist/runtime": "./dist/runtime/index.js",
|
|
@@ -14,10 +17,11 @@
|
|
|
14
17
|
"./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
|
|
15
18
|
"./dist/common/constants": "./dist/common/constants.js",
|
|
16
19
|
"./dist/commands/interface/run": "./dist/commands/interface/run.js",
|
|
20
|
+
"./interface": "./dist/commands/interface/index.js",
|
|
17
21
|
"./dist/commands/intuned-run/intuned-run": "./dist/commands/intuned-run/intuned-run.js",
|
|
18
|
-
"./dist/common/binStartupScript": "./dist/common/binStartupScript.js"
|
|
22
|
+
"./dist/common/binStartupScript": "./dist/common/binStartupScript.js",
|
|
23
|
+
"./dist/commands/common/utils/interfaceClient": "./dist/commands/common/utils/interfaceClient.js"
|
|
19
24
|
},
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
25
|
"author": "Intuned Team",
|
|
22
26
|
"license": "Elastic-2.0",
|
|
23
27
|
"scripts": {
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
"intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
|
|
32
36
|
"intuned": "vite-node ./src/commands/intuned-cli/main.ts",
|
|
33
37
|
"intuned-get-headless-user-agent": "vite-node ./src/commands/get-headless-user-agent.ts",
|
|
34
|
-
"build": "rm -rf dist && tsc -p tsconfig.json
|
|
38
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && tsup && cp -r ./src/common/assets dist/common/assets",
|
|
35
39
|
"test": "vitest run",
|
|
36
40
|
"test:watch": "vitest",
|
|
37
41
|
"e2e": "yarn playwright test --config ./playwright.config.ts",
|
|
@@ -43,16 +47,17 @@
|
|
|
43
47
|
"copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
|
|
44
48
|
},
|
|
45
49
|
"bin": {
|
|
50
|
+
"intuned": "bin/intuned",
|
|
46
51
|
"intuned-api-run": "bin/intuned-api-run",
|
|
52
|
+
"intuned-auth-session-check": "bin/intuned-auth-session-check",
|
|
47
53
|
"intuned-auth-session-create": "bin/intuned-auth-session-create",
|
|
48
54
|
"intuned-auth-session-load": "bin/intuned-auth-session-load",
|
|
49
|
-
"intuned-auth-session-check": "bin/intuned-auth-session-check",
|
|
50
|
-
"intuned-build": "bin/intuned-build",
|
|
51
|
-
"intuned-browser-start": "bin/intuned-browser-start",
|
|
52
55
|
"intuned-browser-save-state": "bin/intuned-browser-save-state",
|
|
53
|
-
"intuned-
|
|
56
|
+
"intuned-browser-start": "bin/intuned-browser-start",
|
|
57
|
+
"intuned-build": "bin/intuned-build",
|
|
54
58
|
"intuned-get-headless-user-agent": "bin/intuned-get-headless-user-agent",
|
|
55
|
-
"intuned": "bin/intuned"
|
|
59
|
+
"intuned-interface": "bin/intuned-interface",
|
|
60
|
+
"intuned-ts-check": "bin/intuned-ts-check"
|
|
56
61
|
},
|
|
57
62
|
"dependencies": {
|
|
58
63
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
@@ -72,16 +77,16 @@
|
|
|
72
77
|
"dotenv": "^16.3.1",
|
|
73
78
|
"fastify": "4.29.1",
|
|
74
79
|
"fs-extra": "^11.3.0",
|
|
80
|
+
"ignore": "^7.0.5",
|
|
75
81
|
"image-size": "^1.1.1",
|
|
76
82
|
"jsonc-parser": "^3.3.1",
|
|
77
83
|
"jsonwebtoken": "9.0.2",
|
|
78
84
|
"lodash": "4.17.21",
|
|
79
85
|
"milliparsec": "2.3.0",
|
|
80
|
-
"minimatch": "10.0.1",
|
|
81
86
|
"nanoid": "3",
|
|
82
87
|
"neverthrow": "6.1.0",
|
|
83
|
-
"playwright-extra": "4.3.6",
|
|
84
88
|
"portfinder": "^1.0.37",
|
|
89
|
+
"press-any-key": "^1.1.0",
|
|
85
90
|
"prettier": "2.8.0",
|
|
86
91
|
"promptly": "3.2.0",
|
|
87
92
|
"prompts": "^2.4.2",
|
|
@@ -105,6 +110,7 @@
|
|
|
105
110
|
"@babel/plugin-transform-export-namespace-from": "^7.24.1",
|
|
106
111
|
"@babel/preset-env": "^7.23.7",
|
|
107
112
|
"@babel/preset-typescript": "^7.23.3",
|
|
113
|
+
"@intuned/runtime-interface": "0.0.1",
|
|
108
114
|
"@jest/globals": "^29.6.2",
|
|
109
115
|
"@ngneat/falso": "^7.2.0",
|
|
110
116
|
"@types/jest": "^29.5.3",
|
|
@@ -118,6 +124,7 @@
|
|
|
118
124
|
"@typescript-eslint/parser": "^7.5.0",
|
|
119
125
|
"@vitest/ui": "^1.1.3",
|
|
120
126
|
"babel-plugin-macros": "^3.1.0",
|
|
127
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
121
128
|
"babel-preset-minify": "^0.5.2",
|
|
122
129
|
"copyfiles": "^2.4.1",
|
|
123
130
|
"dts-bundle-generator": "^8.0.1",
|
|
@@ -127,6 +134,7 @@
|
|
|
127
134
|
"eslint-plugin-prettier": "^4.2.1",
|
|
128
135
|
"msw": "^2.1.2",
|
|
129
136
|
"playwright": "^1.55.0",
|
|
137
|
+
"tsup": "^8.3.5",
|
|
130
138
|
"typedoc": "^0.25.13",
|
|
131
139
|
"typedoc-plugin-frontmatter": "^1.0.0",
|
|
132
140
|
"typedoc-plugin-markdown": "^4.0.2",
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
// bundle workspace dependencies
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
entry: ["src/vendor/runtime-interface.ts"],
|
|
6
|
+
format: ["cjs"],
|
|
7
|
+
dts: true,
|
|
8
|
+
outDir: "dist/vendor",
|
|
9
|
+
clean: false, // Don't clean - babel handles dist cleanup
|
|
10
|
+
sourcemap: false,
|
|
11
|
+
target: "node20",
|
|
12
|
+
});
|
package/WebTemplate.zip
DELETED
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const initCommand: import("commander").Command;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.initCommand = void 0;
|
|
7
|
-
var _command = require("./command");
|
|
8
|
-
var _helpers = require("../helpers");
|
|
9
|
-
const initCommand = exports.initCommand = _command.program.command("init").description("Deprecated: Initialize a new Intuned project").allowExcessArguments(true).allowUnknownOption(true).action((0, _helpers.cliCommandWrapper)(undefined, undefined, async () => {
|
|
10
|
-
throw new _helpers.CLIError("^r^+The init command has been deprecated. Please use^ ^c^/npx create-intuned-project^ ^r^+instead.^:", {
|
|
11
|
-
autoColor: false
|
|
12
|
-
});
|
|
13
|
-
}));
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.saveOrDeployOptionsSchema = exports.saveOrDeployArgsSchema = exports.saveCommand = void 0;
|
|
7
|
-
var _command = require("./command");
|
|
8
|
-
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
9
|
-
var _save = require("../controller/save");
|
|
10
|
-
var _helpers = require("../helpers");
|
|
11
|
-
var _zod = require("zod");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
_dotenv.default.config({
|
|
14
|
-
path: `.env`
|
|
15
|
-
});
|
|
16
|
-
const saveOrDeployArgsSchema = exports.saveOrDeployArgsSchema = _zod.z.tuple([_zod.z.union([_zod.z.string(), _zod.z.undefined()])]);
|
|
17
|
-
const saveOrDeployOptionsSchema = exports.saveOrDeployOptionsSchema = _zod.z.object({
|
|
18
|
-
workspaceId: _zod.z.string().optional(),
|
|
19
|
-
apiKey: _zod.z.string().optional()
|
|
20
|
-
});
|
|
21
|
-
const saveCommand = exports.saveCommand = _command.program.command("save").description("Save an Intuned project to the platform without deploying it").argument("[project-name]", "Name of the project to save").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action((0, _helpers.cliCommandWrapper)(saveOrDeployArgsSchema, saveOrDeployOptionsSchema, async ([projectName], options) => {
|
|
22
|
-
const {
|
|
23
|
-
isValid,
|
|
24
|
-
errorMessage
|
|
25
|
-
} = await (0, _save.validateIntunedProject)();
|
|
26
|
-
if (!isValid) {
|
|
27
|
-
const message = `^r^+Project to be saved is not a valid Intuned project:^:^R ${errorMessage}:\n`;
|
|
28
|
-
throw new _helpers.CLIError(message, {
|
|
29
|
-
autoColor: false
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName;
|
|
33
|
-
if (!_projectName) {
|
|
34
|
-
throw new _helpers.CLIError("Project name is required");
|
|
35
|
-
}
|
|
36
|
-
const projectNameValidation = (0, _save.validateProjectName)(_projectName);
|
|
37
|
-
if (!projectNameValidation.isValid) {
|
|
38
|
-
throw new _helpers.CLIError(projectNameValidation.errorMessage);
|
|
39
|
-
}
|
|
40
|
-
const auth = await (0, _helpers.getAuthCredentials)(options);
|
|
41
|
-
await (0, _save.runSaveProject)(_projectName, auth);
|
|
42
|
-
}));
|